use of net.minecraftforge.liquids.LiquidStack in project MineFactoryReloaded by powercrystals.
the class TileEntityRancher method activateMachine.
@Override
public boolean activateMachine() {
MFRLiquidMover.pumpLiquid(_tank, this);
boolean didDrop = false;
List<?> entities = worldObj.getEntitiesWithinAABB(EntityLiving.class, _areaManager.getHarvestArea().toAxisAlignedBB());
for (Object o : entities) {
EntityLiving e = (EntityLiving) o;
if (MFRRegistry.getRanchables().containsKey(e.getClass())) {
IFactoryRanchable r = MFRRegistry.getRanchables().get(e.getClass());
List<ItemStack> drops = r.ranch(worldObj, e, this);
if (drops != null) {
for (ItemStack s : drops) {
if (LiquidContainerRegistry.isLiquid(s)) {
_tank.fill(new LiquidStack(s.itemID, LiquidContainerRegistry.BUCKET_VOLUME, s.getItemDamage()), true);
didDrop = true;
continue;
}
doDrop(s);
didDrop = true;
}
if (didDrop) {
setIdleTicks(20);
return true;
}
}
}
}
setIdleTicks(getIdleTicksMax());
return false;
}
use of net.minecraftforge.liquids.LiquidStack in project MineFactoryReloaded by powercrystals.
the class TileEntityWeather method activateMachine.
@Override
public boolean activateMachine() {
MFRLiquidMover.pumpLiquid(_tank, this);
if (worldObj.getWorldInfo().isRaining() && canSeeSky()) {
BiomeGenBase bgb = worldObj.getBiomeGenForCoords(this.xCoord, this.zCoord);
if (!bgb.canSpawnLightningBolt() && !bgb.getEnableSnow()) {
setIdleTicks(getIdleTicksMax());
return false;
}
setWorkDone(getWorkDone() + 1);
if (getWorkDone() >= getWorkMax()) {
if (bgb.getFloatTemperature() >= 0.15F) {
if (_tank.fill(new LiquidStack(Block.waterStill.blockID, LiquidContainerRegistry.BUCKET_VOLUME), true) > 0) {
setWorkDone(0);
return true;
} else {
setWorkDone(getWorkMax());
return false;
}
} else {
doDrop(new ItemStack(Item.snowball));
setWorkDone(0);
}
}
return true;
}
setIdleTicks(getIdleTicksMax());
return false;
}
use of net.minecraftforge.liquids.LiquidStack in project MineFactoryReloaded by powercrystals.
the class TileEntityLiquidRouter method weightedRouteLiquid.
private int weightedRouteLiquid(LiquidStack resource, int[] routes, int amountRemaining, boolean doFill) {
if (amountRemaining >= totalWeight(routes)) {
int startingAmount = amountRemaining;
for (int i = 0; i < routes.length; i++) {
TileEntity te = BlockPosition.getAdjacentTileEntity(this, _outputDirections[i]);
int amountForThisRoute = startingAmount * routes[i] / totalWeight(routes);
if (te instanceof ITankContainer && amountForThisRoute > 0) {
amountRemaining -= ((ITankContainer) te).fill(_outputDirections[i].getOpposite(), new LiquidStack(resource.itemID, amountForThisRoute, resource.itemMeta), doFill);
if (amountRemaining <= 0) {
break;
}
}
}
}
if (0 < amountRemaining && amountRemaining < totalWeight(routes)) {
int outdir = weightedRandomSide(routes);
TileEntity te = BlockPosition.getAdjacentTileEntity(this, _outputDirections[outdir]);
if (te instanceof ITankContainer) {
amountRemaining -= ((ITankContainer) te).fill(_outputDirections[outdir].getOpposite(), new LiquidStack(resource.itemID, amountRemaining, resource.itemMeta), doFill);
}
}
return amountRemaining;
}
use of net.minecraftforge.liquids.LiquidStack in project MineFactoryReloaded by powercrystals.
the class Forestry method postInit.
@PostInit
public static void postInit(FMLPostInitializationEvent e) {
if (!Loader.isModLoaded("Forestry")) {
return;
}
LiquidContainerRegistry.registerLiquid(new LiquidContainerData(LiquidDictionary.getOrCreateLiquid("milk", new LiquidStack(MineFactoryReloadedCore.milkLiquid, LiquidContainerRegistry.BUCKET_VOLUME)), new ItemStack(Item.bucketMilk), new ItemStack(Item.bucketEmpty)));
LiquidContainerRegistry.registerLiquid(new LiquidContainerData(LiquidDictionary.getOrCreateLiquid("sludge", new LiquidStack(MineFactoryReloadedCore.sludgeLiquid, LiquidContainerRegistry.BUCKET_VOLUME)), new ItemStack(MineFactoryReloadedCore.sludgeBucketItem), new ItemStack(Item.bucketEmpty)));
LiquidContainerRegistry.registerLiquid(new LiquidContainerData(LiquidDictionary.getOrCreateLiquid("sewage", new LiquidStack(MineFactoryReloadedCore.sewageLiquid, LiquidContainerRegistry.BUCKET_VOLUME)), new ItemStack(MineFactoryReloadedCore.sewageBucketItem), new ItemStack(Item.bucketEmpty)));
LiquidContainerRegistry.registerLiquid(new LiquidContainerData(LiquidDictionary.getOrCreateLiquid("mobEssence", new LiquidStack(MineFactoryReloadedCore.essenceLiquid, LiquidContainerRegistry.BUCKET_VOLUME)), new ItemStack(MineFactoryReloadedCore.mobEssenceBucketItem), new ItemStack(Item.bucketEmpty)));
LiquidContainerRegistry.registerLiquid(new LiquidContainerData(LiquidDictionary.getOrCreateLiquid("biofuel", new LiquidStack(MineFactoryReloadedCore.biofuelLiquid, LiquidContainerRegistry.BUCKET_VOLUME)), new ItemStack(MineFactoryReloadedCore.bioFuelBucketItem), new ItemStack(Item.bucketEmpty)));
MineFactoryReloadedCore.proxy.onPostTextureStitch(null);
ForestryUtils.setTreeRoot();
TileEntityUnifier.updateUnifierLiquids();
}
use of net.minecraftforge.liquids.LiquidStack in project MineFactoryReloaded by powercrystals.
the class ForestryPre method init.
@Init
public static void init(FMLInitializationEvent e) {
if (!Loader.isModLoaded("Forestry")) {
return;
}
LiquidContainerRegistry.registerLiquid(new LiquidContainerData(LiquidDictionary.getOrCreateLiquid("milk", new LiquidStack(MineFactoryReloadedCore.milkLiquid, LiquidContainerRegistry.BUCKET_VOLUME)), new ItemStack(Item.bucketMilk), new ItemStack(Item.bucketEmpty)));
LiquidContainerRegistry.registerLiquid(new LiquidContainerData(LiquidDictionary.getOrCreateLiquid("sludge", new LiquidStack(MineFactoryReloadedCore.sludgeLiquid, LiquidContainerRegistry.BUCKET_VOLUME)), new ItemStack(MineFactoryReloadedCore.sludgeBucketItem), new ItemStack(Item.bucketEmpty)));
LiquidContainerRegistry.registerLiquid(new LiquidContainerData(LiquidDictionary.getOrCreateLiquid("sewage", new LiquidStack(MineFactoryReloadedCore.sewageLiquid, LiquidContainerRegistry.BUCKET_VOLUME)), new ItemStack(MineFactoryReloadedCore.sewageBucketItem), new ItemStack(Item.bucketEmpty)));
LiquidContainerRegistry.registerLiquid(new LiquidContainerData(LiquidDictionary.getOrCreateLiquid("mobEssence", new LiquidStack(MineFactoryReloadedCore.essenceLiquid, LiquidContainerRegistry.BUCKET_VOLUME)), new ItemStack(MineFactoryReloadedCore.mobEssenceBucketItem), new ItemStack(Item.bucketEmpty)));
LiquidContainerRegistry.registerLiquid(new LiquidContainerData(LiquidDictionary.getOrCreateLiquid("biofuel", new LiquidStack(MineFactoryReloadedCore.biofuelLiquid, LiquidContainerRegistry.BUCKET_VOLUME)), new ItemStack(MineFactoryReloadedCore.bioFuelBucketItem), new ItemStack(Item.bucketEmpty)));
LiquidContainerRegistry.registerLiquid(new LiquidContainerData(LiquidDictionary.getOrCreateLiquid("meat", new LiquidStack(MineFactoryReloadedCore.meatLiquid, LiquidContainerRegistry.BUCKET_VOLUME)), new ItemStack(MineFactoryReloadedCore.meatBucketItem), new ItemStack(Item.bucketEmpty)));
LiquidContainerRegistry.registerLiquid(new LiquidContainerData(LiquidDictionary.getOrCreateLiquid("pinkslime", new LiquidStack(MineFactoryReloadedCore.pinkSlimeLiquid, LiquidContainerRegistry.BUCKET_VOLUME)), new ItemStack(MineFactoryReloadedCore.pinkSlimeBucketItem), new ItemStack(Item.bucketEmpty)));
LiquidContainerRegistry.registerLiquid(new LiquidContainerData(LiquidDictionary.getOrCreateLiquid("chocolatemilk", new LiquidStack(MineFactoryReloadedCore.chocolateMilkLiquid, LiquidContainerRegistry.BUCKET_VOLUME)), new ItemStack(MineFactoryReloadedCore.chocolateMilkBucketItem), new ItemStack(Item.bucketEmpty)));
LiquidContainerRegistry.registerLiquid(new LiquidContainerData(LiquidDictionary.getOrCreateLiquid("mushroomsoup", new LiquidStack(MineFactoryReloadedCore.mushroomSoupLiquid, LiquidContainerRegistry.BUCKET_VOLUME)), new ItemStack(MineFactoryReloadedCore.mushroomSoupBucketItem), new ItemStack(Item.bucketEmpty)));
LiquidContainerRegistry.registerLiquid(new LiquidContainerData(LiquidDictionary.getOrCreateLiquid("mushroomsoup", new LiquidStack(MineFactoryReloadedCore.mushroomSoupLiquid, LiquidContainerRegistry.BUCKET_VOLUME)), new ItemStack(Item.bowlSoup), new ItemStack(Item.bowlEmpty)));
}
Aggregations