#falling block thing
1 messages · Page 1 of 1 (latest)
There should be an event for when it interacts with a block, listen to it and get the location and set the location to the falling block type
If not just create a runnable and check it’s location every x ticks
@sly vine theres no event how would i do the runnable thing?
cuz if im detecting when it dies, then how will i make it snap to a block?
also the block will have to be air
new BukkitRunnable() {
@Override
public void run() {
if(entity.getLocation().getBlock().isAir() && !entity.getLocation().getBlock().getRelative(BlockFace.DOWN).getBlock().isAir()) {
entity.getLocation().getBlock().setType(entity.getType());
entity.remove();
}
}
}.runTaskTimer(plugin, 1, 1);
something like that
there should also be a event since its classed as an entity
thx (srry i was offline)
um falling block.getBlock().isAir() doesnt work
*getLocation.getBlock
like the falling block.getLocation().getBlock().isAir doesnt work
it cant resolve isAir() in that
what about isEmpty()
for some reason that works
would this work?
@Override
public void run() {
if(fb.getLocation().getBlock().isEmpty() && fb.getLocation().getBlock().getRelative(BlockFace.DOWN).getBlockData().getMaterial() != Material.AIR) {
fb.getLocation().getBlock().setType(fb.getBlockData().getMaterial());
fb.remove();
}
}
}.runTaskTimer(plugin, 1, 1);
god discord what did u do to my indents
my eyes
are dying