mirror of
https://github.com/GTNewHorizons/NotEnoughItems.git
synced 2026-11-16 10:44:45 +00:00
Fix crash with null fluid stack (#193)
* fix crash with null fluid stack * change minimum stack size in bookmarks Co-authored-by: Serghei Borovetchi <[email protected]>
This commit is contained in:
1 parent
2d18dcf42b
commit
144a37cebb
3 files changed
+20
-15
No files matched your search
@@ -281,15 +281,11 @@ public class BookmarkPanel extends ItemPanel
|
||||
for (PositionedStack stack : ingredients) {
|
||||
final NBTTagCompound nbTag = StackInfo.itemStackToNBT(stack.item, saveStackSize);
|
||||
|
||||
if (nbTag.getInteger("Count") > 0) {
|
||||
|
||||
if (unique.get(nbTag) == null) {
|
||||
unique.put(nbTag, 1);
|
||||
sorted.add(nbTag);
|
||||
} else if (saveStackSize) {
|
||||
unique.put(nbTag, unique.get(nbTag) + 1);
|
||||
}
|
||||
|
||||
if (unique.get(nbTag) == null) {
|
||||
unique.put(nbTag, 1);
|
||||
sorted.add(nbTag);
|
||||
} else if (saveStackSize) {
|
||||
unique.put(nbTag, unique.get(nbTag) + 1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -14,9 +14,15 @@ public class DefaultStackStringifyHandler implements IStackStringifyHandler
|
||||
|
||||
public NBTTagCompound convertItemStackToNBT(ItemStack stack, boolean saveStackSize)
|
||||
{
|
||||
final String strId = Item.itemRegistry.getNameForObject(stack.getItem());
|
||||
|
||||
if (strId == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
final NBTTagCompound nbTag = new NBTTagCompound();
|
||||
nbTag.setString("strId", Item.itemRegistry.getNameForObject(stack.getItem()));
|
||||
nbTag.setInteger("Count", saveStackSize? stack.stackSize: 1);
|
||||
nbTag.setString("strId", strId);
|
||||
nbTag.setInteger("Count", Math.max(saveStackSize? stack.stackSize: 1, 1));
|
||||
nbTag.setShort("Damage", (short)stack.getItemDamage());
|
||||
|
||||
if (stack.hasTagCompound()) {
|
||||
|
||||
@@ -31,12 +31,15 @@ public class GTFluidStackStringifyHandler implements IStackStringifyHandler
|
||||
{
|
||||
|
||||
if (GTDisplayFluid != null && GTDisplayFluid.isInstance(stack.getItem())) {
|
||||
final NBTTagCompound nbTag = new NBTTagCompound();
|
||||
final FluidStack fluidStack = getFluid(stack);
|
||||
|
||||
nbTag.setString("gtFluidName", fluidStack.getFluid().getName());
|
||||
nbTag.setInteger("Count", saveStackSize? fluidStack.amount: 1);
|
||||
return nbTag;
|
||||
if (fluidStack != null) {
|
||||
final NBTTagCompound nbTag = new NBTTagCompound();
|
||||
nbTag.setString("gtFluidName", fluidStack.getFluid().getName());
|
||||
nbTag.setInteger("Count", saveStackSize? fluidStack.amount: 1);
|
||||
return nbTag;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
Reference in new issue
Block a user