revert change
This commit is contained in:
parent
1b6f6dce4f
commit
776f46653b
1 changed files with 17 additions and 34 deletions
|
|
@ -22,6 +22,7 @@ public class Bbsdfia extends JavaPlugin implements Listener {
|
||||||
super.onEnable();
|
super.onEnable();
|
||||||
getServer().getPluginManager().registerEvents(this, this);
|
getServer().getPluginManager().registerEvents(this, this);
|
||||||
getServer().getLogger().info("Bbsdfia plugin started");
|
getServer().getLogger().info("Bbsdfia plugin started");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -29,7 +30,7 @@ public class Bbsdfia extends JavaPlugin implements Listener {
|
||||||
super.onDisable();
|
super.onDisable();
|
||||||
getServer().getLogger().info("Bbsdfia plugin stopped");
|
getServer().getLogger().info("Bbsdfia plugin stopped");
|
||||||
}
|
}
|
||||||
|
FoliaLib foliaLib = new FoliaLib(this);
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onFallingBlockToBlock(EntityChangeBlockEvent e){
|
public void onFallingBlockToBlock(EntityChangeBlockEvent e){
|
||||||
if(e.getEntityType() == EntityType.FALLING_BLOCK){
|
if(e.getEntityType() == EntityType.FALLING_BLOCK){
|
||||||
|
|
@ -37,45 +38,27 @@ public class Bbsdfia 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);
|
||||||
|
foliaLib.getImpl().runAtEntity(entity, () -> {/* Code */
|
||||||
World nesssistw = Bukkit.getServer().getWorld("world_the_end");
|
|
||||||
Location location = new Location(nesssistw, 100, 5, 0);
|
|
||||||
|
|
||||||
FoliaLib foliaLib = new FoliaLib(this);
|
|
||||||
|
|
||||||
|
|
||||||
if(movingTo != null && movingTo.getType() == Material.END_PORTAL){
|
if(movingTo != null && movingTo.getType() == Material.END_PORTAL){
|
||||||
// Debug message
|
Location spawnLoc = movingTo.getLocation();
|
||||||
getLogger().info("Falling block detected near end portal");
|
spawnLoc.setX(spawnLoc.getX()+0.5);
|
||||||
|
spawnLoc.setY(spawnLoc.getY()+0.5);
|
||||||
//Entity Scheduler Task
|
spawnLoc.setZ(spawnLoc.getZ()+0.5);
|
||||||
//foliaLib.getImpl().runAtEntity(entity, () -> {
|
|
||||||
// Debug message
|
|
||||||
getLogger().info("Spawning falling block in the end dimension");
|
|
||||||
|
|
||||||
//spawn new falling block in the end dimension and have same properties entity type and material same form entity that detect near end portal
|
|
||||||
|
|
||||||
Material blockMaterial = ((FallingBlock) entity).getBlockData().getMaterial();
|
|
||||||
FallingBlock dummy = nesssistw.spawnFallingBlock(location, blockMaterial.createBlockData());
|
|
||||||
|
|
||||||
|
FallingBlock dummy = loc.getWorld().spawnFallingBlock(spawnLoc, ((FallingBlock) entity).getBlockData());
|
||||||
Vector dummyVel = vel.clone();
|
Vector dummyVel = vel.clone();
|
||||||
|
dummyVel.setY(-dummyVel.getY());
|
||||||
|
dummyVel.multiply(new Vector(2, 2, 2)); // double the velocity
|
||||||
|
|
||||||
|
// add a constant downward velocity to simulate gravity
|
||||||
|
dummyVel.add(new Vector(0, 0.3, 0));
|
||||||
|
|
||||||
dummy.setVelocity(dummyVel);
|
dummy.setVelocity(dummyVel);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Debug message
|
|
||||||
getLogger().info("Setting velocity for the dummy falling block");
|
|
||||||
|
|
||||||
//velocity to north
|
|
||||||
dummy.setVelocity(new Vector(0, 1, 0));
|
|
||||||
//velocity to south
|
|
||||||
dummy.setVelocity(new Vector(0, -1, 0));
|
|
||||||
//velocity to east
|
|
||||||
dummy.setVelocity(new Vector(1, 0, 0));
|
|
||||||
//velocity to west
|
|
||||||
dummy.setVelocity(new Vector(-1, 0, 0));
|
|
||||||
//});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Block getBlockMovingTo(Location loc, Vector vel){
|
Block getBlockMovingTo(Location loc, Vector vel){
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue