SteamWar/BauSystem2.0
Archiviert
12
0

Update TNTSimulator
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
yoyosource 2021-12-09 21:53:15 +01:00
Ursprung f5cb296cf0
Commit 54382c7968
2 geänderte Dateien mit 5 neuen und 32 gelöschten Zeilen

Datei anzeigen

@ -117,6 +117,8 @@ public class ObserverTracer {
}
private void calculateObserver(Block block) {
// TODO: Implement single Repeater, single Redstone, DetectorRail, PoweredRail, Diagonal Piston
Observer observer = (Observer) block.getBlockData();
for (BlockFace blockFace : ALLOWED) {
Location location = block.getLocation().add(blockFace.getModX(), blockFace.getModY(), blockFace.getModZ());

Datei anzeigen

@ -26,12 +26,10 @@ import de.steamwar.bausystem.SWUtils;
import de.steamwar.bausystem.config.ColorConfig;
import de.steamwar.bausystem.features.simulator.show.SimulatorEntityShowMode;
import de.steamwar.bausystem.worlddata.SimulatorData;
import de.steamwar.bausystem.worlddata.WorldData;
import de.steamwar.inventory.SWAnvilInv;
import de.steamwar.inventory.SWInventory;
import de.steamwar.inventory.SWItem;
import de.steamwar.inventory.SWListInv;
import de.steamwar.sql.SteamwarUser;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.World;
@ -211,7 +209,6 @@ public class TNTSimulator {
List<String> lore = new ArrayList<>();
lore.add("§7TNT-Anzahl§8: §e" + spawn.count);
lore.add("§7Tick§8: §e" + spawn.tickOffset);
lore.add("§7Fuse-Tick§8: §e" + spawn.fuseTicks);
lore.add("");
lore.add("§7x§8: §e" + spawn.position.getX());
lore.add("§7y§8: §e" + spawn.position.getY());
@ -313,7 +310,6 @@ public class TNTSimulator {
private boolean printed = false;
private final Vector position;
private int fuseTicks = 80;
private int count = 1;
private int tickOffset = 0;
private boolean xVelocity = false;
@ -331,7 +327,6 @@ public class TNTSimulator {
private TNTSpawn(YAPIONObject yapionObject) {
this.position = new Vector(yapionObject.getPlainValueOrDefault("positionX", 0.0), yapionObject.getPlainValueOrDefault("positionY", 0.0), yapionObject.getPlainValueOrDefault("positionZ", 0.0));
this.entity = SimulatorEntityShowMode.createEntity(player, position, false);
this.fuseTicks = yapionObject.getPlainValue("fuseTicks");
this.count = yapionObject.getPlainValue("count");
this.tickOffset = yapionObject.getPlainValue("tickOffset");
this.xVelocity = yapionObject.getPlainValue("xVelocity");
@ -345,7 +340,6 @@ public class TNTSimulator {
yapionObject.add("positionX", position.getX());
yapionObject.add("positionY", position.getY());
yapionObject.add("positionZ", position.getZ());
yapionObject.add("fuseTicks", fuseTicks);
yapionObject.add("count", count);
yapionObject.add("tickOffset", tickOffset);
yapionObject.add("xVelocity", xVelocity);
@ -371,19 +365,12 @@ public class TNTSimulator {
private void spawn() {
WORLD.spawn(position.toLocation(WORLD), TNTPrimed.class, tntPrimed -> {
tntPrimed.setFuseTicks(fuseTicks);
if (!xVelocity) tntPrimed.setVelocity(tntPrimed.getVelocity().setX(0));
if (!yVelocity) tntPrimed.setVelocity(tntPrimed.getVelocity().setY(0));
if (!zVelocity) tntPrimed.setVelocity(tntPrimed.getVelocity().setZ(0));
});
}
private void setFuseTicks(int fuseTicks) {
if (fuseTicks < 0) fuseTicks = 0;
if (fuseTicks > 160) fuseTicks = 160;
this.fuseTicks = fuseTicks;
}
private void setCount(int count) {
if (count < 1) count = 1;
if (count > 400) count = 400;
@ -443,22 +430,6 @@ public class TNTSimulator {
editTNT();
}));
// Change FuseTicks
swInventory.setItem(3, new SWItem(SWItem.getDye(10), "§7+1", clickType -> {
setFuseTicks(fuseTicks + 1);
editTNT();
}));
SWItem fuseTickItem = new SWItem(Material.CLOCK, "§7Lebensdauer §8- §e" + fuseTicks, LORE, false, clickType -> changeCount(player, "Fuse-Ticks", fuseTicks, tick -> {
setFuseTicks(tick);
editTNT();
}, this::editTNT));
fuseTickItem.getItemStack().setAmount(Math.max(fuseTicks, 1));
swInventory.setItem(12, fuseTickItem);
swInventory.setItem(21, new SWItem(SWItem.getDye(1), "§7-1", clickType -> {
setFuseTicks(fuseTicks - 1);
editTNT();
}));
// Velocity Settings
swInventory.setItem(38, Material.TNT, "TNT", clickType -> {
});
@ -525,7 +496,7 @@ public class TNTSimulator {
}));
// Repeater before Comparator
swInventory.setItem(41, new SWItem(comparator ? SWItem.getMaterial("REDSTONE_COMPARATOR_OFF") : SWItem.getMaterial("DIODE"), "§7Gezündet durch §8- §e" + (comparator ? "Comparator" : "Repeater"), clickType -> {
swInventory.setItem(42, new SWItem(comparator ? SWItem.getMaterial("REDSTONE_COMPARATOR_OFF") : SWItem.getMaterial("DIODE"), "§7Gezündet durch §8- §e" + (comparator ? "Comparator" : "Repeater"), clickType -> {
comparator = !comparator;
editTNT();
}));
@ -534,7 +505,7 @@ public class TNTSimulator {
spawns.add(new TNTSpawn(position, entity));
}));
swInventory.setItem(42, new SWItem(Material.ARROW, "§eZurück", clickType -> {
swInventory.setItem(53, new SWItem(Material.ARROW, "§eZurück", clickType -> {
showGUI();
}));
@ -544,7 +515,7 @@ public class TNTSimulator {
}));
// Delete tnt
swInventory.setItem(43, new SWItem(Material.BARRIER, "§cEntfernen", clickType -> {
swInventory.setItem(44, new SWItem(Material.BARRIER, "§cEntfernen", clickType -> {
hide();
spawns.remove(this);
player.closeInventory();