First batch of null -> isEmpty() checks.
I most likely still missed a ton of checks...
This commit is contained in:
@@ -37,14 +37,14 @@ public class TileCubeGenerator extends AEBaseTile implements ITickable
|
||||
{
|
||||
|
||||
private int size = 3;
|
||||
private ItemStack is = null;
|
||||
private ItemStack is = ItemStack.EMPTY;
|
||||
private int countdown = 20 * 10;
|
||||
private EntityPlayer who = null;
|
||||
|
||||
@Override
|
||||
public void update()
|
||||
{
|
||||
if( this.is != null && Platform.isServer() )
|
||||
if( !this.is.isEmpty() && Platform.isServer() )
|
||||
{
|
||||
this.countdown--;
|
||||
|
||||
@@ -92,9 +92,9 @@ public class TileCubeGenerator extends AEBaseTile implements ITickable
|
||||
final ItemStack hand = player.inventory.getCurrentItem();
|
||||
this.who = player;
|
||||
|
||||
if( hand == null )
|
||||
if( hand.isEmpty() )
|
||||
{
|
||||
this.is = null;
|
||||
this.is = ItemStack.EMPTY;
|
||||
|
||||
if( player.isSneaking() )
|
||||
{
|
||||
|
||||
@@ -23,6 +23,7 @@ import java.util.LinkedList;
|
||||
import java.util.Queue;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -78,7 +79,10 @@ public class TileItemGen extends AEBaseTile implements IInventory
|
||||
|
||||
private ItemStack getRandomItem()
|
||||
{
|
||||
return POSSIBLE_ITEMS.peek();
|
||||
// Safeguard for crash
|
||||
ItemStack testStack = POSSIBLE_ITEMS.peek();
|
||||
if( testStack.isEmpty() ) testStack = new ItemStack(Blocks.COBBLESTONE, 1);
|
||||
return testStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user