-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix incompatibility with prismatic lib.
- Loading branch information
1 parent
d9221ff
commit d2f1917
Showing
4 changed files
with
21 additions
and
4 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
19 changes: 17 additions & 2 deletions
19
src/main/java/turniplabs/halplibe/mixin/mixins/GuiRenderItemMixin.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 |
---|---|---|
@@ -1,30 +1,45 @@ | ||
package turniplabs.halplibe.mixin.mixins; | ||
|
||
import com.llamalad7.mixinextras.sugar.Local; | ||
import com.llamalad7.mixinextras.sugar.ref.LocalBooleanRef; | ||
import net.minecraft.client.Minecraft; | ||
import net.minecraft.client.gui.Gui; | ||
import net.minecraft.client.gui.GuiRenderItem; | ||
import net.minecraft.core.item.ItemStack; | ||
import net.minecraft.core.player.inventory.slot.Slot; | ||
import org.spongepowered.asm.mixin.Debug; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.ModifyVariable; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
import turniplabs.halplibe.HalpLibe; | ||
|
||
@Debug(export = true) | ||
@Mixin( | ||
value = GuiRenderItem.class, | ||
remap = false | ||
remap = false, | ||
priority = -1 | ||
) | ||
public class GuiRenderItemMixin extends Gui { | ||
|
||
@Shadow | ||
Minecraft mc; | ||
|
||
@Inject(method = "render(Lnet/minecraft/core/item/ItemStack;IIZLnet/minecraft/core/player/inventory/slot/Slot;)V", at = @At("HEAD")) | ||
public void render(ItemStack itemStack, int x, int y, boolean isSelected, Slot slot, CallbackInfo ci) { | ||
public void setDiscovered(ItemStack itemStack, int x, int y, boolean isSelected, Slot slot, CallbackInfo ci) { | ||
if(mc.theWorld.getGameRule(HalpLibe.UNLOCK_ALL_RECIPES) && slot != null){ | ||
slot.discovered = true; | ||
} | ||
} | ||
|
||
|
||
@Inject(method = "render(Lnet/minecraft/core/item/ItemStack;IIZLnet/minecraft/core/player/inventory/slot/Slot;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/core/player/inventory/slot/Slot;getBackgroundIconIndex()I", shift = At.Shift.BEFORE)) | ||
public void setDiscovered2(ItemStack itemStack, int x, int y, boolean isSelected, Slot slot, CallbackInfo ci, @Local(ordinal = 2) LocalBooleanRef discovered) { | ||
if(mc.theWorld.getGameRule(HalpLibe.UNLOCK_ALL_RECIPES) && slot != null){ | ||
slot.discovered = true; | ||
discovered.set(true); | ||
} | ||
} | ||
} |
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