SteamWar/FightSystem
Archiviert
13
1

Fix Piston retract with Block on Region Floor and Piston above #271

Manuell gemergt
Zeanon hat 3 Commits von PistonFixArenaFloor nach master 2021-05-08 01:33:33 +02:00 zusammengeführt
2 geänderte Dateien mit 4 neuen und 6 gelöschten Zeilen

Datei anzeigen

@ -37,7 +37,7 @@ public class Region {
public Region(int minX, int minY, int minZ, int sizeX, int sizeY, int sizeZ, int extendX, int extendZ) { public Region(int minX, int minY, int minZ, int sizeX, int sizeY, int sizeZ, int extendX, int extendZ) {
this(minX - extendX, minY, minZ - extendZ, this(minX - extendX, minY, minZ - extendZ,
sizeX + extendX * 2, sizeY, sizeZ + extendZ * 2); sizeX + extendX * 2, sizeY, sizeZ + extendZ * 2);
} }
public Region(int minX, int minY, int minZ, int sizeX, int sizeY, int sizeZ) { public Region(int minX, int minY, int minZ, int sizeX, int sizeY, int sizeZ) {
@ -96,7 +96,7 @@ public class Region {
public boolean chunkOutside(int cX, int cZ) { public boolean chunkOutside(int cX, int cZ) {
return getMinChunkX() > cX || cX > getMaxChunkX() || return getMinChunkX() > cX || cX > getMaxChunkX() ||
getMinChunkZ() > cZ || cZ > getMaxChunkZ(); getMinChunkZ() > cZ || cZ > getMaxChunkZ();
} }
public void forEachChunk(ObjIntConsumer<Integer> executor) { public void forEachChunk(ObjIntConsumer<Integer> executor) {

Datei anzeigen

@ -39,9 +39,8 @@ public class PistonListener implements Listener {
@EventHandler @EventHandler
public void handlePistonExtend(BlockPistonExtendEvent e){ public void handlePistonExtend(BlockPistonExtendEvent e){
BlockFace b = e.getDirection().getOppositeFace();
for(Block block : e.getBlocks()){ for(Block block : e.getBlocks()){
if(!Config.BlueExtendRegion.inRegion(block.getRelative(b)) && !Config.RedExtendRegion.inRegion(block.getRelative(b))){ if(!Config.BlueExtendRegion.inRegion(block) && !Config.RedExtendRegion.inRegion(block)){
e.setCancelled(true); e.setCancelled(true);
return; return;
} }
@ -50,9 +49,8 @@ public class PistonListener implements Listener {
@EventHandler @EventHandler
public void handlePistonRetract(BlockPistonRetractEvent e){ public void handlePistonRetract(BlockPistonRetractEvent e){
BlockFace b = e.getDirection().getOppositeFace();
for(Block block : e.getBlocks()){ for(Block block : e.getBlocks()){
if(!Config.BlueExtendRegion.inRegion(block.getRelative(b)) && !Config.RedExtendRegion.inRegion(block.getRelative(b))) { if(!Config.BlueExtendRegion.inRegion(block) && !Config.RedExtendRegion.inRegion(block)) {
e.setCancelled(true); e.setCancelled(true);
return; return;
} }