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(); Location respawnLoc = data.getEggEntity().getLocation();
Egg.removeEgg(data.getEggEntity()); Egg.removeEgg(data.getEggEntity());
if (config.getEggInvulnerable()) { EggController.eggDestroyed(config, data, logger);
// 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);
}
} }
} }
} }
public boolean isUnderWorld(Entity entity) { public boolean isUnderWorld(Entity entity) {
return entity.getLocation().getY() < UNDER_WORLD_HEIGHT; return entity.getLocation().getY() < UNDER_WORLD_HEIGHT;
} }
@ -80,15 +63,15 @@ public class EventScheduler extends BukkitRunnable {
Player player = (Player) entity; Player player = (Player) entity;
player.getInventory().remove(m); player.getInventory().remove(m);
break; break;
case ITEM: case ITEM:
((Item) entity).remove(); ((Item) entity).remove();
break; break;
case FALLING_BLOCK: case FALLING_BLOCK:
((FallingBlock) entity).remove(); ((FallingBlock) entity).remove();
break; break;
default: default:
if (entity instanceof LivingEntity) { if (entity instanceof LivingEntity) {
EntityEquipment equipment = ((LivingEntity) entity).getEquipment(); EntityEquipment equipment = ((LivingEntity) entity).getEquipment();