From accb4310e3bb37d0b92ee4672cf903cf1512bb0a Mon Sep 17 00:00:00 2001 From: alongstringofnumbers Date: Wed, 6 Dec 2023 21:06:37 -0700 Subject: [PATCH] Another one down --- .../gregtech/asm/GregTechTransformer.java | 27 +++++++++---------- .../mixins/minecraft/RenderItemMixin.java | 14 ++++++++++ 2 files changed, 26 insertions(+), 15 deletions(-) diff --git a/src/main/java/gregtech/asm/GregTechTransformer.java b/src/main/java/gregtech/asm/GregTechTransformer.java index fcda1ef12ba..1d7bf0915f3 100644 --- a/src/main/java/gregtech/asm/GregTechTransformer.java +++ b/src/main/java/gregtech/asm/GregTechTransformer.java @@ -7,17 +7,12 @@ import gregtech.asm.visitors.JEIVisitor; import gregtech.asm.visitors.LittleTilesVisitor; import gregtech.asm.visitors.ModelCTMVisitor; -import gregtech.asm.visitors.RenderItemVisitor; import net.minecraft.launchwrapper.IClassTransformer; import org.objectweb.asm.ClassReader; import org.objectweb.asm.ClassWriter; import org.objectweb.asm.Opcodes; -import org.objectweb.asm.tree.ClassNode; -import org.objectweb.asm.tree.MethodNode; - -import java.util.Iterator; public class GregTechTransformer implements IClassTransformer, Opcodes { @@ -170,16 +165,18 @@ public byte[] transform(String name, String transformedName, byte[] basicClass) * return classWriter.toByteArray(); * } */ - case RenderItemVisitor.TARGET_CLASS_NAME: { - ClassNode classNode = new ClassNode(); - ClassReader classReader = new ClassReader(basicClass); - classReader.accept(classNode, 0); - Iterator methods = classNode.methods.iterator(); - RenderItemVisitor.transform(methods); - ClassWriter classWriter = new ClassWriter(0); - classNode.accept(classWriter); - return classWriter.toByteArray(); - } + /* + * case RenderItemVisitor.TARGET_CLASS_NAME: { + * ClassNode classNode = new ClassNode(); + * ClassReader classReader = new ClassReader(basicClass); + * classReader.accept(classNode, 0); + * Iterator methods = classNode.methods.iterator(); + * RenderItemVisitor.transform(methods); + * ClassWriter classWriter = new ClassWriter(0); + * classNode.accept(classWriter); + * return classWriter.toByteArray(); + * } + */ /* * case RecipeRepairItemVisitor.TARGET_CLASS_NAME: { * ClassReader classReader = new ClassReader(basicClass); diff --git a/src/main/java/gregtech/mixins/minecraft/RenderItemMixin.java b/src/main/java/gregtech/mixins/minecraft/RenderItemMixin.java index 2ef94bb6ec5..6efc191b408 100644 --- a/src/main/java/gregtech/mixins/minecraft/RenderItemMixin.java +++ b/src/main/java/gregtech/mixins/minecraft/RenderItemMixin.java @@ -1,10 +1,12 @@ package gregtech.mixins.minecraft; +import gregtech.api.GTValues; import gregtech.asm.hooks.RenderItemHooks; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.renderer.RenderItem; import net.minecraft.item.ItemStack; +import net.minecraftforge.fml.common.Loader; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; @@ -22,4 +24,16 @@ private void renderItemOverlayIntoGUIInject(FontRenderer fr, ItemStack stack, in RenderItemHooks.renderLampOverlay(stack, xPosition, yPosition); } } + + @Inject(method = "renderItemOverlayIntoGUI", + at = @At(value = "INVOKE_ASSIGN", + target = "Lnet/minecraft/client/Minecraft;getMinecraft()Lnet/minecraft/client/Minecraft;", + shift = At.Shift.BEFORE, + ordinal = 0)) + public void showDurabilityBarMixin(FontRenderer fr, ItemStack stack, int xPosition, int yPosition, String text, + CallbackInfo ci) { + if (!Loader.isModLoaded(GTValues.MODID_ECORE)) { + RenderItemHooks.renderElectricBar(stack, xPosition, yPosition); + } + } }