blob: 08d0c7a1d577f5f31cf34dd10263e4a84147d839 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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;
}
}
}
}
|