SteamWar/BauSystem2.0
Archiviert
12
0

Add ShowModeParameterType.MICROMOTION
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
yoyosource 2023-06-18 17:19:00 +02:00
Ursprung 949f7d1aeb
Commit 1b28b377e2
4 geänderte Dateien mit 20 neuen und 2 gelöschten Zeilen

Datei anzeigen

@ -29,7 +29,6 @@ import de.steamwar.entity.REntityServer;
import de.steamwar.entity.RFallingBlockEntity; import de.steamwar.entity.RFallingBlockEntity;
import net.md_5.bungee.api.chat.ClickEvent; import net.md_5.bungee.api.chat.ClickEvent;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -85,6 +84,10 @@ public class EntityShowMode implements ShowMode<TNTPosition> {
return; return;
} }
if (showModeParameter.isMicroMotion() && !position.getRecord().isHasMicroMotion()) {
return;
}
if (showModeParameter.isExplodeOnly()) { if (showModeParameter.isExplodeOnly()) {
if (position.isExploded()) { if (position.isExploded()) {
generatePositions(position, false, false); generatePositions(position, false, false);

Datei anzeigen

@ -75,6 +75,9 @@ public class Record {
@Setter @Setter
private boolean inBuildArea = false; private boolean inBuildArea = false;
@Getter
private boolean hasMicroMotion = false;
public TNTRecord(long offset, Region region) { public TNTRecord(long offset, Region region) {
this.offset = offset; this.offset = offset;
this.region = region; this.region = region;
@ -90,6 +93,11 @@ public class Record {
public void explode(TNTPrimed tntPrimed) { public void explode(TNTPrimed tntPrimed) {
add(tntPrimed, false, true); add(tntPrimed, false, true);
Vector velocity = tntPrimed.getVelocity();
if (velocity.getY() != 0) return;
if (velocity.getX() > 0.001 || velocity.getZ() > 0.001) return;
if (velocity.getX() == 0 && velocity.getZ() == 0) return;
hasMicroMotion = true;
} }
private void add(TNTPrimed tntPrimed, boolean source, boolean exploded) { private void add(TNTPrimed tntPrimed, boolean source, boolean exploded) {

Datei anzeigen

@ -32,6 +32,7 @@ public class ShowModeParameter {
private boolean count = false; private boolean count = false;
private boolean buildDestroyOnly = false; private boolean buildDestroyOnly = false;
private boolean ticksSinceStart = false; private boolean ticksSinceStart = false;
private boolean microMotion = false;
public void enableWater() { public void enableWater() {
this.water = true; this.water = true;
@ -68,4 +69,8 @@ public class ShowModeParameter {
public void enableTicksSinceStart() { public void enableTicksSinceStart() {
this.ticksSinceStart = true; this.ticksSinceStart = true;
} }
public void enableMicroMotion() {
this.microMotion = true;
}
} }

Datei anzeigen

@ -41,7 +41,9 @@ public enum ShowModeParameterType {
TICKS(ShowModeParameter::enableTicks, Arrays.asList("-ticks", "-t"), "EXPLODE", "SOURCE", "COUNT", "TICKS_SINCE_START"), TICKS(ShowModeParameter::enableTicks, Arrays.asList("-ticks", "-t"), "EXPLODE", "SOURCE", "COUNT", "TICKS_SINCE_START"),
COUNT(ShowModeParameter::enableCount, Arrays.asList("-count", "-c"), "TICKS", "TICKS_SINCE_START"), COUNT(ShowModeParameter::enableCount, Arrays.asList("-count", "-c"), "TICKS", "TICKS_SINCE_START"),
BUILD_DESTROY_ONLY(ShowModeParameter::enableBuildDestroyOnly, Arrays.asList("-builddestroy", "-builddestoryonly"), "WATER"), BUILD_DESTROY_ONLY(ShowModeParameter::enableBuildDestroyOnly, Arrays.asList("-builddestroy", "-builddestoryonly"), "WATER"),
TICKS_SINCE_START(ShowModeParameter::enableTicksSinceStart, Arrays.asList("-tickssincestart", "-tss"), "TICKS", "COUNT"); TICKS_SINCE_START(ShowModeParameter::enableTicksSinceStart, Arrays.asList("-tickssincestart", "-tss"), "TICKS", "COUNT"),
MICROMOTION(ShowModeParameter::enableMicroMotion, Arrays.asList("-micromotion", "-micro", "-m"), "COUNT"),
;
@Getter @Getter
private final Consumer<ShowModeParameter> showModeParameterConsumer; private final Consumer<ShowModeParameter> showModeParameterConsumer;