Changes the max age of gateway blocks to prevent the occasional purple beam
Some checks failed
EpicKnarvik97/Stargate/pipeline/head There was a failure building this commit

This commit is contained in:
Kristian Knarvik 2021-11-26 16:55:22 +01:00
parent f8ae83bc08
commit fc5bac937a

View File

@ -39,8 +39,7 @@ public class BlockChangeThread implements Runnable {
Block block = blockChangeRequest.getBlockLocation().getBlock(); Block block = blockChangeRequest.getBlockLocation().getBlock();
block.setType(blockChangeRequest.getMaterial(), false); block.setType(blockChangeRequest.getMaterial(), false);
if (blockChangeRequest.getMaterial() == Material.END_GATEWAY && if (blockChangeRequest.getMaterial() == Material.END_GATEWAY) {
block.getWorld().getEnvironment() == World.Environment.THE_END) {
//Force a specific location to prevent exit gateway generation //Force a specific location to prevent exit gateway generation
fixEndGatewayGate(block); fixEndGatewayGate(block);
} else if (blockChangeRequest.getAxis() != null) { } else if (blockChangeRequest.getAxis() != null) {
@ -56,8 +55,11 @@ public class BlockChangeThread implements Runnable {
*/ */
private static void fixEndGatewayGate(Block block) { private static void fixEndGatewayGate(Block block) {
EndGateway gateway = (EndGateway) block.getState(); EndGateway gateway = (EndGateway) block.getState();
gateway.setExitLocation(block.getLocation()); gateway.setAge(Long.MIN_VALUE);
gateway.setExactTeleport(true); if (block.getWorld().getEnvironment() == World.Environment.THE_END) {
gateway.setExitLocation(block.getLocation());
gateway.setExactTeleport(true);
}
gateway.update(false, false); gateway.update(false, false);
} }