mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-23 21:49:49 +00:00
More null annotations
This commit is contained in:
1 parent
da8a833485
commit
a5daa93bf1
163 files changed
+952
-849
No files matched your search
@@ -11,6 +11,8 @@ import forestry.api.core.Tabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class ItemHiveFrame extends Item implements IHiveFrame, IBeeModifier, IItemModelRegister {
|
||||
EnumHiveFrame frame;
|
||||
|
||||
@@ -53,6 +55,7 @@ public class ItemHiveFrame extends Item implements IHiveFrame, IBeeModifier, IIt
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public ItemStack frameUsed(final IBeeHousing housing, final ItemStack frame, final IBee queen, final int wear) {
|
||||
frame.setItemDamage(frame.getItemDamage() + wear);
|
||||
if (frame.getItemDamage() >= frame.getMaxDamage()) {
|
||||
|
||||
@@ -8,6 +8,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
public class ItemIndustrialFrame extends Item {
|
||||
@@ -53,10 +54,12 @@ public class ItemIndustrialFrame extends Item {
|
||||
this.setUnlocalizedName("industrialFrame");
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static IndustrialFrame getFrame(final ItemStack stack) {
|
||||
if (stack == null || !stack.hasTagCompound() || !stack.getTagCompound().hasKey("frame")) {
|
||||
NBTTagCompound tagCompound = stack.getTagCompound();
|
||||
if (tagCompound == null || !tagCompound.hasKey("frame")) {
|
||||
return null;
|
||||
}
|
||||
return IndustrialFrame.values()[stack.getTagCompound().getInteger("frame")];
|
||||
return IndustrialFrame.values()[tagCompound.getInteger("frame")];
|
||||
}
|
||||
}
|
||||
@@ -31,8 +31,7 @@ public class AlvearyFrame {
|
||||
public void createMachine(final Machine machine) {
|
||||
new ComponentExtraBeeGUI(machine, ExtraBeeGUID.AlvearyFrame);
|
||||
final ComponentInventorySlots inventory = new ComponentInventorySlots(machine);
|
||||
inventory.addSlot(AlvearyFrame.slotFrame, "frame");
|
||||
inventory.getSlot(AlvearyFrame.slotFrame).setValidator(new SlotValidatorFrame());
|
||||
inventory.addSlot(AlvearyFrame.slotFrame, "frame").setValidator(new SlotValidatorFrame());
|
||||
new ComponentFrameModifier(machine);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,8 +60,7 @@ public class AlvearyMutator {
|
||||
public void createMachine(final Machine machine) {
|
||||
new ComponentExtraBeeGUI(machine, ExtraBeeGUID.AlvearyMutator);
|
||||
final ComponentInventorySlots inventory = new ComponentInventorySlots(machine);
|
||||
inventory.addSlot(AlvearyMutator.slotMutator, "mutator");
|
||||
inventory.getSlot(AlvearyMutator.slotMutator).setValidator(new SlotValidatorMutator());
|
||||
inventory.addSlot(AlvearyMutator.slotMutator, "mutator").setValidator(new SlotValidatorMutator());
|
||||
new ComponentMutatorModifier(machine);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,8 +39,7 @@ public class AlvearyStimulator {
|
||||
public void createMachine(final Machine machine) {
|
||||
new ComponentExtraBeeGUI(machine, ExtraBeeGUID.AlvearyStimulator);
|
||||
final ComponentInventorySlots inventory = new ComponentInventorySlots(machine);
|
||||
inventory.addSlot(AlvearyStimulator.slotCircuit, "circuit");
|
||||
inventory.getSlot(AlvearyStimulator.slotCircuit).setValidator(new SlotValidatorCircuit());
|
||||
inventory.addSlot(AlvearyStimulator.slotCircuit, "circuit").setValidator(new SlotValidatorCircuit());
|
||||
final ComponentPowerReceptor power = new ComponentPowerReceptor(machine);
|
||||
new ComponentStimulatorModifier(machine);
|
||||
}
|
||||
|
||||
@@ -14,6 +14,8 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public enum ExtraBeeGUID implements IBinnieGUID {
|
||||
Database,
|
||||
DatabaseNEI,
|
||||
@@ -24,6 +26,7 @@ public enum ExtraBeeGUID implements IBinnieGUID {
|
||||
AlvearyHatchery;
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Window getWindow(final EntityPlayer player, final World world, final int x, final int y, final int z, final Side side) {
|
||||
Window window = null;
|
||||
final TileEntity tileEntity = world.getTileEntity(new BlockPos(x, y, z));
|
||||
|
||||
@@ -12,6 +12,7 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
public enum ExtraBeeItems implements IItemMiscProvider {
|
||||
@@ -48,7 +49,9 @@ public enum ExtraBeeItems implements IItemMiscProvider {
|
||||
|
||||
String name;
|
||||
String modelPath;
|
||||
@Nullable
|
||||
String metalString;
|
||||
@Nullable
|
||||
String gemString;
|
||||
|
||||
public static void init() {
|
||||
|
||||
@@ -6,6 +6,7 @@ import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IAlleleSpecies;
|
||||
import forestry.api.genetics.IClassification;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -271,6 +272,7 @@ public enum ExtraBeesBranch implements IClassification {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public IClassification[] getMemberGroups() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package binnie.extrabees.gui;
|
||||
|
||||
import binnie.core.AbstractMod;
|
||||
import binnie.core.machines.Machine;
|
||||
import binnie.core.machines.TileEntityMachine;
|
||||
import binnie.craftgui.minecraft.Window;
|
||||
import binnie.craftgui.minecraft.control.ControlPlayerInventory;
|
||||
import binnie.craftgui.minecraft.control.ControlSlot;
|
||||
@@ -11,17 +9,17 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class WindowAlvearyFrame extends Window {
|
||||
Machine machine;
|
||||
ControlPlayerInventory playerInventory;
|
||||
|
||||
public WindowAlvearyFrame(final EntityPlayer player, final IInventory inventory, final Side side) {
|
||||
super(176, 144, player, inventory, side);
|
||||
this.machine = ((TileEntityMachine) inventory).getMachine();
|
||||
}
|
||||
|
||||
public static Window create(final EntityPlayer player, final IInventory inventory, final Side side) {
|
||||
if (player == null || inventory == null) {
|
||||
@Nullable
|
||||
public static Window create(final EntityPlayer player, @Nullable final IInventory inventory, final Side side) {
|
||||
if (inventory == null) {
|
||||
return null;
|
||||
}
|
||||
return new WindowAlvearyFrame(player, inventory, side);
|
||||
@@ -30,9 +28,8 @@ public class WindowAlvearyFrame extends Window {
|
||||
@Override
|
||||
public void initialiseClient() {
|
||||
this.setTitle("Frame Housing");
|
||||
this.playerInventory = new ControlPlayerInventory(this);
|
||||
final ControlSlot slot = new ControlSlot(this, 79, 30);
|
||||
slot.assign(0);
|
||||
ControlPlayerInventory playerInventory = new ControlPlayerInventory(this);
|
||||
new ControlSlot.Builder(this, 79, 30).assign(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -12,17 +12,16 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
public class WindowAlvearyHatchery extends Window {
|
||||
Machine machine;
|
||||
ControlPlayerInventory playerInventory;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class WindowAlvearyHatchery extends Window {
|
||||
public WindowAlvearyHatchery(final EntityPlayer player, final IInventory inventory, final Side side) {
|
||||
super(176, 144, player, inventory, side);
|
||||
this.machine = ((TileEntityMachine) inventory).getMachine();
|
||||
}
|
||||
|
||||
public static Window create(final EntityPlayer player, final IInventory inventory, final Side side) {
|
||||
if (player == null || inventory == null) {
|
||||
@Nullable
|
||||
public static Window create(final EntityPlayer player, @Nullable final IInventory inventory, final Side side) {
|
||||
if (inventory == null) {
|
||||
return null;
|
||||
}
|
||||
return new WindowAlvearyHatchery(player, inventory, side);
|
||||
@@ -31,8 +30,8 @@ public class WindowAlvearyHatchery extends Window {
|
||||
@Override
|
||||
public void initialiseClient() {
|
||||
this.setTitle("Hatchery");
|
||||
this.playerInventory = new ControlPlayerInventory(this);
|
||||
final ControlSlotArray slot = new ControlSlotArray(this, 43, 30, 5, 1);
|
||||
ControlPlayerInventory playerInventory = new ControlPlayerInventory(this);
|
||||
final ControlSlotArray.Builder slot = new ControlSlotArray.Builder(this, 43, 30, 5, 1);
|
||||
slot.create(AlvearyHatchery.slotLarvae);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,27 +12,19 @@ import net.minecraft.inventory.IInventory;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
public class WindowAlvearyIndustrialFrame extends Window {
|
||||
Machine machine;
|
||||
ControlPlayerInventory playerInventory;
|
||||
|
||||
public WindowAlvearyIndustrialFrame(final EntityPlayer player, final IInventory inventory, final Side side) {
|
||||
super(176, 144, player, inventory, side);
|
||||
this.machine = ((TileEntityMachine) inventory).getMachine();
|
||||
}
|
||||
|
||||
public static Window create(final EntityPlayer player, final IInventory inventory, final Side side) {
|
||||
if (player == null || inventory == null) {
|
||||
return null;
|
||||
}
|
||||
return new WindowAlvearyIndustrialFrame(player, inventory, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialiseClient() {
|
||||
this.setTitle("Industrial Frame Housing");
|
||||
this.playerInventory = new ControlPlayerInventory(this);
|
||||
final ControlSlot slot = new ControlSlot(this, 79, 30);
|
||||
slot.assign(0);
|
||||
ControlPlayerInventory playerInventory = new ControlPlayerInventory(this);
|
||||
new ControlSlot.Builder(this, 79, 30).assign(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -17,17 +17,16 @@ import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
public class WindowAlvearyMutator extends Window {
|
||||
Machine machine;
|
||||
ControlPlayerInventory playerInventory;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class WindowAlvearyMutator extends Window {
|
||||
public WindowAlvearyMutator(final EntityPlayer player, final IInventory inventory, final Side side) {
|
||||
super(176, 176, player, inventory, side);
|
||||
this.machine = ((TileEntityMachine) inventory).getMachine();
|
||||
}
|
||||
|
||||
public static Window create(final EntityPlayer player, final IInventory inventory, final Side side) {
|
||||
if (player == null || inventory == null) {
|
||||
@Nullable
|
||||
public static Window create(final EntityPlayer player, @Nullable final IInventory inventory, final Side side) {
|
||||
if (inventory == null) {
|
||||
return null;
|
||||
}
|
||||
return new WindowAlvearyMutator(player, inventory, side);
|
||||
@@ -36,9 +35,8 @@ public class WindowAlvearyMutator extends Window {
|
||||
@Override
|
||||
public void initialiseClient() {
|
||||
this.setTitle("Mutator");
|
||||
this.playerInventory = new ControlPlayerInventory(this);
|
||||
final ControlSlot slot = new ControlSlot(this, 79, 30);
|
||||
slot.assign(0);
|
||||
new ControlPlayerInventory(this);
|
||||
new ControlSlot.Builder(this, 79, 30).assign(0);
|
||||
new ControlText(this, new IArea(0, 52, this.w(), 16), "Possible Mutagens:", TextJustification.MiddleCenter).setColour(5592405);
|
||||
final int size = AlvearyMutator.getMutagens().size();
|
||||
final int w = size * 18;
|
||||
|
||||
@@ -14,17 +14,16 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
public class WindowAlvearyStimulator extends Window {
|
||||
Machine machine;
|
||||
ControlPlayerInventory playerInventory;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class WindowAlvearyStimulator extends Window {
|
||||
public WindowAlvearyStimulator(final EntityPlayer player, final IInventory inventory, final Side side) {
|
||||
super(176, 144, player, inventory, side);
|
||||
this.machine = ((TileEntityMachine) inventory).getMachine();
|
||||
}
|
||||
|
||||
public static Window create(final EntityPlayer player, final IInventory inventory, final Side side) {
|
||||
if (player == null || inventory == null) {
|
||||
@Nullable
|
||||
public static Window create(final EntityPlayer player, @Nullable final IInventory inventory, final Side side) {
|
||||
if (inventory == null) {
|
||||
return null;
|
||||
}
|
||||
return new WindowAlvearyStimulator(player, inventory, side);
|
||||
@@ -34,9 +33,8 @@ public class WindowAlvearyStimulator extends Window {
|
||||
public void initialiseClient() {
|
||||
this.setTitle("Stimulator");
|
||||
new ControlEnergyBar(this, 75, 29, 60, 16, Position.Left);
|
||||
final ControlSlot slot = new ControlSlot(this, 41, 28);
|
||||
slot.assign(AlvearyStimulator.slotCircuit);
|
||||
this.playerInventory = new ControlPlayerInventory(this);
|
||||
new ControlSlot.Builder(this, 41, 28).assign(AlvearyStimulator.slotCircuit);
|
||||
new ControlPlayerInventory(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -63,7 +63,7 @@ public enum ExtraBeeLiquid implements ILiquidType {
|
||||
|
||||
@Override
|
||||
public boolean showInCreative(final FluidContainerType container) {
|
||||
return container == FluidContainerType.CAN || container == FluidContainerType.CAPSULE || container == FluidContainerType.REFARACTORY;
|
||||
return container == FluidContainerType.CAN || container == FluidContainerType.CAPSULE || container == FluidContainerType.REFRACTORY;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -8,6 +8,8 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public enum EnumHoneyDrop implements IItemEnum {
|
||||
ENERGY(10242418, 14905713, ""),
|
||||
ACID(4961601, 4841020, "acid"),
|
||||
@@ -39,14 +41,13 @@ public enum EnumHoneyDrop implements IItemEnum {
|
||||
MAGENTA(15040472, 16711884, "for.honey"),
|
||||
LIGHTGRAY(10066329, 13224393, "for.honey");
|
||||
|
||||
int[] colour;
|
||||
String liquidName;
|
||||
ItemStack remenant;
|
||||
public boolean deprecated;
|
||||
private int[] colour;
|
||||
private String liquidName;
|
||||
@Nullable
|
||||
private ItemStack remnant;
|
||||
|
||||
public void addRemenant(final ItemStack stack) {
|
||||
this.remenant = stack;
|
||||
this.deprecated = true;
|
||||
public void addRemnant(final ItemStack stack) {
|
||||
this.remnant = stack;
|
||||
}
|
||||
|
||||
EnumHoneyDrop() {
|
||||
@@ -54,23 +55,21 @@ public enum EnumHoneyDrop implements IItemEnum {
|
||||
}
|
||||
|
||||
EnumHoneyDrop(final int colour, final int colour2, final String liquid) {
|
||||
this.liquidName = "";
|
||||
this.remenant = null;
|
||||
this.deprecated = false;
|
||||
this.remnant = null;
|
||||
this.colour = new int[]{colour, colour2};
|
||||
this.liquidName = liquid;
|
||||
}
|
||||
|
||||
public void addRecipe() {
|
||||
final FluidStack liquid = Binnie.LIQUID.getFluidStack(this.liquidName, 200);
|
||||
final FluidStack liquid = Binnie.LIQUID.getFluidStack(this.getLiquidName(), 200);
|
||||
if (liquid != null) {
|
||||
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{this.get(1)}, liquid, this.remenant, 100);
|
||||
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{this.get(1)}, liquid, this.getRemnant(), 100);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isActive() {
|
||||
return !this.deprecated && (this.liquidName == null || FluidRegistry.isFluidRegistered(this.liquidName));
|
||||
return this.remnant != null && FluidRegistry.isFluidRegistered(this.getLiquidName());
|
||||
}
|
||||
|
||||
public static EnumHoneyDrop get(final ItemStack itemStack) {
|
||||
@@ -90,4 +89,17 @@ public enum EnumHoneyDrop implements IItemEnum {
|
||||
public String getName(final ItemStack stack) {
|
||||
return ExtraBees.proxy.localise("item.honeydrop." + this.name().toLowerCase());
|
||||
}
|
||||
|
||||
public int[] getColour() {
|
||||
return colour;
|
||||
}
|
||||
|
||||
public String getLiquidName() {
|
||||
return liquidName;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public ItemStack getRemnant() {
|
||||
return remnant;
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,8 @@ import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class ItemHoneyComb extends ItemProduct implements IColoredItem {
|
||||
|
||||
public ItemHoneyComb() {
|
||||
@@ -214,10 +216,11 @@ public class ItemHoneyComb extends ItemProduct implements IColoredItem {
|
||||
}
|
||||
}
|
||||
type.addProduct(drop.get(1), 1.00f);
|
||||
drop.addRemenant(dye);
|
||||
drop.addRemnant(dye);
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static ItemStack getOreDictionary(final String string) {
|
||||
if (OreDictionary.getOres(string).size() > 0) {
|
||||
return OreDictionary.getOres(string).get(0);
|
||||
@@ -228,13 +231,11 @@ public class ItemHoneyComb extends ItemProduct implements IColoredItem {
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public int getColorFromItemstack(ItemStack stack, int tintIndex) {
|
||||
if (EnumHoneyComb.get(stack) == null) {
|
||||
return 16777215;
|
||||
}
|
||||
EnumHoneyComb honeyComb = EnumHoneyComb.get(stack);
|
||||
if (tintIndex == 1) {
|
||||
return EnumHoneyComb.get(stack).colour[0];
|
||||
return honeyComb.colour[0];
|
||||
}
|
||||
return EnumHoneyComb.get(stack).colour[1];
|
||||
return honeyComb.colour[1];
|
||||
}
|
||||
|
||||
public enum VanillaComb {
|
||||
|
||||
@@ -18,9 +18,9 @@ public class ItemHoneyDrop extends ItemProduct implements IColoredItem {
|
||||
@Override
|
||||
public int getColorFromItemstack(ItemStack itemStack, int tintIndex) {
|
||||
if (tintIndex == 0) {
|
||||
return EnumHoneyDrop.get(itemStack).colour[0];
|
||||
return EnumHoneyDrop.get(itemStack).getColour()[0];
|
||||
}
|
||||
return EnumHoneyDrop.get(itemStack).colour[1];
|
||||
return EnumHoneyDrop.get(itemStack).getColour()[1];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -24,9 +24,6 @@ public class HiveDrop implements IHiveDrop {
|
||||
|
||||
public HiveDrop(IAllele[] template, final ItemStack[] bonus, final int chance) {
|
||||
this.additional = new ArrayList<>();
|
||||
if (template == null) {
|
||||
template = Binnie.GENETICS.getBeeRoot().getDefaultTemplate();
|
||||
}
|
||||
this.template = template;
|
||||
this.chance = chance;
|
||||
Collections.addAll(this.additional, bonus);
|
||||
|
||||
Reference in new issue
Block a user