mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-23 21:39:51 +00:00
Check that fluids are not null when auto-dumping from bottler
This commit is contained in:
1 parent
408d1dc7c3
commit
07b88d36fc
3 files changed
+14
-8
No files matched your search
@@ -10,6 +10,8 @@
|
||||
******************************************************************************/
|
||||
package forestry.core.fluids;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import forestry.core.utils.InventoryUtil;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
@@ -36,7 +38,7 @@ public final class FluidHelper {
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean canAcceptFluid(World world, BlockPos pos, EnumFacing facing, FluidStack fluid) {
|
||||
public static boolean canAcceptFluid(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull EnumFacing facing, @Nonnull FluidStack fluid) {
|
||||
IFluidHandler capability = FluidUtil.getFluidHandler(world, pos, facing);
|
||||
if (capability != null) {
|
||||
if(capability.getTankProperties() == null){
|
||||
|
||||
@@ -298,6 +298,7 @@ public class TankManager implements ITankManager, ITankUpdateHandler, IStreamabl
|
||||
return tanks.get(tankIndex).getInfo();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public FluidStack getFluid(int tankIndex) {
|
||||
return tanks.get(tankIndex).getFluid();
|
||||
}
|
||||
|
||||
@@ -135,15 +135,18 @@ public class TileBottler extends TilePowered implements ISidedInventory, ILiquid
|
||||
}
|
||||
|
||||
private boolean canDump() {
|
||||
if (canDump.isEmpty()) {
|
||||
for(EnumFacing facing : EnumFacing.VALUES){
|
||||
canDump.put(facing, FluidHelper.canAcceptFluid(worldObj, pos.offset(facing), facing.getOpposite(), tankManager.getFluid(0)));
|
||||
FluidStack fluid = tankManager.getFluid(0);
|
||||
if (fluid != null) {
|
||||
if (canDump.isEmpty()) {
|
||||
for (EnumFacing facing : EnumFacing.VALUES) {
|
||||
canDump.put(facing, FluidHelper.canAcceptFluid(worldObj, pos.offset(facing), facing.getOpposite(), fluid));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(EnumFacing facing : EnumFacing.VALUES){
|
||||
if(canDump.get(facing)){
|
||||
return true;
|
||||
for (EnumFacing facing : EnumFacing.VALUES) {
|
||||
if (canDump.get(facing)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
Reference in new issue
Block a user