A bunch more null fixes

This commit is contained in:
Vincent Lee committed 2017-01-05 03:59:01 -06:00
1 parent 24779ded1c
commit 4a3e0fd636
49 files changed
+75 -75

No files matched your search

@@ -90,7 +90,7 @@ public final class ManaItemHandler {
* @return The amount of mana received from the request.
*/
public static int requestMana(ItemStack stack, EntityPlayer player, int manaToGet, boolean remove) {
if(stack == null)
if(stack.isEmpty())
return 0;
List<ItemStack> items = getManaItems(player);
@@ -143,7 +143,7 @@ public final class ManaItemHandler {
* @return If the request was succesful.
*/
public static boolean requestManaExact(ItemStack stack, EntityPlayer player, int manaToGet, boolean remove) {
if(stack == null)
if(stack.isEmpty())
return false;
List<ItemStack> items = getManaItems(player);
@@ -191,7 +191,7 @@ public final class ManaItemHandler {
* @return The amount of mana actually sent.
*/
public static int dispatchMana(ItemStack stack, EntityPlayer player, int manaToSend, boolean add) {
if(stack == null)
if(stack.isEmpty())
return 0;
List<ItemStack> items = getManaItems(player);
@@ -251,7 +251,7 @@ public final class ManaItemHandler {
* @return If an item received the mana sent.
*/
public static boolean dispatchManaExact(ItemStack stack, EntityPlayer player, int manaToSend, boolean add) {
if(stack == null)
if(stack.isEmpty())
return false;
List<ItemStack> items = getManaItems(player);
@@ -106,7 +106,7 @@ public class RecipeBrew {
}
public ItemStack getOutput(ItemStack stack) {
if(stack == null || !(stack.getItem() instanceof IBrewContainer))
if(stack.isEmpty() || !(stack.getItem() instanceof IBrewContainer))
return new ItemStack(Items.GLASS_BOTTLE); // Fallback...
IBrewContainer container = (IBrewContainer) stack.getItem();
@@ -105,7 +105,7 @@ public final class ItemsRemainingRenderHandler {
ItemsRemainingRenderHandler.stack = stack;
ItemsRemainingRenderHandler.count = count;
ItemsRemainingRenderHandler.customString = str;
ticks = stack == null ? 0 : maxTicks;
ticks = stack.isEmpty() ? 0 : maxTicks;
}
public static void set(EntityPlayer player, ItemStack displayStack, Pattern pattern) {
@@ -67,7 +67,7 @@ public class GuiButtonInvisible extends GuiButtonLexicon {
hovered = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + width && par3 < yPosition + height;
int k = getHoverState(hovered);
boolean showStack = displayStack != null && !displayString.isEmpty();
boolean showStack = !displayStack.isEmpty() && !displayString.isEmpty();
if(!displayString.isEmpty() && k == 2) {
timeHover = Math.min(5, timeHover + gui.timeDelta);
@@ -147,7 +147,7 @@ public class BlockSparkChanger extends BlockMod implements ILexiconable {
public int getComparatorInputOverride(IBlockState state, World world, BlockPos pos) {
TileSparkChanger changer = (TileSparkChanger) world.getTileEntity(pos);
ItemStack stack = changer.getItemHandler().getStackInSlot(0);
if(stack == null)
if(stack.isEmpty())
return 0;
return stack.getItemDamage() + 1;
}
@@ -144,7 +144,7 @@ public class BlockEnchanter extends BlockMod implements IWandable, ILexiconable,
ItemStack itemstack = enchanter.itemToEnchant;
if (itemstack != null) {
if (!itemstack.isEmpty()) {
float f = random.nextFloat() * 0.8F + 0.1F;
float f1 = random.nextFloat() * 0.8F + 0.1F;
EntityItem entityitem;
@@ -128,7 +128,7 @@ public class SubTileHopperhock extends SubTileFunctional {
}
public boolean canAcceptItem(ItemStack stack, List<ItemStack> filter, int filterType) {
if(stack == null)
if(stack.isEmpty())
return false;
if(filter.isEmpty())
@@ -77,7 +77,7 @@ public class SubTileLoonuim extends SubTileFunctional {
if (stacks.isEmpty())
return;
else stack = stacks.get(0);
} while(stack == null || BotaniaAPI.looniumBlacklist.contains(stack.getItem()));
} while(stack.isEmpty() || BotaniaAPI.looniumBlacklist.contains(stack.getItem()));
int bound = RANGE * 2 + 1;
int xp = supertile.getPos().getX() - RANGE + rand.nextInt(bound);
@@ -61,7 +61,7 @@ public class SubTileMarimorphosis extends SubTileFunctional {
BlockPos coords = getCoordsToPut();
if(coords != null) {
ItemStack stack = getStoneToPut(coords);
if(stack != null) {
if(!stack.isEmpty()) {
Block block = Block.getBlockFromItem(stack.getItem());
int meta = stack.getItemDamage();
supertile.getWorld().setBlockState(coords, block.getStateFromMeta(meta), 1 | 2);
@@ -208,7 +208,7 @@ public class TileAlfPortal extends TileMod {
private void resolveRecipes() {
int i = 0;
for(ItemStack stack : stacksIn) {
if(stack != null && stack.getItem() instanceof ILexicon) {
if(!stack.isEmpty() && stack.getItem() instanceof ILexicon) {
ILexicon lexicon = (ILexicon) stack.getItem();
if (!lexicon.isKnowledgeUnlocked(stack, BotaniaAPI.elvenKnowledge)) {
lexicon.unlockKnowledge(stack, BotaniaAPI.elvenKnowledge);
@@ -197,7 +197,7 @@ public class TileAltar extends TileSimpleInventory implements IPetalApothecary {
int index = 0;
boolean didAny = false;
for(ItemStack stack : lastRecipe) {
if(stack == null)
if(stack.isEmpty())
continue;
for(int i = 0; i < player.inventory.getSizeInventory(); i++) {
@@ -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).isEmpty() != stack.getItem() instanceof IBrewContainer)
if(recipe != null || stack.isEmpty() || 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;
@@ -19,7 +19,7 @@ public class TileCacophonium extends TileMod {
private static final String TAG_STACK = "stack";
public ItemStack stack;
public ItemStack stack = ItemStack.EMPTY;
public void annoyDirewolf() {
ItemCacophonium.playSound(world, stack, pos.getX(), pos.getY(), pos.getZ(), SoundCategory.BLOCKS, 1F);
@@ -30,7 +30,7 @@ public class TileCacophonium extends TileMod {
super.writePacketNBT(cmp);
NBTTagCompound cmp1 = new NBTTagCompound();
if(stack != null)
if(!stack.isEmpty())
stack.writeToNBT(cmp1);
cmp.setTag(TAG_STACK, cmp1);
}
@@ -73,7 +73,7 @@ public class TileEnchanter extends TileMod implements ISparkAttachable {
private int manaRequired = -1;
private int mana = 0;
public ItemStack itemToEnchant = null;
public ItemStack itemToEnchant = ItemStack.EMPTY;
private final List<EnchantmentData> enchants = new ArrayList<>();
private static final BlockPos[] OBSIDIAN_LOCATIONS = {
@@ -20,14 +20,14 @@ import vazkii.botania.common.block.ModBlocks;
public class TileFloatingFlower extends TileMod implements IFloatingFlower {
public static final String TAG_ISLAND_TYPE = "islandType";
public static ItemStack forcedStack = null;
public static ItemStack forcedStack = ItemStack.EMPTY;
IslandType type = IslandType.GRASS;
@Override
public ItemStack getDisplayStack() {
if(forcedStack != null) {
if(!forcedStack.isEmpty()) {
ItemStack retStack = forcedStack;
forcedStack = null;
forcedStack = ItemStack.EMPTY;
return retStack;
}
EnumDyeColor color = world.getBlockState(getPos()).getBlock() != ModBlocks.floatingFlower ? EnumDyeColor.WHITE
@@ -108,7 +108,7 @@ public class TileHourglass extends TileSimpleInventory {
}
public static int getStackItemTime(ItemStack stack) {
if(stack == null)
if(stack.isEmpty())
return 0;
if(stack.getItem() == Item.getItemFromBlock(Blocks.SAND))
return stack.getItemDamage() == 1 ? 200 : 20;
@@ -121,7 +121,7 @@ public class TileIncensePlate extends TileSimpleInventory {
}
public boolean acceptsItem(ItemStack stack) {
return stack != null && stack.getItem() == ModItems.incenseStick && ((ItemIncenseStick) ModItems.incenseStick).getBrew(stack) != BotaniaAPI.fallbackBrew;
return !stack.isEmpty() && stack.getItem() == ModItems.incenseStick && ((ItemIncenseStick) ModItems.incenseStick).getBrew(stack) != BotaniaAPI.fallbackBrew;
}
@Override
@@ -36,7 +36,7 @@ public class TileTinyPotato extends TileSimpleInventory {
if(!stackAt.isEmpty() && stack.isEmpty()) {
player.setHeldItem(hand, stackAt);
getItemHandler().setStackInSlot(index, ItemStack.EMPTY);
} else if(stack != null) {
} else if(!stack.isEmpty()) {
ItemStack copy = stack.copy();
copy.setCount(1);
stack.shrink(1);
@@ -62,7 +62,7 @@ public class TileCorporeaCrystalCube extends TileCorporeaBase implements ICorpor
}
public void setRequestTarget(ItemStack stack) {
if(stack != null) {
if(!stack.isEmpty()) {
ItemStack copy = stack.copy();
copy.setCount(1);
requestTarget = copy;
@@ -35,7 +35,7 @@ public class TileCorporeaFunnel extends TileCorporeaBase implements ICorporeaReq
if(!filter.isEmpty()) {
ItemStack stack = filter.get(world.rand.nextInt(filter.size()));
if(stack != null)
if(!stack.isEmpty())
doCorporeaRequest(stack, stack.getCount(), spark);
}
}
@@ -200,7 +200,7 @@ public class TileCorporeaIndex extends TileCorporeaBase implements ICorporeaRequ
List<ItemStack> stacks = CorporeaHelper.requestItem((String) request, count, spark, true);
spark.onItemsRequested(stacks);
for(ItemStack stack : stacks)
if(stack != null) {
if(!stack.isEmpty()) {
EntityItem item = new EntityItem(world, pos.getX() + 0.5, pos.getY() + 1.5, pos.getZ() + 0.5, stack);
world.spawnEntity(item);
}
@@ -539,7 +539,7 @@ public class TileSpreader extends TileSimpleInventory implements IManaCollector,
}
public ILensControl getLensController(ItemStack stack) {
if(stack != null && stack.getItem() instanceof ILensControl) {
if(!stack.isEmpty() && stack.getItem() instanceof ILensControl) {
ILensControl control = (ILensControl) stack.getItem();
if(control.isControlLens(stack))
return control;
@@ -42,7 +42,7 @@ public class CommandOpen extends CommandBase {
if(sender instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) sender;
ItemStack stack = PlayerHelper.getFirstHeldItemClass(player, ItemLexicon.class);
if(stack != null) {
if(!stack.isEmpty()) {
ItemLexicon.setForcedPage(stack, args[0]);
ItemLexicon.setQueueTicks(stack, 5);
} else sender.sendMessage(new TextComponentTranslation("botaniamisc.noLexicon").setStyle(new Style().setColor(TextFormatting.RED)));
@@ -50,7 +50,7 @@ public final class PixieHandler {
}
float dmg = 4;
if(stack != null && stack.getItem() == ModItems.elementiumSword)
if(!stack.isEmpty() && stack.getItem() == ModItems.elementiumSword)
dmg += 2;
pixie.setProps((EntityLivingBase) event.getSource().getEntity(), player, 0, dmg);
@@ -60,7 +60,7 @@ public final class PixieHandler {
}
private static float getChance(ItemStack stack) {
if(stack == null || !(stack.getItem() instanceof IPixieSpawner))
if(stack.isEmpty() || !(stack.getItem() instanceof IPixieSpawner))
return 0F;
else return ((IPixieSpawner) stack.getItem()).getPixieChance(stack);
}
@@ -86,8 +86,8 @@ public class EntityBabylonWeapon extends EntityThrowableCopy {
EntityPlayer player = (EntityPlayer) thrower;
boolean charging = isCharging();
if(!world.isRemote) {
ItemStack stack = player == null ? null : PlayerHelper.getFirstHeldItem(player, ModItems.kingKey);
boolean newCharging = stack != null && ItemKingKey.isCharging(stack);
ItemStack stack = player == null ? ItemStack.EMPTY : PlayerHelper.getFirstHeldItem(player, ModItems.kingKey);
boolean newCharging = !stack.isEmpty() && ItemKingKey.isCharging(stack);
if(charging != newCharging) {
setCharging(newCharging);
charging = newCharging;
@@ -304,7 +304,7 @@ public class EntityCorporeaSpark extends Entity implements ICorporeaSpark {
}
public boolean doPhantomInk(ItemStack stack) {
if(stack != null && stack.getItem() == ModItems.phantomInk && !world.isRemote) {
if(!stack.isEmpty() && stack.getItem() == ModItems.phantomInk && !world.isRemote) {
int invis = dataManager.get(INVISIBILITY);
dataManager.set(INVISIBILITY, ~invis & 1);
return true;
@@ -383,7 +383,7 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
ItemStack stack = getSourceLens();
NBTTagCompound lensCmp = new NBTTagCompound();
if(stack != null)
if(!stack.isEmpty())
stack.writeToNBT(lensCmp);
par1nbtTagCompound.setTag(TAG_LENS_STACK, lensCmp);
@@ -119,7 +119,7 @@ public class EntitySpark extends Entity implements ISparkEntity {
stacks.addAll(Arrays.asList(baubleStacks));
for(ItemStack stack : stacks) {
if(stack == null || !(stack.getItem() instanceof IManaItem))
if(stack.isEmpty() || !(stack.getItem() instanceof IManaItem))
continue;
IManaItem manaItem = (IManaItem) stack.getItem();
@@ -42,7 +42,7 @@ public class EntityThornChakram extends EntityThrowable {
private static final DataParameter<Integer> RETURN_TO = EntityDataManager.createKey(EntityThornChakram.class, DataSerializers.VARINT);
private static final int MAX_BOUNCES = 16;
private boolean bounced = false;
private ItemStack stack;
private ItemStack stack = ItemStack.EMPTY;
public EntityThornChakram(World world) {
super(world);
@@ -119,7 +119,7 @@ public class EntityThornChakram extends EntityThrowable {
}
private ItemStack getItemStack() {
return stack != null ? stack.copy() : new ItemStack(ModItems.thornChakram, 1, isFire() ? 1 : 0);
return !stack.isEmpty() ? stack.copy() : new ItemStack(ModItems.thornChakram, 1, isFire() ? 1 : 0);
}
@Override
@@ -203,7 +203,7 @@ public class EntityThornChakram extends EntityThrowable {
@Override
public void writeEntityToNBT(NBTTagCompound compound) {
super.writeEntityToNBT(compound);
if(stack != null) {
if(!stack.isEmpty()) {
compound.setTag("fly_stack", stack.writeToNBT(new NBTTagCompound()));
}
compound.setBoolean("flare", isFire());
@@ -152,7 +152,7 @@ public class ItemCacophonium extends ItemMod implements ICraftAchievement {
}
public static void playSound(World world, ItemStack stack, double x, double y, double z, SoundCategory category, float volume) {
if(stack == null)
if(stack.isEmpty())
return;
SoundEvent sound = getSound(stack);
@@ -169,7 +169,7 @@ public class ItemCacophonium extends ItemMod implements ICraftAchievement {
}
private static boolean isDOIT(ItemStack stack) {
return stack != null && stack.getDisplayName().equalsIgnoreCase("shia labeouf");
return !stack.isEmpty() && stack.getDisplayName().equalsIgnoreCase("shia labeouf");
}
@Override
@@ -406,7 +406,7 @@ public class ItemCraftingHalo extends ItemMod implements ICraftAchievement {
public void onRenderWorldLast(RenderWorldLastEvent event) {
EntityPlayer player = Minecraft.getMinecraft().player;
ItemStack stack = PlayerHelper.getFirstHeldItemClass(player, ItemCraftingHalo.class);
if(stack != null)
if(!stack.isEmpty())
render(stack, player, event.getPartialTicks());
}
@@ -464,7 +464,7 @@ public class ItemCraftingHalo extends ItemMod implements ICraftAchievement {
inside = true;
ItemStack slotStack = getItemForSlot(stack, seg);
if(slotStack != null) {
if(!slotStack.isEmpty()) {
mc.renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
RenderHelper.enableStandardItemLighting();
float scale = seg == 0 ? 0.9F : 0.8F;
@@ -565,7 +565,7 @@ public class ItemCraftingHalo extends ItemMod implements ICraftAchievement {
public static void renderRecipe(ScaledResolution resolution, String label, ItemStack[] recipe, EntityPlayer player, boolean setRecipe) {
Minecraft mc = Minecraft.getMinecraft();
if(recipe[9] != null) {
if(!recipe[9].isEmpty()) {
int x = resolution.getScaledWidth() / 2 - 45;
int y = resolution.getScaledHeight() / 2 - 90;
@@ -579,7 +579,7 @@ public class ItemCraftingHalo extends ItemMod implements ICraftAchievement {
GlStateManager.enableRescaleNormal();
for(int i = 0; i < 9; i++) {
ItemStack stack = recipe[i];
if(stack != null) {
if(!stack.isEmpty()) {
int xpos = x + i % 3 * 18;
int ypos = y + i / 3 * 18;
Gui.drawRect(xpos, ypos, xpos + 16, ypos + 16, 0x22000000);
@@ -77,7 +77,7 @@ public class ItemEnderHand extends ItemMod implements IManaUsingItem, IBlockProv
return false;
ItemStack istack = ItemExchangeRod.removeFromInventory(player, player.getInventoryEnderChest(), stack, block, meta, false);
if(istack != null) {
if(!istack.isEmpty()) {
boolean mana = ManaItemHandler.requestManaExact(stack, player, COST_PROVIDE, false);
if(mana) {
if(doit) {
@@ -49,7 +49,7 @@ public class ItemIncenseStick extends ItemMod implements IBrewItem, IBrewContain
super.getSubItems(item, tab, list);
for(String s : BotaniaAPI.brewMap.keySet()) {
ItemStack brewStack = getItemForBrew(BotaniaAPI.brewMap.get(s), new ItemStack(this));
if(brewStack != null)
if(!brewStack.isEmpty())
list.add(brewStack);
}
}
@@ -361,7 +361,7 @@ public class ItemBaubleCosmetic extends ItemBauble implements ICosmeticBauble {
// Copy of RenderItem.renderQuads
private void renderQuads(VertexBuffer renderer, List<BakedQuad> quads, int color, ItemStack stack)
{
boolean flag = color == -1 && stack != null;
boolean flag = color == -1 && !stack.isEmpty();
int i = 0;
for (int j = quads.size(); i < j; ++i)
@@ -64,7 +64,7 @@ public class ItemBloodPendant extends ItemBauble implements IBrewContainer, IBre
super.getSubItems(item, tab, list);
for(String s : BotaniaAPI.brewMap.keySet()) {
ItemStack brewStack = getItemForBrew(BotaniaAPI.brewMap.get(s), new ItemStack(this));
if(brewStack != null)
if(!brewStack.isEmpty())
list.add(brewStack);
}
}
@@ -120,7 +120,7 @@ public class ItemItemFinder extends ItemBauble implements IBaubleRender {
}
private void scanForStack(ItemStack pstack, EntityPlayer player, TIntArrayList entIdBuilder, TLongArrayList blockPosBuilder) {
if(pstack != null || player.isSneaking()) {
if(!pstack.isEmpty() || player.isSneaking()) {
int range = 24;
List<Entity> entities = player.world.getEntitiesWithinAABB(Entity.class, new AxisAlignedBB(player.posX - range, player.posY - range, player.posZ - range, player.posX + range, player.posY + range, player.posZ + range));
@@ -152,7 +152,7 @@ public class ItemItemFinder extends ItemBauble implements IBaubleRender {
} else if(e instanceof EntityVillager) {
EntityVillager villager = (EntityVillager) e;
ArrayList<MerchantRecipe> recipes = villager.getRecipes(player);
if(pstack != null && recipes != null)
if(!pstack.isEmpty() && recipes != null)
for(MerchantRecipe recipe : recipes)
if(recipe != null && !recipe.isRecipeDisabled() && (equalStacks(pstack, recipe.getItemToBuy()) || equalStacks(pstack, recipe.getItemToSell()))) {
entIdBuilder.add(villager.getEntityId());
@@ -162,7 +162,7 @@ public class ItemItemFinder extends ItemBauble implements IBaubleRender {
}
}
if(pstack != null) {
if(!pstack.isEmpty()) {
range = 12;
BlockPos pos = new BlockPos(player);
for(BlockPos pos_ : BlockPos.getAllInBoxMutable(pos.add(-range, -range, -range), pos.add(range + 1, range + 1, range + 1))) {
@@ -193,7 +193,7 @@ public class ItemItemFinder extends ItemBauble implements IBaubleRender {
}
private boolean scanInventory(IItemHandler inv, ItemStack pstack) {
if(pstack == null)
if(pstack.isEmpty())
return false;
for(int l = 0; l < inv.getSlots(); l++) {
@@ -43,7 +43,7 @@ public class ItemKnockbackBelt extends ItemBaubleModifier implements IBaubleRend
@Override
void fillModifiers(Multimap<String, AttributeModifier> attributes, ItemStack stack) {
if(stack == null) // workaround for Azanor/Baubles#156
if(stack.isEmpty()) // workaround for Azanor/Baubles#156
return;
attributes.put(SharedMonsterAttributes.KNOCKBACK_RESISTANCE.getName(), new AttributeModifier(getBaubleUUID(stack), "Bauble modifier", 1, 0));
@@ -75,7 +75,7 @@ public class ItemMonocle extends ItemBauble implements IBurstViewerBauble, ICosm
Block block = state.getBlock();
player.world.getTileEntity(pos.getBlockPos());
ItemStack dispStack = null;
ItemStack dispStack = ItemStack.EMPTY;
String text = "";
if(block == Blocks.REDSTONE_WIRE) {
@@ -89,7 +89,7 @@ public class ItemMonocle extends ItemBauble implements IBurstViewerBauble, ICosm
text = state.getValue(BlockRedstoneComparator.MODE) == BlockRedstoneComparator.Mode.SUBTRACT ? "-" : "+";
}
if(dispStack == null)
if(dispStack.isEmpty())
return;
int x = resolution.getScaledWidth() / 2 + 15;
@@ -111,7 +111,7 @@ public final class ToolCommons {
}
public static int getToolPriority(ItemStack stack) {
if(stack == null)
if(stack.isEmpty())
return 0;
Item item = stack.getItem();
@@ -115,12 +115,12 @@ public class ItemLivingwoodBow extends ItemBow implements IManaUsingItem, IModel
int i = (int) ((getMaxItemUseDuration(stack) - useTicks) * chargeVelocityMultiplier()); // Botania - velocity multiplier
if(isPlayer)
i = net.minecraftforge.event.ForgeEventFactory.onArrowLoose(stack, world, player, i, itemstack != null || flag);
i = net.minecraftforge.event.ForgeEventFactory.onArrowLoose(stack, world, player, i, !itemstack.isEmpty() || flag);
if (i < 0) return;
if (itemstack != null || flag)
if (!itemstack.isEmpty() || flag)
{
if (itemstack == null)
if (itemstack.isEmpty())
{
itemstack = new ItemStack(Items.ARROW);
}
@@ -120,7 +120,7 @@ public class ItemAesirRing extends ItemRelicBauble implements IWireframeCoordina
private void fillModifiers(Multimap<String, AttributeModifier> attributes, ItemStack stack) {
if(stack == null) // workaround for Azanor/Baubles#156
if(stack.isEmpty()) // workaround for Azanor/Baubles#156
return;
attributes.put(SharedMonsterAttributes.MAX_HEALTH.getName(), new AttributeModifier(getBaubleUUID(stack), "Bauble modifier", 20, 0));
@@ -201,7 +201,7 @@ public class ItemLokiRing extends ItemRelicBauble implements IWireframeCoordinat
}
private static boolean isLokiRing(ItemStack stack) {
return stack != null && (stack.getItem() == ModItems.lokiRing || stack.getItem() == ModItems.aesirRing);
return !stack.isEmpty() && (stack.getItem() == ModItems.lokiRing || stack.getItem() == ModItems.aesirRing);
}
private static BlockPos getOriginPos(ItemStack stack) {
@@ -82,7 +82,7 @@ public class ItemOdinRing extends ItemRelicBauble {
}
private static boolean isOdinRing(ItemStack stack) {
return stack != null && (stack.getItem() == ModItems.odinRing || stack.getItem() == ModItems.aesirRing);
return !stack.isEmpty() && (stack.getItem() == ModItems.odinRing || stack.getItem() == ModItems.aesirRing);
}
@Override
@@ -100,7 +100,7 @@ public class ItemOdinRing extends ItemRelicBauble {
}
void fillModifiers(Multimap<String, AttributeModifier> attributes, ItemStack stack) {
if(stack == null) // workaround for Azanor/Baubles#156
if(stack.isEmpty()) // workaround for Azanor/Baubles#156
return;
attributes.put(SharedMonsterAttributes.MAX_HEALTH.getName(), new AttributeModifier(getBaubleUUID(stack), "Bauble modifier", 20, 0));
@@ -95,7 +95,7 @@ public class ItemRelic extends ItemMod implements IRelic {
}
public void updateRelic(ItemStack stack, EntityPlayer player) {
if(stack == null || !(stack.getItem() instanceof IRelic))
if(stack.isEmpty() || !(stack.getItem() instanceof IRelic))
return;
boolean rightPlayer = true;
@@ -37,7 +37,7 @@ public class ItemThorRing extends ItemRelicBauble {
}
private static boolean isThorRing(ItemStack stack) {
return stack != null && (stack.getItem() == ModItems.thorRing || stack.getItem() == ModItems.aesirRing);
return !stack.isEmpty() && (stack.getItem() == ModItems.thorRing || stack.getItem() == ModItems.aesirRing);
}
}
@@ -219,7 +219,7 @@ public class ItemExchangeRod extends ItemMod implements IManaUsingItem, IWirefra
return false;
ItemStack placeStack = removeFromInventory(player, stack, state.getBlock(), state.getBlock().getMetaFromState(state), false);
if(placeStack != null) {
if(!placeStack.isEmpty()) {
IBlockState stateAt = world.getBlockState(pos);
Block blockAt = stateAt.getBlock();
if(!blockAt.isAir(world.getBlockState(pos), world, pos) && stateAt.getPlayerRelativeBlockHardness(player, world, pos) > 0 && stateAt != state) {
@@ -275,7 +275,7 @@ public class ItemExchangeRod extends ItemMod implements IManaUsingItem, IWirefra
return new ItemStack(block, 1, meta);
}
return null;
return ItemStack.EMPTY;
}
public static ItemStack removeFromInventory(EntityPlayer player, ItemStack stack, Block block, int meta, boolean doit) {
@@ -283,7 +283,7 @@ public class ItemExchangeRod extends ItemMod implements IManaUsingItem, IWirefra
return new ItemStack(block, 1, meta);
ItemStack outStack = removeFromInventory(player, BotaniaAPI.internalHandler.getBaublesInventory(player), stack, block, meta, doit);
if (outStack == null)
if (outStack.isEmpty())
outStack = removeFromInventory(player, player.inventory, stack, block, meta, doit);
return outStack;
}
@@ -39,7 +39,7 @@ import vazkii.botania.common.core.helper.PlayerHelper;
public class PageRecipe extends LexiconPage {
int relativeMouseX, relativeMouseY;
ItemStack tooltipStack, tooltipContainerStack;
ItemStack tooltipStack = ItemStack.EMPTY, tooltipContainerStack = ItemStack.EMPTY;
boolean tooltipEntry;
static boolean mouseDownLastTick = false;
@@ -62,7 +62,7 @@ public class PageRecipe extends LexiconPage {
int y = gui.getTop() + height - 40;
PageText.renderText(x, y, width, height, getUnlocalizedName());
if(tooltipStack != null) {
if(!tooltipStack.isEmpty()) {
List<String> tooltipData = tooltipStack.getTooltip(Minecraft.getMinecraft().player, false);
List<String> parsedTooltip = new ArrayList<>();
boolean first = true;
@@ -84,7 +84,7 @@ public class PageRecipe extends LexiconPage {
tooltipY += 18;
}
if(tooltipContainerStack != null)
if(!tooltipContainerStack.isEmpty())
vazkii.botania.client.core.helper.RenderHelper.renderTooltipGreen(mx, my + tooltipY, Arrays.asList(TextFormatting.AQUA + I18n.format("botaniamisc.craftingContainer"), tooltipContainerStack.getDisplayName()));
}
@@ -76,7 +76,7 @@ public class PageShedding extends PageEntity {
GlStateManager.color(1F, 1F, 1F, 1F);
((GuiScreen) gui).drawTexturedModalRect(gui.getLeft(), gui.getTop(), 0, 0, gui.getWidth(), gui.getHeight());
if(tooltipStack != null) {
if(!tooltipStack.isEmpty()) {
List<String> tooltipData = tooltipStack.getTooltip(Minecraft.getMinecraft().player, false);
List<String> parsedTooltip = new ArrayList<>();
boolean first = true;
@@ -13,11 +13,11 @@ package vazkii.botania.common.lib;
public final class LibMisc {
// Mod Constants
public static final String MOD_ID = "Botania";
public static final String MOD_ID = "botania";
public static final String MOD_NAME = MOD_ID;
public static final String BUILD = "GRADLE:BUILD";
public static final String VERSION = "GRADLE:VERSION-" + BUILD;
public static final String DEPENDENCIES = "required-after:Forge@[12.18.1.2053,];required-after:Baubles@[1.3.BETA8,];after:Thaumcraft";
public static final String DEPENDENCIES = "required-after:forge@[13.20.0.2201,];required-after:baubles@[1.4.2,];after:thaumcraft";
// Network Contants
public static final String NETWORK_CHANNEL = MOD_ID;