Change spawn overworld falling block to above portal
This commit is contained in:
parent
792c0c5f1d
commit
2369212335
1 changed files with 11 additions and 19 deletions
|
|
@ -128,28 +128,20 @@ public class FoliaFlow extends JavaPlugin implements Listener {
|
||||||
Location loc = entity.getLocation();
|
Location loc = entity.getLocation();
|
||||||
Vector vel = entity.getVelocity();
|
Vector vel = entity.getVelocity();
|
||||||
Block movingTo = getBlockMovingTo(loc, vel);
|
Block movingTo = getBlockMovingTo(loc, vel);
|
||||||
try {
|
|
||||||
|
|
||||||
if(movingTo != null && movingTo.getType() == Material.END_PORTAL){
|
if(movingTo != null && movingTo.getType() == Material.END_PORTAL){
|
||||||
Location spawnLoc = movingTo.getLocation();
|
Location spawnLoc = movingTo.getLocation();
|
||||||
spawnLoc.setX(spawnLoc.getX()+0.5);
|
spawnLoc.setX(spawnLoc.getX()+0.5);
|
||||||
spawnLoc.setY(spawnLoc.getY()-0.25);
|
spawnLoc.setY(spawnLoc.getY()+0.5);
|
||||||
spawnLoc.setZ(spawnLoc.getZ()+0.5);
|
spawnLoc.setZ(spawnLoc.getZ()+0.5);
|
||||||
|
|
||||||
FallingBlock dummy = loc.getWorld().spawnFallingBlock(spawnLoc, ((FallingBlock) entity).getBlockData());
|
FallingBlock dummy = loc.getWorld().spawnFallingBlock(spawnLoc, ((FallingBlock) entity).getBlockData());
|
||||||
dummy.setDropItem(true);
|
Vector dummyVel = vel.clone();
|
||||||
dummy.setHurtEntities(true);
|
dummyVel.setY(-dummyVel.getY());
|
||||||
dummy.setGravity(true);
|
dummyVel.multiply(new Vector(2, 2, 2));
|
||||||
Vector dummyVel = vel.clone();
|
dummyVel.add(new Vector(0, -0.2, 0));
|
||||||
dummyVel.setY(-dummyVel.getY());
|
|
||||||
dummyVel.multiply(new Vector(2, 1, 2));
|
|
||||||
|
|
||||||
dummyVel.add(new Vector(0, 1, 0));
|
dummy.setVelocity(dummyVel);
|
||||||
|
|
||||||
dummy.setVelocity(dummyVel);
|
|
||||||
}
|
|
||||||
} catch (NullPointerException dummy) {
|
|
||||||
getServer().getLogger().info("onFallingBlockToBlock error (likely chunky it not load)");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue