Ton of null fixes

This commit is contained in:
Vincent Lee committed 2017-01-05 03:44:13 -06:00
1 parent a87dd1d46b
commit 24779ded1c
132 files changed
+403 -325

No files matched your search

@@ -51,7 +51,7 @@ public interface IManaProficiencyArmor {
if(e.getSlotType() != EntityEquipmentSlot.Type.ARMOR)
continue;
ItemStack armor = player.getItemStackFromSlot(e);
if(armor != null) {
if(!armor.isEmpty()) {
Item item = armor.getItem();
if(item instanceof IManaProficiencyArmor && ((IManaProficiencyArmor) item).shouldGiveProficiency(armor, e, player, rod)) {
proficient = true;
@@ -59,7 +59,7 @@ public final class LexiconRecipeMappings {
}
public static String stackToString(ItemStack stack, boolean forceIgnore) {
if(stack == null || stack.getItem() == null)
if(stack.isEmpty())
return "NULL";
if(stack.hasTagCompound() && stack.getItem() instanceof IRecipeKeyProvider)
@@ -40,10 +40,10 @@ public final class AstrolabePreviewHandler {
List<EntityPlayer> playerEntities = world.playerEntities;
for (EntityPlayer player : playerEntities) {
ItemStack currentStack = player.getHeldItemMainhand();
if(currentStack == null || !(currentStack.getItem() instanceof ItemAstrolabe))
if(currentStack.isEmpty() || !(currentStack.getItem() instanceof ItemAstrolabe))
currentStack = player.getHeldItemOffhand();
if(currentStack != null && currentStack.getItem() instanceof ItemAstrolabe) {
if(!currentStack.isEmpty() && currentStack.getItem() instanceof ItemAstrolabe) {
Block block = ItemAstrolabe.getBlock(currentStack);
if(block != Blocks.AIR)
renderPlayerLook(player, currentStack);
@@ -46,7 +46,7 @@ public final class BaubleRenderHandler implements LayerRenderer<EntityPlayer> {
IInventory inv = BaublesApi.getBaubles(player);
dispatchRenders(inv, player, RenderType.BODY, partialTicks);
if(inv.getStackInSlot(3) != null)
if(!inv.getStackInSlot(3).isEmpty())
renderManaTablet(player);
float yaw = player.prevRotationYawHead + (player.rotationYawHead - player.prevRotationYawHead) * partialTicks;
@@ -60,7 +60,7 @@ public final class BaubleRenderHandler implements LayerRenderer<EntityPlayer> {
dispatchRenders(inv, player, RenderType.HEAD, partialTicks);
ItemStack helm = player.inventory.armorItemInSlot(3);
if(helm != null && helm.getItem() instanceof ItemTerrasteelHelm)
if(!helm.isEmpty() && helm.getItem() instanceof ItemTerrasteelHelm)
ItemTerrasteelHelm.renderOnPlayer(helm, player);
GlStateManager.popMatrix();
@@ -69,7 +69,7 @@ public final class BaubleRenderHandler implements LayerRenderer<EntityPlayer> {
private void dispatchRenders(IInventory inv, EntityPlayer player, RenderType type, float partialTicks) {
for(int i = 0; i < inv.getSizeInventory(); i++) {
ItemStack stack = inv.getStackInSlot(i);
if(stack != null) {
if(!stack.isEmpty()) {
Item item = stack.getItem();
if(item instanceof IPhantomInkable) {
@@ -107,11 +107,11 @@ public final class BaubleRenderHandler implements LayerRenderer<EntityPlayer> {
boolean renderedOne = false;
for(int i = 0; i < player.inventory.getSizeInventory(); i++) {
ItemStack stack = player.inventory.getStackInSlot(i);
if(stack != null && stack.getItem() == ModItems.manaTablet) {
if(!stack.isEmpty() && stack.getItem() == ModItems.manaTablet) {
GlStateManager.pushMatrix();
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
Helper.rotateIfSneaking(player);
boolean armor = player.getItemStackFromSlot(EntityEquipmentSlot.LEGS) != null;
boolean armor = !player.getItemStackFromSlot(EntityEquipmentSlot.LEGS).isEmpty();
GlStateManager.rotate(90, 0, 1, 0);
GlStateManager.rotate(180, 0, 0, 1);
GlStateManager.translate(0, -0.6, 0);
@@ -53,13 +53,13 @@ public final class BoundTileRenderer {
EntityPlayer player = Minecraft.getMinecraft().player;
int color = Color.HSBtoRGB(ClientTickHandler.ticksInGame % 200 / 200F, 0.6F, 1F);
if(player.getHeldItemMainhand() != null && player.getHeldItemMainhand().getItem() instanceof ICoordBoundItem) {
if(!player.getHeldItemMainhand().isEmpty() && player.getHeldItemMainhand().getItem() instanceof ICoordBoundItem) {
BlockPos coords = ((ICoordBoundItem) player.getHeldItemMainhand().getItem()).getBinding(player.getHeldItemMainhand());
if(coords != null)
renderBlockOutlineAt(coords, color);
}
if(player.getHeldItemOffhand() != null && player.getHeldItemOffhand().getItem() instanceof ICoordBoundItem) {
if(!player.getHeldItemOffhand().isEmpty() && player.getHeldItemOffhand().getItem() instanceof ICoordBoundItem) {
BlockPos coords = ((ICoordBoundItem) player.getHeldItemOffhand().getItem()).getBinding(player.getHeldItemOffhand());
if(coords != null)
renderBlockOutlineAt(coords, color);
@@ -72,7 +72,7 @@ public final class BoundTileRenderer {
for(int i = 0; i < joined.getSlots(); i++) {
ItemStack stackInSlot = joined.getStackInSlot(i);
if(stackInSlot != null && stackInSlot.getItem() instanceof IWireframeCoordinateListProvider) {
if(!stackInSlot.isEmpty() && stackInSlot.getItem() instanceof IWireframeCoordinateListProvider) {
IWireframeCoordinateListProvider provider = (IWireframeCoordinateListProvider) stackInSlot.getItem();
List<BlockPos> coordsList = provider.getWireframesToDraw(player, stackInSlot);
if(coordsList != null)
@@ -138,7 +138,7 @@ public final class ColorHandler {
items.registerItemColorHandler((s, t) -> {
ItemStack lens = ItemManaGun.getLens(s);
if(lens != null && t == 0)
if(!lens.isEmpty() && t == 0)
return Minecraft.getMinecraft().getItemColors().getColorFromItemstack(lens, t);
if(t == 2) {
@@ -90,7 +90,7 @@ public final class HUDHandler {
profiler.startSection("botania-hud");
IInventory baublesInv = BaublesApi.getBaubles(mc.player);
ItemStack headpiece = baublesInv.getStackInSlot(4);
if(headpiece != null && headpiece.getItem() == ModItems.flightTiara) {
if(!headpiece.isEmpty() && headpiece.getItem() == ModItems.flightTiara) {
profiler.startSection("flugelTiara");
ItemFlightTiara.renderHUD(event.getResolution(), mc.player, headpiece);
profiler.endSection();
@@ -98,9 +98,9 @@ public final class HUDHandler {
dodgeRing: {
ItemStack ring = baublesInv.getStackInSlot(1);
if(ring == null || !(ring.getItem() instanceof ItemDodgeRing)) {
if(ring.isEmpty() || !(ring.getItem() instanceof ItemDodgeRing)) {
ring = baublesInv.getStackInSlot(2);
if(ring == null || !(ring.getItem() instanceof ItemDodgeRing))
if(ring.isEmpty() || !(ring.getItem() instanceof ItemDodgeRing))
break dodgeRing;
}
@@ -140,7 +140,7 @@ public final class HUDHandler {
}
} else if(block != null && PlayerHelper.hasHeldItemClass(mc.player, ILexicon.class))
drawLexiconHUD(PlayerHelper.getFirstHeldItemClass(mc.player, ILexicon.class), state, pos, event.getResolution());
if(tile != null && tile instanceof TilePool && mc.player.getHeldItemMainhand() != null)
if(tile != null && tile instanceof TilePool && !mc.player.getHeldItemMainhand().isEmpty())
renderPoolRecipeHUD(event.getResolution(), (TilePool) tile, mc.player.getHeldItemMainhand());
}
if(tile != null && tile instanceof TileAltar)
@@ -166,17 +166,17 @@ public final class HUDHandler {
profiler.endSection();
}
if(main != null && main.getItem() instanceof ItemCraftingHalo) {
if(!main.isEmpty() && main.getItem() instanceof ItemCraftingHalo) {
profiler.startSection("craftingHalo_main");
ItemCraftingHalo.renderHUD(event.getResolution(), mc.player, main);
profiler.endSection();
} else if(offhand != null && offhand.getItem() instanceof ItemCraftingHalo) {
} else if(!offhand.isEmpty() && offhand.getItem() instanceof ItemCraftingHalo) {
profiler.startSection("craftingHalo_off");
ItemCraftingHalo.renderHUD(event.getResolution(), mc.player, offhand);
profiler.endSection();
}
if(main != null && main.getItem() instanceof ItemSextant) {
if(!main.isEmpty() && main.getItem() instanceof ItemSextant) {
profiler.startSection("sextant");
ItemSextant.renderHUD(event.getResolution(), mc.player, main);
profiler.endSection();
@@ -216,7 +216,7 @@ public final class HUDHandler {
IInventory inv = useBaubles ? baublesInv : mainInv;
ItemStack stack = inv.getStackInSlot(i - (useBaubles ? invSize : 0));
if(stack != null) {
if(!stack.isEmpty()) {
Item item = stack.getItem();
if(item instanceof IManaUsingItem)
anyRequest = anyRequest || ((IManaUsingItem) item).usesMana(stack);
@@ -29,13 +29,13 @@ public final class ItemsRemainingRenderHandler {
private static final int maxTicks = 30;
private static final int leaveTicks = 20;
private static ItemStack stack;
private static ItemStack stack = ItemStack.EMPTY;
private static String customString;
private static int ticks, count;
@SideOnly(Side.CLIENT)
public static void render(ScaledResolution resolution, float partTicks) {
if(ticks > 0 && stack != null) {
if(ticks > 0 && !stack.isEmpty()) {
int pos = maxTicks - ticks;
Minecraft mc = Minecraft.getMinecraft();
int x = resolution.getScaledWidth() / 2 + 10 + Math.max(0, pos - leaveTicks);
@@ -64,7 +64,7 @@ public final class ItemsRemainingRenderHandler {
String text = "";
if(customString == null) {
if(stack != null && stack.getItem() != null) {
if(!stack.isEmpty()) {
text = TextFormatting.GREEN + stack.getDisplayName();
if(count >= 0) {
int max = stack.getMaxStackSize();
@@ -13,6 +13,7 @@ package vazkii.botania.client.core.handler;
import javax.annotation.Nonnull;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Biomes;
import net.minecraft.init.Blocks;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
@@ -88,7 +89,7 @@ public class MultiblockBlockAccess implements IBlockAccess {
public Biome getBiome(@Nonnull BlockPos pos) {
if(hasBlockAccess)
return originalBlockAccess.getBiome(pos);
return null;
return Biomes.DEFAULT;
}
@Override
@@ -44,7 +44,7 @@ public class RenderLexicon {
Minecraft mc = Minecraft.getMinecraft();
if(!ConfigHandler.lexicon3dModel
|| mc.gameSettings.thirdPersonView != 0
|| mc.player.getHeldItem(evt.getHand()) == null
|| mc.player.getHeldItem(evt.getHand()).isEmpty()
|| mc.player.getHeldItem(evt.getHand()).getItem() != ModItems.lexicon)
return;
evt.setCanceled(true);
@@ -44,7 +44,7 @@ public final class TooltipAdditionDisplayHandler {
@SubscribeEvent
public static void onToolTipRender(RenderTooltipEvent.PostText evt) {
if(evt.getStack() == null)
if(evt.getStack().isEmpty())
return;
ItemStack stack = evt.getStack();
@@ -67,7 +67,7 @@ public final class TooltipAdditionDisplayHandler {
for(int i = 0; i < InventoryPlayer.getHotbarSize(); i++) {
ItemStack stackAt = mc.player.inventory.getStackInSlot(i);
if(stackAt != null && stackAt.getItem() instanceof ILexicon && ((ILexicon) stackAt.getItem()).isKnowledgeUnlocked(stackAt, data.entry.getKnowledgeType())) {
if(!stackAt.isEmpty() && stackAt.getItem() instanceof ILexicon && ((ILexicon) stackAt.getItem()).isKnowledgeUnlocked(stackAt, data.entry.getKnowledgeType())) {
lexiconStack = stackAt;
lexSlot = i;
break;
@@ -54,6 +54,7 @@ public class ContainerFlowerBag extends Container {
|| player.getHeldItemOffhand() == flowerBagInv.bag;
}
@Nonnull
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slotIndex) {
ItemStack itemstack = ItemStack.EMPTY;
@@ -76,7 +76,7 @@ import vazkii.botania.common.lib.LibMisc;
public class GuiLexicon extends GuiScreen {
public static GuiLexicon currentOpenLexicon = new GuiLexicon();
public static ItemStack stackUsed;
public static ItemStack stackUsed = ItemStack.EMPTY;
public static final Map<String, String> notes = new HashMap<>();
@@ -32,7 +32,7 @@ public class GuiButtonInvisible extends GuiButtonLexicon {
private static final ResourceLocation dogResource = new ResourceLocation(LibResources.GUI_DOG);
final GuiLexiconIndex gui;
public ItemStack displayStack = null;
public ItemStack displayStack = ItemStack.EMPTY;
public boolean dog = false;
float timeHover = 0;
@@ -55,7 +55,7 @@ public class ModelBrewery extends ModelBase {
GlStateManager.translate(0F, offset, 0F);
GlStateManager.rotate(polerot, 0F, 1F, 0F);
if(hasTile && render.brewery.getItemHandler().getStackInSlot(0) != null) {
if(hasTile && !render.brewery.getItemHandler().getStackInSlot(0).isEmpty()) {
GlStateManager.rotate(180F, 1F, 0F, 0F);
GlStateManager.translate(0, -0.45, 0);
//GlStateManager.translate(-1F / 8F, -0.5F, 1F / 128F);
@@ -78,7 +78,7 @@ public class ModelBrewery extends ModelBase {
offset1 = 0F;
GlStateManager.translate(0F, offset1, 0F);
if(hasTile && render.brewery.getItemHandler().getStackInSlot(i + 1) != null) {
if(hasTile && !render.brewery.getItemHandler().getStackInSlot(i + 1).isEmpty()) {
float rot = Plate.rotateAngleY * 180F / (float) Math.PI;
float transX = 0.3125F;
float transY = 1.06F;
@@ -17,6 +17,8 @@ import net.minecraft.item.ItemStack;
import vazkii.botania.common.entity.EntityThornChakram;
import vazkii.botania.common.item.ModItems;
import javax.annotation.Nonnull;
// Basically a bit of an extension of RenderSnowball
public class RenderThornChakram extends RenderSnowball<EntityThornChakram> {
@@ -24,6 +26,7 @@ public class RenderThornChakram extends RenderSnowball<EntityThornChakram> {
super(renderManager, ModItems.thornChakram, Minecraft.getMinecraft().getRenderItem());
}
@Nonnull
@Override
public ItemStack getStackToRender(EntityThornChakram entityIn) {
return new ItemStack(ModItems.thornChakram, 1, entityIn.isFire() ? 1 : 0);
@@ -23,7 +23,7 @@ public final class AchievementTriggerer {
@SubscribeEvent
public static void onItemPickedUp(ItemPickupEvent event) {
ItemStack stack = event.pickedUp.getEntityItem();
if(stack != null && stack.getItem() instanceof IPickupAchievement) {
if(!stack.isEmpty() && stack.getItem() instanceof IPickupAchievement) {
Achievement achievement = ((IPickupAchievement) stack.getItem()).getAchievementOnPickup(stack, event.player, event.pickedUp);
if(achievement != null)
event.player.addStat(achievement, 1);
@@ -32,7 +32,7 @@ public final class AchievementTriggerer {
@SubscribeEvent
public static void onItemCrafted(ItemCraftedEvent event) {
if(event.crafting != null && event.crafting.getItem() instanceof ICraftAchievement) {
if(!event.crafting.isEmpty() && event.crafting.getItem() instanceof ICraftAchievement) {
Achievement achievement = ((ICraftAchievement) event.crafting.getItem()).getAchievementOnCraft(event.crafting, event.player, event.craftMatrix);
if(achievement != null)
event.player.addStat(achievement, 1);
@@ -110,6 +110,7 @@ public class BlockAltGrass extends BlockMod implements ILexiconable {
}
}
@Nonnull
@Override
public Item getItemDropped(IBlockState state, Random rand, int fortune) {
return Blocks.DIRT.getItemDropped(state, rand, fortune);
@@ -174,7 +174,7 @@ public class BlockAltar extends BlockMod implements ILexiconable {
}
return true;
} else if(stack != null && stack.getItem() == Items.LAVA_BUCKET) {
} else if(!stack.isEmpty() && stack.getItem() == Items.LAVA_BUCKET) {
if(!player.capabilities.isCreativeMode)
drain(FluidRegistry.LAVA, stack);
@@ -184,7 +184,7 @@ public class BlockAltar extends BlockMod implements ILexiconable {
world.checkLight(pos);
return true;
} else if(stack != null && stack.getItem() == Items.BUCKET && (tile.hasWater || tile.hasLava) && !Botania.gardenOfGlassLoaded) {
} else if(!stack.isEmpty() && stack.getItem() == Items.BUCKET && (tile.hasWater || tile.hasLava) && !Botania.gardenOfGlassLoaded) {
ItemStack bucket = tile.hasLava ? new ItemStack(Items.LAVA_BUCKET) : new ItemStack(Items.WATER_BUCKET);
if(stack.getCount() == 1)
player.setHeldItem(hand, bucket);
@@ -37,6 +37,8 @@ import vazkii.botania.common.block.tile.TileAnimatedTorch;
import vazkii.botania.common.lexicon.LexiconData;
import vazkii.botania.common.lib.LibBlockNames;
import javax.annotation.Nonnull;
public class BlockAnimatedTorch extends BlockMod implements IWandable, IManaTrigger, IHourglassTrigger, IWandHUD, ILexiconable {
private static final AxisAlignedBB AABB = new AxisAlignedBB(0, 0, 0, 1, 0.25, 1);
@@ -102,6 +104,7 @@ public class BlockAnimatedTorch extends BlockMod implements IWandable, IManaTrig
return 0;
}
@Nonnull
@Override
public EnumBlockRenderType getRenderType(IBlockState state) {
return EnumBlockRenderType.ENTITYBLOCK_ANIMATED;
@@ -117,13 +120,14 @@ public class BlockAnimatedTorch extends BlockMod implements IWandable, IManaTrig
return false;
}
@Nonnull
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess world, BlockPos pos) {
return AABB;
}
@Override
public TileEntity createTileEntity(World world, IBlockState state) {
public TileEntity createTileEntity(@Nonnull World world, @Nonnull IBlockState state) {
return new TileAnimatedTorch();
}
@@ -93,13 +93,13 @@ public class BlockAvatar extends BlockMod implements ILexiconable {
TileAvatar avatar = (TileAvatar) world.getTileEntity(pos);
ItemStack stackOnAvatar = avatar.getItemHandler().getStackInSlot(0);
ItemStack stackOnPlayer = player.getHeldItem(hand);
if(stackOnAvatar != null) {
if(!stackOnAvatar.isEmpty()) {
ItemStack copyStack = stackOnAvatar.copy();
avatar.getItemHandler().setStackInSlot(0, ItemStack.EMPTY);
if(!player.inventory.addItemStackToInventory(copyStack))
player.dropItem(copyStack, true);
return true;
} else if(stackOnPlayer != null && stackOnPlayer.getItem() instanceof IAvatarWieldable) {
} else if(!stackOnPlayer.isEmpty() && stackOnPlayer.getItem() instanceof IAvatarWieldable) {
ItemStack copyStack = stackOnPlayer.copy();
avatar.getItemHandler().setStackInSlot(0, copyStack);
stackOnPlayer.shrink(1);
@@ -45,6 +45,7 @@ public class BlockEnchantedSoil extends BlockMod implements ILexiconable {
return false;
}
@Nonnull
@Override
public Item getItemDropped(IBlockState state, Random rand, int fortune) {
return Blocks.DIRT.getItemDropped(state, rand, fortune);
@@ -104,7 +104,7 @@ public class BlockFakeAir extends BlockMod {
}
@Override
public boolean canBeReplacedByLeaves(IBlockState state, IBlockAccess world, BlockPos pos) {
public boolean canBeReplacedByLeaves(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos) {
return true;
}
@@ -71,6 +71,7 @@ public class BlockGaiaHead extends BlockSkull implements IModelRegister {
return ret;
}
@Nonnull
@Override
public Item getItemDropped(IBlockState state, Random rand, int fortune) {
return ModItems.gaiaHead;
@@ -28,6 +28,7 @@ import net.minecraft.client.renderer.block.statemap.StateMap;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.EnumDyeColor;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@@ -88,9 +89,10 @@ public abstract class BlockModDoubleFlower extends BlockDoublePlant implements I
@Override
public abstract IBlockState getStateFromMeta(int meta);
@Nonnull
@Override
public Item getItemDropped(IBlockState state, @Nonnull Random rand, int fortune) {
return null;
return Items.AIR;
}
@Override
@@ -146,7 +146,7 @@ public class BlockPlatform extends BlockCamo implements ILexiconable, IWandable,
}
@Override
public float getExplosionResistance(World world, BlockPos pos, Entity exploder, Explosion explosion) {
public float getExplosionResistance(World world, BlockPos pos, @Nonnull Entity exploder, Explosion explosion) {
return world.getBlockState(pos).getValue(BotaniaStateProps.PLATFORM_VARIANT) != PlatformVariant.INFRANGIBLE ? super.getExplosionResistance(world, pos, exploder, explosion) : Float.MAX_VALUE;
}
@@ -43,6 +43,7 @@ public class BlockRoot extends BlockMod implements ILexiconable {
return new ItemStack(this);
}
@Nonnull
@Override
public Item getItemDropped(IBlockState state, Random rand, int fortune) {
return ModItems.manaResource;
@@ -67,6 +67,7 @@ public class BlockBuriedPetals extends BlockModFlower {
return false;
}
@Nonnull
@Override
public Item getItemDropped(IBlockState state, Random rand, int fortune) {
return ModItems.petal;
@@ -114,6 +114,7 @@ public class BlockSpecialQuartz extends BlockMod implements ILexiconable {
return getMetaFromState(state);
}
@Nonnull
@Override
public ItemStack getSilkTouchDrop(@Nonnull IBlockState state) {
return new ItemStack(this, 1, damageDropped(state));
@@ -86,11 +86,13 @@ public class BlockSpecialQuartzSlab extends BlockModSlab {
return new ItemStack(getSingleBlock());
}
@Nonnull
@Override
public Item getItemDropped(IBlockState state, Random rand, int fortune) {
return Item.getItemFromBlock(getSingleBlock());
}
@Nonnull
@Override
public ItemStack getSilkTouchDrop(@Nonnull IBlockState par1) {
return new ItemStack(getSingleBlock());
@@ -90,11 +90,13 @@ public abstract class BlockModSlab extends BlockSlab implements ILexiconable, IM
return new ItemStack(getSingleBlock());
}
@Nonnull
@Override
public Item getItemDropped(IBlockState state, Random rand, int fortune) {
return Item.getItemFromBlock(getSingleBlock());
}
@Nonnull
@Override
public ItemStack getSilkTouchDrop(@Nonnull IBlockState par1) {
return new ItemStack(getSingleBlock());
@@ -100,6 +100,7 @@ public class BlockEnchanter extends BlockMod implements IWandable, ILexiconable,
return new TileEnchanter();
}
@Nonnull
@Override
public Item getItemDropped(IBlockState state, Random rand, int fortune) {
return Item.getItemFromBlock(Blocks.LAPIS_BLOCK);
@@ -54,7 +54,7 @@ public class SubTileOrechid extends SubTileFunctional {
BlockPos coords = getCoordsToPut();
if(coords != null) {
ItemStack stack = getOreToPut();
if(stack != null && stack.getItem() != null) {
if(!stack.isEmpty()) {
Block block = Block.getBlockFromItem(stack.getItem());
int meta = stack.getItemDamage();
supertile.getWorld().setBlockState(coords, block.getStateFromMeta(meta), 1 | 2);
@@ -175,7 +175,7 @@ public class SubTileRannuncarpus extends SubTileFunctional {
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
if(recieverStack.getItem() != null) {
if(!recieverStack.isEmpty()) {
String stackName = recieverStack.getDisplayName();
int width = 16 + mc.fontRendererObj.getStringWidth(stackName) / 2;
int x = res.getScaledWidth() / 2 - width;
@@ -64,7 +64,7 @@ public class SubTileGourmaryllis extends SubTileGenerating {
continue;
}
if(stack != null && stack.getItem() instanceof ItemFood && !item.isDead && age >= slowdown) {
if(!stack.isEmpty() && stack.getItem() instanceof ItemFood && !item.isDead && age >= slowdown) {
if(cooldown <= 0) {
int val = Math.min(12, ((ItemFood) stack.getItem()).getHealAmount(stack));
storedMana = val * val * 64;
@@ -62,7 +62,7 @@ public class SubTileSpectrolus extends SubTileGenerating {
continue;
}
if(stack != null && stack.getItem() == wool && !item.isDead && age >= slowdown) {
if(!stack.isEmpty() && stack.getItem() == wool && !item.isDead && age >= slowdown) {
int meta = stack.getItemDamage();
if(meta == nextColor) {
if(!remote) {
@@ -116,7 +116,7 @@ public class SubTileSpectrolus extends SubTileGenerating {
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
if(stack != null && stack.getItem() != null) {
if(!stack.isEmpty()) {
String stackName = stack.getDisplayName();
int width = 16 + mc.fontRendererObj.getStringWidth(stackName) / 2;
int x = res.getScaledWidth() / 2 - width;
@@ -51,6 +51,8 @@ import vazkii.botania.client.core.handler.HUDHandler;
import vazkii.botania.client.core.helper.RenderHelper;
import vazkii.botania.common.Botania;
import javax.annotation.Nonnull;
public class TileAltar extends TileSimpleInventory implements IPetalApothecary {
private static final Pattern SEED_PATTERN = Pattern.compile("(?:(?:(?:[A-Z-_.:]|^)seed)|(?:(?:[a-z-_.:]|^)Seed))(?:[sA-Z-_.:]|$)");
@@ -69,7 +71,7 @@ public class TileAltar extends TileSimpleInventory implements IPetalApothecary {
public boolean collideEntityItem(EntityItem item) {
ItemStack stack = item.getEntityItem();
if(stack == null || item.isDead)
if(stack.isEmpty() || item.isDead)
return false;
if(!isMossy && world.getBlockState(getPos()).getValue(BotaniaStateProps.ALTAR_VARIANT) == AltarVariant.DEFAULT) {
@@ -139,7 +141,7 @@ public class TileAltar extends TileSimpleInventory implements IPetalApothecary {
break;
}
}
} else if(stack.getItem() != null && SEED_PATTERN.matcher(stack.getItem().getUnlocalizedName(stack)).find()) {
} else if(!stack.isEmpty() && SEED_PATTERN.matcher(stack.getItem().getUnlocalizedName(stack)).find()) {
for(RecipePetals recipe : BotaniaAPI.petalRecipes) {
if(recipe.matches(itemHandler)) {
saveLastRecipe();
@@ -237,7 +239,7 @@ public class TileAltar extends TileSimpleInventory implements IPetalApothecary {
public boolean isEmpty() {
for(int i = 0; i < getSizeInventory(); i++)
if(itemHandler.getStackInSlot(i) != null)
if(!itemHandler.getStackInSlot(i).isEmpty())
return false;
return true;
@@ -256,7 +258,7 @@ public class TileAltar extends TileSimpleInventory implements IPetalApothecary {
for(int i = 0; i < getSizeInventory(); i++) {
ItemStack stackAt = itemHandler.getStackInSlot(i);
if(stackAt == null)
if(stackAt.isEmpty())
break;
if(Math.random() >= 0.97) {
@@ -309,7 +311,7 @@ public class TileAltar extends TileSimpleInventory implements IPetalApothecary {
protected SimpleItemStackHandler createItemHandler() {
return new SimpleItemStackHandler(this, false) {
@Override
protected int getStackLimit(int slot, ItemStack stack) {
protected int getStackLimit(int slot, @Nonnull ItemStack stack) {
return 1;
}
};
@@ -344,7 +346,7 @@ public class TileAltar extends TileSimpleInventory implements IPetalApothecary {
int radius = 24;
int amt = 0;
for(int i = 0; i < getSizeInventory(); i++) {
if(itemHandler.getStackInSlot(i) == null)
if(itemHandler.getStackInSlot(i).isEmpty())
break;
amt++;
}
@@ -18,6 +18,8 @@ import vazkii.botania.api.item.IAvatarTile;
import vazkii.botania.api.item.IAvatarWieldable;
import vazkii.botania.api.state.BotaniaStateProps;
import javax.annotation.Nonnull;
public class TileAvatar extends TileSimpleInventory implements IAvatarTile {
private static final int MAX_MANA = 6400;
@@ -42,7 +44,7 @@ public class TileAvatar extends TileSimpleInventory implements IAvatarTile {
}
ItemStack stack = itemHandler.getStackInSlot(0);
if(stack != null && stack.getItem() instanceof IAvatarWieldable) {
if(!stack.isEmpty() && stack.getItem() instanceof IAvatarWieldable) {
IAvatarWieldable wieldable = (IAvatarWieldable) stack.getItem();
wieldable.onAvatarUpdate(this, stack);
}
@@ -76,7 +78,7 @@ public class TileAvatar extends TileSimpleInventory implements IAvatarTile {
protected SimpleItemStackHandler createItemHandler() {
return new SimpleItemStackHandler(this, false) {
@Override
protected int getStackLimit(int slot, ItemStack stack) {
protected int getStackLimit(int slot, @Nonnull ItemStack stack) {
return 1;
}
};
@@ -94,7 +96,7 @@ public class TileAvatar extends TileSimpleInventory implements IAvatarTile {
@Override
public boolean canRecieveManaFromBursts() {
return itemHandler.getStackInSlot(0) != null;
return !itemHandler.getStackInSlot(0).isEmpty();
}
@Override
@@ -48,7 +48,7 @@ public class TileBrewery extends TileSimpleInventory implements IManaReceiver {
public int signal = 0;
public boolean addItem(@Nullable EntityPlayer player, ItemStack stack, @Nullable EnumHand hand) {
if(recipe != null || stack == null || stack.getItem() instanceof IBrewItem && ((IBrewItem) stack.getItem()).getBrew(stack) != null && ((IBrewItem) stack.getItem()).getBrew(stack) != BotaniaAPI.fallbackBrew || itemHandler.getStackInSlot(0) == null != stack.getItem() instanceof IBrewContainer)
if(recipe != null || stack == null || stack.getItem() instanceof IBrewItem && ((IBrewItem) stack.getItem()).getBrew(stack) != null && ((IBrewItem) stack.getItem()).getBrew(stack) != BotaniaAPI.fallbackBrew || itemHandler.getStackInSlot(0).isEmpty() != stack.getItem() instanceof IBrewContainer)
return false;
boolean did = false;
@@ -205,7 +205,7 @@ public class TileBrewery extends TileSimpleInventory implements IManaReceiver {
protected SimpleItemStackHandler createItemHandler() {
return new SimpleItemStackHandler(this, false) {
@Override
protected int getStackLimit(int slot, ItemStack stack) {
protected int getStackLimit(int slot, @Nonnull ItemStack stack) {
return 1;
}
};
@@ -83,12 +83,13 @@ public class TileCraftCrate extends TileOpenCrate {
protected SimpleItemStackHandler createItemHandler() {
return new SimpleItemStackHandler(this, true) {
@Override
protected int getStackLimit(int slot, ItemStack stack) {
protected int getStackLimit(int slot, @Nonnull ItemStack stack) {
return 1;
}
@Nonnull
@Override
public ItemStack insertItem(int slot, ItemStack stack, boolean simulate) {
public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) {
if(slot != 9 && !isLocked(slot))
return super.insertItem(slot, stack, simulate);
else return stack;
@@ -110,7 +111,7 @@ public class TileCraftCrate extends TileOpenCrate {
int newSignal = 0;
for(; newSignal < 9; newSignal++) // dis for loop be derpy
if(!isLocked(newSignal) && itemHandler.getStackInSlot(newSignal) == null)
if(!isLocked(newSignal) && itemHandler.getStackInSlot(newSignal).isEmpty())
break;
if(newSignal != signal) {
@@ -132,7 +133,7 @@ public class TileCraftCrate extends TileOpenCrate {
for(int i = 0; i < 9; i++) {
ItemStack stack = itemHandler.getStackInSlot(i);
if(stack == null || isLocked(i) || stack.getItem() == ModItems.manaResource && stack.getItemDamage() == 11)
if(stack.isEmpty() || isLocked(i) || stack.getItem() == ModItems.manaResource && stack.getItemDamage() == 11)
continue;
craft.setInventorySlotContents(i, stack.copy());
@@ -145,7 +146,7 @@ public class TileCraftCrate extends TileOpenCrate {
for(int i = 0; i < 9; i++) {
ItemStack stack = itemHandler.getStackInSlot(i);
if(stack == null)
if(stack.isEmpty())
continue;
ItemStack container = stack.getItem().getContainerItem(stack);
@@ -159,7 +160,7 @@ public class TileCraftCrate extends TileOpenCrate {
boolean isFull() {
for(int i = 0; i < 9; i++)
if(!isLocked(i) && itemHandler.getStackInSlot(i) == null)
if(!isLocked(i) && itemHandler.getStackInSlot(i).isEmpty())
return false;
return true;
@@ -168,9 +169,9 @@ public class TileCraftCrate extends TileOpenCrate {
private void ejectAll() {
for(int i = 0; i < getSizeInventory(); ++i) {
ItemStack stack = itemHandler.getStackInSlot(i);
if(stack != null)
if(!stack.isEmpty())
eject(stack, false);
itemHandler.setStackInSlot(i, null);
itemHandler.setStackInSlot(i, ItemStack.EMPTY);
}
markDirty();
}
@@ -38,7 +38,7 @@ public class TileEnderEye extends TileMod {
boolean looking = false;
for(EntityPlayer player : players) {
ItemStack helm = player.getItemStackFromSlot(EntityEquipmentSlot.HEAD);
if(helm != null && helm.getItem() == Item.getItemFromBlock(Blocks.PUMPKIN))
if(!helm.isEmpty() && helm.getItem() == Item.getItemFromBlock(Blocks.PUMPKIN))
continue;
RayTraceResult pos = ToolCommons.raytraceFromEntity(world, player, true, 64);
@@ -30,6 +30,8 @@ import vazkii.botania.api.item.IHourglassTrigger;
import vazkii.botania.api.state.BotaniaStateProps;
import vazkii.botania.common.item.ModItems;
import javax.annotation.Nonnull;
public class TileHourglass extends TileSimpleInventory {
private static final String TAG_TIME = "time";
@@ -52,7 +54,7 @@ public class TileHourglass extends TileSimpleInventory {
public void update() {
int totalTime = getTotalTime();
ItemStack dustStack = itemHandler.getStackInSlot(0);
dust = dustStack != null && dustStack.getItem() == ModItems.manaResource;
dust = !dustStack.isEmpty() && dustStack.getItem() == ModItems.manaResource;
if(totalTime > 0 || dust) {
if(move && !dust)
@@ -134,9 +136,10 @@ public class TileHourglass extends TileSimpleInventory {
@Override
protected SimpleItemStackHandler createItemHandler() {
return new SimpleItemStackHandler(this, true) {
@Nonnull
@Override
public ItemStack insertItem(int slot, ItemStack stack, boolean simulate) {
if(stack != null && (stack.getItem() == Item.getItemFromBlock(Blocks.SAND) || stack.getItem() == Item.getItemFromBlock(Blocks.SOUL_SAND)) || stack.getItem() == ModItems.manaResource && stack.getItemDamage() == 23)
public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) {
if(!stack.isEmpty() && (stack.getItem() == Item.getItemFromBlock(Blocks.SAND) || stack.getItem() == Item.getItemFromBlock(Blocks.SOUL_SAND)) || stack.getItem() == ModItems.manaResource && stack.getItemDamage() == 23)
return super.insertItem(slot, stack, simulate);
else return stack;
}
@@ -185,7 +188,7 @@ public class TileHourglass extends TileSimpleInventory {
int y = res.getScaledHeight() / 2 - 10;
ItemStack stack = itemHandler.getStackInSlot(0);
if(stack != null) {
if(!stack.isEmpty()) {
RenderHelper.enableGUIStandardItemLighting();
GlStateManager.enableRescaleNormal();
mc.getRenderItem().renderItemIntoGUI(stack, x, y);
@@ -28,6 +28,8 @@ import vazkii.botania.common.Botania;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.item.brew.ItemIncenseStick;
import javax.annotation.Nonnull;
public class TileIncensePlate extends TileSimpleInventory {
private static final String TAG_TIME_LEFT = "timeLeft";
@@ -42,7 +44,7 @@ public class TileIncensePlate extends TileSimpleInventory {
@Override
public void update() {
ItemStack stack = itemHandler.getStackInSlot(0);
if(stack != null && burning) {
if(!stack.isEmpty() && burning) {
Brew brew = ((ItemIncenseStick) ModItems.incenseStick).getBrew(stack);
PotionEffect effect = brew.getPotionEffects(stack).get(0);
if(timeLeft > 0) {
@@ -72,14 +74,14 @@ public class TileIncensePlate extends TileSimpleInventory {
Botania.proxy.wispFX(x - (Math.random() - 0.5) * 0.2, y - (Math.random() - 0.5) * 0.2, z - (Math.random() - 0.5) * 0.2, 0.2F, 0.2F, 0.2F, 0.05F + (float) Math.random() * 0.02F, 0.005F - (float) Math.random() * 0.01F, 0.01F + (float) Math.random() * 0.001F, 0.005F - (float) Math.random() * 0.01F);
}
} else {
itemHandler.setStackInSlot(0, null);
itemHandler.setStackInSlot(0, ItemStack.EMPTY);
burning = false;
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(this);
}
} else timeLeft = 0;
int newComparator = 0;
if(stack != null)
if(!stack.isEmpty())
newComparator = 1;
if(burning)
newComparator = 2;
@@ -91,7 +93,7 @@ public class TileIncensePlate extends TileSimpleInventory {
public void ignite() {
ItemStack stack = itemHandler.getStackInSlot(0);
if(stack == null || burning)
if(stack.isEmpty() || burning)
return;
burning = true;
@@ -125,16 +127,18 @@ public class TileIncensePlate extends TileSimpleInventory {
@Override
protected SimpleItemStackHandler createItemHandler() {
return new SimpleItemStackHandler(this, true) {
@Nonnull
@Override
public ItemStack insertItem(int slot, ItemStack stack, boolean simulate) {
public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) {
if(acceptsItem(stack))
return super.insertItem(slot, stack, simulate);
else return stack;
}
@Nonnull
@Override
public ItemStack extractItem(int slot, int amount, boolean simulate) {
return null;
return ItemStack.EMPTY;
}
};
}
@@ -56,7 +56,7 @@ public class TileOpenCrate extends TileSimpleInventory {
if(canEject()) {
ItemStack stack = itemHandler.getStackInSlot(0);
if(stack != null)
if(!stack.isEmpty())
eject(stack, redstone);
}
}
@@ -80,7 +80,7 @@ public class TileOpenCrate extends TileSimpleInventory {
}
itemHandler.setStackInSlot(0, null);
itemHandler.setStackInSlot(0, ItemStack.EMPTY);
world.spawnEntity(item);
}
@@ -83,7 +83,7 @@ public class TileRuneAltar extends TileSimpleInventory implements IManaReceiver
boolean did = false;
for(int i = 0; i < getSizeInventory(); i++)
if(itemHandler.getStackInSlot(i) == null) {
if(itemHandler.getStackInSlot(i).isEmpty()) {
did = true;
ItemStack stackToAdd = stack.copy();
stackToAdd.setCount(1);
@@ -92,7 +92,7 @@ public class TileRuneAltar extends TileSimpleInventory implements IManaReceiver
if(player == null || !player.capabilities.isCreativeMode) {
stack.shrink(1);
if(stack.isEmpty() && player != null)
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
player.inventory.setInventorySlotContents(player.inventory.currentItem, ItemStack.EMPTY);
}
break;
@@ -113,7 +113,7 @@ public class TileRuneAltar extends TileSimpleInventory implements IManaReceiver
if(!world.isRemote && manaToGet == 0) {
List<EntityItem> items = world.getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(pos, pos.add(1, 1, 1)));
for(EntityItem item : items)
if(!item.isDead && item.getEntityItem() != null && item.getEntityItem().getItem() != Item.getItemFromBlock(ModBlocks.livingrock)) {
if(!item.isDead && !item.getEntityItem().isEmpty() && item.getEntityItem().getItem() != Item.getItemFromBlock(ModBlocks.livingrock)) {
ItemStack stack = item.getEntityItem();
if(addItem(null, stack, null) && stack.isEmpty())
item.setDead();
@@ -179,7 +179,7 @@ public class TileRuneAltar extends TileSimpleInventory implements IManaReceiver
lastRecipe = new ArrayList<>();
for(int i = 0; i < getSizeInventory(); i++) {
ItemStack stack = itemHandler.getStackInSlot(i);
if(stack == null)
if(stack.isEmpty())
break;
lastRecipe.add(stack.copy());
}
@@ -216,7 +216,7 @@ public class TileRuneAltar extends TileSimpleInventory implements IManaReceiver
List<EntityItem> items = world.getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(pos, pos.add(1, 1, 1)));
EntityItem livingrock = null;
for(EntityItem item : items)
if(!item.isDead && item.getEntityItem() != null && item.getEntityItem().getItem() == Item.getItemFromBlock(ModBlocks.livingrock)) {
if(!item.isDead && !item.getEntityItem().isEmpty() && item.getEntityItem().getItem() == Item.getItemFromBlock(ModBlocks.livingrock)) {
livingrock = item;
break;
}
@@ -236,13 +236,13 @@ public class TileRuneAltar extends TileSimpleInventory implements IManaReceiver
if(!world.isRemote) {
for(int i = 0; i < getSizeInventory(); i++) {
ItemStack stack = itemHandler.getStackInSlot(i);
if(stack != null) {
if(!stack.isEmpty()) {
if(stack.getItem() == ModItems.rune && (player == null || !player.capabilities.isCreativeMode)) {
EntityItem outputItem = new EntityItem(world, getPos().getX() + 0.5, getPos().getY() + 1.5, getPos().getZ() + 0.5, stack.copy());
world.spawnEntity(outputItem);
}
itemHandler.setStackInSlot(i, null);
itemHandler.setStackInSlot(i, ItemStack.EMPTY);
}
}
@@ -269,7 +269,7 @@ public class TileRuneAltar extends TileSimpleInventory implements IManaReceiver
public boolean isEmpty() {
for(int i = 0; i < getSizeInventory(); i++)
if(itemHandler.getStackInSlot(i) != null)
if(!itemHandler.getStackInSlot(i).isEmpty())
return false;
return true;
@@ -306,7 +306,7 @@ public class TileRuneAltar extends TileSimpleInventory implements IManaReceiver
protected SimpleItemStackHandler createItemHandler() {
return new SimpleItemStackHandler(this, false) {
@Override
protected int getStackLimit(int slot, ItemStack stack) {
protected int getStackLimit(int slot, @Nonnull ItemStack stack) {
return 1;
}
};
@@ -340,7 +340,7 @@ public class TileRuneAltar extends TileSimpleInventory implements IManaReceiver
int radius = 24;
int amt = 0;
for(int i = 0; i < getSizeInventory(); i++) {
if(itemHandler.getStackInSlot(i) == null)
if(itemHandler.getStackInSlot(i).isEmpty())
break;
amt++;
}
@@ -46,13 +46,12 @@ public abstract class TileSimpleInventory extends TileMod {
}
@Override
public boolean hasCapability(@Nonnull Capability<?> cap, @Nonnull EnumFacing side) {
public boolean hasCapability(@Nonnull Capability<?> cap, EnumFacing side) {
return cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY || super.hasCapability(cap, side);
}
@Nonnull
@Override
public <T> T getCapability(@Nonnull Capability<T> cap, @Nonnull EnumFacing side) {
public <T> T getCapability(@Nonnull Capability<T> cap, EnumFacing side) {
if(cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY)
return CapabilityItemHandler.ITEM_HANDLER_CAPABILITY.cast(itemHandler);
return super.getCapability(cap, side);
@@ -71,18 +70,20 @@ public abstract class TileSimpleInventory extends TileMod {
tile = inv;
}
@Nonnull
@Override
public ItemStack insertItem(int slot, ItemStack stack, boolean simulate) {
public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) {
if(allowWrite) {
return super.insertItem(slot, stack, simulate);
} else return stack;
}
@Nonnull
@Override
public ItemStack extractItem(int slot, int amount, boolean simulate) {
if(allowWrite) {
return super.extractItem(slot, amount, simulate);
} else return null;
} else return ItemStack.EMPTY;
}
@Override
@@ -23,6 +23,8 @@ import vazkii.botania.api.mana.spark.ISparkEntity;
import vazkii.botania.api.mana.spark.SparkUpgradeType;
import vazkii.botania.common.item.ModItems;
import javax.annotation.Nonnull;
public class TileSparkChanger extends TileSimpleInventory {
public void doSwap() {
@@ -38,7 +40,7 @@ public class TileSparkChanger extends TileSimpleInventory {
ISparkEntity spark = attach.getAttachedSpark();
if(spark != null) {
SparkUpgradeType upg = spark.getUpgrade();
SparkUpgradeType newUpg = changeStack == null ? SparkUpgradeType.NONE : SparkUpgradeType.values()[changeStack.getItemDamage() + 1];
SparkUpgradeType newUpg = changeStack.isEmpty() ? SparkUpgradeType.NONE : SparkUpgradeType.values()[changeStack.getItemDamage() + 1];
if(upg != newUpg)
attachables.add(attach);
}
@@ -49,8 +51,8 @@ public class TileSparkChanger extends TileSimpleInventory {
ISparkAttachable attach = attachables.get(world.rand.nextInt(attachables.size()));
ISparkEntity spark = attach.getAttachedSpark();
SparkUpgradeType upg = spark.getUpgrade();
ItemStack sparkStack = upg == SparkUpgradeType.NONE ? null : new ItemStack(ModItems.sparkUpgrade, 1, upg.ordinal() - 1);
SparkUpgradeType newUpg = changeStack == null ? SparkUpgradeType.NONE : SparkUpgradeType.values()[changeStack.getItemDamage() + 1];
ItemStack sparkStack = upg == SparkUpgradeType.NONE ? ItemStack.EMPTY : new ItemStack(ModItems.sparkUpgrade, 1, upg.ordinal() - 1);
SparkUpgradeType newUpg = changeStack.isEmpty() ? SparkUpgradeType.NONE : SparkUpgradeType.values()[changeStack.getItemDamage() + 1];
spark.setUpgrade(newUpg);
Collection transfers = spark.getTransfers();
if(transfers != null)
@@ -70,13 +72,14 @@ public class TileSparkChanger extends TileSimpleInventory {
protected SimpleItemStackHandler createItemHandler() {
return new SimpleItemStackHandler(this, true) {
@Override
protected int getStackLimit(int slot, ItemStack stack) {
protected int getStackLimit(int slot, @Nonnull ItemStack stack) {
return 1;
}
@Nonnull
@Override
public ItemStack insertItem(int slot, ItemStack stack, boolean simulate) {
if(stack != null && stack.getItem() == ModItems.sparkUpgrade)
public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) {
if(!stack.isEmpty() && stack.getItem() == ModItems.sparkUpgrade)
return super.insertItem(slot, stack, simulate);
else return stack;
}
@@ -173,13 +173,12 @@ public class TileCorporeaCrystalCube extends TileCorporeaBase implements ICorpor
}
@Override
public boolean hasCapability(@Nonnull Capability<?> cap, @Nonnull EnumFacing side) {
public boolean hasCapability(@Nonnull Capability<?> cap, EnumFacing side) {
return cap == CapabilityAnimation.ANIMATION_CAPABILITY || super.hasCapability(cap, side);
}
@Nonnull
@Override
public <T> T getCapability(@Nonnull Capability<T> cap, @Nonnull EnumFacing side) {
public <T> T getCapability(@Nonnull Capability<T> cap, EnumFacing side) {
if(cap == CapabilityAnimation.ANIMATION_CAPABILITY) {
return CapabilityAnimation.ANIMATION_CAPABILITY.cast(asm);
} else return super.getCapability(cap, side);
@@ -54,7 +54,7 @@ public class TileCorporeaFunnel extends TileCorporeaBase implements ICorporeaReq
EnumFacing orientation = frame.facingDirection;
if(orientation == dir) {
ItemStack stack = frame.getDisplayedItem();
if(stack != null) {
if(!stack.isEmpty()) {
ItemStack copy = stack.copy();
copy.setCount(rotationToStackSize[frame.getRotation()]);
filter.add(copy);
@@ -86,7 +86,7 @@ public class TileCorporeaFunnel extends TileCorporeaBase implements ICorporeaReq
List<ItemStack> stacks = CorporeaHelper.requestItem(request, count, spark, true, true);
spark.onItemsRequested(stacks);
for(ItemStack reqStack : stacks) {
if(inv != null && ItemHandlerHelper.insertItemStacked(inv, reqStack, true) == null)
if(inv != null && ItemHandlerHelper.insertItemStacked(inv, reqStack, true).isEmpty())
ItemHandlerHelper.insertItemStacked(inv, reqStack, false);
else {
EntityItem item = new EntityItem(world, pos.getX() + 0.5, pos.getY() + 1.5, pos.getZ() + 0.5, reqStack);
@@ -260,7 +260,7 @@ public class TileCorporeaIndex extends TileCorporeaBase implements ICorporeaRequ
if(name.equals("this")) {
ItemStack stack = event.getPlayer().getHeldItemMainhand();
if(stack != null)
if(!stack.isEmpty())
name = stack.getDisplayName().toLowerCase().trim();
}
@@ -66,12 +66,12 @@ public class TileCorporeaInterceptor extends TileCorporeaBase implements ICorpor
}
public boolean requestMatches(Object request, ItemStack filter) {
if(filter == null)
if(filter.isEmpty())
return false;
if(request instanceof ItemStack) {
ItemStack stack = (ItemStack) request;
return stack != null && stack.isItemEqual(filter) && ItemStack.areItemStackTagsEqual(filter, stack);
return !stack.isEmpty() && stack.isItemEqual(filter) && ItemStack.areItemStackTagsEqual(filter, stack);
}
String name = (String) request;
@@ -249,7 +249,7 @@ public class TilePool extends TileMod implements IManaPool, IKeyLocked, ISparkAt
continue;
ItemStack stack = item.getEntityItem();
if(stack != null && stack.getItem() instanceof IManaItem) {
if(!stack.isEmpty() && stack.getItem() instanceof IManaItem) {
IManaItem mana = (IManaItem) stack.getItem();
if(outputting && mana.canReceiveManaFromPool(stack, this) || !outputting && mana.canExportManaToPool(stack, this)) {
boolean didSomething = false;
@@ -20,15 +20,17 @@ import vazkii.botania.api.mana.ITinyPlanetExcempt;
import vazkii.botania.api.state.BotaniaStateProps;
import vazkii.botania.common.block.tile.TileSimpleInventory;
import javax.annotation.Nonnull;
public class TilePrism extends TileSimpleInventory {
public void onBurstCollision(IManaBurst burst) {
ItemStack lens = itemHandler.getStackInSlot(0);
boolean active = !world.getBlockState(getPos()).getValue(BotaniaStateProps.POWERED);
boolean valid = lens != null && lens.getItem() instanceof ILens && (!(lens.getItem() instanceof ITinyPlanetExcempt) || ((ITinyPlanetExcempt) lens.getItem()).shouldPull(lens));
boolean valid = !lens.isEmpty() && lens.getItem() instanceof ILens && (!(lens.getItem() instanceof ITinyPlanetExcempt) || ((ITinyPlanetExcempt) lens.getItem()).shouldPull(lens));
if(active) {
burst.setSourceLens(valid ? lens.copy() : null);
burst.setSourceLens(valid ? lens.copy() : ItemStack.EMPTY);
burst.setColor(0xFFFFFF);
burst.setGravity(0F);
@@ -56,9 +58,10 @@ public class TilePrism extends TileSimpleInventory {
@Override
protected SimpleItemStackHandler createItemHandler() {
return new SimpleItemStackHandler(this, true) {
@Nonnull
@Override
public ItemStack insertItem(int slot, ItemStack stack, boolean simulate) {
if(stack != null && stack.getItem() instanceof ILens)
public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) {
if(!stack.isEmpty() && stack.getItem() instanceof ILens)
return super.insertItem(slot, stack, simulate);
else return stack;
}
@@ -56,13 +56,12 @@ public class TilePump extends TileMod {
}
@Override
public boolean hasCapability(@Nonnull Capability<?> cap, @Nonnull EnumFacing side) {
public boolean hasCapability(@Nonnull Capability<?> cap, EnumFacing side) {
return cap == CapabilityAnimation.ANIMATION_CAPABILITY || super.hasCapability(cap, side);
}
@Nonnull
@Override
public <T> T getCapability(@Nonnull Capability<T> cap, @Nonnull EnumFacing side) {
public <T> T getCapability(@Nonnull Capability<T> cap, EnumFacing side) {
if (cap == CapabilityAnimation.ANIMATION_CAPABILITY) {
return CapabilityAnimation.ANIMATION_CAPABILITY.cast(asm);
}
@@ -510,7 +510,7 @@ public class TileSpreader extends TileSimpleInventory implements IManaCollector,
BurstProperties props = new BurstProperties(maxMana, ticksBeforeManaLoss, manaLossPerTick, gravity, motionModifier, color);
ItemStack lens = itemHandler.getStackInSlot(0);
if(lens != null && lens.getItem() instanceof ILensEffect)
if(!lens.isEmpty() && lens.getItem() instanceof ILensEffect)
((ILensEffect) lens.getItem()).apply(lens, props);
burst.setSourceLens(lens);
@@ -578,7 +578,7 @@ public class TileSpreader extends TileSimpleInventory implements IManaCollector,
HUDHandler.drawSimpleManaHUD(color, knownMana, getMaxMana(), name, res);
ItemStack lens = itemHandler.getStackInSlot(0);
if(lens != null) {
if(!lens.isEmpty()) {
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
String lensName = lens.getDisplayName();
@@ -599,7 +599,7 @@ public class TileSpreader extends TileSimpleInventory implements IManaCollector,
ItemStack recieverStack = new ItemStack(world.getBlockState(receiverTile.getPos()).getBlock(), 1, receiverTile.getBlockMetadata());
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
if(recieverStack != null && recieverStack.getItem() != null) {
if(!recieverStack.isEmpty()) {
String stackName = recieverStack.getDisplayName();
int width = 16 + mc.fontRendererObj.getStringWidth(stackName) / 2;
int x = res.getScaledWidth() / 2 - width;
@@ -640,13 +640,14 @@ public class TileSpreader extends TileSimpleInventory implements IManaCollector,
protected SimpleItemStackHandler createItemHandler() {
return new SimpleItemStackHandler(this, true) {
@Override
protected int getStackLimit(int slot, ItemStack stack) {
protected int getStackLimit(int slot, @Nonnull ItemStack stack) {
return 1;
}
@Nonnull
@Override
public ItemStack insertItem(int slot, ItemStack stack, boolean simulate) {
if(stack != null && stack.getItem() instanceof ILens)
public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) {
if(!stack.isEmpty() && stack.getItem() instanceof ILens)
return super.insertItem(slot, stack, simulate);
else return stack;
}
@@ -31,7 +31,7 @@ public class TileRedStringContainer extends TileRedString {
}
@Override
public boolean hasCapability(@Nonnull Capability<?> cap, @Nonnull EnumFacing side) {
public boolean hasCapability(@Nonnull Capability<?> cap, EnumFacing side) {
if(cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY
&& getTileAtBinding() != null
&& getTileAtBinding().hasCapability(cap, side))
@@ -39,9 +39,8 @@ public class TileRedStringContainer extends TileRedString {
return super.hasCapability(cap, side);
}
@Nonnull
@Override
public <T> T getCapability(@Nonnull Capability<T> cap, @Nonnull EnumFacing side) {
public <T> T getCapability(@Nonnull Capability<T> cap, EnumFacing side) {
if(cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY
&& getTileAtBinding() != null
&& getTileAtBinding().hasCapability(cap, side))
@@ -60,7 +60,7 @@ public class InventoryHelper {
for(int j1 = 0; j1 < inv.getSizeInventory(); ++j1) {
ItemStack itemstack = inv.getItemHandler().getStackInSlot(j1);
if(itemstack != null) {
if(!itemstack.isEmpty()) {
net.minecraft.inventory.InventoryHelper.spawnItemStack(world, pos.getX(), pos.getY(), pos.getZ(), itemstack);
}
}
@@ -72,10 +72,10 @@ public class InventoryHelper {
public static void withdrawFromInventory(TileSimpleInventory inv, EntityPlayer player) {
for(int i = inv.getSizeInventory() - 1; i >= 0; i--) {
ItemStack stackAt = inv.getItemHandler().getStackInSlot(i);
if(stackAt != null) {
if(!stackAt.isEmpty()) {
ItemStack copy = stackAt.copy();
ItemHandlerHelper.giveItemToPlayer(player, copy);
inv.getItemHandler().setStackInSlot(i, null);
inv.getItemHandler().setStackInSlot(i, ItemStack.EMPTY);
player.world.updateComparatorOutputLevel(inv.getPos(), null);
break;
}
@@ -101,7 +101,7 @@ public final class ItemNBTHelper {
// GETTERS ///////////////////////////////////////////////////////////////////
public static boolean verifyExistance(ItemStack stack, String tag) {
return stack != null && getNBT(stack).hasKey(tag);
return !stack.isEmpty() && getNBT(stack).hasKey(tag);
}
public static boolean getBoolean(ItemStack stack, String tag, boolean defaultExpected) {
@@ -33,7 +33,7 @@ public class AesirRingRecipe implements IRecipe {
for(int i = 0; i < var1.getSizeInventory(); i++) {
ItemStack stack = var1.getStackInSlot(i);
if(stack != null) {
if(!stack.isEmpty()) {
if(stack.getItem() == ModItems.thorRing && !foundThorRing)
foundThorRing = true;
else if(stack.getItem() == ModItems.odinRing && !foundOdinRing)
@@ -47,6 +47,7 @@ public class AesirRingRecipe implements IRecipe {
return foundThorRing && foundOdinRing && foundLokiRing;
}
@Nonnull
@Override
public ItemStack getCraftingResult(@Nonnull InventoryCrafting var1) {
String soulbind = null;
@@ -55,7 +56,7 @@ public class AesirRingRecipe implements IRecipe {
for(int i = 0; i < var1.getSizeInventory(); i++) {
ItemStack stack = var1.getStackInSlot(i);
if(stack != null) {
if(!stack.isEmpty()) {
if(stack.getItem() instanceof IRelic) {
if(((IRelic) stack.getItem()).hasUUID(stack)) {
hasUUID = true;
@@ -63,16 +64,16 @@ public class AesirRingRecipe implements IRecipe {
if(soulbindUUID == null)
soulbindUUID = bindUUID;
else if(!soulbindUUID.equals(bindUUID))
return null;
return ItemStack.EMPTY;
}
else {
String bind = ((IRelic) stack.getItem()).getSoulbindUsername(stack);
if(soulbind == null)
soulbind = bind;
else if(!soulbind.equals(bind))
return null;
return ItemStack.EMPTY;
}
} else return null;
} else return ItemStack.EMPTY;
}
}
@@ -89,9 +90,10 @@ public class AesirRingRecipe implements IRecipe {
return 10;
}
@Nonnull
@Override
public ItemStack getRecipeOutput() {
return null;
return ItemStack.EMPTY;
}
@Nonnull
@@ -30,7 +30,7 @@ public class AncientWillRecipe implements IRecipe {
for(int i = 0; i < var1.getSizeInventory(); i++) {
ItemStack stack = var1.getStackInSlot(i);
if(stack != null) {
if(!stack.isEmpty()) {
if(stack.getItem() == ModItems.ancientWill && !foundWill)
foundWill = true;
else if(!foundItem) {
@@ -44,14 +44,15 @@ public class AncientWillRecipe implements IRecipe {
return foundWill && foundItem;
}
@Nonnull
@Override
public ItemStack getCraftingResult(@Nonnull InventoryCrafting var1) {
ItemStack item = null;
ItemStack item = ItemStack.EMPTY;
int will = -1;
for(int i = 0; i < var1.getSizeInventory(); i++) {
ItemStack stack = var1.getStackInSlot(i);
if(stack != null) {
if(!stack.isEmpty()) {
if(stack.getItem() instanceof IAncientWillContainer && item == null)
item = stack;
else will = stack.getItemDamage();
@@ -60,7 +61,7 @@ public class AncientWillRecipe implements IRecipe {
IAncientWillContainer container = (IAncientWillContainer) item.getItem();
if(container.hasAncientWill(item, will))
return null;
return ItemStack.EMPTY;
ItemStack copy = item.copy();
container.addAncientWill(copy, will);
@@ -72,9 +73,10 @@ public class AncientWillRecipe implements IRecipe {
return 10;
}
@Nonnull
@Override
public ItemStack getRecipeOutput() {
return null;
return ItemStack.EMPTY;
}
@Nonnull
@@ -28,7 +28,7 @@ public class ArmorUpgradeRecipe extends ShapedOreRecipe {
ItemStack out = output.copy();
for (int i = 0; i < var1.getSizeInventory(); i++) {
ItemStack stack = var1.getStackInSlot(i);
if (stack != null && stack.getItem() instanceof ItemArmor && stack.hasTagCompound()) {
if (!stack.isEmpty() && stack.getItem() instanceof ItemArmor && stack.hasTagCompound()) {
EnchantmentHelper.setEnchantments(EnchantmentHelper.getEnchantments(stack), out);
byte runicHardening = ItemNBTHelper.getByte(stack, "RS.HARDEN", (byte)0);
if (runicHardening != 0)
@@ -30,7 +30,7 @@ public class BlackHoleTalismanExtractRecipe implements IRecipe {
for(int i = 0; i < var1.getSizeInventory(); i++) {
ItemStack stack = var1.getStackInSlot(i);
if(stack != null) {
if(!stack.isEmpty()) {
if(stack.getItem() == ModItems.blackHoleTalisman && !foundTalisman)
foundTalisman = true;
else return false;
@@ -40,13 +40,14 @@ public class BlackHoleTalismanExtractRecipe implements IRecipe {
return foundTalisman;
}
@Nonnull
@Override
public ItemStack getCraftingResult(@Nonnull InventoryCrafting var1) {
ItemStack talisman = null;
ItemStack talisman = ItemStack.EMPTY;
for(int i = 0; i < var1.getSizeInventory(); i++) {
ItemStack stack = var1.getStackInSlot(i);
if(stack != null)
if(!stack.isEmpty())
talisman = stack;
}
@@ -57,7 +58,7 @@ public class BlackHoleTalismanExtractRecipe implements IRecipe {
return new ItemStack(block, Math.min(64, count), meta);
}
return null;
return ItemStack.EMPTY;
}
@Override
@@ -65,9 +66,10 @@ public class BlackHoleTalismanExtractRecipe implements IRecipe {
return 10;
}
@Nonnull
@Override
public ItemStack getRecipeOutput() {
return null;
return ItemStack.EMPTY;
}
@Nonnull
@@ -33,7 +33,7 @@ public class CompositeLensRecipe implements IRecipe {
for(int i = 0; i < var1.getSizeInventory(); i++) {
ItemStack stack = var1.getStackInSlot(i);
if(stack != null) {
if(!stack.isEmpty()) {
if(stack.getItem() instanceof ICompositableLens && !foundSecondLens) {
if(foundLens)
foundSecondLens = true;
@@ -47,16 +47,17 @@ public class CompositeLensRecipe implements IRecipe {
return foundSecondLens && foundSlimeball;
}
@Nonnull
@Override
public ItemStack getCraftingResult(@Nonnull InventoryCrafting var1) {
ItemStack lens = null;
ItemStack secondLens = null;
ItemStack lens = ItemStack.EMPTY;
ItemStack secondLens = ItemStack.EMPTY;
for(int i = 0; i < var1.getSizeInventory(); i++) {
ItemStack stack = var1.getStackInSlot(i);
if(stack != null) {
if(!stack.isEmpty()) {
if(stack.getItem() instanceof ICompositableLens)
if(lens == null)
if(lens.isEmpty())
lens = stack;
else secondLens = stack;
}
@@ -64,8 +65,8 @@ public class CompositeLensRecipe implements IRecipe {
if(lens.getItem() instanceof ICompositableLens) {
ICompositableLens lensItem = (ICompositableLens) lens.getItem();
if(secondLens == null || !lensItem.canCombineLenses(lens, secondLens) || lensItem.getCompositeLens(lens) != null || lensItem.getCompositeLens(secondLens) != null)
return null;
if(secondLens.isEmpty() || !lensItem.canCombineLenses(lens, secondLens) || lensItem.getCompositeLens(lens) != null || lensItem.getCompositeLens(secondLens) != null)
return ItemStack.EMPTY;
ItemStack lensCopy = lens.copy();
((ItemLens) ModItems.lens).setCompositeLens(lensCopy, secondLens);
@@ -73,7 +74,7 @@ public class CompositeLensRecipe implements IRecipe {
return lensCopy;
}
return null;
return ItemStack.EMPTY;
}
@Override
@@ -81,9 +82,10 @@ public class CompositeLensRecipe implements IRecipe {
return 10;
}
@Nonnull
@Override
public ItemStack getRecipeOutput() {
return null;
return ItemStack.EMPTY;
}
@Nonnull
@@ -30,7 +30,7 @@ public class CosmeticAttachRecipe implements IRecipe {
for(int i = 0; i < var1.getSizeInventory(); i++) {
ItemStack stack = var1.getStackInSlot(i);
if(stack != null) {
if(!stack.isEmpty()) {
if(stack.getItem() instanceof ICosmeticBauble && !foundCosmetic)
foundCosmetic = true;
else if(!foundAttachable) {
@@ -44,14 +44,15 @@ public class CosmeticAttachRecipe implements IRecipe {
return foundCosmetic && foundAttachable;
}
@Nonnull
@Override
public ItemStack getCraftingResult(@Nonnull InventoryCrafting var1) {
ItemStack cosmeticItem = null;
ItemStack attachableItem = null;
ItemStack cosmeticItem = ItemStack.EMPTY;
ItemStack attachableItem = ItemStack.EMPTY;
for(int i = 0; i < var1.getSizeInventory(); i++) {
ItemStack stack = var1.getStackInSlot(i);
if(stack != null) {
if(!stack.isEmpty()) {
if(stack.getItem() instanceof ICosmeticBauble && cosmeticItem == null)
cosmeticItem = stack;
else attachableItem = stack;
@@ -59,11 +60,11 @@ public class CosmeticAttachRecipe implements IRecipe {
}
if(!(attachableItem.getItem() instanceof ICosmeticAttachable))
return null;
return ItemStack.EMPTY;
ICosmeticAttachable attachable = (ICosmeticAttachable) attachableItem.getItem();
if(attachable.getCosmeticItem(attachableItem) != null)
return null;
if(!attachable.getCosmeticItem(attachableItem).isEmpty())
return ItemStack.EMPTY;
ItemStack copy = attachableItem.copy();
attachable.setCosmeticItem(copy, cosmeticItem);
@@ -75,9 +76,10 @@ public class CosmeticAttachRecipe implements IRecipe {
return 10;
}
@Nonnull
@Override
public ItemStack getRecipeOutput() {
return null;
return ItemStack.EMPTY;
}
@Nonnull
@@ -29,7 +29,7 @@ public class CosmeticRemoveRecipe implements IRecipe {
for(int i = 0; i < var1.getSizeInventory(); i++) {
ItemStack stack = var1.getStackInSlot(i);
if(stack != null) {
if(!stack.isEmpty()) {
if(stack.getItem() instanceof ICosmeticAttachable && !(stack.getItem() instanceof ICosmeticBauble) && ((ICosmeticAttachable) stack.getItem()).getCosmeticItem(stack) != null)
foundAttachable = true;
else return false;
@@ -39,19 +39,20 @@ public class CosmeticRemoveRecipe implements IRecipe {
return foundAttachable;
}
@Nonnull
@Override
public ItemStack getCraftingResult(@Nonnull InventoryCrafting var1) {
ItemStack attachableItem = null;
ItemStack attachableItem = ItemStack.EMPTY;
for(int i = 0; i < var1.getSizeInventory(); i++) {
ItemStack stack = var1.getStackInSlot(i);
if(stack != null)
if(!stack.isEmpty())
attachableItem = stack;
}
ICosmeticAttachable attachable = (ICosmeticAttachable) attachableItem.getItem();
if(attachable.getCosmeticItem(attachableItem) == null)
return null;
return ItemStack.EMPTY;
ItemStack copy = attachableItem.copy();
attachable.setCosmeticItem(copy, null);
@@ -63,9 +64,10 @@ public class CosmeticRemoveRecipe implements IRecipe {
return 10;
}
@Nonnull
@Override
public ItemStack getRecipeOutput() {
return null;
return ItemStack.EMPTY;
}
@Nonnull
@@ -32,7 +32,7 @@ public class HeadRecipe extends RecipeRuneAltar {
if(matches) {
for(int i = 0; i < inv.getSlots(); i++) {
ItemStack stack = inv.getStackInSlot(i);
if(stack == null)
if(stack.isEmpty())
break;
if(stack.getItem() == Items.NAME_TAG) {
@@ -36,7 +36,7 @@ public class HelmRevealingRecipe implements IRecipe {
boolean foundHelm = false;
for(int i = 0; i < var1.getSizeInventory(); i++) {
ItemStack stack = var1.getStackInSlot(i);
if(stack != null) {
if(!stack.isEmpty()) {
if(checkHelm(stack))
foundHelm = true;
else if(stack.getItem() == goggles)
@@ -47,18 +47,19 @@ public class HelmRevealingRecipe implements IRecipe {
return foundGoggles && foundHelm;
}
@Nonnull
@Override
public ItemStack getCraftingResult(@Nonnull InventoryCrafting var1) {
ItemStack helm = null;
ItemStack helm = ItemStack.EMPTY;
for(int i = 0; i < var1.getSizeInventory(); i++) {
ItemStack stack = var1.getStackInSlot(i);
if(stack != null && checkHelm(stack))
if(!stack.isEmpty() && checkHelm(stack))
helm = stack;
}
if(helm == null)
return null;
if(helm.isEmpty())
return ItemStack.EMPTY;
ItemStack helmCopy = helm.copy();
Item helmItem = helmCopy.getItem();
@@ -71,7 +72,7 @@ public class HelmRevealingRecipe implements IRecipe {
newHelm = new ItemStack(ModItems.terrasteelHelmRevealing);
else if(helmItem == ModItems.elementiumHelm)
newHelm = new ItemStack(ModItems.elementiumHelmRevealing);
else return null;
else return ItemStack.EMPTY;
//Copy Ancient Wills
for(int i = 0; i < 6; i++)
@@ -95,6 +96,7 @@ public class HelmRevealingRecipe implements IRecipe {
return 10;
}
@Nonnull
@Override
public ItemStack getRecipeOutput() {
return new ItemStack(ModItems.manasteelHelmRevealing);
@@ -37,7 +37,7 @@ public class LensDyeingRecipe implements IRecipe {
for(int i = 0; i < var1.getSizeInventory(); i++) {
ItemStack stack = var1.getStackInSlot(i);
if(stack != null) {
if(!stack.isEmpty()) {
if(stack.getItem() instanceof ILens && !foundLens)
foundLens = true;
else if(!foundDye) {
@@ -53,15 +53,16 @@ public class LensDyeingRecipe implements IRecipe {
return foundLens && foundDye;
}
@Nonnull
@Override
public ItemStack getCraftingResult(@Nonnull InventoryCrafting var1) {
ItemStack lens = null;
ItemStack lens = ItemStack.EMPTY;
int color = -1;
for(int i = 0; i < var1.getSizeInventory(); i++) {
ItemStack stack = var1.getStackInSlot(i);
if(stack != null) {
if(stack.getItem() instanceof ILens && lens == null)
if(!stack.isEmpty()) {
if(stack.getItem() instanceof ILens && lens.isEmpty())
lens = stack;
else color = getStackColor(stack);//We can assume if its not a lens its a dye because we checked it in matches()
}
@@ -75,7 +76,7 @@ public class LensDyeingRecipe implements IRecipe {
return lensCopy;
}
return null;
return ItemStack.EMPTY;
}
@Override
@@ -83,9 +84,10 @@ public class LensDyeingRecipe implements IRecipe {
return 10;
}
@Nonnull
@Override
public ItemStack getRecipeOutput() {
return null;
return ItemStack.EMPTY;
}
int getStackColor(ItemStack stack) {
@@ -30,7 +30,7 @@ public class ManaGunClipRecipe implements IRecipe {
for(int i = 0; i < var1.getSizeInventory(); i++) {
ItemStack stack = var1.getStackInSlot(i);
if(stack != null) {
if(!stack.isEmpty()) {
if(stack.getItem() instanceof ItemManaGun && !ItemManaGun.hasClip(stack))
foundGun = true;
@@ -44,18 +44,19 @@ public class ManaGunClipRecipe implements IRecipe {
return foundGun && foundClip;
}
@Nonnull
@Override
public ItemStack getCraftingResult(@Nonnull InventoryCrafting var1) {
ItemStack gun = null;
ItemStack gun = ItemStack.EMPTY;
for(int i = 0; i < var1.getSizeInventory(); i++) {
ItemStack stack = var1.getStackInSlot(i);
if(stack != null && stack.getItem() instanceof ItemManaGun)
if(!stack.isEmpty() && stack.getItem() instanceof ItemManaGun)
gun = stack;
}
if(gun == null)
return null;
if(gun.isEmpty())
return ItemStack.EMPTY;
ItemStack lens = ItemManaGun.getLens(gun);
ItemManaGun.setLens(gun, null);
@@ -70,9 +71,10 @@ public class ManaGunClipRecipe implements IRecipe {
return 10;
}
@Nonnull
@Override
public ItemStack getRecipeOutput() {
return null;
return ItemStack.EMPTY;
}
@Nonnull
@@ -31,7 +31,7 @@ public class ManaGunLensRecipe implements IRecipe {
for(int i = 0; i < var1.getSizeInventory(); i++) {
ItemStack stack = var1.getStackInSlot(i);
if(stack != null) {
if(!stack.isEmpty()) {
if(stack.getItem() instanceof ItemManaGun && ItemManaGun.getLens(stack) == null)
foundGun = true;
@@ -48,14 +48,15 @@ public class ManaGunLensRecipe implements IRecipe {
return foundLens && foundGun;
}
@Nonnull
@Override
public ItemStack getCraftingResult(@Nonnull InventoryCrafting var1) {
ItemStack lens = null;
ItemStack gun = null;
ItemStack lens = ItemStack.EMPTY;
ItemStack gun = ItemStack.EMPTY;
for(int i = 0; i < var1.getSizeInventory(); i++) {
ItemStack stack = var1.getStackInSlot(i);
if(stack != null) {
if(!stack.isEmpty()) {
if(stack.getItem() instanceof ItemManaGun)
gun = stack;
else if(stack.getItem() instanceof ILens)
@@ -63,8 +64,8 @@ public class ManaGunLensRecipe implements IRecipe {
}
}
if(lens == null || gun == null)
return null;
if(lens.isEmpty() || gun.isEmpty())
return ItemStack.EMPTY;
ItemStack gunCopy = gun.copy();
ItemManaGun.setLens(gunCopy, lens);
@@ -78,9 +79,10 @@ public class ManaGunLensRecipe implements IRecipe {
return 10;
}
@Nonnull
@Override
public ItemStack getRecipeOutput() {
return null;
return ItemStack.EMPTY;
}
@Nonnull
@@ -28,7 +28,7 @@ public class ManaGunRemoveLensRecipe implements IRecipe {
for(int i = 0; i < var1.getSizeInventory(); i++) {
ItemStack stack = var1.getStackInSlot(i);
if(stack != null) {
if(!stack.isEmpty()) {
if(stack.getItem() instanceof ItemManaGun && ItemManaGun.getLens(stack) != null)
foundGun = true;
@@ -39,13 +39,14 @@ public class ManaGunRemoveLensRecipe implements IRecipe {
return foundGun;
}
@Nonnull
@Override
public ItemStack getCraftingResult(@Nonnull InventoryCrafting var1) {
ItemStack gun = null;
ItemStack gun = ItemStack.EMPTY;
for(int i = 0; i < var1.getSizeInventory(); i++) {
ItemStack stack = var1.getStackInSlot(i);
if(stack != null) {
if(!stack.isEmpty()) {
if(stack.getItem() instanceof ItemManaGun)
gun = stack;
}
@@ -62,9 +63,10 @@ public class ManaGunRemoveLensRecipe implements IRecipe {
return 10;
}
@Nonnull
@Override
public ItemStack getRecipeOutput() {
return null;
return ItemStack.EMPTY;
}
@Nonnull
@@ -27,7 +27,7 @@ public class ManaUpgradeRecipe extends ShapedOreRecipe {
IManaItem outItem = (IManaItem) out.getItem();
for (int i = 0; i < var1.getSizeInventory(); i++) {
ItemStack stack = var1.getStackInSlot(i);
if (stack != null) {
if (!stack.isEmpty()) {
if (stack.getItem() instanceof IManaItem) {
IManaItem item = (IManaItem) stack.getItem();
outItem.addMana(out, item.getMana(stack));
@@ -30,11 +30,11 @@ public class PhantomInkRecipe implements IRecipe {
for(int i = 0; i < var1.getSizeInventory(); i++) {
ItemStack stack = var1.getStackInSlot(i);
if(stack != null) {
if(!stack.isEmpty()) {
if(stack.getItem() == ModItems.phantomInk && !foundInk)
foundInk = true;
else if(!foundItem) {
if(stack.getItem() instanceof IPhantomInkable && stack.getItem().getContainerItem(stack) == null)
if(stack.getItem() instanceof IPhantomInkable && stack.getItem().getContainerItem(stack).isEmpty())
foundItem = true;
else return false;
} else return false;
@@ -44,13 +44,14 @@ public class PhantomInkRecipe implements IRecipe {
return foundInk && foundItem;
}
@Nonnull
@Override
public ItemStack getCraftingResult(@Nonnull InventoryCrafting var1) {
ItemStack item = null;
ItemStack item = ItemStack.EMPTY;
for(int i = 0; i < var1.getSizeInventory(); i++) {
ItemStack stack = var1.getStackInSlot(i);
if(stack != null && stack.getItem() instanceof IPhantomInkable && item == null)
if(!stack.isEmpty() && stack.getItem() instanceof IPhantomInkable && item.isEmpty())
item = stack;
}
@@ -65,9 +66,10 @@ public class PhantomInkRecipe implements IRecipe {
return 10;
}
@Nonnull
@Override
public ItemStack getRecipeOutput() {
return null;
return ItemStack.EMPTY;
}
@Nonnull
@@ -31,7 +31,7 @@ public class SpecialFloatingFlowerRecipe implements IRecipe {
for(int i = 0; i < var1.getSizeInventory(); i++) {
ItemStack stack = var1.getStackInSlot(i);
if(stack != null) {
if(!stack.isEmpty()) {
if(stack.getItem() == Item.getItemFromBlock(ModBlocks.floatingFlower))
foundFloatingFlower = true;
@@ -45,18 +45,19 @@ public class SpecialFloatingFlowerRecipe implements IRecipe {
return foundFloatingFlower && foundSpecialFlower;
}
@Nonnull
@Override
public ItemStack getCraftingResult(@Nonnull InventoryCrafting var1) {
ItemStack specialFlower = null;
ItemStack specialFlower = ItemStack.EMPTY;
for(int i = 0; i < var1.getSizeInventory(); i++) {
ItemStack stack = var1.getStackInSlot(i);
if(stack != null && stack.getItem() == Item.getItemFromBlock(ModBlocks.specialFlower))
if(!stack.isEmpty() && stack.getItem() == Item.getItemFromBlock(ModBlocks.specialFlower))
specialFlower = stack;
}
if(specialFlower == null)
return null;
if(specialFlower.isEmpty())
return ItemStack.EMPTY;
return ItemBlockSpecialFlower.ofType(new ItemStack(ModBlocks.floatingSpecialFlower), ItemBlockSpecialFlower.getType(specialFlower));
}
@@ -66,9 +67,10 @@ public class SpecialFloatingFlowerRecipe implements IRecipe {
return 10;
}
@Nonnull
@Override
public ItemStack getRecipeOutput() {
return null;
return ItemStack.EMPTY;
}
@Nonnull
@@ -30,7 +30,7 @@ public class SpellClothRecipe implements IRecipe {
for(int i = 0; i < var1.getSizeInventory(); i++) {
ItemStack stack = var1.getStackInSlot(i);
if(stack != null) {
if(!stack.isEmpty()) {
if(stack.isItemEnchanted() && !foundEnchanted && stack.getItem() != ModItems.spellCloth)
foundEnchanted = true;
@@ -44,19 +44,20 @@ public class SpellClothRecipe implements IRecipe {
return foundCloth && foundEnchanted;
}
@Nonnull
@Override
public ItemStack getCraftingResult(@Nonnull InventoryCrafting var1) {
ItemStack stackToDisenchant = null;
ItemStack stackToDisenchant = ItemStack.EMPTY;
for(int i = 0; i < var1.getSizeInventory(); i++) {
ItemStack stack = var1.getStackInSlot(i);
if(stack != null && stack.isItemEnchanted()) {
if(!stack.isEmpty() && stack.isItemEnchanted()) {
stackToDisenchant = stack.copy();
break;
}
}
if(stackToDisenchant == null)
return null;
if(stackToDisenchant.isEmpty())
return ItemStack.EMPTY;
NBTTagCompound cmp = stackToDisenchant.getTagCompound().copy();
cmp.removeTag("ench"); // Remove enchantments
@@ -70,9 +71,10 @@ public class SpellClothRecipe implements IRecipe {
return 10;
}
@Nonnull
@Override
public ItemStack getRecipeOutput() {
return null;
return ItemStack.EMPTY;
}
@Nonnull
@@ -30,7 +30,7 @@ public class TerraPickTippingRecipe implements IRecipe {
for(int i = 0; i < var1.getSizeInventory(); i++) {
ItemStack stack = var1.getStackInSlot(i);
if(stack != null) {
if(!stack.isEmpty()) {
if(stack.getItem() instanceof ItemTerraPick && !ItemTerraPick.isTipped(stack))
foundTerraPick = true;
@@ -44,18 +44,19 @@ public class TerraPickTippingRecipe implements IRecipe {
return foundTerraPick && foundElementiumPick;
}
@Nonnull
@Override
public ItemStack getCraftingResult(@Nonnull InventoryCrafting var1) {
ItemStack terraPick = null;
ItemStack terraPick = ItemStack.EMPTY;
for(int i = 0; i < var1.getSizeInventory(); i++) {
ItemStack stack = var1.getStackInSlot(i);
if(stack != null && stack.getItem() instanceof ItemTerraPick)
if(!stack.isEmpty() && stack.getItem() instanceof ItemTerraPick)
terraPick = stack;
}
if(terraPick == null)
return null;
if(terraPick.isEmpty())
return ItemStack.EMPTY;
ItemStack terraPickCopy = terraPick.copy();
ItemTerraPick.setTipped(terraPickCopy);
@@ -67,9 +68,10 @@ public class TerraPickTippingRecipe implements IRecipe {
return 10;
}
@Nonnull
@Override
public ItemStack getRecipeOutput() {
return null;
return ItemStack.EMPTY;
}
@Nonnull
@@ -464,7 +464,7 @@ public class EntityDoppleganger extends EntityLiving implements IBotaniaBoss {
super.dropEquipment(wasRecentlyHit, lootingModifier);
for (EntityEquipmentSlot e : EntityEquipmentSlot.values()) {
setItemStackToSlot(e, null);
setItemStackToSlot(e, ItemStack.EMPTY);
}
// Generate loot table for every single attacking player
@@ -606,7 +606,7 @@ public class EntityDoppleganger extends EntityLiving implements IBotaniaBoss {
else {
for(EntityPlayer player : players) {
for(EntityEquipmentSlot e : EntityEquipmentSlot.values()) {
if(e.getSlotType() == EntityEquipmentSlot.Type.ARMOR && player.getItemStackFromSlot(e) != null) {
if(e.getSlotType() == EntityEquipmentSlot.Type.ARMOR && !player.getItemStackFromSlot(e).isEmpty()) {
anyWithArmor = true;
break;
}
@@ -418,9 +418,9 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
NBTTagCompound lensCmp = par1nbtTagCompound.getCompoundTag(TAG_LENS_STACK);
ItemStack stack = new ItemStack(lensCmp);
if(stack != null)
if(!stack.isEmpty())
setSourceLens(stack);
else setSourceLens(new ItemStack(Blocks.STONE, 0, 0));
else setSourceLens(ItemStack.EMPTY);
int x = par1nbtTagCompound.getInteger(TAG_SPREADER_X);
int y = par1nbtTagCompound.getInteger(TAG_SPREADER_Y);
@@ -41,6 +41,8 @@ import vazkii.botania.common.item.equipment.tool.ToolCommons;
import vazkii.botania.common.item.rod.ItemExchangeRod;
import vazkii.botania.common.lib.LibItemNames;
import javax.annotation.Nonnull;
public class ItemAstrolabe extends ItemMod {
private static final String TAG_BLOCK_NAME = "blockName";
@@ -52,6 +54,7 @@ public class ItemAstrolabe extends ItemMod {
setMaxStackSize(1);
}
@Nonnull
@Override
public EnumActionResult onItemUse(EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
ItemStack stack = playerIn.getHeldItem(hand);
@@ -78,8 +81,9 @@ public class ItemAstrolabe extends ItemMod {
return EnumActionResult.PASS;
}
@Nonnull
@Override
public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand hand) {
public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, @Nonnull EnumHand hand) {
ItemStack stack = playerIn.getHeldItem(hand);
if(playerIn.isSneaking()) {
int size = getSize(stack);
@@ -55,9 +55,10 @@ public class ItemBaubleBox extends ItemMod {
private static class InvProvider implements ICapabilitySerializable<NBTBase> {
private final IItemHandler inv = new ItemStackHandler(24) {
@Nonnull
@Override
public ItemStack insertItem(int slot, ItemStack toInsert, boolean simulate) {
if(toInsert != null &&
public ItemStack insertItem(int slot, @Nonnull ItemStack toInsert, boolean simulate) {
if(!toInsert.isEmpty() &&
(toInsert.getItem() instanceof IManaItem
|| toInsert.getItem() instanceof IBauble))
return super.insertItem(slot, toInsert, simulate);
@@ -66,12 +67,12 @@ public class ItemBaubleBox extends ItemMod {
};
@Override
public boolean hasCapability(Capability<?> capability, @Nullable EnumFacing facing) {
public boolean hasCapability(@Nonnull Capability<?> capability, @Nullable EnumFacing facing) {
return capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY;
}
@Override
public <T> T getCapability(Capability<T> capability, @Nullable EnumFacing facing) {
public <T> T getCapability(@Nonnull Capability<T> capability, @Nullable EnumFacing facing) {
if(capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY)
return CapabilityItemHandler.ITEM_HANDLER_CAPABILITY.cast(inv);
else return null;
@@ -165,7 +165,7 @@ public class ItemBlackHoleTalisman extends ItemMod implements IBlockProvider {
continue;
add(itemstack, count);
player.inventory.setInventorySlotContents(i, null);
player.inventory.setInventorySlotContents(i, ItemStack.EMPTY);
}
/*int countInHighest = counts[highest];
@@ -187,7 +187,7 @@ public class ItemBlackHoleTalisman extends ItemMod implements IBlockProvider {
int meta = getBlockMeta(par1ItemStack);
ItemStack stack = new ItemStack(block, 1, meta);
return super.getItemStackDisplayName(par1ItemStack) + (stack == null || stack.getItem() == null ? "" : " (" + TextFormatting.GREEN + stack.getDisplayName() + TextFormatting.RESET + ")");
return super.getItemStackDisplayName(par1ItemStack) + (stack.isEmpty() ? "" : " (" + TextFormatting.GREEN + stack.getDisplayName() + TextFormatting.RESET + ")");
}
@Nonnull
@@ -195,7 +195,7 @@ public class ItemBlackHoleTalisman extends ItemMod implements IBlockProvider {
public ItemStack getContainerItem(@Nonnull ItemStack itemStack) {
int count = getBlockCount(itemStack);
if(count == 0)
return null;
return ItemStack.EMPTY;
int extract = Math.min(64, count);
ItemStack copy = itemStack.copy();
@@ -210,7 +210,7 @@ public class ItemBlackHoleTalisman extends ItemMod implements IBlockProvider {
@Override
public boolean hasContainerItem(ItemStack stack) {
return getContainerItem(stack) != null;
return !getContainerItem(stack).isEmpty();
}
private boolean setBlock(ItemStack stack, Block block, int meta) {
@@ -102,9 +102,9 @@ public class ItemBottledMana extends ItemMod {
for(int i = 0; i < player.inventory.getSizeInventory(); i++) {
ItemStack stackAt = player.inventory.getStackInSlot(i);
if(stackAt != stack) {
if(stackAt != null)
if(!stackAt.isEmpty())
player.entityDropItem(stackAt, 0);
player.inventory.setInventorySlotContents(i, null);
player.inventory.setInventorySlotContents(i, ItemStack.EMPTY);
}
}
}
@@ -223,6 +223,7 @@ public class ItemBottledMana extends ItemMod {
return ActionResult.newResult(EnumActionResult.SUCCESS, player.getHeldItem(hand));
}
@Nonnull
@Override
public ItemStack onItemUseFinish(@Nonnull ItemStack par1ItemStack, World world, EntityLivingBase living) {
randomEffect(living, par1ItemStack);
@@ -93,7 +93,7 @@ public class ItemCraftingHalo extends ItemMod implements ICraftAchievement {
@Nonnull
@Override
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) {
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, @Nonnull EnumHand hand) {
ItemStack stack = player.getHeldItem(hand);
int segment = getSegmentLookedAt(stack, player);
ItemStack itemForPos = getItemForSlot(stack, segment);
@@ -176,7 +176,7 @@ public class ItemCraftingHalo extends ItemMod implements ICraftAchievement {
if(recipe == null)
return false;
if(ItemHandlerHelper.insertItemStacked(inv, recipe[9], true) != null)
if(!ItemHandlerHelper.insertItemStacked(inv, recipe[9], true).isEmpty())
return false;
return consumeRecipeIngredients(recipe, inv, null);
@@ -210,11 +210,11 @@ public class ItemCraftingHalo extends ItemMod implements ICraftAchievement {
private static boolean consumeFromInventory(ItemStack stack, IItemHandler inv, EntityPlayer player) {
for(int i = 0; i < inv.getSlots(); i++) {
ItemStack stackAt = inv.getStackInSlot(i);
if(stackAt != null && stack.isItemEqual(stackAt) && ItemStack.areItemStackTagsEqual(stack, stackAt)) {
if(!stackAt.isEmpty() && stack.isItemEqual(stackAt) && ItemStack.areItemStackTagsEqual(stack, stackAt)) {
boolean consume = true;
ItemStack container = stackAt.getItem().getContainerItem(stackAt);
if(container != null) {
if(!container.isEmpty()) {
if(container == stackAt)
consume = false;
else {
@@ -292,14 +292,14 @@ public class ItemCraftingHalo extends ItemMod implements ICraftAchievement {
if(slot == 0)
return craftingTable;
else if(slot >= SEGMENTS)
return null;
return ItemStack.EMPTY;
else {
NBTTagCompound cmp = getStoredRecipeCompound(stack, slot);
if(cmp != null) {
ItemStack cmpStack = getLastCraftingItem(cmp, 9);
return cmpStack;
} else return null;
} else return ItemStack.EMPTY;
}
}
@@ -317,7 +317,7 @@ public class ItemCraftingHalo extends ItemMod implements ICraftAchievement {
for(int i = 0; i < event.player.inventory.getSizeInventory(); i++) {
ItemStack stack = event.player.inventory.getStackInSlot(i);
if(stack != null && stack.getItem() instanceof ItemCraftingHalo)
if(!stack.isEmpty() && stack.getItem() instanceof ItemCraftingHalo)
saveRecipeToStack(event, stack);
}
}
@@ -327,7 +327,7 @@ public class ItemCraftingHalo extends ItemMod implements ICraftAchievement {
NBTTagCompound cmp1 = new NBTTagCompound();
ItemStack result = CraftingManager.getInstance().findMatchingRecipe((InventoryCrafting) event.craftMatrix, event.player.world);
if(result != null) {
if(!result.isEmpty()) {
result.writeToNBT(cmp1);
cmp.setTag(TAG_ITEM_PREFIX + 9, cmp1);
@@ -335,7 +335,7 @@ public class ItemCraftingHalo extends ItemMod implements ICraftAchievement {
cmp1 = new NBTTagCompound();
ItemStack stackSlot = event.craftMatrix.getStackInSlot(i);
if(stackSlot != null) {
if(!stackSlot.isEmpty()) {
ItemStack writeStack = stackSlot.copy();
writeStack.setCount(1);
writeStack.writeToNBT(cmp1);
@@ -69,9 +69,10 @@ public class ItemFlowerBag extends ItemMod {
private static class InvProvider implements ICapabilitySerializable<NBTBase> {
private final IItemHandler inv = new ItemStackHandler(16) {
@Nonnull
@Override
public ItemStack insertItem(int slot, ItemStack toInsert, boolean simulate) {
if(toInsert != null
public ItemStack insertItem(int slot, @Nonnull ItemStack toInsert, boolean simulate) {
if(!toInsert.isEmpty()
&& toInsert.getItem() == Item.getItemFromBlock(ModBlocks.flower)
&& toInsert.getItemDamage() == slot)
return super.insertItem(slot, toInsert, simulate);
@@ -80,12 +81,12 @@ public class ItemFlowerBag extends ItemMod {
};
@Override
public boolean hasCapability(Capability<?> capability, @Nullable EnumFacing facing) {
public boolean hasCapability(@Nonnull Capability<?> capability, @Nullable EnumFacing facing) {
return capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY;
}
@Override
public <T> T getCapability(Capability<T> capability, @Nullable EnumFacing facing) {
public <T> T getCapability(@Nonnull Capability<T> capability, @Nullable EnumFacing facing) {
if(capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY)
return CapabilityItemHandler.ITEM_HANDLER_CAPABILITY.cast(inv);
else return null;
@@ -48,7 +48,7 @@ public class ItemKeepIvy extends ItemMod {
List<EntityItem> keeps = new ArrayList<>();
for(EntityItem item : event.getDrops()) {
ItemStack stack = item.getEntityItem();
if(stack != null && ItemNBTHelper.detectNBT(stack) && ItemNBTHelper.getBoolean(stack, TAG_KEEP, false))
if(!stack.isEmpty() && ItemNBTHelper.detectNBT(stack) && ItemNBTHelper.getBoolean(stack, TAG_KEEP, false))
keeps.add(item);
}
@@ -87,7 +87,7 @@ public class ItemKeepIvy extends ItemMod {
for(int i = 0; i < count; i++) {
NBTTagCompound cmp2 = cmp1.getCompoundTag(TAG_DROP_PREFIX + i);
ItemStack stack = new ItemStack(cmp2);
if(stack != null) {
if(!stack.isEmpty()) {
ItemStack copy = stack.copy();
ItemNBTHelper.setBoolean(copy, TAG_KEEP, false);
event.player.inventory.addItemStackToInventory(copy);
@@ -147,7 +147,7 @@ public class ItemLexicon extends ItemMod implements ILexicon, IElvenItem {
@Nonnull
@Override
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) {
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, @Nonnull EnumHand hand) {
ItemStack stack = player.getHeldItem(hand);
String force = getForcedPage(stack);
if(force != null && !force.isEmpty()) {
@@ -241,8 +241,8 @@ public class ItemLexicon extends ItemMod implements ILexicon, IElvenItem {
}
public static String getTitle(ItemStack stack) {
String title = ModItems.lexicon.getItemStackDisplayName(null);
if(stack != null)
String title = ModItems.lexicon.getItemStackDisplayName(ItemStack.EMPTY);
if(!stack.isEmpty())
title = stack.getDisplayName();
String akashicTomeNBT = "akashictome:displayName";
@@ -77,7 +77,7 @@ public class ItemManaGun extends ItemMod implements IManaUsingItem {
@Nonnull
@Override
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) {
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, @Nonnull EnumHand hand) {
ItemStack stack = player.getHeldItem(hand);
int effCd = COOLDOWN;
PotionEffect effect = player.getActivePotionEffect(MobEffects.HASTE);
@@ -260,7 +260,7 @@ public class ItemManaGun extends ItemMod implements IManaUsingItem {
if(cmp != null) {
return new ItemStack(cmp);
}
return null;
return ItemStack.EMPTY;
}
public static void setLensAtPos(ItemStack stack, ItemStack lens, int pos) {
@@ -288,7 +288,7 @@ public class ItemManaGun extends ItemMod implements IManaUsingItem {
if(cmp != null) {
return new ItemStack(cmp);
}
return null;
return ItemStack.EMPTY;
}
public static List<ItemStack> getAllLens(ItemStack stack) {
@@ -104,7 +104,7 @@ public class ItemSextant extends ItemMod {
@Nonnull
@Override
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) {
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, @Nonnull EnumHand hand) {
Botania.proxy.removeSextantMultiblock();
ItemStack stack = player.getHeldItem(hand);
@@ -69,7 +69,7 @@ public class ItemTemperanceStone extends ItemMod {
IInventory inv = player.inventory;
for(int i = 0; i < inv.getSizeInventory(); i++) {
ItemStack stack = inv.getStackInSlot(i);
if(stack != null && stack.getItem() == ModItems.temperanceStone && stack.getItemDamage() == 1)
if(!stack.isEmpty() && stack.getItem() == ModItems.temperanceStone && stack.getItemDamage() == 1)
return true;
}
@@ -58,7 +58,7 @@ public class ItemThornChakram extends ItemMod implements ICraftAchievement {
@Nonnull
@Override
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) {
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, @Nonnull EnumHand hand) {
ItemStack stack = player.getHeldItem(hand);
if(!world.isRemote) {
@@ -17,6 +17,8 @@ import vazkii.botania.common.core.handler.ConfigHandler;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.item.equipment.armor.manasteel.ItemManasteelArmor;
import javax.annotation.Nonnull;
public abstract class ItemElementiumArmor extends ItemManasteelArmor implements IPixieSpawner {
public ItemElementiumArmor(EntityEquipmentSlot type, String name) {
@@ -36,7 +38,7 @@ public abstract class ItemElementiumArmor extends ItemManasteelArmor implements
}
@Override
public boolean getIsRepairable(ItemStack par1ItemStack, ItemStack par2ItemStack) {
public boolean getIsRepairable(ItemStack par1ItemStack, @Nonnull ItemStack par2ItemStack) {
return par2ItemStack.getItem() == ModItems.manaResource && par2ItemStack.getItemDamage() == 7 ? true : super.getIsRepairable(par1ItemStack, par2ItemStack);
}
@@ -80,14 +80,14 @@ public class ItemManasteelArmor extends ItemArmor implements ISpecialArmor, IMan
}
@Override
public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, int slot) {
public ArmorProperties getProperties(EntityLivingBase player, @Nonnull ItemStack armor, DamageSource source, double damage, int slot) {
if(source.isUnblockable())
return new ArmorProperties(0, 0, 0);
return new ArmorProperties(0, damageReduceAmount / 25D, armor.getMaxDamage() + 1 - armor.getItemDamage());
}
@Override
public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) {
public int getArmorDisplay(EntityPlayer player, @Nonnull ItemStack armor, int slot) {
return damageReduceAmount;
}
@@ -104,7 +104,7 @@ public class ItemManasteelArmor extends ItemArmor implements ISpecialArmor, IMan
}
@Override
public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot) {
public void damageArmor(EntityLivingBase entity, @Nonnull ItemStack stack, DamageSource source, int damage, int slot) {
ToolCommons.damageItem(stack, damage, entity, MANA_PER_DAMAGE);
}
@@ -118,7 +118,6 @@ public class ItemManasteelArmor extends ItemArmor implements ISpecialArmor, IMan
return ConfigHandler.enableArmorModels ? LibResources.MODEL_MANASTEEL_NEW : slot == EntityEquipmentSlot.LEGS ? LibResources.MODEL_MANASTEEL_1 : LibResources.MODEL_MANASTEEL_0;
}
@Nonnull
@Override
@SideOnly(Side.CLIENT)
public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, EntityEquipmentSlot armorSlot, ModelBiped original) {
@@ -151,7 +150,7 @@ public class ItemManasteelArmor extends ItemArmor implements ISpecialArmor, IMan
}
@Override
public boolean getIsRepairable(ItemStack par1ItemStack, ItemStack par2ItemStack) {
public boolean getIsRepairable(ItemStack par1ItemStack, @Nonnull ItemStack par2ItemStack) {
return par2ItemStack.getItem() == ModItems.manaResource && par2ItemStack.getItemDamage() == 0 ? true : super.getIsRepairable(par1ItemStack, par2ItemStack);
}
@@ -64,7 +64,7 @@ public class ItemManaweaveArmor extends ItemManasteelArmor implements ICraftAchi
}
@Override
public boolean getIsRepairable(ItemStack par1ItemStack, ItemStack par2ItemStack) {
public boolean getIsRepairable(ItemStack par1ItemStack, @Nonnull ItemStack par2ItemStack) {
return par2ItemStack.getItem() == ModItems.manaResource && par2ItemStack.getItemDamage() == 22 ? true : super.getIsRepairable(par1ItemStack, par2ItemStack);
}
@@ -86,7 +86,7 @@ public class ItemManaweaveArmor extends ItemManasteelArmor implements ICraftAchi
@Override
public boolean hasArmorSetItem(EntityPlayer player, int i) {
ItemStack stack = player.inventory.armorInventory.get(3 - i);
if(stack == null)
if(stack.isEmpty())
return false;
switch(i) {
@@ -52,7 +52,7 @@ public class ItemTerrasteelArmor extends ItemManasteelArmor {
}
@Override
public boolean getIsRepairable(ItemStack par1ItemStack, ItemStack par2ItemStack) {
public boolean getIsRepairable(ItemStack par1ItemStack, @Nonnull ItemStack par2ItemStack) {
return par2ItemStack.getItem() == ModItems.manaResource && par2ItemStack.getItemDamage() == 4 || super.getIsRepairable(par1ItemStack, par2ItemStack);
}
@@ -128,7 +128,7 @@ public class ItemTerrasteelHelm extends ItemTerrasteelArmor implements IManaDisc
if(hasArmorSet(player)) {
boolean crit = player.fallDistance > 0.0F && !player.onGround && !player.isOnLadder() && !player.isInWater() && !player.isPotionActive(MobEffects.BLINDNESS) && !player.isRiding();
ItemStack stack = player.getItemStackFromSlot(EntityEquipmentSlot.HEAD);
if(crit && stack != null && stack.getItem() instanceof ItemTerrasteelHelm) {
if(crit && !stack.isEmpty() && stack.getItem() instanceof ItemTerrasteelHelm) {
boolean ahrim = hasAncientWill(stack, 0);
boolean dharok = hasAncientWill(stack, 1);
boolean guthan = hasAncientWill(stack, 2);
@@ -172,7 +172,7 @@ public abstract class ItemBauble extends ItemMod implements IBauble, ICosmeticAt
@Override
public boolean hasContainerItem(ItemStack stack) {
return getContainerItem(stack) != null;
return !getContainerItem(stack).isEmpty();
}
@Nonnull
@@ -154,7 +154,7 @@ public class ItemBloodPendant extends ItemBauble implements IBrewContainer, IBre
if(type == RenderType.BODY) {
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
Helper.rotateIfSneaking(player);
boolean armor = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST) != null;
boolean armor = !player.getItemStackFromSlot(EntityEquipmentSlot.CHEST).isEmpty();
GlStateManager.rotate(180F, 1F, 0F, 0F);
GlStateManager.translate(-0.26F, -0.4F, armor ? 0.2F : 0.15F);
GlStateManager.scale(0.5F, 0.5F, 0.5F);
@@ -88,7 +88,7 @@ public class ItemCloudPendant extends CloudPendantShim implements IBaubleRender
if(type == RenderType.BODY) {
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
Helper.rotateIfSneaking(player);
boolean armor = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST) != null;
boolean armor = !player.getItemStackFromSlot(EntityEquipmentSlot.CHEST).isEmpty();
GlStateManager.rotate(180F, 1F, 0F, 0F);
GlStateManager.translate(-0.2F, -0.3F, armor ? 0.2F : 0.15F);
GlStateManager.scale(0.5F, 0.5F, 0.5F);
@@ -55,7 +55,7 @@ public class ItemDivaCharm extends ItemBauble implements IManaUsingItem, IBauble
if(event.getSource().getEntity() instanceof EntityPlayer && event.getEntityLiving() instanceof EntityLiving && !event.getEntityLiving().world.isRemote && Math.random() < 0.6F) {
EntityPlayer player = (EntityPlayer) event.getSource().getEntity();
ItemStack amulet = BaublesApi.getBaubles(player).getStackInSlot(6);
if(amulet != null && amulet.getItem() == this) {
if(!amulet.isEmpty() && amulet.getItem() == this) {
final int cost = 250;
if(ManaItemHandler.requestManaExact(amulet, player, cost, false)) {
final int range = 20;
@@ -55,9 +55,9 @@ public class ItemDodgeRing extends ItemBauble {
IInventory baublesInv = BaublesApi.getBaubles(mc.player);
ItemStack ringStack = baublesInv.getStackInSlot(1);
if(ringStack == null || !(ringStack.getItem() instanceof ItemDodgeRing)) {
if(ringStack.isEmpty() || !(ringStack.getItem() instanceof ItemDodgeRing)) {
ringStack = baublesInv.getStackInSlot(2);
if(ringStack == null || !(ringStack.getItem() instanceof ItemDodgeRing))
if(ringStack.isEmpty() || !(ringStack.getItem() instanceof ItemDodgeRing))
return;
}
Loaded 100 of 132 files, more files were not shown because too many files have changed in this diff. Show more