Fix nullable annotation stuff + some stack nulls. Closes #2162

This commit is contained in:
Vincent Lee committed 2017-02-20 23:04:37 -06:00
1 parent 0d1324c45d
commit 6e5f757518
16 files changed
+25 -24

No files matched your search

@@ -76,9 +76,6 @@ public final class AstrolabePreviewHandler {
private static void renderBlockAt(Block block, int meta, BlockPos pos) {
IBlockState state = block.getStateFromMeta(meta);
if(state == null)
return;
double renderPosX, renderPosY, renderPosZ;
@@ -10,7 +10,7 @@
*/
package vazkii.botania.client.render.tile;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.lwjgl.opengl.GL11;
@@ -41,7 +41,7 @@ public class RenderTileAvatar extends TileEntitySpecialRenderer<TileAvatar> {
private static final ModelAvatar model = new ModelAvatar();
@Override
public void renderTileEntityAt(@Nonnull TileAvatar avatar, double d0, double d1, double d2, float pticks, int digProgress) {
public void renderTileEntityAt(@Nullable TileAvatar avatar, double d0, double d1, double d2, float pticks, int digProgress) {
if (avatar != null)
if (!avatar.getWorld().isBlockLoaded(avatar.getPos(), false)
|| avatar.getWorld().getBlockState(avatar.getPos()).getBlock() != ModBlocks.avatar)
@@ -10,7 +10,7 @@
*/
package vazkii.botania.client.render.tile;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
@@ -31,7 +31,7 @@ public class RenderTileBellows extends TileEntitySpecialRenderer<TileBellows> {
private static final ModelBellows model = new ModelBellows();
@Override
public void renderTileEntityAt(@Nonnull TileBellows bellows, double d0, double d1, double d2, float f, int digProgress) {
public void renderTileEntityAt(@Nullable TileBellows bellows, double d0, double d1, double d2, float f, int digProgress) {
if (bellows != null)
if (!bellows.getWorld().isBlockLoaded(bellows.getPos(), false)
|| bellows.getWorld().getBlockState(bellows.getPos()).getBlock() != ModBlocks.bellows)
@@ -11,6 +11,7 @@
package vazkii.botania.client.render.tile;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
@@ -31,7 +32,7 @@ public class RenderTileBrewery extends TileEntitySpecialRenderer<TileBrewery> {
public TileBrewery brewery;
@Override
public void renderTileEntityAt(@Nonnull TileBrewery brewery, double d0, double d1, double d2, float f, int digProgress) {
public void renderTileEntityAt(@Nullable TileBrewery brewery, double d0, double d1, double d2, float f, int digProgress) {
this.brewery = brewery;
GlStateManager.pushMatrix();
GlStateManager.enableRescaleNormal();
@@ -10,7 +10,7 @@
*/
package vazkii.botania.client.render.tile;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import net.minecraft.client.Minecraft;
import net.minecraft.client.model.ModelEnderCrystal;
@@ -28,7 +28,7 @@ public class RenderTileCorporeaIndex extends TileEntitySpecialRenderer<TileCorpo
public static boolean move = true;
@Override
public void renderTileEntityAt(@Nonnull TileCorporeaIndex index, double x, double y, double z, float partticks, int digProgress) {
public void renderTileEntityAt(@Nullable TileCorporeaIndex index, double x, double y, double z, float partticks, int digProgress) {
move = index != null;
GlStateManager.pushMatrix();
@@ -12,7 +12,7 @@ package vazkii.botania.client.render.tile;
import java.util.Random;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.lwjgl.opengl.GL11;
@@ -32,7 +32,7 @@ public class RenderTileHourglass extends TileEntitySpecialRenderer<TileHourglass
final ModelHourglass model = new ModelHourglass();
@Override
public void renderTileEntityAt(@Nonnull TileHourglass hourglass, double d0, double d1, double d2, float ticks, int digProgress) {
public void renderTileEntityAt(@Nullable TileHourglass hourglass, double d0, double d1, double d2, float ticks, int digProgress) {
GlStateManager.pushMatrix();
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
@@ -12,7 +12,7 @@ package vazkii.botania.client.render.tile;
import java.util.Random;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.lwjgl.opengl.GL11;
@@ -33,7 +33,7 @@ public class RenderTileTeruTeruBozu extends TileEntitySpecialRenderer<TileTeruTe
final ModelTeruTeruBozu model = new ModelTeruTeruBozu();
@Override
public void renderTileEntityAt(@Nonnull TileTeruTeruBozu tileentity, double d0, double d1, double d2, float f, int digProgress) {
public void renderTileEntityAt(@Nullable TileTeruTeruBozu tileentity, double d0, double d1, double d2, float f, int digProgress) {
GlStateManager.pushMatrix();
GlStateManager.enableRescaleNormal();
GlStateManager.enableBlend();
@@ -111,7 +111,7 @@ public class BlockCacophonium extends BlockMod {
if(tile != null && tile instanceof TileCacophonium) {
stacks.add(new ItemStack(Blocks.NOTEBLOCK));
ItemStack thingy = ((TileCacophonium) tile).stack;
if(thingy != null)
if(!thingy.isEmpty())
stacks.add(thingy.copy());
}
@@ -81,7 +81,7 @@ public class BlockModFlower extends BlockFlower implements ILexiconable, IPickup
@Nonnull
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess world, BlockPos pos) {
public AxisAlignedBB getBoundingBox(IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos) {
return AABB;
}
@@ -135,7 +135,7 @@ public class BlockSpecialFlower extends BlockFlower implements ISpecialFlower, I
@Nonnull
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess world, BlockPos pos) {
public AxisAlignedBB getBoundingBox(IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos) {
return AABB;
}
@@ -43,7 +43,7 @@ public class BlockBuriedPetals extends BlockModFlower {
@Nonnull
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess world, BlockPos pos) {
public AxisAlignedBB getBoundingBox(IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos) {
return AABB;
}
@@ -54,8 +54,10 @@ public class BlackHoleTalismanExtractRecipe implements IRecipe {
int count = ItemBlackHoleTalisman.getBlockCount(talisman);
if(count > 0) {
Block block = ItemBlackHoleTalisman.getBlock(talisman);
int meta = ItemBlackHoleTalisman.getBlockMeta(talisman);
return new ItemStack(block, Math.min(64, count), meta);
if(block != null) {
int meta = ItemBlackHoleTalisman.getBlockMeta(talisman);
return new ItemStack(block, Math.min(64, count), meta);
}
}
return ItemStack.EMPTY;
@@ -10,6 +10,7 @@
*/
package vazkii.botania.common.item.equipment.armor.manaweave;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import net.minecraft.entity.EntityLivingBase;
@@ -49,7 +50,7 @@ public class ItemManaweaveHelm extends ItemManaweaveArmor implements IManaDiscou
}
@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);
}
@@ -75,7 +75,7 @@ public class ItemManasteelAxe extends ItemAxe implements IManaUsingItem, ISortab
}
@Override
public boolean onBlockDestroyed(@Nonnull ItemStack stack, @Nonnull World world, IBlockState state, @Nonnull BlockPos pos, @Nonnull EntityLivingBase entity) {
public boolean onBlockDestroyed(@Nonnull ItemStack stack, @Nonnull World world, @Nonnull IBlockState state, @Nonnull BlockPos pos, @Nonnull EntityLivingBase entity) {
if (state.getBlockHardness(world, pos) != 0F)
ToolCommons.damageItem(stack, 1, entity, getManaPerDamage());
@@ -75,7 +75,7 @@ public class ItemManasteelPick extends ItemPickaxe implements IManaUsingItem, IS
}
@Override
public boolean onBlockDestroyed(@Nonnull ItemStack stack, @Nonnull World world, IBlockState state, @Nonnull BlockPos pos, @Nonnull EntityLivingBase entity) {
public boolean onBlockDestroyed(@Nonnull ItemStack stack, @Nonnull World world, @Nonnull IBlockState state, @Nonnull BlockPos pos, @Nonnull EntityLivingBase entity) {
if(state.getBlockHardness(world, pos) != 0F)
ToolCommons.damageItem(stack, 1, entity, getManaPerDmg());
@@ -75,7 +75,7 @@ public class ItemManasteelShovel extends ItemSpade implements IManaUsingItem, IS
}
@Override
public boolean onBlockDestroyed(@Nonnull ItemStack stack, @Nonnull World world, IBlockState state, @Nonnull BlockPos pos, @Nonnull EntityLivingBase entity) {
public boolean onBlockDestroyed(@Nonnull ItemStack stack, @Nonnull World world, @Nonnull IBlockState state, @Nonnull BlockPos pos, @Nonnull EntityLivingBase entity) {
if (state.getBlockHardness(world, pos) != 0F)
ToolCommons.damageItem(stack, 1, entity, MANA_PER_DAMAGE);