private boolean canEntityDespawnHere(EntityLiving entity) { LivingHandlerRegistry livingHandlerRegistry = MVELProfile.worldSettings().livingHandlerRegistry(); List<LivingHandler> livingHandlers = livingHandlerRegistry.getLivingHandlers(entity.getClass()); CountInfo info = CustomSpawner.spawnCounter.countEntities(entity.worldObj); if (!livingHandlers.isEmpty()) { for (LivingHandler livingHandler : livingHandlers) { if (livingHandler.canDespawn(entity, info)) { return true; } } return false; } return LivingHelper.canDespawn(entity); }
private EntityLiving getTargetEntity(String entityName, EntityPlayer targetPlayer) { EntityLiving entity; try { @SuppressWarnings("unchecked") Class<? extends EntityLiving> entityClass = (Class<? extends EntityLiving>) EntityList.stringToClassMapping.get(entityName); entity = (EntityLiving) LivingHelper.instantiateEntity(entityClass, targetPlayer.worldObj); } catch (Exception exception) { throw new WrongUsageException( "commands.jascanspawnhere.cannotinstantiateentity", new Object[0]); } entity.setLocationAndAngles( targetPlayer.posX, targetPlayer.posY, targetPlayer.posZ, targetPlayer.rotationYaw, targetPlayer.rotationPitch); return entity; }