mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-26 14:52:58 +00:00
Fix loading gas tank's with null gas stored. Fixes #5470
This commit is contained in:
2 files changed
+3
-2
No files matched your search
@@ -1,5 +1,6 @@
|
||||
package mekanism.api.gas;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
/**
|
||||
@@ -44,6 +45,7 @@ public class GasStack {
|
||||
*
|
||||
* @return GasStack stored in the tag compound
|
||||
*/
|
||||
@Nullable
|
||||
public static GasStack readFromNBT(NBTTagCompound nbtTags) {
|
||||
if (nbtTags == null || nbtTags.isEmpty()) {
|
||||
return null;
|
||||
@@ -70,7 +72,6 @@ public class GasStack {
|
||||
|
||||
public GasStack withAmount(int newAmount) {
|
||||
amount = newAmount;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@@ -217,7 +217,7 @@ public class GasTank implements GasTankInfo {
|
||||
public void read(NBTTagCompound nbtTags) {
|
||||
if (nbtTags.hasKey("stored")) {
|
||||
stored = GasStack.readFromNBT(nbtTags.getCompoundTag("stored"));
|
||||
if (stored.amount <= 0) {
|
||||
if (stored != null && stored.amount <= 0) {
|
||||
//fix any old data that may be broken
|
||||
stored = null;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user