Clean up some null annotations

This commit is contained in:
mezz committed 2017-04-19 00:52:10 -07:00
1 parent cc20e2d339
commit 3bb678258f
29 files changed
+97 -38

No files matched your search

@@ -104,10 +104,12 @@ public class BlockCeramic extends Block implements IColoredBlock, IItemModelRegi
@SideOnly(Side.CLIENT)
@Override
public int colorMultiplier(IBlockState state, IBlockAccess world, BlockPos pos, int tintIndex) {
TileCeramic ceramic = TileUtil.getTile(world, pos, TileCeramic.class);
if (ceramic != null) {
return ceramic.getColor().getColor(false);
public int colorMultiplier(IBlockState state, @Nullable IBlockAccess world, @Nullable BlockPos pos, int tintIndex) {
if (world != null && pos != null) {
TileCeramic ceramic = TileUtil.getTile(world, pos, TileCeramic.class);
if (ceramic != null) {
return ceramic.getColor().getColor(false);
}
}
return EnumFlowerColor.get(0).getColor(false);
}
@@ -176,7 +176,7 @@ public class BlockStainedGlass extends Block implements IBlockMetadata, IColored
}
@Override
public int colorMultiplier(IBlockState state, IBlockAccess worldIn, BlockPos pos, int tintIndex) {
public int colorMultiplier(IBlockState state, @Nullable IBlockAccess worldIn, @Nullable BlockPos pos, int tintIndex) {
if (worldIn == null || pos == null) {
return 0;
}
@@ -187,13 +187,15 @@ public class BlockCeramicBrick extends Block implements IMultipassBlock<CeramicB
@SideOnly(Side.CLIENT)
@Override
public int colorMultiplier(IBlockState state, IBlockAccess world, BlockPos pos, int tintIndex) {
TileCeramicBrick ceramic = TileUtil.getTile(world, pos, TileCeramicBrick.class);
if (ceramic != null) {
if (tintIndex == 1) {
return ceramic.getColorFirst().getColor(false);
} else if (tintIndex == 2) {
return ceramic.getColorSecond().getColor(false);
public int colorMultiplier(IBlockState state, @Nullable IBlockAccess world, @Nullable BlockPos pos, int tintIndex) {
if (world != null && pos != null) {
TileCeramicBrick ceramic = TileUtil.getTile(world, pos, TileCeramicBrick.class);
if (ceramic != null) {
if (tintIndex == 1) {
return ceramic.getColorFirst().getColor(false);
} else if (tintIndex == 2) {
return ceramic.getColorSecond().getColor(false);
}
}
}
return 16777215;
@@ -170,8 +170,8 @@ public class BlockFlower extends BlockContainer implements IColoredBlock, IState
@Override
@SideOnly(Side.CLIENT)
public int colorMultiplier(IBlockState state, IBlockAccess world, BlockPos pos, int tintIndex) {
if (pos != null) {
public int colorMultiplier(IBlockState state, @Nullable IBlockAccess world, @Nullable BlockPos pos, int tintIndex) {
if (world != null && pos != null) {
TileEntity tile = world.getTileEntity(pos);
if (tile instanceof TileEntityFlower) {
TileEntityFlower flower = (TileEntityFlower) tile;
@@ -422,6 +422,7 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt
return true;
}
@Nullable
public GameProfile getOwner() {
return this.owner;
}
@@ -507,6 +508,7 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt
}
@Override
@Nullable
public IButterfly getCaterpillar() {
return this.caterpillar;
}
@@ -517,7 +519,7 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt
}
@Override
public void setCaterpillar(final IButterfly butterfly) {
public void setCaterpillar(@Nullable final IButterfly butterfly) {
this.caterpillar = butterfly;
this.matureTime = 0;
}
@@ -1,6 +1,6 @@
package binnie.core.craftgui.geometry;
public class Area {
public final class Area {
private Point pos;
private Point size;
@@ -25,8 +25,8 @@ public class Area {
}
public Area(final int x, final int y, final int w, final int h) {
this.setPosition(new Point(x, y));
this.setSize(new Point(w, h));
this.pos = new Point(x, y);
this.size = new Point(w, h);
}
public Point pos() {
@@ -100,7 +100,6 @@ public class ContainerCraftGUI extends Container {
}
}
@Nullable
@Override
public ItemStack slotClick(int slotNum, int dragType, ClickType clickType, EntityPlayer player) {
final Slot slot = this.getSlot(slotNum);
@@ -160,7 +160,6 @@ public class WindowInventory implements IInventory {
}
@Nullable
@Override
public ItemStack removeStackFromSlot(int index) {
return this.inventory.remove(index);
@@ -159,14 +159,14 @@ public class RenderUtil {
GuiUtils.drawGradientRect(0, area.pos().x(), area.pos().y(), area.pos().x() + area.size().x(), area.pos().y() + area.size().y(), startColor, endColor);
}
public static void drawSprite(final Point pos, final TextureAtlasSprite icon) {
public static void drawSprite(final Point pos, @Nullable final TextureAtlasSprite icon) {
if (icon != null) {
BinnieCore.getBinnieProxy().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
drawTexture(pos.x(), pos.y(), icon, 0, 0, 0);
}
}
public static void drawGuiSprite(final Point pos, final TextureAtlasSprite icon) {
public static void drawGuiSprite(final Point pos, @Nullable final TextureAtlasSprite icon) {
if (icon != null) {
BinnieCore.getBinnieProxy().bindTexture(ForestryAPI.textureManager.getGuiTextureMap());
drawTexture(pos.x(), pos.y(), icon, 0, 0, 0);
@@ -19,6 +19,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.Collections;
@@ -44,7 +45,7 @@ public class VirtualBeeHousing extends VirtualHousing implements IBeeHousing, IB
}
@Override
public float getLifespanModifier(final IBeeGenome genome, final IBeeGenome mate, final float currentModifier) {
public float getLifespanModifier(final IBeeGenome genome, @Nullable final IBeeGenome mate, final float currentModifier) {
return 1.0f;
}
@@ -26,7 +26,7 @@ public class VirtualMothHousing extends VirtualHousing implements IButterflyNurs
}
@Override
public void setCaterpillar(final IButterfly butterfly) {
public void setCaterpillar(@Nullable final IButterfly butterfly) {
}
@Override
@@ -170,7 +170,7 @@ public class ItemFluidContainer extends ItemFood implements IItemModelRegister {
}
@Override
public ICapabilityProvider initCapabilities(ItemStack stack, NBTTagCompound nbt) {
public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable NBTTagCompound nbt) {
return new FluidHandlerItemBinnie(stack, container);
}
@@ -260,6 +260,7 @@ public class Machine implements INetworkedEntity, INbtReadable, INbtWritable, IN
}
@Override
@Nullable
public GameProfile getOwner() {
return this.owner;
}
@@ -235,7 +235,7 @@ public class AABBModelBaker implements IModelBaker {
}
@Override
public void setModelState(IModelState modelState) {
public void setModelState(@Nullable IModelState modelState) {
currentModel.setModelState(modelState);
}
@@ -38,6 +38,8 @@ import net.minecraftforge.common.model.IModelState;
import net.minecraftforge.common.model.TRSRTransformation;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -206,7 +208,7 @@ public class ModelManager implements IModelManager {
}
@Override
public int colorMultiplier(IBlockState state, IBlockAccess worldIn, BlockPos pos, int tintIndex) {
public int colorMultiplier(IBlockState state, @Nullable IBlockAccess worldIn, @Nullable BlockPos pos, int tintIndex) {
Block block = state.getBlock();
if (block instanceof IColoredBlock) {
return ((IColoredBlock) block).colorMultiplier(state, worldIn, pos, tintIndex);
@@ -9,6 +9,8 @@ import forestry.api.apiculture.IBeeModifier;
import forestry.api.genetics.IIndividual;
import net.minecraft.item.ItemStack;
import javax.annotation.Nullable;
public class ComponentBeeModifier extends MachineComponent implements IBeeModifier, IBeeListener {
public ComponentBeeModifier(final Machine machine) {
super(machine);
@@ -25,7 +27,7 @@ public class ComponentBeeModifier extends MachineComponent implements IBeeModifi
}
@Override
public float getLifespanModifier(final IBeeGenome genome, final IBeeGenome mate, final float currentModifier) {
public float getLifespanModifier(final IBeeGenome genome, @Nullable final IBeeGenome mate, final float currentModifier) {
return 1.0f;
}
@@ -6,6 +6,8 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import javax.annotation.Nullable;
public enum IndustrialFrame implements IBeeModifier {
Empty("Empty", 5, 0),
Light("Glowstone Lighting", 2, 4),
@@ -69,7 +71,7 @@ public enum IndustrialFrame implements IBeeModifier {
}
@Override
public float getLifespanModifier(final IBeeGenome genome, final IBeeGenome mate, final float currentModifier) {
public float getLifespanModifier(final IBeeGenome genome, @Nullable final IBeeGenome mate, final float currentModifier) {
return this.lifespanMod;
}
@@ -132,7 +132,7 @@ public class AlvearyStimulator {
}
@Override
public float getLifespanModifier(final IBeeGenome genome, final IBeeGenome mate, final float currentModifier) {
public float getLifespanModifier(final IBeeGenome genome, @Nullable final IBeeGenome mate, final float currentModifier) {
float mod = 1.0f;
if (!this.powered) {
return mod;
@@ -260,7 +260,7 @@ public class AlvearyStimulator {
}
@Override
public float getLifespanModifier(final IBeeGenome genome, final IBeeGenome mate, final float currentModifier) {
public float getLifespanModifier(final IBeeGenome genome, @Nullable final IBeeGenome mate, final float currentModifier) {
return this.type.getLifespanModifier(genome, mate, currentModifier);
}
@@ -348,7 +348,7 @@ public class AlvearyStimulator {
}
@Override
public float getLifespanModifier(final IBeeGenome genome, final IBeeGenome mate, final float currentModifier) {
public float getLifespanModifier(final IBeeGenome genome, @Nullable final IBeeGenome mate, final float currentModifier) {
return this.logic.getModifier(EnumBeeModifier.Lifespan, currentModifier);
}
@@ -5,7 +5,6 @@ import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import javax.annotation.Nullable;
import java.util.Random;
public class BlockEctoplasm extends BlockWeb {
@@ -26,7 +25,6 @@ public class BlockEctoplasm extends BlockWeb {
return (rand.nextInt(5) == 0) ? 1 : 0;
}
@Nullable
@Override
public Item getItemDropped(IBlockState state, Random rand, int fortune) {
return Items.SLIME_BALL;
@@ -34,6 +34,7 @@ import net.minecraftforge.common.IShearable;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -221,7 +222,7 @@ public abstract class BlockETDecorativeLeaves extends Block implements IItemMode
@Override
@SideOnly(Side.CLIENT)
public int colorMultiplier(IBlockState state, IBlockAccess worldIn, BlockPos pos, int tintIndex) {
public int colorMultiplier(IBlockState state, @Nullable IBlockAccess worldIn, @Nullable BlockPos pos, int tintIndex) {
ETTreeDefinition treeDefinition = state.getValue(getVariant());
ITreeGenome genome = treeDefinition.getGenome();
@@ -176,7 +176,7 @@ public class BlockHedge extends Block implements IBlockFence, IColoredBlock {
@SideOnly(Side.CLIENT)
@Override
public int colorMultiplier(IBlockState state, IBlockAccess world, BlockPos pos, int tintIndex) {
public int colorMultiplier(IBlockState state, @Nullable IBlockAccess world, @Nullable BlockPos pos, int tintIndex) {
return getColor(getMetaFromState(state));
}
@@ -120,7 +120,7 @@ public abstract class BlockDesign extends BlockMetadata implements IMultipassBlo
@SideOnly(Side.CLIENT)
@Override
public int colorMultiplier(IBlockState state, IBlockAccess world, BlockPos pos, int tintIndex) {
public int colorMultiplier(IBlockState state, @Nullable IBlockAccess world, @Nullable BlockPos pos, int tintIndex) {
if (world == null || pos == null) {
return 0;
}
@@ -0,0 +1,9 @@
@ParametersAreNonnullByDefault
@FieldsAreNonnullByDefault
@MethodsReturnNonnullByDefault
package binnie.extratrees.integration.jei.multifence;
import binnie.core.util.FieldsAreNonnullByDefault;
import mcp.MethodsReturnNonnullByDefault;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -64,7 +64,7 @@ public class TileEntityNursery extends TileEntityMachine implements IButterflyNu
}
@Override
public void setCaterpillar(final IButterfly butterfly) {
public void setCaterpillar(@Nullable final IButterfly butterfly) {
IButterflyNursery nursery = this.getNursery();
if (nursery != null) {
nursery.setCaterpillar(butterfly);
@@ -0,0 +1,9 @@
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
@FieldsAreNonnullByDefault
package binnie.genetics.gui.bee;
import binnie.core.util.FieldsAreNonnullByDefault;
import mcp.MethodsReturnNonnullByDefault;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -0,0 +1,9 @@
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
@FieldsAreNonnullByDefault
package binnie.genetics.gui.butterfly;
import binnie.core.util.FieldsAreNonnullByDefault;
import mcp.MethodsReturnNonnullByDefault;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -16,6 +16,8 @@ import binnie.genetics.gui.ControlAnalystPage;
import forestry.api.genetics.IAlleleSpecies;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class AnalystPageAppearance extends ControlAnalystPage {
public AnalystPageAppearance(final IWidget parent, final Area area, final IFlower flower) {
@@ -38,6 +40,7 @@ public class AnalystPageAppearance extends ControlAnalystPage {
final int width = (sections > 1) ? 50 : 100;
new ControlIconDisplay(this, (this.width() - width) / 2, y - ((sections == 1) ? 0 : 0)) {
@Override
@SideOnly(Side.CLIENT)
public void onRenderForeground(int guiWidth, int guiHeight) {
GlStateManager.pushMatrix();
final float scale = width / 16.0f;
@@ -0,0 +1,9 @@
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
@FieldsAreNonnullByDefault
package binnie.genetics.gui.flower;
import binnie.core.util.FieldsAreNonnullByDefault;
import mcp.MethodsReturnNonnullByDefault;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -0,0 +1,9 @@
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
@FieldsAreNonnullByDefault
package binnie.genetics.gui.tree;
import binnie.core.util.FieldsAreNonnullByDefault;
import mcp.MethodsReturnNonnullByDefault;
import javax.annotation.ParametersAreNonnullByDefault;