From bd3acc73d8f079fef3155c955db25b6e70861f5e Mon Sep 17 00:00:00 2001 From: UselessBullets <80850784+UselessBullets@users.noreply.github.com> Date: Tue, 21 Nov 2023 01:29:13 -0600 Subject: [PATCH 01/10] Update BlockCoords.java --- src/main/java/turniplabs/halplibe/helper/BlockCoords.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/turniplabs/halplibe/helper/BlockCoords.java b/src/main/java/turniplabs/halplibe/helper/BlockCoords.java index 74d96ac..04eb875 100644 --- a/src/main/java/turniplabs/halplibe/helper/BlockCoords.java +++ b/src/main/java/turniplabs/halplibe/helper/BlockCoords.java @@ -17,7 +17,7 @@ public static int[] nextCoords() { lastX = 22; if (++lastY > Global.TEXTURE_ATLAS_WIDTH_TILES-1) { area = 1; - lastX = 7; + lastX = 10; lastY = 16; } } @@ -27,7 +27,7 @@ public static int[] nextCoords() { int x = lastX; int y = lastY; if (++lastX > 21) { - lastX = 7; + lastX = 10; if (++lastY > 30) { area = 2; lastX = 16; From 185e87e6fabf243d7fb54e5ab7574f3ede7c842d Mon Sep 17 00:00:00 2001 From: UselessBullets <80850784+UselessBullets@users.noreply.github.com> Date: Fri, 1 Dec 2023 15:59:24 -0600 Subject: [PATCH 02/10] Updating methods --- gradle.properties | 4 ++-- .../java/turniplabs/halplibe/HalpLibe.java | 5 ++--- .../halplibe/helper/ArmorHelper.java | 17 ++++++----------- .../halplibe/helper/BlockBuilder.java | 9 ++++++--- .../halplibe/helper/BlockHelper.java | 2 +- .../mixin/accessors/BlockAccessor.java | 13 ------------- .../mixin/accessors/RenderPlayerAccessor.java | 19 ------------------- .../util/achievements/GuiAchievements.java | 8 ++++---- src/main/resources/halplibe.mixins.json | 1 - 9 files changed, 21 insertions(+), 57 deletions(-) delete mode 100644 src/main/java/turniplabs/halplibe/mixin/accessors/RenderPlayerAccessor.java diff --git a/gradle.properties b/gradle.properties index 678834a..af3c2ea 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,13 +1,13 @@ org.gradle.jvmargs=-Xmx2G # BTA -bta_version=1.7.7.0_02 +bta_version=1.7.7.1 # Loader loader_version=0.14.19-babric.1-bta # Mod -mod_version=2.7.0 +mod_version=3.0.0 mod_group=turniplabs mod_name=halplibe diff --git a/src/main/java/turniplabs/halplibe/HalpLibe.java b/src/main/java/turniplabs/halplibe/HalpLibe.java index 76b9333..248d73a 100644 --- a/src/main/java/turniplabs/halplibe/HalpLibe.java +++ b/src/main/java/turniplabs/halplibe/HalpLibe.java @@ -2,7 +2,6 @@ import net.fabricmc.api.ModInitializer; import net.fabricmc.loader.api.entrypoint.PreLaunchEntrypoint; -import net.minecraft.core.Global; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import turniplabs.halplibe.helper.AchievementHelper; @@ -12,8 +11,8 @@ import turniplabs.halplibe.util.achievements.AchievementPage; import turniplabs.halplibe.util.achievements.VanillaAchievementsPage; import turniplabs.halplibe.util.network.PacketExtendedMobSpawn; -import turniplabs.halplibe.util.version.PacketModList; import turniplabs.halplibe.util.toml.Toml; +import turniplabs.halplibe.util.version.PacketModList; public class HalpLibe implements ModInitializer, PreLaunchEntrypoint { public static final String MOD_ID = "halplibe"; @@ -26,7 +25,7 @@ public class HalpLibe implements ModInitializer, PreLaunchEntrypoint { CONFIG = new TomlConfigHandler(MOD_ID, toml); - Global.TEXTURE_ATLAS_WIDTH_TILES = Math.max(32, CONFIG.getInt("Experimental.AtlasWidth")); + //Global.TEXTURE_ATLAS_WIDTH_TILES = Math.max(32, CONFIG.getInt("Experimental.AtlasWidth")); // Initialize Block and Item static fields try { Class.forName("net.minecraft.core.block.Block"); diff --git a/src/main/java/turniplabs/halplibe/helper/ArmorHelper.java b/src/main/java/turniplabs/halplibe/helper/ArmorHelper.java index 85c2db1..08fd9ce 100644 --- a/src/main/java/turniplabs/halplibe/helper/ArmorHelper.java +++ b/src/main/java/turniplabs/halplibe/helper/ArmorHelper.java @@ -2,8 +2,6 @@ import net.minecraft.core.item.material.ArmorMaterial; import net.minecraft.core.util.helper.DamageType; -import org.apache.commons.lang3.ArrayUtils; -import turniplabs.halplibe.mixin.accessors.RenderPlayerAccessor; public class ArmorHelper { @@ -19,15 +17,12 @@ public class ArmorHelper { * @return the new ArmorMaterial. */ public static ArmorMaterial createArmorMaterial(String textureName, int durability, float combat, float blast, float fire, float fall) { - String[] armorFilenamePrefix = RenderPlayerAccessor.getArmorFilenamePrefix(); - armorFilenamePrefix = ArrayUtils.add(armorFilenamePrefix, textureName); - RenderPlayerAccessor.setArmorFilenamePrefix(armorFilenamePrefix); - - ArmorMaterial armorMaterial = new ArmorMaterial(textureName, armorFilenamePrefix.length - 1, durability); - ArmorMaterial.setProtectionValuePercent(armorMaterial, DamageType.COMBAT, combat); - ArmorMaterial.setProtectionValuePercent(armorMaterial, DamageType.BLAST, blast); - ArmorMaterial.setProtectionValuePercent(armorMaterial, DamageType.FIRE, fire); - ArmorMaterial.setProtectionValuePercent(armorMaterial, DamageType.FALL, fall); + ArmorMaterial armorMaterial = new ArmorMaterial(textureName, ArmorMaterial.getArmorMaterials().size()-1, durability) + .withProtectionPercentage(DamageType.COMBAT, combat) + .withProtectionPercentage(DamageType.BLAST, blast) + .withProtectionPercentage(DamageType.FIRE, fire) + .withProtectionPercentage(DamageType.FALL, fall); + ArmorMaterial.register(armorMaterial); return armorMaterial; } diff --git a/src/main/java/turniplabs/halplibe/helper/BlockBuilder.java b/src/main/java/turniplabs/halplibe/helper/BlockBuilder.java index 28807c3..e2e86ed 100644 --- a/src/main/java/turniplabs/halplibe/helper/BlockBuilder.java +++ b/src/main/java/turniplabs/halplibe/helper/BlockBuilder.java @@ -22,6 +22,9 @@ public class BlockBuilder implements Cloneable { public static final Set infiniburnList = new TreeSet<>(); + static { + infiniburnList.add(Block.netherrack.id); + } private final String MOD_ID; private Float hardness = null; @@ -461,11 +464,11 @@ public Block build(Block block) { } if (luminance != null) { - ((BlockAccessor) block).callSetLightValue(luminance); + block.withLightEmission(luminance); } if (lightOpacity != null) { - ((BlockAccessor) block).callSetLightOpacity(lightOpacity); + block.withLightBlock(lightOpacity); } if (slipperiness != null) { @@ -490,7 +493,7 @@ public Block build(Block block) { ((BlockAccessor) block).callWithDisabledNeighborNotifyOnMetadataChange(); } - ((BlockAccessor) block).callSetTickOnLoad(tickOnLoad); + block.setTicking(tickOnLoad); if (blockDrop != null) { ((BlockAccessor) block).callSetDropOverride(blockDrop); diff --git a/src/main/java/turniplabs/halplibe/helper/BlockHelper.java b/src/main/java/turniplabs/halplibe/helper/BlockHelper.java index 613a830..fd81ff6 100644 --- a/src/main/java/turniplabs/halplibe/helper/BlockHelper.java +++ b/src/main/java/turniplabs/halplibe/helper/BlockHelper.java @@ -122,7 +122,7 @@ public static Block createBlock(String modId, Block block, BlockSound blockSound BlockSoundDispatcher.getInstance().addDispatch(block, blockSound); ((BlockAccessor) block).callSetHardness(hardness); ((BlockAccessor) block).callSetResistance(resistance); - ((BlockAccessor) block).callSetLightValue(lightValue); + block.withLightEmission(lightValue); Item.itemsList[block.id] = new ItemBlock(block); diff --git a/src/main/java/turniplabs/halplibe/mixin/accessors/BlockAccessor.java b/src/main/java/turniplabs/halplibe/mixin/accessors/BlockAccessor.java index 816bbd8..b6c73d0 100644 --- a/src/main/java/turniplabs/halplibe/mixin/accessors/BlockAccessor.java +++ b/src/main/java/turniplabs/halplibe/mixin/accessors/BlockAccessor.java @@ -14,15 +14,6 @@ public interface BlockAccessor { @Invoker("withBlastResistance") Block callSetResistance(float f); - @Invoker("withLightOpacity") - Block callSetLightOpacity(int i); - - @Invoker("withLightValue") - Block callSetLightValue(float f); - - @Invoker("withLightValue") - Block callSetLightValue(int i); - @Invoker("withImmovableFlagSet") Block callSetImmovable(); @@ -31,13 +22,9 @@ public interface BlockAccessor { @Invoker("withLitInteriorSurface") Block callSetIsLitInteriorSurface(boolean isLit); - @Invoker Block callWithDisabledNeighborNotifyOnMetadataChange(); - @Invoker - Block callSetTickOnLoad(boolean tickOnLoad); - @Accessor("key") void halplibe$setKey(String key); } diff --git a/src/main/java/turniplabs/halplibe/mixin/accessors/RenderPlayerAccessor.java b/src/main/java/turniplabs/halplibe/mixin/accessors/RenderPlayerAccessor.java deleted file mode 100644 index e0cb6d2..0000000 --- a/src/main/java/turniplabs/halplibe/mixin/accessors/RenderPlayerAccessor.java +++ /dev/null @@ -1,19 +0,0 @@ -package turniplabs.halplibe.mixin.accessors; - -import net.minecraft.client.render.entity.PlayerRenderer; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Accessor; - -@Mixin(value = PlayerRenderer.class, remap = false) -public interface RenderPlayerAccessor { - - @Accessor("armorFilenamePrefix") - static String[] getArmorFilenamePrefix() { - throw new AssertionError(); - } - - @Accessor("armorFilenamePrefix") - static void setArmorFilenamePrefix(String[] strings) { - throw new AssertionError(); - } -} diff --git a/src/main/java/turniplabs/halplibe/util/achievements/GuiAchievements.java b/src/main/java/turniplabs/halplibe/util/achievements/GuiAchievements.java index b12d871..e1db1c5 100644 --- a/src/main/java/turniplabs/halplibe/util/achievements/GuiAchievements.java +++ b/src/main/java/turniplabs/halplibe/util/achievements/GuiAchievements.java @@ -170,11 +170,11 @@ public void drawAchievementBackground(int x, int y, float renderPartialTicks) { if(posY < top){ posY = top; } - if(posX >= right){ - posX = right - 1; + if(posX > right){ + posX = right; } - if(posY >= bottom){ - posY = bottom - 1; + if(posY > bottom){ + posY = bottom; } int blockTex = this.mc.renderEngine.getTexture("/terrain.png"); int bgTex = this.mc.renderEngine.getTexture("/achievement/bg.png"); diff --git a/src/main/resources/halplibe.mixins.json b/src/main/resources/halplibe.mixins.json index 5cfd786..61ba37f 100644 --- a/src/main/resources/halplibe.mixins.json +++ b/src/main/resources/halplibe.mixins.json @@ -13,7 +13,6 @@ "accessors.RecipesBlastFurnaceAccessor", "accessors.RecipesFurnaceAccessor", "accessors.RenderManagerAccessor", - "accessors.RenderPlayerAccessor", "accessors.TileEntityAccessor", "accessors.TileEntityRendererAccessor", "mixins.BlockFireMixin", From a6bb2378c7bbe37ac7df150fee9946cc206d8b51 Mon Sep 17 00:00:00 2001 From: UselessBullets <80850784+UselessBullets@users.noreply.github.com> Date: Fri, 1 Dec 2023 16:07:15 -0600 Subject: [PATCH 03/10] Bootable --- .../halplibe/helper/ParticleHelper.java | 3 +- .../{RecipeHelper.java => RecipeHelper.djava} | 2 -- ...sor.java => CraftingManagerAccessor.djava} | 0 ...java => RecipesBlastFurnaceAccessor.djava} | 0 ...ssor.java => RecipesFurnaceAccessor.djava} | 0 .../mixins/EntityClientPlayerMPMixin.java | 2 +- .../mixin/mixins/GuiIngameMenuMixin.java | 2 +- .../mixin/mixins/RenderGlobalMixin.java | 2 +- .../halplibe/util/TextureHandler.java | 2 +- .../util/achievements/GuiAchievements.java | 28 +++++++++---------- .../achievements/TestAchievementsPage.java | 4 +-- .../achievements/VanillaAchievementsPage.java | 5 ---- src/main/resources/halplibe.mixins.json | 3 -- 13 files changed, 22 insertions(+), 31 deletions(-) rename src/main/java/turniplabs/halplibe/helper/{RecipeHelper.java => RecipeHelper.djava} (98%) rename src/main/java/turniplabs/halplibe/mixin/accessors/{CraftingManagerAccessor.java => CraftingManagerAccessor.djava} (100%) rename src/main/java/turniplabs/halplibe/mixin/accessors/{RecipesBlastFurnaceAccessor.java => RecipesBlastFurnaceAccessor.djava} (100%) rename src/main/java/turniplabs/halplibe/mixin/accessors/{RecipesFurnaceAccessor.java => RecipesFurnaceAccessor.djava} (100%) diff --git a/src/main/java/turniplabs/halplibe/helper/ParticleHelper.java b/src/main/java/turniplabs/halplibe/helper/ParticleHelper.java index 776b47c..5156953 100644 --- a/src/main/java/turniplabs/halplibe/helper/ParticleHelper.java +++ b/src/main/java/turniplabs/halplibe/helper/ParticleHelper.java @@ -1,7 +1,8 @@ package turniplabs.halplibe.helper; -import net.minecraft.core.entity.fx.EntityFX; + +import net.minecraft.client.entity.fx.EntityFX; import java.util.HashMap; import java.util.Map; diff --git a/src/main/java/turniplabs/halplibe/helper/RecipeHelper.java b/src/main/java/turniplabs/halplibe/helper/RecipeHelper.djava similarity index 98% rename from src/main/java/turniplabs/halplibe/helper/RecipeHelper.java rename to src/main/java/turniplabs/halplibe/helper/RecipeHelper.djava index f6d2b86..c3a11ee 100644 --- a/src/main/java/turniplabs/halplibe/helper/RecipeHelper.java +++ b/src/main/java/turniplabs/halplibe/helper/RecipeHelper.djava @@ -1,8 +1,6 @@ package turniplabs.halplibe.helper; import net.minecraft.core.block.Block; -import net.minecraft.core.crafting.CraftingManager; -import net.minecraft.core.crafting.recipe.*; import net.minecraft.core.item.Item; import net.minecraft.core.item.ItemStack; import turniplabs.halplibe.HalpLibe; diff --git a/src/main/java/turniplabs/halplibe/mixin/accessors/CraftingManagerAccessor.java b/src/main/java/turniplabs/halplibe/mixin/accessors/CraftingManagerAccessor.djava similarity index 100% rename from src/main/java/turniplabs/halplibe/mixin/accessors/CraftingManagerAccessor.java rename to src/main/java/turniplabs/halplibe/mixin/accessors/CraftingManagerAccessor.djava diff --git a/src/main/java/turniplabs/halplibe/mixin/accessors/RecipesBlastFurnaceAccessor.java b/src/main/java/turniplabs/halplibe/mixin/accessors/RecipesBlastFurnaceAccessor.djava similarity index 100% rename from src/main/java/turniplabs/halplibe/mixin/accessors/RecipesBlastFurnaceAccessor.java rename to src/main/java/turniplabs/halplibe/mixin/accessors/RecipesBlastFurnaceAccessor.djava diff --git a/src/main/java/turniplabs/halplibe/mixin/accessors/RecipesFurnaceAccessor.java b/src/main/java/turniplabs/halplibe/mixin/accessors/RecipesFurnaceAccessor.djava similarity index 100% rename from src/main/java/turniplabs/halplibe/mixin/accessors/RecipesFurnaceAccessor.java rename to src/main/java/turniplabs/halplibe/mixin/accessors/RecipesFurnaceAccessor.djava diff --git a/src/main/java/turniplabs/halplibe/mixin/mixins/EntityClientPlayerMPMixin.java b/src/main/java/turniplabs/halplibe/mixin/mixins/EntityClientPlayerMPMixin.java index 47a330b..5bbf3a9 100644 --- a/src/main/java/turniplabs/halplibe/mixin/mixins/EntityClientPlayerMPMixin.java +++ b/src/main/java/turniplabs/halplibe/mixin/mixins/EntityClientPlayerMPMixin.java @@ -3,8 +3,8 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.entity.player.EntityClientPlayerMP; import net.minecraft.client.entity.player.EntityPlayerSP; +import net.minecraft.client.util.helper.Colors; import net.minecraft.core.net.command.*; -import net.minecraft.core.util.helper.Colors; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; diff --git a/src/main/java/turniplabs/halplibe/mixin/mixins/GuiIngameMenuMixin.java b/src/main/java/turniplabs/halplibe/mixin/mixins/GuiIngameMenuMixin.java index e292976..8002813 100644 --- a/src/main/java/turniplabs/halplibe/mixin/mixins/GuiIngameMenuMixin.java +++ b/src/main/java/turniplabs/halplibe/mixin/mixins/GuiIngameMenuMixin.java @@ -19,7 +19,7 @@ public class GuiIngameMenuMixin extends GuiScreen { ) protected void buttonPressed(GuiButton guibutton, CallbackInfo ci) { if (guibutton.id == 5) { - this.mc.displayGuiScreen(new GuiAchievements(this, this.mc.statFileWriter)); + this.mc.displayGuiScreen(new GuiAchievements(this, this.mc.statsCounter)); ci.cancel(); } } diff --git a/src/main/java/turniplabs/halplibe/mixin/mixins/RenderGlobalMixin.java b/src/main/java/turniplabs/halplibe/mixin/mixins/RenderGlobalMixin.java index f8e4f4c..ae126b4 100644 --- a/src/main/java/turniplabs/halplibe/mixin/mixins/RenderGlobalMixin.java +++ b/src/main/java/turniplabs/halplibe/mixin/mixins/RenderGlobalMixin.java @@ -1,8 +1,8 @@ package turniplabs.halplibe.mixin.mixins; import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.fx.EntityFX; import net.minecraft.client.render.RenderGlobal; -import net.minecraft.core.entity.fx.EntityFX; import net.minecraft.core.world.World; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; diff --git a/src/main/java/turniplabs/halplibe/util/TextureHandler.java b/src/main/java/turniplabs/halplibe/util/TextureHandler.java index 4df7ac1..4a2ef7b 100644 --- a/src/main/java/turniplabs/halplibe/util/TextureHandler.java +++ b/src/main/java/turniplabs/halplibe/util/TextureHandler.java @@ -2,7 +2,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.render.dynamictexture.DynamicTexture; -import net.minecraft.core.util.helper.Textures; +import net.minecraft.client.util.helper.Textures; import turniplabs.halplibe.helper.TextureHelper; import java.awt.image.BufferedImage; diff --git a/src/main/java/turniplabs/halplibe/util/achievements/GuiAchievements.java b/src/main/java/turniplabs/halplibe/util/achievements/GuiAchievements.java index e1db1c5..74dc770 100644 --- a/src/main/java/turniplabs/halplibe/util/achievements/GuiAchievements.java +++ b/src/main/java/turniplabs/halplibe/util/achievements/GuiAchievements.java @@ -11,7 +11,7 @@ import net.minecraft.client.render.entity.ItemEntityRenderer; import net.minecraft.core.achievement.Achievement; import net.minecraft.core.achievement.AchievementList; -import net.minecraft.core.achievement.stat.StatFileWriter; +import net.minecraft.core.achievement.stat.StatsCounter; import net.minecraft.core.item.ItemStack; import net.minecraft.core.lang.I18n; import net.minecraft.core.util.helper.MathHelper; @@ -39,11 +39,11 @@ public class GuiAchievements extends GuiScreen { protected double field_27112_q; protected double field_27111_r; private int isMouseButtonDown = 0; - private final StatFileWriter statFileWriter; + private final StatsCounter statFileWriter; public int page = 0; GuiScreen parent; - public GuiAchievements(GuiScreen parent, StatFileWriter statFileWriter){ + public GuiAchievements(GuiScreen parent, StatsCounter statFileWriter){ this.statFileWriter = statFileWriter; this.parent = parent; this.guiX = field_27112_q = field_27116_m = AchievementList.OPEN_INVENTORY.x * 24 - (double) 141 / 2 - 12; @@ -51,7 +51,7 @@ public GuiAchievements(GuiScreen parent, StatFileWriter statFileWriter){ } @Override - public void initGui() { + public void init() { this.controlList.clear(); this.controlList.add(new GuiOptionsButton(1, this.width / 2 + 24, this.height / 2 + 74, 80, 20, I18n.getInstance().translateKey("gui.done"))); this.controlList.add(new GuiOptionsButton(2, this.width / 2 - 104, this.height / 2 + 74, 120, 20, "Minecraft")); @@ -88,7 +88,7 @@ protected void buttonPressed(GuiButton guibutton) { @Override public void keyTyped(char c, int i, int mouseX, int mouseY) { - if (this.mc.gameSettings.keyInventory.isKey(i)) { + if (this.mc.gameSettings.keyInventory.isKeyboardKey(i)) { this.mc.displayGuiScreen(null); this.mc.setIngameFocus(); } else { @@ -140,7 +140,7 @@ public void drawScreen(int x, int y, float renderPartialTicks) { } @Override - public void updateScreen() { + public void tick() { this.field_27116_m = this.guiX; this.field_27115_n = this.guiY; double var1 = this.field_27112_q - this.guiX; @@ -209,8 +209,8 @@ public void drawAchievementBackground(int x, int y, float renderPartialTicks) { int x1 = achievement.x * 24 - posX + 11 + iOffset; int y1 = achievement.y * 24 - posY + 11 + jOffset; int color = 0; - boolean isUnlocked = statFileWriter.hasAchievementUnlocked(achievement); - boolean isAvailable = statFileWriter.func_27181_b(achievement); + boolean isUnlocked = statFileWriter.isAchievementUnlocked(achievement); + boolean isAvailable = statFileWriter.isAchievementUnlockable(achievement); int n = Math.sin((double)(System.currentTimeMillis() % 600L) / 600.0 * Math.PI * 2.0) <= 0.6 ? 130 : 255; color = isUnlocked ? -9408400 : (isAvailable ? 65280 + (n << 24) : -16777216); this.func_27100_a(x1, x1, y1, color); @@ -221,8 +221,8 @@ public void drawAchievementBackground(int x, int y, float renderPartialTicks) { int x2 = achievement.parent.x * 24 - posX + 11 + iOffset; int y2 = achievement.parent.y * 24 - posY + 11 + jOffset; int color = 0; - boolean isUnlocked = statFileWriter.hasAchievementUnlocked(achievement); - boolean isAvailable = statFileWriter.func_27181_b(achievement); + boolean isUnlocked = statFileWriter.isAchievementUnlocked(achievement); + boolean isAvailable = statFileWriter.isAchievementUnlockable(achievement); int n = Math.sin((double)(System.currentTimeMillis() % 600L) / 600.0 * Math.PI * 2.0) <= 0.6 ? 130 : 255; color = isUnlocked ? -9408400 : (isAvailable ? 65280 + (n << 24) : -16777216); this.func_27100_a(x1, x2, y1, color); @@ -239,8 +239,8 @@ public void drawAchievementBackground(int x, int y, float renderPartialTicks) { int x1 = achievement.x * 24 - posX; int y1 = achievement.y * 24 - posY; if (x1 < -24 || y1 < -24 || x1 > 224 || y1 > 155) continue; - boolean isUnlocked = statFileWriter.hasAchievementUnlocked(achievement); - boolean isAvailable = statFileWriter.func_27181_b(achievement); + boolean isUnlocked = statFileWriter.isAchievementUnlocked(achievement); + boolean isAvailable = statFileWriter.isAchievementUnlockable(achievement); if(isUnlocked){ GL11.glColor4f(1,1,1,1); } else if (isAvailable) { @@ -289,8 +289,8 @@ public void drawAchievementBackground(int x, int y, float renderPartialTicks) { String desc = achievement1.getDescription(); int x1 = x + 12; int y1 = y - 4; - boolean isUnlocked = statFileWriter.hasAchievementUnlocked(achievement1); - boolean isAvailable = statFileWriter.func_27181_b(achievement1); + boolean isUnlocked = statFileWriter.isAchievementUnlocked(achievement1); + boolean isAvailable = statFileWriter.isAchievementUnlockable(achievement1); if(isAvailable){ int maxNameLength = Math.max(this.fontRenderer.getStringWidth(name), 120); int descLength = this.fontRenderer.func_27277_a(desc, maxNameLength); diff --git a/src/main/java/turniplabs/halplibe/util/achievements/TestAchievementsPage.java b/src/main/java/turniplabs/halplibe/util/achievements/TestAchievementsPage.java index 47dc828..ce448e9 100644 --- a/src/main/java/turniplabs/halplibe/util/achievements/TestAchievementsPage.java +++ b/src/main/java/turniplabs/halplibe/util/achievements/TestAchievementsPage.java @@ -4,7 +4,7 @@ import net.minecraft.core.Global; import net.minecraft.core.achievement.Achievement; import net.minecraft.core.achievement.AchievementList; -import net.minecraft.core.achievement.stat.StatBase; +import net.minecraft.core.achievement.stat.Stat; import net.minecraft.core.block.Block; import net.minecraft.core.util.helper.Side; import org.lwjgl.opengl.GL11; @@ -17,7 +17,7 @@ public class TestAchievementsPage extends AchievementPage{ public TestAchievementsPage() { super("HalpLibe", "achievements.page.halplibe"); - ((StatBase)TEST).registerStat(); + ((Stat)TEST).registerStat(); achievementList.add(TEST); } diff --git a/src/main/java/turniplabs/halplibe/util/achievements/VanillaAchievementsPage.java b/src/main/java/turniplabs/halplibe/util/achievements/VanillaAchievementsPage.java index 94096cb..610b2da 100644 --- a/src/main/java/turniplabs/halplibe/util/achievements/VanillaAchievementsPage.java +++ b/src/main/java/turniplabs/halplibe/util/achievements/VanillaAchievementsPage.java @@ -1,16 +1,11 @@ package turniplabs.halplibe.util.achievements; -import net.minecraft.client.Minecraft; import net.minecraft.client.render.TextureFX; import net.minecraft.core.Global; -import net.minecraft.core.achievement.Achievement; import net.minecraft.core.achievement.AchievementList; -import net.minecraft.core.achievement.stat.StatStringFormatKeyInv; import net.minecraft.core.block.Block; -import net.minecraft.core.item.Item; import net.minecraft.core.util.helper.Side; import org.lwjgl.opengl.GL11; -import turniplabs.halplibe.HalpLibe; import java.util.Random; diff --git a/src/main/resources/halplibe.mixins.json b/src/main/resources/halplibe.mixins.json index 61ba37f..a55d23f 100644 --- a/src/main/resources/halplibe.mixins.json +++ b/src/main/resources/halplibe.mixins.json @@ -6,12 +6,9 @@ "mixins": [ "accessors.BlockAccessor", "accessors.BlockFireAccessor", - "accessors.CraftingManagerAccessor", "accessors.DimensionAccessor", "accessors.EntityListAccessor", "accessors.LanguageAccessor", - "accessors.RecipesBlastFurnaceAccessor", - "accessors.RecipesFurnaceAccessor", "accessors.RenderManagerAccessor", "accessors.TileEntityAccessor", "accessors.TileEntityRendererAccessor", From 66b0c7ea9913624390b4da704d3ac99ab46c0b2d Mon Sep 17 00:00:00 2001 From: UselessBullets <80850784+UselessBullets@users.noreply.github.com> Date: Fri, 1 Dec 2023 17:06:28 -0600 Subject: [PATCH 04/10] Crash bypass --- gradle.properties | 2 +- .../java/turniplabs/halplibe/helper/RegistryHelper.java | 6 +++--- .../halplibe/mixin/mixins/registry/MinecraftMixin.java | 2 ++ 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/gradle.properties b/gradle.properties index af3c2ea..e1416e6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,7 +7,7 @@ bta_version=1.7.7.1 loader_version=0.14.19-babric.1-bta # Mod -mod_version=3.0.0 +mod_version=3.0.4 mod_group=turniplabs mod_name=halplibe diff --git a/src/main/java/turniplabs/halplibe/helper/RegistryHelper.java b/src/main/java/turniplabs/halplibe/helper/RegistryHelper.java index dfec147..7c10992 100644 --- a/src/main/java/turniplabs/halplibe/helper/RegistryHelper.java +++ b/src/main/java/turniplabs/halplibe/helper/RegistryHelper.java @@ -38,8 +38,8 @@ public static void scheduleRegistry(boolean configured, Runnable function) { @SuppressWarnings("unused") private static void runRegistry() { - for (Runnable regsitryFunction : configuredRegsitryFunctions) regsitryFunction.run(); - for (Runnable regsitryFunction : smartRregsitryFunctions) regsitryFunction.run(); - for (Runnable regsitryFunction : regsitryFunctions) regsitryFunction.run(); +// for (Runnable regsitryFunction : configuredRegsitryFunctions) regsitryFunction.run(); +// for (Runnable regsitryFunction : smartRregsitryFunctions) regsitryFunction.run(); +// for (Runnable regsitryFunction : regsitryFunctions) regsitryFunction.run(); } } diff --git a/src/main/java/turniplabs/halplibe/mixin/mixins/registry/MinecraftMixin.java b/src/main/java/turniplabs/halplibe/mixin/mixins/registry/MinecraftMixin.java index d6e10fd..f251cf2 100644 --- a/src/main/java/turniplabs/halplibe/mixin/mixins/registry/MinecraftMixin.java +++ b/src/main/java/turniplabs/halplibe/mixin/mixins/registry/MinecraftMixin.java @@ -2,6 +2,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.core.achievement.stat.StatList; +import net.minecraft.core.lang.I18n; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; @@ -19,6 +20,7 @@ public void postInit(CallbackInfo ci) { m.setAccessible(true); m.invoke(null); m.setAccessible(false); + I18n.initialize("en_US"); StatList.init(); StatList.onBlockInit(); StatList.onItemInit(); From 2a03ced58c3287b5c81078a87862938e7fc2e1cb Mon Sep 17 00:00:00 2001 From: UselessBullets <80850784+UselessBullets@users.noreply.github.com> Date: Fri, 1 Dec 2023 20:45:02 -0600 Subject: [PATCH 05/10] removed necro classes --- .../java/turniplabs/halplibe/HalpLibe.java | 7 +- .../halplibe/helper/RecipeHelper.djava | 223 ------------------ .../halplibe/helper/RegistryHelper.java | 6 +- .../accessors/CraftingManagerAccessor.djava | 23 -- .../RecipesBlastFurnaceAccessor.djava | 14 -- .../accessors/RecipesFurnaceAccessor.djava | 14 -- 6 files changed, 8 insertions(+), 279 deletions(-) delete mode 100644 src/main/java/turniplabs/halplibe/helper/RecipeHelper.djava delete mode 100644 src/main/java/turniplabs/halplibe/mixin/accessors/CraftingManagerAccessor.djava delete mode 100644 src/main/java/turniplabs/halplibe/mixin/accessors/RecipesBlastFurnaceAccessor.djava delete mode 100644 src/main/java/turniplabs/halplibe/mixin/accessors/RecipesFurnaceAccessor.djava diff --git a/src/main/java/turniplabs/halplibe/HalpLibe.java b/src/main/java/turniplabs/halplibe/HalpLibe.java index 248d73a..f991bbd 100644 --- a/src/main/java/turniplabs/halplibe/HalpLibe.java +++ b/src/main/java/turniplabs/halplibe/HalpLibe.java @@ -2,6 +2,8 @@ import net.fabricmc.api.ModInitializer; import net.fabricmc.loader.api.entrypoint.PreLaunchEntrypoint; +import net.minecraft.core.Global; +import org.apache.commons.lang3.reflect.FieldUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import turniplabs.halplibe.helper.AchievementHelper; @@ -14,6 +16,9 @@ import turniplabs.halplibe.util.toml.Toml; import turniplabs.halplibe.util.version.PacketModList; +import java.lang.reflect.Field; +import java.lang.reflect.Modifier; + public class HalpLibe implements ModInitializer, PreLaunchEntrypoint { public static final String MOD_ID = "halplibe"; public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID); @@ -25,7 +30,6 @@ public class HalpLibe implements ModInitializer, PreLaunchEntrypoint { CONFIG = new TomlConfigHandler(MOD_ID, toml); - //Global.TEXTURE_ATLAS_WIDTH_TILES = Math.max(32, CONFIG.getInt("Experimental.AtlasWidth")); // Initialize Block and Item static fields try { Class.forName("net.minecraft.core.block.Block"); @@ -38,7 +42,6 @@ public class HalpLibe implements ModInitializer, PreLaunchEntrypoint { public static String addModId(String modId, String name) { return modId + "." + name; } - @Override public void onInitialize() { AchievementHelper.addPage(VANILLA_ACHIEVEMENTS); diff --git a/src/main/java/turniplabs/halplibe/helper/RecipeHelper.djava b/src/main/java/turniplabs/halplibe/helper/RecipeHelper.djava deleted file mode 100644 index c3a11ee..0000000 --- a/src/main/java/turniplabs/halplibe/helper/RecipeHelper.djava +++ /dev/null @@ -1,223 +0,0 @@ -package turniplabs.halplibe.helper; - -import net.minecraft.core.block.Block; -import net.minecraft.core.item.Item; -import net.minecraft.core.item.ItemStack; -import turniplabs.halplibe.HalpLibe; -import turniplabs.halplibe.mixin.accessors.CraftingManagerAccessor; -import turniplabs.halplibe.mixin.accessors.RecipesBlastFurnaceAccessor; -import turniplabs.halplibe.mixin.accessors.RecipesFurnaceAccessor; - -import java.util.List; -import java.util.Map; - -public class RecipeHelper { - public static final CraftingManager craftingManager = CraftingManager.getInstance(); - public static final RecipesFurnace smeltingManager = RecipesFurnace.smelting(); - public static final RecipesBlastFurnace blastingManager = RecipesBlastFurnace.smelting(); - - public static void removeRecipe(Item outputItem, int meta) { - List recipes = craftingManager.getRecipeList(); - IRecipe theRecipe = null; - - for (IRecipe recipe : recipes) { - if (recipe instanceof RecipeShaped && ((RecipeShaped) recipe).recipeOutput.itemID == outputItem.id && ((RecipeShaped) recipe).recipeOutput.getMetadata() == meta) { - theRecipe = recipe; - break; - } else if (recipe instanceof RecipeShapeless && ((RecipeShapeless) recipe).recipeOutput.itemID == outputItem.id && ((RecipeShapeless) recipe).recipeOutput.getMetadata() == meta) { - theRecipe = recipe; - break; - } - } - - if (theRecipe == null) { - HalpLibe.LOGGER.debug("Couldn't find recipe with output: " + outputItem.getKey()); - return; - } - - recipes.remove(theRecipe); - ((CraftingManagerAccessor) craftingManager).setRecipes(recipes); - } - - public static void removeRecipe(Block outputBlock, int meta) { - List recipes = craftingManager.getRecipeList(); - IRecipe theRecipe = null; - - for (IRecipe recipe : recipes) { - if (recipe instanceof RecipeShaped && ((RecipeShaped) recipe).recipeOutput.itemID == outputBlock.id && ((RecipeShaped) recipe).recipeOutput.getMetadata() == meta) { - theRecipe = recipe; - break; - } else if (recipe instanceof RecipeShapeless && ((RecipeShapeless) recipe).recipeOutput.itemID == outputBlock.id && ((RecipeShapeless) recipe).recipeOutput.getMetadata() == meta) { - theRecipe = recipe; - break; - } - } - - if (theRecipe == null) { - HalpLibe.LOGGER.debug("Couldn't find crafting recipe with output: " + outputBlock.getKey()); - return; - } - - recipes.remove(theRecipe); - ((CraftingManagerAccessor) craftingManager).setRecipes(recipes); - } - - public static class Crafting { - - public static void createRecipe(Item outputItem, int amount, Object[] aobj) { - ((CraftingManagerAccessor) craftingManager).callAddRecipe(new ItemStack(outputItem, amount), aobj); - } - - public static void createRecipe(Block outputBlock, int amount, Object[] aobj) { - ((CraftingManagerAccessor) craftingManager).callAddRecipe(new ItemStack(outputBlock, amount), aobj); - } - - public static void createShapelessRecipe(Item outputItem, int amount, Object[] aobj) { - ((CraftingManagerAccessor) craftingManager).callAddShapelessRecipe(new ItemStack(outputItem, amount), aobj); - } - - public static void createShapelessRecipe(Block outputBlock, int amount, Object[] aobj) { - ((CraftingManagerAccessor) craftingManager).callAddShapelessRecipe(new ItemStack(outputBlock, amount), aobj); - } - - public static void createRecipe(ItemStack stack, Object[] aobj) { - ((CraftingManagerAccessor) craftingManager).callAddRecipe(stack, aobj); - } - - public static void createShapelessRecipe(ItemStack stack, Object[] aobj) { - ((CraftingManagerAccessor) craftingManager).callAddShapelessRecipe(stack, aobj); - } - - public static void removeRecipe(Item outputItem) { - List recipes = craftingManager.getRecipeList(); - IRecipe theRecipe = null; - - for (IRecipe recipe : recipes) { - if (recipe instanceof RecipeShaped && ((RecipeShaped) recipe).recipeOutput.itemID == outputItem.id) { - theRecipe = recipe; - break; - } else if (recipe instanceof RecipeShapeless && ((RecipeShapeless) recipe).recipeOutput.itemID == outputItem.id) { - theRecipe = recipe; - break; - } - } - - if (theRecipe == null) { - HalpLibe.LOGGER.debug("Couldn't find recipe with output: " + outputItem.getKey()); - return; - } - - recipes.remove(theRecipe); - ((CraftingManagerAccessor) craftingManager).setRecipes(recipes); - } - - public static void removeRecipe(Block outputBlock) { - List recipes = craftingManager.getRecipeList(); - IRecipe theRecipe = null; - - for (IRecipe recipe : recipes) { - if (recipe instanceof RecipeShaped && ((RecipeShaped) recipe).recipeOutput.itemID == outputBlock.id) { - theRecipe = recipe; - break; - } else if (recipe instanceof RecipeShapeless && ((RecipeShapeless) recipe).recipeOutput.itemID == outputBlock.id) { - theRecipe = recipe; - break; - } - } - - if (theRecipe == null) { - HalpLibe.LOGGER.debug("Couldn't find crafting recipe with output: " + outputBlock.getKey()); - return; - } - - recipes.remove(theRecipe); - ((CraftingManagerAccessor) craftingManager).setRecipes(recipes); - } - } - - public static class Smelting { - - public static void createRecipe(Item outputItem, Item inputItem) { - smeltingManager.addSmelting(inputItem.id, new ItemStack(outputItem)); - } - - public static void createRecipe(Item outputItem, Block inputItem) { - smeltingManager.addSmelting(inputItem.id, new ItemStack(outputItem)); - } - - public static void createRecipe(Block outputItem, Item inputItem) { - smeltingManager.addSmelting(inputItem.id, new ItemStack(outputItem)); - } - - public static void createRecipe(Block outputItem, Block inputItem) { - smeltingManager.addSmelting(inputItem.id, new ItemStack(outputItem)); - } - - public static void removeRecipe(Item inputItem) { - Map recipes = smeltingManager.getSmeltingList(); - - if (!recipes.containsKey(inputItem)) { - HalpLibe.LOGGER.debug("Couldn't find smelting recipe with input: " + inputItem.getKey()); - return; - } - - recipes.remove(inputItem); - ((RecipesFurnaceAccessor) smeltingManager).setSmeltingList(recipes); - } - - public static void removeRecipe(Block inputItem) { - Map recipes = smeltingManager.getSmeltingList(); - - if (!recipes.containsKey(inputItem)) { - HalpLibe.LOGGER.debug("Couldn't find smelting recipe with input: " + inputItem.getKey()); - return; - } - - recipes.remove(inputItem); - ((RecipesFurnaceAccessor) smeltingManager).setSmeltingList(recipes); - } - } - - public static class Blasting { - public static void createRecipe(Item outputItem, Item inputItem) { - blastingManager.addSmelting(inputItem.id, new ItemStack(outputItem)); - } - - public static void createRecipe(Item outputItem, Block inputItem) { - blastingManager.addSmelting(inputItem.id, new ItemStack(outputItem)); - } - - public static void createRecipe(Block outputItem, Item inputItem) { - blastingManager.addSmelting(inputItem.id, new ItemStack(outputItem)); - } - - public static void createRecipe(Block outputItem, Block inputItem) { - blastingManager.addSmelting(inputItem.id, new ItemStack(outputItem)); - } - - public static void removeRecipe(Item inputItem) { - Map recipes = blastingManager.getSmeltingList(); - - if (!recipes.containsKey(inputItem)) { - HalpLibe.LOGGER.debug("Couldn't find blasting recipe with input: " + inputItem.getKey()); - return; - } - - recipes.remove(inputItem); - ((RecipesBlastFurnaceAccessor) blastingManager).setSmeltingList(recipes); - } - - public static void removeRecipe(Block inputItem) { - Map recipes = blastingManager.getSmeltingList(); - - if (!recipes.containsKey(inputItem)) { - HalpLibe.LOGGER.debug("Couldn't find blasting recipe with input: " + inputItem.getKey()); - return; - } - - recipes.remove(inputItem); - ((RecipesBlastFurnaceAccessor) blastingManager).setSmeltingList(recipes); - } - } - -} diff --git a/src/main/java/turniplabs/halplibe/helper/RegistryHelper.java b/src/main/java/turniplabs/halplibe/helper/RegistryHelper.java index 7c10992..dfec147 100644 --- a/src/main/java/turniplabs/halplibe/helper/RegistryHelper.java +++ b/src/main/java/turniplabs/halplibe/helper/RegistryHelper.java @@ -38,8 +38,8 @@ public static void scheduleRegistry(boolean configured, Runnable function) { @SuppressWarnings("unused") private static void runRegistry() { -// for (Runnable regsitryFunction : configuredRegsitryFunctions) regsitryFunction.run(); -// for (Runnable regsitryFunction : smartRregsitryFunctions) regsitryFunction.run(); -// for (Runnable regsitryFunction : regsitryFunctions) regsitryFunction.run(); + for (Runnable regsitryFunction : configuredRegsitryFunctions) regsitryFunction.run(); + for (Runnable regsitryFunction : smartRregsitryFunctions) regsitryFunction.run(); + for (Runnable regsitryFunction : regsitryFunctions) regsitryFunction.run(); } } diff --git a/src/main/java/turniplabs/halplibe/mixin/accessors/CraftingManagerAccessor.djava b/src/main/java/turniplabs/halplibe/mixin/accessors/CraftingManagerAccessor.djava deleted file mode 100644 index 8318c42..0000000 --- a/src/main/java/turniplabs/halplibe/mixin/accessors/CraftingManagerAccessor.djava +++ /dev/null @@ -1,23 +0,0 @@ -package turniplabs.halplibe.mixin.accessors; - -import net.minecraft.core.crafting.CraftingManager; -import net.minecraft.core.crafting.recipe.IRecipe; -import net.minecraft.core.item.ItemStack; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Accessor; -import org.spongepowered.asm.mixin.gen.Invoker; - -import java.util.List; - -@Mixin(value = CraftingManager.class, remap = false) -public interface CraftingManagerAccessor { - - @Invoker("addRecipe") - void callAddRecipe(ItemStack itemstack, Object[] aobj); - - @Invoker("addShapelessRecipe") - void callAddShapelessRecipe(ItemStack itemstack, Object[] aobj); - - @Accessor("recipes") - void setRecipes(List list); -} diff --git a/src/main/java/turniplabs/halplibe/mixin/accessors/RecipesBlastFurnaceAccessor.djava b/src/main/java/turniplabs/halplibe/mixin/accessors/RecipesBlastFurnaceAccessor.djava deleted file mode 100644 index dc42493..0000000 --- a/src/main/java/turniplabs/halplibe/mixin/accessors/RecipesBlastFurnaceAccessor.djava +++ /dev/null @@ -1,14 +0,0 @@ -package turniplabs.halplibe.mixin.accessors; - -import net.minecraft.core.crafting.recipe.RecipesBlastFurnace; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Accessor; - -import java.util.Map; - -@Mixin(value = RecipesBlastFurnace.class, remap = false) -public interface RecipesBlastFurnaceAccessor { - - @Accessor("smeltingList") - void setSmeltingList(Map map); -} diff --git a/src/main/java/turniplabs/halplibe/mixin/accessors/RecipesFurnaceAccessor.djava b/src/main/java/turniplabs/halplibe/mixin/accessors/RecipesFurnaceAccessor.djava deleted file mode 100644 index 60daa80..0000000 --- a/src/main/java/turniplabs/halplibe/mixin/accessors/RecipesFurnaceAccessor.djava +++ /dev/null @@ -1,14 +0,0 @@ -package turniplabs.halplibe.mixin.accessors; - -import net.minecraft.core.crafting.recipe.RecipesFurnace; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Accessor; - -import java.util.Map; - -@Mixin(value = RecipesFurnace.class, remap = false) -public interface RecipesFurnaceAccessor { - - @Accessor("smeltingList") - void setSmeltingList(Map map); -} From 416c75e0ab8408aa8d1781685e4eca985bb33a9c Mon Sep 17 00:00:00 2001 From: UselessBullets <80850784+UselessBullets@users.noreply.github.com> Date: Sat, 2 Dec 2023 09:30:07 -0600 Subject: [PATCH 06/10] Update gradle.properties --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index e1416e6..1c958fd 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,7 +7,7 @@ bta_version=1.7.7.1 loader_version=0.14.19-babric.1-bta # Mod -mod_version=3.0.4 +mod_version=3.0.5 mod_group=turniplabs mod_name=halplibe From 7907e8098f292cffe7119530846581a57004f8ca Mon Sep 17 00:00:00 2001 From: UselessBullets <80850784+UselessBullets@users.noreply.github.com> Date: Sat, 2 Dec 2023 10:02:22 -0600 Subject: [PATCH 07/10] Update gradle.properties --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 1c958fd..5268e8a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,7 +7,7 @@ bta_version=1.7.7.1 loader_version=0.14.19-babric.1-bta # Mod -mod_version=3.0.5 +mod_version=3.0.6 mod_group=turniplabs mod_name=halplibe From bc38095d2195346e73cac5313946534e64b5ae7c Mon Sep 17 00:00:00 2001 From: UselessBullets <80850784+UselessBullets@users.noreply.github.com> Date: Sat, 2 Dec 2023 10:46:44 -0600 Subject: [PATCH 08/10] Added legacy reciper helper --- .../halplibe/helper/RecipeHelper.java | 79 +++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 src/main/java/turniplabs/halplibe/helper/RecipeHelper.java diff --git a/src/main/java/turniplabs/halplibe/helper/RecipeHelper.java b/src/main/java/turniplabs/halplibe/helper/RecipeHelper.java new file mode 100644 index 0000000..e91f46d --- /dev/null +++ b/src/main/java/turniplabs/halplibe/helper/RecipeHelper.java @@ -0,0 +1,79 @@ +package turniplabs.halplibe.helper; + +import net.minecraft.core.block.Block; +import net.minecraft.core.crafting.legacy.CraftingManager; +import net.minecraft.core.crafting.legacy.recipe.RecipesBlastFurnace; +import net.minecraft.core.crafting.legacy.recipe.RecipesFurnace; +import net.minecraft.core.item.Item; +import net.minecraft.core.item.ItemStack; +@Deprecated +public class RecipeHelper { + public static final CraftingManager craftingManager = CraftingManager.getInstance(); + public static final RecipesFurnace smeltingManager = RecipesFurnace.getInstance(); + public static final RecipesBlastFurnace blastingManager = RecipesBlastFurnace.getInstance(); + + public static class Crafting { + + public static void createRecipe(Item outputItem, int amount, Object[] aobj) { + craftingManager.addRecipe(new ItemStack(outputItem, amount), aobj); + } + + public static void createRecipe(Block outputBlock, int amount, Object[] aobj) { + craftingManager.addRecipe(new ItemStack(outputBlock, amount), aobj); + } + + public static void createShapelessRecipe(Item outputItem, int amount, Object[] aobj) { + craftingManager.addShapelessRecipe(new ItemStack(outputItem, amount), aobj); + } + + public static void createShapelessRecipe(Block outputBlock, int amount, Object[] aobj) { + craftingManager.addShapelessRecipe(new ItemStack(outputBlock, amount), aobj); + } + + public static void createRecipe(ItemStack stack, Object[] aobj) { + craftingManager.addRecipe(stack, aobj); + } + + public static void createShapelessRecipe(ItemStack stack, Object[] aobj) { + craftingManager.addShapelessRecipe(stack, aobj); + } + } + + public static class Smelting { + + public static void createRecipe(Item outputItem, Item inputItem) { + smeltingManager.addSmelting(inputItem.id, new ItemStack(outputItem)); + } + + public static void createRecipe(Item outputItem, Block inputItem) { + smeltingManager.addSmelting(inputItem.id, new ItemStack(outputItem)); + } + + public static void createRecipe(Block outputItem, Item inputItem) { + smeltingManager.addSmelting(inputItem.id, new ItemStack(outputItem)); + } + + public static void createRecipe(Block outputItem, Block inputItem) { + smeltingManager.addSmelting(inputItem.id, new ItemStack(outputItem)); + } + } + + public static class Blasting { + public static void createRecipe(Item outputItem, Item inputItem) { + blastingManager.addSmelting(inputItem.id, new ItemStack(outputItem)); + } + + public static void createRecipe(Item outputItem, Block inputItem) { + blastingManager.addSmelting(inputItem.id, new ItemStack(outputItem)); + } + + public static void createRecipe(Block outputItem, Item inputItem) { + blastingManager.addSmelting(inputItem.id, new ItemStack(outputItem)); + } + + public static void createRecipe(Block outputItem, Block inputItem) { + blastingManager.addSmelting(inputItem.id, new ItemStack(outputItem)); + } + } + +} From f8fc8cafb79f6969200c228b8de45f3f66eeaf64 Mon Sep 17 00:00:00 2001 From: UselessBullets <80850784+UselessBullets@users.noreply.github.com> Date: Sat, 2 Dec 2023 12:51:41 -0600 Subject: [PATCH 09/10] Added getMinecraft mixin --- gradle.properties | 2 +- .../halplibe/mixin/mixins/MinecraftMixin.java | 18 ++++++++++++++++++ src/main/resources/halplibe.mixins.json | 1 + 3 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 src/main/java/turniplabs/halplibe/mixin/mixins/MinecraftMixin.java diff --git a/gradle.properties b/gradle.properties index 5268e8a..0636dda 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,7 +7,7 @@ bta_version=1.7.7.1 loader_version=0.14.19-babric.1-bta # Mod -mod_version=3.0.6 +mod_version=3.0.7 mod_group=turniplabs mod_name=halplibe diff --git a/src/main/java/turniplabs/halplibe/mixin/mixins/MinecraftMixin.java b/src/main/java/turniplabs/halplibe/mixin/mixins/MinecraftMixin.java new file mode 100644 index 0000000..e016280 --- /dev/null +++ b/src/main/java/turniplabs/halplibe/mixin/mixins/MinecraftMixin.java @@ -0,0 +1,18 @@ +package turniplabs.halplibe.mixin.mixins; + +import net.minecraft.client.Minecraft; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +@Mixin(value = Minecraft.class, remap = false, priority = 999) +public class MinecraftMixin { + @Shadow private static Minecraft INSTANCE; + + @Inject(method = "getMinecraft(Ljava/lang/Object;)Lnet/minecraft/client/Minecraft;", at = @At("HEAD"), cancellable = true) + private static void returnMinecraft(Object caller, CallbackInfoReturnable cir){ + cir.setReturnValue(INSTANCE); + } +} diff --git a/src/main/resources/halplibe.mixins.json b/src/main/resources/halplibe.mixins.json index a55d23f..ed31766 100644 --- a/src/main/resources/halplibe.mixins.json +++ b/src/main/resources/halplibe.mixins.json @@ -17,6 +17,7 @@ "mixins.EntityClientPlayerMPMixin", "mixins.GuiIngameMenuMixin", "mixins.I18nMixin", + "mixins.MinecraftMixin", "mixins.RenderEngineMixin", "mixins.RenderGlobalMixin", "mixins.network.EntityTrackerEntryMixin", From e897d8d01eef73f651eaa7a42ecd558b8d16d6af Mon Sep 17 00:00:00 2001 From: UselessBullets <80850784+UselessBullets@users.noreply.github.com> Date: Sat, 2 Dec 2023 12:54:22 -0600 Subject: [PATCH 10/10] Revert "Added getMinecraft mixin" This reverts commit f8fc8cafb79f6969200c228b8de45f3f66eeaf64. --- gradle.properties | 2 +- .../halplibe/mixin/mixins/MinecraftMixin.java | 18 ------------------ src/main/resources/halplibe.mixins.json | 1 - 3 files changed, 1 insertion(+), 20 deletions(-) delete mode 100644 src/main/java/turniplabs/halplibe/mixin/mixins/MinecraftMixin.java diff --git a/gradle.properties b/gradle.properties index 0636dda..5268e8a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,7 +7,7 @@ bta_version=1.7.7.1 loader_version=0.14.19-babric.1-bta # Mod -mod_version=3.0.7 +mod_version=3.0.6 mod_group=turniplabs mod_name=halplibe diff --git a/src/main/java/turniplabs/halplibe/mixin/mixins/MinecraftMixin.java b/src/main/java/turniplabs/halplibe/mixin/mixins/MinecraftMixin.java deleted file mode 100644 index e016280..0000000 --- a/src/main/java/turniplabs/halplibe/mixin/mixins/MinecraftMixin.java +++ /dev/null @@ -1,18 +0,0 @@ -package turniplabs.halplibe.mixin.mixins; - -import net.minecraft.client.Minecraft; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; - -@Mixin(value = Minecraft.class, remap = false, priority = 999) -public class MinecraftMixin { - @Shadow private static Minecraft INSTANCE; - - @Inject(method = "getMinecraft(Ljava/lang/Object;)Lnet/minecraft/client/Minecraft;", at = @At("HEAD"), cancellable = true) - private static void returnMinecraft(Object caller, CallbackInfoReturnable cir){ - cir.setReturnValue(INSTANCE); - } -} diff --git a/src/main/resources/halplibe.mixins.json b/src/main/resources/halplibe.mixins.json index ed31766..a55d23f 100644 --- a/src/main/resources/halplibe.mixins.json +++ b/src/main/resources/halplibe.mixins.json @@ -17,7 +17,6 @@ "mixins.EntityClientPlayerMPMixin", "mixins.GuiIngameMenuMixin", "mixins.I18nMixin", - "mixins.MinecraftMixin", "mixins.RenderEngineMixin", "mixins.RenderGlobalMixin", "mixins.network.EntityTrackerEntryMixin",