SteamWar/BauSystem2.0
Archiviert
12
0

Add total tnt stat
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
yoyosource 2022-06-11 22:29:59 +02:00
Ursprung 0ad94d9716
Commit dc8d9ccf4b
7 geänderte Dateien mit 19 neuen und 8 gelöschten Zeilen

Datei anzeigen

@ -541,6 +541,8 @@ SIMULATOR_POSITION_Y = §7y-Position
SIMULATOR_POSITION_Z = §7z-Position
SIMULATOR_BACK = §eBack
SIMULATOR_GUI_TOTAL_TNT = §7Total TNT§8: §e{0}
SIMULATOR_DELETED = §cSimulator deleted
## GUI

Datei anzeigen

@ -542,6 +542,8 @@ SIMULATOR_POSITION_Y = §7y-Position
SIMULATOR_POSITION_Z = §7z-Position
SIMULATOR_BACK = §eZurück
SIMULATOR_GUI_TOTAL_TNT = §7Gesamt TNT§8: §e{0}
SIMULATOR_DELETED = §cSimulator gelöscht
## GUI

Datei anzeigen

@ -44,14 +44,6 @@ import java.util.List;
@UtilityClass
public class TNTElementGUI {
private static final Vector X_VECTOR = new Vector(0.0625, 0, 0);
private static final Vector Y_VECTOR = new Vector(0, 0.0625, 0);
private static final Vector Z_VECTOR = new Vector(0, 0, 0.0625);
private static final Vector FX_VECTOR = new Vector(1, 0, 0);
private static final Vector FY_VECTOR = new Vector(0, 1, 0);
private static final Vector FZ_VECTOR = new Vector(0, 0, 1);
private SWInventory open(Player player, String name) {
SWInventory inv = new SWInventory(player, 45, BauSystem.MESSAGE.parse("SIMULATOR_TNT_SPAWN_GUI_NAME", player, name));
SWItem gray = new SWItem(Material.GRAY_STAINED_GLASS_PANE, "§f", clickType -> {});

Datei anzeigen

@ -52,8 +52,10 @@ public class TNTSimulatorGui {
public void open(Player player, TNTSimulator currentTntSimulator, TNTGroup currentTntGroup, Supplier<List<SimulatorElement>> simulatorElements, Runnable back) {
List<SWListInv.SWListEntry<SimulatorElement>> swListEntryList = new ArrayList<>();
int totalTNTCount = 0;
for (SimulatorElement element : simulatorElements.get()) {
swListEntryList.add(new SWListInv.SWListEntry<>(element.menu(player), element));
totalTNTCount += element.tntCount();
}
SWListInv<SimulatorElement> inv = new SWListInv<>(player, BauSystem.MESSAGE.parse("SIMULATOR_GUI_NAME", player), false, swListEntryList, (clickType, simulatorElement) -> {
@ -78,6 +80,7 @@ public class TNTSimulatorGui {
open(player, currentTntSimulator, currentTntGroup, simulatorElements, back);
}));
}
inv.setItem(49, new SWItem(Material.TNT_MINECART, BauSystem.MESSAGE.parse("SIMULATOR_GUI_TOTAL_TNT", player, totalTNTCount), clickType -> {}));
if (currentTntGroup != null) {
Runnable editObserver = () -> {
List<String> otherLore = new ArrayList<>();

Datei anzeigen

@ -50,6 +50,7 @@ public interface SimulatorElement {
SWItem menu(Player p);
boolean locations(Map<Integer, Map<Integer, Set<Pair<Runnable, Integer>>>> result, Region region, Location location); // Ticks to subtick order to spawning runnable to count of activations
int tntCount();
// Observer
default void change() {

Datei anzeigen

@ -193,6 +193,11 @@ public class TNTElement implements SimulatorElement {
return false;
}
@Override
public int tntCount() {
return disabled ? 0 : count;
}
public void setCount(int count) {
if (count < 0) count = 1;
if (count > 400) count = 400;

Datei anzeigen

@ -149,6 +149,12 @@ public class TNTGroup implements SimulatorElement {
return false;
}
@Override
public int tntCount() {
if (disabled) return 0;
return elements.stream().mapToInt(TNTElement::tntCount).sum();
}
public void setTickOffset(int tickOffset) {
if (tickOffset < 0) tickOffset = 0;
if (tickOffset > 400) tickOffset = 400;