Merge branch 'master' of github.com:SirSengir/BuildCraft into FacadesRefactor

This commit is contained in:
Krapht 2012-07-12 05:57:32 +02:00
commit 984d5d67af
19 changed files with 369 additions and 91 deletions

View file

@ -1,6 +1,10 @@
## Welcome to Buildcraft on GitHub
## Compiling and packaging Buildcraft
### Official Builds
An official jenkins build server can be found [here](http://kyprusmc.game-host.org:8080/). Jenkins will generate a new
build every time a change is pushed to github.
### Compiling and packaging Buildcraft
1. Ensure that `Apache Ant` (found [here](http://ant.apache.org/)) is installed correctly on your system.
* Linux users will need the latest version of astyle installed as well.
1. Create a base directory for the build

View file

@ -13,6 +13,7 @@ import net.minecraft.src.InventoryPlayer;
import net.minecraft.src.ItemStack;
import net.minecraft.src.buildcraft.api.BuildCraftAPI;
import net.minecraft.src.buildcraft.api.RefineryRecipe;
import net.minecraft.src.buildcraft.api.liquids.LiquidManager;
import net.minecraft.src.buildcraft.core.DefaultProps;
import net.minecraft.src.buildcraft.core.GuiAdvancedInterface;
import net.minecraft.src.buildcraft.core.utils.StringUtil;
@ -77,7 +78,7 @@ public class GuiRefinery extends GuiAdvancedInterface {
slot = slots[position];
if (slot != null) {
int liquidId = BuildCraftAPI.getLiquidForFilledItem(mc.thePlayer.inventory.getItemStack());
int liquidId = LiquidManager.getLiquidForFilledItem(mc.thePlayer.inventory.getItemStack()).itemID;
container.setFilter(position, liquidId, 0);
}

View file

@ -457,7 +457,7 @@ public class RenderPipe extends TileEntitySpecialRenderer {
this.loadTexture(ForgeHooksClient.getTexture("/gui/items.png", Item.itemsList[itemstack.itemID]));
for (int i = 0; i <= 1; ++i) {
int iconIndex = itemstack.getItem().func_46057_a(itemstack.getItemDamage(), i);
int iconIndex = itemstack.getItem().getIconFromDamageForRenderPass(itemstack.getItemDamage(), i);
float scale = 1.0F;
if (true) {

View file

@ -24,7 +24,6 @@ import net.minecraft.src.buildcraft.factory.BptBlockFrame;
import net.minecraft.src.buildcraft.factory.BptBlockRefinery;
import net.minecraft.src.buildcraft.factory.BptBlockTank;
import net.minecraft.src.buildcraft.factory.GuiHandler;
import net.minecraft.src.buildcraft.factory.TankBucketHandler;
import net.minecraft.src.buildcraft.factory.TileAssemblyTable;
import net.minecraft.src.buildcraft.factory.TileAutoWorkbench;
import net.minecraft.src.buildcraft.factory.TileHopper;
@ -99,8 +98,6 @@ public class BuildCraftFactory {
BuildCraftCore.mainConfiguration.save();
MinecraftForge.registerCustomBucketHandler(new TankBucketHandler());
miningWellBlock = new BlockMiningWell(Integer.parseInt(minigWellId.value));
CoreProxy.registerBlock(miningWellBlock.setBlockName("miningWellBlock"));
CoreProxy.addName(miningWellBlock, "Mining Well");

View file

@ -32,6 +32,7 @@ public class BuildCraftAPI {
// Other BuildCraft global data
@Deprecated
public static LinkedList<LiquidData> liquids = new LinkedList<LiquidData>();
public static HashMap<Integer, IronEngineFuel> ironEngineFuel = new HashMap<Integer, IronEngineFuel>();
public static Trigger[] triggers = new Trigger[1024];
@ -42,6 +43,7 @@ public class BuildCraftAPI {
private static LinkedList<ITriggerProvider> triggerProviders = new LinkedList<ITriggerProvider>();
private static LinkedList<IActionProvider> actionProviders = new LinkedList<IActionProvider>();
@Deprecated
public static int getLiquidForFilledItem(ItemStack filledItem) {
if (filledItem == null) {
return 0;
@ -56,6 +58,7 @@ public class BuildCraftAPI {
return 0;
}
@Deprecated
public static ItemStack getFilledItemForLiquid(int liquidId) {
for (LiquidData d : liquids) {
if (d.liquidId == liquidId) {
@ -65,7 +68,8 @@ public class BuildCraftAPI {
return null;
}
@Deprecated
public static boolean isLiquid(int blockId) {
if (blockId == 0) {
return false;

View file

@ -12,6 +12,7 @@ package net.minecraft.src.buildcraft.api;
import net.minecraft.src.Item;
import net.minecraft.src.ItemStack;
@Deprecated
public class LiquidData {
public final int liquidId;

View file

@ -0,0 +1,39 @@
/**
* Copyright (c) SpaceToad, 2011
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package net.minecraft.src.buildcraft.api.liquids;
import net.minecraft.src.Item;
import net.minecraft.src.ItemStack;
import net.minecraft.src.buildcraft.api.BuildCraftAPI;
public class LiquidData {
public final LiquidStack stillLiquid;
public final LiquidStack movingLiquid;
public final ItemStack filled;
public final ItemStack container;
public LiquidData(int stillLiquidId, int movingLiquidId, Item filled) {
this(new LiquidStack(stillLiquidId, BuildCraftAPI.BUCKET_VOLUME), new LiquidStack(movingLiquidId, BuildCraftAPI.BUCKET_VOLUME), new ItemStack(filled, 1), new ItemStack(Item.bucketEmpty));
}
public LiquidData(int stillLiquidId, int movingLiquidId, ItemStack filled) {
this(new LiquidStack(stillLiquidId, BuildCraftAPI.BUCKET_VOLUME), new LiquidStack(movingLiquidId, BuildCraftAPI.BUCKET_VOLUME), filled, new ItemStack(Item.bucketEmpty));
}
public LiquidData(LiquidStack stillLiquid, LiquidStack movingLiquid, ItemStack filled, ItemStack container) {
this.stillLiquid = stillLiquid;
this.movingLiquid = movingLiquid;
this.filled = filled;
this.container = container;
}
}

View file

@ -0,0 +1,62 @@
package net.minecraft.src.buildcraft.api.liquids;
import java.util.LinkedList;
import net.minecraft.src.ItemStack;
public class LiquidManager {
public static LinkedList<LiquidData> liquids = new LinkedList<LiquidData>();
public static LiquidStack getLiquidForFilledItem(ItemStack filledItem) {
if (filledItem == null)
return null;
for (LiquidData liquid : liquids)
if (liquid.filled.isItemEqual(filledItem))
return liquid.stillLiquid;
return null;
}
public static int getLiquidIDForFilledItem(ItemStack filledItem) {
LiquidStack liquidForFilledItem = getLiquidForFilledItem(filledItem);
if (liquidForFilledItem == null)
return 0;
return liquidForFilledItem.itemID;
}
public static ItemStack getFilledItemForLiquid(LiquidStack liquid) {
for (LiquidData data : liquids)
if(data.stillLiquid.isLiquidEqual(liquid))
return data.filled.copy();
return null;
}
public static ItemStack fillLiquidContainer(int liquidId, ItemStack emptyContainer) {
return fillLiquidContainer(new LiquidStack(liquidId, 1, 0), emptyContainer);
}
public static ItemStack fillLiquidContainer(LiquidStack liquid, ItemStack emptyContainer) {
for(LiquidData data : liquids)
if(data.stillLiquid.isLiquidEqual(liquid) && data.container.isItemEqual(emptyContainer))
return data.filled.copy();
return null;
}
public static boolean isLiquid(ItemStack block) {
if (block.itemID == 0)
return false;
for (LiquidData liquid : liquids)
if (liquid.stillLiquid.isLiquidEqual(block) || liquid.movingLiquid.isLiquidEqual(block))
return true;
return false;
}
}

View file

@ -0,0 +1,104 @@
package net.minecraft.src.buildcraft.api.liquids;
import net.minecraft.src.Block;
import net.minecraft.src.Item;
import net.minecraft.src.ItemStack;
import net.minecraft.src.NBTTagCompound;
/**
*
* Forestry internal ItemStack substitute for liquids
*
* @author SirSengir
*/
public class LiquidStack {
public int itemID;
public int amount;
public int itemMeta;
public NBTTagCompound stackTagCompound;
private LiquidStack() {
}
public LiquidStack(int itemID, int liquidAmount) {
this(itemID, liquidAmount, 0);
}
public LiquidStack(Item item, int liquidAmount) {
this(item.shiftedIndex, liquidAmount, 0);
}
public LiquidStack(Block block, int liquidAmount) {
this(block.blockID, liquidAmount, 0);
}
public LiquidStack(int itemID, int amount, int itemDamage) {
this.itemID = itemID;
this.amount = amount;
this.itemMeta = itemDamage;
}
public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound) {
nbttagcompound.setShort("Id", (short) itemID);
nbttagcompound.setInteger("Amount", amount);
nbttagcompound.setShort("Meta", (short) itemMeta);
if (stackTagCompound != null)
nbttagcompound.setTag("Tag", stackTagCompound);
return nbttagcompound;
}
public void readFromNBT(NBTTagCompound nbttagcompound) {
itemID = nbttagcompound.getShort("Id");
amount = nbttagcompound.getInteger("Amount");
itemMeta = nbttagcompound.getShort("Meta");
if (nbttagcompound.hasKey("Tag"))
stackTagCompound = nbttagcompound.getCompoundTag("tag");
}
public LiquidStack copy() {
LiquidStack copy = new LiquidStack(itemID, amount, itemMeta);
if (stackTagCompound != null) {
copy.stackTagCompound = (NBTTagCompound) stackTagCompound.copy();
if (!copy.stackTagCompound.equals(stackTagCompound))
return copy;
}
return copy;
}
public NBTTagCompound getTagCompound() {
return stackTagCompound;
}
public void setTagCompound(NBTTagCompound nbttagcompound) {
stackTagCompound = nbttagcompound;
}
public boolean isLiquidEqual(LiquidStack other) {
return itemID == other.itemID && itemMeta == other.itemMeta;
}
public boolean isLiquidEqual(ItemStack other) {
return itemID == other.itemID && itemMeta == other.getItemDamage();
}
/**
* @return An ItemStack representation of this LiquidStack
*/
public ItemStack asItemStack() {
return new ItemStack(itemID, 1, itemMeta);
}
/**
* Reads a liquid stack from the passed nbttagcompound and returns it.
*
* @param nbttagcompound
* @return
*/
public static LiquidStack loadLiquidStackFromNBT(NBTTagCompound nbttagcompound) {
LiquidStack liquidstack = new LiquidStack();
liquidstack.readFromNBT(nbttagcompound);
return liquidstack.itemID == 0 ? null : liquidstack;
}
}

View file

@ -15,6 +15,7 @@ import net.minecraft.src.buildcraft.api.ILiquidContainer;
import net.minecraft.src.buildcraft.api.LiquidSlot;
import net.minecraft.src.buildcraft.api.Trigger;
import net.minecraft.src.buildcraft.api.TriggerParameter;
import net.minecraft.src.buildcraft.api.liquids.LiquidManager;
public class TriggerLiquidContainer extends Trigger {
@ -73,7 +74,7 @@ public class TriggerLiquidContainer extends Trigger {
int seachedLiquidId = 0;
if (parameter != null && parameter.getItem() != null)
seachedLiquidId = BuildCraftAPI.getLiquidForFilledItem(parameter.getItem());
seachedLiquidId = LiquidManager.getLiquidIDForFilledItem(parameter.getItem());
LiquidSlot[] liquids = container.getLiquidSlots();

View file

@ -10,6 +10,7 @@
package net.minecraft.src.buildcraft.energy;
import net.minecraft.src.ICrafting;
import net.minecraft.src.ItemStack;
import net.minecraft.src.NBTTagCompound;
import net.minecraft.src.buildcraft.api.APIProxy;
import net.minecraft.src.buildcraft.api.LiquidSlot;
@ -165,4 +166,11 @@ public abstract class Engine {
return currentOutput;
}
/* IINVENTORY */
public int getSizeInventory() { return 0; }
public ItemStack getStackInSlot(int i) { return null; }
public ItemStack decrStackSize(int i, int j) { return null; }
public ItemStack getStackInSlotOnClosing(int i) { return getStackInSlot(i); }
public void setInventorySlotContents(int i, ItemStack itemstack) {}
}

View file

@ -17,6 +17,7 @@ import net.minecraft.src.buildcraft.api.BuildCraftAPI;
import net.minecraft.src.buildcraft.api.IronEngineFuel;
import net.minecraft.src.buildcraft.api.LiquidSlot;
import net.minecraft.src.buildcraft.api.Orientations;
import net.minecraft.src.buildcraft.api.liquids.LiquidManager;
import net.minecraft.src.buildcraft.core.DefaultProps;
import net.minecraft.src.buildcraft.core.Utils;
@ -26,6 +27,8 @@ public class EngineIron extends Engine {
public static int MAX_HEAT = 100000;
public static int COOLANT_THRESHOLD = 49000;
private ItemStack itemInInventory;
int burnTime = 0;
int liquidQty = 0;
int liquidId = 0;
@ -120,10 +123,8 @@ public class EngineIron extends Engine {
public void update() {
super.update();
ItemStack itemInInventory = tile.getStackInSlot(0);
if (itemInInventory != null) {
int liquidId = BuildCraftAPI.getLiquidForFilledItem(itemInInventory);
int liquidId = LiquidManager.getLiquidIDForFilledItem(itemInInventory);
if (liquidId != 0) {
if (fill(Orientations.Unknown, BuildCraftAPI.BUCKET_VOLUME, liquidId, false) == BuildCraftAPI.BUCKET_VOLUME) {
@ -245,6 +246,12 @@ public class EngineIron extends Engine {
coolantQty = nbttagcompound.getInteger("coolantQty");
heat = nbttagcompound.getInteger("heat");
penaltyCooling = nbttagcompound.getInteger("penaltyCooling");
if (nbttagcompound.hasKey("itemInInventory")) {
NBTTagCompound cpt = nbttagcompound.getCompoundTag("itemInInventory");
itemInInventory = ItemStack.loadItemStackFromNBT(cpt);
}
}
@Override
@ -255,7 +262,14 @@ public class EngineIron extends Engine {
nbttagcompound.setInteger("coolantId", coolantId);
nbttagcompound.setInteger("coolantQty", coolantQty);
nbttagcompound.setInteger("heat", heat);
nbttagcompound.setInteger("penaltyCooling", penaltyCooling);
nbttagcompound.setInteger("penaltyCooling", penaltyCooling);
if (itemInInventory != null) {
NBTTagCompound cpt = new NBTTagCompound();
itemInInventory.writeToNBT(cpt);
nbttagcompound.setTag("itemInInventory", cpt);
}
}
public int getScaledCoolant(int i) {
@ -320,4 +334,34 @@ public class EngineIron extends Engine {
public int getHeat() {
return heat;
}
/* IINVENTORY */
@Override public int getSizeInventory() { return 1; }
@Override public ItemStack getStackInSlot(int i) { return itemInInventory; }
@Override public void setInventorySlotContents(int i, ItemStack itemstack) { itemInInventory = itemstack; }
@Override
public ItemStack decrStackSize(int i, int j) {
if (itemInInventory != null) {
ItemStack newStack = itemInInventory.splitStack(j);
if (itemInInventory.stackSize == 0) {
itemInInventory = null;
}
return newStack;
} else {
return null;
}
}
@Override
public ItemStack getStackInSlotOnClosing(int var1) {
if (itemInInventory == null)
return null;
ItemStack toReturn = itemInInventory;
itemInInventory = null;
return toReturn;
}
}

View file

@ -24,6 +24,8 @@ public class EngineStone extends Engine {
int burnTime = 0;
int totalBurnTime = 0;
private ItemStack itemInInventory;
public EngineStone(TileEngine engine) {
super(engine);
@ -112,16 +114,30 @@ public class EngineStone extends Engine {
}
}
/* SAVING & LOADING */
@Override
public void readFromNBT(NBTTagCompound nbttagcompound) {
burnTime = nbttagcompound.getInteger("burnTime");
totalBurnTime = nbttagcompound.getInteger("totalBurnTime");
if (nbttagcompound.hasKey("itemInInventory")) {
NBTTagCompound cpt = nbttagcompound.getCompoundTag("itemInInventory");
itemInInventory = ItemStack.loadItemStackFromNBT(cpt);
}
}
@Override
public void writeToNBT(NBTTagCompound nbttagcompound) {
nbttagcompound.setInteger("burnTime", burnTime);
nbttagcompound.setInteger("totalBurnTime", totalBurnTime);
if (itemInInventory != null) {
NBTTagCompound cpt = new NBTTagCompound();
itemInInventory.writeToNBT(cpt);
nbttagcompound.setTag("itemInInventory", cpt);
}
}
@Override
@ -161,4 +177,34 @@ public class EngineStone extends Engine {
public int getHeat() {
return energy;
}
/* IINVENTORY */
@Override public int getSizeInventory() { return 1; }
@Override public ItemStack getStackInSlot(int i) { return itemInInventory; }
@Override public void setInventorySlotContents(int i, ItemStack itemstack) { itemInInventory = itemstack; }
@Override
public ItemStack decrStackSize(int i, int j) {
if (itemInInventory != null) {
ItemStack newStack = itemInInventory.splitStack(j);
if (itemInInventory.stackSize == 0) {
itemInInventory = null;
}
return newStack;
} else {
return null;
}
}
@Override
public ItemStack getStackInSlotOnClosing(int var1) {
if (itemInInventory == null)
return null;
ItemStack toReturn = itemInInventory;
itemInInventory = null;
return toReturn;
}
}

View file

@ -53,8 +53,6 @@ public class TileEngine extends TileBuildCraft implements IPowerReceptor, IInven
public int orientation;
private ItemStack itemInInventory;
PowerProvider provider;
public boolean isRedstonePowered = false;
@ -229,11 +227,6 @@ public class TileEngine extends TileBuildCraft implements IPowerReceptor, IInven
engine.orientation = Orientations.values()[orientation];
}
if (nbttagcompound.hasKey("itemInInventory")) {
NBTTagCompound cpt = nbttagcompound.getCompoundTag("itemInInventory");
itemInInventory = ItemStack.loadItemStackFromNBT(cpt);
}
if (engine != null) {
engine.readFromNBT(nbttagcompound);
}
@ -251,58 +244,48 @@ public class TileEngine extends TileBuildCraft implements IPowerReceptor, IInven
nbttagcompound.setInteger("energy", engine.energy);
}
if (itemInInventory != null) {
NBTTagCompound cpt = new NBTTagCompound();
itemInInventory.writeToNBT(cpt);
nbttagcompound.setTag("itemInInventory", cpt);
}
if (engine != null) {
engine.writeToNBT(nbttagcompound);
}
}
/* IINVENTORY IMPLEMENTATION */
@Override
public int getSizeInventory() {
if (engine instanceof EngineStone) {
return 1;
} else {
if(engine != null)
return engine.getSizeInventory();
else
return 0;
}
}
@Override
public ItemStack getStackInSlot(int i) {
return itemInInventory;
if(engine != null)
return engine.getStackInSlot(i);
else
return null;
}
@Override
public ItemStack decrStackSize(int i, int j) {
if (itemInInventory != null) {
ItemStack newStack = itemInInventory.splitStack(j);
if (itemInInventory.stackSize == 0) {
itemInInventory = null;
}
return newStack;
} else {
if(engine != null)
return engine.decrStackSize(i, j);
else
return null;
}
}
@Override
public ItemStack getStackInSlotOnClosing(int var1) {
if (itemInInventory == null)
public ItemStack getStackInSlotOnClosing(int i) {
if(engine != null)
return engine.getStackInSlotOnClosing(i);
else
return null;
ItemStack toReturn = itemInInventory;
itemInInventory = null;
return toReturn;
}
@Override
public void setInventorySlotContents(int i, ItemStack itemstack) {
itemInInventory = itemstack;
if(engine != null)
engine.setInventorySlotContents(i, itemstack);
}
@Override
@ -320,6 +303,7 @@ public class TileEngine extends TileBuildCraft implements IPowerReceptor, IInven
return worldObj.getBlockTileEntity(xCoord, yCoord, zCoord) == this;
}
/* STATE INFORMATION */
public boolean isBurning() {
return engine != null && engine.isBurning();
}
@ -332,6 +316,7 @@ public class TileEngine extends TileBuildCraft implements IPowerReceptor, IInven
}
}
/* SMP UPDATING */
@Override
public Packet getDescriptionPacket() {
createEngineIfNeeded();

View file

@ -25,6 +25,7 @@ import net.minecraft.src.buildcraft.api.APIProxy;
import net.minecraft.src.buildcraft.api.BuildCraftAPI;
import net.minecraft.src.buildcraft.api.Orientations;
import net.minecraft.src.buildcraft.api.Position;
import net.minecraft.src.buildcraft.api.liquids.LiquidManager;
import net.minecraft.src.buildcraft.api.tools.IToolWrench;
import net.minecraft.src.buildcraft.core.GuiIds;
import net.minecraft.src.buildcraft.core.Utils;
@ -101,7 +102,7 @@ public class BlockRefinery extends BlockContainer {
return true;
} else {
int liquidId = BuildCraftAPI.getLiquidForFilledItem(entityplayer.getCurrentEquippedItem());
int liquidId = LiquidManager.getLiquidIDForFilledItem(entityplayer.getCurrentEquippedItem());
if (liquidId != 0) {
int qty = ((TileRefinery) world.getBlockTileEntity(i, j, k)).fill(Orientations.Unknown,

View file

@ -20,6 +20,7 @@ import net.minecraft.src.Material;
import net.minecraft.src.TileEntity;
import net.minecraft.src.World;
import net.minecraft.src.buildcraft.api.BuildCraftAPI;
import net.minecraft.src.buildcraft.api.liquids.LiquidManager;
import net.minecraft.src.buildcraft.api.Orientations;
import net.minecraft.src.buildcraft.core.DefaultProps;
import net.minecraft.src.buildcraft.core.Utils;
@ -88,8 +89,10 @@ public class BlockTank extends BlockContainer implements ITextureProvider {
@Override
public boolean blockActivated(World world, int i, int j, int k, EntityPlayer entityplayer) {
if (entityplayer.getCurrentEquippedItem() != null) {
int liquidId = BuildCraftAPI.getLiquidForFilledItem(entityplayer.getCurrentEquippedItem());
ItemStack current = entityplayer.inventory.getCurrentItem();
if (current != null) {
int liquidId = LiquidManager.getLiquidIDForFilledItem(current);
TileTank tank = (TileTank) world.getBlockTileEntity(i, j, k);
@ -98,10 +101,24 @@ public class BlockTank extends BlockContainer implements ITextureProvider {
if (qty != 0 && !BuildCraftCore.debugMode) {
entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem,
Utils.consumeItem(entityplayer.inventory.getCurrentItem()));
Utils.consumeItem(current));
}
return true;
} else {
ItemStack filled = LiquidManager.fillLiquidContainer(tank.getLiquidId(), current);
int qty = tank.empty(BuildCraftAPI.BUCKET_VOLUME, false);
if(filled != null && qty >= BuildCraftAPI.BUCKET_VOLUME){
if(current.stackSize > 1 && !entityplayer.inventory.addItemStackToInventory(filled)){
return false;
}
entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem,
Utils.consumeItem(current));
tank.empty(BuildCraftAPI.BUCKET_VOLUME, true);
return true;
}
}
}

View file

@ -1,40 +0,0 @@
/**
* Copyright (c) SpaceToad, 2011
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package net.minecraft.src.buildcraft.factory;
import net.minecraft.src.BuildCraftFactory;
import net.minecraft.src.ItemStack;
import net.minecraft.src.World;
import net.minecraft.src.buildcraft.api.BuildCraftAPI;
import net.minecraft.src.forge.IBucketHandler;
public class TankBucketHandler implements IBucketHandler {
@Override
public ItemStack fillCustomBucket(World w, int i, int j, int k) {
if (w.getBlockId(i, j, k) == BuildCraftFactory.tankBlock.blockID) {
TileTank tank = (TileTank) w.getBlockTileEntity(i, j, k);
int qty = tank.empty(BuildCraftAPI.BUCKET_VOLUME, false);
ItemStack filledBucket = BuildCraftAPI.getFilledItemForLiquid(tank.getLiquidId());
if (qty >= BuildCraftAPI.BUCKET_VOLUME && filledBucket != null) {
tank.empty(BuildCraftAPI.BUCKET_VOLUME, true);
return filledBucket;
}
}
return null;
}
}

View file

@ -141,6 +141,9 @@ public class PipeTransportPower extends PipeTransport {
if (entity instanceof TileGenericPipe) {
TileGenericPipe nearbyTile = (TileGenericPipe) entity;
if (nearbyTile.pipe == null)
continue;
PipeTransportPower nearbyTransport = (PipeTransportPower) nearbyTile.pipe.transport;
nearbyTransport.requestEnergy(Orientations.values()[i].reverse(), transferQuery[i]);

View file

@ -12,6 +12,7 @@ package net.minecraft.src.buildcraft.transport;
import net.minecraft.src.buildcraft.api.BuildCraftAPI;
import net.minecraft.src.buildcraft.api.Trigger;
import net.minecraft.src.buildcraft.api.TriggerParameter;
import net.minecraft.src.buildcraft.api.liquids.LiquidManager;
import net.minecraft.src.buildcraft.core.DefaultProps;
import net.minecraft.src.buildcraft.transport.PipeTransportLiquids.LiquidBuffer;
@ -92,7 +93,7 @@ public class TriggerPipeContents extends Trigger implements ITriggerPipe {
int seachedLiquidId = 0;
if (parameter != null && parameter.getItem() != null)
seachedLiquidId = BuildCraftAPI.getLiquidForFilledItem(parameter.getItem());
seachedLiquidId = LiquidManager.getLiquidIDForFilledItem(parameter.getItem());
if (kind == Kind.Empty) {
for (LiquidBuffer b : transportLiquids.side)