mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-14 01:14:21 +00:00
Localization and refactoring (#77)
* Some refactoring for bee production * Code cleanup * Code cleanup * Added some localization * Fix wrong dropped class * Added some localization * Added some localization * Added some localization * Fix wrong import
This commit is contained in:
1 parent
68bbe7710c
commit
1ea7b62e5f
157 files changed
+3240
-5045
No files matched your search
@@ -1,11 +0,0 @@
|
||||
package binnie;
|
||||
|
||||
// TODO unusing class?
|
||||
public final class Constants {
|
||||
public static final String LiquidJuice = "juice";
|
||||
public static final String LiquidWater = "water";
|
||||
public static final String LiquidSeedOil = "seedoil";
|
||||
public static final String LiquidCreosote = "Creosote Oil";
|
||||
public static final String LiquidEthanol = "bioethanol";
|
||||
public static final String LiquidHoney = "for.honey";
|
||||
}
|
||||
@@ -40,7 +40,7 @@ public class CeramicColor implements IDesignMaterial {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColour() {
|
||||
public int getColor() {
|
||||
return color.getColor(false);
|
||||
}
|
||||
}
|
||||
@@ -21,8 +21,8 @@ import java.util.List;
|
||||
|
||||
public abstract class AbstractMod implements IPacketProvider, IInitializable {
|
||||
private SimpleNetworkWrapper wrapper;
|
||||
private LinkedHashSet<Field> fields;
|
||||
protected List<IInitializable> modules;
|
||||
private final LinkedHashSet<Field> fields;
|
||||
protected final List<IInitializable> modules;
|
||||
|
||||
public AbstractMod() {
|
||||
fields = new LinkedHashSet<>();
|
||||
|
||||
@@ -27,8 +27,7 @@ public class BlockMetadata extends BlockContainer implements IBlockMetadata {
|
||||
}
|
||||
|
||||
@Override
|
||||
// TODO fix deprecated usage
|
||||
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z) {
|
||||
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z, boolean willHarvest) {
|
||||
return breakBlock(this, player, world, x, y, z);
|
||||
}
|
||||
|
||||
@@ -121,8 +120,7 @@ public class BlockMetadata extends BlockContainer implements IBlockMetadata {
|
||||
}
|
||||
|
||||
@Override
|
||||
// TODO fix deprecated usage
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) {
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player) {
|
||||
return getPickBlock(world, x, y, z);
|
||||
}
|
||||
}
|
||||
@@ -22,9 +22,9 @@ import binnie.core.craftgui.resource.minecraft.StandardTexture;
|
||||
import binnie.core.machines.inventory.SlotValidator;
|
||||
import binnie.core.util.I18N;
|
||||
import binnie.extrabees.core.ExtraBeeTexture;
|
||||
import binnie.extrabees.gui.punnett.ExtraBeeGUITexture;
|
||||
import binnie.extrabees.gui.ExtraBeeGUITexture;
|
||||
import binnie.genetics.gui.ControlChromosome;
|
||||
import binnie.genetics.machine.Analyser;
|
||||
import binnie.genetics.machine.analyser.Analyser;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IAllele;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package binnie.core.craftgui.controls.button;
|
||||
package binnie.core.craftgui.controls;
|
||||
|
||||
import binnie.core.craftgui.CraftGUI;
|
||||
import binnie.core.craftgui.IWidget;
|
||||
@@ -1,10 +0,0 @@
|
||||
package binnie.core.craftgui.controls;
|
||||
|
||||
// TODO unused interface?
|
||||
public interface IControlSelection<T> {
|
||||
T getSelectedValue();
|
||||
|
||||
void setSelectedValue(T p0);
|
||||
|
||||
boolean isSelected(IControlSelectionOption<T> p0);
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
package binnie.core.craftgui.controls.button;
|
||||
|
||||
import binnie.core.craftgui.IWidget;
|
||||
import binnie.core.craftgui.controls.core.IControlValue;
|
||||
import binnie.core.craftgui.events.EventMouse;
|
||||
import binnie.core.craftgui.events.EventValueChanged;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
// TODO unused class?
|
||||
public class ControlEnumButton<T> extends ControlButton implements IControlValue<T> {
|
||||
public static String eventEnumChanged = "eventEnumButtonChanged";
|
||||
private T currentSelection;
|
||||
private List<T> enumConstants;
|
||||
|
||||
@Override
|
||||
public String getText() {
|
||||
return currentSelection.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMouseClick(EventMouse.Down event) {
|
||||
int index = enumConstants.indexOf(currentSelection);
|
||||
if (index < enumConstants.size() - 1) {
|
||||
index++;
|
||||
} else {
|
||||
index = 0;
|
||||
}
|
||||
|
||||
T newEnum = enumConstants.get(index);
|
||||
setValue(newEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue(T selection) {
|
||||
if (currentSelection != selection) {
|
||||
currentSelection = selection;
|
||||
callEvent(new EventValueChanged<Object>(this, getValue()));
|
||||
}
|
||||
}
|
||||
|
||||
public ControlEnumButton(IWidget parent, float x, float y, float width, float height, T[] values) {
|
||||
super(parent, x, y, width, height, "");
|
||||
enumConstants = new ArrayList<T>();
|
||||
Collections.addAll(enumConstants, values);
|
||||
if (values.length > 0) {
|
||||
currentSelection = values[0];
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public T getValue() {
|
||||
return currentSelection;
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
package binnie.core.craftgui.controls.button;
|
||||
|
||||
import binnie.core.craftgui.IWidget;
|
||||
import binnie.core.craftgui.events.EventMouse;
|
||||
import binnie.core.craftgui.events.EventToggleButtonClicked;
|
||||
|
||||
// TODO unused class?
|
||||
public class ControlToggleButton extends ControlButton {
|
||||
boolean toggled;
|
||||
|
||||
@Override
|
||||
public void onMouseClick(EventMouse.Down event) {
|
||||
callEvent(new EventToggleButtonClicked(this, toggled));
|
||||
}
|
||||
|
||||
public ControlToggleButton(IWidget parent, int x, int y, int width, int height) {
|
||||
super(parent, x, y, width, height);
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
package binnie.core.craftgui.controls.core;
|
||||
|
||||
// TODO unused interface?
|
||||
public interface IControlIndexed {
|
||||
int getIndex();
|
||||
|
||||
void setIndex(int index);
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package binnie.core.craftgui.database;
|
||||
|
||||
import binnie.core.craftgui.IWidget;
|
||||
import binnie.core.craftgui.controls.ControlText;
|
||||
import binnie.core.craftgui.controls.ControlTextCentered;
|
||||
import binnie.core.craftgui.controls.core.Control;
|
||||
import binnie.core.genetics.BreedingSystem;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
// TODO unused class?
|
||||
public class PageBreederStats extends Control {
|
||||
String player;
|
||||
|
||||
public PageBreederStats(IWidget parent, int w, int h, String player) {
|
||||
super(parent, 0.0f, 0.0f, w, h);
|
||||
this.player = player;
|
||||
ControlText pageBranchOverview_branchName = new ControlTextCentered(this, 8.0f, EnumChatFormatting.UNDERLINE + "§tats" + EnumChatFormatting.RESET);
|
||||
BreedingSystem system = ((WindowAbstractDatabase) getSuperParent()).getBreedingSystem();
|
||||
}
|
||||
}
|
||||
@@ -31,17 +31,4 @@ public abstract class EventKey extends Event {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO unused class?
|
||||
public static class Up extends EventKey {
|
||||
public Up(IWidget origin, char character, int key) {
|
||||
super(origin, character, key);
|
||||
}
|
||||
|
||||
public abstract static class Handler extends EventHandler<Up> {
|
||||
public Handler() {
|
||||
super(Up.class);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -44,8 +44,7 @@ import net.minecraft.world.World;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Deque;
|
||||
|
||||
public abstract class Window extends TopLevelWidget implements INetwork.RecieveGuiNBT
|
||||
{
|
||||
public abstract class Window extends TopLevelWidget implements INetwork.RecieveGuiNBT {
|
||||
private GuiCraftGUI gui;
|
||||
private ContainerCraftGUI container;
|
||||
private WindowInventory windowInventory;
|
||||
@@ -76,7 +75,6 @@ public abstract class Window extends TopLevelWidget implements INetwork.RecieveG
|
||||
if (widget.hasAttribute(WidgetAttribute.BlockTooltip)) {
|
||||
return;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -98,7 +96,6 @@ public abstract class Window extends TopLevelWidget implements INetwork.RecieveG
|
||||
if (widget.hasAttribute(WidgetAttribute.BlockTooltip)) {
|
||||
return;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -123,32 +120,36 @@ public abstract class Window extends TopLevelWidget implements INetwork.RecieveG
|
||||
}
|
||||
|
||||
public Window(float width, float height, EntityPlayer player, IInventory inventory, Side side) {
|
||||
this.side = side;
|
||||
titleButtonLeft = 8.0f;
|
||||
titleButtonRight = 8.0f;
|
||||
bgText1 = null;
|
||||
bgText2 = null;
|
||||
hasBeenInitialised = false;
|
||||
this.side = Side.CLIENT;
|
||||
this.side = side;
|
||||
setInventories(player, inventory);
|
||||
container = new ContainerCraftGUI(this);
|
||||
windowInventory = new WindowInventory(this);
|
||||
if (side == Side.SERVER) {
|
||||
return;
|
||||
}
|
||||
|
||||
setSize(new IPoint(width, height));
|
||||
gui = new GuiCraftGUI(this);
|
||||
for (EnumHighlighting h : EnumHighlighting.values()) {
|
||||
ControlSlot.highlighting.put(h, new ArrayList<Integer>());
|
||||
ControlSlot.highlighting.put(h, new ArrayList<>());
|
||||
}
|
||||
(CraftGUI.Render = new Renderer(gui)).stylesheet(StyleSheetManager.getDefault());
|
||||
|
||||
CraftGUI.Render = new Renderer(gui);
|
||||
CraftGUI.Render.stylesheet(StyleSheetManager.getDefault());
|
||||
titleButtonLeft = -14.0f;
|
||||
|
||||
if (showHelpButton()) {
|
||||
new ControlHelp(this, titleButtonLeft += 22.0f, 8.0f);
|
||||
}
|
||||
if (showInfoButton() != null) {
|
||||
new ControlInfo(this, titleButtonLeft += 22.0f, 8.0f, showInfoButton());
|
||||
}
|
||||
|
||||
addSelfEventHandler(new EventWidget.ChangeSize.Handler() {
|
||||
@Override
|
||||
public void onEvent(EventWidget.ChangeSize event) {
|
||||
@@ -163,7 +164,8 @@ public abstract class Window extends TopLevelWidget implements INetwork.RecieveG
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
(this.title = new ControlTextCentered(this, 12.0f, title)).setColor(4210752);
|
||||
this.title = new ControlTextCentered(this, 12.0f, title);
|
||||
this.title.setColor(0x404040);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@@ -183,10 +185,12 @@ public abstract class Window extends TopLevelWidget implements INetwork.RecieveG
|
||||
if (hasBeenInitialised) {
|
||||
return;
|
||||
}
|
||||
|
||||
bgText1 = new StandardTexture(0, 0, 256, 256, getBackgroundTextureFile(1));
|
||||
if (getSize().x() > 256.0f) {
|
||||
bgText2 = new StandardTexture(0, 0, 256, 256, getBackgroundTextureFile(2));
|
||||
}
|
||||
|
||||
if (!BinnieCore.proxy.checkTexture(bgText1.getTexture())) {
|
||||
bgText1 = null;
|
||||
bgText2 = null;
|
||||
@@ -198,11 +202,12 @@ public abstract class Window extends TopLevelWidget implements INetwork.RecieveG
|
||||
public abstract void initialiseClient();
|
||||
|
||||
public void initialiseServer() {
|
||||
// ignored
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
CraftGUI.Render.colour(16777215);
|
||||
CraftGUI.Render.colour(0xffffff);
|
||||
if (getBackground1() != null) {
|
||||
CraftGUI.Render.texture(getBackground1(), IPoint.ZERO);
|
||||
}
|
||||
@@ -267,9 +272,6 @@ public abstract class Window extends TopLevelWidget implements INetwork.RecieveG
|
||||
return BinnieCore.proxy.getWorld();
|
||||
}
|
||||
|
||||
public void onInventoryUpdate() {
|
||||
}
|
||||
|
||||
public void sendClientAction(String name, NBTTagCompound action) {
|
||||
action.setString("type", name);
|
||||
MessageCraftGUI packet = new MessageCraftGUI(action);
|
||||
@@ -282,19 +284,20 @@ public abstract class Window extends TopLevelWidget implements INetwork.RecieveG
|
||||
float w = w();
|
||||
float titleButtonRight = this.titleButtonRight + 16.0f;
|
||||
this.titleButtonRight = titleButtonRight;
|
||||
ControlUser controlUser = new ControlUser(this, w - titleButtonRight, 8.0f, nbt.getString("username"));
|
||||
new ControlUser(this, w - titleButtonRight, 8.0f, nbt.getString("username"));
|
||||
this.titleButtonRight += 6.0f;
|
||||
}
|
||||
if (side == Side.CLIENT && name.equals("power-system")) {
|
||||
float w2 = w();
|
||||
float titleButtonRight2 = titleButtonRight + 16.0f;
|
||||
titleButtonRight = titleButtonRight2;
|
||||
ControlPowerSystem controlPowerSystem = new ControlPowerSystem(this, w2 - titleButtonRight2, 8.0f, PowerSystem.get(nbt.getByte("system")));
|
||||
new ControlPowerSystem(this, w2 - titleButtonRight2, 8.0f, PowerSystem.get(nbt.getByte("system")));
|
||||
titleButtonRight += 6.0f;
|
||||
}
|
||||
}
|
||||
|
||||
public void onWindowInventoryChanged() {
|
||||
// ignored
|
||||
}
|
||||
|
||||
public Texture getBackground1() {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package binnie.core.craftgui.minecraft.control;
|
||||
|
||||
import binnie.core.BinnieCore;
|
||||
import binnie.core.craftgui.CraftGUI;
|
||||
import binnie.core.craftgui.ITooltip;
|
||||
import binnie.core.craftgui.IWidget;
|
||||
@@ -7,6 +8,7 @@ import binnie.core.craftgui.Tooltip;
|
||||
import binnie.core.craftgui.WidgetAttribute;
|
||||
import binnie.core.craftgui.controls.core.Control;
|
||||
import binnie.core.craftgui.resource.minecraft.CraftGUITexture;
|
||||
import binnie.core.util.I18N;
|
||||
|
||||
public class ControlHelp extends Control implements ITooltip {
|
||||
public ControlHelp(IWidget parent, float x, float y) {
|
||||
@@ -22,10 +24,10 @@ public class ControlHelp extends Control implements ITooltip {
|
||||
@Override
|
||||
public void getTooltip(Tooltip tooltip) {
|
||||
tooltip.setType(Tooltip.Type.Help);
|
||||
tooltip.add("Help");
|
||||
tooltip.add("To activate help tooltips,");
|
||||
tooltip.add("hold down the tab key and");
|
||||
tooltip.add("mouse over controls.");
|
||||
tooltip.add(I18N.localise(BinnieCore.instance, "gui.tooltip.help"));
|
||||
tooltip.add(I18N.localise(BinnieCore.instance, "gui.tooltip.help.0"));
|
||||
tooltip.add(I18N.localise(BinnieCore.instance, "gui.tooltip.help.1"));
|
||||
tooltip.add(I18N.localise(BinnieCore.instance, "gui.tooltip.help.2"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package binnie.core.craftgui.minecraft.control;
|
||||
|
||||
import binnie.core.BinnieCore;
|
||||
import binnie.core.craftgui.CraftGUI;
|
||||
import binnie.core.craftgui.ITooltip;
|
||||
import binnie.core.craftgui.IWidget;
|
||||
@@ -7,6 +8,7 @@ import binnie.core.craftgui.Tooltip;
|
||||
import binnie.core.craftgui.WidgetAttribute;
|
||||
import binnie.core.craftgui.controls.core.Control;
|
||||
import binnie.core.craftgui.resource.minecraft.CraftGUITexture;
|
||||
import binnie.core.util.I18N;
|
||||
|
||||
public class ControlInfo extends Control implements ITooltip {
|
||||
private String info;
|
||||
@@ -25,7 +27,7 @@ public class ControlInfo extends Control implements ITooltip {
|
||||
@Override
|
||||
public void getTooltip(Tooltip tooltip) {
|
||||
tooltip.setType(Tooltip.Type.Information);
|
||||
tooltip.add("Info");
|
||||
tooltip.add(I18N.localise(BinnieCore.instance, "gui.tooltip.info"));
|
||||
tooltip.add(info);
|
||||
tooltip.setMaxWidth(200);
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ import binnie.core.machines.inventory.MachineSide;
|
||||
import binnie.core.machines.inventory.TankSlot;
|
||||
import binnie.core.machines.power.ITankMachine;
|
||||
import binnie.core.machines.power.TankInfo;
|
||||
import binnie.core.util.I18N;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.IIcon;
|
||||
@@ -89,7 +90,6 @@ public class ControlLiquidTank extends Control implements ITooltip {
|
||||
if (isTankValid()) {
|
||||
float height = horizontal ? 16.0f : 58.0f;
|
||||
int squaled = (int) (height * (getTank().getAmount() / getTank().getCapacity()));
|
||||
int yPos = (int) height + 1;
|
||||
Fluid fluid = getTank().liquid.getFluid();
|
||||
int hex = fluid.getColor(getTank().liquid);
|
||||
int r = (hex & 0xFF0000) >> 16;
|
||||
@@ -144,25 +144,32 @@ public class ControlLiquidTank extends Control implements ITooltip {
|
||||
|
||||
TankSlot slot = getTankSlot();
|
||||
tooltip.add(slot.getName());
|
||||
tooltip.add("Capacity: " + getTankCapacity() + " mB");
|
||||
tooltip.add("Insert Side: " + MachineSide.asString(slot.getInputSides()));
|
||||
tooltip.add("Extract Side: " + MachineSide.asString(slot.getOutputSides()));
|
||||
tooltip.add(I18N.localise(BinnieCore.instance, "gui.tooltip.tank.capacity", getTankCapacity()));
|
||||
tooltip.add(I18N.localise(BinnieCore.instance, "gui.tooltip.tank.insertSide", MachineSide.asString(slot.getInputSides())));
|
||||
tooltip.add(I18N.localise(BinnieCore.instance, "gui.tooltip.tank.extractSide", MachineSide.asString(slot.getOutputSides())));
|
||||
|
||||
if (slot.isReadOnly()) {
|
||||
tooltip.add("Output Only Tank");
|
||||
tooltip.add(I18N.localise(BinnieCore.instance, "gui.tooltip.tank.outputOnlyTank"));
|
||||
}
|
||||
|
||||
if (slot.getValidator() == null) {
|
||||
tooltip.add(I18N.localise(BinnieCore.instance, "gui.tooltip.tank.acceptsAny"));
|
||||
} else {
|
||||
tooltip.add(I18N.localise(BinnieCore.instance, "gui.tooltip.tank.accepts", slot.getValidator().getTooltip()));
|
||||
}
|
||||
tooltip.add("Accepts: " + ((slot.getValidator() == null) ? "Any Item" : slot.getValidator().getTooltip()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getTooltip(Tooltip tooltip) {
|
||||
if (isTankValid()) {
|
||||
int percentage = (int) (100.0 * getTank().getAmount() / getTankCapacity());
|
||||
tooltip.add(getTank().getName());
|
||||
tooltip.add(percentage + "% full");
|
||||
tooltip.add((int) getTank().getAmount() + " mB");
|
||||
if (!isTankValid()) {
|
||||
tooltip.add(I18N.localise(BinnieCore.instance, "gui.tooltip.tank.empty"));
|
||||
return;
|
||||
}
|
||||
tooltip.add("Empty");
|
||||
|
||||
int percentage = (int) (100.0 * getTank().getAmount() / getTankCapacity());
|
||||
tooltip.add(getTank().getName());
|
||||
tooltip.add(I18N.localise(BinnieCore.instance, "gui.tooltip.tank.full", percentage));
|
||||
tooltip.add(I18N.localise(BinnieCore.instance, "gui.tooltip.tank.amount", (int) getTank().getAmount()));
|
||||
}
|
||||
|
||||
private TankSlot getTankSlot() {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package binnie.core.craftgui.minecraft.control;
|
||||
|
||||
import binnie.core.BinnieCore;
|
||||
import binnie.core.craftgui.CraftGUI;
|
||||
import binnie.core.craftgui.ITooltip;
|
||||
import binnie.core.craftgui.IWidget;
|
||||
@@ -8,6 +9,7 @@ import binnie.core.craftgui.WidgetAttribute;
|
||||
import binnie.core.craftgui.controls.core.Control;
|
||||
import binnie.core.craftgui.resource.minecraft.CraftGUITexture;
|
||||
import binnie.core.machines.power.PowerSystem;
|
||||
import binnie.core.util.I18N;
|
||||
|
||||
public class ControlPowerSystem extends Control implements ITooltip {
|
||||
private PowerSystem system;
|
||||
@@ -26,8 +28,8 @@ public class ControlPowerSystem extends Control implements ITooltip {
|
||||
@Override
|
||||
public void getTooltip(Tooltip tooltip) {
|
||||
tooltip.setType(Tooltip.Type.Power);
|
||||
tooltip.add("Power Supply");
|
||||
tooltip.add("Powered by " + system.getUnitName());
|
||||
tooltip.add(I18N.localise(BinnieCore.instance, "gui.tooltip.powerSupply"));
|
||||
tooltip.add(I18N.localise(BinnieCore.instance, "gui.tooltip.poweredBy", system.getUnitName()));
|
||||
tooltip.setMaxWidth(200);
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
package binnie.core.craftgui.minecraft.render;
|
||||
|
||||
import binnie.core.craftgui.geometry.IArea;
|
||||
import binnie.core.resource.IBinnieTexture;
|
||||
|
||||
// TODO unused class?
|
||||
public class MinecraftTexture {
|
||||
protected IArea textureArea;
|
||||
protected IBinnieTexture texture;
|
||||
|
||||
public MinecraftTexture() {
|
||||
textureArea = new IArea(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package binnie.core.craftgui.minecraft.render;
|
||||
|
||||
import binnie.core.craftgui.IWidget;
|
||||
import binnie.core.craftgui.minecraft.GuiCraftGUI;
|
||||
|
||||
// TODO unused class?
|
||||
public abstract class RenderCommand {
|
||||
protected IWidget widget;
|
||||
|
||||
public RenderCommand(IWidget widget) {
|
||||
this.widget = widget;
|
||||
}
|
||||
|
||||
public abstract void render(GuiCraftGUI p0);
|
||||
}
|
||||
@@ -1,111 +0,0 @@
|
||||
package binnie.core.genetics;
|
||||
|
||||
import binnie.core.BinnieCore;
|
||||
import binnie.core.util.I18N;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IAlleleSpecies;
|
||||
import forestry.api.genetics.IClassification;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
// TODO unused interface?
|
||||
interface IBreedingMessage {
|
||||
String getTitle();
|
||||
|
||||
String getBody();
|
||||
|
||||
ItemStack getIcon();
|
||||
|
||||
class MessageSpeciesDiscovered implements IBreedingMessage {
|
||||
IAlleleSpecies species;
|
||||
ItemStack stack;
|
||||
|
||||
public MessageSpeciesDiscovered(IAlleleSpecies species) {
|
||||
this.species = species;
|
||||
ISpeciesRoot root = null;
|
||||
for (ISpeciesRoot sRoot : AlleleManager.alleleRegistry.getSpeciesRoot().values()) {
|
||||
if (sRoot.getKaryotype()[0].getAlleleClass().isInstance(species)) {
|
||||
root = sRoot;
|
||||
}
|
||||
}
|
||||
if (root != null) {
|
||||
stack = root.getMemberStack(root.templateAsIndividual(root.getTemplate(species.getUID())), 0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return I18N.localise(BinnieCore.instance, "gui.breedingmessage.species");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBody() {
|
||||
return species.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getIcon() {
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
|
||||
class BranchDiscovered implements IBreedingMessage {
|
||||
IAlleleSpecies species;
|
||||
IClassification classification;
|
||||
ItemStack stack;
|
||||
|
||||
public BranchDiscovered(IAlleleSpecies species, IClassification classification) {
|
||||
this.species = species;
|
||||
this.classification = classification;
|
||||
ISpeciesRoot root = null;
|
||||
for (ISpeciesRoot sRoot : AlleleManager.alleleRegistry.getSpeciesRoot().values()) {
|
||||
if (sRoot.getKaryotype()[0].getAlleleClass().isInstance(species)) {
|
||||
root = sRoot;
|
||||
}
|
||||
}
|
||||
if (root != null) {
|
||||
stack = root.getMemberStack(root.templateAsIndividual(root.getTemplate(species.getUID())), 0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return I18N.localise(BinnieCore.instance, "gui.breedingmessage.branch");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBody() {
|
||||
return classification.getScientific();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getIcon() {
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
|
||||
class EpithetGained implements IBreedingMessage {
|
||||
String epithet;
|
||||
ItemStack stack;
|
||||
|
||||
public EpithetGained(String epithet, ISpeciesRoot root) {
|
||||
this.epithet = epithet;
|
||||
stack = root.getMemberStack(root.templateAsIndividual(root.getDefaultTemplate()), 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return I18N.localise(BinnieCore.instance, "gui.breedingmessage.epithet");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBody() {
|
||||
return epithet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getIcon() {
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,6 @@ import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import forestry.api.lepidopterology.IButterflyRoot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.event.world.WorldEvent;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -67,11 +66,6 @@ public class ManagerGenetics extends ManagerBase {
|
||||
refreshData();
|
||||
}
|
||||
|
||||
// TODO unused method?
|
||||
public boolean isSpeciesDiscovered(IAlleleSpecies species, World world, boolean nei) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public ITreeRoot getTreeRoot() {
|
||||
return (ITreeRoot) AlleleManager.alleleRegistry.getSpeciesRoot("rootTrees");
|
||||
}
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
package binnie.core.genetics;
|
||||
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.lepidopterology.IButterfly;
|
||||
import forestry.api.lepidopterology.IButterflyNursery;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
// TODO unused class?
|
||||
public class VirtualMothHousing extends VirtualHousing implements IButterflyNursery {
|
||||
public VirtualMothHousing(EntityPlayer player) {
|
||||
super(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IButterfly getCaterpillar() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIndividual getNanny() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCaterpillar(IButterfly butterfly) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canNurse(IButterfly butterfly) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package binnie.core.liquid;
|
||||
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
class BinnieFluid extends Fluid {
|
||||
protected IFluidType fluidType;
|
||||
@@ -8,8 +9,7 @@ class BinnieFluid extends Fluid {
|
||||
private String name;
|
||||
|
||||
@Override
|
||||
// TODO fix deprecated usage
|
||||
public String getLocalizedName() {
|
||||
public String getLocalizedName(FluidStack stack) {
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ import binnie.core.BinnieCore;
|
||||
import binnie.core.machines.component.IInteraction;
|
||||
import binnie.core.machines.component.IRender;
|
||||
import binnie.core.machines.network.INetwork;
|
||||
import binnie.core.machines.power.ITankMachine;
|
||||
import binnie.core.network.BinnieCorePacketID;
|
||||
import binnie.core.network.INetworkedEntity;
|
||||
import binnie.core.network.packet.MessageTileNBT;
|
||||
@@ -114,13 +113,6 @@ public class Machine implements INetworkedEntity, INBTTagable, INetwork.TilePack
|
||||
return tile;
|
||||
}
|
||||
|
||||
public void sendPacket() {
|
||||
if (!BinnieCore.proxy.isSimulating(getTileEntity().getWorldObj())) {
|
||||
return;
|
||||
}
|
||||
BinnieCore.proxy.sendNetworkEntityPacket((INetworkedEntity) getTileEntity());
|
||||
}
|
||||
|
||||
public Side getSide() {
|
||||
return BinnieCore.proxy.isSimulating(getTileEntity().getWorldObj()) ? Side.SERVER : Side.CLIENT;
|
||||
}
|
||||
@@ -178,10 +170,6 @@ public class Machine implements INetworkedEntity, INBTTagable, INetwork.TilePack
|
||||
return getInterface(IInventory.class);
|
||||
}
|
||||
|
||||
public ITankMachine getTankContainer() {
|
||||
return getInterface(ITankMachine.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbttagcompound) {
|
||||
for (MachineComponent component : getComponents()) {
|
||||
|
||||
@@ -9,7 +9,7 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
// TODO unused class?
|
||||
// Hmm. It's used class
|
||||
public class RendererMachine extends TileEntitySpecialRenderer implements ISimpleBlockRenderingHandler {
|
||||
RenderBlocks blockRenderer;
|
||||
|
||||
|
||||
@@ -72,15 +72,6 @@ public abstract class BaseSlot<T> implements INBTTagable, IValidator<T> {
|
||||
forbidExtraction();
|
||||
}
|
||||
|
||||
// TODO unusing method?
|
||||
public void setInputSides(EnumSet<ForgeDirection> sides) {
|
||||
for (ForgeDirection side : EnumSet.complementOf(sides)) {
|
||||
if (side != ForgeDirection.UNKNOWN) {
|
||||
access.setInsert(side, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setOutputSides(EnumSet<ForgeDirection> sides) {
|
||||
for (ForgeDirection side : EnumSet.complementOf(sides)) {
|
||||
if (side != ForgeDirection.UNKNOWN) {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package binnie.core.machines.power;
|
||||
|
||||
import binnie.core.BinnieCore;
|
||||
import binnie.core.util.I18N;
|
||||
import forestry.api.core.INBTTagable;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
@@ -49,10 +51,6 @@ public class ErrorState implements INBTTagable {
|
||||
return progress;
|
||||
}
|
||||
|
||||
public void setIsProgress() {
|
||||
progress = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
name = nbt.getString("name");
|
||||
@@ -109,13 +107,13 @@ public class ErrorState implements INBTTagable {
|
||||
}
|
||||
|
||||
public NoItem(String desc, int[] slots) {
|
||||
super("No Item", desc, slots);
|
||||
super(I18N.localise(BinnieCore.instance, "machine.error.noItem"), desc, slots);
|
||||
}
|
||||
}
|
||||
|
||||
public static class InvalidItem extends Item {
|
||||
public InvalidItem(String desc, int slot) {
|
||||
this("Invalid Item", desc, slot);
|
||||
this(I18N.localise(BinnieCore.instance, "machine.error.invalidItem"), desc, slot);
|
||||
}
|
||||
|
||||
public InvalidItem(String name, String desc, int slot) {
|
||||
@@ -125,31 +123,28 @@ public class ErrorState implements INBTTagable {
|
||||
|
||||
public static class NoSpace extends Item {
|
||||
public NoSpace(String desc, int[] slots) {
|
||||
super("No Space", desc, slots);
|
||||
super(I18N.localise(BinnieCore.instance, "machine.error.noSpace"), desc, slots);
|
||||
}
|
||||
}
|
||||
|
||||
public static class InsufficientPower extends ErrorState {
|
||||
public InsufficientPower() {
|
||||
super("Insufficient Power", "Not enough power to operate");
|
||||
super(
|
||||
I18N.localise(BinnieCore.instance, "machine.error.insufficientPower.title"),
|
||||
I18N.localise(BinnieCore.instance, "machine.error.insufficientPower.desc")
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public static class TankSpace extends Tank {
|
||||
public TankSpace(String desc, int tank) {
|
||||
super("Tank Full", desc, new int[]{tank});
|
||||
super(I18N.localise(BinnieCore.instance, "machine.error.tankFull"), desc, new int[]{tank});
|
||||
}
|
||||
}
|
||||
|
||||
public static class InsufficientLiquid extends Tank {
|
||||
public InsufficientLiquid(String desc, int tank) {
|
||||
super("Insufficient Liquid", desc, new int[]{tank});
|
||||
}
|
||||
}
|
||||
|
||||
public static class InvalidRecipe extends Item {
|
||||
public InvalidRecipe(String string, int[] slots) {
|
||||
super("Invalid Recipe", string, slots);
|
||||
super(I18N.localise(BinnieCore.instance, "machine.error.insufficientLiquid"), desc, new int[]{tank});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@ import binnie.core.craftgui.WidgetAttribute;
|
||||
import binnie.core.craftgui.controls.ControlCheckbox;
|
||||
import binnie.core.craftgui.controls.ControlText;
|
||||
import binnie.core.craftgui.controls.ControlTextEdit;
|
||||
import binnie.core.craftgui.controls.button.ControlButton;
|
||||
import binnie.core.craftgui.controls.ControlButton;
|
||||
import binnie.core.craftgui.controls.core.Control;
|
||||
import binnie.core.craftgui.controls.page.ControlPage;
|
||||
import binnie.core.craftgui.controls.page.ControlPages;
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
package binnie.core.machines.storage;
|
||||
|
||||
import binnie.core.AbstractMod;
|
||||
import binnie.core.BinnieCore;
|
||||
import binnie.core.craftgui.minecraft.Window;
|
||||
import binnie.genetics.craftgui.WindowMachine;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
|
||||
// TODO unused class?
|
||||
public class WindowTest extends WindowMachine {
|
||||
public static Window create(EntityPlayer player, IInventory inventory, Side side) {
|
||||
return new WindowCompartment(player, inventory, side);
|
||||
}
|
||||
|
||||
public WindowTest(EntityPlayer player, IInventory inventory, Side side) {
|
||||
super(320, 240, player, inventory, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialiseClient() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return "Test";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AbstractMod getMod() {
|
||||
return BinnieCore.instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getName() {
|
||||
return "Test";
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
package binnie.core.multiblock;
|
||||
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
// TODO unused class?
|
||||
public class BlockMultiblockMachine extends BlockContainer {
|
||||
public BlockMultiblockMachine(String blockName) {
|
||||
super(Material.iron);
|
||||
setHardness(1.5f);
|
||||
setBlockName(blockName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createTileEntity(World world, int metadata) {
|
||||
return new TileEntityMultiblockMachine();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int metadata) {
|
||||
return new TileEntityMultiblockMachine();
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
package binnie.core.multiblock;
|
||||
|
||||
import binnie.core.machines.Machine;
|
||||
import binnie.core.machines.TileEntityMachine;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
class TileEntityMultiblockMachine extends TileEntity {
|
||||
private boolean inStructure;
|
||||
private int tileX;
|
||||
private int tileY;
|
||||
private int tileZ;
|
||||
|
||||
boolean inStructure() {
|
||||
return inStructure;
|
||||
}
|
||||
|
||||
public Machine getMachine() {
|
||||
return getMasterMachine();
|
||||
}
|
||||
|
||||
private Machine getMasterMachine() {
|
||||
if (!inStructure) {
|
||||
return null;
|
||||
}
|
||||
|
||||
TileEntity tile = worldObj.getTileEntity(xCoord + tileX, yCoord + tileY, zCoord + tileZ);
|
||||
if (tile instanceof TileEntityMachine) {
|
||||
return ((TileEntityMachine) tile).getMachine();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -18,11 +18,6 @@ public class BinnieResource {
|
||||
this.path = path;
|
||||
}
|
||||
|
||||
// TODO unused method?
|
||||
public String getFullPath() {
|
||||
return "/assets/" + mod + "/textures/" + type.toString() + "/" + path;
|
||||
}
|
||||
|
||||
public ResourceLocation getResourceLocation() {
|
||||
return new ResourceLocation(mod, "textures/" + type.toString() + "/" + path);
|
||||
}
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
package binnie.core.texture;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
// TODO unused class?
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class TextureManager
|
||||
{
|
||||
static List<Icon> textures = new ArrayList<>();
|
||||
|
||||
public static void init() {
|
||||
// ignored
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
package binnie.core.triggers;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
|
||||
// TODO unusing class?
|
||||
public class TriggerInventory {
|
||||
private static Boolean isSlotEmpty(IInventory inventory, int slot) {
|
||||
return inventory.getStackInSlot(slot) != null;
|
||||
}
|
||||
}
|
||||
@@ -14,16 +14,16 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
class TriggerProvider implements ITriggerProvider {
|
||||
static TriggerProvider instance = new TriggerProvider();
|
||||
public static List<BinnieTrigger> triggers = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public Collection<ITriggerExternal> getExternalTriggers(ForgeDirection side, TileEntity tile) {
|
||||
LinkedList<TriggerData> list = new LinkedList<TriggerData>();
|
||||
LinkedList<ITriggerExternal> triggerData = new LinkedList<ITriggerExternal>();
|
||||
LinkedList<TriggerData> list = new LinkedList<>();
|
||||
LinkedList<ITriggerExternal> triggerData = new LinkedList<>();
|
||||
if (tile instanceof IBuildcraft.TriggerProvider) {
|
||||
((IBuildcraft.TriggerProvider) tile).getTriggers(list);
|
||||
}
|
||||
|
||||
for (TriggerData data : list) {
|
||||
if (data.getKey() != null && data.getKey().getUniqueTag() != null) {
|
||||
triggerData.add(data.getKey());
|
||||
@@ -32,21 +32,6 @@ class TriggerProvider implements ITriggerProvider {
|
||||
return triggerData;
|
||||
}
|
||||
|
||||
// TODO unusing method?
|
||||
public static boolean isTriggerActive(ITriggerExternal trigger, TileEntity tile) {
|
||||
LinkedList<TriggerData> list = new LinkedList<TriggerData>();
|
||||
LinkedList<ITriggerExternal> triggerData = new LinkedList<ITriggerExternal>();
|
||||
if (tile instanceof IBuildcraft.TriggerProvider) {
|
||||
((IBuildcraft.TriggerProvider) tile).getTriggers(list);
|
||||
}
|
||||
for (TriggerData data : list) {
|
||||
if (data.getKey() == trigger) {
|
||||
return data.getValue();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<ITriggerInternal> getInternalTriggers(IStatementContainer container) {
|
||||
return new ArrayList<>();
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
package binnie.core.triggers;
|
||||
|
||||
import binnie.core.machines.Machine;
|
||||
import binnie.core.machines.power.IProcess;
|
||||
|
||||
// TODO unusing class?
|
||||
public class TriggerWorking {
|
||||
public static TriggerData isNotWorking(Object inventory) {
|
||||
IProcess process = Machine.getInterface(IProcess.class, inventory);
|
||||
boolean b = false;
|
||||
if (process != null) {
|
||||
b = (process.canWork() != null && process.canProgress() != null);
|
||||
}
|
||||
return new TriggerData(BinnieTrigger.triggerIsNotWorking, b);
|
||||
}
|
||||
|
||||
public static TriggerData isWorking(Object inventory) {
|
||||
IProcess process = Machine.getInterface(IProcess.class, inventory);
|
||||
boolean b = false;
|
||||
if (process != null) {
|
||||
b = (process.canWork() == null && process.canProgress() == null);
|
||||
}
|
||||
return new TriggerData(BinnieTrigger.triggerIsWorking, b);
|
||||
}
|
||||
|
||||
public static TriggerData canWork(Object inventory) {
|
||||
IProcess process = Machine.getInterface(IProcess.class, inventory);
|
||||
boolean b = false;
|
||||
if (process != null) {
|
||||
b = (process.canWork() == null);
|
||||
}
|
||||
return new TriggerData(BinnieTrigger.triggerCanWork, b);
|
||||
}
|
||||
|
||||
public static TriggerData cannotWork(Object inventory) {
|
||||
IProcess process = Machine.getInterface(IProcess.class, inventory);
|
||||
boolean b = false;
|
||||
if (process != null) {
|
||||
b = (process.canWork() != null);
|
||||
}
|
||||
return new TriggerData(BinnieTrigger.triggerCannotWork, b);
|
||||
}
|
||||
}
|
||||
@@ -71,11 +71,6 @@ public enum EnumHiveFrame implements IHiveFrame, IBeeModifier {
|
||||
);
|
||||
}
|
||||
|
||||
// TODO unused method?
|
||||
public int getIconIndex() {
|
||||
return 55 + ordinal();
|
||||
}
|
||||
|
||||
public void setMaxDamage(int damage) {
|
||||
maxDamage = damage;
|
||||
}
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
package binnie.extrabees.genetics.items;
|
||||
|
||||
import binnie.extrabees.ExtraBees;
|
||||
import binnie.extrabees.core.ExtraBeeGUID;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
// TODO unused class?
|
||||
public class ItemPunnettSquare extends Item {
|
||||
public ItemPunnettSquare() {
|
||||
setCreativeTab(CreativeTabs.tabTools);
|
||||
setMaxStackSize(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister register) {
|
||||
itemIcon = ExtraBees.proxy.getIcon(register, "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack itemstack) {
|
||||
return "Punnett Square";
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
|
||||
ExtraBees.proxy.openGui(ExtraBeeGUID.PunnettSquare, player, (int) player.posX, (int) player.posY, (int) player.posZ);
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package binnie.extrabees.gui.punnett;
|
||||
package binnie.extrabees.gui;
|
||||
|
||||
public enum ExtraBeeGUITexture {
|
||||
Chromosome,
|
||||
@@ -1,48 +0,0 @@
|
||||
package binnie.extrabees.gui;
|
||||
|
||||
import binnie.core.AbstractMod;
|
||||
import binnie.core.craftgui.minecraft.Window;
|
||||
import binnie.core.craftgui.minecraft.control.ControlPlayerInventory;
|
||||
import binnie.core.craftgui.minecraft.control.ControlSlot;
|
||||
import binnie.core.machines.Machine;
|
||||
import binnie.core.machines.TileEntityMachine;
|
||||
import binnie.extrabees.ExtraBees;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
|
||||
// TODO unused class?
|
||||
public class WindowAlvearyIndustrialFrame extends Window {
|
||||
protected Machine machine;
|
||||
protected ControlPlayerInventory playerInventory;
|
||||
|
||||
public WindowAlvearyIndustrialFrame(EntityPlayer player, IInventory inventory, Side side) {
|
||||
super(176.0f, 144.0f, player, inventory, side);
|
||||
machine = ((TileEntityMachine) inventory).getMachine();
|
||||
}
|
||||
|
||||
public static Window create(EntityPlayer player, IInventory inventory, Side side) {
|
||||
if (player == null || inventory == null) {
|
||||
return null;
|
||||
}
|
||||
return new WindowAlvearyIndustrialFrame(player, inventory, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialiseClient() {
|
||||
setTitle("Industrial Frame Housing");
|
||||
playerInventory = new ControlPlayerInventory(this);
|
||||
ControlSlot slot = new ControlSlot(this, 79.0f, 30.0f);
|
||||
slot.assign(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractMod getMod() {
|
||||
return ExtraBees.instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "AlvearyIndustrialFrame";
|
||||
}
|
||||
}
|
||||
@@ -48,31 +48,4 @@ public class WindowApiaristDatabase extends WindowAbstractDatabase {
|
||||
public String getName() {
|
||||
return "Database";
|
||||
}
|
||||
|
||||
// TODO unused class?
|
||||
enum SpeciesTab {
|
||||
Overview(0xff),
|
||||
Genome(0xffff00),
|
||||
Productivity(0xffff),
|
||||
Climate(0xff0000),
|
||||
ResultantMutations(0xff00ff),
|
||||
FurtherMutations(0xff00);
|
||||
|
||||
public int colour;
|
||||
|
||||
SpeciesTab(int colour) {
|
||||
this.colour = colour;
|
||||
}
|
||||
}
|
||||
|
||||
enum BranchesTab {
|
||||
Overview(255),
|
||||
Species(16711680);
|
||||
|
||||
public int colour;
|
||||
|
||||
BranchesTab(int colour) {
|
||||
this.colour = colour;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
package binnie.extrabees.gui.punnett;
|
||||
|
||||
import binnie.core.craftgui.CraftGUI;
|
||||
import binnie.core.craftgui.ITooltip;
|
||||
import binnie.core.craftgui.IWidget;
|
||||
import binnie.core.craftgui.Tooltip;
|
||||
import binnie.core.craftgui.WidgetAttribute;
|
||||
import binnie.core.craftgui.controls.core.Control;
|
||||
import binnie.core.craftgui.controls.core.IControlValue;
|
||||
import forestry.api.genetics.IChromosomeType;
|
||||
|
||||
// TODO unused class?
|
||||
public class ControlChromosome extends Control implements IControlValue<IChromosomeType>, ITooltip {
|
||||
protected IChromosomeType value;
|
||||
|
||||
protected ControlChromosome(IWidget parent, float x, float y, IChromosomeType type) {
|
||||
super(parent, x, y, 16.0f, 16.0f);
|
||||
setValue(type);
|
||||
addAttribute(WidgetAttribute.MouseOver);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IChromosomeType getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue(IChromosomeType value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
CraftGUI.Render.texture(ExtraBeeGUITexture.Chromosome, getArea());
|
||||
CraftGUI.Render.colour(0xff0000);
|
||||
CraftGUI.Render.texture(ExtraBeeGUITexture.Chromosome2, getArea());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getTooltip(Tooltip tooltip) {
|
||||
if (value != null) {
|
||||
tooltip.add(value.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,76 +0,0 @@
|
||||
package binnie.extrabees.gui.punnett;
|
||||
|
||||
import binnie.core.craftgui.CraftGUI;
|
||||
import binnie.core.craftgui.IWidget;
|
||||
import binnie.core.craftgui.controls.ControlText;
|
||||
import binnie.core.craftgui.controls.core.Control;
|
||||
import binnie.core.craftgui.geometry.IArea;
|
||||
import binnie.core.craftgui.geometry.TextJustification;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IChromosomeType;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
public class ControlPunnett extends Control {
|
||||
protected static int boxWidth = 80;
|
||||
protected static int boxHeight = 28;
|
||||
|
||||
protected ControlPunnett(IWidget parent, float x, float y) {
|
||||
super(parent, x, y, ControlPunnett.boxWidth * 3, ControlPunnett.boxWidth * 3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
CraftGUI.Render.solid(new IArea(0.0f, ControlPunnett.boxHeight, ControlPunnett.boxWidth * 3, 1.0f), 11184810);
|
||||
CraftGUI.Render.solid(new IArea(ControlPunnett.boxWidth / 2.0f, ControlPunnett.boxHeight * 2, ControlPunnett.boxWidth * 2.5f, 1.0f), 11184810);
|
||||
CraftGUI.Render.solid(new IArea(ControlPunnett.boxWidth, 0.0f, 1.0f, ControlPunnett.boxHeight * 3), 11184810);
|
||||
CraftGUI.Render.solid(new IArea(ControlPunnett.boxWidth * 2, ControlPunnett.boxHeight / 2.0f, 1.0f, ControlPunnett.boxHeight * 2.5f), 11184810);
|
||||
}
|
||||
|
||||
// TODO unused method?
|
||||
public void setup(IChromosomeType chromosome, IIndividual ind1, IIndividual ind2, ISpeciesRoot root) {
|
||||
deleteAllChildren();
|
||||
if (chromosome == null || ind1 == null || ind2 == null || root == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
IAllele primary1 = ind1.getGenome().getActiveAllele(chromosome);
|
||||
IAllele primary2 = ind2.getGenome().getActiveAllele(chromosome);
|
||||
IAllele secondary1 = ind1.getGenome().getInactiveAllele(chromosome);
|
||||
IAllele secondary2 = ind2.getGenome().getInactiveAllele(chromosome);
|
||||
int x = 1;
|
||||
int y;
|
||||
|
||||
for (IAllele allele1 : new IAllele[]{primary1, secondary1}) {
|
||||
y = 1;
|
||||
for (IAllele allele2 : new IAllele[]{primary2, secondary2}) {
|
||||
List<IAllele> alleles = new LinkedList<IAllele>();
|
||||
if (allele1.isDominant() && !allele2.isDominant()) {
|
||||
alleles.add(allele1);
|
||||
} else if (allele2.isDominant() && !allele1.isDominant()) {
|
||||
alleles.add(allele2);
|
||||
} else {
|
||||
alleles.add(allele1);
|
||||
if (allele1 != allele2) {
|
||||
alleles.add(allele2);
|
||||
}
|
||||
}
|
||||
|
||||
String text = "";
|
||||
for (IAllele allele3 : alleles) {
|
||||
text = text + allele3.getName() + ": " + 25.0f / alleles.size() + "%\n";
|
||||
}
|
||||
new ControlText(this, new IArea(x * ControlPunnett.boxWidth, ControlPunnett.boxHeight * y, ControlPunnett.boxWidth, ControlPunnett.boxHeight), text, TextJustification.TopCenter).setColor(11184810);
|
||||
y++;
|
||||
}
|
||||
x++;
|
||||
}
|
||||
new ControlText(this, new IArea(ControlPunnett.boxWidth, 0.0f, ControlPunnett.boxWidth, ControlPunnett.boxHeight), "\n" + primary1.getName(), TextJustification.TopCenter).setColor(11184810);
|
||||
new ControlText(this, new IArea(ControlPunnett.boxWidth * 2, 0.0f, ControlPunnett.boxWidth, ControlPunnett.boxHeight), "\n" + secondary1.getName(), TextJustification.TopCenter).setColor(11184810);
|
||||
new ControlText(this, new IArea(0.0f, ControlPunnett.boxHeight, ControlPunnett.boxWidth, ControlPunnett.boxHeight), primary2.getName(), TextJustification.TopCenter).setColor(11184810);
|
||||
new ControlText(this, new IArea(0.0f, ControlPunnett.boxHeight * 2, ControlPunnett.boxWidth, ControlPunnett.boxHeight), primary2.getName(), TextJustification.TopCenter).setColor(11184810);
|
||||
}
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
package binnie.extrabees.gui.punnett;
|
||||
|
||||
import binnie.core.AbstractMod;
|
||||
import binnie.core.craftgui.CraftGUI;
|
||||
import binnie.core.craftgui.minecraft.Window;
|
||||
import binnie.core.craftgui.minecraft.control.ControlSlot;
|
||||
import binnie.core.craftgui.resource.StyleSheet;
|
||||
import binnie.core.craftgui.resource.minecraft.CraftGUITexture;
|
||||
import binnie.core.craftgui.resource.minecraft.PaddedTexture;
|
||||
import binnie.core.craftgui.resource.minecraft.StandardTexture;
|
||||
import binnie.extrabees.ExtraBees;
|
||||
import binnie.extrabees.core.ExtraBeeTexture;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
|
||||
// TODO unused class?
|
||||
public class WindowPunnettSquare extends Window {
|
||||
ControlSlot bee1;
|
||||
ControlSlot bee2;
|
||||
ControlPunnett punnett;
|
||||
ISpeciesRoot root;
|
||||
|
||||
public WindowPunnettSquare(EntityPlayer player, IInventory inventory, Side side) {
|
||||
super(245.0f, 205.0f, player, inventory, side);
|
||||
root = null;
|
||||
}
|
||||
|
||||
public static Window create(EntityPlayer player, IInventory inventory, Side side) {
|
||||
return new WindowPunnettSquare(player, inventory, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractMod getMod() {
|
||||
return ExtraBees.instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "Punnett";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialiseClient() {
|
||||
setTitle("Punnett Square");
|
||||
CraftGUI.Render.stylesheet(new StyleSheetPunnett());
|
||||
}
|
||||
|
||||
static class StyleSheetPunnett extends StyleSheet {
|
||||
public StyleSheetPunnett() {
|
||||
textures.put(CraftGUITexture.Window, new PaddedTexture(0, 0, 160, 160, 0, ExtraBeeTexture.GUIPunnett, 32, 32, 32, 32));
|
||||
textures.put(CraftGUITexture.Slot, new StandardTexture(160, 0, 18, 18, 0, ExtraBeeTexture.GUIPunnett));
|
||||
textures.put(ExtraBeeGUITexture.Chromosome, new StandardTexture(160, 36, 16, 16, 0, ExtraBeeTexture.GUIPunnett));
|
||||
textures.put(ExtraBeeGUITexture.Chromosome2, new StandardTexture(160, 52, 16, 16, 0, ExtraBeeTexture.GUIPunnett));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,18 +10,20 @@ import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
public enum ExtraBeeLiquid implements ILiquidType {
|
||||
ACID("acid", 0xafeb19),
|
||||
POISON("poison", 0xeb14eb),
|
||||
GLACIAL("liquidnitrogen", 0x96c8c8);
|
||||
ACID("acid", new Color(0xafeb19)),
|
||||
POISON("poison", new Color(0xeb14eb)),
|
||||
GLACIAL("liquidnitrogen", new Color(0x96c8c8));
|
||||
|
||||
protected String ident;
|
||||
protected IIcon icon;
|
||||
protected int colour;
|
||||
protected int color;
|
||||
|
||||
ExtraBeeLiquid(String ident, int colour) {
|
||||
ExtraBeeLiquid(String ident, Color color) {
|
||||
this.ident = ident;
|
||||
this.colour = colour;
|
||||
this.color = color.getRGB();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -75,6 +77,6 @@ public enum ExtraBeeLiquid implements ILiquidType {
|
||||
|
||||
@Override
|
||||
public int getContainerColor() {
|
||||
return colour;
|
||||
return color;
|
||||
}
|
||||
}
|
||||
@@ -4,116 +4,112 @@ import binnie.core.item.IItemEnum;
|
||||
import binnie.extrabees.ExtraBees;
|
||||
import forestry.api.recipes.RecipeManagers;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
public enum EnumHoneyComb implements IItemEnum {
|
||||
BARREN(7564356, 12762791),
|
||||
ROTTEN(4084257, 11652233),
|
||||
BONE(12895407, 14606017),
|
||||
OIL(394760, 2894646),
|
||||
COAL(10392696, 3682590),
|
||||
FUEL(10252096, 16761856),
|
||||
WATER(2568911, 7973065),
|
||||
MILK(14145991, 16777215),
|
||||
FRUIT(8202548, 14372706),
|
||||
SEED(3428147, 7457902),
|
||||
ALCOHOL(4293921, 14604622),
|
||||
STONE(9211025, 13027020),
|
||||
REDSTONE(16422550, 15077392),
|
||||
RESIN(16762703, 13208064),
|
||||
IC2ENERGY(15332623, 2143177),
|
||||
IRON(3552564, 11038808),
|
||||
GOLD(3552564, 15125515),
|
||||
COPPER(3552564, 13722376),
|
||||
TIN(3552564, 12431805),
|
||||
SILVER(3552564, 14408667),
|
||||
BRONZE,
|
||||
URANIUM(2031360, 4303667),
|
||||
CLAY(7034426, 11583702),
|
||||
OLD(4535060, 11769444),
|
||||
FUNGAL(7234891, 2856003),
|
||||
CREOSOTE(10256652, 12429911),
|
||||
LATEX(5854529, 11051653),
|
||||
ACIDIC(3441987, 1374014),
|
||||
VENOMOUS(8198269, 16724991),
|
||||
SLIME(3884860, 8442245),
|
||||
BLAZE(16738816, 16763904),
|
||||
COFFEE(5519389, 11763531),
|
||||
GLACIAL(5146503, 13366002),
|
||||
MINT,
|
||||
CITRUS,
|
||||
PEAT,
|
||||
SHADOW(0, 3545141),
|
||||
LEAD(3552564, 10125468),
|
||||
BRASS,
|
||||
ELECTRUM,
|
||||
ZINC(3552564, 15592447),
|
||||
TITANIUM(3552564, 11578083),
|
||||
TUNGSTEN(3552564, 1249812),
|
||||
STEEL,
|
||||
IRIDIUM,
|
||||
PLATINUM(3552564, 10125468),
|
||||
LAPIS(3552564, 4009179),
|
||||
SODALITE,
|
||||
PYRITE,
|
||||
BAUXITE,
|
||||
CINNABAR,
|
||||
SPHALERITE,
|
||||
EMERALD(3552564, 1900291),
|
||||
RUBY(3552564, 14024704),
|
||||
SAPPHIRE(3552564, 673791),
|
||||
OLIVINE,
|
||||
DIAMOND(3552564, 8371706),
|
||||
RED(13388876, 16711680),
|
||||
YELLOW(15066419, 16768256),
|
||||
BLUE(10072818, 8959),
|
||||
GREEN(6717235, 39168),
|
||||
BLACK(1644825, 5723991),
|
||||
WHITE(14079702, 16777215),
|
||||
BROWN(8349260, 6042895),
|
||||
ORANGE(15905331, 16751872),
|
||||
CYAN(5020082, 65509),
|
||||
PURPLE(11691749, 11403519),
|
||||
GRAY(5000268, 12237498),
|
||||
LIGHTBLUE(10072818, 40447),
|
||||
PINK(15905484, 16744671),
|
||||
LIMEGREEN(8375321, 65288),
|
||||
MAGENTA(15040472, 16711884),
|
||||
LIGHTGRAY(10066329, 13224393),
|
||||
NICKEL(3552564, 16768764),
|
||||
INVAR,
|
||||
GLOWSTONE(10919006, 14730249),
|
||||
SALTPETER(10919006, 14730249),
|
||||
PULP,
|
||||
MULCH,
|
||||
COMPOST(4338440, 7036475),
|
||||
SAWDUST(12561009, 15913854),
|
||||
CERTUS(13029631, 3755363),
|
||||
ENDERPEARL(3446662, 206368),
|
||||
YELLORIUM(2564173, 14019840),
|
||||
CYANITE(2564173, 34541),
|
||||
BLUTONIUM(2564173, 1769702);
|
||||
BARREN(new Color(0x736c44), new Color(0xc2bea7)),
|
||||
ROTTEN(new Color(0x3e5221), new Color(0xb1cc89)),
|
||||
BONE(new Color(0xc4c4af), new Color(0xdedec1)),
|
||||
OIL(new Color(0x060608), new Color(0x2c2b36)),
|
||||
COAL(new Color(0x9e9478), new Color(0x38311e)),
|
||||
FUEL(new Color(0x9c6f40), new Color(0xffc400)),
|
||||
WATER(new Color(0x2732cf), new Color(0x79a8c9)),
|
||||
MILK(new Color(0xd7d9c7), new Color(0xffffff)),
|
||||
FRUIT(new Color(0x7d2934), new Color(0xdb4f62)),
|
||||
SEED(new Color(0x344f33), new Color(0x71cc6e)),
|
||||
ALCOHOL(new Color(0x418521), new Color(0xded94e)),
|
||||
STONE(new Color(0x8c8c91), new Color(0xc6c6cc)),
|
||||
REDSTONE(new Color(0xfa9696), new Color(0xe61010)),
|
||||
RESIN(new Color(0xffc74f), new Color(0xc98a00)),
|
||||
IC2ENERGY(new Color(0xe9f50f), new Color(0x20b3c9)),
|
||||
IRON(new Color(0x363534), new Color(0xa87058)),
|
||||
GOLD(new Color(0x363534), new Color(0xe6cc0b)),
|
||||
COPPER(new Color(0x363534), new Color(0xd16308)),
|
||||
TIN(new Color(0x363534), new Color(0xbdb1bd)),
|
||||
SILVER(new Color(0x363534), new Color(0xdbdbdb)),
|
||||
// BRONZE,
|
||||
URANIUM(new Color(0x1eff00), new Color(0x41ab33)),
|
||||
CLAY(new Color(0x6b563a), new Color(0xb0c0d6)),
|
||||
OLD(new Color(0x453314), new Color(0xb39664)),
|
||||
FUNGAL(new Color(0x6e654b), new Color(0x2b9443)),
|
||||
CREOSOTE(new Color(0x9c810c), new Color(0xbdaa57)),
|
||||
LATEX(new Color(0x595541), new Color(0xa8a285)),
|
||||
ACIDIC(new Color(0x348543), new Color(0x14f73e)),
|
||||
VENOMOUS(new Color(0x7d187d), new Color(0xff33ff)),
|
||||
SLIME(new Color(0x3b473c), new Color(0x80d185)),
|
||||
BLAZE(new Color(0xff6a00), new Color(0xffcc00)),
|
||||
COFFEE(new Color(0x54381d), new Color(0xb37f4b)),
|
||||
GLACIAL(new Color(0x4e8787), new Color(0xcbf2f2)),
|
||||
// MINT,
|
||||
// CITRUS,
|
||||
// PEAT,
|
||||
SHADOW(new Color(0x000000), new Color(0x361835)),
|
||||
LEAD(new Color(0x363534), new Color(0x9a809c)),
|
||||
// BRASS,
|
||||
// ELECTRUM,
|
||||
ZINC(new Color(0x363534), new Color(0xedebff)),
|
||||
TITANIUM(new Color(0x363534), new Color(0xb0aae3)),
|
||||
TUNGSTEN(new Color(0x363534), new Color(0x131214)),
|
||||
// STEEL,
|
||||
// IRIDIUM,
|
||||
PLATINUM(new Color(0x363534), new Color(0x9a809c)),
|
||||
LAPIS(new Color(0x363534), new Color(0x3d2cdb)),
|
||||
// SODALITE,
|
||||
// PYRITE,
|
||||
// BAUXITE,
|
||||
// CINNABAR,
|
||||
// SPHALERITE,
|
||||
EMERALD(new Color(0x363534), new Color(0x1cff03)),
|
||||
RUBY(new Color(0x363534), new Color(0xd60000)),
|
||||
SAPPHIRE(new Color(0x363534), new Color(0xa47ff)),
|
||||
// OLIVINE,
|
||||
DIAMOND(new Color(0x363534), new Color(0x7fbdfa)),
|
||||
RED(new Color(0xcc4c4c), new Color(0xff0000)),
|
||||
YELLOW(new Color(0xe5e533), new Color(0xffdd00)),
|
||||
BLUE(new Color(0x99b2f2), new Color(0x0022ff)),
|
||||
GREEN(new Color(0x667f33), new Color(0x009900)),
|
||||
BLACK(new Color(0x191919), new Color(0x575757)),
|
||||
WHITE(new Color(0xd6d6d6), new Color(0xffffff)),
|
||||
BROWN(new Color(0x7f664c), new Color(0x5c350f)),
|
||||
ORANGE(new Color(0xf2b233), new Color(0xff9d00)),
|
||||
CYAN(new Color(0x4c99b2), new Color(0x00ffe5)),
|
||||
PURPLE(new Color(0xb266e5), new Color(0xae00ff)),
|
||||
GRAY(new Color(0x4c4c4c), new Color(0xbababa)),
|
||||
LIGHTBLUE(new Color(0x99b2f2), new Color(0x009dff)),
|
||||
PINK(new Color(0xf2b2cc), new Color(0xff80df)),
|
||||
LIMEGREEN(new Color(0x7fcc19), new Color(0x00ff08)),
|
||||
MAGENTA(new Color(0xe57fd8), new Color(0xff00cc)),
|
||||
LIGHTGRAY(new Color(0x999999), new Color(0xc9c9c9)),
|
||||
NICKEL(new Color(0x363534), new Color(0xffdefc)),
|
||||
// INVAR,
|
||||
GLOWSTONE(new Color(0xa69c5e), new Color(0xe0c409)),
|
||||
SALTPETER(new Color(0xa69c5e), new Color(0xe0c409)),
|
||||
//PULP,
|
||||
//MULCH,
|
||||
COMPOST(new Color(0x423308), new Color(0x6b5e3b)),
|
||||
SAWDUST(new Color(0xbfaa71), new Color(0xf2d37e)),
|
||||
CERTUS(new Color(0xc6d0ff), new Color(0x394d63)),
|
||||
ENDERPEARL(new Color(0x349786), new Color(0x32620)),
|
||||
YELLORIUM(new Color(0x27204d), new Color(14019840)),
|
||||
CYANITE(new Color(0x27204d), new Color(0x86ed)),
|
||||
BLUTONIUM(new Color(0x27204d), new Color(0x1b00e6));
|
||||
|
||||
public Map<ItemStack, Float> products;
|
||||
public boolean deprecated;
|
||||
public final int primaryColor;
|
||||
public final int secondaryColor;
|
||||
public final String name;
|
||||
|
||||
protected int[] color;
|
||||
protected boolean active;
|
||||
|
||||
EnumHoneyComb() {
|
||||
this(0xffffff, 0xffffff);
|
||||
active = false;
|
||||
deprecated = true;
|
||||
}
|
||||
|
||||
EnumHoneyComb(int color, int color2) {
|
||||
this.color = new int[]{color, color2};
|
||||
EnumHoneyComb(Color primaryColor, Color secondaryColor) {
|
||||
this.primaryColor = primaryColor.getRGB();
|
||||
this.secondaryColor = secondaryColor.getRGB();
|
||||
name = toString().toLowerCase(Locale.ENGLISH);
|
||||
products = new LinkedHashMap<>();
|
||||
active = true;
|
||||
deprecated = false;
|
||||
}
|
||||
|
||||
public static EnumHoneyComb get(ItemStack itemStack) {
|
||||
@@ -139,8 +135,8 @@ public enum EnumHoneyComb implements IItemEnum {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName(ItemStack itemStack) {
|
||||
return ExtraBees.proxy.localise("item.comb." + name().toLowerCase());
|
||||
public String getName(ItemStack stack) {
|
||||
return ExtraBees.proxy.localise("item.comb." + name);
|
||||
}
|
||||
|
||||
public boolean addProduct(ItemStack item, Float chance) {
|
||||
@@ -155,18 +151,9 @@ public enum EnumHoneyComb implements IItemEnum {
|
||||
active = addProduct(item, chance);
|
||||
}
|
||||
|
||||
// TODO unused method?
|
||||
public void tryAddProduct(String oreDict, Float chance) {
|
||||
if (!OreDictionary.getOres(oreDict).isEmpty()) {
|
||||
tryAddProduct(OreDictionary.getOres(oreDict).get(0), chance);
|
||||
} else {
|
||||
active = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void tryAddProduct(IItemEnum type, Float chance) {
|
||||
tryAddProduct(type.get(1), chance);
|
||||
active = (active && type.isActive());
|
||||
active = active && type.isActive();
|
||||
}
|
||||
|
||||
public void copyProducts(EnumHoneyComb comb) {
|
||||
|
||||
@@ -8,52 +8,48 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
public enum EnumHoneyDrop implements IItemEnum {
|
||||
ENERGY(0x9c4972, 0xe37171, ""),
|
||||
ACID(0x4bb541, 0x49de3c, "acid"),
|
||||
POISON(0xd106b9, 0xff03e2, "poison"),
|
||||
APPLE(0xc75252, 0xc92a2a, "juice"),
|
||||
CITRUS,
|
||||
ICE(0xaee8e2, 0x96fff5, "liquidnitrogen"),
|
||||
MILK(0xe0e0e0, 0xffffff, "milk"),
|
||||
SEED(0x7cc272, 0xc2bea7, "seedoil"),
|
||||
ALCOHOL(0xdbe84d, 0xa5e84d, "short.mead"),
|
||||
FRUIT,
|
||||
VEGETABLE,
|
||||
PUMPKIN,
|
||||
MELON,
|
||||
RED(0xcc4c4c, 0xff0000, "for.honey"),
|
||||
YELLOW(0xe5e533, 0xffdd00, "for.honey"),
|
||||
BLUE(0x99b2f2, 0x0022ff, "for.honey"),
|
||||
GREEN(0x667f33, 0x009900, "for.honey"),
|
||||
BLACK(0x191919, 0x575757, "for.honey"),
|
||||
WHITE(0xd6d6d6, 0xffffff, "for.honey"),
|
||||
BROWN(0x7f664c, 0x5c350f, "for.honey"),
|
||||
ORANGE(0xf2b233, 0xff9d00, "for.honey"),
|
||||
CYAN(0x4c99b2, 0x00ffe5, "for.honey"),
|
||||
PURPLE(0xb266e5, 0xae00ff, "for.honey"),
|
||||
GRAY(0x4c4c4c, 0xbababa, "for.honey"),
|
||||
LIGHTBLUE(0x99b2f2, 0x009dff, "for.honey"),
|
||||
PINK(0xf2b2cc, 0xff80df, "for.honey"),
|
||||
LIMEGREEN(0x7fcc19, 0x00ff08, "for.honey"),
|
||||
MAGENTA(0xe57fd8, 0xff00cc, "for.honey"),
|
||||
LIGHTGRAY(0x999999, 0xc9c9c9, "for.honey");
|
||||
ENERGY(new Color(0x9c4972), new Color(0xe37171), ""),
|
||||
ACID(new Color(0x4bb541), new Color(0x49de3c), "acid"),
|
||||
POISON(new Color(0xd106b9), new Color(0xff03e2), "poison"),
|
||||
APPLE(new Color(0xc75252), new Color(0xc92a2a), "juice"),
|
||||
// CITRUS,
|
||||
ICE(new Color(0xaee8e2), new Color(0x96fff5), "liquidnitrogen"),
|
||||
MILK(new Color(0xe0e0e0), new Color(0xffffff), "milk"),
|
||||
SEED(new Color(0x7cc272), new Color(0xc2bea7), "seedoil"),
|
||||
ALCOHOL(new Color(0xdbe84d), new Color(0xa5e84d), "short.mead"),
|
||||
// FRUIT,
|
||||
// VEGETABLE,
|
||||
// PUMPKIN,
|
||||
// MELON,
|
||||
RED(new Color(0xcc4c4c), new Color(0xff0000), "for.honey"),
|
||||
YELLOW(new Color(0xe5e533), new Color(0xffdd00), "for.honey"),
|
||||
BLUE(new Color(0x99b2f2), new Color(0x0022ff), "for.honey"),
|
||||
GREEN(new Color(0x667f33), new Color(0x009900), "for.honey"),
|
||||
BLACK(new Color(0x191919), new Color(0x575757), "for.honey"),
|
||||
WHITE(new Color(0xd6d6d6), new Color(0xffffff), "for.honey"),
|
||||
BROWN(new Color(0x7f664c), new Color(0x5c350f), "for.honey"),
|
||||
ORANGE(new Color(0xf2b233), new Color(0xff9d00), "for.honey"),
|
||||
CYAN(new Color(0x4c99b2), new Color(0x00ffe5), "for.honey"),
|
||||
PURPLE(new Color(0xb266e5), new Color(0xae00ff), "for.honey"),
|
||||
GRAY(new Color(0x4c4c4c), new Color(0xbababa), "for.honey"),
|
||||
LIGHTBLUE(new Color(0x99b2f2), new Color(0x009dff), "for.honey"),
|
||||
PINK(new Color(0xf2b2cc), new Color(0xff80df), "for.honey"),
|
||||
LIMEGREEN(new Color(0x7fcc19), new Color(0x00ff08), "for.honey"),
|
||||
MAGENTA(new Color(0xe57fd8), new Color(0xff00cc), "for.honey"),
|
||||
LIGHTGRAY(new Color(0x999999), new Color(0xc9c9c9), "for.honey");
|
||||
|
||||
public final int primaryColor;
|
||||
public final int secondaryColor;
|
||||
|
||||
public boolean deprecated;
|
||||
|
||||
protected int[] color;
|
||||
protected String liquidName;
|
||||
protected ItemStack remenant;
|
||||
|
||||
EnumHoneyDrop() {
|
||||
this(0xffffff, 0xffffff, "");
|
||||
}
|
||||
|
||||
EnumHoneyDrop(int color, int color2, String liquid) {
|
||||
liquidName = "";
|
||||
remenant = null;
|
||||
deprecated = false;
|
||||
this.color = new int[]{color, color2};
|
||||
EnumHoneyDrop(Color primaryColor, Color secondaryColor, String liquid) {
|
||||
this.primaryColor = primaryColor.getRGB();
|
||||
this.secondaryColor = secondaryColor.getRGB();
|
||||
liquidName = liquid;
|
||||
}
|
||||
|
||||
@@ -67,7 +63,6 @@ public enum EnumHoneyDrop implements IItemEnum {
|
||||
|
||||
public void addRemenant(ItemStack stack) {
|
||||
remenant = stack;
|
||||
deprecated = true;
|
||||
}
|
||||
|
||||
public void addRecipe() {
|
||||
@@ -79,7 +74,8 @@ public enum EnumHoneyDrop implements IItemEnum {
|
||||
|
||||
@Override
|
||||
public boolean isActive() {
|
||||
return !deprecated && (liquidName == null || FluidRegistry.isFluidRegistered(liquidName));
|
||||
return liquidName == null
|
||||
|| FluidRegistry.isFluidRegistered(liquidName);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -7,32 +7,28 @@ import forestry.api.recipes.RecipeManagers;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
public enum EnumPropolis implements IItemEnum {
|
||||
WATER(0x24b3c9, 0xc2bea7, "Water"),
|
||||
OIL(0x172f33, 0xc2bea7, "oil"),
|
||||
FUEL(0xa38d12, 0xc2bea7, "fuel"),
|
||||
MILK,
|
||||
FRUIT,
|
||||
SEED,
|
||||
ALCOHOL,
|
||||
CREOSOTE(0x877501, 0xbda613, "creosote"),
|
||||
GLACIAL,
|
||||
PEAT;
|
||||
WATER(new Color(0x24b3c9), new Color(0xc2bea7), "Water"),
|
||||
OIL(new Color(0x172f33), new Color(0xc2bea7), "oil"),
|
||||
FUEL(new Color(0xa38d12), new Color(0xc2bea7), "fuel"),
|
||||
// MILK,
|
||||
// FRUIT,
|
||||
// SEED,
|
||||
// ALCOHOL,
|
||||
CREOSOTE(new Color(0x877501), new Color(0xbda613), "creosote");
|
||||
// GLACIAL,
|
||||
// PEAT
|
||||
|
||||
int[] colour;
|
||||
String liquidName;
|
||||
boolean active;
|
||||
public final int secondaryColor;
|
||||
public final int primaryColor;
|
||||
public final String liquidName;
|
||||
|
||||
EnumPropolis() {
|
||||
this(0xffffff, 0xffffff, "");
|
||||
active = false;
|
||||
}
|
||||
|
||||
EnumPropolis(int colour, int colour2, String liquid) {
|
||||
this.colour = new int[0];
|
||||
active = true;
|
||||
this.colour = new int[]{colour, colour2};
|
||||
liquidName = liquid;
|
||||
EnumPropolis(Color primaryColor, Color secondaryColor, String liquidName) {
|
||||
this.primaryColor = primaryColor.getRGB();
|
||||
this.secondaryColor = secondaryColor.getRGB();
|
||||
this.liquidName = liquidName;
|
||||
}
|
||||
|
||||
public static EnumPropolis get(ItemStack itemStack) {
|
||||
@@ -52,7 +48,7 @@ public enum EnumPropolis implements IItemEnum {
|
||||
|
||||
@Override
|
||||
public boolean isActive() {
|
||||
return active && Binnie.Liquid.getLiquidStack(liquidName, 100) != null;
|
||||
return Binnie.Liquid.getLiquidStack(liquidName, 100) != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -291,14 +291,15 @@ public class ItemHoneyComb extends ItemProduct {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColorFromItemStack(ItemStack itemStack, int j) {
|
||||
if (EnumHoneyComb.get(itemStack) == null) {
|
||||
public int getColorFromItemStack(ItemStack stack, int indexColor) {
|
||||
EnumHoneyComb comb = EnumHoneyComb.get(stack);
|
||||
if (comb == null) {
|
||||
return 0xffffff;
|
||||
}
|
||||
if (j == 0) {
|
||||
return EnumHoneyComb.get(itemStack).color[0];
|
||||
if (indexColor == 0) {
|
||||
return comb.primaryColor;
|
||||
}
|
||||
return EnumHoneyComb.get(itemStack).color[1];
|
||||
return comb.secondaryColor;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -27,9 +27,9 @@ public class ItemHoneyDrop extends ItemProduct {
|
||||
@Override
|
||||
public int getColorFromItemStack(ItemStack itemStack, int j) {
|
||||
if (j == 0) {
|
||||
return EnumHoneyDrop.get(itemStack).color[0];
|
||||
return EnumHoneyDrop.get(itemStack).primaryColor;
|
||||
}
|
||||
return EnumHoneyDrop.get(itemStack).color[1];
|
||||
return EnumHoneyDrop.get(itemStack).secondaryColor;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -11,10 +11,10 @@ public class ItemProduct extends Item {
|
||||
protected IItemEnum[] types;
|
||||
|
||||
public ItemProduct(IItemEnum[] types) {
|
||||
this.types = types;
|
||||
setMaxStackSize(64);
|
||||
setMaxDamage(0);
|
||||
setHasSubtypes(true);
|
||||
this.types = types;
|
||||
}
|
||||
|
||||
public IItemEnum get(ItemStack stack) {
|
||||
@@ -26,15 +26,15 @@ public class ItemProduct extends Item {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack itemstack) {
|
||||
return get(itemstack).getName(itemstack);
|
||||
public String getItemStackDisplayName(ItemStack stack) {
|
||||
return get(stack).getName(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List itemList) {
|
||||
public void getSubItems(Item item, CreativeTabs tab, List list) {
|
||||
for (IItemEnum type : types) {
|
||||
if (type.isActive()) {
|
||||
itemList.add(new ItemStack(this, 1, type.ordinal()));
|
||||
list.add(new ItemStack(this, 1, type.ordinal()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,9 +17,9 @@ public class ItemPropolis extends ItemProduct {
|
||||
@Override
|
||||
public int getColorFromItemStack(ItemStack itemStack, int j) {
|
||||
if (j == 0) {
|
||||
return EnumPropolis.get(itemStack).colour[0];
|
||||
return EnumPropolis.get(itemStack).primaryColor;
|
||||
}
|
||||
return EnumPropolis.get(itemStack).colour[1];
|
||||
return EnumPropolis.get(itemStack).secondaryColor;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -63,7 +63,7 @@ public class BlockExtraBeeHive extends Block {
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
|
||||
ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
|
||||
ArrayList<ItemStack> ret = new ArrayList<>();
|
||||
List<IHiveDrop> dropList = EnumHiveType.values()[metadata].drops;
|
||||
Collections.shuffle(dropList);
|
||||
int tries = 0;
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
package binnie.extratrees.alcohol.drink;
|
||||
|
||||
import binnie.extratrees.alcohol.ModuleAlcohol;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
// TODO unused class?
|
||||
public class BlockDrink extends BlockContainer {
|
||||
public BlockDrink() {
|
||||
super(Material.glass);
|
||||
setBlockName("drink");
|
||||
setCreativeTab(CreativeTabs.tabTools);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getRenderBlockPass() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileEntityDrink();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return ModuleAlcohol.drinkRendererID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNormalCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
package binnie.extratrees.alcohol.drink;
|
||||
|
||||
import binnie.extratrees.alcohol.ModuleAlcohol;
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
// TODO unused class?
|
||||
public class BlockDrinkRenderer implements ISimpleBlockRenderingHandler {
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
|
||||
// ignored
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
|
||||
GL11.glPushMatrix();
|
||||
Tessellator.instance.setColorRGBA(255, 255, 255, 150);
|
||||
Tessellator tess = Tessellator.instance;
|
||||
renderer.renderFaceYPos(block, x, y, z, Blocks.dirt.getIcon(0, 0));
|
||||
float s = 0.0625f;
|
||||
|
||||
for (int h = 0; h < 16; ++h) {
|
||||
float d1 = 8.0f * s;
|
||||
float h2 = h * s;
|
||||
tess.addVertexWithUV(x + 0.5f - d1, y + h2, z + 0.5f - d1, 0.0, 0.0);
|
||||
tess.addVertexWithUV(x + 0.5f - d1, y + h2, z + 0.5f - d1, 0.0, 0.0);
|
||||
tess.addVertexWithUV(x + 0.5f + d1, y + h2, z + 0.5f - d1, 0.0, 0.0);
|
||||
tess.addVertexWithUV(x + 0.5f + d1, y + h2, z + 0.5f - d1, 0.0, 0.0);
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int modelId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return ModuleAlcohol.drinkRendererID;
|
||||
}
|
||||
}
|
||||
@@ -7,5 +7,5 @@ public interface IDesignMaterial {
|
||||
|
||||
String getName();
|
||||
|
||||
int getColour();
|
||||
int getColor();
|
||||
}
|
||||
@@ -1,135 +0,0 @@
|
||||
package binnie.extratrees.block;
|
||||
|
||||
import binnie.core.block.BlockMetadata;
|
||||
import binnie.core.block.IBlockMetadata;
|
||||
import binnie.core.block.TileEntityMetadata;
|
||||
import binnie.extratrees.ExtraTrees;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import forestry.api.core.Tabs;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockLog;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
// TODO unused class?
|
||||
public class BlockBranch extends BlockLog implements IBlockMetadata {
|
||||
public BlockBranch() {
|
||||
setCreativeTab(Tabs.tabArboriculture);
|
||||
setBlockName("branch");
|
||||
setResistance(5.0f);
|
||||
setHardness(2.0f);
|
||||
setStepSound(Block.soundTypeWood);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List itemList) {
|
||||
for (int i = 0; i < ILogType.ExtraTreeLog.values().length; ++i) {
|
||||
itemList.add(TileEntityMetadata.getItemStack(this, i));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
||||
if (tile != null) {
|
||||
return getIcon(side, tile.getTileMetadata(), world.getBlockMetadata(x, y, z));
|
||||
}
|
||||
return super.getIcon(world, x, y, z, side);
|
||||
}
|
||||
|
||||
public IIcon getIcon(int side, int tileMeta, int blockMeta) {
|
||||
int oriented = blockMeta & 0xC;
|
||||
ILogType.ExtraTreeLog log = ILogType.ExtraTreeLog.values()[tileMeta];
|
||||
if (side > 3) {
|
||||
return log.getTrunk();
|
||||
}
|
||||
return log.getBark();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int tileMeta) {
|
||||
return getIcon(side, tileMeta, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return ExtraTrees.branchRenderId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dropAsStack(World world, int x, int y, int z, ItemStack itemStack) {
|
||||
dropBlockAsItem(world, x, y, z, itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int blockMeta, int fortune) {
|
||||
return BlockMetadata.getBlockDropped(this, world, x, y, z, blockMeta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z) {
|
||||
return BlockMetadata.breakBlock(this, player, world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileEntityMetadata();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity(int meta) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockEventReceived(World world, int x, int y, int z, int eventId, int eventType) {
|
||||
super.onBlockEventReceived(world, x, y, z, eventId, eventType);
|
||||
TileEntity tileentity = world.getTileEntity(x, y, z);
|
||||
return tileentity != null && tileentity.receiveClientEvent(eventId, eventType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDroppedMeta(int blockMeta, int tileMeta) {
|
||||
return tileMeta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName(ItemStack itemStack) {
|
||||
int meta = TileEntityMetadata.getItemDamage(itemStack);
|
||||
return ILogType.ExtraTreeLog.values()[meta].getName() + " Branch";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addBlockTooltip(ItemStack itemStack, List tooltip) {
|
||||
// ignored
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPlacedMeta(ItemStack itemStack, World world, int x, int y, int z, ForgeDirection direction) {
|
||||
return TileEntityMetadata.getItemDamage(itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int side) {
|
||||
super.breakBlock(world, x, y, z, block, side);
|
||||
world.removeTileEntity(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) {
|
||||
return BlockMetadata.getPickBlock(world, x, y, z);
|
||||
}
|
||||
}
|
||||
@@ -114,11 +114,11 @@ public class BlockETDoor extends BlockDoor implements IBlockMetadata {
|
||||
int i1 = getFullMetadata(blockAccess, x, y, z);
|
||||
if ((i1 & 0x8) != 0) {
|
||||
int meta = TileEntityMetadata.getTileMetadata(blockAccess, x, y - 1, z);
|
||||
return WoodManager.getPlankType(meta & 0xFF).getColour();
|
||||
return WoodManager.getPlankType(meta & 0xFF).getColor();
|
||||
}
|
||||
|
||||
int meta = TileEntityMetadata.getTileMetadata(blockAccess, x, y, z);
|
||||
return WoodManager.getPlankType(meta & 0xFF).getColour();
|
||||
return WoodManager.getPlankType(meta & 0xFF).getColor();
|
||||
}
|
||||
|
||||
public int getFullMetadata(IBlockAccess blockAccess, int x, int y, int pzr4) {
|
||||
@@ -156,8 +156,7 @@ public class BlockETDoor extends BlockDoor implements IBlockMetadata {
|
||||
}
|
||||
|
||||
@Override
|
||||
// TODO fix deprecated code
|
||||
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z) {
|
||||
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z, boolean willHarvest) {
|
||||
return BlockMetadata.breakBlock(this, player, world, x, y, z);
|
||||
}
|
||||
|
||||
|
||||
@@ -108,6 +108,6 @@ public class ItemETDoor extends ItemMetadata {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getColorFromItemStack(ItemStack stack, int meta) {
|
||||
return WoodManager.getPlankType((stack == null) ? 0 : (stack.getItemDamage() & 0xFF)).getColour();
|
||||
return WoodManager.getPlankType((stack == null) ? 0 : (stack.getItemDamage() & 0xFF)).getColor();
|
||||
}
|
||||
}
|
||||
@@ -84,7 +84,7 @@ public class PlankType {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColour() {
|
||||
public int getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
@@ -133,7 +133,7 @@ public class PlankType {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColour() {
|
||||
public int getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
@@ -198,7 +198,7 @@ public class PlankType {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColour() {
|
||||
public int getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
@@ -248,7 +248,7 @@ public class PlankType {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColour() {
|
||||
public int getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
package binnie.extratrees.block.decor;
|
||||
|
||||
import binnie.extratrees.genetics.LeafType;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemBlockWithMetadata;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
// TODO unused class?
|
||||
public class ItemHedge extends ItemBlockWithMetadata {
|
||||
public ItemHedge(Block block) {
|
||||
super(block, block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack item) {
|
||||
int meta = item.getItemDamage();
|
||||
return LeafType.values()[meta % 6].description + ((meta >= 8) ? " Full" : "") + " Hedge";
|
||||
}
|
||||
}
|
||||
@@ -64,61 +64,11 @@ public class DesignBlock {
|
||||
}
|
||||
|
||||
public int getPrimaryColour() {
|
||||
return getPrimaryMaterial().getColour();
|
||||
return getPrimaryMaterial().getColor();
|
||||
}
|
||||
|
||||
public int getSecondaryColour() {
|
||||
return getSecondaryMaterial().getColour();
|
||||
}
|
||||
|
||||
// TODO unused method?
|
||||
ForgeDirection getRotation(ForgeDirection dir, ModuleCarpentry.Axis axis) {
|
||||
if (axis == ModuleCarpentry.Axis.Y) {
|
||||
switch (dir) {
|
||||
case EAST:
|
||||
return ForgeDirection.NORTH;
|
||||
|
||||
case NORTH:
|
||||
return ForgeDirection.WEST;
|
||||
|
||||
case SOUTH:
|
||||
return ForgeDirection.EAST;
|
||||
|
||||
case WEST:
|
||||
return ForgeDirection.SOUTH;
|
||||
}
|
||||
return dir;
|
||||
} else if (axis == ModuleCarpentry.Axis.X) {
|
||||
switch (dir) {
|
||||
case EAST:
|
||||
return ForgeDirection.UP;
|
||||
|
||||
case UP:
|
||||
return ForgeDirection.WEST;
|
||||
|
||||
case WEST:
|
||||
return ForgeDirection.DOWN;
|
||||
|
||||
case DOWN:
|
||||
return ForgeDirection.EAST;
|
||||
}
|
||||
return dir;
|
||||
} else {
|
||||
switch (dir) {
|
||||
case SOUTH:
|
||||
return ForgeDirection.UP;
|
||||
|
||||
case UP:
|
||||
return ForgeDirection.NORTH;
|
||||
|
||||
case NORTH:
|
||||
return ForgeDirection.DOWN;
|
||||
|
||||
case DOWN:
|
||||
return ForgeDirection.SOUTH;
|
||||
}
|
||||
return dir;
|
||||
}
|
||||
return getSecondaryMaterial().getColor();
|
||||
}
|
||||
|
||||
public ILayout getLayout(ForgeDirection dir) {
|
||||
|
||||
@@ -72,7 +72,7 @@ public class GlassType implements IDesignMaterial {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColour() {
|
||||
public int getColor() {
|
||||
return colour;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
package binnie.extratrees.craftgui.dictionary;
|
||||
|
||||
import binnie.core.craftgui.IWidget;
|
||||
import binnie.core.craftgui.minecraft.Dialog;
|
||||
|
||||
// TODO unused class?
|
||||
public class DialogBreweryRecipe extends Dialog {
|
||||
public DialogBreweryRecipe(IWidget parent, float w, float h) {
|
||||
super(parent, w, h);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialise() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClose() {
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
package binnie.extratrees.craftgui.kitchen;
|
||||
|
||||
import binnie.core.craftgui.IWidget;
|
||||
import binnie.core.craftgui.controls.button.ControlButton;
|
||||
import binnie.core.craftgui.events.EventMouse;
|
||||
import binnie.core.craftgui.minecraft.Window;
|
||||
|
||||
// TODO unused class?
|
||||
public abstract class ControlDropdownButton extends ControlButton {
|
||||
public ControlDropdownButton(IWidget parent, float x, float y, float width, float height, String text) {
|
||||
super(parent, x, y, width, height, text);
|
||||
addSelfEventHandler(new EventMouse.Down.Handler() {
|
||||
@Override
|
||||
public void onEvent(EventMouse.Down event) {
|
||||
ControlDropDownMenu menu = getWidget(ControlDropDownMenu.class);
|
||||
deleteChild(getWidget(ControlDropDownMenu.class));
|
||||
if (getWidget(ControlDropDownMenu.class) == null) {
|
||||
menu = createDropDownMenu();
|
||||
Window.get(getWidget()).setFocusedWidget(menu);
|
||||
} else {
|
||||
deleteChild(getWidget(ControlDropDownMenu.class));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public abstract ControlDropDownMenu createDropDownMenu();
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
package binnie.extratrees.craftgui.kitchen;
|
||||
|
||||
import binnie.core.craftgui.IWidget;
|
||||
import binnie.core.craftgui.controls.core.IControlValue;
|
||||
import binnie.core.craftgui.minecraft.control.ControlSlotBase;
|
||||
import binnie.extratrees.alcohol.Glassware;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
// TODO unused class?
|
||||
public class ControlSlotGlassware extends ControlSlotBase implements IControlValue<Glassware> {
|
||||
Glassware glassware;
|
||||
|
||||
public ControlSlotGlassware(IWidget parent, int x, int y, Glassware glassware) {
|
||||
super(parent, x, y);
|
||||
this.glassware = glassware;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Glassware getValue() {
|
||||
return glassware;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue(Glassware value) {
|
||||
glassware = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getItemStack() {
|
||||
return glassware.get(1);
|
||||
}
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
package binnie.extratrees.genetics;
|
||||
|
||||
import forestry.api.arboriculture.EnumGrowthConditions;
|
||||
import forestry.api.arboriculture.IAlleleGrowth;
|
||||
import forestry.api.arboriculture.IGrowthProvider;
|
||||
import forestry.api.arboriculture.ITreeGenome;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
// TODO unused class?
|
||||
public class ExtraTreeGrowthProvider implements IAlleleGrowth, IGrowthProvider {
|
||||
@Override
|
||||
public String getUID() {
|
||||
return "extratrees.fruit." + toString().toLowerCase();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDominant() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGrowthProvider getProvider() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canGrow(ITreeGenome genome, World world, int xPos, int yPos, int zPos, int expectedGirth, int expectedHeight) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumGrowthConditions getGrowthConditions(ITreeGenome genome, World world, int xPos, int yPos, int zPos) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getInfo() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return getProvider().getDescription();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName() {
|
||||
return getUID();
|
||||
}
|
||||
}
|
||||
@@ -1,161 +0,0 @@
|
||||
package binnie.extratrees.machines;
|
||||
|
||||
import binnie.core.craftgui.minecraft.IMachineInformation;
|
||||
import binnie.core.machines.Machine;
|
||||
import binnie.core.machines.TileEntityMachine;
|
||||
import binnie.core.machines.inventory.ComponentInventorySlots;
|
||||
import binnie.core.machines.inventory.ComponentTankContainer;
|
||||
import binnie.core.machines.inventory.MachineSide;
|
||||
import binnie.core.machines.inventory.TankValidator;
|
||||
import binnie.core.machines.power.ComponentPowerReceptor;
|
||||
import binnie.core.machines.power.ComponentProcessSetCost;
|
||||
import binnie.core.machines.power.ErrorState;
|
||||
import binnie.core.machines.power.IProcess;
|
||||
import binnie.extratrees.core.ExtraTreeTexture;
|
||||
import binnie.extratrees.core.ExtraTreesGUID;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class Infuser {
|
||||
public static int tankInput = 0;
|
||||
public static int tankOutput = 1;
|
||||
static Map<Fluid, FluidStack> recipes = new HashMap<>();
|
||||
|
||||
public static FluidStack getOutput(FluidStack fluid, ItemStack stack) {
|
||||
if (fluid == null) {
|
||||
return null;
|
||||
}
|
||||
return Infuser.recipes.get(fluid.getFluid());
|
||||
}
|
||||
|
||||
public static boolean isValidInputLiquid(FluidStack fluid) {
|
||||
return Infuser.recipes.containsKey(fluid.getFluid());
|
||||
}
|
||||
|
||||
public static boolean isValidOutputLiquid(FluidStack fluid) {
|
||||
for (Map.Entry<Fluid, FluidStack> entry : Infuser.recipes.entrySet()) {
|
||||
if (entry.getValue().isFluidEqual(fluid)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void addRecipe(FluidStack input, FluidStack output) {
|
||||
Infuser.recipes.put(input.getFluid(), output);
|
||||
}
|
||||
|
||||
// TODO unused class?
|
||||
public static class PackageInfuser extends ExtraTreeMachine.PackageExtraTreeMachine implements IMachineInformation {
|
||||
public PackageInfuser() {
|
||||
super("infuser", ExtraTreeTexture.infuserTexture, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createMachine(Machine machine) {
|
||||
new ExtraTreeMachine.ComponentExtraTreeGUI(machine, ExtraTreesGUID.Infuser);
|
||||
ComponentInventorySlots inventory = new ComponentInventorySlots(machine);
|
||||
ComponentTankContainer tanks = new ComponentTankContainer(machine);
|
||||
tanks.addTank(Infuser.tankInput, "input", 5000);
|
||||
tanks.getTankSlot(Infuser.tankInput).setValidator(new TankValidatorInfuserInput());
|
||||
tanks.getTankSlot(Infuser.tankInput).setOutputSides(MachineSide.TopAndBottom);
|
||||
tanks.addTank(Infuser.tankOutput, "output", 5000);
|
||||
tanks.getTankSlot(Infuser.tankOutput).setValidator(new TankValidatorInfuserOutput());
|
||||
tanks.getTankSlot(Infuser.tankOutput).setReadOnly();
|
||||
tanks.getTankSlot(Infuser.tankOutput).setOutputSides(MachineSide.Sides);
|
||||
new ComponentPowerReceptor(machine);
|
||||
new ComponentInfuserLogic(machine);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createTileEntity() {
|
||||
return new TileEntityMachine(this);
|
||||
}
|
||||
}
|
||||
|
||||
public static class ComponentInfuserLogic extends ComponentProcessSetCost implements IProcess {
|
||||
protected ItemStack infusing;
|
||||
|
||||
public ComponentInfuserLogic(Machine machine) {
|
||||
super(machine, 16000, 800);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getProcessEnergy() {
|
||||
return getProcessLength() * 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getProcessLength() {
|
||||
return 20;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ErrorState canWork() {
|
||||
if (getUtil().isTankEmpty(Infuser.tankInput)) {
|
||||
return new ErrorState.InsufficientLiquid("No Input Liquid", Infuser.tankInput);
|
||||
}
|
||||
return super.canWork();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ErrorState canProgress() {
|
||||
if (!getUtil().isTankEmpty(Infuser.tankOutput) && getOutput() != null && !getOutput().isFluidEqual(getUtil().getFluid(Infuser.tankOutput))) {
|
||||
return new ErrorState.Tank("No Room", "No room for liquid", new int[]{Infuser.tankOutput});
|
||||
}
|
||||
if (getUtil().getFluid(Infuser.tankOutput) != null && !getUtil().getFluid(Infuser.tankOutput).isFluidEqual(getOutput())) {
|
||||
return new ErrorState.TankSpace("Different fluid in tank", Infuser.tankOutput);
|
||||
}
|
||||
return super.canProgress();
|
||||
}
|
||||
|
||||
private FluidStack getOutput() {
|
||||
return Infuser.getOutput(getUtil().getFluid(Infuser.tankInput), infusing);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onFinishTask() {
|
||||
FluidStack output = getOutput().copy();
|
||||
getUtil().fillTank(Infuser.tankOutput, output);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onTickTask() {
|
||||
// ignored
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTooltip() {
|
||||
return "Infusing";
|
||||
}
|
||||
}
|
||||
|
||||
public static class TankValidatorInfuserInput extends TankValidator {
|
||||
@Override
|
||||
public boolean isValid(FluidStack liquid) {
|
||||
return Infuser.isValidInputLiquid(liquid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTooltip() {
|
||||
return "Infusable Liquids";
|
||||
}
|
||||
}
|
||||
|
||||
public static class TankValidatorInfuserOutput extends TankValidator {
|
||||
@Override
|
||||
public boolean isValid(FluidStack liquid) {
|
||||
return Infuser.isValidOutputLiquid(liquid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTooltip() {
|
||||
return "Infused Liquids";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
package binnie.extratrees.village;
|
||||
|
||||
import cpw.mods.fml.common.registry.VillagerRegistry;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.gen.structure.MapGenStructureIO;
|
||||
import net.minecraft.world.gen.structure.StructureVillagePieces;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
// TODO Unused class?
|
||||
public class VillageHandlerExtraTrees implements VillagerRegistry.IVillageCreationHandler {
|
||||
public static void registerVillageComponents() {
|
||||
try {
|
||||
MapGenStructureIO.func_143031_a(ComponentVillageGrove.class, "ExtraTrees:Grove");
|
||||
} catch (Throwable t) {
|
||||
// ignored
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public StructureVillagePieces.PieceWeight getVillagePieceWeight(Random random, int size) {
|
||||
return new StructureVillagePieces.PieceWeight(ComponentVillageGrove.class, 505, MathHelper.getRandomIntegerInRange(random, size, 1 + size));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?> getComponentClass() {
|
||||
return ComponentVillageGrove.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object buildComponent(StructureVillagePieces.PieceWeight villagePiece, StructureVillagePieces.Start startPiece, List pieces, Random random, int p1, int p2, int p3, int p4, int p5) {
|
||||
return ComponentVillageGrove.buildComponent(startPiece, pieces, random, p1, p2, p3, p4, p5);
|
||||
}
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
package binnie.extratrees.worldgen;
|
||||
|
||||
import forestry.api.arboriculture.ITree;
|
||||
import forestry.api.world.ITreeGenData;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.gen.feature.WorldGenerator;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
// TODO unused class?
|
||||
public class TreeGenBase extends WorldGenerator {
|
||||
protected ITree tree;
|
||||
protected ITreeGenData treeGen;
|
||||
protected World world;
|
||||
protected Random rand;
|
||||
protected int startX;
|
||||
protected int startY;
|
||||
protected int startZ;
|
||||
protected int girth;
|
||||
protected int height;
|
||||
protected int minHeight;
|
||||
protected int maxHeight;
|
||||
protected boolean spawnPods;
|
||||
protected int minPodHeight;
|
||||
|
||||
public TreeGenBase() {
|
||||
minHeight = 4;
|
||||
maxHeight = 80;
|
||||
spawnPods = false;
|
||||
minPodHeight = 3;
|
||||
}
|
||||
|
||||
protected int randBetween(int a, int b) {
|
||||
return a + rand.nextInt(b - a);
|
||||
}
|
||||
|
||||
protected float randBetween(float a, float b) {
|
||||
return a + rand.nextFloat() * (b - a);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean generate(World world, Random random, int x, int y, int z) {
|
||||
this.world = world;
|
||||
startX = x;
|
||||
startY = y;
|
||||
startZ = z;
|
||||
girth = tree.getGirth(world, x, y, z);
|
||||
height = (int) (randBetween(getHeight()[0], getHeight()[1]) * tree.getGenome().getHeight());
|
||||
|
||||
if (tree.canGrow(world, x, y, z, girth, height)) {
|
||||
generate();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void generate() {
|
||||
}
|
||||
|
||||
protected int[] getHeight() {
|
||||
return new int[]{5, 2};
|
||||
}
|
||||
|
||||
private static class Vector {
|
||||
int x;
|
||||
int y;
|
||||
int z;
|
||||
|
||||
public Vector(int x, int y, int z) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -80,8 +80,8 @@ public class ControlGene extends Control implements IControlValue<IGene>, IToolt
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
if (isMouseOver() && canFill(Window.get(this).getHeldItemStack())) {
|
||||
CraftGUI.Render.solid(getArea(), -1);
|
||||
CraftGUI.Render.solid(getArea().inset(1), -12303292);
|
||||
CraftGUI.Render.solid(getArea(), 0xffffffff);
|
||||
CraftGUI.Render.solid(getArea().inset(1), 0xff444444);
|
||||
}
|
||||
|
||||
CraftGUI.Render.colour(-1);
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
package binnie.genetics.craftgui;
|
||||
|
||||
import binnie.core.craftgui.CraftGUI;
|
||||
import binnie.core.craftgui.IWidget;
|
||||
import binnie.core.craftgui.geometry.IArea;
|
||||
import binnie.core.craftgui.geometry.IPoint;
|
||||
import binnie.core.craftgui.minecraft.control.ControlMachineProgress;
|
||||
|
||||
// TODO unused class?
|
||||
public class ControlProcessTemporary extends ControlMachineProgress {
|
||||
public ControlProcessTemporary(IWidget parent, int x, int y, int width, int height) {
|
||||
super(parent, x, y, null, null, null);
|
||||
setSize(new IPoint(width, height));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
CraftGUI.Render.solid(getArea(), -4868683);
|
||||
float w = getSize().y() * progress / 100.0f;
|
||||
CraftGUI.Render.solid(new IArea(getArea().x(), getArea().y(), w, getArea().h()), -65536);
|
||||
}
|
||||
}
|
||||
@@ -10,21 +10,17 @@ import binnie.core.craftgui.minecraft.control.ControlSlot;
|
||||
import binnie.core.craftgui.minecraft.control.ControlSlotArray;
|
||||
import binnie.core.craftgui.resource.Texture;
|
||||
import binnie.core.craftgui.resource.minecraft.StandardTexture;
|
||||
import binnie.core.util.I18N;
|
||||
import binnie.extrabees.core.ExtraBeeTexture;
|
||||
import binnie.genetics.Genetics;
|
||||
import binnie.genetics.machine.Acclimatiser;
|
||||
import binnie.genetics.machine.acclimatiser.Acclimatiser;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
|
||||
public class WindowAcclimatiser extends WindowMachine {
|
||||
public static int[] slotReserve = new int[]{0, 1, 2, 3};
|
||||
public static int slotTarget = 4;
|
||||
public static int[] slotAcclimatiser = new int[]{5, 6, 7};
|
||||
public static int[] slotDone = new int[]{8, 9, 10, 11};
|
||||
|
||||
protected static Texture ProgressBase = new StandardTexture(64, 0, 130, 21, ExtraBeeTexture.GUIProgress.getTexture());
|
||||
protected static Texture Progress = new StandardTexture(64, 21, 130, 21, ExtraBeeTexture.GUIProgress.getTexture());
|
||||
protected static Texture progressBase = new StandardTexture(64, 0, 130, 21, ExtraBeeTexture.GUIProgress.getTexture());
|
||||
protected static Texture progress = new StandardTexture(64, 21, 130, 21, ExtraBeeTexture.GUIProgress.getTexture());
|
||||
|
||||
public WindowAcclimatiser(EntityPlayer player, IInventory inventory, Side side) {
|
||||
super(280, 198, player, inventory, side);
|
||||
@@ -36,15 +32,15 @@ public class WindowAcclimatiser extends WindowMachine {
|
||||
|
||||
@Override
|
||||
public void initialiseClient() {
|
||||
setTitle("Acclimatiser");
|
||||
int x = 16;
|
||||
setTitle(I18N.localise(Genetics.instance, "machine.labMachine.acclimatiser"));
|
||||
int x = 59;
|
||||
int y = 32;
|
||||
new ControlSlotArray(this, x, y, 2, 2).create(Acclimatiser.slotReserve);
|
||||
new ControlSlotArray(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.slotAcclimatiser);
|
||||
new ControlSlotArray(this, x, y + 18 + 18, 3, 1).create(Acclimatiser.SLOT_ACCLIMATISER);
|
||||
x += 72;
|
||||
new ControlSlotArray(this, x, y, 2, 2).create(Acclimatiser.slotDone);
|
||||
new ControlSlotArray(this, x, y, 2, 2).create(Acclimatiser.SLOT_DONE);
|
||||
new ControlEnergyBar(this, 21, 115, 16, 60, Position.Bottom);
|
||||
new ControlErrorState(this, 181.0f, 83.0f);
|
||||
new ControlPlayerInventory(this);
|
||||
@@ -52,7 +48,7 @@ public class WindowAcclimatiser extends WindowMachine {
|
||||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return "Acclimatiser";
|
||||
return I18N.localise(Genetics.instance, "machine.labMachine.acclimatiser");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -62,6 +58,6 @@ public class WindowAcclimatiser extends WindowMachine {
|
||||
|
||||
@Override
|
||||
protected String getName() {
|
||||
return "Acclimatiser";
|
||||
return I18N.localise(Genetics.instance, "machine.labMachine.acclimatiser");
|
||||
}
|
||||
}
|
||||
@@ -19,7 +19,7 @@ import binnie.core.craftgui.window.Panel;
|
||||
import binnie.extrabees.core.ExtraBeeTexture;
|
||||
import binnie.genetics.Genetics;
|
||||
import binnie.genetics.core.GeneticsTexture;
|
||||
import binnie.genetics.machine.Analyser;
|
||||
import binnie.genetics.machine.analyser.Analyser;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
@@ -42,7 +42,7 @@ public class WindowAnalyser extends WindowMachine {
|
||||
WindowAnalyser.Progress = new StandardTexture(66, 51, 66, 40, GeneticsTexture.GUIProcess.getTexture());
|
||||
int x = 16;
|
||||
int y = 32;
|
||||
new ControlSlotArray(this, x, y, 2, 3).create(Analyser.slotReserve);
|
||||
new ControlSlotArray(this, x, y, 2, 3).create(Analyser.SLOT_RESERVE);
|
||||
x += 28;
|
||||
new ControlSlot(this, x, y + 54 + 8).assign(13);
|
||||
new ControlSlotCharge(this, x + 20, y + 54 + 8, 13).setColor(10040319);
|
||||
@@ -56,7 +56,7 @@ public class WindowAnalyser extends WindowMachine {
|
||||
new ControlSlot(this, x + 38 - 9, y + 25 - 9).assign(6);
|
||||
new ControlIconDisplay(this, x + 76 + 2, y + 18, GUIIcon.ArrowRight.getIcon());
|
||||
x += 96;
|
||||
new ControlSlotArray(this, x, y, 2, 3).create(Analyser.slotFinished);
|
||||
new ControlSlotArray(this, x, y, 2, 3).create(Analyser.SLOT_FINISHED);
|
||||
x += 52;
|
||||
setTitle("Analyser");
|
||||
new ControlPlayerInventory(this);
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
package binnie.genetics.craftgui;
|
||||
|
||||
import binnie.core.AbstractMod;
|
||||
import binnie.core.craftgui.minecraft.Window;
|
||||
import binnie.genetics.Genetics;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
|
||||
// TODO unused class?
|
||||
public class WindowGeneProject extends Window {
|
||||
public WindowGeneProject(EntityPlayer player, IInventory inventory, Side side) {
|
||||
super(100.0f, 100.0f, player, inventory, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AbstractMod getMod() {
|
||||
return Genetics.instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getName() {
|
||||
return "GeneProjects";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialiseClient() {
|
||||
setTitle("Gene Projects");
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,7 @@ import binnie.core.craftgui.resource.Texture;
|
||||
import binnie.core.craftgui.resource.minecraft.StandardTexture;
|
||||
import binnie.extrabees.core.ExtraBeeTexture;
|
||||
import binnie.genetics.Genetics;
|
||||
import binnie.genetics.machine.Genepool;
|
||||
import binnie.genetics.machine.genepool.Genepool;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
@@ -41,7 +41,7 @@ public class WindowGenepool extends WindowMachine {
|
||||
int y = 32;
|
||||
new ControlLiquidTank(this, x, y).setTankID(1);
|
||||
x += 26;
|
||||
new ControlSlotArray(this, x, y + 3, 2, 3).create(Genepool.slotReserve);
|
||||
new ControlSlotArray(this, x, y + 3, 2, 3).create(Genepool.SLOT_RESERVE);
|
||||
x += 38;
|
||||
new ControlIconDisplay(this, x, y + 3 + 18 + 1, GUIIcon.ArrowRight.getIcon());
|
||||
x += 18;
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
package binnie.genetics.craftgui;
|
||||
|
||||
import binnie.core.AbstractMod;
|
||||
import binnie.core.craftgui.minecraft.Window;
|
||||
import binnie.genetics.Genetics;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
|
||||
// TODO unused class?
|
||||
public class WindowGenomeAssembler extends WindowMachine {
|
||||
public WindowGenomeAssembler(EntityPlayer player, IInventory inventory, Side side) {
|
||||
super(320, 240, player, inventory, side);
|
||||
}
|
||||
|
||||
public static Window create(EntityPlayer player, IInventory inventory, Side side) {
|
||||
return new WindowGenomeAssembler(player, inventory, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return "Genome Assembler";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AbstractMod getMod() {
|
||||
return Genetics.instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getName() {
|
||||
return "GenomeAssembler";
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,7 @@ import binnie.core.craftgui.resource.Texture;
|
||||
import binnie.core.craftgui.resource.minecraft.StandardTexture;
|
||||
import binnie.genetics.Genetics;
|
||||
import binnie.genetics.core.GeneticsTexture;
|
||||
import binnie.genetics.machine.Incubator;
|
||||
import binnie.genetics.machine.incubator.Incubator;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
@@ -40,7 +40,7 @@ public class WindowIncubator extends WindowMachine {
|
||||
int y = 32;
|
||||
new ControlLiquidTank(this, x, y).setTankID(0);
|
||||
x += 26;
|
||||
new ControlSlotArray(this, x, y + 3, 1, 3).create(Incubator.slotQueue);
|
||||
new ControlSlotArray(this, x, y + 3, 1, 3).create(Incubator.SLOT_QUEUE);
|
||||
x += 20;
|
||||
new ControlIconDisplay(this, x, y + 3 + 10, GUIIcon.ArrowRight.getIcon());
|
||||
x += 18;
|
||||
@@ -49,7 +49,7 @@ public class WindowIncubator extends WindowMachine {
|
||||
x += 40;
|
||||
new ControlIconDisplay(this, x, y + 3 + 10, GUIIcon.ArrowRight.getIcon());
|
||||
x += 18;
|
||||
new ControlSlotArray(this, x, y + 3, 1, 3).create(Incubator.slotOutput);
|
||||
new ControlSlotArray(this, x, y + 3, 1, 3).create(Incubator.SLOT_OUTPUT);
|
||||
x += 26;
|
||||
new ControlLiquidTank(this, x, y).setTankID(1);
|
||||
x += 34;
|
||||
|
||||
@@ -17,7 +17,7 @@ import binnie.core.craftgui.resource.Texture;
|
||||
import binnie.core.craftgui.resource.minecraft.StandardTexture;
|
||||
import binnie.extrabees.core.ExtraBeeTexture;
|
||||
import binnie.genetics.Genetics;
|
||||
import binnie.genetics.machine.Isolator;
|
||||
import binnie.genetics.machine.isolator.Isolator;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
@@ -41,7 +41,7 @@ public class WindowIsolator extends WindowMachine {
|
||||
int y = 32;
|
||||
new ControlLiquidTank(this, x, y).setTankID(0);
|
||||
x += 26;
|
||||
new ControlSlotArray(this, x, y + 3, 1, 3).create(Isolator.slotReserve);
|
||||
new ControlSlotArray(this, x, y + 3, 1, 3).create(Isolator.SLOT_RESERVE);
|
||||
x += 20;
|
||||
new ControlIconDisplay(this, x, y + 3 + 1, GUIIcon.ArrowRight.getIcon());
|
||||
x += 18;
|
||||
@@ -57,7 +57,7 @@ public class WindowIsolator extends WindowMachine {
|
||||
x += 20;
|
||||
new ControlIconDisplay(this, x, y + 3 + 1, GUIIcon.ArrowRight.getIcon());
|
||||
x += 18;
|
||||
new ControlSlotArray(this, x, y + 3, 2, 3).create(Isolator.slotFinished);
|
||||
new ControlSlotArray(this, x, y + 3, 2, 3).create(Isolator.SLOT_FINISHED);
|
||||
new ControlEnergyBar(this, 260, 130, 16, 60, Position.Bottom);
|
||||
new ControlErrorState(this, 153.0f, 81.0f);
|
||||
new ControlPlayerInventory(this);
|
||||
|
||||
@@ -17,7 +17,7 @@ import binnie.core.craftgui.resource.Texture;
|
||||
import binnie.core.craftgui.resource.minecraft.StandardTexture;
|
||||
import binnie.genetics.Genetics;
|
||||
import binnie.genetics.core.GeneticsTexture;
|
||||
import binnie.genetics.machine.Polymeriser;
|
||||
import binnie.genetics.machine.polymeriser.Polymeriser;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
@@ -42,7 +42,7 @@ public class WindowPolymeriser extends WindowMachine {
|
||||
super.initialiseClient();
|
||||
int x = 16;
|
||||
int y = 38;
|
||||
new ControlSlotArray(this, x, y, 1, 4).create(Polymeriser.slotSerumReserve);
|
||||
new ControlSlotArray(this, x, y, 1, 4).create(Polymeriser.SLOT_SERUM_RESERVE);
|
||||
new ControlIconDisplay(this, x + 18, y + 1, GUIIcon.ArrowRight.getIcon());
|
||||
x += 34;
|
||||
new ControlMachineProgress(this, x + 18, y - 6, WindowPolymeriser.ProgressBase, WindowPolymeriser.Progress, Position.Left);
|
||||
@@ -54,7 +54,7 @@ public class WindowPolymeriser extends WindowMachine {
|
||||
new ControlSlot(this, x + 30, y + 18 + 8).assign(1);
|
||||
new ControlSlotCharge(this, x + 30 + 20, y + 18 + 8, 1).setColor(16766976);
|
||||
x += 138;
|
||||
new ControlSlotArray(this, x, y + 9, 2, 2).create(Polymeriser.slotSerumFinished);
|
||||
new ControlSlotArray(this, x, y + 9, 2, 2).create(Polymeriser.SLOT_SERUM_FINISHED);
|
||||
ControlErrorState errorState = new ControlErrorState(this, 244.0f, 97.0f);
|
||||
new ControlPlayerInventory(this);
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ import binnie.core.craftgui.resource.minecraft.StandardTexture;
|
||||
import binnie.genetics.Genetics;
|
||||
import binnie.genetics.core.GeneticsTexture;
|
||||
import binnie.genetics.machine.inoculator.Inoculator;
|
||||
import binnie.genetics.machine.Splicer;
|
||||
import binnie.genetics.machine.splicer.Splicer;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
@@ -39,8 +39,8 @@ public class WindowSplicer extends WindowMachine {
|
||||
setTitle("Splicer");
|
||||
int x = 16;
|
||||
new ControlSplicerProgress(this, 84.0f, 32.0f, w() - 172.0f, 102.0f);
|
||||
CraftGUIUtil.horizontalGrid(x, 62.0f, new ControlSlotArray(this, 0, 0, 2, 1).create(Splicer.slotSerumReserve), new ControlIconDisplay(this, 0.0f, 0.0f, GUIIcon.ArrowRight.getIcon()), new ControlSlot(this, 0.0f, 0.0f).assign(0));
|
||||
new ControlSlotArray(this, x + 12, 84, 2, 1).create(Splicer.slotSerumExpended);
|
||||
CraftGUIUtil.horizontalGrid(x, 62.0f, new ControlSlotArray(this, 0, 0, 2, 1).create(Splicer.SLOT_SERUM_RESERVE), new ControlIconDisplay(this, 0.0f, 0.0f, GUIIcon.ArrowRight.getIcon()), new ControlSlot(this, 0.0f, 0.0f).assign(0));
|
||||
new ControlSlotArray(this, x + 12, 84, 2, 1).create(Splicer.SLOT_SERUM_EXPENDED);
|
||||
new ControlIconDisplay(this, x + 12 + 36 + 4, 86.0f, GUIIcon.ArrowUpLeft.getIcon());
|
||||
new ControlEnergyBar(this, 196, 64, 60, 16, Position.Left);
|
||||
new ControlErrorState(this, 218.0f, 86.0f);
|
||||
|
||||
@@ -1,119 +0,0 @@
|
||||
package binnie.genetics.genetics;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldSavedData;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
// TODO unused class?
|
||||
public class GeneProjectTracker extends WorldSavedData {
|
||||
Map<Integer, GeneProject> projects;
|
||||
Map<GameProfile, Set<Integer>> TeamInvites;
|
||||
|
||||
public GeneProjectTracker(String s) {
|
||||
super(s);
|
||||
projects = new HashMap<>();
|
||||
TeamInvites = new HashMap<>();
|
||||
}
|
||||
|
||||
public static GeneProjectTracker getTracker(World world) {
|
||||
String filename = "GeneProjectTracker.common";
|
||||
GeneProjectTracker tracker = (GeneProjectTracker) world.loadItemData(GeneProjectTracker.class, filename);
|
||||
if (tracker == null) {
|
||||
tracker = new GeneProjectTracker(filename);
|
||||
world.setItemData(filename, tracker);
|
||||
}
|
||||
return tracker;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
}
|
||||
|
||||
public int createProject(String name, GameProfile leader) {
|
||||
int i;
|
||||
for (i = 1; projects.keySet().contains(i); ++i) {
|
||||
}
|
||||
GeneProject project = new GeneProject(i, name, leader);
|
||||
projects.put(i, project);
|
||||
markDirty();
|
||||
return i;
|
||||
}
|
||||
|
||||
public void removeProject(int id) {
|
||||
projects.remove(id);
|
||||
for (Map.Entry<GameProfile, Set<Integer>> entry : TeamInvites.entrySet()) {
|
||||
entry.getValue().remove(id);
|
||||
}
|
||||
markDirty();
|
||||
}
|
||||
|
||||
public void leaveProject(int id, GameProfile player) {
|
||||
GeneProject project = projects.get(id);
|
||||
if (project == null) {
|
||||
return;
|
||||
}
|
||||
project.removePlayer(player);
|
||||
if (project.isEmpty()) {
|
||||
removeProject(id);
|
||||
}
|
||||
markDirty();
|
||||
}
|
||||
|
||||
public void joinProject(int id, GameProfile player) {
|
||||
GeneProject project = projects.get(id);
|
||||
if (project == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
project.addPlayer(player);
|
||||
markDirty();
|
||||
}
|
||||
|
||||
public void reassignPlayer(int id, int id2, GameProfile player) {
|
||||
GeneProject project = projects.get(id);
|
||||
if (project == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
GeneProject project2 = projects.get(id2);
|
||||
if (project2 == null) {
|
||||
return;
|
||||
}
|
||||
leaveProject(id, player);
|
||||
joinProject(id2, player);
|
||||
}
|
||||
|
||||
public void renameProject(int id, String newName) {
|
||||
GeneProject project = projects.get(id);
|
||||
if (project != null) {
|
||||
project.setName(newName);
|
||||
}
|
||||
markDirty();
|
||||
}
|
||||
|
||||
public void invitePlayer(int id, GameProfile player) {
|
||||
if (!TeamInvites.containsKey(player)) {
|
||||
TeamInvites.put(player, new LinkedHashSet<>());
|
||||
}
|
||||
TeamInvites.get(player).add(id);
|
||||
markDirty();
|
||||
}
|
||||
|
||||
public void revokeInvite(int id, GameProfile player) {
|
||||
if (!TeamInvites.containsKey(player)) {
|
||||
TeamInvites.put(player, new LinkedHashSet<>());
|
||||
}
|
||||
TeamInvites.get(player).add(id);
|
||||
markDirty();
|
||||
}
|
||||
}
|
||||
@@ -1,77 +0,0 @@
|
||||
package binnie.genetics.genetics;
|
||||
|
||||
import binnie.core.genetics.BreedingSystem;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IAlleleFloat;
|
||||
import forestry.api.genetics.IAlleleInteger;
|
||||
import forestry.api.genetics.IChromosomeType;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TreeSet;
|
||||
|
||||
// TODO unused class?
|
||||
public class GeneticEngineeringSystem {
|
||||
static List<IAllele> speciesList;
|
||||
public Map<IChromosomeType, List<IAllele>> chromosomeMap;
|
||||
BreedingSystem breedingSystem;
|
||||
|
||||
public GeneticEngineeringSystem(BreedingSystem system) {
|
||||
chromosomeMap = new HashMap<>();
|
||||
breedingSystem = system;
|
||||
for (IIndividual indiv : breedingSystem.getSpeciesRoot().getIndividualTemplates()) {
|
||||
for (IChromosomeType chromosome : breedingSystem.getSpeciesRoot().getKaryotype()) {
|
||||
if (!chromosomeMap.containsKey(chromosome)) {
|
||||
chromosomeMap.put(chromosome, new ArrayList<>());
|
||||
}
|
||||
try {
|
||||
IAllele a1 = indiv.getGenome().getActiveAllele(chromosome);
|
||||
IAllele a2 = indiv.getGenome().getInactiveAllele(chromosome);
|
||||
if (a1 != null) {
|
||||
chromosomeMap.get(chromosome).add(a1);
|
||||
}
|
||||
if (a2 != null) {
|
||||
chromosomeMap.get(chromosome).add(a2);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
// ignored
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (IChromosomeType chromosome2 : breedingSystem.getSpeciesRoot().getKaryotype()) {
|
||||
List<IAllele> alleles = getAlleles(chromosome2);
|
||||
TreeSet<IAllele> set = new TreeSet<IAllele>(new ComparatorAllele());
|
||||
set.addAll(alleles);
|
||||
List<IAllele> list = new ArrayList<IAllele>();
|
||||
list.addAll(set);
|
||||
chromosomeMap.put(chromosome2, list);
|
||||
}
|
||||
}
|
||||
|
||||
public List<IAllele> getAlleles(IChromosomeType chromosome) {
|
||||
return chromosomeMap.get(chromosome);
|
||||
}
|
||||
|
||||
public ISpeciesRoot getSpeciesRoot() {
|
||||
return breedingSystem.getSpeciesRoot();
|
||||
}
|
||||
|
||||
class ComparatorAllele implements Comparator<IAllele> {
|
||||
@Override
|
||||
public int compare(IAllele o1, IAllele o2) {
|
||||
if (o1 instanceof IAlleleFloat && o2 instanceof IAlleleFloat) {
|
||||
return Float.valueOf(((IAlleleFloat) o1).getValue()).compareTo(((IAlleleFloat) o2).getValue());
|
||||
}
|
||||
if (o1 instanceof IAlleleInteger && o2 instanceof IAlleleInteger) {
|
||||
return Integer.valueOf(((IAlleleInteger) o1).getValue()).compareTo(((IAlleleInteger) o2).getValue());
|
||||
}
|
||||
return o1.getUID().compareTo(o2.getUID());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -29,7 +29,7 @@ import binnie.core.genetics.BreedingSystem;
|
||||
import binnie.core.machines.inventory.SlotValidator;
|
||||
import binnie.genetics.Genetics;
|
||||
import binnie.genetics.item.GeneticsItems;
|
||||
import binnie.genetics.machine.Analyser;
|
||||
import binnie.genetics.machine.analyser.Analyser;
|
||||
import binnie.genetics.machine.ModuleMachine;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import forestry.api.apiculture.IBee;
|
||||
|
||||
@@ -1,388 +0,0 @@
|
||||
package binnie.genetics.machine;
|
||||
|
||||
import binnie.Binnie;
|
||||
import binnie.botany.api.EnumFlowerChromosome;
|
||||
import binnie.botany.gardening.Gardening;
|
||||
import binnie.core.BinnieCore;
|
||||
import binnie.core.Mods;
|
||||
import binnie.core.craftgui.minecraft.IMachineInformation;
|
||||
import binnie.core.genetics.Gene;
|
||||
import binnie.core.genetics.Tolerance;
|
||||
import binnie.core.machines.IMachine;
|
||||
import binnie.core.machines.Machine;
|
||||
import binnie.core.machines.TileEntityMachine;
|
||||
import binnie.core.machines.inventory.ComponentInventorySlots;
|
||||
import binnie.core.machines.inventory.ComponentInventoryTransfer;
|
||||
import binnie.core.machines.inventory.InventorySlot;
|
||||
import binnie.core.machines.inventory.SlotValidator;
|
||||
import binnie.core.machines.power.ComponentPowerReceptor;
|
||||
import binnie.core.machines.power.ComponentProcessIndefinate;
|
||||
import binnie.core.machines.power.ErrorState;
|
||||
import binnie.genetics.core.GeneticsGUI;
|
||||
import binnie.genetics.core.GeneticsTexture;
|
||||
import binnie.genetics.machine.inoculator.Inoculator;
|
||||
import forestry.api.apiculture.EnumBeeChromosome;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.EnumTolerance;
|
||||
import forestry.api.genetics.IAlleleTolerance;
|
||||
import forestry.api.genetics.IChromosomeType;
|
||||
import forestry.api.genetics.IGenome;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import forestry.api.lepidopterology.EnumButterflyChromosome;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
public class Acclimatiser {
|
||||
public static int[] slotReserve = new int[]{0, 1, 2, 3};
|
||||
public static int[] slotAcclimatiser = new int[]{5, 6, 7};
|
||||
public static int[] slotDone = new int[]{8, 9, 10, 11};
|
||||
public static int slotTarget = 4;
|
||||
|
||||
protected static Map<ItemStack, Float> temperatureItems = new HashMap<>();
|
||||
protected static Map<ItemStack, Float> humidityItems = new HashMap<>();
|
||||
|
||||
private static List<ToleranceSystem> toleranceSystems = new ArrayList<>();
|
||||
|
||||
private static ToleranceSystem getToleranceSystem(ItemStack stack, ItemStack acclim) {
|
||||
ISpeciesRoot root = AlleleManager.alleleRegistry.getSpeciesRoot(stack);
|
||||
if (root == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
for (ToleranceSystem system : Acclimatiser.toleranceSystems) {
|
||||
if (root.getUID().equals(system.uid) && system.type.hasEffect(acclim)) {
|
||||
return system;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void addTolerance(String uid, IChromosomeType chromosome, ToleranceType type) {
|
||||
Acclimatiser.toleranceSystems.add(new ToleranceSystem(uid, chromosome, type));
|
||||
}
|
||||
|
||||
public static float getTemperatureEffect(ItemStack item) {
|
||||
for (ItemStack stack : Acclimatiser.temperatureItems.keySet()) {
|
||||
if (stack.isItemEqual(item)) {
|
||||
return Acclimatiser.temperatureItems.get(stack);
|
||||
}
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
public static float getHumidityEffect(ItemStack item) {
|
||||
for (ItemStack stack : Acclimatiser.humidityItems.keySet()) {
|
||||
if (stack.isItemEqual(item)) {
|
||||
return Acclimatiser.humidityItems.get(stack);
|
||||
}
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
public static void addTemperatureItem(ItemStack itemStack, float amount) {
|
||||
if (itemStack == null) {
|
||||
return;
|
||||
}
|
||||
Acclimatiser.temperatureItems.put(itemStack, amount);
|
||||
}
|
||||
|
||||
public static void addHumidityItem(ItemStack itemStack, float amount) {
|
||||
if (itemStack == null) {
|
||||
return;
|
||||
}
|
||||
Acclimatiser.humidityItems.put(itemStack, amount);
|
||||
}
|
||||
|
||||
public static void setupRecipes() {
|
||||
if (BinnieCore.isApicultureActive()) {
|
||||
addTolerance(Binnie.Genetics.getBeeRoot().getUID(), EnumBeeChromosome.HUMIDITY_TOLERANCE, ToleranceType.Humidity);
|
||||
addTolerance(Binnie.Genetics.getBeeRoot().getUID(), EnumBeeChromosome.TEMPERATURE_TOLERANCE, ToleranceType.Temperature);
|
||||
}
|
||||
|
||||
if (BinnieCore.isLepidopteryActive()) {
|
||||
addTolerance(Binnie.Genetics.getButterflyRoot().getUID(), EnumButterflyChromosome.HUMIDITY_TOLERANCE, ToleranceType.Humidity);
|
||||
addTolerance(Binnie.Genetics.getButterflyRoot().getUID(), EnumButterflyChromosome.TEMPERATURE_TOLERANCE, ToleranceType.Temperature);
|
||||
}
|
||||
|
||||
if (BinnieCore.isBotanyActive()) {
|
||||
addTolerance(Binnie.Genetics.getFlowerRoot().getUID(), EnumFlowerChromosome.HUMIDITY_TOLERANCE, ToleranceType.Humidity);
|
||||
addTolerance(Binnie.Genetics.getFlowerRoot().getUID(), EnumFlowerChromosome.TEMPERATURE_TOLERANCE, ToleranceType.Temperature);
|
||||
addTolerance(Binnie.Genetics.getFlowerRoot().getUID(), EnumFlowerChromosome.PH_TOLERANCE, ToleranceType.PH);
|
||||
}
|
||||
|
||||
addTemperatureItem(new ItemStack(Items.blaze_powder), 0.5f);
|
||||
addTemperatureItem(new ItemStack(Items.blaze_rod), 0.75f);
|
||||
addTemperatureItem(new ItemStack(Items.lava_bucket), 0.75f);
|
||||
addTemperatureItem(new ItemStack(Items.snowball), -0.15f);
|
||||
addTemperatureItem(new ItemStack(Blocks.ice), -0.75f);
|
||||
addHumidityItem(new ItemStack(Items.water_bucket), 0.75f);
|
||||
addHumidityItem(new ItemStack(Blocks.sand), -0.15f);
|
||||
addTemperatureItem(Mods.Forestry.stack("canLava"), 0.75f);
|
||||
addTemperatureItem(Mods.Forestry.stack("refractoryLava"), 0.75f);
|
||||
addHumidityItem(Mods.Forestry.stack("canWater"), 0.75f);
|
||||
addHumidityItem(Mods.Forestry.stack("refractoryWater"), 0.75f);
|
||||
addHumidityItem(Mods.Forestry.stack("waxCapsuleWater"), 0.75f);
|
||||
}
|
||||
|
||||
public static boolean canAcclimatise(ItemStack stack, List<ItemStack> acclimatisers) {
|
||||
if (stack == null || acclimatisers.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
for (ItemStack acclim : acclimatisers) {
|
||||
if (canAcclimatise(stack, acclim)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean canAcclimatise(ItemStack stack, ItemStack acclim) {
|
||||
ToleranceSystem system = getToleranceSystem(stack, acclim);
|
||||
return system != null && system.canAlter(stack, acclim);
|
||||
}
|
||||
|
||||
public static ItemStack acclimatise(ItemStack stack, ItemStack acc) {
|
||||
ToleranceSystem system = getToleranceSystem(stack, acc);
|
||||
return system.alter(stack, acc);
|
||||
}
|
||||
|
||||
public static Tolerance alterTolerance(Tolerance tol, float effect) {
|
||||
int[] is = tol.getBounds();
|
||||
int[] range;
|
||||
if (effect < 0.0f) {
|
||||
range = new int[]{is[0] - 1, is[1]};
|
||||
} else {
|
||||
range = new int[]{is[0], is[1] + 1};
|
||||
}
|
||||
|
||||
if (range[0] < -5) {
|
||||
range[0] = -5;
|
||||
}
|
||||
if (range[1] > 5) {
|
||||
range[1] = 5;
|
||||
}
|
||||
|
||||
EnumTolerance[] up = {EnumTolerance.NONE, EnumTolerance.UP_1, EnumTolerance.UP_2, EnumTolerance.UP_3, EnumTolerance.UP_4, EnumTolerance.UP_5};
|
||||
EnumTolerance[] down = {EnumTolerance.NONE, EnumTolerance.DOWN_1, EnumTolerance.DOWN_2, EnumTolerance.DOWN_3, EnumTolerance.DOWN_4, EnumTolerance.DOWN_5};
|
||||
EnumTolerance[] both = {EnumTolerance.NONE, EnumTolerance.BOTH_1, EnumTolerance.BOTH_2, EnumTolerance.BOTH_3, EnumTolerance.BOTH_4, EnumTolerance.BOTH_5};
|
||||
|
||||
if (range[0] == 0) {
|
||||
return Tolerance.get(up[range[1]]);
|
||||
}
|
||||
if (range[1] == 0) {
|
||||
return Tolerance.get(down[-range[0]]);
|
||||
}
|
||||
|
||||
int avg = (int) ((-range[0] + range[1]) / 2.0f + 0.6f);
|
||||
return Tolerance.get(both[avg]);
|
||||
}
|
||||
|
||||
public enum ToleranceType {
|
||||
Temperature,
|
||||
Humidity,
|
||||
PH;
|
||||
|
||||
public float getEffect(ItemStack stack) {
|
||||
switch (this) {
|
||||
case Temperature:
|
||||
return Acclimatiser.getTemperatureEffect(stack);
|
||||
|
||||
case Humidity:
|
||||
return Acclimatiser.getHumidityEffect(stack);
|
||||
|
||||
case PH:
|
||||
if (Gardening.isAcidFertiliser(stack)) {
|
||||
return -0.5f * Gardening.getFertiliserStrength(stack);
|
||||
}
|
||||
if (Gardening.isAlkalineFertiliser(stack)) {
|
||||
return 0.5f * Gardening.getFertiliserStrength(stack);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
public boolean hasEffect(ItemStack stack) {
|
||||
return getEffect(stack) != 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
public static class PackageAcclimatiser extends GeneticMachine.PackageGeneticBase implements IMachineInformation {
|
||||
public PackageAcclimatiser() {
|
||||
super("acclimatiser", GeneticsTexture.Acclimatiser, 0x966a49, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createMachine(Machine machine) {
|
||||
new ComponentGeneticGUI(machine, GeneticsGUI.Acclimatiser);
|
||||
ComponentInventorySlots inventory = new ComponentInventorySlots(machine);
|
||||
inventory.addSlot(4, "process");
|
||||
inventory.getSlot(4).setValidator(new SlotValidator.Individual());
|
||||
inventory.getSlot(4).setReadOnly();
|
||||
inventory.getSlot(4).forbidExtraction();
|
||||
|
||||
for (InventorySlot slot : inventory.addSlotArray(Acclimatiser.slotReserve, "input")) {
|
||||
slot.forbidExtraction();
|
||||
slot.setValidator(new SlotValidator.Individual());
|
||||
}
|
||||
|
||||
for (InventorySlot slot : inventory.addSlotArray(Acclimatiser.slotDone, "output")) {
|
||||
slot.setReadOnly();
|
||||
slot.setValidator(new SlotValidator.Individual());
|
||||
}
|
||||
|
||||
for (InventorySlot slot : inventory.addSlotArray(Acclimatiser.slotAcclimatiser, "acclimatiser")) {
|
||||
slot.setValidator(new ValidatorAcclimatiserItem());
|
||||
}
|
||||
|
||||
ComponentInventoryTransfer transfer = new ComponentInventoryTransfer(machine);
|
||||
transfer.addRestock(Acclimatiser.slotReserve, 4, 1);
|
||||
transfer.addStorage(4, Acclimatiser.slotDone, new ComponentInventoryTransfer.Condition() {
|
||||
@Override
|
||||
public boolean fufilled(ItemStack stack) {
|
||||
return !Acclimatiser.canAcclimatise(stack, machine.getMachineUtil().getNonNullStacks(Acclimatiser.slotAcclimatiser));
|
||||
}
|
||||
});
|
||||
|
||||
new ComponentPowerReceptor(machine, 5000);
|
||||
new ComponentAcclimatiserLogic(machine);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createTileEntity() {
|
||||
return new TileEntityMachine(this);
|
||||
}
|
||||
}
|
||||
|
||||
public static class ComponentAcclimatiserLogic extends ComponentProcessIndefinate {
|
||||
public ComponentAcclimatiserLogic(IMachine machine) {
|
||||
super(machine, 2.0f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ErrorState canWork() {
|
||||
if (getUtil().getStack(4) == null) {
|
||||
return new ErrorState.NoItem("No Individual to Acclimatise", 4);
|
||||
}
|
||||
if (getUtil().getNonNullStacks(Acclimatiser.slotAcclimatiser).isEmpty()) {
|
||||
return new ErrorState.NoItem("No Acclimatising Items", Acclimatiser.slotAcclimatiser);
|
||||
}
|
||||
return super.canWork();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ErrorState canProgress() {
|
||||
if (!Acclimatiser.canAcclimatise(getUtil().getStack(4), getUtil().getNonNullStacks(Acclimatiser.slotAcclimatiser))) {
|
||||
return new ErrorState.InvalidItem("Cannot Acclimatise this individual with these items", 4);
|
||||
}
|
||||
return super.canProgress();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean inProgress() {
|
||||
return canWork() == null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onTickTask() {
|
||||
super.onTickTask();
|
||||
if (getUtil().getRandom().nextInt(100) == 0) {
|
||||
attemptAcclimatisation();
|
||||
}
|
||||
}
|
||||
|
||||
protected void attemptAcclimatisation() {
|
||||
List<ItemStack> acclms = new ArrayList<ItemStack>();
|
||||
for (ItemStack s : getUtil().getNonNullStacks(Acclimatiser.slotAcclimatiser)) {
|
||||
if (Acclimatiser.canAcclimatise(getUtil().getStack(4), s)) {
|
||||
acclms.add(s);
|
||||
}
|
||||
}
|
||||
|
||||
ItemStack acc = acclms.get(getUtil().getRandom().nextInt(acclms.size()));
|
||||
ItemStack acclimed = Acclimatiser.acclimatise(getUtil().getStack(4), acc);
|
||||
if (acclimed != null) {
|
||||
getUtil().setStack(4, acclimed);
|
||||
boolean removed = false;
|
||||
for (int i : Acclimatiser.slotAcclimatiser) {
|
||||
if (!removed && getUtil().getStack(i) != null && getUtil().getStack(i).isItemEqual(acc)) {
|
||||
getUtil().decreaseStack(i, 1);
|
||||
removed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class ValidatorAcclimatiserItem extends SlotValidator {
|
||||
public ValidatorAcclimatiserItem() {
|
||||
super(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid(ItemStack stack) {
|
||||
for (ToleranceType type : ToleranceType.values()) {
|
||||
if (type.hasEffect(stack)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTooltip() {
|
||||
return "Acclimatising Items";
|
||||
}
|
||||
}
|
||||
|
||||
private static class ToleranceSystem {
|
||||
String uid;
|
||||
IChromosomeType chromosomeOrdinal;
|
||||
ToleranceType type;
|
||||
|
||||
private ToleranceSystem(String uid, IChromosomeType chromosomeOrdinal, ToleranceType type) {
|
||||
this.uid = uid;
|
||||
this.chromosomeOrdinal = chromosomeOrdinal;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public boolean canAlter(ItemStack stack, ItemStack acclim) {
|
||||
IIndividual member = AlleleManager.alleleRegistry.getIndividual(stack);
|
||||
IGenome genome = member.getGenome();
|
||||
IAlleleTolerance tolAllele = (IAlleleTolerance) genome.getActiveAllele(chromosomeOrdinal);
|
||||
Tolerance tol = Tolerance.get(tolAllele.getValue());
|
||||
float effect = type.getEffect(acclim);
|
||||
return (effect > 0.0f && tol.getBounds()[1] < 5) || (effect < 0.0f && tol.getBounds()[0] > -5);
|
||||
}
|
||||
|
||||
public ItemStack alter(ItemStack stack, ItemStack acc) {
|
||||
Random rand = new Random();
|
||||
float effect = type.getEffect(acc);
|
||||
if (rand.nextFloat() > Math.abs(effect)) {
|
||||
return stack;
|
||||
}
|
||||
|
||||
IIndividual member = AlleleManager.alleleRegistry.getIndividual(stack);
|
||||
IGenome genome = member.getGenome();
|
||||
IAlleleTolerance tolAllele = (IAlleleTolerance) genome.getActiveAllele(chromosomeOrdinal);
|
||||
Tolerance tol = Tolerance.get(tolAllele.getValue());
|
||||
Tolerance newTol = Acclimatiser.alterTolerance(tol, effect);
|
||||
if (rand.nextFloat() > 1.0f / (-newTol.getBounds()[0] + newTol.getBounds()[1])) {
|
||||
return stack;
|
||||
}
|
||||
ISpeciesRoot root = AlleleManager.alleleRegistry.getSpeciesRoot(stack);
|
||||
Inoculator.setGene(new Gene(newTol.getAllele(), chromosomeOrdinal, root), stack, rand.nextInt(2));
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,10 +4,11 @@ import binnie.core.machines.IMachineType;
|
||||
import binnie.core.machines.MachinePackage;
|
||||
import binnie.core.resource.IBinnieTexture;
|
||||
import binnie.genetics.Genetics;
|
||||
import binnie.genetics.machine.splicer.SplicerPackage;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public enum AdvGeneticMachine implements IMachineType {
|
||||
Splicer(Splicer.PackageSplicer.class);
|
||||
Splicer(SplicerPackage.class);
|
||||
|
||||
protected Class<? extends MachinePackage> cls;
|
||||
|
||||
@@ -29,7 +30,7 @@ public enum AdvGeneticMachine implements IMachineType {
|
||||
return new ItemStack(Genetics.packageAdvGenetic.getBlock(), i, ordinal());
|
||||
}
|
||||
|
||||
public abstract static class PackageAdvGeneticBase extends GeneticMachine.PackageGeneticBase {
|
||||
public abstract static class PackageAdvGeneticBase extends PackageGeneticBase {
|
||||
protected PackageAdvGeneticBase(String uid, IBinnieTexture renderTexture, int flashColor, boolean powered) {
|
||||
super(uid, renderTexture, flashColor, powered);
|
||||
}
|
||||
|
||||
@@ -1,318 +0,0 @@
|
||||
package binnie.genetics.machine;
|
||||
|
||||
import binnie.Binnie;
|
||||
import binnie.core.BinnieCore;
|
||||
import binnie.core.craftgui.minecraft.IMachineInformation;
|
||||
import binnie.core.machines.IMachine;
|
||||
import binnie.core.machines.Machine;
|
||||
import binnie.core.machines.MachineComponent;
|
||||
import binnie.core.machines.TileEntityMachine;
|
||||
import binnie.core.machines.component.IRender;
|
||||
import binnie.core.machines.inventory.ComponentChargedSlots;
|
||||
import binnie.core.machines.inventory.ComponentInventorySlots;
|
||||
import binnie.core.machines.inventory.ComponentInventoryTransfer;
|
||||
import binnie.core.machines.inventory.InventorySlot;
|
||||
import binnie.core.machines.inventory.SlotValidator;
|
||||
import binnie.core.machines.network.INetwork;
|
||||
import binnie.core.machines.power.ComponentPowerReceptor;
|
||||
import binnie.core.machines.power.ComponentProcessSetCost;
|
||||
import binnie.core.machines.power.ErrorState;
|
||||
import binnie.core.machines.power.IProcess;
|
||||
import binnie.genetics.api.IItemAnalysable;
|
||||
import binnie.genetics.core.GeneticsGUI;
|
||||
import binnie.genetics.core.GeneticsTexture;
|
||||
import binnie.genetics.item.GeneticsItems;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import net.minecraft.client.particle.EntityFX;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class Analyser {
|
||||
public static int[] slotReserve = new int[]{0, 1, 2, 3, 4, 5};
|
||||
public static int[] slotFinished = new int[]{7, 8, 9, 10, 11, 12};
|
||||
public static int slotTarget = 6;
|
||||
public static int slotDye = 13;
|
||||
|
||||
static {
|
||||
}
|
||||
|
||||
public static boolean isAnalysable(ItemStack stack) {
|
||||
IIndividual ind = AlleleManager.alleleRegistry.getIndividual(stack);
|
||||
return ind != null || stack.getItem() instanceof IItemAnalysable || Binnie.Genetics.getConversion(stack) != null;
|
||||
}
|
||||
|
||||
public static boolean isAnalysed(ItemStack stack) {
|
||||
IIndividual ind = AlleleManager.alleleRegistry.getIndividual(stack);
|
||||
if (ind != null) {
|
||||
return ind.isAnalyzed();
|
||||
}
|
||||
return stack.getItem() instanceof IItemAnalysable && ((IItemAnalysable) stack.getItem()).isAnalysed(stack);
|
||||
}
|
||||
|
||||
public static ItemStack analyse(ItemStack stack) {
|
||||
ItemStack conv = Binnie.Genetics.getConversionStack(stack);
|
||||
if (conv != null) {
|
||||
stack = conv;
|
||||
}
|
||||
|
||||
ISpeciesRoot root = AlleleManager.alleleRegistry.getSpeciesRoot(stack);
|
||||
if (root != null) {
|
||||
IIndividual ind = root.getMember(stack);
|
||||
ind.analyze();
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
ind.writeToNBT(nbttagcompound);
|
||||
stack.setTagCompound(nbttagcompound);
|
||||
return stack;
|
||||
}
|
||||
|
||||
if (stack.getItem() instanceof IItemAnalysable) {
|
||||
return ((IItemAnalysable) stack.getItem()).analyse(stack);
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
||||
public static class PackageAnalyser extends GeneticMachine.PackageGeneticBase implements IMachineInformation {
|
||||
public PackageAnalyser() {
|
||||
super("analyser", GeneticsTexture.Analyser, 9961727, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createMachine(Machine machine) {
|
||||
new ComponentGeneticGUI(machine, GeneticsGUI.Analyser);
|
||||
ComponentInventorySlots inventory = new ComponentInventorySlots(machine);
|
||||
inventory.addSlotArray(Analyser.slotReserve, "input");
|
||||
for (InventorySlot slot : inventory.getSlots(Analyser.slotReserve)) {
|
||||
slot.setValidator(new SlotValidatorUnanalysed());
|
||||
slot.forbidExtraction();
|
||||
}
|
||||
|
||||
inventory.addSlot(6, "analyse");
|
||||
inventory.getSlot(6).setValidator(new SlotValidatorUnanalysed());
|
||||
inventory.getSlot(6).setReadOnly();
|
||||
inventory.getSlot(6).forbidInteraction();
|
||||
inventory.addSlot(13, "dye");
|
||||
inventory.getSlot(13).forbidExtraction();
|
||||
inventory.getSlot(13).setValidator(new SlotValidator(ModuleMachine.IconDye) {
|
||||
@Override
|
||||
public boolean isValid(ItemStack itemStack) {
|
||||
return itemStack.isItemEqual(GeneticsItems.DNADye.get(1));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTooltip() {
|
||||
return "DNA Dye";
|
||||
}
|
||||
});
|
||||
|
||||
inventory.addSlotArray(Analyser.slotFinished, "output");
|
||||
for (InventorySlot slot : inventory.getSlots(Analyser.slotFinished)) {
|
||||
slot.forbidInsertion();
|
||||
slot.setReadOnly();
|
||||
}
|
||||
|
||||
ComponentInventoryTransfer transfer = new ComponentInventoryTransfer(machine);
|
||||
transfer.addRestock(Analyser.slotReserve, 6, 1);
|
||||
transfer.addStorage(6, Analyser.slotFinished, new ComponentInventoryTransfer.Condition() {
|
||||
@Override
|
||||
public boolean fufilled(ItemStack stack) {
|
||||
return Analyser.isAnalysed(stack);
|
||||
}
|
||||
});
|
||||
|
||||
new ComponentChargedSlots(machine).addCharge(13);
|
||||
new ComponentPowerReceptor(machine, 500);
|
||||
new ComponentAnalyserLogic(machine);
|
||||
new ComponentAnalyserFX(machine);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createTileEntity() {
|
||||
return new TileEntityMachine(this);
|
||||
}
|
||||
}
|
||||
|
||||
public static class ComponentAnalyserLogic extends ComponentProcessSetCost implements IProcess {
|
||||
private static float DYE_PER_TICK = 0.002f;
|
||||
|
||||
public ComponentAnalyserLogic(Machine machine) {
|
||||
super(machine, 9000, 300);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ErrorState canWork() {
|
||||
if (getUtil().isSlotEmpty(6)) {
|
||||
return new ErrorState.NoItem("No item to analyse", 6);
|
||||
}
|
||||
|
||||
boolean analysed = Analyser.isAnalysed(getUtil().getStack(6));
|
||||
if (analysed) {
|
||||
return new ErrorState.InvalidItem("Already Analysed", "Item has already been analysed", 6);
|
||||
}
|
||||
return super.canWork();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ErrorState canProgress() {
|
||||
if (getUtil().getSlotCharge(13) == 0.0f) {
|
||||
return new ErrorState.Item("Insufficient Dye", "Not enough DNA dye to analyse", new int[]{13});
|
||||
}
|
||||
return super.canProgress();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onFinishTask() {
|
||||
super.onFinishTask();
|
||||
ItemStack itemStack = getUtil().getStack(6);
|
||||
itemStack = Analyser.analyse(itemStack);
|
||||
getInventory().setInventorySlotContents(6, itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onTickTask() {
|
||||
getUtil().useCharge(13, 0.002f);
|
||||
}
|
||||
}
|
||||
|
||||
public static class SlotValidatorUnanalysed extends SlotValidator {
|
||||
public SlotValidatorUnanalysed() {
|
||||
super(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid(ItemStack itemStack) {
|
||||
return Analyser.isAnalysable(itemStack) && !Analyser.isAnalysed(itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTooltip() {
|
||||
return "Unanalysed Item";
|
||||
}
|
||||
}
|
||||
|
||||
public static class ComponentAnalyserFX extends MachineComponent implements
|
||||
IRender.RandomDisplayTick,
|
||||
IRender.DisplayTick,
|
||||
IRender.Render,
|
||||
INetwork.TilePacketSync {
|
||||
private EntityItem dummyEntityItem;
|
||||
|
||||
public ComponentAnalyserFX(IMachine machine) {
|
||||
super(machine);
|
||||
dummyEntityItem = new EntityItem(null);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void onRandomDisplayTick(World world, int x, int y, int z, Random rand) {
|
||||
// ignored
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void onDisplayTick(World world, int x, int y, int z, Random rand) {
|
||||
if (rand.nextFloat() < 1.0f && getUtil().getProcess().isInProgress()) {
|
||||
BinnieCore.proxy.getMinecraftInstance().effectRenderer.addEffect(new EntityFX(world, x + 0.5, y + 1.3 + rand.nextDouble() * 0.2, z + 0.5, 0.0, 0.0, 0.0) {
|
||||
double axisX = posX;
|
||||
double axisZ = posZ;
|
||||
double angle = rand.nextDouble() * 2.0 * 3.1415;
|
||||
|
||||
{
|
||||
axisX = 0.0;
|
||||
axisZ = 0.0;
|
||||
angle = 0.0;
|
||||
motionX = 0.05 * (rand.nextDouble() - 0.5);
|
||||
motionZ = 0.05 * (rand.nextDouble() - 0.5);
|
||||
motionY = 0.0;
|
||||
particleMaxAge = 25;
|
||||
particleGravity = 0.05f;
|
||||
noClip = true;
|
||||
setRBGColorF(0.6f, 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
setAlphaF((float) Math.cos(1.57 * particleAge / particleMaxAge));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFXLayer() {
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void renderInWorld(RenderItem renderItem, double x, double y, double z) {
|
||||
if (!getUtil().getProcess().isInProgress()) {
|
||||
return;
|
||||
}
|
||||
|
||||
ItemStack stack = getUtil().getStack(6);
|
||||
dummyEntityItem.worldObj = getMachine().getWorld();
|
||||
dummyEntityItem.setEntityItemStack(stack);
|
||||
EntityItem dummyEntityItem = this.dummyEntityItem;
|
||||
dummyEntityItem.age++;
|
||||
this.dummyEntityItem.hoverStart = 0.0f;
|
||||
if (stack == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
EntityPlayer player = BinnieCore.proxy.getPlayer();
|
||||
double dx = x + 0.5 - player.lastTickPosX;
|
||||
double dz = z + 0.5 - player.lastTickPosZ;
|
||||
double t = Math.atan2(dz, dx) * 180.0 / 3.1415;
|
||||
GL11.glPushMatrix();
|
||||
GL11.glRotatef(180.0f, 0.0f, 0.0f, 1.0f);
|
||||
GL11.glTranslatef(0.0f, -0.2f, 0.0f);
|
||||
renderItem.doRender(this.dummyEntityItem, 0.0, 0.0, 0.0, 0.0f, 0.0f);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void syncToNBT(NBTTagCompound nbt) {
|
||||
NBTTagCompound item = new NBTTagCompound();
|
||||
ItemStack stack = getUtil().getStack(6);
|
||||
if (stack == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
stack.writeToNBT(item);
|
||||
nbt.setTag("item", item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void syncFromNBT(NBTTagCompound nbt) {
|
||||
if (nbt.hasKey("item")) {
|
||||
getUtil().setStack(6, ItemStack.loadItemStackFromNBT(nbt.getCompoundTag("item")));
|
||||
} else {
|
||||
getUtil().setStack(6, null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInventoryUpdate() {
|
||||
if (!getUtil().isServer()) {
|
||||
return;
|
||||
}
|
||||
|
||||
IMachine machine = getMachine();
|
||||
TileEntity tile = machine.getTileEntity();
|
||||
machine.getWorld().markBlockForUpdate(tile.xCoord, tile.yCoord, tile.zCoord);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,148 @@
|
||||
package binnie.genetics.machine;
|
||||
|
||||
import binnie.botany.Botany;
|
||||
import binnie.core.BinnieCore;
|
||||
import binnie.core.machines.IMachine;
|
||||
import binnie.core.machines.MachineComponent;
|
||||
import binnie.core.machines.component.IInteraction;
|
||||
import binnie.core.machines.network.INetwork;
|
||||
import binnie.extrabees.ExtraBees;
|
||||
import binnie.extratrees.ExtraTrees;
|
||||
import binnie.genetics.Genetics;
|
||||
import buildcraft.api.tools.IToolWrench;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class ComponentGUIHolder extends MachineComponent implements INetwork.TilePacketSync, IInteraction.RightClick {
|
||||
private ItemStack stack;
|
||||
|
||||
public ComponentGUIHolder(IMachine machine) {
|
||||
super(machine);
|
||||
}
|
||||
|
||||
public ItemStack getStack() {
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbttagcompound) {
|
||||
super.readFromNBT(nbttagcompound);
|
||||
if (nbttagcompound == null) {
|
||||
return;
|
||||
}
|
||||
stack = ItemStack.loadItemStackFromNBT(nbttagcompound.getCompoundTag("Item"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbttagcompound) {
|
||||
super.writeToNBT(nbttagcompound);
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
if (stack != null) {
|
||||
stack.writeToNBT(nbt);
|
||||
}
|
||||
nbttagcompound.setTag("Item", nbt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void syncToNBT(NBTTagCompound nbt) {
|
||||
writeToNBT(nbt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void syncFromNBT(NBTTagCompound nbt) {
|
||||
readFromNBT(nbt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestruction() {
|
||||
super.onDestruction();
|
||||
if (stack == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
IMachine machine = getMachine();
|
||||
TileEntity tile = machine.getTileEntity();
|
||||
World world = machine.getWorld();
|
||||
Random rand = world.rand;
|
||||
float xOffset = rand.nextFloat() * 0.8f + 0.1f;
|
||||
float yOffset = rand.nextFloat() * 0.8f + 0.1f;
|
||||
float zOffset = rand.nextFloat() * 0.8f + 0.1f;
|
||||
if (stack.stackSize == 0) {
|
||||
stack.stackSize = 1;
|
||||
}
|
||||
|
||||
EntityItem entityitem = new EntityItem(world, tile.xCoord + xOffset, tile.yCoord + yOffset, tile.zCoord + zOffset, stack.copy());
|
||||
float accel = 0.05f;
|
||||
entityitem.motionX = (float) rand.nextGaussian() * accel;
|
||||
entityitem.motionY = (float) rand.nextGaussian() * accel + 0.2f;
|
||||
entityitem.motionZ = (float) rand.nextGaussian() * accel;
|
||||
world.spawnEntityInWorld(entityitem);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRightClick(World world, EntityPlayer player, int x, int y, int z) {
|
||||
if (BinnieCore.proxy.isSimulating(world) && player.getHeldItem() != null) {
|
||||
if (stack != null && player.getHeldItem().getItem() instanceof IToolWrench) {
|
||||
Random rand = world.rand;
|
||||
float f = 0.7f;
|
||||
double fOffset = (1.0f - f) * 0.5;
|
||||
double xOffset = rand.nextFloat() * f + fOffset;
|
||||
double yOffset = rand.nextFloat() * f + fOffset;
|
||||
double zOffset = rand.nextFloat() * f + fOffset;
|
||||
|
||||
EntityItem entityitem = new EntityItem(world, x + xOffset, y + yOffset, z + zOffset, stack);
|
||||
entityitem.delayBeforeCanPickup = 10;
|
||||
world.spawnEntityInWorld(entityitem);
|
||||
stack = null;
|
||||
((IToolWrench) player.getHeldItem().getItem()).wrenchUsed(player, x, y, z);
|
||||
getUtil().refreshBlock();
|
||||
return;
|
||||
}
|
||||
|
||||
List<Item> validSelections = new ArrayList<>();
|
||||
if (BinnieCore.isBotanyActive()) {
|
||||
validSelections.add(Botany.database);
|
||||
}
|
||||
if (BinnieCore.isExtraBeesActive()) {
|
||||
validSelections.add(ExtraBees.dictionary);
|
||||
}
|
||||
if (BinnieCore.isExtraTreesActive()) {
|
||||
validSelections.add(ExtraTrees.itemDictionary);
|
||||
}
|
||||
if (BinnieCore.isLepidopteryActive()) {
|
||||
validSelections.add(ExtraTrees.itemDictionaryLepi);
|
||||
}
|
||||
|
||||
validSelections.add(Genetics.database);
|
||||
validSelections.add(Genetics.analyst);
|
||||
validSelections.add(Genetics.registry);
|
||||
validSelections.add(Genetics.masterRegistry);
|
||||
validSelections.add(BinnieCore.genesis);
|
||||
|
||||
if (stack == null && validSelections.contains(player.getHeldItem().getItem())) {
|
||||
stack = player.getHeldItem().copy();
|
||||
ItemStack heldItem = player.getHeldItem();
|
||||
heldItem.stackSize--;
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
return;
|
||||
}
|
||||
|
||||
if (stack != null && player.getHeldItem().getItem() instanceof IToolWrench) {
|
||||
stack.getItem().onItemRightClick(stack, world, player);
|
||||
}
|
||||
}
|
||||
|
||||
if (stack != null) {
|
||||
stack.getItem().onItemRightClick(stack, world, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ComponentGeneticGUI extends MachineComponent implements IInteraction.RightClick {
|
||||
GeneticsGUI id;
|
||||
public GeneticsGUI id;
|
||||
|
||||
public ComponentGeneticGUI(Machine machine, GeneticsGUI id) {
|
||||
super(machine);
|
||||
|
||||
@@ -1,265 +0,0 @@
|
||||
package binnie.genetics.machine;
|
||||
|
||||
import binnie.Binnie;
|
||||
import binnie.core.machines.Machine;
|
||||
import binnie.core.machines.inventory.ComponentInventory;
|
||||
import binnie.core.machines.inventory.SetList;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
// TODO unused class?
|
||||
public abstract class ComponentIndexerInventory<T> extends ComponentInventory implements IInventory {
|
||||
public int guiRefreshCounter;
|
||||
public List<Integer> sortedInventory;
|
||||
int indexerSize;
|
||||
List<ItemStack> indexerInventory;
|
||||
T sortingMode;
|
||||
boolean needsSorting;
|
||||
|
||||
public ComponentIndexerInventory(Machine machine) {
|
||||
super(machine);
|
||||
indexerSize = -1;
|
||||
guiRefreshCounter = 0;
|
||||
indexerInventory = new SetList<>();
|
||||
sortedInventory = new SetList<>();
|
||||
needsSorting = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
if (indexerSize > 0) {
|
||||
return indexerSize + 1;
|
||||
}
|
||||
return indexerInventory.size() + 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int index) {
|
||||
if (index >= 0 && index < indexerInventory.size()) {
|
||||
return indexerInventory.get(index);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int index, int amount) {
|
||||
if (index >= 0) {
|
||||
ItemStack returnStack = getStackInSlot(index).copy();
|
||||
setInventorySlotContents(index, null);
|
||||
return returnStack;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int var1) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markDirty() {
|
||||
super.markDirty();
|
||||
guiRefreshCounter++;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int index, ItemStack itemStack) {
|
||||
if (index >= 0 && index < indexerInventory.size()) {
|
||||
indexerInventory.set(index, itemStack);
|
||||
} else if (itemStack != null) {
|
||||
indexerInventory.add(itemStack);
|
||||
}
|
||||
needsSorting = true;
|
||||
markDirty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return 64;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer var1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory() {
|
||||
// ignored
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
// ignored
|
||||
}
|
||||
|
||||
public T getMode() {
|
||||
return sortingMode;
|
||||
}
|
||||
|
||||
public void setMode(T mode) {
|
||||
sortingMode = mode;
|
||||
needsSorting = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbttagcompound) {
|
||||
super.writeToNBT(nbttagcompound);
|
||||
NBTTagList indexerNBT = new NBTTagList();
|
||||
for (ItemStack item : indexerInventory) {
|
||||
NBTTagCompound itemNBT = new NBTTagCompound();
|
||||
item.writeToNBT(itemNBT);
|
||||
indexerNBT.appendTag(itemNBT);
|
||||
}
|
||||
nbttagcompound.setTag("indexer", indexerNBT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbttagcompound) {
|
||||
super.readFromNBT(nbttagcompound);
|
||||
NBTTagList indexerNBT = nbttagcompound.getTagList("indexer", 10);
|
||||
indexerInventory.clear();
|
||||
for (int i = 0; i < indexerNBT.tagCount(); ++i) {
|
||||
NBTTagCompound itemNBT = indexerNBT.getCompoundTagAt(i);
|
||||
setInventorySlotContents(i, ItemStack.loadItemStackFromNBT(itemNBT));
|
||||
}
|
||||
needsSorting = true;
|
||||
markDirty();
|
||||
}
|
||||
|
||||
public abstract void Sort();
|
||||
|
||||
public static class ComponentApiaristIndexerInventory extends ComponentIndexerInventory<ComponentApiaristIndexerInventory.Mode> implements IInventory {
|
||||
public ComponentApiaristIndexerInventory(Machine machine) {
|
||||
super(machine);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Sort() {
|
||||
int i = 0;
|
||||
while (i < indexerInventory.size()) {
|
||||
if (indexerInventory.get(i) == null) {
|
||||
indexerInventory.remove(i);
|
||||
} else {
|
||||
++i;
|
||||
}
|
||||
}
|
||||
if (!needsSorting) {
|
||||
return;
|
||||
}
|
||||
needsSorting = false;
|
||||
++guiRefreshCounter;
|
||||
switch (sortingMode) {
|
||||
case Species:
|
||||
case Type: {
|
||||
class SpeciesList {
|
||||
public List<Integer> drones;
|
||||
public List<Integer> queens;
|
||||
public List<Integer> princesses;
|
||||
public List<ItemStack> bees;
|
||||
|
||||
SpeciesList() {
|
||||
drones = new ArrayList<>();
|
||||
queens = new ArrayList<>();
|
||||
princesses = new ArrayList<>();
|
||||
bees = new ArrayList<>();
|
||||
}
|
||||
|
||||
public void add(ItemStack stack) {
|
||||
bees.add(stack);
|
||||
}
|
||||
}
|
||||
|
||||
Map<Integer, SpeciesList> speciesList = new HashMap<Integer, SpeciesList>();
|
||||
for (ItemStack itemStack : indexerInventory) {
|
||||
int species = itemStack.getItemDamage();
|
||||
if (!speciesList.containsKey(species)) {
|
||||
speciesList.put(species, new SpeciesList());
|
||||
}
|
||||
speciesList.get(species).add(itemStack);
|
||||
}
|
||||
|
||||
for (SpeciesList sortableList : speciesList.values()) {
|
||||
for (ItemStack beeStack : sortableList.bees) {
|
||||
if (Binnie.Genetics.getBeeRoot().isDrone(beeStack)) {
|
||||
sortableList.drones.add(indexerInventory.indexOf(beeStack));
|
||||
} else if (Binnie.Genetics.getBeeRoot().isMated(beeStack)) {
|
||||
sortableList.queens.add(indexerInventory.indexOf(beeStack));
|
||||
} else {
|
||||
sortableList.princesses.add(indexerInventory.indexOf(beeStack));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sortedInventory = new SetList<>();
|
||||
switch (sortingMode) {
|
||||
case Species:
|
||||
for (int j = 0; j < 1024; ++j) {
|
||||
if (speciesList.containsKey(j)) {
|
||||
sortedInventory.addAll(speciesList.get(j).queens);
|
||||
sortedInventory.addAll(speciesList.get(j).princesses);
|
||||
sortedInventory.addAll(speciesList.get(j).drones);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case Type:
|
||||
for (int j = 0; j < 1024; ++j) {
|
||||
if (speciesList.containsKey(j)) {
|
||||
sortedInventory.addAll(speciesList.get(j).queens);
|
||||
}
|
||||
}
|
||||
for (int j = 0; j < 1024; ++j) {
|
||||
if (speciesList.containsKey(j)) {
|
||||
sortedInventory.addAll(speciesList.get(j).princesses);
|
||||
}
|
||||
}
|
||||
for (int j = 0; j < 1024; ++j) {
|
||||
if (speciesList.containsKey(j)) {
|
||||
sortedInventory.addAll(speciesList.get(j).drones);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
sortedInventory.clear();
|
||||
for (i = 0; i < indexerInventory.size(); ++i) {
|
||||
sortedInventory.add(i);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack itemstack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public enum Mode {
|
||||
None,
|
||||
Species,
|
||||
Type
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,222 +0,0 @@
|
||||
package binnie.genetics.machine;
|
||||
|
||||
import binnie.Binnie;
|
||||
import binnie.core.BinnieCore;
|
||||
import binnie.core.craftgui.minecraft.IMachineInformation;
|
||||
import binnie.core.machines.IMachine;
|
||||
import binnie.core.machines.Machine;
|
||||
import binnie.core.machines.MachineComponent;
|
||||
import binnie.core.machines.TileEntityMachine;
|
||||
import binnie.core.machines.component.IRender;
|
||||
import binnie.core.machines.inventory.ComponentChargedSlots;
|
||||
import binnie.core.machines.inventory.ComponentInventorySlots;
|
||||
import binnie.core.machines.inventory.ComponentInventoryTransfer;
|
||||
import binnie.core.machines.inventory.ComponentTankContainer;
|
||||
import binnie.core.machines.inventory.IChargedSlots;
|
||||
import binnie.core.machines.inventory.InventorySlot;
|
||||
import binnie.core.machines.inventory.SlotValidator;
|
||||
import binnie.core.machines.inventory.TankValidator;
|
||||
import binnie.core.machines.power.ComponentPowerReceptor;
|
||||
import binnie.core.machines.power.ComponentProcessSetCost;
|
||||
import binnie.core.machines.power.ErrorState;
|
||||
import binnie.core.machines.power.IProcess;
|
||||
import binnie.genetics.core.GeneticsGUI;
|
||||
import binnie.genetics.core.GeneticsTexture;
|
||||
import binnie.genetics.item.GeneticLiquid;
|
||||
import binnie.genetics.item.GeneticsItems;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import net.minecraft.client.particle.EntityFX;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class Genepool {
|
||||
public static int slotBee = 0;
|
||||
public static int[] slotReserve;
|
||||
public static int tankDNA = 0;
|
||||
public static int tankEthanol = 1;
|
||||
public static int slotEnzyme = 7;
|
||||
|
||||
static {
|
||||
slotReserve = new int[]{1, 2, 3, 4, 5, 6};
|
||||
}
|
||||
|
||||
public static class PackageGenepool extends GeneticMachine.PackageGeneticBase implements IMachineInformation {
|
||||
public PackageGenepool() {
|
||||
super("genepool", GeneticsTexture.Genepool, 0xc134b6, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createMachine(Machine machine) {
|
||||
new ComponentGeneticGUI(machine, GeneticsGUI.Genepool);
|
||||
ComponentInventorySlots inventory = new ComponentInventorySlots(machine);
|
||||
inventory.addSlot(7, "enzyme");
|
||||
inventory.getSlot(7).setValidator(new SlotValidator.Item(GeneticsItems.Enzyme.get(1), ModuleMachine.IconEnzyme));
|
||||
inventory.getSlot(7).forbidExtraction();
|
||||
inventory.addSlot(0, "process");
|
||||
inventory.getSlot(0).setValidator(new SlotValidator.Individual());
|
||||
inventory.getSlot(0).setReadOnly();
|
||||
inventory.getSlot(0).forbidExtraction();
|
||||
inventory.addSlotArray(Genepool.slotReserve, "input");
|
||||
|
||||
for (InventorySlot slot : inventory.getSlots(Genepool.slotReserve)) {
|
||||
slot.setValidator(new SlotValidator.Individual());
|
||||
slot.forbidExtraction();
|
||||
}
|
||||
|
||||
ComponentTankContainer tanks = new ComponentTankContainer(machine);
|
||||
tanks.addTank(0, "output", 2000);
|
||||
tanks.getTankSlot(0).setReadOnly();
|
||||
tanks.addTank(1, "input", 1000);
|
||||
tanks.getTankSlot(1).forbidExtraction();
|
||||
tanks.getTankSlot(1).setValidator(new TankValidator() {
|
||||
@Override
|
||||
public String getTooltip() {
|
||||
return "Ethanol";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid(FluidStack liquid) {
|
||||
return liquid.getFluid().getName() == "bioethanol";
|
||||
}
|
||||
});
|
||||
|
||||
ComponentInventoryTransfer transfer = new ComponentInventoryTransfer(machine);
|
||||
transfer.addRestock(Genepool.slotReserve, 0, 1);
|
||||
new ComponentPowerReceptor(machine, 1600);
|
||||
new ComponentGenepoolLogic(machine);
|
||||
ComponentChargedSlots chargedSlots = new ComponentChargedSlots(machine);
|
||||
chargedSlots.addCharge(7);
|
||||
new ComponentGenepoolFX(machine);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createTileEntity() {
|
||||
return new TileEntityMachine(this);
|
||||
}
|
||||
}
|
||||
|
||||
public static class ComponentGenepoolLogic extends ComponentProcessSetCost implements IProcess {
|
||||
float enzymePerProcess;
|
||||
float ethanolPerProcess;
|
||||
private float ethanolDrain;
|
||||
|
||||
public ComponentGenepoolLogic(Machine machine) {
|
||||
super(machine, 8000, 400);
|
||||
enzymePerProcess = 0.25f;
|
||||
ethanolPerProcess = 50.0f;
|
||||
ethanolDrain = 0.0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ErrorState canWork() {
|
||||
if (getUtil().isSlotEmpty(0)) {
|
||||
return new ErrorState.NoItem("No Individual", 0);
|
||||
}
|
||||
return super.canWork();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ErrorState canProgress() {
|
||||
if (!getUtil().spaceInTank(0, getDNAAmount(getUtil().getStack(0)))) {
|
||||
return new ErrorState.NoSpace("Not enough room in Tank", new int[]{0});
|
||||
}
|
||||
if (!getUtil().liquidInTank(1, 1)) {
|
||||
return new ErrorState.InsufficientLiquid("Not enough Ethanol", 1);
|
||||
}
|
||||
if (getUtil().getSlotCharge(7) == 0.0f) {
|
||||
return new ErrorState.NoItem("Insufficient Enzyme", 7);
|
||||
}
|
||||
return super.canProgress();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onFinishTask() {
|
||||
super.onFinishTask();
|
||||
int amount = getDNAAmount(getUtil().getStack(0));
|
||||
getUtil().fillTank(0, GeneticLiquid.RawDNA.get(amount));
|
||||
getUtil().deleteStack(0);
|
||||
}
|
||||
|
||||
private int getDNAAmount(ItemStack stack) {
|
||||
ISpeciesRoot root = AlleleManager.alleleRegistry.getSpeciesRoot(stack);
|
||||
if (root == null) {
|
||||
return 10;
|
||||
}
|
||||
if (root != Binnie.Genetics.getBeeRoot()) {
|
||||
return 10;
|
||||
}
|
||||
if (Binnie.Genetics.getBeeRoot().isDrone(stack)) {
|
||||
return 10;
|
||||
}
|
||||
if (Binnie.Genetics.getBeeRoot().isMated(stack)) {
|
||||
return 50;
|
||||
}
|
||||
return 30;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onTickTask() {
|
||||
ethanolDrain += getDNAAmount(getUtil().getStack(0)) * 1.2f * getProgressPerTick() / 100.0f;
|
||||
if (ethanolDrain >= 1.0f) {
|
||||
getUtil().drainTank(1, 1);
|
||||
ethanolDrain--;
|
||||
}
|
||||
getMachine().getInterface(IChargedSlots.class).alterCharge(7, -enzymePerProcess * getProgressPerTick() / 100.0f);
|
||||
}
|
||||
}
|
||||
|
||||
public static class ComponentGenepoolFX extends MachineComponent implements IRender.RandomDisplayTick, IRender.DisplayTick {
|
||||
public ComponentGenepoolFX(IMachine machine) {
|
||||
super(machine);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void onRandomDisplayTick(World world, int x, int y, int z, Random rand) {
|
||||
// ignored
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void onDisplayTick(World world, int x, int y, int z, Random rand) {
|
||||
if (rand.nextFloat() < 1.0f && getUtil().getProcess().isInProgress()) {
|
||||
BinnieCore.proxy.getMinecraftInstance().effectRenderer.addEffect(new EntityFX(world, x + 0.3 + rand.nextDouble() * 0.4, y + 1, z + 0.3 + rand.nextDouble() * 0.4, 0.0, 0.0, 0.0) {
|
||||
double axisX = posX;
|
||||
double axisZ = posZ;
|
||||
double angle = rand.nextDouble() * 2.0 * 3.1415;
|
||||
|
||||
{
|
||||
axisX = 0.0;
|
||||
axisZ = 0.0;
|
||||
angle = 0.0;
|
||||
motionX = 0.0;
|
||||
motionZ = 0.0;
|
||||
motionY = rand.nextFloat() * 0.01;
|
||||
particleMaxAge = 25;
|
||||
particleGravity = 0.0f;
|
||||
noClip = true;
|
||||
setRBGColorF(0.4f + 0.6f * rand.nextFloat(), 0.6f * rand.nextFloat(), 0.6f + 0.4f * rand.nextFloat());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
setAlphaF((float) Math.cos(1.57 * particleAge / particleMaxAge));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFXLayer() {
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,23 +1,19 @@
|
||||
package binnie.genetics.machine;
|
||||
|
||||
import binnie.core.machines.IMachineType;
|
||||
import binnie.core.machines.Machine;
|
||||
import binnie.core.machines.MachinePackage;
|
||||
import binnie.core.machines.TileEntityMachine;
|
||||
import binnie.core.resource.BinnieResource;
|
||||
import binnie.core.resource.IBinnieTexture;
|
||||
import binnie.genetics.Genetics;
|
||||
import binnie.genetics.machine.inoculator.PackageInoculator;
|
||||
import binnie.genetics.machine.sequencer.PackageSequencer;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import binnie.genetics.machine.inoculator.InoculatorPackage;
|
||||
import binnie.genetics.machine.isolator.IsolatorPackage;
|
||||
import binnie.genetics.machine.polymeriser.PolymeriserPackage;
|
||||
import binnie.genetics.machine.sequencer.SequencerPackage;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public enum GeneticMachine implements IMachineType {
|
||||
Isolator(Isolator.PackageIsolator.class),
|
||||
Sequencer(PackageSequencer.class),
|
||||
Polymeriser(Polymeriser.PackagePolymeriser.class),
|
||||
Inoculator(PackageInoculator.class);
|
||||
Isolator(IsolatorPackage.class),
|
||||
Sequencer(SequencerPackage.class),
|
||||
Polymeriser(PolymeriserPackage.class),
|
||||
Inoculator(InoculatorPackage.class);
|
||||
|
||||
protected Class<? extends MachinePackage> clss;
|
||||
|
||||
@@ -38,25 +34,4 @@ public enum GeneticMachine implements IMachineType {
|
||||
public ItemStack get(int i) {
|
||||
return new ItemStack(Genetics.packageGenetic.getBlock(), i, ordinal());
|
||||
}
|
||||
|
||||
public abstract static class PackageGeneticBase extends MachinePackage {
|
||||
protected BinnieResource renderTexture;
|
||||
protected int colour;
|
||||
|
||||
protected PackageGeneticBase(String uid, IBinnieTexture renderTexture, int flashColor, boolean powered) {
|
||||
super(uid, powered);
|
||||
this.renderTexture = renderTexture.getTexture();
|
||||
colour = flashColor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createTileEntity() {
|
||||
return new TileEntityMachine(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderMachine(Machine machine, double x, double y, double z, float partialTick, RenderBlocks renderer) {
|
||||
MachineRendererGenetics.instance.renderMachine(machine, colour, renderTexture, x, y, z, partialTick);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,345 +0,0 @@
|
||||
package binnie.genetics.machine;
|
||||
|
||||
import binnie.Binnie;
|
||||
import binnie.core.BinnieCore;
|
||||
import binnie.core.craftgui.minecraft.IMachineInformation;
|
||||
import binnie.core.machines.Machine;
|
||||
import binnie.core.machines.MachineUtil;
|
||||
import binnie.core.machines.TileEntityMachine;
|
||||
import binnie.core.machines.inventory.ComponentInventorySlots;
|
||||
import binnie.core.machines.inventory.ComponentTankContainer;
|
||||
import binnie.core.machines.inventory.InventorySlot;
|
||||
import binnie.core.machines.power.ComponentPowerReceptor;
|
||||
import binnie.core.machines.power.ComponentProcessIndefinate;
|
||||
import binnie.core.machines.power.ErrorState;
|
||||
import binnie.core.machines.power.IProcess;
|
||||
import binnie.core.machines.transfer.TransferRequest;
|
||||
import binnie.genetics.api.IIncubatorRecipe;
|
||||
import binnie.genetics.core.GeneticsGUI;
|
||||
import binnie.genetics.core.GeneticsTexture;
|
||||
import binnie.genetics.item.GeneticLiquid;
|
||||
import binnie.genetics.item.GeneticsItems;
|
||||
import forestry.api.apiculture.EnumBeeType;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class Incubator {
|
||||
public static int[] slotQueue = new int[]{0, 1, 2};
|
||||
public static int[] slotOutput = new int[]{4, 5, 6};
|
||||
public static int slotIncubator = 3;
|
||||
public static int tankInput = 0;
|
||||
public static int tankOutput = 1;
|
||||
private static List<IIncubatorRecipe> RECIPES = new ArrayList<>();
|
||||
|
||||
public static void addRecipes() {
|
||||
Incubator.RECIPES.add(new IncubatorRecipe(Binnie.Liquid.getLiquidStack("water", 25), GeneticLiquid.GrowthMedium.get(25), 0.2f) {
|
||||
@Override
|
||||
public boolean isItemStack(ItemStack stack) {
|
||||
return GeneticsItems.GrowthMedium.get(1).isItemEqual(stack);
|
||||
}
|
||||
});
|
||||
Incubator.RECIPES.add(new IncubatorRecipe(GeneticLiquid.GrowthMedium.get(25), GeneticLiquid.Bacteria.get(5), 0.2f) {
|
||||
@Override
|
||||
public boolean isItemStack(ItemStack stack) {
|
||||
return new ItemStack(Items.wheat).isItemEqual(stack);
|
||||
}
|
||||
});
|
||||
Incubator.RECIPES.add(new IncubatorRecipe(GeneticLiquid.Bacteria.get(0), GeneticLiquid.Bacteria.get(5), 0.05f) {
|
||||
@Override
|
||||
public boolean isItemStack(ItemStack stack) {
|
||||
return GeneticsItems.GrowthMedium.get(1).isItemEqual(stack);
|
||||
}
|
||||
});
|
||||
Incubator.RECIPES.add(new IncubatorRecipe(GeneticLiquid.Bacteria.get(2), null, 0.5f, 0.2f) {
|
||||
@Override
|
||||
public boolean isItemStack(ItemStack stack) {
|
||||
return stack.getItem() == Items.sugar;
|
||||
}
|
||||
}.setOutputStack(GeneticsItems.Enzyme.get(1)));
|
||||
Incubator.RECIPES.add(new IncubatorRecipe(GeneticLiquid.BacteriaPoly.get(0), GeneticLiquid.BacteriaPoly.get(5), 0.05f) {
|
||||
@Override
|
||||
public boolean isItemStack(ItemStack stack) {
|
||||
return GeneticsItems.GrowthMedium.get(1).isItemEqual(stack);
|
||||
}
|
||||
});
|
||||
Incubator.RECIPES.add(new IncubatorRecipe(GeneticLiquid.BacteriaVector.get(0), GeneticLiquid.BacteriaVector.get(5), 0.05f) {
|
||||
@Override
|
||||
public boolean isItemStack(ItemStack stack) {
|
||||
return GeneticsItems.GrowthMedium.get(1).isItemEqual(stack);
|
||||
}
|
||||
});
|
||||
Incubator.RECIPES.add(new IncubatorRecipe(GeneticLiquid.Bacteria.get(10), GeneticLiquid.BacteriaPoly.get(10), 0.1f) {
|
||||
@Override
|
||||
public boolean isItemStack(ItemStack stack) {
|
||||
return new ItemStack(Items.dye, 1, 15).isItemEqual(stack);
|
||||
}
|
||||
});
|
||||
Incubator.RECIPES.add(new IncubatorRecipe(GeneticLiquid.Bacteria.get(10), GeneticLiquid.BacteriaVector.get(10), 0.05f) {
|
||||
@Override
|
||||
public boolean isItemStack(ItemStack stack) {
|
||||
return new ItemStack(Items.blaze_powder).isItemEqual(stack);
|
||||
}
|
||||
});
|
||||
|
||||
if (BinnieCore.isApicultureActive()) {
|
||||
Incubator.RECIPES.add(new IncubatorRecipe(GeneticLiquid.GrowthMedium.get(50), null, 1.0f, 0.05f) {
|
||||
@Override
|
||||
public boolean isItemStack(ItemStack stack) {
|
||||
return Binnie.Genetics.getBeeRoot().isMember(stack) && Binnie.Genetics.getBeeRoot().getType(stack) == EnumBeeType.LARVAE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getOutputStack(MachineUtil machine) {
|
||||
ItemStack larvae = machine.getStack(3);
|
||||
IBee bee = Binnie.Genetics.getBeeRoot().getMember(larvae);
|
||||
return Binnie.Genetics.getBeeRoot().getMemberStack(bee, EnumBeeType.DRONE.ordinal());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public static class PackageIncubator extends GeneticMachine.PackageGeneticBase implements IMachineInformation {
|
||||
public PackageIncubator() {
|
||||
super("incubator", GeneticsTexture.Incubator, 16767313, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createMachine(Machine machine) {
|
||||
new ComponentGeneticGUI(machine, GeneticsGUI.Incubator);
|
||||
ComponentInventorySlots inventory = new ComponentInventorySlots(machine);
|
||||
inventory.addSlotArray(Incubator.slotQueue, "input");
|
||||
for (InventorySlot slot : inventory.getSlots(Incubator.slotQueue)) {
|
||||
slot.forbidExtraction();
|
||||
}
|
||||
inventory.addSlot(3, "incubator");
|
||||
inventory.getSlot(3).forbidInteraction();
|
||||
inventory.getSlot(3).setReadOnly();
|
||||
inventory.addSlotArray(Incubator.slotOutput, "output");
|
||||
for (InventorySlot slot : inventory.getSlots(Incubator.slotOutput)) {
|
||||
slot.forbidInsertion();
|
||||
slot.setReadOnly();
|
||||
}
|
||||
new ComponentPowerReceptor(machine, 2000);
|
||||
ComponentTankContainer tanks = new ComponentTankContainer(machine);
|
||||
tanks.addTank(0, "input", 2000).forbidExtraction();
|
||||
tanks.addTank(1, "output", 2000).setReadOnly();
|
||||
new ComponentIncubatorLogic(machine);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createTileEntity() {
|
||||
return new TileEntityMachine(this);
|
||||
}
|
||||
}
|
||||
|
||||
public static class ComponentIncubatorLogic extends ComponentProcessIndefinate implements IProcess {
|
||||
IIncubatorRecipe recipe;
|
||||
private Random rand;
|
||||
private boolean roomForOutput;
|
||||
|
||||
public ComponentIncubatorLogic(Machine machine) {
|
||||
super(machine, 2.0f);
|
||||
recipe = null;
|
||||
rand = new Random();
|
||||
roomForOutput = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ErrorState canWork() {
|
||||
if (recipe == null) {
|
||||
return new ErrorState("No Recipe", "There is no valid recipe");
|
||||
}
|
||||
return super.canWork();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ErrorState canProgress() {
|
||||
if (recipe != null) {
|
||||
if (!recipe.isInputLiquidSufficient(getUtil().getFluid(0))) {
|
||||
return new ErrorState.InsufficientLiquid("Not enough incubation liquid", 0);
|
||||
}
|
||||
if (!roomForOutput) {
|
||||
return new ErrorState.TankSpace("No room for output", 1);
|
||||
}
|
||||
}
|
||||
return super.canProgress();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onTickTask() {
|
||||
if (rand.nextInt(20) == 0 && recipe != null && rand.nextFloat() < recipe.getChance()) {
|
||||
recipe.doTask(getUtil());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean inProgress() {
|
||||
return recipe != null;
|
||||
}
|
||||
|
||||
private IIncubatorRecipe getRecipe(ItemStack stack, FluidStack liquid) {
|
||||
for (IIncubatorRecipe recipe : Incubator.RECIPES) {
|
||||
boolean rightLiquid = recipe.isInputLiquid(liquid);
|
||||
boolean rightItem = recipe.isItemStack(stack);
|
||||
if (rightLiquid && rightItem) {
|
||||
return recipe;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInventoryUpdate() {
|
||||
super.onInventoryUpdate();
|
||||
if (!getUtil().isServer()) {
|
||||
return;
|
||||
}
|
||||
|
||||
FluidStack liquid = getUtil().getFluid(0);
|
||||
ItemStack incubator = getUtil().getStack(3);
|
||||
if (recipe != null && (incubator == null || liquid == null || !recipe.isInputLiquid(liquid) || !recipe.isItemStack(incubator))) {
|
||||
recipe = null;
|
||||
ItemStack leftover = new TransferRequest(incubator, getInventory()).setTargetSlots(Incubator.slotOutput).ignoreValidation().transfer(true);
|
||||
getUtil().setStack(3, leftover);
|
||||
}
|
||||
|
||||
if (recipe == null) {
|
||||
if (liquid == null) {
|
||||
return;
|
||||
}
|
||||
if (incubator != null) {
|
||||
IIncubatorRecipe recipe = getRecipe(incubator, liquid);
|
||||
if (recipe != null) {
|
||||
this.recipe = recipe;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
IIncubatorRecipe potential = null;
|
||||
int potentialSlot = 0;
|
||||
for (int slot : Incubator.slotQueue) {
|
||||
ItemStack stack = getUtil().getStack(slot);
|
||||
if (stack != null) {
|
||||
if (potential == null) {
|
||||
for (IIncubatorRecipe recipe2 : Incubator.RECIPES) {
|
||||
boolean rightLiquid = recipe2.isInputLiquid(liquid);
|
||||
boolean rightItem = recipe2.isItemStack(stack);
|
||||
if (rightLiquid && rightItem) {
|
||||
potential = recipe2;
|
||||
potentialSlot = slot;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (potential != null) {
|
||||
TransferRequest removal = new TransferRequest(incubator, getInventory()).setTargetSlots(Incubator.slotOutput).ignoreValidation();
|
||||
if (removal.transfer(false) == null) {
|
||||
recipe = potential;
|
||||
}
|
||||
removal.transfer(true);
|
||||
ItemStack stack2 = getUtil().getStack(potentialSlot);
|
||||
getUtil().setStack(potentialSlot, null);
|
||||
getUtil().setStack(3, stack2);
|
||||
}
|
||||
}
|
||||
|
||||
if (recipe != null) {
|
||||
roomForOutput = recipe.roomForOutput(getUtil());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private abstract static class IncubatorRecipe implements IIncubatorRecipe {
|
||||
protected FluidStack input;
|
||||
protected FluidStack output;
|
||||
protected float lossChance;
|
||||
protected ItemStack outputStack;
|
||||
protected float tickChance;
|
||||
|
||||
public IncubatorRecipe(FluidStack input, FluidStack output, float lossChance) {
|
||||
this(input, output, lossChance, 1.0f);
|
||||
}
|
||||
|
||||
public IncubatorRecipe(FluidStack input, FluidStack output, float lossChance, float chance) {
|
||||
this.input = input;
|
||||
this.output = output;
|
||||
this.lossChance = lossChance;
|
||||
tickChance = chance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getChance() {
|
||||
return tickChance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInputLiquid(FluidStack liquid) {
|
||||
return liquid != null && input.isFluidEqual(liquid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInputLiquidSufficient(FluidStack liquid) {
|
||||
return liquid != null && liquid.amount >= 500;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doTask(MachineUtil machine) {
|
||||
machine.drainTank(0, input.amount);
|
||||
if (output != null) {
|
||||
machine.fillTank(1, output);
|
||||
}
|
||||
|
||||
outputStack = getOutputStack(machine);
|
||||
if (outputStack != null) {
|
||||
ItemStack output = outputStack.copy();
|
||||
TransferRequest product = new TransferRequest(output, machine.getInventory()).setTargetSlots(Incubator.slotOutput).ignoreValidation();
|
||||
product.transfer(true);
|
||||
}
|
||||
|
||||
Random rand = machine.getRandom();
|
||||
if (rand.nextFloat() < lossChance) {
|
||||
machine.decreaseStack(3, 1);
|
||||
}
|
||||
}
|
||||
|
||||
public IncubatorRecipe setOutputStack(ItemStack stack) {
|
||||
outputStack = stack;
|
||||
return this;
|
||||
}
|
||||
|
||||
protected ItemStack getOutputStack(MachineUtil util) {
|
||||
return outputStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean roomForOutput(MachineUtil machine) {
|
||||
if (output != null && !machine.isTankEmpty(1)) {
|
||||
if (!machine.getFluid(1).isFluidEqual(output)) {
|
||||
return false;
|
||||
}
|
||||
if (!machine.spaceInTank(1, output.amount)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
ItemStack outputStack = getOutputStack(machine);
|
||||
if (outputStack != null) {
|
||||
ItemStack output = outputStack.copy();
|
||||
TransferRequest product = new TransferRequest(output, machine.getInventory()).setTargetSlots(Incubator.slotOutput).ignoreValidation();
|
||||
ItemStack leftover = product.transfer(false);
|
||||
return leftover == null;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,276 +0,0 @@
|
||||
package binnie.genetics.machine;
|
||||
|
||||
import binnie.core.BinnieCore;
|
||||
import binnie.core.craftgui.minecraft.IMachineInformation;
|
||||
import binnie.core.genetics.Gene;
|
||||
import binnie.core.machines.IMachine;
|
||||
import binnie.core.machines.Machine;
|
||||
import binnie.core.machines.MachineComponent;
|
||||
import binnie.core.machines.TileEntityMachine;
|
||||
import binnie.core.machines.component.IRender;
|
||||
import binnie.core.machines.inventory.ComponentChargedSlots;
|
||||
import binnie.core.machines.inventory.ComponentInventorySlots;
|
||||
import binnie.core.machines.inventory.ComponentInventoryTransfer;
|
||||
import binnie.core.machines.inventory.ComponentTankContainer;
|
||||
import binnie.core.machines.inventory.IChargedSlots;
|
||||
import binnie.core.machines.inventory.InventorySlot;
|
||||
import binnie.core.machines.inventory.SlotValidator;
|
||||
import binnie.core.machines.inventory.TankValidator;
|
||||
import binnie.core.machines.power.ComponentPowerReceptor;
|
||||
import binnie.core.machines.power.ComponentProcessSetCost;
|
||||
import binnie.core.machines.power.ErrorState;
|
||||
import binnie.core.machines.power.IProcess;
|
||||
import binnie.genetics.core.GeneticsGUI;
|
||||
import binnie.genetics.core.GeneticsTexture;
|
||||
import binnie.genetics.item.GeneticsItems;
|
||||
import binnie.genetics.item.ItemSequence;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IChromosomeType;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import net.minecraft.client.particle.EntityFX;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class Isolator {
|
||||
public static int slotEnzyme = 0;
|
||||
public static int slotSequencerVial = 1;
|
||||
public static int[] slotReserve = new int[]{2, 3, 4};
|
||||
public static int[] slotFinished = new int[]{7, 8, 9, 10, 11, 12};
|
||||
public static int slotTarget = 5;
|
||||
public static int slotResult = 6;
|
||||
public static int tankEthanol = 0;
|
||||
|
||||
public static class PackageIsolator extends GeneticMachine.PackageGeneticBase implements IMachineInformation {
|
||||
public PackageIsolator() {
|
||||
super("isolator", GeneticsTexture.Isolator, 16740111, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createMachine(Machine machine) {
|
||||
new ComponentGeneticGUI(machine, GeneticsGUI.Isolator);
|
||||
ComponentInventorySlots inventory = new ComponentInventorySlots(machine);
|
||||
inventory.addSlot(0, "enzyme");
|
||||
inventory.getSlot(0).setValidator(new SlotValidator.Item(GeneticsItems.Enzyme.get(1), ModuleMachine.IconEnzyme));
|
||||
inventory.getSlot(0).forbidExtraction();
|
||||
inventory.addSlot(1, "sequencervial");
|
||||
inventory.getSlot(1).setValidator(new SlotValidator.Item(GeneticsItems.EmptySequencer.get(1), ModuleMachine.IconSequencer));
|
||||
inventory.getSlot(1).forbidExtraction();
|
||||
inventory.addSlotArray(Isolator.slotReserve, "input");
|
||||
for (InventorySlot slot : inventory.getSlots(Isolator.slotReserve)) {
|
||||
slot.setValidator(new SlotValidator.Individual());
|
||||
slot.forbidExtraction();
|
||||
}
|
||||
|
||||
inventory.addSlot(5, "process");
|
||||
inventory.getSlot(5).setValidator(new SlotValidator.Individual());
|
||||
inventory.getSlot(5).setReadOnly();
|
||||
inventory.getSlot(5).forbidInteraction();
|
||||
|
||||
inventory.addSlot(6, "output");
|
||||
inventory.getSlot(6).setReadOnly();
|
||||
inventory.getSlot(6).forbidInteraction();
|
||||
inventory.addSlotArray(Isolator.slotFinished, "output");
|
||||
for (InventorySlot slot : inventory.getSlots(Isolator.slotFinished)) {
|
||||
slot.setReadOnly();
|
||||
slot.forbidInsertion();
|
||||
}
|
||||
|
||||
ComponentTankContainer tanks = new ComponentTankContainer(machine);
|
||||
tanks.addTank(0, "input", 1000);
|
||||
tanks.getTankSlot(0).setValidator(new TankValidator() {
|
||||
@Override
|
||||
public String getTooltip() {
|
||||
return "Ethanol";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid(FluidStack liquid) {
|
||||
return liquid.getFluid().getName() == "bioethanol";
|
||||
}
|
||||
});
|
||||
|
||||
ComponentChargedSlots chargedSlots = new ComponentChargedSlots(machine);
|
||||
chargedSlots.addCharge(0);
|
||||
ComponentInventoryTransfer transfer = new ComponentInventoryTransfer(machine);
|
||||
transfer.addRestock(Isolator.slotReserve, 5, 1);
|
||||
transfer.addStorage(6, Isolator.slotFinished);
|
||||
new ComponentPowerReceptor(machine, 20000);
|
||||
new ComponentIsolatorLogic(machine);
|
||||
new ComponentIsolaterFX(machine);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createTileEntity() {
|
||||
return new TileEntityMachine(this);
|
||||
}
|
||||
}
|
||||
|
||||
public static class ComponentIsolatorLogic extends ComponentProcessSetCost implements IProcess {
|
||||
protected float enzymePerProcess;
|
||||
protected float ethanolPerProcess;
|
||||
|
||||
public ComponentIsolatorLogic(Machine machine) {
|
||||
super(machine, 192000, 4800);
|
||||
enzymePerProcess = 0.5f;
|
||||
ethanolPerProcess = 10.0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ErrorState canWork() {
|
||||
if (getUtil().isSlotEmpty(5)) {
|
||||
return new ErrorState.NoItem("No individual to isolate", 5);
|
||||
}
|
||||
if (!getUtil().isSlotEmpty(6)) {
|
||||
return new ErrorState.NoSpace("No room for DNA sequences", Isolator.slotFinished);
|
||||
}
|
||||
if (getUtil().isSlotEmpty(1)) {
|
||||
return new ErrorState.NoItem("No empty sequencer vials", 1);
|
||||
}
|
||||
return super.canWork();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ErrorState canProgress() {
|
||||
if (!getUtil().liquidInTank(0, (int) ethanolPerProcess)) {
|
||||
return new ErrorState.InsufficientLiquid("Insufficient ethanol", 0);
|
||||
}
|
||||
if (getUtil().getSlotCharge(0) == 0.0f) {
|
||||
return new ErrorState.NoItem("No enzyme", 0);
|
||||
}
|
||||
return super.canProgress();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onFinishTask() {
|
||||
super.onFinishTask();
|
||||
Random rand = getMachine().getWorld().rand;
|
||||
ISpeciesRoot root = AlleleManager.alleleRegistry.getSpeciesRoot(getUtil().getStack(5));
|
||||
if (root == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
IIndividual individual = root.getMember(getUtil().getStack(5));
|
||||
if (individual == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
IAllele allele;
|
||||
IChromosomeType chromosome;
|
||||
Gene gene = null;
|
||||
if (getMachine().getWorld().rand.nextFloat() < 2.0f) {
|
||||
while (gene == null) {
|
||||
try {
|
||||
chromosome = root.getKaryotype()[rand.nextInt(root.getKaryotype().length)];
|
||||
allele = rand.nextBoolean() ?
|
||||
individual.getGenome().getActiveAllele(chromosome) :
|
||||
individual.getGenome().getInactiveAllele(chromosome);
|
||||
gene = Gene.create(allele, chromosome, root);
|
||||
} catch (Exception e) {
|
||||
// ignored
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ItemStack serum = ItemSequence.create(gene);
|
||||
getUtil().setStack(6, serum);
|
||||
getUtil().decreaseStack(1, 1);
|
||||
if (rand.nextFloat() < 0.05f) {
|
||||
getUtil().decreaseStack(5, 1);
|
||||
}
|
||||
getUtil().drainTank(0, (int) ethanolPerProcess);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onTickTask() {
|
||||
getMachine().getInterface(IChargedSlots.class).alterCharge(0, -enzymePerProcess * getProgressPerTick() / 100.0f);
|
||||
}
|
||||
}
|
||||
|
||||
public static class ComponentIsolaterFX extends MachineComponent implements IRender.RandomDisplayTick, IRender.DisplayTick {
|
||||
public ComponentIsolaterFX(IMachine machine) {
|
||||
super(machine);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void onRandomDisplayTick(World world, int x, int y, int z, Random rand) {
|
||||
if (!getUtil().getProcess().isInProgress()) {
|
||||
return;
|
||||
}
|
||||
BinnieCore.proxy.getMinecraftInstance().effectRenderer.addEffect(new EntityFX(world, x + 0.4 + 0.2 * rand.nextDouble(), y + 1.6, z + 0.4 + rand.nextDouble() * 0.2, 0.0, 0.0, 0.0) {
|
||||
double axisX = 0.0;
|
||||
double axisZ = 0.0;
|
||||
double angle = 0.0;
|
||||
|
||||
{
|
||||
motionX = 0.0;
|
||||
motionZ = 0.0;
|
||||
motionY = -0.012;
|
||||
particleMaxAge = 100;
|
||||
particleGravity = 0.0f;
|
||||
noClip = true;
|
||||
setRBGColorF(0.8f, 0.4f, 0.0f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
angle += 0.06;
|
||||
setAlphaF((float) Math.sin(3.14 * particleAge / particleMaxAge));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFXLayer() {
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void onDisplayTick(World world, int x, int y, int z, Random rand) {
|
||||
int tick = (int) (world.getTotalWorldTime() % 6L);
|
||||
if ((tick == 0 || tick == 5) && getUtil().getProcess().isInProgress()) {
|
||||
BinnieCore.proxy.getMinecraftInstance().effectRenderer.addEffect(new EntityFX(world, x + 0.5, y + 1, z + 0.5, 0.0, 0.0, 0.0) {
|
||||
double axisX = posX;
|
||||
double axisZ = posZ;
|
||||
double angle = 0.7 + (int) (worldObj.getTotalWorldTime() % 2L) * 3.1415;
|
||||
|
||||
{
|
||||
axisX = 0.0;
|
||||
axisZ = 0.0;
|
||||
angle = 0.0;
|
||||
motionX = 0.0;
|
||||
motionZ = 0.0;
|
||||
motionY = 0.012;
|
||||
particleMaxAge = 100;
|
||||
particleGravity = 0.0f;
|
||||
noClip = true;
|
||||
setRBGColorF(0.8f, 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
angle += 0.06;
|
||||
setPosition(axisX + 0.26 * Math.sin(angle), posY, axisZ + 0.26 * Math.cos(angle));
|
||||
setAlphaF((float) Math.cos(1.57 * particleAge / particleMaxAge));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFXLayer() {
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,40 +1,23 @@
|
||||
package binnie.genetics.machine;
|
||||
|
||||
import binnie.botany.Botany;
|
||||
import binnie.core.BinnieCore;
|
||||
import binnie.core.machines.IMachine;
|
||||
import binnie.core.machines.IMachineType;
|
||||
import binnie.core.machines.Machine;
|
||||
import binnie.core.machines.MachineComponent;
|
||||
import binnie.core.machines.MachinePackage;
|
||||
import binnie.core.machines.component.IInteraction;
|
||||
import binnie.core.machines.network.INetwork;
|
||||
import binnie.extrabees.ExtraBees;
|
||||
import binnie.extratrees.ExtraTrees;
|
||||
import binnie.genetics.Genetics;
|
||||
import binnie.genetics.core.GeneticsTexture;
|
||||
import buildcraft.api.tools.IToolWrench;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import binnie.genetics.machine.acclimatiser.AcclimatiserPackage;
|
||||
import binnie.genetics.machine.analyser.AnalyserPackage;
|
||||
import binnie.genetics.machine.genepool.GenepoolPackage;
|
||||
import binnie.genetics.machine.incubator.IncubatorPackage;
|
||||
import binnie.genetics.machine.lab.LabMachinePackage;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public enum LaboratoryMachine implements IMachineType {
|
||||
LabMachine(PackageLabMachine.class),
|
||||
Analyser(Analyser.PackageAnalyser.class),
|
||||
Incubator(Incubator.PackageIncubator.class),
|
||||
Genepool(Genepool.PackageGenepool.class),
|
||||
Acclimatiser(Acclimatiser.PackageAcclimatiser.class);
|
||||
LabMachine(LabMachinePackage.class),
|
||||
Analyser(AnalyserPackage.class),
|
||||
Incubator(IncubatorPackage.class),
|
||||
Genepool(GenepoolPackage.class),
|
||||
Acclimatiser(AcclimatiserPackage.class);
|
||||
|
||||
Class<? extends MachinePackage> clss;
|
||||
private Class<? extends MachinePackage> clss;
|
||||
|
||||
LaboratoryMachine(Class<? extends MachinePackage> clss) {
|
||||
this.clss = clss;
|
||||
@@ -53,145 +36,4 @@ public enum LaboratoryMachine implements IMachineType {
|
||||
public ItemStack get(int i) {
|
||||
return new ItemStack(Genetics.packageLabMachine.getBlock(), i, ordinal());
|
||||
}
|
||||
|
||||
public static class PackageLabMachine extends GeneticMachine.PackageGeneticBase {
|
||||
public PackageLabMachine() {
|
||||
super("labMachine", GeneticsTexture.LabMachine, 16777215, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createMachine(Machine machine) {
|
||||
new ComponentGUIHolder(machine);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderMachine(Machine machine, double x, double y, double z, float partialTick, RenderBlocks renderer) {
|
||||
MachineRendererLab.instance.renderMachine(machine, colour, renderTexture, x, y, z, partialTick);
|
||||
}
|
||||
}
|
||||
|
||||
public static class ComponentGUIHolder extends MachineComponent implements INetwork.TilePacketSync, IInteraction.RightClick {
|
||||
private ItemStack stack;
|
||||
|
||||
public ComponentGUIHolder(IMachine machine) {
|
||||
super(machine);
|
||||
}
|
||||
|
||||
public ItemStack getStack() {
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbttagcompound) {
|
||||
super.readFromNBT(nbttagcompound);
|
||||
if (nbttagcompound == null) {
|
||||
return;
|
||||
}
|
||||
stack = ItemStack.loadItemStackFromNBT(nbttagcompound.getCompoundTag("Item"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbttagcompound) {
|
||||
super.writeToNBT(nbttagcompound);
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
if (stack != null) {
|
||||
stack.writeToNBT(nbt);
|
||||
}
|
||||
nbttagcompound.setTag("Item", nbt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void syncToNBT(NBTTagCompound nbt) {
|
||||
writeToNBT(nbt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void syncFromNBT(NBTTagCompound nbt) {
|
||||
readFromNBT(nbt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestruction() {
|
||||
super.onDestruction();
|
||||
if (stack == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
IMachine machine = getMachine();
|
||||
TileEntity tile = machine.getTileEntity();
|
||||
World world = machine.getWorld();
|
||||
Random rand = world.rand;
|
||||
float xOffset = rand.nextFloat() * 0.8f + 0.1f;
|
||||
float yOffset = rand.nextFloat() * 0.8f + 0.1f;
|
||||
float zOffset = rand.nextFloat() * 0.8f + 0.1f;
|
||||
if (stack.stackSize == 0) {
|
||||
stack.stackSize = 1;
|
||||
}
|
||||
|
||||
EntityItem entityitem = new EntityItem(world, tile.xCoord + xOffset, tile.yCoord + yOffset, tile.zCoord + zOffset, stack.copy());
|
||||
float accel = 0.05f;
|
||||
entityitem.motionX = (float) rand.nextGaussian() * accel;
|
||||
entityitem.motionY = (float) rand.nextGaussian() * accel + 0.2f;
|
||||
entityitem.motionZ = (float) rand.nextGaussian() * accel;
|
||||
world.spawnEntityInWorld(entityitem);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRightClick(World world, EntityPlayer player, int x, int y, int z) {
|
||||
if (BinnieCore.proxy.isSimulating(world) && player.getHeldItem() != null) {
|
||||
if (stack != null && player.getHeldItem().getItem() instanceof IToolWrench) {
|
||||
Random rand = world.rand;
|
||||
float f = 0.7f;
|
||||
double fOffset = (1.0f - f) * 0.5;
|
||||
double xOffset = rand.nextFloat() * f + fOffset;
|
||||
double yOffset = rand.nextFloat() * f + fOffset;
|
||||
double zOffset = rand.nextFloat() * f + fOffset;
|
||||
|
||||
EntityItem entityitem = new EntityItem(world, x + xOffset, y + yOffset, z + zOffset, stack);
|
||||
entityitem.delayBeforeCanPickup = 10;
|
||||
world.spawnEntityInWorld(entityitem);
|
||||
stack = null;
|
||||
((IToolWrench) player.getHeldItem().getItem()).wrenchUsed(player, x, y, z);
|
||||
getUtil().refreshBlock();
|
||||
return;
|
||||
}
|
||||
|
||||
List<Item> validSelections = new ArrayList<>();
|
||||
if (BinnieCore.isBotanyActive()) {
|
||||
validSelections.add(Botany.database);
|
||||
}
|
||||
if (BinnieCore.isExtraBeesActive()) {
|
||||
validSelections.add(ExtraBees.dictionary);
|
||||
}
|
||||
if (BinnieCore.isExtraTreesActive()) {
|
||||
validSelections.add(ExtraTrees.itemDictionary);
|
||||
}
|
||||
if (BinnieCore.isLepidopteryActive()) {
|
||||
validSelections.add(ExtraTrees.itemDictionaryLepi);
|
||||
}
|
||||
|
||||
validSelections.add(Genetics.database);
|
||||
validSelections.add(Genetics.analyst);
|
||||
validSelections.add(Genetics.registry);
|
||||
validSelections.add(Genetics.masterRegistry);
|
||||
validSelections.add(BinnieCore.genesis);
|
||||
|
||||
if (stack == null && validSelections.contains(player.getHeldItem().getItem())) {
|
||||
stack = player.getHeldItem().copy();
|
||||
ItemStack heldItem = player.getHeldItem();
|
||||
heldItem.stackSize--;
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
return;
|
||||
}
|
||||
|
||||
if (stack != null && player.getHeldItem().getItem() instanceof IToolWrench) {
|
||||
stack.getItem().onItemRightClick(stack, world, player);
|
||||
}
|
||||
}
|
||||
|
||||
if (stack != null) {
|
||||
stack.getItem().onItemRightClick(stack, world, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,13 +13,10 @@ import org.lwjgl.opengl.GL11;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class MachineRendererGenetics {
|
||||
public static MachineRendererGenetics instance;
|
||||
|
||||
static {
|
||||
MachineRendererGenetics.instance = new MachineRendererGenetics();
|
||||
}
|
||||
public static MachineRendererGenetics instance = new MachineRendererGenetics();
|
||||
|
||||
public RenderItem customRenderItem;
|
||||
|
||||
private ModelMachine model;
|
||||
|
||||
public MachineRendererGenetics() {
|
||||
@@ -40,15 +37,6 @@ public class MachineRendererGenetics {
|
||||
|
||||
public void renderMachine(Machine machine, int colour, BinnieResource texture, double x, double y, double z, float var8) {
|
||||
GL11.glPushMatrix();
|
||||
int i1 = 0;
|
||||
int ix = machine.getTileEntity().xCoord;
|
||||
int iy = machine.getTileEntity().yCoord;
|
||||
int iz = machine.getTileEntity().zCoord;
|
||||
if (machine.getTileEntity() != null) {
|
||||
i1 = ix * iy * iz + ix * iy - ix * iz + iy * iz - ix + iy - iz;
|
||||
}
|
||||
|
||||
float phase = (float) Math.max(0.0, Math.sin((System.currentTimeMillis() + i1) * 0.003));
|
||||
GL11.glTranslated(x + 0.5, y + 1.5, z + 0.5);
|
||||
GL11.glRotatef(180.0f, 0.0f, 0.0f, 1.0f);
|
||||
BinnieCore.proxy.bindTexture(texture);
|
||||
@@ -63,6 +51,7 @@ public class MachineRendererGenetics {
|
||||
render.renderInWorld(customRenderItem, x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@@ -43,15 +43,9 @@ public class MachineRendererLab {
|
||||
|
||||
public void renderMachine(Machine machine, int colour, BinnieResource texture, double x, double y, double z, float var8) {
|
||||
GL11.glPushMatrix();
|
||||
int i1 = 0;
|
||||
int ix = machine.getTileEntity().xCoord;
|
||||
int iy = machine.getTileEntity().yCoord;
|
||||
int iz = machine.getTileEntity().zCoord;
|
||||
if (machine.getTileEntity() != null) {
|
||||
i1 = ix * iy * iz + ix * iy - ix * iz + iy * iz - ix + iy - iz;
|
||||
}
|
||||
|
||||
float phase = (float) Math.max(0.0, Math.sin((System.currentTimeMillis() + i1) * 0.003));
|
||||
GL11.glTranslated(x + 0.5, y + 1.5, z + 0.5);
|
||||
GL11.glRotatef(180.0f, 0.0f, 0.0f, 1.0f);
|
||||
BinnieCore.proxy.bindTexture(texture);
|
||||
@@ -59,7 +53,7 @@ public class MachineRendererLab {
|
||||
model.render((float) x, (float) y, (float) z, 0.0625f, 0.0625f, 0.0625f);
|
||||
GL11.glPopMatrix();
|
||||
World world = machine.getWorld();
|
||||
LaboratoryMachine.ComponentGUIHolder holder = Machine.getInterface(LaboratoryMachine.ComponentGUIHolder.class, machine);
|
||||
ComponentGUIHolder holder = Machine.getInterface(ComponentGUIHolder.class, machine);
|
||||
|
||||
// TODO remove label
|
||||
Label_0591:
|
||||
@@ -91,6 +85,7 @@ public class MachineRendererLab {
|
||||
customRenderItem.doRender(dummyEntityItem, 0.0, 0.0, 0.0, 0.0f, 0.0f);
|
||||
GL11.glPopMatrix();
|
||||
int rot = 0;
|
||||
|
||||
for (EntityItem item : itemSides) {
|
||||
GL11.glPushMatrix();
|
||||
item.worldObj = world;
|
||||
|
||||
@@ -4,13 +4,13 @@ import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
|
||||
public class ModelMachine extends ModelBase {
|
||||
ModelRenderer base;
|
||||
ModelRenderer body;
|
||||
ModelRenderer arm1;
|
||||
ModelRenderer arm2;
|
||||
ModelRenderer arm3;
|
||||
ModelRenderer arm4;
|
||||
ModelRenderer top;
|
||||
private ModelRenderer base;
|
||||
private ModelRenderer body;
|
||||
private ModelRenderer arm1;
|
||||
private ModelRenderer arm2;
|
||||
private ModelRenderer arm3;
|
||||
private ModelRenderer arm4;
|
||||
private ModelRenderer top;
|
||||
|
||||
public ModelMachine() {
|
||||
textureWidth = 64;
|
||||
|
||||
@@ -8,6 +8,8 @@ import binnie.core.machines.inventory.ValidatorIcon;
|
||||
import binnie.genetics.CreativeTabGenetics;
|
||||
import binnie.genetics.Genetics;
|
||||
import binnie.genetics.item.GeneticsItems;
|
||||
import binnie.genetics.machine.acclimatiser.Acclimatiser;
|
||||
import binnie.genetics.machine.incubator.Incubator;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package binnie.genetics.machine;
|
||||
|
||||
import binnie.core.machines.Machine;
|
||||
import binnie.core.machines.MachinePackage;
|
||||
import binnie.core.machines.TileEntityMachine;
|
||||
import binnie.core.resource.BinnieResource;
|
||||
import binnie.core.resource.IBinnieTexture;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public abstract class PackageGeneticBase extends MachinePackage {
|
||||
protected BinnieResource renderTexture;
|
||||
protected int color;
|
||||
|
||||
protected PackageGeneticBase(String uid, IBinnieTexture renderTexture, int flashColor, boolean powered) {
|
||||
super(uid, powered);
|
||||
this.renderTexture = renderTexture.getTexture();
|
||||
color = flashColor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createTileEntity() {
|
||||
return new TileEntityMachine(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderMachine(Machine machine, double x, double y, double z, float partialTick, RenderBlocks renderer) {
|
||||
MachineRendererGenetics.instance.renderMachine(machine, color, renderTexture, x, y, z, partialTick);
|
||||
}
|
||||
}
|
||||
Loaded 100 of 157 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user