fix: egg not respawning when dropped in the void if egg_inv is true

This commit is contained in:
HerozDotExe 2026-02-17 21:50:08 +01:00
parent 1ddf48d6ba
commit bf50a33b32

View file

@ -47,29 +47,12 @@ public class EventScheduler extends BukkitRunnable {
Location respawnLoc = data.getEggEntity().getLocation();
Egg.removeEgg(data.getEggEntity());
if (config.getEggInvulnerable()) {
// get coords for egg to spawn at
//get highest block
Block highestBlock = respawnLoc.getWorld().getHighestBlockAt(respawnLoc);
int yPos = highestBlock.getY()+1;
//if no highest block, default to sea level
if (highestBlock.isEmpty()) {
yPos = respawnLoc.getWorld().getSeaLevel();
}
respawnLoc.setY(yPos);
EggController.spawnEggItem(respawnLoc, config, data); //do not need to update data with this location since item spawn event will be called
data.resetEggOwner(true, config);
} else {
//alert and respawn if applicable
EggController.eggDestroyed(config, data, logger);
}
EggController.eggDestroyed(config, data, logger);
}
}
}
public boolean isUnderWorld(Entity entity) {
return entity.getLocation().getY() < UNDER_WORLD_HEIGHT;
}
@ -80,15 +63,15 @@ public class EventScheduler extends BukkitRunnable {
Player player = (Player) entity;
player.getInventory().remove(m);
break;
case ITEM:
((Item) entity).remove();
break;
case FALLING_BLOCK:
((FallingBlock) entity).remove();
break;
default:
if (entity instanceof LivingEntity) {
EntityEquipment equipment = ((LivingEntity) entity).getEquipment();