Add Simulator to improvements

This commit is contained in:
2025-04-21 00:02:13 +02:00
parent a4eea298d2
commit 79edc1c591
17 changed files with 195 additions and 181 deletions
@@ -70,12 +70,12 @@ public class SimulatorGroupGui extends SimulatorPageGui<SimulatorElement<?>> {
inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> { inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> {
back.open(); back.open();
})); }).setCustomModelData(1));
inventory.setItem(8, new SWItem(Material.BARRIER, "§eDelete", clickType -> { inventory.setItem(8, new SWItem(Material.BARRIER, "§eDelete", clickType -> {
simulatorGroup.getElements().clear(); simulatorGroup.getElements().clear();
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
})); }).setCustomModelData(1));
inventory.setItem(4, simulatorGroup.toItem(player, clickType -> { inventory.setItem(4, simulatorGroup.toItem(player, clickType -> {
if (simulatorGroup.getMaterial() == null) return; if (simulatorGroup.getMaterial() == null) return;
@@ -85,7 +85,7 @@ public class SimulatorGroupGui extends SimulatorPageGui<SimulatorElement<?>> {
inventory.setItem(48, new SWItem(Material.REPEATER, "§eSettings", clickType -> { inventory.setItem(48, new SWItem(Material.REPEATER, "§eSettings", clickType -> {
new SimulatorGroupSettingsGui(player, simulator, simulatorGroup, this).open(); new SimulatorGroupSettingsGui(player, simulator, simulatorGroup, this).open();
})); }).setCustomModelData(1));
boolean disabled = simulatorGroup.getMaterial() == null ? simulatorGroup.getElements().stream().allMatch(SimulatorElement::isDisabled) : simulatorGroup.isDisabled(); 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 -> { inventory.setItem(50, new SWItem(disabled ? Material.ENDER_PEARL : Material.ENDER_EYE, simulatorGroup.isDisabled() ? "§cDisabled" : "§aEnabled", clickType -> {
if (simulatorGroup.getMaterial() == null) { if (simulatorGroup.getMaterial() == null) {
@@ -96,7 +96,7 @@ public class SimulatorGroupGui extends SimulatorPageGui<SimulatorElement<?>> {
simulatorGroup.setDisabled(!disabled); simulatorGroup.setDisabled(!disabled);
} }
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
})); }).setCustomModelData(1));
} }
@Override @Override
@@ -58,7 +58,7 @@ public class SimulatorGroupSettingsGui extends SimulatorBaseGui {
// Back Arrow // Back Arrow
inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> { inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> {
back.open(); back.open();
})); }).setCustomModelData(1));
// Material Chooser // Material Chooser
inventory.setItem(4, simulatorGroup.toItem(player, clickType -> { inventory.setItem(4, simulatorGroup.toItem(player, clickType -> {
@@ -69,10 +69,10 @@ public class SimulatorGroupSettingsGui extends SimulatorBaseGui {
// Base Tick // Base Tick
int baseTicks = simulatorGroup.getBaseTick(); 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); simulatorGroup.changeBaseTicks(clickType.isShiftClick() ? 5 : 1);
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(3));
SWItem baseTick = new SWItem(Material.REPEATER, "§eTicks§8:§7 " + baseTicks, clickType -> { SWItem baseTick = new SWItem(Material.REPEATER, "§eTicks§8:§7 " + baseTicks, clickType -> {
new SimulatorAnvilGui<>(player, "Ticks", baseTicks + "", Integer::parseInt, integer -> { new SimulatorAnvilGui<>(player, "Ticks", baseTicks + "", Integer::parseInt, integer -> {
if (integer < 0) return false; if (integer < 0) return false;
@@ -83,14 +83,14 @@ public class SimulatorGroupSettingsGui extends SimulatorBaseGui {
}); });
baseTick.getItemStack().setAmount(Math.max(1, Math.min(baseTicks, 64))); baseTick.getItemStack().setAmount(Math.max(1, Math.min(baseTicks, 64)));
inventory.setItem(18, baseTick); 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) { if (baseTicks - (clickType.isShiftClick() ? 5 : 1) < 0) {
simulatorGroup.changeBaseTicks(-baseTicks); simulatorGroup.changeBaseTicks(-baseTicks);
} else { } else {
simulatorGroup.changeBaseTicks(clickType.isShiftClick() ? -5 : -1); simulatorGroup.changeBaseTicks(clickType.isShiftClick() ? -5 : -1);
} }
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(3));
boolean allTNT = simulatorGroup.getElements().stream().allMatch(TNTElement.class::isInstance); boolean allTNT = simulatorGroup.getElements().stream().allMatch(TNTElement.class::isInstance);
@@ -163,10 +163,10 @@ public class SimulatorGroupSettingsGui extends SimulatorBaseGui {
} }
//Pos X //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); simulatorGroup.move(clickType.isShiftClick() ? (allTNT ? 0.0625 : 5) : 1, 0, 0);
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(3));
inventory.setItem(24, new SWItem(Material.PAPER, "§eX", clickType -> { inventory.setItem(24, new SWItem(Material.PAPER, "§eX", clickType -> {
new SimulatorAnvilGui<>(player, "Relative X", "", Double::parseDouble, number -> { new SimulatorAnvilGui<>(player, "Relative X", "", Double::parseDouble, number -> {
if(!allTNT){ if(!allTNT){
@@ -177,16 +177,16 @@ public class SimulatorGroupSettingsGui extends SimulatorBaseGui {
return true; return true;
}, this).setItem(Material.PAPER).open(); }, 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); simulatorGroup.move(clickType.isShiftClick() ? (allTNT ? -0.0625 : -5) : -1, 0, 0);
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(3));
//Pos Y //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); simulatorGroup.move(0, clickType.isShiftClick() ? (allTNT ? 0.0625 : 5) : 1, 0);
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(3));
inventory.setItem(25, new SWItem(Material.PAPER, "§eY", clickType -> { inventory.setItem(25, new SWItem(Material.PAPER, "§eY", clickType -> {
new SimulatorAnvilGui<>(player, "Relative Y", "", Double::parseDouble, number -> { new SimulatorAnvilGui<>(player, "Relative Y", "", Double::parseDouble, number -> {
if(!allTNT){ if(!allTNT){
@@ -197,16 +197,16 @@ public class SimulatorGroupSettingsGui extends SimulatorBaseGui {
return true; return true;
}, this).setItem(Material.PAPER).open(); }, 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); simulatorGroup.move(0, clickType.isShiftClick() ? (allTNT ? -0.0625 : -5) : -1, 0);
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(3));
//Pos Z //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); simulatorGroup.move(0, 0, clickType.isShiftClick() ? (allTNT ? 0.0625 : 5) : 1);
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(3));
inventory.setItem(26, new SWItem(Material.PAPER, "§eZ", clickType -> { inventory.setItem(26, new SWItem(Material.PAPER, "§eZ", clickType -> {
new SimulatorAnvilGui<>(player, "Relative Z", "", Double::parseDouble, number -> { new SimulatorAnvilGui<>(player, "Relative Z", "", Double::parseDouble, number -> {
if(!allTNT){ if(!allTNT){
@@ -217,9 +217,9 @@ public class SimulatorGroupSettingsGui extends SimulatorBaseGui {
return true; return true;
}, this).setItem(Material.PAPER).open(); }, 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); simulatorGroup.move(0, 0, clickType.isShiftClick() ? (allTNT ? -0.0625 : -5) : -1);
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(3));
} }
} }
@@ -50,7 +50,7 @@ public class SimulatorGui extends SimulatorPageGui<SimulatorGroup> {
})); }));
inventory.setItem(49, new SWItem(Material.REPEATER, "§eSettings", clickType -> { inventory.setItem(49, new SWItem(Material.REPEATER, "§eSettings", clickType -> {
new SimulatorSettingsGui(player, simulator, this).open(); new SimulatorSettingsGui(player, simulator, this).open();
})); }).setCustomModelData(1));
} }
@Override @Override
@@ -75,7 +75,7 @@ public class SimulatorMaterialGui extends SimulatorPageGui<Material> {
})); }));
inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> { inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> {
back.open(); back.open();
})); }).setCustomModelData(1));
} }
@Override @Override
@@ -82,12 +82,12 @@ public class SimulatorObserverGui extends SimulatorScrollGui<ObserverPhase> {
new SimulatorGroupGui(player, simulator, newParent, simulatorGui).open(); new SimulatorGroupGui(player, simulator, newParent, simulatorGui).open();
} }
} }
})); }).setCustomModelData(1));
inventory.setItem(8, new SWItem(Material.BARRIER, "§eDelete", clickType -> { inventory.setItem(8, new SWItem(Material.BARRIER, "§eDelete", clickType -> {
observer.getPhases().clear(); observer.getPhases().clear();
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
})); }).setCustomModelData(1));
// Material Chooser // Material Chooser
inventory.setItem(4, observer.toItem(player, clickType -> { inventory.setItem(4, observer.toItem(player, clickType -> {
@@ -97,18 +97,18 @@ public class SimulatorObserverGui extends SimulatorScrollGui<ObserverPhase> {
// Settings // Settings
inventory.setItem(47, new SWItem(Material.REPEATER, "§eSettings", clickType -> { inventory.setItem(47, new SWItem(Material.REPEATER, "§eSettings", clickType -> {
new SimulatorObserverSettingsGui(player, simulator, observer, this).open(); new SimulatorObserverSettingsGui(player, simulator, observer, this).open();
})); }).setCustomModelData(1));
// Enable/Disable // Enable/Disable
inventory.setItem(48, new SWItem(observer.isDisabled() ? Material.ENDER_PEARL : Material.ENDER_EYE, observer.isDisabled() ? "§cDisabled" : "§aEnabled", clickType -> { inventory.setItem(48, new SWItem(observer.isDisabled() ? Material.ENDER_PEARL : Material.ENDER_EYE, observer.isDisabled() ? "§cDisabled" : "§aEnabled", clickType -> {
observer.setDisabled(!observer.isDisabled()); observer.setDisabled(!observer.isDisabled());
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
})); }).setCustomModelData(1));
// Group chooser // Group chooser
inventory.setItem(51, new SWItem(Material.LEAD, "§eJoin Group", clickType -> { inventory.setItem(51, new SWItem(Material.LEAD, "§eJoin Group", clickType -> {
new SimulatorGroupChooserGui(player, simulator, observer, observer.getGroup(simulator), this).open(); new SimulatorGroupChooserGui(player, simulator, observer, observer.getGroup(simulator), this).open();
})); }).setCustomModelData(1));
} }
@Override @Override
@@ -151,15 +151,15 @@ public class SimulatorObserverGui extends SimulatorScrollGui<ObserverPhase> {
new SWItem(SWItem.getDye(getter.get() < max ? 10 : 8), "§e+1", Arrays.asList("§7Shift§8:§e +5"), false, clickType -> { 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))); setter.accept(Math.min(max, getter.get() + (clickType.isShiftClick() ? 5 : 1)));
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}), }).setCustomModelData(3),
observer, observer,
new SWItem(SWItem.getDye(getter.get() > min ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8:§e -5"), false, clickType -> { 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))); setter.accept(Math.max(min, getter.get() - (clickType.isShiftClick() ? 5 : 1)));
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}), }).setCustomModelData(3),
new SWItem(Material.ANVIL, "§eEdit Activation", clickType -> { new SWItem(Material.ANVIL, "§eEdit Activation", clickType -> {
new SimulatorObserverPhaseSettingsGui(player, simulator, this.observer, observerPhase, this).open(); new SimulatorObserverPhaseSettingsGui(player, simulator, this.observer, observerPhase, this).open();
}), }).setCustomModelData(1),
}; };
} }
@@ -168,12 +168,12 @@ public class SimulatorObserverGui extends SimulatorScrollGui<ObserverPhase> {
return new SWItem[]{ return new SWItem[]{
new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8:§e +5"), false, clickType -> { new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8:§e +5"), false, clickType -> {
addNewPhase(clickType.isShiftClick()); addNewPhase(clickType.isShiftClick());
}), }).setCustomModelData(3),
new SWItem(Material.QUARTZ, "§eObserver§8:§a New Phase", clickType -> { new SWItem(Material.QUARTZ, "§eObserver§8:§a New Phase", clickType -> {
addNewPhase(false); addNewPhase(false);
}), }).setCustomModelData(1),
new SWItem(SWItem.getDye(8), "§7", clickType -> { new SWItem(SWItem.getDye(8), "§7", clickType -> {
}), }).setCustomModelData(3),
}; };
} }
@@ -62,7 +62,7 @@ public class SimulatorObserverPhaseSettingsGui extends SimulatorBaseGui {
// Back Arrow // Back Arrow
inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> { inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> {
back.open(); back.open();
})); }).setCustomModelData(1));
// Material Chooser // Material Chooser
inventory.setItem(4, observerElement.toItem(player, clickType -> { inventory.setItem(4, observerElement.toItem(player, clickType -> {
@@ -74,7 +74,7 @@ public class SimulatorObserverPhaseSettingsGui extends SimulatorBaseGui {
observerElement.getPhases().remove(observer); observerElement.getPhases().remove(observer);
back.open(); back.open();
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
})); }).setCustomModelData(1));
int index = observerElement.getPhases().indexOf(observer); int index = observerElement.getPhases().indexOf(observer);
int min; int min;
@@ -95,10 +95,10 @@ public class SimulatorObserverPhaseSettingsGui extends SimulatorBaseGui {
//Tick Offset //Tick Offset
int offset = observer.getTickOffset(); 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))); observer.setTickOffset(Math.min(max, offset + (clickType.isShiftClick() ? 5 : 1)));
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(3));
SWItem offsetItem = new SWItem(Material.REPEATER, "§eStart at§8:§7 " + offset, clickType -> { SWItem offsetItem = new SWItem(Material.REPEATER, "§eStart at§8:§7 " + offset, clickType -> {
new SimulatorAnvilGui<>(player, "Start at", offset + "", Integer::parseInt, integer -> { 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))); offsetItem.getItemStack().setAmount(Math.max(1, Math.min(offset, 64)));
inventory.setItem(19, offsetItem); 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))); observer.setTickOffset(Math.max(min, offset - (clickType.isShiftClick() ? 5 : 1)));
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(3));
//Order //Order
int order = observer.getOrder(); 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))); observer.setOrder(Math.min(SimulatorPhase.ORDER_LIMIT, order + (clickType.isShiftClick() ? 5 : 1)));
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(3));
Material negativeNumbers = Material.getMaterial(Core.getVersion() >= 19 ? "RECOVERY_COMPASS" : "FIREWORK_STAR"); 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 -> { 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))); orderItem.getItemStack().setAmount(Math.max(1, Math.min(Math.abs(order), 30)));
inventory.setItem(22, orderItem); 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))); observer.setOrder(Math.max(-SimulatorPhase.ORDER_LIMIT, order - (clickType.isShiftClick() ? 5 : 1)));
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(3));
// Update orientation // Update orientation
inventory.setItem(25, new SWItem(Material.SUNFLOWER, "§7", clickType -> { inventory.setItem(25, new SWItem(Material.SUNFLOWER, "§7", clickType -> {
@@ -56,7 +56,7 @@ public class SimulatorObserverSettingsGui extends SimulatorBaseGui {
// Back Arrow // Back Arrow
inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> { inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> {
back.open(); back.open();
})); }).setCustomModelData(1));
// Material Chooser // Material Chooser
inventory.setItem(4, observer.toItem(player, clickType -> { inventory.setItem(4, observer.toItem(player, clickType -> {
@@ -65,10 +65,10 @@ public class SimulatorObserverSettingsGui extends SimulatorBaseGui {
// Base Tick // Base Tick
int baseTicks = observer.getBaseTick(); 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); observer.changeBaseTicks(clickType.isShiftClick() ? 5 : 1);
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(3));
SWItem baseTick = new SWItem(Material.REPEATER, "§eTicks§8:§7 " + baseTicks, clickType -> { SWItem baseTick = new SWItem(Material.REPEATER, "§eTicks§8:§7 " + baseTicks, clickType -> {
new SimulatorAnvilGui<>(player, "Ticks", baseTicks + "", Integer::parseInt, integer -> { new SimulatorAnvilGui<>(player, "Ticks", baseTicks + "", Integer::parseInt, integer -> {
if (integer < 0) return false; if (integer < 0) return false;
@@ -79,20 +79,20 @@ public class SimulatorObserverSettingsGui extends SimulatorBaseGui {
}); });
baseTick.getItemStack().setAmount(Math.max(1, Math.min(baseTicks, 64))); baseTick.getItemStack().setAmount(Math.max(1, Math.min(baseTicks, 64)));
inventory.setItem(18, baseTick); 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) { if (baseTicks - (clickType.isShiftClick() ? 5 : 1) < 0) {
observer.changeBaseTicks(-baseTicks); observer.changeBaseTicks(-baseTicks);
} else { } else {
observer.changeBaseTicks(clickType.isShiftClick() ? -5 : -1); observer.changeBaseTicks(clickType.isShiftClick() ? -5 : -1);
} }
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(3));
//Pos X //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); observer.move(clickType.isShiftClick() ? 5 : 1, 0, 0);
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(3));
inventory.setItem(24, new SWItem(Material.PAPER, "§eX§8:§7 " + observer.getPosition().getBlockX(), clickType -> { inventory.setItem(24, new SWItem(Material.PAPER, "§eX§8:§7 " + observer.getPosition().getBlockX(), clickType -> {
new SimulatorAnvilGui<>(player, "X", observer.getPosition().getBlockX() + "", Integer::parseInt, i -> { new SimulatorAnvilGui<>(player, "X", observer.getPosition().getBlockX() + "", Integer::parseInt, i -> {
observer.getPosition().setX(i); observer.getPosition().setX(i);
@@ -100,16 +100,16 @@ public class SimulatorObserverSettingsGui extends SimulatorBaseGui {
return true; return true;
}, this).open(); }, 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); observer.move(clickType.isShiftClick() ? -5 : -1, 0, 0);
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(3));
//Pos Y //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); observer.move(0, clickType.isShiftClick() ? 5 : 1, 0);
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(3));
inventory.setItem(25, new SWItem(Material.PAPER, "§eY§8:§7 " + observer.getPosition().getBlockY(), clickType -> { inventory.setItem(25, new SWItem(Material.PAPER, "§eY§8:§7 " + observer.getPosition().getBlockY(), clickType -> {
new SimulatorAnvilGui<>(player, "Y", observer.getPosition().getBlockY() + "", Integer::parseInt, i -> { new SimulatorAnvilGui<>(player, "Y", observer.getPosition().getBlockY() + "", Integer::parseInt, i -> {
observer.getPosition().setY(i); observer.getPosition().setY(i);
@@ -117,16 +117,16 @@ public class SimulatorObserverSettingsGui extends SimulatorBaseGui {
return true; return true;
}, this).open(); }, 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); observer.move(0, clickType.isShiftClick() ? -5 : -1, 0);
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(3));
//Pos Z //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); observer.move(0, 0, clickType.isShiftClick() ? 5 : 1);
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(3));
inventory.setItem(26, new SWItem(Material.PAPER, "§eZ§8:§7 " + observer.getPosition().getBlockZ(), clickType -> { inventory.setItem(26, new SWItem(Material.PAPER, "§eZ§8:§7 " + observer.getPosition().getBlockZ(), clickType -> {
new SimulatorAnvilGui<>(player, "Z", observer.getPosition().getBlockZ() + "", Integer::parseInt, i -> { new SimulatorAnvilGui<>(player, "Z", observer.getPosition().getBlockZ() + "", Integer::parseInt, i -> {
observer.getPosition().setZ(i); observer.getPosition().setZ(i);
@@ -134,9 +134,9 @@ public class SimulatorObserverSettingsGui extends SimulatorBaseGui {
return true; return true;
}, this).open(); }, 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); observer.move(0, 0, clickType.isShiftClick() ? -5 : -1);
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(3));
} }
} }
@@ -88,12 +88,12 @@ public class SimulatorRedstoneGui extends SimulatorScrollGui<SimulatorRedstoneGu
new SimulatorGroupGui(player, simulator, newParent, simulatorGui).open(); new SimulatorGroupGui(player, simulator, newParent, simulatorGui).open();
} }
} }
})); }).setCustomModelData(1));
inventory.setItem(8, new SWItem(Material.BARRIER, "§eDelete", clickType -> { inventory.setItem(8, new SWItem(Material.BARRIER, "§eDelete", clickType -> {
redstone.getPhases().clear(); redstone.getPhases().clear();
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
})); }).setCustomModelData(1));
// Material Chooser // Material Chooser
inventory.setItem(4, redstone.toItem(player, clickType -> { inventory.setItem(4, redstone.toItem(player, clickType -> {
@@ -103,18 +103,18 @@ public class SimulatorRedstoneGui extends SimulatorScrollGui<SimulatorRedstoneGu
// Settings // Settings
inventory.setItem(47, new SWItem(Material.REPEATER, "§eSettings", clickType -> { inventory.setItem(47, new SWItem(Material.REPEATER, "§eSettings", clickType -> {
new SimulatorRedstoneSettingsGui(player, simulator, redstone, this).open(); new SimulatorRedstoneSettingsGui(player, simulator, redstone, this).open();
})); }).setCustomModelData(1));
// Enable/Disable // Enable/Disable
inventory.setItem(48, new SWItem(redstone.isDisabled() ? Material.ENDER_PEARL : Material.ENDER_EYE, redstone.isDisabled() ? "§cDisabled" : "§aEnabled", clickType -> { inventory.setItem(48, new SWItem(redstone.isDisabled() ? Material.ENDER_PEARL : Material.ENDER_EYE, redstone.isDisabled() ? "§cDisabled" : "§aEnabled", clickType -> {
redstone.setDisabled(!redstone.isDisabled()); redstone.setDisabled(!redstone.isDisabled());
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
})); }).setCustomModelData(1));
// Group chooser // Group chooser
inventory.setItem(51, new SWItem(Material.LEAD, "§eJoin Group", clickType -> { inventory.setItem(51, new SWItem(Material.LEAD, "§eJoin Group", clickType -> {
new SimulatorGroupChooserGui(player, simulator, redstone, redstone.getGroup(simulator), this).open(); new SimulatorGroupChooserGui(player, simulator, redstone, redstone.getGroup(simulator), this).open();
})); }).setCustomModelData(1));
} }
@Override @Override
@@ -166,15 +166,15 @@ public class SimulatorRedstoneGui extends SimulatorScrollGui<SimulatorRedstoneGu
new SWItem(SWItem.getDye(getter.get() < max ? 10 : 8), "§e+1", Arrays.asList("§7Shift§8:§e +5"), false, clickType -> { 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))); setter.accept(Math.min(max, getter.get() + (clickType.isShiftClick() ? 5 : 1)));
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}), }).setCustomModelData(3),
redstone, redstone,
new SWItem(SWItem.getDye(getter.get() > min ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8:§e -5"), false, clickType -> { 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))); setter.accept(Math.max(min, getter.get() - (clickType.isShiftClick() ? 5 : 1)));
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}), }).setCustomModelData(3),
new SWItem(Material.ANVIL, "§eEdit Activation", clickType -> { new SWItem(Material.ANVIL, "§eEdit Activation", clickType -> {
new SimulatorRedstonePhaseSettingsGui(player, simulator, this.redstone, redstoneSubPhase.phase, this).open(); new SimulatorRedstonePhaseSettingsGui(player, simulator, this.redstone, redstoneSubPhase.phase, this).open();
}), }).setCustomModelData(1),
}; };
} }
@@ -183,12 +183,12 @@ public class SimulatorRedstoneGui extends SimulatorScrollGui<SimulatorRedstoneGu
return new SWItem[]{ return new SWItem[]{
new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8:§e +5"), false, clickType -> { new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8:§e +5"), false, clickType -> {
addNewPhase(clickType.isShiftClick()); addNewPhase(clickType.isShiftClick());
}), }).setCustomModelData(3),
new SWItem(Material.REDSTONE, "§eRedstone§8:§a New Phase", clickType -> { new SWItem(Material.REDSTONE, "§eRedstone§8:§a New Phase", clickType -> {
addNewPhase(false); addNewPhase(false);
}), }).setCustomModelData(1),
new SWItem(SWItem.getDye(8), "§7", clickType -> { new SWItem(SWItem.getDye(8), "§7", clickType -> {
}), }).setCustomModelData(3),
}; };
} }
@@ -60,7 +60,7 @@ public class SimulatorRedstonePhaseSettingsGui extends SimulatorBaseGui {
// Back Arrow // Back Arrow
inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> { inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> {
back.open(); back.open();
})); }).setCustomModelData(1));
// Material Chooser // Material Chooser
inventory.setItem(4, redstoneElement.toItem(player, clickType -> { inventory.setItem(4, redstoneElement.toItem(player, clickType -> {
@@ -72,7 +72,7 @@ public class SimulatorRedstonePhaseSettingsGui extends SimulatorBaseGui {
redstoneElement.getPhases().remove(redstone); redstoneElement.getPhases().remove(redstone);
back.open(); back.open();
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
})); }).setCustomModelData(1));
int index = redstoneElement.getPhases().indexOf(redstone); int index = redstoneElement.getPhases().indexOf(redstone);
int min; int min;
@@ -96,10 +96,10 @@ public class SimulatorRedstonePhaseSettingsGui extends SimulatorBaseGui {
//Tick Offset //Tick Offset
int offset = redstone.getTickOffset(); 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))); redstone.setTickOffset(Math.min(maxOffset, offset + (clickType.isShiftClick() ? 5 : 1)));
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(3));
SWItem offsetItem = new SWItem(Material.REPEATER, "§eStart at§8:§7 " + offset, clickType -> { SWItem offsetItem = new SWItem(Material.REPEATER, "§eStart at§8:§7 " + offset, clickType -> {
new SimulatorAnvilGui<>(player, "Start at", offset + "", Integer::parseInt, integer -> { 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))); offsetItem.getItemStack().setAmount(Math.max(1, Math.min(offset, 64)));
inventory.setItem(19, offsetItem); 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))); redstone.setTickOffset(Math.max(min, offset - (clickType.isShiftClick() ? 5 : 1)));
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(3));
//Lifetime //Lifetime
int lifetime = redstone.getLifetime(); 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))); redstone.setLifetime(Math.min(maxLifetime, lifetime + (clickType.isShiftClick() ? 5 : 1)));
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(3));
SWItem lifetimeItem = new SWItem(Material.CLOCK, "§eActivation Time§8:§7 " + lifetime, clickType -> { SWItem lifetimeItem = new SWItem(Material.CLOCK, "§eActivation Time§8:§7 " + lifetime, clickType -> {
new SimulatorAnvilGui<>(player, "Activation Time", lifetime + "", Integer::parseInt, integer -> { 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))); lifetimeItem.getItemStack().setAmount(Math.max(1, Math.min(lifetime, 64)));
inventory.setItem(20, lifetimeItem); 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))); redstone.setLifetime(Math.max(0, lifetime - (clickType.isShiftClick() ? 5 : 1)));
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(3));
//Order //Order
int order = redstone.getOrder(); 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))); redstone.setOrder(Math.min(SimulatorPhase.ORDER_LIMIT, order + (clickType.isShiftClick() ? 5 : 1)));
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(3));
Material negativeNumbers = Material.getMaterial(Core.getVersion() >= 19 ? "RECOVERY_COMPASS" : "FIREWORK_STAR"); 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 -> { 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))); orderItem.getItemStack().setAmount(Math.max(1, Math.min(Math.abs(order), 30)));
inventory.setItem(22, orderItem); 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))); redstone.setOrder(Math.max(-SimulatorPhase.ORDER_LIMIT, order - (clickType.isShiftClick() ? 5 : 1)));
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(3));
} }
} }
@@ -55,7 +55,7 @@ public class SimulatorRedstoneSettingsGui extends SimulatorBaseGui {
// Back Arrow // Back Arrow
inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> { inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> {
back.open(); back.open();
})); }).setCustomModelData(1));
// Material Chooser // Material Chooser
inventory.setItem(4, redstone.toItem(player, clickType -> { inventory.setItem(4, redstone.toItem(player, clickType -> {
@@ -64,10 +64,10 @@ public class SimulatorRedstoneSettingsGui extends SimulatorBaseGui {
// Base Tick // Base Tick
int baseTicks = redstone.getBaseTick(); 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); redstone.changeBaseTicks(clickType.isShiftClick() ? 5 : 1);
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(3));
SWItem baseTick = new SWItem(Material.REPEATER, "§eTicks§8:§7 " + baseTicks, clickType -> { SWItem baseTick = new SWItem(Material.REPEATER, "§eTicks§8:§7 " + baseTicks, clickType -> {
new SimulatorAnvilGui<>(player, "Ticks", baseTicks + "", Integer::parseInt, integer -> { new SimulatorAnvilGui<>(player, "Ticks", baseTicks + "", Integer::parseInt, integer -> {
if (integer < 0) return false; if (integer < 0) return false;
@@ -78,20 +78,20 @@ public class SimulatorRedstoneSettingsGui extends SimulatorBaseGui {
}); });
baseTick.getItemStack().setAmount(Math.max(1, Math.min(baseTicks, 64))); baseTick.getItemStack().setAmount(Math.max(1, Math.min(baseTicks, 64)));
inventory.setItem(18, baseTick); 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) { if (baseTicks - (clickType.isShiftClick() ? 5 : 1) < 0) {
redstone.changeBaseTicks(-baseTicks); redstone.changeBaseTicks(-baseTicks);
} else { } else {
redstone.changeBaseTicks(clickType.isShiftClick() ? -5 : -1); redstone.changeBaseTicks(clickType.isShiftClick() ? -5 : -1);
} }
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(3));
//Pos X //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); redstone.move(clickType.isShiftClick() ? 5 : 1, 0, 0);
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(3));
inventory.setItem(24, new SWItem(Material.PAPER, "§eX§8:§7 " + redstone.getPosition().getBlockX(), clickType -> { inventory.setItem(24, new SWItem(Material.PAPER, "§eX§8:§7 " + redstone.getPosition().getBlockX(), clickType -> {
new SimulatorAnvilGui<>(player, "X", redstone.getPosition().getBlockX() + "", Integer::parseInt, i -> { new SimulatorAnvilGui<>(player, "X", redstone.getPosition().getBlockX() + "", Integer::parseInt, i -> {
redstone.getPosition().setX(i); redstone.getPosition().setX(i);
@@ -99,16 +99,16 @@ public class SimulatorRedstoneSettingsGui extends SimulatorBaseGui {
return true; return true;
}, this).open(); }, 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); redstone.move(clickType.isShiftClick() ? -5 : -1, 0, 0);
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(3));
//Pos Y //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); redstone.move(0, clickType.isShiftClick() ? 5 : 1, 0);
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(3));
inventory.setItem(25, new SWItem(Material.PAPER, "§eY§8:§7 " + redstone.getPosition().getBlockY(), clickType -> { inventory.setItem(25, new SWItem(Material.PAPER, "§eY§8:§7 " + redstone.getPosition().getBlockY(), clickType -> {
new SimulatorAnvilGui<>(player, "Y", redstone.getPosition().getBlockY() + "", Integer::parseInt, i -> { new SimulatorAnvilGui<>(player, "Y", redstone.getPosition().getBlockY() + "", Integer::parseInt, i -> {
redstone.getPosition().setY(i); redstone.getPosition().setY(i);
@@ -116,16 +116,16 @@ public class SimulatorRedstoneSettingsGui extends SimulatorBaseGui {
return true; return true;
}, this).open(); }, 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); redstone.move(0, clickType.isShiftClick() ? -5 : -1, 0);
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(3));
//Pos Z //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); redstone.move(0, 0, clickType.isShiftClick() ? 5 : 1);
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(3));
inventory.setItem(26, new SWItem(Material.PAPER, "§eZ§8:§7 " + redstone.getPosition().getBlockZ(), clickType -> { inventory.setItem(26, new SWItem(Material.PAPER, "§eZ§8:§7 " + redstone.getPosition().getBlockZ(), clickType -> {
new SimulatorAnvilGui<>(player, "Z", redstone.getPosition().getBlockZ() + "", Integer::parseInt, i -> { new SimulatorAnvilGui<>(player, "Z", redstone.getPosition().getBlockZ() + "", Integer::parseInt, i -> {
redstone.getPosition().setZ(i); redstone.getPosition().setZ(i);
@@ -133,9 +133,9 @@ public class SimulatorRedstoneSettingsGui extends SimulatorBaseGui {
return true; return true;
}, this).open(); }, 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); redstone.move(0, 0, clickType.isShiftClick() ? -5 : -1);
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(3));
} }
} }
@@ -47,7 +47,7 @@ public class SimulatorSettingsGui extends SimulatorBaseGui {
// Back Arrow // Back Arrow
inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> { inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> {
back.open(); back.open();
})); }).setCustomModelData(1));
// Material Chooser // Material Chooser
inventory.setItem(4, simulator.toItem(player, clickType -> { inventory.setItem(4, simulator.toItem(player, clickType -> {
@@ -61,39 +61,39 @@ public class SimulatorSettingsGui extends SimulatorBaseGui {
})); }));
//Pos X //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); simulator.move(clickType.isShiftClick() ? 5 : 1, 0, 0);
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(3));
inventory.setItem(24, new SWItem(Material.PAPER, "§eX", clickType -> { 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); simulator.move(clickType.isShiftClick() ? -5 : -1, 0, 0);
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(3));
//Pos Y //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); simulator.move(0, clickType.isShiftClick() ? 5 : 1, 0);
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(3));
inventory.setItem(25, new SWItem(Material.PAPER, "§eY", clickType -> { 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); simulator.move(0, clickType.isShiftClick() ? -5 : -1, 0);
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(3));
//Pos Z //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); simulator.move(0, 0, clickType.isShiftClick() ? 5 : 1);
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(3));
inventory.setItem(26, new SWItem(Material.PAPER, "§eZ", clickType -> { 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); simulator.move(0, 0, clickType.isShiftClick() ? -5 : -1);
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(3));
} }
} }
@@ -81,12 +81,12 @@ public class SimulatorTNTGui extends SimulatorScrollGui<TNTPhase> {
new SimulatorGroupGui(player, simulator, newParent, simulatorGui).open(); new SimulatorGroupGui(player, simulator, newParent, simulatorGui).open();
} }
} }
})); }).setCustomModelData(1));
inventory.setItem(8, new SWItem(Material.BARRIER, "§eDelete", clickType -> { inventory.setItem(8, new SWItem(Material.BARRIER, "§eDelete", clickType -> {
tnt.getPhases().clear(); tnt.getPhases().clear();
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
})); }).setCustomModelData(1));
// Material Chooser // Material Chooser
inventory.setItem(4, tnt.toItem(player, clickType -> { inventory.setItem(4, tnt.toItem(player, clickType -> {
@@ -95,11 +95,11 @@ public class SimulatorTNTGui extends SimulatorScrollGui<TNTPhase> {
inventory.setItem(47, new SWItem(Material.REPEATER, "§eSettings", clickType -> { inventory.setItem(47, new SWItem(Material.REPEATER, "§eSettings", clickType -> {
new SimulatorTNTSettingsGui(player, simulator, tnt, this).open(); 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 -> { inventory.setItem(48, new SWItem(tnt.isDisabled() ? Material.ENDER_PEARL : Material.ENDER_EYE, tnt.isDisabled() ? "§cDisabled" : "§aEnabled", clickType -> {
tnt.setDisabled(!tnt.isDisabled()); tnt.setDisabled(!tnt.isDisabled());
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
})); }).setCustomModelData(1));
inventory.setItem(49, new SWItem(Material.CALIBRATED_SCULK_SENSOR, "§eCreate Stab", click -> { inventory.setItem(49, new SWItem(Material.CALIBRATED_SCULK_SENSOR, "§eCreate Stab", click -> {
new SimulatorAnvilGui<>(player, "Depth Limit", "", Integer::parseInt, depthLimit -> { new SimulatorAnvilGui<>(player, "Depth Limit", "", Integer::parseInt, depthLimit -> {
if (depthLimit <= 0) return false; if (depthLimit <= 0) return false;
@@ -107,17 +107,17 @@ public class SimulatorTNTGui extends SimulatorScrollGui<TNTPhase> {
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
return true; return true;
}, null).open(); }, null).open();
})); }).setCustomModelData(1));
inventory.setItem(50, new SWItem(Material.CHEST, parent.getElements().size() == 1 ? "§eMake Group" : "§eAdd another TNT to Group", clickType -> { 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 tntElement = new TNTElement(tnt.getPosition().clone());
tntElement.add(new TNTPhase()); tntElement.add(new TNTPhase());
parent.add(tntElement); parent.add(tntElement);
new SimulatorGroupGui(player, simulator, parent, new SimulatorGui(player, simulator)).open(); new SimulatorGroupGui(player, simulator, parent, new SimulatorGui(player, simulator)).open();
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
})); }).setCustomModelData(1));
inventory.setItem(51, new SWItem(Material.LEAD, "§eJoin Group", clickType -> { inventory.setItem(51, new SWItem(Material.LEAD, "§eJoin Group", clickType -> {
new SimulatorGroupChooserGui(player, simulator, tnt, tnt.getGroup(simulator), this).open(); new SimulatorGroupChooserGui(player, simulator, tnt, tnt.getGroup(simulator), this).open();
})); }).setCustomModelData(1));
} }
@Override @Override
@@ -136,15 +136,15 @@ public class SimulatorTNTGui extends SimulatorScrollGui<TNTPhase> {
new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8:§e +5"), false, clickType -> { new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8:§e +5"), false, clickType -> {
tntSetting.setCount(tntSetting.getCount() + (clickType.isShiftClick() ? 5 : 1)); tntSetting.setCount(tntSetting.getCount() + (clickType.isShiftClick() ? 5 : 1));
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}), }).setCustomModelData(3),
tnt, tnt,
new SWItem(SWItem.getDye(tntSetting.getCount() > 1 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8:§e -5"), false, clickType -> { 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))); tntSetting.setCount(Math.max(1, tntSetting.getCount() - (clickType.isShiftClick() ? 5 : 1)));
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}), }).setCustomModelData(3),
new SWItem(Material.ANVIL, "§eEdit Phase", clickType -> { new SWItem(Material.ANVIL, "§eEdit Phase", clickType -> {
new SimulatorTNTPhaseSettingsGui(player, simulator, this.tnt, tntSetting, this).open(); new SimulatorTNTPhaseSettingsGui(player, simulator, this.tnt, tntSetting, this).open();
}), }).setCustomModelData(1),
}; };
} }
@@ -153,12 +153,12 @@ public class SimulatorTNTGui extends SimulatorScrollGui<TNTPhase> {
return new SWItem[]{ return new SWItem[]{
new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8:§e +5"), false, clickType -> { new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8:§e +5"), false, clickType -> {
addNewPhase(clickType.isShiftClick()); addNewPhase(clickType.isShiftClick());
}), }).setCustomModelData(3),
new SWItem(Material.GUNPOWDER, "§eTNT§8:§a New Phase", clickType -> { new SWItem(Material.GUNPOWDER, "§eTNT§8:§a New Phase", clickType -> {
addNewPhase(false); addNewPhase(false);
}), }).setCustomModelData(1),
new SWItem(SWItem.getDye(8), "§7", clickType -> { new SWItem(SWItem.getDye(8), "§7", clickType -> {
}), }).setCustomModelData(3),
}; };
} }
@@ -60,7 +60,7 @@ public class SimulatorTNTPhaseSettingsGui extends SimulatorBaseGui {
// Back Arrow // Back Arrow
inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> { inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> {
back.open(); back.open();
})); }).setCustomModelData(1));
// Material Chooser // Material Chooser
inventory.setItem(4, tntElement.toItem(player, clickType -> { inventory.setItem(4, tntElement.toItem(player, clickType -> {
@@ -72,14 +72,14 @@ public class SimulatorTNTPhaseSettingsGui extends SimulatorBaseGui {
tntElement.getPhases().remove(tnt); tntElement.getPhases().remove(tnt);
back.open(); back.open();
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
})); }).setCustomModelData(1));
//Count //Count
int count = tnt.getCount(); 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)); tnt.setCount(count + (clickType.isShiftClick() ? 5 : 1));
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(3));
SWItem countItem = new SWItem(Material.TNT, "§eCount§8:§7 " + count, clickType -> { SWItem countItem = new SWItem(Material.TNT, "§eCount§8:§7 " + count, clickType -> {
new SimulatorAnvilGui<>(player, "Count", count + "", Integer::parseInt, integer -> { 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))); countItem.getItemStack().setAmount(Math.max(1, Math.min(count, 64)));
inventory.setItem(18, countItem); 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))); tnt.setCount(Math.max(1, count - (clickType.isShiftClick() ? 5 : 1)));
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(3));
//Tick Offset //Tick Offset
int offset = tnt.getTickOffset(); 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)); tnt.setTickOffset(offset + (clickType.isShiftClick() ? 5 : 1));
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(3));
SWItem offsetItem = new SWItem(Material.REPEATER, "§eStart at§8:§7 " + offset, clickType -> { SWItem offsetItem = new SWItem(Material.REPEATER, "§eStart at§8:§7 " + offset, clickType -> {
new SimulatorAnvilGui<>(player, "Start at", offset + "", Integer::parseInt, integer -> { 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))); offsetItem.getItemStack().setAmount(Math.max(1, Math.min(offset, 64)));
inventory.setItem(19, offsetItem); 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))); tnt.setTickOffset(Math.max(0, offset - (clickType.isShiftClick() ? 5 : 1)));
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(3));
//Lifetime //Lifetime
int lifetime = tnt.getLifetime(); 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)); tnt.setLifetime(lifetime + (clickType.isShiftClick() ? 5 : 1));
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(3));
SWItem lifetimeItem = new SWItem(Material.CLOCK, "§eLifetime§8:§7 " + lifetime, clickType -> { SWItem lifetimeItem = new SWItem(Material.CLOCK, "§eLifetime§8:§7 " + lifetime, clickType -> {
new SimulatorAnvilGui<>(player, "Lifetime", lifetime + "", Integer::parseInt, integer -> { 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))); lifetimeItem.getItemStack().setAmount(Math.max(1, Math.min(lifetime, 64)));
inventory.setItem(20, lifetimeItem); 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))); tnt.setLifetime(Math.max(1, lifetime - (clickType.isShiftClick() ? 5 : 1)));
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(3));
//Order //Order
int order = tnt.getOrder(); 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))); tnt.setOrder(Math.min(SimulatorPhase.ORDER_LIMIT, order + (clickType.isShiftClick() ? 5 : 1)));
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(3));
Material negativeNumbers = Material.getMaterial(Core.getVersion() >= 19 ? "RECOVERY_COMPASS" : "FIREWORK_STAR"); 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 -> { 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))); orderItem.getItemStack().setAmount(Math.max(1, Math.min(Math.abs(order), 30)));
inventory.setItem(22, orderItem); 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))); tnt.setOrder(Math.max(-SimulatorPhase.ORDER_LIMIT, order - (clickType.isShiftClick() ? 5 : 1)));
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(3));
//Jump //Jump
SWItem jumpX = new SWItem(tnt.isXJump() ? Material.LIME_WOOL : Material.RED_WOOL, "§7TNT §eJump X§8: " + (tnt.isZJump() ? "§aon" : "§coff"), clickType -> { SWItem jumpX = new SWItem(tnt.isXJump() ? Material.LIME_WOOL : Material.RED_WOOL, "§7TNT §eJump X§8: " + (tnt.isZJump() ? "§aon" : "§coff"), clickType -> {
@@ -58,7 +58,7 @@ public class SimulatorTNTSettingsGui extends SimulatorBaseGui {
// Back Arrow // Back Arrow
inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> { inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> {
back.open(); back.open();
})); }).setCustomModelData(1));
// Material Chooser // Material Chooser
List<String> lore = new ArrayList<>(); List<String> lore = new ArrayList<>();
@@ -74,10 +74,10 @@ public class SimulatorTNTSettingsGui extends SimulatorBaseGui {
// Base Tick // Base Tick
int baseTicks = tnt.getBaseTick(); 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); tnt.changeBaseTicks(clickType.isShiftClick() ? 5 : 1);
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(3));
SWItem baseTick = new SWItem(Material.REPEATER, "§eTicks§8:§7 " + baseTicks, clickType -> { SWItem baseTick = new SWItem(Material.REPEATER, "§eTicks§8:§7 " + baseTicks, clickType -> {
new SimulatorAnvilGui<>(player, "Ticks", baseTicks + "", Integer::parseInt, integer -> { new SimulatorAnvilGui<>(player, "Ticks", baseTicks + "", Integer::parseInt, integer -> {
if (integer < 0) return false; if (integer < 0) return false;
@@ -88,14 +88,14 @@ public class SimulatorTNTSettingsGui extends SimulatorBaseGui {
}); });
baseTick.getItemStack().setAmount(Math.max(1, Math.min(baseTicks, 64))); baseTick.getItemStack().setAmount(Math.max(1, Math.min(baseTicks, 64)));
inventory.setItem(18, baseTick); 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) { if (baseTicks - (clickType.isShiftClick() ? 5 : 1) < 0) {
tnt.changeBaseTicks(-baseTicks); tnt.changeBaseTicks(-baseTicks);
} else { } else {
tnt.changeBaseTicks(clickType.isShiftClick() ? -5 : -1); tnt.changeBaseTicks(clickType.isShiftClick() ? -5 : -1);
} }
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(3));
// Subpixel Alignment // Subpixel Alignment
inventory.setItem(21, new SWItem(Material.SUNFLOWER, "§7Align§8: §eCenter", clickType -> { inventory.setItem(21, new SWItem(Material.SUNFLOWER, "§7Align§8: §eCenter", clickType -> {
@@ -135,10 +135,10 @@ public class SimulatorTNTSettingsGui extends SimulatorBaseGui {
inventory.setItem(30, positivXItem); inventory.setItem(30, positivXItem);
// Pos X // 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); tnt.move(clickType.isShiftClick() ? 0.0625 : 1, 0, 0);
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(3));
inventory.setItem(24, new SWItem(Material.PAPER, "§eX§8:§7 " + tnt.getPosition().getX(), clickType -> { inventory.setItem(24, new SWItem(Material.PAPER, "§eX§8:§7 " + tnt.getPosition().getX(), clickType -> {
new SimulatorAnvilGui<>(player, "X", tnt.getPosition().getX() + "", Double::parseDouble, d -> { new SimulatorAnvilGui<>(player, "X", tnt.getPosition().getX() + "", Double::parseDouble, d -> {
tnt.getPosition().setX(d); tnt.getPosition().setX(d);
@@ -146,16 +146,16 @@ public class SimulatorTNTSettingsGui extends SimulatorBaseGui {
return true; return true;
}, this).open(); }, 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); tnt.move(clickType.isShiftClick() ? -0.0625 : -1, 0, 0);
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(3));
// Pos Y // 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); tnt.move(0, clickType.isShiftClick() ? 0.0625 : 1, 0);
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(3));
inventory.setItem(25, new SWItem(Material.PAPER, "§eY§8:§7 " + tnt.getPosition().getY(), clickType -> { inventory.setItem(25, new SWItem(Material.PAPER, "§eY§8:§7 " + tnt.getPosition().getY(), clickType -> {
new SimulatorAnvilGui<>(player, "Y", tnt.getPosition().getY() + "", Double::parseDouble, d -> { new SimulatorAnvilGui<>(player, "Y", tnt.getPosition().getY() + "", Double::parseDouble, d -> {
tnt.getPosition().setY(d); tnt.getPosition().setY(d);
@@ -163,16 +163,16 @@ public class SimulatorTNTSettingsGui extends SimulatorBaseGui {
return true; return true;
}, this).open(); }, 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); tnt.move(0, clickType.isShiftClick() ? -0.0625 : -1, 0);
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(3));
// Pos Z // 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); tnt.move(0, 0, clickType.isShiftClick() ? 0.0625 : 1);
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(3));
inventory.setItem(26, new SWItem(Material.PAPER, "§eZ§8:§7 " + tnt.getPosition().getZ(), clickType -> { inventory.setItem(26, new SWItem(Material.PAPER, "§eZ§8:§7 " + tnt.getPosition().getZ(), clickType -> {
new SimulatorAnvilGui<>(player, "Z", tnt.getPosition().getZ() + "", Double::parseDouble, d -> { new SimulatorAnvilGui<>(player, "Z", tnt.getPosition().getZ() + "", Double::parseDouble, d -> {
tnt.getPosition().setZ(d); tnt.getPosition().setZ(d);
@@ -180,9 +180,9 @@ public class SimulatorTNTSettingsGui extends SimulatorBaseGui {
return true; return true;
}, this).open(); }, 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); tnt.move(0, 0, clickType.isShiftClick() ? -0.0625 : -1);
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(3));
} }
} }
@@ -50,19 +50,19 @@ public abstract class SimulatorPageGui<T> extends SimulatorBaseGui {
headerAndFooter(); headerAndFooter();
page = Math.min(page, maxPage()); 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) { if (page > 0) {
page--; page--;
open(); open();
} }
}); }).setCustomModelData(1));
boolean hasNext = page < maxPage() - (data.size() % (size - 18) == 0 ? 1 : 0); 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) { if (hasNext) {
page++; page++;
open(); open();
} }
}); }).setCustomModelData(2));
int minElement = page * (size - 18); int minElement = page * (size - 18);
int maxElement = Math.min(data.size(), (page + 1) * (size - 18)); int maxElement = Math.min(data.size(), (page + 1) * (size - 18));
@@ -50,19 +50,19 @@ public abstract class SimulatorScrollGui<T> extends SimulatorBaseGui {
headerAndFooter(); headerAndFooter();
scroll = maxScroll(); 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) { if (scroll > 0) {
scroll = Math.max(0, scroll - 9); scroll = Math.max(0, scroll - 9);
open(); open();
} }
}); }).setCustomModelData(1));
boolean hasNext = (data.size() + 1) - scroll > 9; 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) { if (hasNext) {
scroll = Math.min(scroll + 9, data.size() + 1 - 9); scroll = Math.min(scroll + 9, data.size() + 1 - 9);
open(); open();
} }
}); }).setCustomModelData(2));
for (int i = 0; i < 9; i++) { for (int i = 0; i < 9; i++) {
if (scroll + i < data.size()) { if (scroll + i < data.size()) {
@@ -145,62 +145,76 @@ public class SWItem {
return item; return item;
} }
private void hideAttributes() { private SWItem hideAttributes() {
if (itemMeta == null) return; if (itemMeta == null) return this;
for (ItemFlag flag : EnumSet.allOf(ItemFlag.class)) { for (ItemFlag flag : EnumSet.allOf(ItemFlag.class)) {
itemMeta.addItemFlags(flag); itemMeta.addItemFlags(flag);
} }
return this;
} }
public ItemStack getItemStack() { public ItemStack getItemStack() {
return itemStack; return itemStack;
} }
public void setItemStack(ItemStack itemStack) { public SWItem setItemStack(ItemStack itemStack) {
this.itemStack = itemStack; this.itemStack = itemStack;
itemMeta = itemStack.getItemMeta(); itemMeta = itemStack.getItemMeta();
hideAttributes(); hideAttributes();
return this;
} }
public ItemMeta getItemMeta() { public ItemMeta getItemMeta() {
return itemMeta; return itemMeta;
} }
public void setItemMeta(ItemMeta itemMeta) { public SWItem setItemMeta(ItemMeta itemMeta) {
this.itemMeta = itemMeta; this.itemMeta = itemMeta;
itemStack.setItemMeta(itemMeta); itemStack.setItemMeta(itemMeta);
hideAttributes(); hideAttributes();
return this;
} }
public InvCallback getCallback() { public InvCallback getCallback() {
return callback; return callback;
} }
public void setCallback(InvCallback callback) { public SWItem setCallback(InvCallback callback) {
this.callback = callback; this.callback = callback;
return this;
} }
public void setName(String name) { public SWItem setName(String name) {
itemMeta.setDisplayName(name); itemMeta.setDisplayName(name);
itemStack.setItemMeta(itemMeta); itemStack.setItemMeta(itemMeta);
return this;
} }
public void setLore(List<String> lore) { public SWItem setLore(List<String> lore) {
itemMeta.setLore(lore); itemMeta.setLore(lore);
itemStack.setItemMeta(itemMeta); itemStack.setItemMeta(itemMeta);
return this;
} }
public void setLore(String... lore) { public SWItem setLore(String... lore) {
itemMeta.setLore(Arrays.stream(lore).collect(Collectors.toList())); itemMeta.setLore(Arrays.stream(lore).collect(Collectors.toList()));
itemStack.setItemMeta(itemMeta); itemStack.setItemMeta(itemMeta);
return this;
} }
public void setEnchanted(boolean enchanted) { public SWItem setEnchanted(boolean enchanted) {
if (enchanted){ if (enchanted){
itemMeta.addEnchant(TrickyTrialsWrapper.impl.getUnbreakingEnchantment() , 10, true); itemMeta.addEnchant(TrickyTrialsWrapper.impl.getUnbreakingEnchantment() , 10, true);
} else { } else {
itemMeta.removeEnchant(TrickyTrialsWrapper.impl.getUnbreakingEnchantment()); itemMeta.removeEnchant(TrickyTrialsWrapper.impl.getUnbreakingEnchantment());
} }
itemStack.setItemMeta(itemMeta); itemStack.setItemMeta(itemMeta);
return this;
}
public SWItem setCustomModelData(int customModelData) {
itemMeta.setCustomModelData(customModelData);
itemStack.setItemMeta(itemMeta);
return this;
} }
} }