Discovered more NPEs related to LiquidManager so I took a new approach.
This commit is contained in:
parent
edf5e8eb32
commit
610be32388
6 changed files with 14 additions and 11 deletions
|
@ -18,6 +18,15 @@ public class LiquidManager {
|
|||
|
||||
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)
|
||||
|
|
|
@ -74,7 +74,7 @@ public class TriggerLiquidContainer extends Trigger {
|
|||
int seachedLiquidId = 0;
|
||||
|
||||
if (parameter != null && parameter.getItem() != null)
|
||||
seachedLiquidId = LiquidManager.getLiquidForFilledItem(parameter.getItem()).itemID;
|
||||
seachedLiquidId = LiquidManager.getLiquidIDForFilledItem(parameter.getItem());
|
||||
|
||||
LiquidSlot[] liquids = container.getLiquidSlots();
|
||||
|
||||
|
|
|
@ -18,7 +18,6 @@ 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.api.liquids.LiquidStack;
|
||||
import net.minecraft.src.buildcraft.core.DefaultProps;
|
||||
import net.minecraft.src.buildcraft.core.Utils;
|
||||
|
||||
|
@ -125,12 +124,7 @@ public class EngineIron extends Engine {
|
|||
super.update();
|
||||
|
||||
if (itemInInventory != null) {
|
||||
|
||||
LiquidStack liquidForFilledItem = LiquidManager.getLiquidForFilledItem(itemInInventory);
|
||||
if (liquidForFilledItem == null)
|
||||
return;
|
||||
|
||||
int liquidId = liquidForFilledItem.itemID;
|
||||
int liquidId = LiquidManager.getLiquidIDForFilledItem(itemInInventory);
|
||||
|
||||
if (liquidId != 0) {
|
||||
if (fill(Orientations.Unknown, BuildCraftAPI.BUCKET_VOLUME, liquidId, false) == BuildCraftAPI.BUCKET_VOLUME) {
|
||||
|
|
|
@ -102,7 +102,7 @@ public class BlockRefinery extends BlockContainer {
|
|||
return true;
|
||||
} else {
|
||||
|
||||
int liquidId = LiquidManager.getLiquidForFilledItem(entityplayer.getCurrentEquippedItem()).itemID;
|
||||
int liquidId = LiquidManager.getLiquidIDForFilledItem(entityplayer.getCurrentEquippedItem());
|
||||
|
||||
if (liquidId != 0) {
|
||||
int qty = ((TileRefinery) world.getBlockTileEntity(i, j, k)).fill(Orientations.Unknown,
|
||||
|
|
|
@ -92,7 +92,7 @@ public class BlockTank extends BlockContainer implements ITextureProvider {
|
|||
ItemStack current = entityplayer.inventory.getCurrentItem();
|
||||
if (current != null) {
|
||||
|
||||
int liquidId = LiquidManager.getLiquidForFilledItem(current).itemID;
|
||||
int liquidId = LiquidManager.getLiquidIDForFilledItem(current);
|
||||
|
||||
TileTank tank = (TileTank) world.getBlockTileEntity(i, j, k);
|
||||
|
||||
|
|
|
@ -93,7 +93,7 @@ public class TriggerPipeContents extends Trigger implements ITriggerPipe {
|
|||
int seachedLiquidId = 0;
|
||||
|
||||
if (parameter != null && parameter.getItem() != null)
|
||||
seachedLiquidId = LiquidManager.getLiquidForFilledItem(parameter.getItem()).itemID;
|
||||
seachedLiquidId = LiquidManager.getLiquidIDForFilledItem(parameter.getItem());
|
||||
|
||||
if (kind == Kind.Empty) {
|
||||
for (LiquidBuffer b : transportLiquids.side)
|
||||
|
|
Loading…
Reference in a new issue