A couple more nulls

This commit is contained in:
Vincent Lee committed 2017-01-16 14:29:16 -06:00
1 parent ec94aa640d
commit b04d6bbefa
8 files changed
+17 -21

No files matched your search

@@ -33,7 +33,7 @@ public interface IManaProficiencyArmor {
return false;
}
default boolean shouldGiveProficiency(ItemStack armorStack, EntityEquipmentSlot slot, EntityPlayer player, @Nullable ItemStack rod) {
default boolean shouldGiveProficiency(ItemStack armorStack, EntityEquipmentSlot slot, EntityPlayer player, ItemStack rod) {
return shouldGiveProficiency(armorStack, slot, player);
}
@@ -41,10 +41,10 @@ public interface IManaProficiencyArmor {
@Deprecated
public static boolean hasProficiency(EntityPlayer player) {
return hasProficiency(player, null);
return hasProficiency(player, ItemStack.EMPTY);
}
public static boolean hasProficiency(EntityPlayer player, @Nullable ItemStack rod) {
public static boolean hasProficiency(EntityPlayer player, ItemStack rod) {
boolean proficient = false;
for(EntityEquipmentSlot e: EntityEquipmentSlot.values()) {
@@ -130,13 +130,10 @@ public class LexiconEntry implements Comparable<LexiconEntry> {
public List<ItemStack> getDisplayedRecipes() {
ArrayList<ItemStack> list = new ArrayList<>();
for(LexiconPage page : pages) {
List<ItemStack> l = page.getDisplayedRecipes();
ArrayList<ItemStack> itemsAddedThisPage = new ArrayList<>();
if(l != null) {
ArrayList<ItemStack> itemsAddedThisPage = new ArrayList<>();
for(ItemStack s : l) {
addItem: {
for(ItemStack s : page.getDisplayedRecipes()) {
addItem: {
for(ItemStack s1 : itemsAddedThisPage)
if(s1.getItem() == s.getItem())
break addItem;
@@ -147,7 +144,6 @@ public class LexiconEntry implements Comparable<LexiconEntry> {
itemsAddedThisPage.add(s);
list.add(s);
}
}
}
}
@@ -12,6 +12,7 @@ package vazkii.botania.api.lexicon;
import java.util.List;
import com.google.common.collect.ImmutableList;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.Side;
@@ -84,10 +85,10 @@ public abstract class LexiconPage {
/**
* Shows the list of recipes present in this page for display in the category
* page. Can return null for an entry with no recipes.
* page.
*/
public List<ItemStack> getDisplayedRecipes() {
return null;
return ImmutableList.of();
}
public String getUnlocalizedName() {
@@ -35,7 +35,7 @@ public final class LexiconRecipeMappings {
if(force || !mappings.containsKey(str))
mappings.put(str, data);
if(entry.getIcon() == null)
if(entry.getIcon().isEmpty())
entry.setIcon(stack.copy());
}
@@ -22,7 +22,7 @@ public class ManaDiscountEvent extends Event {
private float discount;
private ItemStack tool;
public ManaDiscountEvent(EntityPlayer entityPlayer, float discount, @Nullable ItemStack tool) {
public ManaDiscountEvent(EntityPlayer entityPlayer, float discount, ItemStack tool) {
this.entityPlayer = entityPlayer;
this.discount = discount;
this.tool = tool;
@@ -30,10 +30,10 @@ public class ManaDiscountEvent extends Event {
@Deprecated
public ManaDiscountEvent(EntityPlayer entityPlayer, float discount) {
this(entityPlayer, discount, null);
this(entityPlayer, discount, ItemStack.EMPTY);
}
@Nullable
public ItemStack getTool() {
return tool;
}
@@ -197,7 +197,7 @@ public class SubTileGenerating extends SubTileEntity {
public void populateDropStackNBTs(List<ItemStack> drops) {
if(isPassiveFlower() && ticksExisted > 0 && BotaniaAPI.internalHandler.getPassiveFlowerDecay() > 0) {
ItemStack drop = drops.get(0);
if(drop != null) {
if(!drop.isEmpty()) {
if(!drop.hasTagCompound())
drop.setTagCompound(new NBTTagCompound());
NBTTagCompound cmp = drop.getTagCompound();
@@ -75,9 +75,8 @@ public final class BoundTileRenderer {
if(!stackInSlot.isEmpty() && stackInSlot.getItem() instanceof IWireframeCoordinateListProvider) {
IWireframeCoordinateListProvider provider = (IWireframeCoordinateListProvider) stackInSlot.getItem();
List<BlockPos> coordsList = provider.getWireframesToDraw(player, stackInSlot);
if(coordsList != null)
for(BlockPos coords : coordsList)
renderBlockOutlineAt(coords, color);
for(BlockPos coords : coordsList)
renderBlockOutlineAt(coords, color);
BlockPos coords = provider.getSourceWireframe(player, stackInSlot);
if(coords != null && coords.getY() > -1)
@@ -734,7 +734,7 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
private ILensEffect getLensInstance() {
ItemStack lens = getSourceLens();
if(lens != null && lens.getItem() instanceof ILensEffect)
if(!lens.isEmpty() && lens.getItem() instanceof ILensEffect)
return (ILensEffect) lens.getItem();
return null;