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 void drawEntity(int x, int y, EntityLiving entityLiving) { GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); Tessellator tess = Tessellator.instance; this.renderEngine.bindTexture(Gui.statIcons); drawEntitySlot(tess, x, y); TextureInformation ti = ClientProxy.ENTITY_ICONS.get(entityLiving.getClass()); if (ti != null) { this.renderEngine.bindTexture(ti.resourceLocation); drawTextureParts(tess, x, y, ti); if (ti.resourceSpecial != null) { this.renderEngine.bindTexture(ti.resourceSpecial); drawTextureParts(tess, x, y, ti); } } }
@Override public boolean activateMachine() { _grindingWorld.cleanReferences(); List<?> entities = worldObj.getEntitiesWithinAABB( EntityLiving.class, _areaManager.getHarvestArea().toAxisAlignedBB()); entityList: for (Object o : entities) { EntityLiving e = (EntityLiving) o; if (e instanceof EntityAgeable && ((EntityAgeable) e).getGrowingAge() < 0 || e.isEntityInvulnerable() || e.getHealth() <= 0) { continue; } boolean processMob = false; processEntity: { if (MFRRegistry.getGrindables27().containsKey(e.getClass())) { IFactoryGrindable2 r = MFRRegistry.getGrindables27().get(e.getClass()); List<MobDrop> drops = r.grind(e.worldObj, e, getRandom()); if (drops != null && drops.size() > 0 && WeightedRandom.getTotalWeight(drops) > 0) { ItemStack drop = ((MobDrop) WeightedRandom.getRandomItem(_rand, drops)).getStack(); doDrop(drop); } if (r instanceof IFactoryGrindable2) { if (((IFactoryGrindable2) r).processEntity(e)) { processMob = true; if (e.getHealth() <= 0) { continue entityList; } break processEntity; } } else { processMob = true; break processEntity; } } for (Class<?> t : MFRRegistry.getGrinderBlacklist()) { if (t.isInstance(e)) { continue entityList; } } if (!_grindingWorld.addEntityForGrinding(e)) { continue entityList; } } if (processMob && e.worldObj.getGameRules().getGameRuleBooleanValue("doMobLoot")) { try { e.worldObj.getGameRules().setOrCreateGameRule("doMobLoot", "false"); damageEntity(e); if (e.getHealth() <= 0) { _tank.fill(LiquidDictionary.getLiquid("mobEssence", 100), true); } } finally { e.worldObj.getGameRules().setOrCreateGameRule("doMobLoot", "true"); setIdleTicks(20); } return true; } damageEntity(e); if (e.getHealth() <= 0) { _tank.fill(LiquidDictionary.getLiquid("mobEssence", 100), true); setIdleTicks(20); } else { setIdleTicks(10); } return true; } setIdleTicks(getIdleTicksMax()); return false; }