Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
Ursprung
1086808cf0
Commit
5d1fb567ef
@ -136,37 +136,27 @@ public class TNTElementGUI {
|
|||||||
// Alignment
|
// Alignment
|
||||||
inv.setItem(23, new SWItem(Material.OAK_BUTTON, BauSystem.MESSAGE.parse("SIMULATOR_ALIGNMENT_NEGATIVE_Z", player), clickType -> { // Z negative
|
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;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
Vector position = tntElement.getOwnPosition();
|
tntElement.align(new Vector(0.5, 0, 0.49));
|
||||||
align(position, new Vector(0.5, 0, 0.49));
|
|
||||||
tntElement.setPosition(position);
|
|
||||||
tntElement.change();
|
tntElement.change();
|
||||||
}));
|
}));
|
||||||
inv.setItem(25, new SWItem(Material.OAK_BUTTON, BauSystem.MESSAGE.parse("SIMULATOR_ALIGNMENT_POSITIVE_Z", player), clickType -> { // Z positive
|
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;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
Vector position = tntElement.getOwnPosition();
|
tntElement.align(new Vector(0.5, 0, 0.51));
|
||||||
align(position, new Vector(0.5, 0, 0.51));
|
|
||||||
tntElement.setPosition(position);
|
|
||||||
tntElement.change();
|
tntElement.change();
|
||||||
}));
|
}));
|
||||||
inv.setItem(15, new SWItem(Material.OAK_BUTTON, BauSystem.MESSAGE.parse("SIMULATOR_ALIGNMENT_POSITIVE_X", player), clickType -> { // X positive
|
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;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
Vector position = tntElement.getOwnPosition();
|
tntElement.align(new Vector(0.51, 0, 0.5));
|
||||||
align(position, new Vector(0.51, 0, 0.5));
|
|
||||||
tntElement.setPosition(position);
|
|
||||||
tntElement.change();
|
tntElement.change();
|
||||||
}));
|
}));
|
||||||
inv.setItem(33, new SWItem(Material.OAK_BUTTON, BauSystem.MESSAGE.parse("SIMULATOR_ALIGNMENT_NEGATIVE_X", player), clickType -> { // X negative
|
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;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
Vector position = tntElement.getOwnPosition();
|
tntElement.align(new Vector(0.49, 0, 0.5));
|
||||||
align(position, new Vector(0.49, 0, 0.5));
|
|
||||||
tntElement.setPosition(position);
|
|
||||||
tntElement.change();
|
tntElement.change();
|
||||||
}));
|
}));
|
||||||
inv.setItem(24, new SWItem(Material.SUNFLOWER, BauSystem.MESSAGE.parse("SIMULATOR_ALIGNMENT_CENTER", player), clickType -> { // CENTER
|
inv.setItem(24, new SWItem(Material.SUNFLOWER, BauSystem.MESSAGE.parse("SIMULATOR_ALIGNMENT_CENTER", player), clickType -> { // CENTER
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
Vector position = tntElement.getOwnPosition();
|
tntElement.align(new Vector(0.5, 0, 0.5));
|
||||||
align(position, new Vector(0.5, 0, 0.5));
|
|
||||||
tntElement.setPosition(position);
|
|
||||||
tntElement.change();
|
tntElement.change();
|
||||||
}));
|
}));
|
||||||
};
|
};
|
||||||
@ -179,25 +169,6 @@ public class TNTElementGUI {
|
|||||||
inv.open();
|
inv.open();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void align(Vector vector, Vector offset) {
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
vector.setX(vector.getBlockX() + offset.getX());
|
|
||||||
vector.setY(vector.getBlockY() + offset.getY());
|
|
||||||
vector.setZ(vector.getBlockZ() + offset.getZ());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void editProperties(Player player, TNTElement tntElement, Runnable back) {
|
private void editProperties(Player player, TNTElement tntElement, Runnable back) {
|
||||||
SWInventory inv = open(player, BauSystem.MESSAGE.parse("SIMULATOR_TNT_SPAWN_EDIT_PROPERTIES", player));
|
SWInventory inv = open(player, BauSystem.MESSAGE.parse("SIMULATOR_TNT_SPAWN_EDIT_PROPERTIES", player));
|
||||||
if (back != null) {
|
if (back != null) {
|
||||||
|
@ -285,4 +285,31 @@ public class TNTElement implements SimulatorElement {
|
|||||||
this.disabled = disabled;
|
this.disabled = disabled;
|
||||||
_updatePosition();
|
_updatePosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void align(Vector offset) {
|
||||||
|
Vector vector = getPosition();
|
||||||
|
Vector parentVector = new Vector(0, 0, 0);
|
||||||
|
if (tntGroup != null) {
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
vector.setX(vector.getBlockX() + offset.getX());
|
||||||
|
vector.setY(vector.getBlockY() + offset.getY());
|
||||||
|
vector.setZ(vector.getBlockZ() + offset.getZ());
|
||||||
|
|
||||||
|
setPosition(vector.subtract(parentVector));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren