Skip to content

Commit

Permalink
Fixes for #6 Server Crash When Rotting to Null (may not be complete fix)
Browse files Browse the repository at this point in the history
  • Loading branch information
Stormwind99 committed Jun 28, 2018
1 parent 4b24385 commit 0e228e7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/java/com/wumple/foodfunk/EventManager.java
Expand Up @@ -62,7 +62,7 @@ public static void onPlayerInteract(PlayerInteractEvent event)
{
TileEntity tile = event.getEntityPlayer().world.getTileEntity(event.getPos());

if(tile != null & tile instanceof IInventory)
if ((tile != null) && (tile instanceof IInventory))
{
RotHandler.rotInvo(event.getEntityPlayer().world, (IInventory)tile);
}
Expand Down
6 changes: 5 additions & 1 deletion src/java/com/wumple/foodfunk/RotHandler.java
Expand Up @@ -57,7 +57,7 @@ private static ItemStack forceRot(ItemStack stack, String rotID)

Item item = Item.REGISTRY.getObject(new ResourceLocation(rotID));

return item == null ? null : new ItemStack(item, stack.getCount()); // , meta);
return item == null ? ItemStack.EMPTY : new ItemStack(item, stack.getCount()); // , meta);
}

/*
Expand Down Expand Up @@ -134,6 +134,10 @@ public static void rotInvo(World world, IInventory inventory)

if(rotItem == null || rotItem.isEmpty() || (rotItem.getItem() != slotItem.getItem()))
{
if (rotItem == null)
{
rotItem = ItemStack.EMPTY;
}
inventory.setInventorySlotContents(i, rotItem);
flag = true;
}
Expand Down

0 comments on commit 0e228e7

Please sign in to comment.