SteamWar/BauSystem2.0
Archiviert
12
0

Refactored PhaseGuis

Dieser Commit ist enthalten in:
D4rkr34lm 2023-10-10 00:37:19 +02:00 committet von yoyosource
Ursprung 273fba879e
Commit f067e55d1f
3 geänderte Dateien mit 20 neuen und 59 gelöschten Zeilen

Datei anzeigen

@ -29,16 +29,4 @@ public abstract class SimulatorSetting {
protected int tickOffset; protected int tickOffset;
protected int lifetime = 80; protected int lifetime = 80;
protected int order = 1; protected int order = 1;
public void changeOffset(int tick){
tickOffset += tick;
}
public void changeLifetime(int tick){
lifetime += tick;
}
public void changeOrder(int tick){
order += tick;
}
} }

Datei anzeigen

@ -66,6 +66,7 @@ public class SimulatorRedstonePhaseGui extends SimulatorBaseGui {
new SimulatorMaterialGui(player, simulator, redstoneElement::getMaterial, redstoneElement::setMaterial, this).open(); new SimulatorMaterialGui(player, simulator, redstoneElement::getMaterial, redstoneElement::setMaterial, this).open();
})); }));
// Delete
inventory.setItem(8, new SWItem(Material.BARRIER, "§eDelete", clickType -> { inventory.setItem(8, new SWItem(Material.BARRIER, "§eDelete", clickType -> {
redstoneElement.getSettings().remove(redstone); redstoneElement.getSettings().remove(redstone);
back.open(); back.open();
@ -75,40 +76,32 @@ public class SimulatorRedstonePhaseGui extends SimulatorBaseGui {
//Tick Offset //Tick Offset
int offset = redstone.getTickOffset(); int offset = redstone.getTickOffset();
inventory.setItem(11, SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> { inventory.setItem(11, SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
redstone.changeOffset(clickType.isShiftClick() ? 5 : 1); redstone.setTickOffset(offset + (clickType.isShiftClick() ? 5 : 1));
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); });
SWItem offsetItem = new SWItem(Material.REPEATER, "§eTicks§8:§7 " + offset, clickType -> {}); SWItem offsetItem = new SWItem(Material.REPEATER, "§eTicks§8:§7 " + offset, clickType -> {});
offsetItem.getItemStack().setAmount(Math.max(1, Math.min(offset, 64))); offsetItem.getItemStack().setAmount(Math.max(1, Math.min(offset, 64)));
inventory.setItem(20, offsetItem); inventory.setItem(20, offsetItem);
inventory.setItem(29, SWItem.getDye(offset > 0 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> { inventory.setItem(29, SWItem.getDye(offset > 0 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
if (offset - (clickType.isShiftClick() ? 5 : 1) < 0) { redstone.setTickOffset(Math.max(1, offset - (clickType.isShiftClick() ? -5 : -1)));
redstone.changeOffset(-offset);
} else {
redstone.changeOffset(clickType.isShiftClick() ? -5 : -1);
}
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); });
//Lifetime //Lifetime
int lifetime = redstone.getLifetime(); int lifetime = redstone.getLifetime();
inventory.setItem(12, SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> { inventory.setItem(12, SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
redstone.changeLifetime(clickType.isShiftClick() ? 5 : 1); redstone.setLifetime(lifetime + (clickType.isShiftClick() ? 5 : 1));
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); });
SWItem lifetimeItem = new SWItem(Material.CLOCK, "§eLifetime§8:§7 " + lifetime, clickType -> {}); SWItem lifetimeItem = new SWItem(Material.CLOCK, "§eLifetime§8:§7 " + lifetime, clickType -> {});
lifetimeItem.getItemStack().setAmount(Math.max(1, Math.min(lifetime, 64))); lifetimeItem.getItemStack().setAmount(Math.max(1, Math.min(lifetime, 64)));
inventory.setItem(21, lifetimeItem); inventory.setItem(21, lifetimeItem);
inventory.setItem(30, SWItem.getDye(lifetime > 0 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> { inventory.setItem(30, SWItem.getDye(lifetime > 0 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
if (lifetime - (clickType.isShiftClick() ? 5 : 1) < 0) { redstone.setLifetime(Math.max(1, lifetime - (clickType.isShiftClick() ? -5 : -1)));
redstone.changeLifetime(-lifetime);
} else {
redstone.changeLifetime(clickType.isShiftClick() ? -5 : -1);
}
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); });
@ -120,15 +113,11 @@ public class SimulatorRedstonePhaseGui extends SimulatorBaseGui {
}); });
SWItem orderItem = new SWItem(Material.COMPASS, "§eOrder§8:§7 " + order, clickType -> {}); SWItem orderItem = new SWItem(Material.COMPASS, "§eOrder§8:§7 " + order, clickType -> {});
orderItem.getItemStack().setAmount(Math.max(1, Math.min(order, 64))); orderItem.getItemStack().setAmount(Math.max(1, Math.min(order, 64)));
inventory.setItem(23, orderItem); inventory.setItem(23, orderItem);
inventory.setItem(32, SWItem.getDye(order > 1 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> { inventory.setItem(32, SWItem.getDye(order > 1 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
if (order - (clickType.isShiftClick() ? 5 : 1) < 1) { redstone.setOrder(Math.max(1, order - (clickType.isShiftClick() ? -5 : -1)));
redstone.changeOrder(-order);
} else {
redstone.changeOrder(clickType.isShiftClick() ? -5 : -1);
}
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); });
} }

Datei anzeigen

@ -68,6 +68,7 @@ public class SimulatorTntPhaseGui extends SimulatorBaseGui{
new SimulatorMaterialGui(player, simulator, tntElement::getMaterial, tntElement::setMaterial, this).open(); new SimulatorMaterialGui(player, simulator, tntElement::getMaterial, tntElement::setMaterial, this).open();
})); }));
//Delete
inventory.setItem(8, new SWItem(Material.BARRIER, "§eDelete", clickType -> { inventory.setItem(8, new SWItem(Material.BARRIER, "§eDelete", clickType -> {
tntElement.getSettings().remove(tnt); tntElement.getSettings().remove(tnt);
back.open(); back.open();
@ -82,55 +83,43 @@ public class SimulatorTntPhaseGui extends SimulatorBaseGui{
}); });
SWItem countItem = new SWItem(Material.REPEATER, "§eTicks§8:§7 " + count, clickType -> {}); SWItem countItem = new SWItem(Material.REPEATER, "§eTicks§8:§7 " + count, clickType -> {});
countItem.getItemStack().setAmount(Math.max(1, Math.min(count, 64))); countItem.getItemStack().setAmount(Math.max(1, Math.min(count, 64)));
inventory.setItem(19, countItem); inventory.setItem(19, countItem);
inventory.setItem(28, SWItem.getDye(count > 0 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> { inventory.setItem(28, SWItem.getDye(count > 0 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
if (count - (clickType.isShiftClick() ? 5 : 1) < 1) { tnt.setCount(Math.max(1, count - (clickType.isShiftClick() ? -5 : -1)));
tnt.setCount(1);
} else {
tnt.setCount(count + (clickType.isShiftClick() ? -5 : -1));
}
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); });
//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, SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
tnt.changeOffset(clickType.isShiftClick() ? 5 : 1); tnt.setTickOffset(offset + (clickType.isShiftClick() ? 5 : 1));
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); });
SWItem offsetItem = new SWItem(Material.REPEATER, "§eTicks§8:§7 " + offset, clickType -> {}); SWItem offsetItem = new SWItem(Material.REPEATER, "§eTicks§8:§7 " + offset, clickType -> {});
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, SWItem.getDye(offset > 0 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
if (offset - (clickType.isShiftClick() ? 5 : 1) < 0) { tnt.setTickOffset(Math.max(1, offset - (clickType.isShiftClick() ? -5 : -1)));
tnt.changeOffset(-offset);
} else {
tnt.changeOffset(clickType.isShiftClick() ? -5 : -1);
}
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); });
//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, SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
tnt.changeLifetime(clickType.isShiftClick() ? 5 : 1); tnt.setLifetime(lifetime + (clickType.isShiftClick() ? 5 : 1));
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); });
SWItem lifetimeItem = new SWItem(Material.CLOCK, "§eLifetime§8:§7 " + lifetime, clickType -> {}); SWItem lifetimeItem = new SWItem(Material.CLOCK, "§eLifetime§8:§7 " + lifetime, clickType -> {});
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, SWItem.getDye(lifetime > 0 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
if (lifetime - (clickType.isShiftClick() ? 5 : 1) < 0) { tnt.setLifetime(Math.max(1, lifetime - (clickType.isShiftClick() ? -5 : -1)));
tnt.changeLifetime(-lifetime);
} else {
tnt.changeLifetime(clickType.isShiftClick() ? -5 : -1);
}
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); });
@ -146,11 +135,7 @@ public class SimulatorTntPhaseGui extends SimulatorBaseGui{
orderItem.getItemStack().setAmount(Math.max(1, Math.min(order, 64))); orderItem.getItemStack().setAmount(Math.max(1, Math.min(order, 64)));
inventory.setItem(22, orderItem); inventory.setItem(22, orderItem);
inventory.setItem(31, SWItem.getDye(order > 0 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> { inventory.setItem(31, SWItem.getDye(order > 0 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
if (order - (clickType.isShiftClick() ? 5 : 1) < 1) { tnt.setOrder(Math.max(1, order - (clickType.isShiftClick() ? -5 : -1)));
tnt.changeOrder(-order);
} else {
tnt.changeOrder(clickType.isShiftClick() ? -5 : -1);
}
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); });
@ -177,7 +162,6 @@ public class SimulatorTntPhaseGui extends SimulatorBaseGui{
tnt.setJump(!tnt.hasJump()); tnt.setJump(!tnt.hasJump());
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); });
inventory.setItem(25, jumpAll);
//inventory.setItem();
} }
} }