diff options
author | bowser0000 <bowser0000@gmail.com> | 2021-04-08 08:43:19 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-08 08:43:19 -0400 |
commit | 14efcd8b81763d1c06a4291eeb6a0f1aaeb770fe (patch) | |
tree | 5b58218f51e6f358e5dd15946580dd7b7159c79a /src/main/java/me/Danker/features/StopSalvagingStarredItems.java | |
parent | 435d8dfd5a7f36803ceefcbd245e814ec735aced (diff) | |
parent | 8b1c19bff9ca13034e794ef76086e75aaf59bd14 (diff) | |
download | SkyblockMod-1.8.6.tar.gz SkyblockMod-1.8.6.tar.bz2 SkyblockMod-1.8.6.zip |
Merge pull request #91 from bowser0000/developmentv1.8.6
1.8.6
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; + } + } + } + +} |