use of com.lying.variousoddities.entity.ai.EntityAISleep in project VariousOddities by Lyinginbedmon.
the class VOBusServer method addEntityBehaviours.
@SubscribeEvent
public static void addEntityBehaviours(EntityJoinWorldEvent event) {
Entity theEntity = event.getEntity();
if (theEntity instanceof LivingEntity && !theEntity.getEntityWorld().isRemote) {
LivingData data = LivingData.forEntity((LivingEntity) theEntity);
if (data != null && !theEntity.getEntityWorld().isRemote)
PacketHandler.sendToAll((ServerWorld) theEntity.getEntityWorld(), new PacketSyncLivingData(theEntity.getUniqueID(), data));
}
if (theEntity.getType() == EntityType.CAT || theEntity.getType() == EntityType.OCELOT) {
MobEntity feline = (MobEntity) theEntity;
if (ConfigVO.MOBS.aiSettings.isOddityAIEnabled(VOEntities.RAT))
feline.targetSelector.addGoal(1, new NearestAttackableTargetGoal<EntityRat>(feline, EntityRat.class, true));
if (ConfigVO.MOBS.aiSettings.isOddityAIEnabled(VOEntities.RAT_GIANT))
feline.targetSelector.addGoal(1, new NearestAttackableTargetGoal<EntityRatGiant>(feline, EntityRatGiant.class, true));
}
// Add sleep AI to mobs
if (theEntity instanceof MobEntity) {
MobEntity living = (MobEntity) theEntity;
living.goalSelector.addGoal(1, new EntityAISleep(living));
if (living instanceof CreatureEntity)
living.goalSelector.addGoal(1, new EntityAIFrightened((CreatureEntity) living));
}
// Spook worgs
if (event.getEntity().getType() == EntityType.LIGHTNING_BOLT) {
BlockPos pos = event.getEntity().getPosition();
AxisAlignedBB bounds = new AxisAlignedBB(0, 0, 0, 1, 256, 1).offset(pos.getX(), 0, pos.getZ()).grow(128, 0, 128);
for (EntityWorg worg : event.getEntity().getEntityWorld().getEntitiesWithinAABB(EntityWorg.class, bounds)) worg.spook();
}
}
Aggregations