-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move ASM transformer to mixin potion render fix (#101)
* Add a debug message in the chat when toggling vanilla debug options * update dependencies and use GTNH lib to print chat message * update dependencies to get NEI fix that causes mixins to crash * move the potion rendering over NEI fix from ASM to mixins * changed the mixin to center the inventory * applys spotless * use the same name for potion offset * Fix the vanilla bug that doesn't render the potion effects that you get while your inventory is opened
- Loading branch information
Showing
7 changed files
with
79 additions
and
184 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
158 changes: 0 additions & 158 deletions
158
src/main/java/com/mitchej123/hodgepodge/asm/InventoryEffectRendererTransformer.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 0 additions & 20 deletions
20
src/main/java/com/mitchej123/hodgepodge/mixins/minecraft/MixinInventoryEffectRenderer.java
This file was deleted.
Oops, something went wrong.
42 changes: 42 additions & 0 deletions
42
...ej123/hodgepodge/mixins/minecraft/MixinInventoryEffectRenderer_PotionEffectRendering.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package com.mitchej123.hodgepodge.mixins.minecraft; | ||
|
||
import codechicken.nei.NEIClientConfig; | ||
import net.minecraft.client.gui.inventory.GuiContainer; | ||
import net.minecraft.client.renderer.InventoryEffectRenderer; | ||
import net.minecraft.inventory.Container; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Overwrite; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
|
||
@Mixin(InventoryEffectRenderer.class) | ||
public abstract class MixinInventoryEffectRenderer_PotionEffectRendering extends GuiContainer { | ||
|
||
@Shadow | ||
private void func_147044_g() {} | ||
|
||
/** | ||
* @author Alexdoru | ||
* @reason Fix the bug that renders the potion effects above the tooltips from items in NEI | ||
* Fix the vanilla bug that doesn't render the potion effects that you get while your inventory | ||
* is opened | ||
*/ | ||
@Overwrite | ||
public void drawScreen(int p_73863_1_, int p_73863_2_, float p_73863_3_) { | ||
boolean bookmarkPanelHidden = NEIClientConfig.isHidden(); | ||
if (bookmarkPanelHidden) { | ||
super.drawScreen(p_73863_1_, p_73863_2_, p_73863_3_); | ||
} | ||
if (!this.mc.thePlayer.getActivePotionEffects().isEmpty()) { | ||
this.func_147044_g(); | ||
} | ||
if (bookmarkPanelHidden) { | ||
return; | ||
} | ||
super.drawScreen(p_73863_1_, p_73863_2_, p_73863_3_); | ||
} | ||
|
||
/*Forced to have constructor matching super*/ | ||
public MixinInventoryEffectRenderer_PotionEffectRendering(Container p_i1089_1_) { | ||
super(p_i1089_1_); | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
...com/mitchej123/hodgepodge/mixins/minecraft/MixinInventoryEffectRenderer_PotionOffset.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.mitchej123.hodgepodge.mixins.minecraft; | ||
|
||
import net.minecraft.client.gui.inventory.GuiContainer; | ||
import net.minecraft.client.renderer.InventoryEffectRenderer; | ||
import net.minecraft.inventory.Container; | ||
import org.objectweb.asm.Opcodes; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Redirect; | ||
|
||
@Mixin(InventoryEffectRenderer.class) | ||
public abstract class MixinInventoryEffectRenderer_PotionOffset extends GuiContainer { | ||
|
||
@Redirect( | ||
method = "initGui", | ||
at = | ||
@At( | ||
value = "FIELD", | ||
target = "Lnet/minecraft/client/renderer/InventoryEffectRenderer;guiLeft:I", | ||
opcode = Opcodes.PUTFIELD)) | ||
public void hodgepodge$fixPotionOffset(InventoryEffectRenderer instance, int value) { | ||
this.guiLeft = (this.width - this.xSize) / 2; | ||
} | ||
|
||
/*Forced to have constructor matching super*/ | ||
public MixinInventoryEffectRenderer_PotionOffset(Container p_i1072_1_) { | ||
super(p_i1072_1_); | ||
} | ||
} |