diff --git a/gradle.properties b/gradle.properties index bfc9f00d..d5c1912b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -82,7 +82,7 @@ usesMixins = true separateMixinSourceSet = # Adds some debug arguments like verbose output and class export. -usesMixinDebug = false +usesMixinDebug = true # Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise. mixinPlugin = diff --git a/src/main/java/com/cleanroommc/modularui/drawable/GuiDraw.java b/src/main/java/com/cleanroommc/modularui/drawable/GuiDraw.java index f470ce62..c1149771 100644 --- a/src/main/java/com/cleanroommc/modularui/drawable/GuiDraw.java +++ b/src/main/java/com/cleanroommc/modularui/drawable/GuiDraw.java @@ -329,7 +329,7 @@ public static void drawItem(ItemStack item, int x, int y, float width, float hei GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glTranslatef(x, y, 0); GL11.glScalef(width / 16f, height / 16f, 1); - RenderItem renderItem = ((GuiScreenAccessor) Minecraft.getMinecraft().currentScreen).getItemRender(); + RenderItem renderItem = GuiScreenAccessor.getItemRender(); renderItem.zLevel = 200; renderItem.renderItemAndEffectIntoGUI(Minecraft.getMinecraft().fontRenderer, Minecraft.getMinecraft().getTextureManager(), item, 0, 0); GuiDraw.afterRenderItemAndEffectIntoGUI(item); diff --git a/src/main/java/com/cleanroommc/modularui/mixins/early/minecraft/GuiScreenAccessor.java b/src/main/java/com/cleanroommc/modularui/mixins/early/minecraft/GuiScreenAccessor.java index 3f09f3a1..5f69b745 100644 --- a/src/main/java/com/cleanroommc/modularui/mixins/early/minecraft/GuiScreenAccessor.java +++ b/src/main/java/com/cleanroommc/modularui/mixins/early/minecraft/GuiScreenAccessor.java @@ -36,7 +36,9 @@ public interface GuiScreenAccessor { void setLastMouseEvent(long event); @Accessor - RenderItem getItemRender(); + static RenderItem getItemRender() { + throw new UnsupportedOperationException("Mixin failed to inject!"); + } @Accessor("fontRendererObj") FontRenderer getFontRenderer(); diff --git a/src/main/java/com/cleanroommc/modularui/screen/ClientScreenHandler.java b/src/main/java/com/cleanroommc/modularui/screen/ClientScreenHandler.java index 8c9c9162..711e5fe7 100644 --- a/src/main/java/com/cleanroommc/modularui/screen/ClientScreenHandler.java +++ b/src/main/java/com/cleanroommc/modularui/screen/ClientScreenHandler.java @@ -425,16 +425,16 @@ private static boolean shouldRenderNEITooltip(ModularScreen muiScreen) { private static void drawItemStack(GuiContainer mcScreen, ItemStack stack, int x, int y, String altText) { GL11.glTranslatef(0.0F, 0.0F, 32.0F); ((GuiAccessor) mcScreen).setZLevel(200f); - ((GuiScreenAccessor) mcScreen).getItemRender().zLevel = 200.0F; + GuiScreenAccessor.getItemRender().zLevel = 200.0F; FontRenderer font = stack.getItem().getFontRenderer(stack); if (font == null) font = ((GuiScreenAccessor) mcScreen).getFontRenderer(); GL11.glEnable(GL11.GL_DEPTH_TEST); - ((GuiScreenAccessor) mcScreen).getItemRender().renderItemAndEffectIntoGUI(font, Minecraft.getMinecraft().getTextureManager(), stack, x, y); + GuiScreenAccessor.getItemRender().renderItemAndEffectIntoGUI(font, Minecraft.getMinecraft().getTextureManager(), stack, x, y); GuiDraw.afterRenderItemAndEffectIntoGUI(stack); - ((GuiScreenAccessor) mcScreen).getItemRender().renderItemOverlayIntoGUI(font, Minecraft.getMinecraft().getTextureManager(), stack, x, y - (((GuiContainerAccessor) mcScreen).getDraggedStack() == null ? 0 : 8), altText); + GuiScreenAccessor.getItemRender().renderItemOverlayIntoGUI(font, Minecraft.getMinecraft().getTextureManager(), stack, x, y - (((GuiContainerAccessor) mcScreen).getDraggedStack() == null ? 0 : 8), altText); GL11.glDisable(GL11.GL_DEPTH_TEST); ((GuiAccessor) mcScreen).setZLevel(0f); - ((GuiScreenAccessor) mcScreen).getItemRender().zLevel = 0.0F; + GuiScreenAccessor.getItemRender().zLevel = 0.0F; } private static void drawVanillaElements(GuiScreen mcScreen, int mouseX, int mouseY, float partialTicks) { diff --git a/src/main/java/com/cleanroommc/modularui/widgets/ItemSlot.java b/src/main/java/com/cleanroommc/modularui/widgets/ItemSlot.java index f9f37ea0..9808a07b 100644 --- a/src/main/java/com/cleanroommc/modularui/widgets/ItemSlot.java +++ b/src/main/java/com/cleanroommc/modularui/widgets/ItemSlot.java @@ -191,7 +191,7 @@ private void drawSlot(ModularSlot slotIn) { if (!(guiScreen instanceof GuiContainer)) throw new IllegalStateException("The gui must be an instance of GuiContainer if it contains slots!"); GuiContainerAccessor acc = (GuiContainerAccessor) guiScreen; - RenderItem renderItem = ((GuiScreenAccessor) guiScreen).getItemRender(); + RenderItem renderItem = GuiScreenAccessor.getItemRender(); ItemStack itemstack = slotIn.getStack(); boolean flag = false; boolean flag1 = slotIn == acc.getClickedSlot() && acc.getDraggedStack() != null && !acc.getIsRightMouseClick(); diff --git a/src/main/java/com/cleanroommc/modularui/widgets/ItemSlotLong.java b/src/main/java/com/cleanroommc/modularui/widgets/ItemSlotLong.java index 9f55ff97..1e2975c0 100644 --- a/src/main/java/com/cleanroommc/modularui/widgets/ItemSlotLong.java +++ b/src/main/java/com/cleanroommc/modularui/widgets/ItemSlotLong.java @@ -193,7 +193,7 @@ private void drawSlot(ModularSlotLong slotIn) { if (!(guiScreen instanceof GuiContainer)) throw new IllegalStateException("The gui must be an instance of GuiContainer if it contains slots!"); GuiContainerAccessor acc = (GuiContainerAccessor) guiScreen; - RenderItem renderItem = ((GuiScreenAccessor) guiScreen).getItemRender(); + RenderItem renderItem = GuiScreenAccessor.getItemRender(); IItemStackLong itemstack = slotIn.getStackLong(); boolean flag = false; boolean flag1 = slotIn == acc.getClickedSlot() && acc.getDraggedStack() != null && !acc.getIsRightMouseClick();