use of org.spongepowered.api.entity.living.animal.SkeletonHorse in project Skree by Skelril.
the class BuildWorldWrapper method onEntitySpawn.
@Listener
public void onEntitySpawn(SpawnEntityEvent event) {
List<Entity> entities = event.getEntities();
Optional<BlockSnapshot> optBlockCause = event.getCause().first(BlockSnapshot.class);
for (Entity entity : entities) {
if (!isApplicable(entity)) {
continue;
}
if (entity instanceof Lightning) {
((Lightning) entity).setEffect(true);
continue;
}
if (entity instanceof Egg && optBlockCause.isPresent()) {
new ItemDropper(entity.getLocation()).dropStacks(Lists.newArrayList(newItemStack(ItemTypes.EGG)));
event.setCancelled(true);
return;
}
if (entity instanceof Monster || (entity instanceof SkeletonHorse)) {
event.setCancelled(true);
return;
}
}
}
Aggregations