-
Notifications
You must be signed in to change notification settings - Fork 438
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Sychic
authored and
Sychic
committed
Feb 7, 2021
1 parent
4c0abc3
commit 5615b9f
Showing
4 changed files
with
148 additions
and
1 deletion.
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
42 changes: 42 additions & 0 deletions
42
src/main/java/skytils/skytilsmod/mixins/MixinGuiContainer.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 skytils.skytilsmod.mixins; | ||
|
||
import skytils.skytilsmod.Skytils; | ||
import skytils.skytilsmod.utils.Utils; | ||
import net.minecraft.client.gui.inventory.GuiContainer; | ||
import net.minecraft.init.Blocks; | ||
import net.minecraft.init.Items; | ||
import net.minecraft.inventory.Container; | ||
import net.minecraft.inventory.ContainerChest; | ||
import net.minecraft.inventory.Slot; | ||
import net.minecraft.item.Item; | ||
import net.minecraft.item.ItemStack; | ||
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.callback.CallbackInfo; | ||
|
||
@Mixin(GuiContainer.class) | ||
public class MixinGuiContainer { | ||
|
||
@Shadow public Container inventorySlots; | ||
|
||
@Inject(method = "drawSlot", at = @At("HEAD"), cancellable = true) | ||
private void onDrawSlot(Slot slot, CallbackInfo ci) { | ||
if (!Utils.inSkyblock) return; | ||
Container container = this.inventorySlots; | ||
if (container instanceof ContainerChest) { | ||
ContainerChest cc = (ContainerChest) container; | ||
String displayName = cc.getLowerChestInventory().getDisplayName().getUnformattedText().trim(); | ||
if (slot.getHasStack()) { | ||
ItemStack item = slot.getStack(); | ||
if (Skytils.config.spiritLeapNames && displayName.equals("Spirit Leap")) { | ||
if (item.getItem() == Item.getItemFromBlock(Blocks.stained_glass_pane)) { | ||
ci.cancel(); | ||
return; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
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