Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for(Entity e : world.getNearbyEntities(world.getBlockAt(x, y, z).getLocation(), 1, 1, 1))
- {
- if(e instanceof LivingEntity)
- {
- int time = 1;
- while(e.getLocation().getBlock().getType().isSolid() || e.getLocation().add(0, 1, 0).getBlock().getType().isSolid())
- {
- if(time >= 50)
- {
- e.teleport(e.getLocation().add(0, 1, 0));
- }
- time++;
- Block n = e.getLocation().getBlock().getRelative(BlockFace.NORTH);
- Block s = e.getLocation().getBlock().getRelative(BlockFace.SOUTH);
- Block east = e.getLocation().getBlock().getRelative(BlockFace.EAST);
- Block w = e.getLocation().getBlock().getRelative(BlockFace.WEST);
- e.teleport(e.getLocation().add(0, 1, 0));
- if(!n.getType().isSolid())
- {
- e.teleport(n.getLocation());
- }
- if(!s.getType().isSolid())
- {
- e.teleport(s.getLocation());
- }
- if(!east.getType().isSolid())
- {
- e.teleport(east.getLocation());
- }
- if(!w.getType().isSolid())
- {
- e.teleport(w.getLocation());
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement