Fix NPE when a smeltery fuel is removed from the fluid registry (such as a mod being removed)
@@ -9,6 +9,7 @@ import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
+import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidTank;
import net.minecraftforge.fml.relauncher.Side;
@@ -216,11 +217,18 @@ public abstract class TileHeatingStructureFuelTank<T extends MultiblockDetection
// we still have leftover fuel
if(hasFuel()) {
+ // if the current fuel is null, something in the fluid registry changed
+ // just replace it with lava and ignore for now, it will fix next time we consume fuel
+ if(currentFuel == null) {
+ info.fluid = new FluidStack(FluidRegistry.LAVA, 0);
+ info.maxCap = 1;
+ } else {
info.fluid = currentFuel.copy();
info.fluid.amount = 0;
- info.heat = this.temperature + 300;
info.maxCap = currentFuel.amount;
}
+ info.heat = this.temperature + 300;
+ }
else if(currentTank != null) {
// we need to consume fuel, check the current tank
if(hasTankWithFuel(currentTank, currentFuel)) {
