Merge pull request #83 from CovertJaguar/master
Added a new API function for filling liquid containers
This commit is contained in:
commit
f1caf84953
2 changed files with 10 additions and 1 deletions
|
@ -66,6 +66,15 @@ public class BuildCraftAPI {
|
|||
return null;
|
||||
}
|
||||
|
||||
public static ItemStack fillLiquidContainer(int liquidId, ItemStack emptyContainer){
|
||||
for(LiquidData data : liquids) {
|
||||
if(data.liquidId == liquidId && data.container.isItemEqual(emptyContainer)) {
|
||||
return data.filled.copy();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static boolean isLiquid(int blockId) {
|
||||
if (blockId == 0) {
|
||||
return false;
|
||||
|
|
|
@ -25,7 +25,7 @@ public class TankBucketHandler implements IBucketHandler {
|
|||
|
||||
int qty = tank.empty(BuildCraftAPI.BUCKET_VOLUME, false);
|
||||
|
||||
ItemStack filledBucket = BuildCraftAPI.getFilledItemForLiquid(tank.getLiquidId());
|
||||
ItemStack filledBucket = BuildCraftAPI.fillLiquidContainer(tank.getLiquidId(), new ItemStack(Item.bucketEmpty));
|
||||
|
||||
if (qty >= BuildCraftAPI.BUCKET_VOLUME && filledBucket != null) {
|
||||
tank.empty(BuildCraftAPI.BUCKET_VOLUME, true);
|
||||
|
|
Loading…
Reference in a new issue