Improve/refactoring (#15)

* Improve the code

* Code improve in binnie.core.utils package

* Code improve in binnie.core.triggers package

* Code improve in binnie.core.resource package

* Code improve in binnie.core.proxy package

* Code improve readability in binnie.core package

* Add missed constructors

* Some improve code readabilty

* Expand import with *

* Revert "Expand import with *"

This reverts commit 3bb4a44f3b69a8559bd5753337e0f6793ad18dc4.

* Fix using fully qualified names in imports

* Fix missed unnessesary "this."

* Removed binnie.craftgui package
Optimised imports and removed unnessesary "this."

* Some refactoring code in binnie.core.craftgui package

* Merge from master1.7.10

* Improve code readability in binnie.core.craftgui.database package

* Improve code readability in binnie.core.craftgui.events package

* Improve code readability in binnie.core.craftgui.geometry package

* Improve code readability in binnie.core.craftgui.* package
This commit is contained in:
Alexander Kornilov authored and mezz committed 2017-04-26 15:09:09 -07:00
1 parent a3c2360ba6
commit f402cb155f
428 files changed
+9515 -10103

No files matched your search

@@ -5,17 +5,17 @@
package binnie.extratrees.core;
import net.minecraft.tileentity.TileEntity;
import binnie.craftgui.extratrees.dictionary.WindowSetSquare;
import binnie.craftgui.extratrees.dictionary.WindowLepidopteristDatabase;
import binnie.craftgui.extratrees.dictionary.WindowDistillery;
import binnie.craftgui.extratrees.dictionary.WindowBrewery;
import binnie.craftgui.extratrees.dictionary.WindowPress;
import binnie.craftgui.extratrees.kitchen.WindowBottleRack;
import binnie.craftgui.extratrees.dictionary.WindowLumbermill;
import binnie.craftgui.extratrees.dictionary.WindowWoodworker;
import binnie.craftgui.extratrees.dictionary.WindowArboristDatabase;
import binnie.extratrees.craftgui.dictionary.WindowSetSquare;
import binnie.extratrees.craftgui.dictionary.WindowLepidopteristDatabase;
import binnie.extratrees.craftgui.dictionary.WindowDistillery;
import binnie.extratrees.craftgui.dictionary.WindowBrewery;
import binnie.extratrees.craftgui.dictionary.WindowPress;
import binnie.extratrees.craftgui.kitchen.WindowBottleRack;
import binnie.extratrees.craftgui.dictionary.WindowLumbermill;
import binnie.extratrees.craftgui.dictionary.WindowWoodworker;
import binnie.extratrees.craftgui.dictionary.WindowArboristDatabase;
import net.minecraft.inventory.IInventory;
import binnie.craftgui.minecraft.Window;
import binnie.core.craftgui.minecraft.Window;
import cpw.mods.fml.relauncher.Side;
import net.minecraft.world.World;
import net.minecraft.entity.player.EntityPlayer;
@@ -0,0 +1,26 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.extratrees.craftgui.dictionary;
import binnie.core.craftgui.geometry.IPoint;
import binnie.core.craftgui.CraftGUI;
import binnie.core.craftgui.IWidget;
import net.minecraft.util.IIcon;
import binnie.core.craftgui.controls.core.Control;
public class ControlBlockIconDisplay extends Control
{
IIcon icon;
public ControlBlockIconDisplay(final IWidget parent, final float x, final float y, final IIcon icon) {
super(parent, x, y, 18.0f, 18.0f);
this.icon = icon;
}
@Override
public void onRenderBackground() {
CraftGUI.Render.iconBlock(IPoint.ZERO, this.icon);
}
}
@@ -0,0 +1,98 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.extratrees.craftgui.dictionary;
import binnie.core.craftgui.resource.minecraft.StandardTexture;
import binnie.extratrees.core.ExtraTreeTexture;
import net.minecraft.util.IIcon;
import net.minecraftforge.fluids.FluidStack;
import binnie.core.craftgui.WidgetAttribute;
import net.minecraft.item.ItemStack;
import binnie.core.util.ItemStackSet;
import org.lwjgl.opengl.GL11;
import binnie.core.craftgui.geometry.IArea;
import binnie.core.machines.Machine;
import binnie.core.craftgui.IWidget;
import binnie.core.craftgui.minecraft.Window;
import binnie.extratrees.machines.Brewery;
import binnie.core.craftgui.geometry.IPoint;
import binnie.core.craftgui.CraftGUI;
import binnie.core.craftgui.resource.Texture;
import binnie.core.craftgui.minecraft.control.ControlProgressBase;
public class ControlBreweryProgress extends ControlProgressBase
{
static Texture Brewery;
static Texture BreweryOverlay;
@Override
public void onRenderBackground() {
CraftGUI.Render.texture(ControlBreweryProgress.Brewery, new IPoint(0.0f, 0.0f));
final Brewery.ComponentBreweryLogic logic = Machine.getInterface(Brewery.ComponentBreweryLogic.class, Window.get(this).getInventory());
if (logic.currentCrafting == null) {
return;
}
if (logic.currentCrafting.currentInput == null) {
return;
}
final int fermentedHeight = (int) (32.0f * logic.getProgress() / 100.0f);
CraftGUI.Render.limitArea(new IArea(new IPoint(1.0f, 6.0f).add(this.getAbsolutePosition()), new IPoint(32.0f, 32 - fermentedHeight)));
GL11.glEnable(3089);
this.renderFluid(logic.currentCrafting.currentInput, new IPoint(1.0f, 6.0f));
this.renderFluid(logic.currentCrafting.currentInput, new IPoint(17.0f, 6.0f));
this.renderFluid(logic.currentCrafting.currentInput, new IPoint(1.0f, 22.0f));
this.renderFluid(logic.currentCrafting.currentInput, new IPoint(17.0f, 22.0f));
GL11.glDisable(3089);
CraftGUI.Render.limitArea(new IArea(new IPoint(1.0f, 38 - fermentedHeight).add(this.getAbsolutePosition()), new IPoint(32.0f, fermentedHeight)));
GL11.glEnable(3089);
this.renderFluid(binnie.extratrees.machines.Brewery.getOutput(logic.currentCrafting), new IPoint(1.0f, 6.0f));
this.renderFluid(binnie.extratrees.machines.Brewery.getOutput(logic.currentCrafting), new IPoint(17.0f, 6.0f));
this.renderFluid(binnie.extratrees.machines.Brewery.getOutput(logic.currentCrafting), new IPoint(1.0f, 22.0f));
this.renderFluid(binnie.extratrees.machines.Brewery.getOutput(logic.currentCrafting), new IPoint(17.0f, 22.0f));
GL11.glDisable(3089);
final ItemStackSet stacks = new ItemStackSet();
for (final ItemStack stack : logic.currentCrafting.inputs) {
stacks.add(stack);
}
stacks.add(logic.currentCrafting.ingr);
int x = 1;
int y = 6;
for (final ItemStack stack : stacks) {
CraftGUI.Render.item(new IPoint(x, y), stack);
x += 16;
if (x > 18) {
x = 1;
y += 16;
}
}
}
@Override
public void onRenderForeground() {
}
protected ControlBreweryProgress(final IWidget parent, final float x, final float y) {
super(parent, x, y, 34.0f, 39.0f);
this.addAttribute(WidgetAttribute.MouseOver);
}
public void renderFluid(final FluidStack fluid, final IPoint pos) {
final int hex = fluid.getFluid().getColor(fluid);
final int r = (hex & 0xFF0000) >> 16;
final int g = (hex & 0xFF00) >> 8;
final int b = hex & 0xFF;
final IIcon icon = fluid.getFluid().getIcon();
GL11.glColor4f(r / 255.0f, g / 255.0f, b / 255.0f, 1.0f);
GL11.glEnable(3042);
GL11.glBlendFunc(770, 771);
CraftGUI.Render.iconBlock(pos, fluid.getFluid().getIcon());
GL11.glDisable(3042);
}
static {
ControlBreweryProgress.Brewery = new StandardTexture(0, 69, 34, 39, ExtraTreeTexture.Gui);
ControlBreweryProgress.BreweryOverlay = new StandardTexture(34, 69, 34, 39, ExtraTreeTexture.Gui);
}
}
@@ -0,0 +1,98 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.extratrees.craftgui.dictionary;
import binnie.core.craftgui.resource.minecraft.StandardTexture;
import binnie.extratrees.core.ExtraTreeTexture;
import net.minecraft.util.IIcon;
import org.lwjgl.opengl.GL11;
import net.minecraft.nbt.NBTTagCompound;
import binnie.core.craftgui.events.EventMouse;
import net.minecraftforge.fluids.FluidStack;
import binnie.core.machines.Machine;
import binnie.core.craftgui.IWidget;
import binnie.core.craftgui.minecraft.Window;
import binnie.extratrees.machines.Distillery;
import binnie.core.craftgui.geometry.Position;
import binnie.core.craftgui.geometry.IArea;
import binnie.core.craftgui.geometry.IPoint;
import binnie.core.craftgui.CraftGUI;
import binnie.core.craftgui.resource.Texture;
import binnie.core.craftgui.minecraft.control.ControlProgressBase;
public class ControlDistilleryProgress extends ControlProgressBase
{
static Texture DistilleryBase;
static Texture DistilleryOverlay;
static Texture LiquidFlow;
static Texture Output;
@Override
public void onRenderBackground() {
CraftGUI.Render.texture(ControlDistilleryProgress.DistilleryBase, new IPoint(0.0f, 0.0f));
CraftGUI.Render.texturePercentage(ControlDistilleryProgress.LiquidFlow, new IArea(18.0f, 0.0f, 38.0f, 66.0f), Position.Left, this.progress);
final Distillery.ComponentDistilleryLogic component = Machine.getInterface(Distillery.ComponentDistilleryLogic.class, Window.get(this).getInventory());
FluidStack stack = null;
if (component != null) {
stack = component.currentFluid;
}
if (stack != null) {
for (int y = 0; y < 4; ++y) {
this.renderFluid(stack, new IPoint(1.0f, 1 + y * 16));
}
}
}
@Override
public void onRenderForeground() {
final int level = Machine.getInterface(Distillery.ComponentDistilleryLogic.class, Window.get(this).getInventory()).level;
CraftGUI.Render.texture(ControlDistilleryProgress.Output, new IPoint(47.0f, 14 + level * 15));
CraftGUI.Render.texture(ControlDistilleryProgress.DistilleryOverlay, new IPoint(0.0f, 0.0f));
}
protected ControlDistilleryProgress(final IWidget parent, final float x, final float y) {
super(parent, x, y, 58.0f, 66.0f);
this.addSelfEventHandler(new EventMouse.Down.Handler() {
@Override
public void onEvent(final EventMouse.Down event) {
int distillationLevel = -1;
if (new IArea(45.0f, 8.0f, 19.0f, 11.0f).contains(ControlDistilleryProgress.this.getRelativeMousePosition())) {
distillationLevel = 0;
}
else if (new IArea(45.0f, 23.0f, 19.0f, 11.0f).contains(ControlDistilleryProgress.this.getRelativeMousePosition())) {
distillationLevel = 1;
}
else if (new IArea(45.0f, 38.0f, 19.0f, 11.0f).contains(ControlDistilleryProgress.this.getRelativeMousePosition())) {
distillationLevel = 2;
}
if (distillationLevel >= 0) {
final NBTTagCompound nbt = new NBTTagCompound();
nbt.setByte("i", (byte) distillationLevel);
Window.get(ControlDistilleryProgress.this.getWidget()).sendClientAction("still-level", nbt);
}
}
});
}
public void renderFluid(final FluidStack fluid, final IPoint pos) {
final int hex = fluid.getFluid().getColor(fluid);
final int r = (hex & 0xFF0000) >> 16;
final int g = (hex & 0xFF00) >> 8;
final int b = hex & 0xFF;
final IIcon icon = fluid.getFluid().getIcon();
GL11.glColor4f(r / 255.0f, g / 255.0f, b / 255.0f, 1.0f);
GL11.glEnable(3042);
GL11.glBlendFunc(770, 771);
CraftGUI.Render.iconBlock(pos, fluid.getFluid().getIcon());
GL11.glDisable(3042);
}
static {
ControlDistilleryProgress.DistilleryBase = new StandardTexture(43, 0, 58, 66, ExtraTreeTexture.Gui);
ControlDistilleryProgress.DistilleryOverlay = new StandardTexture(139, 0, 18, 66, ExtraTreeTexture.Gui);
ControlDistilleryProgress.LiquidFlow = new StandardTexture(101, 0, 38, 66, ExtraTreeTexture.Gui);
ControlDistilleryProgress.Output = new StandardTexture(68, 66, 17, 7, ExtraTreeTexture.Gui);
}
}
@@ -0,0 +1,78 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.extratrees.craftgui.dictionary;
import binnie.core.craftgui.resource.minecraft.StandardTexture;
import binnie.extratrees.core.ExtraTreeTexture;
import net.minecraft.nbt.NBTTagCompound;
import binnie.core.craftgui.events.EventMouse;
import binnie.core.craftgui.WidgetAttribute;
import net.minecraft.util.IIcon;
import net.minecraftforge.fluids.Fluid;
import net.minecraft.item.ItemStack;
import org.lwjgl.opengl.GL11;
import binnie.extratrees.machines.Press;
import binnie.core.craftgui.IWidget;
import binnie.core.craftgui.minecraft.Window;
import binnie.core.craftgui.geometry.IPoint;
import binnie.core.craftgui.CraftGUI;
import binnie.core.craftgui.resource.Texture;
import binnie.core.craftgui.minecraft.control.ControlProgressBase;
public class ControlFruitPressProgress extends ControlProgressBase
{
static Texture PressTexture;
static Texture PressSlot;
@Override
public void onRenderBackground() {
CraftGUI.Render.texture(ControlFruitPressProgress.PressSlot, new IPoint(3.0f, 52.0f));
final ItemStack input = Window.get(this).getContainer().getSlotFromInventory(Window.get(this).getInventory(), Press.slotCurrent).getStack();
if (input == null || Press.getOutput(input) == null) {
return;
}
final Fluid fluid = Press.getOutput(input).getFluid();
final int hex = fluid.getColor(Press.getOutput(input));
final int r = (hex & 0xFF0000) >> 16;
final int g = (hex & 0xFF00) >> 8;
final int b = hex & 0xFF;
IIcon icon = fluid.getIcon();
GL11.glColor4f(r / 255.0f, g / 255.0f, b / 255.0f, 1.0f);
GL11.glEnable(3042);
GL11.glBlendFunc(770, 771);
CraftGUI.Render.iconBlock(new IPoint(4.0f, 52.0f), fluid.getIcon());
GL11.glDisable(3042);
icon = input.getIconIndex();
CraftGUI.Render.iconItem(new IPoint(4.0f, 52.0f), icon);
}
@Override
public void onRenderForeground() {
CraftGUI.Render.texture(ControlFruitPressProgress.PressTexture, new IPoint(0.0f, 16.0f * this.progress));
}
protected ControlFruitPressProgress(final IWidget parent, final float x, final float y) {
super(parent, x, y, 37.0f, 69.0f);
this.addAttribute(WidgetAttribute.MouseOver);
this.addSelfEventHandler(new EventMouse.Down.Handler() {
@Override
public void onEvent(final EventMouse.Down event) {
if (event.getButton() == 0) {
final NBTTagCompound action = new NBTTagCompound();
Window.get(ControlFruitPressProgress.this.getWidget()).sendClientAction("fruitpress-click", action);
}
else if (event.getButton() == 1) {
final NBTTagCompound action = new NBTTagCompound();
Window.get(ControlFruitPressProgress.this.getWidget()).sendClientAction("clear-fruit", action);
}
}
});
}
static {
ControlFruitPressProgress.PressTexture = new StandardTexture(6, 0, 24, 52, ExtraTreeTexture.Gui);
ControlFruitPressProgress.PressSlot = new StandardTexture(9, 52, 34, 17, ExtraTreeTexture.Gui);
}
}
@@ -0,0 +1,96 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.extratrees.craftgui.dictionary;
import binnie.core.craftgui.resource.minecraft.StandardTexture;
import binnie.extratrees.core.ExtraTreeTexture;
import binnie.core.craftgui.minecraft.MinecraftGUI;
import binnie.core.craftgui.window.Panel;
import net.minecraft.util.IIcon;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import binnie.core.craftgui.geometry.IArea;
import net.minecraft.item.ItemBlock;
import binnie.extratrees.machines.Lumbermill;
import binnie.core.craftgui.IWidget;
import binnie.core.craftgui.minecraft.Window;
import binnie.core.craftgui.geometry.IPoint;
import binnie.core.craftgui.CraftGUI;
import org.lwjgl.opengl.GL11;
import binnie.core.craftgui.resource.Texture;
import binnie.core.craftgui.minecraft.control.ControlProgressBase;
public class ControlLumbermillProgress extends ControlProgressBase
{
float oldProgress;
float animation;
static Texture Saw;
static Texture Saw2;
@Override
public void onUpdateClient() {
super.onUpdateClient();
if (this.oldProgress != this.progress) {
this.oldProgress = this.progress;
this.animation += 5.0f;
}
}
@Override
public void onRenderForeground() {
GL11.glDisable(2896);
final int sawX = (int) (63.0f * this.progress);
CraftGUI.Render.texture(ControlLumbermillProgress.Saw, new IPoint(sawX, -8.0f + 6.0f * (float) Math.sin(this.animation)));
final ItemStack item = Window.get(this).getInventory().getStackInSlot(Lumbermill.slotWood);
if (item == null) {
return;
}
GL11.glDisable(2896);
Block block = null;
if (item.getItem() instanceof ItemBlock) {
block = ((ItemBlock) item.getItem()).field_150939_a;
}
if (block == null) {
return;
}
final IIcon icon = block.getIcon(2, item.getItemDamage());
for (int i = 0; i < 4; ++i) {
CraftGUI.Render.iconBlock(new IPoint(1 + i * 16, 1.0f), icon);
}
final ItemStack result = Lumbermill.getPlankProduct(item);
if (result == null) {
return;
}
Block block2 = null;
if (item.getItem() instanceof ItemBlock) {
block2 = ((ItemBlock) result.getItem()).field_150939_a;
}
if (block2 == null) {
return;
}
final IIcon icon2 = block2.getIcon(2, result.getItemDamage());
final IPoint size = this.getSize();
final IPoint pos = this.getAbsolutePosition();
CraftGUI.Render.limitArea(new IArea(pos.add(new IPoint(0.0f, 0.0f)), new IPoint(this.progress * 64.0f + 2.0f, 18.0f)));
GL11.glEnable(3089);
for (int j = 0; j < 4; ++j) {
CraftGUI.Render.iconBlock(new IPoint(1 + j * 16, 1.0f), icon2);
}
GL11.glDisable(3089);
CraftGUI.Render.texture(ControlLumbermillProgress.Saw2, new IPoint(sawX + 2, -8.0f + 6.0f * (float) Math.sin(this.animation)));
}
protected ControlLumbermillProgress(final IWidget parent, final float x, final float y) {
super(parent, x, y, 66.0f, 18.0f);
this.oldProgress = 0.0f;
this.animation = 0.0f;
new Panel(this, 0.0f, 0.0f, 66.0f, 18.0f, MinecraftGUI.PanelType.Black);
}
static {
ControlLumbermillProgress.Saw = new StandardTexture(0, 0, 6, 32, ExtraTreeTexture.Gui);
ControlLumbermillProgress.Saw2 = new StandardTexture(2, 0, 4, 32, ExtraTreeTexture.Gui);
}
}
@@ -0,0 +1,41 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.extratrees.craftgui.dictionary;
import binnie.core.machines.Machine;
import binnie.core.machines.component.IComponentRecipe;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import binnie.core.machines.TileEntityMachine;
import binnie.core.craftgui.minecraft.Window;
import net.minecraft.tileentity.TileEntity;
import binnie.core.craftgui.events.EventMouse;
import binnie.core.craftgui.IWidget;
import binnie.core.craftgui.minecraft.control.ControlSlotBase;
public class ControlRecipeSlot extends ControlSlotBase
{
public ControlRecipeSlot(final IWidget parent, final int x, final int y) {
super(parent, x, y, 50);
this.addSelfEventHandler(new EventMouse.Down.Handler() {
@Override
public void onEvent(final EventMouse.Down event) {
final TileEntity tile = (TileEntity) Window.get(ControlRecipeSlot.this.getWidget()).getInventory();
if (tile == null || !(tile instanceof TileEntityMachine)) {
return;
}
final NBTTagCompound nbt = new NBTTagCompound();
Window.get(ControlRecipeSlot.this.getWidget()).sendClientAction("recipe", nbt);
}
});
this.setRotating();
}
@Override
public ItemStack getItemStack() {
final IComponentRecipe recipe = Machine.getInterface(IComponentRecipe.class, Window.get(this).getInventory());
return recipe.isRecipe() ? recipe.getProduct() : null;
}
}
@@ -0,0 +1,182 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.extratrees.craftgui.dictionary;
import net.minecraft.item.ItemStack;
import binnie.core.craftgui.resource.minecraft.CraftGUITexture;
import binnie.core.craftgui.CraftGUI;
import binnie.core.BinnieCore;
import binnie.Binnie;
import binnie.core.craftgui.Tooltip;
import net.minecraft.nbt.NBTTagCompound;
import binnie.core.craftgui.events.EventMouse;
import binnie.core.craftgui.WidgetAttribute;
import binnie.core.craftgui.ITooltip;
import java.util.Map;
import binnie.core.craftgui.geometry.IPoint;
import binnie.core.craftgui.controls.ControlText;
import java.util.ArrayList;
import java.util.List;
import binnie.extratrees.api.IDesignCategory;
import java.util.HashMap;
import binnie.extratrees.machines.Designer;
import binnie.core.craftgui.minecraft.Window;
import binnie.core.machines.TileEntityMachine;
import binnie.extratrees.carpentry.EnumDesign;
import binnie.extratrees.api.CarpentryManager;
import binnie.core.craftgui.IWidget;
import binnie.core.craftgui.controls.scroll.IControlScrollable;
import binnie.extratrees.api.IDesign;
import binnie.core.craftgui.controls.core.IControlValue;
import binnie.core.craftgui.controls.core.Control;
public class ControlTileSelect extends Control implements IControlValue<IDesign>, IControlScrollable
{
IDesign value;
float shownHeight;
protected ControlTileSelect(final IWidget parent, final float x, final float y) {
super(parent, x, y, 102.0f, 20 * (CarpentryManager.carpentryInterface.getSortedDesigns().size() / 4) + 22);
this.value = EnumDesign.Blank;
this.shownHeight = 92.0f;
this.refresh("");
}
@Override
public float getPercentageIndex() {
return 0.0f;
}
@Override
public float getPercentageShown() {
return 0.0f;
}
@Override
public IDesign getValue() {
return this.value;
}
@Override
public void movePercentage(final float percentage) {
}
@Override
public void onUpdateClient() {
super.onUpdateClient();
final TileEntityMachine tile = (TileEntityMachine) Window.get(this).getInventory();
if (tile == null) {
return;
}
final Designer.ComponentWoodworkerRecipe recipe = tile.getMachine().getComponent(Designer.ComponentWoodworkerRecipe.class);
this.setValue(recipe.getDesign());
}
public void refresh(final String filterText) {
this.deleteAllChildren();
int cx = 2;
int cy = 2;
final Map<IDesignCategory, List<IDesign>> designs = new HashMap<IDesignCategory, List<IDesign>>();
for (final IDesignCategory category : CarpentryManager.carpentryInterface.getAllDesignCategories()) {
designs.put(category, new ArrayList<IDesign>());
for (final IDesign tile : category.getDesigns()) {
if (filterText == "" || tile.getName().toLowerCase().contains(filterText)) {
designs.get(category).add(tile);
}
}
if (designs.get(category).isEmpty()) {
designs.remove(category);
}
}
for (final IDesignCategory category : designs.keySet()) {
cx = 2;
new ControlText(this, new IPoint(cx, cy + 3), category.getName());
cy += 16;
for (final IDesign tile : designs.get(category)) {
if (cx > 90) {
cx = 2;
cy += 20;
}
new ControlTile(this, cx, cy, tile);
cx += 20;
}
cy += 20;
}
final int height = cy;
this.setSize(new IPoint(this.getSize().x(), height));
}
@Override
public void setPercentageIndex(final float index) {
}
@Override
public void setValue(final IDesign value) {
this.value = value;
}
@Override
public float getMovementRange() {
return 0.0f;
}
public static class ControlTile extends Control implements IControlValue<IDesign>, ITooltip
{
IDesign value;
protected ControlTile(final IWidget parent, final float x, final float y, final IDesign value) {
super(parent, x, y, 18.0f, 18.0f);
this.setValue(value);
this.addAttribute(WidgetAttribute.MouseOver);
this.addSelfEventHandler(new EventMouse.Down.Handler() {
@Override
public void onEvent(final EventMouse.Down event) {
final TileEntityMachine tile = (TileEntityMachine) Window.get(ControlTile.this.getWidget()).getInventory();
if (tile == null) {
return;
}
final Designer.ComponentWoodworkerRecipe recipe = tile.getMachine().getComponent(Designer.ComponentWoodworkerRecipe.class);
final NBTTagCompound nbt = new NBTTagCompound();
nbt.setShort("d", (short) CarpentryManager.carpentryInterface.getDesignIndex(ControlTile.this.getValue()));
Window.get(ControlTile.this.getWidget()).sendClientAction("design", nbt);
}
});
}
@Override
public void getTooltip(final Tooltip tooltip) {
tooltip.add(Binnie.Language.localise(BinnieCore.instance, "gui.designer.pattern", this.getValue().getName()));
}
@Override
public IDesign getValue() {
return this.value;
}
@Override
public void onRenderBackground() {
CraftGUI.Render.texture(CraftGUITexture.Slot, IPoint.ZERO);
}
@Override
public void onRenderForeground() {
final ItemStack image = ((WindowWoodworker) this.getSuperParent()).getDesignerType().getDisplayStack(this.getValue());
CraftGUI.Render.item(new IPoint(1.0f, 1.0f), image);
if (((IControlValue) this.getParent()).getValue() != this.getValue()) {
if (Window.get(this).getMousedOverWidget() == this) {
CraftGUI.Render.gradientRect(this.getArea().inset(1), 1157627903, 1157627903);
}
else {
CraftGUI.Render.gradientRect(this.getArea().inset(1), -1433892728, -1433892728);
}
}
}
@Override
public void setValue(final IDesign value) {
this.value = value;
}
}
}
@@ -0,0 +1,23 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.extratrees.craftgui.dictionary;
import binnie.core.craftgui.IWidget;
import binnie.core.craftgui.minecraft.Dialog;
public class DialogBreweryRecipe extends Dialog
{
public DialogBreweryRecipe(final IWidget parent, final float w, final float h) {
super(parent, w, h);
}
@Override
public void initialise() {
}
@Override
public void onClose() {
}
}
@@ -0,0 +1,39 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.extratrees.craftgui.dictionary;
import forestry.api.genetics.IAlleleSpecies;
import java.util.Collection;
import binnie.core.craftgui.database.ControlSpeciesBox;
import binnie.core.genetics.TreeBreedingSystem;
import binnie.core.craftgui.geometry.TextJustification;
import binnie.extratrees.ExtraTrees;
import binnie.core.craftgui.geometry.IArea;
import binnie.core.craftgui.controls.ControlText;
import binnie.core.craftgui.minecraft.Window;
import binnie.core.craftgui.database.WindowAbstractDatabase;
import binnie.core.craftgui.database.DatabaseTab;
import binnie.core.craftgui.IWidget;
import net.minecraft.item.ItemStack;
import binnie.core.craftgui.database.PageAbstract;
public class PageFruit extends PageAbstract<ItemStack>
{
boolean treesThatBearFruit;
public PageFruit(final IWidget parent, final DatabaseTab tab, final boolean treesThatBearFruit) {
super(parent, tab);
this.treesThatBearFruit = treesThatBearFruit;
}
@Override
public void onValueChanged(final ItemStack species) {
this.deleteAllChildren();
final WindowAbstractDatabase database = Window.get(this);
new ControlText(this, new IArea(0.0f, 0.0f, this.size().x(), 24.0f), ExtraTrees.proxy.localise("gui.database.tab.fruit." + (this.treesThatBearFruit ? "natural" : "potential")), TextJustification.MiddleCenter);
final Collection<IAlleleSpecies> trees = this.treesThatBearFruit ? ((TreeBreedingSystem) database.getBreedingSystem()).getTreesThatBearFruit(species, database.isNEI(), database.getWorld(), database.getUsername()) : ((TreeBreedingSystem) database.getBreedingSystem()).getTreesThatCanBearFruit(species, database.isNEI(), database.getWorld(), database.getUsername());
new ControlSpeciesBox(this, 4.0f, 24.0f, this.size().x() - 8.0f, this.size().y() - 4.0f - 24.0f).setOptions(trees);
}
}
@@ -0,0 +1,83 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.extratrees.craftgui.dictionary;
import binnie.extratrees.block.IPlankType;
import binnie.core.craftgui.geometry.IPoint;
import binnie.core.craftgui.CraftGUI;
import binnie.core.BinnieCore;
import binnie.core.craftgui.minecraft.control.ControlItemDisplay;
import binnie.extratrees.block.DoorType;
import binnie.extratrees.block.decor.FenceType;
import binnie.extratrees.block.WoodManager;
import binnie.extratrees.ExtraTrees;
import binnie.core.craftgui.geometry.TextJustification;
import binnie.core.craftgui.geometry.IArea;
import binnie.core.craftgui.controls.ControlText;
import binnie.core.craftgui.minecraft.Window;
import binnie.core.craftgui.database.WindowAbstractDatabase;
import binnie.core.craftgui.database.DatabaseTab;
import binnie.core.craftgui.IWidget;
import net.minecraft.item.ItemStack;
import binnie.core.craftgui.database.PageAbstract;
public class PagePlanksOverview extends PageAbstract<ItemStack>
{
public PagePlanksOverview(final IWidget parent, final DatabaseTab tab) {
super(parent, tab);
}
@Override
public void onValueChanged(final ItemStack species) {
this.deleteAllChildren();
final WindowAbstractDatabase database = Window.get(this);
new ControlText(this, new IArea(0.0f, 0.0f, this.size().x(), 24.0f), species.getDisplayName(), TextJustification.MiddleCenter);
new ControlText(this, new IArea(12.0f, 24.0f, this.size().x() - 24.0f, 24.0f), ExtraTrees.proxy.localise("gui.database.planks.use"), TextJustification.MiddleLeft);
final IPlankType type = WoodManager.get(species);
int x = 12;
if (type != null) {
final ItemStack fence = WoodManager.getFence(type, new FenceType(0), 1);
final ItemStack gate = WoodManager.getGate(type);
final ItemStack door = WoodManager.getDoor(type, DoorType.Standard);
if (fence != null) {
new ControlItemDisplay(this, x, 48.0f).setItemStack(fence);
x += 22;
}
if (gate != null) {
new ControlItemDisplay(this, x, 48.0f).setItemStack(gate);
x += 22;
}
if (door != null) {
new ControlItemDisplay(this, x, 48.0f).setItemStack(door);
x += 22;
}
}
final ControlText controlDescription = new ControlText(this, new IArea(8.0f, 84.0f, this.getSize().x() - 16.0f, 0.0f), "", TextJustification.MiddleCenter);
final ControlText controlSignature = new ControlText(this, new IArea(8.0f, 84.0f, this.getSize().x() - 16.0f, 0.0f), "", TextJustification.BottomRight);
String desc = "";
if (type != null) {
desc = type.getDescription();
}
String descBody = "§o";
String descSig = "";
if (desc == null || desc.length() == 0) {
descBody += BinnieCore.proxy.localise("gui.database.nodescription");
}
else {
final String[] descStrings = desc.split("\\|");
descBody += descStrings[0];
for (int i = 1; i < descStrings.length - 1; ++i) {
descBody = descBody + " " + descStrings[i];
}
if (descStrings.length > 1) {
descSig += descStrings[descStrings.length - 1];
}
}
controlDescription.setValue(descBody + "§r");
controlSignature.setValue(descSig + "§r");
final float descHeight = CraftGUI.Render.textHeight(controlDescription.getValue(), controlDescription.getSize().x());
controlSignature.setPosition(new IPoint(controlSignature.pos().x(), controlDescription.getPosition().y() + descHeight + 10.0f));
}
}
@@ -0,0 +1,35 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.extratrees.craftgui.dictionary;
import forestry.api.genetics.IAlleleSpecies;
import java.util.Collection;
import binnie.core.craftgui.database.ControlSpeciesBox;
import binnie.core.genetics.TreeBreedingSystem;
import binnie.core.craftgui.geometry.TextJustification;
import binnie.core.craftgui.geometry.IArea;
import binnie.core.craftgui.controls.ControlText;
import binnie.core.craftgui.minecraft.Window;
import binnie.core.craftgui.database.WindowAbstractDatabase;
import binnie.core.craftgui.database.DatabaseTab;
import binnie.core.craftgui.IWidget;
import net.minecraft.item.ItemStack;
import binnie.core.craftgui.database.PageAbstract;
public class PagePlanksTrees extends PageAbstract<ItemStack>
{
public PagePlanksTrees(final IWidget parent, final DatabaseTab tab) {
super(parent, tab);
}
@Override
public void onValueChanged(final ItemStack species) {
this.deleteAllChildren();
final WindowAbstractDatabase database = Window.get(this);
new ControlText(this, new IArea(0.0f, 0.0f, this.size().x(), 24.0f), species.getDisplayName(), TextJustification.MiddleCenter);
final Collection<IAlleleSpecies> trees = ((TreeBreedingSystem) database.getBreedingSystem()).getTreesThatMakePlanks(species, database.isNEI(), database.getWorld(), database.getUsername());
new ControlSpeciesBox(this, 4.0f, 24.0f, this.size().x() - 8.0f, this.size().y() - 4.0f - 24.0f).setOptions(trees);
}
}
@@ -0,0 +1,33 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.extratrees.craftgui.dictionary;
import binnie.core.craftgui.database.EnumDiscoveryState;
import forestry.api.genetics.IAlleleSpecies;
import binnie.core.craftgui.controls.ControlTextCentered;
import binnie.core.craftgui.minecraft.MinecraftGUI;
import binnie.core.craftgui.window.Panel;
import binnie.core.craftgui.database.DatabaseTab;
import binnie.core.craftgui.IWidget;
import binnie.core.craftgui.database.ControlDatabaseIndividualDisplay;
import binnie.core.craftgui.database.PageSpecies;
public class PageSpeciesImage extends PageSpecies
{
ControlDatabaseIndividualDisplay display;
public PageSpeciesImage(final IWidget parent, final DatabaseTab tab) {
super(parent, tab);
new Panel(this, 7.0f, 25.0f, 130.0f, 120.0f, MinecraftGUI.PanelType.Gray);
this.display = new ControlDatabaseIndividualDisplay(this, 12.0f, 25.0f, 120.0f);
this.display.hastooltip = false;
new ControlTextCentered(this, 8.0f, this.getValue().toString());
}
@Override
public void onValueChanged(final IAlleleSpecies species) {
this.display.setSpecies(species, EnumDiscoveryState.Show);
}
}
@@ -0,0 +1,161 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.extratrees.craftgui.dictionary;
import java.util.List;
import net.minecraft.util.IIcon;
import binnie.core.genetics.BreedingSystem;
import forestry.api.arboriculture.IAlleleTreeSpecies;
import forestry.api.arboriculture.ITreeGenome;
import forestry.api.arboriculture.ITree;
import forestry.api.genetics.IAllele;
import binnie.core.craftgui.geometry.IPoint;
import net.minecraft.item.ItemStack;
import java.util.ArrayList;
import binnie.core.craftgui.minecraft.control.ControlItemDisplay;
import binnie.extratrees.ExtraTrees;
import binnie.extratrees.FakeWorld;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.common.util.ForgeDirection;
import forestry.api.core.ForestryAPI;
import binnie.core.BinnieCore;
import forestry.api.arboriculture.EnumTreeChromosome;
import binnie.core.craftgui.controls.core.Control;
import binnie.core.craftgui.controls.scroll.ControlScrollableContent;
import binnie.core.craftgui.geometry.TextJustification;
import binnie.core.craftgui.geometry.IArea;
import binnie.core.craftgui.controls.ControlText;
import binnie.Binnie;
import forestry.api.genetics.IAlleleSpecies;
import binnie.core.craftgui.database.DatabaseTab;
import binnie.core.craftgui.IWidget;
import binnie.core.craftgui.database.PageSpecies;
public class PageSpeciesTreeGenome extends PageSpecies
{
public PageSpeciesTreeGenome(final IWidget parent, final DatabaseTab tab) {
super(parent, tab);
}
@Override
public void onValueChanged(final IAlleleSpecies species) {
this.deleteAllChildren();
final IAllele[] template = Binnie.Genetics.getTreeRoot().getTemplate(species.getUID());
if (template == null) {
return;
}
final ITree tree = Binnie.Genetics.getTreeRoot().templateAsIndividual(template);
if (tree == null) {
return;
}
ItemStack log = null;
try {
FakeWorld world = FakeWorld.instance;
tree.getGenome().getPrimary().getGenerator().setLogBlock(tree.getGenome(), world, 0, 0, 0, ForgeDirection.UP);// getGenome().getPrimary().getGenerator().getWorldGenerator(tree);
log = world.getWooLog();
} catch (Exception e) {
e.printStackTrace();
}
final ITreeGenome genome = tree.getGenome();
final IAlleleTreeSpecies treeSpecies = genome.getPrimary();
final int w = 144;
final int h = 176;
new ControlText(this, new IArea(0.0f, 4.0f, w, 16.0f), this.getValue().toString(), TextJustification.MiddleCenter);
final ControlScrollableContent scrollable = new ControlScrollableContent(this, 4.0f, 20.0f, w - 8, h - 8 - 16, 12.0f);
final Control contents = new Control(scrollable, 0.0f, 0.0f, w - 8 - 12, h - 8 - 16);
final int tw = w - 8 - 12;
final int w2 = 65;
final int w3 = tw - 50;
int y = 0;
final int th = 14;
final int th2 = 18;
final BreedingSystem syst = Binnie.Genetics.treeBreedingSystem;
new ControlText(contents, new IArea(0.0f, y, w2, th), syst.getChromosomeShortName(EnumTreeChromosome.PLANT) + " : ", TextJustification.MiddleRight);
new ControlText(contents, new IArea(w2, y, w3, th), treeSpecies.getPlantType().toString(), TextJustification.MiddleLeft);
y += th;
new ControlText(contents, new IArea(0.0f, y, w2, th), BinnieCore.proxy.localise("gui.temperature.short") + " : ", TextJustification.MiddleRight);
new ControlText(contents, new IArea(w2, y, w3, th), treeSpecies.getTemperature().getName(), TextJustification.MiddleLeft);
y += th;
final IIcon leaf = treeSpecies.getLeafIcon(false, false);
IIcon fruit = null;
int fruitColour = 16777215;
try {
fruit = ForestryAPI.textureManager.getIcon(genome.getFruitProvider().getIconIndex(genome, (IBlockAccess) null, 0, 0, 0, 100, false));
fruitColour = genome.getFruitProvider().getColour(genome, (IBlockAccess) null, 0, 0, 0, 100);
} catch (Exception ex) {
ex.printStackTrace();
}
if (leaf != null) {
new ControlText(contents, new IArea(0.0f, y, w2, th2), ExtraTrees.proxy.localise("gui.database.leaves") + " : ", TextJustification.MiddleRight);
new ControlBlockIconDisplay(contents, w2, y, leaf).setColor(treeSpecies.getLeafColour(false));
if (fruit != null && !treeSpecies.getUID().equals("forestry.treeOak")) {
new ControlBlockIconDisplay(contents, w2, y, fruit).setColor(fruitColour);
}
y += th2;
}
// final ItemStack log = (genome.getFruitProvider().getProducts().length
// > 0) ? genome.getFruitProvider().getProducts()[0] : null;
if (log != null) {
new ControlText(contents, new IArea(0.0f, y, w2, th2), ExtraTrees.proxy.localise("gui.database.log") + " : ", TextJustification.MiddleRight);
final ControlItemDisplay display = new ControlItemDisplay(contents, w2, y);
display.setItemStack(log);
display.setTooltip();
y += th2;
}
new ControlText(contents, new IArea(0.0f, y, w2, th), syst.getChromosomeShortName(EnumTreeChromosome.GROWTH) + " : ", TextJustification.MiddleRight);
new ControlText(contents, new IArea(w2, y, w3, th), genome.getGrowthProvider().getDescription(), TextJustification.MiddleLeft);
y += th;
new ControlText(contents, new IArea(0.0f, y, w2, th), syst.getChromosomeShortName(EnumTreeChromosome.HEIGHT) + " : ", TextJustification.MiddleRight);
new ControlText(contents, new IArea(w2, y, w3, th), genome.getHeight() + "x", TextJustification.MiddleLeft);
y += th;
new ControlText(contents, new IArea(0.0f, y, w2, th), syst.getChromosomeShortName(EnumTreeChromosome.FERTILITY) + " : ", TextJustification.MiddleRight);
new ControlText(contents, new IArea(w2, y, w3, th), genome.getFertility() + "x", TextJustification.MiddleLeft);
y += th;
final List<ItemStack> fruits = new ArrayList<ItemStack>();
for (final ItemStack stack : genome.getFruitProvider().getProducts()) {
fruits.add(stack);
}
if (!fruits.isEmpty()) {
new ControlText(contents, new IArea(0.0f, y, w2, th2), syst.getChromosomeShortName(EnumTreeChromosome.FRUITS) + " : ", TextJustification.MiddleRight);
for (final ItemStack fruitw : fruits) {
final ControlItemDisplay display2 = new ControlItemDisplay(contents, w2, y);
display2.setItemStack(fruitw);
display2.setTooltip();
y += th2;
}
}
new ControlText(contents, new IArea(0.0f, y, w2, th), syst.getChromosomeShortName(EnumTreeChromosome.YIELD) + " : ", TextJustification.MiddleRight);
new ControlText(contents, new IArea(w2, y, w3, th), genome.getYield() + "x", TextJustification.MiddleLeft);
y += th;
new ControlText(contents, new IArea(0.0f, y, w2, th), syst.getChromosomeShortName(EnumTreeChromosome.SAPPINESS) + " : ", TextJustification.MiddleRight);
new ControlText(contents, new IArea(w2, y, w3, th), genome.getSappiness() + "x", TextJustification.MiddleLeft);
y += th;
new ControlText(contents, new IArea(0.0f, y, w2, th), syst.getChromosomeShortName(EnumTreeChromosome.MATURATION) + " : ", TextJustification.MiddleRight);
new ControlText(contents, new IArea(w2, y, w3, th), genome.getMaturationTime() + "x", TextJustification.MiddleLeft);
y += th;
new ControlText(contents, new IArea(0.0f, y, w2, th), syst.getChromosomeShortName(EnumTreeChromosome.GIRTH) + " : ", TextJustification.MiddleRight);
new ControlText(contents, new IArea(w2, y, w3, th), genome.getGirth() + "x" + genome.getGirth(), TextJustification.MiddleLeft);
y += th;
contents.setSize(new IPoint(contents.size().x(), y));
scrollable.setScrollableContent(contents);
}
public static String tolerated(final boolean t) {
if (t) {
return BinnieCore.proxy.localise("gui.tolerated");
}
return BinnieCore.proxy.localise("gui.nottolerated");
}
}
@@ -0,0 +1,35 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.extratrees.craftgui.dictionary;
import forestry.api.genetics.IAlleleSpecies;
import java.util.Collection;
import binnie.core.craftgui.database.ControlSpeciesBox;
import binnie.core.genetics.TreeBreedingSystem;
import binnie.core.craftgui.geometry.TextJustification;
import binnie.core.craftgui.geometry.IArea;
import binnie.core.craftgui.controls.ControlText;
import binnie.core.craftgui.minecraft.Window;
import binnie.core.craftgui.database.WindowAbstractDatabase;
import binnie.core.craftgui.database.DatabaseTab;
import binnie.core.craftgui.IWidget;
import net.minecraft.item.ItemStack;
import binnie.core.craftgui.database.PageAbstract;
public class PageWood extends PageAbstract<ItemStack>
{
public PageWood(final IWidget parent, final DatabaseTab tab) {
super(parent, tab);
}
@Override
public void onValueChanged(final ItemStack species) {
this.deleteAllChildren();
final WindowAbstractDatabase database = Window.get(this);
new ControlText(this, new IArea(0.0f, 0.0f, this.size().x(), 24.0f), this.getValue().toString(), TextJustification.MiddleCenter);
final Collection<IAlleleSpecies> trees = ((TreeBreedingSystem) database.getBreedingSystem()).getTreesThatHaveWood(species, database.isNEI(), database.getWorld(), database.getUsername());
new ControlSpeciesBox(this, 4.0f, 24.0f, this.size().x() - 8.0f, this.size().y() - 4.0f - 24.0f).setOptions(trees);
}
}
@@ -0,0 +1,117 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.extratrees.craftgui.dictionary;
import binnie.core.craftgui.controls.scroll.ControlScrollableContent;
import binnie.core.genetics.TreeBreedingSystem;
import binnie.core.craftgui.database.ControlItemStackOption;
import binnie.core.craftgui.controls.listbox.ControlList;
import binnie.core.craftgui.geometry.IArea;
import binnie.core.craftgui.database.PageBreeder;
import binnie.core.craftgui.database.PageBranchSpecies;
import binnie.core.craftgui.database.PageBranchOverview;
import binnie.core.craftgui.database.PageSpeciesMutations;
import binnie.core.craftgui.database.PageSpeciesResultant;
import binnie.core.craftgui.database.PageSpeciesClassification;
import binnie.core.craftgui.IWidget;
import binnie.core.AbstractMod;
import binnie.core.craftgui.database.DatabaseTab;
import binnie.extratrees.ExtraTrees;
import binnie.core.craftgui.database.IDatabaseMode;
import binnie.core.craftgui.database.PageSpeciesOverview;
import binnie.core.craftgui.minecraft.Window;
import binnie.Binnie;
import cpw.mods.fml.relauncher.Side;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import binnie.core.craftgui.controls.listbox.ControlListBox;
import binnie.core.craftgui.database.WindowAbstractDatabase;
public class WindowArboristDatabase extends WindowAbstractDatabase
{
ControlListBox<ItemStack> selectionBoxFruit;
ControlListBox<ItemStack> selectionBoxWood;
ControlListBox<ItemStack> selectionBoxPlanks;
public WindowArboristDatabase(final EntityPlayer player, final Side side, final boolean nei) {
super(player, side, nei, Binnie.Genetics.treeBreedingSystem, 120.0f);
}
public static Window create(final EntityPlayer player, final Side side, final boolean nei) {
return new WindowArboristDatabase(player, side, nei);
}
@Override
protected void addTabs() {
new PageSpeciesOverview(this.getInfoPages(Mode.Species), new DatabaseTab(ExtraTrees.instance, "species.overview", 0));
new PageSpeciesTreeGenome(this.getInfoPages(Mode.Species), new DatabaseTab(ExtraTrees.instance, "species.genome", 0));
new PageSpeciesClassification(this.getInfoPages(Mode.Species), new DatabaseTab(ExtraTrees.instance, "species.classification", 0));
new PageSpeciesResultant(this.getInfoPages(Mode.Species), new DatabaseTab(ExtraTrees.instance, "species.resultant", 0));
new PageSpeciesMutations(this.getInfoPages(Mode.Species), new DatabaseTab(ExtraTrees.instance, "species.further", 0));
new PageBranchOverview(this.getInfoPages(Mode.Branches), new DatabaseTab(ExtraTrees.instance, "branches.overview", 0));
new PageBranchSpecies(this.getInfoPages(Mode.Branches), new DatabaseTab(ExtraTrees.instance, "branches.species", 0));
new PageBreeder(this.getInfoPages(Mode.Breeder), this.getUsername(), new DatabaseTab(ExtraTrees.instance, "breeder", 0));
this.createMode(TreeMode.Fruit, new ModeWidgets(TreeMode.Fruit, this) {
@Override
public void createListBox(final IArea area) {
(this.listBox = new ControlListBox<ItemStack>(this.modePage, area.x(), area.y(), area.w(), area.h(), 12.0f) {
@Override
public IWidget createOption(final ItemStack value, final int y) {
return new ControlItemStackOption(((ControlScrollableContent<ControlList<ItemStack>>) this).getContent(), value, y);
}
}).setOptions(((TreeBreedingSystem) WindowArboristDatabase.this.getBreedingSystem()).allFruits);
}
});
this.createMode(TreeMode.Wood, new ModeWidgets(TreeMode.Wood, this) {
@Override
public void createListBox(final IArea area) {
(this.listBox = new ControlListBox<ItemStack>(this.modePage, area.x(), area.y(), area.w(), area.h(), 12.0f) {
@Override
public IWidget createOption(final ItemStack value, final int y) {
return new ControlItemStackOption(((ControlScrollableContent<ControlList<ItemStack>>) this).getContent(), value, y);
}
}).setOptions(((TreeBreedingSystem) WindowArboristDatabase.this.getBreedingSystem()).allWoods);
}
});
this.createMode(TreeMode.Planks, new ModeWidgets(TreeMode.Planks, this) {
@Override
public void createListBox(final IArea area) {
this.listBox = new ControlListBox<ItemStack>(this.modePage, area.x(), area.y(), area.w(), area.h(), 12.0f) {
@Override
public IWidget createOption(final ItemStack value, final int y) {
return new ControlItemStackOption(((ControlScrollableContent<ControlList<ItemStack>>) this).getContent(), value, y);
}
};
}
});
new PageFruit(this.getInfoPages(TreeMode.Fruit), new DatabaseTab(ExtraTrees.instance, "fruit.natural", 0), true);
new PageFruit(this.getInfoPages(TreeMode.Fruit), new DatabaseTab(ExtraTrees.instance, "fruit.potential", 0), false);
new PageWood(this.getInfoPages(TreeMode.Wood), new DatabaseTab(ExtraTrees.instance, "wood.natural", 0));
new PagePlanksOverview(this.getInfoPages(TreeMode.Planks), new DatabaseTab(ExtraTrees.instance, "planks.overview", 0));
new PagePlanksTrees(this.getInfoPages(TreeMode.Planks), new DatabaseTab(ExtraTrees.instance, "planks.natural", 1));
}
@Override
protected AbstractMod getMod() {
return ExtraTrees.instance;
}
@Override
protected String getName() {
return "TreeDatabase";
}
enum TreeMode implements IDatabaseMode
{
Fruit,
Wood,
Planks;
@Override
public String getName() {
return ExtraTrees.proxy.localise("gui.database.mode." + this.name().toLowerCase());
}
}
}
@@ -0,0 +1,57 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.extratrees.craftgui.dictionary;
import binnie.core.craftgui.minecraft.control.ControlErrorState;
import binnie.core.craftgui.minecraft.control.ControlPlayerInventory;
import binnie.core.craftgui.geometry.Position;
import binnie.core.craftgui.minecraft.control.ControlEnergyBar;
import binnie.core.craftgui.minecraft.control.ControlLiquidTank;
import binnie.core.craftgui.minecraft.control.ControlSlot;
import binnie.extratrees.machines.Brewery;
import binnie.core.craftgui.minecraft.control.ControlSlotArray;
import binnie.core.machines.Machine;
import binnie.extratrees.ExtraTrees;
import binnie.core.AbstractMod;
import cpw.mods.fml.relauncher.Side;
import net.minecraft.inventory.IInventory;
import net.minecraft.entity.player.EntityPlayer;
import binnie.core.craftgui.minecraft.Window;
public class WindowBrewery extends Window
{
public WindowBrewery(final EntityPlayer player, final IInventory inventory, final Side side) {
super(228.0f, 218.0f, player, inventory, side);
}
@Override
protected AbstractMod getMod() {
return ExtraTrees.instance;
}
@Override
protected String getName() {
return "Brewery";
}
@Override
public void initialiseClient() {
this.setTitle(Machine.getMachine(this.getInventory()).getPackage().getDisplayName());
new ControlSlotArray(this, 42, 32, 1, 3).create(Brewery.slotRecipeGrains);
new ControlSlot(this, 16.0f, 41.0f).assign(Brewery.slotRecipeInput);
new ControlSlot(this, 105.0f, 77.0f).assign(Brewery.slotRecipeYeast);
new ControlLiquidTank(this, 76, 32).setTankID(Brewery.tankInput);
new ControlLiquidTank(this, 162, 32).setTankID(Brewery.tankOutput);
new ControlEnergyBar(this, 196, 32, 16, 60, Position.Bottom);
new ControlBreweryProgress(this, 110.0f, 32.0f);
new ControlSlotArray(this, (int) (this.getSize().x() / 2.0f - 81.0f), 104, 9, 1).create(Brewery.slotInventory);
new ControlPlayerInventory(this);
new ControlErrorState(this, 133.0f, 79.0f);
}
public static Window create(final EntityPlayer player, final IInventory inventory, final Side side) {
return new WindowBrewery(player, inventory, side);
}
}
@@ -0,0 +1,55 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.extratrees.craftgui.dictionary;
import binnie.core.craftgui.minecraft.control.ControlErrorState;
import binnie.core.craftgui.minecraft.control.ControlPlayerInventory;
import binnie.core.craftgui.geometry.Position;
import binnie.core.craftgui.minecraft.control.ControlEnergyBar;
import binnie.extratrees.machines.Distillery;
import binnie.core.craftgui.minecraft.control.ControlLiquidTank;
import binnie.core.machines.Machine;
import binnie.extratrees.ExtraTrees;
import binnie.core.AbstractMod;
import cpw.mods.fml.relauncher.Side;
import net.minecraft.inventory.IInventory;
import net.minecraft.entity.player.EntityPlayer;
import binnie.core.craftgui.minecraft.Window;
public class WindowDistillery extends Window
{
public WindowDistillery(final EntityPlayer player, final IInventory inventory, final Side side) {
super(224.0f, 192.0f, player, inventory, side);
}
@Override
protected AbstractMod getMod() {
return ExtraTrees.instance;
}
@Override
protected String getName() {
return "Distillery";
}
@Override
public void initialiseClient() {
this.setTitle(Machine.getMachine(this.getInventory()).getPackage().getDisplayName());
int x = 16;
new ControlLiquidTank(this, x, 35).setTankID(Distillery.tankInput);
x += 34;
new ControlDistilleryProgress(this, x, 32.0f);
x += 64;
new ControlLiquidTank(this, x, 35).setTankID(Distillery.tankOutput);
x += 34;
new ControlEnergyBar(this, x, 36, 60, 16, Position.Left);
new ControlPlayerInventory(this);
new ControlErrorState(this, x + 21, 62.0f);
}
public static Window create(final EntityPlayer player, final IInventory inventory, final Side side) {
return new WindowDistillery(player, inventory, side);
}
}
@@ -0,0 +1,54 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.extratrees.craftgui.dictionary;
import binnie.core.craftgui.database.PageBreeder;
import binnie.core.craftgui.database.PageBranchSpecies;
import binnie.core.craftgui.database.PageBranchOverview;
import binnie.core.craftgui.database.PageSpeciesMutations;
import binnie.core.craftgui.database.PageSpeciesResultant;
import binnie.core.craftgui.database.PageSpeciesClassification;
import binnie.core.AbstractMod;
import binnie.core.craftgui.database.DatabaseTab;
import binnie.extratrees.ExtraTrees;
import binnie.core.craftgui.database.PageSpeciesOverview;
import binnie.core.craftgui.minecraft.Window;
import binnie.Binnie;
import cpw.mods.fml.relauncher.Side;
import net.minecraft.entity.player.EntityPlayer;
import binnie.core.craftgui.database.WindowAbstractDatabase;
public class WindowLepidopteristDatabase extends WindowAbstractDatabase
{
public WindowLepidopteristDatabase(final EntityPlayer player, final Side side, final boolean nei) {
super(player, side, nei, Binnie.Genetics.mothBreedingSystem, 160.0f);
}
public static Window create(final EntityPlayer player, final Side side, final boolean nei) {
return new WindowLepidopteristDatabase(player, side, nei);
}
@Override
protected void addTabs() {
new PageSpeciesOverview(this.getInfoPages(Mode.Species), new DatabaseTab(ExtraTrees.instance, "butterfly.species.overview", 0));
new PageSpeciesClassification(this.getInfoPages(Mode.Species), new DatabaseTab(ExtraTrees.instance, "butterfly.species.classification", 0));
new PageSpeciesImage(this.getInfoPages(Mode.Species), new DatabaseTab(ExtraTrees.instance, "butterfly.species.specimen", 0));
new PageSpeciesResultant(this.getInfoPages(Mode.Species), new DatabaseTab(ExtraTrees.instance, "butterfly.species.resultant", 0));
new PageSpeciesMutations(this.getInfoPages(Mode.Species), new DatabaseTab(ExtraTrees.instance, "butterfly.species.further", 0));
new PageBranchOverview(this.getInfoPages(Mode.Branches), new DatabaseTab(ExtraTrees.instance, "butterfly.branches.overview", 0));
new PageBranchSpecies(this.getInfoPages(Mode.Branches), new DatabaseTab(ExtraTrees.instance, "butterfly.branches.species", 0));
new PageBreeder(this.getInfoPages(Mode.Breeder), this.getUsername(), new DatabaseTab(ExtraTrees.instance, "butterfly.breeder", 0));
}
@Override
protected AbstractMod getMod() {
return ExtraTrees.instance;
}
@Override
protected String getName() {
return "MothDatabase";
}
}
@@ -0,0 +1,55 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.extratrees.craftgui.dictionary;
import binnie.core.craftgui.minecraft.control.ControlErrorState;
import binnie.core.craftgui.minecraft.control.ControlPlayerInventory;
import binnie.core.craftgui.geometry.Position;
import binnie.core.craftgui.minecraft.control.ControlEnergyBar;
import binnie.core.craftgui.minecraft.control.ControlLiquidTank;
import binnie.extratrees.machines.Lumbermill;
import binnie.core.craftgui.minecraft.control.ControlSlot;
import binnie.core.machines.Machine;
import binnie.extratrees.ExtraTrees;
import binnie.core.AbstractMod;
import cpw.mods.fml.relauncher.Side;
import net.minecraft.inventory.IInventory;
import net.minecraft.entity.player.EntityPlayer;
import binnie.core.craftgui.minecraft.Window;
public class WindowLumbermill extends Window
{
public WindowLumbermill(final EntityPlayer player, final IInventory inventory, final Side side) {
super(220.0f, 192.0f, player, inventory, side);
}
@Override
protected AbstractMod getMod() {
return ExtraTrees.instance;
}
@Override
protected String getName() {
return "Lumbermill";
}
@Override
public void initialiseClient() {
this.setTitle(Machine.getMachine(this.getInventory()).getPackage().getDisplayName());
new ControlSlot(this, 42.0f, 43.0f).assign(Lumbermill.slotWood);
new ControlSlot(this, 148.0f, 43.0f).assign(Lumbermill.slotPlanks);
new ControlSlot(this, 172.0f, 28.0f).assign(Lumbermill.slotBark);
new ControlSlot(this, 172.0f, 58.0f).assign(Lumbermill.slotSawdust);
new ControlLumbermillProgress(this, 70.0f, 43.0f);
new ControlLiquidTank(this, 16, 32);
new ControlEnergyBar(this, 8, 112, 16, 60, Position.Bottom);
new ControlPlayerInventory(this);
new ControlErrorState(this, 95.0f, 73.0f);
}
public static Window create(final EntityPlayer player, final IInventory inventory, final Side side) {
return new WindowLumbermill(player, inventory, side);
}
}
@@ -0,0 +1,72 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.extratrees.craftgui.dictionary;
import net.minecraft.item.ItemStack;
import binnie.core.machines.power.ErrorState;
import net.minecraft.nbt.NBTTagCompound;
import binnie.core.craftgui.minecraft.InventoryType;
import binnie.core.craftgui.minecraft.control.ControlErrorState;
import binnie.core.craftgui.minecraft.control.ControlPlayerInventory;
import binnie.core.craftgui.geometry.Position;
import binnie.core.craftgui.minecraft.control.ControlEnergyBar;
import binnie.core.craftgui.minecraft.control.ControlLiquidTank;
import binnie.extratrees.machines.Press;
import binnie.core.craftgui.minecraft.control.ControlSlot;
import binnie.core.machines.Machine;
import binnie.extratrees.ExtraTrees;
import binnie.core.AbstractMod;
import cpw.mods.fml.relauncher.Side;
import net.minecraft.inventory.IInventory;
import net.minecraft.entity.player.EntityPlayer;
import binnie.core.craftgui.minecraft.Window;
public class WindowPress extends Window
{
public WindowPress(final EntityPlayer player, final IInventory inventory, final Side side) {
super(194.0f, 192.0f, player, inventory, side);
}
@Override
protected AbstractMod getMod() {
return ExtraTrees.instance;
}
@Override
protected String getName() {
return "Press";
}
@Override
public void initialiseClient() {
this.setTitle(Machine.getMachine(this.getInventory()).getPackage().getDisplayName());
new ControlSlot(this, 24.0f, 52.0f).assign(Press.slotFruit);
new ControlLiquidTank(this, 99, 32).setTankID(Press.tankWater);
new ControlEnergyBar(this, 154, 32, 16, 60, Position.Bottom);
new ControlPlayerInventory(this);
new ControlErrorState(this, 128.0f, 54.0f);
new ControlFruitPressProgress(this, 62.0f, 24.0f);
((Window) this.getSuperParent()).getContainer().getOrCreateSlot(InventoryType.Machine, Press.slotCurrent);
}
public static Window create(final EntityPlayer player, final IInventory inventory, final Side side) {
return new WindowPress(player, inventory, side);
}
@Override
public void recieveGuiNBT(final Side side, final EntityPlayer player, final String name, final NBTTagCompound nbt) {
final Press.ComponentFruitPressLogic logic = Machine.getInterface(Press.ComponentFruitPressLogic.class, this.getInventory());
super.recieveGuiNBT(side, player, name, nbt);
if (side == Side.SERVER && name.equals("fruitpress-click")) {
if (logic.canWork() == null && (logic.canProgress() == null || logic.canProgress() instanceof ErrorState.InsufficientPower)) {
logic.alterProgress(2.0f);
}
else if (side == Side.SERVER && name.equals("clear-fruit")) {
logic.setProgress(0.0f);
this.getInventory().setInventorySlotContents(Press.slotCurrent, (ItemStack) null);
}
}
}
}
@@ -0,0 +1,38 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.extratrees.craftgui.dictionary;
import net.minecraft.world.World;
import binnie.extratrees.ExtraTrees;
import binnie.core.AbstractMod;
import cpw.mods.fml.relauncher.Side;
import net.minecraft.inventory.IInventory;
import net.minecraft.entity.player.EntityPlayer;
import binnie.core.craftgui.minecraft.Window;
public class WindowSetSquare extends Window
{
public WindowSetSquare(final EntityPlayer player, final IInventory inventory, final Side side) {
super(150.0f, 150.0f, player, inventory, side);
}
@Override
protected AbstractMod getMod() {
return ExtraTrees.instance;
}
@Override
protected String getName() {
return null;
}
@Override
public void initialiseClient() {
}
public static Window create(final EntityPlayer player, final World world, final int x, final int y, final int z, final Side side) {
return new WindowSetSquare(player, null, side);
}
}
@@ -0,0 +1,84 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.extratrees.craftgui.dictionary;
import binnie.extratrees.machines.DesignerType;
import binnie.extratrees.ExtraTrees;
import binnie.core.AbstractMod;
import binnie.core.craftgui.events.EventHandler;
import binnie.core.craftgui.events.EventTextEdit;
import cpw.mods.fml.relauncher.Side;
import net.minecraft.inventory.IInventory;
import net.minecraft.entity.player.EntityPlayer;
import binnie.extratrees.machines.Designer;
import binnie.core.craftgui.minecraft.control.ControlSlot;
import binnie.core.craftgui.minecraft.control.ControlErrorState;
import binnie.core.craftgui.geometry.IPoint;
import binnie.core.craftgui.minecraft.control.ControlPlayerInventory;
import binnie.core.craftgui.controls.scroll.ControlScrollableContent;
import binnie.core.craftgui.minecraft.MinecraftGUI;
import binnie.core.craftgui.window.Panel;
import binnie.core.craftgui.controls.ControlText;
import binnie.core.craftgui.geometry.TextJustification;
import binnie.core.BinnieCore;
import binnie.core.craftgui.geometry.IArea;
import binnie.core.machines.Machine;
import binnie.core.craftgui.controls.ControlTextEdit;
import binnie.core.craftgui.minecraft.Window;
public class WindowWoodworker extends Window
{
ControlTextEdit textEdit;
ControlTileSelect tileSelect;
@Override
public void initialiseClient() {
this.setTitle(Machine.getMachine(this.getInventory()).getPackage().getDisplayName());
new ControlText(this, new IArea(190.0f, 36.0f, 114.0f, 10.0f), BinnieCore.proxy.localise("gui.design"), TextJustification.TopCenter).setColor(4473924);
new Panel(this, 188.0f, 48.0f, 118.0f, 126.0f, MinecraftGUI.PanelType.Gray);
this.textEdit = new ControlTextEdit(this, 188.0f, 178.0f, 118.0f, 12.0f);
final ControlScrollableContent scroll = new ControlScrollableContent(this, 190.0f, 50.0f, 114.0f, 122.0f, 12.0f);
scroll.setScrollableContent(this.tileSelect = new ControlTileSelect(scroll, 0.0f, 0.0f));
new ControlPlayerInventory(this).setPosition(new IPoint(14.0f, 96.0f));
new ControlErrorState(this, 76.0f, 65.0f);
if (this.getInventory() != null) {
final ControlSlot slotWood1 = new ControlSlot(this, 22.0f, 34.0f);
slotWood1.assign(Designer.design1Slot);
final ControlSlot slotWood2 = new ControlSlot(this, 62.0f, 34.0f);
slotWood2.assign(Designer.design2Slot);
final ControlSlot slotBeeswax = new ControlSlot(this, 42.0f, 64.0f);
slotBeeswax.assign(Designer.beeswaxSlot);
final ControlRecipeSlot slotFinished = new ControlRecipeSlot(this, 112, 34);
}
}
public WindowWoodworker(final EntityPlayer player, final IInventory inventory, final Side side) {
super(320.0f, 216.0f, player, inventory, side);
this.addEventHandler(new EventTextEdit.Handler() {
@Override
public void onEvent(final EventTextEdit event) {
WindowWoodworker.this.tileSelect.refresh(event.getValue());
}
}.setOrigin(EventHandler.Origin.DirectChild, this));
}
public static Window create(final EntityPlayer player, final IInventory inventory, final Side side) {
return new WindowWoodworker(player, inventory, side);
}
@Override
protected AbstractMod getMod() {
return ExtraTrees.instance;
}
@Override
protected String getName() {
return "Woodworker";
}
public DesignerType getDesignerType() {
return Machine.getInterface(Designer.ComponentWoodworkerRecipe.class, this.getInventory()).getDesignerType();
}
}
@@ -0,0 +1,21 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.extratrees.craftgui.kitchen;
import binnie.core.craftgui.WidgetAttribute;
import binnie.core.craftgui.minecraft.MinecraftGUI;
import binnie.core.craftgui.IWidget;
import binnie.core.craftgui.window.Panel;
public class ControlDropDownMenu extends Panel
{
public boolean stayOpenOnChildClick;
public ControlDropDownMenu(final IWidget parent, final float x, final float y, final float width, final float height) {
super(parent, x, y, width, 2.0f, MinecraftGUI.PanelType.Gray);
this.stayOpenOnChildClick = false;
this.addAttribute(WidgetAttribute.CanFocus);
}
}
@@ -0,0 +1,33 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.extratrees.craftgui.kitchen;
import binnie.core.craftgui.minecraft.Window;
import binnie.core.craftgui.events.EventMouse;
import binnie.core.craftgui.IWidget;
import binnie.core.craftgui.controls.button.ControlButton;
public abstract class ControlDropdownButton extends ControlButton
{
public ControlDropdownButton(final IWidget parent, final float x, final float y, final float width, final float height, final String text) {
super(parent, x, y, width, height, text);
this.addSelfEventHandler(new EventMouse.Down.Handler() {
@Override
public void onEvent(final EventMouse.Down event) {
ControlDropDownMenu menu = ControlDropdownButton.this.getWidget(ControlDropDownMenu.class);
ControlDropdownButton.this.deleteChild(ControlDropdownButton.this.getWidget(ControlDropDownMenu.class));
if (ControlDropdownButton.this.getWidget(ControlDropDownMenu.class) == null) {
menu = ControlDropdownButton.this.createDropDownMenu();
Window.get(ControlDropdownButton.this.getWidget()).setFocusedWidget(menu);
}
else {
ControlDropdownButton.this.deleteChild(ControlDropdownButton.this.getWidget(ControlDropDownMenu.class));
}
}
});
}
public abstract ControlDropDownMenu createDropDownMenu();
}
@@ -0,0 +1,91 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.extratrees.craftgui.kitchen;
import binnie.core.craftgui.Tooltip;
import net.minecraft.util.IIcon;
import net.minecraftforge.fluids.Fluid;
import binnie.core.craftgui.geometry.IPoint;
import binnie.core.craftgui.CraftGUI;
import org.lwjgl.opengl.GL11;
import binnie.core.craftgui.minecraft.Window;
import binnie.core.craftgui.IWidget;
import binnie.core.craftgui.WidgetAttribute;
import net.minecraftforge.fluids.FluidStack;
import binnie.core.craftgui.ITooltip;
import binnie.core.craftgui.controls.core.Control;
public class ControlFluidDisplay extends Control implements ITooltip
{
FluidStack itemStack;
public boolean hastooltip;
public void setTooltip() {
this.hastooltip = true;
this.addAttribute(WidgetAttribute.MouseOver);
}
public ControlFluidDisplay(final IWidget parent, final float f, final float y) {
this(parent, f, y, 16.0f);
}
public ControlFluidDisplay(final IWidget parent, final float f, final float y, final FluidStack stack, final boolean tooltip) {
this(parent, f, y, 16.0f);
this.setItemStack(stack);
if (tooltip) {
this.setTooltip();
}
}
public ControlFluidDisplay(final IWidget parent, final float x, final float y, final float size) {
super(parent, x, y, size, size);
this.itemStack = null;
this.hastooltip = false;
}
@Override
public void onRenderForeground() {
if (this.itemStack == null) {
return;
}
final IPoint relativeToWindow = this.getAbsolutePosition().sub(this.getSuperParent().getPosition());
if (relativeToWindow.x() > Window.get(this).getSize().x() + 100.0f || relativeToWindow.y() > Window.get(this).getSize().y() + 100.0f) {
return;
}
if (this.itemStack != null) {
final Fluid fluid = this.itemStack.getFluid();
final int hex = fluid.getColor(this.itemStack);
final int r = (hex & 0xFF0000) >> 16;
final int g = (hex & 0xFF00) >> 8;
final int b = hex & 0xFF;
final IIcon icon = this.itemStack.getFluid().getIcon(this.itemStack);
GL11.glColor4f(r / 255.0f, g / 255.0f, b / 255.0f, 1.0f);
GL11.glEnable(3042);
GL11.glBlendFunc(770, 771);
if (this.getSize().x() != 16.0f) {
GL11.glPushMatrix();
final float scale = this.getSize().x() / 16.0f;
GL11.glScalef(scale, scale, 1.0f);
CraftGUI.Render.iconBlock(IPoint.ZERO, this.itemStack.getFluid().getIcon(this.itemStack));
GL11.glPopMatrix();
}
else {
CraftGUI.Render.iconBlock(IPoint.ZERO, this.itemStack.getFluid().getIcon(this.itemStack));
}
GL11.glDisable(3042);
}
}
public void setItemStack(final FluidStack itemStack) {
this.itemStack = itemStack;
}
@Override
public void getTooltip(final Tooltip tooltip) {
if (this.hastooltip && this.itemStack != null) {
tooltip.add(this.itemStack.getLocalizedName());
}
}
}
@@ -0,0 +1,70 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.extratrees.craftgui.kitchen;
import binnie.core.craftgui.Tooltip;
import binnie.core.craftgui.geometry.IArea;
import binnie.core.craftgui.resource.minecraft.CraftGUITexture;
import binnie.core.craftgui.CraftGUI;
import binnie.core.craftgui.geometry.IPoint;
import binnie.core.craftgui.events.EventWidget;
import binnie.core.craftgui.WidgetAttribute;
import binnie.core.craftgui.IWidget;
import net.minecraftforge.fluids.FluidStack;
import binnie.core.craftgui.ITooltip;
import binnie.core.craftgui.controls.core.Control;
public class ControlSlotFluid extends Control implements ITooltip
{
ControlFluidDisplay itemDisplay;
FluidStack fluidStack;
public ControlSlotFluid(final IWidget parent, final int x, final int y, final FluidStack fluid) {
this(parent, x, y, 18, fluid);
}
public ControlSlotFluid(final IWidget parent, final int x, final int y, final int size, final FluidStack fluid) {
super(parent, x, y, size, size);
this.addAttribute(WidgetAttribute.MouseOver);
this.itemDisplay = new ControlFluidDisplay(this, 1.0f, 1.0f, size - 2);
this.fluidStack = fluid;
this.addSelfEventHandler(new EventWidget.ChangeSize.Handler() {
@Override
public void onEvent(final EventWidget.ChangeSize event) {
if (ControlSlotFluid.this.itemDisplay != null) {
ControlSlotFluid.this.itemDisplay.setSize(ControlSlotFluid.this.getSize().sub(new IPoint(2.0f, 2.0f)));
}
}
});
}
@Override
public void onRenderBackground() {
final int size = (int) this.getSize().x();
CraftGUI.Render.texture(CraftGUITexture.Slot, this.getArea());
if (this.getSuperParent().getMousedOverWidget() == this) {
CraftGUI.Render.gradientRect(new IArea(new IPoint(1.0f, 1.0f), this.getArea().size().sub(new IPoint(2.0f, 2.0f))), -2130706433, -2130706433);
}
}
@Override
public void onUpdateClient() {
super.onUpdateClient();
this.itemDisplay.setItemStack(this.getFluidStack());
}
@Override
public void getTooltip(final Tooltip tooltip) {
final FluidStack item = this.getFluidStack();
if (item == null) {
return;
}
tooltip.add(item.getFluid().getLocalizedName());
}
public FluidStack getFluidStack() {
return this.fluidStack;
}
}
@@ -0,0 +1,36 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.extratrees.craftgui.kitchen;
import net.minecraft.item.ItemStack;
import binnie.core.craftgui.IWidget;
import binnie.extratrees.alcohol.Glassware;
import binnie.core.craftgui.controls.core.IControlValue;
import binnie.core.craftgui.minecraft.control.ControlSlotBase;
public class ControlSlotGlassware extends ControlSlotBase implements IControlValue<Glassware>
{
Glassware glassware;
public ControlSlotGlassware(final IWidget parent, final int x, final int y, final Glassware glassware) {
super(parent, x, y);
this.glassware = glassware;
}
@Override
public Glassware getValue() {
return this.glassware;
}
@Override
public void setValue(final Glassware value) {
this.glassware = value;
}
@Override
public ItemStack getItemStack() {
return this.glassware.get(1);
}
}
@@ -0,0 +1,45 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.extratrees.craftgui.kitchen;
import binnie.core.craftgui.geometry.IArea;
import binnie.core.craftgui.minecraft.Window;
import net.minecraft.nbt.NBTTagCompound;
import binnie.core.craftgui.events.EventMouse;
import binnie.core.craftgui.IWidget;
public class ControlTankSlot extends ControlSlotFluid
{
int tankID;
public ControlTankSlot(final IWidget parent, final int x, final int y, final int i) {
super(parent, x, y, null);
this.tankID = 0;
this.tankID = i;
this.addSelfEventHandler(new EventMouse.Down.Handler() {
@Override
public void onEvent(final EventMouse.Down event) {
if (event.getButton() == 0) {
final NBTTagCompound nbt = new NBTTagCompound();
nbt.setByte("id", (byte) ControlTankSlot.this.tankID);
Window.get(ControlTankSlot.this.getWidget()).sendClientAction("tank-click", nbt);
}
}
});
}
@Override
public void onUpdateClient() {
this.fluidStack = Window.get(this).getContainer().getTankInfo(this.tankID).liquid;
final int height = (int) (16.0f * (((this.fluidStack == null) ? 0 : this.fluidStack.amount) / 1000.0f));
this.itemDisplay.setCroppedZone(this.itemDisplay, new IArea(0.0f, 16 - height, 16.0f, 16.0f));
super.onUpdateClient();
}
@Override
public void onRenderBackground() {
super.onRenderBackground();
}
}
@@ -0,0 +1,46 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.extratrees.craftgui.kitchen;
import binnie.core.craftgui.minecraft.control.ControlPlayerInventory;
import binnie.core.machines.Machine;
import binnie.extratrees.ExtraTrees;
import binnie.core.AbstractMod;
import cpw.mods.fml.relauncher.Side;
import net.minecraft.inventory.IInventory;
import net.minecraft.entity.player.EntityPlayer;
import binnie.core.craftgui.minecraft.Window;
public class WindowBottleRack extends Window
{
public WindowBottleRack(final EntityPlayer player, final IInventory inventory, final Side side) {
super(248.0f, 180.0f, player, inventory, side);
}
public static Window create(final EntityPlayer player, final IInventory inventory, final Side side) {
return new WindowBottleRack(player, inventory, side);
}
@Override
protected AbstractMod getMod() {
return ExtraTrees.instance;
}
@Override
protected String getName() {
return "BottleBank";
}
@Override
public void initialiseClient() {
this.setTitle(Machine.getMachine(this.getInventory()).getPackage().getDisplayName());
for (int i = 0; i < 36; ++i) {
final int x = i % 12;
final int y = i / 12;
new ControlTankSlot(this, 16 + x * 18, 32 + y * 18, i);
}
new ControlPlayerInventory(this);
}
}
@@ -9,7 +9,7 @@ import binnie.extratrees.core.ExtraTreesGUID;
import binnie.extratrees.machines.ExtraTreeMachine;
import binnie.core.machines.Machine;
import binnie.extratrees.core.ExtraTreeTexture;
import binnie.craftgui.minecraft.IMachineInformation;
import binnie.core.craftgui.minecraft.IMachineInformation;
public class BottleRack
{
@@ -14,7 +14,7 @@ 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.craftgui.minecraft.IMachineInformation;
import binnie.core.craftgui.minecraft.IMachineInformation;
import binnie.extratrees.alcohol.Alcohol;
import binnie.extratrees.core.ExtraTreeTexture;
import binnie.extratrees.core.ExtraTreesGUID;
@@ -23,7 +23,7 @@ import binnie.core.machines.component.ComponentRecipe;
import binnie.core.machines.inventory.ComponentInventorySlots;
import binnie.extratrees.core.ExtraTreesGUID;
import binnie.core.machines.Machine;
import binnie.craftgui.minecraft.IMachineInformation;
import binnie.core.craftgui.minecraft.IMachineInformation;
public abstract class Designer
{
@@ -15,7 +15,7 @@ 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.craftgui.minecraft.IMachineInformation;
import binnie.core.craftgui.minecraft.IMachineInformation;
import binnie.extratrees.core.ExtraTreeTexture;
import binnie.extratrees.core.ExtraTreesGUID;
import cpw.mods.fml.relauncher.Side;
@@ -17,7 +17,7 @@ import binnie.core.machines.inventory.ComponentInventorySlots;
import binnie.extratrees.core.ExtraTreesGUID;
import binnie.core.machines.Machine;
import binnie.extratrees.core.ExtraTreeTexture;
import binnie.craftgui.minecraft.IMachineInformation;
import binnie.core.craftgui.minecraft.IMachineInformation;
import java.util.HashMap;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
@@ -21,7 +21,7 @@ import binnie.core.machines.inventory.ComponentInventorySlots;
import binnie.extratrees.core.ExtraTreesGUID;
import binnie.core.machines.Machine;
import binnie.extratrees.core.ExtraTreeTexture;
import binnie.craftgui.minecraft.IMachineInformation;
import binnie.core.craftgui.minecraft.IMachineInformation;
import java.util.HashMap;
import java.util.List;
import net.minecraftforge.oredict.ShapelessOreRecipe;
@@ -17,7 +17,7 @@ import binnie.core.machines.inventory.ComponentInventorySlots;
import binnie.extratrees.core.ExtraTreesGUID;
import binnie.core.machines.Machine;
import binnie.extratrees.core.ExtraTreeTexture;
import binnie.craftgui.minecraft.IMachineInformation;
import binnie.core.craftgui.minecraft.IMachineInformation;
import java.util.HashMap;
import net.minecraftforge.fluids.FluidStack;
import net.minecraft.item.ItemStack;