@Override public int fill(ForgeDirection from, LiquidStack resource, boolean doFill) { if (resource == null || (resource.itemID != LiquidDictionary.getCanonicalLiquid("sewage").itemID)) { return 0; } else { return _tank.fill(resource, doFill); } }
@Override public void updateEntity() { super.updateEntity(); if (!worldObj.isRemote) { for (int i = 0; i < 9; i++) { if (_inventory[i] != null && MFRRegistry.getPlantables().containsKey(_inventory[i].itemID)) { int targetSlot = findMatchingSlot(_inventory[i]); if (targetSlot < 0) { continue; } if (_inventory[targetSlot] == null) { _inventory[targetSlot] = _inventory[i]; _inventory[i] = null; } else { UtilInventory.mergeStacks(_inventory[targetSlot], _inventory[i]); if (_inventory[i].stackSize <= 0) { _inventory[i] = null; } } } } if (Util.isRedstonePowered(this)) { return; } int newBurn = getOutputValue(); if (_burnTimeMax - _burnTime >= newBurn) { _burnTime += newBurn; for (int i = 9; i < 18; i++) { if (_inventory[i] != null) { decrStackSize(i, 1); } } } if (_burnTime > 0 && (_tank.getLiquid() == null || _tank.getLiquid().amount <= _tank.getCapacity() - _bioFuelPerTick)) { _burnTime -= _burnTimeDecreasePerTick; _tank.fill(LiquidDictionary.getLiquid("biofuel", _bioFuelPerTick), true); } } }
@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; }