From 79edc1c59184ea038eee43a6a8001b39acdeba19 Mon Sep 17 00:00:00 2001 From: YoyoNow Date: Mon, 21 Apr 2025 00:02:13 +0200 Subject: [PATCH] Add Simulator to improvements --- .../simulator/gui/SimulatorGroupGui.java | 8 ++--- .../gui/SimulatorGroupSettingsGui.java | 34 +++++++++--------- .../features/simulator/gui/SimulatorGui.java | 2 +- .../simulator/gui/SimulatorMaterialGui.java | 2 +- .../simulator/gui/SimulatorObserverGui.java | 22 ++++++------ .../SimulatorObserverPhaseSettingsGui.java | 20 +++++------ .../gui/SimulatorObserverSettingsGui.java | 34 +++++++++--------- .../simulator/gui/SimulatorRedstoneGui.java | 22 ++++++------ .../SimulatorRedstonePhaseSettingsGui.java | 28 +++++++-------- .../gui/SimulatorRedstoneSettingsGui.java | 34 +++++++++--------- .../simulator/gui/SimulatorSettingsGui.java | 26 +++++++------- .../simulator/gui/SimulatorTNTGui.java | 26 +++++++------- .../gui/SimulatorTNTPhaseSettingsGui.java | 36 +++++++++---------- .../gui/SimulatorTNTSettingsGui.java | 34 +++++++++--------- .../simulator/gui/base/SimulatorPageGui.java | 8 ++--- .../gui/base/SimulatorScrollGui.java | 8 ++--- .../src/de/steamwar/inventory/SWItem.java | 32 ++++++++++++----- 17 files changed, 195 insertions(+), 181 deletions(-) diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorGroupGui.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorGroupGui.java index c3b8ee1a..185a22ca 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorGroupGui.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorGroupGui.java @@ -70,12 +70,12 @@ public class SimulatorGroupGui extends SimulatorPageGui> { inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> { back.open(); - })); + }).setCustomModelData(1)); inventory.setItem(8, new SWItem(Material.BARRIER, "§eDelete", clickType -> { simulatorGroup.getElements().clear(); SimulatorWatcher.update(simulator); - })); + }).setCustomModelData(1)); inventory.setItem(4, simulatorGroup.toItem(player, clickType -> { if (simulatorGroup.getMaterial() == null) return; @@ -85,7 +85,7 @@ public class SimulatorGroupGui extends SimulatorPageGui> { inventory.setItem(48, new SWItem(Material.REPEATER, "§eSettings", clickType -> { new SimulatorGroupSettingsGui(player, simulator, simulatorGroup, this).open(); - })); + }).setCustomModelData(1)); boolean disabled = simulatorGroup.getMaterial() == null ? simulatorGroup.getElements().stream().allMatch(SimulatorElement::isDisabled) : simulatorGroup.isDisabled(); inventory.setItem(50, new SWItem(disabled ? Material.ENDER_PEARL : Material.ENDER_EYE, simulatorGroup.isDisabled() ? "§cDisabled" : "§aEnabled", clickType -> { if (simulatorGroup.getMaterial() == null) { @@ -96,7 +96,7 @@ public class SimulatorGroupGui extends SimulatorPageGui> { simulatorGroup.setDisabled(!disabled); } SimulatorWatcher.update(simulator); - })); + }).setCustomModelData(1)); } @Override diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorGroupSettingsGui.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorGroupSettingsGui.java index ba5b984e..e7617297 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorGroupSettingsGui.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorGroupSettingsGui.java @@ -58,7 +58,7 @@ public class SimulatorGroupSettingsGui extends SimulatorBaseGui { // Back Arrow inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> { back.open(); - })); + }).setCustomModelData(1)); // Material Chooser inventory.setItem(4, simulatorGroup.toItem(player, clickType -> { @@ -69,10 +69,10 @@ public class SimulatorGroupSettingsGui extends SimulatorBaseGui { // Base Tick int baseTicks = simulatorGroup.getBaseTick(); - inventory.setItem(9, SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> { + inventory.setItem(9, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> { simulatorGroup.changeBaseTicks(clickType.isShiftClick() ? 5 : 1); SimulatorWatcher.update(simulator); - }); + }).setCustomModelData(3)); SWItem baseTick = new SWItem(Material.REPEATER, "§eTicks§8:§7 " + baseTicks, clickType -> { new SimulatorAnvilGui<>(player, "Ticks", baseTicks + "", Integer::parseInt, integer -> { if (integer < 0) return false; @@ -83,14 +83,14 @@ public class SimulatorGroupSettingsGui extends SimulatorBaseGui { }); baseTick.getItemStack().setAmount(Math.max(1, Math.min(baseTicks, 64))); inventory.setItem(18, baseTick); - inventory.setItem(27, SWItem.getDye(baseTicks > 0 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> { + inventory.setItem(27, new SWItem(SWItem.getDye(baseTicks > 0 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> { if (baseTicks - (clickType.isShiftClick() ? 5 : 1) < 0) { simulatorGroup.changeBaseTicks(-baseTicks); } else { simulatorGroup.changeBaseTicks(clickType.isShiftClick() ? -5 : -1); } SimulatorWatcher.update(simulator); - }); + }).setCustomModelData(3)); boolean allTNT = simulatorGroup.getElements().stream().allMatch(TNTElement.class::isInstance); @@ -163,10 +163,10 @@ public class SimulatorGroupSettingsGui extends SimulatorBaseGui { } //Pos X - inventory.setItem(15, SWItem.getDye(10), "§e+1", Arrays.asList(allTNT ? "§7Shift§8: §e+0.0625" : "§7Shift§8: §e+5"), false, clickType -> { + inventory.setItem(15, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList(allTNT ? "§7Shift§8: §e+0.0625" : "§7Shift§8: §e+5"), false, clickType -> { simulatorGroup.move(clickType.isShiftClick() ? (allTNT ? 0.0625 : 5) : 1, 0, 0); SimulatorWatcher.update(simulator); - }); + }).setCustomModelData(3)); inventory.setItem(24, new SWItem(Material.PAPER, "§eX", clickType -> { new SimulatorAnvilGui<>(player, "Relative X", "", Double::parseDouble, number -> { if(!allTNT){ @@ -177,16 +177,16 @@ public class SimulatorGroupSettingsGui extends SimulatorBaseGui { return true; }, this).setItem(Material.PAPER).open(); })); - inventory.setItem(33, SWItem.getDye(1), "§e-1", Arrays.asList(allTNT ? "§7Shift§8: §e-0.0625" : "§7Shift§8: §e-5"), false, clickType -> { + inventory.setItem(33, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList(allTNT ? "§7Shift§8: §e-0.0625" : "§7Shift§8: §e-5"), false, clickType -> { simulatorGroup.move(clickType.isShiftClick() ? (allTNT ? -0.0625 : -5) : -1, 0, 0); SimulatorWatcher.update(simulator); - }); + }).setCustomModelData(3)); //Pos Y - inventory.setItem(16, SWItem.getDye(10), "§e+1", Arrays.asList(allTNT ? "§7Shift§8: §e+0.0625" : "§7Shift§8: §e+5"), false, clickType -> { + inventory.setItem(16, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList(allTNT ? "§7Shift§8: §e+0.0625" : "§7Shift§8: §e+5"), false, clickType -> { simulatorGroup.move(0, clickType.isShiftClick() ? (allTNT ? 0.0625 : 5) : 1, 0); SimulatorWatcher.update(simulator); - }); + }).setCustomModelData(3)); inventory.setItem(25, new SWItem(Material.PAPER, "§eY", clickType -> { new SimulatorAnvilGui<>(player, "Relative Y", "", Double::parseDouble, number -> { if(!allTNT){ @@ -197,16 +197,16 @@ public class SimulatorGroupSettingsGui extends SimulatorBaseGui { return true; }, this).setItem(Material.PAPER).open(); })); - inventory.setItem(34, SWItem.getDye(1), "§e-1", Arrays.asList(allTNT ? "§7Shift§8: §e-0.0625" : "§7Shift§8: §e-5"), false, clickType -> { + inventory.setItem(34, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList(allTNT ? "§7Shift§8: §e-0.0625" : "§7Shift§8: §e-5"), false, clickType -> { simulatorGroup.move(0, clickType.isShiftClick() ? (allTNT ? -0.0625 : -5) : -1, 0); SimulatorWatcher.update(simulator); - }); + }).setCustomModelData(3)); //Pos Z - inventory.setItem(17, SWItem.getDye(10), "§e+1", Arrays.asList(allTNT ? "§7Shift§8: §e+0.0625" : "§7Shift§8: §e+5"), false, clickType -> { + inventory.setItem(17, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList(allTNT ? "§7Shift§8: §e+0.0625" : "§7Shift§8: §e+5"), false, clickType -> { simulatorGroup.move(0, 0, clickType.isShiftClick() ? (allTNT ? 0.0625 : 5) : 1); SimulatorWatcher.update(simulator); - }); + }).setCustomModelData(3)); inventory.setItem(26, new SWItem(Material.PAPER, "§eZ", clickType -> { new SimulatorAnvilGui<>(player, "Relative Z", "", Double::parseDouble, number -> { if(!allTNT){ @@ -217,9 +217,9 @@ public class SimulatorGroupSettingsGui extends SimulatorBaseGui { return true; }, this).setItem(Material.PAPER).open(); })); - inventory.setItem(35, SWItem.getDye(1), "§e-1", Arrays.asList(allTNT ? "§7Shift§8: §e-0.0625" : "§7Shift§8: §e-5"), false, clickType -> { + inventory.setItem(35, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList(allTNT ? "§7Shift§8: §e-0.0625" : "§7Shift§8: §e-5"), false, clickType -> { simulatorGroup.move(0, 0, clickType.isShiftClick() ? (allTNT ? -0.0625 : -5) : -1); SimulatorWatcher.update(simulator); - }); + }).setCustomModelData(3)); } } diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorGui.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorGui.java index e35f0eaa..e165b851 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorGui.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorGui.java @@ -50,7 +50,7 @@ public class SimulatorGui extends SimulatorPageGui { })); inventory.setItem(49, new SWItem(Material.REPEATER, "§eSettings", clickType -> { new SimulatorSettingsGui(player, simulator, this).open(); - })); + }).setCustomModelData(1)); } @Override diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorMaterialGui.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorMaterialGui.java index f081374d..8d57b830 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorMaterialGui.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorMaterialGui.java @@ -75,7 +75,7 @@ public class SimulatorMaterialGui extends SimulatorPageGui { })); inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> { back.open(); - })); + }).setCustomModelData(1)); } @Override diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorObserverGui.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorObserverGui.java index 42669387..dedcc69e 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorObserverGui.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorObserverGui.java @@ -82,12 +82,12 @@ public class SimulatorObserverGui extends SimulatorScrollGui { new SimulatorGroupGui(player, simulator, newParent, simulatorGui).open(); } } - })); + }).setCustomModelData(1)); inventory.setItem(8, new SWItem(Material.BARRIER, "§eDelete", clickType -> { observer.getPhases().clear(); SimulatorWatcher.update(simulator); - })); + }).setCustomModelData(1)); // Material Chooser inventory.setItem(4, observer.toItem(player, clickType -> { @@ -97,18 +97,18 @@ public class SimulatorObserverGui extends SimulatorScrollGui { // Settings inventory.setItem(47, new SWItem(Material.REPEATER, "§eSettings", clickType -> { new SimulatorObserverSettingsGui(player, simulator, observer, this).open(); - })); + }).setCustomModelData(1)); // Enable/Disable inventory.setItem(48, new SWItem(observer.isDisabled() ? Material.ENDER_PEARL : Material.ENDER_EYE, observer.isDisabled() ? "§cDisabled" : "§aEnabled", clickType -> { observer.setDisabled(!observer.isDisabled()); SimulatorWatcher.update(simulator); - })); + }).setCustomModelData(1)); // Group chooser inventory.setItem(51, new SWItem(Material.LEAD, "§eJoin Group", clickType -> { new SimulatorGroupChooserGui(player, simulator, observer, observer.getGroup(simulator), this).open(); - })); + }).setCustomModelData(1)); } @Override @@ -151,15 +151,15 @@ public class SimulatorObserverGui extends SimulatorScrollGui { new SWItem(SWItem.getDye(getter.get() < max ? 10 : 8), "§e+1", Arrays.asList("§7Shift§8:§e +5"), false, clickType -> { setter.accept(Math.min(max, getter.get() + (clickType.isShiftClick() ? 5 : 1))); SimulatorWatcher.update(simulator); - }), + }).setCustomModelData(3), observer, new SWItem(SWItem.getDye(getter.get() > min ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8:§e -5"), false, clickType -> { setter.accept(Math.max(min, getter.get() - (clickType.isShiftClick() ? 5 : 1))); SimulatorWatcher.update(simulator); - }), + }).setCustomModelData(3), new SWItem(Material.ANVIL, "§eEdit Activation", clickType -> { new SimulatorObserverPhaseSettingsGui(player, simulator, this.observer, observerPhase, this).open(); - }), + }).setCustomModelData(1), }; } @@ -168,12 +168,12 @@ public class SimulatorObserverGui extends SimulatorScrollGui { return new SWItem[]{ new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8:§e +5"), false, clickType -> { addNewPhase(clickType.isShiftClick()); - }), + }).setCustomModelData(3), new SWItem(Material.QUARTZ, "§eObserver§8:§a New Phase", clickType -> { addNewPhase(false); - }), + }).setCustomModelData(1), new SWItem(SWItem.getDye(8), "§7", clickType -> { - }), + }).setCustomModelData(3), }; } diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorObserverPhaseSettingsGui.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorObserverPhaseSettingsGui.java index f7925c34..0653ef98 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorObserverPhaseSettingsGui.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorObserverPhaseSettingsGui.java @@ -62,7 +62,7 @@ public class SimulatorObserverPhaseSettingsGui extends SimulatorBaseGui { // Back Arrow inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> { back.open(); - })); + }).setCustomModelData(1)); // Material Chooser inventory.setItem(4, observerElement.toItem(player, clickType -> { @@ -74,7 +74,7 @@ public class SimulatorObserverPhaseSettingsGui extends SimulatorBaseGui { observerElement.getPhases().remove(observer); back.open(); SimulatorWatcher.update(simulator); - })); + }).setCustomModelData(1)); int index = observerElement.getPhases().indexOf(observer); int min; @@ -95,10 +95,10 @@ public class SimulatorObserverPhaseSettingsGui extends SimulatorBaseGui { //Tick Offset int offset = observer.getTickOffset(); - inventory.setItem(10, SWItem.getDye(offset < max ? 10 : 8), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> { + inventory.setItem(10, new SWItem(SWItem.getDye(offset < max ? 10 : 8), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> { observer.setTickOffset(Math.min(max, offset + (clickType.isShiftClick() ? 5 : 1))); SimulatorWatcher.update(simulator); - }); + }).setCustomModelData(3)); SWItem offsetItem = new SWItem(Material.REPEATER, "§eStart at§8:§7 " + offset, clickType -> { new SimulatorAnvilGui<>(player, "Start at", offset + "", Integer::parseInt, integer -> { @@ -111,17 +111,17 @@ public class SimulatorObserverPhaseSettingsGui extends SimulatorBaseGui { offsetItem.getItemStack().setAmount(Math.max(1, Math.min(offset, 64))); inventory.setItem(19, offsetItem); - inventory.setItem(28, SWItem.getDye(offset > min ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> { + inventory.setItem(28, new SWItem(SWItem.getDye(offset > min ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> { observer.setTickOffset(Math.max(min, offset - (clickType.isShiftClick() ? 5 : 1))); SimulatorWatcher.update(simulator); - }); + }).setCustomModelData(3)); //Order int order = observer.getOrder(); - inventory.setItem(13, SWItem.getDye(order < SimulatorPhase.ORDER_LIMIT ? 10 : 8), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> { + inventory.setItem(13, new SWItem(SWItem.getDye(order < SimulatorPhase.ORDER_LIMIT ? 10 : 8), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> { observer.setOrder(Math.min(SimulatorPhase.ORDER_LIMIT, order + (clickType.isShiftClick() ? 5 : 1))); SimulatorWatcher.update(simulator); - }); + }).setCustomModelData(3)); Material negativeNumbers = Material.getMaterial(Core.getVersion() >= 19 ? "RECOVERY_COMPASS" : "FIREWORK_STAR"); SWItem orderItem = new SWItem(order >= 0 ? Material.COMPASS : negativeNumbers, "§eActivation Order§8:§7 " + order, clickType -> { @@ -136,10 +136,10 @@ public class SimulatorObserverPhaseSettingsGui extends SimulatorBaseGui { orderItem.getItemStack().setAmount(Math.max(1, Math.min(Math.abs(order), 30))); inventory.setItem(22, orderItem); - inventory.setItem(31, SWItem.getDye(order > -SimulatorPhase.ORDER_LIMIT ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> { + inventory.setItem(31, new SWItem(SWItem.getDye(order > -SimulatorPhase.ORDER_LIMIT ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> { observer.setOrder(Math.max(-SimulatorPhase.ORDER_LIMIT, order - (clickType.isShiftClick() ? 5 : 1))); SimulatorWatcher.update(simulator); - }); + }).setCustomModelData(3)); // Update orientation inventory.setItem(25, new SWItem(Material.SUNFLOWER, "§7", clickType -> { diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorObserverSettingsGui.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorObserverSettingsGui.java index 8084c7b1..302245b3 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorObserverSettingsGui.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorObserverSettingsGui.java @@ -56,7 +56,7 @@ public class SimulatorObserverSettingsGui extends SimulatorBaseGui { // Back Arrow inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> { back.open(); - })); + }).setCustomModelData(1)); // Material Chooser inventory.setItem(4, observer.toItem(player, clickType -> { @@ -65,10 +65,10 @@ public class SimulatorObserverSettingsGui extends SimulatorBaseGui { // Base Tick int baseTicks = observer.getBaseTick(); - inventory.setItem(9, SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> { + inventory.setItem(9, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> { observer.changeBaseTicks(clickType.isShiftClick() ? 5 : 1); SimulatorWatcher.update(simulator); - }); + }).setCustomModelData(3)); SWItem baseTick = new SWItem(Material.REPEATER, "§eTicks§8:§7 " + baseTicks, clickType -> { new SimulatorAnvilGui<>(player, "Ticks", baseTicks + "", Integer::parseInt, integer -> { if (integer < 0) return false; @@ -79,20 +79,20 @@ public class SimulatorObserverSettingsGui extends SimulatorBaseGui { }); baseTick.getItemStack().setAmount(Math.max(1, Math.min(baseTicks, 64))); inventory.setItem(18, baseTick); - inventory.setItem(27, SWItem.getDye(baseTicks > 0 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> { + inventory.setItem(27, new SWItem(SWItem.getDye(baseTicks > 0 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> { if (baseTicks - (clickType.isShiftClick() ? 5 : 1) < 0) { observer.changeBaseTicks(-baseTicks); } else { observer.changeBaseTicks(clickType.isShiftClick() ? -5 : -1); } SimulatorWatcher.update(simulator); - }); + }).setCustomModelData(3)); //Pos X - inventory.setItem(15, SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> { + inventory.setItem(15, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> { observer.move(clickType.isShiftClick() ? 5 : 1, 0, 0); SimulatorWatcher.update(simulator); - }); + }).setCustomModelData(3)); inventory.setItem(24, new SWItem(Material.PAPER, "§eX§8:§7 " + observer.getPosition().getBlockX(), clickType -> { new SimulatorAnvilGui<>(player, "X", observer.getPosition().getBlockX() + "", Integer::parseInt, i -> { observer.getPosition().setX(i); @@ -100,16 +100,16 @@ public class SimulatorObserverSettingsGui extends SimulatorBaseGui { return true; }, this).open(); })); - inventory.setItem(33, SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> { + inventory.setItem(33, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> { observer.move(clickType.isShiftClick() ? -5 : -1, 0, 0); SimulatorWatcher.update(simulator); - }); + }).setCustomModelData(3)); //Pos Y - inventory.setItem(16, SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> { + inventory.setItem(16, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> { observer.move(0, clickType.isShiftClick() ? 5 : 1, 0); SimulatorWatcher.update(simulator); - }); + }).setCustomModelData(3)); inventory.setItem(25, new SWItem(Material.PAPER, "§eY§8:§7 " + observer.getPosition().getBlockY(), clickType -> { new SimulatorAnvilGui<>(player, "Y", observer.getPosition().getBlockY() + "", Integer::parseInt, i -> { observer.getPosition().setY(i); @@ -117,16 +117,16 @@ public class SimulatorObserverSettingsGui extends SimulatorBaseGui { return true; }, this).open(); })); - inventory.setItem(34, SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> { + inventory.setItem(34, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> { observer.move(0, clickType.isShiftClick() ? -5 : -1, 0); SimulatorWatcher.update(simulator); - }); + }).setCustomModelData(3)); //Pos Z - inventory.setItem(17, SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> { + inventory.setItem(17, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> { observer.move(0, 0, clickType.isShiftClick() ? 5 : 1); SimulatorWatcher.update(simulator); - }); + }).setCustomModelData(3)); inventory.setItem(26, new SWItem(Material.PAPER, "§eZ§8:§7 " + observer.getPosition().getBlockZ(), clickType -> { new SimulatorAnvilGui<>(player, "Z", observer.getPosition().getBlockZ() + "", Integer::parseInt, i -> { observer.getPosition().setZ(i); @@ -134,9 +134,9 @@ public class SimulatorObserverSettingsGui extends SimulatorBaseGui { return true; }, this).open(); })); - inventory.setItem(35, SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> { + inventory.setItem(35, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> { observer.move(0, 0, clickType.isShiftClick() ? -5 : -1); SimulatorWatcher.update(simulator); - }); + }).setCustomModelData(3)); } } diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorRedstoneGui.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorRedstoneGui.java index 2e288895..9764621a 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorRedstoneGui.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorRedstoneGui.java @@ -88,12 +88,12 @@ public class SimulatorRedstoneGui extends SimulatorScrollGui { redstone.getPhases().clear(); SimulatorWatcher.update(simulator); - })); + }).setCustomModelData(1)); // Material Chooser inventory.setItem(4, redstone.toItem(player, clickType -> { @@ -103,18 +103,18 @@ public class SimulatorRedstoneGui extends SimulatorScrollGui { new SimulatorRedstoneSettingsGui(player, simulator, redstone, this).open(); - })); + }).setCustomModelData(1)); // Enable/Disable inventory.setItem(48, new SWItem(redstone.isDisabled() ? Material.ENDER_PEARL : Material.ENDER_EYE, redstone.isDisabled() ? "§cDisabled" : "§aEnabled", clickType -> { redstone.setDisabled(!redstone.isDisabled()); SimulatorWatcher.update(simulator); - })); + }).setCustomModelData(1)); // Group chooser inventory.setItem(51, new SWItem(Material.LEAD, "§eJoin Group", clickType -> { new SimulatorGroupChooserGui(player, simulator, redstone, redstone.getGroup(simulator), this).open(); - })); + }).setCustomModelData(1)); } @Override @@ -166,15 +166,15 @@ public class SimulatorRedstoneGui extends SimulatorScrollGui { setter.accept(Math.min(max, getter.get() + (clickType.isShiftClick() ? 5 : 1))); SimulatorWatcher.update(simulator); - }), + }).setCustomModelData(3), redstone, new SWItem(SWItem.getDye(getter.get() > min ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8:§e -5"), false, clickType -> { setter.accept(Math.max(min, getter.get() - (clickType.isShiftClick() ? 5 : 1))); SimulatorWatcher.update(simulator); - }), + }).setCustomModelData(3), new SWItem(Material.ANVIL, "§eEdit Activation", clickType -> { new SimulatorRedstonePhaseSettingsGui(player, simulator, this.redstone, redstoneSubPhase.phase, this).open(); - }), + }).setCustomModelData(1), }; } @@ -183,12 +183,12 @@ public class SimulatorRedstoneGui extends SimulatorScrollGui { addNewPhase(clickType.isShiftClick()); - }), + }).setCustomModelData(3), new SWItem(Material.REDSTONE, "§eRedstone§8:§a New Phase", clickType -> { addNewPhase(false); - }), + }).setCustomModelData(1), new SWItem(SWItem.getDye(8), "§7", clickType -> { - }), + }).setCustomModelData(3), }; } diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorRedstonePhaseSettingsGui.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorRedstonePhaseSettingsGui.java index 27901b09..29ae1525 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorRedstonePhaseSettingsGui.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorRedstonePhaseSettingsGui.java @@ -60,7 +60,7 @@ public class SimulatorRedstonePhaseSettingsGui extends SimulatorBaseGui { // Back Arrow inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> { back.open(); - })); + }).setCustomModelData(1)); // Material Chooser inventory.setItem(4, redstoneElement.toItem(player, clickType -> { @@ -72,7 +72,7 @@ public class SimulatorRedstonePhaseSettingsGui extends SimulatorBaseGui { redstoneElement.getPhases().remove(redstone); back.open(); SimulatorWatcher.update(simulator); - })); + }).setCustomModelData(1)); int index = redstoneElement.getPhases().indexOf(redstone); int min; @@ -96,10 +96,10 @@ public class SimulatorRedstonePhaseSettingsGui extends SimulatorBaseGui { //Tick Offset int offset = redstone.getTickOffset(); - inventory.setItem(10, SWItem.getDye(offset < maxOffset ? 10 : 8), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> { + inventory.setItem(10, new SWItem(SWItem.getDye(offset < maxOffset ? 10 : 8), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> { redstone.setTickOffset(Math.min(maxOffset, offset + (clickType.isShiftClick() ? 5 : 1))); SimulatorWatcher.update(simulator); - }); + }).setCustomModelData(3)); SWItem offsetItem = new SWItem(Material.REPEATER, "§eStart at§8:§7 " + offset, clickType -> { new SimulatorAnvilGui<>(player, "Start at", offset + "", Integer::parseInt, integer -> { @@ -112,17 +112,17 @@ public class SimulatorRedstonePhaseSettingsGui extends SimulatorBaseGui { offsetItem.getItemStack().setAmount(Math.max(1, Math.min(offset, 64))); inventory.setItem(19, offsetItem); - inventory.setItem(28, SWItem.getDye(offset > min ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> { + inventory.setItem(28, new SWItem(SWItem.getDye(offset > min ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> { redstone.setTickOffset(Math.max(min, offset - (clickType.isShiftClick() ? 5 : 1))); SimulatorWatcher.update(simulator); - }); + }).setCustomModelData(3)); //Lifetime int lifetime = redstone.getLifetime(); - inventory.setItem(11, SWItem.getDye(lifetime < maxLifetime ? 10 : 8), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> { + inventory.setItem(11, new SWItem(SWItem.getDye(lifetime < maxLifetime ? 10 : 8), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> { redstone.setLifetime(Math.min(maxLifetime, lifetime + (clickType.isShiftClick() ? 5 : 1))); SimulatorWatcher.update(simulator); - }); + }).setCustomModelData(3)); SWItem lifetimeItem = new SWItem(Material.CLOCK, "§eActivation Time§8:§7 " + lifetime, clickType -> { new SimulatorAnvilGui<>(player, "Activation Time", lifetime + "", Integer::parseInt, integer -> { @@ -135,17 +135,17 @@ public class SimulatorRedstonePhaseSettingsGui extends SimulatorBaseGui { lifetimeItem.getItemStack().setAmount(Math.max(1, Math.min(lifetime, 64))); inventory.setItem(20, lifetimeItem); - inventory.setItem(29, SWItem.getDye(lifetime > 0 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> { + inventory.setItem(29, new SWItem(SWItem.getDye(lifetime > 0 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> { redstone.setLifetime(Math.max(0, lifetime - (clickType.isShiftClick() ? 5 : 1))); SimulatorWatcher.update(simulator); - }); + }).setCustomModelData(3)); //Order int order = redstone.getOrder(); - inventory.setItem(13, SWItem.getDye(order < SimulatorPhase.ORDER_LIMIT ? 10 : 8), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> { + inventory.setItem(13, new SWItem(SWItem.getDye(order < SimulatorPhase.ORDER_LIMIT ? 10 : 8), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> { redstone.setOrder(Math.min(SimulatorPhase.ORDER_LIMIT, order + (clickType.isShiftClick() ? 5 : 1))); SimulatorWatcher.update(simulator); - }); + }).setCustomModelData(3)); Material negativeNumbers = Material.getMaterial(Core.getVersion() >= 19 ? "RECOVERY_COMPASS" : "FIREWORK_STAR"); SWItem orderItem = new SWItem(order >= 0 ? Material.COMPASS : negativeNumbers, "§eActivation Order§8:§7 " + order, clickType -> { @@ -160,9 +160,9 @@ public class SimulatorRedstonePhaseSettingsGui extends SimulatorBaseGui { orderItem.getItemStack().setAmount(Math.max(1, Math.min(Math.abs(order), 30))); inventory.setItem(22, orderItem); - inventory.setItem(31, SWItem.getDye(order > -SimulatorPhase.ORDER_LIMIT ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> { + inventory.setItem(31, new SWItem(SWItem.getDye(order > -SimulatorPhase.ORDER_LIMIT ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> { redstone.setOrder(Math.max(-SimulatorPhase.ORDER_LIMIT, order - (clickType.isShiftClick() ? 5 : 1))); SimulatorWatcher.update(simulator); - }); + }).setCustomModelData(3)); } } diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorRedstoneSettingsGui.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorRedstoneSettingsGui.java index 184d73a1..f8e6b3b8 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorRedstoneSettingsGui.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorRedstoneSettingsGui.java @@ -55,7 +55,7 @@ public class SimulatorRedstoneSettingsGui extends SimulatorBaseGui { // Back Arrow inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> { back.open(); - })); + }).setCustomModelData(1)); // Material Chooser inventory.setItem(4, redstone.toItem(player, clickType -> { @@ -64,10 +64,10 @@ public class SimulatorRedstoneSettingsGui extends SimulatorBaseGui { // Base Tick int baseTicks = redstone.getBaseTick(); - inventory.setItem(9, SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> { + inventory.setItem(9, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> { redstone.changeBaseTicks(clickType.isShiftClick() ? 5 : 1); SimulatorWatcher.update(simulator); - }); + }).setCustomModelData(3)); SWItem baseTick = new SWItem(Material.REPEATER, "§eTicks§8:§7 " + baseTicks, clickType -> { new SimulatorAnvilGui<>(player, "Ticks", baseTicks + "", Integer::parseInt, integer -> { if (integer < 0) return false; @@ -78,20 +78,20 @@ public class SimulatorRedstoneSettingsGui extends SimulatorBaseGui { }); baseTick.getItemStack().setAmount(Math.max(1, Math.min(baseTicks, 64))); inventory.setItem(18, baseTick); - inventory.setItem(27, SWItem.getDye(baseTicks > 0 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> { + inventory.setItem(27, new SWItem(SWItem.getDye(baseTicks > 0 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> { if (baseTicks - (clickType.isShiftClick() ? 5 : 1) < 0) { redstone.changeBaseTicks(-baseTicks); } else { redstone.changeBaseTicks(clickType.isShiftClick() ? -5 : -1); } SimulatorWatcher.update(simulator); - }); + }).setCustomModelData(3)); //Pos X - inventory.setItem(15, SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> { + inventory.setItem(15, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> { redstone.move(clickType.isShiftClick() ? 5 : 1, 0, 0); SimulatorWatcher.update(simulator); - }); + }).setCustomModelData(3)); inventory.setItem(24, new SWItem(Material.PAPER, "§eX§8:§7 " + redstone.getPosition().getBlockX(), clickType -> { new SimulatorAnvilGui<>(player, "X", redstone.getPosition().getBlockX() + "", Integer::parseInt, i -> { redstone.getPosition().setX(i); @@ -99,16 +99,16 @@ public class SimulatorRedstoneSettingsGui extends SimulatorBaseGui { return true; }, this).open(); })); - inventory.setItem(33, SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> { + inventory.setItem(33, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> { redstone.move(clickType.isShiftClick() ? -5 : -1, 0, 0); SimulatorWatcher.update(simulator); - }); + }).setCustomModelData(3)); //Pos Y - inventory.setItem(16, SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> { + inventory.setItem(16, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> { redstone.move(0, clickType.isShiftClick() ? 5 : 1, 0); SimulatorWatcher.update(simulator); - }); + }).setCustomModelData(3)); inventory.setItem(25, new SWItem(Material.PAPER, "§eY§8:§7 " + redstone.getPosition().getBlockY(), clickType -> { new SimulatorAnvilGui<>(player, "Y", redstone.getPosition().getBlockY() + "", Integer::parseInt, i -> { redstone.getPosition().setY(i); @@ -116,16 +116,16 @@ public class SimulatorRedstoneSettingsGui extends SimulatorBaseGui { return true; }, this).open(); })); - inventory.setItem(34, SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> { + inventory.setItem(34, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> { redstone.move(0, clickType.isShiftClick() ? -5 : -1, 0); SimulatorWatcher.update(simulator); - }); + }).setCustomModelData(3)); //Pos Z - inventory.setItem(17, SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> { + inventory.setItem(17, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> { redstone.move(0, 0, clickType.isShiftClick() ? 5 : 1); SimulatorWatcher.update(simulator); - }); + }).setCustomModelData(3)); inventory.setItem(26, new SWItem(Material.PAPER, "§eZ§8:§7 " + redstone.getPosition().getBlockZ(), clickType -> { new SimulatorAnvilGui<>(player, "Z", redstone.getPosition().getBlockZ() + "", Integer::parseInt, i -> { redstone.getPosition().setZ(i); @@ -133,9 +133,9 @@ public class SimulatorRedstoneSettingsGui extends SimulatorBaseGui { return true; }, this).open(); })); - inventory.setItem(35, SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> { + inventory.setItem(35, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> { redstone.move(0, 0, clickType.isShiftClick() ? -5 : -1); SimulatorWatcher.update(simulator); - }); + }).setCustomModelData(3)); } } diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorSettingsGui.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorSettingsGui.java index ccb00412..48b35725 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorSettingsGui.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorSettingsGui.java @@ -47,7 +47,7 @@ public class SimulatorSettingsGui extends SimulatorBaseGui { // Back Arrow inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> { back.open(); - })); + }).setCustomModelData(1)); // Material Chooser inventory.setItem(4, simulator.toItem(player, clickType -> { @@ -61,39 +61,39 @@ public class SimulatorSettingsGui extends SimulatorBaseGui { })); //Pos X - inventory.setItem(15, SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> { + inventory.setItem(15, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> { simulator.move(clickType.isShiftClick() ? 5 : 1, 0, 0); SimulatorWatcher.update(simulator); - }); + }).setCustomModelData(3)); inventory.setItem(24, new SWItem(Material.PAPER, "§eX", clickType -> { })); - inventory.setItem(33, SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> { + inventory.setItem(33, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> { simulator.move(clickType.isShiftClick() ? -5 : -1, 0, 0); SimulatorWatcher.update(simulator); - }); + }).setCustomModelData(3)); //Pos Y - inventory.setItem(16, SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> { + inventory.setItem(16, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> { simulator.move(0, clickType.isShiftClick() ? 5 : 1, 0); SimulatorWatcher.update(simulator); - }); + }).setCustomModelData(3)); inventory.setItem(25, new SWItem(Material.PAPER, "§eY", clickType -> { })); - inventory.setItem(34, SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> { + inventory.setItem(34, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> { simulator.move(0, clickType.isShiftClick() ? -5 : -1, 0); SimulatorWatcher.update(simulator); - }); + }).setCustomModelData(3)); //Pos Z - inventory.setItem(17, SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> { + inventory.setItem(17, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> { simulator.move(0, 0, clickType.isShiftClick() ? 5 : 1); SimulatorWatcher.update(simulator); - }); + }).setCustomModelData(3)); inventory.setItem(26, new SWItem(Material.PAPER, "§eZ", clickType -> { })); - inventory.setItem(35, SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> { + inventory.setItem(35, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> { simulator.move(0, 0, clickType.isShiftClick() ? -5 : -1); SimulatorWatcher.update(simulator); - }); + }).setCustomModelData(3)); } } diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorTNTGui.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorTNTGui.java index 3520720e..a9b660d5 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorTNTGui.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorTNTGui.java @@ -81,12 +81,12 @@ public class SimulatorTNTGui extends SimulatorScrollGui { new SimulatorGroupGui(player, simulator, newParent, simulatorGui).open(); } } - })); + }).setCustomModelData(1)); inventory.setItem(8, new SWItem(Material.BARRIER, "§eDelete", clickType -> { tnt.getPhases().clear(); SimulatorWatcher.update(simulator); - })); + }).setCustomModelData(1)); // Material Chooser inventory.setItem(4, tnt.toItem(player, clickType -> { @@ -95,11 +95,11 @@ public class SimulatorTNTGui extends SimulatorScrollGui { inventory.setItem(47, new SWItem(Material.REPEATER, "§eSettings", clickType -> { new SimulatorTNTSettingsGui(player, simulator, tnt, this).open(); - })); + }).setCustomModelData(1)); inventory.setItem(48, new SWItem(tnt.isDisabled() ? Material.ENDER_PEARL : Material.ENDER_EYE, tnt.isDisabled() ? "§cDisabled" : "§aEnabled", clickType -> { tnt.setDisabled(!tnt.isDisabled()); SimulatorWatcher.update(simulator); - })); + }).setCustomModelData(1)); inventory.setItem(49, new SWItem(Material.CALIBRATED_SCULK_SENSOR, "§eCreate Stab", click -> { new SimulatorAnvilGui<>(player, "Depth Limit", "", Integer::parseInt, depthLimit -> { if (depthLimit <= 0) return false; @@ -107,17 +107,17 @@ public class SimulatorTNTGui extends SimulatorScrollGui { SimulatorWatcher.update(simulator); return true; }, null).open(); - })); + }).setCustomModelData(1)); inventory.setItem(50, new SWItem(Material.CHEST, parent.getElements().size() == 1 ? "§eMake Group" : "§eAdd another TNT to Group", clickType -> { TNTElement tntElement = new TNTElement(tnt.getPosition().clone()); tntElement.add(new TNTPhase()); parent.add(tntElement); new SimulatorGroupGui(player, simulator, parent, new SimulatorGui(player, simulator)).open(); SimulatorWatcher.update(simulator); - })); + }).setCustomModelData(1)); inventory.setItem(51, new SWItem(Material.LEAD, "§eJoin Group", clickType -> { new SimulatorGroupChooserGui(player, simulator, tnt, tnt.getGroup(simulator), this).open(); - })); + }).setCustomModelData(1)); } @Override @@ -136,15 +136,15 @@ public class SimulatorTNTGui extends SimulatorScrollGui { new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8:§e +5"), false, clickType -> { tntSetting.setCount(tntSetting.getCount() + (clickType.isShiftClick() ? 5 : 1)); SimulatorWatcher.update(simulator); - }), + }).setCustomModelData(3), tnt, new SWItem(SWItem.getDye(tntSetting.getCount() > 1 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8:§e -5"), false, clickType -> { tntSetting.setCount(Math.max(1, tntSetting.getCount() - (clickType.isShiftClick() ? 5 : 1))); SimulatorWatcher.update(simulator); - }), + }).setCustomModelData(3), new SWItem(Material.ANVIL, "§eEdit Phase", clickType -> { new SimulatorTNTPhaseSettingsGui(player, simulator, this.tnt, tntSetting, this).open(); - }), + }).setCustomModelData(1), }; } @@ -153,12 +153,12 @@ public class SimulatorTNTGui extends SimulatorScrollGui { return new SWItem[]{ new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8:§e +5"), false, clickType -> { addNewPhase(clickType.isShiftClick()); - }), + }).setCustomModelData(3), new SWItem(Material.GUNPOWDER, "§eTNT§8:§a New Phase", clickType -> { addNewPhase(false); - }), + }).setCustomModelData(1), new SWItem(SWItem.getDye(8), "§7", clickType -> { - }), + }).setCustomModelData(3), }; } diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorTNTPhaseSettingsGui.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorTNTPhaseSettingsGui.java index 9bfc4fe5..fd78d18a 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorTNTPhaseSettingsGui.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorTNTPhaseSettingsGui.java @@ -60,7 +60,7 @@ public class SimulatorTNTPhaseSettingsGui extends SimulatorBaseGui { // Back Arrow inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> { back.open(); - })); + }).setCustomModelData(1)); // Material Chooser inventory.setItem(4, tntElement.toItem(player, clickType -> { @@ -72,14 +72,14 @@ public class SimulatorTNTPhaseSettingsGui extends SimulatorBaseGui { tntElement.getPhases().remove(tnt); back.open(); SimulatorWatcher.update(simulator); - })); + }).setCustomModelData(1)); //Count int count = tnt.getCount(); - inventory.setItem(9, SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> { + inventory.setItem(9, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> { tnt.setCount(count + (clickType.isShiftClick() ? 5 : 1)); SimulatorWatcher.update(simulator); - }); + }).setCustomModelData(3)); SWItem countItem = new SWItem(Material.TNT, "§eCount§8:§7 " + count, clickType -> { new SimulatorAnvilGui<>(player, "Count", count + "", Integer::parseInt, integer -> { @@ -92,17 +92,17 @@ public class SimulatorTNTPhaseSettingsGui extends SimulatorBaseGui { countItem.getItemStack().setAmount(Math.max(1, Math.min(count, 64))); inventory.setItem(18, countItem); - inventory.setItem(27, SWItem.getDye(count > 1 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> { + inventory.setItem(27, new SWItem(SWItem.getDye(count > 1 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> { tnt.setCount(Math.max(1, count - (clickType.isShiftClick() ? 5 : 1))); SimulatorWatcher.update(simulator); - }); + }).setCustomModelData(3)); //Tick Offset int offset = tnt.getTickOffset(); - inventory.setItem(10, SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> { + inventory.setItem(10, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> { tnt.setTickOffset(offset + (clickType.isShiftClick() ? 5 : 1)); SimulatorWatcher.update(simulator); - }); + }).setCustomModelData(3)); SWItem offsetItem = new SWItem(Material.REPEATER, "§eStart at§8:§7 " + offset, clickType -> { new SimulatorAnvilGui<>(player, "Start at", offset + "", Integer::parseInt, integer -> { @@ -115,17 +115,17 @@ public class SimulatorTNTPhaseSettingsGui extends SimulatorBaseGui { offsetItem.getItemStack().setAmount(Math.max(1, Math.min(offset, 64))); inventory.setItem(19, offsetItem); - inventory.setItem(28, SWItem.getDye(offset > 0 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> { + inventory.setItem(28, new SWItem(SWItem.getDye(offset > 0 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> { tnt.setTickOffset(Math.max(0, offset - (clickType.isShiftClick() ? 5 : 1))); SimulatorWatcher.update(simulator); - }); + }).setCustomModelData(3)); //Lifetime int lifetime = tnt.getLifetime(); - inventory.setItem(11, SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> { + inventory.setItem(11, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> { tnt.setLifetime(lifetime + (clickType.isShiftClick() ? 5 : 1)); SimulatorWatcher.update(simulator); - }); + }).setCustomModelData(3)); SWItem lifetimeItem = new SWItem(Material.CLOCK, "§eLifetime§8:§7 " + lifetime, clickType -> { new SimulatorAnvilGui<>(player, "Lifetime", lifetime + "", Integer::parseInt, integer -> { @@ -138,17 +138,17 @@ public class SimulatorTNTPhaseSettingsGui extends SimulatorBaseGui { lifetimeItem.getItemStack().setAmount(Math.max(1, Math.min(lifetime, 64))); inventory.setItem(20, lifetimeItem); - inventory.setItem(29, SWItem.getDye(lifetime > 0 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> { + inventory.setItem(29, new SWItem(SWItem.getDye(lifetime > 0 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> { tnt.setLifetime(Math.max(1, lifetime - (clickType.isShiftClick() ? 5 : 1))); SimulatorWatcher.update(simulator); - }); + }).setCustomModelData(3)); //Order int order = tnt.getOrder(); - inventory.setItem(13, SWItem.getDye(order < SimulatorPhase.ORDER_LIMIT ? 10 : 8), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> { + inventory.setItem(13, new SWItem(SWItem.getDye(order < SimulatorPhase.ORDER_LIMIT ? 10 : 8), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> { tnt.setOrder(Math.min(SimulatorPhase.ORDER_LIMIT, order + (clickType.isShiftClick() ? 5 : 1))); SimulatorWatcher.update(simulator); - }); + }).setCustomModelData(3)); Material negativeNumbers = Material.getMaterial(Core.getVersion() >= 19 ? "RECOVERY_COMPASS" : "FIREWORK_STAR"); SWItem orderItem = new SWItem(order >= 0 ? Material.COMPASS : negativeNumbers, "§eCalculation Order§8:§7 " + order, clickType -> { @@ -163,10 +163,10 @@ public class SimulatorTNTPhaseSettingsGui extends SimulatorBaseGui { orderItem.getItemStack().setAmount(Math.max(1, Math.min(Math.abs(order), 30))); inventory.setItem(22, orderItem); - inventory.setItem(31, SWItem.getDye(order > -SimulatorPhase.ORDER_LIMIT ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> { + inventory.setItem(31, new SWItem(SWItem.getDye(order > -SimulatorPhase.ORDER_LIMIT ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> { tnt.setOrder(Math.max(-SimulatorPhase.ORDER_LIMIT, order - (clickType.isShiftClick() ? 5 : 1))); SimulatorWatcher.update(simulator); - }); + }).setCustomModelData(3)); //Jump SWItem jumpX = new SWItem(tnt.isXJump() ? Material.LIME_WOOL : Material.RED_WOOL, "§7TNT §eJump X§8: " + (tnt.isZJump() ? "§aon" : "§coff"), clickType -> { diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorTNTSettingsGui.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorTNTSettingsGui.java index 24dbb22e..cd24bddb 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorTNTSettingsGui.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorTNTSettingsGui.java @@ -58,7 +58,7 @@ public class SimulatorTNTSettingsGui extends SimulatorBaseGui { // Back Arrow inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> { back.open(); - })); + }).setCustomModelData(1)); // Material Chooser List lore = new ArrayList<>(); @@ -74,10 +74,10 @@ public class SimulatorTNTSettingsGui extends SimulatorBaseGui { // Base Tick int baseTicks = tnt.getBaseTick(); - inventory.setItem(9, SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> { + inventory.setItem(9, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> { tnt.changeBaseTicks(clickType.isShiftClick() ? 5 : 1); SimulatorWatcher.update(simulator); - }); + }).setCustomModelData(3)); SWItem baseTick = new SWItem(Material.REPEATER, "§eTicks§8:§7 " + baseTicks, clickType -> { new SimulatorAnvilGui<>(player, "Ticks", baseTicks + "", Integer::parseInt, integer -> { if (integer < 0) return false; @@ -88,14 +88,14 @@ public class SimulatorTNTSettingsGui extends SimulatorBaseGui { }); baseTick.getItemStack().setAmount(Math.max(1, Math.min(baseTicks, 64))); inventory.setItem(18, baseTick); - inventory.setItem(27, SWItem.getDye(baseTicks > 0 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> { + inventory.setItem(27, new SWItem(SWItem.getDye(baseTicks > 0 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> { if (baseTicks - (clickType.isShiftClick() ? 5 : 1) < 0) { tnt.changeBaseTicks(-baseTicks); } else { tnt.changeBaseTicks(clickType.isShiftClick() ? -5 : -1); } SimulatorWatcher.update(simulator); - }); + }).setCustomModelData(3)); // Subpixel Alignment inventory.setItem(21, new SWItem(Material.SUNFLOWER, "§7Align§8: §eCenter", clickType -> { @@ -135,10 +135,10 @@ public class SimulatorTNTSettingsGui extends SimulatorBaseGui { inventory.setItem(30, positivXItem); // Pos X - inventory.setItem(15, SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+0.0625"), false, clickType -> { + inventory.setItem(15, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+0.0625"), false, clickType -> { tnt.move(clickType.isShiftClick() ? 0.0625 : 1, 0, 0); SimulatorWatcher.update(simulator); - }); + }).setCustomModelData(3)); inventory.setItem(24, new SWItem(Material.PAPER, "§eX§8:§7 " + tnt.getPosition().getX(), clickType -> { new SimulatorAnvilGui<>(player, "X", tnt.getPosition().getX() + "", Double::parseDouble, d -> { tnt.getPosition().setX(d); @@ -146,16 +146,16 @@ public class SimulatorTNTSettingsGui extends SimulatorBaseGui { return true; }, this).open(); })); - inventory.setItem(33, SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-0.0625"), false, clickType -> { + inventory.setItem(33, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-0.0625"), false, clickType -> { tnt.move(clickType.isShiftClick() ? -0.0625 : -1, 0, 0); SimulatorWatcher.update(simulator); - }); + }).setCustomModelData(3)); // Pos Y - inventory.setItem(16, SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+0.0625"), false, clickType -> { + inventory.setItem(16, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+0.0625"), false, clickType -> { tnt.move(0, clickType.isShiftClick() ? 0.0625 : 1, 0); SimulatorWatcher.update(simulator); - }); + }).setCustomModelData(3)); inventory.setItem(25, new SWItem(Material.PAPER, "§eY§8:§7 " + tnt.getPosition().getY(), clickType -> { new SimulatorAnvilGui<>(player, "Y", tnt.getPosition().getY() + "", Double::parseDouble, d -> { tnt.getPosition().setY(d); @@ -163,16 +163,16 @@ public class SimulatorTNTSettingsGui extends SimulatorBaseGui { return true; }, this).open(); })); - inventory.setItem(34, SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-0.0625"), false, clickType -> { + inventory.setItem(34, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-0.0625"), false, clickType -> { tnt.move(0, clickType.isShiftClick() ? -0.0625 : -1, 0); SimulatorWatcher.update(simulator); - }); + }).setCustomModelData(3)); // Pos Z - inventory.setItem(17, SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+0.0625"), false, clickType -> { + inventory.setItem(17, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+0.0625"), false, clickType -> { tnt.move(0, 0, clickType.isShiftClick() ? 0.0625 : 1); SimulatorWatcher.update(simulator); - }); + }).setCustomModelData(3)); inventory.setItem(26, new SWItem(Material.PAPER, "§eZ§8:§7 " + tnt.getPosition().getZ(), clickType -> { new SimulatorAnvilGui<>(player, "Z", tnt.getPosition().getZ() + "", Double::parseDouble, d -> { tnt.getPosition().setZ(d); @@ -180,9 +180,9 @@ public class SimulatorTNTSettingsGui extends SimulatorBaseGui { return true; }, this).open(); })); - inventory.setItem(35, SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-0.0625"), false, clickType -> { + inventory.setItem(35, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-0.0625"), false, clickType -> { tnt.move(0, 0, clickType.isShiftClick() ? -0.0625 : -1); SimulatorWatcher.update(simulator); - }); + }).setCustomModelData(3)); } } diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/base/SimulatorPageGui.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/base/SimulatorPageGui.java index e3c3ccbd..d3f24b56 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/base/SimulatorPageGui.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/base/SimulatorPageGui.java @@ -50,19 +50,19 @@ public abstract class SimulatorPageGui extends SimulatorBaseGui { headerAndFooter(); page = Math.min(page, maxPage()); - inventory.setItem(size - 9, SWItem.getDye(page > 0 ? 10 : 8), page > 0 ? (byte) 10 : (byte) 8, Core.MESSAGE.parse(page > 0 ? "SWLISINV_PREVIOUS_PAGE_ACTIVE" : "SWLISINV_PREVIOUS_PAGE_INACTIVE", player), clickType -> { + inventory.setItem(size - 9, new SWItem(SWItem.getDye(page > 0 ? 10 : 8), page > 0 ? (byte) 10 : (byte) 8, Core.MESSAGE.parse(page > 0 ? "SWLISINV_PREVIOUS_PAGE_ACTIVE" : "SWLISINV_PREVIOUS_PAGE_INACTIVE", player), clickType -> { if (page > 0) { page--; open(); } - }); + }).setCustomModelData(1)); boolean hasNext = page < maxPage() - (data.size() % (size - 18) == 0 ? 1 : 0); - inventory.setItem(size - 1, SWItem.getDye(hasNext ? 10 : 8), hasNext ? (byte) 10 : (byte) 8, Core.MESSAGE.parse(hasNext ? "SWLISINV_NEXT_PAGE_ACTIVE" : "SWLISINV_NEXT_PAGE_INACTIVE", player), clickType -> { + inventory.setItem(size - 1, new SWItem(SWItem.getDye(hasNext ? 10 : 8), hasNext ? (byte) 10 : (byte) 8, Core.MESSAGE.parse(hasNext ? "SWLISINV_NEXT_PAGE_ACTIVE" : "SWLISINV_NEXT_PAGE_INACTIVE", player), clickType -> { if (hasNext) { page++; open(); } - }); + }).setCustomModelData(2)); int minElement = page * (size - 18); int maxElement = Math.min(data.size(), (page + 1) * (size - 18)); diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/base/SimulatorScrollGui.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/base/SimulatorScrollGui.java index a4cfbb5d..6538196a 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/base/SimulatorScrollGui.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/base/SimulatorScrollGui.java @@ -50,19 +50,19 @@ public abstract class SimulatorScrollGui extends SimulatorBaseGui { headerAndFooter(); scroll = maxScroll(); - inventory.setItem(size - 9, SWItem.getDye(scroll > 0 ? 10 : 8), scroll > 0 ? (byte) 10 : (byte) 8, Core.MESSAGE.parse(scroll > 0 ? "SWLISINV_PREVIOUS_PAGE_ACTIVE" : "SWLISINV_PREVIOUS_PAGE_INACTIVE", player), clickType -> { + inventory.setItem(size - 9, new SWItem(SWItem.getDye(scroll > 0 ? 10 : 8), scroll > 0 ? (byte) 10 : (byte) 8, Core.MESSAGE.parse(scroll > 0 ? "SWLISINV_PREVIOUS_PAGE_ACTIVE" : "SWLISINV_PREVIOUS_PAGE_INACTIVE", player), clickType -> { if (scroll > 0) { scroll = Math.max(0, scroll - 9); open(); } - }); + }).setCustomModelData(1)); boolean hasNext = (data.size() + 1) - scroll > 9; - inventory.setItem(size - 1, SWItem.getDye(hasNext ? 10 : 8), hasNext ? (byte) 10 : (byte) 8, Core.MESSAGE.parse(hasNext ? "SWLISINV_NEXT_PAGE_ACTIVE" : "SWLISINV_NEXT_PAGE_INACTIVE", player), clickType -> { + inventory.setItem(size - 1, new SWItem(SWItem.getDye(hasNext ? 10 : 8), hasNext ? (byte) 10 : (byte) 8, Core.MESSAGE.parse(hasNext ? "SWLISINV_NEXT_PAGE_ACTIVE" : "SWLISINV_NEXT_PAGE_INACTIVE", player), clickType -> { if (hasNext) { scroll = Math.min(scroll + 9, data.size() + 1 - 9); open(); } - }); + }).setCustomModelData(2)); for (int i = 0; i < 9; i++) { if (scroll + i < data.size()) { diff --git a/SpigotCore/SpigotCore_Main/src/de/steamwar/inventory/SWItem.java b/SpigotCore/SpigotCore_Main/src/de/steamwar/inventory/SWItem.java index 1f9c9813..2220c471 100644 --- a/SpigotCore/SpigotCore_Main/src/de/steamwar/inventory/SWItem.java +++ b/SpigotCore/SpigotCore_Main/src/de/steamwar/inventory/SWItem.java @@ -145,62 +145,76 @@ public class SWItem { return item; } - private void hideAttributes() { - if (itemMeta == null) return; + private SWItem hideAttributes() { + if (itemMeta == null) return this; for (ItemFlag flag : EnumSet.allOf(ItemFlag.class)) { itemMeta.addItemFlags(flag); } + return this; } public ItemStack getItemStack() { return itemStack; } - public void setItemStack(ItemStack itemStack) { + public SWItem setItemStack(ItemStack itemStack) { this.itemStack = itemStack; itemMeta = itemStack.getItemMeta(); hideAttributes(); + return this; } public ItemMeta getItemMeta() { return itemMeta; } - public void setItemMeta(ItemMeta itemMeta) { + public SWItem setItemMeta(ItemMeta itemMeta) { this.itemMeta = itemMeta; itemStack.setItemMeta(itemMeta); hideAttributes(); + return this; } public InvCallback getCallback() { return callback; } - public void setCallback(InvCallback callback) { + public SWItem setCallback(InvCallback callback) { this.callback = callback; + return this; } - public void setName(String name) { + public SWItem setName(String name) { itemMeta.setDisplayName(name); itemStack.setItemMeta(itemMeta); + return this; } - public void setLore(List lore) { + public SWItem setLore(List lore) { itemMeta.setLore(lore); itemStack.setItemMeta(itemMeta); + return this; } - public void setLore(String... lore) { + public SWItem setLore(String... lore) { itemMeta.setLore(Arrays.stream(lore).collect(Collectors.toList())); itemStack.setItemMeta(itemMeta); + return this; } - public void setEnchanted(boolean enchanted) { + public SWItem setEnchanted(boolean enchanted) { if (enchanted){ itemMeta.addEnchant(TrickyTrialsWrapper.impl.getUnbreakingEnchantment() , 10, true); } else { itemMeta.removeEnchant(TrickyTrialsWrapper.impl.getUnbreakingEnchantment()); } itemStack.setItemMeta(itemMeta); + return this; + } + + public SWItem setCustomModelData(int customModelData) { + itemMeta.setCustomModelData(customModelData); + itemStack.setItemMeta(itemMeta); + return this; } }