mirror of
https://github.com/GTNewHorizons/AE2FluidCraft-Rework.git
synced 2026-11-15 17:44:46 +00:00
Ensure that the itemstack is not null
This commit is contained in:
2 files changed
+20
-12
No files matched your search
@@ -441,7 +441,11 @@ public class TileLevelMaintainer extends AENetworkTile
|
||||
if (tag == null || !tag.hasKey(NBT_STACK)) {
|
||||
this.requests[i] = null;
|
||||
} else if (this.requests[i] == null) {
|
||||
this.requests[i] = new RequestInfo(tag, this);
|
||||
try {
|
||||
this.requests[i] = new RequestInfo(tag, this);
|
||||
} catch (Exception ignored) {
|
||||
this.requests[i] = null;
|
||||
}
|
||||
} else {
|
||||
this.requests[i].loadFromNBT(tag);
|
||||
}
|
||||
@@ -598,9 +602,12 @@ public class TileLevelMaintainer extends AENetworkTile
|
||||
job = null;
|
||||
}
|
||||
|
||||
public RequestInfo(NBTTagCompound tag, TileLevelMaintainer tile) {
|
||||
public RequestInfo(NBTTagCompound tag, TileLevelMaintainer tile) throws IllegalArgumentException {
|
||||
this.tile = tile;
|
||||
itemStack = AEItemStack.loadItemStackFromNBT(tag.getCompoundTag(NBT_STACK));
|
||||
if (itemStack == null) {
|
||||
throw new IllegalArgumentException("ItemStack cannot be null!");
|
||||
}
|
||||
quantity = tag.getLong(NBT_QUANTITY);
|
||||
batchSize = tag.getLong(NBT_BATCH);
|
||||
enable = tag.getBoolean(NBT_ENABLE);
|
||||
|
||||
+11
-10
@@ -31,16 +31,17 @@ public class LevelMaintainerWailaDataProvider extends BaseWailaDataProvider {
|
||||
NBTTagCompound tag = tagList.getCompoundTagAt(i);
|
||||
if (tag == null || !tag.hasKey(TileLevelMaintainer.NBT_STACK)) continue;
|
||||
|
||||
TileLevelMaintainer.RequestInfo request = new TileLevelMaintainer.RequestInfo(
|
||||
tag,
|
||||
tileLevelMaintainer);
|
||||
currentToolTip.add(
|
||||
Tooltip.tileLevelMaintainerFormat(
|
||||
request.getAEItemStack().getItemStack().getDisplayName(),
|
||||
request.getQuantity(),
|
||||
request.getBatchSize(),
|
||||
request.isEnable()));
|
||||
|
||||
try {
|
||||
TileLevelMaintainer.RequestInfo request = new TileLevelMaintainer.RequestInfo(
|
||||
tag,
|
||||
tileLevelMaintainer);
|
||||
currentToolTip.add(
|
||||
Tooltip.tileLevelMaintainerFormat(
|
||||
request.getAEItemStack().getItemStack().getDisplayName(),
|
||||
request.getQuantity(),
|
||||
request.getBatchSize(),
|
||||
request.isEnable()));
|
||||
} catch (Exception ignored) {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user