From 6911f81fe51a1e0b61ac099638e9ce2039b100de Mon Sep 17 00:00:00 2001 From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Date: Thu, 26 Aug 2021 18:14:38 +0200 Subject: command block to open pv --- .../moulberry/notenoughupdates/NEUEventListener.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/main/java') diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java index 08ef97a9..ea9994a7 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java @@ -937,6 +937,16 @@ public class NEUEventListener { GuiChest eventGui = (GuiChest) guiScreen; ContainerChest cc = (ContainerChest) eventGui.inventorySlots; containerName = cc.getLowerChestInventory().getDisplayName().getUnformattedText(); + if(containerName.endsWith(" Profile")){ + Slot slot = new Slot(cc.getLowerChestInventory(), 34, cc.inventorySlots.get(34).xDisplayPosition, cc.inventorySlots.get(34).yDisplayPosition); + slot.putStack(Utils.createItemStack(Item.getItemFromBlock(Blocks.command_block), EnumChatFormatting.GREEN + "Profile Viewer", + EnumChatFormatting.YELLOW + "Click to open NEU profile viewer!")); + cc.inventorySlots.replaceAll(e -> { + if(e.getSlotIndex() == 34) + return slot; + return e; + }); + } } if(GuiCustomEnchant.getInstance().shouldOverride(containerName)) { @@ -1386,6 +1396,12 @@ public class NEUEventListener { GuiChest eventGui = (GuiChest) guiScreen; ContainerChest cc = (ContainerChest) eventGui.inventorySlots; containerName = cc.getLowerChestInventory().getDisplayName().getUnformattedText(); + if(containerName.endsWith(" Profile") && eventGui.getSlotUnderMouse() != null && eventGui.getSlotUnderMouse().getSlotIndex() == 34 && + Mouse.getEventButton() >= 0) { + event.setCanceled(true); + Utils.playPressSound(); + NotEnoughUpdates.INSTANCE.viewProfileRunnable.processCommand(null, new String[]{containerName.replaceAll("'s? Profile", "")}); + } } if(GuiCustomEnchant.getInstance().shouldOverride(containerName) && -- cgit