From be13e04c006d95c675af1664d9c3ea91c6e37dbc Mon Sep 17 00:00:00 2001 From: MartinSVK12 <37455793+MartinSVK12@users.noreply.github.com> Date: Sun, 3 Dec 2023 02:27:45 +0100 Subject: [PATCH] Make it run with 7.1 --- gradle.properties | 2 +- .../halplibe/helper/RecipeHelper.java | 12 ++++++----- .../mixin/mixins/RenderEngineMixin.java | 4 ++-- .../mixin/mixins/RenderGlobalMixin.java | 6 +++--- .../mixins/network/NetClientHandlerMixin.java | 2 ++ .../mixins/network/NetworkManagerMixin.java | 21 ------------------- 6 files changed, 15 insertions(+), 32 deletions(-) diff --git a/gradle.properties b/gradle.properties index af3c2ea..8b1c9e3 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,7 +1,7 @@ org.gradle.jvmargs=-Xmx2G # BTA -bta_version=1.7.7.1 +bta_version=1.7.7.0_02 # Loader loader_version=0.14.19-babric.1-bta diff --git a/src/main/java/turniplabs/halplibe/helper/RecipeHelper.java b/src/main/java/turniplabs/halplibe/helper/RecipeHelper.java index b69fa25..e99dcba 100644 --- a/src/main/java/turniplabs/halplibe/helper/RecipeHelper.java +++ b/src/main/java/turniplabs/halplibe/helper/RecipeHelper.java @@ -2,6 +2,7 @@ import net.minecraft.core.block.Block; import net.minecraft.core.crafting.legacy.CraftingManager; +import net.minecraft.core.crafting.legacy.recipe.IRecipe; import net.minecraft.core.crafting.legacy.recipe.RecipesBlastFurnace; import net.minecraft.core.crafting.legacy.recipe.RecipesFurnace; import net.minecraft.core.item.Item; @@ -10,18 +11,18 @@ public class RecipeHelper { @Deprecated public static final CraftingManager craftingManager = CraftingManager.getInstance(); - public static final RecipesFurnace smeltingManager = RecipesFurnace.getInstance(); - public static final RecipesBlastFurnace blastingManager = RecipesBlastFurnace.getInstance(); @Deprecated - public static final RecipesFurnace smeltingManager = RecipesFurnace.smelting(); + public static final RecipesFurnace smeltingManager = RecipesFurnace.getInstance(); @Deprecated - public static final RecipesBlastFurnace blastingManager = RecipesBlastFurnace.smelting(); + public static final RecipesBlastFurnace blastingManager = RecipesBlastFurnace.getInstance(); @Deprecated public static void removeRecipe(Item outputItem, int meta) { IRecipe theRecipe = null; + } - + @Deprecated + public static class Crafting { public static void createShapelessRecipe(Item outputItem, int amount, Object[] aobj) { craftingManager.addShapelessRecipe(new ItemStack(outputItem, amount), aobj); } @@ -38,6 +39,7 @@ public static void createShapelessRecipe(ItemStack stack, Object[] aobj) { craftingManager.addShapelessRecipe(stack, aobj); } } + @Deprecated public static class Smelting { diff --git a/src/main/java/turniplabs/halplibe/mixin/mixins/RenderEngineMixin.java b/src/main/java/turniplabs/halplibe/mixin/mixins/RenderEngineMixin.java index 1a4f047..5d210ed 100644 --- a/src/main/java/turniplabs/halplibe/mixin/mixins/RenderEngineMixin.java +++ b/src/main/java/turniplabs/halplibe/mixin/mixins/RenderEngineMixin.java @@ -26,7 +26,7 @@ public abstract class RenderEngineMixin { private List dynamicTextures; @Shadow protected abstract void generateMipmaps(ByteBuffer buffer, BufferedImage image, int levels, boolean smooth); - @Shadow @Final public Minecraft minecraft; + @Shadow @Final public Minecraft mc; @Shadow private boolean clampTexture; @Shadow private boolean blurTexture; @Unique @@ -84,7 +84,7 @@ private void adjustAtlasSize(BufferedImage img, int id, boolean mipmap, Callback Buffer.put(resizedAtlas); GL11.glTexImage2D(3553, 0, 6408, w, h, 0, 6408, 5121, Buffer.buffer); if (mipmap) { - this.generateMipmaps(Buffer.buffer, resizedAtlas, this.minecraft.gameSettings.mipmapLevels.value, this.minecraft.gameSettings.mipmapType.value == MipmapType.SMOOTH); + this.generateMipmaps(Buffer.buffer, resizedAtlas, this.mc.gameSettings.mipmapLevels.value, this.mc.gameSettings.mipmapType.value == MipmapType.SMOOTH); } 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 3a5e7c5..b2a5973 100644 --- a/src/main/java/turniplabs/halplibe/mixin/mixins/RenderGlobalMixin.java +++ b/src/main/java/turniplabs/halplibe/mixin/mixins/RenderGlobalMixin.java @@ -31,13 +31,13 @@ private void spawnParticle(String particle, double x, double y, double z, double double maxDistance = 16.0; if (!(distanceX * distanceX + distanceY * distanceY + distanceZ * distanceZ > maxDistance * maxDistance)) { - Map> particles = (Map>) ParticleHelper.particles; + Map> particles = (Map>) ParticleHelper.particles; for (String name : particles.keySet()) { if (name.equals(particle)) { - Class clazz = particles.get(name); + Class clazz = particles.get(name); try { - mc.effectRenderer.addEffect((net.minecraft.client.entity.fx.EntityFX) clazz + mc.effectRenderer.addEffect(clazz .getDeclaredConstructor(World.class, double.class, double.class, double.class, double.class, double.class, double.class) .newInstance(worldObj, x, y, z, motionX, motionY, motionZ)); } catch (Exception e) { diff --git a/src/main/java/turniplabs/halplibe/mixin/mixins/network/NetClientHandlerMixin.java b/src/main/java/turniplabs/halplibe/mixin/mixins/network/NetClientHandlerMixin.java index 9e10578..ddcfd0c 100644 --- a/src/main/java/turniplabs/halplibe/mixin/mixins/network/NetClientHandlerMixin.java +++ b/src/main/java/turniplabs/halplibe/mixin/mixins/network/NetClientHandlerMixin.java @@ -8,6 +8,7 @@ import net.minecraft.core.entity.EntityLiving; import net.minecraft.core.net.handler.NetHandler; import net.minecraft.core.net.packet.Packet24MobSpawn; +import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; @@ -21,6 +22,7 @@ public abstract class NetClientHandlerMixin extends NetHandler { @Shadow private WorldClient worldClient; + @Final @Shadow private Minecraft mc; @Inject(method = "handleMobSpawn(Lnet/minecraft/core/net/packet/Packet24MobSpawn;)V", diff --git a/src/main/java/turniplabs/halplibe/mixin/mixins/network/NetworkManagerMixin.java b/src/main/java/turniplabs/halplibe/mixin/mixins/network/NetworkManagerMixin.java index 67ce457..e374ed6 100644 --- a/src/main/java/turniplabs/halplibe/mixin/mixins/network/NetworkManagerMixin.java +++ b/src/main/java/turniplabs/halplibe/mixin/mixins/network/NetworkManagerMixin.java @@ -1,30 +1,15 @@ package turniplabs.halplibe.mixin.mixins.network; import net.minecraft.core.net.NetworkManager; -import net.minecraft.core.net.handler.NetHandler; import net.minecraft.core.net.packet.Packet; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Redirect; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import turniplabs.halplibe.helper.NetworkHelper; -import java.net.Socket; - @Mixin(value = NetworkManager.class, remap = false) public class NetworkManagerMixin { - @Shadow public static int[] field_28144_e; - - @Shadow public static int[] field_28145_d; - - @Inject(at = @At("TAIL"), method = "") - public void postInit(Socket socket, String s, NetHandler nethandler, CallbackInfo ci) { - field_28144_e = new int[NetworkHelper.getLastPacketId() + 1]; - field_28145_d = new int[NetworkHelper.getLastPacketId() + 1]; - } // Increase id size when needed @@ -45,10 +30,4 @@ private int addToSendQueue_SizeIncrease(Packet instance){ private int sendPacket_SizeIncrease(Packet instance){ return extendedPacketSize(instance); } - @Redirect( - method = "readPacket()Z", - at = @At(value = "INVOKE", target = "Lnet/minecraft/core/net/packet/Packet;getPacketSize()I")) - private int readPacket_SizeIncrease(Packet instance){ - return extendedPacketSize(instance); - } }