From 7011e367ac5ccc34473283d6245bc2cec93b835e Mon Sep 17 00:00:00 2001 From: Draknyte1 Date: Fri, 19 Feb 2016 17:38:35 +1000 Subject: Removed Hard dependency on gregtech as another Project and added dev versions of all requires libs. Also started work on GT-EU EnderIO conduits, adding @Optional annotations where possible and a few other nice things. --- .../binnie/craftgui/binniecore/WindowFieldKit.java | 334 ------------ .../binnie/craftgui/binniecore/WindowGenesis.java | 264 --------- .../binnie/craftgui/controls/ControlCheckbox.java | 75 --- src/Java/binnie/craftgui/controls/ControlText.java | 50 -- .../craftgui/controls/ControlTextCentered.java | 15 - .../binnie/craftgui/controls/ControlTextEdit.java | 154 ------ .../craftgui/controls/IControlSelection.java | 10 - .../craftgui/controls/IControlSelectionOption.java | 6 - .../craftgui/controls/button/ControlButton.java | 70 --- .../controls/button/ControlEnumButton.java | 61 --- .../controls/button/ControlToggleButton.java | 21 - .../binnie/craftgui/controls/core/Control.java | 85 --- .../craftgui/controls/core/IControlIndexed.java | 8 - .../craftgui/controls/core/IControlValue.java | 11 - .../craftgui/controls/core/IControlValues.java | 11 - .../craftgui/controls/listbox/ControlList.java | 146 ----- .../craftgui/controls/listbox/ControlListBox.java | 76 --- .../craftgui/controls/listbox/ControlOption.java | 73 --- .../controls/listbox/ControlTextOption.java | 37 -- .../binnie/craftgui/controls/page/ControlPage.java | 36 -- .../craftgui/controls/page/ControlPages.java | 57 -- .../craftgui/controls/scroll/ControlScroll.java | 22 - .../craftgui/controls/scroll/ControlScrollBar.java | 94 ---- .../controls/scroll/ControlScrollableContent.java | 134 ----- .../controls/scroll/IControlScrollable.java | 17 - .../binnie/craftgui/controls/tab/ControlTab.java | 128 ----- .../craftgui/controls/tab/ControlTabBar.java | 86 --- src/Java/binnie/craftgui/core/Attribute.java | 9 - src/Java/binnie/craftgui/core/CraftGUI.java | 10 - src/Java/binnie/craftgui/core/ITooltip.java | 6 - src/Java/binnie/craftgui/core/ITooltipHelp.java | 6 - src/Java/binnie/craftgui/core/ITopLevelWidget.java | 29 - src/Java/binnie/craftgui/core/IWidget.java | 138 ----- .../binnie/craftgui/core/IWidgetAttribute.java | 3 - src/Java/binnie/craftgui/core/RenderStage.java | 8 - src/Java/binnie/craftgui/core/Tooltip.java | 84 --- src/Java/binnie/craftgui/core/TopLevelWidget.java | 248 --------- src/Java/binnie/craftgui/core/Widget.java | 499 ----------------- .../craftgui/core/geometry/CraftGUIUtil.java | 77 --- src/Java/binnie/craftgui/core/geometry/IArea.java | 143 ----- .../binnie/craftgui/core/geometry/IBorder.java | 126 ----- src/Java/binnie/craftgui/core/geometry/IPoint.java | 83 --- .../binnie/craftgui/core/geometry/Position.java | 41 -- .../craftgui/core/geometry/TextJustification.java | 25 - .../binnie/craftgui/core/renderer/Renderer.java | 252 --------- .../binnie/craftgui/core/renderer/TextureType.java | 8 - src/Java/binnie/craftgui/events/Event.java | 23 - .../binnie/craftgui/events/EventButtonClicked.java | 21 - .../binnie/craftgui/events/EventCycleChanged.java | 20 - src/Java/binnie/craftgui/events/EventHandler.java | 53 -- src/Java/binnie/craftgui/events/EventKey.java | 63 --- src/Java/binnie/craftgui/events/EventMouse.java | 156 ------ src/Java/binnie/craftgui/events/EventTextEdit.java | 21 - .../craftgui/events/EventToggleButtonClicked.java | 20 - .../binnie/craftgui/events/EventValueChanged.java | 29 - .../binnie/craftgui/events/EventValuesChanged.java | 20 - src/Java/binnie/craftgui/events/EventWidget.java | 272 --------- .../craftgui/minecraft/ContainerCraftGUI.java | 549 ------------------- src/Java/binnie/craftgui/minecraft/CustomSlot.java | 54 -- src/Java/binnie/craftgui/minecraft/Dialog.java | 53 -- src/Java/binnie/craftgui/minecraft/EnumColor.java | 32 -- src/Java/binnie/craftgui/minecraft/GUIIcon.java | 30 - .../binnie/craftgui/minecraft/GuiCraftGUI.java | 605 --------------------- .../craftgui/minecraft/IMachineInformation.java | 6 - .../craftgui/minecraft/IMinecraftTooltip.java | 9 - .../minecraft/IWindowAffectsShiftClick.java | 8 - .../binnie/craftgui/minecraft/InventoryType.java | 8 - src/Java/binnie/craftgui/minecraft/ListMap.java | 149 ----- .../binnie/craftgui/minecraft/MinecraftGUI.java | 14 - .../craftgui/minecraft/MinecraftTooltip.java | 63 --- .../binnie/craftgui/minecraft/ModuleCraftGUI.java | 18 - src/Java/binnie/craftgui/minecraft/Window.java | 338 ------------ .../binnie/craftgui/minecraft/WindowInventory.java | 144 ----- .../minecraft/control/ControlEnergyBar.java | 161 ------ .../minecraft/control/ControlErrorState.java | 113 ---- .../craftgui/minecraft/control/ControlHelp.java | 41 -- .../minecraft/control/ControlIconDisplay.java | 25 - .../craftgui/minecraft/control/ControlImage.java | 25 - .../craftgui/minecraft/control/ControlInfo.java | 38 -- .../minecraft/control/ControlItemDisplay.java | 98 ---- .../minecraft/control/ControlLiquidTank.java | 223 -------- .../minecraft/control/ControlMachineProgress.java | 14 - .../minecraft/control/ControlPlayerInventory.java | 108 ---- .../minecraft/control/ControlPowerSystem.java | 39 -- .../minecraft/control/ControlProgress.java | 30 - .../minecraft/control/ControlProgressBase.java | 100 ---- .../craftgui/minecraft/control/ControlSlide.java | 113 ---- .../craftgui/minecraft/control/ControlSlot.java | 221 -------- .../minecraft/control/ControlSlotArray.java | 76 --- .../minecraft/control/ControlSlotBase.java | 77 --- .../minecraft/control/ControlSlotCharge.java | 43 -- .../craftgui/minecraft/control/ControlTabIcon.java | 47 -- .../craftgui/minecraft/control/ControlUser.java | 41 -- .../minecraft/control/EnumHighlighting.java | 28 - .../minecraft/render/MinecraftTexture.java | 10 - .../craftgui/minecraft/render/RenderCommand.java | 16 - .../craftgui/mod/database/ControlBranchBox.java | 20 - .../mod/database/ControlBranchBoxOption.java | 14 - .../mod/database/ControlBreedingProgress.java | 41 -- .../database/ControlDatabaseIndividualDisplay.java | 120 ---- .../mod/database/ControlItemStackOption.java | 38 -- .../craftgui/mod/database/ControlMutationBox.java | 71 --- .../craftgui/mod/database/ControlMutationItem.java | 51 -- .../mod/database/ControlMutationSymbol.java | 80 --- .../craftgui/mod/database/ControlSpeciesBox.java | 55 -- .../mod/database/ControlSpeciexBoxOption.java | 42 -- .../binnie/craftgui/mod/database/DatabaseTab.java | 32 -- .../craftgui/mod/database/EnumDiscoveryState.java | 8 - .../craftgui/mod/database/IDatabaseMode.java | 6 - .../binnie/craftgui/mod/database/PageAbstract.java | 16 - .../binnie/craftgui/mod/database/PageBranch.java | 13 - .../craftgui/mod/database/PageBranchOverview.java | 67 --- .../craftgui/mod/database/PageBranchSpecies.java | 43 -- .../binnie/craftgui/mod/database/PageBreeder.java | 51 -- .../craftgui/mod/database/PageBreederStats.java | 23 - .../binnie/craftgui/mod/database/PageSpecies.java | 13 - .../mod/database/PageSpeciesClassification.java | 54 -- .../mod/database/PageSpeciesMutations.java | 27 - .../craftgui/mod/database/PageSpeciesOverview.java | 88 --- .../mod/database/PageSpeciesResultant.java | 27 - .../mod/database/WindowAbstractDatabase.java | 314 ----------- src/Java/binnie/craftgui/resource/IStyleSheet.java | 6 - src/Java/binnie/craftgui/resource/StyleSheet.java | 18 - .../craftgui/resource/StyleSheetManager.java | 28 - src/Java/binnie/craftgui/resource/Texture.java | 128 ----- .../minecraft/CraftGUIResourceManager.java | 155 ------ .../resource/minecraft/CraftGUITexture.java | 18 - .../resource/minecraft/CraftGUITextureSheet.java | 33 -- .../craftgui/resource/minecraft/PaddedTexture.java | 21 - .../resource/minecraft/ParsedTextureSheet.java | 25 - .../resource/minecraft/StandardTexture.java | 36 -- src/Java/binnie/craftgui/window/Panel.java | 58 -- 132 files changed, 10181 deletions(-) delete mode 100644 src/Java/binnie/craftgui/binniecore/WindowFieldKit.java delete mode 100644 src/Java/binnie/craftgui/binniecore/WindowGenesis.java delete mode 100644 src/Java/binnie/craftgui/controls/ControlCheckbox.java delete mode 100644 src/Java/binnie/craftgui/controls/ControlText.java delete mode 100644 src/Java/binnie/craftgui/controls/ControlTextCentered.java delete mode 100644 src/Java/binnie/craftgui/controls/ControlTextEdit.java delete mode 100644 src/Java/binnie/craftgui/controls/IControlSelection.java delete mode 100644 src/Java/binnie/craftgui/controls/IControlSelectionOption.java delete mode 100644 src/Java/binnie/craftgui/controls/button/ControlButton.java delete mode 100644 src/Java/binnie/craftgui/controls/button/ControlEnumButton.java delete mode 100644 src/Java/binnie/craftgui/controls/button/ControlToggleButton.java delete mode 100644 src/Java/binnie/craftgui/controls/core/Control.java delete mode 100644 src/Java/binnie/craftgui/controls/core/IControlIndexed.java delete mode 100644 src/Java/binnie/craftgui/controls/core/IControlValue.java delete mode 100644 src/Java/binnie/craftgui/controls/core/IControlValues.java delete mode 100644 src/Java/binnie/craftgui/controls/listbox/ControlList.java delete mode 100644 src/Java/binnie/craftgui/controls/listbox/ControlListBox.java delete mode 100644 src/Java/binnie/craftgui/controls/listbox/ControlOption.java delete mode 100644 src/Java/binnie/craftgui/controls/listbox/ControlTextOption.java delete mode 100644 src/Java/binnie/craftgui/controls/page/ControlPage.java delete mode 100644 src/Java/binnie/craftgui/controls/page/ControlPages.java delete mode 100644 src/Java/binnie/craftgui/controls/scroll/ControlScroll.java delete mode 100644 src/Java/binnie/craftgui/controls/scroll/ControlScrollBar.java delete mode 100644 src/Java/binnie/craftgui/controls/scroll/ControlScrollableContent.java delete mode 100644 src/Java/binnie/craftgui/controls/scroll/IControlScrollable.java delete mode 100644 src/Java/binnie/craftgui/controls/tab/ControlTab.java delete mode 100644 src/Java/binnie/craftgui/controls/tab/ControlTabBar.java delete mode 100644 src/Java/binnie/craftgui/core/Attribute.java delete mode 100644 src/Java/binnie/craftgui/core/CraftGUI.java delete mode 100644 src/Java/binnie/craftgui/core/ITooltip.java delete mode 100644 src/Java/binnie/craftgui/core/ITooltipHelp.java delete mode 100644 src/Java/binnie/craftgui/core/ITopLevelWidget.java delete mode 100644 src/Java/binnie/craftgui/core/IWidget.java delete mode 100644 src/Java/binnie/craftgui/core/IWidgetAttribute.java delete mode 100644 src/Java/binnie/craftgui/core/RenderStage.java delete mode 100644 src/Java/binnie/craftgui/core/Tooltip.java delete mode 100644 src/Java/binnie/craftgui/core/TopLevelWidget.java delete mode 100644 src/Java/binnie/craftgui/core/Widget.java delete mode 100644 src/Java/binnie/craftgui/core/geometry/CraftGUIUtil.java delete mode 100644 src/Java/binnie/craftgui/core/geometry/IArea.java delete mode 100644 src/Java/binnie/craftgui/core/geometry/IBorder.java delete mode 100644 src/Java/binnie/craftgui/core/geometry/IPoint.java delete mode 100644 src/Java/binnie/craftgui/core/geometry/Position.java delete mode 100644 src/Java/binnie/craftgui/core/geometry/TextJustification.java delete mode 100644 src/Java/binnie/craftgui/core/renderer/Renderer.java delete mode 100644 src/Java/binnie/craftgui/core/renderer/TextureType.java delete mode 100644 src/Java/binnie/craftgui/events/Event.java delete mode 100644 src/Java/binnie/craftgui/events/EventButtonClicked.java delete mode 100644 src/Java/binnie/craftgui/events/EventCycleChanged.java delete mode 100644 src/Java/binnie/craftgui/events/EventHandler.java delete mode 100644 src/Java/binnie/craftgui/events/EventKey.java delete mode 100644 src/Java/binnie/craftgui/events/EventMouse.java delete mode 100644 src/Java/binnie/craftgui/events/EventTextEdit.java delete mode 100644 src/Java/binnie/craftgui/events/EventToggleButtonClicked.java delete mode 100644 src/Java/binnie/craftgui/events/EventValueChanged.java delete mode 100644 src/Java/binnie/craftgui/events/EventValuesChanged.java delete mode 100644 src/Java/binnie/craftgui/events/EventWidget.java delete mode 100644 src/Java/binnie/craftgui/minecraft/ContainerCraftGUI.java delete mode 100644 src/Java/binnie/craftgui/minecraft/CustomSlot.java delete mode 100644 src/Java/binnie/craftgui/minecraft/Dialog.java delete mode 100644 src/Java/binnie/craftgui/minecraft/EnumColor.java delete mode 100644 src/Java/binnie/craftgui/minecraft/GUIIcon.java delete mode 100644 src/Java/binnie/craftgui/minecraft/GuiCraftGUI.java delete mode 100644 src/Java/binnie/craftgui/minecraft/IMachineInformation.java delete mode 100644 src/Java/binnie/craftgui/minecraft/IMinecraftTooltip.java delete mode 100644 src/Java/binnie/craftgui/minecraft/IWindowAffectsShiftClick.java delete mode 100644 src/Java/binnie/craftgui/minecraft/InventoryType.java delete mode 100644 src/Java/binnie/craftgui/minecraft/ListMap.java delete mode 100644 src/Java/binnie/craftgui/minecraft/MinecraftGUI.java delete mode 100644 src/Java/binnie/craftgui/minecraft/MinecraftTooltip.java delete mode 100644 src/Java/binnie/craftgui/minecraft/ModuleCraftGUI.java delete mode 100644 src/Java/binnie/craftgui/minecraft/Window.java delete mode 100644 src/Java/binnie/craftgui/minecraft/WindowInventory.java delete mode 100644 src/Java/binnie/craftgui/minecraft/control/ControlEnergyBar.java delete mode 100644 src/Java/binnie/craftgui/minecraft/control/ControlErrorState.java delete mode 100644 src/Java/binnie/craftgui/minecraft/control/ControlHelp.java delete mode 100644 src/Java/binnie/craftgui/minecraft/control/ControlIconDisplay.java delete mode 100644 src/Java/binnie/craftgui/minecraft/control/ControlImage.java delete mode 100644 src/Java/binnie/craftgui/minecraft/control/ControlInfo.java delete mode 100644 src/Java/binnie/craftgui/minecraft/control/ControlItemDisplay.java delete mode 100644 src/Java/binnie/craftgui/minecraft/control/ControlLiquidTank.java delete mode 100644 src/Java/binnie/craftgui/minecraft/control/ControlMachineProgress.java delete mode 100644 src/Java/binnie/craftgui/minecraft/control/ControlPlayerInventory.java delete mode 100644 src/Java/binnie/craftgui/minecraft/control/ControlPowerSystem.java delete mode 100644 src/Java/binnie/craftgui/minecraft/control/ControlProgress.java delete mode 100644 src/Java/binnie/craftgui/minecraft/control/ControlProgressBase.java delete mode 100644 src/Java/binnie/craftgui/minecraft/control/ControlSlide.java delete mode 100644 src/Java/binnie/craftgui/minecraft/control/ControlSlot.java delete mode 100644 src/Java/binnie/craftgui/minecraft/control/ControlSlotArray.java delete mode 100644 src/Java/binnie/craftgui/minecraft/control/ControlSlotBase.java delete mode 100644 src/Java/binnie/craftgui/minecraft/control/ControlSlotCharge.java delete mode 100644 src/Java/binnie/craftgui/minecraft/control/ControlTabIcon.java delete mode 100644 src/Java/binnie/craftgui/minecraft/control/ControlUser.java delete mode 100644 src/Java/binnie/craftgui/minecraft/control/EnumHighlighting.java delete mode 100644 src/Java/binnie/craftgui/minecraft/render/MinecraftTexture.java delete mode 100644 src/Java/binnie/craftgui/minecraft/render/RenderCommand.java delete mode 100644 src/Java/binnie/craftgui/mod/database/ControlBranchBox.java delete mode 100644 src/Java/binnie/craftgui/mod/database/ControlBranchBoxOption.java delete mode 100644 src/Java/binnie/craftgui/mod/database/ControlBreedingProgress.java delete mode 100644 src/Java/binnie/craftgui/mod/database/ControlDatabaseIndividualDisplay.java delete mode 100644 src/Java/binnie/craftgui/mod/database/ControlItemStackOption.java delete mode 100644 src/Java/binnie/craftgui/mod/database/ControlMutationBox.java delete mode 100644 src/Java/binnie/craftgui/mod/database/ControlMutationItem.java delete mode 100644 src/Java/binnie/craftgui/mod/database/ControlMutationSymbol.java delete mode 100644 src/Java/binnie/craftgui/mod/database/ControlSpeciesBox.java delete mode 100644 src/Java/binnie/craftgui/mod/database/ControlSpeciexBoxOption.java delete mode 100644 src/Java/binnie/craftgui/mod/database/DatabaseTab.java delete mode 100644 src/Java/binnie/craftgui/mod/database/EnumDiscoveryState.java delete mode 100644 src/Java/binnie/craftgui/mod/database/IDatabaseMode.java delete mode 100644 src/Java/binnie/craftgui/mod/database/PageAbstract.java delete mode 100644 src/Java/binnie/craftgui/mod/database/PageBranch.java delete mode 100644 src/Java/binnie/craftgui/mod/database/PageBranchOverview.java delete mode 100644 src/Java/binnie/craftgui/mod/database/PageBranchSpecies.java delete mode 100644 src/Java/binnie/craftgui/mod/database/PageBreeder.java delete mode 100644 src/Java/binnie/craftgui/mod/database/PageBreederStats.java delete mode 100644 src/Java/binnie/craftgui/mod/database/PageSpecies.java delete mode 100644 src/Java/binnie/craftgui/mod/database/PageSpeciesClassification.java delete mode 100644 src/Java/binnie/craftgui/mod/database/PageSpeciesMutations.java delete mode 100644 src/Java/binnie/craftgui/mod/database/PageSpeciesOverview.java delete mode 100644 src/Java/binnie/craftgui/mod/database/PageSpeciesResultant.java delete mode 100644 src/Java/binnie/craftgui/mod/database/WindowAbstractDatabase.java delete mode 100644 src/Java/binnie/craftgui/resource/IStyleSheet.java delete mode 100644 src/Java/binnie/craftgui/resource/StyleSheet.java delete mode 100644 src/Java/binnie/craftgui/resource/StyleSheetManager.java delete mode 100644 src/Java/binnie/craftgui/resource/Texture.java delete mode 100644 src/Java/binnie/craftgui/resource/minecraft/CraftGUIResourceManager.java delete mode 100644 src/Java/binnie/craftgui/resource/minecraft/CraftGUITexture.java delete mode 100644 src/Java/binnie/craftgui/resource/minecraft/CraftGUITextureSheet.java delete mode 100644 src/Java/binnie/craftgui/resource/minecraft/PaddedTexture.java delete mode 100644 src/Java/binnie/craftgui/resource/minecraft/ParsedTextureSheet.java delete mode 100644 src/Java/binnie/craftgui/resource/minecraft/StandardTexture.java delete mode 100644 src/Java/binnie/craftgui/window/Panel.java (limited to 'src/Java/binnie/craftgui') diff --git a/src/Java/binnie/craftgui/binniecore/WindowFieldKit.java b/src/Java/binnie/craftgui/binniecore/WindowFieldKit.java deleted file mode 100644 index d52a6cde31..0000000000 --- a/src/Java/binnie/craftgui/binniecore/WindowFieldKit.java +++ /dev/null @@ -1,334 +0,0 @@ -package binnie.craftgui.binniecore; - -import binnie.Binnie; -import binnie.core.AbstractMod; -import binnie.core.BinnieCore; -import binnie.core.genetics.BreedingSystem; -import binnie.core.genetics.ManagerGenetics; -import binnie.core.language.ManagerLanguage; -import binnie.core.machines.inventory.SlotValidator; -import binnie.core.machines.inventory.ValidatorIcon; -import binnie.craftgui.controls.ControlText; -import binnie.craftgui.controls.core.Control; -import binnie.craftgui.core.CraftGUI; -import binnie.craftgui.core.geometry.IArea; -import binnie.craftgui.core.geometry.IPoint; -import binnie.craftgui.core.geometry.TextJustification; -import binnie.craftgui.core.renderer.Renderer; -import binnie.craftgui.events.EventHandler.Origin; -import binnie.craftgui.events.EventValueChanged; -import binnie.craftgui.events.EventValueChanged.Handler; -import binnie.craftgui.minecraft.InventoryType; -import binnie.craftgui.minecraft.Window; -import binnie.craftgui.minecraft.WindowInventory; -import binnie.craftgui.minecraft.control.ControlImage; -import binnie.craftgui.minecraft.control.ControlPlayerInventory; -import binnie.craftgui.minecraft.control.ControlSlot; -import binnie.craftgui.resource.StyleSheet; -import binnie.craftgui.resource.minecraft.CraftGUITexture; -import binnie.craftgui.resource.minecraft.PaddedTexture; -import binnie.craftgui.resource.minecraft.StandardTexture; -import binnie.extrabees.core.ExtraBeeTexture; -import binnie.extrabees.gui.punnett.ExtraBeeGUITexture; -import binnie.genetics.gui.ControlChromosome; -import binnie.genetics.machine.Analyser; -import cpw.mods.fml.relauncher.Side; -import forestry.api.genetics.AlleleManager; -import forestry.api.genetics.IAllele; -import forestry.api.genetics.IAlleleRegistry; -import forestry.api.genetics.IChromosomeType; -import forestry.api.genetics.IGenome; -import forestry.api.genetics.IIndividual; -import forestry.api.genetics.ISpeciesRoot; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Random; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.init.Items; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; - -public class WindowFieldKit - extends Window -{ - public WindowFieldKit(EntityPlayer player, IInventory inventory, Side side) - { - super(280.0F, 230.0F, player, inventory, side); - } - - protected AbstractMod getMod() - { - return BinnieCore.instance; - } - - protected String getName() - { - return "Field Kit"; - } - - private void setupValidators() - { - getWindowInventory().setValidator(0, new SlotValidator(null) - { - public boolean isValid(ItemStack object) - { - return (AlleleManager.alleleRegistry.isIndividual(object)) || (Binnie.Genetics.getConversion(object) != null); - } - - public String getTooltip() - { - return "Individual"; - } - }); - getWindowInventory().setValidator(1, new SlotValidator(null) - { - public boolean isValid(ItemStack object) - { - return object.getItem() == Items.paper; - } - - public String getTooltip() - { - return "Paper"; - } - }); - getWindowInventory().disableAutoDispense(1); - } - - public void initialiseClient() - { - setTitle("Field Kit"); - - CraftGUI.Render.stylesheet(new StyleSheetPunnett()); - - getWindowInventory().createSlot(0); - getWindowInventory().createSlot(1); - - setupValidators(); - - new ControlPlayerInventory(this); - - IPoint handGlass = new IPoint(16.0F, 32.0F); - this.GlassControl = new ControlImage(this, handGlass.x(), handGlass.y(), new StandardTexture(0, 160, 96, 96, ExtraBeeTexture.GUIPunnett)); - new ControlSlot(this, handGlass.x() + 54.0F, handGlass.y() + 26.0F).assign(InventoryType.Window, 0); - - new ControlSlot(this, 208.0F, 8.0F).assign(InventoryType.Window, 1); - - this.text = new ControlText(this, new IPoint(232.0F, 13.0F), "Paper"); - this.text.setColour(2236962); - - this.text = new ControlText(this, new IArea(0.0F, 120.0F, w(), 24.0F), "", TextJustification.MiddleCenter); - this.text.setColour(2236962); - - this.chromo = new ControlChromosome(this, 150.0F, 24.0F); - - addEventHandler(new EventValueChanged.Handler() - { - public void onEvent(EventValueChanged event) - { - IChromosomeType type = (IChromosomeType)event.getValue(); - if ((type != null) && (WindowFieldKit.this.info.containsKey(type))) - { - String t = (String)WindowFieldKit.this.info.get(type); - WindowFieldKit.this.text.setValue(t); - } - else - { - WindowFieldKit.this.text.setValue(""); - } - } - }.setOrigin(EventHandler.Origin.DirectChild, this.chromo)); - } - - public void initialiseServer() - { - ItemStack kit = getPlayer().getHeldItem(); - int sheets = 64 - kit.getItemDamage(); - if (sheets != 0) { - getWindowInventory().setInventorySlotContents(1, new ItemStack(Items.paper, sheets)); - } - setupValidators(); - } - - private float glassOffsetX = 0.0F; - private float glassOffsetY = 0.0F; - private float glassVX = 0.0F; - private float glassVY = 0.0F; - private Random glassRand = new Random(); - private Control GlassControl; - private ControlChromosome chromo; - private ControlText text; - private float analyseProgress = 1.0F; - private boolean isAnalysing = false; - - public void onUpdateClient() - { - super.onUpdateClient(); - if (this.isAnalysing) - { - this.analyseProgress += 0.01F; - if (this.analyseProgress >= 1.0F) - { - this.isAnalysing = false; - this.analyseProgress = 1.0F; - ItemStack stack = getWindowInventory().getStackInSlot(0); - if (stack != null) { - sendClientAction("analyse", new NBTTagCompound()); - } - refreshSpecies(); - } - } - this.glassVX += this.glassRand.nextFloat() - 0.5F - this.glassOffsetX * 0.2F; - this.glassVY += this.glassRand.nextFloat() - 0.5F - this.glassOffsetY * 0.2F; - - this.glassOffsetX += this.glassVX; - this.glassOffsetX *= (1.0F - this.analyseProgress); - this.glassOffsetY += this.glassVY; - this.glassOffsetY *= (1.0F - this.analyseProgress); - - this.GlassControl.setOffset(new IPoint(this.glassOffsetX, this.glassOffsetY)); - } - - private Map info = new HashMap(); - - private void refreshSpecies() - { - ItemStack item = getWindowInventory().getStackInSlot(0); - if ((item == null) || (!AlleleManager.alleleRegistry.isIndividual(item))) { - return; - } - IIndividual ind = AlleleManager.alleleRegistry.getIndividual(item); - if (ind == null) { - return; - } - ISpeciesRoot root = AlleleManager.alleleRegistry.getSpeciesRoot(item); - this.chromo.setRoot(root); - Random rand = new Random(); - this.info.clear(); - for (IChromosomeType type : root.getKaryotype()) { - if (!Binnie.Genetics.isInvalidChromosome(type)) - { - IAllele allele = ind.getGenome().getActiveAllele(type); - List infos = new ArrayList(); - int i = 0; - String pref = root.getUID() + ".fieldkit." + type.getName().toLowerCase() + "."; - while (Binnie.Language.canLocalise(pref + i)) - { - infos.add(Binnie.Language.localise(pref + i)); - i++; - } - String text = Binnie.Genetics.getSystem(root).getAlleleName(type, allele); - if (!infos.isEmpty()) { - text = (String)infos.get(rand.nextInt(infos.size())); - } - this.info.put(type, text); - this.chromo.setRoot(root); - } - } - } - - private ItemStack prev = null; - - public void onWindowInventoryChanged() - { - super.onWindowInventoryChanged(); - if (isServer()) - { - ItemStack kit = getPlayer().getHeldItem(); - int sheets = 64 - kit.getItemDamage(); - int size = getWindowInventory().getStackInSlot(1) == null ? 0 : getWindowInventory().getStackInSlot(1).stackSize; - if (sheets != size) { - kit.setItemDamage(64 - size); - } - ((EntityPlayerMP)getPlayer()).updateHeldItem(); - } - if (isClient()) - { - ItemStack item = getWindowInventory().getStackInSlot(0); - this.prev = item; - this.text.setValue(""); - if ((item != null) && (!Analyser.isAnalysed(item))) - { - if (getWindowInventory().getStackInSlot(1) == null) - { - this.text.setValue("No Paper!"); - this.isAnalysing = false; - this.analyseProgress = 1.0F; - } - else - { - startAnalysing(); - this.chromo.setRoot(null); - if (!damageKit()) {} - } - } - else if (item != null) - { - this.isAnalysing = false; - this.analyseProgress = 1.0F; - refreshSpecies(); - if (!damageKit()) {} - } - else - { - this.isAnalysing = false; - this.analyseProgress = 1.0F; - - this.chromo.setRoot(null); - } - } - } - - private boolean damageKit() - { - return false; - } - - private void startAnalysing() - { - this.glassVX = 0.0F; - this.glassVY = 0.0F; - this.glassOffsetX = 0.0F; - this.glassOffsetY = 0.0F; - this.isAnalysing = true; - this.analyseProgress = 0.0F; - } - - public boolean showHelpButton() - { - return true; - } - - public String showInfoButton() - { - return "The Field Kit analyses bees, trees, flowers and butterflies. All that is required is a piece of paper to jot notes"; - } - - public void recieveGuiNBT(Side side, EntityPlayer player, String name, NBTTagCompound action) - { - super.recieveGuiNBT(side, player, name, action); - if ((side == Side.SERVER) && (name.equals("analyse"))) - { - getWindowInventory().setInventorySlotContents(0, Analyser.analyse(getWindowInventory().getStackInSlot(0))); - getWindowInventory().decrStackSize(1, 1); - } - } - - static class StyleSheetPunnett - extends StyleSheet - { - public StyleSheetPunnett() - { - this.textures.put(CraftGUITexture.Window, new PaddedTexture(0, 0, 160, 160, 0, ExtraBeeTexture.GUIPunnett, 32, 32, 32, 32)); - this.textures.put(CraftGUITexture.Slot, new StandardTexture(160, 0, 18, 18, 0, ExtraBeeTexture.GUIPunnett)); - this.textures.put(ExtraBeeGUITexture.Chromosome, new StandardTexture(160, 36, 16, 16, 0, ExtraBeeTexture.GUIPunnett)); - this.textures.put(ExtraBeeGUITexture.Chromosome2, new StandardTexture(160, 52, 16, 16, 0, ExtraBeeTexture.GUIPunnett)); - this.textures.put(CraftGUITexture.HelpButton, new StandardTexture(178, 0, 16, 16, 0, ExtraBeeTexture.GUIPunnett)); - this.textures.put(CraftGUITexture.InfoButton, new StandardTexture(178, 16, 16, 16, 0, ExtraBeeTexture.GUIPunnett)); - } - } -} diff --git a/src/Java/binnie/craftgui/binniecore/WindowGenesis.java b/src/Java/binnie/craftgui/binniecore/WindowGenesis.java deleted file mode 100644 index 8295645f5a..0000000000 --- a/src/Java/binnie/craftgui/binniecore/WindowGenesis.java +++ /dev/null @@ -1,264 +0,0 @@ -package binnie.craftgui.binniecore; - -import binnie.Binnie; -import binnie.core.AbstractMod; -import binnie.core.BinnieCore; -import binnie.core.genetics.BreedingSystem; -import binnie.core.genetics.Gene; -import binnie.core.genetics.ManagerGenetics; -import binnie.craftgui.controls.listbox.ControlList; -import binnie.craftgui.controls.listbox.ControlListBox; -import binnie.craftgui.controls.listbox.ControlTextOption; -import binnie.craftgui.controls.tab.ControlTab; -import binnie.craftgui.controls.tab.ControlTabBar; -import binnie.craftgui.core.IWidget; -import binnie.craftgui.core.geometry.IArea; -import binnie.craftgui.core.geometry.Position; -import binnie.craftgui.events.EventHandler.Origin; -import binnie.craftgui.events.EventMouse.Down; -import binnie.craftgui.events.EventMouse.Down.Handler; -import binnie.craftgui.events.EventValueChanged; -import binnie.craftgui.events.EventValueChanged.Handler; -import binnie.craftgui.minecraft.MinecraftGUI.PanelType; -import binnie.craftgui.minecraft.Window; -import binnie.craftgui.minecraft.control.ControlItemDisplay; -import binnie.craftgui.minecraft.control.ControlPlayerInventory; -import binnie.craftgui.minecraft.control.ControlTabIcon; -import binnie.craftgui.window.Panel; -import binnie.genetics.gui.ControlGenesisOption; -import cpw.mods.fml.relauncher.Side; -import forestry.api.genetics.IAllele; -import forestry.api.genetics.IChromosomeType; -import forestry.api.genetics.IIndividual; -import forestry.api.genetics.ISpeciesRoot; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; - -public class WindowGenesis - extends Window -{ - private ISpeciesRoot root; - private IAllele[] template; - private ControlListBox geneList; - private ControlListBox geneOptions; - private Panel panelPickup; - - public WindowGenesis(EntityPlayer player, IInventory inventory, Side side) - { - super(342.0F, 228.0F, player, inventory, side); - } - - protected AbstractMod getMod() - { - return BinnieCore.instance; - } - - protected String getName() - { - return "Genesis"; - } - - public void initialiseClient() - { - new ControlPlayerInventory(this); - setTitle("Genesis"); - - ControlTabBar tabSystems = new ControlTabBar(this, 8.0F, 28.0F, 23.0F, 100.0F, Position.Left) - { - public ControlTab createTab(float x, float y, float w, float h, BreedingSystem value) - { - new ControlTabIcon(this, x, y, w, h, value) - { - public ItemStack getItemStack() - { - int type = ((BreedingSystem)this.value).getDefaultType(); - IIndividual ind = ((BreedingSystem)this.value).getDefaultIndividual(); - return ((BreedingSystem)this.value).getSpeciesRoot().getMemberStack(ind, type); - } - - public String getName() - { - return ((BreedingSystem)this.value).getName(); - } - - public int getOutlineColour() - { - return ((BreedingSystem)this.value).getColour(); - } - - public boolean hasOutline() - { - return true; - } - }; - } - }; - tabSystems.setValues(Binnie.Genetics.getActiveSystems()); - - this.root = ((BreedingSystem)Binnie.Genetics.getActiveSystems().iterator().next()).getSpeciesRoot(); - this.template = this.root.getDefaultTemplate(); - - IArea one = new IArea(32.0F, 28.0F, 170.0F, 100.0F); - IArea two = new IArea(214.0F, 28.0F, 100.0F, 100.0F); - - new Panel(this, one.outset(1), MinecraftGUI.PanelType.Black); - new Panel(this, two.outset(1), MinecraftGUI.PanelType.Black); - - this.geneList = new ControlListBox(this, one.x(), one.y(), one.w(), one.h(), 10.0F) - { - public IWidget createOption(Gene value, int y) - { - return new ControlGenesisOption((ControlList)getContent(), value, y); - } - }; - this.geneOptions = new ControlListBox(this, two.x(), two.y(), two.w(), two.h(), 10.0F) - { - public IWidget createOption(Gene value, int y) - { - return new ControlTextOption((ControlList)getContent(), value, y); - } - }; - tabSystems.addEventHandler(new EventValueChanged.Handler() - { - public void onEvent(EventValueChanged event) - { - WindowGenesis.this.root = ((BreedingSystem)event.getValue()).getSpeciesRoot(); - WindowGenesis.this.template = WindowGenesis.this.root.getDefaultTemplate(); - WindowGenesis.this.refreshTemplate(null); - } - }.setOrigin(EventHandler.Origin.Self, tabSystems)); - - - - this.geneList.addEventHandler(new EventValueChanged.Handler() - { - public void onEvent(EventValueChanged event) - { - Map> map = Binnie.Genetics.getChromosomeMap(WindowGenesis.this.root); - List opts = new ArrayList(); - IChromosomeType chromo = ((Gene)event.value).getChromosome(); - for (IAllele allele : (List)map.get(chromo)) { - opts.add(new Gene(allele, chromo, WindowGenesis.this.root)); - } - WindowGenesis.this.geneOptions.setOptions(opts); - } - }.setOrigin(EventHandler.Origin.Self, this.geneList)); - - - - this.geneOptions.addEventHandler(new EventValueChanged.Handler() - { - public void onEvent(EventValueChanged event) - { - if (event.value == null) { - return; - } - IChromosomeType chromo = ((Gene)event.value).getChromosome(); - WindowGenesis.this.template[chromo.ordinal()] = ((Gene)event.value).getAllele(); - if (chromo == ((Gene)event.value).getSpeciesRoot().getKaryotypeKey()) { - WindowGenesis.this.template = ((Gene)event.value).getSpeciesRoot().getTemplate(((Gene)event.value).getAllele().getUID()); - } - WindowGenesis.this.refreshTemplate(chromo); - } - }.setOrigin(EventHandler.Origin.Self, this.geneOptions)); - - - - - this.panelPickup = new Panel(this, 16.0F, 140.0F, 60.0F, 42.0F, MinecraftGUI.PanelType.Black); - - refreshTemplate(null); - } - - private void refreshTemplate(IChromosomeType selection) - { - List genes = new ArrayList(); - IChromosomeType[] chromos = (IChromosomeType[])Binnie.Genetics.getChromosomeMap(this.root).keySet().toArray(new IChromosomeType[0]); - for (IChromosomeType type : chromos) - { - IAllele allele = this.template[type.ordinal()]; - if (allele == null) { - throw new NullPointerException("Allele missing for Chromosome " + type.getName()); - } - genes.add(new Gene(allele, type, this.root)); - } - Map> map = Binnie.Genetics.getChromosomeMap(this.root); - this.geneList.setOptions(genes); - if (selection != null) { - this.geneList.setValue(new Gene(this.template[selection.ordinal()], selection, this.root)); - } else { - this.geneOptions.setOptions(new ArrayList()); - } - refreshPickup(); - } - - private void refreshPickup() - { - this.panelPickup.deleteAllChildren(); - int i = 0; - for (int type : Binnie.Genetics.getSystem(this.root).getActiveTypes()) - { - IIndividual ind = this.root.templateAsIndividual(this.template); - ind.analyze(); - final ItemStack stack = this.root.getMemberStack(ind, type); - ControlItemDisplay display = new ControlItemDisplay(this.panelPickup, 4 + i % 3 * 18, 4 + i / 3 * 18); - display.setItemStack(stack); - display.setTooltip(); - display.addEventHandler(new EventMouse.Down.Handler() - { - public void onEvent(EventMouse.Down event) - { - NBTTagCompound nbt = new NBTTagCompound(); - stack.writeToNBT(nbt); - Window.get(event.getOrigin()).sendClientAction("genesis", nbt); - } - }.setOrigin(EventHandler.Origin.Self, display)); - - - - i++; - } - } - - public void recieveGuiNBT(Side side, EntityPlayer player, String name, NBTTagCompound action) - { - super.recieveGuiNBT(side, player, name, action); - if ((side == Side.SERVER) && (name.equals("genesis"))) - { - ItemStack stack = ItemStack.loadItemStackFromNBT(action); - InventoryPlayer playerInv = player.inventory; - if (stack == null) { - return; - } - if (playerInv.getItemStack() == null) - { - playerInv.setItemStack(stack); - } - else if ((playerInv.getItemStack().isItemEqual(stack)) && (ItemStack.areItemStackTagsEqual(playerInv.getItemStack(), stack))) - { - int fit = stack.getMaxStackSize() - (stack.stackSize + playerInv.getItemStack().stackSize); - if (fit >= 0) - { - ItemStack rec = stack; - rec.stackSize += playerInv.getItemStack().stackSize; - playerInv.setItemStack(rec); - } - } - player.openContainer.detectAndSendChanges(); - if ((player instanceof EntityPlayerMP)) { - ((EntityPlayerMP)player).updateHeldItem(); - } - } - } -} diff --git a/src/Java/binnie/craftgui/controls/ControlCheckbox.java b/src/Java/binnie/craftgui/controls/ControlCheckbox.java deleted file mode 100644 index edfeab631c..0000000000 --- a/src/Java/binnie/craftgui/controls/ControlCheckbox.java +++ /dev/null @@ -1,75 +0,0 @@ -package binnie.craftgui.controls; - -import binnie.craftgui.controls.core.Control; -import binnie.craftgui.controls.core.IControlValue; -import binnie.craftgui.core.Attribute; -import binnie.craftgui.core.CraftGUI; -import binnie.craftgui.core.IWidget; -import binnie.craftgui.core.geometry.IArea; -import binnie.craftgui.core.geometry.IPoint; -import binnie.craftgui.core.geometry.TextJustification; -import binnie.craftgui.core.renderer.Renderer; -import binnie.craftgui.events.EventHandler.Origin; -import binnie.craftgui.events.EventMouse.Down; -import binnie.craftgui.events.EventMouse.Down.Handler; -import binnie.craftgui.events.EventValueChanged; -import binnie.craftgui.resource.minecraft.CraftGUITexture; - -public class ControlCheckbox - extends Control - implements IControlValue -{ - boolean value; - String text; - - public ControlCheckbox(IWidget parent, float x, float y, boolean bool) - { - this(parent, x, y, 0.0F, "", bool); - } - - public ControlCheckbox(IWidget parent, float x, float y, float w, String text, boolean bool) - { - super(parent, x, y, w > 16.0F ? w : 16.0F, 16.0F); - this.text = text; - this.value = bool; - if (w > 16.0F) { - new ControlText(this, new IArea(16.0F, 1.0F, w - 16.0F, 16.0F), text, TextJustification.MiddleCenter).setColour(4473924); - } - addAttribute(Attribute.MouseOver); - addEventHandler(new EventMouse.Down.Handler() - { - public void onEvent(EventMouse.Down event) - { - ControlCheckbox.this.toggleValue(); - } - }.setOrigin(EventHandler.Origin.Self, this)); - } - - protected void onValueChanged(boolean value) {} - - public Boolean getValue() - { - return Boolean.valueOf(this.value); - } - - public void setValue(Boolean value) - { - this.value = value.booleanValue(); - onValueChanged(value.booleanValue()); - callEvent(new EventValueChanged(this, value)); - } - - public void toggleValue() - { - setValue(Boolean.valueOf(!getValue().booleanValue())); - } - - public void onRenderBackground() - { - Object texture = getValue().booleanValue() ? CraftGUITexture.CheckboxChecked : CraftGUITexture.Checkbox; - if (isMouseOver()) { - texture = getValue().booleanValue() ? CraftGUITexture.CheckboxCheckedHighlighted : CraftGUITexture.CheckboxHighlighted; - } - CraftGUI.Render.texture(texture, IPoint.ZERO); - } -} diff --git a/src/Java/binnie/craftgui/controls/ControlText.java b/src/Java/binnie/craftgui/controls/ControlText.java deleted file mode 100644 index 4df9c04db1..0000000000 --- a/src/Java/binnie/craftgui/controls/ControlText.java +++ /dev/null @@ -1,50 +0,0 @@ -package binnie.craftgui.controls; - -import binnie.craftgui.controls.core.Control; -import binnie.craftgui.controls.core.IControlValue; -import binnie.craftgui.core.CraftGUI; -import binnie.craftgui.core.IWidget; -import binnie.craftgui.core.geometry.IArea; -import binnie.craftgui.core.geometry.IPoint; -import binnie.craftgui.core.geometry.TextJustification; -import binnie.craftgui.core.renderer.Renderer; - -public class ControlText - extends Control - implements IControlValue -{ - private String text; - private TextJustification align; - - public ControlText(IWidget parent, IPoint pos, String text) - { - this(parent, new IArea(pos, new IPoint(500.0F, 0.0F)), text, TextJustification.TopLeft); - } - - public ControlText(IWidget parent, String text, TextJustification align) - { - this(parent, parent.getArea(), text, align); - } - - public ControlText(IWidget parent, IArea area, String text, TextJustification align) - { - super(parent, area.pos().x(), area.pos().y(), area.size().x(), area.size().y()); - setValue(text); - this.align = align; - } - - public void onRenderBackground() - { - CraftGUI.Render.text(getArea(), this.align, this.text, getColour()); - } - - public void setValue(String text) - { - this.text = text; - } - - public String getValue() - { - return this.text; - } -} diff --git a/src/Java/binnie/craftgui/controls/ControlTextCentered.java b/src/Java/binnie/craftgui/controls/ControlTextCentered.java deleted file mode 100644 index 12434528db..0000000000 --- a/src/Java/binnie/craftgui/controls/ControlTextCentered.java +++ /dev/null @@ -1,15 +0,0 @@ -package binnie.craftgui.controls; - -import binnie.craftgui.core.IWidget; -import binnie.craftgui.core.geometry.IArea; -import binnie.craftgui.core.geometry.IPoint; -import binnie.craftgui.core.geometry.TextJustification; - -public class ControlTextCentered - extends ControlText -{ - public ControlTextCentered(IWidget parent, float y, String text) - { - super(parent, new IArea(new IPoint(0.0F, y), new IPoint(parent.size().x(), 0.0F)), text, TextJustification.TopCenter); - } -} diff --git a/src/Java/binnie/craftgui/controls/ControlTextEdit.java b/src/Java/binnie/craftgui/controls/ControlTextEdit.java deleted file mode 100644 index 8c07a12d7c..0000000000 --- a/src/Java/binnie/craftgui/controls/ControlTextEdit.java +++ /dev/null @@ -1,154 +0,0 @@ -package binnie.craftgui.controls; - -import binnie.craftgui.controls.core.Control; -import binnie.craftgui.controls.core.IControlValue; -import binnie.craftgui.core.Attribute; -import binnie.craftgui.core.CraftGUI; -import binnie.craftgui.core.IWidget; -import binnie.craftgui.core.geometry.IPoint; -import binnie.craftgui.core.renderer.Renderer; -import binnie.craftgui.events.EventHandler.Origin; -import binnie.craftgui.events.EventKey.Down; -import binnie.craftgui.events.EventKey.Down.Handler; -import binnie.craftgui.events.EventMouse.Down; -import binnie.craftgui.events.EventMouse.Down.Handler; -import binnie.craftgui.events.EventTextEdit; -import binnie.craftgui.events.EventWidget.GainFocus; -import binnie.craftgui.events.EventWidget.GainFocus.Handler; -import binnie.craftgui.events.EventWidget.LoseFocus; -import binnie.craftgui.events.EventWidget.LoseFocus.Handler; -import binnie.craftgui.minecraft.GuiCraftGUI; -import binnie.craftgui.minecraft.Window; -import binnie.craftgui.resource.minecraft.CraftGUITexture; -import net.minecraft.client.gui.GuiTextField; - -public class ControlTextEdit - extends Control - implements IControlValue -{ - GuiTextField field; - - public ControlTextEdit(IWidget parent, float x, float y, float width, float height) - { - super(parent, x, y, width, height); - - this.field = new GuiTextField(getWindow().getGui().getFontRenderer(), 0, 0, 10, 10); - addAttribute(Attribute.CanFocus); - addAttribute(Attribute.MouseOver); - this.field.setEnableBackgroundDrawing(false); - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - addEventHandler(new EventKey.Down.Handler() - { - public void onEvent(EventKey.Down event) - { - ControlTextEdit.this.field.textboxKeyTyped(event.getCharacter(), event.getKey()); - String text = ControlTextEdit.this.getValue(); - if (!text.equals(ControlTextEdit.this.cachedValue)) - { - ControlTextEdit.this.cachedValue = text; - ControlTextEdit.this.callEvent(new EventTextEdit(ControlTextEdit.this, ControlTextEdit.this.cachedValue)); - ControlTextEdit.this.onTextEdit(ControlTextEdit.this.cachedValue); - } - } - }.setOrigin(EventHandler.Origin.Self, this)); - - - - - addEventHandler(new EventMouse.Down.Handler() - { - public void onEvent(EventMouse.Down event) - { - ControlTextEdit.this.field.mouseClicked((int)ControlTextEdit.this.getRelativeMousePosition().x(), (int)ControlTextEdit.this.getRelativeMousePosition().y(), event.getButton()); - } - }.setOrigin(EventHandler.Origin.Self, this)); - - - - addEventHandler(new EventWidget.GainFocus.Handler() - { - public void onEvent(EventWidget.GainFocus event) - { - ControlTextEdit.this.field.setFocused(true); - } - }.setOrigin(EventHandler.Origin.Self, this)); - - - - addEventHandler(new EventWidget.LoseFocus.Handler() - { - public void onEvent(EventWidget.LoseFocus event) - { - ControlTextEdit.this.field.setFocused(false); - } - }.setOrigin(EventHandler.Origin.Self, this)); - } - - public String getValue() - { - return this.field.getText() == null ? "" : this.field.getText(); - } - - public void setValue(String value) - { - if (!getValue().equals(value)) - { - this.field.setText(value); - this.field.setCursorPosition(0); - } - } - - private String cachedValue = ""; - - public void onUpdateClient() {} - - protected void onTextEdit(String value) {} - - public void onRenderBackground() - { - CraftGUI.Render.texture(CraftGUITexture.Slot, getArea()); - renderTextField(); - } - - protected void renderTextField() - { - this.field.width = ((int)w()); - this.field.height = ((int)h()); - this.field.xPosition = ((int)((h() - 8.0F) / 2.0F)); - this.field.yPosition = ((int)((h() - 8.0F) / 2.0F)); - this.field.drawTextBox(); - } -} diff --git a/src/Java/binnie/craftgui/controls/IControlSelection.java b/src/Java/binnie/craftgui/controls/IControlSelection.java deleted file mode 100644 index 4648f49290..0000000000 --- a/src/Java/binnie/craftgui/controls/IControlSelection.java +++ /dev/null @@ -1,10 +0,0 @@ -package binnie.craftgui.controls; - -public abstract interface IControlSelection -{ - public abstract T getSelectedValue(); - - public abstract void setSelectedValue(T paramT); - - public abstract boolean isSelected(IControlSelectionOption paramIControlSelectionOption); -} diff --git a/src/Java/binnie/craftgui/controls/IControlSelectionOption.java b/src/Java/binnie/craftgui/controls/IControlSelectionOption.java deleted file mode 100644 index 9074a55541..0000000000 --- a/src/Java/binnie/craftgui/controls/IControlSelectionOption.java +++ /dev/null @@ -1,6 +0,0 @@ -package binnie.craftgui.controls; - -public abstract interface IControlSelectionOption -{ - public abstract T getValue(); -} diff --git a/src/Java/binnie/craftgui/controls/button/ControlButton.java b/src/Java/binnie/craftgui/controls/button/ControlButton.java deleted file mode 100644 index b41cb65116..0000000000 --- a/src/Java/binnie/craftgui/controls/button/ControlButton.java +++ /dev/null @@ -1,70 +0,0 @@ -package binnie.craftgui.controls.button; - -import binnie.craftgui.controls.ControlText; -import binnie.craftgui.controls.core.Control; -import binnie.craftgui.core.Attribute; -import binnie.craftgui.core.CraftGUI; -import binnie.craftgui.core.IWidget; -import binnie.craftgui.core.geometry.TextJustification; -import binnie.craftgui.core.renderer.Renderer; -import binnie.craftgui.events.EventButtonClicked; -import binnie.craftgui.events.EventHandler.Origin; -import binnie.craftgui.events.EventMouse.Down; -import binnie.craftgui.events.EventMouse.Down.Handler; -import binnie.craftgui.resource.minecraft.CraftGUITexture; - -public class ControlButton - extends Control -{ - private ControlText textWidget; - private String text; - - public ControlButton(IWidget parent, float x, float y, float width, float height) - { - super(parent, x, y, width, height); - - addAttribute(Attribute.MouseOver); - - addEventHandler(new EventMouse.Down.Handler() - { - public void onEvent(EventMouse.Down event) - { - ControlButton.this.callEvent(new EventButtonClicked(ControlButton.this.getWidget())); - ControlButton.this.onMouseClick(event); - } - }.setOrigin(EventHandler.Origin.Self, this)); - } - - protected void onMouseClick(EventMouse.Down event) {} - - public ControlButton(IWidget parent, float x, float y, float width, float height, String text) - { - this(parent, x, y, width, height); - - this.text = text; - this.textWidget = new ControlText(this, getArea(), text, TextJustification.MiddleCenter); - } - - public void onUpdateClient() - { - if (this.textWidget != null) { - this.textWidget.setValue(getText()); - } - } - - public String getText() - { - return this.text; - } - - public void onRenderBackground() - { - Object texture = CraftGUITexture.ButtonDisabled; - if (isMouseOver()) { - texture = CraftGUITexture.ButtonHighlighted; - } else if (isEnabled()) { - texture = CraftGUITexture.Button; - } - CraftGUI.Render.texture(texture, getArea()); - } -} diff --git a/src/Java/binnie/craftgui/controls/button/ControlEnumButton.java b/src/Java/binnie/craftgui/controls/button/ControlEnumButton.java deleted file mode 100644 index 924bd8c110..0000000000 --- a/src/Java/binnie/craftgui/controls/button/ControlEnumButton.java +++ /dev/null @@ -1,61 +0,0 @@ -package binnie.craftgui.controls.button; - -import binnie.craftgui.controls.core.IControlValue; -import binnie.craftgui.core.IWidget; -import binnie.craftgui.events.EventMouse.Down; -import binnie.craftgui.events.EventValueChanged; -import java.util.ArrayList; -import java.util.List; - -public class ControlEnumButton - extends ControlButton - implements IControlValue -{ - public static final String eventEnumChanged = "eventEnumButtonChanged"; - private T currentSelection; - - public String getText() - { - return this.currentSelection.toString(); - } - - public void onMouseClick(EventMouse.Down event) - { - int index = this.enumConstants.indexOf(this.currentSelection); - if (index < this.enumConstants.size() - 1) { - index++; - } else { - index = 0; - } - T newEnum = this.enumConstants.get(index); - - setValue(newEnum); - } - - public void setValue(T selection) - { - if (this.currentSelection != selection) - { - this.currentSelection = selection; - callEvent(new EventValueChanged(this, getValue())); - } - } - - private List enumConstants = new ArrayList(); - - public ControlEnumButton(IWidget parent, float x, float y, float width, float height, T[] values) - { - super(parent, x, y, width, height, ""); - for (T value : values) { - this.enumConstants.add(value); - } - if (values.length > 0) { - this.currentSelection = values[0]; - } - } - - public T getValue() - { - return this.currentSelection; - } -} diff --git a/src/Java/binnie/craftgui/controls/button/ControlToggleButton.java b/src/Java/binnie/craftgui/controls/button/ControlToggleButton.java deleted file mode 100644 index 1a06801fbd..0000000000 --- a/src/Java/binnie/craftgui/controls/button/ControlToggleButton.java +++ /dev/null @@ -1,21 +0,0 @@ -package binnie.craftgui.controls.button; - -import binnie.craftgui.core.IWidget; -import binnie.craftgui.events.EventMouse.Down; -import binnie.craftgui.events.EventToggleButtonClicked; - -public class ControlToggleButton - extends ControlButton -{ - boolean toggled; - - public void onMouseClick(EventMouse.Down event) - { - callEvent(new EventToggleButtonClicked(this, this.toggled)); - } - - public ControlToggleButton(IWidget parent, int x, int y, int width, int height) - { - super(parent, x, y, width, height); - } -} diff --git a/src/Java/binnie/craftgui/controls/core/Control.java b/src/Java/binnie/craftgui/controls/core/Control.java deleted file mode 100644 index f5f7bddabb..0000000000 --- a/src/Java/binnie/craftgui/controls/core/Control.java +++ /dev/null @@ -1,85 +0,0 @@ -package binnie.craftgui.controls.core; - -import binnie.craftgui.core.Attribute; -import binnie.craftgui.core.ITooltip; -import binnie.craftgui.core.ITooltipHelp; -import binnie.craftgui.core.IWidget; -import binnie.craftgui.core.Tooltip; -import binnie.craftgui.core.Widget; -import binnie.craftgui.core.geometry.IArea; -import binnie.craftgui.core.geometry.IPoint; -import binnie.craftgui.minecraft.Window; -import java.util.ArrayList; -import java.util.List; - -public class Control - extends Widget - implements ITooltipHelp, ITooltip -{ - public Control(IWidget parent, float x, float y, float w, float h) - { - super(parent); - setPosition(new IPoint(x, y)); - setSize(new IPoint(w, h)); - initialise(); - } - - public Control(IWidget parent, IArea area) - { - this(parent, area.x(), area.y(), area.w(), area.h()); - } - - List helpStrings = new ArrayList(); - List tooltipStrings = new ArrayList(); - - protected void initialise() {} - - public void onUpdateClient() {} - - public void addHelp(String string) - { - this.helpStrings.add(string); - } - - public void addHelp(String[] strings) - { - for (String string : strings) { - addHelp(string); - } - } - - public void addTooltip(String string) - { - addAttribute(Attribute.MouseOver); - this.tooltipStrings.add(string); - } - - public void addTooltip(String[] strings) - { - for (String string : strings) { - addTooltip(string); - } - } - - public int extraLevel = 0; - - public int getLevel() - { - return this.extraLevel + super.getLevel(); - } - - public void getHelpTooltip(Tooltip tooltip) - { - tooltip.add(this.helpStrings); - } - - public void getTooltip(Tooltip tooltip) - { - tooltip.add(this.tooltipStrings); - } - - public Window getWindow() - { - return (Window)getSuperParent(); - } -} diff --git a/src/Java/binnie/craftgui/controls/core/IControlIndexed.java b/src/Java/binnie/craftgui/controls/core/IControlIndexed.java deleted file mode 100644 index a30bceb76c..0000000000 --- a/src/Java/binnie/craftgui/controls/core/IControlIndexed.java +++ /dev/null @@ -1,8 +0,0 @@ -package binnie.craftgui.controls.core; - -public abstract interface IControlIndexed -{ - public abstract int getIndex(); - - public abstract void setIndex(int paramInt); -} diff --git a/src/Java/binnie/craftgui/controls/core/IControlValue.java b/src/Java/binnie/craftgui/controls/core/IControlValue.java deleted file mode 100644 index 9d44b8ad17..0000000000 --- a/src/Java/binnie/craftgui/controls/core/IControlValue.java +++ /dev/null @@ -1,11 +0,0 @@ -package binnie.craftgui.controls.core; - -import binnie.craftgui.core.IWidget; - -public abstract interface IControlValue - extends IWidget -{ - public abstract T getValue(); - - public abstract void setValue(T paramT); -} diff --git a/src/Java/binnie/craftgui/controls/core/IControlValues.java b/src/Java/binnie/craftgui/controls/core/IControlValues.java deleted file mode 100644 index 92bb5d1f13..0000000000 --- a/src/Java/binnie/craftgui/controls/core/IControlValues.java +++ /dev/null @@ -1,11 +0,0 @@ -package binnie.craftgui.controls.core; - -import java.util.Collection; - -public abstract interface IControlValues - extends IControlValue -{ - public abstract Collection getValues(); - - public abstract void setValues(Collection paramCollection); -} diff --git a/src/Java/binnie/craftgui/controls/listbox/ControlList.java b/src/Java/binnie/craftgui/controls/listbox/ControlList.java deleted file mode 100644 index d1b6be8821..0000000000 --- a/src/Java/binnie/craftgui/controls/listbox/ControlList.java +++ /dev/null @@ -1,146 +0,0 @@ -package binnie.craftgui.controls.listbox; - -import binnie.core.util.IValidator; -import binnie.craftgui.controls.core.Control; -import binnie.craftgui.controls.core.IControlValue; -import binnie.craftgui.core.IWidget; -import binnie.craftgui.core.geometry.IPoint; -import binnie.craftgui.events.EventValueChanged; -import java.util.Collection; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Map.Entry; - -public class ControlList - extends Control - implements IControlValue -{ - ControlListBox parent; - - protected ControlList(ControlListBox parent, float x, float y, float w, float h) - { - super(parent, x, y, w, h); - this.parent = parent; - } - - T value = null; - Map allOptions = new LinkedHashMap(); - Map optionWidgets = new LinkedHashMap(); - - public T getValue() - { - return this.value; - } - - public void setValue(T value) - { - if (value == this.value) { - return; - } - this.value = value; - if ((value != null) && (this.optionWidgets.containsKey(value))) - { - IWidget child = (IWidget)this.optionWidgets.get(value); - this.parent.ensureVisible(child.y(), child.y() + child.h(), h()); - } - getParent().callEvent(new EventValueChanged(getParent(), value)); - } - - boolean creating = false; - IValidator validator; - - public void setOptions(Collection options) - { - deleteAllChildren(); - this.allOptions.clear(); - int i = 0; - for (T option : options) - { - IWidget optionWidget = ((ControlListBox)getParent()).createOption(option, 0); - if (optionWidget != null) { - this.allOptions.put(option, optionWidget); - } - i++; - } - filterOptions(); - } - - public void filterOptions() - { - int height = 0; - this.optionWidgets.clear(); - for (Map.Entry entry : this.allOptions.entrySet()) { - if (isValidOption((IWidget)entry.getValue())) - { - ((IWidget)entry.getValue()).show(); - this.optionWidgets.put(entry.getKey(), entry.getValue()); - ((IWidget)entry.getValue()).setPosition(new IPoint(0.0F, height)); - height = (int)(height + ((IWidget)entry.getValue()).getSize().y()); - } - else - { - ((IWidget)entry.getValue()).hide(); - } - } - this.creating = true; - setValue(getValue()); - setSize(new IPoint(getSize().x(), height)); - } - - public Collection getOptions() - { - return this.optionWidgets.keySet(); - } - - public Collection getAllOptions() - { - return this.allOptions.keySet(); - } - - public int getIndexOf(T value) - { - int index = 0; - for (T option : getOptions()) - { - if (option.equals(value)) { - return index; - } - index++; - } - return -1; - } - - public int getCurrentIndex() - { - return getIndexOf(getValue()); - } - - public void setIndex(int currentIndex) - { - int index = 0; - for (T option : getOptions()) - { - if (index == currentIndex) - { - setValue(option); - return; - } - index++; - } - setValue(null); - } - - private boolean isValidOption(IWidget widget) - { - return this.validator == null ? true : this.validator.isValid(widget); - } - - public void setValidator(IValidator validator) - { - if (this.validator != validator) - { - this.validator = validator; - filterOptions(); - } - } -} diff --git a/src/Java/binnie/craftgui/controls/listbox/ControlListBox.java b/src/Java/binnie/craftgui/controls/listbox/ControlListBox.java deleted file mode 100644 index e9370daa3d..0000000000 --- a/src/Java/binnie/craftgui/controls/listbox/ControlListBox.java +++ /dev/null @@ -1,76 +0,0 @@ -package binnie.craftgui.controls.listbox; - -import binnie.core.util.IValidator; -import binnie.craftgui.controls.core.IControlValue; -import binnie.craftgui.controls.scroll.ControlScrollableContent; -import binnie.craftgui.core.IWidget; -import binnie.craftgui.events.EventKey.Down; -import binnie.craftgui.events.EventKey.Down.Handler; -import java.util.Collection; - -public class ControlListBox - extends ControlScrollableContent> - implements IControlValue -{ - public ControlListBox(IWidget parent, float x, float y, float w, float h, float scrollBarSize) - { - super(parent, x, y, w, h, scrollBarSize); - } - - public void initialise() - { - setScrollableContent(new ControlList(this, 1.0F, 1.0F, w() - 2.0F - this.scrollBarSize, h() - 2.0F)); - - addEventHandler(new EventKey.Down.Handler() - { - public void onEvent(EventKey.Down event) - { - EventKey.Down eventKey = event; - if (ControlListBox.this.calculateIsMouseOver()) - { - int currentIndex = ((ControlList)ControlListBox.this.getContent()).getCurrentIndex(); - if (eventKey.getKey() == 208) - { - currentIndex++; - if (currentIndex >= ((ControlList)ControlListBox.this.getContent()).getOptions().size()) { - currentIndex = 0; - } - } - else if (eventKey.getKey() == 200) - { - currentIndex--; - if (currentIndex < 0) { - currentIndex = ((ControlList)ControlListBox.this.getContent()).getOptions().size() - 1; - } - } - ((ControlList)ControlListBox.this.getContent()).setIndex(currentIndex); - } - } - }); - } - - public final T getValue() - { - return ((ControlList