SteamWar/BauSystem2.0
Archiviert
12
0

Hotfix TNTElement alignment
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Author: PSIRobot

Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
yoyosource 2023-03-06 21:17:42 +01:00
Ursprung ae1e10ecc6
Commit 106a1a8fb0
2 geänderte Dateien mit 21 neuen und 18 gelöschten Zeilen

Datei anzeigen

@ -136,22 +136,22 @@ public class TNTElementGUI {
// Alignment
inv.setItem(23, new SWItem(Material.OAK_BUTTON, BauSystem.MESSAGE.parse("SIMULATOR_ALIGNMENT_NEGATIVE_Z", player), clickType -> { // Z negative
if (clickType == ClickType.DOUBLE_CLICK) return;
tntElement.align(new Vector(0.5, 0, 0.49));
tntElement.align(new Vector(0, 0, 0.49));
tntElement.change();
}));
inv.setItem(25, new SWItem(Material.OAK_BUTTON, BauSystem.MESSAGE.parse("SIMULATOR_ALIGNMENT_POSITIVE_Z", player), clickType -> { // Z positive
if (clickType == ClickType.DOUBLE_CLICK) return;
tntElement.align(new Vector(0.5, 0, 0.51));
tntElement.align(new Vector(0, 0, 0.51));
tntElement.change();
}));
inv.setItem(15, new SWItem(Material.OAK_BUTTON, BauSystem.MESSAGE.parse("SIMULATOR_ALIGNMENT_POSITIVE_X", player), clickType -> { // X positive
if (clickType == ClickType.DOUBLE_CLICK) return;
tntElement.align(new Vector(0.51, 0, 0.5));
tntElement.align(new Vector(0.51, 0, 0));
tntElement.change();
}));
inv.setItem(33, new SWItem(Material.OAK_BUTTON, BauSystem.MESSAGE.parse("SIMULATOR_ALIGNMENT_NEGATIVE_X", player), clickType -> { // X negative
if (clickType == ClickType.DOUBLE_CLICK) return;
tntElement.align(new Vector(0.49, 0, 0.5));
tntElement.align(new Vector(0.49, 0, 0));
tntElement.change();
}));
inv.setItem(24, new SWItem(Material.SUNFLOWER, BauSystem.MESSAGE.parse("SIMULATOR_ALIGNMENT_CENTER", player), clickType -> { // CENTER

Datei anzeigen

@ -293,22 +293,25 @@ public class TNTElement implements SimulatorElement {
parentVector = tntGroup.getPosition();
}
if (vector.getX() - (int) vector.getX() == 0.49) {
vector.setX(vector.getX() + 0.02);
}
if (vector.getX() - (int) vector.getX() == -0.49) {
vector.setX(vector.getX() - 0.02);
}
if (vector.getZ() - (int) vector.getZ() == 0.49) {
vector.setZ(vector.getZ() + 0.02);
}
if (vector.getZ() - (int) vector.getZ() == -0.49) {
vector.setZ(vector.getZ() - 0.02);
if (offset.getX() != 0) {
if (vector.getX() - (int) vector.getX() == 0.49) {
vector.setX(vector.getX() + 0.02);
}
if (vector.getX() - (int) vector.getX() == -0.49) {
vector.setX(vector.getX() - 0.02);
}
vector.setX(vector.getBlockX() + offset.getX());
}
vector.setX(vector.getBlockX() + offset.getX());
vector.setY(vector.getBlockY() + offset.getY());
vector.setZ(vector.getBlockZ() + offset.getZ());
if (offset.getZ() != 0) {
if (vector.getZ() - (int) vector.getZ() == 0.49) {
vector.setZ(vector.getZ() + 0.02);
}
if (vector.getZ() - (int) vector.getZ() == -0.49) {
vector.setZ(vector.getZ() - 0.02);
}
vector.setZ(vector.getBlockZ() + offset.getZ());
}
setPosition(vector.subtract(parentVector));
}