mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-26 15:03:14 +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
@@ -34,6 +34,7 @@ public class CreativeTabGenetics extends CreativeTabs {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Item getTabIconItem() {
|
||||
//TODO add icon item for genetics
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,9 +7,9 @@ import net.minecraftforge.fluids.FluidStack;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public interface IIncubatorRecipe {
|
||||
boolean isInputLiquid(final FluidStack p0);
|
||||
boolean isInputLiquid(@Nullable final FluidStack fluid);
|
||||
|
||||
boolean isInputLiquidSufficient(final FluidStack p0);
|
||||
boolean isInputLiquidSufficient(@Nullable final FluidStack fluid);
|
||||
|
||||
void doTask(final MachineUtil p0);
|
||||
|
||||
@@ -21,6 +21,7 @@ public interface IIncubatorRecipe {
|
||||
|
||||
FluidStack getInput();
|
||||
|
||||
@Nullable
|
||||
FluidStack getOutput();
|
||||
|
||||
ItemStack getInputStack();
|
||||
|
||||
@@ -17,8 +17,7 @@ public enum GeneticsPacket implements IPacketID {
|
||||
if (this == GeneticsPacket.GeneTrackerSync && context.side == Side.CLIENT) {
|
||||
final MessageNBT packet = new MessageNBT(message);
|
||||
final EntityPlayer player = BinnieCore.getBinnieProxy().getPlayer();
|
||||
GeneTracker tracker = null;
|
||||
tracker = GeneTracker.getTracker(BinnieCore.getBinnieProxy().getWorld(), player.getGameProfile());
|
||||
GeneTracker tracker = GeneTracker.getTracker(BinnieCore.getBinnieProxy().getWorld(), player.getGameProfile());
|
||||
if (tracker != null) {
|
||||
tracker.readFromNBT(packet.getTagCompound());
|
||||
}
|
||||
|
||||
@@ -53,14 +53,16 @@ public class Engineering {
|
||||
return stack;
|
||||
}
|
||||
|
||||
public static IGene[] getGenes(final ItemStack serum) {
|
||||
if (serum.getItem() instanceof IItemSerum) {
|
||||
return ((IItemSerum) serum.getItem()).getGenes(serum);
|
||||
}
|
||||
if (serum.getItem() == Genetics.itemSequencer) {
|
||||
SequencerItem sequencerItem = SequencerItem.create(serum);
|
||||
if (sequencerItem != null) {
|
||||
return new IGene[]{sequencerItem.getGene()};
|
||||
public static IGene[] getGenes(@Nullable final ItemStack serum) {
|
||||
if (serum != null) {
|
||||
if (serum.getItem() instanceof IItemSerum) {
|
||||
return ((IItemSerum) serum.getItem()).getGenes(serum);
|
||||
}
|
||||
if (serum.getItem() == Genetics.itemSequencer) {
|
||||
SequencerItem sequencerItem = SequencerItem.create(serum);
|
||||
if (sequencerItem != null) {
|
||||
return new IGene[]{sequencerItem.getGene()};
|
||||
}
|
||||
}
|
||||
}
|
||||
return new IGene[0];
|
||||
|
||||
@@ -6,18 +6,17 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class GeneProject {
|
||||
int id;
|
||||
String name;
|
||||
GameProfile leader;
|
||||
List<GameProfile> members;
|
||||
private int id;
|
||||
private String name;
|
||||
private GameProfile leader;
|
||||
private List<GameProfile> members;
|
||||
|
||||
public GeneProject(final int id, final String name, final GameProfile leader) {
|
||||
this.id = 0;
|
||||
this.leader = null;
|
||||
this.leader = leader;
|
||||
this.members = new ArrayList<>();
|
||||
this.setID(id);
|
||||
this.setName(name);
|
||||
this.setLeader(leader);
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public int getID() {
|
||||
@@ -40,10 +39,6 @@ public class GeneProject {
|
||||
return this.leader;
|
||||
}
|
||||
|
||||
public void setLeader(final GameProfile leader) {
|
||||
this.addPlayer(this.leader = leader);
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return this.members.isEmpty();
|
||||
}
|
||||
|
||||
@@ -32,12 +32,8 @@ public class GeneticEngineeringSystem {
|
||||
try {
|
||||
final IAllele a1 = indiv.getGenome().getActiveAllele(chromosome);
|
||||
final IAllele a2 = indiv.getGenome().getInactiveAllele(chromosome);
|
||||
if (a1 != null) {
|
||||
this.chromosomeMap.get(chromosome).add(a1);
|
||||
}
|
||||
if (a2 != null) {
|
||||
this.chromosomeMap.get(chromosome).add(a2);
|
||||
}
|
||||
this.chromosomeMap.get(chromosome).add(a1);
|
||||
this.chromosomeMap.get(chromosome).add(a2);
|
||||
} catch (Exception ex) {
|
||||
throw Throwables.propagate(ex);
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ public class AnalystPageAppearance extends ControlAnalystPage {
|
||||
y += 26;
|
||||
final int sections = ind.getGenome().getType().getSections();
|
||||
final int w = (sections > 1) ? 50 : 100;
|
||||
// TODO fix this control icon display
|
||||
new ControlIconDisplay(this, (this.w() - w) / 2, y - ((sections == 1) ? 0 : 0), null) {
|
||||
@Override
|
||||
public void onRenderForeground(int guiWidth, int guiHeight) {
|
||||
|
||||
@@ -27,13 +27,11 @@ import java.util.Collection;
|
||||
import java.util.Objects;
|
||||
|
||||
public class AnalystPageDatabase extends ControlAnalystPage {
|
||||
@Nullable
|
||||
ControlScrollableContent scroll;
|
||||
private final ControlScrollableContent scroll;
|
||||
boolean isMaster;
|
||||
|
||||
public AnalystPageDatabase(final IWidget parent, final IArea area, final BreedingSystem system, final boolean isMaster) {
|
||||
super(parent, area);
|
||||
this.scroll = null;
|
||||
this.isMaster = isMaster;
|
||||
final int cOfSystem = system.getColour();
|
||||
final int cr = (0xFF0000 & cOfSystem) >> 16;
|
||||
@@ -109,7 +107,8 @@ public class AnalystPageDatabase extends ControlAnalystPage {
|
||||
}
|
||||
};
|
||||
} else {
|
||||
(this.scroll = new ControlScrollableContent(this, 4, y, this.w() - 8, this.h() - y - 8, 0)).setScrollableContent(this.getItemScrollList(system, options));
|
||||
this.scroll = new ControlScrollableContent(this, 4, y, this.w() - 8, this.h() - y - 8, 0);
|
||||
this.scroll.setScrollableContent(this.getItemScrollList(system, options));
|
||||
}
|
||||
new ControlScrollBar(this, this.scroll.x() + this.scroll.w() - 6, this.scroll.y() + 3, 3, this.scroll.h() - 6, this.scroll) {
|
||||
@Override
|
||||
@@ -139,7 +138,7 @@ public class AnalystPageDatabase extends ControlAnalystPage {
|
||||
this.addSelfEventHandler(new EventMouse.Down.Handler() {
|
||||
@Override
|
||||
public void onEvent(final EventMouse.Down event) {
|
||||
final WindowAnalyst window = (WindowAnalyst) AnalystPageDatabase.this.getSuperParent();
|
||||
final WindowAnalyst window = (WindowAnalyst) AnalystPageDatabase.this.getTopParent();
|
||||
window.setIndividual(ind);
|
||||
}
|
||||
});
|
||||
@@ -147,7 +146,7 @@ public class AnalystPageDatabase extends ControlAnalystPage {
|
||||
|
||||
@Override
|
||||
public void onRenderBackground(int guiWidth, int guiHeight) {
|
||||
final WindowAnalyst window = (WindowAnalyst) AnalystPageDatabase.this.getSuperParent();
|
||||
final WindowAnalyst window = (WindowAnalyst) AnalystPageDatabase.this.getTopParent();
|
||||
if (window.getIndividual() != null && window.getIndividual().getGenome().getPrimary() == species) {
|
||||
RenderUtil.setColour(15658734);
|
||||
CraftGUI.render.texture(CraftGUITexture.TabSolid, this.getArea().outset(1));
|
||||
|
||||
@@ -10,6 +10,7 @@ import binnie.craftgui.core.IWidget;
|
||||
import binnie.craftgui.core.geometry.IPoint;
|
||||
import binnie.craftgui.resource.Texture;
|
||||
import binnie.craftgui.resource.minecraft.StandardTexture;
|
||||
import com.google.common.base.Preconditions;
|
||||
import forestry.api.apiculture.EnumBeeChromosome;
|
||||
import forestry.api.arboriculture.EnumTreeChromosome;
|
||||
import forestry.api.genetics.IChromosomeType;
|
||||
@@ -38,8 +39,8 @@ public class ControlChromosome extends Control implements IControlValue<IChromos
|
||||
this.species = null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public ISpeciesRoot getRoot() {
|
||||
Preconditions.checkState(this.species != null, "root has not been set");
|
||||
return this.species;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,6 +45,7 @@ import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -164,9 +165,9 @@ public class WindowAnalyst extends Window {
|
||||
x += 22;
|
||||
}
|
||||
} else {
|
||||
new ControlSlot(this, x, y + 1).assign(InventoryType.Window, 0);
|
||||
new ControlSlot.Builder(this, x, y + 1).assign(InventoryType.Window, 0);
|
||||
x += 22;
|
||||
new ControlSlot(this, x, y + 1).assign(InventoryType.Window, 1);
|
||||
new ControlSlot.Builder(this, x, y + 1).assign(InventoryType.Window, 1);
|
||||
x += 26;
|
||||
this.setupValidators();
|
||||
}
|
||||
@@ -461,13 +462,14 @@ public class WindowAnalyst extends Window {
|
||||
if (ind != null) {
|
||||
ind.getGenome().getSpeciesRoot().getBreedingTracker(this.getWorld(), this.getUsername()).registerBirth(ind);
|
||||
}
|
||||
// TODO why is this specific client/server code needed?
|
||||
if (this.isClient()) {
|
||||
this.setStack(this.getWindowInventory().getStackInSlot(0));
|
||||
} else if (this.isServer()) {
|
||||
}
|
||||
}
|
||||
|
||||
public void setStack(final ItemStack stack) {
|
||||
public void setStack(@Nullable final ItemStack stack) {
|
||||
final IIndividual ind = AlleleManager.alleleRegistry.getIndividual(stack);
|
||||
this.setIndividual(ind);
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ public abstract class ItemGene extends ItemCore {
|
||||
}
|
||||
|
||||
public int getCharges(final ItemStack stack) {
|
||||
return (stack == null) ? 0 : (stack.getMaxDamage() - stack.getItemDamage());
|
||||
return stack.getMaxDamage() - stack.getItemDamage();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -45,6 +45,7 @@ public abstract class ComponentIndexerInventory<T> extends ComponentInventory im
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public ItemStack getStackInSlot(final int index) {
|
||||
if (index >= 0 && index < this.indexerInventory.size()) {
|
||||
return this.indexerInventory.get(index);
|
||||
@@ -53,6 +54,7 @@ public abstract class ComponentIndexerInventory<T> extends ComponentInventory im
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public ItemStack decrStackSize(final int index, final int amount) {
|
||||
ItemStack stackInSlot = this.getStackInSlot(index);
|
||||
if (stackInSlot != null) {
|
||||
|
||||
@@ -77,9 +77,6 @@ public enum LaboratoryMachine implements IMachineType {
|
||||
@Override
|
||||
public void readFromNBT(final NBTTagCompound nbttagcompound) {
|
||||
super.readFromNBT(nbttagcompound);
|
||||
if (nbttagcompound == null) {
|
||||
return;
|
||||
}
|
||||
this.stack = ItemStack.loadItemStackFromNBT(nbttagcompound.getCompoundTag("Item"));
|
||||
}
|
||||
|
||||
|
||||
@@ -103,9 +103,9 @@ public class Acclimatiser {
|
||||
addHumidityItem(new ItemStack(Items.WATER_BUCKET), 0.75f);
|
||||
addHumidityItem(new ItemStack(Blocks.SAND), -0.15f);
|
||||
addTemperatureItem(FluidContainerType.CAN.getFilled(FluidRegistry.LAVA), 0.75f);
|
||||
addTemperatureItem(FluidContainerType.REFARACTORY.getFilled(FluidRegistry.LAVA), 0.75f);
|
||||
addTemperatureItem(FluidContainerType.REFRACTORY.getFilled(FluidRegistry.LAVA), 0.75f);
|
||||
addHumidityItem(FluidContainerType.CAN.getFilled(FluidRegistry.WATER), 0.75f);
|
||||
addHumidityItem(FluidContainerType.REFARACTORY.getFilled(FluidRegistry.WATER), 0.75f);
|
||||
addHumidityItem(FluidContainerType.REFRACTORY.getFilled(FluidRegistry.WATER), 0.75f);
|
||||
addHumidityItem(FluidContainerType.CAPSULE.getFilled(FluidRegistry.WATER), 0.75f);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,10 @@ public class Analyser {
|
||||
return ind != null || stack.getItem() instanceof IItemAnalysable || Binnie.GENETICS.getConversion(stack) != null;
|
||||
}
|
||||
|
||||
public static boolean isAnalysed(final ItemStack stack) {
|
||||
public static boolean isAnalysed(@Nullable final ItemStack stack) {
|
||||
if (stack == null) {
|
||||
return false;
|
||||
}
|
||||
final IIndividual ind = AlleleManager.alleleRegistry.getIndividual(stack);
|
||||
if (ind != null) {
|
||||
return ind.isAnalyzed();
|
||||
@@ -29,7 +32,11 @@ public class Analyser {
|
||||
return stack.getItem() instanceof IItemAnalysable && ((IItemAnalysable) stack.getItem()).isAnalysed(stack);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static ItemStack analyse(@Nullable ItemStack stack) {
|
||||
if (stack == null) {
|
||||
return null;
|
||||
}
|
||||
final ItemStack conv = Binnie.GENETICS.getConversionStack(stack);
|
||||
if (conv != null) {
|
||||
stack = conv;
|
||||
|
||||
@@ -33,12 +33,12 @@ public class WindowAcclimatiser extends WindowMachine {
|
||||
super.initialiseClient();
|
||||
int x = 16;
|
||||
final int y = 32;
|
||||
new ControlSlotArray(this, x, y, 2, 2).create(Acclimatiser.SLOT_RESERVE);
|
||||
new ControlSlotArray.Builder(this, x, y, 2, 2).create(Acclimatiser.SLOT_RESERVE);
|
||||
x += 54;
|
||||
new ControlSlot(this, x + 18, y).assign(4);
|
||||
new ControlSlotArray(this, x, y + 18 + 18, 3, 1).create(Acclimatiser.SLOT_ACCLIMATISER);
|
||||
new ControlSlot.Builder(this, x + 18, y).assign(4);
|
||||
new ControlSlotArray.Builder(this, x, y + 18 + 18, 3, 1).create(Acclimatiser.SLOT_ACCLIMATISER);
|
||||
x += 72;
|
||||
new ControlSlotArray(this, x, y, 2, 2).create(Acclimatiser.SLOT_DRONE);
|
||||
new ControlSlotArray.Builder(this, x, y, 2, 2).create(Acclimatiser.SLOT_DRONE);
|
||||
new ControlEnergyBar(this, 21, 115, 16, 60, Position.Bottom);
|
||||
new ControlErrorState(this, 181, 83);
|
||||
new ControlPlayerInventory(this);
|
||||
|
||||
@@ -38,9 +38,9 @@ public class WindowAnalyser extends WindowMachine {
|
||||
WindowAnalyser.Progress = new StandardTexture(66, 51, 66, 40, GeneticsTexture.GUIProcess.getTexture());
|
||||
int x = 16;
|
||||
final int y = 32;
|
||||
new ControlSlotArray(this, x, y, 2, 3).create(Analyser.SLOT_RESERVE);
|
||||
new ControlSlotArray.Builder(this, x, y, 2, 3).create(Analyser.SLOT_RESERVE);
|
||||
x += 28;
|
||||
new ControlSlot(this, x, y + 54 + 8).assign(13);
|
||||
new ControlSlot.Builder(this, x, y + 54 + 8).assign(13);
|
||||
new ControlSlotCharge(this, x + 20, y + 54 + 8, 13).setColour(10040319);
|
||||
new ControlEnergyBar(this, x + 24 + 16, y + 54 + 8 + 1, 60, 16, Position.Left);
|
||||
new ControlErrorState(this, x + 24 + 16 + 60 + 16, y + 54 + 8 + 1);
|
||||
@@ -49,10 +49,10 @@ public class WindowAnalyser extends WindowMachine {
|
||||
x += 56;
|
||||
new Panel(this, x, y, 76, 50, MinecraftGUI.PanelType.Tinted);
|
||||
new ControlProgress(this, x + 5, y + 5, WindowAnalyser.ProgressBase, WindowAnalyser.Progress, Position.Left);
|
||||
new ControlSlot(this, x + 38 - 9, y + 25 - 9).assign(6);
|
||||
new ControlSlot.Builder(this, x + 38 - 9, y + 25 - 9).assign(6);
|
||||
new ControlIconDisplay(this, x + 76 + 2, y + 18, GUIIcon.ArrowRight.getIcon().getResourceLocation());
|
||||
x += 96;
|
||||
new ControlSlotArray(this, x, y, 2, 3).create(Analyser.SLOT_FINISHED);
|
||||
new ControlSlotArray.Builder(this, x, y, 2, 3).create(Analyser.SLOT_FINISHED);
|
||||
x += 52;
|
||||
new ControlPlayerInventory(this);
|
||||
}
|
||||
|
||||
@@ -36,17 +36,17 @@ public class WindowGenepool extends WindowMachine {
|
||||
final int y = 32;
|
||||
new ControlLiquidTank(this, x, y).setTankID(1);
|
||||
x += 26;
|
||||
new ControlSlotArray(this, x, y + 3, 2, 3).create(Genepool.SLOT_RESERVE);
|
||||
new ControlSlotArray.Builder(this, x, y + 3, 2, 3).create(Genepool.SLOT_RESERVE);
|
||||
x += 38;
|
||||
new ControlIconDisplay(this, x, y + 3 + 18 + 1, GUIIcon.ArrowRight.getIcon().getResourceLocation());
|
||||
x += 18;
|
||||
new ControlSlot(this, x, y + 3 + 18).assign(0);
|
||||
new ControlSlot.Builder(this, x, y + 3 + 18).assign(0);
|
||||
x += 18;
|
||||
new ControlMachineProgress(this, x, y + 19, WindowGenepool.ProgressBase, WindowGenepool.Progress, Position.Left);
|
||||
x += 130;
|
||||
new ControlLiquidTank(this, x, y).setTankID(0);
|
||||
new ControlEnergyBar(this, 21, 115, 16, 60, Position.Bottom);
|
||||
new ControlSlot(this, 121, 82).assign(7);
|
||||
new ControlSlot.Builder(this, 121, 82).assign(7);
|
||||
new ControlSlotCharge(this, 143, 82, 7).setColour(15722671);
|
||||
new ControlErrorState(this, 181, 83);
|
||||
new ControlPlayerInventory(this);
|
||||
|
||||
@@ -35,16 +35,16 @@ public class WindowIncubator extends WindowMachine {
|
||||
final int y = 32;
|
||||
new ControlLiquidTank(this, x, y).setTankID(0);
|
||||
x += 26;
|
||||
new ControlSlotArray(this, x, y + 3, 1, 3).create(Incubator.SLOT_QUEUE);
|
||||
new ControlSlotArray.Builder(this, x, y + 3, 1, 3).create(Incubator.SLOT_QUEUE);
|
||||
x += 20;
|
||||
new ControlIconDisplay(this, x, y + 3 + 10, GUIIcon.ArrowRight.getIcon().getResourceLocation());
|
||||
x += 18;
|
||||
new ControlMachineProgress(this, x, y + 6, WindowIncubator.ProgressBase, WindowIncubator.Progress, Position.Left);
|
||||
new ControlSlot(this, x + 11, y + 3 + 10).assign(3);
|
||||
new ControlSlot.Builder(this, x + 11, y + 3 + 10).assign(3);
|
||||
x += 40;
|
||||
new ControlIconDisplay(this, x, y + 3 + 10, GUIIcon.ArrowRight.getIcon().getResourceLocation());
|
||||
x += 18;
|
||||
new ControlSlotArray(this, x, y + 3, 1, 3).create(Incubator.SLOT_OUTPUT);
|
||||
new ControlSlotArray.Builder(this, x, y + 3, 1, 3).create(Incubator.SLOT_OUTPUT);
|
||||
x += 26;
|
||||
new ControlLiquidTank(this, x, y).setTankID(1);
|
||||
x += 34;
|
||||
|
||||
@@ -37,11 +37,11 @@ public class WindowInoculator extends WindowMachine {
|
||||
final int y = 32;
|
||||
new ControlLiquidTank(this, x, y + 18 + 16).setTankID(0);
|
||||
CraftGUIUtil.horizontalGrid(x, y,
|
||||
new ControlSlotArray(this, 0, 0, 2, 1).create(Inoculator.SLOT_SERUM_RESERVE),
|
||||
new ControlSlotArray.Builder(this, 0, 0, 2, 1).create(Inoculator.SLOT_SERUM_RESERVE),
|
||||
new ControlIconDisplay(this, 0, 0, GUIIcon.ArrowRight.getIcon().getResourceLocation()),
|
||||
new ControlSlot(this, 0, 0).assign(0),
|
||||
new ControlSlot.Builder(this, 0, 0).assign(0),
|
||||
new ControlIconDisplay(this, 0, 0, GUIIcon.ArrowRight.getIcon().getResourceLocation()),
|
||||
new ControlSlotArray(this, 0, 0, 2, 1).create(Inoculator.SLOT_SERUM_EXPENDED)
|
||||
new ControlSlotArray.Builder(this, 0, 0, 2, 1).create(Inoculator.SLOT_SERUM_EXPENDED)
|
||||
);
|
||||
x += 18;
|
||||
new ControlMachineProgress(this, x, y + 24, WindowInoculator.ProgressBase, WindowInoculator.Progress, Position.Left);
|
||||
@@ -49,9 +49,9 @@ public class WindowInoculator extends WindowMachine {
|
||||
new ControlErrorState(this, 161, 118);
|
||||
x += 142;
|
||||
CraftGUIUtil.verticalGrid(x, y, TextJustification.MiddleLeft, 8,
|
||||
new ControlSlotArray(this, x, y, 4, 1).create(Inoculator.SLOT_RESERVE),
|
||||
new ControlSlot(this, x, y + 18 + 8).assign(9),
|
||||
new ControlSlotArray(this, x, y + 18 + 8 + 18 + 8, 4, 1).create(Inoculator.SLOT_FINISHED)
|
||||
new ControlSlotArray.Builder(this, x, y, 4, 1).create(Inoculator.SLOT_RESERVE),
|
||||
new ControlSlot.Builder(this, x, y + 18 + 8).assign(9),
|
||||
new ControlSlotArray.Builder(this, x, y + 18 + 8 + 18 + 8, 4, 1).create(Inoculator.SLOT_FINISHED)
|
||||
);
|
||||
new ControlIconDisplay(this, x + 18, y + 18 + 2, GUIIcon.ArrowUpLeft.getIcon().getResourceLocation());
|
||||
new ControlIconDisplay(this, x + 18, y + 18 + 18, GUIIcon.ArrowLeftDown.getIcon().getResourceLocation());
|
||||
|
||||
@@ -36,23 +36,23 @@ public class WindowIsolator extends WindowMachine {
|
||||
final int y = 32;
|
||||
new ControlLiquidTank(this, x, y).setTankID(0);
|
||||
x += 26;
|
||||
new ControlSlotArray(this, x, y + 3, 1, 3).create(Isolator.SLOT_RESERVE);
|
||||
new ControlSlotArray.Builder(this, x, y + 3, 1, 3).create(Isolator.SLOT_RESERVE);
|
||||
x += 20;
|
||||
new ControlIconDisplay(this, x, y + 3 + 1, GUIIcon.ArrowRight.getIcon().getResourceLocation());
|
||||
x += 18;
|
||||
new ControlSlot(this, x, y + 3).assign(5);
|
||||
new ControlSlot(this, x, y + 36 + 3).assign(0);
|
||||
new ControlSlot.Builder(this, x, y + 3).assign(5);
|
||||
new ControlSlot.Builder(this, x, y + 36 + 3).assign(0);
|
||||
new ControlSlotCharge(this, x + 18 + 2, y + 36 + 3, 0).setColour(15722671);
|
||||
x += 18;
|
||||
new ControlProgress(this, x, y + 3, WindowIsolator.ProgressBase, WindowIsolator.Progress, Position.Left);
|
||||
x += 142;
|
||||
new ControlSlot(this, x, y + 3).assign(6);
|
||||
new ControlSlot(this, x, y + 3 + 36).assign(1);
|
||||
new ControlSlot.Builder(this, x, y + 3).assign(6);
|
||||
new ControlSlot.Builder(this, x, y + 3 + 36).assign(1);
|
||||
new ControlIconDisplay(this, x + 1, y + 3 + 19, GUIIcon.ArrowUp.getIcon().getResourceLocation());
|
||||
x += 20;
|
||||
new ControlIconDisplay(this, x, y + 3 + 1, GUIIcon.ArrowRight.getIcon().getResourceLocation());
|
||||
x += 18;
|
||||
new ControlSlotArray(this, x, y + 3, 2, 3).create(Isolator.SLOT_FINISHED);
|
||||
new ControlSlotArray.Builder(this, x, y + 3, 2, 3).create(Isolator.SLOT_FINISHED);
|
||||
new ControlEnergyBar(this, 260, 130, 16, 60, Position.Bottom);
|
||||
new ControlErrorState(this, 153, 81);
|
||||
new ControlPlayerInventory(this);
|
||||
|
||||
@@ -34,19 +34,19 @@ public class WindowPolymeriser extends WindowMachine {
|
||||
super.initialiseClient();
|
||||
int x = 16;
|
||||
final int y = 38;
|
||||
new ControlSlotArray(this, x, y, 1, 4).create(Polymeriser.SLOT_SERUM_RESERVE);
|
||||
new ControlSlotArray.Builder(this, x, y, 1, 4).create(Polymeriser.SLOT_SERUM_RESERVE);
|
||||
new ControlIconDisplay(this, x + 18, y + 1, GUIIcon.ArrowRight.getIcon().getResourceLocation());
|
||||
x += 34;
|
||||
new ControlMachineProgress(this, x + 18, y - 6, WindowPolymeriser.ProgressBase, WindowPolymeriser.Progress, Position.Left);
|
||||
new ControlSlot(this, x, y).assign(0);
|
||||
new ControlSlot.Builder(this, x, y).assign(0);
|
||||
new ControlLiquidTank(this, x, y + 18 + 16, true).setTankID(0);
|
||||
new ControlLiquidTank(this, x, y + 18 + 16 + 18 + 8, true).setTankID(1);
|
||||
new ControlEnergyBar(this, x + 120, 96, 64, 16, Position.Left);
|
||||
x += 40;
|
||||
new ControlSlot(this, x + 30, y + 18 + 8).assign(1);
|
||||
new ControlSlot.Builder(this, x + 30, y + 18 + 8).assign(1);
|
||||
new ControlSlotCharge(this, x + 30 + 20, y + 18 + 8, 1).setColour(16766976);
|
||||
x += 138;
|
||||
new ControlSlotArray(this, x, y + 9, 2, 2).create(Polymeriser.SLOT_SERUM_FINISHED);
|
||||
new ControlSlotArray.Builder(this, x, y + 9, 2, 2).create(Polymeriser.SLOT_SERUM_FINISHED);
|
||||
final ControlErrorState errorState = new ControlErrorState(this, 244, 97);
|
||||
new ControlPlayerInventory(this);
|
||||
}
|
||||
|
||||
@@ -48,20 +48,18 @@ public class WindowSequencer extends WindowMachine {
|
||||
int x = 16;
|
||||
int y = 32;
|
||||
CraftGUIUtil.horizontalGrid(x, y, TextJustification.MiddleCenter, 2,
|
||||
new ControlSlotArray(this, 0, 0, 2, 2).create(Sequencer.SLOT_RESERVE),
|
||||
new ControlSlotArray.Builder(this, 0, 0, 2, 2).create(Sequencer.SLOT_RESERVE),
|
||||
new ControlIconDisplay(this, 0, 0, GUIIcon.ArrowRight.getIcon().getResourceLocation()),
|
||||
new ControlSequencerProgress(this, 0, 0),
|
||||
new ControlIconDisplay(this, 0, 0, GUIIcon.ArrowRight.getIcon().getResourceLocation()),
|
||||
new ControlSlot(this, 0, 0).assign(6)
|
||||
new ControlSlot.Builder(this, 0, 0).assign(6)
|
||||
);
|
||||
final ControlSlot slotTarget = new ControlSlot(this, x + 96, y + 16);
|
||||
slotTarget.assign(5);
|
||||
final ControlSlot slotTarget = new ControlSlot.Builder(this, x + 96, y + 16).assign(5);
|
||||
x = 34;
|
||||
y = 92;
|
||||
this.slotText = new ControlText(this, new IArea(0, y, this.w(), 12), TextFormatting.DARK_GRAY + Genetics.proxy.localise("machine.machine.sequencer.texts.userless"), TextJustification.MiddleCenter);
|
||||
y += 20;
|
||||
final ControlSlot slotDye = new ControlSlot(this, x, y);
|
||||
slotDye.assign(0);
|
||||
final ControlSlot slotDye = new ControlSlot.Builder(this, x, y).assign(0);
|
||||
x += 20;
|
||||
new ControlSlotCharge(this, x, y, 0).setColour(16750848);
|
||||
x += 32;
|
||||
|
||||
@@ -35,21 +35,21 @@ public class WindowSplicer extends WindowMachine {
|
||||
int x = 16;
|
||||
new ControlSplicerProgress(this, 84, 32, this.w() - 172, 102);
|
||||
CraftGUIUtil.horizontalGrid(x, 62,
|
||||
new ControlSlotArray(this, 0, 0, 2, 1).create(Splicer.SLOT_SERUM_RESERVE),
|
||||
new ControlSlotArray.Builder(this, 0, 0, 2, 1).create(Splicer.SLOT_SERUM_RESERVE),
|
||||
new ControlIconDisplay(this, 0, 0, GUIIcon.ArrowRight.getIcon().getResourceLocation()),
|
||||
new ControlSlot(this, 0, 0).assign(0)
|
||||
new ControlSlot.Builder(this, 0, 0).assign(0)
|
||||
);
|
||||
new ControlSlotArray(this, x + 12, 84, 2, 1).create(Splicer.SLOT_SERUM_EXPENDED);
|
||||
new ControlSlotArray.Builder(this, x + 12, 84, 2, 1).create(Splicer.SLOT_SERUM_EXPENDED);
|
||||
new ControlIconDisplay(this, x + 12 + 36 + 4, 86, GUIIcon.ArrowUpLeft.getIcon().getResourceLocation());
|
||||
new ControlEnergyBar(this, 196, 64, 60, 16, Position.Left);
|
||||
new ControlErrorState(this, 218, 86);
|
||||
x += 142;
|
||||
CraftGUIUtil.verticalGrid((this.w() - 72) / 2, 32, TextJustification.MiddleCenter, 4,
|
||||
new ControlSlotArray(this, 0, 0, 4, 1).create(Inoculator.SLOT_RESERVE),
|
||||
new ControlSlotArray.Builder(this, 0, 0, 4, 1).create(Inoculator.SLOT_RESERVE),
|
||||
new ControlIconDisplay(this, 0, 0, GUIIcon.ArrowDown.getIcon().getResourceLocation()),
|
||||
new ControlSlot(this, 0, 0).assign(9),
|
||||
new ControlSlot.Builder(this, 0, 0).assign(9),
|
||||
new ControlIconDisplay(this, 0, 0, GUIIcon.ArrowDown.getIcon().getResourceLocation()),
|
||||
new ControlSlotArray(this, 0, 0, 4, 1).create(Inoculator.SLOT_FINISHED)
|
||||
new ControlSlotArray.Builder(this, 0, 0, 4, 1).create(Inoculator.SLOT_FINISHED)
|
||||
);
|
||||
new ControlPlayerInventory(this);
|
||||
}
|
||||
|
||||
@@ -48,7 +48,8 @@ public class GenepoolLogic extends ComponentProcessSetCost implements IProcess {
|
||||
|
||||
@Override
|
||||
public ErrorState canProgress() {
|
||||
if (!this.getUtil().spaceInTank(Genepool.TANK_DNA, getDNAAmount(this.getUtil().getStack(0)))) {
|
||||
ItemStack individual = this.getUtil().getStack(Genepool.SLOT_BEE);
|
||||
if (!this.getUtil().spaceInTank(Genepool.TANK_DNA, getDNAAmount(individual))) {
|
||||
return new ErrorState.NoSpace(Genetics.proxy.localise("machine.errors.tanks.no.room.desc"), new int[]{0});
|
||||
}
|
||||
if (!this.getUtil().liquidInTank(Genepool.TANK_ETHANOL, 1)) {
|
||||
@@ -77,6 +78,7 @@ public class GenepoolLogic extends ComponentProcessSetCost implements IProcess {
|
||||
this.getUtil().drainTank(Genepool.TANK_ETHANOL, 1);
|
||||
--this.ethanolDrain;
|
||||
}
|
||||
this.getMachine().getInterface(IChargedSlots.class).alterCharge(Genepool.SLOT_ENZYME, -ENZYME_PER_PROCESS * this.getProgressPerTick() / 100.0f);
|
||||
IChargedSlots chargedSlots = this.getMachine().getInterface(IChargedSlots.class);
|
||||
chargedSlots.alterCharge(Genepool.SLOT_ENZYME, -ENZYME_PER_PROCESS * this.getProgressPerTick() / 100.0f);
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,8 @@ import forestry.api.apiculture.EnumBeeType;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
@@ -28,7 +30,7 @@ public class Incubator {
|
||||
private static IncubatorRecipeLarvae LARVAE_RECIPE;
|
||||
|
||||
public static void addRecipes() {
|
||||
Incubator.RECIPES.add(new IncubatorRecipe(GeneticsItems.GrowthMedium.get(1), Binnie.LIQUID.getFluidStack("water", 25), GeneticLiquid.GrowthMedium.get(25), 0.2f));
|
||||
Incubator.RECIPES.add(new IncubatorRecipe(GeneticsItems.GrowthMedium.get(1), new FluidStack(FluidRegistry.WATER, 25), GeneticLiquid.GrowthMedium.get(25), 0.2f));
|
||||
Incubator.RECIPES.add(new IncubatorRecipe(new ItemStack(Items.WHEAT), GeneticLiquid.GrowthMedium.get(25), GeneticLiquid.Bacteria.get(5), 0.2f));
|
||||
Incubator.RECIPES.add(new IncubatorRecipe(GeneticsItems.GrowthMedium.get(1), GeneticLiquid.Bacteria.get(0), GeneticLiquid.Bacteria.get(5), 0.05f));
|
||||
Incubator.RECIPES.add(new IncubatorRecipe(new ItemStack(Items.SUGAR), GeneticLiquid.Bacteria.get(2), null, 0.5f, 0.2f)
|
||||
|
||||
@@ -10,10 +10,12 @@ import binnie.genetics.api.IIncubatorRecipe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Random;
|
||||
|
||||
public class IncubatorLogic extends ComponentProcessIndefinate implements IProcess {
|
||||
IIncubatorRecipe recipe;
|
||||
@Nullable
|
||||
private IIncubatorRecipe recipe;
|
||||
private Random rand;
|
||||
private boolean roomForOutput;
|
||||
|
||||
@@ -57,6 +59,7 @@ public class IncubatorLogic extends ComponentProcessIndefinate implements IProce
|
||||
return this.recipe != null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private IIncubatorRecipe getRecipe(final ItemStack stack, final FluidStack liquid) {
|
||||
for (final IIncubatorRecipe recipe : Incubator.getRecipes()) {
|
||||
final boolean rightLiquid = recipe.isInputLiquid(liquid);
|
||||
|
||||
@@ -6,21 +6,24 @@ import binnie.genetics.api.IIncubatorRecipe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Random;
|
||||
|
||||
public class IncubatorRecipe implements IIncubatorRecipe {
|
||||
private final FluidStack input;
|
||||
@Nullable
|
||||
private final FluidStack output;
|
||||
private final ItemStack itemStack;
|
||||
private final float lossChance;
|
||||
private final float tickChance;
|
||||
@Nullable
|
||||
private ItemStack outputStack;
|
||||
|
||||
public IncubatorRecipe(ItemStack itemStack, final FluidStack input, final FluidStack output, final float lossChance) {
|
||||
public IncubatorRecipe(ItemStack itemStack, final FluidStack input, @Nullable final FluidStack output, final float lossChance) {
|
||||
this(itemStack, input, output, lossChance, 1.0f);
|
||||
}
|
||||
|
||||
public IncubatorRecipe(ItemStack itemStack, final FluidStack input, final FluidStack output, final float lossChance, final float chance) {
|
||||
public IncubatorRecipe(ItemStack itemStack, final FluidStack input, @Nullable final FluidStack output, final float lossChance, final float chance) {
|
||||
this.itemStack = itemStack;
|
||||
this.input = input;
|
||||
this.output = output;
|
||||
@@ -39,12 +42,12 @@ public class IncubatorRecipe implements IIncubatorRecipe {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInputLiquid(final FluidStack fluid) {
|
||||
public boolean isInputLiquid(@Nullable final FluidStack fluid) {
|
||||
return fluid != null && this.input.isFluidEqual(fluid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInputLiquidSufficient(final FluidStack fluid) {
|
||||
public boolean isInputLiquidSufficient(@Nullable final FluidStack fluid) {
|
||||
return fluid != null && fluid.amount >= 500;
|
||||
}
|
||||
|
||||
@@ -54,6 +57,7 @@ public class IncubatorRecipe implements IIncubatorRecipe {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public FluidStack getOutput() {
|
||||
return output;
|
||||
}
|
||||
@@ -91,6 +95,7 @@ public class IncubatorRecipe implements IIncubatorRecipe {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected ItemStack getOutputStack(final MachineUtil util) {
|
||||
return getExpectedOutput();
|
||||
}
|
||||
@@ -98,7 +103,7 @@ public class IncubatorRecipe implements IIncubatorRecipe {
|
||||
@Override
|
||||
public boolean roomForOutput(final MachineUtil machine) {
|
||||
if (this.output != null && !machine.isTankEmpty(1)) {
|
||||
if (!machine.getFluid(Incubator.TANK_OUTPUT).isFluidEqual(this.output)) {
|
||||
if (!this.output.isFluidEqual(machine.getFluid(Incubator.TANK_OUTPUT))) {
|
||||
return false;
|
||||
}
|
||||
if (!machine.spaceInTank(Incubator.TANK_OUTPUT, this.output.amount)) {
|
||||
|
||||
@@ -23,11 +23,11 @@ public class InoculatorLogic extends ComponentProcess implements IProcess {
|
||||
public static final int PROCESS_BASE_ENERGY = 600000;
|
||||
public static final int BACTERIA_PER_PROCESS = 15;
|
||||
|
||||
public static int getProcessLength(ItemStack itemStack) {
|
||||
public static int getProcessLength(@Nullable ItemStack itemStack) {
|
||||
return PROCESS_BASE_LENGTH * getNumberOfGenes(itemStack);
|
||||
}
|
||||
|
||||
public static int getProcessBaseEnergy(ItemStack itemStack) {
|
||||
public static int getProcessBaseEnergy(@Nullable ItemStack itemStack) {
|
||||
return PROCESS_BASE_ENERGY * getNumberOfGenes(itemStack);
|
||||
}
|
||||
|
||||
@@ -80,12 +80,14 @@ public class InoculatorLogic extends ComponentProcess implements IProcess {
|
||||
if (state != null) {
|
||||
return state;
|
||||
}
|
||||
if (this.getUtil().getStack(Inoculator.SLOT_SERUM_VIAL) != null && Engineering.getCharges(this.getUtil().getStack(Inoculator.SLOT_SERUM_VIAL)) == 0) {
|
||||
ItemStack serum = this.getUtil().getStack(Inoculator.SLOT_SERUM_VIAL);
|
||||
if (serum != null && Engineering.getCharges(serum) == 0) {
|
||||
return new ErrorState(Genetics.proxy.localise("machine.errors.empty.serum.desc"), Genetics.proxy.localise("machine.errors.empty.serum.info"));
|
||||
}
|
||||
return super.canWork();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public ErrorState isValidSerum() {
|
||||
final ItemStack serum = this.getUtil().getStack(Inoculator.SLOT_SERUM_VIAL);
|
||||
final ItemStack target = this.getUtil().getStack(Inoculator.SLOT_TARGET);
|
||||
|
||||
Reference in new issue
Block a user