Skip to content

Commit

Permalink
Make it run with 7.1
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinSVK12 committed Dec 3, 2023
1 parent adc045a commit be13e04
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 32 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -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
Expand Down
12 changes: 7 additions & 5 deletions src/main/java/turniplabs/halplibe/helper/RecipeHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
}
Expand All @@ -38,6 +39,7 @@ public static void createShapelessRecipe(ItemStack stack, Object[] aobj) {
craftingManager.addShapelessRecipe(stack, aobj);
}
}

@Deprecated
public static class Smelting {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public abstract class RenderEngineMixin {
private List<DynamicTexture> 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
Expand Down Expand Up @@ -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();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, Class<? super EntityFX>> particles = (Map<String, Class<? super EntityFX>>) ParticleHelper.particles;
Map<String, Class<? extends EntityFX>> particles = (Map<String, Class<? extends EntityFX>>) ParticleHelper.particles;
for (String name : particles.keySet()) {
if (name.equals(particle)) {
Class<? super EntityFX> clazz = particles.get(name);
Class<? extends EntityFX> 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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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",
Expand Down
Original file line number Diff line number Diff line change
@@ -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 = "<init>")
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

Expand All @@ -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);
}
}

0 comments on commit be13e04

Please sign in to comment.