Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
Ursprung
137bf5eeca
Commit
fb920902f0
@ -56,6 +56,7 @@ public class SimulatorCursor {
|
||||
|
||||
if (result.getHitEntity() != null) {
|
||||
List<SimulatorElement> elements = tntSimulator.getEntity(result.getHitEntity());
|
||||
System.out.println(elements);
|
||||
|
||||
cursor = new REntityServer();
|
||||
RFallingBlockEntity entity = new RFallingBlockEntity(cursor, (elements.isEmpty() ? getPos(player, result) : elements.get(0).getPosition()).toLocation(WORLD), Material.TNT);
|
||||
|
@ -178,7 +178,7 @@ public class SimulatorStorage implements Enable, Disable {
|
||||
if (content.isEmpty()) continue;
|
||||
TNTSimulator tntSimulator = new TNTSimulator();
|
||||
for (YAPIONObject element : content.streamObject().collect(Collectors.toList())) {
|
||||
tntSimulator.getTntElementList().add(new TNTElement(element, tntSimulator.getEntityServer()));
|
||||
tntSimulator.getTntElementList().add(new TNTElement(element, null, tntSimulator.getEntityServer()));
|
||||
}
|
||||
tntSimulators.put(newName, tntSimulator);
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ public class TNTSimulator {
|
||||
if (element.containsKey("elements", YAPIONType.ARRAY)) {
|
||||
tntElementList.add(new TNTGroup(element, entityServer));
|
||||
} else {
|
||||
tntElementList.add(new TNTElement(element, entityServer));
|
||||
tntElementList.add(new TNTElement(element, null, entityServer));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -164,7 +164,7 @@ public class TNTSimulator {
|
||||
return;
|
||||
}
|
||||
|
||||
TNTElement tntElement = new TNTElement(SimulatorCursor.getPos(player, result), entityServer);
|
||||
TNTElement tntElement = new TNTElement(SimulatorCursor.getPos(player, result), null, entityServer);
|
||||
tntElementList.add(tntElement);
|
||||
TNTElementGUI.open(player, tntElement, null);
|
||||
}
|
||||
|
@ -341,15 +341,13 @@ public class TNTElementGUI {
|
||||
int tickOffset = tntElement.getOwnTickOffset();
|
||||
TNTGroup tntGroup = new TNTGroup(vector);
|
||||
tntGroup.setTickOffset(tickOffset);
|
||||
tntElement.setTickOffset(0);
|
||||
tntElement.getOwnPosition().setX(0);
|
||||
tntElement.getOwnPosition().setY(0);
|
||||
tntElement.getOwnPosition().setZ(0);
|
||||
tntGroup.add(tntElement);
|
||||
tntElement.setTickOffset(0);
|
||||
tntElement.setPosition(new Vector(0, 0, 0));
|
||||
tntSimulator.getTntElementList().add(tntGroup);
|
||||
|
||||
// Add new TNT
|
||||
TNTElement newElement = new TNTElement(new Vector(0, 0, 0), tntSimulator.getEntityServer());
|
||||
TNTElement newElement = new TNTElement(new Vector(0, 0, 0), tntGroup, tntSimulator.getEntityServer());
|
||||
newElement.setTickOffset(1);
|
||||
tntGroup.add(newElement);
|
||||
|
||||
@ -365,7 +363,7 @@ public class TNTElementGUI {
|
||||
inv.setItem(25, new SWItem(Material.DISPENSER, BauSystem.MESSAGE.parse("SIMULATOR_TNT_SPAWN_ADD_TNT", player), clickType -> {
|
||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||
Vector vector = tntElement.getOwnPosition().clone();
|
||||
TNTElement newElement = new TNTElement(vector, tntSimulator.getEntityServer());
|
||||
TNTElement newElement = new TNTElement(vector, null, tntSimulator.getEntityServer());
|
||||
if (tntElement.hasParent()) {
|
||||
newElement.setTickOffset(tntElement.getOwnTickOffset() + 1);
|
||||
tntElement.getParent().add(newElement);
|
||||
|
@ -71,20 +71,18 @@ public class TNTElement implements SimulatorElement {
|
||||
private Material material = Material.TNT;
|
||||
private boolean disabled = false;
|
||||
|
||||
public TNTElement(Vector position, REntityServer entityServer) {
|
||||
public TNTElement(Vector position, TNTGroup tntGroup, REntityServer entityServer) {
|
||||
this.entityServer = entityServer;
|
||||
this.tntGroup = tntGroup;
|
||||
this.position = position;
|
||||
this.entity = new RFallingBlockEntity(entityServer, position.toLocation(WORLD), Material.TNT);
|
||||
this.entity.setNoGravity(true);
|
||||
initEntity();
|
||||
}
|
||||
|
||||
public TNTElement(YAPIONObject yapionObject, REntityServer entityServer) {
|
||||
public TNTElement(YAPIONObject yapionObject, TNTGroup tntGroup, REntityServer entityServer) {
|
||||
this.entityServer = entityServer;
|
||||
this.tntGroup = tntGroup;
|
||||
this.position = new Vector(yapionObject.getDoubleOrDefault("x", yapionObject.getDoubleOrDefault("positionX", 0)), yapionObject.getDoubleOrDefault("y", yapionObject.getDoubleOrDefault("positionY", 0)), yapionObject.getDoubleOrDefault("z", yapionObject.getDoubleOrDefault("positionZ", 0)));
|
||||
this.disabled = yapionObject.getBooleanOrDefault("disabled", false);
|
||||
this.entity = new RFallingBlockEntity(entityServer, position.toLocation(WORLD), Material.TNT);
|
||||
this.entity.setNoGravity(true);
|
||||
this.entity.setInvisible(disabled);
|
||||
this.fuseTicks = yapionObject.getIntOrDefault("fuseTicks", 80);
|
||||
this.count = yapionObject.getIntOrDefault("count", 1);
|
||||
this.tickOffset = yapionObject.getIntOrDefault("tickOffset", 0);
|
||||
@ -93,6 +91,12 @@ public class TNTElement implements SimulatorElement {
|
||||
this.zVelocity = yapionObject.getBooleanOrDefault("zVelocity", false);
|
||||
this.order = Material.valueOf(yapionObject.getStringOrDefault("order", yapionObject.getBooleanOrDefault("comparator", false) ? Material.COMPARATOR.name() : Material.REPEATER.name()));
|
||||
this.material = Material.valueOf(yapionObject.getStringOrDefault("material", Material.TNT.name()));
|
||||
initEntity();
|
||||
}
|
||||
|
||||
private void initEntity() {
|
||||
this.entity = new RFallingBlockEntity(entityServer, getPosition().toLocation(WORLD), Material.TNT);
|
||||
this.entity.setNoGravity(true);
|
||||
_updatePosition();
|
||||
}
|
||||
|
||||
|
@ -59,8 +59,7 @@ public class TNTGroup implements SimulatorElement {
|
||||
this.disabled = yapionObject.getBooleanOrDefault("disabled", false);
|
||||
YAPIONArray elements = yapionObject.getArrayOrDefault("elements", new YAPIONArray());
|
||||
for (YAPIONObject element : elements.streamObject().collect(Collectors.toList())) {
|
||||
TNTElement tntElement = new TNTElement(element, entityServer);
|
||||
tntElement.tntGroup = this;
|
||||
TNTElement tntElement = new TNTElement(element, this, entityServer);
|
||||
this.elements.add(tntElement);
|
||||
tntElement._updatePosition();
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren