diff options
Diffstat (limited to 'src/main/java/me/Danker/features/StopSalvagingStarredItems.java')
-rw-r--r-- | src/main/java/me/Danker/features/StopSalvagingStarredItems.java | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/main/java/me/Danker/features/StopSalvagingStarredItems.java b/src/main/java/me/Danker/features/StopSalvagingStarredItems.java new file mode 100644 index 0000000..08d0c7a --- /dev/null +++ b/src/main/java/me/Danker/features/StopSalvagingStarredItems.java @@ -0,0 +1,34 @@ +package me.Danker.features; + +import me.Danker.DankersSkyblockMod; +import me.Danker.commands.ToggleCommand; +import me.Danker.events.ChestSlotClickedEvent; +import net.minecraft.client.Minecraft; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ChatComponentText; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +public class StopSalvagingStarredItems { + + @SubscribeEvent + public void onSlotClick(ChestSlotClickedEvent event) { + ItemStack item = event.item; + if (ToggleCommand.stopSalvageStarredToggled && event.inventoryName.startsWith("Salvage")) { + if (item == null) return; + boolean inSalvageGui = false; + if (item.getDisplayName().contains("Salvage") || item.getDisplayName().contains("Essence")) { + ItemStack salvageItem = event.inventory.getStackInSlot(13); + if (salvageItem == null) return; + item = salvageItem; + inSalvageGui = true; + } + if (item.getDisplayName().contains("✪") && (event.slot.slotNumber > 53 || inSalvageGui)) { + Minecraft.getMinecraft().thePlayer.playSound("note.bass", 1, 0.5f); + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Danker's Skyblock Mod has stopped you from salvaging that item!")); + event.setCanceled(true); + return; + } + } + } + +} |