aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Java/binnie/Binnie.java24
-rw-r--r--src/Java/binnie/Constants.java11
-rw-r--r--src/Java/binnie/core/AbstractMod.java158
-rw-r--r--src/Java/binnie/core/BinnieCore.java259
-rw-r--r--src/Java/binnie/core/IInitializable.java10
-rw-r--r--src/Java/binnie/core/ManagerBase.java19
-rw-r--r--src/Java/binnie/core/Mods.java1
-rw-r--r--src/Java/binnie/core/block/BlockMetadata.java138
-rw-r--r--src/Java/binnie/core/block/IBlockMetadata.java21
-rw-r--r--src/Java/binnie/core/block/IMultipassBlock.java8
-rw-r--r--src/Java/binnie/core/block/ItemMetadata.java67
-rw-r--r--src/Java/binnie/core/block/ItemMetadataRenderer.java64
-rw-r--r--src/Java/binnie/core/block/MultipassBlockRenderer.java106
-rw-r--r--src/Java/binnie/core/block/MultipassItemRenderer.java78
-rw-r--r--src/Java/binnie/core/block/TileEntityMetadata.java116
-rw-r--r--src/Java/binnie/core/circuits/BinnieCircuit.java80
-rw-r--r--src/Java/binnie/core/circuits/BinnieCircuitLayout.java37
-rw-r--r--src/Java/binnie/core/genetics/BeeBreedingSystem.java125
-rw-r--r--src/Java/binnie/core/genetics/BeeModifierLogic.java47
-rw-r--r--src/Java/binnie/core/genetics/BreedingSystem.java558
-rw-r--r--src/Java/binnie/core/genetics/EnumBeeBooleanModifier.java8
-rw-r--r--src/Java/binnie/core/genetics/EnumBeeModifier.java17
-rw-r--r--src/Java/binnie/core/genetics/FlowerBreedingSystem.java129
-rw-r--r--src/Java/binnie/core/genetics/ForestryAllele.java211
-rw-r--r--src/Java/binnie/core/genetics/Gene.java128
-rw-r--r--src/Java/binnie/core/genetics/IAlleleProvider.java8
-rw-r--r--src/Java/binnie/core/genetics/IBreedingMessage.java124
-rw-r--r--src/Java/binnie/core/genetics/IItemStackRepresentitive.java8
-rw-r--r--src/Java/binnie/core/genetics/ManagerGenetics.java298
-rw-r--r--src/Java/binnie/core/genetics/MothBreedingSystem.java138
-rw-r--r--src/Java/binnie/core/genetics/Tolerance.java48
-rw-r--r--src/Java/binnie/core/genetics/TreeBreedingSystem.java303
-rw-r--r--src/Java/binnie/core/genetics/VirtualBeeHousing.java111
-rw-r--r--src/Java/binnie/core/genetics/VirtualHousing.java98
-rw-r--r--src/Java/binnie/core/genetics/VirtualMothHousing.java33
-rw-r--r--src/Java/binnie/core/gui/BinnieCoreGUI.java54
-rw-r--r--src/Java/binnie/core/gui/BinnieGUIHandler.java54
-rw-r--r--src/Java/binnie/core/gui/IBinnieGUID.java13
-rw-r--r--src/Java/binnie/core/item/IItemEnum.java14
-rw-r--r--src/Java/binnie/core/item/IItemMisc.java19
-rw-r--r--src/Java/binnie/core/item/ItemFieldKit.java82
-rw-r--r--src/Java/binnie/core/item/ItemGenesis.java42
-rw-r--r--src/Java/binnie/core/item/ItemMisc.java81
-rw-r--r--src/Java/binnie/core/item/ManagerItem.java11
-rw-r--r--src/Java/binnie/core/item/ModuleItems.java75
-rw-r--r--src/Java/binnie/core/language/ManagerLanguage.java59
-rw-r--r--src/Java/binnie/core/liquid/BinnieFluid.java32
-rw-r--r--src/Java/binnie/core/liquid/FluidContainer.java95
-rw-r--r--src/Java/binnie/core/liquid/IFluidType.java28
-rw-r--r--src/Java/binnie/core/liquid/ILiquidType.java7
-rw-r--r--src/Java/binnie/core/liquid/ItemFluidContainer.java179
-rw-r--r--src/Java/binnie/core/liquid/ManagerLiquid.java80
-rw-r--r--src/Java/binnie/core/machines/BlockMachine.java181
-rw-r--r--src/Java/binnie/core/machines/IBlockMachine.java8
-rw-r--r--src/Java/binnie/core/machines/IMachine.java25
-rw-r--r--src/Java/binnie/core/machines/IMachineType.java11
-rw-r--r--src/Java/binnie/core/machines/IOwnable.java10
-rw-r--r--src/Java/binnie/core/machines/ItemMachine.java29
-rw-r--r--src/Java/binnie/core/machines/Machine.java320
-rw-r--r--src/Java/binnie/core/machines/MachineComponent.java61
-rw-r--r--src/Java/binnie/core/machines/MachineGroup.java113
-rw-r--r--src/Java/binnie/core/machines/MachinePackage.java74
-rw-r--r--src/Java/binnie/core/machines/MachineRendererBlock.java41
-rw-r--r--src/Java/binnie/core/machines/MachineUtil.java216
-rw-r--r--src/Java/binnie/core/machines/ManagerMachine.java108
-rw-r--r--src/Java/binnie/core/machines/ModelBlock.java42
-rw-r--r--src/Java/binnie/core/machines/RendererMachine.java68
-rw-r--r--src/Java/binnie/core/machines/TileEntityMachine.java112
-rw-r--r--src/Java/binnie/core/machines/base/DefaultInventory.java82
-rw-r--r--src/Java/binnie/core/machines/base/DefaultPower.java71
-rw-r--r--src/Java/binnie/core/machines/base/DefaultTankContainer.java79
-rw-r--r--src/Java/binnie/core/machines/base/TileEntityMachineBase.java262
-rw-r--r--src/Java/binnie/core/machines/component/ComponentRecipe.java14
-rw-r--r--src/Java/binnie/core/machines/component/IBuildcraft.java20
-rw-r--r--src/Java/binnie/core/machines/component/IComponentRecipe.java12
-rw-r--r--src/Java/binnie/core/machines/component/IInteraction.java22
-rw-r--r--src/Java/binnie/core/machines/component/IRender.java28
-rw-r--r--src/Java/binnie/core/machines/inventory/AccessDirection.java97
-rw-r--r--src/Java/binnie/core/machines/inventory/BaseSlot.java148
-rw-r--r--src/Java/binnie/core/machines/inventory/ComponentChargedSlots.java117
-rw-r--r--src/Java/binnie/core/machines/inventory/ComponentInventory.java22
-rw-r--r--src/Java/binnie/core/machines/inventory/ComponentInventorySlots.java247
-rw-r--r--src/Java/binnie/core/machines/inventory/ComponentInventoryTransfer.java161
-rw-r--r--src/Java/binnie/core/machines/inventory/ComponentTankContainer.java207
-rw-r--r--src/Java/binnie/core/machines/inventory/IChargedSlots.java10
-rw-r--r--src/Java/binnie/core/machines/inventory/IInventoryMachine.java8
-rw-r--r--src/Java/binnie/core/machines/inventory/IInventorySlots.java14
-rw-r--r--src/Java/binnie/core/machines/inventory/IValidatedInventory.java9
-rw-r--r--src/Java/binnie/core/machines/inventory/IValidatedTankContainer.java10
-rw-r--r--src/Java/binnie/core/machines/inventory/InventorySlot.java115
-rw-r--r--src/Java/binnie/core/machines/inventory/MachineSide.java79
-rw-r--r--src/Java/binnie/core/machines/inventory/SetList.java36
-rw-r--r--src/Java/binnie/core/machines/inventory/SidedAccess.java106
-rw-r--r--src/Java/binnie/core/machines/inventory/SlotValidator.java68
-rw-r--r--src/Java/binnie/core/machines/inventory/TankSlot.java58
-rw-r--r--src/Java/binnie/core/machines/inventory/TankValidator.java33
-rw-r--r--src/Java/binnie/core/machines/inventory/TransferHandler.java227
-rw-r--r--src/Java/binnie/core/machines/inventory/Validator.java9
-rw-r--r--src/Java/binnie/core/machines/inventory/ValidatorIcon.java25
-rw-r--r--src/Java/binnie/core/machines/network/INetwork.java30
-rw-r--r--src/Java/binnie/core/machines/power/ComponentPowerReceptor.java191
-rw-r--r--src/Java/binnie/core/machines/power/ComponentProcess.java90
-rw-r--r--src/Java/binnie/core/machines/power/ComponentProcessIndefinate.java120
-rw-r--r--src/Java/binnie/core/machines/power/ComponentProcessSetCost.java27
-rw-r--r--src/Java/binnie/core/machines/power/ErrorState.java187
-rw-r--r--src/Java/binnie/core/machines/power/IErrorStateSource.java8
-rw-r--r--src/Java/binnie/core/machines/power/IPoweredMachine.java14
-rw-r--r--src/Java/binnie/core/machines/power/IProcess.java13
-rw-r--r--src/Java/binnie/core/machines/power/IProcessTimed.java13
-rw-r--r--src/Java/binnie/core/machines/power/ITankMachine.java20
-rw-r--r--src/Java/binnie/core/machines/power/PowerInfo.java41
-rw-r--r--src/Java/binnie/core/machines/power/PowerInterface.java90
-rw-r--r--src/Java/binnie/core/machines/power/PowerSystem.java44
-rw-r--r--src/Java/binnie/core/machines/power/ProcessInfo.java67
-rw-r--r--src/Java/binnie/core/machines/power/TankInfo.java76
-rw-r--r--src/Java/binnie/core/machines/storage/Compartment.java65
-rw-r--r--src/Java/binnie/core/machines/storage/CompartmentTab.java77
-rw-r--r--src/Java/binnie/core/machines/storage/ComponentBinnieCoreGUI.java28
-rw-r--r--src/Java/binnie/core/machines/storage/ComponentCompartmentInventory.java128
-rw-r--r--src/Java/binnie/core/machines/storage/ControlColourSelector.java47
-rw-r--r--src/Java/binnie/core/machines/storage/MachineRendererCompartment.java50
-rw-r--r--src/Java/binnie/core/machines/storage/ModelCompartment.java171
-rw-r--r--src/Java/binnie/core/machines/storage/ModuleStorage.java39
-rw-r--r--src/Java/binnie/core/machines/storage/StandardCompartment.java142
-rw-r--r--src/Java/binnie/core/machines/storage/WindowCompartment.java594
-rw-r--r--src/Java/binnie/core/machines/storage/WindowTest.java40
-rw-r--r--src/Java/binnie/core/machines/transfer/TransferHandler.java3
-rw-r--r--src/Java/binnie/core/machines/transfer/TransferRequest.java419
-rw-r--r--src/Java/binnie/core/mod/config/BinnieConfiguration.java21
-rw-r--r--src/Java/binnie/core/mod/config/BinnieItemData.java15
-rw-r--r--src/Java/binnie/core/mod/config/ConfigFile.java11
-rw-r--r--src/Java/binnie/core/mod/config/ConfigProperty.java26
-rw-r--r--src/Java/binnie/core/mod/config/ConfigurationMain.java4
-rw-r--r--src/Java/binnie/core/mod/config/ConfigurationMods.java18
-rw-r--r--src/Java/binnie/core/mod/config/ManagerConfig.java71
-rw-r--r--src/Java/binnie/core/mod/config/PropBoolean.java38
-rw-r--r--src/Java/binnie/core/mod/config/PropDouble.java38
-rw-r--r--src/Java/binnie/core/mod/config/PropInteger.java38
-rw-r--r--src/Java/binnie/core/mod/config/PropPercentage.java43
-rw-r--r--src/Java/binnie/core/mod/config/PropertyBase.java72
-rw-r--r--src/Java/binnie/core/mod/parser/FieldParser.java55
-rw-r--r--src/Java/binnie/core/mod/parser/ItemParser.java24
-rw-r--r--src/Java/binnie/core/multiblock/BlockMultiblockMachine.java27
-rw-r--r--src/Java/binnie/core/multiblock/TileEntityMultiblockMachine.java37
-rw-r--r--src/Java/binnie/core/network/BinnieCorePacketID.java77
-rw-r--r--src/Java/binnie/core/network/BinniePacketHandler.java43
-rw-r--r--src/Java/binnie/core/network/INetworkedEntity.java10
-rw-r--r--src/Java/binnie/core/network/IOrdinaled.java6
-rw-r--r--src/Java/binnie/core/network/IPacketID.java10
-rw-r--r--src/Java/binnie/core/network/IPacketProvider.java8
-rw-r--r--src/Java/binnie/core/network/packet/IPacket.java8
-rw-r--r--src/Java/binnie/core/network/packet/IPacketLocation.java15
-rw-r--r--src/Java/binnie/core/network/packet/IndexInPayload.java15
-rw-r--r--src/Java/binnie/core/network/packet/MachinePayload.java77
-rw-r--r--src/Java/binnie/core/network/packet/MessageBase.java69
-rw-r--r--src/Java/binnie/core/network/packet/MessageBinnie.java40
-rw-r--r--src/Java/binnie/core/network/packet/MessageContainerUpdate.java17
-rw-r--r--src/Java/binnie/core/network/packet/MessageCoordinates.java59
-rw-r--r--src/Java/binnie/core/network/packet/MessageCraftGUI.java18
-rw-r--r--src/Java/binnie/core/network/packet/MessageMetadata.java36
-rw-r--r--src/Java/binnie/core/network/packet/MessageNBT.java49
-rw-r--r--src/Java/binnie/core/network/packet/MessageTileNBT.java82
-rw-r--r--src/Java/binnie/core/network/packet/MessageUpdate.java92
-rw-r--r--src/Java/binnie/core/network/packet/PacketPayload.java70
-rw-r--r--src/Java/binnie/core/proxy/BinnieModProxy.java67
-rw-r--r--src/Java/binnie/core/proxy/BinnieProxy.java156
-rw-r--r--src/Java/binnie/core/proxy/BinnieProxyClient.java158
-rw-r--r--src/Java/binnie/core/proxy/BinnieProxyServer.java6
-rw-r--r--src/Java/binnie/core/proxy/IBinnieModProxy.java21
-rw-r--r--src/Java/binnie/core/proxy/IBinnieProxy.java54
-rw-r--r--src/Java/binnie/core/proxy/IProxyCore.java7
-rw-r--r--src/Java/binnie/core/resource/BinnieIcon.java47
-rw-r--r--src/Java/binnie/core/resource/BinnieResource.java38
-rw-r--r--src/Java/binnie/core/resource/IBinnieTexture.java6
-rw-r--r--src/Java/binnie/core/resource/ManagerResource.java48
-rw-r--r--src/Java/binnie/core/resource/ResourceType.java18
-rw-r--r--src/Java/binnie/core/texture/BinnieCoreTexture.java28
-rw-r--r--src/Java/binnie/core/texture/TextureManager.java15
-rw-r--r--src/Java/binnie/core/triggers/ActionProvider.java38
-rw-r--r--src/Java/binnie/core/triggers/BinnieAction.java88
-rw-r--r--src/Java/binnie/core/triggers/BinnieTrigger.java116
-rw-r--r--src/Java/binnie/core/triggers/ModuleTrigger.java45
-rw-r--r--src/Java/binnie/core/triggers/TriggerData.java37
-rw-r--r--src/Java/binnie/core/triggers/TriggerInventory.java11
-rw-r--r--src/Java/binnie/core/triggers/TriggerPower.java48
-rw-r--r--src/Java/binnie/core/triggers/TriggerProvider.java57
-rw-r--r--src/Java/binnie/core/triggers/TriggerWorking.java47
-rw-r--r--src/Java/binnie/core/util/FluidStackSet.java128
-rw-r--r--src/Java/binnie/core/util/IValidator.java6
-rw-r--r--src/Java/binnie/core/util/ItemStackSet.java128
-rw-r--r--src/Java/binnie/core/util/UniqueFluidStackSet.java28
-rw-r--r--src/Java/binnie/core/util/UniqueItemStackSet.java28
-rw-r--r--src/Java/binnie/craftgui/binniecore/WindowFieldKit.java334
-rw-r--r--src/Java/binnie/craftgui/binniecore/WindowGenesis.java264
-rw-r--r--src/Java/binnie/craftgui/botany/ControlColourDisplay.java47
-rw-r--r--src/Java/binnie/craftgui/botany/ControlColourMixBox.java31
-rw-r--r--src/Java/binnie/craftgui/botany/ControlColourMixItem.java37
-rw-r--r--src/Java/binnie/craftgui/botany/ControlColourMixSymbol.java58
-rw-r--r--src/Java/binnie/craftgui/botany/ControlColourOption.java38
-rw-r--r--src/Java/binnie/craftgui/botany/PageColourMix.java40
-rw-r--r--src/Java/binnie/craftgui/botany/PageColourMixResultant.java40
-rw-r--r--src/Java/binnie/craftgui/botany/PageSpeciesFlowerGenome.java137
-rw-r--r--src/Java/binnie/craftgui/botany/WindowBotanistDatabase.java103
-rw-r--r--src/Java/binnie/craftgui/controls/ControlCheckbox.java75
-rw-r--r--src/Java/binnie/craftgui/controls/ControlText.java50
-rw-r--r--src/Java/binnie/craftgui/controls/ControlTextCentered.java15
-rw-r--r--src/Java/binnie/craftgui/controls/ControlTextEdit.java154
-rw-r--r--src/Java/binnie/craftgui/controls/IControlSelection.java10
-rw-r--r--src/Java/binnie/craftgui/controls/IControlSelectionOption.java6
-rw-r--r--src/Java/binnie/craftgui/controls/button/ControlButton.java70
-rw-r--r--src/Java/binnie/craftgui/controls/button/ControlEnumButton.java61
-rw-r--r--src/Java/binnie/craftgui/controls/button/ControlToggleButton.java21
-rw-r--r--src/Java/binnie/craftgui/controls/core/Control.java85
-rw-r--r--src/Java/binnie/craftgui/controls/core/IControlIndexed.java8
-rw-r--r--src/Java/binnie/craftgui/controls/core/IControlValue.java11
-rw-r--r--src/Java/binnie/craftgui/controls/core/IControlValues.java11
-rw-r--r--src/Java/binnie/craftgui/controls/listbox/ControlList.java146
-rw-r--r--src/Java/binnie/craftgui/controls/listbox/ControlListBox.java76
-rw-r--r--src/Java/binnie/craftgui/controls/listbox/ControlOption.java73
-rw-r--r--src/Java/binnie/craftgui/controls/listbox/ControlTextOption.java37
-rw-r--r--src/Java/binnie/craftgui/controls/page/ControlPage.java36
-rw-r--r--src/Java/binnie/craftgui/controls/page/ControlPages.java57
-rw-r--r--src/Java/binnie/craftgui/controls/scroll/ControlScroll.java22
-rw-r--r--src/Java/binnie/craftgui/controls/scroll/ControlScrollBar.java94
-rw-r--r--src/Java/binnie/craftgui/controls/scroll/ControlScrollableContent.java134
-rw-r--r--src/Java/binnie/craftgui/controls/scroll/IControlScrollable.java17
-rw-r--r--src/Java/binnie/craftgui/controls/tab/ControlTab.java128
-rw-r--r--src/Java/binnie/craftgui/controls/tab/ControlTabBar.java86
-rw-r--r--src/Java/binnie/craftgui/core/Attribute.java9
-rw-r--r--src/Java/binnie/craftgui/core/CraftGUI.java10
-rw-r--r--src/Java/binnie/craftgui/core/ITooltip.java6
-rw-r--r--src/Java/binnie/craftgui/core/ITooltipHelp.java6
-rw-r--r--src/Java/binnie/craftgui/core/ITopLevelWidget.java29
-rw-r--r--src/Java/binnie/craftgui/core/IWidget.java138
-rw-r--r--src/Java/binnie/craftgui/core/IWidgetAttribute.java3
-rw-r--r--src/Java/binnie/craftgui/core/RenderStage.java8
-rw-r--r--src/Java/binnie/craftgui/core/Tooltip.java84
-rw-r--r--src/Java/binnie/craftgui/core/TopLevelWidget.java248
-rw-r--r--src/Java/binnie/craftgui/core/Widget.java499
-rw-r--r--src/Java/binnie/craftgui/core/geometry/CraftGUIUtil.java77
-rw-r--r--src/Java/binnie/craftgui/core/geometry/IArea.java143
-rw-r--r--src/Java/binnie/craftgui/core/geometry/IBorder.java126
-rw-r--r--src/Java/binnie/craftgui/core/geometry/IPoint.java83
-rw-r--r--src/Java/binnie/craftgui/core/geometry/Position.java41
-rw-r--r--src/Java/binnie/craftgui/core/geometry/TextJustification.java25
-rw-r--r--src/Java/binnie/craftgui/core/renderer/Renderer.java252
-rw-r--r--src/Java/binnie/craftgui/core/renderer/TextureType.java8
-rw-r--r--src/Java/binnie/craftgui/events/Event.java23
-rw-r--r--src/Java/binnie/craftgui/events/EventButtonClicked.java21
-rw-r--r--src/Java/binnie/craftgui/events/EventCycleChanged.java20
-rw-r--r--src/Java/binnie/craftgui/events/EventHandler.java53
-rw-r--r--src/Java/binnie/craftgui/events/EventKey.java63
-rw-r--r--src/Java/binnie/craftgui/events/EventMouse.java156
-rw-r--r--src/Java/binnie/craftgui/events/EventTextEdit.java21
-rw-r--r--src/Java/binnie/craftgui/events/EventToggleButtonClicked.java20
-rw-r--r--src/Java/binnie/craftgui/events/EventValueChanged.java29
-rw-r--r--src/Java/binnie/craftgui/events/EventValuesChanged.java20
-rw-r--r--src/Java/binnie/craftgui/events/EventWidget.java272
-rw-r--r--src/Java/binnie/craftgui/extratrees/dictionary/ControlBlockIconDisplay.java25
-rw-r--r--src/Java/binnie/craftgui/extratrees/dictionary/ControlBreweryProgress.java115
-rw-r--r--src/Java/binnie/craftgui/extratrees/dictionary/ControlDistilleryProgress.java104
-rw-r--r--src/Java/binnie/craftgui/extratrees/dictionary/ControlFruitPressProgress.java90
-rw-r--r--src/Java/binnie/craftgui/extratrees/dictionary/ControlLumbermillProgress.java96
-rw-r--r--src/Java/binnie/craftgui/extratrees/dictionary/ControlRecipeSlot.java42
-rw-r--r--src/Java/binnie/craftgui/extratrees/dictionary/ControlTileSelect.java197
-rw-r--r--src/Java/binnie/craftgui/extratrees/dictionary/DialogBreweryRecipe.java17
-rw-r--r--src/Java/binnie/craftgui/extratrees/dictionary/PageFruit.java47
-rw-r--r--src/Java/binnie/craftgui/extratrees/dictionary/PagePlanksOverview.java103
-rw-r--r--src/Java/binnie/craftgui/extratrees/dictionary/PagePlanksTrees.java40
-rw-r--r--src/Java/binnie/craftgui/extratrees/dictionary/PageSpeciesImage.java31
-rw-r--r--src/Java/binnie/craftgui/extratrees/dictionary/PageSpeciesTreeGenome.java175
-rw-r--r--src/Java/binnie/craftgui/extratrees/dictionary/PageWood.java40
-rw-r--r--src/Java/binnie/craftgui/extratrees/dictionary/WindowArboristDatabase.java133
-rw-r--r--src/Java/binnie/craftgui/extratrees/dictionary/WindowBrewery.java61
-rw-r--r--src/Java/binnie/craftgui/extratrees/dictionary/WindowDistillery.java59
-rw-r--r--src/Java/binnie/craftgui/extratrees/dictionary/WindowLepidopteristDatabase.java57
-rw-r--r--src/Java/binnie/craftgui/extratrees/dictionary/WindowLumbermill.java56
-rw-r--r--src/Java/binnie/craftgui/extratrees/dictionary/WindowPress.java77
-rw-r--r--src/Java/binnie/craftgui/extratrees/dictionary/WindowSetSquare.java35
-rw-r--r--src/Java/binnie/craftgui/extratrees/dictionary/WindowWoodworker.java110
-rw-r--r--src/Java/binnie/craftgui/extratrees/kitchen/ControlDropDownMenu.java18
-rw-r--r--src/Java/binnie/craftgui/extratrees/kitchen/ControlDropdownButton.java36
-rw-r--r--src/Java/binnie/craftgui/extratrees/kitchen/ControlFluidDisplay.java103
-rw-r--r--src/Java/binnie/craftgui/extratrees/kitchen/ControlSlotFluid.java77
-rw-r--r--src/Java/binnie/craftgui/extratrees/kitchen/ControlSlotGlassware.java35
-rw-r--r--src/Java/binnie/craftgui/extratrees/kitchen/ControlTankSlot.java49
-rw-r--r--src/Java/binnie/craftgui/extratrees/kitchen/WindowBottleRack.java48
-rw-r--r--src/Java/binnie/craftgui/genetics/machine/ControlGene.java101
-rw-r--r--src/Java/binnie/craftgui/genetics/machine/ControlGeneScroll.java97
-rw-r--r--src/Java/binnie/craftgui/genetics/machine/ControlProcessTemporary.java27
-rw-r--r--src/Java/binnie/craftgui/genetics/machine/ControlSequencerProgress.java64
-rw-r--r--src/Java/binnie/craftgui/genetics/machine/ControlSplicerProgress.java60
-rw-r--r--src/Java/binnie/craftgui/genetics/machine/WindowAcclimatiser.java80
-rw-r--r--src/Java/binnie/craftgui/genetics/machine/WindowAnalyser.java110
-rw-r--r--src/Java/binnie/craftgui/genetics/machine/WindowGeneBank.java256
-rw-r--r--src/Java/binnie/craftgui/genetics/machine/WindowGeneBankNEI.java14
-rw-r--r--src/Java/binnie/craftgui/genetics/machine/WindowGeneProject.java32
-rw-r--r--src/Java/binnie/craftgui/genetics/machine/WindowGenepool.java96
-rw-r--r--src/Java/binnie/craftgui/genetics/machine/WindowGenomeAssembler.java37
-rw-r--r--src/Java/binnie/craftgui/genetics/machine/WindowIncubator.java99
-rw-r--r--src/Java/binnie/craftgui/genetics/machine/WindowInoculator.java107
-rw-r--r--src/Java/binnie/craftgui/genetics/machine/WindowIsolator.java116
-rw-r--r--src/Java/binnie/craftgui/genetics/machine/WindowMachine.java22
-rw-r--r--src/Java/binnie/craftgui/genetics/machine/WindowPolymeriser.java101
-rw-r--r--src/Java/binnie/craftgui/genetics/machine/WindowSequencer.java116
-rw-r--r--src/Java/binnie/craftgui/genetics/machine/WindowSplicer.java93
-rw-r--r--src/Java/binnie/craftgui/minecraft/ContainerCraftGUI.java549
-rw-r--r--src/Java/binnie/craftgui/minecraft/CustomSlot.java54
-rw-r--r--src/Java/binnie/craftgui/minecraft/Dialog.java53
-rw-r--r--src/Java/binnie/craftgui/minecraft/EnumColor.java32
-rw-r--r--src/Java/binnie/craftgui/minecraft/GUIIcon.java30
-rw-r--r--src/Java/binnie/craftgui/minecraft/GuiCraftGUI.java605
-rw-r--r--src/Java/binnie/craftgui/minecraft/IMachineInformation.java6
-rw-r--r--src/Java/binnie/craftgui/minecraft/IMinecraftTooltip.java9
-rw-r--r--src/Java/binnie/craftgui/minecraft/IWindowAffectsShiftClick.java8
-rw-r--r--src/Java/binnie/craftgui/minecraft/InventoryType.java8
-rw-r--r--src/Java/binnie/craftgui/minecraft/ListMap.java149
-rw-r--r--src/Java/binnie/craftgui/minecraft/MinecraftGUI.java14
-rw-r--r--src/Java/binnie/craftgui/minecraft/MinecraftTooltip.java63
-rw-r--r--src/Java/binnie/craftgui/minecraft/ModuleCraftGUI.java18
-rw-r--r--src/Java/binnie/craftgui/minecraft/Window.java338
-rw-r--r--src/Java/binnie/craftgui/minecraft/WindowInventory.java144
-rw-r--r--src/Java/binnie/craftgui/minecraft/control/ControlEnergyBar.java161
-rw-r--r--src/Java/binnie/craftgui/minecraft/control/ControlErrorState.java113
-rw-r--r--src/Java/binnie/craftgui/minecraft/control/ControlHelp.java41
-rw-r--r--src/Java/binnie/craftgui/minecraft/control/ControlIconDisplay.java25
-rw-r--r--src/Java/binnie/craftgui/minecraft/control/ControlImage.java25
-rw-r--r--src/Java/binnie/craftgui/minecraft/control/ControlInfo.java38
-rw-r--r--src/Java/binnie/craftgui/minecraft/control/ControlItemDisplay.java98
-rw-r--r--src/Java/binnie/craftgui/minecraft/control/ControlLiquidTank.java223
-rw-r--r--src/Java/binnie/craftgui/minecraft/control/ControlMachineProgress.java14
-rw-r--r--src/Java/binnie/craftgui/minecraft/control/ControlPlayerInventory.java108
-rw-r--r--src/Java/binnie/craftgui/minecraft/control/ControlPowerSystem.java39
-rw-r--r--src/Java/binnie/craftgui/minecraft/control/ControlProgress.java30
-rw-r--r--src/Java/binnie/craftgui/minecraft/control/ControlProgressBase.java100
-rw-r--r--src/Java/binnie/craftgui/minecraft/control/ControlSlide.java113
-rw-r--r--src/Java/binnie/craftgui/minecraft/control/ControlSlot.java221
-rw-r--r--src/Java/binnie/craftgui/minecraft/control/ControlSlotArray.java76
-rw-r--r--src/Java/binnie/craftgui/minecraft/control/ControlSlotBase.java77
-rw-r--r--src/Java/binnie/craftgui/minecraft/control/ControlSlotCharge.java43
-rw-r--r--src/Java/binnie/craftgui/minecraft/control/ControlTabIcon.java47
-rw-r--r--src/Java/binnie/craftgui/minecraft/control/ControlUser.java41
-rw-r--r--src/Java/binnie/craftgui/minecraft/control/EnumHighlighting.java28
-rw-r--r--src/Java/binnie/craftgui/minecraft/render/MinecraftTexture.java10
-rw-r--r--src/Java/binnie/craftgui/minecraft/render/RenderCommand.java16
-rw-r--r--src/Java/binnie/craftgui/mod/database/ControlBranchBox.java20
-rw-r--r--src/Java/binnie/craftgui/mod/database/ControlBranchBoxOption.java14
-rw-r--r--src/Java/binnie/craftgui/mod/database/ControlBreedingProgress.java41
-rw-r--r--src/Java/binnie/craftgui/mod/database/ControlDatabaseIndividualDisplay.java120
-rw-r--r--src/Java/binnie/craftgui/mod/database/ControlItemStackOption.java38
-rw-r--r--src/Java/binnie/craftgui/mod/database/ControlMutationBox.java71
-rw-r--r--src/Java/binnie/craftgui/mod/database/ControlMutationItem.java51
-rw-r--r--src/Java/binnie/craftgui/mod/database/ControlMutationSymbol.java80
-rw-r--r--src/Java/binnie/craftgui/mod/database/ControlSpeciesBox.java55
-rw-r--r--src/Java/binnie/craftgui/mod/database/ControlSpeciexBoxOption.java42
-rw-r--r--src/Java/binnie/craftgui/mod/database/DatabaseTab.java32
-rw-r--r--src/Java/binnie/craftgui/mod/database/EnumDiscoveryState.java8
-rw-r--r--src/Java/binnie/craftgui/mod/database/IDatabaseMode.java6
-rw-r--r--src/Java/binnie/craftgui/mod/database/PageAbstract.java16
-rw-r--r--src/Java/binnie/craftgui/mod/database/PageBranch.java13
-rw-r--r--src/Java/binnie/craftgui/mod/database/PageBranchOverview.java67
-rw-r--r--src/Java/binnie/craftgui/mod/database/PageBranchSpecies.java43
-rw-r--r--src/Java/binnie/craftgui/mod/database/PageBreeder.java51
-rw-r--r--src/Java/binnie/craftgui/mod/database/PageBreederStats.java23
-rw-r--r--src/Java/binnie/craftgui/mod/database/PageSpecies.java13
-rw-r--r--src/Java/binnie/craftgui/mod/database/PageSpeciesClassification.java54
-rw-r--r--src/Java/binnie/craftgui/mod/database/PageSpeciesMutations.java27
-rw-r--r--src/Java/binnie/craftgui/mod/database/PageSpeciesOverview.java88
-rw-r--r--src/Java/binnie/craftgui/mod/database/PageSpeciesResultant.java27
-rw-r--r--src/Java/binnie/craftgui/mod/database/WindowAbstractDatabase.java314
-rw-r--r--src/Java/binnie/craftgui/resource/IStyleSheet.java6
-rw-r--r--src/Java/binnie/craftgui/resource/StyleSheet.java18
-rw-r--r--src/Java/binnie/craftgui/resource/StyleSheetManager.java28
-rw-r--r--src/Java/binnie/craftgui/resource/Texture.java128
-rw-r--r--src/Java/binnie/craftgui/resource/minecraft/CraftGUIResourceManager.java155
-rw-r--r--src/Java/binnie/craftgui/resource/minecraft/CraftGUITexture.java18
-rw-r--r--src/Java/binnie/craftgui/resource/minecraft/CraftGUITextureSheet.java33
-rw-r--r--src/Java/binnie/craftgui/resource/minecraft/PaddedTexture.java21
-rw-r--r--src/Java/binnie/craftgui/resource/minecraft/ParsedTextureSheet.java25
-rw-r--r--src/Java/binnie/craftgui/resource/minecraft/StandardTexture.java36
-rw-r--r--src/Java/binnie/craftgui/window/Panel.java58
-rw-r--r--src/Java/binnie/extrabees/ExtraBees.java123
-rw-r--r--src/Java/binnie/extrabees/apiary/ComponentBeeModifier.java88
-rw-r--r--src/Java/binnie/extrabees/apiary/ComponentExtraBeeGUI.java28
-rw-r--r--src/Java/binnie/extrabees/apiary/EnumHiveFrame.java140
-rw-r--r--src/Java/binnie/extrabees/apiary/IndustrialFrame.java141
-rw-r--r--src/Java/binnie/extrabees/apiary/ItemHiveFrame.java100
-rw-r--r--src/Java/binnie/extrabees/apiary/ItemIndustrialFrame.java66
-rw-r--r--src/Java/binnie/extrabees/apiary/ModuleApiary.java96
-rw-r--r--src/Java/binnie/extrabees/apiary/TileExtraBeeAlveary.java355
-rw-r--r--src/Java/binnie/extrabees/apiary/machine/AlvearyFrame.java125
-rw-r--r--src/Java/binnie/extrabees/apiary/machine/AlvearyHatchery.java106
-rw-r--r--src/Java/binnie/extrabees/apiary/machine/AlvearyLighting.java41
-rw-r--r--src/Java/binnie/extrabees/apiary/machine/AlvearyMachine.java66
-rw-r--r--src/Java/binnie/extrabees/apiary/machine/AlvearyMutator.java125
-rw-r--r--src/Java/binnie/extrabees/apiary/machine/AlvearyRainShield.java41
-rw-r--r--src/Java/binnie/extrabees/apiary/machine/AlvearyStimulator.java430
-rw-r--r--src/Java/binnie/extrabees/apiary/machine/AlvearyTransmission.java81
-rw-r--r--src/Java/binnie/extrabees/config/ConfigurationMachines.java17
-rw-r--r--src/Java/binnie/extrabees/config/ConfigurationMain.java26
-rw-r--r--src/Java/binnie/extrabees/core/ExtraBeeGUID.java54
-rw-r--r--src/Java/binnie/extrabees/core/ExtraBeeItems.java172
-rw-r--r--src/Java/binnie/extrabees/core/ExtraBeeTexture.java28
-rw-r--r--src/Java/binnie/extrabees/core/ModuleCore.java19
-rw-r--r--src/Java/binnie/extrabees/genetics/ExtraBeeMutation.java478
-rw-r--r--src/Java/binnie/extrabees/genetics/ExtraBeesBranch.java313
-rw-r--r--src/Java/binnie/extrabees/genetics/ExtraBeesFlowers.java202
-rw-r--r--src/Java/binnie/extrabees/genetics/ExtraBeesSpecies.java1139
-rw-r--r--src/Java/binnie/extrabees/genetics/ModuleGenetics.java88
-rw-r--r--src/Java/binnie/extrabees/genetics/effect/BlockEctoplasm.java42
-rw-r--r--src/Java/binnie/extrabees/genetics/effect/EntityBeeLightning.java68
-rw-r--r--src/Java/binnie/extrabees/genetics/effect/ExtraBeesEffect.java585
-rw-r--r--src/Java/binnie/extrabees/genetics/effect/FireworkCreator.java83
-rw-r--r--src/Java/binnie/extrabees/genetics/items/ItemDictionary.java73
-rw-r--r--src/Java/binnie/extrabees/genetics/items/ItemPunnettSquare.java41
-rw-r--r--src/Java/binnie/extrabees/gui/WindowAlvearyFrame.java53
-rw-r--r--src/Java/binnie/extrabees/gui/WindowAlvearyHatchery.java54
-rw-r--r--src/Java/binnie/extrabees/gui/WindowAlvearyIndustrialFrame.java53
-rw-r--r--src/Java/binnie/extrabees/gui/WindowAlvearyMutator.java78
-rw-r--r--src/Java/binnie/extrabees/gui/WindowAlvearyStimulator.java56
-rw-r--r--src/Java/binnie/extrabees/gui/database/ControlBiomes.java75
-rw-r--r--src/Java/binnie/extrabees/gui/database/ControlClimateBar.java153
-rw-r--r--src/Java/binnie/extrabees/gui/database/ControlProductsBox.java92
-rw-r--r--src/Java/binnie/extrabees/gui/database/ControlProductsItem.java44
-rw-r--r--src/Java/binnie/extrabees/gui/database/PageSpeciesClimate.java36
-rw-r--r--src/Java/binnie/extrabees/gui/database/PageSpeciesGenome.java206
-rw-r--r--src/Java/binnie/extrabees/gui/database/PageSpeciesProducts.java38
-rw-r--r--src/Java/binnie/extrabees/gui/database/WindowApiaristDatabase.java83
-rw-r--r--src/Java/binnie/extrabees/gui/punnett/ControlChromosome.java49
-rw-r--r--src/Java/binnie/extrabees/gui/punnett/ControlPunnett.java86
-rw-r--r--src/Java/binnie/extrabees/gui/punnett/ExtraBeeGUITexture.java8
-rw-r--r--src/Java/binnie/extrabees/gui/punnett/WindowPunnettSquare.java67
-rw-r--r--src/Java/binnie/extrabees/liquids/ExtraBeeLiquid.java80
-rw-r--r--src/Java/binnie/extrabees/liquids/ModuleLiquids.java19
-rw-r--r--src/Java/binnie/extrabees/products/EnumHoneyComb.java109
-rw-r--r--src/Java/binnie/extrabees/products/EnumHoneyDrop.java72
-rw-r--r--src/Java/binnie/extrabees/products/EnumPropolis.java65
-rw-r--r--src/Java/binnie/extrabees/products/ItemHoneyComb.java335
-rw-r--r--src/Java/binnie/extrabees/products/ItemHoneyCrystal.java51
-rw-r--r--src/Java/binnie/extrabees/products/ItemHoneyCrystalEmpty.java30
-rw-r--r--src/Java/binnie/extrabees/products/ItemHoneyDrop.java55
-rw-r--r--src/Java/binnie/extrabees/products/ItemProduct.java44
-rw-r--r--src/Java/binnie/extrabees/products/ItemPropolis.java35
-rw-r--r--src/Java/binnie/extrabees/products/ModuleProducts.java43
-rw-r--r--src/Java/binnie/extrabees/proxy/ExtraBeesProxy.java13
-rw-r--r--src/Java/binnie/extrabees/proxy/ExtraBeesProxyClient.java5
-rw-r--r--src/Java/binnie/extrabees/proxy/ExtraBeesProxyServer.java5
-rw-r--r--src/Java/binnie/extrabees/worldgen/BlockExtraBeeHive.java109
-rw-r--r--src/Java/binnie/extrabees/worldgen/EnumHiveType.java14
-rw-r--r--src/Java/binnie/extrabees/worldgen/HiveDrop.java65
-rw-r--r--src/Java/binnie/extrabees/worldgen/ItemBeehive.java37
-rw-r--r--src/Java/binnie/extrabees/worldgen/MaterialBeehive.java20
-rw-r--r--src/Java/binnie/extrabees/worldgen/ModuleGeneration.java85
-rw-r--r--src/Java/binnie/extrabees/worldgen/WorldGenHiveNether.java33
-rw-r--r--src/Java/binnie/extrabees/worldgen/WorldGenHiveRock.java27
-rw-r--r--src/Java/binnie/extrabees/worldgen/WorldGenHiveWater.java31
-rw-r--r--src/Java/mcmod.info19
-rw-r--r--src/Java/miscutil/MiscUtils.java118
-rw-r--r--src/Java/miscutil/core/CommonProxy.java70
-rw-r--r--src/Java/miscutil/core/block/AdvancedBlock.java31
-rw-r--r--src/Java/miscutil/core/block/BasicBlock.java22
-rw-r--r--src/Java/miscutil/core/block/ModBlocks.java90
-rw-r--r--src/Java/miscutil/core/commands/CommandMath.java195
-rw-r--r--src/Java/miscutil/core/commands/CommandUtils.java20
-rw-r--r--src/Java/miscutil/core/creativetabs/MiscUtilCreativeTabBlock.java18
-rw-r--r--src/Java/miscutil/core/creativetabs/MiscUtilCreativeTabMachines.java18
-rw-r--r--src/Java/miscutil/core/creativetabs/MiscUtilCreativeTabMisc.java18
-rw-r--r--src/Java/miscutil/core/creativetabs/MiscUtilCreativeTabTools.java18
-rw-r--r--src/Java/miscutil/core/creativetabs/TMCreativeTabs.java20
-rw-r--r--src/Java/miscutil/core/gui/GUI_Bat_Buf.java247
-rw-r--r--src/Java/miscutil/core/gui/GUI_Battery_Buffer.java51
-rw-r--r--src/Java/miscutil/core/gui/GUI_Tool_Builder.java5
-rw-r--r--src/Java/miscutil/core/gui/Gui_No_Inventory_Base.java51
-rw-r--r--src/Java/miscutil/core/gui/ModGUI.java15
-rw-r--r--src/Java/miscutil/core/handler/CraftingManager.java21
-rw-r--r--src/Java/miscutil/core/handler/GuiHandler.java39
-rw-r--r--src/Java/miscutil/core/handler/ResourceHandler.java83
-rw-r--r--src/Java/miscutil/core/item/BaseMetaItemTool.java5
-rw-r--r--src/Java/miscutil/core/item/EntityTeleportFX.java236
-rw-r--r--src/Java/miscutil/core/item/ModItems.java311
-rw-r--r--src/Java/miscutil/core/item/effects/RarityEffect.java41
-rw-r--r--src/Java/miscutil/core/item/effects/RarityEpic.java28
-rw-r--r--src/Java/miscutil/core/item/effects/RarityRare.java28
-rw-r--r--src/Java/miscutil/core/item/effects/RarityUncommon.java22
-rw-r--r--src/Java/miscutil/core/item/materials/MaterialHandler.java9
-rw-r--r--src/Java/miscutil/core/item/tool/bloodsteel/BloodSteelArmor.java56
-rw-r--r--src/Java/miscutil/core/item/tool/bloodsteel/BloodSteelAxe.java12
-rw-r--r--src/Java/miscutil/core/item/tool/bloodsteel/BloodSteelHoe.java12
-rw-r--r--src/Java/miscutil/core/item/tool/bloodsteel/BloodSteelPickaxe.java12
-rw-r--r--src/Java/miscutil/core/item/tool/bloodsteel/BloodSteelSpade.java12
-rw-r--r--src/Java/miscutil/core/item/tool/bloodsteel/BloodSteelSword.java12
-rw-r--r--src/Java/miscutil/core/item/tool/staballoy/StaballoyPickaxe.java14
-rw-r--r--src/Java/miscutil/core/lib/Strings.java19
-rw-r--r--src/Java/miscutil/core/proxy/ClientProxy.java42
-rw-r--r--src/Java/miscutil/core/proxy/ServerProxy.java28
-rw-r--r--src/Java/miscutil/core/tileentities/ModTileEntities.java13
-rw-r--r--src/Java/miscutil/core/util/Benchmark.java153
-rw-r--r--src/Java/miscutil/core/util/Utils.java61
-rw-r--r--src/Java/miscutil/gregtech/energy/IC2ElectricItem.java55
-rw-r--r--src/Java/miscutil/gregtech/energy/IC2ElectricItemManager.java95
-rw-r--r--src/Java/miscutil/gregtech/enums/AddExtraOreDict.java16
-rw-r--r--src/Java/miscutil/gregtech/enums/ExtraOreDictNames.java5
-rw-r--r--src/Java/miscutil/gregtech/enums/GregtechItemList.java153
-rw-r--r--src/Java/miscutil/gregtech/init/InitGregtech.java23
-rw-r--r--src/Java/miscutil/gregtech/init/machines/GregtechCobbleGenerator.java51
-rw-r--r--src/Java/miscutil/gregtech/init/machines/GregtechEnergyBuffer.java88
-rw-r--r--src/Java/miscutil/gregtech/interfaces/GregtechItemContainer.java24
-rw-r--r--src/Java/miscutil/gregtech/metatileentity/implementations/GregtechMetaCreativeEnergyBuffer.java261
-rw-r--r--src/Java/miscutil/gregtech/metatileentity/implementations/GregtechMetaEnergyBuffer.java401
-rw-r--r--src/Java/miscutil/gregtech/metatileentity/implementations/GregtechMetaTileEntity.java65
-rw-r--r--src/Java/miscutil/gregtech/metatileentity/implementations/GregtechSteelBoiler.java290
-rw-r--r--src/Java/miscutil/gregtech/util/IMessage.java21
-rw-r--r--src/Java/miscutil/gregtech/util/VanillaChatCommandSender.java35
-rw-r--r--src/resources/assets/miscutils/lang/en_US.lang53
-rw-r--r--src/resources/assets/miscutils/textures/blocks/blockBloodSteel.pngbin0 -> 3078 bytes
-rw-r--r--src/resources/assets/miscutils/textures/blocks/blockStaballoy.pngbin0 -> 3328 bytes
-rw-r--r--src/resources/assets/miscutils/textures/items/itemBufferCore.pngbin0 -> 4047 bytes
-rw-r--r--src/resources/assets/miscutils/textures/items/itemIngotBloodSteel.pngbin0 -> 2965 bytes
-rw-r--r--src/resources/assets/miscutils/textures/items/itemIngotStaballoy.pngbin0 -> 2976 bytes
-rw-r--r--src/resources/assets/miscutils/textures/items/itemPlateBedrockium.pngbin0 -> 2948 bytes
-rw-r--r--src/resources/assets/miscutils/textures/items/itemPlateBloodSteel.pngbin0 -> 3052 bytes
-rw-r--r--src/resources/assets/miscutils/textures/items/itemPlateBlutonium.pngbin0 -> 2939 bytes
-rw-r--r--src/resources/assets/miscutils/textures/items/itemPlateCompressedIron.pngbin0 -> 2948 bytes
-rw-r--r--src/resources/assets/miscutils/textures/items/itemPlateConductiveIron.pngbin0 -> 2968 bytes
-rw-r--r--src/resources/assets/miscutils/textures/items/itemPlateCyanite.pngbin0 -> 2936 bytes
-rw-r--r--src/resources/assets/miscutils/textures/items/itemPlateDarkSteel.pngbin0 -> 2941 bytes
-rw-r--r--src/resources/assets/miscutils/textures/items/itemPlateDimensionShard.pngbin0 -> 3190 bytes
-rw-r--r--src/resources/assets/miscutils/textures/items/itemPlateElectricalSteel.pngbin0 -> 2950 bytes
-rw-r--r--src/resources/assets/miscutils/textures/items/itemPlateElectricalSteel2.pngbin0 -> 2947 bytes
-rw-r--r--src/resources/assets/miscutils/textures/items/itemPlateEnergeticAlloy.pngbin0 -> 2968 bytes
-rw-r--r--src/resources/assets/miscutils/textures/items/itemPlateLudicrite.pngbin0 -> 2939 bytes
-rw-r--r--src/resources/assets/miscutils/textures/items/itemPlatePulsatingIron.pngbin0 -> 2973 bytes
-rw-r--r--src/resources/assets/miscutils/textures/items/itemPlateRedstoneAlloy.pngbin0 -> 2965 bytes
-rw-r--r--src/resources/assets/miscutils/textures/items/itemPlateSoularium.pngbin0 -> 2973 bytes
-rw-r--r--src/resources/assets/miscutils/textures/items/itemPlateStaballoy.pngbin0 -> 3051 bytes
-rw-r--r--src/resources/assets/miscutils/textures/items/itemPlateVibrantAlloy.pngbin0 -> 2963 bytes
-rw-r--r--src/resources/assets/miscutils/textures/items/itemPlateVoidMetal.pngbin0 -> 3103 bytes
-rw-r--r--src/resources/assets/miscutils/textures/items/itemStaballoyPickaxe.pngbin0 -> 3186 bytes
538 files changed, 40516 insertions, 0 deletions
diff --git a/src/Java/binnie/Binnie.java b/src/Java/binnie/Binnie.java
new file mode 100644
index 0000000000..a8bd664f1a
--- /dev/null
+++ b/src/Java/binnie/Binnie.java
@@ -0,0 +1,24 @@
+package binnie;
+
+import binnie.core.ManagerBase;
+import binnie.core.genetics.ManagerGenetics;
+import binnie.core.item.ManagerItem;
+import binnie.core.language.ManagerLanguage;
+import binnie.core.liquid.ManagerLiquid;
+import binnie.core.machines.ManagerMachine;
+import binnie.core.mod.config.ManagerConfig;
+import binnie.core.resource.ManagerResource;
+import java.util.ArrayList;
+import java.util.List;
+
+public final class Binnie
+{
+ public static final List<ManagerBase> Managers = new ArrayList();
+ public static final ManagerLanguage Language = new ManagerLanguage();
+ public static final ManagerGenetics Genetics = new ManagerGenetics();
+ public static final ManagerConfig Configuration = new ManagerConfig();
+ public static final ManagerLiquid Liquid = new ManagerLiquid();
+ public static final ManagerMachine Machine = new ManagerMachine();
+ public static final ManagerItem Item = new ManagerItem();
+ public static final ManagerResource Resource = new ManagerResource();
+}
diff --git a/src/Java/binnie/Constants.java b/src/Java/binnie/Constants.java
new file mode 100644
index 0000000000..30abf2c3c2
--- /dev/null
+++ b/src/Java/binnie/Constants.java
@@ -0,0 +1,11 @@
+package binnie;
+
+public final class Constants
+{
+ public static final String LiquidJuice = "juice";
+ public static final String LiquidWater = "water";
+ public static final String LiquidSeedOil = "seedoil";
+ public static final String LiquidCreosote = "Creosote Oil";
+ public static final String LiquidEthanol = "bioethanol";
+ public static final String LiquidHoney = "for.honey";
+}
diff --git a/src/Java/binnie/core/AbstractMod.java b/src/Java/binnie/core/AbstractMod.java
new file mode 100644
index 0000000000..74f274cdb7
--- /dev/null
+++ b/src/Java/binnie/core/AbstractMod.java
@@ -0,0 +1,158 @@
+package binnie.core;
+
+import binnie.Binnie;
+import binnie.core.gui.IBinnieGUID;
+import binnie.core.mod.config.ManagerConfig;
+import binnie.core.mod.parser.FieldParser;
+import binnie.core.network.BinniePacketHandler;
+import binnie.core.network.IPacketID;
+import binnie.core.network.IPacketProvider;
+import binnie.core.network.packet.MessageBinnie;
+import binnie.core.proxy.IProxyCore;
+import cpw.mods.fml.common.eventhandler.EventBus;
+import cpw.mods.fml.common.network.NetworkRegistry;
+import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper;
+import cpw.mods.fml.relauncher.Side;
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.LinkedHashSet;
+import java.util.List;
+import net.minecraftforge.common.MinecraftForge;
+
+public abstract class AbstractMod
+ implements IPacketProvider, IInitializable
+{
+ private SimpleNetworkWrapper wrapper;
+
+ public AbstractMod()
+ {
+ BinnieCore.registerMod(this);
+ MinecraftForge.EVENT_BUS.register(this);
+ }
+
+ public abstract boolean isActive();
+
+ public abstract String getChannel();
+
+ public IPacketID[] getPacketIDs()
+ {
+ return new IPacketID[0];
+ }
+
+ public IBinnieGUID[] getGUIDs()
+ {
+ return new IBinnieGUID[0];
+ }
+
+ public Class[] getConfigs()
+ {
+ return new Class[0];
+ }
+
+ public abstract IProxyCore getProxy();
+
+ public abstract String getModID();
+
+ public SimpleNetworkWrapper getNetworkWrapper()
+ {
+ return this.wrapper;
+ }
+
+ protected abstract Class<? extends BinniePacketHandler> getPacketHandler();
+
+ public void preInit()
+ {
+ if (!isActive()) {
+ return;
+ }
+ if (getConfigs() != null) {
+ for (Class cls : getConfigs()) {
+ Binnie.Configuration.registerConfiguration(cls, this);
+ }
+ }
+ getProxy().preInit();
+ for (IInitializable module : this.modules) {
+ module.preInit();
+ }
+ for (Field field : getClass().getFields()) {
+ this.fields.add(field);
+ }
+ for (Class cls : getClass().getClasses()) {
+ for (Field field : getClass().getFields()) {
+ this.fields.add(field);
+ }
+ }
+ for (IInitializable module : this.modules) {
+ for (Field field : module.getClass().getFields()) {
+ this.fields.add(field);
+ }
+ }
+ for (Field field : this.fields) {
+ try
+ {
+ FieldParser.preInitParse(field, this);
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+
+ public void init()
+ {
+ if (!isActive()) {
+ return;
+ }
+ getProxy().init();
+
+ this.wrapper = NetworkRegistry.INSTANCE.newSimpleChannel(getChannel());
+
+ this.wrapper.registerMessage(getPacketHandler(), MessageBinnie.class, 1, Side.CLIENT);
+ this.wrapper.registerMessage(getPacketHandler(), MessageBinnie.class, 1, Side.SERVER);
+ for (IInitializable module : this.modules) {
+ module.init();
+ }
+ for (Field field : this.fields) {
+ try
+ {
+ FieldParser.initParse(field, this);
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+
+ private LinkedHashSet<Field> fields = new LinkedHashSet();
+
+ public void postInit()
+ {
+ if (!isActive()) {
+ return;
+ }
+ getProxy().postInit();
+ for (IInitializable module : this.modules) {
+ module.postInit();
+ }
+ for (Field field : this.fields) {
+ try
+ {
+ FieldParser.postInitParse(field, this);
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+
+ protected final void addModule(IInitializable init)
+ {
+ this.modules.add(init);
+ MinecraftForge.EVENT_BUS.register(init);
+ }
+
+ protected List<IInitializable> modules = new ArrayList();
+}
diff --git a/src/Java/binnie/core/BinnieCore.java b/src/Java/binnie/core/BinnieCore.java
new file mode 100644
index 0000000000..6f1ce219ef
--- /dev/null
+++ b/src/Java/binnie/core/BinnieCore.java
@@ -0,0 +1,259 @@
+package binnie.core;
+
+import binnie.Binnie;
+import binnie.core.block.MultipassBlockRenderer;
+import binnie.core.block.TileEntityMetadata;
+import binnie.core.gui.BinnieCoreGUI;
+import binnie.core.gui.BinnieGUIHandler;
+import binnie.core.gui.IBinnieGUID;
+import binnie.core.item.ItemFieldKit;
+import binnie.core.item.ItemGenesis;
+import binnie.core.item.ModuleItems;
+import binnie.core.liquid.FluidContainer;
+import binnie.core.liquid.ItemFluidContainer;
+import binnie.core.liquid.ManagerLiquid;
+import binnie.core.machines.MachineGroup;
+import binnie.core.machines.storage.ModuleStorage;
+import binnie.core.mod.config.ConfigurationMain;
+import binnie.core.mod.config.ConfigurationMods;
+import binnie.core.mod.config.ManagerConfig;
+import binnie.core.mod.parser.FieldParser;
+import binnie.core.mod.parser.ItemParser;
+import binnie.core.network.BinnieCorePacketID;
+import binnie.core.network.BinniePacketHandler;
+import binnie.core.network.IPacketID;
+import binnie.core.proxy.BinnieProxy;
+import binnie.core.proxy.IBinnieProxy;
+import binnie.core.resource.ManagerResource;
+import binnie.core.triggers.ModuleTrigger;
+import binnie.craftgui.minecraft.ModuleCraftGUI;
+import com.mojang.authlib.GameProfile;
+import cpw.mods.fml.client.registry.RenderingRegistry;
+import cpw.mods.fml.common.Loader;
+import cpw.mods.fml.common.Mod;
+import cpw.mods.fml.common.Mod.EventHandler;
+import cpw.mods.fml.common.Mod.Instance;
+import cpw.mods.fml.common.SidedProxy;
+import cpw.mods.fml.common.event.FMLInitializationEvent;
+import cpw.mods.fml.common.event.FMLPostInitializationEvent;
+import cpw.mods.fml.common.event.FMLPreInitializationEvent;
+import cpw.mods.fml.common.eventhandler.SubscribeEvent;
+import cpw.mods.fml.common.network.NetworkRegistry;
+import cpw.mods.fml.common.registry.GameRegistry;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import forestry.api.core.ForestryEvent.SpeciesDiscovered;
+import forestry.api.genetics.IAlleleSpecies;
+import forestry.api.genetics.IBreedingTracker;
+import forestry.plugins.PluginManager.Module;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import net.minecraft.client.renderer.texture.TextureMap;
+import net.minecraft.entity.player.EntityPlayerMP;
+import net.minecraft.item.Item;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.server.MinecraftServer;
+import net.minecraft.server.management.ServerConfigurationManager;
+import net.minecraftforge.client.event.TextureStitchEvent.Pre;
+
+@Mod(modid="BinnieCore", name="Binnie Core", useMetadata=true)
+public final class BinnieCore
+ extends AbstractMod
+{
+ @Mod.Instance("BinnieCore")
+ public static BinnieCore instance;
+ @SidedProxy(clientSide="binnie.core.proxy.BinnieProxyClient", serverSide="binnie.core.proxy.BinnieProxyServer")
+ public static BinnieProxy proxy;
+ public static int multipassRenderID;
+
+ @Mod.EventHandler
+ public void preInit(FMLPreInitializationEvent evt)
+ {
+ Binnie.Configuration.registerConfiguration(ConfigurationMods.class, this);
+ for (ManagerBase baseManager : Binnie.Managers) {
+ addModule(baseManager);
+ }
+ addModule(new ModuleCraftGUI());
+ addModule(new ModuleStorage());
+ addModule(new ModuleItems());
+ if (Loader.isModLoaded("BuildCraft|Silicon")) {
+ addModule(new ModuleTrigger());
+ }
+ preInit();
+ }
+
+ @Mod.EventHandler
+ public void init(FMLInitializationEvent evt)
+ {
+ init();
+ }
+
+ @Mod.EventHandler
+ public void postInit(FMLPostInitializationEvent evt)
+ {
+ postInit();
+ }
+
+ public IBinnieGUID[] getGUIDs()
+ {
+ return BinnieCoreGUI.values();
+ }
+
+ public void preInit()
+ {
+ instance = this;
+ for (FluidContainer container : FluidContainer.values())
+ {
+ Item item = new ItemFluidContainer(container);
+ GameRegistry.registerItem(item, item.getUnlocalizedName().substring(5));
+ }
+ FieldParser.parsers.add(new ItemParser());
+
+ super.preInit();
+ }
+
+ public void init()
+ {
+ super.init();
+ for (AbstractMod mod : getActiveMods()) {
+ NetworkRegistry.INSTANCE.registerGuiHandler(mod, new BinnieGUIHandler(mod));
+ }
+ multipassRenderID = RenderingRegistry.getNextAvailableRenderId();
+ RenderingRegistry.registerBlockHandler(new MultipassBlockRenderer());
+
+ GameRegistry.registerTileEntity(TileEntityMetadata.class, "binnie.tile.metadata");
+ }
+
+ public static boolean isLepidopteryActive()
+ {
+ return PluginManager.Module.LEPIDOPTEROLOGY.isEnabled();
+ }
+
+ public static boolean isApicultureActive()
+ {
+ return PluginManager.Module.APICULTURE.isEnabled();
+ }
+
+ public static boolean isArboricultureActive()
+ {
+ return PluginManager.Module.ARBORICULTURE.isEnabled();
+ }
+
+ public static boolean isBotanyActive()
+ {
+ return ConfigurationMods.botany;
+ }
+
+ public static boolean isGeneticsActive()
+ {
+ return ConfigurationMods.genetics;
+ }
+
+ public static boolean isExtraBeesActive()
+ {
+ return (ConfigurationMods.extraBees) && (isApicultureActive());
+ }
+
+ public static boolean isExtraTreesActive()
+ {
+ return (ConfigurationMods.extraTrees) && (isArboricultureActive());
+ }
+
+ public void postInit()
+ {
+ super.postInit();
+ }
+
+ private static List<AbstractMod> modList = new ArrayList();
+ public static MachineGroup packageCompartment;
+ public static ItemGenesis genesis;
+ public static ItemFieldKit fieldKit;
+
+ static void registerMod(AbstractMod mod)
+ {
+ modList.add(mod);
+ }
+
+ private static List<AbstractMod> getActiveMods()
+ {
+ List<AbstractMod> list = new ArrayList();
+ for (AbstractMod mod : modList) {
+ if (mod.isActive()) {
+ list.add(mod);
+ }
+ }
+ return list;
+ }
+
+ @SubscribeEvent
+ @SideOnly(Side.CLIENT)
+ public void handleSpeciesDiscovered(ForestryEvent.SpeciesDiscovered event)
+ {
+ try
+ {
+ EntityPlayerMP player = MinecraftServer.getServer().getConfigurationManager().func_152612_a(event.username.getName());
+ if (player == null) {
+ return;
+ }
+ event.tracker.synchToPlayer(player);
+ NBTTagCompound nbt = new NBTTagCompound();
+ nbt.setString("species", event.species.getUID());
+ }
+ catch (Exception e) {}
+ }
+
+ public String getChannel()
+ {
+ return "BIN";
+ }
+
+ public IBinnieProxy getProxy()
+ {
+ return proxy;
+ }
+
+ public String getModID()
+ {
+ return "binniecore";
+ }
+
+ public IPacketID[] getPacketIDs()
+ {
+ return BinnieCorePacketID.values();
+ }
+
+ @SubscribeEvent
+ @SideOnly(Side.CLIENT)
+ public void handleTextureRemap(TextureStitchEvent.Pre event)
+ {
+ if (event.map.getTextureType() == 0) {
+ Binnie.Liquid.reloadIcons(event.map);
+ }
+ Binnie.Resource.registerIcons(event.map, event.map.getTextureType());
+ }
+
+ public Class<?>[] getConfigs()
+ {
+ return new Class[] { ConfigurationMain.class };
+ }
+
+ protected Class<? extends BinniePacketHandler> getPacketHandler()
+ {
+ return PacketHandler.class;
+ }
+
+ public static class PacketHandler
+ extends BinniePacketHandler
+ {
+ public PacketHandler()
+ {
+ super();
+ }
+ }
+
+ public boolean isActive()
+ {
+ return true;
+ }
+}
diff --git a/src/Java/binnie/core/IInitializable.java b/src/Java/binnie/core/IInitializable.java
new file mode 100644
index 0000000000..7a357faa12
--- /dev/null
+++ b/src/Java/binnie/core/IInitializable.java
@@ -0,0 +1,10 @@
+package binnie.core;
+
+public abstract interface IInitializable
+{
+ public abstract void preInit();
+
+ public abstract void init();
+
+ public abstract void postInit();
+}
diff --git a/src/Java/binnie/core/ManagerBase.java b/src/Java/binnie/core/ManagerBase.java
new file mode 100644
index 0000000000..9627ed20bd
--- /dev/null
+++ b/src/Java/binnie/core/ManagerBase.java
@@ -0,0 +1,19 @@
+package binnie.core;
+
+import binnie.Binnie;
+import java.util.List;
+
+public abstract class ManagerBase
+ implements IInitializable
+{
+ public ManagerBase()
+ {
+ Binnie.Managers.add(this);
+ }
+
+ public void preInit() {}
+
+ public void init() {}
+
+ public void postInit() {}
+}
diff --git a/src/Java/binnie/core/Mods.java b/src/Java/binnie/core/Mods.java
new file mode 100644
index 0000000000..9c242aa712
--- /dev/null
+++ b/src/Java/binnie/core/Mods.java
@@ -0,0 +1 @@
+// INTERNAL ERROR // \ No newline at end of file
diff --git a/src/Java/binnie/core/block/BlockMetadata.java b/src/Java/binnie/core/block/BlockMetadata.java
new file mode 100644
index 0000000000..39b461d01d
--- /dev/null
+++ b/src/Java/binnie/core/block/BlockMetadata.java
@@ -0,0 +1,138 @@
+package binnie.core.block;
+
+import binnie.core.BinnieCore;
+import binnie.core.proxy.BinnieProxy;
+import java.util.ArrayList;
+import java.util.List;
+import net.minecraft.block.Block;
+import net.minecraft.block.BlockContainer;
+import net.minecraft.block.material.Material;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.PlayerCapabilities;
+import net.minecraft.item.ItemStack;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.IIcon;
+import net.minecraft.util.MovingObjectPosition;
+import net.minecraft.world.IBlockAccess;
+import net.minecraft.world.World;
+import net.minecraftforge.common.util.ForgeDirection;
+
+public class BlockMetadata
+ extends BlockContainer
+ implements IBlockMetadata
+{
+ public BlockMetadata(Material material)
+ {
+ super(material);
+ }
+
+ public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int blockMeta, int fortune)
+ {
+ return getBlockDropped(this, world, x, y, z, blockMeta);
+ }
+
+ public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z)
+ {
+ return breakBlock(this, player, world, x, y, z);
+ }
+
+ public TileEntity createNewTileEntity(World var1, int i)
+ {
+ return new TileEntityMetadata();
+ }
+
+ public boolean hasTileEntity(int meta)
+ {
+ return true;
+ }
+
+ public boolean onBlockEventReceived(World par1World, int par2, int par3, int par4, int par5, int par6)
+ {
+ super.onBlockEventReceived(par1World, par2, par3, par4, par5, par6);
+ TileEntity tileentity = par1World.getTileEntity(par2, par3, par4);
+ return tileentity != null ? tileentity.receiveClientEvent(par5, par6) : false;
+ }
+
+ public IIcon getIcon(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
+ {
+ int metadata = TileEntityMetadata.getTileMetadata(par1IBlockAccess, par2, par3, par4);
+ return getIcon(par5, metadata);
+ }
+
+ public String getBlockName(ItemStack par1ItemStack)
+ {
+ return getLocalizedName();
+ }
+
+ public void getBlockTooltip(ItemStack par1ItemStack, List par3List) {}
+
+ public int getPlacedMeta(ItemStack item, World world, int x, int y, int z, ForgeDirection clickedBlock)
+ {
+ int damage = TileEntityMetadata.getItemDamage(item);
+ return damage;
+ }
+
+ public int getDroppedMeta(int tileMeta, int blockMeta)
+ {
+ return tileMeta;
+ }
+
+ public static ArrayList<ItemStack> getBlockDropped(IBlockMetadata block, World world, int x, int y, int z, int blockMeta)
+ {
+ ArrayList<ItemStack> array = new ArrayList();
+ TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
+ if ((tile != null) && (!tile.hasDroppedBlock()))
+ {
+ int meta = block.getDroppedMeta(world.getBlockMetadata(x, y, z), tile.getTileMetadata());
+ array.add(TileEntityMetadata.getItemStack((Block)block, meta));
+ }
+ return array;
+ }
+
+ static int temporyMeta = -1;
+
+ public static boolean breakBlock(IBlockMetadata block, EntityPlayer player, World world, int i, int j, int k)
+ {
+ List<ItemStack> drops = new ArrayList();
+
+ Block block2 = (Block)block;
+
+ TileEntityMetadata tile = TileEntityMetadata.getTile(world, i, j, k);
+ if ((tile != null) && (!tile.hasDroppedBlock()))
+ {
+ int tileMeta = TileEntityMetadata.getTileMetadata(world, i, j, k);
+ drops = block2.getDrops(world, i, j, k, world.getBlockMetadata(i, j, k), 0);
+ }
+ boolean hasBeenBroken = world.setBlockToAir(i, j, k);
+ if ((hasBeenBroken) && (BinnieCore.proxy.isSimulating(world)) && (drops.size() > 0) && ((player == null) || (!player.capabilities.isCreativeMode)))
+ {
+ for (ItemStack drop : drops) {
+ block.dropAsStack(world, i, j, k, drop);
+ }
+ tile.dropBlock();
+ }
+ return hasBeenBroken;
+ }
+
+ public void dropAsStack(World world, int x, int y, int z, ItemStack drop)
+ {
+ dropBlockAsItem(world, x, y, z, drop);
+ }
+
+ public void breakBlock(World par1World, int par2, int par3, int par4, Block par5, int par6)
+ {
+ super.breakBlock(par1World, par2, par3, par4, par5, par6);
+ par1World.removeTileEntity(par2, par3, par4);
+ }
+
+ public static ItemStack getPickBlock(World world, int x, int y, int z)
+ {
+ List<ItemStack> list = getBlockDropped((IBlockMetadata)world.getBlock(x, y, z), world, x, y, z, world.getBlockMetadata(x, y, z));
+ return list.isEmpty() ? null : (ItemStack)list.get(0);
+ }
+
+ public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z)
+ {
+ return getPickBlock(world, x, y, z);
+ }
+}
diff --git a/src/Java/binnie/core/block/IBlockMetadata.java b/src/Java/binnie/core/block/IBlockMetadata.java
new file mode 100644
index 0000000000..b182139de7
--- /dev/null
+++ b/src/Java/binnie/core/block/IBlockMetadata.java
@@ -0,0 +1,21 @@
+package binnie.core.block;
+
+import java.util.List;
+import net.minecraft.block.ITileEntityProvider;
+import net.minecraft.item.ItemStack;
+import net.minecraft.world.World;
+import net.minecraftforge.common.util.ForgeDirection;
+
+public abstract interface IBlockMetadata
+ extends ITileEntityProvider
+{
+ public abstract int getPlacedMeta(ItemStack paramItemStack, World paramWorld, int paramInt1, int paramInt2, int paramInt3, ForgeDirection paramForgeDirection);
+
+ public abstract int getDroppedMeta(int paramInt1, int paramInt2);
+
+ public abstract String getBlockName(ItemStack paramItemStack);
+
+ public abstract void getBlockTooltip(ItemStack paramItemStack, List paramList);
+
+ public abstract void dropAsStack(World paramWorld, int paramInt1, int paramInt2, int paramInt3, ItemStack paramItemStack);
+}
diff --git a/src/Java/binnie/core/block/IMultipassBlock.java b/src/Java/binnie/core/block/IMultipassBlock.java
new file mode 100644
index 0000000000..fd578c0ee5
--- /dev/null
+++ b/src/Java/binnie/core/block/IMultipassBlock.java
@@ -0,0 +1,8 @@
+package binnie.core.block;
+
+public abstract interface IMultipassBlock
+{
+ public abstract int getNumberOfPasses();
+
+ public abstract int colorMultiplier(int paramInt);
+}
diff --git a/src/Java/binnie/core/block/ItemMetadata.java b/src/Java/binnie/core/block/ItemMetadata.java
new file mode 100644
index 0000000000..a3cd5173a9
--- /dev/null
+++ b/src/Java/binnie/core/block/ItemMetadata.java
@@ -0,0 +1,67 @@
+package binnie.core.block;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import java.util.List;
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemBlock;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.IIcon;
+import net.minecraft.world.World;
+
+public class ItemMetadata
+ extends ItemBlock
+{
+ public ItemMetadata(Block block)
+ {
+ super(block);
+ }
+
+ public int getMetadata(int par1)
+ {
+ return 0;
+ }
+
+ public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metadata)
+ {
+ Block block = this.field_150939_a;
+ if (!(block instanceof IBlockMetadata)) {
+ return false;
+ }
+ int placedMeta = ((IBlockMetadata)block).getPlacedMeta(stack, world, x, y, z, net.minecraftforge.common.util.ForgeDirection.values()[side]);
+ if (placedMeta < 0) {
+ return false;
+ }
+ if (!world.setBlock(x, y, z, block, metadata, 3)) {
+ return false;
+ }
+ if (world.getBlock(x, y, z) == block)
+ {
+ TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
+ if (tile != null) {
+ tile.setTileMetadata(placedMeta, false);
+ }
+ block.onBlockPlacedBy(world, x, y, z, player, stack);
+ block.onPostBlockPlaced(world, x, y, z, metadata);
+ }
+ return true;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public String getItemStackDisplayName(ItemStack par1ItemStack)
+ {
+ return ((IBlockMetadata)this.field_150939_a).getBlockName(par1ItemStack);
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
+ {
+ ((IBlockMetadata)this.field_150939_a).getBlockTooltip(par1ItemStack, par3List);
+ }
+
+ public IIcon getIconFromDamage(int par1)
+ {
+ return this.field_150939_a.getIcon(1, par1);
+ }
+}
diff --git a/src/Java/binnie/core/block/ItemMetadataRenderer.java b/src/Java/binnie/core/block/ItemMetadataRenderer.java
new file mode 100644
index 0000000000..e96dd068c1
--- /dev/null
+++ b/src/Java/binnie/core/block/ItemMetadataRenderer.java
@@ -0,0 +1,64 @@
+package binnie.core.block;
+
+import net.minecraft.block.Block;
+import net.minecraft.client.renderer.OpenGlHelper;
+import net.minecraft.client.renderer.RenderBlocks;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.client.IItemRenderer;
+import net.minecraftforge.client.IItemRenderer.ItemRenderType;
+import net.minecraftforge.client.IItemRenderer.ItemRendererHelper;
+import org.lwjgl.opengl.GL11;
+
+public class ItemMetadataRenderer
+ implements IItemRenderer
+{
+ public boolean handleRenderType(ItemStack item, IItemRenderer.ItemRenderType type)
+ {
+ return (type == IItemRenderer.ItemRenderType.INVENTORY) || (type == IItemRenderer.ItemRenderType.ENTITY) || (type == IItemRenderer.ItemRenderType.EQUIPPED) || (type == IItemRenderer.ItemRenderType.EQUIPPED_FIRST_PERSON);
+ }
+
+ public boolean shouldUseRenderHelper(IItemRenderer.ItemRenderType type, ItemStack item, IItemRenderer.ItemRendererHelper helper)
+ {
+ if (type == IItemRenderer.ItemRenderType.INVENTORY) {
+ return helper == IItemRenderer.ItemRendererHelper.INVENTORY_BLOCK;
+ }
+ if (type == IItemRenderer.ItemRenderType.ENTITY) {
+ return (helper == IItemRenderer.ItemRendererHelper.ENTITY_BOBBING) || (helper == IItemRenderer.ItemRendererHelper.ENTITY_ROTATION);
+ }
+ if ((type == IItemRenderer.ItemRenderType.EQUIPPED) || (type == IItemRenderer.ItemRenderType.EQUIPPED_FIRST_PERSON)) {
+ return helper == IItemRenderer.ItemRendererHelper.EQUIPPED_BLOCK;
+ }
+ return false;
+ }
+
+ public void renderItem(IItemRenderer.ItemRenderType type, ItemStack item, Object... data)
+ {
+ GL11.glPushMatrix();
+
+
+
+
+
+
+
+
+
+
+ Block block = Block.getBlockFromItem(item.getItem());
+ if (type == IItemRenderer.ItemRenderType.EQUIPPED_FIRST_PERSON) {
+ GL11.glTranslated(0.5D, 0.5D, 0.5D);
+ }
+ if ((type == IItemRenderer.ItemRenderType.INVENTORY) &&
+ (block.getRenderBlockPass() != 0))
+ {
+ GL11.glAlphaFunc(516, 0.1F);
+ GL11.glEnable(3042);
+ OpenGlHelper.glBlendFunc(770, 771, 1, 0);
+ }
+ GL11.glPushMatrix();
+ ((RenderBlocks)data[0]).renderBlockAsItem(block, TileEntityMetadata.getItemDamage(item), 1.0F);
+
+ GL11.glPopMatrix();
+ GL11.glPopMatrix();
+ }
+}
diff --git a/src/Java/binnie/core/block/MultipassBlockRenderer.java b/src/Java/binnie/core/block/MultipassBlockRenderer.java
new file mode 100644
index 0000000000..cc809fb8e5
--- /dev/null
+++ b/src/Java/binnie/core/block/MultipassBlockRenderer.java
@@ -0,0 +1,106 @@
+package binnie.core.block;
+
+import binnie.core.BinnieCore;
+import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
+import net.minecraft.block.Block;
+import net.minecraft.client.renderer.RenderBlocks;
+import net.minecraft.client.renderer.Tessellator;
+import net.minecraft.world.IBlockAccess;
+import org.lwjgl.opengl.GL11;
+
+public class MultipassBlockRenderer
+ implements ISimpleBlockRenderingHandler
+{
+ public static MultipassBlockRenderer instance;
+
+ public MultipassBlockRenderer()
+ {
+ instance = this;
+ }
+
+ private void setColour(Tessellator tess, int colour)
+ {
+ float var6 = (colour >> 16 & 0xFF) / 255.0F;
+ float var7 = (colour >> 8 & 0xFF) / 255.0F;
+ float var8 = (colour & 0xFF) / 255.0F;
+ GL11.glColor3f(var6, var7, var8);
+ }
+
+ private static int layer = 0;
+
+ public static int getLayer()
+ {
+ return layer;
+ }
+
+ public void renderInventoryBlock(Block block, int meta, int modelID, RenderBlocks renderer)
+ {
+ block.setBlockBoundsForItemRender();
+ renderer.setRenderBoundsFromBlock(block);
+ GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
+ for (layer = 0; layer < ((IMultipassBlock)block).getNumberOfPasses(); layer += 1) {
+ renderItem(block, renderer, meta);
+ }
+ layer = 0;
+ }
+
+ public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer)
+ {
+ boolean r = true;
+ for (layer = 0; layer < ((IMultipassBlock)block).getNumberOfPasses(); layer += 1) {
+ r = renderer.renderStandardBlock(block, x, y, z);
+ }
+ layer = 0;
+ return r;
+ }
+
+ public boolean shouldRender3DInInventory(int i)
+ {
+ return true;
+ }
+
+ public int getRenderId()
+ {
+ return BinnieCore.multipassRenderID;
+ }
+
+ public void renderItem(Block block, RenderBlocks renderer, int meta)
+ {
+ setColor(((IMultipassBlock)block).colorMultiplier(meta));
+
+ Tessellator tessellator = Tessellator.instance;
+
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(0.0F, -1.0F, 0.0F);
+ renderer.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 0, meta));
+ tessellator.draw();
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(0.0F, 1.0F, 0.0F);
+ renderer.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 1, meta));
+ tessellator.draw();
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(0.0F, 0.0F, -1.0F);
+ renderer.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 2, meta));
+ tessellator.draw();
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(0.0F, 0.0F, 1.0F);
+ renderer.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 3, meta));
+ tessellator.draw();
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(-1.0F, 0.0F, 0.0F);
+ renderer.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 4, meta));
+ tessellator.draw();
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(1.0F, 0.0F, 0.0F);
+ renderer.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 5, meta));
+ tessellator.draw();
+ }
+
+ public void setColor(int l)
+ {
+ float f = (l >> 16 & 0xFF) / 255.0F;
+ float f1 = (l >> 8 & 0xFF) / 255.0F;
+ float f2 = (l & 0xFF) / 255.0F;
+ GL11.glColor3f(f, f1, f2);
+ }
+}
diff --git a/src/Java/binnie/core/block/MultipassItemRenderer.java b/src/Java/binnie/core/block/MultipassItemRenderer.java
new file mode 100644
index 0000000000..6e53642b2f
--- /dev/null
+++ b/src/Java/binnie/core/block/MultipassItemRenderer.java
@@ -0,0 +1,78 @@
+package binnie.core.block;
+
+import net.minecraft.block.Block;
+import net.minecraft.client.renderer.OpenGlHelper;
+import net.minecraft.client.renderer.RenderBlocks;
+import net.minecraft.item.ItemBlock;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.client.IItemRenderer;
+import net.minecraftforge.client.IItemRenderer.ItemRenderType;
+import net.minecraftforge.client.IItemRenderer.ItemRendererHelper;
+import org.lwjgl.opengl.GL11;
+
+public class MultipassItemRenderer
+ implements IItemRenderer
+{
+ private void render(RenderBlocks renderer, ItemStack item, float f, float g, float h)
+ {
+ GL11.glTranslatef(f, g, h);
+
+ Block block = ((ItemBlock)item.getItem()).field_150939_a;
+
+ GL11.glEnable(3008);
+ if (block.getRenderBlockPass() != 0)
+ {
+ GL11.glAlphaFunc(516, 0.1F);
+ GL11.glEnable(3042);
+ OpenGlHelper.glBlendFunc(770, 771, 1, 0);
+ }
+ else
+ {
+ GL11.glAlphaFunc(516, 0.5F);
+ GL11.glDisable(3042);
+ }
+ MultipassBlockRenderer.instance.renderInventoryBlock(block, TileEntityMetadata.getItemDamage(item), 0, renderer);
+ if (block.getRenderBlockPass() == 0) {
+ GL11.glAlphaFunc(516, 0.1F);
+ }
+ GL11.glTranslatef(-f, -g, -h);
+ }
+
+ public boolean handleRenderType(ItemStack item, IItemRenderer.ItemRenderType type)
+ {
+ switch (1.$SwitchMap$net$minecraftforge$client$IItemRenderer$ItemRenderType[type.ordinal()])
+ {
+ case 1:
+ return true;
+ case 2:
+ return true;
+ case 3:
+ return true;
+ case 4:
+ return true;
+ }
+ return false;
+ }
+
+ public boolean shouldUseRenderHelper(IItemRenderer.ItemRenderType type, ItemStack item, IItemRenderer.ItemRendererHelper helper)
+ {
+ return true;
+ }
+
+ public void renderItem(IItemRenderer.ItemRenderType type, ItemStack item, Object... data)
+ {
+ switch (1.$SwitchMap$net$minecraftforge$client$IItemRenderer$ItemRenderType[type.ordinal()])
+ {
+ case 1:
+ render((RenderBlocks)data[0], item, 0.0F, 0.0F, 0.0F);
+ break;
+ case 2:
+ case 4:
+ render((RenderBlocks)data[0], item, 0.5F, 0.5F, 0.5F);
+ break;
+ case 3:
+ render((RenderBlocks)data[0], item, 0.0F, 0.0F, 0.0F);
+ break;
+ }
+ }
+}
diff --git a/src/Java/binnie/core/block/TileEntityMetadata.java b/src/Java/binnie/core/block/TileEntityMetadata.java
new file mode 100644
index 0000000000..28563e66e7
--- /dev/null
+++ b/src/Java/binnie/core/block/TileEntityMetadata.java
@@ -0,0 +1,116 @@
+package binnie.core.block;
+
+import binnie.core.BinnieCore;
+import binnie.core.network.packet.MessageMetadata;
+import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper;
+import net.minecraft.block.Block;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.network.Packet;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.world.IBlockAccess;
+import net.minecraft.world.World;
+
+public class TileEntityMetadata
+ extends TileEntity
+{
+ private int meta;
+
+ public boolean receiveClientEvent(int par1, int par2)
+ {
+ if (par1 == 42)
+ {
+ this.meta = par2;
+ this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
+ }
+ return true;
+ }
+
+ public void readFromNBT(NBTTagCompound nbt)
+ {
+ super.readFromNBT(nbt);
+ this.meta = nbt.getInteger("meta");
+ }
+
+ public void writeToNBT(NBTTagCompound nbt)
+ {
+ super.writeToNBT(nbt);
+ nbt.setInteger("meta", this.meta);
+ }
+
+ public boolean canUpdate()
+ {
+ return false;
+ }
+
+ public int getTileMetadata()
+ {
+ return this.meta;
+ }
+
+ public void setTileMetadata(int meta, boolean notify)
+ {
+ if (this.meta != meta)
+ {
+ this.meta = meta;
+ if (notify) {
+ this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
+ }
+ }
+ }
+
+ public Packet getDescriptionPacket()
+ {
+ return BinnieCore.instance.getNetworkWrapper().getPacketFrom(new MessageMetadata(this.xCoord, this.yCoord, this.zCoord, this.meta).GetMessage());
+ }
+
+ public static TileEntityMetadata getTile(IBlockAccess world, int x, int y, int z)
+ {
+ TileEntity tile = world.getTileEntity(x, y, z);
+ if (!(tile instanceof TileEntityMetadata)) {
+ return null;
+ }
+ return (TileEntityMetadata)tile;
+ }
+
+ public static ItemStack getItemStack(Block block, int damage)
+ {
+ ItemStack item = new ItemStack(block, 1, 0);
+ setItemDamage(item, damage);
+ return item;
+ }
+
+ public static void setItemDamage(ItemStack item, int i)
+ {
+ item.setItemDamage(i < 16387 ? i : 16387);
+ NBTTagCompound tag = new NBTTagCompound();
+ tag.setInteger("meta", i);
+ item.setTagCompound(tag);
+ }
+
+ public static int getItemDamage(ItemStack item)
+ {
+ if ((item.hasTagCompound()) && (item.getTagCompound().hasKey("meta"))) {
+ return item.getTagCompound().getInteger("meta");
+ }
+ return item.getItemDamage();
+ }
+
+ public static int getTileMetadata(IBlockAccess world, int x, int y, int z)
+ {
+ TileEntityMetadata tile = getTile(world, x, y, z);
+ return tile == null ? 0 : tile.getTileMetadata();
+ }
+
+ private boolean droppedBlock = false;
+
+ public boolean hasDroppedBlock()
+ {
+ return this.droppedBlock;
+ }
+
+ public void dropBlock()
+ {
+ this.droppedBlock = true;
+ }
+}
diff --git a/src/Java/binnie/core/circuits/BinnieCircuit.java b/src/Java/binnie/core/circuits/BinnieCircuit.java
new file mode 100644
index 0000000000..e7e2db0203
--- /dev/null
+++ b/src/Java/binnie/core/circuits/BinnieCircuit.java
@@ -0,0 +1,80 @@
+package binnie.core.circuits;
+
+import forestry.api.circuits.ChipsetManager;
+import forestry.api.circuits.ICircuit;
+import forestry.api.circuits.ICircuitLayout;
+import forestry.api.circuits.ICircuitRegistry;
+import forestry.api.circuits.ISolderManager;
+import java.util.ArrayList;
+import java.util.List;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.tileentity.TileEntity;
+
+public class BinnieCircuit
+ implements ICircuit
+{
+ private String uid;
+ private int limit;
+ private List<String> tooltips = new ArrayList();
+
+ public BinnieCircuit(String uid, int limit, ICircuitLayout layout, ItemStack itemStack)
+ {
+ this.uid = ("binnie.circuit." + uid);
+ this.limit = limit;
+ ChipsetManager.circuitRegistry.registerCircuit(this);
+ if (itemStack != null) {
+ ChipsetManager.solderManager.addRecipe(layout, itemStack, this);
+ }
+ }
+
+ public BinnieCircuit(String uid, int limit, ICircuitLayout layout, Item item, int itemMeta)
+ {
+ this(uid, limit, layout, new ItemStack(item, 1, itemMeta));
+ }
+
+ public void addTooltipString(String string)
+ {
+ this.tooltips.add(string);
+ }
+
+ public String getUID()
+ {
+ return this.uid;
+ }
+
+ public boolean requiresDiscovery()
+ {
+ return false;
+ }
+
+ public int getLimit()
+ {
+ return this.limit;
+ }
+
+ public String getName()
+ {
+ return this.uid;
+ }
+
+ public boolean isCircuitable(TileEntity tile)
+ {
+ return false;
+ }
+
+ public void onInsertion(int slot, TileEntity tile) {}
+
+ public void onLoad(int slot, TileEntity tile) {}
+
+ public void onRemoval(int slot, TileEntity tile) {}
+
+ public void onTick(int slot, TileEntity tile) {}
+
+ public void addTooltip(List<String> list)
+ {
+ for (String string : this.tooltips) {
+ list.add(" - " + string);
+ }
+ }
+}
diff --git a/src/Java/binnie/core/circuits/BinnieCircuitLayout.java b/src/Java/binnie/core/circuits/BinnieCircuitLayout.java
new file mode 100644
index 0000000000..0f160054ce
--- /dev/null
+++ b/src/Java/binnie/core/circuits/BinnieCircuitLayout.java
@@ -0,0 +1,37 @@
+package binnie.core.circuits;
+
+import binnie.Binnie;
+import binnie.core.AbstractMod;
+import binnie.core.language.ManagerLanguage;
+import forestry.api.circuits.ChipsetManager;
+import forestry.api.circuits.ICircuitLayout;
+import forestry.api.circuits.ICircuitRegistry;
+
+public class BinnieCircuitLayout
+ implements ICircuitLayout
+{
+ private String uid;
+ private AbstractMod mod;
+
+ public BinnieCircuitLayout(AbstractMod mod, String uid)
+ {
+ this.uid = uid;
+ this.mod = mod;
+ ChipsetManager.circuitRegistry.registerLayout(this);
+ }
+
+ public String getUID()
+ {
+ return "binnie.circuitLayout" + this.uid;
+ }
+
+ public String getName()
+ {
+ return Binnie.Language.localise(this.mod, "circuit.layout." + this.uid.toLowerCase());
+ }
+
+ public String getUsage()
+ {
+ return Binnie.Language.localise(this.mod, "circuit.layout." + this.uid.toLowerCase() + ".usage");
+ }
+}
diff --git a/src/Java/binnie/core/genetics/BeeBreedingSystem.java b/src/Java/binnie/core/genetics/BeeBreedingSystem.java
new file mode 100644
index 0000000000..2c3947b5a0
--- /dev/null
+++ b/src/Java/binnie/core/genetics/BeeBreedingSystem.java
@@ -0,0 +1,125 @@
+package binnie.core.genetics;
+
+import binnie.Binnie;
+import binnie.core.BinnieCore;
+import binnie.core.language.ManagerLanguage;
+import binnie.core.resource.ManagerResource;
+import binnie.extrabees.ExtraBees;
+import forestry.api.apiculture.EnumBeeChromosome;
+import forestry.api.apiculture.EnumBeeType;
+import forestry.api.apiculture.IApiaristTracker;
+import forestry.api.apiculture.IBeeMutation;
+import forestry.api.apiculture.IBeeRoot;
+import forestry.api.genetics.IAllele;
+import forestry.api.genetics.IBreedingTracker;
+import forestry.api.genetics.IChromosomeType;
+import forestry.api.genetics.IMutation;
+import forestry.api.genetics.ISpeciesRoot;
+import java.util.TreeSet;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+
+class BeeBreedingSystem
+ extends BreedingSystem
+{
+ public BeeBreedingSystem()
+ {
+ this.iconUndiscovered = Binnie.Resource.getItemIcon(ExtraBees.instance, "icon/undiscoveredBee");
+ this.iconDiscovered = Binnie.Resource.getItemIcon(ExtraBees.instance, "icon/discoveredBee");
+ }
+
+ public float getChance(IMutation mutation, EntityPlayer player, IAllele species1, IAllele species2)
+ {
+ return ((IBeeMutation)mutation).getChance(new VirtualBeeHousing(player), species1, species2, getSpeciesRoot().templateAsGenome(getSpeciesRoot().getTemplate(species1.getUID())), getSpeciesRoot().templateAsGenome(getSpeciesRoot().getTemplate(species2.getUID())));
+ }
+
+ public ISpeciesRoot getSpeciesRoot()
+ {
+ return Binnie.Genetics.getBeeRoot();
+ }
+
+ public int getColour()
+ {
+ return 16767232;
+ }
+
+ public Class<? extends IBreedingTracker> getTrackerClass()
+ {
+ return IApiaristTracker.class;
+ }
+
+ public String getAlleleName(IChromosomeType chromosome, IAllele allele)
+ {
+ if (chromosome == EnumBeeChromosome.FERTILITY)
+ {
+ if (allele.getUID().contains("Low")) {
+ return Binnie.Language.localise(BinnieCore.instance, "allele.fertility.low");
+ }
+ if (allele.getUID().contains("Normal")) {
+ return Binnie.Language.localise(BinnieCore.instance, "allele.fertility.normal");
+ }
+ if (allele.getUID().contains("High")) {
+ return Binnie.Language.localise(BinnieCore.instance, "allele.fertility.high");
+ }
+ if (allele.getUID().contains("Maximum")) {
+ return Binnie.Language.localise(BinnieCore.instance, "allele.fertility.maximum");
+ }
+ }
+ return super.getAlleleName(chromosome, allele);
+ }
+
+ public boolean isDNAManipulable(ItemStack member)
+ {
+ return ((IBeeRoot)getSpeciesRoot()).getType(member) == EnumBeeType.LARVAE;
+ }
+
+ public int[] getActiveTypes()
+ {
+ return new int[] { EnumBeeType.DRONE.ordinal(), EnumBeeType.PRINCESS.ordinal(), EnumBeeType.QUEEN.ordinal(), EnumBeeType.LARVAE.ordinal() };
+ }
+
+ public void addExtraAlleles(IChromosomeType chromosome, TreeSet<IAllele> alleles)
+ {
+ switch (1.$SwitchMap$forestry$api$apiculture$EnumBeeChromosome[((EnumBeeChromosome)chromosome).ordinal()])
+ {
+ case 1:
+ for (ForestryAllele.Fertility a : ForestryAllele.Fertility.values()) {
+ alleles.add(a.getAllele());
+ }
+ break;
+ case 2:
+ for (ForestryAllele.Flowering a : ForestryAllele.Flowering.values()) {
+ alleles.add(a.getAllele());
+ }
+ break;
+ case 3:
+ case 4:
+ for (Tolerance a : Tolerance.values()) {
+ alleles.add(a.getAllele());
+ }
+ break;
+ case 5:
+ for (ForestryAllele.Lifespan a : ForestryAllele.Lifespan.values()) {
+ alleles.add(a.getAllele());
+ }
+ break;
+ case 6:
+ for (ForestryAllele.Speed a : ForestryAllele.Speed.values()) {
+ alleles.add(a.getAllele());
+ }
+ break;
+ case 7:
+ for (ForestryAllele.Territory a : ForestryAllele.Territory.values()) {
+ alleles.add(a.getAllele());
+ }
+ break;
+ case 8:
+ case 9:
+ case 10:
+ for (ForestryAllele.Bool a : ForestryAllele.Bool.values()) {
+ alleles.add(a.getAllele());
+ }
+ break;
+ }
+ }
+}
diff --git a/src/Java/binnie/core/genetics/BeeModifierLogic.java b/src/Java/binnie/core/genetics/BeeModifierLogic.java
new file mode 100644
index 0000000000..65a2ab3103
--- /dev/null
+++ b/src/Java/binnie/core/genetics/BeeModifierLogic.java
@@ -0,0 +1,47 @@
+package binnie.core.genetics;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class BeeModifierLogic
+{
+ private Map<EnumBeeModifier, Float[]> modifiers = new HashMap();
+ private List<EnumBeeBooleanModifier> booleanModifiers = new ArrayList();
+
+ public float getModifier(EnumBeeModifier modifier, float currentModifier)
+ {
+ if (!this.modifiers.containsKey(modifier)) {
+ return 1.0F;
+ }
+ float mult = ((Float[])this.modifiers.get(modifier))[0].floatValue();
+ float max = ((Float[])this.modifiers.get(modifier))[1].floatValue();
+ if (max >= 1.0F)
+ {
+ if (max <= currentModifier) {
+ return 1.0F;
+ }
+ return Math.min(max / currentModifier, mult);
+ }
+ if (max >= currentModifier) {
+ return 1.0F;
+ }
+ return Math.max(max / currentModifier, mult);
+ }
+
+ public boolean getModifier(EnumBeeBooleanModifier modifier)
+ {
+ return this.booleanModifiers.contains(modifier);
+ }
+
+ public void setModifier(EnumBeeBooleanModifier modifier)
+ {
+ this.booleanModifiers.add(modifier);
+ }
+
+ public void setModifier(EnumBeeModifier modifier, float mult, float max)
+ {
+ this.modifiers.put(modifier, new Float[] { Float.valueOf(mult), Float.valueOf(max) });
+ }
+}
diff --git a/src/Java/binnie/core/genetics/BreedingSystem.java b/src/Java/binnie/core/genetics/BreedingSystem.java
new file mode 100644
index 0000000000..1bdd5d6376
--- /dev/null
+++ b/src/Java/binnie/core/genetics/BreedingSystem.java
@@ -0,0 +1,558 @@
+package binnie.core.genetics;
+
+import binnie.Binnie;
+import binnie.core.BinnieCore;
+import binnie.core.language.ManagerLanguage;
+import binnie.core.proxy.BinnieProxy;
+import binnie.core.resource.BinnieIcon;
+import binnie.extrabees.genetics.ExtraBeeMutation;
+import com.mojang.authlib.GameProfile;
+import cpw.mods.fml.common.eventhandler.EventBus;
+import cpw.mods.fml.common.eventhandler.SubscribeEvent;
+import forestry.api.core.ForestryEvent.SyncedBreedingTracker;
+import forestry.api.genetics.AlleleManager;
+import forestry.api.genetics.IAllele;
+import forestry.api.genetics.IAlleleBoolean;
+import forestry.api.genetics.IAlleleRegistry;
+import forestry.api.genetics.IAlleleSpecies;
+import forestry.api.genetics.IBreedingTracker;
+import forestry.api.genetics.IChromosomeType;
+import forestry.api.genetics.IClassification;
+import forestry.api.genetics.IGenome;
+import forestry.api.genetics.IIndividual;
+import forestry.api.genetics.IMutation;
+import forestry.api.genetics.ISpeciesRoot;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeSet;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.IIcon;
+import net.minecraft.world.World;
+import net.minecraftforge.common.MinecraftForge;
+
+public abstract class BreedingSystem
+ implements IItemStackRepresentitive
+{
+ protected BinnieIcon iconUndiscovered;
+ protected BinnieIcon iconDiscovered;
+
+ public BreedingSystem()
+ {
+ Binnie.Genetics.registerBreedingSystem(this);
+ MinecraftForge.EVENT_BUS.register(this);
+ }
+
+ public String getChromosomeName(IChromosomeType chromo)
+ {
+ return BinnieCore.proxy.localise(getSpeciesRoot().getUID() + ".chromosome." + chromo.getName());
+ }
+
+ public String getChromosomeShortName(IChromosomeType chromo)
+ {
+ return BinnieCore.proxy.localise(getSpeciesRoot().getUID() + ".chromosome." + chromo.getName() + ".short");
+ }
+
+ public final String getEpitome(float discoveredPercentage)
+ {
+ int i = 0;
+ if (discoveredPercentage == 1.0F) {
+ i = 6;
+ } else if (discoveredPercentage < 0.1F) {
+ i = 0;
+ } else if (discoveredPercentage < 0.3F) {
+ i = 1;
+ } else if (discoveredPercentage < 0.5F) {
+ i = 2;
+ } else if (discoveredPercentage < 0.7F) {
+ i = 3;
+ } else if (discoveredPercentage < 0.9F) {
+ i = 4;
+ } else if (discoveredPercentage < 1.0F) {
+ i = 5;
+ }
+ return BinnieCore.proxy.localise(getSpeciesRoot().getUID() + ".epitome." + i);
+ }
+
+ private List<IClassification> allBranches = new ArrayList();
+ List<IAlleleSpecies> allActiveSpecies = new ArrayList();
+ private List<IAlleleSpecies> allSpecies = new ArrayList();
+ private List<IMutation> allMutations = new ArrayList();
+ private Map<IAlleleSpecies, List<IMutation>> resultantMutations = new HashMap();
+ private Map<IAlleleSpecies, List<IMutation>> furtherMutations = new HashMap();
+ private Map<IAlleleSpecies, List<IMutation>> allResultantMutations = new HashMap();
+ private Map<IAlleleSpecies, List<IMutation>> allFurtherMutations = new HashMap();
+ public float discoveredSpeciesPercentage;
+ public int totalSpeciesCount;
+ public int discoveredSpeciesCount;
+ public int totalSecretCount;
+ public int discoveredSecretCount;
+ public float discoveredBranchPercentage;
+ public int totalBranchCount;
+ public int discoveredBranchCount;
+ private int totalSecretBranchCount;
+ private int discoveredSecretBranchCount;
+ String currentEpithet;
+
+ public abstract ISpeciesRoot getSpeciesRoot();
+
+ public final List<IClassification> getAllBranches()
+ {
+ return this.allBranches;
+ }
+
+ public final Collection<IAlleleSpecies> getAllSpecies()
+ {
+ return this.allActiveSpecies;
+ }
+
+ public final Collection<IMutation> getAllMutations()
+ {
+ return this.allMutations;
+ }
+
+ public void calculateArrays()
+ {
+ Collection<IAllele> allAlleles = AlleleManager.alleleRegistry.getRegisteredAlleles().values();
+
+
+ this.resultantMutations = new HashMap();
+ this.furtherMutations = new HashMap();
+ this.allResultantMutations = new HashMap();
+ this.allFurtherMutations = new HashMap();
+
+ this.allActiveSpecies = new ArrayList();
+ this.allSpecies = new ArrayList();
+ for (IAllele species : allAlleles) {
+ if (getSpeciesRoot().getTemplate(species.getUID()) != null)
+ {
+ this.resultantMutations.put((IAlleleSpecies)species, new ArrayList());
+
+ this.furtherMutations.put((IAlleleSpecies)species, new ArrayList());
+
+ this.allResultantMutations.put((IAlleleSpecies)species, new ArrayList());
+
+ this.allFurtherMutations.put((IAlleleSpecies)species, new ArrayList());
+
+ this.allSpecies.add((IAlleleSpecies)species);
+ if ((!isBlacklisted(species)) && (!species.getUID().contains("speciesBotAlfheim"))) {
+ this.allActiveSpecies.add((IAlleleSpecies)species);
+ }
+ }
+ }
+ this.allMutations = new ArrayList();
+
+ Collection<IClassification> allRegBranches = AlleleManager.alleleRegistry.getRegisteredClassifications().values();
+
+
+ this.allBranches = new ArrayList();
+ for (IClassification branch : allRegBranches) {
+ if ((branch.getMemberSpecies().length > 0) &&
+ (getSpeciesRoot().getTemplate(branch.getMemberSpecies()[0].getUID()) != null))
+ {
+ boolean possible = false;
+ for (IAlleleSpecies species : branch.getMemberSpecies()) {
+ if (this.allActiveSpecies.contains(species)) {
+ possible = true;
+ }
+ }
+ if (possible) {
+ this.allBranches.add(branch);
+ }
+ }
+ }
+ if (getSpeciesRoot().getMutations(false) != null)
+ {
+ Set<IMutation> mutations = new LinkedHashSet();
+ mutations.addAll(getSpeciesRoot().getMutations(false));
+ if (this == Binnie.Genetics.beeBreedingSystem) {
+ mutations.addAll(ExtraBeeMutation.mutations);
+ }
+ for (IMutation mutation : mutations)
+ {
+ this.allMutations.add(mutation);
+
+ Set<IAlleleSpecies> participatingSpecies = new LinkedHashSet();
+ if ((mutation.getAllele0() instanceof IAlleleSpecies)) {
+ participatingSpecies.add((IAlleleSpecies)mutation.getAllele0());
+ }
+ if ((mutation.getAllele1() instanceof IAlleleSpecies)) {
+ participatingSpecies.add((IAlleleSpecies)mutation.getAllele1());
+ }
+ for (IAlleleSpecies species : participatingSpecies)
+ {
+ ((List)this.allFurtherMutations.get(species)).add(mutation);
+ if (this.allActiveSpecies.contains(species)) {
+ ((List)this.furtherMutations.get(species)).add(mutation);
+ }
+ }
+ if (this.resultantMutations.containsKey(mutation.getTemplate()[0]))
+ {
+ ((List)this.allResultantMutations.get(mutation.getTemplate()[0])).add(mutation);
+ ((List)this.resultantMutations.get(mutation.getTemplate()[0])).add(mutation);
+ }
+ }
+ }
+ }
+
+ public final boolean isBlacklisted(IAllele allele)
+ {
+ return AlleleManager.alleleRegistry.isBlacklisted(allele.getUID());
+ }
+
+ public final List<IMutation> getResultantMutations(IAlleleSpecies species, boolean includeInactive)
+ {
+ if (this.resultantMutations.isEmpty()) {
+ calculateArrays();
+ }
+ return includeInactive ? (List)this.allResultantMutations.get(species) : (List)this.resultantMutations.get(species);
+ }
+
+ public final List<IMutation> getResultantMutations(IAlleleSpecies species)
+ {
+ if (this.resultantMutations.isEmpty()) {
+ calculateArrays();
+ }
+ return (List)this.resultantMutations.get(species);
+ }
+
+ public final List<IMutation> getFurtherMutations(IAlleleSpecies species, boolean includeInactive)
+ {
+ if (this.furtherMutations.isEmpty()) {
+ calculateArrays();
+ }
+ return includeInactive ? (List)this.allFurtherMutations.get(species) : (List)this.furtherMutations.get(species);
+ }
+
+ public final List<IMutation> getFurtherMutations(IAlleleSpecies species)
+ {
+ if (this.furtherMutations.isEmpty()) {
+ calculateArrays();
+ }
+ return (List)this.furtherMutations.get(species);
+ }
+
+ public final boolean isMutationDiscovered(IMutation mutation, World world, GameProfile name)
+ {
+ return isMutationDiscovered(mutation, getSpeciesRoot().getBreedingTracker(world, name));
+ }
+
+ public final boolean isMutationDiscovered(IMutation mutation, IBreedingTracker tracker)
+ {
+ if (tracker == null) {
+ return true;
+ }
+ return tracker.isDiscovered(mutation);
+ }
+
+ public final boolean isSpeciesDiscovered(IAlleleSpecies species, World world, GameProfile name)
+ {
+ return isSpeciesDiscovered(species, getSpeciesRoot().getBreedingTracker(world, name));
+ }
+
+ public final boolean isSpeciesDiscovered(IAlleleSpecies species, IBreedingTracker tracker)
+ {
+ if (tracker == null) {
+ return true;
+ }
+ return tracker.isDiscovered(species);
+ }
+
+ public final boolean isSecret(IAlleleSpecies species)
+ {
+ return !species.isCounted();
+ }
+
+ public final boolean isSecret(IClassification branch)
+ {
+ for (IAlleleSpecies species : branch.getMemberSpecies()) {
+ if (!isSecret(species)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public final Collection<IClassification> getDiscoveredBranches(World world, GameProfile player)
+ {
+ List<IClassification> branches = new ArrayList();
+ for (IClassification branch : getAllBranches())
+ {
+ boolean discovered = false;
+ for (IAlleleSpecies species : branch.getMemberSpecies()) {
+ if (isSpeciesDiscovered(species, world, player)) {
+ discovered = true;
+ }
+ }
+ if (discovered) {
+ branches.add(branch);
+ }
+ }
+ return branches;
+ }
+
+ public final Collection<IClassification> getDiscoveredBranches(IBreedingTracker tracker)
+ {
+ List<IClassification> branches = new ArrayList();
+ for (IClassification branch : getAllBranches())
+ {
+ boolean discovered = false;
+ for (IAlleleSpecies species : branch.getMemberSpecies()) {
+ if (isSpeciesDiscovered(species, tracker)) {
+ discovered = true;
+ }
+ }
+ if (discovered) {
+ branches.add(branch);
+ }
+ }
+ return branches;
+ }
+
+ public final Collection<IAlleleSpecies> getDiscoveredSpecies(World world, GameProfile player)
+ {
+ List<IAlleleSpecies> speciesList = new ArrayList();
+ for (IAlleleSpecies species : getAllSpecies()) {
+ if (isSpeciesDiscovered(species, world, player)) {
+ speciesList.add(species);
+ }
+ }
+ return speciesList;
+ }
+
+ public final Collection<IAlleleSpecies> getDiscoveredSpecies(IBreedingTracker tracker)
+ {
+ List<IAlleleSpecies> speciesList = new ArrayList();
+ for (IAlleleSpecies species : getAllSpecies()) {
+ if (isSpeciesDiscovered(species, tracker)) {
+ speciesList.add(species);
+ }
+ }
+ return speciesList;
+ }
+
+ public final List<IMutation> getDiscoveredMutations(World world, GameProfile player)
+ {
+ List<IMutation> speciesList = new ArrayList();
+ for (IMutation species : getAllMutations()) {
+ if (isMutationDiscovered(species, world, player)) {
+ speciesList.add(species);
+ }
+ }
+ return speciesList;
+ }
+
+ public final List<IMutation> getDiscoveredMutations(IBreedingTracker tracker)
+ {
+ List<IMutation> speciesList = new ArrayList();
+ for (IMutation species : getAllMutations()) {
+ if (isMutationDiscovered(species, tracker)) {
+ speciesList.add(species);
+ }
+ }
+ return speciesList;
+ }
+
+ public final int getDiscoveredBranchMembers(IClassification branch, IBreedingTracker tracker)
+ {
+ int discoveredSpecies = 0;
+ for (IAlleleSpecies species : branch.getMemberSpecies()) {
+ if (isSpeciesDiscovered(species, tracker)) {
+ discoveredSpecies++;
+ }
+ }
+ return discoveredSpecies;
+ }
+
+ public IIcon getUndiscoveredIcon()
+ {
+ return this.iconUndiscovered.getIcon();
+ }
+
+ public IIcon getDiscoveredIcon()
+ {
+ return this.iconDiscovered.getIcon();
+ }
+
+ public abstract float getChance(IMutation paramIMutation, EntityPlayer paramEntityPlayer, IAllele paramIAllele1, IAllele paramIAllele2);
+
+ public abstract Class<? extends IBreedingTracker> getTrackerClass();
+
+ @SubscribeEvent
+ public final void onSyncBreedingTracker(ForestryEvent.SyncedBreedingTracker event)
+ {
+ IBreedingTracker tracker = event.tracker;
+ if (!getTrackerClass().isInstance(tracker)) {
+ return;
+ }
+ syncTracker(tracker);
+ }
+
+ public final void syncTracker(IBreedingTracker tracker)
+ {
+ this.discoveredSpeciesPercentage = 0.0F;
+
+ this.totalSpeciesCount = 0;
+ this.discoveredSpeciesCount = 0;
+
+ this.totalSecretCount = 0;
+ this.discoveredSecretCount = 0;
+
+ Collection<IAlleleSpecies> discoveredSpecies = getDiscoveredSpecies(tracker);
+ Collection<IAlleleSpecies> allSpecies = getAllSpecies();
+ for (IAlleleSpecies species : allSpecies) {
+ if (!isSecret(species))
+ {
+ this.totalSpeciesCount += 1;
+ if (isSpeciesDiscovered(species, tracker)) {
+ this.discoveredSpeciesCount += 1;
+ }
+ }
+ else
+ {
+ this.totalSecretCount += 1;
+ if (isSpeciesDiscovered(species, tracker)) {
+ this.discoveredSecretCount += 1;
+ }
+ }
+ }
+ this.discoveredBranchPercentage = 0.0F;
+
+ this.totalBranchCount = 0;
+ this.discoveredBranchCount = 0;
+
+ Collection<IClassification> discoveredBranches = getDiscoveredBranches(tracker);
+ Collection<IClassification> allBranches = getAllBranches();
+ for (IClassification branch : allBranches) {
+ if (!isSecret(branch))
+ {
+ this.totalBranchCount += 1;
+ if (discoveredBranches.contains(branch)) {
+ this.discoveredBranchCount += 1;
+ }
+ }
+ else
+ {
+ this.totalSecretBranchCount += 1;
+ if (discoveredBranches.contains(branch)) {
+ this.discoveredSecretBranchCount += 1;
+ }
+ }
+ }
+ this.discoveredSpeciesPercentage = (this.discoveredSpeciesCount / this.totalSpeciesCount);
+
+ this.discoveredBranchPercentage = (this.discoveredBranchCount / this.totalBranchCount);
+
+
+ String epithet = getEpitome();
+
+ onSyncBreedingTracker(tracker);
+ }
+
+ public void onSyncBreedingTracker(IBreedingTracker tracker) {}
+
+ public String getEpitome()
+ {
+ return getEpitome(this.discoveredSpeciesPercentage);
+ }
+
+ public final String getDescriptor()
+ {
+ return BinnieCore.proxy.localise(getSpeciesRoot().getUID() + ".descriptor");
+ }
+
+ public final String getIdent()
+ {
+ return getSpeciesRoot().getUID();
+ }
+
+ public final IChromosomeType getChromosome(int i)
+ {
+ for (IChromosomeType chromosome : getSpeciesRoot().getKaryotype()) {
+ if (i == chromosome.ordinal()) {
+ return chromosome;
+ }
+ }
+ return null;
+ }
+
+ public abstract int getColour();
+
+ public String getAlleleName(IChromosomeType chromosome, IAllele allele)
+ {
+ if ((allele instanceof IAlleleBoolean)) {
+ return ((IAlleleBoolean)allele).getValue() ? Binnie.Language.localise(BinnieCore.instance, "allele.true") : Binnie.Language.localise(BinnieCore.instance, "allele.false");
+ }
+ if (allele.getName() == "for.gui.maximum") {
+ return Binnie.Language.localise(BinnieCore.instance, "allele.fertility.maximum");
+ }
+ return allele.getName();
+ }
+
+ public String getName()
+ {
+ return BinnieCore.proxy.localise(getSpeciesRoot().getUID() + ".shortName");
+ }
+
+ public ItemStack getItemStackRepresentitive()
+ {
+ IIndividual first = (IIndividual)getSpeciesRoot().getIndividualTemplates().get(0);
+ return getSpeciesRoot().getMemberStack(first, getDefaultType());
+ }
+
+ public String toString()
+ {
+ return getName();
+ }
+
+ public abstract boolean isDNAManipulable(ItemStack paramItemStack);
+
+ public IIndividual getConversion(ItemStack stack)
+ {
+ return null;
+ }
+
+ public final IIndividual getDefaultIndividual()
+ {
+ return getSpeciesRoot().templateAsIndividual(getSpeciesRoot().getDefaultTemplate());
+ }
+
+ public final int getDefaultType()
+ {
+ return getActiveTypes()[0];
+ }
+
+ public abstract int[] getActiveTypes();
+
+ public abstract void addExtraAlleles(IChromosomeType paramIChromosomeType, TreeSet<IAllele> paramTreeSet);
+
+ public ItemStack getConversionStack(ItemStack stack)
+ {
+ return getSpeciesRoot().getMemberStack(getConversion(stack), getDefaultType());
+ }
+
+ public final Collection<IChromosomeType> getActiveKaryotype()
+ {
+ return Binnie.Genetics.getActiveChromosomes(getSpeciesRoot());
+ }
+
+ public ItemStack getDefaultMember(String uid)
+ {
+ return getSpeciesRoot().getMemberStack(getIndividual(uid), getDefaultType());
+ }
+
+ public IIndividual getIndividual(String uid)
+ {
+ return getSpeciesRoot().templateAsIndividual(getSpeciesRoot().getTemplate(uid));
+ }
+
+ public IGenome getGenome(String uid)
+ {
+ return getSpeciesRoot().templateAsGenome(getSpeciesRoot().getTemplate(uid));
+ }
+}
diff --git a/src/Java/binnie/core/genetics/EnumBeeBooleanModifier.java b/src/Java/binnie/core/genetics/EnumBeeBooleanModifier.java
new file mode 100644
index 0000000000..58eae12e79
--- /dev/null
+++ b/src/Java/binnie/core/genetics/EnumBeeBooleanModifier.java
@@ -0,0 +1,8 @@
+package binnie.core.genetics;
+
+public enum EnumBeeBooleanModifier
+{
+ Sealed, SelfLighted, SunlightStimulated, Hellish;
+
+ private EnumBeeBooleanModifier() {}
+}
diff --git a/src/Java/binnie/core/genetics/EnumBeeModifier.java b/src/Java/binnie/core/genetics/EnumBeeModifier.java
new file mode 100644
index 0000000000..92fc30bda0
--- /dev/null
+++ b/src/Java/binnie/core/genetics/EnumBeeModifier.java
@@ -0,0 +1,17 @@
+package binnie.core.genetics;
+
+import binnie.Binnie;
+import binnie.core.BinnieCore;
+import binnie.core.language.ManagerLanguage;
+
+public enum EnumBeeModifier
+{
+ Territory, Mutation, Lifespan, Production, Flowering, GeneticDecay;
+
+ private EnumBeeModifier() {}
+
+ public String getName()
+ {
+ return Binnie.Language.localise(BinnieCore.instance, "beemodifier." + name().toLowerCase());
+ }
+}
diff --git a/src/Java/binnie/core/genetics/FlowerBreedingSystem.java b/src/Java/binnie/core/genetics/FlowerBreedingSystem.java
new file mode 100644
index 0000000000..bc706976c8
--- /dev/null
+++ b/src/Java/binnie/core/genetics/FlowerBreedingSystem.java
@@ -0,0 +1,129 @@
+package binnie.core.genetics;
+
+import binnie.Binnie;
+import binnie.botany.api.EnumFlowerChromosome;
+import binnie.botany.api.EnumFlowerStage;
+import binnie.botany.api.IBotanistTracker;
+import binnie.botany.api.IFlowerMutation;
+import binnie.botany.api.IFlowerRoot;
+import binnie.botany.core.BotanyCore;
+import binnie.botany.genetics.EnumFlowerColor;
+import binnie.core.BinnieCore;
+import binnie.core.language.ManagerLanguage;
+import binnie.core.resource.ManagerResource;
+import binnie.extrabees.ExtraBees;
+import forestry.api.genetics.IAllele;
+import forestry.api.genetics.IBreedingTracker;
+import forestry.api.genetics.IChromosomeType;
+import forestry.api.genetics.IIndividual;
+import forestry.api.genetics.IMutation;
+import forestry.api.genetics.ISpeciesRoot;
+import java.util.TreeSet;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+
+class FlowerBreedingSystem
+ extends BreedingSystem
+{
+ public FlowerBreedingSystem()
+ {
+ this.iconUndiscovered = Binnie.Resource.getItemIcon(ExtraBees.instance, "icon/undiscoveredBee");
+ this.iconDiscovered = Binnie.Resource.getItemIcon(ExtraBees.instance, "icon/discoveredBee");
+ }
+
+ public float getChance(IMutation mutation, EntityPlayer player, IAllele species1, IAllele species2)
+ {
+ return ((IFlowerMutation)mutation).getBaseChance();
+ }
+
+ public ISpeciesRoot getSpeciesRoot()
+ {
+ return Binnie.Genetics.getFlowerRoot();
+ }
+
+ public int getColour()
+ {
+ return 14563127;
+ }
+
+ public Class<? extends IBreedingTracker> getTrackerClass()
+ {
+ return IBotanistTracker.class;
+ }
+
+ public String getAlleleName(IChromosomeType chromosome, IAllele allele)
+ {
+ if (chromosome == EnumFlowerChromosome.FERTILITY)
+ {
+ if (allele.getUID().contains("Low")) {
+ return Binnie.Language.localise(BinnieCore.instance, "allele.fertility.low");
+ }
+ if (allele.getUID().contains("Normal")) {
+ return Binnie.Language.localise(BinnieCore.instance, "allele.fertility.normal");
+ }
+ if (allele.getUID().contains("High")) {
+ return Binnie.Language.localise(BinnieCore.instance, "allele.fertility.high");
+ }
+ if (allele.getUID().contains("Maximum")) {
+ return Binnie.Language.localise(BinnieCore.instance, "allele.fertility.maximum");
+ }
+ }
+ return super.getAlleleName(chromosome, allele);
+ }
+
+ public boolean isDNAManipulable(ItemStack member)
+ {
+ return ((IFlowerRoot)getSpeciesRoot()).getType(member) == EnumFlowerStage.POLLEN;
+ }
+
+ public IIndividual getConversion(ItemStack stack)
+ {
+ return BotanyCore.getFlowerRoot().getConversion(stack);
+ }
+
+ public int[] getActiveTypes()
+ {
+ return new int[] { EnumFlowerStage.FLOWER.ordinal(), EnumFlowerStage.POLLEN.ordinal(), EnumFlowerStage.SEED.ordinal() };
+ }
+
+ public void addExtraAlleles(IChromosomeType chromosome, TreeSet<IAllele> alleles)
+ {
+ switch (1.$SwitchMap$binnie$botany$api$EnumFlowerChromosome[((EnumFlowerChromosome)chromosome).ordinal()])
+ {
+ case 1:
+ for (ForestryAllele.Fertility a : ForestryAllele.Fertility.values()) {
+ alleles.add(a.getAllele());
+ }
+ break;
+ case 2:
+ for (ForestryAllele.Lifespan a : ForestryAllele.Lifespan.values()) {
+ alleles.add(a.getAllele());
+ }
+ break;
+ case 3:
+ case 4:
+ case 5:
+ for (Tolerance a : Tolerance.values()) {
+ alleles.add(a.getAllele());
+ }
+ break;
+ case 6:
+ case 7:
+ case 8:
+ for (EnumFlowerColor a : EnumFlowerColor.values()) {
+ alleles.add(a.getAllele());
+ }
+ break;
+ case 9:
+ for (ForestryAllele.Sappiness a : ForestryAllele.Sappiness.values()) {
+ alleles.add(a.getAllele());
+ }
+ break;
+ case 10:
+ for (ForestryAllele.Territory a : ForestryAllele.Territory.values()) {
+ alleles.add(a.getAllele());
+ }
+ break;
+ }
+ }
+}
diff --git a/src/Java/binnie/core/genetics/ForestryAllele.java b/src/Java/binnie/core/genetics/ForestryAllele.java
new file mode 100644
index 0000000000..19a3ad8b6f
--- /dev/null
+++ b/src/Java/binnie/core/genetics/ForestryAllele.java
@@ -0,0 +1,211 @@
+package binnie.core.genetics;
+
+import binnie.Binnie;
+import forestry.api.apiculture.IAlleleBeeSpecies;
+import forestry.api.apiculture.IBeeRoot;
+import forestry.api.genetics.AlleleManager;
+import forestry.api.genetics.IAllele;
+import forestry.api.genetics.IAlleleRegistry;
+
+public class ForestryAllele
+{
+ public static enum Lifespan
+ {
+ Shortest, Shorter, Short, Shortened, Normal, Elongated, Long, Longer, Longest;
+
+ private Lifespan() {}
+
+ public IAllele getAllele()
+ {
+ return AlleleManager.alleleRegistry.getAllele("forestry.lifespan" + toString());
+ }
+ }
+
+ public static enum Speed
+ {
+ Slowest, Slower, Slow, Norm, Fast, Faster, Fastest;
+
+ private Speed() {}
+
+ public IAllele getAllele()
+ {
+ return AlleleManager.alleleRegistry.getAllele("forestry.speed" + toString());
+ }
+ }
+
+ public static enum Fertility
+ {
+ Low, Normal, High, Maximum;
+
+ private Fertility() {}
+
+ public IAllele getAllele()
+ {
+ return AlleleManager.alleleRegistry.getAllele("forestry.fertility" + toString());
+ }
+ }
+
+ public static enum Flowering
+ {
+ Slowest, Slower, Slow, Average, Fast, Faster, Fastest, Maximum;
+
+ private Flowering() {}
+
+ public IAllele getAllele()
+ {
+ return AlleleManager.alleleRegistry.getAllele("forestry.flowering" + toString());
+ }
+ }
+
+ public static enum Territory
+ {
+ Default, Large, Larger, Largest;
+
+ private Territory() {}
+
+ public IAllele getAllele()
+ {
+ return AlleleManager.alleleRegistry.getAllele("forestry.territory" + toString());
+ }
+ }
+
+ public static enum Sappiness
+ {
+ Lowest, Lower, Low, Average, High, Higher, Highest;
+
+ private Sappiness() {}
+
+ public IAllele getAllele()
+ {
+ return AlleleManager.alleleRegistry.getAllele("forestry.sappiness" + toString());
+ }
+ }
+
+ public static enum TreeHeight
+ {
+ Smallest, Smaller, Small, Average, Large, Larger, Largest, Gigantic;
+
+ private TreeHeight() {}
+
+ public IAllele getAllele()
+ {
+ return AlleleManager.alleleRegistry.getAllele("forestry.height" + (this == Average ? "Max10" : toString()));
+ }
+ }
+
+ public static enum Size
+ {
+ Smallest, Smaller, Small, Average, Large, Larger, Largest;
+
+ private Size() {}
+
+ public IAllele getAllele()
+ {
+ return AlleleManager.alleleRegistry.getAllele("forestry.size" + toString());
+ }
+ }
+
+ public static enum Saplings
+ {
+ Lowest, Lower, Low, Average, High, Higher, Highest;
+
+ private Saplings() {}
+
+ public IAllele getAllele()
+ {
+ String s = toString();
+ if (this == Average) {
+ s = "Default";
+ }
+ if (this == High) {
+ s = "Double";
+ }
+ if (this == Higher) {
+ s = "Triple";
+ }
+ return AlleleManager.alleleRegistry.getAllele("forestry.saplings" + s);
+ }
+ }
+
+ public static enum Yield
+ {
+ Lowest, Lower, Low, Average, High, Higher, Highest;
+
+ private Yield() {}
+
+ public IAllele getAllele()
+ {
+ return AlleleManager.alleleRegistry.getAllele("forestry.yield" + (this == Average ? "Default" : toString()));
+ }
+ }
+
+ public static enum Maturation
+ {
+ Slowest, Slower, Slow, Average, Fast, Faster, Fastest;
+
+ private Maturation() {}
+
+ public IAllele getAllele()
+ {
+ return AlleleManager.alleleRegistry.getAllele("forestry.maturation" + toString());
+ }
+ }
+
+ public static enum Bool
+ {
+ True, False;
+
+ private Bool() {}
+
+ public IAllele getAllele()
+ {
+ return AlleleManager.alleleRegistry.getAllele("forestry.bool" + toString());
+ }
+
+ public static IAllele get(boolean bool)
+ {
+ return (bool ? True : False).getAllele();
+ }
+ }
+
+ public static enum Growth
+ {
+ Tropical;
+
+ private Growth() {}
+
+ public IAllele getAllele()
+ {
+ return AlleleManager.alleleRegistry.getAllele("forestry.growth" + toString());
+ }
+ }
+
+ public static enum Int
+ {
+ Int1, Int2, Int3, Int4, Int5, Int6, Int7, Int8, Int9, Int10;
+
+ private Int() {}
+
+ public IAllele getAllele()
+ {
+ return AlleleManager.alleleRegistry.getAllele("forestry.i" + (ordinal() + 1) + "d");
+ }
+ }
+
+ public static enum BeeSpecies
+ {
+ Modest, Noble, Forest, Rural, Marshy, Sinister, Tropical, Wintry, Merry, Austere, Imperial, Ended, Meadows, Common, Frugal, Unweary, Diligent, Majestic, Cultivated, Industrious, Valiant, Secluded, Hermitic, Spectral, Exotic, Fiendish, Monastic, Steadfast, Miry, Farmerly, Boggy, Demonic;
+
+ private BeeSpecies() {}
+
+ public IAlleleBeeSpecies getAllele()
+ {
+ return (IAlleleBeeSpecies)AlleleManager.alleleRegistry.getAllele("forestry.species" + toString());
+ }
+
+ public IAllele[] getTemplate()
+ {
+ return Binnie.Genetics.getBeeRoot().getTemplate(getAllele().getUID());
+ }
+ }
+}
diff --git a/src/Java/binnie/core/genetics/Gene.java b/src/Java/binnie/core/genetics/Gene.java
new file mode 100644
index 0000000000..3d071cc1ab
--- /dev/null
+++ b/src/Java/binnie/core/genetics/Gene.java
@@ -0,0 +1,128 @@
+package binnie.core.genetics;
+
+import binnie.Binnie;
+import binnie.genetics.api.IGene;
+import forestry.api.core.INBTTagable;
+import forestry.api.genetics.AlleleManager;
+import forestry.api.genetics.IAllele;
+import forestry.api.genetics.IAlleleRegistry;
+import forestry.api.genetics.IChromosomeType;
+import forestry.api.genetics.ISpeciesRoot;
+import net.minecraft.nbt.NBTTagCompound;
+
+public class Gene
+ implements INBTTagable, IGene
+{
+ private IAllele allele;
+ private IChromosomeType chromosome;
+ private ISpeciesRoot root;
+
+ public ISpeciesRoot getSpeciesRoot()
+ {
+ return this.root;
+ }
+
+ public String toString()
+ {
+ return getAlleleName();
+ }
+
+ public Gene(IAllele allele, IChromosomeType chromosome, ISpeciesRoot root)
+ {
+ this.allele = allele;
+ this.chromosome = chromosome;
+ this.root = root;
+ }
+
+ public Gene(NBTTagCompound nbt)
+ {
+ readFromNBT(nbt);
+ }
+
+ public void readFromNBT(NBTTagCompound nbt)
+ {
+ this.allele = AlleleManager.alleleRegistry.getAllele(nbt.getString("allele"));
+
+ this.root = AlleleManager.alleleRegistry.getSpeciesRoot(nbt.getString("root"));
+
+ int chromoID = nbt.getByte("chromo");
+ if ((this.root != null) && (chromoID >= 0) && (chromoID < this.root.getKaryotype().length)) {
+ this.chromosome = this.root.getKaryotype()[chromoID];
+ }
+ }
+
+ public void writeToNBT(NBTTagCompound nbt)
+ {
+ nbt.setString("allele", this.allele.getUID());
+ nbt.setString("root", this.root.getUID());
+ nbt.setByte("chromo", (byte)this.chromosome.ordinal());
+ }
+
+ public boolean isCorrupted()
+ {
+ return (this.allele == null) || (this.chromosome == null) || (this.root == null);
+ }
+
+ public static Gene create(NBTTagCompound nbt)
+ {
+ Gene gene = new Gene(nbt);
+ return gene.isCorrupted() ? null : gene;
+ }
+
+ public static Gene create(IAllele allele, IChromosomeType chromosome, ISpeciesRoot root)
+ {
+ Gene gene = new Gene(allele, chromosome, root);
+ return gene.isCorrupted() ? null : gene;
+ }
+
+ public NBTTagCompound getNBTTagCompound()
+ {
+ NBTTagCompound nbt = new NBTTagCompound();
+ writeToNBT(nbt);
+ return nbt;
+ }
+
+ public String getName()
+ {
+ return Binnie.Genetics.getSystem(this.root).getAlleleName(this.chromosome, this.allele);
+ }
+
+ public BreedingSystem getSystem()
+ {
+ return Binnie.Genetics.getSystem(this.root);
+ }
+
+ public IChromosomeType getChromosome()
+ {
+ return this.chromosome;
+ }
+
+ public IAllele getAllele()
+ {
+ return this.allele;
+ }
+
+ public boolean equals(Object obj)
+ {
+ if (!(obj instanceof Gene)) {
+ return false;
+ }
+ Gene g = (Gene)obj;
+ return (this.allele == g.allele) && (this.chromosome.ordinal() == g.chromosome.ordinal()) && (this.root == g.root);
+ }
+
+ public String getAlleleName()
+ {
+ return getSystem().getAlleleName(this.chromosome, this.allele);
+ }
+
+ public String getChromosomeName()
+ {
+ return getSystem().getChromosomeName(this.chromosome);
+ }
+
+ public String getShortChromosomeName()
+ {
+ return getSystem().getChromosomeShortName(this.chromosome);
+ }
+}
diff --git a/src/Java/binnie/core/genetics/IAlleleProvider.java b/src/Java/binnie/core/genetics/IAlleleProvider.java
new file mode 100644
index 0000000000..30dc8992e4
--- /dev/null
+++ b/src/Java/binnie/core/genetics/IAlleleProvider.java
@@ -0,0 +1,8 @@
+package binnie.core.genetics;
+
+import forestry.api.genetics.IAllele;
+
+public abstract interface IAlleleProvider
+{
+ public abstract IAllele getAllele();
+}
diff --git a/src/Java/binnie/core/genetics/IBreedingMessage.java b/src/Java/binnie/core/genetics/IBreedingMessage.java
new file mode 100644
index 0000000000..fdd815c122
--- /dev/null
+++ b/src/Java/binnie/core/genetics/IBreedingMessage.java
@@ -0,0 +1,124 @@
+package binnie.core.genetics;
+
+import binnie.Binnie;
+import binnie.core.BinnieCore;
+import binnie.core.language.ManagerLanguage;
+import forestry.api.genetics.AlleleManager;
+import forestry.api.genetics.IAlleleRegistry;
+import forestry.api.genetics.IAlleleSpecies;
+import forestry.api.genetics.IChromosomeType;
+import forestry.api.genetics.IClassification;
+import forestry.api.genetics.ISpeciesRoot;
+import java.util.Map;
+import net.minecraft.item.ItemStack;
+
+abstract interface IBreedingMessage
+{
+ public abstract String getTitle();
+
+ public abstract String getBody();
+
+ public abstract ItemStack getIcon();
+
+ public static class MessageSpeciesDiscovered
+ implements IBreedingMessage
+ {
+ IAlleleSpecies species;
+ ItemStack stack;
+
+ public MessageSpeciesDiscovered(IAlleleSpecies species)
+ {
+ this.species = species;
+ ISpeciesRoot root = null;
+ for (ISpeciesRoot sRoot : AlleleManager.alleleRegistry.getSpeciesRoot().values()) {
+ if (sRoot.getKaryotype()[0].getAlleleClass().isInstance(species)) {
+ root = sRoot;
+ }
+ }
+ if (root != null) {
+ this.stack = root.getMemberStack(root.templateAsIndividual(root.getTemplate(species.getUID())), 0);
+ }
+ }
+
+ public String getTitle()
+ {
+ return Binnie.Language.localise(BinnieCore.instance, "gui.breedingmessage.species");
+ }
+
+ public String getBody()
+ {
+ return this.species.getName();
+ }
+
+ public ItemStack getIcon()
+ {
+ return this.stack;
+ }
+ }
+
+ public static class BranchDiscovered
+ implements IBreedingMessage
+ {
+ IAlleleSpecies species;
+ IClassification classification;
+ ItemStack stack;
+
+ public BranchDiscovered(IAlleleSpecies species, IClassification classification)
+ {
+ this.species = species;
+ this.classification = classification;
+ ISpeciesRoot root = null;
+ for (ISpeciesRoot sRoot : AlleleManager.alleleRegistry.getSpeciesRoot().values()) {
+ if (sRoot.getKaryotype()[0].getAlleleClass().isInstance(species)) {
+ root = sRoot;
+ }
+ }
+ if (root != null) {
+ this.stack = root.getMemberStack(root.templateAsIndividual(root.getTemplate(species.getUID())), 0);
+ }
+ }
+
+ public String getTitle()
+ {
+ return Binnie.Language.localise(BinnieCore.instance, "gui.breedingmessage.branch");
+ }
+
+ public String getBody()
+ {
+ return this.classification.getScientific();
+ }
+
+ public ItemStack getIcon()
+ {
+ return this.stack;
+ }
+ }
+
+ public static class EpithetGained
+ implements IBreedingMessage
+ {
+ String epithet;
+ ItemStack stack;
+
+ public EpithetGained(String epithet, ISpeciesRoot root)
+ {
+ this.epithet = epithet;
+ this.stack = root.getMemberStack(root.templateAsIndividual(root.getDefaultTemplate()), 0);
+ }
+
+ public String getTitle()
+ {
+ return Binnie.Language.localise(BinnieCore.instance, "gui.breedingmessage.epithet");
+ }
+
+ public String getBody()
+ {
+ return this.epithet;
+ }
+
+ public ItemStack getIcon()
+ {
+ return this.stack;
+ }
+ }
+}
diff --git a/src/Java/binnie/core/genetics/IItemStackRepresentitive.java b/src/Java/binnie/core/genetics/IItemStackRepresentitive.java
new file mode 100644
index 0000000000..ccaf2d4ec4
--- /dev/null
+++ b/src/Java/binnie/core/genetics/IItemStackRepresentitive.java
@@ -0,0 +1,8 @@
+package binnie.core.genetics;
+
+import net.minecraft.item.ItemStack;
+
+public abstract interface IItemStackRepresentitive
+{
+ public abstract ItemStack getItemStackRepresentitive();
+}
diff --git a/src/Java/binnie/core/genetics/ManagerGenetics.java b/src/Java/binnie/core/genetics/ManagerGenetics.java
new file mode 100644
index 0000000000..4ea18ca7a4
--- /dev/null
+++ b/src/Java/binnie/core/genetics/ManagerGenetics.java
@@ -0,0 +1,298 @@
+package binnie.core.genetics;
+
+import binnie.Binnie;
+import binnie.botany.api.IFlowerRoot;
+import binnie.botany.genetics.AlleleColor;
+import binnie.core.BinnieCore;
+import binnie.core.ManagerBase;
+import cpw.mods.fml.common.eventhandler.SubscribeEvent;
+import forestry.api.apiculture.IBeeRoot;
+import forestry.api.arboriculture.ITreeRoot;
+import forestry.api.genetics.AlleleManager;
+import forestry.api.genetics.EnumTolerance;
+import forestry.api.genetics.IAllele;
+import forestry.api.genetics.IAlleleFloat;
+import forestry.api.genetics.IAlleleInteger;
+import forestry.api.genetics.IAlleleRegistry;
+import forestry.api.genetics.IAlleleSpecies;
+import forestry.api.genetics.IChromosomeType;
+import forestry.api.genetics.IGenome;
+import forestry.api.genetics.IIndividual;
+import forestry.api.genetics.ISpeciesRoot;
+import forestry.api.lepidopterology.IButterflyRoot;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Comparator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeSet;
+import net.minecraft.item.ItemStack;
+import net.minecraft.world.World;
+import net.minecraftforge.event.world.WorldEvent.Load;
+
+public class ManagerGenetics
+ extends ManagerBase
+{
+ public BreedingSystem beeBreedingSystem;
+ public BreedingSystem treeBreedingSystem;
+ public BreedingSystem mothBreedingSystem;
+ public BreedingSystem flowerBreedingSystem;
+ private final Map<ISpeciesRoot, BreedingSystem> BREEDING_SYSTEMS;
+ private List<IChromosomeType> invalidChromosomeTypes;
+ private Map<ISpeciesRoot, Map<IChromosomeType, List<IAllele>>> chromosomeArray;
+
+ public void init()
+ {
+ if (BinnieCore.isApicultureActive()) {
+ this.beeBreedingSystem = new BeeBreedingSystem();
+ }
+ if (BinnieCore.isArboricultureActive()) {
+ this.treeBreedingSystem = new TreeBreedingSystem();
+ }
+ if (BinnieCore.isLepidopteryActive()) {
+ this.mothBreedingSystem = new MothBreedingSystem();
+ }
+ if (BinnieCore.isBotanyActive()) {
+ this.flowerBreedingSystem = new FlowerBreedingSystem();
+ }
+ }
+
+ public void postInit()
+ {
+ refreshData();
+ }
+
+ public boolean isSpeciesDiscovered(IAlleleSpecies species, World world, boolean nei)
+ {
+ return true;
+ }
+
+ public ITreeRoot getTreeRoot()
+ {
+ return (ITreeRoot)AlleleManager.alleleRegistry.getSpeciesRoot("rootTrees");
+ }
+
+ public IBeeRoot getBeeRoot()
+ {
+ return (IBeeRoot)AlleleManager.alleleRegistry.getSpeciesRoot("rootBees");
+ }
+
+ public IButterflyRoot getButterflyRoot()
+ {
+ return (IButterflyRoot)AlleleManager.alleleRegistry.getSpeciesRoot("rootButterflies");
+ }
+
+ public IFlowerRoot getFlowerRoot()
+ {
+ return (IFlowerRoot)AlleleManager.alleleRegistry.getSpeciesRoot("rootFlowers");
+ }
+
+ public BreedingSystem getSystem(String string)
+ {
+ for (BreedingSystem system : this.BREEDING_SYSTEMS.values()) {
+ if (system.getIdent().equals(string)) {
+ return system;
+ }
+ }
+ return null;
+ }
+
+ public BreedingSystem getSystem(ISpeciesRoot root)
+ {
+ return getSystem(root.getUID());
+ }
+
+ public ISpeciesRoot getSpeciesRoot(IAlleleSpecies species)
+ {
+ for (ISpeciesRoot root : AlleleManager.alleleRegistry.getSpeciesRoot().values()) {
+ if (root.getKaryotype()[0].getAlleleClass().isInstance(species)) {
+ return root;
+ }
+ }
+ return null;
+ }
+
+ public IAllele getToleranceAllele(EnumTolerance tol)
+ {
+ return AlleleManager.alleleRegistry.getAllele(Tolerance.values()[tol.ordinal()].getUID());
+ }
+
+ public int[] getTolerance(EnumTolerance tol)
+ {
+ return Tolerance.values()[tol.ordinal()].getBounds();
+ }
+
+ public Collection<BreedingSystem> getActiveSystems()
+ {
+ return this.BREEDING_SYSTEMS.values();
+ }
+
+ public void registerBreedingSystem(BreedingSystem system)
+ {
+ this.BREEDING_SYSTEMS.put(system.getSpeciesRoot(), system);
+ }
+
+ public BreedingSystem getConversionSystem(ItemStack stack)
+ {
+ for (BreedingSystem system : getActiveSystems()) {
+ if (system.getConversion(stack) != null) {
+ return system;
+ }
+ }
+ return null;
+ }
+
+ public ItemStack getConversionStack(ItemStack stack)
+ {
+ BreedingSystem system = getConversionSystem(stack);
+ return system == null ? null : system.getConversionStack(stack);
+ }
+
+ public IIndividual getConversion(ItemStack stack)
+ {
+ BreedingSystem system = getConversionSystem(stack);
+ return system == null ? null : system.getConversion(stack);
+ }
+
+ @SubscribeEvent
+ public void onWorldLoad(WorldEvent.Load event)
+ {
+ refreshData();
+ }
+
+ private void refreshData()
+ {
+ loadAlleles();
+ for (BreedingSystem system : Binnie.Genetics.getActiveSystems()) {
+ system.calculateArrays();
+ }
+ }
+
+ public ManagerGenetics()
+ {
+ this.BREEDING_SYSTEMS = new LinkedHashMap();
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ this.invalidChromosomeTypes = new ArrayList();
+
+ this.chromosomeArray = new LinkedHashMap();
+ }
+
+ private void loadAlleles()
+ {
+ this.invalidChromosomeTypes.clear();
+ for (ISpeciesRoot root : AlleleManager.alleleRegistry.getSpeciesRoot().values())
+ {
+ BreedingSystem system = getSystem(root);
+ Map<IChromosomeType, List<IAllele>> chromosomeMap = new LinkedHashMap();
+ for (IChromosomeType chromosome : root.getKaryotype())
+ {
+ TreeSet<IAllele> alleles = new TreeSet(new ComparatorAllele());
+ for (IIndividual individual : root.getIndividualTemplates())
+ {
+ IGenome genome = individual.getGenome();
+ try
+ {
+ IAllele a1 = genome.getActiveAllele(chromosome);
+ IAllele a2 = genome.getInactiveAllele(chromosome);
+ if (chromosome.getAlleleClass().isInstance(a1)) {
+ alleles.add(a1);
+ }
+ if (chromosome.getAlleleClass().isInstance(a2)) {
+ alleles.add(a2);
+ }
+ }
+ catch (Exception e) {}
+ }
+ system.addExtraAlleles(chromosome, alleles);
+ if (alleles.size() == 0)
+ {
+ this.invalidChromosomeTypes.add(chromosome);
+ }
+ else
+ {
+ List<IAllele> alleleList = new ArrayList();
+ alleleList.addAll(alleles);
+ chromosomeMap.put(chromosome, alleleList);
+ }
+ }
+ this.chromosomeArray.put(root, chromosomeMap);
+ }
+ }
+
+ static class ComparatorAllele
+ implements Comparator<IAllele>
+ {
+ public int compare(IAllele o1, IAllele o2)
+ {
+ if ((o1 == null) || (o2 == null)) {
+ throw new NullPointerException("Allele is null!");
+ }
+ if (((o1 instanceof IAlleleFloat)) && ((o2 instanceof IAlleleFloat))) {
+ return Float.valueOf(((IAlleleFloat)o1).getValue()).compareTo(Float.valueOf(((IAlleleFloat)o2).getValue()));
+ }
+ if (((o1 instanceof IAlleleInteger)) && ((o2 instanceof IAlleleInteger)) && (!(o1 instanceof AlleleColor))) {
+ return Integer.valueOf(((IAlleleInteger)o1).getValue()).compareTo(Integer.valueOf(((IAlleleInteger)o2).getValue()));
+ }
+ if ((o1.getName() != null) && (o2.getName() != null)) {
+ return o1.getName().compareTo(o2.getName());
+ }
+ return o1.getUID().compareTo(o2.getUID());
+ }
+ }
+
+ public Map<IChromosomeType, List<IAllele>> getChromosomeMap(ISpeciesRoot root)
+ {
+ return (Map)this.chromosomeArray.get(root);
+ }
+
+ public Collection<IChromosomeType> getActiveChromosomes(ISpeciesRoot root)
+ {
+ return getChromosomeMap(root).keySet();
+ }
+
+ public boolean isInvalidChromosome(IChromosomeType type)
+ {
+ return this.invalidChromosomeTypes.contains(type);
+ }
+}
diff --git a/src/Java/binnie/core/genetics/MothBreedingSystem.java b/src/Java/binnie/core/genetics/MothBreedingSystem.java
new file mode 100644
index 0000000000..e1a45c9a9c
--- /dev/null
+++ b/src/Java/binnie/core/genetics/MothBreedingSystem.java
@@ -0,0 +1,138 @@
+package binnie.core.genetics;
+
+import binnie.Binnie;
+import binnie.core.BinnieCore;
+import binnie.core.language.ManagerLanguage;
+import binnie.core.resource.ManagerResource;
+import binnie.extratrees.ExtraTrees;
+import forestry.api.genetics.IAllele;
+import forestry.api.genetics.IAlleleInteger;
+import forestry.api.genetics.IBreedingTracker;
+import forestry.api.genetics.IChromosomeType;
+import forestry.api.genetics.IMutation;
+import forestry.api.genetics.ISpeciesRoot;
+import forestry.api.lepidopterology.EnumButterflyChromosome;
+import forestry.api.lepidopterology.EnumFlutterType;
+import forestry.api.lepidopterology.IButterflyRoot;
+import forestry.api.lepidopterology.ILepidopteristTracker;
+import java.util.TreeSet;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+
+class MothBreedingSystem
+ extends BreedingSystem
+{
+ public MothBreedingSystem()
+ {
+ this.iconUndiscovered = Binnie.Resource.getItemIcon(ExtraTrees.instance, "icon/undiscoveredMoth");
+ this.iconDiscovered = Binnie.Resource.getItemIcon(ExtraTrees.instance, "icon/discoveredMoth");
+ }
+
+ public float getChance(IMutation mutation, EntityPlayer player, IAllele species1, IAllele species2)
+ {
+ return 0.0F;
+ }
+
+ public ISpeciesRoot getSpeciesRoot()
+ {
+ return Binnie.Genetics.getButterflyRoot();
+ }
+
+ public int getColour()
+ {
+ return 62194;
+ }
+
+ public Class<? extends IBreedingTracker> getTrackerClass()
+ {
+ return ILepidopteristTracker.class;
+ }
+
+ public String getAlleleName(IChromosomeType chromosome, IAllele allele)
+ {
+ if (chromosome == EnumButterflyChromosome.METABOLISM)
+ {
+ int metabolism = ((IAlleleInteger)allele).getValue();
+ if (metabolism >= 19) {
+ return Binnie.Language.localise(BinnieCore.instance, "allele.metabolism.highest");
+ }
+ if (metabolism >= 16) {
+ return Binnie.Language.localise(BinnieCore.instance, "allele.metabolism.higher");
+ }
+ if (metabolism >= 13) {
+ return Binnie.Language.localise(BinnieCore.instance, "allele.metabolism.high");
+ }
+ if (metabolism >= 10) {
+ return Binnie.Language.localise(BinnieCore.instance, "allele.metabolism.normal");
+ }
+ if (metabolism >= 7) {
+ return Binnie.Language.localise(BinnieCore.instance, "allele.metabolism.slow");
+ }
+ if (metabolism >= 4) {
+ return Binnie.Language.localise(BinnieCore.instance, "allele.metabolism.slower");
+ }
+ return Binnie.Language.localise(BinnieCore.instance, "allele.metabolism.slowest");
+ }
+ if (chromosome == EnumButterflyChromosome.FERTILITY)
+ {
+ int metabolism = ((IAlleleInteger)allele).getValue();
+ return metabolism + "x";
+ }
+ return super.getAlleleName(chromosome, allele);
+ }
+
+ public boolean isDNAManipulable(ItemStack member)
+ {
+ return ((IButterflyRoot)getSpeciesRoot()).getType(member) == EnumFlutterType.SERUM;
+ }
+
+ public int[] getActiveTypes()
+ {
+ return new int[] { EnumFlutterType.BUTTERFLY.ordinal(), EnumFlutterType.CATERPILLAR.ordinal(), EnumFlutterType.SERUM.ordinal() };
+ }
+
+ public void addExtraAlleles(IChromosomeType chromosome, TreeSet<IAllele> alleles)
+ {
+ switch (1.$SwitchMap$forestry$api$lepidopterology$EnumButterflyChromosome[((EnumButterflyChromosome)chromosome).ordinal()])
+ {
+ case 1:
+ for (ForestryAllele.Int a : ForestryAllele.Int.values()) {
+ alleles.add(a.getAllele());
+ }
+ break;
+ case 2:
+ for (ForestryAllele.Lifespan a : ForestryAllele.Lifespan.values()) {
+ alleles.add(a.getAllele());
+ }
+ break;
+ case 3:
+ for (ForestryAllele.Int a : ForestryAllele.Int.values()) {
+ alleles.add(a.getAllele());
+ }
+ break;
+ case 4:
+ case 5:
+ case 6:
+ for (ForestryAllele.Bool a : ForestryAllele.Bool.values()) {
+ alleles.add(a.getAllele());
+ }
+ break;
+ case 7:
+ for (ForestryAllele.Size a : ForestryAllele.Size.values()) {
+ alleles.add(a.getAllele());
+ }
+ break;
+ case 8:
+ for (ForestryAllele.Speed a : ForestryAllele.Speed.values()) {
+ alleles.add(a.getAllele());
+ }
+ break;
+ case 9:
+ case 10:
+ for (Tolerance a : Tolerance.values()) {
+ alleles.add(a.getAllele());
+ }
+ break;
+ }
+ }
+}
diff --git a/src/Java/binnie/core/genetics/Tolerance.java b/src/Java/binnie/core/genetics/Tolerance.java
new file mode 100644
index 0000000000..7d9f62dfbf
--- /dev/null
+++ b/src/Java/binnie/core/genetics/Tolerance.java
@@ -0,0 +1,48 @@
+package binnie.core.genetics;
+
+import forestry.api.genetics.AlleleManager;
+import forestry.api.genetics.EnumTolerance;
+import forestry.api.genetics.IAllele;
+import forestry.api.genetics.IAlleleRegistry;
+
+public enum Tolerance
+{
+ None(0, 0), Both1(-1, 1), Both2(-2, 2), Both3(-3, 3), Both4(-4, 4), Both5(-5, 5), Up1(0, 1), Up2(0, 2), Up3(0, 3), Up4(0, 4), Up5(0, 5), Down1(-1, 0), Down2(-2, 0), Down3(-3, 0), Down4(-4, 0), Down5(-5, 0);
+
+ private int[] bounds;
+
+ private Tolerance(int a, int b)
+ {
+ this.bounds = new int[] { a, b };
+ }
+
+ public String getUID()
+ {
+ return "forestry.tolerance" + toString();
+ }
+
+ public int[] getBounds()
+ {
+ return this.bounds;
+ }
+
+ public static Tolerance get(EnumTolerance tol)
+ {
+ return values()[tol.ordinal()];
+ }
+
+ public IAllele getAllele()
+ {
+ return AlleleManager.alleleRegistry.getAllele(getUID());
+ }
+
+ public <T extends Enum<T>> boolean canTolerate(T base, T test)
+ {
+ return (test.ordinal() <= base.ordinal() + this.bounds[1]) && (test.ordinal() >= base.ordinal() + this.bounds[0]);
+ }
+
+ public static <T extends Enum<T>> boolean canTolerate(T base, T test, EnumTolerance tol)
+ {
+ return get(tol).canTolerate(base, test);
+ }
+}
diff --git a/src/Java/binnie/core/genetics/TreeBreedingSystem.java b/src/Java/binnie/core/genetics/TreeBreedingSystem.java
new file mode 100644
index 0000000000..9793126cb1
--- /dev/null
+++ b/src/Java/binnie/core/genetics/TreeBreedingSystem.java
@@ -0,0 +1,303 @@
+package binnie.core.genetics;
+
+import binnie.Binnie;
+import binnie.core.BinnieCore;
+import binnie.core.language.ManagerLanguage;
+import binnie.core.resource.ManagerResource;
+import binnie.core.util.UniqueItemStackSet;
+import binnie.extratrees.ExtraTrees;
+import binnie.extratrees.machines.Lumbermill;
+import com.mojang.authlib.GameProfile;
+import forestry.api.arboriculture.EnumGermlingType;
+import forestry.api.arboriculture.EnumTreeChromosome;
+import forestry.api.arboriculture.IAlleleFruit;
+import forestry.api.arboriculture.IAlleleTreeSpecies;
+import forestry.api.arboriculture.IArboristTracker;
+import forestry.api.arboriculture.IFruitProvider;
+import forestry.api.arboriculture.ITreeGenome;
+import forestry.api.arboriculture.ITreeMutation;
+import forestry.api.arboriculture.ITreeRoot;
+import forestry.api.genetics.AlleleManager;
+import forestry.api.genetics.IAllele;
+import forestry.api.genetics.IAlleleInteger;
+import forestry.api.genetics.IAllelePlantType;
+import forestry.api.genetics.IAlleleSpecies;
+import forestry.api.genetics.IBreedingTracker;
+import forestry.api.genetics.IChromosomeType;
+import forestry.api.genetics.IFruitFamily;
+import forestry.api.genetics.IGenome;
+import forestry.api.genetics.IIndividual;
+import forestry.api.genetics.IMutation;
+import forestry.api.genetics.ISpeciesRoot;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map.Entry;
+import java.util.Set;
+import java.util.TreeSet;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.world.World;
+import net.minecraftforge.common.EnumPlantType;
+
+public class TreeBreedingSystem
+ extends BreedingSystem
+{
+ public UniqueItemStackSet allFruits = new UniqueItemStackSet();
+ public UniqueItemStackSet allWoods = new UniqueItemStackSet();
+ private UniqueItemStackSet discoveredFruits = new UniqueItemStackSet();
+ private UniqueItemStackSet discoveredWoods = new UniqueItemStackSet();
+ public UniqueItemStackSet discoveredPlanks = new UniqueItemStackSet();
+
+ public TreeBreedingSystem()
+ {
+ this.iconUndiscovered = Binnie.Resource.getItemIcon(ExtraTrees.instance, "icon/undiscoveredTree");
+ this.iconDiscovered = Binnie.Resource.getItemIcon(ExtraTrees.instance, "icon/discoveredTree");
+ }
+
+ public float getChance(IMutation mutation, EntityPlayer player, IAllele species1, IAllele species2)
+ {
+ IGenome genome0 = getSpeciesRoot().templateAsGenome(getSpeciesRoot().getTemplate(species1.getUID()));
+ IGenome genome1 = getSpeciesRoot().templateAsGenome(getSpeciesRoot().getTemplate(species2.getUID()));
+ return ((ITreeMutation)mutation).getChance(player.worldObj, (int)player.posX, (int)player.posY, (int)player.posZ, species1, species2, genome0, genome1);
+ }
+
+ public ISpeciesRoot getSpeciesRoot()
+ {
+ return Binnie.Genetics.getTreeRoot();
+ }
+
+ public int getColour()
+ {
+ return 53006;
+ }
+
+ public Class<? extends IBreedingTracker> getTrackerClass()
+ {
+ return IArboristTracker.class;
+ }
+
+ public String getAlleleName(IChromosomeType chromosome, IAllele allele)
+ {
+ if (chromosome == EnumTreeChromosome.GIRTH) {
+ return ((IAlleleInteger)allele).getValue() + "x" + ((IAlleleInteger)allele).getValue();
+ }
+ if (chromosome == EnumTreeChromosome.PLANT)
+ {
+ EnumSet<EnumPlantType> types = ((IAllelePlantType)allele).getPlantTypes();
+ return types.isEmpty() ? Binnie.Language.localise(BinnieCore.instance, "allele.none") : ((EnumPlantType)types.iterator().next()).toString();
+ }
+ if ((chromosome == EnumTreeChromosome.FRUITS) && (allele.getUID().contains(".")))
+ {
+ IFruitProvider provider = ((IAlleleFruit)allele).getProvider();
+ return provider.getProducts().length == 0 ? Binnie.Language.localise(BinnieCore.instance, "allele.none") : provider.getProducts()[0].getDisplayName();
+ }
+ if (chromosome == EnumTreeChromosome.GROWTH)
+ {
+ if (allele.getUID().contains("Tropical")) {
+ return Binnie.Language.localise(BinnieCore.instance, "allele.growth.tropical");
+ }
+ if (allele.getUID().contains("Lightlevel")) {
+ return Binnie.Language.localise(BinnieCore.instance, "allele.growth.lightlevel");
+ }
+ }
+ return super.getAlleleName(chromosome, allele);
+ }
+
+ public void onSyncBreedingTracker(IBreedingTracker tracker)
+ {
+ this.discoveredFruits.clear();
+ this.discoveredWoods.clear();
+ for (IAlleleSpecies species : getDiscoveredSpecies(tracker))
+ {
+ IAlleleTreeSpecies tSpecies = (IAlleleTreeSpecies)species;
+
+ ITreeGenome genome = (ITreeGenome)getSpeciesRoot().templateAsGenome(getSpeciesRoot().getTemplate(tSpecies.getUID()));
+ for (ItemStack wood : tSpecies.getLogStacks()) {
+ this.discoveredWoods.add(wood);
+ }
+ for (ItemStack fruit : genome.getFruitProvider().getProducts()) {
+ this.discoveredFruits.add(fruit);
+ }
+ for (Iterator i$ = this.discoveredWoods.iterator(); i$.hasNext(); wood = (ItemStack)i$.next()) {}
+ }
+ ItemStack wood;
+ }
+
+ public final void calculateArrays()
+ {
+ super.calculateArrays();
+ for (IAlleleSpecies species : this.allActiveSpecies)
+ {
+ IAlleleTreeSpecies tSpecies = (IAlleleTreeSpecies)species;
+
+
+ ITreeGenome genome = (ITreeGenome)getSpeciesRoot().templateAsGenome(getSpeciesRoot().getTemplate(tSpecies.getUID()));
+ for (ItemStack wood : tSpecies.getLogStacks()) {
+ this.allWoods.add(wood);
+ }
+ for (ItemStack fruit : genome.getFruitProvider().getProducts()) {
+ this.allFruits.add(fruit);
+ }
+ }
+ }
+
+ public Collection<IAlleleSpecies> getTreesThatBearFruit(ItemStack fruit, boolean nei, World world, GameProfile player)
+ {
+ Collection<IAlleleSpecies> set = nei ? getAllSpecies() : getDiscoveredSpecies(world, player);
+ List<IAlleleSpecies> found = new ArrayList();
+ for (IAlleleSpecies species : set)
+ {
+ IAlleleTreeSpecies tSpecies = (IAlleleTreeSpecies)species;
+ ITreeGenome genome = (ITreeGenome)getSpeciesRoot().templateAsGenome(getSpeciesRoot().getTemplate(tSpecies.getUID()));
+ for (ItemStack fruit2 : genome.getFruitProvider().getProducts()) {
+ if (fruit2.isItemEqual(fruit)) {
+ found.add(species);
+ }
+ }
+ }
+ return found;
+ }
+
+ public Collection<IAlleleSpecies> getTreesThatCanBearFruit(ItemStack fruit, boolean nei, World world, GameProfile player)
+ {
+ Collection<IAlleleSpecies> set = nei ? getAllSpecies() : getDiscoveredSpecies(world, player);
+ List<IAlleleSpecies> found = new ArrayList();
+
+ Set<IFruitFamily> providers = new HashSet();
+ for (IAlleleSpecies species : set)
+ {
+ IAlleleTreeSpecies tSpecies = (IAlleleTreeSpecies)species;
+ ITreeGenome genome = (ITreeGenome)getSpeciesRoot().templateAsGenome(getSpeciesRoot().getTemplate(tSpecies.getUID()));
+ for (ItemStack fruit2 : genome.getFruitProvider().getProducts()) {
+ if (fruit2.isItemEqual(fruit)) {
+ providers.add(genome.getFruitProvider().getFamily());
+ }
+ }
+ }
+ for (Iterator i$ = set.iterator(); i$.hasNext();)
+ {
+ species = (IAlleleSpecies)i$.next();
+ tSpecies = (IAlleleTreeSpecies)species;
+ for (IFruitFamily family : providers) {
+ if (tSpecies.getSuitableFruit().contains(family))
+ {
+ found.add(species);
+ break;
+ }
+ }
+ }
+ IAlleleSpecies species;
+ IAlleleTreeSpecies tSpecies;
+ return found;
+ }
+
+ public Collection<IAlleleSpecies> getTreesThatHaveWood(ItemStack fruit, boolean nei, World world, GameProfile player)
+ {
+ Collection<IAlleleSpecies> set = nei ? getAllSpecies() : getDiscoveredSpecies(world, player);
+ List<IAlleleSpecies> found = new ArrayList();
+ for (IAlleleSpecies species : set)
+ {
+ IAlleleTreeSpecies tSpecies = (IAlleleTreeSpecies)species;
+ for (ItemStack fruit2 : tSpecies.getLogStacks()) {
+ if (fruit2.isItemEqual(fruit)) {
+ found.add(species);
+ }
+ }
+ }
+ return found;
+ }
+
+ public Collection<IAlleleSpecies> getTreesThatMakePlanks(ItemStack fruit, boolean nei, World world, GameProfile player)
+ {
+ if (fruit == null) {
+ return new ArrayList();
+ }
+ Collection<IAlleleSpecies> set = nei ? getAllSpecies() : getDiscoveredSpecies(world, player);
+ List<IAlleleSpecies> found = new ArrayList();
+ for (IAlleleSpecies species : set)
+ {
+ IAlleleTreeSpecies tSpecies = (IAlleleTreeSpecies)species;
+ for (ItemStack fruit2 : tSpecies.getLogStacks()) {
+ if ((Lumbermill.getPlankProduct(fruit2) != null) && (fruit.isItemEqual(Lumbermill.getPlankProduct(fruit2)))) {
+ found.add(species);
+ }
+ }
+ }
+ return found;
+ }
+
+ public boolean isDNAManipulable(ItemStack member)
+ {
+ return ((ITreeRoot)getSpeciesRoot()).getType(member) == EnumGermlingType.POLLEN;
+ }
+
+ public IIndividual getConversion(ItemStack stack)
+ {
+ if (stack == null) {
+ return null;
+ }
+ for (Map.Entry<ItemStack, IIndividual> entry : AlleleManager.ersatzSaplings.entrySet()) {
+ if (ItemStack.areItemStacksEqual(stack, (ItemStack)entry.getKey())) {
+ return (IIndividual)entry.getValue();
+ }
+ }
+ return null;
+ }
+
+ public int[] getActiveTypes()
+ {
+ return new int[] { EnumGermlingType.SAPLING.ordinal(), EnumGermlingType.POLLEN.ordinal() };
+ }
+
+ public void addExtraAlleles(IChromosomeType chromosome, TreeSet<IAllele> alleles)
+ {
+ switch (1.$SwitchMap$forestry$api$arboriculture$EnumTreeChromosome[((EnumTreeChromosome)chromosome).ordinal()])
+ {
+ case 1:
+ for (ForestryAllele.Saplings a : ForestryAllele.Saplings.values()) {
+ alleles.add(a.getAllele());
+ }
+ break;
+ case 2:
+ for (ForestryAllele.Int a : ForestryAllele.Int.values()) {
+ alleles.add(a.getAllele());
+ }
+ break;
+ case 3:
+ for (ForestryAllele.TreeHeight a : ForestryAllele.TreeHeight.values()) {
+ alleles.add(a.getAllele());
+ }
+ break;
+ case 4:
+ for (ForestryAllele.Maturation a : ForestryAllele.Maturation.values()) {
+ alleles.add(a.getAllele());
+ }
+ break;
+ case 5:
+ for (ForestryAllele.Sappiness a : ForestryAllele.Sappiness.values()) {
+ alleles.add(a.getAllele());
+ }
+ break;
+ case 6:
+ for (ForestryAllele.Territory a : ForestryAllele.Territory.values()) {
+ alleles.add(a.getAllele());
+ }
+ break;
+ case 7:
+ for (ForestryAllele.Yield a : ForestryAllele.Yield.values()) {
+ alleles.add(a.getAllele());
+ }
+ break;
+ case 8:
+ for (ForestryAllele.Bool a : ForestryAllele.Bool.values()) {
+ alleles.add(a.getAllele());
+ }
+ break;
+ }
+ }
+}
diff --git a/src/Java/binnie/core/genetics/VirtualBeeHousing.java b/src/Java/binnie/core/genetics/VirtualBeeHousing.java
new file mode 100644
index 0000000000..b425a21d83
--- /dev/null
+++ b/src/Java/binnie/core/genetics/VirtualBeeHousing.java
@@ -0,0 +1,111 @@
+package binnie.core.genetics;
+
+import forestry.api.apiculture.IBee;
+import forestry.api.apiculture.IBeeGenome;
+import forestry.api.apiculture.IBeeHousing;
+import forestry.api.genetics.IIndividual;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.world.biome.BiomeGenBase;
+
+public class VirtualBeeHousing
+ extends VirtualHousing
+ implements IBeeHousing
+{
+ public VirtualBeeHousing(EntityPlayer player)
+ {
+ super(player);
+ }
+
+ public float getTerritoryModifier(IBeeGenome genome, float currentModifier)
+ {
+ return 1.0F;
+ }
+
+ public float getMutationModifier(IBeeGenome genome, IBeeGenome mate, float currentModifier)
+ {
+ return 1.0F;
+ }
+
+ public float getLifespanModifier(IBeeGenome genome, IBeeGenome mate, float currentModifier)
+ {
+ return 1.0F;
+ }
+
+ public float getProductionModifier(IBeeGenome genome, float currentModifier)
+ {
+ return 1.0F;
+ }
+
+ public ItemStack getQueen()
+ {
+ return null;
+ }
+
+ public ItemStack getDrone()
+ {
+ return null;
+ }
+
+ public void setQueen(ItemStack itemstack) {}
+
+ public void setDrone(ItemStack itemstack) {}
+
+ public boolean canBreed()
+ {
+ return true;
+ }
+
+ public boolean addProduct(ItemStack product, boolean all)
+ {
+ return false;
+ }
+
+ public void wearOutEquipment(int amount) {}
+
+ public void onQueenChange(ItemStack queen) {}
+
+ public boolean isSealed()
+ {
+ return false;
+ }
+
+ public boolean isSelfLighted()
+ {
+ return false;
+ }
+
+ public boolean isSunlightSimulated()
+ {
+ return false;
+ }
+
+ public boolean isHellish()
+ {
+ return getBiomeId() == BiomeGenBase.hell.biomeID;
+ }
+
+ public float getFloweringModifier(IBeeGenome genome, float currentModifier)
+ {
+ return 1.0F;
+ }
+
+ public void onQueenDeath(IBee queen) {}
+
+ public void onPostQueenDeath(IBee queen) {}
+
+ public boolean onPollenRetrieved(IBee queen, IIndividual pollen, boolean isHandled)
+ {
+ return false;
+ }
+
+ public boolean onEggLaid(IBee queen)
+ {
+ return false;
+ }
+
+ public float getGeneticDecay(IBeeGenome genome, float currentModifier)
+ {
+ return 1.0F;
+ }
+}
diff --git a/src/Java/binnie/core/genetics/VirtualHousing.java b/src/Java/binnie/core/genetics/VirtualHousing.java
new file mode 100644
index 0000000000..b6caa48360
--- /dev/null
+++ b/src/Java/binnie/core/genetics/VirtualHousing.java
@@ -0,0 +1,98 @@
+package binnie.core.genetics;
+
+import com.mojang.authlib.GameProfile;
+import forestry.api.core.EnumHumidity;
+import forestry.api.core.EnumTemperature;
+import forestry.api.core.IErrorState;
+import forestry.api.genetics.IHousing;
+import forestry.core.EnumErrorCode;
+import java.util.Set;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.world.World;
+import net.minecraft.world.biome.BiomeGenBase;
+
+class VirtualHousing
+ implements IHousing
+{
+ private EntityPlayer player;
+
+ public VirtualHousing(EntityPlayer player)
+ {
+ this.player = player;
+ }
+
+ public int getXCoord()
+ {
+ return (int)this.player.posX;
+ }
+
+ public int getYCoord()
+ {
+ return (int)this.player.posY;
+ }
+
+ public int getZCoord()
+ {
+ return (int)this.player.posZ;
+ }
+
+ public int getBiomeId()
+ {
+ return this.player.worldObj.getBiomeGenForCoords(getXCoord(), getYCoord()).biomeID;
+ }
+
+ public EnumTemperature getTemperature()
+ {
+ return EnumTemperature.getFromValue(getBiome().temperature);
+ }
+
+ public EnumHumidity getHumidity()
+ {
+ return EnumHumidity.getFromValue(getBiome().rainfall);
+ }
+
+ public World getWorld()
+ {
+ return this.player.worldObj;
+ }
+
+ public void setErrorState(int state) {}
+
+ public int getErrorOrdinal()
+ {
+ return 0;
+ }
+
+ public boolean addProduct(ItemStack product, boolean all)
+ {
+ return false;
+ }
+
+ public GameProfile getOwnerName()
+ {
+ return this.player.getGameProfile();
+ }
+
+ public BiomeGenBase getBiome()
+ {
+ return this.player.worldObj.getBiomeGenForCoords(getXCoord(), getZCoord());
+ }
+
+ public EnumErrorCode getErrorState()
+ {
+ return null;
+ }
+
+ public void setErrorState(IErrorState state) {}
+
+ public boolean setErrorCondition(boolean condition, IErrorState errorState)
+ {
+ return false;
+ }
+
+ public Set<IErrorState> getErrorStates()
+ {
+ return null;
+ }
+}
diff --git a/src/Java/binnie/core/genetics/VirtualMothHousing.java b/src/Java/binnie/core/genetics/VirtualMothHousing.java
new file mode 100644
index 0000000000..ad0f8d0cfc
--- /dev/null
+++ b/src/Java/binnie/core/genetics/VirtualMothHousing.java
@@ -0,0 +1,33 @@
+package binnie.core.genetics;
+
+import forestry.api.genetics.IIndividual;
+import forestry.api.lepidopterology.IButterfly;
+import forestry.api.lepidopterology.IButterflyNursery;
+import net.minecraft.entity.player.EntityPlayer;
+
+public class VirtualMothHousing
+ extends VirtualHousing
+ implements IButterflyNursery
+{
+ public VirtualMothHousing(EntityPlayer player)
+ {
+ super(player);
+ }
+
+ public IButterfly getCaterpillar()
+ {
+ return null;
+ }
+
+ public IIndividual getNanny()
+ {
+ return null;
+ }
+
+ public void setCaterpillar(IButterfly butterfly) {}
+
+ public boolean canNurse(IButterfly butterfly)
+ {
+ return false;
+ }
+}
diff --git a/src/Java/binnie/core/gui/BinnieCoreGUI.java b/src/Java/binnie/core/gui/BinnieCoreGUI.java
new file mode 100644
index 0000000000..50f99306f1
--- /dev/null
+++ b/src/Java/binnie/core/gui/BinnieCoreGUI.java
@@ -0,0 +1,54 @@
+package binnie.core.gui;
+
+import binnie.core.machines.storage.WindowCompartment;
+import binnie.craftgui.binniecore.WindowFieldKit;
+import binnie.craftgui.binniecore.WindowGenesis;
+import binnie.craftgui.minecraft.Window;
+import cpw.mods.fml.relauncher.Side;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.world.World;
+
+public enum BinnieCoreGUI
+ implements IBinnieGUID
+{
+ Compartment, FieldKit, Genesis;
+
+ private BinnieCoreGUI() {}
+
+ public Window getWindow(EntityPlayer player, IInventory object, Side side)
+ throws Exception
+ {
+ switch (1.$SwitchMap$binnie$core$gui$BinnieCoreGUI[ordinal()])
+ {
+ case 1:
+ return new WindowCompartment(player, object, side);
+ case 2:
+ return new WindowFieldKit(player, null, side);
+ case 3:
+ return new WindowGenesis(player, null, side);
+ }
+ return null;
+ }
+
+ public Window getWindow(EntityPlayer player, World world, int x, int y, int z, Side side)
+ {
+ Window window = null;
+ TileEntity tileEntity = world.getTileEntity(x, y, z);
+
+ IInventory object = null;
+ if ((tileEntity instanceof IInventory)) {
+ object = (IInventory)tileEntity;
+ }
+ try
+ {
+ window = getWindow(player, object, side);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ return window;
+ }
+}
diff --git a/src/Java/binnie/core/gui/BinnieGUIHandler.java b/src/Java/binnie/core/gui/BinnieGUIHandler.java
new file mode 100644
index 0000000000..c146d914e0
--- /dev/null
+++ b/src/Java/binnie/core/gui/BinnieGUIHandler.java
@@ -0,0 +1,54 @@
+package binnie.core.gui;
+
+import binnie.core.AbstractMod;
+import binnie.core.BinnieCore;
+import binnie.core.proxy.BinnieProxy;
+import binnie.craftgui.minecraft.Window;
+import cpw.mods.fml.common.network.IGuiHandler;
+import cpw.mods.fml.relauncher.Side;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.world.World;
+
+public final class BinnieGUIHandler
+ implements IGuiHandler
+{
+ private AbstractMod mod;
+
+ public BinnieGUIHandler(AbstractMod mod)
+ {
+ this.mod = mod;
+ }
+
+ public final Object getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z)
+ {
+ Window window = getWindow(id, player, world, x, y, z, Side.SERVER);
+ if (window == null) {
+ return null;
+ }
+ window.initialiseServer();
+
+ return window.getContainer();
+ }
+
+ public final Object getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z)
+ {
+ if (BinnieCore.proxy.isSimulating(world)) {
+ return getServerGuiElement(id, player, world, x, y, z);
+ }
+ Window window = getWindow(id, player, world, x, y, z, Side.CLIENT);
+ if (window == null) {
+ return null;
+ }
+ return window.getGui();
+ }
+
+ public Window getWindow(int id, EntityPlayer player, World world, int x, int y, int z, Side side)
+ {
+ for (IBinnieGUID guid : this.mod.getGUIDs()) {
+ if (guid.ordinal() == id) {
+ return guid.getWindow(player, world, x, y, z, side);
+ }
+ }
+ return null;
+ }
+}
diff --git a/src/Java/binnie/core/gui/IBinnieGUID.java b/src/Java/binnie/core/gui/IBinnieGUID.java
new file mode 100644
index 0000000000..be0fd174da
--- /dev/null
+++ b/src/Java/binnie/core/gui/IBinnieGUID.java
@@ -0,0 +1,13 @@
+package binnie.core.gui;
+
+import binnie.core.network.IOrdinaled;
+import binnie.craftgui.minecraft.Window;
+import cpw.mods.fml.relauncher.Side;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.world.World;
+
+public abstract interface IBinnieGUID
+ extends IOrdinaled
+{
+ public abstract Window getWindow(EntityPlayer paramEntityPlayer, World paramWorld, int paramInt1, int paramInt2, int paramInt3, Side paramSide);
+}
diff --git a/src/Java/binnie/core/item/IItemEnum.java b/src/Java/binnie/core/item/IItemEnum.java
new file mode 100644
index 0000000000..70b27d7aa7
--- /dev/null
+++ b/src/Java/binnie/core/item/IItemEnum.java
@@ -0,0 +1,14 @@
+package binnie.core.item;
+
+import net.minecraft.item.ItemStack;
+
+public abstract interface IItemEnum
+{
+ public abstract boolean isActive();
+
+ public abstract String getName(ItemStack paramItemStack);
+
+ public abstract int ordinal();
+
+ public abstract ItemStack get(int paramInt);
+}
diff --git a/src/Java/binnie/core/item/IItemMisc.java b/src/Java/binnie/core/item/IItemMisc.java
new file mode 100644
index 0000000000..1538297884
--- /dev/null
+++ b/src/Java/binnie/core/item/IItemMisc.java
@@ -0,0 +1,19 @@
+package binnie.core.item;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import java.util.List;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.IIcon;
+
+public abstract interface IItemMisc
+ extends IItemEnum
+{
+ public abstract IIcon getIcon(ItemStack paramItemStack);
+
+ @SideOnly(Side.CLIENT)
+ public abstract void registerIcons(IIconRegister paramIIconRegister);
+
+ public abstract void addInformation(List paramList);
+}
diff --git a/src/Java/binnie/core/item/ItemFieldKit.java b/src/Java/binnie/core/item/ItemFieldKit.java
new file mode 100644
index 0000000000..0a6ec0b813
--- /dev/null
+++ b/src/Java/binnie/core/item/ItemFieldKit.java
@@ -0,0 +1,82 @@
+package binnie.core.item;
+
+import binnie.core.BinnieCore;
+import binnie.core.gui.BinnieCoreGUI;
+import binnie.core.proxy.BinnieProxy;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import java.util.List;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.IIcon;
+import net.minecraft.world.World;
+
+public class ItemFieldKit
+ extends Item
+{
+ private IIcon fieldKit0;
+ private IIcon fieldKit1;
+ private IIcon fieldKit2;
+ private IIcon fieldKit3;
+
+ public ItemFieldKit()
+ {
+ setUnlocalizedName("fieldKit");
+ setCreativeTab(CreativeTabs.tabTools);
+ setMaxStackSize(1);
+ setMaxDamage(64);
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void registerIcons(IIconRegister register)
+ {
+ this.fieldKit0 = BinnieCore.proxy.getIcon(register, "fieldKit");
+ this.fieldKit1 = BinnieCore.proxy.getIcon(register, "fieldKit1");
+ this.fieldKit2 = BinnieCore.proxy.getIcon(register, "fieldKit2");
+ this.fieldKit3 = BinnieCore.proxy.getIcon(register, "fieldKit3");
+ this.itemIcon = this.fieldKit0;
+ }
+
+ public IIcon getIcon(ItemStack stack, int pass)
+ {
+ int damage = stack.getItemDamage();
+ if (damage < 24) {
+ return this.fieldKit3;
+ }
+ if (damage < 48) {
+ return this.fieldKit2;
+ }
+ if (damage < 64) {
+ return this.fieldKit1;
+ }
+ return this.fieldKit0;
+ }
+
+ public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer player)
+ {
+ if (!player.isSneaking()) {
+ BinnieCore.proxy.openGui(BinnieCoreGUI.FieldKit, player, (int)player.posX, (int)player.posY, (int)player.posZ);
+ }
+ return itemstack;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void addInformation(ItemStack p_77624_1_, EntityPlayer p_77624_2_, List p_77624_3_, boolean p_77624_4_)
+ {
+ int i = getMaxDamage() - p_77624_1_.getItemDamage();
+ if (i == 0) {
+ p_77624_3_.add("No paper");
+ } else {
+ p_77624_3_.add("" + i + " sheet" + (i > 1 ? "s" : "") + " of paper");
+ }
+ super.addInformation(p_77624_1_, p_77624_2_, p_77624_3_, p_77624_4_);
+ }
+
+ public String getItemStackDisplayName(ItemStack p_77653_1_)
+ {
+ return "Field Kit";
+ }
+}
diff --git a/src/Java/binnie/core/item/ItemGenesis.java b/src/Java/binnie/core/item/ItemGenesis.java
new file mode 100644
index 0000000000..1e946372be
--- /dev/null
+++ b/src/Java/binnie/core/item/ItemGenesis.java
@@ -0,0 +1,42 @@
+package binnie.core.item;
+
+import binnie.core.BinnieCore;
+import binnie.core.gui.BinnieCoreGUI;
+import binnie.core.proxy.BinnieProxy;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import forestry.api.core.Tabs;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.world.World;
+
+public class ItemGenesis
+ extends Item
+{
+ @SideOnly(Side.CLIENT)
+ public void registerIcons(IIconRegister register)
+ {
+ this.itemIcon = BinnieCore.proxy.getIcon(register, "genesis");
+ }
+
+ public ItemGenesis()
+ {
+ setCreativeTab(Tabs.tabApiculture);
+ setUnlocalizedName("genesis");
+ setMaxStackSize(1);
+ }
+
+ public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer player)
+ {
+ BinnieCore.proxy.openGui(BinnieCoreGUI.Genesis, player, (int)player.posX, (int)player.posY, (int)player.posZ);
+
+ return itemstack;
+ }
+
+ public String getItemStackDisplayName(ItemStack i)
+ {
+ return "Genesis";
+ }
+}
diff --git a/src/Java/binnie/core/item/ItemMisc.java b/src/Java/binnie/core/item/ItemMisc.java
new file mode 100644
index 0000000000..db54b2c1dd
--- /dev/null
+++ b/src/Java/binnie/core/item/ItemMisc.java
@@ -0,0 +1,81 @@
+package binnie.core.item;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import java.util.List;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.IIcon;
+
+public class ItemMisc
+ extends Item
+{
+ private IItemMisc[] items;
+
+ protected ItemMisc(CreativeTabs tab, IItemMisc[] items2)
+ {
+ setCreativeTab(tab);
+ setHasSubtypes(true);
+ setUnlocalizedName("misc");
+ this.items = items2;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List par3List)
+ {
+ for (IItemMisc item : this.items) {
+ if (item.isActive()) {
+ par3List.add(getStack(item, 1));
+ }
+ }
+ }
+
+ private IItemMisc getItem(int damage)
+ {
+ return damage >= this.items.length ? this.items[0] : this.items[damage];
+ }
+
+ public ItemStack getStack(IItemMisc type, int size)
+ {
+ return new ItemStack(this, size, type.ordinal());
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
+ {
+ super.addInformation(par1ItemStack, par2EntityPlayer, par3List, par4);
+ IItemMisc item = getItem(par1ItemStack.getItemDamage());
+ if (item != null) {
+ item.addInformation(par3List);
+ }
+ }
+
+ public String getItemStackDisplayName(ItemStack stack)
+ {
+ IItemMisc item = getItem(stack.getItemDamage());
+ return item != null ? item.getName(stack) : "null";
+ }
+
+ public IIcon getIcon(ItemStack stack, int pass)
+ {
+ IItemMisc item = getItem(stack.getItemDamage());
+ return item != null ? item.getIcon(stack) : null;
+ }
+
+ public IIcon getIconFromDamage(int damage)
+ {
+ IItemMisc item = getItem(damage);
+ return item != null ? item.getIcon(null) : null;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void registerIcons(IIconRegister register)
+ {
+ for (IItemMisc item : this.items) {
+ item.registerIcons(register);
+ }
+ }
+}
diff --git a/src/Java/binnie/core/item/ManagerItem.java b/src/Java/binnie/core/item/ManagerItem.java
new file mode 100644
index 0000000000..39ea70f826
--- /dev/null
+++ b/src/Java/binnie/core/item/ManagerItem.java
@@ -0,0 +1,11 @@
+package binnie.core.item;
+
+import net.minecraft.creativetab.CreativeTabs;
+
+public class ManagerItem
+{
+ public ItemMisc registerMiscItems(IItemMisc[] items, CreativeTabs tab)
+ {
+ return new ItemMisc(tab, items);
+ }
+}
diff --git a/src/Java/binnie/core/item/ModuleItems.java b/src/Java/binnie/core/item/ModuleItems.java
new file mode 100644
index 0000000000..335106e040
--- /dev/null
+++ b/src/Java/binnie/core/item/ModuleItems.java
@@ -0,0 +1,75 @@
+package binnie.core.item;
+
+import binnie.botany.Botany;
+import binnie.botany.api.IAlleleFlowerSpecies;
+import binnie.botany.api.IFlower;
+import binnie.botany.api.IFlowerColour;
+import binnie.botany.api.IFlowerGenome;
+import binnie.botany.flower.TileEntityFlower;
+import binnie.botany.network.PacketID;
+import binnie.botany.proxy.Proxy;
+import binnie.core.BinnieCore;
+import binnie.core.IInitializable;
+import binnie.core.network.packet.MessageNBT;
+import cpw.mods.fml.common.eventhandler.SubscribeEvent;
+import cpw.mods.fml.common.registry.GameRegistry;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.init.Blocks;
+import net.minecraft.init.Items;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.world.World;
+import net.minecraftforge.event.entity.player.PlayerInteractEvent;
+import net.minecraftforge.event.entity.player.PlayerInteractEvent.Action;
+
+public class ModuleItems
+ implements IInitializable
+{
+ public void preInit()
+ {
+ BinnieCore.fieldKit = new ItemFieldKit();
+ BinnieCore.genesis = new ItemGenesis();
+ }
+
+ public void init() {}
+
+ public void postInit()
+ {
+ GameRegistry.addRecipe(new ItemStack(BinnieCore.fieldKit, 1, 63), new Object[] { "g ", " is", " pi", Character.valueOf('g'), Blocks.glass_pane, Character.valueOf('i'), Items.iron_ingot, Character.valueOf('p'), Items.paper, Character.valueOf('s'), new ItemStack(Items.dye, 1) });
+ }
+
+ @SubscribeEvent
+ public void onUseFieldKit(PlayerInteractEvent event)
+ {
+ if (!BinnieCore.isBotanyActive()) {
+ return;
+ }
+ if (event.action != PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) {
+ return;
+ }
+ if ((event.entityPlayer != null) && (event.entityPlayer.getHeldItem() != null) && (event.entityPlayer.getHeldItem().getItem() == BinnieCore.fieldKit) && (event.entityPlayer.isSneaking()))
+ {
+ TileEntity tile = event.world.getTileEntity(event.x, event.y, event.z);
+ if ((tile instanceof TileEntityFlower))
+ {
+ TileEntityFlower tileFlower = (TileEntityFlower)tile;
+ IFlower flower = tileFlower.getFlower();
+ if (flower != null)
+ {
+ NBTTagCompound info = new NBTTagCompound();
+ info.setString("Species", flower.getGenome().getPrimary().getUID());
+ info.setString("Species2", flower.getGenome().getSecondary().getUID());
+ info.setFloat("Age", flower.getAge() / flower.getGenome().getLifespan());
+ info.setShort("Colour", (short)flower.getGenome().getPrimaryColor().getID());
+ info.setShort("Colour2", (short)flower.getGenome().getSecondaryColor().getID());
+ info.setBoolean("Wilting", flower.isWilted());
+ info.setBoolean("Flowered", flower.hasFlowered());
+
+ Botany.proxy.sendToPlayer(new MessageNBT(PacketID.Encylopedia.ordinal(), info), event.entityPlayer);
+ event.entityPlayer.getHeldItem().damageItem(1, event.entityPlayer);
+ }
+ }
+ }
+ }
+}
diff --git a/src/Java/binnie/core/language/ManagerLanguage.java b/src/Java/binnie/core/language/ManagerLanguage.java
new file mode 100644
index 0000000000..b4deb37344
--- /dev/null
+++ b/src/Java/binnie/core/language/ManagerLanguage.java
@@ -0,0 +1,59 @@
+package binnie.core.language;
+
+import binnie.core.AbstractMod;
+import binnie.core.ManagerBase;
+import java.util.HashMap;
+import java.util.Map;
+import net.minecraft.util.StatCollector;
+
+public class ManagerLanguage
+ extends ManagerBase
+{
+ private Map<Object, String> objNames = new HashMap();
+
+ public void addObjectName(Object obj, String name)
+ {
+ this.objNames.put(obj, name);
+ }
+
+ public String unlocalised(AbstractMod mod, String id)
+ {
+ return mod.getModID() + "." + id;
+ }
+
+ public String localise(Object key)
+ {
+ String loc = StatCollector.translateToLocal(key.toString());
+ if (loc.equals(key.toString())) {
+ return this.objNames.containsKey(key) ? localise(this.objNames.get(key)) : key.toString();
+ }
+ return loc;
+ }
+
+ public String localise(AbstractMod mod, String id)
+ {
+ return localise(unlocalised(mod, id));
+ }
+
+ public String localiseOrBlank(AbstractMod mod, String id)
+ {
+ return localiseOrBlank(unlocalised(mod, id));
+ }
+
+ public String localise(AbstractMod mod, String id, Object... objs)
+ {
+ return String.format(localise(mod, id), objs);
+ }
+
+ public String localiseOrBlank(Object key)
+ {
+ String trans = localise(key);
+ return trans.equals(key) ? "" : trans;
+ }
+
+ public boolean canLocalise(Object key)
+ {
+ String trans = localise(key);
+ return !trans.equals(key);
+ }
+}
diff --git a/src/Java/binnie/core/liquid/BinnieFluid.java b/src/Java/binnie/core/liquid/BinnieFluid.java
new file mode 100644
index 0000000000..e0ac5fc815
--- /dev/null
+++ b/src/Java/binnie/core/liquid/BinnieFluid.java
@@ -0,0 +1,32 @@
+package binnie.core.liquid;
+
+import net.minecraftforge.fluids.Fluid;
+
+class BinnieFluid
+ extends Fluid
+{
+ private final String name;
+ final IFluidType fluidType;
+
+ public String getLocalizedName()
+ {
+ return this.name;
+ }
+
+ public BinnieFluid(IFluidType fluid)
+ {
+ super(fluid.getIdentifier());
+ this.fluidType = fluid;
+ this.name = fluid.getName();
+ }
+
+ public int getColor()
+ {
+ return this.fluidType.getColour();
+ }
+
+ public IFluidType getType()
+ {
+ return this.fluidType;
+ }
+}
diff --git a/src/Java/binnie/core/liquid/FluidContainer.java b/src/Java/binnie/core/liquid/FluidContainer.java
new file mode 100644
index 0000000000..0bfb14512b
--- /dev/null
+++ b/src/Java/binnie/core/liquid/FluidContainer.java
@@ -0,0 +1,95 @@
+package binnie.core.liquid;
+
+import binnie.core.BinnieCore;
+import binnie.core.Mods;
+import binnie.core.Mods.Mod;
+import binnie.core.proxy.BinnieProxy;
+import binnie.genetics.item.GeneticsItems;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.init.Items;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.IIcon;
+import net.minecraftforge.fluids.FluidContainerRegistry;
+import net.minecraftforge.fluids.FluidContainerRegistry.FluidContainerData;
+
+public enum FluidContainer
+{
+ Bucket, Capsule, Refractory, Can, Glass, Cylinder;
+
+ IIcon bottle;
+ IIcon contents;
+ ItemFluidContainer item;
+
+ private FluidContainer() {}
+
+ public int getMaxStackSize()
+ {
+ return this == Bucket ? 1 : 16;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void updateIcons(IIconRegister register)
+ {
+ this.bottle = BinnieCore.proxy.getIcon(register, this == Cylinder ? "binniecore" : "forestry", "liquids/" + toString().toLowerCase() + ".bottle");
+
+ this.contents = BinnieCore.proxy.getIcon(register, this == Cylinder ? "binniecore" : "forestry", "liquids/" + toString().toLowerCase() + ".contents");
+ }
+
+ public IIcon getBottleIcon()
+ {
+ return this.bottle;
+ }
+
+ public IIcon getContentsIcon()
+ {
+ return this.contents;
+ }
+
+ public String getName()
+ {
+ return BinnieCore.proxy.localise("item.container." + name().toLowerCase());
+ }
+
+ public boolean isActive()
+ {
+ return getEmpty() != null;
+ }
+
+ public ItemStack getEmpty()
+ {
+ switch (1.$SwitchMap$binnie$core$liquid$FluidContainer[ordinal()])
+ {
+ case 1:
+ return new ItemStack(Items.bucket, 1, 0);
+ case 2:
+ return Mods.Forestry.stack("canEmpty");
+ case 3:
+ return Mods.Forestry.stack("waxCapsule");
+ case 4:
+ return new ItemStack(Items.glass_bottle, 1, 0);
+ case 5:
+ return Mods.Forestry.stack("refractoryEmpty");
+ case 6:
+ return GeneticsItems.Cylinder.get(1);
+ }
+ return null;
+ }
+
+ public void registerContainerData(IFluidType fluid)
+ {
+ if (!isActive()) {
+ return;
+ }
+ ItemStack filled = this.item.getContainer(fluid);
+
+ ItemStack empty = getEmpty();
+ if ((filled == null) || (empty == null) || (fluid.get(1000) == null)) {
+ return;
+ }
+ FluidContainerRegistry.FluidContainerData data = new FluidContainerRegistry.FluidContainerData(fluid.get(1000), filled, empty);
+
+ FluidContainerRegistry.registerFluidContainer(data);
+ }
+}
diff --git a/src/Java/binnie/core/liquid/IFluidType.java b/src/Java/binnie/core/liquid/IFluidType.java
new file mode 100644
index 0000000000..3d0bd46d2b
--- /dev/null
+++ b/src/Java/binnie/core/liquid/IFluidType.java
@@ -0,0 +1,28 @@
+package binnie.core.liquid;
+
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.util.IIcon;
+import net.minecraftforge.fluids.FluidStack;
+
+public abstract interface IFluidType
+{
+ public abstract IIcon getIcon();
+
+ public abstract void registerIcon(IIconRegister paramIIconRegister);
+
+ public abstract String getName();
+
+ public abstract String getIdentifier();
+
+ public abstract FluidStack get(int paramInt);
+
+ public abstract int getColour();
+
+ public abstract int getContainerColour();
+
+ public abstract int getTransparency();
+
+ public abstract boolean canPlaceIn(FluidContainer paramFluidContainer);
+
+ public abstract boolean showInCreative(FluidContainer paramFluidContainer);
+}
diff --git a/src/Java/binnie/core/liquid/ILiquidType.java b/src/Java/binnie/core/liquid/ILiquidType.java
new file mode 100644
index 0000000000..69e035a3c3
--- /dev/null
+++ b/src/Java/binnie/core/liquid/ILiquidType.java
@@ -0,0 +1,7 @@
+package binnie.core.liquid;
+
+public abstract interface ILiquidType
+ extends IFluidType
+{
+ public abstract int ordinal();
+}
diff --git a/src/Java/binnie/core/liquid/ItemFluidContainer.java b/src/Java/binnie/core/liquid/ItemFluidContainer.java
new file mode 100644
index 0000000000..fe3e72a123
--- /dev/null
+++ b/src/Java/binnie/core/liquid/ItemFluidContainer.java
@@ -0,0 +1,179 @@
+package binnie.core.liquid;
+
+import binnie.Binnie;
+import binnie.extratrees.alcohol.AlcoholEffect;
+import binnie.extratrees.alcohol.drink.DrinkManager;
+import binnie.extratrees.alcohol.drink.IDrinkLiquid;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.EnumAction;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemFood;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.FoodStats;
+import net.minecraft.util.IIcon;
+import net.minecraft.world.World;
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidStack;
+
+public class ItemFluidContainer
+ extends ItemFood
+{
+ private FluidContainer container;
+ public static int LiquidExtraBee = 64;
+ public static int LiquidExtraTree = 128;
+ public static int LiquidJuice = 256;
+ public static int LiquidAlcohol = 384;
+ public static int LiquidSpirit = 512;
+ public static int LiquidLiqueuer = 640;
+ public static int LiquidGenetics = 768;
+ private static Map<Integer, String> idToFluid = new HashMap();
+ private static Map<String, Integer> fluidToID = new HashMap();
+
+ public static void registerFluid(IFluidType fluid, int id)
+ {
+ idToFluid.put(Integer.valueOf(id), fluid.getIdentifier().toLowerCase());
+ fluidToID.put(fluid.getIdentifier().toLowerCase(), Integer.valueOf(id));
+ }
+
+ public ItemFluidContainer(FluidContainer container)
+ {
+ super(0, false);
+ this.container = container;
+ container.item = this;
+ this.maxStackSize = container.getMaxStackSize();
+ setHasSubtypes(true);
+ setUnlocalizedName("container" + container.name());
+ setCreativeTab(CreativeTabs.tabMaterials);
+ }
+
+ private FluidStack getLiquid(ItemStack stack)
+ {
+ String liquid = (String)idToFluid.get(Integer.valueOf(stack.getItemDamage()));
+ return liquid == null ? null : Binnie.Liquid.getLiquidStack(liquid, 1000);
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void registerIcons(IIconRegister register)
+ {
+ this.container.updateIcons(register);
+ }
+
+ public String getItemStackDisplayName(ItemStack itemstack)
+ {
+ if (itemstack == null) {
+ return "???";
+ }
+ FluidStack fluid = getLiquid(itemstack);
+ if (fluid == null) {
+ return "Missing Fluid";
+ }
+ return fluid.getFluid().getLocalizedName(fluid) + " " + this.container.getName();
+ }
+
+ public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List itemList)
+ {
+ for (IFluidType liquid : Binnie.Liquid.fluids.values()) {
+ if ((liquid.canPlaceIn(this.container)) &&
+
+ (liquid.showInCreative(this.container))) {
+ itemList.add(getContainer(liquid));
+ }
+ }
+ }
+
+ public ItemStack getContainer(IFluidType liquid)
+ {
+ int id = ((Integer)fluidToID.get(liquid.getIdentifier().toLowerCase())).intValue();
+ ItemStack itemstack = new ItemStack(this, 1, id);
+ return itemstack;
+ }
+
+ public IIcon getIcon(ItemStack itemstack, int j)
+ {
+ if (j > 0) {
+ return this.container.getBottleIcon();
+ }
+ return this.container.getContentsIcon();
+ }
+
+ @SideOnly(Side.CLIENT)
+ public int getColorFromItemStack(ItemStack item, int pass)
+ {
+ FluidStack fluid = getLiquid(item);
+ if (fluid == null) {
+ return 16777215;
+ }
+ if ((pass == 0) && ((fluid.getFluid() instanceof BinnieFluid))) {
+ return ((BinnieFluid)fluid.getFluid()).fluidType.getContainerColour();
+ }
+ return super.getColorFromItemStack(item, pass);
+ }
+
+ public boolean requiresMultipleRenderPasses()
+ {
+ return true;
+ }
+
+ public ItemStack onEaten(ItemStack stack, World world, EntityPlayer player)
+ {
+ player.getFoodStats().func_151686_a(this, stack);
+ world.playSoundAtEntity(player, "random.burp", 0.5F, world.rand.nextFloat() * 0.1F + 0.9F);
+ onFoodEaten(stack, world, player);
+ return this.container.getEmpty();
+ }
+
+ protected void onFoodEaten(ItemStack stack, World world, EntityPlayer player)
+ {
+ if (!world.isRemote)
+ {
+ FluidStack fluid = getLiquid(stack);
+ IDrinkLiquid liquid = DrinkManager.getLiquid(fluid);
+ if (liquid != null) {
+ AlcoholEffect.makeDrunk(player, liquid.getABV() * fluid.amount);
+ }
+ }
+ }
+
+ public int getMaxItemUseDuration(ItemStack stack)
+ {
+ return 32;
+ }
+
+ public EnumAction getItemUseAction(ItemStack stack)
+ {
+ return isDrinkable(stack) ? EnumAction.drink : EnumAction.none;
+ }
+
+ public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
+ {
+ if (isDrinkable(stack)) {
+ player.setItemInUse(stack, getMaxItemUseDuration(stack));
+ }
+ return stack;
+ }
+
+ public int func_150905_g(ItemStack p_150905_1_)
+ {
+ return 0;
+ }
+
+ public float func_150906_h(ItemStack p_150906_1_)
+ {
+ return 0.0F;
+ }
+
+ private boolean isDrinkable(ItemStack stack)
+ {
+ FluidStack fluid = getLiquid(stack);
+ IDrinkLiquid liquid = DrinkManager.getLiquid(fluid);
+ return liquid == null ? false : liquid.isConsumable();
+ }
+}
diff --git a/src/Java/binnie/core/liquid/ManagerLiquid.java b/src/Java/binnie/core/liquid/ManagerLiquid.java
new file mode 100644
index 0000000000..f0ab486cc0
--- /dev/null
+++ b/src/Java/binnie/core/liquid/ManagerLiquid.java
@@ -0,0 +1,80 @@
+package binnie.core.liquid;
+
+import binnie.core.ManagerBase;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import java.util.Collection;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidRegistry;
+import net.minecraftforge.fluids.FluidStack;
+
+public class ManagerLiquid
+ extends ManagerBase
+{
+ Map<String, IFluidType> fluids = new LinkedHashMap();
+
+ public Collection<IFluidType> getFluidTypes()
+ {
+ return this.fluids.values();
+ }
+
+ public void createLiquids(IFluidType[] liquids, int startID)
+ {
+ for (IFluidType liquid : liquids)
+ {
+ BinnieFluid fluid = createLiquid(liquid, startID++);
+ if (fluid == null) {
+ throw new RuntimeException("Liquid registered incorrectly - " + liquid.getIdentifier());
+ }
+ }
+ }
+
+ public BinnieFluid createLiquid(IFluidType fluid, int id)
+ {
+ this.fluids.put(fluid.getIdentifier().toLowerCase(), fluid);
+ BinnieFluid bFluid = new BinnieFluid(fluid);
+ FluidRegistry.registerFluid(bFluid);
+ ItemFluidContainer.registerFluid(fluid, id);
+ return bFluid;
+ }
+
+ public FluidStack getLiquidStack(String name, int amount)
+ {
+ return FluidRegistry.getFluidStack(name.toLowerCase(), amount);
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void reloadIcons(IIconRegister register)
+ {
+ for (IFluidType type : this.fluids.values())
+ {
+ Fluid fluid = getLiquidStack(type.getIdentifier(), 1).getFluid();
+ type.registerIcon(register);
+ if (fluid == null) {
+ throw new RuntimeException("[Binnie] Liquid not registered properly - " + type.getIdentifier());
+ }
+ fluid.setIcons(type.getIcon());
+ }
+ }
+
+ public void init() {}
+
+ public void postInit()
+ {
+ for (IFluidType fluid : this.fluids.values()) {
+ for (FluidContainer container : FluidContainer.values()) {
+ if ((container.isActive()) && (fluid.canPlaceIn(container))) {
+ container.registerContainerData(fluid);
+ }
+ }
+ }
+ }
+
+ public IFluidType getFluidType(String liquid)
+ {
+ return (IFluidType)this.fluids.get(liquid.toLowerCase());
+ }
+}
diff --git a/src/Java/binnie/core/machines/BlockMachine.java b/src/Java/binnie/core/machines/BlockMachine.java
new file mode 100644
index 0000000000..042e213aec
--- /dev/null
+++ b/src/Java/binnie/core/machines/BlockMachine.java
@@ -0,0 +1,181 @@
+package binnie.core.machines;
+
+import binnie.Binnie;
+import binnie.core.BinnieCore;
+import binnie.core.machines.component.IRender.RandomDisplayTick;
+import binnie.core.proxy.BinnieProxy;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Random;
+import net.minecraft.block.Block;
+import net.minecraft.block.BlockContainer;
+import net.minecraft.block.material.Material;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.PlayerCapabilities;
+import net.minecraft.init.Blocks;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.IIcon;
+import net.minecraft.world.IBlockAccess;
+import net.minecraft.world.World;
+
+class BlockMachine
+ extends BlockContainer
+ implements IBlockMachine
+{
+ private MachineGroup group;
+
+ public BlockMachine(MachineGroup group, String blockName)
+ {
+ super(Material.iron);
+ this.group = group;
+ setHardness(1.5F);
+ setBlockName(blockName);
+ }
+
+ public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List itemList)
+ {
+ for (MachinePackage pack : this.group.getPackages()) {
+ if (pack.isActive()) {
+ itemList.add(new ItemStack(this, 1, pack.getMetadata().intValue()));
+ }
+ }
+ }
+
+ public boolean isOpaqueCube()
+ {
+ return false;
+ }
+
+ public boolean renderAsNormalBlock()
+ {
+ return !this.group.customRenderer;
+ }
+
+ public int getRenderType()
+ {
+ return Binnie.Machine.getMachineRenderID();
+ }
+
+ public TileEntity createTileEntity(World world, int metadata)
+ {
+ if (this.group.getPackage(metadata) == null) {
+ return null;
+ }
+ return this.group.getPackage(metadata).createTileEntity();
+ }
+
+ public MachinePackage getPackage(int meta)
+ {
+ return this.group.getPackage(meta);
+ }
+
+ public String getMachineName(int meta)
+ {
+ return getPackage(meta) == null ? "Unnamed Machine" : getPackage(meta).getDisplayName();
+ }
+
+ public int damageDropped(int par1)
+ {
+ return par1;
+ }
+
+ public TileEntity createNewTileEntity(World var1, int meta)
+ {
+ return createTileEntity(var1, meta);
+ }
+
+ public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9)
+ {
+ if (!BinnieCore.proxy.isSimulating(world)) {
+ return true;
+ }
+ if (player.isSneaking()) {
+ return true;
+ }
+ TileEntity entity = world.getTileEntity(x, y, z);
+ if ((entity instanceof TileEntityMachine)) {
+ ((TileEntityMachine)entity).getMachine().onRightClick(world, player, x, y, z);
+ }
+ return true;
+ }
+
+ public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entityliving, ItemStack stack)
+ {
+ super.onBlockPlacedBy(world, i, j, k, entityliving, stack);
+ if (!BinnieCore.proxy.isSimulating(world)) {
+ return;
+ }
+ IMachine machine = Machine.getMachine(world.getTileEntity(i, j, k));
+ if (machine == null) {
+ return;
+ }
+ if ((entityliving instanceof EntityPlayer)) {
+ machine.setOwner(((EntityPlayer)entityliving).getGameProfile());
+ }
+ }
+
+ public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side)
+ {
+ TileEntity entity = world.getTileEntity(x, y, z);
+ if (((entity instanceof TileEntityMachine)) && (((TileEntityMachine)entity).getMachine().hasInterface(IMachineTexturedFaces.class))) {
+ return ((IMachineTexturedFaces)((TileEntityMachine)entity).getMachine().getInterface(IMachineTexturedFaces.class)).getIcon(side);
+ }
+ return Blocks.dirt.getIcon(0, 0);
+ }
+
+ public void breakBlock(World world, int x, int y, int z, Block par5, int par6)
+ {
+ TileEntity tileentity = world.getTileEntity(x, y, z);
+ if (!(tileentity instanceof TileEntityMachine)) {
+ return;
+ }
+ TileEntityMachine entity = (TileEntityMachine)tileentity;
+ if (entity != null) {
+ entity.onBlockDestroy();
+ }
+ super.breakBlock(world, x, y, z, par5, par6);
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void registerBlockIcons(IIconRegister register) {}
+
+ @SideOnly(Side.CLIENT)
+ public void randomDisplayTick(World world, int x, int y, int z, Random rand)
+ {
+ IMachine machine = Machine.getMachine(world.getTileEntity(x, y, z));
+ if (machine != null) {
+ for (IRender.RandomDisplayTick renders : machine.getInterfaces(IRender.RandomDisplayTick.class)) {
+ renders.onRandomDisplayTick(world, x, y, z, rand);
+ }
+ }
+ }
+
+ public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune)
+ {
+ return new ArrayList();
+ }
+
+ public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z, boolean willHarvest)
+ {
+ if ((BinnieCore.proxy.isSimulating(world)) && (canHarvestBlock(player, world.getBlockMetadata(x, y, z))) &&
+ (!player.capabilities.isCreativeMode))
+ {
+ int metadata = world.getBlockMetadata(x, y, z);
+ ItemStack stack = new ItemStack(Item.getItemFromBlock(this), 1, damageDropped(metadata));
+ dropBlockAsItem(world, x, y, z, stack);
+ }
+ return world.setBlockToAir(x, y, z);
+ }
+
+ public static abstract interface IMachineTexturedFaces
+ {
+ public abstract IIcon getIcon(int paramInt);
+ }
+}
diff --git a/src/Java/binnie/core/machines/IBlockMachine.java b/src/Java/binnie/core/machines/IBlockMachine.java
new file mode 100644
index 0000000000..01b7e321a1
--- /dev/null
+++ b/src/Java/binnie/core/machines/IBlockMachine.java
@@ -0,0 +1,8 @@
+package binnie.core.machines;
+
+abstract interface IBlockMachine
+{
+ public abstract MachinePackage getPackage(int paramInt);
+
+ public abstract String getMachineName(int paramInt);
+}
diff --git a/src/Java/binnie/core/machines/IMachine.java b/src/Java/binnie/core/machines/IMachine.java
new file mode 100644
index 0000000000..9a57b0e019
--- /dev/null
+++ b/src/Java/binnie/core/machines/IMachine.java
@@ -0,0 +1,25 @@
+package binnie.core.machines;
+
+import java.util.Collection;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.world.World;
+
+public abstract interface IMachine
+ extends IOwnable
+{
+ public abstract void addComponent(MachineComponent paramMachineComponent);
+
+ public abstract MachineUtil getMachineUtil();
+
+ public abstract <T> T getInterface(Class<T> paramClass);
+
+ public abstract void markDirty();
+
+ public abstract World getWorld();
+
+ public abstract TileEntity getTileEntity();
+
+ public abstract <T> Collection<T> getInterfaces(Class<T> paramClass);
+
+ public abstract MachinePackage getPackage();
+}
diff --git a/src/Java/binnie/core/machines/IMachineType.java b/src/Java/binnie/core/machines/IMachineType.java
new file mode 100644
index 0000000000..06c02218a0
--- /dev/null
+++ b/src/Java/binnie/core/machines/IMachineType.java
@@ -0,0 +1,11 @@
+package binnie.core.machines;
+
+import binnie.core.network.IOrdinaled;
+
+public abstract interface IMachineType
+ extends IOrdinaled
+{
+ public abstract Class<? extends MachinePackage> getPackageClass();
+
+ public abstract boolean isActive();
+}
diff --git a/src/Java/binnie/core/machines/IOwnable.java b/src/Java/binnie/core/machines/IOwnable.java
new file mode 100644
index 0000000000..78aa1a76f9
--- /dev/null
+++ b/src/Java/binnie/core/machines/IOwnable.java
@@ -0,0 +1,10 @@
+package binnie.core.machines;
+
+import com.mojang.authlib.GameProfile;
+
+abstract interface IOwnable
+{
+ public abstract GameProfile getOwner();
+
+ public abstract void setOwner(GameProfile paramGameProfile);
+}
diff --git a/src/Java/binnie/core/machines/ItemMachine.java b/src/Java/binnie/core/machines/ItemMachine.java
new file mode 100644
index 0000000000..08426cdb7a
--- /dev/null
+++ b/src/Java/binnie/core/machines/ItemMachine.java
@@ -0,0 +1,29 @@
+package binnie.core.machines;
+
+import net.minecraft.block.Block;
+import net.minecraft.item.ItemBlock;
+import net.minecraft.item.ItemStack;
+
+public class ItemMachine
+ extends ItemBlock
+{
+ private IBlockMachine associatedBlock;
+
+ public ItemMachine(Block block)
+ {
+ super(block);
+ setMaxDamage(0);
+ setHasSubtypes(true);
+ this.associatedBlock = ((IBlockMachine)block);
+ }
+
+ public int getMetadata(int i)
+ {
+ return i;
+ }
+
+ public String getItemStackDisplayName(ItemStack itemstack)
+ {
+ return this.associatedBlock.getMachineName(itemstack.getItemDamage());
+ }
+}
diff --git a/src/Java/binnie/core/machines/Machine.java b/src/Java/binnie/core/machines/Machine.java
new file mode 100644
index 0000000000..474b32c627
--- /dev/null
+++ b/src/Java/binnie/core/machines/Machine.java
@@ -0,0 +1,320 @@
+package binnie.core.machines;
+
+import binnie.core.BinnieCore;
+import binnie.core.machines.component.IInteraction.RightClick;
+import binnie.core.machines.component.IRender.DisplayTick;
+import binnie.core.machines.network.INetwork.GuiNBT;
+import binnie.core.machines.network.INetwork.RecieveGuiNBT;
+import binnie.core.machines.network.INetwork.SendGuiNBT;
+import binnie.core.machines.network.INetwork.TilePacketSync;
+import binnie.core.machines.power.ITankMachine;
+import binnie.core.network.BinnieCorePacketID;
+import binnie.core.network.INetworkedEntity;
+import binnie.core.network.packet.MessageTileNBT;
+import binnie.core.network.packet.PacketPayload;
+import binnie.core.proxy.BinnieProxy;
+import com.mojang.authlib.GameProfile;
+import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper;
+import cpw.mods.fml.relauncher.Side;
+import forestry.api.core.INBTTagable;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.nbt.NBTUtil;
+import net.minecraft.network.Packet;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.world.World;
+
+public class Machine
+ implements INetworkedEntity, INBTTagable, INetwork.TilePacketSync, IMachine, INetwork.GuiNBT
+{
+ private MachinePackage machinePackage;
+ private Map<Class, List<MachineComponent>> componentInterfaceMap = new LinkedHashMap();
+ private Map<Class<? extends MachineComponent>, MachineComponent> componentMap = new LinkedHashMap();
+ private TileEntity tile;
+
+ public Machine(MachinePackage pack, TileEntity tile)
+ {
+ this.tile = tile;
+
+ pack.createMachine(this);
+ this.machinePackage = pack;
+ }
+
+ public void addComponent(MachineComponent component)
+ {
+ if (component == null) {
+ throw new NullPointerException("Can't have a null machine component!");
+ }
+ component.setMachine(this);
+ this.componentMap.put(component.getClass(), component);
+ for (Class inter : component.getComponentInterfaces())
+ {
+ if (!this.componentInterfaceMap.containsKey(inter)) {
+ this.componentInterfaceMap.put(inter, new ArrayList());
+ }
+ ((List)this.componentInterfaceMap.get(inter)).add(component);
+ }
+ }
+
+ public Collection<MachineComponent> getComponents()
+ {
+ return this.componentMap.values();
+ }
+
+ public <T extends MachineComponent> T getComponent(Class<T> componentClass)
+ {
+ return hasComponent(componentClass) ? (MachineComponent)componentClass.cast(this.componentMap.get(componentClass)) : null;
+ }
+
+ public <T> T getInterface(Class<T> interfaceClass)
+ {
+ if (hasInterface(interfaceClass)) {
+ return getInterfaces(interfaceClass).get(0);
+ }
+ if (interfaceClass.isInstance(getPackage())) {
+ return interfaceClass.cast(getPackage());
+ }
+ for (MachineComponent component : getComponents()) {
+ if (interfaceClass.isInstance(component)) {
+ return interfaceClass.cast(component);
+ }
+ }
+ return null;
+ }
+
+ public <T> List<T> getInterfaces(Class<T> interfaceClass)
+ {
+ ArrayList<T> interfaces = new ArrayList();
+ if (!hasInterface(interfaceClass)) {
+ return interfaces;
+ }
+ for (MachineComponent component : (List)this.componentInterfaceMap.get(interfaceClass)) {
+ interfaces.add(interfaceClass.cast(component));
+ }
+ return interfaces;
+ }
+
+ public boolean hasInterface(Class<?> interfaceClass)
+ {
+ return this.componentInterfaceMap.containsKey(interfaceClass);
+ }
+
+ public boolean hasComponent(Class<? extends MachineComponent> componentClass)
+ {
+ return this.componentMap.containsKey(componentClass);
+ }
+
+ public TileEntity getTileEntity()
+ {
+ return this.tile;
+ }
+
+ public void sendPacket()
+ {
+ if (!BinnieCore.proxy.isSimulating(getTileEntity().getWorldObj())) {
+ return;
+ }
+ BinnieCore.proxy.sendNetworkEntityPacket((INetworkedEntity)getTileEntity());
+ }
+
+ public Side getSide()
+ {
+ return BinnieCore.proxy.isSimulating(getTileEntity().getWorldObj()) ? Side.SERVER : Side.CLIENT;
+ }
+
+ public void writeToPacket(PacketPayload payload)
+ {
+ for (MachineComponent component : getComponents()) {
+ if ((component instanceof INetworkedEntity)) {
+ ((INetworkedEntity)component).writeToPacket(payload);
+ }
+ }
+ }
+
+ public void readFromPacket(PacketPayload payload)
+ {
+ for (MachineComponent component : getComponents()) {
+ if ((component instanceof INetworkedEntity)) {
+ ((INetworkedEntity)component).readFromPacket(payload);
+ }
+ }
+ }
+
+ public void onRightClick(World world, EntityPlayer player, int x, int y, int z)
+ {
+ for (IInteraction.RightClick component : getInterfaces(IInteraction.RightClick.class)) {
+ component.onRightClick(world, player, x, y, z);
+ }
+ }
+
+ public void markDirty()
+ {
+ this.queuedInventoryUpdate = true;
+ }
+
+ private boolean queuedInventoryUpdate = false;
+
+ public void onUpdate()
+ {
+ if (BinnieCore.proxy.isSimulating(getWorld())) {
+ for (MachineComponent component : getComponents()) {
+ component.onUpdate();
+ }
+ } else {
+ for (IRender.DisplayTick renders : getInterfaces(IRender.DisplayTick.class)) {
+ renders.onDisplayTick(getWorld(), getTileEntity().xCoord, getTileEntity().yCoord, getTileEntity().zCoord, getWorld().rand);
+ }
+ }
+ if (this.queuedInventoryUpdate)
+ {
+ for (MachineComponent component : getComponents()) {
+ component.onInventoryUpdate();
+ }
+ this.queuedInventoryUpdate = false;
+ }
+ }
+
+ public IInventory getInventory()
+ {
+ return (IInventory)getInterface(IInventory.class);
+ }
+
+ public ITankMachine getTankContainer()
+ {
+ return (ITankMachine)getInterface(ITankMachine.class);
+ }
+
+ public void readFromNBT(NBTTagCompound nbttagcompound)
+ {
+ for (MachineComponent component : getComponents()) {
+ component.readFromNBT(nbttagcompound);
+ }
+ this.owner = NBTUtil.func_152459_a(nbttagcompound.getCompoundTag("owner"));
+ markDirty();
+ }
+
+ public void writeToNBT(NBTTagCompound nbttagcompound)
+ {
+ for (MachineComponent component : getComponents()) {
+ component.writeToNBT(nbttagcompound);
+ }
+ if (this.owner != null)
+ {
+ NBTTagCompound nbt = new NBTTagCompound();
+ NBTUtil.func_152460_a(nbt, this.owner);
+ nbttagcompound.setTag("owner", nbt);
+ }
+ }
+
+ public MachinePackage getPackage()
+ {
+ return this.machinePackage;
+ }
+
+ public static IMachine getMachine(Object inventory)
+ {
+ if ((inventory != null) && ((inventory instanceof IMachine))) {
+ return (IMachine)inventory;
+ }
+ if ((inventory != null) && ((inventory instanceof TileEntityMachine))) {
+ return ((TileEntityMachine)inventory).getMachine();
+ }
+ if ((inventory != null) && ((inventory instanceof MachineComponent))) {
+ return ((MachineComponent)inventory).getMachine();
+ }
+ return null;
+ }
+
+ public static <T> T getInterface(Class<T> interfac, Object inventory)
+ {
+ IMachine machine = getMachine(inventory);
+ if (machine != null) {
+ return machine.getInterface(interfac);
+ }
+ if (interfac.isInstance(inventory)) {
+ return interfac.cast(inventory);
+ }
+ return null;
+ }
+
+ public MachineUtil getMachineUtil()
+ {
+ return new MachineUtil(this);
+ }
+
+ public World getWorld()
+ {
+ return getTileEntity().getWorldObj();
+ }
+
+ public void onBlockDestroy()
+ {
+ for (MachineComponent component : getComponents()) {
+ component.onDestruction();
+ }
+ }
+
+ private int nextProgressBarID = 0;
+
+ public int getUniqueProgressBarID()
+ {
+ return this.nextProgressBarID++;
+ }
+
+ private GameProfile owner = null;
+
+ public GameProfile getOwner()
+ {
+ return this.owner;
+ }
+
+ public void setOwner(GameProfile owner)
+ {
+ this.owner = owner;
+ }
+
+ public Packet getDescriptionPacket()
+ {
+ NBTTagCompound nbt = new NBTTagCompound();
+
+ syncToNBT(nbt);
+ if (nbt.hasNoTags()) {
+ return null;
+ }
+ return BinnieCore.instance.getNetworkWrapper().getPacketFrom(new MessageTileNBT(BinnieCorePacketID.TileDescriptionSync.ordinal(), getTileEntity(), nbt).GetMessage());
+ }
+
+ public void syncToNBT(NBTTagCompound nbt)
+ {
+ for (INetwork.TilePacketSync comp : getInterfaces(INetwork.TilePacketSync.class)) {
+ comp.syncToNBT(nbt);
+ }
+ }
+
+ public void syncFromNBT(NBTTagCompound nbt)
+ {
+ for (INetwork.TilePacketSync comp : getInterfaces(INetwork.TilePacketSync.class)) {
+ comp.syncFromNBT(nbt);
+ }
+ }
+
+ public void recieveGuiNBT(Side side, EntityPlayer player, String name, NBTTagCompound nbt)
+ {
+ for (INetwork.RecieveGuiNBT recieve : getInterfaces(INetwork.RecieveGuiNBT.class)) {
+ recieve.recieveGuiNBT(side, player, name, nbt);
+ }
+ }
+
+ public void sendGuiNBT(Map<String, NBTTagCompound> nbt)
+ {
+ for (INetwork.SendGuiNBT recieve : getInterfaces(INetwork.SendGuiNBT.class)) {
+ recieve.sendGuiNBT(nbt);
+ }
+ }
+}
diff --git a/src/Java/binnie/core/machines/MachineComponent.java b/src/Java/binnie/core/machines/MachineComponent.java
new file mode 100644
index 0000000000..3b90497fc3
--- /dev/null
+++ b/src/Java/binnie/core/machines/MachineComponent.java
@@ -0,0 +1,61 @@
+package binnie.core.machines;
+
+import binnie.Binnie;
+import binnie.core.network.packet.MachinePayload;
+import forestry.api.core.INBTTagable;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.nbt.NBTTagCompound;
+
+public class MachineComponent
+ implements INBTTagable
+{
+ private IMachine machine;
+
+ public MachineComponent(IMachine machine)
+ {
+ setMachine(machine);
+ machine.addComponent(this);
+ }
+
+ public void setMachine(IMachine machine)
+ {
+ this.machine = machine;
+ }
+
+ public IMachine getMachine()
+ {
+ return this.machine;
+ }
+
+ public void readFromNBT(NBTTagCompound nbttagcompound) {}
+
+ public void writeToNBT(NBTTagCompound nbttagcompound) {}
+
+ public void onUpdate() {}
+
+ public Class[] getComponentInterfaces()
+ {
+ return Binnie.Machine.getComponentInterfaces(getClass());
+ }
+
+ public void onInventoryUpdate() {}
+
+ public final MachinePayload getPayload()
+ {
+ return new MachinePayload(Binnie.Machine.getNetworkID(getClass()));
+ }
+
+ public void recieveData(MachinePayload payload) {}
+
+ public MachineUtil getUtil()
+ {
+ return getMachine().getMachineUtil();
+ }
+
+ public void onDestruction() {}
+
+ public IInventory getInventory()
+ {
+ return (IInventory)getMachine().getInterface(IInventory.class);
+ }
+}
diff --git a/src/Java/binnie/core/machines/MachineGroup.java b/src/Java/binnie/core/machines/MachineGroup.java
new file mode 100644
index 0000000000..03984f1f10
--- /dev/null
+++ b/src/Java/binnie/core/machines/MachineGroup.java
@@ -0,0 +1,113 @@
+package binnie.core.machines;
+
+import binnie.Binnie;
+import binnie.core.AbstractMod;
+import cpw.mods.fml.common.registry.GameRegistry;
+import java.util.Collection;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import net.minecraft.creativetab.CreativeTabs;
+
+public class MachineGroup
+{
+ private AbstractMod mod;
+ private String blockName;
+ private String uid;
+
+ public MachineGroup(AbstractMod mod, String uid, String blockName, IMachineType[] types)
+ {
+ this.mod = mod;
+ this.uid = uid;
+ this.blockName = blockName;
+ for (IMachineType type : types) {
+ if ((type.getPackageClass() != null) && (type.isActive())) {
+ try
+ {
+ MachinePackage pack = (MachinePackage)type.getPackageClass().newInstance();
+ pack.assignMetadata(type.ordinal());
+ pack.setActive(type.isActive());
+ addPackage(pack);
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Failed to create machine package " + type.toString(), e);
+ }
+ }
+ }
+ Binnie.Machine.registerMachineGroup(this);
+
+ this.block = new BlockMachine(this, blockName);
+ if (this.block != null)
+ {
+ GameRegistry.registerBlock(this.block, ItemMachine.class, blockName);
+ for (MachinePackage pack : getPackages()) {
+ pack.register();
+ }
+ }
+ }
+
+ private Map<String, MachinePackage> packages = new LinkedHashMap();
+ private Map<Integer, MachinePackage> packagesID = new LinkedHashMap();
+ private BlockMachine block;
+
+ private void addPackage(MachinePackage pack)
+ {
+ this.packages.put(pack.getUID(), pack);
+ this.packagesID.put(pack.getMetadata(), pack);
+ pack.setGroup(this);
+ }
+
+ public Collection<MachinePackage> getPackages()
+ {
+ return this.packages.values();
+ }
+
+ public boolean customRenderer = true;
+
+ public BlockMachine getBlock()
+ {
+ return this.block;
+ }
+
+ public MachinePackage getPackage(int metadata)
+ {
+ return (MachinePackage)this.packagesID.get(Integer.valueOf(metadata));
+ }
+
+ public MachinePackage getPackage(String name)
+ {
+ return (MachinePackage)this.packages.get(name);
+ }
+
+ public String getUID()
+ {
+ return this.mod.getModID() + "." + this.uid;
+ }
+
+ public String getShortUID()
+ {
+ return this.uid;
+ }
+
+ private boolean renderedTileEntity = true;
+
+ boolean isTileEntityRenderered()
+ {
+ return this.renderedTileEntity;
+ }
+
+ public void renderAsBlock()
+ {
+ this.renderedTileEntity = false;
+ }
+
+ public void setCreativeTab(CreativeTabs tab)
+ {
+ this.block.setCreativeTab(tab);
+ }
+
+ public AbstractMod getMod()
+ {
+ return this.mod;
+ }
+}
diff --git a/src/Java/binnie/core/machines/MachinePackage.java b/src/Java/binnie/core/machines/MachinePackage.java
new file mode 100644
index 0000000000..943db084b6
--- /dev/null
+++ b/src/Java/binnie/core/machines/MachinePackage.java
@@ -0,0 +1,74 @@
+package binnie.core.machines;
+
+import binnie.Binnie;
+import binnie.core.language.ManagerLanguage;
+import net.minecraft.client.renderer.RenderBlocks;
+import net.minecraft.tileentity.TileEntity;
+
+public abstract class MachinePackage
+{
+ private String uid;
+ private boolean active = true;
+ boolean powered = false;
+ private int metadata = -1;
+ private MachineGroup group;
+
+ public String getUID()
+ {
+ return this.uid;
+ }
+
+ protected MachinePackage(String uid, boolean powered)
+ {
+ this.uid = uid;
+ this.powered = powered;
+ }
+
+ public abstract void createMachine(Machine paramMachine);
+
+ public abstract TileEntity createTileEntity();
+
+ public abstract void register();
+
+ public final String getDisplayName()
+ {
+ return Binnie.Language.localise(this.group.getMod(), "machine." + this.group.getShortUID() + "." + getUID());
+ }
+
+ public final Integer getMetadata()
+ {
+ return Integer.valueOf(this.metadata);
+ }
+
+ public void assignMetadata(int meta)
+ {
+ this.metadata = meta;
+ }
+
+ public MachineGroup getGroup()
+ {
+ return this.group;
+ }
+
+ public void setGroup(MachineGroup group)
+ {
+ this.group = group;
+ }
+
+ public abstract void renderMachine(Machine paramMachine, double paramDouble1, double paramDouble2, double paramDouble3, float paramFloat, RenderBlocks paramRenderBlocks);
+
+ public boolean isActive()
+ {
+ return this.active;
+ }
+
+ public void setActive(boolean active)
+ {
+ this.active = active;
+ }
+
+ public final String getInformation()
+ {
+ return Binnie.Language.localise(this.group.getMod(), "machine." + this.group.getShortUID() + "." + getUID() + ".info");
+ }
+}
diff --git a/src/Java/binnie/core/machines/MachineRendererBlock.java b/src/Java/binnie/core/machines/MachineRendererBlock.java
new file mode 100644
index 0000000000..9506746df4
--- /dev/null
+++ b/src/Java/binnie/core/machines/MachineRendererBlock.java
@@ -0,0 +1,41 @@
+package binnie.core.machines;
+
+import binnie.core.BinnieCore;
+import binnie.core.proxy.BinnieProxy;
+import binnie.core.resource.BinnieResource;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import org.lwjgl.opengl.GL11;
+
+@SideOnly(Side.CLIENT)
+public class MachineRendererBlock
+{
+ public static MachineRendererBlock instance = new MachineRendererBlock();
+ private BinnieResource texture;
+ private ModelBlock model;
+
+ public MachineRendererBlock()
+ {
+ this.model = new ModelBlock();
+ }
+
+ public void renderMachine(BinnieResource texture, double x, double y, double z, float var8)
+ {
+ this.texture = texture;
+
+ GL11.glPushMatrix();
+
+ GL11.glTranslated(x + 0.5D, y + 1.5D, z + 0.5D);
+ GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
+
+ BinnieCore.proxy.bindTexture(texture);
+
+ GL11.glPushMatrix();
+
+ this.model.render((float)x, (float)y, (float)z, 0.0625F, 0.0625F, 0.0625F);
+
+ GL11.glPopMatrix();
+
+ GL11.glPopMatrix();
+ }
+}
diff --git a/src/Java/binnie/core/machines/MachineUtil.java b/src/Java/binnie/core/machines/MachineUtil.java
new file mode 100644
index 0000000000..97ff515061
--- /dev/null
+++ b/src/Java/binnie/core/machines/MachineUtil.java
@@ -0,0 +1,216 @@
+package binnie.core.machines;
+
+import binnie.core.BinnieCore;
+import binnie.core.machines.inventory.IChargedSlots;
+import binnie.core.machines.power.IPoweredMachine;
+import binnie.core.machines.power.IProcess;
+import binnie.core.machines.power.ITankMachine;
+import binnie.core.machines.power.PowerInterface;
+import binnie.core.machines.power.PowerSystem;
+import binnie.core.proxy.BinnieProxy;
+import binnie.core.util.ItemStackSet;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Random;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.item.ItemStack;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.world.World;
+import net.minecraftforge.fluids.FluidStack;
+import net.minecraftforge.fluids.IFluidTank;
+
+public class MachineUtil
+{
+ private IMachine machine;
+
+ public MachineUtil(IMachine machine)
+ {
+ this.machine = machine;
+ }
+
+ public IInventory getInventory()
+ {
+ return (IInventory)this.machine.getInterface(IInventory.class);
+ }
+
+ public ITankMachine getTankContainer()
+ {
+ return (ITankMachine)this.machine.getInterface(ITankMachine.class);
+ }
+
+ public IPoweredMachine getPoweredMachine()
+ {
+ return (IPoweredMachine)this.machine.getInterface(IPoweredMachine.class);
+ }
+
+ public boolean isSlotEmpty(int slot)
+ {
+ return getInventory().getStackInSlot(slot) == null;
+ }
+
+ public IFluidTank getTank(int id)
+ {
+ return getTankContainer().getTanks()[id];
+ }
+
+ public boolean spaceInTank(int id, int amount)
+ {
+ IFluidTank tank = getTank(id);
+ int space = tank.getCapacity() - tank.getFluidAmount();
+ return amount <= space;
+ }
+
+ public ItemStack getStack(int slot)
+ {
+ return getInventory().getStackInSlot(slot);
+ }
+
+ public void deleteStack(int slot)
+ {
+ setStack(slot, null);
+ }
+
+ public ItemStack decreaseStack(int slotWood, int amount)
+ {
+ return getInventory().decrStackSize(slotWood, amount);
+ }
+
+ public void setStack(int slot, ItemStack stack)
+ {
+ getInventory().setInventorySlotContents(slot, stack);
+ }
+
+ public void fillTank(int id, FluidStack liquidStack)
+ {
+ IFluidTank tank = getTank(id);
+ tank.fill(liquidStack, true);
+ }
+
+ public void addStack(int slot, ItemStack addition)
+ {
+ if (isSlotEmpty(slot))
+ {
+ setStack(slot, addition);
+ }
+ else
+ {
+ ItemStack merge = getStack(slot);
+ if ((merge.isItemEqual(addition)) && (merge.stackSize + addition.stackSize <= merge.getMaxStackSize()))
+ {
+ merge.stackSize += addition.stackSize;
+ setStack(slot, merge);
+ }
+ }
+ }
+
+ public FluidStack drainTank(int tank, int amount)
+ {
+ return getTank(tank).drain(amount, true);
+ }
+
+ public boolean liquidInTank(int tank, int amount)
+ {
+ return (getTank(tank).drain(amount, false) != null) && (getTank(tank).drain(amount, false).amount == amount);
+ }
+
+ public void damageItem(int slot, int damage)
+ {
+ ItemStack item = getStack(slot);
+ if (damage < 0) {
+ item.setItemDamage(Math.max(0, item.getItemDamage() + damage));
+ } else if (item.attemptDamageItem(damage, new Random())) {
+ setStack(slot, null);
+ }
+ setStack(slot, item);
+ }
+
+ public boolean isTankEmpty(int tankInput)
+ {
+ return getTank(tankInput).getFluidAmount() == 0;
+ }
+
+ public FluidStack getFluid(int tankInput)
+ {
+ return getTank(tankInput).getFluid() == null ? null : getTank(tankInput).getFluid();
+ }
+
+ public ItemStack[] getStacks(int[] slotGrains)
+ {
+ ItemStack[] stacks = new ItemStack[slotGrains.length];
+ for (int i = 0; i < slotGrains.length; i++) {
+ stacks[i] = getStack(slotGrains[i]);
+ }
+ return stacks;
+ }
+
+ public ItemStack hasIngredients(int recipe, int[] inventory)
+ {
+ return null;
+ }
+
+ public boolean hasIngredients(int[] recipe, int[] inventory)
+ {
+ ItemStackSet requiredStacks = new ItemStackSet();
+ for (ItemStack stack : getStacks(recipe)) {
+ requiredStacks.add(stack);
+ }
+ ItemStackSet inventoryStacks = new ItemStackSet();
+ for (ItemStack stack : getStacks(inventory)) {
+ inventoryStacks.add(stack);
+ }
+ requiredStacks.removeAll(inventoryStacks);
+
+ return requiredStacks.isEmpty();
+ }
+
+ public void useEnergyMJ(float powerUsage)
+ {
+ getPoweredMachine().getInterface().useEnergy(PowerSystem.MJ, powerUsage, true);
+ }
+
+ public boolean hasEnergyMJ(float powerUsage)
+ {
+ return getPoweredMachine().getInterface().useEnergy(PowerSystem.MJ, powerUsage, false) >= powerUsage;
+ }
+
+ public float getSlotCharge(int slot)
+ {
+ return ((IChargedSlots)this.machine.getInterface(IChargedSlots.class)).getCharge(slot);
+ }
+
+ public void useCharge(int slot, float loss)
+ {
+ ((IChargedSlots)this.machine.getInterface(IChargedSlots.class)).alterCharge(slot, -loss);
+ }
+
+ public Random getRandom()
+ {
+ return new Random();
+ }
+
+ public void refreshBlock()
+ {
+ this.machine.getWorld().markBlockForUpdate(this.machine.getTileEntity().xCoord, this.machine.getTileEntity().yCoord, this.machine.getTileEntity().zCoord);
+ }
+
+ public IProcess getProcess()
+ {
+ return (IProcess)this.machine.getInterface(IProcess.class);
+ }
+
+ public List<ItemStack> getNonNullStacks(int[] slotacclimatiser)
+ {
+ List<ItemStack> stacks = new ArrayList();
+ for (ItemStack stack : getStacks(slotacclimatiser)) {
+ if (stack != null) {
+ stacks.add(stack);
+ }
+ }
+ return stacks;
+ }
+
+ public boolean isServer()
+ {
+ return BinnieCore.proxy.isSimulating(this.machine.getWorld());
+ }
+}
diff --git a/src/Java/binnie/core/machines/ManagerMachine.java b/src/Java/binnie/core/machines/ManagerMachine.java
new file mode 100644
index 0000000000..53920e5496
--- /dev/null
+++ b/src/Java/binnie/core/machines/ManagerMachine.java
@@ -0,0 +1,108 @@
+package binnie.core.machines;
+
+import binnie.core.BinnieCore;
+import binnie.core.ManagerBase;
+import binnie.core.machines.inventory.ValidatorIcon;
+import binnie.core.proxy.BinnieProxy;
+import forestry.api.core.INBTTagable;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+public class ManagerMachine
+ extends ManagerBase
+{
+ private Map<Class<?>, Class<?>[]> componentInterfaceMap = new HashMap();
+ private Map<String, MachineGroup> machineGroups = new HashMap();
+ private Map<Integer, Class<?>> networkIDToComponent = new HashMap();
+ private Map<Class<?>, Integer> componentToNetworkID = new HashMap();
+ private int nextNetworkID = 0;
+ private int machineRenderID;
+
+ public void registerMachineGroup(MachineGroup group)
+ {
+ this.machineGroups.put(group.getUID(), group);
+ }
+
+ public MachineGroup getGroup(String name)
+ {
+ return (MachineGroup)this.machineGroups.get(name);
+ }
+
+ public MachinePackage getPackage(String group, String name)
+ {
+ MachineGroup machineGroup = getGroup(group);
+ return machineGroup == null ? null : machineGroup.getPackage(name);
+ }
+
+ private void registerComponentClass(Class<? extends MachineComponent> component)
+ {
+ if (this.componentInterfaceMap.containsKey(component)) {
+ return;
+ }
+ Set<Class<?>> interfaces = new HashSet();
+
+ Class<?> currentClass = component;
+ while (currentClass != null)
+ {
+ for (Class<?> clss : currentClass.getInterfaces()) {
+ interfaces.add(clss);
+ }
+ currentClass = currentClass.getSuperclass();
+ if (currentClass == Object.class) {
+ currentClass = null;
+ }
+ }
+ interfaces.remove(INBTTagable.class);
+
+ this.componentInterfaceMap.put(component, interfaces.toArray(new Class[0]));
+
+ int networkID = this.nextNetworkID++;
+
+ this.networkIDToComponent.put(Integer.valueOf(networkID), component);
+ this.componentToNetworkID.put(component, Integer.valueOf(networkID));
+ }
+
+ public int getNetworkID(Class<?> component)
+ {
+ return ((Integer)this.componentToNetworkID.get(component)).intValue();
+ }
+
+ public Class<?> getComponentClass(int networkID)
+ {
+ return (Class)this.networkIDToComponent.get(Integer.valueOf(networkID));
+ }
+
+ public int getMachineRenderID()
+ {
+ return this.machineRenderID;
+ }
+
+ public void init()
+ {
+ this.machineRenderID = BinnieCore.proxy.getUniqueRenderID();
+
+ binnie.core.machines.inventory.SlotValidator.IconBee = new ValidatorIcon(BinnieCore.instance, "validator/bee.0", "validator/bee.1");
+
+ binnie.core.machines.inventory.SlotValidator.IconFrame = new ValidatorIcon(BinnieCore.instance, "validator/frame.0", "validator/frame.1");
+
+ binnie.core.machines.inventory.SlotValidator.IconCircuit = new ValidatorIcon(BinnieCore.instance, "validator/circuit.0", "validator/circuit.1");
+
+ binnie.core.machines.inventory.SlotValidator.IconBlock = new ValidatorIcon(BinnieCore.instance, "validator/block.0", "validator/block.1");
+ }
+
+ public void postInit()
+ {
+ BinnieCore.proxy.registerBlockRenderer(BinnieCore.proxy.createObject("binnie.core.machines.RendererMachine"));
+ BinnieCore.proxy.registerTileEntity(TileEntityMachine.class, "binnie.tile.machine", BinnieCore.proxy.createObject("binnie.core.machines.RendererMachine"));
+ }
+
+ public Class<?>[] getComponentInterfaces(Class<? extends MachineComponent> clss)
+ {
+ if (!this.componentInterfaceMap.containsKey(clss)) {
+ registerComponentClass(clss);
+ }
+ return (Class[])this.componentInterfaceMap.get(clss);
+ }
+}
diff --git a/src/Java/binnie/core/machines/ModelBlock.java b/src/Java/binnie/core/machines/ModelBlock.java
new file mode 100644
index 0000000000..7258ec8654
--- /dev/null
+++ b/src/Java/binnie/core/machines/ModelBlock.java
@@ -0,0 +1,42 @@
+package binnie.core.machines;
+
+import net.minecraft.client.model.ModelBase;
+import net.minecraft.client.model.ModelRenderer;
+
+class ModelBlock
+ extends ModelBase
+{
+ private ModelRenderer Block;
+
+ public ModelBlock()
+ {
+ this.textureWidth = 64;
+ this.textureHeight = 32;
+
+ this.Block = new ModelRenderer(this, 0, 0);
+ this.Block.addBox(0.0F, 0.0F, 0.0F, 16, 16, 16);
+ this.Block.setRotationPoint(-8.0F, 8.0F, -8.0F);
+ this.Block.setTextureSize(64, 32);
+ this.Block.mirror = true;
+ setRotation(this.Block, 0.0F, 0.0F, 0.0F);
+ }
+
+ public void render(float f, float f1, float f2, float f3, float f4, float f5)
+ {
+ super.render(null, f, f1, f2, f3, f4, f5);
+ setRotationAngles(f, f1, f2, f3, f4, f5);
+ this.Block.render(f5);
+ }
+
+ private void setRotation(ModelRenderer model, float x, float y, float z)
+ {
+ model.rotateAngleX = x;
+ model.rotateAngleY = y;
+ model.rotateAngleZ = z;
+ }
+
+ public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5)
+ {
+ super.setRotationAngles(f, f1, f2, f3, f4, f5, null);
+ }
+}
diff --git a/src/Java/binnie/core/machines/RendererMachine.java b/src/Java/binnie/core/machines/RendererMachine.java
new file mode 100644
index 0000000000..18ad4afe92
--- /dev/null
+++ b/src/Java/binnie/core/machines/RendererMachine.java
@@ -0,0 +1,68 @@
+package binnie.core.machines;
+
+import binnie.Binnie;
+import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
+import net.minecraft.block.Block;
+import net.minecraft.client.renderer.RenderBlocks;
+import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.world.IBlockAccess;
+import net.minecraft.world.World;
+
+public class RendererMachine
+ extends TileEntitySpecialRenderer
+ implements ISimpleBlockRenderingHandler
+{
+ RenderBlocks blockRenderer;
+
+ public void renderTileEntityAt(TileEntity entity, double x, double y, double z, float var8)
+ {
+ renderTileEntity((TileEntityMachine)entity, x, y, z, var8, this.blockRenderer);
+ }
+
+ public void renderTileEntity(TileEntityMachine entity, double x, double y, double z, float var8, RenderBlocks renderer)
+ {
+ if ((entity != null) && (entity.getMachine() != null))
+ {
+ MachinePackage machinePackage = entity.getMachine().getPackage();
+ machinePackage.renderMachine(entity.getMachine(), x, y, z, var8, renderer);
+ }
+ }
+
+ public void renderInvBlock(RenderBlocks renderblocks, Block block, int i, int j)
+ {
+ TileEntity entity = block.createTileEntity(null, i);
+ renderTileEntity((TileEntityMachine)entity, 0.0D, -0.1D, 0.0D, 0.0625F, renderblocks);
+ }
+
+ public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer)
+ {
+ if (modelID == Binnie.Machine.getMachineRenderID()) {
+ renderInvBlock(renderer, block, metadata, modelID);
+ }
+ }
+
+ public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer)
+ {
+ TileEntityMachine tile = (TileEntityMachine)world.getTileEntity(x, y, z);
+ if ((tile != null) && (tile.getMachine() != null) && (tile.getMachine().getPackage() != null) && (tile.getMachine().getPackage().getGroup() != null) && (!tile.getMachine().getPackage().getGroup().customRenderer)) {
+ renderTileEntity(tile, x, y, z, 1.0F, renderer);
+ }
+ return true;
+ }
+
+ public boolean shouldRender3DInInventory(int i)
+ {
+ return true;
+ }
+
+ public int getRenderId()
+ {
+ return Binnie.Machine.getMachineRenderID();
+ }
+
+ public void func_147496_a(World par1World)
+ {
+ this.blockRenderer = new RenderBlocks(par1World);
+ }
+}
diff --git a/src/Java/binnie/core/machines/TileEntityMachine.java b/src/Java/binnie/core/machines/TileEntityMachine.java
new file mode 100644
index 0000000000..c6acf1fda8
--- /dev/null
+++ b/src/Java/binnie/core/machines/TileEntityMachine.java
@@ -0,0 +1,112 @@
+package binnie.core.machines;
+
+import binnie.Binnie;
+import binnie.core.machines.base.TileEntityMachineBase;
+import binnie.core.machines.component.IInteraction.ChunkUnload;
+import binnie.core.machines.component.IInteraction.Invalidation;
+import binnie.core.network.INetworkedEntity;
+import binnie.core.network.packet.PacketPayload;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.network.Packet;
+
+public class TileEntityMachine
+ extends TileEntityMachineBase
+ implements INetworkedEntity
+{
+ private Machine machine;
+
+ public void updateEntity()
+ {
+ super.updateEntity();
+ if (this.machine != null) {
+ this.machine.onUpdate();
+ }
+ }
+
+ public boolean canUpdate()
+ {
+ return super.canUpdate();
+ }
+
+ public TileEntityMachine(MachinePackage pack)
+ {
+ setMachine(pack);
+ }
+
+ public TileEntityMachine() {}
+
+ public void setMachine(MachinePackage pack)
+ {
+ if (pack != null) {
+ this.machine = new Machine(pack, this);
+ }
+ }
+
+ public void readFromNBT(NBTTagCompound nbtTagCompound)
+ {
+ super.readFromNBT(nbtTagCompound);
+ String name = nbtTagCompound.getString("name");
+ String group = nbtTagCompound.getString("group");
+ MachinePackage pack = Binnie.Machine.getPackage(group, name);
+ if (pack == null)
+ {
+ invalidate();
+ return;
+ }
+ setMachine(pack);
+ getMachine().readFromNBT(nbtTagCompound);
+ }
+
+ public void writeToNBT(NBTTagCompound nbtTagCompound)
+ {
+ super.writeToNBT(nbtTagCompound);
+ String name = this.machine.getPackage().getUID();
+ String group = this.machine.getPackage().getGroup().getUID();
+ nbtTagCompound.setString("group", group);
+ nbtTagCompound.setString("name", name);
+ getMachine().writeToNBT(nbtTagCompound);
+ }
+
+ public void writeToPacket(PacketPayload payload)
+ {
+ this.machine.writeToPacket(payload);
+ }
+
+ public void readFromPacket(PacketPayload payload)
+ {
+ this.machine.readFromPacket(payload);
+ }
+
+ public Machine getMachine()
+ {
+ return this.machine;
+ }
+
+ public void onBlockDestroy()
+ {
+ if (getMachine() != null) {
+ getMachine().onBlockDestroy();
+ }
+ }
+
+ public final Packet getDescriptionPacket()
+ {
+ return getMachine() != null ? getMachine().getDescriptionPacket() : null;
+ }
+
+ public void invalidate()
+ {
+ super.invalidate();
+ for (IInteraction.Invalidation c : getMachine().getInterfaces(IInteraction.Invalidation.class)) {
+ c.onInvalidation();
+ }
+ }
+
+ public void onChunkUnload()
+ {
+ super.onChunkUnload();
+ for (IInteraction.ChunkUnload c : getMachine().getInterfaces(IInteraction.ChunkUnload.class)) {
+ c.onChunkUnload();
+ }
+ }
+}
diff --git a/src/Java/binnie/core/machines/base/DefaultInventory.java b/src/Java/binnie/core/machines/base/DefaultInventory.java
new file mode 100644
index 0000000000..b72ebd3b57
--- /dev/null
+++ b/src/Java/binnie/core/machines/base/DefaultInventory.java
@@ -0,0 +1,82 @@
+package binnie.core.machines.base;
+
+import binnie.core.machines.inventory.IInventoryMachine;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+
+class DefaultInventory
+ implements IInventoryMachine
+{
+ public int getSizeInventory()
+ {
+ return 0;
+ }
+
+ public ItemStack getStackInSlot(int i)
+ {
+ return null;
+ }
+
+ public ItemStack decrStackSize(int i, int j)
+ {
+ return null;
+ }
+
+ public ItemStack getStackInSlotOnClosing(int i)
+ {
+ return null;
+ }
+
+ public void setInventorySlotContents(int i, ItemStack itemstack) {}
+
+ public int getInventoryStackLimit()
+ {
+ return 64;
+ }
+
+ public boolean isUseableByPlayer(EntityPlayer entityplayer)
+ {
+ return false;
+ }
+
+ public boolean isItemValidForSlot(int i, ItemStack itemstack)
+ {
+ return false;
+ }
+
+ public int[] getAccessibleSlotsFromSide(int var1)
+ {
+ return new int[0];
+ }
+
+ public boolean canInsertItem(int i, ItemStack itemstack, int j)
+ {
+ return false;
+ }
+
+ public boolean canExtractItem(int i, ItemStack itemstack, int j)
+ {
+ return false;
+ }
+
+ public boolean isReadOnly(int slot)
+ {
+ return false;
+ }
+
+ public String getInventoryName()
+ {
+ return "";
+ }
+
+ public boolean hasCustomInventoryName()
+ {
+ return false;
+ }
+
+ public void markDirty() {}
+
+ public void openInventory() {}
+
+ public void closeInventory() {}
+}
diff --git a/src/Java/binnie/core/machines/base/DefaultPower.java b/src/Java/binnie/core/machines/base/DefaultPower.java
new file mode 100644
index 0000000000..5d3e143b2b
--- /dev/null
+++ b/src/Java/binnie/core/machines/base/DefaultPower.java
@@ -0,0 +1,71 @@
+package binnie.core.machines.base;
+
+import binnie.core.machines.power.IPoweredMachine;
+import binnie.core.machines.power.PowerInfo;
+import binnie.core.machines.power.PowerInterface;
+import cpw.mods.fml.common.Optional.Method;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraftforge.common.util.ForgeDirection;
+
+class DefaultPower
+ implements IPoweredMachine
+{
+ public PowerInfo getPowerInfo()
+ {
+ return new PowerInfo(this, 0.0F);
+ }
+
+ @Optional.Method(modid="IC2")
+ public double getDemandedEnergy()
+ {
+ return 0.0D;
+ }
+
+ @Optional.Method(modid="IC2")
+ public int getSinkTier()
+ {
+ return 0;
+ }
+
+ @Optional.Method(modid="IC2")
+ public double injectEnergy(ForgeDirection directionFrom, double amount, double voltage)
+ {
+ return 0.0D;
+ }
+
+ @Optional.Method(modid="IC2")
+ public boolean acceptsEnergyFrom(TileEntity emitter, ForgeDirection direction)
+ {
+ return false;
+ }
+
+ public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate)
+ {
+ return 0;
+ }
+
+ public int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate)
+ {
+ return 0;
+ }
+
+ public int getEnergyStored(ForgeDirection from)
+ {
+ return 0;
+ }
+
+ public int getMaxEnergyStored(ForgeDirection from)
+ {
+ return 0;
+ }
+
+ public boolean canConnectEnergy(ForgeDirection from)
+ {
+ return false;
+ }
+
+ public PowerInterface getInterface()
+ {
+ return null;
+ }
+}
diff --git a/src/Java/binnie/core/machines/base/DefaultTankContainer.java b/src/Java/binnie/core/machines/base/DefaultTankContainer.java
new file mode 100644
index 0000000000..a0c93b1168
--- /dev/null
+++ b/src/Java/binnie/core/machines/base/DefaultTankContainer.java
@@ -0,0 +1,79 @@
+package binnie.core.machines.base;
+
+import binnie.core.machines.inventory.TankSlot;
+import binnie.core.machines.power.ITankMachine;
+import binnie.core.machines.power.TankInfo;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidStack;
+import net.minecraftforge.fluids.FluidTankInfo;
+import net.minecraftforge.fluids.IFluidTank;
+
+class DefaultTankContainer
+ implements ITankMachine
+{
+ public int fill(ForgeDirection from, FluidStack resource, boolean doFill)
+ {
+ return 0;
+ }
+
+ public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain)
+ {
+ return null;
+ }
+
+ public TankInfo[] getTankInfos()
+ {
+ return new TankInfo[0];
+ }
+
+ public boolean isTankReadOnly(int tank)
+ {
+ return false;
+ }
+
+ public boolean isLiquidValidForTank(FluidStack liquid, int tank)
+ {
+ return false;
+ }
+
+ public TankSlot addTank(int index, String name, int capacity)
+ {
+ return null;
+ }
+
+ public IFluidTank getTank(int index)
+ {
+ return null;
+ }
+
+ public TankSlot getTankSlot(int slot)
+ {
+ return null;
+ }
+
+ public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain)
+ {
+ return null;
+ }
+
+ public boolean canFill(ForgeDirection from, Fluid fluid)
+ {
+ return false;
+ }
+
+ public boolean canDrain(ForgeDirection from, Fluid fluid)
+ {
+ return false;
+ }
+
+ public FluidTankInfo[] getTankInfo(ForgeDirection from)
+ {
+ return new FluidTankInfo[0];
+ }
+
+ public IFluidTank[] getTanks()
+ {
+ return new IFluidTank[0];
+ }
+}
diff --git a/src/Java/binnie/core/machines/base/TileEntityMachineBase.java b/src/Java/binnie/core/machines/base/TileEntityMachineBase.java
new file mode 100644
index 0000000000..927671b67a
--- /dev/null
+++ b/src/Java/binnie/core/machines/base/TileEntityMachineBase.java
@@ -0,0 +1,262 @@
+package binnie.core.machines.base;
+
+import binnie.core.machines.Machine;
+import binnie.core.machines.inventory.IInventoryMachine;
+import binnie.core.machines.inventory.TankSlot;
+import binnie.core.machines.power.IPoweredMachine;
+import binnie.core.machines.power.ITankMachine;
+import binnie.core.machines.power.PowerInfo;
+import binnie.core.machines.power.PowerInterface;
+import binnie.core.machines.power.TankInfo;
+import cpw.mods.fml.common.Optional.Method;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.world.World;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidStack;
+import net.minecraftforge.fluids.FluidTankInfo;
+import net.minecraftforge.fluids.IFluidTank;
+
+public class TileEntityMachineBase
+ extends TileEntity
+ implements IInventoryMachine, ITankMachine, IPoweredMachine
+{
+ public IInventoryMachine getInventory()
+ {
+ IInventoryMachine inv = (IInventoryMachine)Machine.getInterface(IInventoryMachine.class, this);
+ return (inv == null) || (inv == this) ? new DefaultInventory() : inv;
+ }
+
+ public ITankMachine getTankContainer()
+ {
+ ITankMachine inv = (ITankMachine)Machine.getInterface(ITankMachine.class, this);
+ return (inv == null) || (inv == this) ? new DefaultTankContainer() : inv;
+ }
+
+ public IPoweredMachine getPower()
+ {
+ IPoweredMachine inv = (IPoweredMachine)Machine.getInterface(IPoweredMachine.class, this);
+ return (inv == null) || (inv == this) ? new DefaultPower() : inv;
+ }
+
+ public int getSizeInventory()
+ {
+ return getInventory().getSizeInventory();
+ }
+
+ public ItemStack getStackInSlot(int index)
+ {
+ return getInventory().getStackInSlot(index);
+ }
+
+ public ItemStack decrStackSize(int index, int amount)
+ {
+ return getInventory().decrStackSize(index, amount);
+ }
+
+ public ItemStack getStackInSlotOnClosing(int var1)
+ {
+ return getInventory().getStackInSlotOnClosing(var1);
+ }
+
+ public void setInventorySlotContents(int index, ItemStack itemStack)
+ {
+ getInventory().setInventorySlotContents(index, itemStack);
+ }
+
+ public String getInventoryName()
+ {
+ return getInventory().getInventoryName();
+ }
+
+ public int getInventoryStackLimit()
+ {
+ return getInventory().getInventoryStackLimit();
+ }
+
+ public boolean isUseableByPlayer(EntityPlayer entityplayer)
+ {
+ if (isInvalid()) {
+ return false;
+ }
+ if (getWorldObj().getTileEntity(this.xCoord, this.yCoord, this.zCoord) != this) {
+ return false;
+ }
+ if (entityplayer.getDistanceSq(this.xCoord + 0.5D, this.yCoord + 0.5D, this.zCoord + 0.5D) > 64.0D) {
+ return false;
+ }
+ return getInventory().isUseableByPlayer(entityplayer);
+ }
+
+ public void openInventory()
+ {
+ getInventory().openInventory();
+ }
+
+ public void closeInventory()
+ {
+ getInventory().closeInventory();
+ }
+
+ public boolean hasCustomInventoryName()
+ {
+ return getInventory().hasCustomInventoryName();
+ }
+
+ public void markDirty()
+ {
+ super.markDirty();
+ getInventory().markDirty();
+ }
+
+ public boolean isItemValidForSlot(int slot, ItemStack itemStack)
+ {
+ return getInventory().isItemValidForSlot(slot, itemStack);
+ }
+
+ public int[] getAccessibleSlotsFromSide(int var1)
+ {
+ return getInventory().getAccessibleSlotsFromSide(var1);
+ }
+
+ public boolean canInsertItem(int i, ItemStack itemstack, int j)
+ {
+ return getInventory().canInsertItem(i, itemstack, j);
+ }
+
+ public boolean canExtractItem(int i, ItemStack itemstack, int j)
+ {
+ return getInventory().canExtractItem(i, itemstack, j);
+ }
+
+ public boolean isReadOnly(int slot)
+ {
+ return getInventory().isReadOnly(slot);
+ }
+
+ public PowerInfo getPowerInfo()
+ {
+ return getPower().getPowerInfo();
+ }
+
+ public TankInfo[] getTankInfos()
+ {
+ return getTankContainer().getTankInfos();
+ }
+
+ public boolean isTankReadOnly(int tank)
+ {
+ return getTankContainer().isTankReadOnly(tank);
+ }
+
+ public boolean isLiquidValidForTank(FluidStack liquid, int tank)
+ {
+ return getTankContainer().isLiquidValidForTank(liquid, tank);
+ }
+
+ public TankSlot addTank(int index, String name, int capacity)
+ {
+ return getTankContainer().addTank(index, name, capacity);
+ }
+
+ public IFluidTank getTank(int index)
+ {
+ return getTankContainer().getTank(index);
+ }
+
+ public TankSlot getTankSlot(int index)
+ {
+ return getTankContainer().getTankSlot(index);
+ }
+
+ public int fill(ForgeDirection from, FluidStack resource, boolean doFill)
+ {
+ return getTankContainer().fill(from, resource, doFill);
+ }
+
+ public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain)
+ {
+ return getTankContainer().drain(from, resource, doDrain);
+ }
+
+ public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain)
+ {
+ return getTankContainer().drain(from, maxDrain, doDrain);
+ }
+
+ public boolean canFill(ForgeDirection from, Fluid fluid)
+ {
+ return getTankContainer().canFill(from, fluid);
+ }
+
+ public boolean canDrain(ForgeDirection from, Fluid fluid)
+ {
+ return getTankContainer().canDrain(from, fluid);
+ }
+
+ public FluidTankInfo[] getTankInfo(ForgeDirection from)
+ {
+ return getTankContainer().getTankInfo(from);
+ }
+
+ public IFluidTank[] getTanks()
+ {
+ return getTankContainer().getTanks();
+ }
+
+ @Optional.Method(modid="IC2")
+ public double getDemandedEnergy()
+ {
+ return getPower().getDemandedEnergy();
+ }
+
+ @Optional.Method(modid="IC2")
+ public int getSinkTier()
+ {
+ return getPower().getSinkTier();
+ }
+
+ @Optional.Method(modid="IC2")
+ public double injectEnergy(ForgeDirection directionFrom, double amount, double voltage)
+ {
+ return getPower().injectEnergy(directionFrom, amount, voltage);
+ }
+
+ @Optional.Method(modid="IC2")
+ public boolean acceptsEnergyFrom(TileEntity emitter, ForgeDirection direction)
+ {
+ return getPower().acceptsEnergyFrom(emitter, direction);
+ }
+
+ public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate)
+ {
+ return getPower().receiveEnergy(from, maxReceive, simulate);
+ }
+
+ public int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate)
+ {
+ return getPower().extractEnergy(from, maxExtract, simulate);
+ }
+
+ public int getEnergyStored(ForgeDirection from)
+ {
+ return getPower().getEnergyStored(from);
+ }
+
+ public int getMaxEnergyStored(ForgeDirection from)
+ {
+ return getPower().getMaxEnergyStored(from);
+ }
+
+ public boolean canConnectEnergy(ForgeDirection from)
+ {
+ return getPower().canConnectEnergy(from);
+ }
+
+ public PowerInterface getInterface()
+ {
+ return getPower().getInterface();
+ }
+}
diff --git a/src/Java/binnie/core/machines/component/ComponentRecipe.java b/src/Java/binnie/core/machines/component/ComponentRecipe.java
new file mode 100644
index 0000000000..502967e83a
--- /dev/null
+++ b/src/Java/binnie/core/machines/component/ComponentRecipe.java
@@ -0,0 +1,14 @@
+package binnie.core.machines.component;
+
+import binnie.core.machines.Machine;
+import binnie.core.machines.MachineComponent;
+
+public abstract class ComponentRecipe
+ extends MachineComponent
+ implements IComponentRecipe
+{
+ public ComponentRecipe(Machine machine)
+ {
+ super(machine);
+ }
+}
diff --git a/src/Java/binnie/core/machines/component/IBuildcraft.java b/src/Java/binnie/core/machines/component/IBuildcraft.java
new file mode 100644
index 0000000000..42c4b315e6
--- /dev/null
+++ b/src/Java/binnie/core/machines/component/IBuildcraft.java
@@ -0,0 +1,20 @@
+package binnie.core.machines.component;
+
+import binnie.core.triggers.TriggerData;
+import buildcraft.api.statements.IActionExternal;
+import buildcraft.api.statements.IActionReceptor;
+import java.util.List;
+
+public abstract interface IBuildcraft
+{
+ public static abstract interface TriggerProvider
+ {
+ public abstract void getTriggers(List<TriggerData> paramList);
+ }
+
+ public static abstract interface ActionProvider
+ extends IActionReceptor
+ {
+ public abstract void getActions(List<IActionExternal> paramList);
+ }
+}
diff --git a/src/Java/binnie/core/machines/component/IComponentRecipe.java b/src/Java/binnie/core/machines/component/IComponentRecipe.java
new file mode 100644
index 0000000000..f512d1090f
--- /dev/null
+++ b/src/Java/binnie/core/machines/component/IComponentRecipe.java
@@ -0,0 +1,12 @@
+package binnie.core.machines.component;
+
+import net.minecraft.item.ItemStack;
+
+public abstract interface IComponentRecipe
+{
+ public abstract boolean isRecipe();
+
+ public abstract ItemStack doRecipe(boolean paramBoolean);
+
+ public abstract ItemStack getProduct();
+}
diff --git a/src/Java/binnie/core/machines/component/IInteraction.java b/src/Java/binnie/core/machines/component/IInteraction.java
new file mode 100644
index 0000000000..7556b5d567
--- /dev/null
+++ b/src/Java/binnie/core/machines/component/IInteraction.java
@@ -0,0 +1,22 @@
+package binnie.core.machines.component;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.world.World;
+
+public abstract interface IInteraction
+{
+ public static abstract interface ChunkUnload
+ {
+ public abstract void onChunkUnload();
+ }
+
+ public static abstract interface Invalidation
+ {
+ public abstract void onInvalidation();
+ }
+
+ public static abstract interface RightClick
+ {
+ public abstract void onRightClick(World paramWorld, EntityPlayer paramEntityPlayer, int paramInt1, int paramInt2, int paramInt3);
+ }
+}
diff --git a/src/Java/binnie/core/machines/component/IRender.java b/src/Java/binnie/core/machines/component/IRender.java
new file mode 100644
index 0000000000..0b79e985bb
--- /dev/null
+++ b/src/Java/binnie/core/machines/component/IRender.java
@@ -0,0 +1,28 @@
+package binnie.core.machines.component;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import java.util.Random;
+import net.minecraft.client.renderer.entity.RenderItem;
+import net.minecraft.world.World;
+
+public abstract interface IRender
+{
+ public static abstract interface DisplayTick
+ {
+ @SideOnly(Side.CLIENT)
+ public abstract void onDisplayTick(World paramWorld, int paramInt1, int paramInt2, int paramInt3, Random paramRandom);
+ }
+
+ public static abstract interface RandomDisplayTick
+ {
+ @SideOnly(Side.CLIENT)
+ public abstract void onRandomDisplayTick(World paramWorld, int paramInt1, int paramInt2, int paramInt3, Random paramRandom);
+ }
+
+ public static abstract interface Render
+ {
+ @SideOnly(Side.CLIENT)
+ public abstract void renderInWorld(RenderItem paramRenderItem, double paramDouble1, double paramDouble2, double paramDouble3);
+ }
+}
diff --git a/src/Java/binnie/core/machines/inventory/AccessDirection.java b/src/Java/binnie/core/machines/inventory/AccessDirection.java
new file mode 100644
index 0000000000..10abf8d7f0
--- /dev/null
+++ b/src/Java/binnie/core/machines/inventory/AccessDirection.java
@@ -0,0 +1,97 @@
+package binnie.core.machines.inventory;
+
+ enum AccessDirection
+{
+ Both, In, Out, Neither;
+
+ private AccessDirection() {}
+
+ boolean canInsert()
+ {
+ return (this == Both) || (this == In);
+ }
+
+ boolean canExtract()
+ {
+ return (this == Both) || (this == Out);
+ }
+
+ boolean canAccess()
+ {
+ return this != Neither;
+ }
+
+ AccessDirection changeInsert(boolean b)
+ {
+ if (b)
+ {
+ if (this == Out) {
+ return Both;
+ }
+ if (this == Neither) {
+ return In;
+ }
+ }
+ else
+ {
+ if (this == Both) {
+ return Out;
+ }
+ if (this == In) {
+ return Neither;
+ }
+ }
+ return this;
+ }
+
+ AccessDirection changeExtract(boolean b)
+ {
+ if (b)
+ {
+ if (this == In) {
+ return Both;
+ }
+ if (this == Neither) {
+ return Out;
+ }
+ }
+ else
+ {
+ if (this == Both) {
+ return In;
+ }
+ if (this == Out) {
+ return Neither;
+ }
+ }
+ return this;
+ }
+
+ public String getTextColour()
+ {
+ switch (1.$SwitchMap$binnie$core$machines$inventory$AccessDirection[ordinal()])
+ {
+ case 1:
+ return "§a";
+ case 2:
+ return "§e";
+ case 3:
+ return "§c";
+ }
+ return "§b";
+ }
+
+ public int getShadeColour()
+ {
+ switch (1.$SwitchMap$binnie$core$machines$inventory$AccessDirection[ordinal()])
+ {
+ case 1:
+ return 1431699285;
+ case 2:
+ return 1442840405;
+ case 3:
+ return 1442796885;
+ }
+ return 1431699455;
+ }
+}
diff --git a/src/Java/binnie/core/machines/inventory/BaseSlot.java b/src/Java/binnie/core/machines/inventory/BaseSlot.java
new file mode 100644
index 0000000000..fe5cde21d3
--- /dev/null
+++ b/src/Java/binnie/core/machines/inventory/BaseSlot.java
@@ -0,0 +1,148 @@
+package binnie.core.machines.inventory;
+
+import binnie.core.util.IValidator;
+import forestry.api.core.INBTTagable;
+import java.util.Collection;
+import java.util.EnumSet;
+import net.minecraftforge.common.util.ForgeDirection;
+
+abstract class BaseSlot<T>
+ implements INBTTagable, IValidator<T>
+{
+ private SidedAccess access = new SidedAccess();
+ Validator<T> validator = null;
+ private boolean readOnly = false;
+ private int index;
+
+ public BaseSlot(int index, String unlocName)
+ {
+ setIndex(index);
+ setUnlocalisedName(unlocName);
+ }
+
+ public void setReadOnly()
+ {
+ this.readOnly = true;
+ forbidInsertion();
+ }
+
+ public boolean isValid(T item)
+ {
+ if (item == null) {
+ return true;
+ }
+ if (this.validator != null) {
+ return this.validator.isValid(item);
+ }
+ return true;
+ }
+
+ public abstract T getContent();
+
+ public abstract void setContent(T paramT);
+
+ public void setValidator(Validator<T> val)
+ {
+ this.validator = val;
+ }
+
+ public boolean isEmpty()
+ {
+ return getContent() == null;
+ }
+
+ public boolean isReadOnly()
+ {
+ return this.readOnly;
+ }
+
+ public int getIndex()
+ {
+ return this.index;
+ }
+
+ private void setIndex(int index)
+ {
+ this.index = index;
+ }
+
+ public boolean canInsert()
+ {
+ return !this.access.getInsertionSides().isEmpty();
+ }
+
+ public boolean canExtract()
+ {
+ return !this.access.getExtractionSides().isEmpty();
+ }
+
+ public void forbidInteraction()
+ {
+ forbidInsertion();
+ forbidExtraction();
+ }
+
+ public void setInputSides(EnumSet<ForgeDirection> sides)
+ {
+ for (ForgeDirection side : EnumSet.complementOf(sides)) {
+ if (side != ForgeDirection.UNKNOWN) {
+ this.access.setInsert(side, false);
+ }
+ }
+ }
+
+ public void setOutputSides(EnumSet<ForgeDirection> sides)
+ {
+ for (ForgeDirection side : EnumSet.complementOf(sides)) {
+ if (side != ForgeDirection.UNKNOWN) {
+ this.access.setExtract(side, false);
+ }
+ }
+ }
+
+ public void forbidExtraction()
+ {
+ this.access.setExtract(false);
+ this.access.forbidExtractChange();
+ }
+
+ public void forbidInsertion()
+ {
+ this.access.setInsert(false);
+ this.access.forbidInsertChange();
+ }
+
+ public boolean canInsert(ForgeDirection dir)
+ {
+ return this.access.canInsert(dir);
+ }
+
+ public boolean canExtract(ForgeDirection dir)
+ {
+ return this.access.canExtract(dir);
+ }
+
+ public Collection<ForgeDirection> getInputSides()
+ {
+ return this.access.getInsertionSides();
+ }
+
+ public Collection<ForgeDirection> getOutputSides()
+ {
+ return this.access.getExtractionSides();
+ }
+
+ protected String unlocName = "";
+
+ public void setUnlocalisedName(String name)
+ {
+ this.unlocName = name;
+ }
+
+ public abstract String getName();
+
+ public Validator<T> getValidator()
+ {
+ return this.validator;
+ }
+}
diff --git a/src/Java/binnie/core/machines/inventory/ComponentChargedSlots.java b/src/Java/binnie/core/machines/inventory/ComponentChargedSlots.java
new file mode 100644
index 0000000000..078a2f98d5
--- /dev/null
+++ b/src/Java/binnie/core/machines/inventory/ComponentChargedSlots.java
@@ -0,0 +1,117 @@
+package binnie.core.machines.inventory;
+
+import binnie.core.machines.Machine;
+import binnie.core.machines.MachineComponent;
+import binnie.core.machines.MachineUtil;
+import binnie.core.machines.network.INetwork.GuiNBT;
+import cpw.mods.fml.relauncher.Side;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.nbt.NBTTagList;
+
+public class ComponentChargedSlots
+ extends MachineComponent
+ implements INetwork.GuiNBT, IChargedSlots
+{
+ public ComponentChargedSlots(Machine machine)
+ {
+ super(machine);
+ }
+
+ public void readFromNBT(NBTTagCompound nbttagcompound)
+ {
+ super.readFromNBT(nbttagcompound);
+ this.charges.clear();
+ NBTTagList list = nbttagcompound.getTagList("charges", 10);
+ for (int i = 0; i < list.tagCount(); i++)
+ {
+ NBTTagCompound tag = list.getCompoundTagAt(i);
+ this.charges.put(Integer.valueOf(tag.getByte("i")), Float.valueOf(tag.getByte("v") / 100.0F));
+ }
+ }
+
+ public void writeToNBT(NBTTagCompound nbttagcompound)
+ {
+ super.writeToNBT(nbttagcompound);
+
+ NBTTagList chargeList = new NBTTagList();
+ for (Map.Entry<Integer, Float> entry : this.charges.entrySet())
+ {
+ NBTTagCompound chargesNBT = new NBTTagCompound();
+ chargesNBT.setByte("i", (byte)(0 + ((Integer)entry.getKey()).intValue()));
+ chargesNBT.setByte("v", (byte)(int)(((Float)entry.getValue()).floatValue() * 100.0F));
+ chargeList.appendTag(chargesNBT);
+ }
+ nbttagcompound.setTag("charges", chargeList);
+ }
+
+ private Map<Integer, Float> charges = new HashMap();
+
+ public void addCharge(int slot)
+ {
+ this.charges.put(Integer.valueOf(slot), Float.valueOf(0.0F));
+ }
+
+ public void recieveGuiNBT(Side side, EntityPlayer player, String name, NBTTagCompound nbt)
+ {
+ Iterator i$;
+ if (name.equals("slot-charges")) {
+ for (i$ = this.charges.keySet().iterator(); i$.hasNext();)
+ {
+ int i = ((Integer)i$.next()).intValue();
+ this.charges.put(Integer.valueOf(i), Float.valueOf(nbt.getShort("" + i) / 100.0F));
+ }
+ }
+ }
+
+ public void sendGuiNBT(Map<String, NBTTagCompound> nbt)
+ {
+ NBTTagCompound tag = new NBTTagCompound();
+ for (Iterator i$ = this.charges.keySet().iterator(); i$.hasNext();)
+ {
+ int i = ((Integer)i$.next()).intValue();
+ tag.setShort("" + i, (short)(int)(((Float)this.charges.get(Integer.valueOf(i))).floatValue() * 100.0F));
+ }
+ nbt.put("slot-charges", tag);
+ }
+
+ public float getCharge(int slot)
+ {
+ return this.charges.containsKey(Integer.valueOf(slot)) ? ((Float)this.charges.get(Integer.valueOf(slot))).floatValue() : 0.0F;
+ }
+
+ public void setCharge(int slot, float charge)
+ {
+ if (charge > 1.0F) {
+ charge = 1.0F;
+ }
+ if (charge < 0.0F) {
+ charge = 0.0F;
+ }
+ if (this.charges.containsKey(Integer.valueOf(slot))) {
+ this.charges.put(Integer.valueOf(slot), Float.valueOf(charge));
+ }
+ }
+
+ public void onUpdate()
+ {
+ for (Iterator i$ = this.charges.keySet().iterator(); i$.hasNext();)
+ {
+ int slot = ((Integer)i$.next()).intValue();
+ if ((getCharge(slot) <= 0.0F) &&
+ (getUtil().decreaseStack(slot, 1) != null)) {
+ setCharge(slot, 1.0F);
+ }
+ }
+ }
+
+ public void alterCharge(int slot, float charge)
+ {
+ setCharge(slot, getCharge(slot) + charge);
+ }
+}
diff --git a/src/Java/binnie/core/machines/inventory/ComponentInventory.java b/src/Java/binnie/core/machines/inventory/ComponentInventory.java
new file mode 100644
index 0000000000..66566e511c
--- /dev/null
+++ b/src/Java/binnie/core/machines/inventory/ComponentInventory.java
@@ -0,0 +1,22 @@
+package binnie.core.machines.inventory;
+
+import binnie.core.machines.IMachine;
+import binnie.core.machines.MachineComponent;
+import net.minecraft.inventory.IInventory;
+
+public abstract class ComponentInventory
+ extends MachineComponent
+ implements IInventory
+{
+ public ComponentInventory(IMachine machine)
+ {
+ super(machine);
+ }
+
+ public void markDirty()
+ {
+ if (getMachine() != null) {
+ getMachine().markDirty();
+ }
+ }
+}
diff --git a/src/Java/binnie/core/machines/inventory/ComponentInventorySlots.java b/src/Java/binnie/core/machines/inventory/ComponentInventorySlots.java
new file mode 100644
index 0000000000..42334f4485
--- /dev/null
+++ b/src/Java/binnie/core/machines/inventory/ComponentInventorySlots.java
@@ -0,0 +1,247 @@
+package binnie.core.machines.inventory;
+
+import binnie.core.machines.IMachine;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Random;
+import net.minecraft.entity.item.EntityItem;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.nbt.NBTTagList;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.world.World;
+import net.minecraftforge.common.util.ForgeDirection;
+
+public class ComponentInventorySlots
+ extends ComponentInventory
+ implements IInventoryMachine, IInventorySlots
+{
+ public ComponentInventorySlots(IMachine machine)
+ {
+ super(machine);
+ }
+
+ private Map<Integer, InventorySlot> inventory = new LinkedHashMap();
+
+ public int getSizeInventory()
+ {
+ int size = 0;
+ for (Integer index : this.inventory.keySet()) {
+ size = Math.max(size, index.intValue() + 1);
+ }
+ return size;
+ }
+
+ public ItemStack getStackInSlot(int index)
+ {
+ if (this.inventory.containsKey(Integer.valueOf(index))) {
+ return ((InventorySlot)this.inventory.get(Integer.valueOf(index))).getContent();
+ }
+ return null;
+ }
+
+ public ItemStack decrStackSize(int index, int amount)
+ {
+ if (this.inventory.containsKey(Integer.valueOf(index)))
+ {
+ ItemStack stack = ((InventorySlot)this.inventory.get(Integer.valueOf(index))).decrStackSize(amount);
+ markDirty();
+ return stack;
+ }
+ return null;
+ }
+
+ public ItemStack getStackInSlotOnClosing(int var1)
+ {
+ return null;
+ }
+
+ public void setInventorySlotContents(int index, ItemStack itemStack)
+ {
+ if ((this.inventory.containsKey(Integer.valueOf(index))) && ((itemStack == null) || (((InventorySlot)this.inventory.get(Integer.valueOf(index))).isValid(itemStack)))) {
+ ((InventorySlot)this.inventory.get(Integer.valueOf(index))).setContent(itemStack);
+ }
+ markDirty();
+ }
+
+ protected void transferItem(int indexFrom, int indexTo)
+ {
+ if ((this.inventory.containsKey(Integer.valueOf(indexFrom))) && (this.inventory.containsKey(Integer.valueOf(indexTo))))
+ {
+ ItemStack newStack = ((InventorySlot)this.inventory.get(Integer.valueOf(indexFrom))).getContent().copy();
+ ((InventorySlot)this.inventory.get(Integer.valueOf(indexFrom))).setContent(null);
+ ((InventorySlot)this.inventory.get(Integer.valueOf(indexTo))).setContent(newStack);
+ }
+ markDirty();
+ }
+
+ public String getInventoryName()
+ {
+ return "";
+ }
+
+ public int getInventoryStackLimit()
+ {
+ return 64;
+ }
+
+ public boolean isUseableByPlayer(EntityPlayer var1)
+ {
+ return true;
+ }
+
+ public void openInventory() {}
+
+ public void closeInventory() {}
+
+ public void readFromNBT(NBTTagCompound nbttagcompound)
+ {
+ super.readFromNBT(nbttagcompound);
+ if (nbttagcompound.hasKey("inventory"))
+ {
+ NBTTagList inventoryNBT = nbttagcompound.getTagList("inventory", 10);
+ for (int i = 0; i < inventoryNBT.tagCount(); i++)
+ {
+ NBTTagCompound slotNBT = inventoryNBT.getCompoundTagAt(i);
+ int index = slotNBT.getInteger("id");
+ if (slotNBT.hasKey("Slot")) {
+ index = slotNBT.getByte("Slot") & 0xFF;
+ }
+ if (this.inventory.containsKey(Integer.valueOf(index))) {
+ ((InventorySlot)this.inventory.get(Integer.valueOf(index))).readFromNBT(slotNBT);
+ }
+ }
+ }
+ markDirty();
+ }
+
+ public void writeToNBT(NBTTagCompound nbttagcompound)
+ {
+ super.writeToNBT(nbttagcompound);
+
+ NBTTagList inventoryNBT = new NBTTagList();
+ for (Map.Entry<Integer, InventorySlot> entry : this.inventory.entrySet())
+ {
+ NBTTagCompound slotNBT = new NBTTagCompound();
+ slotNBT.setInteger("id", ((Integer)entry.getKey()).intValue());
+ ((InventorySlot)entry.getValue()).writeToNBT(slotNBT);
+ inventoryNBT.appendTag(slotNBT);
+ }
+ nbttagcompound.setTag("inventory", inventoryNBT);
+ }
+
+ public final InventorySlot addSlot(int index, String unlocName)
+ {
+ this.inventory.put(Integer.valueOf(index), new InventorySlot(index, unlocName));
+ return getSlot(index);
+ }
+
+ public final InventorySlot[] addSlotArray(int[] indexes, String unlocName)
+ {
+ for (int k : indexes) {
+ addSlot(k, unlocName);
+ }
+ return getSlots(indexes);
+ }
+
+ public InventorySlot getSlot(int index)
+ {
+ if (this.inventory.containsKey(Integer.valueOf(index))) {
+ return (InventorySlot)this.inventory.get(Integer.valueOf(index));
+ }
+ return null;
+ }
+
+ public InventorySlot[] getAllSlots()
+ {
+ return (InventorySlot[])this.inventory.values().toArray(new InventorySlot[0]);
+ }
+
+ public InventorySlot[] getSlots(int[] indexes)
+ {
+ List<InventorySlot> list = new ArrayList();
+ for (int i : indexes) {
+ if (getSlot(i) != null) {
+ list.add(getSlot(i));
+ }
+ }
+ return (InventorySlot[])list.toArray(new InventorySlot[0]);
+ }
+
+ public boolean isReadOnly(int slot)
+ {
+ InventorySlot iSlot = getSlot(slot);
+ return iSlot == null ? true : iSlot.isReadOnly();
+ }
+
+ public boolean hasCustomInventoryName()
+ {
+ return true;
+ }
+
+ public boolean isItemValidForSlot(int slot, ItemStack itemStack)
+ {
+ InventorySlot iSlot = getSlot(slot);
+ return iSlot != null;
+ }
+
+ public void onDestruction()
+ {
+ for (InventorySlot slot : this.inventory.values())
+ {
+ ItemStack stack = slot.getContent();
+ if ((!slot.isRecipe()) && (stack != null))
+ {
+ float f = getMachine().getWorld().rand.nextFloat() * 0.8F + 0.1F;
+ float f1 = getMachine().getWorld().rand.nextFloat() * 0.8F + 0.1F;
+ float f2 = getMachine().getWorld().rand.nextFloat() * 0.8F + 0.1F;
+ if (stack.stackSize == 0) {
+ stack.stackSize = 1;
+ }
+ EntityItem entityitem = new EntityItem(getMachine().getWorld(), getMachine().getTileEntity().xCoord + f, getMachine().getTileEntity().yCoord + f1, getMachine().getTileEntity().zCoord + f2, stack.copy());
+
+
+
+
+ float accel = 0.05F;
+ entityitem.motionX = ((float)getMachine().getWorld().rand.nextGaussian() * accel);
+
+ entityitem.motionY = ((float)getMachine().getWorld().rand.nextGaussian() * accel + 0.2F);
+
+ entityitem.motionZ = ((float)getMachine().getWorld().rand.nextGaussian() * accel);
+
+ getMachine().getWorld().spawnEntityInWorld(entityitem);
+ }
+ }
+ }
+
+ public int[] getAccessibleSlotsFromSide(int var1)
+ {
+ List<Integer> slots = new ArrayList();
+ for (InventorySlot slot : this.inventory.values()) {
+ if ((slot.canInsert()) || (slot.canExtract())) {
+ slots.add(Integer.valueOf(slot.getIndex()));
+ }
+ }
+ int[] ids = new int[slots.size()];
+ for (int i = 0; i < slots.size(); i++) {
+ ids[i] = ((Integer)slots.get(i)).intValue();
+ }
+ return ids;
+ }
+
+ public boolean canInsertItem(int i, ItemStack itemstack, int j)
+ {
+ return (isItemValidForSlot(i, itemstack)) && (getSlot(i).canInsert(ForgeDirection.getOrientation(j)));
+ }
+
+ public boolean canExtractItem(int i, ItemStack itemstack, int j)
+ {
+ return getSlot(i).canExtract(ForgeDirection.getOrientation(j));
+ }
+}
diff --git a/src/Java/binnie/core/machines/inventory/ComponentInventoryTransfer.java b/src/Java/binnie/core/machines/inventory/ComponentInventoryTransfer.java
new file mode 100644
index 0000000000..8ee10080e8
--- /dev/null
+++ b/src/Java/binnie/core/machines/inventory/ComponentInventoryTransfer.java
@@ -0,0 +1,161 @@
+package binnie.core.machines.inventory;
+
+import binnie.core.machines.IMachine;
+import binnie.core.machines.MachineComponent;
+import binnie.core.machines.transfer.TransferRequest;
+import java.util.ArrayList;
+import java.util.List;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.item.ItemStack;
+
+public class ComponentInventoryTransfer
+ extends MachineComponent
+{
+ public ComponentInventoryTransfer(IMachine machine)
+ {
+ super(machine);
+ }
+
+ public abstract class Transfer
+ {
+ protected ComponentInventoryTransfer.Condition condition;
+ protected IMachine machine;
+
+ private Transfer(IMachine machine)
+ {
+ this.machine = machine;
+ }
+
+ public final void transfer(IInventory inv)
+ {
+ if ((this.condition == null) || (fufilled(inv))) {
+ doTransfer(inv);
+ }
+ }
+
+ protected boolean fufilled(IInventory inv)
+ {
+ return true;
+ }
+
+ protected void doTransfer(IInventory inv) {}
+
+ public final Transfer setCondition(ComponentInventoryTransfer.Condition condition)
+ {
+ this.condition = condition;
+ condition.transfer = this;
+ return this;
+ }
+
+ public final IMachine getMachine()
+ {
+ return this.machine;
+ }
+ }
+
+ private class Restock
+ extends ComponentInventoryTransfer.Transfer
+ {
+ int[] buffer;
+ int destination;
+ int limit;
+
+ private Restock(IMachine machine, int[] buffer, int destination, int limit)
+ {
+ super(machine, null);
+ this.buffer = buffer;
+ this.destination = destination;
+ this.limit = limit;
+ }
+
+ private Restock(IMachine machine, int[] buffer, int destination)
+ {
+ this(machine, buffer, destination, 64);
+ }
+
+ protected void doTransfer(IInventory inv)
+ {
+ if (inv.getStackInSlot(this.destination) == null) {
+ for (int i : this.buffer) {
+ if (inv.getStackInSlot(i) != null)
+ {
+ ItemStack newStack = inv.decrStackSize(i, this.limit);
+ if (newStack != null)
+ {
+ inv.setInventorySlotContents(this.destination, newStack);
+ return;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ private class Storage
+ extends ComponentInventoryTransfer.Transfer
+ {
+ int source;
+ int[] destination;
+
+ private Storage(IMachine machine, int source, int[] destination)
+ {
+ super(machine, null);
+ this.source = source;
+ this.destination = destination;
+ }
+
+ protected void doTransfer(IInventory inv)
+ {
+ if (inv.getStackInSlot(this.source) != null) {
+ inv.setInventorySlotContents(this.source, new TransferRequest(inv.getStackInSlot(this.source), inv).setTargetSlots(this.destination).ignoreValidation().transfer(true));
+ }
+ }
+
+ protected boolean fufilled(IInventory inv)
+ {
+ ItemStack stack = inv.getStackInSlot(this.source);
+ return (stack != null) && (this.condition.fufilled(stack));
+ }
+ }
+
+ private List<Transfer> transfers = new ArrayList();
+
+ public void addRestock(int[] buffer, int destination, int limit)
+ {
+ this.transfers.add(new Restock(getMachine(), buffer, destination, limit, null));
+ }
+
+ public void addRestock(int[] buffer, int destination)
+ {
+ this.transfers.add(new Restock(getMachine(), buffer, destination, null));
+ }
+
+ public void addStorage(int source, int[] destination)
+ {
+ this.transfers.add(new Storage(getMachine(), source, destination, null));
+ }
+
+ public void performTransfer(int source, int[] destination)
+ {
+ new Storage(getMachine(), source, destination, null).transfer((IInventory)getMachine().getInterface(IInventoryMachine.class));
+ }
+
+ public void onUpdate()
+ {
+ for (Transfer transfer : this.transfers) {
+ transfer.transfer((IInventory)getMachine().getInterface(IInventoryMachine.class));
+ }
+ }
+
+ public void addStorage(int source, int[] destination, Condition condition)
+ {
+ this.transfers.add(new Storage(getMachine(), source, destination, null).setCondition(condition));
+ }
+
+ public static abstract class Condition
+ {
+ public ComponentInventoryTransfer.Transfer transfer;
+
+ public abstract boolean fufilled(ItemStack paramItemStack);
+ }
+}
diff --git a/src/Java/binnie/core/machines/inventory/ComponentTankContainer.java b/src/Java/binnie/core/machines/inventory/ComponentTankContainer.java
new file mode 100644
index 0000000000..0dee156475
--- /dev/null
+++ b/src/Java/binnie/core/machines/inventory/ComponentTankContainer.java
@@ -0,0 +1,207 @@
+package binnie.core.machines.inventory;
+
+import binnie.core.machines.IMachine;
+import binnie.core.machines.MachineComponent;
+import binnie.core.machines.power.ITankMachine;
+import binnie.core.machines.power.TankInfo;
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.nbt.NBTTagList;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidStack;
+import net.minecraftforge.fluids.FluidTankInfo;
+import net.minecraftforge.fluids.IFluidTank;
+
+public class ComponentTankContainer
+ extends MachineComponent
+ implements ITankMachine
+{
+ private Map<Integer, TankSlot> tanks = new LinkedHashMap();
+
+ public ComponentTankContainer(IMachine machine)
+ {
+ super(machine);
+ }
+
+ public final TankSlot addTank(int index, String name, int capacity)
+ {
+ TankSlot tank = new TankSlot(index, name, capacity);
+ this.tanks.put(Integer.valueOf(index), tank);
+ return tank;
+ }
+
+ public final int fill(ForgeDirection from, FluidStack resource, boolean doFill)
+ {
+ int index = getTankIndexToFill(from, resource);
+ if (this.tanks.containsKey(Integer.valueOf(index))) {
+ return fill(index, resource, doFill);
+ }
+ return 0;
+ }
+
+ public final FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain)
+ {
+ int index = getTankIndexToDrain(from, null);
+ if (this.tanks.containsKey(Integer.valueOf(index))) {
+ return drain(index, maxDrain, doDrain);
+ }
+ return null;
+ }
+
+ private final int fill(int tankIndex, FluidStack resource, boolean doFill)
+ {
+ if (!this.tanks.containsKey(Integer.valueOf(tankIndex))) {
+ return 0;
+ }
+ if (!isLiquidValidForTank(resource, tankIndex)) {
+ return 0;
+ }
+ TankSlot tank = (TankSlot)this.tanks.get(Integer.valueOf(tankIndex));
+ int filled = tank.getTank().fill(resource, doFill);
+ if (filled > 0) {
+ markDirty();
+ }
+ return filled;
+ }
+
+ private final FluidStack drain(int tankIndex, int maxDrain, boolean doDrain)
+ {
+ if (!this.tanks.containsKey(Integer.valueOf(tankIndex))) {
+ return null;
+ }
+ TankSlot tank = (TankSlot)this.tanks.get(Integer.valueOf(tankIndex));
+ FluidStack drained = tank.getTank().drain(maxDrain, doDrain);
+ if (drained != null) {
+ markDirty();
+ }
+ return drained;
+ }
+
+ private int getTankIndexToFill(ForgeDirection from, FluidStack resource)
+ {
+ for (TankSlot tank : this.tanks.values()) {
+ if ((tank.isValid(resource)) && (tank.canInsert(from)) && ((tank.getContent() == null) || (tank.getContent().isFluidEqual(resource)))) {
+ return tank.getIndex();
+ }
+ }
+ return -1;
+ }
+
+ private int getTankIndexToDrain(ForgeDirection from, FluidStack resource)
+ {
+ for (TankSlot tank : this.tanks.values()) {
+ if ((tank.getContent() != null) &&
+ (tank.canExtract(from)) && ((resource == null) || (resource.isFluidEqual(tank.getContent())))) {
+ return tank.getIndex();
+ }
+ }
+ return -1;
+ }
+
+ public void readFromNBT(NBTTagCompound nbttagcompound)
+ {
+ super.readFromNBT(nbttagcompound);
+ if (nbttagcompound.hasKey("liquidTanks"))
+ {
+ NBTTagList tanksNBT = nbttagcompound.getTagList("liquidTanks", 10);
+ for (int i = 0; i < tanksNBT.tagCount(); i++)
+ {
+ NBTTagCompound tankNBT = tanksNBT.getCompoundTagAt(i);
+ int index = tankNBT.getInteger("index");
+ if (this.tanks.containsKey(Integer.valueOf(index))) {
+ ((TankSlot)this.tanks.get(Integer.valueOf(index))).readFromNBT(tankNBT);
+ }
+ }
+ }
+ }
+
+ public void writeToNBT(NBTTagCompound nbttagcompound)
+ {
+ super.writeToNBT(nbttagcompound);
+
+ NBTTagList tanksNBT = new NBTTagList();
+ for (Map.Entry<Integer, TankSlot> entry : this.tanks.entrySet())
+ {
+ NBTTagCompound tankNBT = new NBTTagCompound();
+ tankNBT.setInteger("index", ((Integer)entry.getKey()).intValue());
+ ((TankSlot)entry.getValue()).writeToNBT(tankNBT);
+ tanksNBT.appendTag(tankNBT);
+ }
+ nbttagcompound.setTag("liquidTanks", tanksNBT);
+ }
+
+ public boolean isTankReadOnly(int tank)
+ {
+ return ((TankSlot)this.tanks.get(Integer.valueOf(tank))).isReadOnly();
+ }
+
+ public boolean isLiquidValidForTank(FluidStack liquid, int tank)
+ {
+ TankSlot slot = getTankSlot(tank);
+ return slot != null;
+ }
+
+ public TankInfo[] getTankInfos()
+ {
+ return TankInfo.get(this);
+ }
+
+ public IFluidTank getTank(int index)
+ {
+ return getTanks()[index];
+ }
+
+ public IFluidTank[] getTanks()
+ {
+ List<IFluidTank> ltanks = new ArrayList();
+ for (TankSlot tank : this.tanks.values()) {
+ ltanks.add(tank.getTank());
+ }
+ return (IFluidTank[])ltanks.toArray(new IFluidTank[0]);
+ }
+
+ public TankSlot getTankSlot(int index)
+ {
+ return (TankSlot)this.tanks.get(Integer.valueOf(index));
+ }
+
+ public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain)
+ {
+ int index = getTankIndexToDrain(from, null);
+ if (this.tanks.containsKey(Integer.valueOf(index))) {
+ return drain(index, resource.amount, doDrain);
+ }
+ return null;
+ }
+
+ public boolean canFill(ForgeDirection from, Fluid fluid)
+ {
+ return fill(from, new FluidStack(fluid, 1), false) > 0;
+ }
+
+ public boolean canDrain(ForgeDirection from, Fluid fluid)
+ {
+ return drain(from, new FluidStack(fluid, 1), false) != null;
+ }
+
+ public FluidTankInfo[] getTankInfo(ForgeDirection from)
+ {
+ FluidTankInfo[] info = new FluidTankInfo[getTanks().length];
+ for (int i = 0; i < info.length; i++) {
+ info[i] = new FluidTankInfo(getTanks()[i]);
+ }
+ return info;
+ }
+
+ public void markDirty()
+ {
+ if (getMachine() != null) {
+ getMachine().markDirty();
+ }
+ }
+}
diff --git a/src/Java/binnie/core/machines/inventory/IChargedSlots.java b/src/Java/binnie/core/machines/inventory/IChargedSlots.java
new file mode 100644
index 0000000000..e3fcae1f51
--- /dev/null
+++ b/src/Java/binnie/core/machines/inventory/IChargedSlots.java
@@ -0,0 +1,10 @@
+package binnie.core.machines.inventory;
+
+public abstract interface IChargedSlots
+{
+ public abstract float getCharge(int paramInt);
+
+ public abstract void setCharge(int paramInt, float paramFloat);
+
+ public abstract void alterCharge(int paramInt, float paramFloat);
+}
diff --git a/src/Java/binnie/core/machines/inventory/IInventoryMachine.java b/src/Java/binnie/core/machines/inventory/IInventoryMachine.java
new file mode 100644
index 0000000000..5c0c0a997f
--- /dev/null
+++ b/src/Java/binnie/core/machines/inventory/IInventoryMachine.java
@@ -0,0 +1,8 @@
+package binnie.core.machines.inventory;
+
+import net.minecraft.inventory.IInventory;
+import net.minecraft.inventory.ISidedInventory;
+
+public abstract interface IInventoryMachine
+ extends IInventory, ISidedInventory, IValidatedInventory
+{}
diff --git a/src/Java/binnie/core/machines/inventory/IInventorySlots.java b/src/Java/binnie/core/machines/inventory/IInventorySlots.java
new file mode 100644
index 0000000000..c860f00a63
--- /dev/null
+++ b/src/Java/binnie/core/machines/inventory/IInventorySlots.java
@@ -0,0 +1,14 @@
+package binnie.core.machines.inventory;
+
+public abstract interface IInventorySlots
+{
+ public abstract InventorySlot addSlot(int paramInt, String paramString);
+
+ public abstract InventorySlot[] addSlotArray(int[] paramArrayOfInt, String paramString);
+
+ public abstract InventorySlot getSlot(int paramInt);
+
+ public abstract InventorySlot[] getSlots(int[] paramArrayOfInt);
+
+ public abstract InventorySlot[] getAllSlots();
+}
diff --git a/src/Java/binnie/core/machines/inventory/IValidatedInventory.java b/src/Java/binnie/core/machines/inventory/IValidatedInventory.java
new file mode 100644
index 0000000000..56543612c8
--- /dev/null
+++ b/src/Java/binnie/core/machines/inventory/IValidatedInventory.java
@@ -0,0 +1,9 @@
+package binnie.core.machines.inventory;
+
+import net.minecraft.inventory.IInventory;
+
+abstract interface IValidatedInventory
+ extends IInventory
+{
+ public abstract boolean isReadOnly(int paramInt);
+}
diff --git a/src/Java/binnie/core/machines/inventory/IValidatedTankContainer.java b/src/Java/binnie/core/machines/inventory/IValidatedTankContainer.java
new file mode 100644
index 0000000000..6ca868ce02
--- /dev/null
+++ b/src/Java/binnie/core/machines/inventory/IValidatedTankContainer.java
@@ -0,0 +1,10 @@
+package binnie.core.machines.inventory;
+
+import net.minecraftforge.fluids.FluidStack;
+
+public abstract interface IValidatedTankContainer
+{
+ public abstract boolean isTankReadOnly(int paramInt);
+
+ public abstract boolean isLiquidValidForTank(FluidStack paramFluidStack, int paramInt);
+}
diff --git a/src/Java/binnie/core/machines/inventory/InventorySlot.java b/src/Java/binnie/core/machines/inventory/InventorySlot.java
new file mode 100644
index 0000000000..bfa904176a
--- /dev/null
+++ b/src/Java/binnie/core/machines/inventory/InventorySlot.java
@@ -0,0 +1,115 @@
+package binnie.core.machines.inventory;
+
+import binnie.Binnie;
+import binnie.core.BinnieCore;
+import binnie.core.language.ManagerLanguage;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+
+public class InventorySlot
+ extends BaseSlot<ItemStack>
+{
+ public static enum Type
+ {
+ Standard, Recipe;
+
+ private Type() {}
+ }
+
+ private ItemStack itemStack = null;
+ private Type type = Type.Standard;
+
+ public InventorySlot(int index, String unlocName)
+ {
+ super(index, unlocName);
+ }
+
+ public ItemStack getContent()
+ {
+ return this.itemStack;
+ }
+
+ public ItemStack getItemStack()
+ {
+ return getContent();
+ }
+
+ public void setContent(ItemStack itemStack)
+ {
+ this.itemStack = itemStack;
+ }
+
+ public ItemStack decrStackSize(int amount)
+ {
+ if (this.itemStack == null) {
+ return null;
+ }
+ if (this.itemStack.stackSize <= amount)
+ {
+ ItemStack returnStack = this.itemStack.copy();
+ this.itemStack = null;
+ return returnStack;
+ }
+ ItemStack returnStack = this.itemStack.copy();
+ this.itemStack.stackSize -= amount;
+ returnStack.stackSize = amount;
+ return returnStack;
+ }
+
+ public void readFromNBT(NBTTagCompound slotNBT)
+ {
+ if (slotNBT.hasKey("item"))
+ {
+ NBTTagCompound itemNBT = slotNBT.getCompoundTag("item");
+ this.itemStack = ItemStack.loadItemStackFromNBT(itemNBT);
+ }
+ else
+ {
+ this.itemStack = null;
+ }
+ }
+
+ public void writeToNBT(NBTTagCompound slotNBT)
+ {
+ NBTTagCompound itemNBT = new NBTTagCompound();
+ if (this.itemStack != null) {
+ this.itemStack.writeToNBT(itemNBT);
+ }
+ slotNBT.setTag("item", itemNBT);
+ }
+
+ public void setItemStack(ItemStack duplicate)
+ {
+ setContent(duplicate);
+ }
+
+ public SlotValidator getValidator()
+ {
+ return (SlotValidator)this.validator;
+ }
+
+ public void setType(Type type)
+ {
+ this.type = type;
+ if (type == Type.Recipe)
+ {
+ setReadOnly();
+ forbidInteraction();
+ }
+ }
+
+ public Type getType()
+ {
+ return this.type;
+ }
+
+ public boolean isRecipe()
+ {
+ return this.type == Type.Recipe;
+ }
+
+ public String getName()
+ {
+ return Binnie.Language.localise(BinnieCore.instance, "gui.slot." + this.unlocName);
+ }
+}
diff --git a/src/Java/binnie/core/machines/inventory/MachineSide.java b/src/Java/binnie/core/machines/inventory/MachineSide.java
new file mode 100644
index 0000000000..cba1c7417b
--- /dev/null
+++ b/src/Java/binnie/core/machines/inventory/MachineSide.java
@@ -0,0 +1,79 @@
+package binnie.core.machines.inventory;
+
+import java.util.Collection;
+import java.util.EnumSet;
+import net.minecraftforge.common.util.ForgeDirection;
+
+public class MachineSide
+{
+ private static EnumSet<ForgeDirection> All = EnumSet.of(ForgeDirection.UP, new ForgeDirection[] { ForgeDirection.DOWN, ForgeDirection.NORTH, ForgeDirection.SOUTH, ForgeDirection.EAST, ForgeDirection.WEST });
+ public static EnumSet<ForgeDirection> TopAndBottom = EnumSet.of(ForgeDirection.UP, ForgeDirection.DOWN);
+ public static EnumSet<ForgeDirection> None = EnumSet.noneOf(ForgeDirection.class);
+ public static EnumSet<ForgeDirection> Top = EnumSet.of(ForgeDirection.UP);
+ public static EnumSet<ForgeDirection> Bottom = EnumSet.of(ForgeDirection.DOWN);
+ public static EnumSet<ForgeDirection> Sides = EnumSet.of(ForgeDirection.NORTH, ForgeDirection.SOUTH, ForgeDirection.EAST, ForgeDirection.WEST);
+
+ public static String asString(Collection<ForgeDirection> sides)
+ {
+ if (sides.containsAll(All)) {
+ return "Any";
+ }
+ if (sides.isEmpty()) {
+ return "None";
+ }
+ String text = "";
+ if (sides.contains(ForgeDirection.UP))
+ {
+ if (sides.size() > 0) {
+ text = text + ", ";
+ }
+ text = text + "Up";
+ }
+ if (sides.contains(ForgeDirection.DOWN))
+ {
+ if (sides.size() > 0) {
+ text = text + ", ";
+ }
+ text = text + "Down";
+ }
+ if (sides.containsAll(Sides))
+ {
+ if (sides.size() > 0) {
+ text = text + ", ";
+ }
+ text = text + "Sides";
+ }
+ else
+ {
+ if (sides.contains(ForgeDirection.NORTH))
+ {
+ if (sides.size() > 0) {
+ text = text + ", ";
+ }
+ text = text + "North";
+ }
+ if (sides.contains(ForgeDirection.EAST))
+ {
+ if (sides.size() > 0) {
+ text = text + ", ";
+ }
+ text = text + "East";
+ }
+ if (sides.contains(ForgeDirection.SOUTH))
+ {
+ if (sides.size() > 0) {
+ text = text + ", ";
+ }
+ text = text + "South";
+ }
+ if (sides.contains(ForgeDirection.WEST))
+ {
+ if (sides.size() > 0) {
+ text = text + ", ";
+ }
+ text = text + "West";
+ }
+ }
+ return text;
+ }
+}
diff --git a/src/Java/binnie/core/machines/inventory/SetList.java b/src/Java/binnie/core/machines/inventory/SetList.java
new file mode 100644
index 0000000000..41c455a2fc
--- /dev/null
+++ b/src/Java/binnie/core/machines/inventory/SetList.java
@@ -0,0 +1,36 @@
+package binnie.core.machines.inventory;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Set;
+
+public class SetList<E>
+ extends ArrayList<E>
+ implements Set<E>
+{
+ private static final long serialVersionUID = 1277112003159980135L;
+
+ public boolean add(E e)
+ {
+ return contains(e) ? false : super.add(e);
+ }
+
+ public void add(int index, E e)
+ {
+ if (!contains(e)) {
+ super.add(index, e);
+ }
+ }
+
+ public boolean addAll(Collection<? extends E> c)
+ {
+ return addAll(size(), c);
+ }
+
+ public boolean addAll(int index, Collection<? extends E> c)
+ {
+ Collection<E> copy = new ArrayList(c);
+ copy.removeAll(this);
+ return super.addAll(index, copy);
+ }
+}
diff --git a/src/Java/binnie/core/machines/inventory/SidedAccess.java b/src/Java/binnie/core/machines/inventory/SidedAccess.java
new file mode 100644
index 0000000000..ee505891e2
--- /dev/null
+++ b/src/Java/binnie/core/machines/inventory/SidedAccess.java
@@ -0,0 +1,106 @@
+package binnie.core.machines.inventory;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import net.minecraftforge.common.util.ForgeDirection;
+
+class SidedAccess
+{
+ private Map<ForgeDirection, AccessDirection> accesses = new HashMap();
+ private AccessDirection base = AccessDirection.Both;
+ private boolean insertLocked = false;
+ private boolean extractLocked = false;
+
+ public AccessDirection getAccess(ForgeDirection side)
+ {
+ return this.accesses.containsKey(side) ? (AccessDirection)this.accesses.get(side) : this.base;
+ }
+
+ public boolean canInsert(ForgeDirection side)
+ {
+ return getAccess(side).canInsert();
+ }
+
+ public boolean canExtract(ForgeDirection side)
+ {
+ return getAccess(side).canExtract();
+ }
+
+ public boolean canAccess(ForgeDirection side)
+ {
+ return getAccess(side).canAccess();
+ }
+
+ public boolean canChangeInsert()
+ {
+ return !this.insertLocked;
+ }
+
+ public boolean canChangeExtract()
+ {
+ return !this.extractLocked;
+ }
+
+ public void forbidInsertChange()
+ {
+ this.insertLocked = true;
+ }
+
+ public void forbidExtractChange()
+ {
+ this.extractLocked = true;
+ }
+
+ public Collection<ForgeDirection> getInsertionSides()
+ {
+ List<ForgeDirection> dirs = new ArrayList();
+ for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
+ if (getAccess(dir).canInsert()) {
+ dirs.add(dir);
+ }
+ }
+ return dirs;
+ }
+
+ public Collection<ForgeDirection> getExtractionSides()
+ {
+ List<ForgeDirection> dirs = new ArrayList();
+ for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
+ if (getAccess(dir).canExtract()) {
+ dirs.add(dir);
+ }
+ }
+ return dirs;
+ }
+
+ public void setInsert(ForgeDirection side, boolean b)
+ {
+ if (getAccess(side).canInsert() != b) {
+ this.accesses.put(side, getAccess(side).changeInsert(b));
+ }
+ }
+
+ public void setExtract(ForgeDirection side, boolean b)
+ {
+ if (getAccess(side).canExtract() != b) {
+ this.accesses.put(side, getAccess(side).changeExtract(b));
+ }
+ }
+
+ public void setInsert(boolean b)
+ {
+ if (this.base.canInsert() != b) {
+ this.base = this.base.changeInsert(b);
+ }
+ }
+
+ public void setExtract(boolean b)
+ {
+ if (this.base.canExtract() != b) {
+ this.base = this.base.changeExtract(b);
+ }
+ }
+}
diff --git a/src/Java/binnie/core/machines/inventory/SlotValidator.java b/src/Java/binnie/core/machines/inventory/SlotValidator.java
new file mode 100644
index 0000000000..952ff99761
--- /dev/null
+++ b/src/Java/binnie/core/machines/inventory/SlotValidator.java
@@ -0,0 +1,68 @@
+package binnie.core.machines.inventory;
+
+import binnie.core.resource.BinnieIcon;
+import forestry.api.genetics.AlleleManager;
+import forestry.api.genetics.IAlleleRegistry;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.IIcon;
+
+public abstract class SlotValidator
+ extends Validator<ItemStack>
+{
+ public static ValidatorIcon IconBee;
+ public static ValidatorIcon IconFrame;
+ public static ValidatorIcon IconCircuit;
+ public static ValidatorIcon IconBlock;
+ private ValidatorIcon icon;
+
+ public SlotValidator(ValidatorIcon icon)
+ {
+ this.icon = icon;
+ }
+
+ public IIcon getIcon(boolean input)
+ {
+ return this.icon == null ? null : this.icon.getIcon(input).getIcon();
+ }
+
+ public static class Item
+ extends SlotValidator
+ {
+ private ItemStack target;
+
+ public Item(ItemStack target, ValidatorIcon icon)
+ {
+ super();
+ this.target = target;
+ }
+
+ public boolean isValid(ItemStack itemStack)
+ {
+ return itemStack.isItemEqual(this.target);
+ }
+
+ public String getTooltip()
+ {
+ return this.target.getDisplayName();
+ }
+ }
+
+ public static class Individual
+ extends SlotValidator
+ {
+ public Individual()
+ {
+ super();
+ }
+
+ public boolean isValid(ItemStack itemStack)
+ {
+ return AlleleManager.alleleRegistry.getIndividual(itemStack) != null;
+ }
+
+ public String getTooltip()
+ {
+ return "Breedable Individual";
+ }
+ }
+}
diff --git a/src/Java/binnie/core/machines/inventory/TankSlot.java b/src/Java/binnie/core/machines/inventory/TankSlot.java
new file mode 100644
index 0000000000..275ebfd646
--- /dev/null
+++ b/src/Java/binnie/core/machines/inventory/TankSlot.java
@@ -0,0 +1,58 @@
+package binnie.core.machines.inventory;
+
+import binnie.Binnie;
+import binnie.core.BinnieCore;
+import binnie.core.language.ManagerLanguage;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraftforge.fluids.FluidStack;
+import net.minecraftforge.fluids.FluidTank;
+import net.minecraftforge.fluids.IFluidTank;
+
+public class TankSlot
+ extends BaseSlot<FluidStack>
+{
+ public static final String NameJuice = "Juice Tank";
+ public static final String NameWater = "Water Tank";
+ public static String NameCupboard = "Cupboard Slot";
+ private FluidTank tank;
+
+ public TankSlot(int index, String name, int capacity)
+ {
+ super(index, name);
+ this.tank = new FluidTank(capacity);
+ }
+
+ public void readFromNBT(NBTTagCompound nbttagcompound)
+ {
+ FluidStack liquid = FluidStack.loadFluidStackFromNBT(nbttagcompound);
+
+ setContent(liquid);
+ }
+
+ public void writeToNBT(NBTTagCompound nbttagcompound)
+ {
+ if (getContent() != null) {
+ getContent().writeToNBT(nbttagcompound);
+ }
+ }
+
+ public FluidStack getContent()
+ {
+ return this.tank.getFluid();
+ }
+
+ public void setContent(FluidStack itemStack)
+ {
+ this.tank.setFluid(itemStack);
+ }
+
+ public IFluidTank getTank()
+ {
+ return this.tank;
+ }
+
+ public String getName()
+ {
+ return Binnie.Language.localise(BinnieCore.instance, "gui.slot." + this.unlocName);
+ }
+}
diff --git a/src/Java/binnie/core/machines/inventory/TankValidator.java b/src/Java/binnie/core/machines/inventory/TankValidator.java
new file mode 100644
index 0000000000..07c8f2f9c9
--- /dev/null
+++ b/src/Java/binnie/core/machines/inventory/TankValidator.java
@@ -0,0 +1,33 @@
+package binnie.core.machines.inventory;
+
+import binnie.Binnie;
+import binnie.core.liquid.ManagerLiquid;
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidStack;
+
+public abstract class TankValidator
+ extends Validator<FluidStack>
+{
+ public abstract boolean isValid(FluidStack paramFluidStack);
+
+ public static class Basic
+ extends TankValidator
+ {
+ private Fluid fluid;
+
+ public Basic(String name)
+ {
+ this.fluid = Binnie.Liquid.getLiquidStack(name, 1).getFluid();
+ }
+
+ public boolean isValid(FluidStack stack)
+ {
+ return new FluidStack(this.fluid, 1).isFluidEqual(stack);
+ }
+
+ public String getTooltip()
+ {
+ return new FluidStack(this.fluid, 1).getLocalizedName();
+ }
+ }
+}
diff --git a/src/Java/binnie/core/machines/inventory/TransferHandler.java b/src/Java/binnie/core/machines/inventory/TransferHandler.java
new file mode 100644
index 0000000000..1fa4b2cac5
--- /dev/null
+++ b/src/Java/binnie/core/machines/inventory/TransferHandler.java
@@ -0,0 +1,227 @@
+package binnie.core.machines.inventory;
+
+import binnie.core.machines.Machine;
+import binnie.core.machines.power.ITankMachine;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.fluids.FluidContainerRegistry;
+import net.minecraftforge.fluids.FluidContainerRegistry.FluidContainerData;
+import net.minecraftforge.fluids.FluidStack;
+import net.minecraftforge.fluids.IFluidTank;
+
+public class TransferHandler
+{
+ public static ItemStack transfer(ItemStack item, IInventory origin, IInventory destination, boolean doAdd)
+ {
+ ItemStack ret = transferItemToInventory(item, destination, doAdd);
+ if ((destination instanceof ITankMachine))
+ {
+ ret = transferContainerIntoTank(ret, origin, (ITankMachine)destination, doAdd);
+ ret = transferTankIntoContainer(ret, origin, (ITankMachine)destination, doAdd);
+ }
+ return ret;
+ }
+
+ public static ItemStack transferItemToInventory(ItemStack item, IInventory destination, boolean doAdd)
+ {
+ if ((item == null) || (destination == null)) {
+ return item;
+ }
+ ItemStack addition = item.copy();
+ for (int i = 0; i < destination.getSizeInventory(); i++)
+ {
+ addition = transferToInventory(addition, destination, new int[] { i }, doAdd, false);
+ if (addition == null) {
+ return null;
+ }
+ }
+ return addition;
+ }
+
+ public static ItemStack transferToInventory(ItemStack item, IInventory destination, int[] targetSlots, boolean doAdd, boolean ignoreValidation)
+ {
+ for (int i : targetSlots) {
+ if ((destination.isItemValidForSlot(i, item)) || (ignoreValidation))
+ {
+ if (destination.getStackInSlot(i) == null)
+ {
+ if (doAdd) {
+ destination.setInventorySlotContents(i, item.copy());
+ }
+ return null;
+ }
+ if (item.isStackable())
+ {
+ ItemStack merged = destination.getStackInSlot(i).copy();
+ ItemStack[] newStacks = mergeStacks(item.copy(), merged.copy());
+ item = newStacks[0];
+ if (doAdd) {
+ destination.setInventorySlotContents(i, newStacks[1]);
+ }
+ if (item == null) {
+ return null;
+ }
+ }
+ }
+ }
+ return item;
+ }
+
+ public static ItemStack[] mergeStacks(ItemStack itemstack, ItemStack merged)
+ {
+ if ((ItemStack.areItemStackTagsEqual(itemstack, merged)) && (itemstack.isItemEqual(merged)))
+ {
+ int space = merged.getMaxStackSize() - merged.stackSize;
+ if (space > 0) {
+ if (itemstack.stackSize > space)
+ {
+ itemstack.stackSize -= space;
+ merged.stackSize += space;
+ }
+ else if (itemstack.stackSize <= space)
+ {
+ merged.stackSize += itemstack.stackSize;
+ itemstack = null;
+ }
+ }
+ }
+ return new ItemStack[] { itemstack, merged };
+ }
+
+ public static ItemStack transferContainerIntoTank(ItemStack item, IInventory origin, ITankMachine destination, boolean doAdd)
+ {
+ if (item == null) {
+ return null;
+ }
+ IFluidTank[] tanks = destination.getTanks();
+ ItemStack stack = item.copy();
+ for (int i = 0; i < tanks.length; i++) {
+ stack = transferToTank(stack, origin, destination, i, doAdd);
+ }
+ return stack;
+ }
+
+ public static ItemStack transferTankIntoContainer(ItemStack item, IInventory origin, ITankMachine destination, boolean doAdd)
+ {
+ if (item == null) {
+ return null;
+ }
+ IFluidTank[] tanks = destination.getTanks();
+ ItemStack stack = item.copy();
+ for (int i = 0; i < tanks.length; i++) {
+ stack = transferFromTank(stack, origin, destination, i, doAdd);
+ }
+ return stack;
+ }
+
+ public static ItemStack transferToTank(ItemStack item, IInventory origin, ITankMachine destination, int tankID, boolean doAdd)
+ {
+ if (item == null) {
+ return item;
+ }
+ FluidStack containerLiquid = null;
+ FluidContainerRegistry.FluidContainerData containerLiquidData = null;
+ for (FluidContainerRegistry.FluidContainerData data : FluidContainerRegistry.getRegisteredFluidContainerData()) {
+ if (data.filledContainer.isItemEqual(item))
+ {
+ containerLiquidData = data;
+ containerLiquid = data.fluid.copy();
+ break;
+ }
+ }
+ if (containerLiquid == null) {
+ return item;
+ }
+ IFluidTank tank = destination.getTanks()[tankID];
+
+ IValidatedTankContainer validated = (IValidatedTankContainer)Machine.getInterface(IValidatedTankContainer.class, destination);
+ if ((validated != null) &&
+ (!validated.isLiquidValidForTank(containerLiquid, tankID))) {
+ return item;
+ }
+ FluidStack largeAmountOfLiquid = containerLiquid.copy();
+ largeAmountOfLiquid.amount = tank.getCapacity();
+ int amountAdded = tank.fill(largeAmountOfLiquid, false);
+
+ int numberOfContainersToAdd = amountAdded / containerLiquid.amount;
+ if (numberOfContainersToAdd > item.stackSize) {
+ numberOfContainersToAdd = item.stackSize;
+ }
+ ItemStack leftOverContainers = item.copy();
+ leftOverContainers.stackSize -= numberOfContainersToAdd;
+ if (leftOverContainers.stackSize <= 0) {
+ leftOverContainers = null;
+ }
+ ItemStack emptyContainers = containerLiquidData.emptyContainer.copy();
+ emptyContainers.stackSize = 0;
+ emptyContainers.stackSize += numberOfContainersToAdd;
+ if (emptyContainers.stackSize <= 0) {
+ emptyContainers = null;
+ }
+ ItemStack containersThatCantBeDumped = transferItemToInventory(emptyContainers, origin, false);
+ if (containersThatCantBeDumped != null) {
+ return item;
+ }
+ if (doAdd)
+ {
+ FluidStack liquidToFillTank = containerLiquid.copy();
+ liquidToFillTank.amount *= numberOfContainersToAdd;
+ tank.fill(liquidToFillTank, true);
+ transferItemToInventory(emptyContainers, origin, true);
+ }
+ return leftOverContainers;
+ }
+
+ public static ItemStack transferFromTank(ItemStack item, IInventory origin, ITankMachine destination, int tankID, boolean doAdd)
+ {
+ if (item == null) {
+ return item;
+ }
+ IFluidTank tank = destination.getTanks()[tankID];
+ FluidStack liquidInTank = tank.getFluid();
+ if (liquidInTank == null) {
+ return item;
+ }
+ FluidContainerRegistry.FluidContainerData containerLiquidData = null;
+ for (FluidContainerRegistry.FluidContainerData data : FluidContainerRegistry.getRegisteredFluidContainerData()) {
+ if ((data.emptyContainer.isItemEqual(item)) && (liquidInTank.isFluidEqual(data.fluid)))
+ {
+ containerLiquidData = data;
+ break;
+ }
+ }
+ if (containerLiquidData == null) {
+ return item;
+ }
+ int maximumExtractedLiquid = item.stackSize * containerLiquidData.fluid.amount;
+
+ FluidStack drainedLiquid = tank.drain(maximumExtractedLiquid, false);
+ int amountInTank = drainedLiquid == null ? 0 : drainedLiquid.amount;
+
+ int numberOfContainersToFill = amountInTank / containerLiquidData.fluid.amount;
+ if (numberOfContainersToFill > item.stackSize) {
+ numberOfContainersToFill = item.stackSize;
+ }
+ ItemStack leftOverContainers = item.copy();
+ leftOverContainers.stackSize -= numberOfContainersToFill;
+ if (leftOverContainers.stackSize <= 0) {
+ leftOverContainers = null;
+ }
+ ItemStack filledContainers = containerLiquidData.filledContainer.copy();
+ filledContainers.stackSize = 0;
+ filledContainers.stackSize += numberOfContainersToFill;
+ if (filledContainers.stackSize <= 0) {
+ filledContainers = null;
+ }
+ ItemStack containersThatCantBeDumped = transferItemToInventory(filledContainers, origin, false);
+ if (containersThatCantBeDumped != null) {
+ return item;
+ }
+ if (doAdd)
+ {
+ tank.drain(maximumExtractedLiquid, true);
+ transferItemToInventory(filledContainers, origin, true);
+ }
+ return leftOverContainers;
+ }
+}
diff --git a/src/Java/binnie/core/machines/inventory/Validator.java b/src/Java/binnie/core/machines/inventory/Validator.java
new file mode 100644
index 0000000000..f8dddf7fae
--- /dev/null
+++ b/src/Java/binnie/core/machines/inventory/Validator.java
@@ -0,0 +1,9 @@
+package binnie.core.machines.inventory;
+
+import binnie.core.util.IValidator;
+
+public abstract class Validator<T>
+ implements IValidator<T>
+{
+ public abstract String getTooltip();
+}
diff --git a/src/Java/binnie/core/machines/inventory/ValidatorIcon.java b/src/Java/binnie/core/machines/inventory/ValidatorIcon.java
new file mode 100644
index 0000000000..ff7f1ecb1e
--- /dev/null
+++ b/src/Java/binnie/core/machines/inventory/ValidatorIcon.java
@@ -0,0 +1,25 @@
+package binnie.core.machines.inventory;
+
+import binnie.Binnie;
+import binnie.core.AbstractMod;
+import binnie.core.resource.BinnieIcon;
+import binnie.core.resource.ManagerResource;
+import java.util.ArrayList;
+import java.util.List;
+
+public class ValidatorIcon
+{
+ private List<BinnieIcon> iconsInput = new ArrayList();
+ private List<BinnieIcon> iconsOutput = new ArrayList();
+
+ public ValidatorIcon(AbstractMod mod, String pathInput, String pathOutput)
+ {
+ this.iconsInput.add(Binnie.Resource.getItemIcon(mod, pathInput));
+ this.iconsOutput.add(Binnie.Resource.getItemIcon(mod, pathOutput));
+ }
+
+ public BinnieIcon getIcon(boolean input)
+ {
+ return input ? (BinnieIcon)this.iconsInput.get(0) : (BinnieIcon)this.iconsOutput.get(0);
+ }
+}
diff --git a/src/Java/binnie/core/machines/network/INetwork.java b/src/Java/binnie/core/machines/network/INetwork.java
new file mode 100644
index 0000000000..90b5621bed
--- /dev/null
+++ b/src/Java/binnie/core/machines/network/INetwork.java
@@ -0,0 +1,30 @@
+package binnie.core.machines.network;
+
+import cpw.mods.fml.relauncher.Side;
+import java.util.Map;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.nbt.NBTTagCompound;
+
+public abstract interface INetwork
+{
+ public static abstract interface SendGuiNBT
+ {
+ public abstract void sendGuiNBT(Map<String, NBTTagCompound> paramMap);
+ }
+
+ public static abstract interface TilePacketSync
+ {
+ public abstract void syncToNBT(NBTTagCompound paramNBTTagCompound);
+
+ public abstract void syncFromNBT(NBTTagCompound paramNBTTagCompound);
+ }
+
+ public static abstract interface RecieveGuiNBT
+ {
+ public abstract void recieveGuiNBT(Side paramSide, EntityPlayer paramEntityPlayer, String paramString, NBTTagCompound paramNBTTagCompound);
+ }
+
+ public static abstract interface GuiNBT
+ extends INetwork.RecieveGuiNBT, INetwork.SendGuiNBT
+ {}
+}
diff --git a/src/Java/binnie/core/machines/power/ComponentPowerReceptor.java b/src/Java/binnie/core/machines/power/ComponentPowerReceptor.java
new file mode 100644
index 0000000000..217af86c43
--- /dev/null
+++ b/src/Java/binnie/core/machines/power/ComponentPowerReceptor.java
@@ -0,0 +1,191 @@
+package binnie.core.machines.power;
+
+import binnie.core.Mods;
+import binnie.core.Mods.Mod;
+import binnie.core.machines.IMachine;
+import binnie.core.machines.MachineComponent;
+import binnie.core.machines.component.IBuildcraft.TriggerProvider;
+import binnie.core.machines.component.IInteraction.ChunkUnload;
+import binnie.core.machines.component.IInteraction.Invalidation;
+import binnie.core.triggers.TriggerData;
+import binnie.core.triggers.TriggerPower;
+import cpw.mods.fml.common.Optional.Interface;
+import cpw.mods.fml.common.Optional.Method;
+import cpw.mods.fml.common.eventhandler.EventBus;
+import ic2.api.energy.event.EnergyTileLoadEvent;
+import ic2.api.energy.event.EnergyTileUnloadEvent;
+import ic2.api.energy.tile.IEnergyTile;
+import java.util.LinkedList;
+import java.util.List;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraftforge.common.MinecraftForge;
+import net.minecraftforge.common.util.ForgeDirection;
+
+@Optional.Interface(iface="binnie.core.machines.component.IBuildcraft.TriggerProvider", modid="BuildCraft|Silicon")
+public class ComponentPowerReceptor
+ extends MachineComponent
+ implements IPoweredMachine, IBuildcraft.TriggerProvider, IInteraction.ChunkUnload, IInteraction.Invalidation
+{
+ private boolean registeredToIC2EnergyNet = false;
+ float previousPower = 0.0F;
+ LinkedList<Float> inputs = new LinkedList();
+ static final int inputAverageTicks = 20;
+ private PowerInterface container;
+
+ public ComponentPowerReceptor(IMachine machine)
+ {
+ this(machine, 1000);
+ }
+
+ public ComponentPowerReceptor(IMachine machine, int storage)
+ {
+ super(machine);
+ this.container = new PowerInterface(storage);
+ if (!this.registeredToIC2EnergyNet) {
+ addToEnergyNet();
+ }
+ }
+
+ public void readFromNBT(NBTTagCompound nbttagcompound)
+ {
+ super.readFromNBT(nbttagcompound);
+ this.container.readFromNBT(nbttagcompound);
+ if (!this.registeredToIC2EnergyNet) {
+ addToEnergyNet();
+ }
+ }
+
+ public void writeToNBT(NBTTagCompound nbttagcompound)
+ {
+ super.writeToNBT(nbttagcompound);
+ this.container.writeToNBT(nbttagcompound);
+ }
+
+ public void onUpdate()
+ {
+ if ((!this.registeredToIC2EnergyNet) && (!getMachine().getTileEntity().isInvalid())) {
+ addToEnergyNet();
+ }
+ }
+
+ public PowerInfo getPowerInfo()
+ {
+ return new PowerInfo(this, 0.0F);
+ }
+
+ @Optional.Method(modid="BuildCraft|Silicon")
+ public final void getTriggers(List<TriggerData> triggers)
+ {
+ triggers.add(TriggerPower.powerNone(this));
+ triggers.add(TriggerPower.powerLow(this));
+ triggers.add(TriggerPower.powerMedium(this));
+ triggers.add(TriggerPower.powerHigh(this));
+ triggers.add(TriggerPower.powerFull(this));
+ }
+
+ @Optional.Method(modid="IC2")
+ public double getDemandedEnergy()
+ {
+ return this.container.getEnergySpace(PowerSystem.EU);
+ }
+
+ @Optional.Method(modid="IC2")
+ public int getSinkTier()
+ {
+ return 1;
+ }
+
+ @Optional.Method(modid="IC2")
+ public double injectEnergy(ForgeDirection directionFrom, double amount, double voltage)
+ {
+ this.container.addEnergy(PowerSystem.EU, amount, true);
+ return 0.0D;
+ }
+
+ @Optional.Method(modid="IC2")
+ public boolean acceptsEnergyFrom(TileEntity emitter, ForgeDirection direction)
+ {
+ return acceptsPowerSystem(PowerSystem.EU);
+ }
+
+ public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate)
+ {
+ return (int)this.container.addEnergy(PowerSystem.RF, maxReceive, !simulate);
+ }
+
+ public int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate)
+ {
+ return 0;
+ }
+
+ public int getEnergyStored(ForgeDirection from)
+ {
+ return (int)this.container.getEnergy(PowerSystem.RF);
+ }
+
+ public int getMaxEnergyStored(ForgeDirection from)
+ {
+ return (int)this.container.getCapacity(PowerSystem.RF);
+ }
+
+ public boolean canConnectEnergy(ForgeDirection from)
+ {
+ boolean can = acceptsPowerSystem(PowerSystem.RF);
+ return can;
+ }
+
+ public PowerInterface getInterface()
+ {
+ return this.container;
+ }
+
+ private boolean acceptsPowerSystem(PowerSystem system)
+ {
+ return true;
+ }
+
+ public void onInvalidation()
+ {
+ removeFromEnergyNet();
+ }
+
+ public void onChunkUnload()
+ {
+ removeFromEnergyNet();
+ }
+
+ private void addToEnergyNet()
+ {
+ if (getMachine().getWorld() == null) {
+ return;
+ }
+ if (Mods.IC2.active()) {
+ do_addToEnergyNet();
+ }
+ }
+
+ private void removeFromEnergyNet()
+ {
+ if (getMachine().getWorld() == null) {
+ return;
+ }
+ if (Mods.IC2.active()) {
+ do_removeFromEnergyNet();
+ }
+ }
+
+ @Optional.Method(modid="IC2")
+ private void do_addToEnergyNet()
+ {
+ MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent((IEnergyTile)getMachine().getTileEntity()));
+ this.registeredToIC2EnergyNet = true;
+ }
+
+ @Optional.Method(modid="IC2")
+ private void do_removeFromEnergyNet()
+ {
+ MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent((IEnergyTile)getMachine().getTileEntity()));
+ this.registeredToIC2EnergyNet = false;
+ }
+}
diff --git a/src/Java/binnie/core/machines/power/ComponentProcess.java b/src/Java/binnie/core/machines/power/ComponentProcess.java
new file mode 100644
index 0000000000..b49e919e2d
--- /dev/null
+++ b/src/Java/binnie/core/machines/power/ComponentProcess.java
@@ -0,0 +1,90 @@
+package binnie.core.machines.power;
+
+import binnie.core.machines.IMachine;
+import net.minecraft.nbt.NBTTagCompound;
+
+public abstract class ComponentProcess
+ extends ComponentProcessIndefinate
+ implements IProcessTimed
+{
+ private float progressAmount = 0.0F;
+
+ public ComponentProcess(IMachine machine)
+ {
+ super(machine, 0.0F);
+ }
+
+ public float getEnergyPerTick()
+ {
+ return getProcessEnergy() / getProcessLength();
+ }
+
+ public float getProgressPerTick()
+ {
+ return 100.0F / getProcessLength();
+ }
+
+ protected void onStartTask()
+ {
+ this.progressAmount += 0.01F;
+ }
+
+ protected void onCancelTask()
+ {
+ this.progressAmount = 0.0F;
+ }
+
+ public void onUpdate()
+ {
+ super.onUpdate();
+ if (this.progressAmount >= 100.0F)
+ {
+ onFinishTask();
+ this.progressAmount = 0.0F;
+ }
+ }
+
+ public void alterProgress(float f)
+ {
+ this.progressAmount += f;
+ }
+
+ public void setProgress(float f)
+ {
+ this.progressAmount = f;
+ }
+
+ protected void progressTick()
+ {
+ super.progressTick();
+ alterProgress(getProgressPerTick());
+ }
+
+ public boolean inProgress()
+ {
+ return this.progressAmount > 0.0F;
+ }
+
+ public float getProgress()
+ {
+ return this.progressAmount;
+ }
+
+ protected void onFinishTask() {}
+
+ public void readFromNBT(NBTTagCompound nbt)
+ {
+ super.readFromNBT(nbt);
+ this.progressAmount = nbt.getFloat("progress");
+ }
+
+ public void writeToNBT(NBTTagCompound nbt)
+ {
+ super.writeToNBT(nbt);
+ nbt.setFloat("progress", this.progressAmount);
+ }
+
+ public abstract int getProcessLength();
+
+ public abstract int getProcessEnergy();
+}
diff --git a/src/Java/binnie/core/machines/power/ComponentProcessIndefinate.java b/src/Java/binnie/core/machines/power/ComponentProcessIndefinate.java
new file mode 100644
index 0000000000..f1442107f4
--- /dev/null
+++ b/src/Java/binnie/core/machines/power/ComponentProcessIndefinate.java
@@ -0,0 +1,120 @@
+package binnie.core.machines.power;
+
+import binnie.core.machines.IMachine;
+import binnie.core.machines.MachineComponent;
+import binnie.core.machines.MachineUtil;
+import binnie.core.machines.network.INetwork.TilePacketSync;
+import net.minecraft.nbt.NBTTagCompound;
+
+public abstract class ComponentProcessIndefinate
+ extends MachineComponent
+ implements IProcess, INetwork.TilePacketSync
+{
+ private float energyPerTick = 0.1F;
+ private boolean inProgress;
+
+ public void syncFromNBT(NBTTagCompound nbt)
+ {
+ this.inProgress = nbt.getBoolean("progress");
+ }
+
+ public void syncToNBT(NBTTagCompound nbt)
+ {
+ nbt.setBoolean("progress", this.inProgress);
+ }
+
+ public ComponentProcessIndefinate(IMachine machine, float energyPerTick)
+ {
+ super(machine);
+ this.energyPerTick = energyPerTick;
+ }
+
+ protected final IPoweredMachine getPower()
+ {
+ return (IPoweredMachine)getMachine().getInterface(IPoweredMachine.class);
+ }
+
+ public float getEnergyPerTick()
+ {
+ return this.energyPerTick;
+ }
+
+ private float actionPauseProcess = 0.0F;
+ private float actionCancelTask = 0.0F;
+
+ public void onUpdate()
+ {
+ float energyAvailable = (float)getPower().getInterface().useEnergy(PowerSystem.RF, getEnergyPerTick(), false);
+ if (canWork() == null)
+ {
+ if ((!isInProgress()) && (canProgress() == null))
+ {
+ onStartTask();
+ }
+ else if (canProgress() == null)
+ {
+ progressTick();
+ onTickTask();
+ }
+ }
+ else if (isInProgress()) {
+ onCancelTask();
+ }
+ if (this.actionPauseProcess > 0.0F) {
+ this.actionPauseProcess -= 1.0F;
+ }
+ if (this.actionCancelTask > 0.0F) {
+ this.actionCancelTask -= 1.0F;
+ }
+ super.onUpdate();
+ if (this.inProgress != inProgress())
+ {
+ this.inProgress = inProgress();
+ getUtil().refreshBlock();
+ }
+ }
+
+ protected void progressTick()
+ {
+ getPower().getInterface().useEnergy(PowerSystem.RF, getEnergyPerTick(), true);
+ }
+
+ public ErrorState canWork()
+ {
+ return this.actionCancelTask == 0.0F ? null : new ErrorState("Task Cancelled", "Cancelled by Buildcraft Gate");
+ }
+
+ public ErrorState canProgress()
+ {
+ if (this.actionPauseProcess != 0.0F) {
+ return new ErrorState("Process Paused", "Paused by Buildcraft Gate");
+ }
+ return getPower().getInterface().getEnergy(PowerSystem.RF) < getEnergyPerTick() ? new ErrorState.InsufficientPower() : null;
+ }
+
+ public final boolean isInProgress()
+ {
+ return this.inProgress;
+ }
+
+ int clientEnergyPerSecond = 0;
+ int clientInProgress;
+
+ protected abstract boolean inProgress();
+
+ protected void onCancelTask() {}
+
+ protected void onStartTask() {}
+
+ protected void onTickTask() {}
+
+ public String getTooltip()
+ {
+ return "Processing";
+ }
+
+ public final ProcessInfo getInfo()
+ {
+ return new ProcessInfo(this);
+ }
+}
diff --git a/src/Java/binnie/core/machines/power/ComponentProcessSetCost.java b/src/Java/binnie/core/machines/power/ComponentProcessSetCost.java
new file mode 100644
index 0000000000..b269763136
--- /dev/null
+++ b/src/Java/binnie/core/machines/power/ComponentProcessSetCost.java
@@ -0,0 +1,27 @@
+package binnie.core.machines.power;
+
+import binnie.core.machines.IMachine;
+
+public class ComponentProcessSetCost
+ extends ComponentProcess
+{
+ private int processLength;
+ private int processEnergy;
+
+ public ComponentProcessSetCost(IMachine machine, int rfCost, int timePeriod)
+ {
+ super(machine);
+ this.processLength = timePeriod;
+ this.processEnergy = rfCost;
+ }
+
+ public int getProcessLength()
+ {
+ return this.processLength;
+ }
+
+ public int getProcessEnergy()
+ {
+ return this.processEnergy;
+ }
+}
diff --git a/src/Java/binnie/core/machines/power/ErrorState.java b/src/Java/binnie/core/machines/power/ErrorState.java
new file mode 100644
index 0000000000..03ed4de1f0
--- /dev/null
+++ b/src/Java/binnie/core/machines/power/ErrorState.java
@@ -0,0 +1,187 @@
+package binnie.core.machines.power;
+
+import forestry.api.core.INBTTagable;
+import net.minecraft.nbt.NBTTagCompound;
+
+public class ErrorState
+ implements INBTTagable
+{
+ private String name = "";
+ private String desc = "";
+ private int[] data = new int[0];
+ private boolean progress = false;
+
+ public ErrorState(String name, String desc)
+ {
+ this.name = name;
+ this.desc = desc;
+ }
+
+ public ErrorState(String name, String desc, int[] data)
+ {
+ this.name = name;
+ this.desc = desc;
+ this.data = data;
+ }
+
+ public String toString()
+ {
+ return this.name;
+ }
+
+ public String getTooltip()
+ {
+ return this.desc;
+ }
+
+ public int[] getData()
+ {
+ return this.data;
+ }
+
+ public boolean isProgress()
+ {
+ return this.progress;
+ }
+
+ public void setIsProgress()
+ {
+ this.progress = true;
+ }
+
+ public static class Item
+ extends ErrorState
+ {
+ public Item(String name, String desc, int[] slots)
+ {
+ super(desc, slots);
+ }
+ }
+
+ public static class Tank
+ extends ErrorState
+ {
+ public Tank(String name, String desc, int[] slots)
+ {
+ super(desc, slots);
+ }
+ }
+
+ public static class NoItem
+ extends ErrorState.Item
+ {
+ public NoItem(String desc, int slot)
+ {
+ this(desc, new int[] { slot });
+ }
+
+ public NoItem(String desc, int[] slots)
+ {
+ super(desc, slots);
+ }
+ }
+
+ public static class InvalidItem
+ extends ErrorState.Item
+ {
+ public InvalidItem(String desc, int slot)
+ {
+ this("Invalid Item", desc, slot);
+ }
+
+ public InvalidItem(String name, String desc, int slot)
+ {
+ super(desc, new int[] { slot });
+ }
+ }
+
+ public static class NoSpace
+ extends ErrorState.Item
+ {
+ public NoSpace(String desc, int[] slots)
+ {
+ super(desc, slots);
+ }
+ }
+
+ public static class InsufficientPower
+ extends ErrorState
+ {
+ public InsufficientPower()
+ {
+ super("Not enough power to operate");
+ }
+ }
+
+ public static class TankSpace
+ extends ErrorState.Tank
+ {
+ public TankSpace(String desc, int tank)
+ {
+ super(desc, new int[] { tank });
+ }
+ }
+
+ public static class InsufficientLiquid
+ extends ErrorState.Tank
+ {
+ public InsufficientLiquid(String desc, int tank)
+ {
+ super(desc, new int[] { tank });
+ }
+ }
+
+ public static class InvalidRecipe
+ extends ErrorState.Item
+ {
+ public InvalidRecipe(String string, int[] slots)
+ {
+ super(string, slots);
+ }
+ }
+
+ public void readFromNBT(NBTTagCompound nbt)
+ {
+ this.name = nbt.getString("name");
+ this.desc = nbt.getString("desc");
+ this.data = nbt.getIntArray("data");
+ this.itemError = nbt.getBoolean("item");
+ this.tankError = nbt.getBoolean("tank");
+ this.powerError = nbt.getBoolean("power");
+ }
+
+ public void writeToNBT(NBTTagCompound nbt)
+ {
+ nbt.setString("name", toString());
+ nbt.setString("desc", getTooltip());
+ nbt.setIntArray("data", this.data);
+ if (isItemError()) {
+ nbt.setBoolean("item", true);
+ }
+ if (isTankError()) {
+ nbt.setBoolean("tank", true);
+ }
+ if (isPowerError()) {
+ nbt.setBoolean("power", true);
+ }
+ }
+
+ private boolean itemError = false;
+ private boolean tankError = false;
+ private boolean powerError = false;
+
+ public boolean isItemError()
+ {
+ return (this.itemError) || ((this instanceof Item));
+ }
+
+ public boolean isTankError()
+ {
+ return (this.tankError) || ((this instanceof Tank));
+ }
+
+ public boolean isPowerError()
+ {
+ return (this.powerError) || ((this instanceof InsufficientPower));
+ }
+}
diff --git a/src/Java/binnie/core/machines/power/IErrorStateSource.java b/src/Java/binnie/core/machines/power/IErrorStateSource.java
new file mode 100644
index 0000000000..bd2cd87d24
--- /dev/null
+++ b/src/Java/binnie/core/machines/power/IErrorStateSource.java
@@ -0,0 +1,8 @@
+package binnie.core.machines.power;
+
+public abstract interface IErrorStateSource
+{
+ public abstract ErrorState canWork();
+
+ public abstract ErrorState canProgress();
+}
diff --git a/src/Java/binnie/core/machines/power/IPoweredMachine.java b/src/Java/binnie/core/machines/power/IPoweredMachine.java
new file mode 100644
index 0000000000..b5e57aeff0
--- /dev/null
+++ b/src/Java/binnie/core/machines/power/IPoweredMachine.java
@@ -0,0 +1,14 @@
+package binnie.core.machines.power;
+
+import cofh.api.energy.IEnergyHandler;
+import cpw.mods.fml.common.Optional.Interface;
+import ic2.api.energy.tile.IEnergySink;
+
+@Optional.Interface(iface="ic2.api.energy.tile.IEnergySink", modid="IC2")
+public abstract interface IPoweredMachine
+ extends IEnergySink, IEnergyHandler
+{
+ public abstract PowerInfo getPowerInfo();
+
+ public abstract PowerInterface getInterface();
+}
diff --git a/src/Java/binnie/core/machines/power/IProcess.java b/src/Java/binnie/core/machines/power/IProcess.java
new file mode 100644
index 0000000000..83337cd980
--- /dev/null
+++ b/src/Java/binnie/core/machines/power/IProcess.java
@@ -0,0 +1,13 @@
+package binnie.core.machines.power;
+
+public abstract interface IProcess
+ extends IErrorStateSource
+{
+ public abstract float getEnergyPerTick();
+
+ public abstract String getTooltip();
+
+ public abstract boolean isInProgress();
+
+ public abstract ProcessInfo getInfo();
+}
diff --git a/src/Java/binnie/core/machines/power/IProcessTimed.java b/src/Java/binnie/core/machines/power/IProcessTimed.java
new file mode 100644
index 0000000000..1489d8837f
--- /dev/null
+++ b/src/Java/binnie/core/machines/power/IProcessTimed.java
@@ -0,0 +1,13 @@
+package binnie.core.machines.power;
+
+abstract interface IProcessTimed
+ extends IProcess, IErrorStateSource
+{
+ public abstract int getProcessLength();
+
+ public abstract int getProcessEnergy();
+
+ public abstract float getProgress();
+
+ public abstract float getProgressPerTick();
+}
diff --git a/src/Java/binnie/core/machines/power/ITankMachine.java b/src/Java/binnie/core/machines/power/ITankMachine.java
new file mode 100644
index 0000000000..fa92845cb7
--- /dev/null
+++ b/src/Java/binnie/core/machines/power/ITankMachine.java
@@ -0,0 +1,20 @@
+package binnie.core.machines.power;
+
+import binnie.core.machines.inventory.IValidatedTankContainer;
+import binnie.core.machines.inventory.TankSlot;
+import net.minecraftforge.fluids.IFluidHandler;
+import net.minecraftforge.fluids.IFluidTank;
+
+public abstract interface ITankMachine
+ extends IFluidHandler, IValidatedTankContainer
+{
+ public abstract TankInfo[] getTankInfos();
+
+ public abstract IFluidTank[] getTanks();
+
+ public abstract TankSlot addTank(int paramInt1, String paramString, int paramInt2);
+
+ public abstract IFluidTank getTank(int paramInt);
+
+ public abstract TankSlot getTankSlot(int paramInt);
+}
diff --git a/src/Java/binnie/core/machines/power/PowerInfo.java b/src/Java/binnie/core/machines/power/PowerInfo.java
new file mode 100644
index 0000000000..2c57f2c898
--- /dev/null
+++ b/src/Java/binnie/core/machines/power/PowerInfo.java
@@ -0,0 +1,41 @@
+package binnie.core.machines.power;
+
+import forestry.api.core.INBTTagable;
+import net.minecraft.nbt.NBTTagCompound;
+
+public class PowerInfo
+ implements INBTTagable
+{
+ private float currentEnergy = 0.0F;
+ private float maxEnergy = 0.0F;
+
+ public PowerInfo(IPoweredMachine machine, float currentInput)
+ {
+ this.currentEnergy = ((float)machine.getInterface().getEnergy(PowerSystem.RF));
+ this.maxEnergy = ((float)machine.getInterface().getCapacity(PowerSystem.RF));
+ }
+
+ public PowerInfo() {}
+
+ public int getStoredEnergy()
+ {
+ return (int)this.currentEnergy;
+ }
+
+ public int getMaxEnergy()
+ {
+ return (int)this.maxEnergy;
+ }
+
+ public void readFromNBT(NBTTagCompound nbttagcompound)
+ {
+ this.currentEnergy = nbttagcompound.getInteger("current");
+ this.maxEnergy = nbttagcompound.getInteger("max");
+ }
+
+ public void writeToNBT(NBTTagCompound nbttagcompound)
+ {
+ nbttagcompound.setInteger("current", getStoredEnergy());
+ nbttagcompound.setInteger("max", getMaxEnergy());
+ }
+}
diff --git a/src/Java/binnie/core/machines/power/PowerInterface.java b/src/Java/binnie/core/machines/power/PowerInterface.java
new file mode 100644
index 0000000000..e7e91bc18a
--- /dev/null
+++ b/src/Java/binnie/core/machines/power/PowerInterface.java
@@ -0,0 +1,90 @@
+package binnie.core.machines.power;
+
+import forestry.api.core.INBTTagable;
+import net.minecraft.nbt.NBTTagCompound;
+
+public class PowerInterface
+ implements INBTTagable
+{
+ private int capacity;
+ private int energy;
+
+ public PowerInterface(int capacity)
+ {
+ this.capacity = (capacity * 100);
+ this.energy = 0;
+ }
+
+ public int getCapacity()
+ {
+ return this.capacity;
+ }
+
+ public int getEnergy()
+ {
+ return this.energy;
+ }
+
+ public int addEnergy(int amount, boolean shouldDo)
+ {
+ int added = Math.min(getEnergySpace(), amount);
+ if (shouldDo) {
+ this.energy += added;
+ }
+ return added;
+ }
+
+ public int useEnergy(int amount, boolean simulate)
+ {
+ int added = Math.min(getEnergy(), amount);
+ if (simulate) {
+ this.energy -= added;
+ }
+ return added;
+ }
+
+ public int getEnergySpace()
+ {
+ return getCapacity() - getEnergy();
+ }
+
+ public double addEnergy(PowerSystem unit, double amount, boolean simulate)
+ {
+ return unit.convertTo(addEnergy(unit.convertFrom(amount), simulate));
+ }
+
+ public double useEnergy(PowerSystem unit, double amount, boolean simulate)
+ {
+ return unit.convertTo(useEnergy(unit.convertFrom(amount), simulate));
+ }
+
+ public double getEnergy(PowerSystem unit)
+ {
+ return unit.convertTo(getEnergy());
+ }
+
+ public double getCapacity(PowerSystem unit)
+ {
+ return unit.convertTo(getCapacity());
+ }
+
+ public double getEnergySpace(PowerSystem unit)
+ {
+ return unit.convertTo(getEnergySpace());
+ }
+
+ public void readFromNBT(NBTTagCompound nbt)
+ {
+ this.energy = nbt.getInteger("Energy");
+ if (this.energy > this.capacity) {
+ this.energy = this.capacity;
+ } else if (this.energy < 0) {
+ this.energy = 0;
+ }
+ }
+
+ public void writeToNBT(NBTTagCompound nbt)
+ {
+ nbt.setInteger("Energy", getEnergy());
+ }
+}
diff --git a/src/Java/binnie/core/machines/power/PowerSystem.java b/src/Java/binnie/core/machines/power/PowerSystem.java
new file mode 100644
index 0000000000..58c1cf9709
--- /dev/null
+++ b/src/Java/binnie/core/machines/power/PowerSystem.java
@@ -0,0 +1,44 @@
+package binnie.core.machines.power;
+
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+
+public enum PowerSystem
+{
+ MJ(100.0D), RF(10.0D), EU(40.0D);
+
+ double conversion;
+
+ private PowerSystem(double conversion)
+ {
+ this.conversion = conversion;
+ }
+
+ public double convertTo(int value)
+ {
+ return value / this.conversion;
+ }
+
+ public int convertFrom(double value)
+ {
+ return (int)(value * this.conversion);
+ }
+
+ public static PowerSystem get(int i)
+ {
+ return values()[(i % values().length)];
+ }
+
+ public String getUnitName()
+ {
+ return name();
+ }
+
+ public ItemStack saveTo(ItemStack stack)
+ {
+ NBTTagCompound tag = stack.hasTagCompound() ? stack.getTagCompound() : new NBTTagCompound();
+ tag.setByte("power-system", (byte)ordinal());
+ stack.setTagCompound(tag);
+ return stack;
+ }
+}
diff --git a/src/Java/binnie/core/machines/power/ProcessInfo.java b/src/Java/binnie/core/machines/power/ProcessInfo.java
new file mode 100644
index 0000000000..7b4a9bd8a4
--- /dev/null
+++ b/src/Java/binnie/core/machines/power/ProcessInfo.java
@@ -0,0 +1,67 @@
+package binnie.core.machines.power;
+
+import forestry.api.core.INBTTagable;
+import net.minecraft.nbt.NBTTagCompound;
+
+public class ProcessInfo
+ implements INBTTagable
+{
+ private float currentProgress = 0.0F;
+ private int processEnergy = 0;
+ private int processTime = 0;
+ private float energyPerTick = 0.0F;
+
+ public ProcessInfo(IProcess process)
+ {
+ this.energyPerTick = process.getEnergyPerTick();
+ if ((process instanceof IProcessTimed))
+ {
+ IProcessTimed time = (IProcessTimed)process;
+ this.currentProgress = time.getProgress();
+ this.processEnergy = time.getProcessEnergy();
+ this.processTime = time.getProcessLength();
+ }
+ else
+ {
+ this.currentProgress = (process.isInProgress() ? 100.0F : 0.0F);
+ }
+ }
+
+ public ProcessInfo() {}
+
+ public float getCurrentProgress()
+ {
+ return this.currentProgress;
+ }
+
+ public int getProcessEnergy()
+ {
+ return this.processEnergy;
+ }
+
+ public int getProcessTime()
+ {
+ return this.processTime;
+ }
+
+ public float getEnergyPerTick()
+ {
+ return this.energyPerTick;
+ }
+
+ public void readFromNBT(NBTTagCompound nbttagcompound)
+ {
+ this.energyPerTick = nbttagcompound.getFloat("ept");
+ this.processEnergy = nbttagcompound.getInteger("e");
+ this.processTime = nbttagcompound.getInteger("t");
+ this.currentProgress = nbttagcompound.getFloat("p");
+ }
+
+ public void writeToNBT(NBTTagCompound nbttagcompound)
+ {
+ nbttagcompound.setFloat("ept", this.energyPerTick);
+ nbttagcompound.setFloat("p", this.currentProgress);
+ nbttagcompound.setInteger("e", this.processEnergy);
+ nbttagcompound.setInteger("t", this.processTime);
+ }
+}
diff --git a/src/Java/binnie/core/machines/power/TankInfo.java b/src/Java/binnie/core/machines/power/TankInfo.java
new file mode 100644
index 0000000000..d9e0b350d7
--- /dev/null
+++ b/src/Java/binnie/core/machines/power/TankInfo.java
@@ -0,0 +1,76 @@
+package binnie.core.machines.power;
+
+import forestry.api.core.INBTTagable;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.IIcon;
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidStack;
+import net.minecraftforge.fluids.IFluidTank;
+
+public class TankInfo
+ implements INBTTagable
+{
+ public FluidStack liquid;
+ private float capacity = 0.0F;
+
+ public TankInfo(IFluidTank tank)
+ {
+ this.capacity = tank.getCapacity();
+ this.liquid = tank.getFluid();
+ }
+
+ public TankInfo() {}
+
+ public float getAmount()
+ {
+ return this.liquid == null ? 0.0F : this.liquid.amount;
+ }
+
+ public float getCapacity()
+ {
+ return this.capacity;
+ }
+
+ public boolean isEmpty()
+ {
+ return this.liquid == null;
+ }
+
+ public IIcon getIcon()
+ {
+ return this.liquid.getFluid().getStillIcon();
+ }
+
+ public String getName()
+ {
+ return this.liquid == null ? "" : this.liquid.getFluid().getLocalizedName();
+ }
+
+ public void readFromNBT(NBTTagCompound nbt)
+ {
+ this.capacity = nbt.getInteger("capacity");
+ if (nbt.hasKey("liquid")) {
+ this.liquid = FluidStack.loadFluidStackFromNBT(nbt.getCompoundTag("liquid"));
+ }
+ }
+
+ public void writeToNBT(NBTTagCompound nbt)
+ {
+ nbt.setInteger("capacity", (int)getCapacity());
+ if (this.liquid == null) {
+ return;
+ }
+ NBTTagCompound tag = new NBTTagCompound();
+ this.liquid.writeToNBT(tag);
+ nbt.setTag("liquid", tag);
+ }
+
+ public static TankInfo[] get(ITankMachine machine)
+ {
+ TankInfo[] info = new TankInfo[machine.getTanks().length];
+ for (int i = 0; i < info.length; i++) {
+ info[i] = new TankInfo(machine.getTanks()[i]);
+ }
+ return info;
+ }
+}
diff --git a/src/Java/binnie/core/machines/storage/Compartment.java b/src/Java/binnie/core/machines/storage/Compartment.java
new file mode 100644
index 0000000000..d7694e2502
--- /dev/null
+++ b/src/Java/binnie/core/machines/storage/Compartment.java
@@ -0,0 +1,65 @@
+package binnie.core.machines.storage;
+
+import binnie.core.BinnieCore;
+import binnie.core.machines.IMachineType;
+import binnie.core.machines.Machine;
+import binnie.core.machines.MachineGroup;
+import binnie.core.machines.MachinePackage;
+import binnie.core.machines.TileEntityMachine;
+import binnie.core.resource.BinnieResource;
+import binnie.core.resource.IBinnieTexture;
+import net.minecraft.client.renderer.RenderBlocks;
+import net.minecraft.item.ItemStack;
+import net.minecraft.tileentity.TileEntity;
+
+ enum Compartment
+ implements IMachineType
+{
+ Compartment(StandardCompartment.PackageCompartment.class), CompartmentCopper(StandardCompartment.PackageCompartmentCopper.class), CompartmentBronze(StandardCompartment.PackageCompartmentBronze.class), CompartmentIron(StandardCompartment.PackageCompartmentIron.class), CompartmentGold(StandardCompartment.PackageCompartmentGold.class), CompartmentDiamond(StandardCompartment.PackageCompartmentDiamond.class);
+
+ Class<? extends MachinePackage> clss;
+
+ private Compartment(Class<? extends MachinePackage> clss)
+ {
+ this.clss = clss;
+ }
+
+ public Class<? extends MachinePackage> getPackageClass()
+ {
+ return this.clss;
+ }
+
+ public static abstract class PackageCompartment
+ extends MachinePackage
+ {
+ private BinnieResource renderTexture;
+
+ protected PackageCompartment(String uid, IBinnieTexture renderTexture)
+ {
+ super(false);
+ this.renderTexture = renderTexture.getTexture();
+ }
+
+ public TileEntity createTileEntity()
+ {
+ return new TileEntityMachine(this);
+ }
+
+ public void register() {}
+
+ public void renderMachine(Machine machine, double x, double y, double z, float var8, RenderBlocks renderer)
+ {
+ MachineRendererCompartment.instance.renderMachine(machine, 16777215, this.renderTexture, x, y, z, var8);
+ }
+ }
+
+ public boolean isActive()
+ {
+ return true;
+ }
+
+ public ItemStack get(int i)
+ {
+ return new ItemStack(BinnieCore.packageCompartment.getBlock(), i, ordinal());
+ }
+}
diff --git a/src/Java/binnie/core/machines/storage/CompartmentTab.java b/src/Java/binnie/core/machines/storage/CompartmentTab.java
new file mode 100644
index 0000000000..025f73db31
--- /dev/null
+++ b/src/Java/binnie/core/machines/storage/CompartmentTab.java
@@ -0,0 +1,77 @@
+package binnie.core.machines.storage;
+
+import binnie.craftgui.minecraft.EnumColor;
+import forestry.api.core.INBTTagable;
+import net.minecraft.init.Items;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+
+class CompartmentTab
+ implements INBTTagable
+{
+ private String name;
+ private ItemStack icon;
+ private EnumColor color;
+ private int id;
+
+ public CompartmentTab(int id)
+ {
+ this.name = "";
+ this.icon = new ItemStack(Items.paper);
+ this.color = EnumColor.White;
+ this.id = id;
+ }
+
+ public void readFromNBT(NBTTagCompound nbt)
+ {
+ this.name = nbt.getString("name");
+ this.icon = ItemStack.loadItemStackFromNBT(nbt.getCompoundTag("icon"));
+ this.color = EnumColor.values()[nbt.getByte("color")];
+ this.id = nbt.getByte("id");
+ }
+
+ public void writeToNBT(NBTTagCompound nbt)
+ {
+ nbt.setString("name", this.name);
+ NBTTagCompound n = new NBTTagCompound();
+ this.icon.writeToNBT(n);
+ nbt.setTag("icon", n);
+ nbt.setByte("color", (byte)this.color.ordinal());
+ nbt.setByte("id", (byte)this.id);
+ }
+
+ public String getName()
+ {
+ return this.name;
+ }
+
+ public ItemStack getIcon()
+ {
+ return this.icon;
+ }
+
+ public EnumColor getColor()
+ {
+ return this.color;
+ }
+
+ public int getId()
+ {
+ return this.id;
+ }
+
+ public void setName(String name)
+ {
+ this.name = (name == null ? "" : name);
+ }
+
+ public void setIcon(ItemStack icon)
+ {
+ this.icon = icon;
+ }
+
+ public void setColor(EnumColor color)
+ {
+ this.color = color;
+ }
+}
diff --git a/src/Java/binnie/core/machines/storage/ComponentBinnieCoreGUI.java b/src/Java/binnie/core/machines/storage/ComponentBinnieCoreGUI.java
new file mode 100644
index 0000000000..d987129378
--- /dev/null
+++ b/src/Java/binnie/core/machines/storage/ComponentBinnieCoreGUI.java
@@ -0,0 +1,28 @@
+package binnie.core.machines.storage;
+
+import binnie.core.BinnieCore;
+import binnie.core.gui.BinnieCoreGUI;
+import binnie.core.machines.Machine;
+import binnie.core.machines.MachineComponent;
+import binnie.core.machines.component.IInteraction.RightClick;
+import binnie.core.proxy.BinnieProxy;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.world.World;
+
+class ComponentBinnieCoreGUI
+ extends MachineComponent
+ implements IInteraction.RightClick
+{
+ private BinnieCoreGUI id;
+
+ public ComponentBinnieCoreGUI(Machine machine, BinnieCoreGUI id)
+ {
+ super(machine);
+ this.id = id;
+ }
+
+ public void onRightClick(World world, EntityPlayer player, int x, int y, int z)
+ {
+ BinnieCore.proxy.openGui(this.id, player, x, y, z);
+ }
+}
diff --git a/src/Java/binnie/core/machines/storage/ComponentCompartmentInventory.java b/src/Java/binnie/core/machines/storage/ComponentCompartmentInventory.java
new file mode 100644
index 0000000000..ef55e9df9e
--- /dev/null
+++ b/src/Java/binnie/core/machines/storage/ComponentCompartmentInventory.java
@@ -0,0 +1,128 @@
+package binnie.core.machines.storage;
+
+import binnie.core.machines.IMachine;
+import binnie.core.machines.inventory.ComponentInventorySlots;
+import binnie.core.machines.network.INetwork.GuiNBT;
+import cpw.mods.fml.relauncher.Side;
+import java.util.HashMap;
+import java.util.Map;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.nbt.NBTTagList;
+import net.minecraft.tileentity.TileEntity;
+
+class ComponentCompartmentInventory
+ extends ComponentInventorySlots
+ implements INetwork.GuiNBT
+{
+ private int numberOfTabs;
+ private int slotsPerPage;
+
+ public ComponentCompartmentInventory(IMachine machine, int sections)
+ {
+ this(machine, sections, 4);
+ }
+
+ public ComponentCompartmentInventory(IMachine machine, int tabs, int pageSize)
+ {
+ super(machine);
+
+ this.numberOfTabs = tabs;
+ this.slotsPerPage = pageSize;
+ for (int i = 0; i < this.numberOfTabs * this.slotsPerPage; i++) {
+ addSlot(i, "compartment");
+ }
+ }
+
+ public int getPageSize()
+ {
+ return this.slotsPerPage;
+ }
+
+ public int getTabNumber()
+ {
+ return this.numberOfTabs;
+ }
+
+ public int[] getSlotsForTab(int currentTab)
+ {
+ int[] slots = new int[this.slotsPerPage];
+ for (int i = 0; i < this.slotsPerPage; i++) {
+ slots[i] = (i + currentTab * this.slotsPerPage);
+ }
+ return slots;
+ }
+
+ private Map<Integer, CompartmentTab> tabs = new HashMap();
+
+ public CompartmentTab getTab(int i)
+ {
+ if (!this.tabs.containsKey(Integer.valueOf(i))) {
+ this.tabs.put(Integer.valueOf(i), new CompartmentTab(i));
+ }
+ return (CompartmentTab)this.tabs.get(Integer.valueOf(i));
+ }
+
+ public void sendGuiNBT(Map<String, NBTTagCompound> nbt)
+ {
+ NBTTagList list = new NBTTagList();
+ for (int i = 0; i < this.numberOfTabs; i++)
+ {
+ NBTTagCompound nbt2 = new NBTTagCompound();
+ getTab(i).writeToNBT(nbt2);
+ list.appendTag(nbt2);
+ }
+ NBTTagCompound tag = new NBTTagCompound();
+ tag.setTag("tabs", list);
+ nbt.put("comp-tabs", tag);
+ }
+
+ public void recieveGuiNBT(Side side, EntityPlayer player, String name, NBTTagCompound nbt)
+ {
+ if (name.equals("comp-tabs"))
+ {
+ NBTTagList tags = nbt.getTagList("tabs", 10);
+ for (int i = 0; i < tags.tagCount(); i++)
+ {
+ NBTTagCompound tag = tags.getCompoundTagAt(i);
+ CompartmentTab tab = new CompartmentTab(0);
+ tab.readFromNBT(tag);
+ this.tabs.put(Integer.valueOf(tab.getId()), tab);
+ }
+ }
+ if (name.equals("comp-change-tab"))
+ {
+ NBTTagCompound tag = nbt;
+ CompartmentTab tab = new CompartmentTab(0);
+ tab.readFromNBT(tag);
+ this.tabs.put(Integer.valueOf(tab.getId()), tab);
+ getMachine().getTileEntity().markDirty();
+ }
+ }
+
+ public void readFromNBT(NBTTagCompound nbt)
+ {
+ super.readFromNBT(nbt);
+ NBTTagList tags = nbt.getTagList("tabs", 10);
+ for (int i = 0; i < tags.tagCount(); i++)
+ {
+ NBTTagCompound tag = tags.getCompoundTagAt(i);
+ CompartmentTab tab = new CompartmentTab(0);
+ tab.readFromNBT(tag);
+ this.tabs.put(Integer.valueOf(tab.getId()), tab);
+ }
+ }
+
+ public void writeToNBT(NBTTagCompound nbt)
+ {
+ super.writeToNBT(nbt);
+ NBTTagList list = new NBTTagList();
+ for (int i = 0; i < this.numberOfTabs; i++)
+ {
+ NBTTagCompound nbt2 = new NBTTagCompound();
+ getTab(i).writeToNBT(nbt2);
+ list.appendTag(nbt2);
+ }
+ nbt.setTag("tabs", list);
+ }
+}
diff --git a/src/Java/binnie/core/machines/storage/ControlColourSelector.java b/src/Java/binnie/core/machines/storage/ControlColourSelector.java
new file mode 100644
index 0000000000..c5320a2629
--- /dev/null
+++ b/src/Java/binnie/core/machines/storage/ControlColourSelector.java
@@ -0,0 +1,47 @@
+package binnie.core.machines.storage;
+
+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.ITooltip;
+import binnie.craftgui.core.IWidget;
+import binnie.craftgui.core.Tooltip;
+import binnie.craftgui.core.renderer.Renderer;
+import binnie.craftgui.minecraft.EnumColor;
+
+class ControlColourSelector
+ extends Control
+ implements ITooltip, IControlValue<EnumColor>
+{
+ private EnumColor value;
+
+ public ControlColourSelector(IWidget parent, float x, float y, float w, float h, EnumColor value)
+ {
+ super(parent, x, y, w, h);
+ setValue(value);
+ addAttribute(Attribute.MouseOver);
+ }
+
+ public void getTooltip(Tooltip tooltip)
+ {
+ tooltip.add(this.value.toString());
+ }
+
+ public EnumColor getValue()
+ {
+ return this.value;
+ }
+
+ public void setValue(EnumColor value)
+ {
+ this.value = value;
+ setColour(getValue().getColour());
+ }
+
+ public void onRenderBackground()
+ {
+ super.onRenderBackground();
+ CraftGUI.Render.gradientRect(getArea(), -16777216 + this.value.getColour(), -16777216 + this.value.getColour());
+ }
+}
diff --git a/src/Java/binnie/core/machines/storage/MachineRendererCompartment.java b/src/Java/binnie/core/machines/storage/MachineRendererCompartment.java
new file mode 100644
index 0000000000..133b5293ff
--- /dev/null
+++ b/src/Java/binnie/core/machines/storage/MachineRendererCompartment.java
@@ -0,0 +1,50 @@
+package binnie.core.machines.storage;
+
+import binnie.core.BinnieCore;
+import binnie.core.machines.Machine;
+import binnie.core.proxy.BinnieProxy;
+import binnie.core.resource.BinnieResource;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import net.minecraft.tileentity.TileEntity;
+import org.lwjgl.opengl.GL11;
+
+@SideOnly(Side.CLIENT)
+class MachineRendererCompartment
+{
+ public static MachineRendererCompartment instance = new MachineRendererCompartment();
+ private ModelCompartment model;
+
+ public MachineRendererCompartment()
+ {
+ this.model = new ModelCompartment();
+ }
+
+ public void renderMachine(Machine machine, int colour, BinnieResource texture, double x, double y, double z, float var8)
+ {
+ GL11.glPushMatrix();
+
+ int i1 = 0;
+
+ int ix = machine.getTileEntity().xCoord;
+ int iy = machine.getTileEntity().yCoord;
+ int iz = machine.getTileEntity().zCoord;
+ if (machine.getTileEntity() != null) {
+ i1 = ix * iy * iz + ix * iy - ix * iz + iy * iz - ix + iy - iz;
+ }
+ float phase = (float)Math.max(0.0D, Math.sin((System.currentTimeMillis() + i1) * 0.003D));
+
+ GL11.glTranslated(x + 0.5D, y + 1.5D, z + 0.5D);
+ GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
+
+ BinnieCore.proxy.bindTexture(texture);
+
+ GL11.glPushMatrix();
+
+ this.model.render(null, (float)x, (float)y, (float)z, 0.0625F, 0.0625F, 0.0625F);
+
+ GL11.glPopMatrix();
+
+ GL11.glPopMatrix();
+ }
+}
diff --git a/src/Java/binnie/core/machines/storage/ModelCompartment.java b/src/Java/binnie/core/machines/storage/ModelCompartment.java
new file mode 100644
index 0000000000..9e5aef450a
--- /dev/null
+++ b/src/Java/binnie/core/machines/storage/ModelCompartment.java
@@ -0,0 +1,171 @@
+package binnie.core.machines.storage;
+
+import net.minecraft.client.model.ModelBase;
+import net.minecraft.client.model.ModelRenderer;
+import net.minecraft.entity.Entity;
+
+class ModelCompartment
+ extends ModelBase
+{
+ private ModelRenderer Column1;
+ private ModelRenderer Column4;
+ private ModelRenderer Column2;
+ private ModelRenderer Column3;
+ private ModelRenderer Lid_1;
+ private ModelRenderer Body_1;
+ private ModelRenderer Lock_1;
+ private ModelRenderer Lid_2;
+ private ModelRenderer Body_2;
+ private ModelRenderer Lock_2;
+ private ModelRenderer Body;
+ private ModelRenderer Lid_3;
+ private ModelRenderer Body_3;
+ private ModelRenderer Lock_3;
+ private ModelRenderer Lid_4;
+ private ModelRenderer Body_4;
+ private ModelRenderer Lock_4;
+
+ public ModelCompartment()
+ {
+ this.textureWidth = 128;
+ this.textureHeight = 128;
+
+ this.Column1 = new ModelRenderer(this, 0, 0);
+ this.Column1.addBox(-8.0F, 8.0F, -8.0F, 4, 16, 4);
+ this.Column1.setRotationPoint(0.0F, 0.0F, 0.0F);
+ this.Column1.setTextureSize(128, 128);
+ this.Column1.mirror = true;
+ setRotation(this.Column1, 0.0F, 0.0F, 0.0F);
+ this.Column4 = new ModelRenderer(this, 0, 0);
+ this.Column4.addBox(4.0F, 8.0F, -8.0F, 4, 16, 4);
+ this.Column4.setRotationPoint(0.0F, 0.0F, 0.0F);
+ this.Column4.setTextureSize(128, 128);
+ this.Column4.mirror = true;
+ setRotation(this.Column4, 0.0F, 0.0F, 0.0F);
+ this.Column2 = new ModelRenderer(this, 0, 0);
+ this.Column2.addBox(-8.0F, 8.0F, 4.0F, 4, 16, 4);
+ this.Column2.setRotationPoint(0.0F, 0.0F, 0.0F);
+ this.Column2.setTextureSize(128, 128);
+ this.Column2.mirror = true;
+ setRotation(this.Column2, 0.0F, 0.0F, 0.0F);
+ this.Column3 = new ModelRenderer(this, 0, 0);
+ this.Column3.addBox(4.0F, 8.0F, 4.0F, 4, 16, 4);
+ this.Column3.setRotationPoint(0.0F, 0.0F, 0.0F);
+ this.Column3.setTextureSize(128, 128);
+ this.Column3.mirror = true;
+ setRotation(this.Column3, 0.0F, 0.0F, 0.0F);
+ this.Lid_1 = new ModelRenderer(this, 48, 0);
+ this.Lid_1.addBox(-4.0F, 9.0F, -7.0F, 8, 5, 3);
+ this.Lid_1.setRotationPoint(0.0F, 0.0F, 0.0F);
+ this.Lid_1.setTextureSize(128, 128);
+ this.Lid_1.mirror = true;
+ setRotation(this.Lid_1, 0.0F, 0.0F, 0.0F);
+ this.Body_1 = new ModelRenderer(this, 0, 24);
+ this.Body_1.addBox(-4.0F, 14.0F, -7.0F, 8, 10, 3);
+ this.Body_1.setRotationPoint(0.0F, 0.0F, 0.0F);
+ this.Body_1.setTextureSize(128, 128);
+ this.Body_1.mirror = true;
+ setRotation(this.Body_1, 0.0F, 0.0F, 0.0F);
+ this.Lock_1 = new ModelRenderer(this, 22, 24);
+ this.Lock_1.addBox(-1.0F, 12.0F, -8.0F, 2, 4, 1);
+ this.Lock_1.setRotationPoint(0.0F, 0.0F, 0.0F);
+ this.Lock_1.setTextureSize(128, 128);
+ this.Lock_1.mirror = true;
+ setRotation(this.Lock_1, 0.0F, 0.0F, 0.0F);
+ this.Lid_2 = new ModelRenderer(this, 48, 0);
+ this.Lid_2.addBox(-4.0F, 9.0F, -7.0F, 8, 5, 3);
+ this.Lid_2.setRotationPoint(0.0F, 0.0F, 0.0F);
+ this.Lid_2.setTextureSize(128, 128);
+ this.Lid_2.mirror = true;
+ setRotation(this.Lid_2, 0.0F, 1.570796F, 0.0F);
+ this.Body_2 = new ModelRenderer(this, 0, 24);
+ this.Body_2.addBox(-4.0F, 14.0F, -7.0F, 8, 10, 3);
+ this.Body_2.setRotationPoint(0.0F, 0.0F, 0.0F);
+ this.Body_2.setTextureSize(128, 128);
+ this.Body_2.mirror = true;
+ setRotation(this.Body_2, 0.0F, 1.570796F, 0.0F);
+ this.Lock_2 = new ModelRenderer(this, 22, 24);
+ this.Lock_2.addBox(-1.0F, 12.0F, -8.0F, 2, 4, 1);
+ this.Lock_2.setRotationPoint(0.0F, 0.0F, 0.0F);
+ this.Lock_2.setTextureSize(128, 128);
+ this.Lock_2.mirror = true;
+ setRotation(this.Lock_2, 0.0F, 1.570796F, 0.0F);
+ this.Body = new ModelRenderer(this, 16, 0);
+ this.Body.addBox(-4.0F, 8.0F, -4.0F, 8, 16, 8);
+ this.Body.setRotationPoint(0.0F, 0.0F, 0.0F);
+ this.Body.setTextureSize(128, 128);
+ this.Body.mirror = true;
+ setRotation(this.Body, 0.0F, 0.0F, 0.0F);
+ this.Lid_3 = new ModelRenderer(this, 48, 0);
+ this.Lid_3.addBox(-4.0F, 9.0F, -7.0F, 8, 5, 3);
+ this.Lid_3.setRotationPoint(0.0F, 0.0F, 0.0F);
+ this.Lid_3.setTextureSize(128, 128);
+ this.Lid_3.mirror = true;
+ setRotation(this.Lid_3, 0.0F, 3.141593F, 0.0F);
+ this.Body_3 = new ModelRenderer(this, 0, 24);
+ this.Body_3.addBox(-4.0F, 14.0F, -7.0F, 8, 10, 3);
+ this.Body_3.setRotationPoint(0.0F, 0.0F, 0.0F);
+ this.Body_3.setTextureSize(128, 128);
+ this.Body_3.mirror = true;
+ setRotation(this.Body_3, 0.0F, 3.141593F, 0.0F);
+ this.Lock_3 = new ModelRenderer(this, 22, 24);
+ this.Lock_3.addBox(-1.0F, 12.0F, -8.0F, 2, 4, 1);
+ this.Lock_3.setRotationPoint(0.0F, 0.0F, 0.0F);
+ this.Lock_3.setTextureSize(128, 128);
+ this.Lock_3.mirror = true;
+ setRotation(this.Lock_3, 0.0F, 3.141593F, 0.0F);
+ this.Lid_4 = new ModelRenderer(this, 48, 0);
+ this.Lid_4.addBox(-4.0F, 9.0F, -7.0F, 8, 5, 3);
+ this.Lid_4.setRotationPoint(0.0F, 0.0F, 0.0F);
+ this.Lid_4.setTextureSize(128, 128);
+ this.Lid_4.mirror = true;
+ setRotation(this.Lid_4, 0.0F, -1.570796F, 0.0F);
+ this.Body_4 = new ModelRenderer(this, 0, 24);
+ this.Body_4.addBox(-4.0F, 14.0F, -7.0F, 8, 10, 3);
+ this.Body_4.setRotationPoint(0.0F, 0.0F, 0.0F);
+ this.Body_4.setTextureSize(128, 128);
+ this.Body_4.mirror = true;
+ setRotation(this.Body_4, 0.0F, -1.570796F, 0.0F);
+ this.Lock_4 = new ModelRenderer(this, 22, 24);
+ this.Lock_4.addBox(-1.0F, 12.0F, -8.0F, 2, 4, 1);
+ this.Lock_4.setRotationPoint(0.0F, 0.0F, 0.0F);
+ this.Lock_4.setTextureSize(128, 128);
+ this.Lock_4.mirror = true;
+ setRotation(this.Lock_4, 0.0F, -1.570796F, 0.0F);
+ }
+
+ public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
+ {
+ super.render(entity, f, f1, f2, f3, f4, f5);
+ setRotationAngles(f, f1, f2, f3, f4, f5);
+ this.Column1.render(f5);
+ this.Column4.render(f5);
+ this.Column2.render(f5);
+ this.Column3.render(f5);
+ this.Lid_1.render(f5);
+ this.Body_1.render(f5);
+ this.Lock_1.render(f5);
+ this.Lid_2.render(f5);
+ this.Body_2.render(f5);
+ this.Lock_2.render(f5);
+ this.Body.render(f5);
+ this.Lid_3.render(f5);
+ this.Body_3.render(f5);
+ this.Lock_3.render(f5);
+ this.Lid_4.render(f5);
+ this.Body_4.render(f5);
+ this.Lock_4.render(f5);
+ }
+
+ private void setRotation(ModelRenderer model, float x, float y, float z)
+ {
+ model.rotateAngleX = x;
+ model.rotateAngleY = y;
+ model.rotateAngleZ = z;
+ }
+
+ public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5)
+ {
+ super.setRotationAngles(f, f1, f2, f3, f4, f5, null);
+ }
+}
diff --git a/src/Java/binnie/core/machines/storage/ModuleStorage.java b/src/Java/binnie/core/machines/storage/ModuleStorage.java
new file mode 100644
index 0000000000..7f8bb38ac4
--- /dev/null
+++ b/src/Java/binnie/core/machines/storage/ModuleStorage.java
@@ -0,0 +1,39 @@
+package binnie.core.machines.storage;
+
+import binnie.core.BinnieCore;
+import binnie.core.IInitializable;
+import binnie.core.machines.MachineGroup;
+import cpw.mods.fml.common.registry.GameRegistry;
+import java.util.ArrayList;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.init.Blocks;
+import net.minecraft.init.Items;
+import net.minecraftforge.oredict.OreDictionary;
+import net.minecraftforge.oredict.ShapedOreRecipe;
+
+public class ModuleStorage
+ implements IInitializable
+{
+ public void preInit()
+ {
+ BinnieCore.packageCompartment = new MachineGroup(BinnieCore.instance, "storage", "storage", Compartment.values());
+ BinnieCore.packageCompartment.setCreativeTab(CreativeTabs.tabBlock);
+ }
+
+ public void init() {}
+
+ public void postInit()
+ {
+ String ironGear = OreDictionary.getOres("gearIron").isEmpty() ? "ingotIron" : "gearIron";
+ String goldGear = OreDictionary.getOres("gearGold").isEmpty() ? "ingotGold" : "gearGold";
+ String diamondGear = "gemDiamond";
+
+ GameRegistry.addRecipe(new ShapedOreRecipe(Compartment.Compartment.get(1), new Object[] { "pcp", "cbc", "pcp", Character.valueOf('b'), Items.book, Character.valueOf('c'), Blocks.chest, Character.valueOf('p'), Blocks.stone_button }));
+ GameRegistry.addRecipe(new ShapedOreRecipe(Compartment.CompartmentCopper.get(1), new Object[] { "pcp", "cbc", "pcp", Character.valueOf('b'), Compartment.Compartment.get(1), Character.valueOf('c'), "gearCopper", Character.valueOf('p'), Blocks.stone_button }));
+ GameRegistry.addRecipe(new ShapedOreRecipe(Compartment.CompartmentBronze.get(1), new Object[] { "pcp", "cbc", "pcp", Character.valueOf('b'), Compartment.CompartmentCopper.get(1), Character.valueOf('c'), "gearBronze", Character.valueOf('p'), Items.gold_nugget }));
+
+ GameRegistry.addRecipe(new ShapedOreRecipe(Compartment.CompartmentIron.get(1), new Object[] { "pcp", "cbc", "pcp", Character.valueOf('b'), Compartment.CompartmentCopper.get(1), Character.valueOf('c'), ironGear, Character.valueOf('p'), Items.gold_nugget }));
+ GameRegistry.addRecipe(new ShapedOreRecipe(Compartment.CompartmentGold.get(1), new Object[] { "pcp", "cbc", "pcp", Character.valueOf('b'), Compartment.CompartmentIron.get(1), Character.valueOf('c'), goldGear, Character.valueOf('p'), Items.emerald }));
+ GameRegistry.addRecipe(new ShapedOreRecipe(Compartment.CompartmentDiamond.get(1), new Object[] { "pcp", "cbc", "pcp", Character.valueOf('b'), Compartment.CompartmentGold.get(1), Character.valueOf('c'), diamondGear, Character.valueOf('p'), Items.emerald }));
+ }
+}
diff --git a/src/Java/binnie/core/machines/storage/StandardCompartment.java b/src/Java/binnie/core/machines/storage/StandardCompartment.java
new file mode 100644
index 0000000000..341657cb9e
--- /dev/null
+++ b/src/Java/binnie/core/machines/storage/StandardCompartment.java
@@ -0,0 +1,142 @@
+package binnie.core.machines.storage;
+
+import binnie.core.gui.BinnieCoreGUI;
+import binnie.core.machines.Machine;
+import binnie.core.machines.TileEntityMachine;
+import binnie.core.texture.BinnieCoreTexture;
+import net.minecraft.tileentity.TileEntity;
+
+class StandardCompartment
+{
+ public static class PackageCompartment
+ extends Compartment.PackageCompartment
+ {
+ public PackageCompartment()
+ {
+ super(BinnieCoreTexture.Compartment);
+ }
+
+ public void createMachine(Machine machine)
+ {
+ new ComponentBinnieCoreGUI(machine, BinnieCoreGUI.Compartment);
+ new ComponentCompartmentInventory(machine, 4, 25);
+ }
+
+ public TileEntity createTileEntity()
+ {
+ return new TileEntityMachine(this);
+ }
+
+ public void register() {}
+ }
+
+ public static class PackageCompartmentCopper
+ extends Compartment.PackageCompartment
+ {
+ public PackageCompartmentCopper()
+ {
+ super(BinnieCoreTexture.CompartmentCopper);
+ }
+
+ public void createMachine(Machine machine)
+ {
+ new ComponentBinnieCoreGUI(machine, BinnieCoreGUI.Compartment);
+ new ComponentCompartmentInventory(machine, 6, 25);
+ }
+
+ public TileEntity createTileEntity()
+ {
+ return new TileEntityMachine(this);
+ }
+
+ public void register() {}
+ }
+
+ public static class PackageCompartmentBronze
+ extends Compartment.PackageCompartment
+ {
+ public PackageCompartmentBronze()
+ {
+ super(BinnieCoreTexture.CompartmentBronze);
+ }
+
+ public void createMachine(Machine machine)
+ {
+ new ComponentBinnieCoreGUI(machine, BinnieCoreGUI.Compartment);
+ new ComponentCompartmentInventory(machine, 8, 25);
+ }
+
+ public TileEntity createTileEntity()
+ {
+ return new TileEntityMachine(this);
+ }
+
+ public void register() {}
+ }
+
+ public static class PackageCompartmentIron
+ extends Compartment.PackageCompartment
+ {
+ public PackageCompartmentIron()
+ {
+ super(BinnieCoreTexture.CompartmentIron);
+ }
+
+ public void createMachine(Machine machine)
+ {
+ new ComponentBinnieCoreGUI(machine, BinnieCoreGUI.Compartment);
+ new ComponentCompartmentInventory(machine, 4, 50);
+ }
+
+ public TileEntity createTileEntity()
+ {
+ return new TileEntityMachine(this);
+ }
+
+ public void register() {}
+ }
+
+ public static class PackageCompartmentGold
+ extends Compartment.PackageCompartment
+ {
+ public PackageCompartmentGold()
+ {
+ super(BinnieCoreTexture.CompartmentGold);
+ }
+
+ public void createMachine(Machine machine)
+ {
+ new ComponentBinnieCoreGUI(machine, BinnieCoreGUI.Compartment);
+ new ComponentCompartmentInventory(machine, 6, 50);
+ }
+
+ public TileEntity createTileEntity()
+ {
+ return new TileEntityMachine(this);
+ }
+
+ public void register() {}
+ }
+
+ public static class PackageCompartmentDiamond
+ extends Compartment.PackageCompartment
+ {
+ public PackageCompartmentDiamond()
+ {
+ super(BinnieCoreTexture.CompartmentDiamond);
+ }
+
+ public void createMachine(Machine machine)
+ {
+ new ComponentBinnieCoreGUI(machine, BinnieCoreGUI.Compartment);
+ new ComponentCompartmentInventory(machine, 8, 50);
+ }
+
+ public TileEntity createTileEntity()
+ {
+ return new TileEntityMachine(this);
+ }
+
+ public void register() {}
+ }
+}
diff --git a/src/Java/binnie/core/machines/storage/WindowCompartment.java b/src/Java/binnie/core/machines/storage/WindowCompartment.java
new file mode 100644
index 0000000000..6c28ed0714
--- /dev/null
+++ b/src/Java/binnie/core/machines/storage/WindowCompartment.java
@@ -0,0 +1,594 @@
+package binnie.core.machines.storage;
+
+import binnie.core.AbstractMod;
+import binnie.core.BinnieCore;
+import binnie.core.machines.IMachine;
+import binnie.core.machines.Machine;
+import binnie.core.machines.MachinePackage;
+import binnie.core.machines.transfer.TransferRequest;
+import binnie.craftgui.controls.ControlCheckbox;
+import binnie.craftgui.controls.ControlText;
+import binnie.craftgui.controls.ControlTextEdit;
+import binnie.craftgui.controls.button.ControlButton;
+import binnie.craftgui.controls.core.Control;
+import binnie.craftgui.controls.page.ControlPage;
+import binnie.craftgui.controls.page.ControlPages;
+import binnie.craftgui.controls.scroll.ControlScrollableContent;
+import binnie.craftgui.controls.tab.ControlTab;
+import binnie.craftgui.controls.tab.ControlTabBar;
+import binnie.craftgui.core.Attribute;
+import binnie.craftgui.core.CraftGUI;
+import binnie.craftgui.core.IWidget;
+import binnie.craftgui.core.geometry.CraftGUIUtil;
+import binnie.craftgui.core.geometry.IArea;
+import binnie.craftgui.core.geometry.IBorder;
+import binnie.craftgui.core.geometry.IPoint;
+import binnie.craftgui.core.geometry.Position;
+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.EventTextEdit;
+import binnie.craftgui.events.EventTextEdit.Handler;
+import binnie.craftgui.events.EventValueChanged;
+import binnie.craftgui.events.EventValueChanged.Handler;
+import binnie.craftgui.genetics.machine.WindowMachine;
+import binnie.craftgui.minecraft.Dialog;
+import binnie.craftgui.minecraft.EnumColor;
+import binnie.craftgui.minecraft.IWindowAffectsShiftClick;
+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.ControlSlide;
+import binnie.craftgui.minecraft.control.ControlSlot;
+import binnie.craftgui.minecraft.control.ControlSlotArray;
+import binnie.craftgui.minecraft.control.ControlTabIcon;
+import binnie.craftgui.resource.Texture;
+import binnie.craftgui.resource.minecraft.CraftGUITexture;
+import binnie.craftgui.window.Panel;
+import binnie.craftgui.window.Panel.IPanelType;
+import cpw.mods.fml.relauncher.Side;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.init.Blocks;
+import net.minecraft.init.Items;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+
+public class WindowCompartment
+ extends WindowMachine
+ implements IWindowAffectsShiftClick
+{
+ public static Window create(EntityPlayer player, IInventory inventory, Side side)
+ {
+ return new WindowCompartment(player, inventory, side);
+ }
+
+ public WindowCompartment(EntityPlayer player, IInventory inventory, Side side)
+ {
+ super(320, 226, player, inventory, side);
+ }
+
+ private final Map<Panel, Integer> panels = new HashMap();
+ private ControlTextEdit tabName;
+ private ControlItemDisplay tabIcon;
+ private ControlColourSelector tabColour;
+ boolean dueUpdate;
+
+ public void initialiseClient()
+ {
+ setTitle(Machine.getMachine(getInventory()).getPackage().getDisplayName());
+
+ int x = 16;
+ int y = 32;
+
+ ComponentCompartmentInventory inv = (ComponentCompartmentInventory)Machine.getMachine(getInventory()).getInterface(ComponentCompartmentInventory.class);
+
+
+
+ Integer[] tabs1 = new Integer[0];
+ Integer[] tabs2 = new Integer[0];
+ if (inv.getTabNumber() == 4)
+ {
+ tabs1 = new Integer[] { Integer.valueOf(0), Integer.valueOf(1) };
+ tabs2 = new Integer[] { Integer.valueOf(2), Integer.valueOf(3) };
+ }
+ if (inv.getTabNumber() == 6)
+ {
+ tabs1 = new Integer[] { Integer.valueOf(0), Integer.valueOf(1), Integer.valueOf(2) };
+ tabs2 = new Integer[] { Integer.valueOf(3), Integer.valueOf(4), Integer.valueOf(5) };
+ }
+ if (inv.getTabNumber() == 8)
+ {
+ tabs1 = new Integer[] { Integer.valueOf(0), Integer.valueOf(1), Integer.valueOf(2), Integer.valueOf(3) };
+ tabs2 = new Integer[] { Integer.valueOf(4), Integer.valueOf(5), Integer.valueOf(6), Integer.valueOf(7) };
+ }
+ boolean doubleTabbed = tabs2.length > 0;
+
+ int compartmentPageWidth = 16 + 18 * inv.getPageSize() / 5;
+ int compartmentPageHeight = 106;
+ int compartmentWidth = compartmentPageWidth + (doubleTabbed ? 48 : 24);
+ int compartmentHeight = compartmentPageHeight;
+
+
+
+ Control controlCompartment = new Control(this, x, y, compartmentWidth, compartmentHeight);
+
+ final ControlTabBar<Integer> tab = new ControlTabBar(controlCompartment, 0.0F, 0.0F, 24.0F, compartmentPageHeight, Position.Left)
+ {
+ public ControlTab<Integer> createTab(float x, float y, float w, float h, Integer value)
+ {
+ new ControlTabIcon(this, x, y, w, h, value)
+ {
+ public ItemStack getItemStack()
+ {
+ return WindowCompartment.this.getTab(((Integer)this.value).intValue()).getIcon();
+ }
+
+ public String getName()
+ {
+ return WindowCompartment.this.getTab(((Integer)this.value).intValue()).getName();
+ }
+
+ public int getOutlineColour()
+ {
+ return WindowCompartment.this.getTab(((Integer)this.value).intValue()).getColor().getColour();
+ }
+
+ public boolean hasOutline()
+ {
+ return true;
+ }
+ };
+ }
+ };
+ String[] tabHelp = { "Compartment Tab", "Tabs that divide the inventory into sections. Each one can be labelled seperately." };
+
+ tab.addHelp(tabHelp);
+
+ tab.setValues(Arrays.asList(tabs1));
+ tab.setValue(Integer.valueOf(0));
+
+ tab.addEventHandler(new EventValueChanged.Handler()
+ {
+ public void onEvent(EventValueChanged event)
+ {
+ NBTTagCompound nbt = new NBTTagCompound();
+ int i = ((Integer)event.getValue()).intValue();
+ nbt.setByte("i", (byte)i);
+ Window.get(tab).sendClientAction("tab-change", nbt);
+ WindowCompartment.this.currentTab = i;
+ }
+ }.setOrigin(EventHandler.Origin.DirectChild, tab));
+
+
+
+
+ x += 24;
+
+ ControlPages<Integer> compartmentPages = new ControlPages(controlCompartment, 24.0F, 0.0F, compartmentPageWidth, compartmentPageHeight);
+
+ ControlPage[] page = new ControlPage[inv.getTabNumber()];
+ for (int p = 0; p < inv.getTabNumber(); p++) {
+ page[p] = new ControlPage(compartmentPages, Integer.valueOf(p));
+ }
+ CraftGUIUtil.linkWidgets(tab, compartmentPages);
+
+ int i = 0;
+ for (int p = 0; p < inv.getTabNumber(); p++)
+ {
+ ControlPage thisPage = page[p];
+
+ Panel panel = new Panel(thisPage, 0.0F, 0.0F, thisPage.w(), thisPage.h(), MinecraftGUI.PanelType.Black)
+ {
+ public void onRenderForeground()
+ {
+ Texture iTexture = CraftGUI.Render.getTexture(CraftGUITexture.TabOutline);
+
+ CraftGUI.Render.colour(WindowCompartment.this.getTab(((Integer)WindowCompartment.this.panels.get(this)).intValue()).getColor().getColour());
+
+ CraftGUI.Render.texture(iTexture, getArea().inset(3));
+ }
+ };
+ this.panels.put(panel, Integer.valueOf(p));
+
+ int[] slotsIDs = new int[inv.getPageSize()];
+ for (int k = 0; k < inv.getPageSize(); k++) {
+ slotsIDs[k] = (i++);
+ }
+ new ControlSlotArray(thisPage, 8, 8, inv.getPageSize() / 5, 5).create(slotsIDs);
+ }
+ x += compartmentPageWidth;
+ if (tabs2.length > 0)
+ {
+ ControlTabBar<Integer> tab2 = new ControlTabBar(controlCompartment, 24 + compartmentPageWidth, 0.0F, 24.0F, compartmentPageHeight, Position.Right)
+ {
+ public ControlTab<Integer> createTab(float x, float y, float w, float h, Integer value)
+ {
+ new ControlTabIcon(this, x, y, w, h, value)
+ {
+ public ItemStack getItemStack()
+ {
+ return WindowCompartment.this.getTab(((Integer)this.value).intValue()).getIcon();
+ }
+
+ public String getName()
+ {
+ return WindowCompartment.this.getTab(((Integer)this.value).intValue()).getName();
+ }
+
+ public int getOutlineColour()
+ {
+ return WindowCompartment.this.getTab(((Integer)this.value).intValue()).getColor().getColour();
+ }
+
+ public boolean hasOutline()
+ {
+ return true;
+ }
+ };
+ }
+ };
+ tab2.setValues(Arrays.asList(tabs2));
+ tab2.setValue(Integer.valueOf(0));
+ tab2.addHelp(tabHelp);
+
+ tab2.addEventHandler(new EventValueChanged.Handler()
+ {
+ public void onEvent(EventValueChanged event)
+ {
+ NBTTagCompound nbt = new NBTTagCompound();
+ int i = ((Integer)event.getValue()).intValue();
+ nbt.setByte("i", (byte)i);
+ Window.get(tab).sendClientAction("tab-change", nbt);
+ WindowCompartment.this.currentTab = i;
+ }
+ }.setOrigin(EventHandler.Origin.DirectChild, tab2));
+
+
+
+
+ CraftGUIUtil.linkWidgets(tab2, compartmentPages);
+
+ x += 24;
+ }
+ x += 16;
+
+ setSize(new IPoint(Math.max(32 + compartmentWidth, 252), h()));
+
+ controlCompartment.setPosition(new IPoint((w() - controlCompartment.w()) / 2.0F, controlCompartment.y()));
+
+
+
+ ControlPlayerInventory invent = new ControlPlayerInventory(this, true);
+
+ ControlSlide slide = new ControlSlide(this, 0.0F, 134.0F, 136.0F, 92.0F, Position.Left);
+ slide.setLabel("Tab Properties");
+ slide.setSlide(false);
+
+ slide.addHelp("Tab Properties");
+ slide.addHelp("The label, colour and icon of the Tab can be altered here. Clicking on the icon with a held item will change it.");
+
+ Panel tabPropertyPanel = new Panel(slide, 16.0F, 8.0F, 112.0F, 76.0F, MinecraftGUI.PanelType.Gray);
+
+ int y2 = 4;
+
+ new ControlText(tabPropertyPanel, new IPoint(4.0F, y2), "Tab Name:");
+ y2 += 12;this.tabName = new ControlTextEdit(tabPropertyPanel, 4.0F, y2, 104.0F, 12.0F);
+
+ this.tabName.addSelfEventHandler(new EventTextEdit.Handler()
+ {
+ public void onEvent(EventTextEdit event)
+ {
+ CompartmentTab tab = WindowCompartment.this.getCurrentTab();
+ tab.setName((String)event.getValue());
+ NBTTagCompound nbt = new NBTTagCompound();
+ tab.writeToNBT(nbt);
+ WindowCompartment.this.sendClientAction("comp-change-tab", nbt);
+ }
+ }.setOrigin(EventHandler.Origin.Self, this.tabName));
+
+
+
+
+ y2 += 20;
+
+ new ControlText(tabPropertyPanel, new IPoint(4.0F, y2), "Tab Icon: ");
+ this.tabIcon = new ControlItemDisplay(tabPropertyPanel, 58.0F, y2 - 4);
+ this.tabIcon.setItemStack(new ItemStack(Items.paper));
+ this.tabIcon.addAttribute(Attribute.MouseOver);
+ this.tabIcon.addSelfEventHandler(new EventMouse.Down.Handler()
+ {
+ public void onEvent(EventMouse.Down event)
+ {
+ if (WindowCompartment.this.getHeldItemStack() == null) {
+ return;
+ }
+ CompartmentTab tab = WindowCompartment.this.getCurrentTab();
+ ItemStack stack = WindowCompartment.this.getHeldItemStack().copy();
+ stack.stackSize = 1;
+ tab.setIcon(stack);
+ NBTTagCompound nbt = new NBTTagCompound();
+ tab.writeToNBT(nbt);
+ WindowCompartment.this.sendClientAction("comp-change-tab", nbt);
+ }
+ });
+ this.tabColour = new ControlColourSelector(tabPropertyPanel, 82.0F, y2 - 4, 16.0F, 16.0F, EnumColor.White);
+
+ this.tabIcon.addHelp("Icon for Current Tab");
+ this.tabIcon.addHelp("Click here with an item to change");
+
+ y2 += 20;
+
+ new ControlText(tabPropertyPanel, new IPoint(4.0F, y2), "Colour: ");
+
+ int cw = 8;
+
+ Panel panelColour = new Panel(tabPropertyPanel, 40.0F, y2 - 4, cw * 8 + 2, cw * 2 + 1, MinecraftGUI.PanelType.Gray);
+ for (int cc = 0; cc < 16; cc++)
+ {
+ final ControlColourSelector color = new ControlColourSelector(panelColour, 1 + cw * (cc % 8), 1 + cw * (cc / 8), cw, cw, EnumColor.values()[cc]);
+ color.addSelfEventHandler(new EventMouse.Down.Handler()
+ {
+ public void onEvent(EventMouse.Down event)
+ {
+ CompartmentTab tab = WindowCompartment.this.getCurrentTab();
+ tab.setColor(color.getValue());
+ NBTTagCompound nbt = new NBTTagCompound();
+ tab.writeToNBT(nbt);
+ WindowCompartment.this.sendClientAction("comp-change-tab", nbt);
+ }
+ });
+ color.addHelp("Colour Selector");
+ color.addHelp("Select a colour to highlight the current tab");
+ }
+ y2 += 20;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ControlButton searchButton = new ControlButton(controlCompartment, compartmentWidth - 24 - 64 - 8, compartmentPageHeight, 64.0F, 16.0F, "Search")
+ {
+ protected void onMouseClick(EventMouse.Down event)
+ {
+ WindowCompartment.this.createSearchDialog();
+ }
+
+ public void onRenderBackground()
+ {
+ Object texture = isMouseOver() ? CraftGUITexture.TabHighlighted : CraftGUITexture.Tab;
+ CraftGUI.Render.texture(CraftGUI.Render.getTexture(texture).crop(Position.Bottom, 8.0F), getArea());
+ }
+ };
+ searchButton.addHelp("Search Button");
+ searchButton.addHelp("Clicking this will open the Search dialog. This allows you to search the inventory for specific items.");
+ }
+
+ public void createSearchDialog()
+ {
+ new Dialog(this, 252.0F, 192.0F)
+ {
+ Control slotGrid;
+ String textSearch = "";
+ boolean sortByName = false;
+ boolean includeItems = true;
+ boolean includeBlocks = true;
+
+ public void onClose() {}
+
+ public void initialise()
+ {
+ ControlScrollableContent<IWidget> scroll = new ControlScrollableContent(this, 124.0F, 16.0F, 116.0F, 92.0F, 6.0F)
+ {
+ public void onRenderBackground()
+ {
+ CraftGUI.Render.colour(11184810);
+ CraftGUI.Render.texture(CraftGUITexture.Outline, getArea().inset(new IBorder(0.0F, 6.0F, 0.0F, 0.0F)));
+ }
+ };
+ this.slotGrid = new Control(scroll, 1.0F, 1.0F, 108.0F, 18.0F);
+
+ scroll.setScrollableContent(this.slotGrid);
+
+ new ControlPlayerInventory(this, true);
+
+ new ControlTextEdit(this, 16.0F, 16.0F, 100.0F, 14.0F).addEventHandler(new EventTextEdit.Handler()
+ {
+ public void onEvent(EventTextEdit event)
+ {
+ WindowCompartment.10.this.textSearch = ((String)event.value);
+ WindowCompartment.10.this.updateSearch();
+ }
+ });
+ this.includeItems = true;
+ this.includeBlocks = true;
+
+ new ControlCheckbox(this, 16.0F, 40.0F, 100.0F, "Sort A-Z", this.sortByName)
+ {
+ protected void onValueChanged(boolean value)
+ {
+ WindowCompartment.10.this.sortByName = value;
+ WindowCompartment.10.this.updateSearch();
+ }
+ };
+ new ControlCheckbox(this, 16.0F, 64.0F, 100.0F, "Include Items", this.includeItems)
+ {
+ protected void onValueChanged(boolean value)
+ {
+ WindowCompartment.10.this.includeItems = value;
+ WindowCompartment.10.this.updateSearch();
+ }
+ };
+ new ControlCheckbox(this, 16.0F, 88.0F, 100.0F, "Include Blocks", this.includeBlocks)
+ {
+ protected void onValueChanged(boolean value)
+ {
+ WindowCompartment.10.this.includeBlocks = value;
+ WindowCompartment.10.this.updateSearch();
+ }
+ };
+ updateSearch();
+ }
+
+ private void updateSearch()
+ {
+ Map<Integer, String> slotIds = new HashMap();
+ IInventory inv = WindowCompartment.this.getInventory();
+ for (int i = 0; i < inv.getSizeInventory(); i++)
+ {
+ ItemStack stack = inv.getStackInSlot(i);
+ if (stack != null)
+ {
+ String name = stack.getDisplayName().toLowerCase();
+ if ((this.textSearch == null) || (name.contains(this.textSearch))) {
+ if ((this.includeBlocks) || (Block.getBlockFromItem(stack.getItem()) == Blocks.air)) {
+ if ((this.includeItems) || (Block.getBlockFromItem(stack.getItem()) != Blocks.air)) {
+ slotIds.put(Integer.valueOf(i), name);
+ }
+ }
+ }
+ }
+ }
+ if (this.sortByName)
+ {
+ List list = new LinkedList(slotIds.entrySet());
+ Collections.sort(list, new Comparator()
+ {
+ public int compare(Object o1, Object o2)
+ {
+ return -((Comparable)((Map.Entry)o2).getValue()).compareTo(((Map.Entry)o1).getValue());
+ }
+ });
+ Map result = new LinkedHashMap();
+ for (Iterator it = list.iterator(); it.hasNext();)
+ {
+ Map.Entry entry = (Map.Entry)it.next();
+ result.put(entry.getKey(), entry.getValue());
+ }
+ slotIds = result;
+ }
+ int y = 0;
+ int x = 0;
+ int width = 108;
+ int height = 2 + 18 * (1 + (slotIds.size() - 1) / 6);
+ this.slotGrid.deleteAllChildren();
+ this.slotGrid.setSize(new IPoint(width, height));
+ for (Iterator i$ = slotIds.keySet().iterator(); i$.hasNext();)
+ {
+ int k = ((Integer)i$.next()).intValue();
+ new ControlSlot(this.slotGrid, x, y).assign(k);
+ x += 18;
+ if (x >= 108)
+ {
+ x = 0;
+ y += 18;
+ }
+ }
+ while ((y < 108) || (x != 0))
+ {
+ new ControlSlot(this.slotGrid, x, y);
+ x += 18;
+ if (x >= 108)
+ {
+ x = 0;
+ y += 18;
+ }
+ }
+ }
+ };
+ }
+
+ public void onUpdateClient()
+ {
+ super.onUpdateClient();
+ updateTabs();
+ }
+
+ public void updateTabs()
+ {
+ this.tabName.setValue(getCurrentTab().getName());
+ this.tabIcon.setItemStack(getCurrentTab().getIcon());
+ this.tabColour.setValue(getCurrentTab().getColor());
+ }
+
+ private int currentTab = 0;
+
+ public void recieveGuiNBT(Side side, EntityPlayer player, String name, NBTTagCompound action)
+ {
+ super.recieveGuiNBT(side, player, name, action);
+ if (name.equals("tab-change")) {
+ this.currentTab = action.getByte("i");
+ }
+ }
+
+ public String getTitle()
+ {
+ return "Compartment";
+ }
+
+ protected AbstractMod getMod()
+ {
+ return BinnieCore.instance;
+ }
+
+ protected String getName()
+ {
+ return "compartment";
+ }
+
+ public void alterRequest(TransferRequest request)
+ {
+ if (request.getDestination() == getInventory())
+ {
+ ComponentCompartmentInventory inv = (ComponentCompartmentInventory)Machine.getMachine(getInventory()).getInterface(ComponentCompartmentInventory.class);
+ request.setTargetSlots(inv.getSlotsForTab(this.currentTab));
+ }
+ }
+
+ public CompartmentTab getTab(int i)
+ {
+ return ((ComponentCompartmentInventory)Machine.getInterface(ComponentCompartmentInventory.class, getInventory())).getTab(i);
+ }
+
+ public CompartmentTab getCurrentTab()
+ {
+ return getTab(this.currentTab);
+ }
+}
diff --git a/src/Java/binnie/core/machines/storage/WindowTest.java b/src/Java/binnie/core/machines/storage/WindowTest.java
new file mode 100644
index 0000000000..55c2a0b9db
--- /dev/null
+++ b/src/Java/binnie/core/machines/storage/WindowTest.java
@@ -0,0 +1,40 @@
+package binnie.core.machines.storage;
+
+import binnie.core.AbstractMod;
+import binnie.core.BinnieCore;
+import binnie.craftgui.genetics.machine.WindowMachine;
+import binnie.craftgui.minecraft.Window;
+import cpw.mods.fml.relauncher.Side;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.IInventory;
+
+public class WindowTest
+ extends WindowMachine
+{
+ public static Window create(EntityPlayer player, IInventory inventory, Side side)
+ {
+ return new WindowCompartment(player, inventory, side);
+ }
+
+ public WindowTest(EntityPlayer player, IInventory inventory, Side side)
+ {
+ super(320, 240, player, inventory, side);
+ }
+
+ public void initialiseClient() {}
+
+ public String getTitle()
+ {
+ return "Test";
+ }
+
+ protected AbstractMod getMod()
+ {
+ return BinnieCore.instance;
+ }
+
+ protected String getName()
+ {
+ return "Test";
+ }
+}
diff --git a/src/Java/binnie/core/machines/transfer/TransferHandler.java b/src/Java/binnie/core/machines/transfer/TransferHandler.java
new file mode 100644
index 0000000000..8d8c2bdb57
--- /dev/null
+++ b/src/Java/binnie/core/machines/transfer/TransferHandler.java
@@ -0,0 +1,3 @@
+package binnie.core.machines.transfer;
+
+public class TransferHandler {}
diff --git a/src/Java/binnie/core/machines/transfer/TransferRequest.java b/src/Java/binnie/core/machines/transfer/TransferRequest.java
new file mode 100644
index 0000000000..8059a6b512
--- /dev/null
+++ b/src/Java/binnie/core/machines/transfer/TransferRequest.java
@@ -0,0 +1,419 @@
+package binnie.core.machines.transfer;
+
+import binnie.core.machines.Machine;
+import binnie.core.machines.inventory.IInventorySlots;
+import binnie.core.machines.inventory.IValidatedTankContainer;
+import binnie.core.machines.inventory.InventorySlot;
+import binnie.core.machines.power.ITankMachine;
+import java.util.ArrayList;
+import java.util.List;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.fluids.FluidContainerRegistry;
+import net.minecraftforge.fluids.FluidContainerRegistry.FluidContainerData;
+import net.minecraftforge.fluids.FluidStack;
+import net.minecraftforge.fluids.IFluidContainerItem;
+import net.minecraftforge.fluids.IFluidTank;
+
+public class TransferRequest
+{
+ private ItemStack itemToTransfer = null;
+ private ItemStack returnItem = null;
+ private IInventory origin;
+ private IInventory destination;
+ private int[] targetSlots = new int[0];
+ private int[] targetTanks = new int[0];
+ private boolean transferLiquids = true;
+ private boolean ignoreReadOnly = false;
+
+ public TransferRequest(ItemStack toTransfer, IInventory destination)
+ {
+ int[] target = new int[destination.getSizeInventory()];
+ for (int i = 0; i < target.length; i++) {
+ target[i] = i;
+ }
+ int[] targetTanks = new int[0];
+ if ((destination instanceof ITankMachine))
+ {
+ targetTanks = new int[((ITankMachine)destination).getTanks().length];
+ for (int i = 0; i < targetTanks.length; i++) {
+ targetTanks[i] = i;
+ }
+ }
+ if (toTransfer != null)
+ {
+ setItemToTransfer(toTransfer.copy());
+ setReturnItem(toTransfer.copy());
+ }
+ setOrigin(null);
+ setDestination(destination);
+ setTargetSlots(target);
+ setTargetTanks(targetTanks);
+ this.transferLiquids = true;
+ }
+
+ private void setItemToTransfer(ItemStack itemToTransfer)
+ {
+ this.itemToTransfer = itemToTransfer;
+ }
+
+ private void setReturnItem(ItemStack returnItem)
+ {
+ this.returnItem = returnItem;
+ }
+
+ public TransferRequest setOrigin(IInventory origin)
+ {
+ this.origin = origin;
+ return this;
+ }
+
+ private void setDestination(IInventory destination)
+ {
+ this.destination = destination;
+ }
+
+ public TransferRequest setTargetSlots(int[] targetSlots)
+ {
+ this.targetSlots = targetSlots;
+ return this;
+ }
+
+ public TransferRequest setTargetTanks(int[] targetTanks)
+ {
+ this.targetTanks = targetTanks;
+ return this;
+ }
+
+ public TransferRequest ignoreValidation()
+ {
+ this.ignoreReadOnly = true;
+ return this;
+ }
+
+ public ItemStack getReturnItem()
+ {
+ return this.returnItem;
+ }
+
+ public ItemStack transfer(boolean doAdd)
+ {
+ ItemStack item = this.returnItem;
+ if ((item == null) || (this.destination == null)) {
+ return null;
+ }
+ if ((this.transferLiquids) && ((this.destination instanceof ITankMachine))) {
+ for (int tankID : this.targetTanks)
+ {
+ item = transferToTank(item, this.origin, (ITankMachine)this.destination, tankID, doAdd);
+ if (item != null) {
+ item = transferFromTank(item, this.origin, (ITankMachine)this.destination, tankID, doAdd);
+ }
+ }
+ }
+ if (item != null) {
+ for (int slot : this.targetSlots) {
+ if ((this.destination.isItemValidForSlot(slot, item)) || (this.ignoreReadOnly)) {
+ if ((!(this.destination instanceof IInventorySlots)) || (((IInventorySlots)this.destination).getSlot(slot) == null) || (!((IInventorySlots)this.destination).getSlot(slot).isRecipe())) {
+ if (this.destination.getStackInSlot(slot) != null) {
+ if (item.isStackable())
+ {
+ ItemStack merged = this.destination.getStackInSlot(slot).copy();
+ ItemStack[] newStacks = mergeStacks(item.copy(), merged.copy());
+ item = newStacks[0];
+ if (!areItemsEqual(merged, newStacks[1])) {
+ this.insertedSlots.add(new TransferSlot(slot, this.destination));
+ }
+ if (doAdd) {
+ this.destination.setInventorySlotContents(slot, newStacks[1]);
+ }
+ if (item == null) {
+ return null;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ if (item != null) {
+ for (int slot : this.targetSlots) {
+ if ((this.destination.isItemValidForSlot(slot, item)) || (this.ignoreReadOnly)) {
+ if ((!(this.destination instanceof IInventorySlots)) || (((IInventorySlots)this.destination).getSlot(slot) == null) || (!((IInventorySlots)this.destination).getSlot(slot).isRecipe())) {
+ if ((this.destination.getStackInSlot(slot) == null) && (item != null))
+ {
+ this.insertedSlots.add(new TransferSlot(slot, this.destination));
+ if (doAdd) {
+ this.destination.setInventorySlotContents(slot, item.copy());
+ }
+ return null;
+ }
+ }
+ }
+ }
+ }
+ setReturnItem(item);
+ return getReturnItem();
+ }
+
+ private static boolean areItemsEqual(ItemStack merged, ItemStack itemstack)
+ {
+ return (ItemStack.areItemStackTagsEqual(itemstack, merged)) && (itemstack.isItemEqual(merged));
+ }
+
+ public static ItemStack[] mergeStacks(ItemStack itemstack, ItemStack merged)
+ {
+ if (areItemsEqual(itemstack, merged))
+ {
+ int space = merged.getMaxStackSize() - merged.stackSize;
+ if (space > 0) {
+ if (itemstack.stackSize > space)
+ {
+ itemstack.stackSize -= space;
+ merged.stackSize += space;
+ }
+ else if (itemstack.stackSize <= space)
+ {
+ merged.stackSize += itemstack.stackSize;
+ itemstack = null;
+ }
+ }
+ }
+ return new ItemStack[] { itemstack, merged };
+ }
+
+ private ItemStack transferToTank(ItemStack item, IInventory origin, ITankMachine destination, int tankID, boolean doAdd)
+ {
+ item = transferToTankUsingContainerData(item, origin, destination, tankID, doAdd);
+ item = transferToTankUsingFluidContainer(item, origin, destination, tankID, doAdd);
+ return item;
+ }
+
+ private ItemStack transferToTankUsingFluidContainer(ItemStack item, IInventory origin, ITankMachine destination, int tankID, boolean doAdd)
+ {
+ if ((item == null) || (!(item.getItem() instanceof IFluidContainerItem))) {
+ return item;
+ }
+ IFluidContainerItem fluidContainer = (IFluidContainerItem)item.getItem();
+ FluidStack fluid = fluidContainer.getFluid(item);
+ if (fluid == null) {
+ return item;
+ }
+ IFluidTank tank = destination.getTanks()[tankID];
+
+ IValidatedTankContainer validated = (IValidatedTankContainer)Machine.getInterface(IValidatedTankContainer.class, destination);
+ if ((validated != null) && ((!validated.isLiquidValidForTank(fluid, tankID)) || (validated.isTankReadOnly(tankID)))) {
+ return item;
+ }
+ int maxFill = tank.fill(fluid, false);
+
+ FluidStack toTake = fluidContainer.drain(item, maxFill, true);
+ if (doAdd) {
+ tank.fill(toTake, true);
+ }
+ return item;
+ }
+
+ private ItemStack transferToTankUsingContainerData(ItemStack item, IInventory origin, ITankMachine destination, int tankID, boolean doAdd)
+ {
+ if (item == null) {
+ return item;
+ }
+ FluidStack containerLiquid = null;
+ FluidContainerRegistry.FluidContainerData containerLiquidData = null;
+ for (FluidContainerRegistry.FluidContainerData data : FluidContainerRegistry.getRegisteredFluidContainerData()) {
+ if (data.filledContainer.isItemEqual(item))
+ {
+ containerLiquidData = data;
+ containerLiquid = data.fluid.copy();
+ break;
+ }
+ }
+ if (containerLiquid == null) {
+ return item;
+ }
+ IFluidTank tank = destination.getTanks()[tankID];
+
+ IValidatedTankContainer validated = (IValidatedTankContainer)Machine.getInterface(IValidatedTankContainer.class, destination);
+ if ((validated != null) && (
+ (!validated.isLiquidValidForTank(containerLiquid, tankID)) || (validated.isTankReadOnly(tankID)))) {
+ return item;
+ }
+ FluidStack largeAmountOfLiquid = containerLiquid.copy();
+ largeAmountOfLiquid.amount = tank.getCapacity();
+ int amountAdded = tank.fill(largeAmountOfLiquid, false);
+
+ int numberOfContainersToAdd = amountAdded / containerLiquid.amount;
+ if (numberOfContainersToAdd > item.stackSize) {
+ numberOfContainersToAdd = item.stackSize;
+ }
+ ItemStack leftOverContainers = item.copy();
+ leftOverContainers.stackSize -= numberOfContainersToAdd;
+ if (leftOverContainers.stackSize <= 0) {
+ leftOverContainers = null;
+ }
+ ItemStack emptyContainers = containerLiquidData.emptyContainer.copy();
+ emptyContainers.stackSize = 0;
+ emptyContainers.stackSize += numberOfContainersToAdd;
+ if (emptyContainers.stackSize <= 0) {
+ emptyContainers = null;
+ }
+ TransferRequest containersDump = new TransferRequest(emptyContainers, origin);
+
+ ItemStack containersThatCantBeDumped = containersDump.transfer(false);
+ if (containersThatCantBeDumped != null) {
+ return item;
+ }
+ if (doAdd)
+ {
+ FluidStack liquidToFillTank = containerLiquid.copy();
+ liquidToFillTank.amount *= numberOfContainersToAdd;
+ tank.fill(liquidToFillTank, true);
+ containersDump.transfer(true);
+ }
+ return leftOverContainers;
+ }
+
+ private ItemStack transferFromTank(ItemStack item, IInventory origin, ITankMachine destination, int tankID, boolean doAdd)
+ {
+ item = transferFromTankUsingContainerData(item, origin, destination, tankID, doAdd);
+ item = transferFromTankUsingFluidContainer(item, origin, destination, tankID, doAdd);
+ return item;
+ }
+
+ private ItemStack transferFromTankUsingFluidContainer(ItemStack item, IInventory origin, ITankMachine destination, int tankID, boolean doAdd)
+ {
+ if ((item == null) || (!(item.getItem() instanceof IFluidContainerItem))) {
+ return item;
+ }
+ IFluidContainerItem fluidContainer = (IFluidContainerItem)item.getItem();
+
+ IFluidTank tank = destination.getTanks()[tankID];
+
+ FluidStack fluid = tank.getFluid();
+ if (fluid == null) {
+ return item;
+ }
+ int amount = fluidContainer.fill(item, fluid, false);
+
+ amount = Math.min(amount, tank.drain(amount, false) == null ? 0 : tank.drain(amount, false).amount);
+ if (amount <= 0) {
+ return item;
+ }
+ fluidContainer.fill(item, tank.drain(amount, doAdd), doAdd);
+
+ return item;
+ }
+
+ private ItemStack transferFromTankUsingContainerData(ItemStack item, IInventory origin, ITankMachine destination, int tankID, boolean doAdd)
+ {
+ if (item == null) {
+ return item;
+ }
+ IFluidTank tank = destination.getTanks()[tankID];
+ FluidStack liquidInTank = tank.getFluid();
+ if (liquidInTank == null) {
+ return item;
+ }
+ FluidContainerRegistry.FluidContainerData containerLiquidData = null;
+ for (FluidContainerRegistry.FluidContainerData data : FluidContainerRegistry.getRegisteredFluidContainerData()) {
+ if ((data.emptyContainer.isItemEqual(item)) && (liquidInTank.isFluidEqual(data.fluid)))
+ {
+ containerLiquidData = data;
+ break;
+ }
+ }
+ FluidStack fluid = null;
+ ItemStack filled = null;
+ if (containerLiquidData != null)
+ {
+ fluid = containerLiquidData.fluid;
+ filled = containerLiquidData.filledContainer;
+ }
+ if ((fluid == null) || (filled == null)) {
+ return item;
+ }
+ int maximumExtractedLiquid = item.stackSize * fluid.amount;
+
+ FluidStack drainedLiquid = tank.drain(maximumExtractedLiquid, false);
+ int amountInTank = drainedLiquid == null ? 0 : drainedLiquid.amount;
+
+ int numberOfContainersToFill = amountInTank / fluid.amount;
+ if (numberOfContainersToFill > item.stackSize) {
+ numberOfContainersToFill = item.stackSize;
+ }
+ ItemStack leftOverContainers = item.copy();
+ leftOverContainers.stackSize -= numberOfContainersToFill;
+ if (leftOverContainers.stackSize <= 0) {
+ leftOverContainers = null;
+ }
+ ItemStack filledContainers = filled.copy();
+ filledContainers.stackSize = 0;
+ filledContainers.stackSize += numberOfContainersToFill;
+ if (filledContainers.stackSize <= 0) {
+ filledContainers = null;
+ }
+ TransferRequest containersDump = new TransferRequest(filledContainers, origin);
+
+ ItemStack containersThatCantBeDumped = containersDump.transfer(false);
+ if (containersThatCantBeDumped != null) {
+ return item;
+ }
+ if (doAdd)
+ {
+ tank.drain(maximumExtractedLiquid, true);
+ containersDump.transfer(true);
+ }
+ return leftOverContainers;
+ }
+
+ private List<TransferSlot> insertedSlots = new ArrayList();
+ private List<Integer> insertedTanks = new ArrayList();
+
+ public List<TransferSlot> getInsertedSlots()
+ {
+ return this.insertedSlots;
+ }
+
+ public List<Integer> getInsertedTanks()
+ {
+ return this.insertedTanks;
+ }
+
+ public static class TransferSlot
+ {
+ public int id;
+ public IInventory inventory;
+
+ public TransferSlot(int id, IInventory inventory)
+ {
+ this.id = id;
+ this.inventory = inventory;
+ }
+ }
+
+ public IInventory getOrigin()
+ {
+ return this.origin;
+ }
+
+ public IInventory getDestination()
+ {
+ return this.destination;
+ }
+
+ public ItemStack getItemToTransfer()
+ {
+ return this.itemToTransfer;
+ }
+
+ public int[] getTargetSlots()
+ {
+ return this.targetSlots;
+ }
+
+ public int[] getTargetTanks()
+ {
+ return this.targetTanks;
+ }
+}
diff --git a/src/Java/binnie/core/mod/config/BinnieConfiguration.java b/src/Java/binnie/core/mod/config/BinnieConfiguration.java
new file mode 100644
index 0000000000..09e5a657da
--- /dev/null
+++ b/src/Java/binnie/core/mod/config/BinnieConfiguration.java
@@ -0,0 +1,21 @@
+package binnie.core.mod.config;
+
+import binnie.core.AbstractMod;
+import binnie.core.BinnieCore;
+import binnie.core.proxy.BinnieProxy;
+import java.io.File;
+import net.minecraftforge.common.config.Configuration;
+
+class BinnieConfiguration
+ extends Configuration
+{
+ public AbstractMod mod;
+ private String filename;
+
+ public BinnieConfiguration(String filename, AbstractMod mod)
+ {
+ super(new File(BinnieCore.proxy.getDirectory(), filename));
+ this.mod = mod;
+ this.filename = filename;
+ }
+}
diff --git a/src/Java/binnie/core/mod/config/BinnieItemData.java b/src/Java/binnie/core/mod/config/BinnieItemData.java
new file mode 100644
index 0000000000..435edc122d
--- /dev/null
+++ b/src/Java/binnie/core/mod/config/BinnieItemData.java
@@ -0,0 +1,15 @@
+package binnie.core.mod.config;
+
+class BinnieItemData
+{
+ private int item;
+ private BinnieConfiguration configFile;
+ private String configKey;
+
+ public BinnieItemData(int item, BinnieConfiguration configFile, String configKey)
+ {
+ this.item = item;
+ this.configFile = configFile;
+ this.configKey = configKey;
+ }
+}
diff --git a/src/Java/binnie/core/mod/config/ConfigFile.java b/src/Java/binnie/core/mod/config/ConfigFile.java
new file mode 100644
index 0000000000..425ee52e98
--- /dev/null
+++ b/src/Java/binnie/core/mod/config/ConfigFile.java
@@ -0,0 +1,11 @@
+package binnie.core.mod.config;
+
+import java.lang.annotation.Annotation;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+@Retention(RetentionPolicy.RUNTIME)
+public @interface ConfigFile
+{
+ String filename();
+}
diff --git a/src/Java/binnie/core/mod/config/ConfigProperty.java b/src/Java/binnie/core/mod/config/ConfigProperty.java
new file mode 100644
index 0000000000..d8e5f48339
--- /dev/null
+++ b/src/Java/binnie/core/mod/config/ConfigProperty.java
@@ -0,0 +1,26 @@
+package binnie.core.mod.config;
+
+import java.lang.annotation.Annotation;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target({java.lang.annotation.ElementType.FIELD})
+public @interface ConfigProperty
+{
+ String key();
+
+ String category() default "";
+
+ String[] comment() default {};
+
+ @Retention(RetentionPolicy.RUNTIME)
+ @Target({java.lang.annotation.ElementType.ANNOTATION_TYPE})
+ public static @interface Type
+ {
+ Class<? extends PropertyBase> propertyClass();
+
+ String category() default "general";
+ }
+}
diff --git a/src/Java/binnie/core/mod/config/ConfigurationMain.java b/src/Java/binnie/core/mod/config/ConfigurationMain.java
new file mode 100644
index 0000000000..e7924abe47
--- /dev/null
+++ b/src/Java/binnie/core/mod/config/ConfigurationMain.java
@@ -0,0 +1,4 @@
+package binnie.core.mod.config;
+
+@ConfigFile(filename="/config/forestry/binniecore/main.conf")
+public class ConfigurationMain {}
diff --git a/src/Java/binnie/core/mod/config/ConfigurationMods.java b/src/Java/binnie/core/mod/config/ConfigurationMods.java
new file mode 100644
index 0000000000..77c2f66930
--- /dev/null
+++ b/src/Java/binnie/core/mod/config/ConfigurationMods.java
@@ -0,0 +1,18 @@
+package binnie.core.mod.config;
+
+@ConfigFile(filename="/config/forestry/binnie-mods.conf")
+public class ConfigurationMods
+{
+ @ConfigProperty(key="extraBees", comment={"Enables the Extra Bees Mod."})
+ @PropBoolean
+ public static boolean extraBees = true;
+ @ConfigProperty(key="extraTrees", comment={"Enables the Extra Trees Mod."})
+ @PropBoolean
+ public static boolean extraTrees = true;
+ @ConfigProperty(key="botany", comment={"Enables the Botany Mod."})
+ @PropBoolean
+ public static boolean botany = true;
+ @ConfigProperty(key="genetics", comment={"Enables the Genetics Mod."})
+ @PropBoolean
+ public static boolean genetics = true;
+}
diff --git a/src/Java/binnie/core/mod/config/ManagerConfig.java b/src/Java/binnie/core/mod/config/ManagerConfig.java
new file mode 100644
index 0000000000..16e6df78f4
--- /dev/null
+++ b/src/Java/binnie/core/mod/config/ManagerConfig.java
@@ -0,0 +1,71 @@
+package binnie.core.mod.config;
+
+import binnie.core.AbstractMod;
+import binnie.core.ManagerBase;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import net.minecraftforge.common.config.Configuration;
+
+public class ManagerConfig
+ extends ManagerBase
+{
+ private Map<Class<?>, Configuration> configurations = new LinkedHashMap();
+
+ public void registerConfiguration(Class<?> cls, AbstractMod mod)
+ {
+ if (cls.isAnnotationPresent(ConfigFile.class)) {
+ loadConfiguration(cls, mod);
+ }
+ }
+
+ public void loadConfiguration(Class<?> cls, AbstractMod mod)
+ {
+ try
+ {
+ String filename = ((ConfigFile)cls.getAnnotation(ConfigFile.class)).filename();
+
+
+ BinnieConfiguration config = new BinnieConfiguration(filename, mod);
+
+ config.load();
+ for (Field field : cls.getFields()) {
+ if (field.isAnnotationPresent(ConfigProperty.class))
+ {
+ ConfigProperty propertyAnnot = (ConfigProperty)field.getAnnotation(ConfigProperty.class);
+ PropertyBase property;
+ for (Annotation annotation : field.getAnnotations()) {
+ if (annotation.annotationType().isAnnotationPresent(ConfigProperty.Type.class))
+ {
+ Class<?> propertyClass = ((ConfigProperty.Type)annotation.annotationType().getAnnotation(ConfigProperty.Type.class)).propertyClass();
+
+ property = (PropertyBase)propertyClass.getConstructor(new Class[] { Field.class, BinnieConfiguration.class, ConfigProperty.class, annotation.annotationType() }).newInstance(new Object[] { field, config, propertyAnnot, annotation.annotationType().cast(annotation) });
+ }
+ }
+ }
+ }
+ config.save();
+
+ this.configurations.put(cls, config);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ private Map<AbstractMod, List<BinnieItemData>> itemIDs = new HashMap();
+
+ public void addItemID(Integer configValue, String configKey, BinnieConfiguration configFile)
+ {
+ if (!this.itemIDs.containsKey(configFile.mod)) {
+ this.itemIDs.put(configFile.mod, new ArrayList());
+ }
+ ((List)this.itemIDs.get(configFile.mod)).add(new BinnieItemData(configValue.intValue() + 256, configFile, configKey));
+ }
+}
diff --git a/src/Java/binnie/core/mod/config/PropBoolean.java b/src/Java/binnie/core/mod/config/PropBoolean.java
new file mode 100644
index 0000000000..fc9094bdd8
--- /dev/null
+++ b/src/Java/binnie/core/mod/config/PropBoolean.java
@@ -0,0 +1,38 @@
+package binnie.core.mod.config;
+
+import java.lang.annotation.Annotation;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.reflect.Field;
+import net.minecraftforge.common.config.Configuration;
+import net.minecraftforge.common.config.Property;
+
+@Retention(RetentionPolicy.RUNTIME)
+@ConfigProperty.Type(propertyClass=PropertyBoolean.class)
+public @interface PropBoolean
+{
+ public static class PropertyBoolean
+ extends PropertyBase<Boolean, PropBoolean>
+ {
+ public PropertyBoolean(Field field, BinnieConfiguration file, ConfigProperty configProperty, PropBoolean annotedProperty)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ super(file, configProperty, annotedProperty);
+ }
+
+ protected Property getProperty()
+ {
+ return this.file.get(getCategory(), getKey(), ((Boolean)this.defaultValue).booleanValue());
+ }
+
+ protected Boolean getConfigValue()
+ {
+ return Boolean.valueOf(this.property.getBoolean(((Boolean)this.defaultValue).booleanValue()));
+ }
+
+ protected void addComments()
+ {
+ addComment("Default value is " + this.defaultValue + ".");
+ }
+ }
+}
diff --git a/src/Java/binnie/core/mod/config/PropDouble.java b/src/Java/binnie/core/mod/config/PropDouble.java
new file mode 100644
index 0000000000..331cd2774c
--- /dev/null
+++ b/src/Java/binnie/core/mod/config/PropDouble.java
@@ -0,0 +1,38 @@
+package binnie.core.mod.config;
+
+import java.lang.annotation.Annotation;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.reflect.Field;
+import net.minecraftforge.common.config.Configuration;
+import net.minecraftforge.common.config.Property;
+
+@Retention(RetentionPolicy.RUNTIME)
+@ConfigProperty.Type(propertyClass=PropertyDouble.class)
+public @interface PropDouble
+{
+ public static class PropertyDouble
+ extends PropertyBase<Double, PropDouble>
+ {
+ public PropertyDouble(Field field, BinnieConfiguration file, ConfigProperty configProperty, PropDouble annotedProperty)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ super(file, configProperty, annotedProperty);
+ }
+
+ protected Property getProperty()
+ {
+ return this.file.get(getCategory(), getKey(), ((Double)this.defaultValue).doubleValue());
+ }
+
+ protected Double getConfigValue()
+ {
+ return Double.valueOf(this.property.getDouble(((Double)this.defaultValue).doubleValue()));
+ }
+
+ protected void addComments()
+ {
+ addComment("Default value is " + this.defaultValue + ".");
+ }
+ }
+}
diff --git a/src/Java/binnie/core/mod/config/PropInteger.java b/src/Java/binnie/core/mod/config/PropInteger.java
new file mode 100644
index 0000000000..f74c625a8c
--- /dev/null
+++ b/src/Java/binnie/core/mod/config/PropInteger.java
@@ -0,0 +1,38 @@
+package binnie.core.mod.config;
+
+import java.lang.annotation.Annotation;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.reflect.Field;
+import net.minecraftforge.common.config.Configuration;
+import net.minecraftforge.common.config.Property;
+
+@Retention(RetentionPolicy.RUNTIME)
+@ConfigProperty.Type(propertyClass=PropertyInteger.class)
+public @interface PropInteger
+{
+ public static class PropertyInteger
+ extends PropertyBase<Integer, PropInteger>
+ {
+ public PropertyInteger(Field field, BinnieConfiguration file, ConfigProperty configProperty, PropInteger annotedProperty)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ super(file, configProperty, annotedProperty);
+ }
+
+ protected Property getProperty()
+ {
+ return this.file.get(getCategory(), getKey(), ((Integer)this.defaultValue).intValue());
+ }
+
+ protected Integer getConfigValue()
+ {
+ return Integer.valueOf(this.property.getInt(((Integer)this.defaultValue).intValue()));
+ }
+
+ protected void addComments()
+ {
+ addComment("Default value is " + this.defaultValue + ".");
+ }
+ }
+}
diff --git a/src/Java/binnie/core/mod/config/PropPercentage.java b/src/Java/binnie/core/mod/config/PropPercentage.java
new file mode 100644
index 0000000000..b51d8e3abf
--- /dev/null
+++ b/src/Java/binnie/core/mod/config/PropPercentage.java
@@ -0,0 +1,43 @@
+package binnie.core.mod.config;
+
+import java.lang.annotation.Annotation;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.reflect.Field;
+import net.minecraftforge.common.config.Configuration;
+import net.minecraftforge.common.config.Property;
+
+@Retention(RetentionPolicy.RUNTIME)
+@ConfigProperty.Type(propertyClass=PropertyPercentage.class)
+public @interface PropPercentage
+{
+ int upper() default 100;
+
+ int lower() default 0;
+
+ public static class PropertyPercentage
+ extends PropertyBase<Integer, PropPercentage>
+ {
+ public PropertyPercentage(Field field, BinnieConfiguration file, ConfigProperty configProperty, PropPercentage annotedProperty)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ super(file, configProperty, annotedProperty);
+ }
+
+ protected Integer getConfigValue()
+ {
+ return Integer.valueOf(this.property.getInt(((Integer)this.defaultValue).intValue()));
+ }
+
+ protected void addComments()
+ {
+ addComment("Default value is " + this.defaultValue + "%.");
+ addComment("Range is " + ((PropPercentage)this.annotatedProperty).lower() + "-" + ((PropPercentage)this.annotatedProperty).upper() + "%.");
+ }
+
+ protected Property getProperty()
+ {
+ return this.file.get(getCategory(), getKey(), ((Integer)this.defaultValue).intValue());
+ }
+ }
+}
diff --git a/src/Java/binnie/core/mod/config/PropertyBase.java b/src/Java/binnie/core/mod/config/PropertyBase.java
new file mode 100644
index 0000000000..8ad13f833e
--- /dev/null
+++ b/src/Java/binnie/core/mod/config/PropertyBase.java
@@ -0,0 +1,72 @@
+package binnie.core.mod.config;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.List;
+import net.minecraftforge.common.config.Configuration;
+import net.minecraftforge.common.config.Property;
+
+abstract class PropertyBase<ValueType, AnnotationType extends Annotation>
+{
+ Configuration file;
+ Property property;
+ ValueType defaultValue;
+ private ConfigProperty configProperty;
+ AnnotationType annotatedProperty;
+ private List<String> comments = new ArrayList();
+ private Field field;
+
+ protected PropertyBase(Field field, BinnieConfiguration file, ConfigProperty configProperty, AnnotationType annotedProperty)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ this.field = field;
+ this.file = file;
+ this.configProperty = configProperty;
+ this.annotatedProperty = annotedProperty;
+ this.defaultValue = getDefaultValue(field);
+ this.property = getProperty();
+ for (String comment : configProperty.comment()) {
+ addComment(comment);
+ }
+ addComments();
+ this.property.comment = getComment();
+ field.set(null, getConfigValue());
+ }
+
+ protected abstract Property getProperty();
+
+ protected abstract ValueType getConfigValue();
+
+ protected abstract void addComments();
+
+ protected String getCategory()
+ {
+ return this.configProperty.category().equals("") ? ((ConfigProperty.Type)this.annotatedProperty.annotationType().getAnnotation(ConfigProperty.Type.class)).category() : this.configProperty.category();
+ }
+
+ protected String getKey()
+ {
+ return this.configProperty.key();
+ }
+
+ protected ValueType getDefaultValue(Field field)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ return field.get(null);
+ }
+
+ protected void addComment(String comment)
+ {
+ this.comments.add(comment);
+ }
+
+ protected String getComment()
+ {
+ String comment = "";
+ for (String com : this.comments) {
+ comment = comment + com + " ";
+ }
+ return comment;
+ }
+}
diff --git a/src/Java/binnie/core/mod/parser/FieldParser.java b/src/Java/binnie/core/mod/parser/FieldParser.java
new file mode 100644
index 0000000000..c063d5aca9
--- /dev/null
+++ b/src/Java/binnie/core/mod/parser/FieldParser.java
@@ -0,0 +1,55 @@
+package binnie.core.mod.parser;
+
+import binnie.core.AbstractMod;
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.Collection;
+
+public abstract class FieldParser
+{
+ public static Collection<FieldParser> parsers = new ArrayList();
+
+ public abstract boolean isHandled(Field paramField, AbstractMod paramAbstractMod);
+
+ public void preInit(Field field, AbstractMod mod)
+ throws IllegalArgumentException, IllegalAccessException
+ {}
+
+ public void init(Field field, AbstractMod mod)
+ throws IllegalArgumentException, IllegalAccessException
+ {}
+
+ public void postInit(Field field, AbstractMod mod)
+ throws IllegalArgumentException, IllegalAccessException
+ {}
+
+ public static void preInitParse(Field field, AbstractMod mod)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ for (FieldParser parser : parsers) {
+ if (parser.isHandled(field, mod)) {
+ parser.preInit(field, mod);
+ }
+ }
+ }
+
+ public static void initParse(Field field, AbstractMod mod)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ for (FieldParser parser : parsers) {
+ if (parser.isHandled(field, mod)) {
+ parser.init(field, mod);
+ }
+ }
+ }
+
+ public static void postInitParse(Field field, AbstractMod mod)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ for (FieldParser parser : parsers) {
+ if (parser.isHandled(field, mod)) {
+ parser.postInit(field, mod);
+ }
+ }
+ }
+}
diff --git a/src/Java/binnie/core/mod/parser/ItemParser.java b/src/Java/binnie/core/mod/parser/ItemParser.java
new file mode 100644
index 0000000000..8892a20aba
--- /dev/null
+++ b/src/Java/binnie/core/mod/parser/ItemParser.java
@@ -0,0 +1,24 @@
+package binnie.core.mod.parser;
+
+import binnie.core.AbstractMod;
+import cpw.mods.fml.common.registry.GameRegistry;
+import java.lang.reflect.Field;
+import net.minecraft.item.Item;
+
+public class ItemParser
+ extends FieldParser
+{
+ public boolean isHandled(Field field, AbstractMod mod)
+ {
+ return Item.class.isAssignableFrom(field.getType());
+ }
+
+ public void preInit(Field field, AbstractMod mod)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ Item item = (Item)field.get(null);
+ if (item != null) {
+ GameRegistry.registerItem(item, item.getUnlocalizedName().substring(5));
+ }
+ }
+}
diff --git a/src/Java/binnie/core/multiblock/BlockMultiblockMachine.java b/src/Java/binnie/core/multiblock/BlockMultiblockMachine.java
new file mode 100644
index 0000000000..c2c549e1bd
--- /dev/null
+++ b/src/Java/binnie/core/multiblock/BlockMultiblockMachine.java
@@ -0,0 +1,27 @@
+package binnie.core.multiblock;
+
+import net.minecraft.block.BlockContainer;
+import net.minecraft.block.material.Material;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.world.World;
+
+public class BlockMultiblockMachine
+ extends BlockContainer
+{
+ public BlockMultiblockMachine(String blockName)
+ {
+ super(Material.iron);
+ setHardness(1.5F);
+ setBlockName(blockName);
+ }
+
+ public TileEntity createTileEntity(World world, int metadata)
+ {
+ return new TileEntityMultiblockMachine();
+ }
+
+ public TileEntity createNewTileEntity(World var1, int i)
+ {
+ return new TileEntityMultiblockMachine();
+ }
+}
diff --git a/src/Java/binnie/core/multiblock/TileEntityMultiblockMachine.java b/src/Java/binnie/core/multiblock/TileEntityMultiblockMachine.java
new file mode 100644
index 0000000000..0aaefc91c4
--- /dev/null
+++ b/src/Java/binnie/core/multiblock/TileEntityMultiblockMachine.java
@@ -0,0 +1,37 @@
+package binnie.core.multiblock;
+
+import binnie.core.machines.Machine;
+import binnie.core.machines.TileEntityMachine;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.world.World;
+
+class TileEntityMultiblockMachine
+ extends TileEntity
+{
+ private boolean inStructure;
+ private int tileX;
+ private int tileY;
+ private int tileZ;
+
+ boolean inStructure()
+ {
+ return this.inStructure;
+ }
+
+ public Machine getMachine()
+ {
+ return getMasterMachine();
+ }
+
+ private Machine getMasterMachine()
+ {
+ if (!this.inStructure) {
+ return null;
+ }
+ TileEntity tile = this.worldObj.getTileEntity(this.xCoord + this.tileX, this.yCoord + this.tileY, this.zCoord + this.tileZ);
+ if ((tile instanceof TileEntityMachine)) {
+ return ((TileEntityMachine)tile).getMachine();
+ }
+ return null;
+ }
+}
diff --git a/src/Java/binnie/core/network/BinnieCorePacketID.java b/src/Java/binnie/core/network/BinnieCorePacketID.java
new file mode 100644
index 0000000000..669065ca45
--- /dev/null
+++ b/src/Java/binnie/core/network/BinnieCorePacketID.java
@@ -0,0 +1,77 @@
+package binnie.core.network;
+
+import binnie.core.BinnieCore;
+import binnie.core.block.TileEntityMetadata;
+import binnie.core.machines.IMachine;
+import binnie.core.machines.Machine;
+import binnie.core.machines.network.INetwork.TilePacketSync;
+import binnie.core.network.packet.MessageBinnie;
+import binnie.core.network.packet.MessageCraftGUI;
+import binnie.core.network.packet.MessageMetadata;
+import binnie.core.network.packet.MessageTileNBT;
+import binnie.core.network.packet.MessageUpdate;
+import binnie.core.proxy.BinnieProxy;
+import binnie.craftgui.minecraft.ContainerCraftGUI;
+import cpw.mods.fml.common.network.simpleimpl.MessageContext;
+import cpw.mods.fml.relauncher.Side;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.network.NetHandlerPlayServer;
+import net.minecraft.tileentity.TileEntity;
+
+public enum BinnieCorePacketID
+ implements IPacketID
+{
+ NetworkEntityUpdate, TileMetadata, CraftGUIAction, TileDescriptionSync;
+
+ private BinnieCorePacketID() {}
+
+ public void onMessage(MessageBinnie message, MessageContext context)
+ {
+ if (this == NetworkEntityUpdate)
+ {
+ MessageUpdate packet = new MessageUpdate(message);
+ TileEntity tile = packet.getTileEntity(BinnieCore.proxy.getWorld());
+ if ((tile instanceof INetworkedEntity)) {
+ ((INetworkedEntity)tile).readFromPacket(packet.payload);
+ }
+ }
+ else if (this == TileMetadata)
+ {
+ MessageMetadata packet = new MessageMetadata(message);
+ TileEntity tile = packet.getTileEntity(BinnieCore.proxy.getWorld());
+ if ((tile instanceof TileEntityMetadata)) {
+ ((TileEntityMetadata)tile).setTileMetadata(packet.meta, true);
+ }
+ }
+ else if ((this == CraftGUIAction) && (context.side == Side.CLIENT))
+ {
+ MessageCraftGUI packet = new MessageCraftGUI(message);
+
+ EntityPlayer player = BinnieCore.proxy.getPlayer();
+ if (((player.openContainer instanceof ContainerCraftGUI)) && (packet.getTagCompound() != null)) {
+ ((ContainerCraftGUI)player.openContainer).recieveNBT(Side.CLIENT, player, packet.getTagCompound());
+ }
+ }
+ else if ((this == CraftGUIAction) && (context.side == Side.SERVER) && ((context.netHandler instanceof NetHandlerPlayServer)))
+ {
+ MessageCraftGUI packet = new MessageCraftGUI(message);
+
+ EntityPlayer player = ((NetHandlerPlayServer)context.netHandler).playerEntity;
+ if (((player.openContainer instanceof ContainerCraftGUI)) && (packet.getTagCompound() != null)) {
+ ((ContainerCraftGUI)player.openContainer).recieveNBT(Side.SERVER, player, packet.getTagCompound());
+ }
+ }
+ else if ((this == TileDescriptionSync) && (context.side == Side.CLIENT))
+ {
+ MessageTileNBT packet = new MessageTileNBT(message);
+ TileEntity tile = packet.getTarget(BinnieCore.proxy.getWorld());
+ if ((tile != null) && (packet.getTagCompound() != null))
+ {
+ IMachine machine = Machine.getMachine(tile);
+ if ((machine != null) && ((machine instanceof INetwork.TilePacketSync))) {
+ ((INetwork.TilePacketSync)machine).syncFromNBT(packet.getTagCompound());
+ }
+ }
+ }
+ }
+}
diff --git a/src/Java/binnie/core/network/BinniePacketHandler.java b/src/Java/binnie/core/network/BinniePacketHandler.java
new file mode 100644
index 0000000000..c7ad54c120
--- /dev/null
+++ b/src/Java/binnie/core/network/BinniePacketHandler.java
@@ -0,0 +1,43 @@
+package binnie.core.network;
+
+import binnie.core.AbstractMod;
+import binnie.core.network.packet.MessageBinnie;
+import cpw.mods.fml.common.network.simpleimpl.IMessage;
+import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
+import cpw.mods.fml.common.network.simpleimpl.MessageContext;
+
+public abstract class BinniePacketHandler
+ implements IMessageHandler<MessageBinnie, IMessage>
+{
+ private IPacketProvider provider;
+
+ public BinniePacketHandler(AbstractMod mod)
+ {
+ setProvider(mod);
+ }
+
+ public void setProvider(IPacketProvider provider)
+ {
+ this.provider = provider;
+ }
+
+ public IMessage onMessage(MessageBinnie message, MessageContext ctx)
+ {
+ try
+ {
+ int packetId = message.id;
+ for (IPacketID id : this.provider.getPacketIDs()) {
+ if (id.ordinal() == packetId)
+ {
+ id.onMessage(message, ctx);
+ return null;
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ throw new RuntimeException(ex);
+ }
+ return null;
+ }
+}
diff --git a/src/Java/binnie/core/network/INetworkedEntity.java b/src/Java/binnie/core/network/INetworkedEntity.java
new file mode 100644
index 0000000000..e126a4559b
--- /dev/null
+++ b/src/Java/binnie/core/network/INetworkedEntity.java
@@ -0,0 +1,10 @@
+package binnie.core.network;
+
+import binnie.core.network.packet.PacketPayload;
+
+public abstract interface INetworkedEntity
+{
+ public abstract void writeToPacket(PacketPayload paramPacketPayload);
+
+ public abstract void readFromPacket(PacketPayload paramPacketPayload);
+}
diff --git a/src/Java/binnie/core/network/IOrdinaled.java b/src/Java/binnie/core/network/IOrdinaled.java
new file mode 100644
index 0000000000..2022f04820
--- /dev/null
+++ b/src/Java/binnie/core/network/IOrdinaled.java
@@ -0,0 +1,6 @@
+package binnie.core.network;
+
+public abstract interface IOrdinaled
+{
+ public abstract int ordinal();
+}
diff --git a/src/Java/binnie/core/network/IPacketID.java b/src/Java/binnie/core/network/IPacketID.java
new file mode 100644
index 0000000000..193fbba617
--- /dev/null
+++ b/src/Java/binnie/core/network/IPacketID.java
@@ -0,0 +1,10 @@
+package binnie.core.network;
+
+import binnie.core.network.packet.MessageBinnie;
+import cpw.mods.fml.common.network.simpleimpl.MessageContext;
+
+public abstract interface IPacketID
+ extends IOrdinaled
+{
+ public abstract void onMessage(MessageBinnie paramMessageBinnie, MessageContext paramMessageContext);
+}
diff --git a/src/Java/binnie/core/network/IPacketProvider.java b/src/Java/binnie/core/network/IPacketProvider.java
new file mode 100644
index 0000000000..98f48f69b3
--- /dev/null
+++ b/src/Java/binnie/core/network/IPacketProvider.java
@@ -0,0 +1,8 @@
+package binnie.core.network;
+
+public abstract interface IPacketProvider
+{
+ public abstract String getChannel();
+
+ public abstract IPacketID[] getPacketIDs();
+}
diff --git a/src/Java/binnie/core/network/packet/IPacket.java b/src/Java/binnie/core/network/packet/IPacket.java
new file mode 100644
index 0000000000..b86516ea41
--- /dev/null
+++ b/src/Java/binnie/core/network/packet/IPacket.java
@@ -0,0 +1,8 @@
+package binnie.core.network.packet;
+
+import net.minecraft.network.Packet;
+
+public abstract interface IPacket
+{
+ public abstract Packet getPacket();
+}
diff --git a/src/Java/binnie/core/network/packet/IPacketLocation.java b/src/Java/binnie/core/network/packet/IPacketLocation.java
new file mode 100644
index 0000000000..d9d46cce70
--- /dev/null
+++ b/src/Java/binnie/core/network/packet/IPacketLocation.java
@@ -0,0 +1,15 @@
+package binnie.core.network.packet;
+
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.world.World;
+
+abstract interface IPacketLocation
+{
+ public abstract TileEntity getTarget(World paramWorld);
+
+ public abstract int getX();
+
+ public abstract int getY();
+
+ public abstract int getZ();
+}
diff --git a/src/Java/binnie/core/network/packet/IndexInPayload.java b/src/Java/binnie/core/network/packet/IndexInPayload.java
new file mode 100644
index 0000000000..ff59a0783f
--- /dev/null
+++ b/src/Java/binnie/core/network/packet/IndexInPayload.java
@@ -0,0 +1,15 @@
+package binnie.core.network.packet;
+
+public class IndexInPayload
+{
+ public IndexInPayload(int intIndex, int floatIndex, int stringIndex)
+ {
+ this.intIndex = intIndex;
+ this.floatIndex = floatIndex;
+ this.stringIndex = stringIndex;
+ }
+
+ public int intIndex = 0;
+ public int floatIndex = 0;
+ public int stringIndex = 0;
+}
diff --git a/src/Java/binnie/core/network/packet/MachinePayload.java b/src/Java/binnie/core/network/packet/MachinePayload.java
new file mode 100644
index 0000000000..11eb8b62b9
--- /dev/null
+++ b/src/Java/binnie/core/network/packet/MachinePayload.java
@@ -0,0 +1,77 @@
+package binnie.core.network.packet;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class MachinePayload
+{
+ private List<Integer> intPayload = new ArrayList();
+ private List<Float> floatPayload = new ArrayList();
+ private List<String> stringPayload = new ArrayList();
+ private int id = 0;
+
+ public MachinePayload(int id)
+ {
+ this.id = id;
+ this.intPayload.clear();
+ this.floatPayload.clear();
+ this.stringPayload.clear();
+ }
+
+ public MachinePayload() {}
+
+ public void addInteger(int a)
+ {
+ this.intPayload.add(Integer.valueOf(a));
+ }
+
+ public void addFloat(float a)
+ {
+ this.floatPayload.add(Float.valueOf(a));
+ }
+
+ public void addString(String a)
+ {
+ this.stringPayload.add(a);
+ }
+
+ public int getInteger()
+ {
+ return ((Integer)this.intPayload.remove(0)).intValue();
+ }
+
+ public float getFloat()
+ {
+ return ((Float)this.floatPayload.remove(0)).floatValue();
+ }
+
+ public String getString()
+ {
+ return (String)this.stringPayload.remove(0);
+ }
+
+ public void append(MachinePayload other)
+ {
+ if (other == null) {
+ return;
+ }
+ this.intPayload.addAll(other.intPayload);
+ this.floatPayload.addAll(other.floatPayload);
+ this.stringPayload.addAll(other.stringPayload);
+ }
+
+ public boolean isEmpty()
+ {
+ return (this.intPayload.isEmpty()) && (this.floatPayload.isEmpty()) && (this.stringPayload.isEmpty());
+ }
+
+ public int getID()
+ {
+ return this.id;
+ }
+
+ public void setID(int readInt)
+ {
+ this.id = readInt;
+ }
+}
diff --git a/src/Java/binnie/core/network/packet/MessageBase.java b/src/Java/binnie/core/network/packet/MessageBase.java
new file mode 100644
index 0000000000..e18da968ef
--- /dev/null
+++ b/src/Java/binnie/core/network/packet/MessageBase.java
@@ -0,0 +1,69 @@
+package binnie.core.network.packet;
+
+import io.netty.buffer.ByteBuf;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import net.minecraft.nbt.CompressedStreamTools;
+import net.minecraft.nbt.NBTTagCompound;
+
+public class MessageBase
+{
+ private int id;
+
+ public MessageBase(int id)
+ {
+ this.id = id;
+ }
+
+ public MessageBase(MessageBinnie message)
+ {
+ try
+ {
+ readData(message.data);
+ }
+ catch (IOException e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ public MessageBinnie GetMessage()
+ {
+ return new MessageBinnie(this.id, this);
+ }
+
+ protected NBTTagCompound readNBTTagCompound(ByteBuf data)
+ throws IOException
+ {
+ short length = data.readShort();
+ if (length < 0) {
+ return null;
+ }
+ byte[] compressed = new byte[length];
+ data.readBytes(compressed);
+ return CompressedStreamTools.readCompressed(new ByteArrayInputStream(compressed));
+ }
+
+ protected void writeNBTTagCompound(NBTTagCompound nbttagcompound, ByteBuf data)
+ throws IOException
+ {
+ if (nbttagcompound == null)
+ {
+ data.writeShort(-1);
+ }
+ else
+ {
+ byte[] compressed = CompressedStreamTools.compress(nbttagcompound);
+ data.writeShort((short)compressed.length);
+ data.writeBytes(compressed);
+ }
+ }
+
+ public void writeData(ByteBuf data)
+ throws IOException
+ {}
+
+ public void readData(ByteBuf data)
+ throws IOException
+ {}
+}
diff --git a/src/Java/binnie/core/network/packet/MessageBinnie.java b/src/Java/binnie/core/network/packet/MessageBinnie.java
new file mode 100644
index 0000000000..0559a07e30
--- /dev/null
+++ b/src/Java/binnie/core/network/packet/MessageBinnie.java
@@ -0,0 +1,40 @@
+package binnie.core.network.packet;
+
+import cpw.mods.fml.common.network.simpleimpl.IMessage;
+import io.netty.buffer.ByteBuf;
+import java.io.IOException;
+
+public final class MessageBinnie
+ implements IMessage
+{
+ public int id;
+ private MessageBase message;
+ ByteBuf data;
+
+ public MessageBinnie() {}
+
+ public MessageBinnie(int id, MessageBase base)
+ {
+ this.id = id;
+ this.message = base;
+ }
+
+ public void toBytes(ByteBuf buf)
+ {
+ buf.writeByte(this.id);
+ try
+ {
+ this.message.writeData(buf);
+ }
+ catch (IOException e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ public void fromBytes(ByteBuf buf)
+ {
+ this.id = buf.readByte();
+ this.data = buf;
+ }
+}
diff --git a/src/Java/binnie/core/network/packet/MessageContainerUpdate.java b/src/Java/binnie/core/network/packet/MessageContainerUpdate.java
new file mode 100644
index 0000000000..98e64b0d1f
--- /dev/null
+++ b/src/Java/binnie/core/network/packet/MessageContainerUpdate.java
@@ -0,0 +1,17 @@
+package binnie.core.network.packet;
+
+import net.minecraft.nbt.NBTTagCompound;
+
+public class MessageContainerUpdate
+ extends MessageCraftGUI
+{
+ public MessageContainerUpdate(NBTTagCompound nbt)
+ {
+ super(nbt);
+ }
+
+ public MessageContainerUpdate(MessageBinnie message)
+ {
+ super(message);
+ }
+}
diff --git a/src/Java/binnie/core/network/packet/MessageCoordinates.java b/src/Java/binnie/core/network/packet/MessageCoordinates.java
new file mode 100644
index 0000000000..928ed59d05
--- /dev/null
+++ b/src/Java/binnie/core/network/packet/MessageCoordinates.java
@@ -0,0 +1,59 @@
+package binnie.core.network.packet;
+
+import io.netty.buffer.ByteBuf;
+import java.io.IOException;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.ChunkCoordinates;
+import net.minecraft.world.World;
+
+public class MessageCoordinates
+ extends MessageBase
+{
+ public int posX;
+ public int posY;
+ public int posZ;
+
+ public MessageCoordinates(MessageBinnie message)
+ {
+ super(message);
+ }
+
+ public MessageCoordinates(int id, ChunkCoordinates coordinates)
+ {
+ this(id, coordinates.posX, coordinates.posY, coordinates.posZ);
+ }
+
+ public MessageCoordinates(int id, int posX, int posY, int posZ)
+ {
+ super(id);
+ this.posX = posX;
+ this.posY = posY;
+ this.posZ = posZ;
+ }
+
+ public void writeData(ByteBuf data)
+ throws IOException
+ {
+ data.writeInt(this.posX);
+ data.writeInt(this.posY);
+ data.writeInt(this.posZ);
+ }
+
+ public void readData(ByteBuf data)
+ throws IOException
+ {
+ this.posX = data.readInt();
+ this.posY = data.readInt();
+ this.posZ = data.readInt();
+ }
+
+ public ChunkCoordinates getCoordinates()
+ {
+ return new ChunkCoordinates(this.posX, this.posY, this.posZ);
+ }
+
+ public TileEntity getTileEntity(World world)
+ {
+ return world.getTileEntity(this.posX, this.posY, this.posZ);
+ }
+}
diff --git a/src/Java/binnie/core/network/packet/MessageCraftGUI.java b/src/Java/binnie/core/network/packet/MessageCraftGUI.java
new file mode 100644
index 0000000000..805c4a651b
--- /dev/null
+++ b/src/Java/binnie/core/network/packet/MessageCraftGUI.java
@@ -0,0 +1,18 @@
+package binnie.core.network.packet;
+
+import binnie.core.network.BinnieCorePacketID;
+import net.minecraft.nbt.NBTTagCompound;
+
+public class MessageCraftGUI
+ extends MessageNBT
+{
+ public MessageCraftGUI(MessageBinnie message)
+ {
+ super(message);
+ }
+
+ public MessageCraftGUI(NBTTagCompound action)
+ {
+ super(BinnieCorePacketID.CraftGUIAction.ordinal(), action);
+ }
+}
diff --git a/src/Java/binnie/core/network/packet/MessageMetadata.java b/src/Java/binnie/core/network/packet/MessageMetadata.java
new file mode 100644
index 0000000000..c8ce46dedb
--- /dev/null
+++ b/src/Java/binnie/core/network/packet/MessageMetadata.java
@@ -0,0 +1,36 @@
+package binnie.core.network.packet;
+
+import binnie.core.network.BinnieCorePacketID;
+import io.netty.buffer.ByteBuf;
+import java.io.IOException;
+
+public class MessageMetadata
+ extends MessageCoordinates
+{
+ public int meta;
+
+ public MessageMetadata(int posX, int posY, int posZ, int meta)
+ {
+ super(BinnieCorePacketID.TileMetadata.ordinal(), posX, posY, posZ);
+ this.meta = meta;
+ }
+
+ public MessageMetadata(MessageBinnie message)
+ {
+ super(message);
+ }
+
+ public void writeData(ByteBuf data)
+ throws IOException
+ {
+ super.writeData(data);
+ data.writeInt(this.meta);
+ }
+
+ public void readData(ByteBuf data)
+ throws IOException
+ {
+ super.readData(data);
+ this.meta = data.readInt();
+ }
+}
diff --git a/src/Java/binnie/core/network/packet/MessageNBT.java b/src/Java/binnie/core/network/packet/MessageNBT.java
new file mode 100644
index 0000000000..c1c5345987
--- /dev/null
+++ b/src/Java/binnie/core/network/packet/MessageNBT.java
@@ -0,0 +1,49 @@
+package binnie.core.network.packet;
+
+import io.netty.buffer.ByteBuf;
+import java.io.IOException;
+import net.minecraft.nbt.NBTTagCompound;
+
+public class MessageNBT
+ extends MessageBase
+{
+ NBTTagCompound nbt;
+
+ public NBTTagCompound getTagCompound()
+ {
+ return this.nbt;
+ }
+
+ void setTagCompound(NBTTagCompound nbt)
+ {
+ this.nbt = nbt;
+ }
+
+ public MessageNBT(int id)
+ {
+ super(id);
+ }
+
+ public MessageNBT(int id, NBTTagCompound nbt)
+ {
+ this(id);
+ setTagCompound(nbt);
+ }
+
+ public MessageNBT(MessageBinnie message)
+ {
+ super(message);
+ }
+
+ public void writeData(ByteBuf data)
+ throws IOException
+ {
+ writeNBTTagCompound(this.nbt, data);
+ }
+
+ public void readData(ByteBuf data)
+ throws IOException
+ {
+ this.nbt = readNBTTagCompound(data);
+ }
+}
diff --git a/src/Java/binnie/core/network/packet/MessageTileNBT.java b/src/Java/binnie/core/network/packet/MessageTileNBT.java
new file mode 100644
index 0000000000..7ba41b8d09
--- /dev/null
+++ b/src/Java/binnie/core/network/packet/MessageTileNBT.java
@@ -0,0 +1,82 @@
+package binnie.core.network.packet;
+
+import io.netty.buffer.ByteBuf;
+import java.io.IOException;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.world.World;
+
+public class MessageTileNBT
+ extends MessageNBT
+ implements IPacketLocation
+{
+ private int posX;
+ private int posY;
+ private int posZ;
+
+ public MessageTileNBT(MessageBinnie message)
+ {
+ super(message);
+ }
+
+ public MessageTileNBT(int id, TileEntity tile, NBTTagCompound nbt)
+ {
+ super(id);
+
+ this.posX = tile.xCoord;
+ this.posY = tile.yCoord;
+ this.posZ = tile.zCoord;
+
+ this.nbt = nbt;
+ }
+
+ public void writeData(ByteBuf data)
+ throws IOException
+ {
+ data.writeInt(this.posX);
+ data.writeInt(this.posY);
+ data.writeInt(this.posZ);
+
+ super.writeData(data);
+ }
+
+ public void readData(ByteBuf data)
+ throws IOException
+ {
+ this.posX = data.readInt();
+ this.posY = data.readInt();
+ this.posZ = data.readInt();
+
+ super.readData(data);
+ }
+
+ public TileEntity getTarget(World world)
+ {
+ return world.getTileEntity(this.posX, this.posY, this.posZ);
+ }
+
+ public int getX()
+ {
+ return this.posX;
+ }
+
+ public int getY()
+ {
+ return this.posY;
+ }
+
+ public int getZ()
+ {
+ return this.posZ;
+ }
+
+ public NBTTagCompound getTagCompound()
+ {
+ return this.nbt;
+ }
+
+ void setTagCompound(NBTTagCompound nbt)
+ {
+ this.nbt = nbt;
+ }
+}
diff --git a/src/Java/binnie/core/network/packet/MessageUpdate.java b/src/Java/binnie/core/network/packet/MessageUpdate.java
new file mode 100644
index 0000000000..053246b318
--- /dev/null
+++ b/src/Java/binnie/core/network/packet/MessageUpdate.java
@@ -0,0 +1,92 @@
+package binnie.core.network.packet;
+
+import binnie.core.network.INetworkedEntity;
+import io.netty.buffer.ByteBuf;
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.List;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.world.World;
+
+public class MessageUpdate
+ extends MessageCoordinates
+{
+ public PacketPayload payload;
+
+ public MessageUpdate(MessageBinnie message)
+ {
+ super(message);
+ }
+
+ public MessageUpdate(int id, INetworkedEntity tile)
+ {
+ super(id, ((TileEntity)tile).xCoord, ((TileEntity)tile).yCoord, ((TileEntity)tile).zCoord);
+ this.payload = new PacketPayload();
+ tile.writeToPacket(this.payload);
+ }
+
+ public void writeData(ByteBuf data)
+ throws IOException
+ {
+ super.writeData(data);
+ if (this.payload == null)
+ {
+ data.writeInt(0);
+ data.writeInt(0);
+ data.writeInt(0);
+ return;
+ }
+ data.writeInt(this.payload.intPayload.size());
+ data.writeInt(this.payload.floatPayload.size());
+ data.writeInt(this.payload.stringPayload.size());
+ for (Iterator i$ = this.payload.intPayload.iterator(); i$.hasNext();)
+ {
+ int intData = ((Integer)i$.next()).intValue();
+ data.writeInt(intData);
+ }
+ for (Iterator i$ = this.payload.floatPayload.iterator(); i$.hasNext();)
+ {
+ float floatData = ((Float)i$.next()).floatValue();
+ data.writeFloat(floatData);
+ }
+ for (String stringData : this.payload.stringPayload)
+ {
+ byte[] bytes = stringData.getBytes("UTF-8");
+ data.writeShort(bytes.length);
+ data.writeBytes(bytes);
+ }
+ }
+
+ public void readData(ByteBuf data)
+ throws IOException
+ {
+ super.readData(data);
+
+ this.payload = new PacketPayload();
+
+ int intLength = data.readInt();
+ int floatLength = data.readInt();
+ int stringLength = data.readInt();
+
+ this.payload.intPayload.clear();
+ this.payload.floatPayload.clear();
+ this.payload.stringPayload.clear();
+ for (int i = 0; i < intLength; i++) {
+ this.payload.addInteger(data.readInt());
+ }
+ for (int i = 0; i < floatLength; i++) {
+ this.payload.addFloat(data.readFloat());
+ }
+ for (int i = 0; i < stringLength; i++)
+ {
+ int length = data.readShort();
+ byte[] string = data.readBytes(length).array();
+ this.payload.addString(new String(string, "UTF-8"));
+ }
+ }
+
+ public TileEntity getTarget(World world)
+ {
+ return world.getTileEntity(this.posX, this.posY, this.posZ);
+ }
+}
diff --git a/src/Java/binnie/core/network/packet/PacketPayload.java b/src/Java/binnie/core/network/packet/PacketPayload.java
new file mode 100644
index 0000000000..57d1a13759
--- /dev/null
+++ b/src/Java/binnie/core/network/packet/PacketPayload.java
@@ -0,0 +1,70 @@
+package binnie.core.network.packet;
+
+import binnie.core.network.INetworkedEntity;
+import java.util.ArrayList;
+import java.util.List;
+
+public class PacketPayload
+{
+ public List<Integer> intPayload = new ArrayList();
+ public List<Float> floatPayload = new ArrayList();
+ public List<String> stringPayload = new ArrayList();
+
+ public PacketPayload()
+ {
+ this.intPayload.clear();
+ this.floatPayload.clear();
+ this.stringPayload.clear();
+ }
+
+ public PacketPayload(INetworkedEntity tile)
+ {
+ this();
+ tile.writeToPacket(this);
+ }
+
+ public void addInteger(int a)
+ {
+ this.intPayload.add(Integer.valueOf(a));
+ }
+
+ public void addFloat(float a)
+ {
+ this.floatPayload.add(Float.valueOf(a));
+ }
+
+ public void addString(String a)
+ {
+ this.stringPayload.add(a);
+ }
+
+ public int getInteger()
+ {
+ return ((Integer)this.intPayload.remove(0)).intValue();
+ }
+
+ public float getFloat()
+ {
+ return ((Float)this.floatPayload.remove(0)).floatValue();
+ }
+
+ public String getString()
+ {
+ return (String)this.stringPayload.remove(0);
+ }
+
+ public void append(PacketPayload other)
+ {
+ if (other == null) {
+ return;
+ }
+ this.intPayload.addAll(other.intPayload);
+ this.floatPayload.addAll(other.floatPayload);
+ this.stringPayload.addAll(other.stringPayload);
+ }
+
+ public boolean isEmpty()
+ {
+ return (this.intPayload.isEmpty()) && (this.floatPayload.isEmpty()) && (this.stringPayload.isEmpty());
+ }
+}
diff --git a/src/Java/binnie/core/proxy/BinnieModProxy.java b/src/Java/binnie/core/proxy/BinnieModProxy.java
new file mode 100644
index 0000000000..a6697b384f
--- /dev/null
+++ b/src/Java/binnie/core/proxy/BinnieModProxy.java
@@ -0,0 +1,67 @@
+package binnie.core.proxy;
+
+import binnie.Binnie;
+import binnie.core.AbstractMod;
+import binnie.core.BinnieCore;
+import binnie.core.gui.IBinnieGUID;
+import binnie.core.language.ManagerLanguage;
+import binnie.core.network.packet.MessageBase;
+import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.EntityPlayerMP;
+import net.minecraft.util.IIcon;
+
+public class BinnieModProxy
+ implements IBinnieModProxy
+{
+ private AbstractMod mod;
+
+ public BinnieModProxy(AbstractMod mod)
+ {
+ this.mod = mod;
+ }
+
+ public void openGui(IBinnieGUID ID, EntityPlayer player, int x, int y, int z)
+ {
+ BinnieCore.proxy.openGui(this.mod, ID.ordinal(), player, x, y, z);
+ }
+
+ public void sendToAll(MessageBase packet)
+ {
+ this.mod.getNetworkWrapper().sendToAll(packet.GetMessage());
+ }
+
+ public void sendToPlayer(MessageBase packet, EntityPlayer entityplayer)
+ {
+ if ((entityplayer instanceof EntityPlayerMP)) {
+ this.mod.getNetworkWrapper().sendTo(packet.GetMessage(), (EntityPlayerMP)entityplayer);
+ }
+ }
+
+ public void sendToServer(MessageBase packet)
+ {
+ this.mod.getNetworkWrapper().sendToServer(packet.GetMessage());
+ }
+
+ public IIcon getIcon(IIconRegister register, String string)
+ {
+ return BinnieCore.proxy.getIcon(register, this.mod.getModID(), string);
+ }
+
+ public void preInit() {}
+
+ public void init() {}
+
+ public void postInit() {}
+
+ public String localise(String string)
+ {
+ return Binnie.Language.localise(this.mod, string);
+ }
+
+ public String localiseOrBlank(String string)
+ {
+ return Binnie.Language.localiseOrBlank(this.mod, string);
+ }
+}
diff --git a/src/Java/binnie/core/proxy/BinnieProxy.java b/src/Java/binnie/core/proxy/BinnieProxy.java
new file mode 100644
index 0000000000..04a63b8c67
--- /dev/null
+++ b/src/Java/binnie/core/proxy/BinnieProxy.java
@@ -0,0 +1,156 @@
+package binnie.core.proxy;
+
+import binnie.core.AbstractMod;
+import binnie.core.BinnieCore;
+import binnie.core.network.BinnieCorePacketID;
+import binnie.core.network.INetworkedEntity;
+import binnie.core.network.packet.MessageUpdate;
+import binnie.core.resource.BinnieResource;
+import cpw.mods.fml.client.registry.RenderingRegistry;
+import cpw.mods.fml.common.FMLCommonHandler;
+import cpw.mods.fml.common.registry.GameRegistry;
+import java.io.File;
+import java.util.Map;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.Item;
+import net.minecraft.server.MinecraftServer;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.IIcon;
+import net.minecraft.util.ResourceLocation;
+import net.minecraft.world.World;
+import net.minecraftforge.client.IItemRenderer;
+
+public class BinnieProxy
+ extends BinnieModProxy
+ implements IBinnieProxy
+{
+ public BinnieProxy()
+ {
+ super(BinnieCore.instance);
+ }
+
+ public void preInit() {}
+
+ public void init() {}
+
+ public void postInit() {}
+
+ public void bindTexture(BinnieResource texture) {}
+
+ public boolean checkTexture(BinnieResource location)
+ {
+ return false;
+ }
+
+ public int getUniqueRenderID()
+ {
+ return RenderingRegistry.getNextAvailableRenderId();
+ }
+
+ public void openGui(AbstractMod mod, int id, EntityPlayer player, int x, int y, int z)
+ {
+ player.openGui(mod, id, player.worldObj, x, y, z);
+ }
+
+ public boolean isSimulating(World world)
+ {
+ return true;
+ }
+
+ public void registerCustomItemRenderer(Item item, IItemRenderer itemRenderer) {}
+
+ public boolean needsTagCompoundSynched(Item item)
+ {
+ return item.getShareTag();
+ }
+
+ public World getWorld()
+ {
+ return null;
+ }
+
+ public void throwException(String message, Throwable e)
+ {
+ FMLCommonHandler.instance().raiseException(e, message, true);
+ }
+
+ public Minecraft getMinecraftInstance()
+ {
+ return null;
+ }
+
+ public boolean isClient()
+ {
+ return false;
+ }
+
+ public boolean isServer()
+ {
+ return true;
+ }
+
+ public File getDirectory()
+ {
+ return new File("./");
+ }
+
+ public void registerTileEntity(Class<? extends TileEntity> tile, String id, Object renderer)
+ {
+ GameRegistry.registerTileEntity(tile, id);
+ }
+
+ public void createPipe(Item pipe) {}
+
+ public boolean isDebug()
+ {
+ return System.getenv().containsKey("BINNIE_DEBUG");
+ }
+
+ public void registerBlockRenderer(Object renderer) {}
+
+ public Object createObject(String renderer)
+ {
+ return null;
+ }
+
+ public void sendNetworkEntityPacket(INetworkedEntity entity)
+ {
+ MessageUpdate packet = new MessageUpdate(BinnieCorePacketID.NetworkEntityUpdate.ordinal(), entity);
+ sendToAll(packet);
+ }
+
+ public IIcon getIcon(IIconRegister register, String mod, String name)
+ {
+ return null;
+ }
+
+ private short uniqueTextureUID = 1200;
+
+ public void handleTextureRefresh(IIconRegister register, int type) {}
+
+ public void handlePostTextureRefresh(IIconRegister register, int type) {}
+
+ public short getUniqueTextureUID()
+ {
+ return this.uniqueTextureUID++;
+ }
+
+ public void bindTexture(ResourceLocation location) {}
+
+ public boolean isShiftDown()
+ {
+ return false;
+ }
+
+ public EntityPlayer getPlayer()
+ {
+ return null;
+ }
+
+ public MinecraftServer getServer()
+ {
+ return MinecraftServer.getServer();
+ }
+}
diff --git a/src/Java/binnie/core/proxy/BinnieProxyClient.java b/src/Java/binnie/core/proxy/BinnieProxyClient.java
new file mode 100644
index 0000000000..4eb3db5727
--- /dev/null
+++ b/src/Java/binnie/core/proxy/BinnieProxyClient.java
@@ -0,0 +1,158 @@
+package binnie.core.proxy;
+
+import binnie.Binnie;
+import binnie.core.liquid.ManagerLiquid;
+import binnie.core.resource.BinnieResource;
+import binnie.craftgui.resource.minecraft.CraftGUIResourceManager;
+import cpw.mods.fml.client.FMLClientHandler;
+import cpw.mods.fml.client.registry.ClientRegistry;
+import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
+import cpw.mods.fml.client.registry.RenderingRegistry;
+import cpw.mods.fml.common.registry.GameRegistry;
+import java.io.File;
+import java.io.IOException;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.client.renderer.texture.ITextureObject;
+import net.minecraft.client.renderer.texture.SimpleTexture;
+import net.minecraft.client.renderer.texture.TextureManager;
+import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
+import net.minecraft.client.resources.IReloadableResourceManager;
+import net.minecraft.client.resources.IResourceManager;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.Item;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.IIcon;
+import net.minecraft.util.ResourceLocation;
+import net.minecraft.world.World;
+import net.minecraftforge.client.IItemRenderer;
+import net.minecraftforge.client.MinecraftForgeClient;
+import org.lwjgl.input.Keyboard;
+import org.lwjgl.opengl.GL11;
+
+public final class BinnieProxyClient
+ extends BinnieProxy
+ implements IBinnieProxy
+{
+ public void bindTexture(BinnieResource texture)
+ {
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ bindTexture(texture.getResourceLocation());
+ }
+
+ public void bindTexture(ResourceLocation location)
+ {
+ getMinecraftInstance().getTextureManager().bindTexture(location);
+ }
+
+ public boolean checkTexture(BinnieResource location)
+ {
+ SimpleTexture texture = new SimpleTexture(location.getResourceLocation());
+ try
+ {
+ texture.loadTexture(getMinecraftInstance().getResourceManager());
+ }
+ catch (IOException e)
+ {
+ return false;
+ }
+ return true;
+ }
+
+ public boolean isSimulating(World world)
+ {
+ return !world.isRemote;
+ }
+
+ public void registerCustomItemRenderer(Item item, IItemRenderer itemRenderer)
+ {
+ MinecraftForgeClient.registerItemRenderer(item, itemRenderer);
+ }
+
+ public World getWorld()
+ {
+ return getMinecraftInstance().theWorld;
+ }
+
+ public Minecraft getMinecraftInstance()
+ {
+ return FMLClientHandler.instance().getClient();
+ }
+
+ public boolean isClient()
+ {
+ return true;
+ }
+
+ public boolean isServer()
+ {
+ return false;
+ }
+
+ public File getDirectory()
+ {
+ return new File(".");
+ }
+
+ public void registerTileEntity(Class<? extends TileEntity> tile, String id, Object renderer)
+ {
+ if ((renderer != null) && ((renderer instanceof TileEntitySpecialRenderer))) {
+ ClientRegistry.registerTileEntity(tile, id, (TileEntitySpecialRenderer)renderer);
+ } else {
+ GameRegistry.registerTileEntity(tile, id);
+ }
+ }
+
+ public void registerBlockRenderer(Object renderer)
+ {
+ if ((renderer != null) && ((renderer instanceof ISimpleBlockRenderingHandler))) {
+ RenderingRegistry.registerBlockHandler((ISimpleBlockRenderingHandler)renderer);
+ }
+ }
+
+ public void createPipe(Item pipe) {}
+
+ public Object createObject(String renderer)
+ {
+ Object object = null;
+ try
+ {
+ Class<?> rendererClass = Class.forName(renderer);
+ if (rendererClass != null) {
+ object = rendererClass.newInstance();
+ }
+ }
+ catch (Exception e) {}
+ return object;
+ }
+
+ public IIcon getIcon(IIconRegister register, String mod, String name)
+ {
+ return register.registerIcon(mod + ":" + name);
+ }
+
+ public boolean isShiftDown()
+ {
+ return (Keyboard.isKeyDown(42)) || (Keyboard.isKeyDown(54));
+ }
+
+ public EntityPlayer getPlayer()
+ {
+ return Minecraft.getMinecraft().thePlayer;
+ }
+
+ public void handlePreTextureRefresh(IIconRegister register, int type)
+ {
+ if (type == 0) {
+ Binnie.Liquid.reloadIcons(register);
+ }
+ }
+
+ public void preInit()
+ {
+ IResourceManager manager = Minecraft.getMinecraft().getResourceManager();
+ if ((manager instanceof IReloadableResourceManager)) {
+ ((IReloadableResourceManager)manager).registerReloadListener(new CraftGUIResourceManager());
+ }
+ }
+}
diff --git a/src/Java/binnie/core/proxy/BinnieProxyServer.java b/src/Java/binnie/core/proxy/BinnieProxyServer.java
new file mode 100644
index 0000000000..99e0164974
--- /dev/null
+++ b/src/Java/binnie/core/proxy/BinnieProxyServer.java
@@ -0,0 +1,6 @@
+package binnie.core.proxy;
+
+public class BinnieProxyServer
+ extends BinnieProxy
+ implements IBinnieProxy
+{}
diff --git a/src/Java/binnie/core/proxy/IBinnieModProxy.java b/src/Java/binnie/core/proxy/IBinnieModProxy.java
new file mode 100644
index 0000000000..aa9dd11e62
--- /dev/null
+++ b/src/Java/binnie/core/proxy/IBinnieModProxy.java
@@ -0,0 +1,21 @@
+package binnie.core.proxy;
+
+import binnie.core.gui.IBinnieGUID;
+import binnie.core.network.packet.MessageBase;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.util.IIcon;
+
+abstract interface IBinnieModProxy
+ extends IProxyCore
+{
+ public abstract void openGui(IBinnieGUID paramIBinnieGUID, EntityPlayer paramEntityPlayer, int paramInt1, int paramInt2, int paramInt3);
+
+ public abstract void sendToAll(MessageBase paramMessageBase);
+
+ public abstract void sendToPlayer(MessageBase paramMessageBase, EntityPlayer paramEntityPlayer);
+
+ public abstract void sendToServer(MessageBase paramMessageBase);
+
+ public abstract IIcon getIcon(IIconRegister paramIIconRegister, String paramString);
+}
diff --git a/src/Java/binnie/core/proxy/IBinnieProxy.java b/src/Java/binnie/core/proxy/IBinnieProxy.java
new file mode 100644
index 0000000000..4ce037aa3d
--- /dev/null
+++ b/src/Java/binnie/core/proxy/IBinnieProxy.java
@@ -0,0 +1,54 @@
+package binnie.core.proxy;
+
+import binnie.core.AbstractMod;
+import binnie.core.resource.BinnieResource;
+import java.io.File;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.Item;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.IIcon;
+import net.minecraft.util.ResourceLocation;
+import net.minecraft.world.World;
+import net.minecraftforge.client.IItemRenderer;
+
+public abstract interface IBinnieProxy
+ extends IProxyCore
+{
+ public abstract boolean isClient();
+
+ public abstract boolean isServer();
+
+ public abstract File getDirectory();
+
+ public abstract void bindTexture(BinnieResource paramBinnieResource);
+
+ public abstract void bindTexture(ResourceLocation paramResourceLocation);
+
+ public abstract int getUniqueRenderID();
+
+ public abstract void registerCustomItemRenderer(Item paramItem, IItemRenderer paramIItemRenderer);
+
+ public abstract void openGui(AbstractMod paramAbstractMod, int paramInt1, EntityPlayer paramEntityPlayer, int paramInt2, int paramInt3, int paramInt4);
+
+ public abstract boolean isSimulating(World paramWorld);
+
+ public abstract World getWorld();
+
+ public abstract Minecraft getMinecraftInstance();
+
+ public abstract boolean needsTagCompoundSynched(Item paramItem);
+
+ public abstract Object createObject(String paramString);
+
+ public abstract void registerTileEntity(Class<? extends TileEntity> paramClass, String paramString, Object paramObject);
+
+ public abstract void createPipe(Item paramItem);
+
+ public abstract boolean isDebug();
+
+ public abstract void registerBlockRenderer(Object paramObject);
+
+ public abstract IIcon getIcon(IIconRegister paramIIconRegister, String paramString1, String paramString2);
+}
diff --git a/src/Java/binnie/core/proxy/IProxyCore.java b/src/Java/binnie/core/proxy/IProxyCore.java
new file mode 100644
index 0000000000..4a0d5c231b
--- /dev/null
+++ b/src/Java/binnie/core/proxy/IProxyCore.java
@@ -0,0 +1,7 @@
+package binnie.core.proxy;
+
+import binnie.core.IInitializable;
+
+public abstract interface IProxyCore
+ extends IInitializable
+{}
diff --git a/src/Java/binnie/core/resource/BinnieIcon.java b/src/Java/binnie/core/resource/BinnieIcon.java
new file mode 100644
index 0000000000..cf7f44a018
--- /dev/null
+++ b/src/Java/binnie/core/resource/BinnieIcon.java
@@ -0,0 +1,47 @@
+package binnie.core.resource;
+
+import binnie.Binnie;
+import binnie.core.AbstractMod;
+import binnie.core.BinnieCore;
+import binnie.core.proxy.BinnieProxy;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.util.IIcon;
+
+public class BinnieIcon
+ extends BinnieResource
+{
+ public BinnieIcon(AbstractMod mod, ResourceType type, String path)
+ {
+ super(mod, type, path);
+ this.textureSheet = (type == ResourceType.Block ? 0 : 1);
+ Binnie.Resource.registerIcon(this);
+ }
+
+ private int textureSheet = 0;
+ private IIcon icon = null;
+
+ public IIcon getIcon()
+ {
+ return this.icon;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public IIcon getIcon(IIconRegister register)
+ {
+ registerIcon(register);
+ return this.icon;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void registerIcon(IIconRegister register)
+ {
+ this.icon = BinnieCore.proxy.getIcon(register, this.mod, this.path);
+ }
+
+ public int getTextureSheet()
+ {
+ return this.textureSheet;
+ }
+}
diff --git a/src/Java/binnie/core/resource/BinnieResource.java b/src/Java/binnie/core/resource/BinnieResource.java
new file mode 100644
index 0000000000..d9c3d54a0a
--- /dev/null
+++ b/src/Java/binnie/core/resource/BinnieResource.java
@@ -0,0 +1,38 @@
+package binnie.core.resource;
+
+import binnie.core.AbstractMod;
+import net.minecraft.util.ResourceLocation;
+
+public class BinnieResource
+{
+ String mod;
+ private ResourceType type;
+ String path;
+
+ public BinnieResource(AbstractMod mod, ResourceType type, String path)
+ {
+ this(mod.getModID(), type, path);
+ }
+
+ public BinnieResource(String modid, ResourceType type, String path)
+ {
+ this.mod = modid;
+ this.type = type;
+ this.path = path;
+ }
+
+ public String getFullPath()
+ {
+ return "/assets/" + this.mod + "/textures/" + this.type.toString() + "/" + this.path;
+ }
+
+ public ResourceLocation getResourceLocation()
+ {
+ return new ResourceLocation(this.mod, "textures/" + this.type.toString() + "/" + this.path);
+ }
+
+ public String getShortPath()
+ {
+ return "textures/" + this.type.toString() + "/" + this.path;
+ }
+}
diff --git a/src/Java/binnie/core/resource/IBinnieTexture.java b/src/Java/binnie/core/resource/IBinnieTexture.java
new file mode 100644
index 0000000000..8db06e2c6a
--- /dev/null
+++ b/src/Java/binnie/core/resource/IBinnieTexture.java
@@ -0,0 +1,6 @@
+package binnie.core.resource;
+
+public abstract interface IBinnieTexture
+{
+ public abstract BinnieResource getTexture();
+}
diff --git a/src/Java/binnie/core/resource/ManagerResource.java b/src/Java/binnie/core/resource/ManagerResource.java
new file mode 100644
index 0000000000..31a5116931
--- /dev/null
+++ b/src/Java/binnie/core/resource/ManagerResource.java
@@ -0,0 +1,48 @@
+package binnie.core.resource;
+
+import binnie.core.AbstractMod;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import java.util.ArrayList;
+import java.util.List;
+import net.minecraft.client.renderer.texture.IIconRegister;
+
+public class ManagerResource
+{
+ public BinnieResource getPNG(AbstractMod mod, ResourceType type, String path)
+ {
+ return getFile(mod, type, path + ".png");
+ }
+
+ public BinnieResource getFile(AbstractMod mod, ResourceType type, String path)
+ {
+ return new BinnieResource(mod, type, path);
+ }
+
+ private List<BinnieIcon> icons = new ArrayList();
+
+ public void registerIcon(BinnieIcon binnieIcon)
+ {
+ this.icons.add(binnieIcon);
+ }
+
+ public BinnieIcon getItemIcon(AbstractMod mod, String iconFile)
+ {
+ return new BinnieIcon(mod, ResourceType.Item, iconFile);
+ }
+
+ public BinnieIcon getBlockIcon(AbstractMod mod, String iconFile)
+ {
+ return new BinnieIcon(mod, ResourceType.Block, iconFile);
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void registerIcons(IIconRegister register, int type)
+ {
+ for (BinnieIcon icon : this.icons) {
+ if (icon.getTextureSheet() == type) {
+ icon.registerIcon(register);
+ }
+ }
+ }
+}
diff --git a/src/Java/binnie/core/resource/ResourceType.java b/src/Java/binnie/core/resource/ResourceType.java
new file mode 100644
index 0000000000..e9705ce252
--- /dev/null
+++ b/src/Java/binnie/core/resource/ResourceType.java
@@ -0,0 +1,18 @@
+package binnie.core.resource;
+
+public enum ResourceType
+{
+ Item("items"), Block("blocks"), Tile("tile"), GUI("gui"), FX("fx"), Entity("entities");
+
+ String name;
+
+ private ResourceType(String name)
+ {
+ this.name = name;
+ }
+
+ public String toString()
+ {
+ return this.name;
+ }
+}
diff --git a/src/Java/binnie/core/texture/BinnieCoreTexture.java b/src/Java/binnie/core/texture/BinnieCoreTexture.java
new file mode 100644
index 0000000000..6e8cd9abee
--- /dev/null
+++ b/src/Java/binnie/core/texture/BinnieCoreTexture.java
@@ -0,0 +1,28 @@
+package binnie.core.texture;
+
+import binnie.Binnie;
+import binnie.core.BinnieCore;
+import binnie.core.resource.BinnieResource;
+import binnie.core.resource.IBinnieTexture;
+import binnie.core.resource.ManagerResource;
+import binnie.core.resource.ResourceType;
+
+public enum BinnieCoreTexture
+ implements IBinnieTexture
+{
+ Compartment(ResourceType.Tile, "Compartment"), CompartmentIron(ResourceType.Tile, "CompartmentIron"), CompartmentDiamond(ResourceType.Tile, "CompartmentDiamond"), CompartmentCopper(ResourceType.Tile, "CompartmentCopper"), CompartmentGold(ResourceType.Tile, "CompartmentGold"), CompartmentBronze(ResourceType.Tile, "CompartmentBronze"), GUIBreeding(ResourceType.GUI, "breeding"), GUIAnalyst(ResourceType.GUI, "guianalyst");
+
+ String texture;
+ ResourceType type;
+
+ private BinnieCoreTexture(ResourceType base, String texture)
+ {
+ this.texture = texture;
+ this.type = base;
+ }
+
+ public BinnieResource getTexture()
+ {
+ return Binnie.Resource.getPNG(BinnieCore.instance, this.type, this.texture);
+ }
+}
diff --git a/src/Java/binnie/core/texture/TextureManager.java b/src/Java/binnie/core/texture/TextureManager.java
new file mode 100644
index 0000000000..fceb0539a2
--- /dev/null
+++ b/src/Java/binnie/core/texture/TextureManager.java
@@ -0,0 +1,15 @@
+package binnie.core.texture;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import java.util.ArrayList;
+import java.util.List;
+import javax.swing.Icon;
+
+@SideOnly(Side.CLIENT)
+public class TextureManager
+{
+ static List<Icon> textures = new ArrayList();
+
+ public static void init() {}
+}
diff --git a/src/Java/binnie/core/triggers/ActionProvider.java b/src/Java/binnie/core/triggers/ActionProvider.java
new file mode 100644
index 0000000000..1fa519dc6c
--- /dev/null
+++ b/src/Java/binnie/core/triggers/ActionProvider.java
@@ -0,0 +1,38 @@
+package binnie.core.triggers;
+
+import binnie.core.machines.component.IBuildcraft.ActionProvider;
+import buildcraft.api.statements.IActionExternal;
+import buildcraft.api.statements.IActionInternal;
+import buildcraft.api.statements.IActionProvider;
+import buildcraft.api.statements.IStatementContainer;
+import cpw.mods.fml.common.Optional.Method;
+import java.util.Collection;
+import java.util.LinkedList;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraftforge.common.util.ForgeDirection;
+
+class ActionProvider
+ implements IActionProvider
+{
+ @Optional.Method(modid="BuildCraft|Silicon")
+ public Collection<IActionInternal> getInternalActions(IStatementContainer container)
+ {
+ return null;
+ }
+
+ @Optional.Method(modid="BuildCraft|Silicon")
+ public Collection<IActionExternal> getExternalActions(ForgeDirection side, TileEntity tile)
+ {
+ LinkedList<IActionExternal> list = new LinkedList();
+ if ((tile instanceof IBuildcraft.ActionProvider)) {
+ ((IBuildcraft.ActionProvider)tile).getActions(list);
+ }
+ LinkedList<IActionExternal> list2 = new LinkedList();
+ for (IActionExternal action : list2) {
+ if ((action != null) && (action.getUniqueTag() != null)) {
+ list.add(action);
+ }
+ }
+ return list2;
+ }
+}
diff --git a/src/Java/binnie/core/triggers/BinnieAction.java b/src/Java/binnie/core/triggers/BinnieAction.java
new file mode 100644
index 0000000000..f9c0d24e78
--- /dev/null
+++ b/src/Java/binnie/core/triggers/BinnieAction.java
@@ -0,0 +1,88 @@
+package binnie.core.triggers;
+
+import binnie.Binnie;
+import binnie.core.AbstractMod;
+import binnie.core.BinnieCore;
+import binnie.core.resource.BinnieIcon;
+import binnie.core.resource.ManagerResource;
+import buildcraft.api.statements.IActionExternal;
+import buildcraft.api.statements.IStatement;
+import buildcraft.api.statements.IStatementContainer;
+import buildcraft.api.statements.IStatementParameter;
+import buildcraft.api.statements.StatementManager;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.IIcon;
+import net.minecraftforge.common.util.ForgeDirection;
+
+class BinnieAction
+ implements IActionExternal
+{
+ private static int incrementalID = 800;
+ public static BinnieAction actionPauseProcess;
+ public static BinnieAction actionCancelTask;
+ private String desc;
+ private BinnieIcon icon;
+ private String tag;
+ private int id = 0;
+
+ BinnieAction(String desc, String tag, String iconFile)
+ {
+ this(desc, tag, BinnieCore.instance, iconFile);
+ }
+
+ private BinnieAction(String desc, String tag, AbstractMod mod, String iconFile)
+ {
+ this.id = (incrementalID++);
+ this.tag = tag;
+ StatementManager.registerStatement(this);
+ this.icon = Binnie.Resource.getItemIcon(mod, iconFile);
+ this.desc = desc;
+ }
+
+ public String getDescription()
+ {
+ return this.desc;
+ }
+
+ public String getUniqueTag()
+ {
+ return this.tag;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public IIcon getIcon()
+ {
+ return this.icon.getIcon();
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void registerIcons(IIconRegister iconRegister)
+ {
+ this.icon.registerIcon(iconRegister);
+ }
+
+ public int maxParameters()
+ {
+ return 0;
+ }
+
+ public int minParameters()
+ {
+ return 0;
+ }
+
+ public IStatementParameter createParameter(int index)
+ {
+ return null;
+ }
+
+ public IStatement rotateLeft()
+ {
+ return this;
+ }
+
+ public void actionActivate(TileEntity target, ForgeDirection side, IStatementContainer source, IStatementParameter[] parameters) {}
+}
diff --git a/src/Java/binnie/core/triggers/BinnieTrigger.java b/src/Java/binnie/core/triggers/BinnieTrigger.java
new file mode 100644
index 0000000000..e5cac34dea
--- /dev/null
+++ b/src/Java/binnie/core/triggers/BinnieTrigger.java
@@ -0,0 +1,116 @@
+package binnie.core.triggers;
+
+import binnie.Binnie;
+import binnie.core.AbstractMod;
+import binnie.core.BinnieCore;
+import binnie.core.resource.BinnieIcon;
+import binnie.core.resource.ManagerResource;
+import buildcraft.api.statements.IStatement;
+import buildcraft.api.statements.IStatementContainer;
+import buildcraft.api.statements.IStatementParameter;
+import buildcraft.api.statements.ITriggerExternal;
+import buildcraft.api.statements.StatementManager;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import java.util.List;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.IIcon;
+import net.minecraftforge.common.util.ForgeDirection;
+
+final class BinnieTrigger
+ implements ITriggerExternal
+{
+ private static int incrementalID = 800;
+ protected static BinnieTrigger triggerNoBlankTemplate;
+ protected static BinnieTrigger triggerNoTemplate;
+ protected static BinnieTrigger triggerIsWorking;
+ protected static BinnieTrigger triggerIsNotWorking;
+ protected static BinnieTrigger triggerCanWork;
+ protected static BinnieTrigger triggerCannotWork;
+ protected static BinnieTrigger triggerPowerNone;
+ protected static BinnieTrigger triggerPowerLow;
+ protected static BinnieTrigger triggerPowerMedium;
+ protected static BinnieTrigger triggerPowerHigh;
+ protected static BinnieTrigger triggerPowerFull;
+ protected static BinnieTrigger triggerSerumFull;
+ protected static BinnieTrigger triggerSerumPure;
+ protected static BinnieTrigger triggerSerumEmpty;
+ protected static BinnieTrigger triggerAcclimatiserNone;
+ protected static BinnieTrigger triggerAcclimatiserHot;
+ protected static BinnieTrigger triggerAcclimatiserCold;
+ protected static BinnieTrigger triggerAcclimatiserWet;
+ protected static BinnieTrigger triggerAcclimatiserDry;
+ private String desc;
+ private String tag;
+ private BinnieIcon icon;
+ private int id = 0;
+
+ public BinnieTrigger(String desc, String tag, String iconFile)
+ {
+ this(desc, tag, BinnieCore.instance, iconFile);
+ }
+
+ public BinnieTrigger(String desc, String tag, AbstractMod mod, String iconFile)
+ {
+ this.id = (incrementalID++);
+ this.tag = tag;
+ StatementManager.registerStatement(this);
+ TriggerProvider.triggers.add(this);
+ this.icon = Binnie.Resource.getItemIcon(mod, iconFile);
+ this.desc = desc;
+ }
+
+ public String getDescription()
+ {
+ return this.desc;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public IIcon getIcon(IIconRegister register)
+ {
+ return this.icon.getIcon(register);
+ }
+
+ public String getUniqueTag()
+ {
+ return this.tag;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public IIcon getIcon()
+ {
+ return this.icon.getIcon();
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void registerIcons(IIconRegister iconRegister)
+ {
+ this.icon.registerIcon(iconRegister);
+ }
+
+ public int maxParameters()
+ {
+ return 0;
+ }
+
+ public int minParameters()
+ {
+ return 0;
+ }
+
+ public IStatementParameter createParameter(int index)
+ {
+ return null;
+ }
+
+ public IStatement rotateLeft()
+ {
+ return null;
+ }
+
+ public boolean isTriggerActive(TileEntity target, ForgeDirection side, IStatementContainer source, IStatementParameter[] parameters)
+ {
+ return false;
+ }
+}
diff --git a/src/Java/binnie/core/triggers/ModuleTrigger.java b/src/Java/binnie/core/triggers/ModuleTrigger.java
new file mode 100644
index 0000000000..1d39e816cb
--- /dev/null
+++ b/src/Java/binnie/core/triggers/ModuleTrigger.java
@@ -0,0 +1,45 @@
+package binnie.core.triggers;
+
+import binnie.core.IInitializable;
+import binnie.extrabees.ExtraBees;
+import buildcraft.api.statements.StatementManager;
+
+public class ModuleTrigger
+ implements IInitializable
+{
+ public void preInit() {}
+
+ public void init()
+ {
+ BinnieAction.actionPauseProcess = new BinnieAction("Pause Process", "binnie.action.pauseProcess", "actions/PauseProcess");
+ BinnieAction.actionCancelTask = new BinnieAction("Cancel Task", "binnie.action.cancelTask", "actions/CancelTask");
+
+ StatementManager.registerActionProvider(new ActionProvider());
+
+ BinnieTrigger.triggerNoBlankTemplate = new BinnieTrigger("No Blank Template", "binnie.trigger.noBlankTemplate", ExtraBees.instance, "triggers/NoBlankTemplate");
+
+
+ BinnieTrigger.triggerNoTemplate = new BinnieTrigger("No Template", "binnie.trigger.noTemplate", ExtraBees.instance, "triggers/NoTemplate");
+
+
+ BinnieTrigger.triggerIsWorking = new BinnieTrigger("Is Working", "binnie.trigger.isWorking", "triggers/IsWorking");
+ BinnieTrigger.triggerIsNotWorking = new BinnieTrigger("Is Not Working", "binnie.trigger.isNotWorking", "triggers/IsNotWorking");
+ BinnieTrigger.triggerCanWork = new BinnieTrigger("Can Work", "binnie.trigger.canWork", "triggers/CanWork");
+ BinnieTrigger.triggerCannotWork = new BinnieTrigger("Cannot Work", "binnie.trigger.cannotWork", "triggers/CannotWork");
+
+ BinnieTrigger.triggerPowerNone = new BinnieTrigger("Power None", "binnie.trigger.powerNone", "triggers/PowerNone");
+ BinnieTrigger.triggerPowerLow = new BinnieTrigger("Power Low", "binnie.trigger.powerLow", "triggers/PowerLow");
+ BinnieTrigger.triggerPowerMedium = new BinnieTrigger("Power Medium", "binnie.trigger.powerMedium", "triggers/PowerMedium");
+ BinnieTrigger.triggerPowerHigh = new BinnieTrigger("Power High", "binnie.trigger.powerHigh", "triggers/PowerHigh");
+ BinnieTrigger.triggerPowerFull = new BinnieTrigger("Power Full", "binnie.trigger.powerFull", "triggers/PowerFull");
+
+
+ BinnieTrigger.triggerSerumFull = new BinnieTrigger("Serum Full", "binnie.trigger.serumFull", ExtraBees.instance, "triggers/SerumFull");
+ BinnieTrigger.triggerSerumPure = new BinnieTrigger("Serum Pure", "binnie.trigger.serumPure", ExtraBees.instance, "triggers/SerumPure");
+ BinnieTrigger.triggerSerumEmpty = new BinnieTrigger("Serum Pure", "binnie.trigger.serumEmpty", ExtraBees.instance, "triggers/SerumEmpty");
+
+ StatementManager.registerTriggerProvider(new TriggerProvider());
+ }
+
+ public void postInit() {}
+}
diff --git a/src/Java/binnie/core/triggers/TriggerData.java b/src/Java/binnie/core/triggers/TriggerData.java
new file mode 100644
index 0000000000..8784e4278a
--- /dev/null
+++ b/src/Java/binnie/core/triggers/TriggerData.java
@@ -0,0 +1,37 @@
+package binnie.core.triggers;
+
+import buildcraft.api.statements.ITriggerExternal;
+import java.util.Map.Entry;
+
+public class TriggerData
+ implements Map.Entry<ITriggerExternal, Boolean>
+{
+ private final ITriggerExternal key;
+ private Boolean value;
+
+ public TriggerData(ITriggerExternal key, Boolean value)
+ {
+ if (key == null) {
+ throw new NullPointerException();
+ }
+ this.key = key;
+ this.value = value;
+ }
+
+ public ITriggerExternal getKey()
+ {
+ return this.key;
+ }
+
+ public Boolean getValue()
+ {
+ return this.value;
+ }
+
+ public Boolean setValue(Boolean value)
+ {
+ Boolean old = this.value;
+ this.value = value;
+ return old;
+ }
+}
diff --git a/src/Java/binnie/core/triggers/TriggerInventory.java b/src/Java/binnie/core/triggers/TriggerInventory.java
new file mode 100644
index 0000000000..2892f12c7e
--- /dev/null
+++ b/src/Java/binnie/core/triggers/TriggerInventory.java
@@ -0,0 +1,11 @@
+package binnie.core.triggers;
+
+import net.minecraft.inventory.IInventory;
+
+public class TriggerInventory
+{
+ private static Boolean isSlotEmpty(IInventory inventory, int slot)
+ {
+ return Boolean.valueOf(inventory.getStackInSlot(slot) != null);
+ }
+}
diff --git a/src/Java/binnie/core/triggers/TriggerPower.java b/src/Java/binnie/core/triggers/TriggerPower.java
new file mode 100644
index 0000000000..69c02decd9
--- /dev/null
+++ b/src/Java/binnie/core/triggers/TriggerPower.java
@@ -0,0 +1,48 @@
+package binnie.core.triggers;
+
+import binnie.core.machines.Machine;
+import binnie.core.machines.power.IPoweredMachine;
+import binnie.core.machines.power.PowerInterface;
+
+public class TriggerPower
+{
+ public static TriggerData powerNone(Object tile)
+ {
+ return new TriggerData(BinnieTrigger.triggerPowerNone, Boolean.valueOf(getPercentage(tile) < 0.0500000007450581D));
+ }
+
+ public static TriggerData powerLow(Object tile)
+ {
+ return new TriggerData(BinnieTrigger.triggerPowerLow, Boolean.valueOf(getPercentage(tile) < 0.3499999940395355D));
+ }
+
+ public static TriggerData powerMedium(Object tile)
+ {
+ double p = getPercentage(tile);
+ return new TriggerData(BinnieTrigger.triggerPowerMedium, Boolean.valueOf((p >= 0.3499999940395355D) && (p <= 0.6499999761581421D)));
+ }
+
+ public static TriggerData powerHigh(Object tile)
+ {
+ double p = getPercentage(tile);
+ return new TriggerData(BinnieTrigger.triggerPowerHigh, Boolean.valueOf(getPercentage(tile) > 0.6499999761581421D));
+ }
+
+ public static TriggerData powerFull(Object tile)
+ {
+ double p = getPercentage(tile);
+ return new TriggerData(BinnieTrigger.triggerPowerFull, Boolean.valueOf(getPercentage(tile) > 0.949999988079071D));
+ }
+
+ private static double getPercentage(Object tile)
+ {
+ IPoweredMachine process = (IPoweredMachine)Machine.getInterface(IPoweredMachine.class, tile);
+ if (process != null)
+ {
+ double percentage = process.getInterface().getEnergy() / process.getInterface().getCapacity();
+
+ return percentage;
+ }
+ return 0.0D;
+ }
+}
diff --git a/src/Java/binnie/core/triggers/TriggerProvider.java b/src/Java/binnie/core/triggers/TriggerProvider.java
new file mode 100644
index 0000000000..fc6da191e8
--- /dev/null
+++ b/src/Java/binnie/core/triggers/TriggerProvider.java
@@ -0,0 +1,57 @@
+package binnie.core.triggers;
+
+import binnie.core.machines.component.IBuildcraft.TriggerProvider;
+import buildcraft.api.statements.IStatementContainer;
+import buildcraft.api.statements.ITriggerExternal;
+import buildcraft.api.statements.ITriggerInternal;
+import buildcraft.api.statements.ITriggerProvider;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.LinkedList;
+import java.util.List;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraftforge.common.util.ForgeDirection;
+
+class TriggerProvider
+ implements ITriggerProvider
+{
+ static TriggerProvider instance = new TriggerProvider();
+ public static List<BinnieTrigger> triggers = new ArrayList();
+
+ public Collection<ITriggerExternal> getExternalTriggers(ForgeDirection side, TileEntity tile)
+ {
+ LinkedList<TriggerData> list = new LinkedList();
+
+ LinkedList<ITriggerExternal> triggerData = new LinkedList();
+ if ((tile instanceof IBuildcraft.TriggerProvider)) {
+ ((IBuildcraft.TriggerProvider)tile).getTriggers(list);
+ }
+ for (TriggerData data : list) {
+ if ((data.getKey() != null) && (data.getKey().getUniqueTag() != null)) {
+ triggerData.add(data.getKey());
+ }
+ }
+ return triggerData;
+ }
+
+ public static boolean isTriggerActive(ITriggerExternal trigger, TileEntity tile)
+ {
+ LinkedList<TriggerData> list = new LinkedList();
+
+ LinkedList<ITriggerExternal> triggerData = new LinkedList();
+ if ((tile instanceof IBuildcraft.TriggerProvider)) {
+ ((IBuildcraft.TriggerProvider)tile).getTriggers(list);
+ }
+ for (TriggerData data : list) {
+ if (data.getKey() == trigger) {
+ return data.getValue().booleanValue();
+ }
+ }
+ return false;
+ }
+
+ public Collection<ITriggerInternal> getInternalTriggers(IStatementContainer container)
+ {
+ return new ArrayList();
+ }
+}
diff --git a/src/Java/binnie/core/triggers/TriggerWorking.java b/src/Java/binnie/core/triggers/TriggerWorking.java
new file mode 100644
index 0000000000..06feee0f86
--- /dev/null
+++ b/src/Java/binnie/core/triggers/TriggerWorking.java
@@ -0,0 +1,47 @@
+package binnie.core.triggers;
+
+import binnie.core.machines.Machine;
+import binnie.core.machines.power.IProcess;
+
+public class TriggerWorking
+{
+ public static TriggerData isNotWorking(Object inventory)
+ {
+ IProcess process = (IProcess)Machine.getInterface(IProcess.class, inventory);
+ boolean b = false;
+ if (process != null) {
+ b = (process.canWork() != null) && (process.canProgress() != null);
+ }
+ return new TriggerData(BinnieTrigger.triggerIsNotWorking, Boolean.valueOf(b));
+ }
+
+ public static TriggerData isWorking(Object inventory)
+ {
+ IProcess process = (IProcess)Machine.getInterface(IProcess.class, inventory);
+ boolean b = false;
+ if (process != null) {
+ b = (process.canWork() == null) && (process.canProgress() == null);
+ }
+ return new TriggerData(BinnieTrigger.triggerIsWorking, Boolean.valueOf(b));
+ }
+
+ public static TriggerData canWork(Object inventory)
+ {
+ IProcess process = (IProcess)Machine.getInterface(IProcess.class, inventory);
+ boolean b = false;
+ if (process != null) {
+ b = process.canWork() == null;
+ }
+ return new TriggerData(BinnieTrigger.triggerCanWork, Boolean.valueOf(b));
+ }
+
+ public static TriggerData cannotWork(Object inventory)
+ {
+ IProcess process = (IProcess)Machine.getInterface(IProcess.class, inventory);
+ boolean b = false;
+ if (process != null) {
+ b = process.canWork() != null;
+ }
+ return new TriggerData(BinnieTrigger.triggerCannotWork, Boolean.valueOf(b));
+ }
+}
diff --git a/src/Java/binnie/core/util/FluidStackSet.java b/src/Java/binnie/core/util/FluidStackSet.java
new file mode 100644
index 0000000000..1283435293
--- /dev/null
+++ b/src/Java/binnie/core/util/FluidStackSet.java
@@ -0,0 +1,128 @@
+package binnie.core.util;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import net.minecraftforge.fluids.FluidStack;
+
+class FluidStackSet
+ implements Set<FluidStack>
+{
+ public String toString()
+ {
+ return this.itemStacks.toString();
+ }
+
+ List<FluidStack> itemStacks = new ArrayList();
+
+ protected FluidStack getExisting(FluidStack stack)
+ {
+ for (FluidStack stack2 : this.itemStacks) {
+ if (stack2.isFluidEqual(stack)) {
+ return stack2;
+ }
+ }
+ return null;
+ }
+
+ public boolean add(FluidStack e)
+ {
+ if (e != null)
+ {
+ if (getExisting(e) == null) {
+ return this.itemStacks.add(e.copy());
+ }
+ getExisting(e).amount += e.amount;
+ }
+ return false;
+ }
+
+ public boolean addAll(Collection<? extends FluidStack> c)
+ {
+ boolean addedAll = true;
+ for (FluidStack stack : c) {
+ addedAll = (add(stack)) && (addedAll);
+ }
+ return addedAll;
+ }
+
+ public void clear()
+ {
+ this.itemStacks.clear();
+ }
+
+ public boolean contains(Object o)
+ {
+ if (!(o instanceof FluidStack)) {
+ return false;
+ }
+ return getExisting((FluidStack)o) != null;
+ }
+
+ public boolean containsAll(Collection<?> c)
+ {
+ boolean addedAll = true;
+ for (Object o : c) {
+ addedAll = (addedAll) && (contains(o));
+ }
+ return false;
+ }
+
+ public boolean isEmpty()
+ {
+ return this.itemStacks.isEmpty();
+ }
+
+ public Iterator<FluidStack> iterator()
+ {
+ return this.itemStacks.iterator();
+ }
+
+ public boolean remove(Object o)
+ {
+ if (contains(o))
+ {
+ FluidStack r = (FluidStack)o;
+ FluidStack existing = getExisting(r);
+ if (existing.amount > r.amount) {
+ existing.amount -= r.amount;
+ } else {
+ this.itemStacks.remove(existing);
+ }
+ }
+ return false;
+ }
+
+ public boolean removeAll(Collection<?> c)
+ {
+ boolean addedAll = true;
+ for (Object o : c)
+ {
+ boolean removed = remove(o);
+ addedAll = (removed) && (addedAll);
+ }
+ return false;
+ }
+
+ public boolean retainAll(Collection<?> c)
+ {
+ return this.itemStacks.retainAll(c);
+ }
+
+ public int size()
+ {
+ return this.itemStacks.size();
+ }
+
+ public Object[] toArray()
+ {
+ return this.itemStacks.toArray();
+ }
+
+ public <T> T[] toArray(T[] a)
+ {
+ return this.itemStacks.toArray(a);
+ }
+}
diff --git a/src/Java/binnie/core/util/IValidator.java b/src/Java/binnie/core/util/IValidator.java
new file mode 100644
index 0000000000..c6b39dc153
--- /dev/null
+++ b/src/Java/binnie/core/util/IValidator.java
@@ -0,0 +1,6 @@
+package binnie.core.util;
+
+public abstract interface IValidator<T>
+{
+ public abstract boolean isValid(T paramT);
+}
diff --git a/src/Java/binnie/core/util/ItemStackSet.java b/src/Java/binnie/core/util/ItemStackSet.java
new file mode 100644
index 0000000000..a154f7edfc
--- /dev/null
+++ b/src/Java/binnie/core/util/ItemStackSet.java
@@ -0,0 +1,128 @@
+package binnie.core.util;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import net.minecraft.item.ItemStack;
+
+public class ItemStackSet
+ implements Set<ItemStack>
+{
+ public String toString()
+ {
+ return this.itemStacks.toString();
+ }
+
+ List<ItemStack> itemStacks = new ArrayList();
+
+ protected ItemStack getExisting(ItemStack stack)
+ {
+ for (ItemStack stack2 : this.itemStacks) {
+ if (stack2.isItemEqual(stack)) {
+ return stack2;
+ }
+ }
+ return null;
+ }
+
+ public boolean add(ItemStack e)
+ {
+ if (e != null)
+ {
+ if (getExisting(e) == null) {
+ return this.itemStacks.add(e.copy());
+ }
+ getExisting(e).stackSize += e.stackSize;
+ }
+ return false;
+ }
+
+ public boolean addAll(Collection<? extends ItemStack> c)
+ {
+ boolean addedAll = true;
+ for (ItemStack stack : c) {
+ addedAll = (add(stack)) && (addedAll);
+ }
+ return addedAll;
+ }
+
+ public void clear()
+ {
+ this.itemStacks.clear();
+ }
+
+ public boolean contains(Object o)
+ {
+ if (!(o instanceof ItemStack)) {
+ return false;
+ }
+ return getExisting((ItemStack)o) != null;
+ }
+
+ public boolean containsAll(Collection<?> c)
+ {
+ boolean addedAll = true;
+ for (Object o : c) {
+ addedAll = (addedAll) && (contains(o));
+ }
+ return false;
+ }
+
+ public boolean isEmpty()
+ {
+ return this.itemStacks.isEmpty();
+ }
+
+ public Iterator<ItemStack> iterator()
+ {
+ return this.itemStacks.iterator();
+ }
+
+ public boolean remove(Object o)
+ {
+ if (contains(o))
+ {
+ ItemStack r = (ItemStack)o;
+ ItemStack existing = getExisting(r);
+ if (existing.stackSize > r.stackSize) {
+ existing.stackSize -= r.stackSize;
+ } else {
+ this.itemStacks.remove(existing);
+ }
+ }
+ return false;
+ }
+
+ public boolean removeAll(Collection<?> c)
+ {
+ boolean addedAll = true;
+ for (Object o : c)
+ {
+ boolean removed = remove(o);
+ addedAll = (removed) && (addedAll);
+ }
+ return false;
+ }
+
+ public boolean retainAll(Collection<?> c)
+ {
+ return this.itemStacks.retainAll(c);
+ }
+
+ public int size()
+ {
+ return this.itemStacks.size();
+ }
+
+ public Object[] toArray()
+ {
+ return this.itemStacks.toArray();
+ }
+
+ public <T> T[] toArray(T[] a)
+ {
+ return this.itemStacks.toArray(a);
+ }
+}
diff --git a/src/Java/binnie/core/util/UniqueFluidStackSet.java b/src/Java/binnie/core/util/UniqueFluidStackSet.java
new file mode 100644
index 0000000000..49a7dbab35
--- /dev/null
+++ b/src/Java/binnie/core/util/UniqueFluidStackSet.java
@@ -0,0 +1,28 @@
+package binnie.core.util;
+
+import java.util.List;
+import net.minecraftforge.fluids.FluidStack;
+
+public class UniqueFluidStackSet
+ extends FluidStackSet
+{
+ public boolean add(FluidStack e)
+ {
+ if ((e != null) &&
+ (getExisting(e) == null)) {
+ return this.itemStacks.add(e.copy());
+ }
+ return false;
+ }
+
+ public boolean remove(Object o)
+ {
+ if (contains(o))
+ {
+ FluidStack r = (FluidStack)o;
+ FluidStack existing = getExisting(r);
+ this.itemStacks.remove(existing);
+ }
+ return false;
+ }
+}
diff --git a/src/Java/binnie/core/util/UniqueItemStackSet.java b/src/Java/binnie/core/util/UniqueItemStackSet.java
new file mode 100644
index 0000000000..f9571e8fee
--- /dev/null
+++ b/src/Java/binnie/core/util/UniqueItemStackSet.java
@@ -0,0 +1,28 @@
+package binnie.core.util;
+
+import java.util.List;
+import net.minecraft.item.ItemStack;
+
+public class UniqueItemStackSet
+ extends ItemStackSet
+{
+ public boolean add(ItemStack e)
+ {
+ if ((e != null) &&
+ (getExisting(e) == null)) {
+ return this.itemStacks.add(e.copy());
+ }
+ return false;
+ }
+
+ public boolean remove(Object o)
+ {
+ if (contains(o))
+ {
+ ItemStack r = (ItemStack)o;
+ ItemStack existing = getExisting(r);
+ this.itemStacks.remove(existing);
+ }
+ return false;
+ }
+}
diff --git a/src/Java/binnie/craftgui/binniecore/WindowFieldKit.java b/src/Java/binnie/craftgui/binniecore/WindowFieldKit.java
new file mode 100644
index 0000000000..d52a6cde31
--- /dev/null
+++ b/src/Java/binnie/craftgui/binniecore/WindowFieldKit.java
@@ -0,0 +1,334 @@
+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<IChromosomeType, String> 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<String> 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
new file mode 100644
index 0000000000..8295645f5a
--- /dev/null
+++ b/src/Java/binnie/craftgui/binniecore/WindowGenesis.java
@@ -0,0 +1,264 @@
+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<Gene> geneList;
+ private ControlListBox<Gene> 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<BreedingSystem> tabSystems = new ControlTabBar(this, 8.0F, 28.0F, 23.0F, 100.0F, Position.Left)
+ {
+ public ControlTab<BreedingSystem> 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<IChromosomeType, List<IAllele>> map = Binnie.Genetics.getChromosomeMap(WindowGenesis.this.root);
+ List<Gene> 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<Gene> 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<IChromosomeType, List<IAllele>> 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/botany/ControlColourDisplay.java b/src/Java/binnie/craftgui/botany/ControlColourDisplay.java
new file mode 100644
index 0000000000..21408ec4ad
--- /dev/null
+++ b/src/Java/binnie/craftgui/botany/ControlColourDisplay.java
@@ -0,0 +1,47 @@
+package binnie.craftgui.botany;
+
+import binnie.botany.api.IFlowerColour;
+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.ITooltip;
+import binnie.craftgui.core.IWidget;
+import binnie.craftgui.core.Tooltip;
+import binnie.craftgui.core.geometry.IArea;
+import binnie.craftgui.core.renderer.Renderer;
+
+public class ControlColourDisplay
+ extends Control
+ implements IControlValue<IFlowerColour>, ITooltip
+{
+ IFlowerColour value;
+
+ public ControlColourDisplay(IWidget parent, float x, float y)
+ {
+ super(parent, x, y, 16.0F, 16.0F);
+ addAttribute(Attribute.MouseOver);
+ }
+
+ public IFlowerColour getValue()
+ {
+ return this.value;
+ }
+
+ public void setValue(IFlowerColour value)
+ {
+ this.value = value;
+ }
+
+ public void onRenderBackground()
+ {
+ CraftGUI.Render.solid(getArea(), -1);
+ CraftGUI.Render.solid(getArea().inset(1), -16777216 + getValue().getColor(false));
+ }
+
+ public void getTooltip(Tooltip tooltip)
+ {
+ super.getTooltip(tooltip);
+ tooltip.add(this.value.getName());
+ }
+}
diff --git a/src/Java/binnie/craftgui/botany/ControlColourMixBox.java b/src/Java/binnie/craftgui/botany/ControlColourMixBox.java
new file mode 100644
index 0000000000..7ca4fa98f2
--- /dev/null
+++ b/src/Java/binnie/craftgui/botany/ControlColourMixBox.java
@@ -0,0 +1,31 @@
+package binnie.craftgui.botany;
+
+import binnie.botany.api.IColourMix;
+import binnie.craftgui.controls.listbox.ControlList;
+import binnie.craftgui.controls.listbox.ControlListBox;
+import binnie.craftgui.core.IWidget;
+
+public class ControlColourMixBox
+ extends ControlListBox<IColourMix>
+{
+ private int index;
+ private Type type;
+
+ public IWidget createOption(IColourMix value, int y)
+ {
+ return new ControlColourMixItem((ControlList)getContent(), value, y);
+ }
+
+ static enum Type
+ {
+ Resultant, Further;
+
+ private Type() {}
+ }
+
+ public ControlColourMixBox(IWidget parent, int x, int y, int width, int height, Type type)
+ {
+ super(parent, x, y, width, height, 12.0F);
+ this.type = type;
+ }
+}
diff --git a/src/Java/binnie/craftgui/botany/ControlColourMixItem.java b/src/Java/binnie/craftgui/botany/ControlColourMixItem.java
new file mode 100644
index 0000000000..cf519b9a8e
--- /dev/null
+++ b/src/Java/binnie/craftgui/botany/ControlColourMixItem.java
@@ -0,0 +1,37 @@
+package binnie.craftgui.botany;
+
+import binnie.botany.api.IColourMix;
+import binnie.core.genetics.BreedingSystem;
+import binnie.craftgui.controls.listbox.ControlList;
+import binnie.craftgui.controls.listbox.ControlOption;
+import binnie.craftgui.mod.database.WindowAbstractDatabase;
+
+public class ControlColourMixItem
+ extends ControlOption<IColourMix>
+{
+ ControlColourDisplay itemWidget1;
+ ControlColourDisplay itemWidget2;
+ ControlColourDisplay itemWidget3;
+ ControlColourMixSymbol addSymbol;
+ ControlColourMixSymbol arrowSymbol;
+
+ public ControlColourMixItem(ControlList<IColourMix> controlList, IColourMix option, int y)
+ {
+ super(controlList, option, y);
+ this.itemWidget1 = new ControlColourDisplay(this, 4.0F, 4.0F);
+ this.itemWidget2 = new ControlColourDisplay(this, 44.0F, 4.0F);
+ this.itemWidget3 = new ControlColourDisplay(this, 104.0F, 4.0F);
+ this.addSymbol = new ControlColourMixSymbol(this, 24, 4, 0);
+ this.arrowSymbol = new ControlColourMixSymbol(this, 64, 4, 1);
+
+ BreedingSystem system = ((WindowAbstractDatabase)getSuperParent()).getBreedingSystem();
+ if (getValue() != null)
+ {
+ this.itemWidget1.setValue(((IColourMix)getValue()).getColour1());
+ this.itemWidget2.setValue(((IColourMix)getValue()).getColour2());
+ this.itemWidget3.setValue(((IColourMix)getValue()).getResult());
+ this.addSymbol.setValue((IColourMix)getValue());
+ this.arrowSymbol.setValue((IColourMix)getValue());
+ }
+ }
+}
diff --git a/src/Java/binnie/craftgui/botany/ControlColourMixSymbol.java b/src/Java/binnie/craftgui/botany/ControlColourMixSymbol.java
new file mode 100644
index 0000000000..5afb98d54f
--- /dev/null
+++ b/src/Java/binnie/craftgui/botany/ControlColourMixSymbol.java
@@ -0,0 +1,58 @@
+package binnie.craftgui.botany;
+
+import binnie.botany.api.IColourMix;
+import binnie.craftgui.controls.core.Control;
+import binnie.craftgui.core.Attribute;
+import binnie.craftgui.core.CraftGUI;
+import binnie.craftgui.core.ITooltip;
+import binnie.craftgui.core.IWidget;
+import binnie.craftgui.core.Tooltip;
+import binnie.craftgui.core.geometry.IPoint;
+import binnie.craftgui.core.renderer.Renderer;
+import binnie.craftgui.resource.Texture;
+import binnie.craftgui.resource.minecraft.CraftGUITextureSheet;
+import binnie.craftgui.resource.minecraft.StandardTexture;
+
+public class ControlColourMixSymbol
+ extends Control
+ implements ITooltip
+{
+ static Texture MutationPlus = new StandardTexture(2, 94, 16, 16, CraftGUITextureSheet.Controls2);
+ static Texture MutationArrow = new StandardTexture(20, 94, 32, 16, CraftGUITextureSheet.Controls2);
+ IColourMix value;
+ int type;
+
+ public void onRenderBackground()
+ {
+ super.onRenderBackground();
+ if (this.type == 0) {
+ CraftGUI.Render.texture(MutationPlus, IPoint.ZERO);
+ } else {
+ CraftGUI.Render.texture(MutationArrow, IPoint.ZERO);
+ }
+ }
+
+ protected ControlColourMixSymbol(IWidget parent, int x, int y, int type)
+ {
+ super(parent, x, y, 16 + type * 16, 16.0F);
+ this.value = null;
+ this.type = type;
+ addAttribute(Attribute.MouseOver);
+ }
+
+ public void setValue(IColourMix value)
+ {
+ this.value = value;
+
+ setColour(16777215);
+ }
+
+ public void getTooltip(Tooltip tooltip)
+ {
+ if (this.type == 1)
+ {
+ float chance = this.value.getChance();
+ tooltip.add("Current Chance - " + chance + "%");
+ }
+ }
+}
diff --git a/src/Java/binnie/craftgui/botany/ControlColourOption.java b/src/Java/binnie/craftgui/botany/ControlColourOption.java
new file mode 100644
index 0000000000..0a94e5690f
--- /dev/null
+++ b/src/Java/binnie/craftgui/botany/ControlColourOption.java
@@ -0,0 +1,38 @@
+package binnie.craftgui.botany;
+
+import binnie.botany.api.IFlowerColour;
+import binnie.craftgui.controls.ControlText;
+import binnie.craftgui.controls.listbox.ControlList;
+import binnie.craftgui.controls.listbox.ControlTextOption;
+import binnie.craftgui.core.Attribute;
+import binnie.craftgui.core.CraftGUI;
+import binnie.craftgui.core.geometry.CraftGUIUtil;
+import binnie.craftgui.core.geometry.IPoint;
+import binnie.craftgui.core.renderer.Renderer;
+
+public class ControlColourOption
+ extends ControlTextOption<IFlowerColour>
+{
+ ControlColourDisplay controlBee;
+ IPoint boxPosition;
+
+ public ControlColourOption(ControlList<IFlowerColour> controlList, IFlowerColour option, int y)
+ {
+ super(controlList, option, option.getName(), y);
+ setSize(new IPoint(getSize().x(), 20.0F));
+
+ this.controlBee = new ControlColourDisplay(this, 2.0F, 2.0F);
+ this.controlBee.setValue(option);
+
+ addAttribute(Attribute.MouseOver);
+
+ CraftGUIUtil.moveWidget(this.textWidget, new IPoint(22.0F, 0.0F));
+ this.textWidget.setSize(this.textWidget.getSize().sub(new IPoint(24.0F, 0.0F)));
+
+ int th = (int)CraftGUI.Render.textHeight(this.textWidget.getValue(), this.textWidget.getSize().x());
+ int height = Math.max(20, th + 6);
+ setSize(new IPoint(size().x(), height));
+ this.textWidget.setSize(new IPoint(this.textWidget.getSize().x(), height));
+ this.boxPosition = new IPoint(2.0F, (height - 18) / 2);
+ }
+}
diff --git a/src/Java/binnie/craftgui/botany/PageColourMix.java b/src/Java/binnie/craftgui/botany/PageColourMix.java
new file mode 100644
index 0000000000..5fc7e335db
--- /dev/null
+++ b/src/Java/binnie/craftgui/botany/PageColourMix.java
@@ -0,0 +1,40 @@
+package binnie.craftgui.botany;
+
+import binnie.botany.api.IColourMix;
+import binnie.botany.api.IFlowerColour;
+import binnie.botany.api.IFlowerRoot;
+import binnie.botany.core.BotanyCore;
+import binnie.craftgui.controls.ControlText;
+import binnie.craftgui.controls.ControlTextCentered;
+import binnie.craftgui.core.IWidget;
+import binnie.craftgui.mod.database.DatabaseTab;
+import binnie.craftgui.mod.database.PageAbstract;
+import java.util.ArrayList;
+import java.util.List;
+
+public class PageColourMix
+ extends PageAbstract<IFlowerColour>
+{
+ ControlText pageSpeciesFurther_Title;
+ ControlColourMixBox pageSpeciesFurther_List;
+
+ public PageColourMix(IWidget parent, DatabaseTab tab)
+ {
+ super(parent, tab);
+
+ this.pageSpeciesFurther_Title = new ControlTextCentered(this, 8.0F, "Further Mixes");
+
+ this.pageSpeciesFurther_List = new ControlColourMixBox(this, 4, 20, 136, 152, ControlColourMixBox.Type.Further);
+ }
+
+ public void onValueChanged(IFlowerColour colour)
+ {
+ List<IColourMix> mixes = new ArrayList();
+ for (IColourMix mix : BotanyCore.getFlowerRoot().getColourMixes(false)) {
+ if ((mix.getColour1() == colour) || (mix.getColour2() == colour)) {
+ mixes.add(mix);
+ }
+ }
+ this.pageSpeciesFurther_List.setOptions(mixes);
+ }
+}
diff --git a/src/Java/binnie/craftgui/botany/PageColourMixResultant.java b/src/Java/binnie/craftgui/botany/PageColourMixResultant.java
new file mode 100644
index 0000000000..a8a50f2cb7
--- /dev/null
+++ b/src/Java/binnie/craftgui/botany/PageColourMixResultant.java
@@ -0,0 +1,40 @@
+package binnie.craftgui.botany;
+
+import binnie.botany.api.IColourMix;
+import binnie.botany.api.IFlowerColour;
+import binnie.botany.api.IFlowerRoot;
+import binnie.botany.core.BotanyCore;
+import binnie.craftgui.controls.ControlText;
+import binnie.craftgui.controls.ControlTextCentered;
+import binnie.craftgui.core.IWidget;
+import binnie.craftgui.mod.database.DatabaseTab;
+import binnie.craftgui.mod.database.PageAbstract;
+import java.util.ArrayList;
+import java.util.List;
+
+public class PageColourMixResultant
+ extends PageAbstract<IFlowerColour>
+{
+ ControlText pageSpeciesFurther_Title;
+ ControlColourMixBox pageSpeciesFurther_List;
+
+ public PageColourMixResultant(IWidget parent, DatabaseTab tab)
+ {
+ super(parent, tab);
+
+ this.pageSpeciesFurther_Title = new ControlTextCentered(this, 8.0F, "Resultant Mixes");
+
+ this.pageSpeciesFurther_List = new ControlColourMixBox(this, 4, 20, 136, 152, ControlColourMixBox.Type.Resultant);
+ }
+
+ public void onValueChanged(IFlowerColour colour)
+ {
+ List<IColourMix> mixes = new ArrayList();
+ for (IColourMix mix : BotanyCore.getFlowerRoot().getColourMixes(false)) {
+ if (mix.getResult() == colour) {
+ mixes.add(mix);
+ }
+ }
+ this.pageSpeciesFurther_List.setOptions(mixes);
+ }
+}
diff --git a/src/Java/binnie/craftgui/botany/PageSpeciesFlowerGenome.java b/src/Java/binnie/craftgui/botany/PageSpeciesFlowerGenome.java
new file mode 100644
index 0000000000..dece27f306
--- /dev/null
+++ b/src/Java/binnie/craftgui/botany/PageSpeciesFlowerGenome.java
@@ -0,0 +1,137 @@
+package binnie.craftgui.botany;
+
+import binnie.Binnie;
+import binnie.botany.api.EnumFlowerChromosome;
+import binnie.botany.api.EnumFlowerStage;
+import binnie.botany.api.IAlleleFlowerSpecies;
+import binnie.botany.api.IFlower;
+import binnie.botany.api.IFlowerGenome;
+import binnie.botany.api.IFlowerRoot;
+import binnie.botany.core.BotanyCore;
+import binnie.core.genetics.ManagerGenetics;
+import binnie.core.language.ManagerLanguage;
+import binnie.craftgui.controls.ControlText;
+import binnie.craftgui.controls.core.Control;
+import binnie.craftgui.controls.scroll.ControlScrollableContent;
+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.minecraft.control.ControlItemDisplay;
+import binnie.craftgui.mod.database.DatabaseTab;
+import binnie.craftgui.mod.database.PageSpecies;
+import forestry.api.core.EnumTemperature;
+import forestry.api.genetics.IAllele;
+import forestry.api.genetics.IAlleleSpecies;
+import forestry.api.genetics.IGenome;
+import forestry.api.genetics.IIndividual;
+import net.minecraft.item.ItemStack;
+
+public class PageSpeciesFlowerGenome
+ extends PageSpecies
+{
+ public PageSpeciesFlowerGenome(IWidget parent, DatabaseTab tab)
+ {
+ super(parent, tab);
+ }
+
+ public void onValueChanged(IAlleleSpecies species)
+ {
+ deleteAllChildren();
+ IAllele[] template = Binnie.Genetics.getFlowerRoot().getTemplate(species.getUID());
+ if (template == null) {
+ return;
+ }
+ IFlower tree = Binnie.Genetics.getFlowerRoot().templateAsIndividual(template);
+ if (tree == null) {
+ return;
+ }
+ IFlowerGenome genome = tree.getGenome();
+ IAlleleFlowerSpecies treeSpecies = genome.getPrimary();
+
+ int w = 144;
+ int h = 176;
+
+ new ControlText(this, new IArea(0.0F, 4.0F, w, 16.0F), "Genome", TextJustification.MiddleCenter);
+
+ ControlScrollableContent scrollable = new ControlScrollableContent(this, 4.0F, 20.0F, w - 8, h - 8 - 16, 12.0F);
+
+ Control contents = new Control(scrollable, 0.0F, 0.0F, w - 8 - 12, h - 8 - 16);
+
+ int tw = w - 8 - 12;
+ int w1 = 55;
+ int w2 = tw - 50;
+ int y = 0;
+ int th = 14;
+ int th2 = 18;
+
+ new ControlText(contents, new IArea(0.0F, y, w1, th), "Temp. : ", TextJustification.MiddleRight);
+ new ControlText(contents, new IArea(w1, y, w2, th), treeSpecies.getTemperature().getName(), TextJustification.MiddleLeft);
+
+ y += th;
+
+ new ControlText(contents, new IArea(0.0F, y, w1, th), "Moist. : ", TextJustification.MiddleRight);
+ new ControlText(contents, new IArea(w1, y, w2, th), Binnie.Language.localise(treeSpecies.getMoisture()), TextJustification.MiddleLeft);
+
+
+ y += th;
+
+ new ControlText(contents, new IArea(0.0F, y, w1, th), "pH. : ", TextJustification.MiddleRight);
+ new ControlText(contents, new IArea(w1, y, w2, th), Binnie.Language.localise(treeSpecies.getPH()), TextJustification.MiddleLeft);
+
+ y += th;
+
+ new ControlText(contents, new IArea(0.0F, y, w1, th), "Fertility : ", TextJustification.MiddleRight);
+ new ControlText(contents, new IArea(w1, y, w2, th), genome.getFertility() + "x", TextJustification.MiddleLeft);
+ y += th;
+
+ float lifespan = genome.getLifespan() * 68.269997F / genome.getAgeChance() / 24000.0F;
+
+ new ControlText(contents, new IArea(0.0F, y, w1, th), "Lifespan : ", TextJustification.MiddleRight);
+ new ControlText(contents, new IArea(w1, y, w2, th), "" + String.format("%.2f", new Object[] { Float.valueOf(lifespan) }) + " days", TextJustification.MiddleLeft);
+
+ y += th;
+
+ new ControlText(contents, new IArea(0.0F, y, w1, th), "Nectar : ", TextJustification.MiddleRight);
+ new ControlText(contents, new IArea(w1, y, w2, th), genome.getActiveAllele(EnumFlowerChromosome.SAPPINESS).getName(), TextJustification.MiddleLeft);
+
+
+ y += th;
+
+ int x = w1;
+ int tot = 0;
+ for (IIndividual vid : BotanyCore.getFlowerRoot().getIndividualTemplates()) {
+ if (vid.getGenome().getPrimary() == treeSpecies)
+ {
+ if ((tot > 0) && (tot % 3 == 0))
+ {
+ x -= 54;
+ y += 18;
+ }
+ ItemStack stack = BotanyCore.getFlowerRoot().getMemberStack((IFlower)vid, EnumFlowerStage.FLOWER.ordinal());
+ ControlItemDisplay display = new ControlItemDisplay(contents, x, y);
+ display.setItemStack(stack);
+ tot++;
+ x += 18;
+ }
+ }
+ int numOfLines = 1 + (tot - 1) / 3;
+
+ new ControlText(contents, new IArea(0.0F, y - (numOfLines - 1) * 18, w1, 4 + 18 * numOfLines), "Varieties : ", TextJustification.MiddleRight);
+
+
+ y += th;
+
+ contents.setSize(new IPoint(contents.size().x(), y));
+
+ scrollable.setScrollableContent(contents);
+ }
+
+ public static String tolerated(boolean t)
+ {
+ if (t) {
+ return "Tolerated";
+ }
+ return "Not Tolerated";
+ }
+}
diff --git a/src/Java/binnie/craftgui/botany/WindowBotanistDatabase.java b/src/Java/binnie/craftgui/botany/WindowBotanistDatabase.java
new file mode 100644
index 0000000000..69a2a291ca
--- /dev/null
+++ b/src/Java/binnie/craftgui/botany/WindowBotanistDatabase.java
@@ -0,0 +1,103 @@
+package binnie.craftgui.botany;
+
+import binnie.Binnie;
+import binnie.botany.Botany;
+import binnie.botany.api.IFlowerColour;
+import binnie.botany.genetics.EnumFlowerColor;
+import binnie.botany.proxy.Proxy;
+import binnie.core.AbstractMod;
+import binnie.core.genetics.ManagerGenetics;
+import binnie.craftgui.controls.listbox.ControlList;
+import binnie.craftgui.controls.listbox.ControlListBox;
+import binnie.craftgui.core.IWidget;
+import binnie.craftgui.core.geometry.IArea;
+import binnie.craftgui.minecraft.Window;
+import binnie.craftgui.mod.database.DatabaseTab;
+import binnie.craftgui.mod.database.IDatabaseMode;
+import binnie.craftgui.mod.database.PageBranchOverview;
+import binnie.craftgui.mod.database.PageBranchSpecies;
+import binnie.craftgui.mod.database.PageBreeder;
+import binnie.craftgui.mod.database.PageSpeciesClassification;
+import binnie.craftgui.mod.database.PageSpeciesMutations;
+import binnie.craftgui.mod.database.PageSpeciesOverview;
+import binnie.craftgui.mod.database.PageSpeciesResultant;
+import binnie.craftgui.mod.database.WindowAbstractDatabase;
+import binnie.craftgui.mod.database.WindowAbstractDatabase.Mode;
+import binnie.craftgui.mod.database.WindowAbstractDatabase.ModeWidgets;
+import cpw.mods.fml.relauncher.Side;
+import java.util.ArrayList;
+import java.util.List;
+import net.minecraft.entity.player.EntityPlayer;
+
+public class WindowBotanistDatabase
+ extends WindowAbstractDatabase
+{
+ ControlListBox<EnumFlowerColor> selectionBoxColors;
+
+ static enum FlowerMode
+ implements IDatabaseMode
+ {
+ Colour;
+
+ private FlowerMode() {}
+
+ public String getName()
+ {
+ return Botany.proxy.localise("gui.database.mode." + name().toLowerCase());
+ }
+ }
+
+ public WindowBotanistDatabase(EntityPlayer player, Side side, boolean nei)
+ {
+ super(player, side, nei, Binnie.Genetics.flowerBreedingSystem, 130.0F);
+ }
+
+ public static Window create(EntityPlayer player, Side side, boolean nei)
+ {
+ return new WindowBotanistDatabase(player, side, nei);
+ }
+
+ protected void addTabs()
+ {
+ new PageSpeciesOverview(getInfoPages(WindowAbstractDatabase.Mode.Species), new DatabaseTab(Botany.instance, "species.overview", 0));
+ new PageSpeciesFlowerGenome(getInfoPages(WindowAbstractDatabase.Mode.Species), new DatabaseTab(Botany.instance, "species.genome", 0));
+ new PageSpeciesClassification(getInfoPages(WindowAbstractDatabase.Mode.Species), new DatabaseTab(Botany.instance, "species.classification", 0));
+ new PageSpeciesResultant(getInfoPages(WindowAbstractDatabase.Mode.Species), new DatabaseTab(Botany.instance, "species.resultant", 0));
+ new PageSpeciesMutations(getInfoPages(WindowAbstractDatabase.Mode.Species), new DatabaseTab(Botany.instance, "species.further", 0));
+
+ new PageBranchOverview(getInfoPages(WindowAbstractDatabase.Mode.Branches), new DatabaseTab(Botany.instance, "branches.overview", 0));
+ new PageBranchSpecies(getInfoPages(WindowAbstractDatabase.Mode.Branches), new DatabaseTab(Botany.instance, "branches.species", 0));
+
+ createMode(FlowerMode.Colour, new WindowAbstractDatabase.ModeWidgets(FlowerMode.Colour, this)
+ {
+ public void createListBox(IArea area)
+ {
+ this.listBox = new ControlListBox(this.modePage, area.x(), area.y(), area.w(), area.h(), 12.0F)
+ {
+ public IWidget createOption(IFlowerColour value, int y)
+ {
+ return new ControlColourOption((ControlList)getContent(), value, y);
+ }
+ };
+ List<IFlowerColour> colors = new ArrayList();
+ for (IFlowerColour c : EnumFlowerColor.values()) {
+ colors.add(c);
+ }
+ this.listBox.setOptions(colors);
+ }
+ });
+ new PageColourMixResultant(getInfoPages(FlowerMode.Colour), new DatabaseTab(Botany.instance, "colour.resultant", 0));
+ new PageColourMix(getInfoPages(FlowerMode.Colour), new DatabaseTab(Botany.instance, "colour.further", 0));
+ new PageBreeder(getInfoPages(WindowAbstractDatabase.Mode.Breeder), getUsername(), new DatabaseTab(Botany.instance, "breeder", 0));
+ }
+
+ protected AbstractMod getMod()
+ {
+ return Botany.instance;
+ }
+
+ protected String getName()
+ {
+ return "FlowerDatabase";
+ }
+}
diff --git a/src/Java/binnie/craftgui/controls/ControlCheckbox.java b/src/Java/binnie/craftgui/controls/ControlCheckbox.java
new file mode 100644
index 0000000000..edfeab631c
--- /dev/null
+++ b/src/Java/binnie/craftgui/controls/ControlCheckbox.java
@@ -0,0 +1,75 @@
+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>
+{
+ 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
new file mode 100644
index 0000000000..4df9c04db1
--- /dev/null
+++ b/src/Java/binnie/craftgui/controls/ControlText.java
@@ -0,0 +1,50 @@
+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<String>
+{
+ 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
new file mode 100644
index 0000000000..12434528db
--- /dev/null
+++ b/src/Java/binnie/craftgui/controls/ControlTextCentered.java
@@ -0,0 +1,15 @@
+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
new file mode 100644
index 0000000000..8c07a12d7c
--- /dev/null
+++ b/src/Java/binnie/craftgui/controls/ControlTextEdit.java
@@ -0,0 +1,154 @@
+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<String>
+{
+ 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
new file mode 100644
index 0000000000..4648f49290
--- /dev/null
+++ b/src/Java/binnie/craftgui/controls/IControlSelection.java
@@ -0,0 +1,10 @@
+package binnie.craftgui.controls;
+
+public abstract interface IControlSelection<T>
+{
+ public abstract T getSelectedValue();
+
+ public abstract void setSelectedValue(T paramT);
+
+ public abstract boolean isSelected(IControlSelectionOption<T> paramIControlSelectionOption);
+}
diff --git a/src/Java/binnie/craftgui/controls/IControlSelectionOption.java b/src/Java/binnie/craftgui/controls/IControlSelectionOption.java
new file mode 100644
index 0000000000..9074a55541
--- /dev/null
+++ b/src/Java/binnie/craftgui/controls/IControlSelectionOption.java
@@ -0,0 +1,6 @@
+package binnie.craftgui.controls;
+
+public abstract interface IControlSelectionOption<T>
+{
+ public abstract T getValue();
+}
diff --git a/src/Java/binnie/craftgui/controls/button/ControlButton.java b/src/Java/binnie/craftgui/controls/button/ControlButton.java
new file mode 100644
index 0000000000..b41cb65116
--- /dev/null
+++ b/src/Java/binnie/craftgui/controls/button/ControlButton.java
@@ -0,0 +1,70 @@
+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
new file mode 100644
index 0000000000..924bd8c110
--- /dev/null
+++ b/src/Java/binnie/craftgui/controls/button/ControlEnumButton.java
@@ -0,0 +1,61 @@
+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<T>
+ extends ControlButton
+ implements IControlValue<T>
+{
+ 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<T> 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
new file mode 100644
index 0000000000..1a06801fbd
--- /dev/null
+++ b/src/Java/binnie/craftgui/controls/button/ControlToggleButton.java
@@ -0,0 +1,21 @@
+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
new file mode 100644
index 0000000000..f5f7bddabb
--- /dev/null
+++ b/src/Java/binnie/craftgui/controls/core/Control.java
@@ -0,0 +1,85 @@
+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<String> helpStrings = new ArrayList();
+ List<String> 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
new file mode 100644
index 0000000000..a30bceb76c
--- /dev/null
+++ b/src/Java/binnie/craftgui/controls/core/IControlIndexed.java
@@ -0,0 +1,8 @@
+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
new file mode 100644
index 0000000000..9d44b8ad17
--- /dev/null
+++ b/src/Java/binnie/craftgui/controls/core/IControlValue.java
@@ -0,0 +1,11 @@
+package binnie.craftgui.controls.core;
+
+import binnie.craftgui.core.IWidget;
+
+public abstract interface IControlValue<T>
+ 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
new file mode 100644
index 0000000000..92bb5d1f13
--- /dev/null
+++ b/src/Java/binnie/craftgui/controls/core/IControlValues.java
@@ -0,0 +1,11 @@
+package binnie.craftgui.controls.core;
+
+import java.util.Collection;
+
+public abstract interface IControlValues<T>
+ extends IControlValue<T>
+{
+ public abstract Collection<T> getValues();
+
+ public abstract void setValues(Collection<T> paramCollection);
+}
diff --git a/src/Java/binnie/craftgui/controls/listbox/ControlList.java b/src/Java/binnie/craftgui/controls/listbox/ControlList.java
new file mode 100644
index 0000000000..d1b6be8821
--- /dev/null
+++ b/src/Java/binnie/craftgui/controls/listbox/ControlList.java
@@ -0,0 +1,146 @@
+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<T>
+ extends Control
+ implements IControlValue<T>
+{
+ ControlListBox<T> parent;
+
+ protected ControlList(ControlListBox<T> parent, float x, float y, float w, float h)
+ {
+ super(parent, x, y, w, h);
+ this.parent = parent;
+ }
+
+ T value = null;
+ Map<T, IWidget> allOptions = new LinkedHashMap();
+ Map<T, IWidget> 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<IWidget> validator;
+
+ public void setOptions(Collection<T> 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<T, IWidget> 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<T> getOptions()
+ {
+ return this.optionWidgets.keySet();
+ }
+
+ public Collection<T> 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<IWidget> 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
new file mode 100644
index 0000000000..e9370daa3d
--- /dev/null
+++ b/src/Java/binnie/craftgui/controls/listbox/ControlListBox.java
@@ -0,0 +1,76 @@
+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<T>
+ extends ControlScrollableContent<ControlList<T>>
+ implements IControlValue<T>
+{
+ 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)getContent()).getValue();
+ }
+
+ public final void setValue(T value)
+ {
+ ((ControlList)getContent()).setValue(value);
+ }
+
+ public void setOptions(Collection<T> options)
+ {
+ ((ControlList)getContent()).setOptions(options);
+ }
+
+ public IWidget createOption(T value, int y)
+ {
+ return new ControlOption((ControlList)getContent(), value, y);
+ }
+
+ public void setValidator(IValidator<IWidget> validator)
+ {
+ ((ControlList)getContent()).setValidator(validator);
+ }
+}
diff --git a/src/Java/binnie/craftgui/controls/listbox/ControlOption.java b/src/Java/binnie/craftgui/controls/listbox/ControlOption.java
new file mode 100644
index 0000000000..7a643101cf
--- /dev/null
+++ b/src/Java/binnie/craftgui/controls/listbox/ControlOption.java
@@ -0,0 +1,73 @@
+package binnie.craftgui.controls.listbox;
+
+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.geometry.IPoint;
+import binnie.craftgui.core.renderer.Renderer;
+import binnie.craftgui.events.EventMouse.Down;
+import binnie.craftgui.events.EventMouse.Down.Handler;
+import binnie.craftgui.resource.minecraft.CraftGUITexture;
+
+public class ControlOption<T>
+ extends Control
+ implements IControlValue<T>
+{
+ T value;
+
+ public void onUpdateClient()
+ {
+ if (getValue() == null) {
+ return;
+ }
+ int colour = 10526880;
+ if (isCurrentSelection()) {
+ colour = 16777215;
+ }
+ setColour(colour);
+ }
+
+ public ControlOption(ControlList<T> controlList, T option)
+ {
+ this(controlList, option, 16);
+ }
+
+ public ControlOption(ControlList<T> controlList, T option, int height)
+ {
+ super(controlList, 0.0F, height, controlList.getSize().x(), 20.0F);
+ this.value = option;
+ if (this.value != null) {
+ addAttribute(Attribute.MouseOver);
+ }
+ addSelfEventHandler(new EventMouse.Down.Handler()
+ {
+ public void onEvent(EventMouse.Down event)
+ {
+ ((IControlValue)ControlOption.this.getParent()).setValue(ControlOption.this.getValue());
+ }
+ });
+ }
+
+ public T getValue()
+ {
+ return this.value;
+ }
+
+ public void setValue(T value)
+ {
+ this.value = value;
+ }
+
+ public boolean isCurrentSelection()
+ {
+ return (getValue() != null) && (getValue().equals(((IControlValue)getParent()).getValue()));
+ }
+
+ public void onRenderForeground()
+ {
+ if (isCurrentSelection()) {
+ CraftGUI.Render.texture(CraftGUITexture.Outline, getArea());
+ }
+ }
+}
diff --git a/src/Java/binnie/craftgui/controls/listbox/ControlTextOption.java b/src/Java/binnie/craftgui/controls/listbox/ControlTextOption.java
new file mode 100644
index 0000000000..6a47ec5d41
--- /dev/null
+++ b/src/Java/binnie/craftgui/controls/listbox/ControlTextOption.java
@@ -0,0 +1,37 @@
+package binnie.craftgui.controls.listbox;
+
+import binnie.craftgui.controls.ControlText;
+import binnie.craftgui.core.geometry.TextJustification;
+import binnie.craftgui.events.EventHandler.Origin;
+import binnie.craftgui.events.EventWidget.ChangeColour;
+import binnie.craftgui.events.EventWidget.ChangeColour.Handler;
+
+public class ControlTextOption<T>
+ extends ControlOption<T>
+{
+ public ControlTextOption(ControlList<T> controlList, T option, String optionName, int y)
+ {
+ super(controlList, option, y);
+ this.textWidget = new ControlText(this, getArea(), optionName, TextJustification.MiddleCenter);
+
+ addEventHandler(new EventWidget.ChangeColour.Handler()
+ {
+ public void onEvent(EventWidget.ChangeColour event)
+ {
+ ControlTextOption.this.textWidget.setColour(ControlTextOption.this.getColour());
+ }
+ }.setOrigin(EventHandler.Origin.Self, this));
+ }
+
+ public ControlTextOption(ControlList<T> controlList, T option, int y)
+ {
+ this(controlList, option, option.toString(), y);
+ }
+
+ protected ControlText textWidget = null;
+
+ public String getText()
+ {
+ return this.textWidget.getValue();
+ }
+}
diff --git a/src/Java/binnie/craftgui/controls/page/ControlPage.java b/src/Java/binnie/craftgui/controls/page/ControlPage.java
new file mode 100644
index 0000000000..0e5c89492e
--- /dev/null
+++ b/src/Java/binnie/craftgui/controls/page/ControlPage.java
@@ -0,0 +1,36 @@
+package binnie.craftgui.controls.page;
+
+import binnie.craftgui.controls.core.Control;
+import binnie.craftgui.controls.core.IControlValue;
+import binnie.craftgui.core.IWidget;
+
+public class ControlPage<T>
+ extends Control
+ implements IControlValue<T>
+{
+ T value;
+
+ public ControlPage(IWidget parent, T value)
+ {
+ this(parent, 0.0F, 0.0F, parent.w(), parent.h(), value);
+ }
+
+ public ControlPage(IWidget parent, float x, float y, float w, float h, T value)
+ {
+ super(parent, x, y, w, h);
+ setValue(value);
+ if (((parent instanceof IControlValue)) && (((IControlValue)parent).getValue() == null)) {
+ ((IControlValue)parent).setValue(value);
+ }
+ }
+
+ public T getValue()
+ {
+ return this.value;
+ }
+
+ public void setValue(T value)
+ {
+ this.value = value;
+ }
+}
diff --git a/src/Java/binnie/craftgui/controls/page/ControlPages.java b/src/Java/binnie/craftgui/controls/page/ControlPages.java
new file mode 100644
index 0000000000..43a205e874
--- /dev/null
+++ b/src/Java/binnie/craftgui/controls/page/ControlPages.java
@@ -0,0 +1,57 @@
+package binnie.craftgui.controls.page;
+
+import binnie.craftgui.controls.core.Control;
+import binnie.craftgui.controls.core.IControlValue;
+import binnie.craftgui.controls.core.IControlValues;
+import binnie.craftgui.core.IWidget;
+import binnie.craftgui.events.EventValueChanged;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+public class ControlPages<T>
+ extends Control
+ implements IControlValues<T>, IControlValue<T>
+{
+ public boolean isChildVisible(IWidget child)
+ {
+ if (child == null) {
+ return false;
+ }
+ return this.value == ((IControlValue)child).getValue();
+ }
+
+ public ControlPages(IWidget parent, float x, float y, float w, float h)
+ {
+ super(parent, x, y, w, h);
+ }
+
+ T value = null;
+
+ public void onAddChild(IWidget widget) {}
+
+ public T getValue()
+ {
+ return this.value;
+ }
+
+ public void setValue(T value)
+ {
+ if (this.value != value)
+ {
+ this.value = value;
+ callEvent(new EventValueChanged(this, value));
+ }
+ }
+
+ public Collection<T> getValues()
+ {
+ List<T> list = new ArrayList();
+ for (IWidget child : getWidgets()) {
+ list.add(((IControlValue)child).getValue());
+ }
+ return list;
+ }
+
+ public void setValues(Collection<T> values) {}
+}
diff --git a/src/Java/binnie/craftgui/controls/scroll/ControlScroll.java b/src/Java/binnie/craftgui/controls/scroll/ControlScroll.java
new file mode 100644
index 0000000000..1d03f5fbc7
--- /dev/null
+++ b/src/Java/binnie/craftgui/controls/scroll/ControlScroll.java
@@ -0,0 +1,22 @@
+package binnie.craftgui.controls.scroll;
+
+import binnie.craftgui.controls.core.Control;
+import binnie.craftgui.core.IWidget;
+
+public class ControlScroll
+ extends Control
+{
+ private IControlScrollable scrollWidget;
+
+ public ControlScroll(IWidget parent, float x, float y, float width, float height, IControlScrollable scrollWidget)
+ {
+ super(parent, x, y, width, height);
+ this.scrollWidget = scrollWidget;
+ new ControlScrollBar(this);
+ }
+
+ public IControlScrollable getScrollableWidget()
+ {
+ return this.scrollWidget;
+ }
+}
diff --git a/src/Java/binnie/craftgui/controls/scroll/ControlScrollBar.java b/src/Java/binnie/craftgui/controls/scroll/ControlScrollBar.java
new file mode 100644
index 0000000000..a94705767d
--- /dev/null
+++ b/src/Java/binnie/craftgui/controls/scroll/ControlScrollBar.java
@@ -0,0 +1,94 @@
+package binnie.craftgui.controls.scroll;
+
+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.IArea;
+import binnie.craftgui.core.geometry.IPoint;
+import binnie.craftgui.core.renderer.Renderer;
+import binnie.craftgui.events.EventMouse.Down;
+import binnie.craftgui.events.EventMouse.Down.Handler;
+import binnie.craftgui.events.EventMouse.Drag;
+import binnie.craftgui.events.EventMouse.Drag.Handler;
+import binnie.craftgui.resource.minecraft.CraftGUITexture;
+
+public class ControlScrollBar
+ extends Control
+{
+ protected final IControlScrollable scrollable;
+
+ public ControlScrollBar(ControlScroll parent)
+ {
+ this(parent, 0.0F, 0.0F, parent.getSize().x(), parent.getSize().y(), parent.getScrollableWidget());
+ }
+
+ public ControlScrollBar(IWidget parent, float x, float y, float w, float h, IControlScrollable scrollable2)
+ {
+ super(parent, x, y, w, h);
+ this.scrollable = scrollable2;
+ addAttribute(Attribute.MouseOver);
+
+ addSelfEventHandler(new EventMouse.Drag.Handler()
+ {
+ public void onEvent(EventMouse.Drag event)
+ {
+ ControlScrollBar.this.scrollable.movePercentage(event.getDy() / (ControlScrollBar.this.h() - ControlScrollBar.this.getBarHeight()));
+ }
+ });
+ addSelfEventHandler(new EventMouse.Down.Handler()
+ {
+ public void onEvent(EventMouse.Down event)
+ {
+ float shownPercentage = ControlScrollBar.this.scrollable.getPercentageShown();
+ float percentageIndex = ControlScrollBar.this.scrollable.getPercentageIndex();
+ float minPercent = (1.0F - shownPercentage) * percentageIndex;
+ float maxPercent = minPercent + shownPercentage;
+ float clickedPercentage = ControlScrollBar.this.getRelativeMousePosition().y() / (ControlScrollBar.this.h() - 2.0F);
+ clickedPercentage = Math.max(Math.min(clickedPercentage, 1.0F), 0.0F);
+ if (clickedPercentage > maxPercent) {
+ ControlScrollBar.this.scrollable.setPercentageIndex((clickedPercentage - shownPercentage) / (1.0F - shownPercentage));
+ }
+ if (clickedPercentage < minPercent) {
+ ControlScrollBar.this.scrollable.setPercentageIndex(clickedPercentage / (1.0F - shownPercentage));
+ }
+ }
+ });
+ }
+
+ public void onUpdateClient() {}
+
+ public boolean isEnabled()
+ {
+ return this.scrollable.getPercentageShown() < 0.99F;
+ }
+
+ public float getBarHeight()
+ {
+ return h() * this.scrollable.getPercentageShown();
+ }
+
+ protected IArea getRenderArea()
+ {
+ float height = getBarHeight();
+ if (height < 6.0F) {
+ height = 6.0F;
+ }
+ float yOffset = ((int)h() - (int)getBarHeight()) * this.scrollable.getPercentageIndex();
+
+ return new IArea(0.0F, yOffset, getSize().x(), height);
+ }
+
+ public void onRenderBackground()
+ {
+ IArea renderArea = getRenderArea();
+
+ Object texture = CraftGUITexture.ScrollDisabled;
+ if (isMouseOver()) {
+ texture = CraftGUITexture.ScrollHighlighted;
+ } else if (isEnabled()) {
+ texture = CraftGUITexture.Scroll;
+ }
+ CraftGUI.Render.texture(texture, renderArea);
+ }
+}
diff --git a/src/Java/binnie/craftgui/controls/scroll/ControlScrollableContent.java b/src/Java/binnie/craftgui/controls/scroll/ControlScrollableContent.java
new file mode 100644
index 0000000000..442c9d3226
--- /dev/null
+++ b/src/Java/binnie/craftgui/controls/scroll/ControlScrollableContent.java
@@ -0,0 +1,134 @@
+package binnie.craftgui.controls.scroll;
+
+import binnie.craftgui.controls.core.Control;
+import binnie.craftgui.core.IWidget;
+import binnie.craftgui.core.geometry.IArea;
+import binnie.craftgui.core.geometry.IPoint;
+import binnie.craftgui.events.EventMouse.Wheel;
+import binnie.craftgui.events.EventMouse.Wheel.Handler;
+import binnie.craftgui.events.EventWidget.ChangeSize;
+import binnie.craftgui.events.EventWidget.ChangeSize.Handler;
+
+public class ControlScrollableContent<T extends IWidget>
+ extends Control
+ implements IControlScrollable
+{
+ protected T controlChild;
+ protected float scrollBarSize;
+
+ public ControlScrollableContent(IWidget parent, float x, float y, float w, float h, float scrollBarSize)
+ {
+ super(parent, x, y, w, h);
+ if (scrollBarSize != 0.0F) {
+ new ControlScroll(this, getSize().x() - scrollBarSize, 0.0F, scrollBarSize, getSize().y(), this);
+ }
+ addEventHandler(new EventMouse.Wheel.Handler()
+ {
+ public void onEvent(EventMouse.Wheel event)
+ {
+ if ((ControlScrollableContent.this.getRelativeMousePosition().x() > 0.0F) && (ControlScrollableContent.this.getRelativeMousePosition().y() > 0.0F) && (ControlScrollableContent.this.getRelativeMousePosition().x() < ControlScrollableContent.this.getSize().x()) && (ControlScrollableContent.this.getRelativeMousePosition().y() < ControlScrollableContent.this.getSize().y()))
+ {
+ if (ControlScrollableContent.this.getMovementRange() == 0.0F) {
+ return;
+ }
+ float percentageMove = 0.8F / ControlScrollableContent.this.getMovementRange();
+ ControlScrollableContent.this.movePercentage(percentageMove * -event.getDWheel());
+ }
+ }
+ });
+ this.scrollBarSize = scrollBarSize;
+ }
+
+ public void setScrollableContent(T child)
+ {
+ this.controlChild = child;
+ if (child == null) {
+ return;
+ }
+ child.setCroppedZone(this, new IArea(1.0F, 1.0F, getSize().x() - 2.0F - this.scrollBarSize, getSize().y() - 2.0F));
+ child.addSelfEventHandler(new EventWidget.ChangeSize.Handler()
+ {
+ public void onEvent(EventWidget.ChangeSize event)
+ {
+ ControlScrollableContent.this.controlChild.setOffset(new IPoint(0.0F, -ControlScrollableContent.this.percentageIndex * ControlScrollableContent.this.getMovementRange()));
+ if (ControlScrollableContent.this.getMovementRange() == 0.0F) {
+ ControlScrollableContent.this.percentageIndex = 0.0F;
+ }
+ }
+ });
+ }
+
+ public T getContent()
+ {
+ return this.controlChild;
+ }
+
+ public float getPercentageShown()
+ {
+ if ((this.controlChild == null) || (this.controlChild.getSize().y() == 0.0F)) {
+ return 1.0F;
+ }
+ float shown = getSize().y() / this.controlChild.getSize().y();
+ return Math.min(shown, 1.0F);
+ }
+
+ float percentageIndex = 0.0F;
+
+ public float getPercentageIndex()
+ {
+ return this.percentageIndex;
+ }
+
+ public void movePercentage(float percentage)
+ {
+ if (this.controlChild == null) {
+ return;
+ }
+ this.percentageIndex += percentage;
+ if (this.percentageIndex > 1.0F) {
+ this.percentageIndex = 1.0F;
+ } else if (this.percentageIndex < 0.0F) {
+ this.percentageIndex = 0.0F;
+ }
+ if (getMovementRange() == 0.0F) {
+ this.percentageIndex = 0.0F;
+ }
+ this.controlChild.setOffset(new IPoint(0.0F, -this.percentageIndex * getMovementRange()));
+ }
+
+ public void setPercentageIndex(float index)
+ {
+ movePercentage(index - this.percentageIndex);
+ }
+
+ public float getMovementRange()
+ {
+ if (this.controlChild == null) {
+ return 0.0F;
+ }
+ float range = this.controlChild.getSize().y() - getSize().y();
+ return Math.max(range, 0.0F);
+ }
+
+ public void onUpdateClient()
+ {
+ setPercentageIndex(getPercentageIndex());
+ }
+
+ public void ensureVisible(float minY, float maxY, float totalY)
+ {
+ minY /= totalY;
+ maxY /= totalY;
+
+ float shownPercentage = getPercentageShown();
+ float percentageIndex = getPercentageIndex();
+ float minPercent = (1.0F - shownPercentage) * percentageIndex;
+ float maxPercent = minPercent + shownPercentage;
+ if (maxY > maxPercent) {
+ setPercentageIndex((maxY - shownPercentage) / (1.0F - shownPercentage));
+ }
+ if (minY < minPercent) {
+ setPercentageIndex(minY / (1.0F - shownPercentage));
+ }
+ }
+}
diff --git a/src/Java/binnie/craftgui/controls/scroll/IControlScrollable.java b/src/Java/binnie/craftgui/controls/scroll/IControlScrollable.java
new file mode 100644
index 0000000000..39154815e5
--- /dev/null
+++ b/src/Java/binnie/craftgui/controls/scroll/IControlScrollable.java
@@ -0,0 +1,17 @@
+package binnie.craftgui.controls.scroll;
+
+import binnie.craftgui.core.IWidget;
+
+public abstract interface IControlScrollable
+ extends IWidget
+{
+ public abstract float getPercentageShown();
+
+ public abstract float getPercentageIndex();
+
+ public abstract void movePercentage(float paramFloat);
+
+ public abstract void setPercentageIndex(float paramFloat);
+
+ public abstract float getMovementRange();
+}
diff --git a/src/Java/binnie/craftgui/controls/tab/ControlTab.java b/src/Java/binnie/craftgui/controls/tab/ControlTab.java
new file mode 100644
index 0000000000..e05b7ed01a
--- /dev/null
+++ b/src/Java/binnie/craftgui/controls/tab/ControlTab.java
@@ -0,0 +1,128 @@
+package binnie.craftgui.controls.tab;
+
+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.ITooltip;
+import binnie.craftgui.core.Tooltip;
+import binnie.craftgui.core.geometry.IArea;
+import binnie.craftgui.core.geometry.IPoint;
+import binnie.craftgui.core.geometry.Position;
+import binnie.craftgui.core.renderer.Renderer;
+import binnie.craftgui.events.EventMouse.Down;
+import binnie.craftgui.events.EventMouse.Down.Handler;
+import binnie.craftgui.events.EventValueChanged;
+import binnie.craftgui.minecraft.control.ControlItemDisplay;
+import binnie.craftgui.minecraft.control.ControlTabIcon;
+import binnie.craftgui.resource.Texture;
+import binnie.craftgui.resource.minecraft.CraftGUITexture;
+import java.util.List;
+
+public class ControlTab<T>
+ extends Control
+ implements ITooltip, IControlValue<T>
+{
+ private ControlTabBar<T> tabBar;
+ protected T value;
+
+ public ControlTab(ControlTabBar<T> parent, float x, float y, float w, float h, T value)
+ {
+ super(parent, x, y, w, h);
+ setValue(value);
+ this.tabBar = parent;
+ addAttribute(Attribute.MouseOver);
+
+ addSelfEventHandler(new EventMouse.Down.Handler()
+ {
+ public void onEvent(EventMouse.Down event)
+ {
+ ControlTab.this.callEvent(new EventValueChanged(ControlTab.this.getWidget(), ControlTab.this.getValue()));
+ }
+ });
+ }
+
+ public void getTooltip(Tooltip tooltip)
+ {
+ String name = getName();
+ if ((name != null) && (!name.isEmpty())) {
+ tooltip.add(getName());
+ }
+ if ((this.value instanceof ITooltip)) {
+ ((ITooltip)this.value).getTooltip(tooltip);
+ }
+ }
+
+ public T getValue()
+ {
+ return this.value;
+ }
+
+ public void setValue(T value)
+ {
+ this.value = value;
+ }
+
+ public boolean isCurrentSelection()
+ {
+ return (getValue() != null) && (getValue().equals(this.tabBar.getValue()));
+ }
+
+ public Position getTabPosition()
+ {
+ return this.tabBar.position;
+ }
+
+ public String getName()
+ {
+ return this.value.toString();
+ }
+
+ public void onRenderBackground()
+ {
+ Object texture = CraftGUITexture.TabDisabled;
+ if (isMouseOver()) {
+ texture = CraftGUITexture.TabHighlighted;
+ } else if (isCurrentSelection()) {
+ texture = CraftGUITexture.Tab;
+ }
+ Texture lTexture = CraftGUI.Render.getTexture(texture);
+ Position position = getTabPosition();
+
+ Texture iTexture = lTexture.crop(position, 8.0F);
+
+
+ IArea area = getArea();
+ if (texture == CraftGUITexture.TabDisabled) {
+ if ((position == Position.Top) || (position == Position.Left))
+ {
+ area.setPosition(area.getPosition().sub(new IPoint(4 * position.x(), 4 * position.y())));
+ area.setSize(area.getSize().add(new IPoint(4 * position.x(), 4 * position.y())));
+ }
+ else
+ {
+ area.setSize(area.getSize().sub(new IPoint(4 * position.x(), 4 * position.y())));
+ }
+ }
+ CraftGUI.Render.texture(iTexture, area);
+ if ((this instanceof ControlTabIcon))
+ {
+ ControlTabIcon icon = (ControlTabIcon)this;
+ ControlItemDisplay item = (ControlItemDisplay)getWidgets().get(0);
+ if (texture == CraftGUITexture.TabDisabled) {
+ item.setColour(-1431655766);
+ } else {
+ item.setColour(-1);
+ }
+ if (icon.hasOutline())
+ {
+ iTexture = CraftGUI.Render.getTexture(CraftGUITexture.TabOutline);
+ iTexture = iTexture.crop(position, 8.0F);
+
+ CraftGUI.Render.colour(icon.getOutlineColour());
+
+ CraftGUI.Render.texture(iTexture, area.inset(2));
+ }
+ }
+ }
+}
diff --git a/src/Java/binnie/craftgui/controls/tab/ControlTabBar.java b/src/Java/binnie/craftgui/controls/tab/ControlTabBar.java
new file mode 100644
index 0000000000..d209887994
--- /dev/null
+++ b/src/Java/binnie/craftgui/controls/tab/ControlTabBar.java
@@ -0,0 +1,86 @@
+package binnie.craftgui.controls.tab;
+
+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.core.geometry.Position;
+import binnie.craftgui.events.EventHandler.Origin;
+import binnie.craftgui.events.EventValueChanged;
+import binnie.craftgui.events.EventValueChanged.Handler;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
+public class ControlTabBar<T>
+ extends Control
+ implements IControlValue<T>
+{
+ T value;
+ Position position;
+
+ public ControlTabBar(IWidget parent, float x, float y, float width, float height, Position position)
+ {
+ super(parent, x, y, width, height);
+ this.position = position;
+
+ addEventHandler(new EventValueChanged.Handler()
+ {
+ public void onEvent(EventValueChanged event)
+ {
+ ControlTabBar.this.setValue(event.getValue());
+ }
+ }.setOrigin(EventHandler.Origin.DirectChild, this));
+ }
+
+ public void setValues(Collection<T> values)
+ {
+ for (int i = 0; i < getWidgets().size();) {
+ deleteChild((IWidget)getWidgets().get(0));
+ }
+ float length = values.size();
+ int tabDimension = (int)(getSize().y() / length);
+ if ((this.position == Position.Top) || (this.position == Position.Bottom)) {
+ tabDimension = (int)(getSize().x() / length);
+ }
+ int i = 0;
+ for (T value : values)
+ {
+ IWidget tab;
+ IWidget tab;
+ if ((this.position == Position.Top) || (this.position == Position.Bottom)) {
+ tab = createTab(i * tabDimension, 0.0F, tabDimension, getSize().y(), value);
+ } else {
+ tab = createTab(0.0F, i * tabDimension, getSize().x(), tabDimension, value);
+ }
+ i++;
+ }
+ if ((this.value == null) && (!values.isEmpty())) {
+ setValue(values.iterator().next());
+ }
+ }
+
+ public ControlTab<T> createTab(float x, float y, float w, float h, T value)
+ {
+ return new ControlTab(this, x, y, w, h, value);
+ }
+
+ public T getValue()
+ {
+ return this.value;
+ }
+
+ public void setValue(T value)
+ {
+ boolean change = this.value != value;
+ this.value = value;
+ if (change) {
+ callEvent(new EventValueChanged(this, value));
+ }
+ }
+
+ public Position getDirection()
+ {
+ return this.position;
+ }
+}
diff --git a/src/Java/binnie/craftgui/core/Attribute.java b/src/Java/binnie/craftgui/core/Attribute.java
new file mode 100644
index 0000000000..5d73f58ae2
--- /dev/null
+++ b/src/Java/binnie/craftgui/core/Attribute.java
@@ -0,0 +1,9 @@
+package binnie.craftgui.core;
+
+public enum Attribute
+ implements IWidgetAttribute
+{
+ MouseOver, CanFocus, NeedsDeletion, AlwaysOnTop, BlockTooltip;
+
+ private Attribute() {}
+}
diff --git a/src/Java/binnie/craftgui/core/CraftGUI.java b/src/Java/binnie/craftgui/core/CraftGUI.java
new file mode 100644
index 0000000000..3cce3493cf
--- /dev/null
+++ b/src/Java/binnie/craftgui/core/CraftGUI.java
@@ -0,0 +1,10 @@
+package binnie.craftgui.core;
+
+import binnie.craftgui.core.renderer.Renderer;
+import binnie.craftgui.resource.minecraft.CraftGUIResourceManager;
+
+public class CraftGUI
+{
+ public static CraftGUIResourceManager ResourceManager;
+ public static Renderer Render;
+}
diff --git a/src/Java/binnie/craftgui/core/ITooltip.java b/src/Java/binnie/craftgui/core/ITooltip.java
new file mode 100644
index 0000000000..634ce476d5
--- /dev/null
+++ b/src/Java/binnie/craftgui/core/ITooltip.java
@@ -0,0 +1,6 @@
+package binnie.craftgui.core;
+
+public abstract interface ITooltip
+{
+ public abstract void getTooltip(Tooltip paramTooltip);
+}
diff --git a/src/Java/binnie/craftgui/core/ITooltipHelp.java b/src/Java/binnie/craftgui/core/ITooltipHelp.java
new file mode 100644
index 0000000000..f01744ab6f
--- /dev/null
+++ b/src/Java/binnie/craftgui/core/ITooltipHelp.java
@@ -0,0 +1,6 @@
+package binnie.craftgui.core;
+
+public abstract interface ITooltipHelp
+{
+ public abstract void getHelpTooltip(Tooltip paramTooltip);
+}
diff --git a/src/Java/binnie/craftgui/core/ITopLevelWidget.java b/src/Java/binnie/craftgui/core/ITopLevelWidget.java
new file mode 100644
index 0000000000..2e209b3ea6
--- /dev/null
+++ b/src/Java/binnie/craftgui/core/ITopLevelWidget.java
@@ -0,0 +1,29 @@
+package binnie.craftgui.core;
+
+import binnie.craftgui.core.geometry.IPoint;
+
+public abstract interface ITopLevelWidget
+ extends IWidget
+{
+ public abstract void setMousePosition(int paramInt1, int paramInt2);
+
+ public abstract IPoint getAbsoluteMousePosition();
+
+ public abstract IWidget getFocusedWidget();
+
+ public abstract IWidget getMousedOverWidget();
+
+ public abstract IWidget getDraggedWidget();
+
+ public abstract boolean isFocused(IWidget paramIWidget);
+
+ public abstract boolean isMouseOver(IWidget paramIWidget);
+
+ public abstract boolean isDragged(IWidget paramIWidget);
+
+ public abstract void updateTopLevel();
+
+ public abstract void widgetDeleted(IWidget paramIWidget);
+
+ public abstract IPoint getDragDistance();
+}
diff --git a/src/Java/binnie/craftgui/core/IWidget.java b/src/Java/binnie/craftgui/core/IWidget.java
new file mode 100644
index 0000000000..cd85fa7a40
--- /dev/null
+++ b/src/Java/binnie/craftgui/core/IWidget.java
@@ -0,0 +1,138 @@
+package binnie.craftgui.core;
+
+import binnie.craftgui.core.geometry.IArea;
+import binnie.craftgui.core.geometry.IPoint;
+import binnie.craftgui.events.Event;
+import binnie.craftgui.events.EventHandler;
+import java.util.List;
+
+public abstract interface IWidget
+{
+ public abstract IWidget getParent();
+
+ public abstract void deleteChild(IWidget paramIWidget);
+
+ public abstract void deleteAllChildren();
+
+ public abstract ITopLevelWidget getSuperParent();
+
+ public abstract boolean isTopLevel();
+
+ public abstract IPoint getPosition();
+
+ public abstract IPoint pos();
+
+ public abstract void setPosition(IPoint paramIPoint);
+
+ public abstract IPoint getSize();
+
+ public abstract IPoint size();
+
+ public abstract void setSize(IPoint paramIPoint);
+
+ public abstract IPoint getOriginalPosition();
+
+ public abstract IPoint getAbsolutePosition();
+
+ public abstract IPoint getOriginalAbsolutePosition();
+
+ public abstract IPoint getOffset();
+
+ public abstract IArea getArea();
+
+ public abstract IArea area();
+
+ public abstract void setOffset(IPoint paramIPoint);
+
+ public abstract IPoint getMousePosition();
+
+ public abstract IPoint getRelativeMousePosition();
+
+ public abstract void setColour(int paramInt);
+
+ public abstract int getColour();
+
+ public abstract void render();
+
+ public abstract void updateClient();
+
+ public abstract void enable();
+
+ public abstract void disable();
+
+ public abstract void show();
+
+ public abstract void hide();
+
+ public abstract boolean calculateIsMouseOver();
+
+ public abstract boolean isEnabled();
+
+ public abstract boolean isVisible();
+
+ public abstract boolean isFocused();
+
+ public abstract boolean isMouseOver();
+
+ public abstract boolean isDragged();
+
+ public abstract boolean isChildVisible(IWidget paramIWidget);
+
+ public abstract boolean isChildEnabled(IWidget paramIWidget);
+
+ public abstract boolean canMouseOver();
+
+ public abstract boolean canFocus();
+
+ public abstract IWidget addWidget(IWidget paramIWidget);
+
+ public abstract List<IWidget> getWidgets();
+
+ public abstract void callEvent(Event paramEvent);
+
+ public abstract void recieveEvent(Event paramEvent);
+
+ public abstract void onUpdateClient();
+
+ public abstract void delete();
+
+ public abstract void onDelete();
+
+ public abstract <T> T getWidget(Class<T> paramClass);
+
+ public abstract IArea getCroppedZone();
+
+ public abstract void setCroppedZone(IWidget paramIWidget, IArea paramIArea);
+
+ public abstract boolean isCroppedWidet();
+
+ public abstract IWidget getCropWidget();
+
+ public abstract boolean isMouseOverWidget(IPoint paramIPoint);
+
+ public abstract int getLevel();
+
+ public abstract boolean isDescendant(IWidget paramIWidget);
+
+ public abstract List<IWidgetAttribute> getAttributes();
+
+ public abstract boolean hasAttribute(IWidgetAttribute paramIWidgetAttribute);
+
+ public abstract boolean addAttribute(IWidgetAttribute paramIWidgetAttribute);
+
+ public abstract <E extends Event> void addEventHandler(EventHandler<E> paramEventHandler);
+
+ public abstract <E extends Event> void addSelfEventHandler(EventHandler<E> paramEventHandler);
+
+ public abstract boolean contains(IPoint paramIPoint);
+
+ public abstract float x();
+
+ public abstract float y();
+
+ public abstract float w();
+
+ public abstract float h();
+
+ public abstract void onRender(RenderStage paramRenderStage);
+}
diff --git a/src/Java/binnie/craftgui/core/IWidgetAttribute.java b/src/Java/binnie/craftgui/core/IWidgetAttribute.java
new file mode 100644
index 0000000000..87d994ca43
--- /dev/null
+++ b/src/Java/binnie/craftgui/core/IWidgetAttribute.java
@@ -0,0 +1,3 @@
+package binnie.craftgui.core;
+
+public abstract interface IWidgetAttribute {}
diff --git a/src/Java/binnie/craftgui/core/RenderStage.java b/src/Java/binnie/craftgui/core/RenderStage.java
new file mode 100644
index 0000000000..e710c833e6
--- /dev/null
+++ b/src/Java/binnie/craftgui/core/RenderStage.java
@@ -0,0 +1,8 @@
+package binnie.craftgui.core;
+
+public enum RenderStage
+{
+ PreChildren, PostChildren, PostSiblings;
+
+ private RenderStage() {}
+}
diff --git a/src/Java/binnie/craftgui/core/Tooltip.java b/src/Java/binnie/craftgui/core/Tooltip.java
new file mode 100644
index 0000000000..4afb7f6bc5
--- /dev/null
+++ b/src/Java/binnie/craftgui/core/Tooltip.java
@@ -0,0 +1,84 @@
+package binnie.craftgui.core;
+
+import java.util.ArrayList;
+import java.util.List;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraftforge.fluids.FluidStack;
+
+public class Tooltip
+{
+ public void add(String string)
+ {
+ this.tooltip.add(string);
+ }
+
+ public String getLine(int index)
+ {
+ String string = (String)getList().get(index);
+ return string;
+ }
+
+ public void add(List list)
+ {
+ for (Object obj : list) {
+ this.tooltip.add((String)obj);
+ }
+ }
+
+ List<String> tooltip = new ArrayList();
+
+ public List<String> getList()
+ {
+ return this.tooltip;
+ }
+
+ public boolean exists()
+ {
+ return this.tooltip.size() > 0;
+ }
+
+ public static enum Type
+ implements Tooltip.ITooltipType
+ {
+ Standard, Help, Information, User, Power;
+
+ private Type() {}
+ }
+
+ public void setType(ITooltipType type)
+ {
+ this.type = type;
+ }
+
+ ITooltipType type = Type.Standard;
+ public int maxWidth = 256;
+
+ public void setMaxWidth(int w)
+ {
+ this.maxWidth = w;
+ }
+
+ public ITooltipType getType()
+ {
+ return this.type;
+ }
+
+ public void add(ItemStack item, String string)
+ {
+ NBTTagCompound nbt = new NBTTagCompound();
+ item.writeToNBT(nbt);
+ nbt.setByte("nbt-type", (byte)105);
+ add("~~~" + nbt.toString() + "~~~" + string);
+ }
+
+ public void add(FluidStack item, String string)
+ {
+ NBTTagCompound nbt = new NBTTagCompound();
+ item.writeToNBT(nbt);
+ nbt.setByte("nbt-type", (byte)102);
+ add("~~~" + nbt.toString() + "~~~" + string);
+ }
+
+ public static abstract interface ITooltipType {}
+}
diff --git a/src/Java/binnie/craftgui/core/TopLevelWidget.java b/src/Java/binnie/craftgui/core/TopLevelWidget.java
new file mode 100644
index 0000000000..6f2cdd18a6
--- /dev/null
+++ b/src/Java/binnie/craftgui/core/TopLevelWidget.java
@@ -0,0 +1,248 @@
+package binnie.craftgui.core;
+
+import binnie.craftgui.core.geometry.IArea;
+import binnie.craftgui.core.geometry.IPoint;
+import binnie.craftgui.events.EventMouse.Down;
+import binnie.craftgui.events.EventMouse.Down.Handler;
+import binnie.craftgui.events.EventMouse.Drag;
+import binnie.craftgui.events.EventMouse.Move;
+import binnie.craftgui.events.EventMouse.Up;
+import binnie.craftgui.events.EventMouse.Up.Handler;
+import binnie.craftgui.events.EventWidget.EndDrag;
+import binnie.craftgui.events.EventWidget.EndMouseOver;
+import binnie.craftgui.events.EventWidget.GainFocus;
+import binnie.craftgui.events.EventWidget.LoseFocus;
+import binnie.craftgui.events.EventWidget.StartDrag;
+import binnie.craftgui.events.EventWidget.StartDrag.Handler;
+import binnie.craftgui.events.EventWidget.StartMouseOver;
+import java.util.ArrayDeque;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Deque;
+import java.util.List;
+import java.util.ListIterator;
+import org.lwjgl.input.Mouse;
+
+public abstract class TopLevelWidget
+ extends Widget
+ implements ITopLevelWidget
+{
+ public TopLevelWidget()
+ {
+ super(null);
+
+ addEventHandler(new EventMouse.Down.Handler()
+ {
+ public void onEvent(EventMouse.Down event)
+ {
+ TopLevelWidget.this.setDraggedWidget(TopLevelWidget.this.mousedOverWidget, event.getButton());
+ TopLevelWidget.this.setFocusedWidget(TopLevelWidget.this.mousedOverWidget);
+ }
+ });
+ addEventHandler(new EventMouse.Up.Handler()
+ {
+ public void onEvent(EventMouse.Up event)
+ {
+ TopLevelWidget.this.setDraggedWidget(null);
+ }
+ });
+ addEventHandler(new EventWidget.StartDrag.Handler()
+ {
+ public void onEvent(EventWidget.StartDrag event)
+ {
+ TopLevelWidget.this.dragStart = TopLevelWidget.this.getRelativeMousePosition();
+ }
+ });
+ }
+
+ IWidget mousedOverWidget = null;
+ IWidget draggedWidget = null;
+ IWidget focusedWidget = null;
+
+ public void setMousedOverWidget(IWidget widget)
+ {
+ if (this.mousedOverWidget == widget) {
+ return;
+ }
+ if (this.mousedOverWidget != null) {
+ callEvent(new EventWidget.EndMouseOver(this.mousedOverWidget));
+ }
+ this.mousedOverWidget = widget;
+ if (this.mousedOverWidget != null) {
+ callEvent(new EventWidget.StartMouseOver(this.mousedOverWidget));
+ }
+ }
+
+ public void setDraggedWidget(IWidget widget)
+ {
+ setDraggedWidget(widget, -1);
+ }
+
+ public void setDraggedWidget(IWidget widget, int button)
+ {
+ if (this.draggedWidget == widget) {
+ return;
+ }
+ if (this.draggedWidget != null) {
+ callEvent(new EventWidget.EndDrag(this.draggedWidget));
+ }
+ this.draggedWidget = widget;
+ if (this.draggedWidget != null) {
+ callEvent(new EventWidget.StartDrag(this.draggedWidget, button));
+ }
+ }
+
+ public void setFocusedWidget(IWidget widget)
+ {
+ IWidget newWidget = widget;
+ if (this.focusedWidget == newWidget) {
+ return;
+ }
+ if ((newWidget != null) && (!newWidget.canFocus())) {
+ newWidget = null;
+ }
+ if (this.focusedWidget != null) {
+ callEvent(new EventWidget.LoseFocus(this.focusedWidget));
+ }
+ this.focusedWidget = newWidget;
+ if (this.focusedWidget != null) {
+ callEvent(new EventWidget.GainFocus(this.focusedWidget));
+ }
+ }
+
+ public IWidget getMousedOverWidget()
+ {
+ return this.mousedOverWidget;
+ }
+
+ public IWidget getDraggedWidget()
+ {
+ return this.draggedWidget;
+ }
+
+ public IWidget getFocusedWidget()
+ {
+ return this.focusedWidget;
+ }
+
+ public boolean isMouseOver(IWidget widget)
+ {
+ return getMousedOverWidget() == widget;
+ }
+
+ public boolean isDragged(IWidget widget)
+ {
+ return getDraggedWidget() == widget;
+ }
+
+ public boolean isFocused(IWidget widget)
+ {
+ return getFocusedWidget() == widget;
+ }
+
+ public void updateTopLevel()
+ {
+ setMousedOverWidget(calculateMousedOverWidget());
+ if ((getFocusedWidget() != null) && ((!getFocusedWidget().isVisible()) || (!getFocusedWidget().isEnabled()))) {
+ setFocusedWidget(null);
+ }
+ if (!Mouse.isButtonDown(0)) {
+ if (this.draggedWidget != null) {
+ setDraggedWidget(null);
+ }
+ }
+ }
+
+ private IWidget calculateMousedOverWidget()
+ {
+ Deque<IWidget> queue = calculateMousedOverWidgets();
+ while (!queue.isEmpty())
+ {
+ IWidget widget = (IWidget)queue.removeFirst();
+ if ((widget.isEnabled()) && (widget.isVisible()) && (widget.canMouseOver())) {
+ if ((widget.isEnabled()) && (widget.isVisible()) && (widget.canMouseOver()) && (widget.calculateIsMouseOver())) {
+ return widget;
+ }
+ }
+ }
+ return null;
+ }
+
+ public Deque<IWidget> calculateMousedOverWidgets()
+ {
+ Deque<IWidget> list = new ArrayDeque();
+ for (IWidget widget : getQueuedWidgets(this)) {
+ if (widget.calculateIsMouseOver()) {
+ list.addLast(widget);
+ }
+ }
+ return list;
+ }
+
+ private Collection<IWidget> getQueuedWidgets(IWidget widget)
+ {
+ List<IWidget> widgets = new ArrayList();
+
+ boolean addChildren = true;
+ if (widget.isCroppedWidet()) {
+ addChildren = widget.getCroppedZone().contains(widget.getCropWidget().getRelativeMousePosition());
+ }
+ if (addChildren)
+ {
+ ListIterator<IWidget> li = widget.getWidgets().listIterator(widget.getWidgets().size());
+ while (li.hasPrevious())
+ {
+ IWidget child = (IWidget)li.previous();
+ widgets.addAll(getQueuedWidgets(child));
+ }
+ }
+ widgets.add(widget);
+
+ return widgets;
+ }
+
+ protected IPoint mousePosition = new IPoint(0.0F, 0.0F);
+
+ public void setMousePosition(int x, int y)
+ {
+ float dx = x - this.mousePosition.x();
+ float dy = y - this.mousePosition.y();
+ if ((dx != 0.0F) || (dy != 0.0F)) {
+ if (getDraggedWidget() != null) {
+ callEvent(new EventMouse.Drag(getDraggedWidget(), dx, dy));
+ } else {
+ callEvent(new EventMouse.Move(this, dx, dy));
+ }
+ }
+ if ((this.mousePosition.x() != x) || (this.mousePosition.y() != y))
+ {
+ this.mousePosition = new IPoint(x, y);
+ setMousedOverWidget(calculateMousedOverWidget());
+ }
+ }
+
+ public IPoint getAbsoluteMousePosition()
+ {
+ return this.mousePosition;
+ }
+
+ public void widgetDeleted(IWidget widget)
+ {
+ if (isMouseOver(widget)) {
+ setMousedOverWidget(null);
+ }
+ if (isDragged(widget)) {
+ setDraggedWidget(null);
+ }
+ if (isFocused(widget)) {
+ setFocusedWidget(null);
+ }
+ }
+
+ IPoint dragStart = IPoint.ZERO;
+
+ public IPoint getDragDistance()
+ {
+ return getRelativeMousePosition().sub(this.dragStart);
+ }
+}
diff --git a/src/Java/binnie/craftgui/core/Widget.java b/src/Java/binnie/craftgui/core/Widget.java
new file mode 100644
index 0000000000..448bcbaed6
--- /dev/null
+++ b/src/Java/binnie/craftgui/core/Widget.java
@@ -0,0 +1,499 @@
+package binnie.craftgui.core;
+
+import binnie.craftgui.core.geometry.IArea;
+import binnie.craftgui.core.geometry.IPoint;
+import binnie.craftgui.core.renderer.Renderer;
+import binnie.craftgui.events.Event;
+import binnie.craftgui.events.EventHandler;
+import binnie.craftgui.events.EventHandler.Origin;
+import binnie.craftgui.events.EventWidget.ChangeColour;
+import binnie.craftgui.events.EventWidget.ChangeOffset;
+import binnie.craftgui.events.EventWidget.ChangePosition;
+import binnie.craftgui.events.EventWidget.ChangeSize;
+import binnie.craftgui.events.EventWidget.Disable;
+import binnie.craftgui.events.EventWidget.Enable;
+import binnie.craftgui.events.EventWidget.Hide;
+import binnie.craftgui.events.EventWidget.Show;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.ConcurrentModificationException;
+import java.util.List;
+
+public class Widget
+ implements IWidget
+{
+ public Widget(IWidget parent)
+ {
+ this.parent = parent;
+ if (parent != null) {
+ parent.addWidget(this);
+ }
+ }
+
+ private IWidget parent = null;
+ private List<IWidget> subWidgets = new ArrayList();
+ private List<IWidgetAttribute> attributes = new ArrayList();
+
+ public List<IWidgetAttribute> getAttributes()
+ {
+ return this.attributes;
+ }
+
+ public boolean hasAttribute(IWidgetAttribute attribute)
+ {
+ return this.attributes.contains(attribute);
+ }
+
+ public boolean addAttribute(IWidgetAttribute attribute)
+ {
+ return this.attributes.add(attribute);
+ }
+
+ public final void deleteChild(IWidget child)
+ {
+ if (child == null) {
+ return;
+ }
+ child.delete();
+ this.subWidgets.remove(child);
+ }
+
+ public final void deleteAllChildren()
+ {
+ while (!this.subWidgets.isEmpty()) {
+ deleteChild((IWidget)this.subWidgets.get(0));
+ }
+ }
+
+ public final IWidget getParent()
+ {
+ return this.parent;
+ }
+
+ public final ITopLevelWidget getSuperParent()
+ {
+ return isTopLevel() ? (ITopLevelWidget)this : this.parent.getSuperParent();
+ }
+
+ public final IWidget addWidget(IWidget widget)
+ {
+ if ((this.subWidgets.size() != 0) && (((IWidget)this.subWidgets.get(this.subWidgets.size() - 1)).hasAttribute(Attribute.AlwaysOnTop))) {
+ this.subWidgets.add(this.subWidgets.size() - 1, widget);
+ } else {
+ this.subWidgets.add(widget);
+ }
+ onAddChild(widget);
+ return widget;
+ }
+
+ protected void onAddChild(IWidget widget) {}
+
+ public final List<IWidget> getWidgets()
+ {
+ return this.subWidgets;
+ }
+
+ public final boolean isTopLevel()
+ {
+ return this instanceof ITopLevelWidget;
+ }
+
+ private IPoint position = new IPoint(0.0F, 0.0F);
+ private IPoint size = new IPoint(0.0F, 0.0F);
+ private IPoint offset = new IPoint(0.0F, 0.0F);
+ IArea cropArea;
+ IWidget cropWidget;
+
+ public final IPoint pos()
+ {
+ return this.position.add(this.offset);
+ }
+
+ public final IPoint size()
+ {
+ return this.size;
+ }
+
+ public final IArea area()
+ {
+ return getArea();
+ }
+
+ public final IPoint getPosition()
+ {
+ return pos();
+ }
+
+ public final IArea getArea()
+ {
+ return new IArea(IPoint.ZERO, size());
+ }
+
+ public final IPoint getOriginalPosition()
+ {
+ return this.position;
+ }
+
+ boolean cropped = false;
+
+ public IArea getCroppedZone()
+ {
+ return this.cropArea;
+ }
+
+ public void setCroppedZone(IWidget relative, IArea area)
+ {
+ this.cropArea = area;
+ this.cropped = true;
+ this.cropWidget = relative;
+ }
+
+ public final IPoint getAbsolutePosition()
+ {
+ return isTopLevel() ? getPosition() : getParent().getAbsolutePosition().add(getPosition());
+ }
+
+ public final IPoint getOriginalAbsolutePosition()
+ {
+ return isTopLevel() ? getOriginalPosition() : getParent().getOriginalPosition().sub(getOriginalPosition());
+ }
+
+ public final IPoint getSize()
+ {
+ return size();
+ }
+
+ public final IPoint getOffset()
+ {
+ return this.offset;
+ }
+
+ public final void setPosition(IPoint vector)
+ {
+ if (!vector.equals(this.position))
+ {
+ this.position = new IPoint(vector);
+ callEvent(new EventWidget.ChangePosition(this));
+ }
+ }
+
+ public final void setSize(IPoint vector)
+ {
+ if (!vector.equals(this.size))
+ {
+ this.size = new IPoint(vector);
+ callEvent(new EventWidget.ChangeSize(this));
+ }
+ }
+
+ public final void setOffset(IPoint vector)
+ {
+ if (vector != this.offset)
+ {
+ this.offset = new IPoint(vector);
+ callEvent(new EventWidget.ChangeOffset(this));
+ }
+ }
+
+ int colour = 16777215;
+
+ public final void setColour(int colour)
+ {
+ if (this.colour != colour)
+ {
+ this.colour = colour;
+ callEvent(new EventWidget.ChangeColour(this));
+ }
+ }
+
+ public final int getColour()
+ {
+ return this.colour;
+ }
+
+ public boolean canMouseOver()
+ {
+ return hasAttribute(Attribute.MouseOver);
+ }
+
+ public boolean canFocus()
+ {
+ return hasAttribute(Attribute.CanFocus);
+ }
+
+ private Collection<EventHandler> globalEventHandlers = new ArrayList();
+
+ public void addEventHandler(EventHandler handler)
+ {
+ this.globalEventHandlers.add(handler);
+ }
+
+ public void addSelfEventHandler(EventHandler handler)
+ {
+ addEventHandler(handler.setOrigin(EventHandler.Origin.Self, this));
+ }
+
+ public final void callEvent(Event event)
+ {
+ getSuperParent().recieveEvent(event);
+ }
+
+ public final void recieveEvent(Event event)
+ {
+ for (EventHandler handler : this.globalEventHandlers) {
+ if (handler.handles(event)) {
+ handler.onEvent(event);
+ }
+ }
+ try
+ {
+ for (IWidget child : getWidgets()) {
+ child.recieveEvent(event);
+ }
+ }
+ catch (ConcurrentModificationException e) {}
+ }
+
+ public final IPoint getMousePosition()
+ {
+ return getSuperParent().getAbsoluteMousePosition();
+ }
+
+ public final IPoint getRelativeMousePosition()
+ {
+ return isTopLevel() ? getMousePosition() : getParent().getRelativeMousePosition().sub(getPosition());
+ }
+
+ public boolean isCroppedWidet()
+ {
+ return this.cropped;
+ }
+
+ public final IWidget getCropWidget()
+ {
+ return this.cropWidget == null ? this : this.cropWidget;
+ }
+
+ public final void render()
+ {
+ if (isVisible())
+ {
+ CraftGUI.Render.preRender(this);
+ onRender(RenderStage.PreChildren);
+ for (IWidget widget : getWidgets()) {
+ widget.render();
+ }
+ for (IWidget widget : getWidgets())
+ {
+ CraftGUI.Render.preRender(widget);
+ widget.onRender(RenderStage.PostSiblings);
+ CraftGUI.Render.postRender(widget);
+ }
+ onRender(RenderStage.PostChildren);
+ CraftGUI.Render.postRender(this);
+ }
+ }
+
+ public final void updateClient()
+ {
+ if (!isVisible()) {
+ return;
+ }
+ if (getSuperParent() == this) {
+ ((ITopLevelWidget)this).updateTopLevel();
+ }
+ onUpdateClient();
+
+ List<IWidget> deletedWidgets = new ArrayList();
+ for (IWidget widget : getWidgets()) {
+ if (widget.hasAttribute(Attribute.NeedsDeletion)) {
+ deletedWidgets.add(widget);
+ } else {
+ widget.updateClient();
+ }
+ }
+ for (IWidget widget : deletedWidgets) {
+ deleteChild(widget);
+ }
+ }
+
+ public final boolean calculateIsMouseOver()
+ {
+ IPoint mouse = getRelativeMousePosition();
+ if (!this.cropped) {
+ return isMouseOverWidget(mouse);
+ }
+ IWidget cropRelative = this.cropWidget != null ? this.cropWidget : this;
+ IPoint pos = IPoint.sub(cropRelative.getAbsolutePosition(), getAbsolutePosition());
+ IPoint size = new IPoint(this.cropArea.size().x(), this.cropArea.size().y());
+ boolean inCrop = (mouse.x() > pos.x()) && (mouse.y() > pos.y()) && (mouse.x() < pos.x() + size.x()) && (mouse.y() < pos.y() + size.y());
+
+ return (inCrop) && (isMouseOverWidget(mouse));
+ }
+
+ public boolean isMouseOverWidget(IPoint relativeMouse)
+ {
+ return getArea().contains(relativeMouse);
+ }
+
+ private boolean enabled = true;
+ private boolean visible = true;
+
+ public final void enable()
+ {
+ this.enabled = true;
+ callEvent(new EventWidget.Enable(this));
+ }
+
+ public final void disable()
+ {
+ this.enabled = false;
+ callEvent(new EventWidget.Disable(this));
+ }
+
+ public final void show()
+ {
+ this.visible = true;
+ callEvent(new EventWidget.Show(this));
+ }
+
+ public final void hide()
+ {
+ this.visible = false;
+ callEvent(new EventWidget.Hide(this));
+ }
+
+ public boolean isEnabled()
+ {
+ return (this.enabled) && ((isTopLevel()) || ((getParent().isEnabled()) && (getParent().isChildEnabled(this))));
+ }
+
+ public final boolean isVisible()
+ {
+ return (this.visible) && ((isTopLevel()) || ((getParent().isVisible()) && (getParent().isChildVisible(this))));
+ }
+
+ public final boolean isFocused()
+ {
+ return getSuperParent().isFocused(this);
+ }
+
+ public final boolean isDragged()
+ {
+ return getSuperParent().isDragged(this);
+ }
+
+ public final boolean isMouseOver()
+ {
+ return getSuperParent().isMouseOver(this);
+ }
+
+ public boolean isChildVisible(IWidget child)
+ {
+ return true;
+ }
+
+ public boolean isChildEnabled(IWidget child)
+ {
+ return true;
+ }
+
+ public void onRender(RenderStage stage)
+ {
+ if (stage == RenderStage.PreChildren) {
+ onRenderBackground();
+ }
+ if (stage == RenderStage.PostChildren) {
+ onRenderForeground();
+ }
+ if (stage == RenderStage.PostSiblings) {
+ onRenderOverlay();
+ }
+ }
+
+ public void onRenderBackground() {}
+
+ public void onRenderForeground() {}
+
+ public void onRenderOverlay() {}
+
+ public void onUpdateClient() {}
+
+ public final void delete()
+ {
+ getSuperParent().widgetDeleted(this);
+ onDelete();
+ }
+
+ public void onDelete() {}
+
+ public <T> T getWidget(Class<T> x)
+ {
+ for (IWidget child : getWidgets())
+ {
+ if (x.isInstance(child)) {
+ return child;
+ }
+ T found = child.getWidget(x);
+ if (found != null) {
+ return found;
+ }
+ }
+ return null;
+ }
+
+ public final boolean contains(IPoint position)
+ {
+ return getArea().contains(position);
+ }
+
+ public void scheduleDeletion()
+ {
+ addAttribute(Attribute.NeedsDeletion);
+ }
+
+ public int getLevel()
+ {
+ int level = getParent() == null ? 0 : getParent().getLevel();
+ int index = getParent() == null ? 0 : getParent().getWidgets().indexOf(this);
+ return level + index;
+ }
+
+ public boolean isDescendant(IWidget widget)
+ {
+ IWidget clss = this;
+ do
+ {
+ if (clss == widget) {
+ return true;
+ }
+ clss = clss.getParent();
+ } while (clss != null);
+ return false;
+ }
+
+ public float x()
+ {
+ return pos().x();
+ }
+
+ public float y()
+ {
+ return pos().y();
+ }
+
+ public float w()
+ {
+ return size().x();
+ }
+
+ public float h()
+ {
+ return size().y();
+ }
+
+ public IWidget getWidget()
+ {
+ return this;
+ }
+}
diff --git a/src/Java/binnie/craftgui/core/geometry/CraftGUIUtil.java b/src/Java/binnie/craftgui/core/geometry/CraftGUIUtil.java
new file mode 100644
index 0000000000..5a21e313d4
--- /dev/null
+++ b/src/Java/binnie/craftgui/core/geometry/CraftGUIUtil.java
@@ -0,0 +1,77 @@
+package binnie.craftgui.core.geometry;
+
+import binnie.craftgui.controls.core.IControlValue;
+import binnie.craftgui.core.IWidget;
+import binnie.craftgui.events.EventValueChanged;
+import binnie.craftgui.events.EventValueChanged.Handler;
+
+public class CraftGUIUtil
+{
+ public static void alignToWidget(IWidget target, IWidget relativeTo)
+ {
+ IPoint startPos = target.getAbsolutePosition();
+ IPoint endPos = relativeTo.getAbsolutePosition();
+ moveWidget(target, endPos.sub(startPos));
+ }
+
+ public static void moveWidget(IWidget target, IPoint movement)
+ {
+ target.setPosition(target.getPosition().add(movement));
+ }
+
+ public static void horizontalGrid(float px, float py, IWidget... widgets)
+ {
+ horizontalGrid(px, py, TextJustification.MiddleCenter, 0.0F, widgets);
+ }
+
+ public static void horizontalGrid(float px, float py, TextJustification just, float spacing, IWidget... widgets)
+ {
+ float x = 0.0F;
+ float h = 0.0F;
+ for (IWidget widget : widgets) {
+ h = Math.max(h, widget.getSize().y());
+ }
+ for (IWidget widget : widgets)
+ {
+ widget.setPosition(new IPoint(px + x, py + (h - widget.getSize().y()) * just.yOffset));
+ x += widget.getSize().x() + spacing;
+ }
+ }
+
+ public static void verticalGrid(float px, float py, IWidget... widgets)
+ {
+ horizontalGrid(px, py, TextJustification.MiddleCenter, 0.0F, widgets);
+ }
+
+ public static void verticalGrid(float px, float py, TextJustification just, float spacing, IWidget... widgets)
+ {
+ float y = 0.0F;
+ float w = 0.0F;
+ for (IWidget widget : widgets) {
+ w = Math.max(w, widget.getSize().x());
+ }
+ for (IWidget widget : widgets)
+ {
+ widget.setPosition(new IPoint(px + (w - widget.getSize().x()) * just.xOffset, py + y));
+ y += widget.getSize().y() + spacing;
+ }
+ }
+
+ public static <T> void linkWidgets(IControlValue<T> tab, IControlValue<T> target)
+ {
+ tab.addSelfEventHandler(new EventValueChanged.Handler()
+ {
+ public void onEvent(EventValueChanged event)
+ {
+ this.val$target.setValue(event.getValue());
+ }
+ });
+ target.addSelfEventHandler(new EventValueChanged.Handler()
+ {
+ public void onEvent(EventValueChanged event)
+ {
+ this.val$tab.setValue(event.getValue());
+ }
+ });
+ }
+}
diff --git a/src/Java/binnie/craftgui/core/geometry/IArea.java b/src/Java/binnie/craftgui/core/geometry/IArea.java
new file mode 100644
index 0000000000..c6b5511773
--- /dev/null
+++ b/src/Java/binnie/craftgui/core/geometry/IArea.java
@@ -0,0 +1,143 @@
+package binnie.craftgui.core.geometry;
+
+public class IArea
+{
+ private IPoint pos;
+ private IPoint size;
+
+ public IArea(IArea area)
+ {
+ this(area.pos().x(), area.pos().y(), area.size().x(), area.size().y());
+ }
+
+ public IArea(IPoint pos, IPoint size)
+ {
+ this(pos.x(), pos.y(), size.x(), size.y());
+ }
+
+ public IArea(float xywh)
+ {
+ this(xywh, xywh, xywh, xywh);
+ }
+
+ public IArea(float xy, float wh)
+ {
+ this(xy, xy, wh, wh);
+ }
+
+ public IArea(float x, float y, float wh)
+ {
+ this(x, y, wh, wh);
+ }
+
+ public IArea(float x, float y, float w, float h)
+ {
+ setPosition(new IPoint(x, y));
+ setSize(new IPoint(w, h));
+ }
+
+ public IPoint pos()
+ {
+ return this.pos;
+ }
+
+ public IPoint getPosition()
+ {
+ return this.pos;
+ }
+
+ public void setPosition(IPoint position)
+ {
+ this.pos = position.copy();
+ }
+
+ public IPoint size()
+ {
+ return this.size;
+ }
+
+ public IPoint getSize()
+ {
+ return this.size;
+ }
+
+ public void setSize(IPoint size)
+ {
+ this.size = size.copy();
+ }
+
+ public boolean contains(IPoint position)
+ {
+ return (position.x() >= pos().x()) && (position.y() >= this.pos.y()) && (position.x() <= pos().x() + size().x()) && (position.y() <= pos().y() + size().y());
+ }
+
+ public float x()
+ {
+ return pos().x();
+ }
+
+ public float y()
+ {
+ return pos().y();
+ }
+
+ public float w()
+ {
+ return size().x();
+ }
+
+ public float h()
+ {
+ return size().y();
+ }
+
+ public float x(float n)
+ {
+ return this.pos.x(n);
+ }
+
+ public float y(float n)
+ {
+ return this.pos.y(n);
+ }
+
+ public float w(float n)
+ {
+ return this.size.x(n);
+ }
+
+ public float h(float n)
+ {
+ return this.size.y(n);
+ }
+
+ public IArea inset(IBorder border)
+ {
+ return new IArea(x() + border.l(), y() + border.t(), w() - border.l() - border.r(), h() - border.t() - border.b());
+ }
+
+ public IArea outset(int outset)
+ {
+ return outset(new IBorder(outset));
+ }
+
+ public IArea outset(IBorder border)
+ {
+ return new IArea(x() - border.l(), y() - border.t(), w() + border.l() + border.r(), h() + border.t() + border.b());
+ }
+
+ public IArea inset(int inset)
+ {
+ return inset(new IBorder(inset));
+ }
+
+ public String toString()
+ {
+ return w() + "x" + h() + "@" + x() + "," + y();
+ }
+
+ public IArea shift(float dx, float f)
+ {
+ return new IArea(x() + dx, y() + f, w(), h());
+ }
+}
diff --git a/src/Java/binnie/craftgui/core/geometry/IBorder.java b/src/Java/binnie/craftgui/core/geometry/IBorder.java
new file mode 100644
index 0000000000..e16b6d97f1
--- /dev/null
+++ b/src/Java/binnie/craftgui/core/geometry/IBorder.java
@@ -0,0 +1,126 @@
+package binnie.craftgui.core.geometry;
+
+public class IBorder
+{
+ public static final IBorder ZERO = new IBorder(0.0F);
+ float t;
+ float b;
+ float l;
+ float r;
+
+ public IBorder(float pad)
+ {
+ this(pad, pad, pad, pad);
+ }
+
+ public IBorder(float tb, float rl)
+ {
+ this(tb, rl, tb, rl);
+ }
+
+ public IBorder(float t, float rl, float b)
+ {
+ this(t, rl, b, rl);
+ }
+
+ public IBorder(float t, float r, float b, float l)
+ {
+ this.t = t;
+ this.b = b;
+ this.l = l;
+ this.r = r;
+ }
+
+ public IBorder(Position edge, float n)
+ {
+ this(edge == Position.Top ? n : 0.0F, edge == Position.Right ? n : 0.0F, edge == Position.Bottom ? n : 0.0F, edge == Position.Left ? n : 0.0F);
+ }
+
+ public IBorder(IBorder padding)
+ {
+ this(padding.t(), padding.r(), padding.b(), padding.l());
+ }
+
+ public float t()
+ {
+ return this.t;
+ }
+
+ public float b()
+ {
+ return this.b;
+ }
+
+ public float l()
+ {
+ return this.l;
+ }
+
+ public float r()
+ {
+ return this.r;
+ }
+
+ public float t(float n)
+ {
+ this.t = n;
+ return this.t;
+ }
+
+ public float b(float n)
+ {
+ this.b = n;
+ return this.b;
+ }
+
+ public float l(float n)
+ {
+ this.l = n;
+ return this.l;
+ }
+
+ public float r(float n)
+ {
+ this.r = n;
+ return this.r;
+ }
+
+ public boolean isNonZero()
+ {
+ return (this.t != 0.0F) || (this.r != 0.0F) || (this.l != 0.0F) || (this.r != 0.0F);
+ }
+
+ @Deprecated
+ public IPoint tl()
+ {
+ return new IPoint(l(), t());
+ }
+
+ @Deprecated
+ public IPoint tr()
+ {
+ return new IPoint(r(), t());
+ }
+
+ @Deprecated
+ public IPoint bl()
+ {
+ return new IPoint(l(), b());
+ }
+
+ @Deprecated
+ public IPoint br()
+ {
+ return new IPoint(r(), b());
+ }
+
+ public IBorder add(IBorder o)
+ {
+ return new IBorder(t() + o.t(), r() + o.r(), b() + o.b(), l() + o.l());
+ }
+
+ public String toString()
+ {
+ return t() + "-" + r() + "-" + b() + "-" + l();
+ }
+}
diff --git a/src/Java/binnie/craftgui/core/geometry/IPoint.java b/src/Java/binnie/craftgui/core/geometry/IPoint.java
new file mode 100644
index 0000000000..53be8972fd
--- /dev/null
+++ b/src/Java/binnie/craftgui/core/geometry/IPoint.java
@@ -0,0 +1,83 @@
+package binnie.craftgui.core.geometry;
+
+public class IPoint
+{
+ public static final IPoint ZERO = new IPoint(0.0F, 0.0F);
+ float x = 0.0F;
+ float y = 0.0F;
+
+ public IPoint(float x, float y)
+ {
+ this.x = x;
+ this.y = y;
+ }
+
+ public IPoint(IPoint o)
+ {
+ this.x = o.x();
+ this.y = o.y();
+ }
+
+ public static IPoint add(IPoint a, IPoint b)
+ {
+ return new IPoint(a.x() + b.x(), a.y() + b.y());
+ }
+
+ public static IPoint sub(IPoint a, IPoint b)
+ {
+ return new IPoint(a.x() - b.x(), a.y() - b.y());
+ }
+
+ public IPoint sub(IPoint a)
+ {
+ return sub(this, a);
+ }
+
+ public IPoint add(IPoint other)
+ {
+ return add(this, other);
+ }
+
+ public IPoint add(float dx, float dy)
+ {
+ return add(this, new IPoint(dx, dy));
+ }
+
+ public IPoint copy()
+ {
+ return new IPoint(this);
+ }
+
+ public float x()
+ {
+ return this.x;
+ }
+
+ public float y()
+ {
+ return this.y;
+ }
+
+ public void xy(float x, float y)
+ {
+ x(x);
+ y(y);
+ }
+
+ public float x(float x)
+ {
+ this.x = x;
+ return x;
+ }
+
+ public float y(float y)
+ {
+ this.y = y;
+ return y;
+ }
+
+ public boolean equals(IPoint other)
+ {
+ return (x() == other.x()) && (y() == other.y());
+ }
+}
diff --git a/src/Java/binnie/craftgui/core/geometry/Position.java b/src/Java/binnie/craftgui/core/geometry/Position.java
new file mode 100644
index 0000000000..51b856f120
--- /dev/null
+++ b/src/Java/binnie/craftgui/core/geometry/Position.java
@@ -0,0 +1,41 @@
+package binnie.craftgui.core.geometry;
+
+public enum Position
+{
+ Top(0, -1), Bottom(0, 1), Left(-1, 0), Right(1, 0);
+
+ int x;
+ int y;
+
+ private Position(int x, int y)
+ {
+ this.x = x;
+ this.y = y;
+ }
+
+ public int x()
+ {
+ return this.x;
+ }
+
+ public int y()
+ {
+ return this.y;
+ }
+
+ public Position opposite()
+ {
+ switch (1.$SwitchMap$binnie$craftgui$core$geometry$Position[ordinal()])
+ {
+ case 1:
+ return Top;
+ case 2:
+ return Right;
+ case 3:
+ return Left;
+ case 4:
+ return Bottom;
+ }
+ return null;
+ }
+}
diff --git a/src/Java/binnie/craftgui/core/geometry/TextJustification.java b/src/Java/binnie/craftgui/core/geometry/TextJustification.java
new file mode 100644
index 0000000000..99b759380b
--- /dev/null
+++ b/src/Java/binnie/craftgui/core/geometry/TextJustification.java
@@ -0,0 +1,25 @@
+package binnie.craftgui.core.geometry;
+
+public enum TextJustification
+{
+ TopLeft(0.0F, 0.0F), TopCenter(0.5F, 0.0F), TopRight(1.0F, 0.0F), MiddleLeft(0.0F, 0.5F), MiddleCenter(0.5F, 0.5F), MiddleRight(1.0F, 0.5F), BottomLeft(0.0F, 1.0F), BottomCenter(0.5F, 1.0F), BottomRight(1.0F, 1.0F);
+
+ float xOffset;
+ float yOffset;
+
+ private TextJustification(float xOffset, float yOffset)
+ {
+ this.xOffset = xOffset;
+ this.yOffset = yOffset;
+ }
+
+ public float getXOffset()
+ {
+ return this.xOffset;
+ }
+
+ public float getYOffset()
+ {
+ return this.yOffset;
+ }
+}
diff --git a/src/Java/binnie/craftgui/core/renderer/Renderer.java b/src/Java/binnie/craftgui/core/renderer/Renderer.java
new file mode 100644
index 0000000000..b1d099bf3a
--- /dev/null
+++ b/src/Java/binnie/craftgui/core/renderer/Renderer.java
@@ -0,0 +1,252 @@
+package binnie.craftgui.core.renderer;
+
+import binnie.core.BinnieCore;
+import binnie.core.proxy.BinnieProxy;
+import binnie.craftgui.core.IWidget;
+import binnie.craftgui.core.geometry.IArea;
+import binnie.craftgui.core.geometry.IBorder;
+import binnie.craftgui.core.geometry.IPoint;
+import binnie.craftgui.core.geometry.Position;
+import binnie.craftgui.core.geometry.TextJustification;
+import binnie.craftgui.minecraft.GuiCraftGUI;
+import binnie.craftgui.resource.IStyleSheet;
+import binnie.craftgui.resource.Texture;
+import java.util.List;
+import net.minecraft.client.gui.FontRenderer;
+import net.minecraft.client.renderer.texture.TextureMap;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.IIcon;
+import org.lwjgl.opengl.GL11;
+
+public class Renderer
+{
+ GuiCraftGUI gui;
+
+ public Renderer(GuiCraftGUI gui)
+ {
+ this.gui = gui;
+ }
+
+ public final void preRender(IWidget widget)
+ {
+ GL11.glPushMatrix();
+ GL11.glTranslatef(widget.getPosition().x(), widget.getPosition().y(), 0.0F);
+ colour(widget.getColour());
+ if (widget.isCroppedWidet())
+ {
+ IWidget cropRelative = widget.getCropWidget() != null ? widget.getCropWidget() : widget;
+ IPoint pos = cropRelative.getAbsolutePosition();
+ IArea cropZone = widget.getCroppedZone();
+ limitArea(new IArea(pos.add(cropZone.pos()), cropZone.size()));
+ GL11.glEnable(3089);
+ }
+ GL11.glDisable(2929);
+ }
+
+ public final void postRender(IWidget widget)
+ {
+ if (widget.isCroppedWidet()) {
+ GL11.glDisable(3089);
+ }
+ GL11.glEnable(2929);
+ GL11.glPopMatrix();
+ }
+
+ int currentColour = 16777215;
+ Texture currentTexture;
+ IStyleSheet stylesheet;
+
+ public void colour(int hex)
+ {
+ this.currentColour = hex;
+ int a = (hex & 0xFF000000) >> 24;
+ int r = (hex & 0xFF0000) >> 16;
+ int g = (hex & 0xFF00) >> 8;
+ int b = hex & 0xFF;
+ if (a < 0) {
+ a += 256;
+ }
+ if ((a > 0) && (a != 255))
+ {
+ GL11.glColor4f(r / 255.0F, g / 255.0F, b / 255.0F, a / 255.0F);
+ GL11.glEnable(3042);
+ }
+ else
+ {
+ GL11.glColor3f(r / 255.0F, g / 255.0F, b / 255.0F);
+ }
+ }
+
+ public Texture getTexture(Object key)
+ {
+ if ((key instanceof Texture)) {
+ return (Texture)key;
+ }
+ return this.stylesheet.getTexture(key);
+ }
+
+ public void setTexture(Texture texture)
+ {
+ if ((texture != this.currentTexture) && (texture != null)) {
+ BinnieCore.proxy.bindTexture(texture.getFilename());
+ }
+ colour(this.currentColour);
+ }
+
+ public void texture(Object texture, IPoint position)
+ {
+ texture(getTexture(texture), position);
+ }
+
+ public void texture(Texture texture, IPoint position)
+ {
+ if (texture == null) {
+ return;
+ }
+ setTexture(texture);
+ IPoint point = position.sub(new IPoint(texture.getBorder().l(), texture.getBorder().t()));
+ IArea textureArea = texture.getArea().outset(texture.getBorder());
+ this.gui.renderTexture(point, textureArea);
+ }
+
+ public void texture(Object window, IArea area)
+ {
+ texture(getTexture(window), area);
+ }
+
+ public void texture(Texture texture, IArea area)
+ {
+ if (texture == null) {
+ return;
+ }
+ setTexture(texture);
+ IArea textureArea = texture.getArea().outset(texture.getBorder());
+ IArea targetArea = area.outset(texture.getBorder());
+ if ((textureArea.w() == targetArea.w()) && (textureArea.h() == targetArea.h())) {
+ this.gui.renderTexture(targetArea.pos(), textureArea);
+ } else {
+ this.gui.renderTexturePadded(targetArea, textureArea, texture.getTotalPadding());
+ }
+ }
+
+ public void stylesheet(IStyleSheet sheet)
+ {
+ this.stylesheet = sheet;
+ }
+
+ public int textWidth(String text)
+ {
+ return this.gui.getFontRenderer().getStringWidth(text);
+ }
+
+ public int textHeight()
+ {
+ return this.gui.getFontRenderer() == null ? 0 : this.gui.getFontRenderer().FONT_HEIGHT;
+ }
+
+ public void text(IPoint pos, String text, int colour)
+ {
+ text(new IArea(pos, new IPoint(500.0F, 500.0F)), TextJustification.TopLeft, text, colour);
+ }
+
+ public void text(IArea area, TextJustification justification, String text, int colour)
+ {
+ IPoint pos = area.pos();
+ if (area.size().x() <= 0.0F) {
+ return;
+ }
+ List<String> wrappedStrings = this.gui.getFontRenderer().listFormattedStringToWidth(text, (int)area.size().x());
+ float totalHeight = wrappedStrings.size() * textHeight();
+ float posY = area.pos().y();
+ if (area.size().y() > totalHeight) {
+ posY += (area.size().y() - totalHeight) * justification.getYOffset();
+ }
+ for (String string : wrappedStrings)
+ {
+ float stringWidth = textWidth(string);
+ float posX = area.size().x() - stringWidth;
+ posX *= justification.getXOffset();
+ GL11.glDisable(2929);
+ this.gui.getFontRenderer().drawString(string, (int)(pos.x() + posX), (int)posY, colour);
+
+ posY += textHeight();
+ }
+ GL11.glColor3f(1.0F, 1.0F, 1.0F);
+ }
+
+ public void solid(IArea area, int colour)
+ {
+ this.gui.drawRect(area.pos().x(), area.pos().y(), area.pos().x() + area.size().x(), area.pos().y() + area.size().y(), 0xFF000000 | colour);
+ }
+
+ public void solidAlpha(IArea area, int c1)
+ {
+ this.gui.drawGradientArea(area.pos().x(), area.pos().y(), area.pos().x() + area.size().x(), area.pos().y() + area.size().y(), c1, c1);
+ }
+
+ public void gradientRect(IArea area, int c1, int c2)
+ {
+ this.gui.drawGradientArea(area.pos().x(), area.pos().y(), area.pos().x() + area.size().x(), area.pos().y() + area.size().y(), c1, c2);
+ }
+
+ public void item(IPoint pos, ItemStack item)
+ {
+ this.gui.renderItem(pos, item, false);
+ }
+
+ public void item(IPoint pos, ItemStack item, boolean rotating)
+ {
+ this.gui.renderItem(pos, item, rotating);
+ }
+
+ public void iconBlock(IPoint pos, IIcon icon)
+ {
+ this.gui.renderIcon(pos, icon, TextureMap.locationBlocksTexture);
+ }
+
+ public void iconItem(IPoint pos, IIcon icon)
+ {
+ this.gui.renderIcon(pos, icon, TextureMap.locationItemsTexture);
+ }
+
+ public void limitArea(IArea area)
+ {
+ this.gui.limitArea(area);
+ }
+
+ public float textHeight(String text, float width)
+ {
+ return this.gui.getFontRenderer().listFormattedStringToWidth(text, (int)width).size() * textHeight();
+ }
+
+ public void texturePercentage(Texture texture, IArea area, Position direction, float percentage)
+ {
+ float dist = (direction == Position.Top) || (direction == Position.Bottom) ? percentage * texture.h() : percentage * texture.w();
+
+ float dim = (direction == Position.Top) || (direction == Position.Bottom) ? texture.h() : texture.w();
+
+ float x = area.pos().x();
+ float y = area.pos().y();
+ float w = area.size().x();
+ float h = area.size().y();
+ switch (1.$SwitchMap$binnie$craftgui$core$geometry$Position[direction.ordinal()])
+ {
+ case 1:
+ h *= percentage;
+ break;
+ case 2:
+ x += (1.0F - percentage) * w;
+ w *= percentage;
+ break;
+ case 3:
+ w *= percentage;
+ break;
+ case 4:
+ y += h - (int)(percentage * h);
+ h *= percentage;
+ }
+ texture(texture.crop(direction, dim - dist), new IArea(x, y, w, h));
+ }
+
+ public void test(IWidget widget) {}
+}
diff --git a/src/Java/binnie/craftgui/core/renderer/TextureType.java b/src/Java/binnie/craftgui/core/renderer/TextureType.java
new file mode 100644
index 0000000000..1c9b0e0d1c
--- /dev/null
+++ b/src/Java/binnie/craftgui/core/renderer/TextureType.java
@@ -0,0 +1,8 @@
+package binnie.craftgui.core.renderer;
+
+public enum TextureType
+{
+ Stretched, Tiled;
+
+ private TextureType() {}
+}
diff --git a/src/Java/binnie/craftgui/events/Event.java b/src/Java/binnie/craftgui/events/Event.java
new file mode 100644
index 0000000000..0b4a39426a
--- /dev/null
+++ b/src/Java/binnie/craftgui/events/Event.java
@@ -0,0 +1,23 @@
+package binnie.craftgui.events;
+
+import binnie.craftgui.core.IWidget;
+
+public class Event
+{
+ IWidget origin;
+
+ public Event(IWidget origin)
+ {
+ this.origin = origin;
+ }
+
+ public IWidget getOrigin()
+ {
+ return this.origin;
+ }
+
+ public boolean isOrigin(IWidget widget)
+ {
+ return this.origin == widget;
+ }
+}
diff --git a/src/Java/binnie/craftgui/events/EventButtonClicked.java b/src/Java/binnie/craftgui/events/EventButtonClicked.java
new file mode 100644
index 0000000000..1823e6d430
--- /dev/null
+++ b/src/Java/binnie/craftgui/events/EventButtonClicked.java
@@ -0,0 +1,21 @@
+package binnie.craftgui.events;
+
+import binnie.craftgui.core.IWidget;
+
+public class EventButtonClicked
+ extends Event
+{
+ public EventButtonClicked(IWidget origin)
+ {
+ super(origin);
+ }
+
+ public static abstract class Handler
+ extends EventHandler<EventButtonClicked>
+ {
+ public Handler()
+ {
+ super();
+ }
+ }
+}
diff --git a/src/Java/binnie/craftgui/events/EventCycleChanged.java b/src/Java/binnie/craftgui/events/EventCycleChanged.java
new file mode 100644
index 0000000000..628a177449
--- /dev/null
+++ b/src/Java/binnie/craftgui/events/EventCycleChanged.java
@@ -0,0 +1,20 @@
+package binnie.craftgui.events;
+
+import binnie.craftgui.core.IWidget;
+
+public class EventCycleChanged
+ extends Event
+{
+ public int value;
+
+ public EventCycleChanged(IWidget origin, int value)
+ {
+ super(origin);
+ this.value = value;
+ }
+
+ public int getValue()
+ {
+ return this.value;
+ }
+}
diff --git a/src/Java/binnie/craftgui/events/EventHandler.java b/src/Java/binnie/craftgui/events/EventHandler.java
new file mode 100644
index 0000000000..9d2e5d2ad3
--- /dev/null
+++ b/src/Java/binnie/craftgui/events/EventHandler.java
@@ -0,0 +1,53 @@
+package binnie.craftgui.events;
+
+import binnie.craftgui.core.IWidget;
+import java.util.List;
+
+public abstract class EventHandler<E extends Event>
+{
+ Class<E> eventClass;
+ Origin origin = Origin.Any;
+ IWidget relative = null;
+
+ public EventHandler(Class<E> eventClass)
+ {
+ this.eventClass = eventClass;
+ }
+
+ public EventHandler setOrigin(Origin origin, IWidget relative)
+ {
+ this.origin = origin;
+ this.relative = relative;
+ return this;
+ }
+
+ public abstract void onEvent(E paramE);
+
+ public final boolean handles(Event e)
+ {
+ return (this.eventClass.isInstance(e)) && (this.origin.isOrigin(e.getOrigin(), this.relative));
+ }
+
+ public static enum Origin
+ {
+ Any, Self, Parent, DirectChild;
+
+ private Origin() {}
+
+ public boolean isOrigin(IWidget origin, IWidget test)
+ {
+ switch (EventHandler.1.$SwitchMap$binnie$craftgui$events$EventHandler$Origin[ordinal()])
+ {
+ case 1:
+ return true;
+ case 2:
+ return test.getWidgets().contains(origin);
+ case 3:
+ return test.getParent() == origin;
+ case 4:
+ return test == origin;
+ }
+ return false;
+ }
+ }
+}
diff --git a/src/Java/binnie/craftgui/events/EventKey.java b/src/Java/binnie/craftgui/events/EventKey.java
new file mode 100644
index 0000000000..e49b736f43
--- /dev/null
+++ b/src/Java/binnie/craftgui/events/EventKey.java
@@ -0,0 +1,63 @@
+package binnie.craftgui.events;
+
+import binnie.craftgui.core.IWidget;
+
+public abstract class EventKey
+ extends Event
+{
+ char character;
+ int key;
+
+ public EventKey(IWidget origin, char character, int key)
+ {
+ super(origin);
+ this.character = character;
+ this.key = key;
+ }
+
+ public char getCharacter()
+ {
+ return this.character;
+ }
+
+ public int getKey()
+ {
+ return this.key;
+ }
+
+ public static class Down
+ extends EventKey
+ {
+ public Down(IWidget origin, char character, int key)
+ {
+ super(character, key);
+ }
+
+ public static abstract class Handler
+ extends EventHandler<EventKey.Down>
+ {
+ public Handler()
+ {
+ super();
+ }
+ }
+ }
+
+ public static class Up
+ extends EventKey
+ {
+ public Up(IWidget origin, char character, int key)
+ {
+ super(character, key);
+ }
+
+ public static abstract class Handler
+ extends EventHandler<EventKey.Up>
+ {
+ public Handler()
+ {
+ super();
+ }
+ }
+ }
+}
diff --git a/src/Java/binnie/craftgui/events/EventMouse.java b/src/Java/binnie/craftgui/events/EventMouse.java
new file mode 100644
index 0000000000..162552098a
--- /dev/null
+++ b/src/Java/binnie/craftgui/events/EventMouse.java
@@ -0,0 +1,156 @@
+package binnie.craftgui.events;
+
+import binnie.craftgui.core.IWidget;
+
+public abstract class EventMouse
+ extends Event
+{
+ public EventMouse(IWidget origin)
+ {
+ super(origin);
+ }
+
+ public static class Button
+ extends EventMouse
+ {
+ int x;
+ int y;
+ int button;
+
+ public int getX()
+ {
+ return this.x;
+ }
+
+ public int getY()
+ {
+ return this.y;
+ }
+
+ public int getButton()
+ {
+ return this.button;
+ }
+
+ public Button(IWidget currentMousedOverWidget, int x, int y, int button)
+ {
+ super();
+ this.x = x;
+ this.y = y;
+ this.button = button;
+ }
+ }
+
+ public static class Down
+ extends EventMouse.Button
+ {
+ public Down(IWidget currentMousedOverWidget, int x, int y, int button)
+ {
+ super(x, y, button);
+ }
+
+ public static abstract class Handler
+ extends EventHandler<EventMouse.Down>
+ {
+ public Handler()
+ {
+ super();
+ }
+ }
+ }
+
+ public static class Up
+ extends EventMouse.Button
+ {
+ public Up(IWidget currentMousedOverWidget, int x, int y, int button)
+ {
+ super(x, y, button);
+ }
+
+ public static abstract class Handler
+ extends EventHandler<EventMouse.Up>
+ {
+ public Handler()
+ {
+ super();
+ }
+ }
+ }
+
+ public static class Move
+ extends EventMouse
+ {
+ float dx;
+ float dy;
+
+ public float getDx()
+ {
+ return this.dx;
+ }
+
+ public float getDy()
+ {
+ return this.dy;
+ }
+
+ public Move(IWidget origin, float dx, float dy)
+ {
+ super();
+ this.dx = dx;
+ this.dy = dy;
+ }
+
+ public static abstract class Handler
+ extends EventHandler<EventMouse.Move>
+ {
+ public Handler()
+ {
+ super();
+ }
+ }
+ }
+
+ public static class Drag
+ extends EventMouse.Move
+ {
+ public Drag(IWidget draggedWidget, float dx, float dy)
+ {
+ super(dx, dy);
+ }
+
+ public static abstract class Handler
+ extends EventHandler<EventMouse.Drag>
+ {
+ public Handler()
+ {
+ super();
+ }
+ }
+ }
+
+ public static class Wheel
+ extends EventMouse
+ {
+ int dWheel = 0;
+
+ public Wheel(IWidget origin, int dWheel)
+ {
+ super();
+ this.dWheel = (dWheel / 28);
+ }
+
+ public int getDWheel()
+ {
+ return this.dWheel;
+ }
+
+ public static abstract class Handler
+ extends EventHandler<EventMouse.Wheel>
+ {
+ public Handler()
+ {
+ super();
+ }
+ }
+ }
+}
diff --git a/src/Java/binnie/craftgui/events/EventTextEdit.java b/src/Java/binnie/craftgui/events/EventTextEdit.java
new file mode 100644
index 0000000000..d61ae34008
--- /dev/null
+++ b/src/Java/binnie/craftgui/events/EventTextEdit.java
@@ -0,0 +1,21 @@
+package binnie.craftgui.events;
+
+import binnie.craftgui.core.IWidget;
+
+public class EventTextEdit
+ extends EventValueChanged<String>
+{
+ public EventTextEdit(IWidget origin, String text)
+ {
+ super(origin, text);
+ }
+
+ public static abstract class Handler
+ extends EventHandler<EventTextEdit>
+ {
+ public Handler()
+ {
+ super();
+ }
+ }
+}
diff --git a/src/Java/binnie/craftgui/events/EventToggleButtonClicked.java b/src/Java/binnie/craftgui/events/EventToggleButtonClicked.java
new file mode 100644
index 0000000000..79ff26fa59
--- /dev/null
+++ b/src/Java/binnie/craftgui/events/EventToggleButtonClicked.java
@@ -0,0 +1,20 @@
+package binnie.craftgui.events;
+
+import binnie.craftgui.core.IWidget;
+
+public class EventToggleButtonClicked
+ extends Event
+{
+ boolean toggled;
+
+ public EventToggleButtonClicked(IWidget origin, boolean toggled)
+ {
+ super(origin);
+ this.toggled = toggled;
+ }
+
+ public boolean isActive()
+ {
+ return this.toggled;
+ }
+}
diff --git a/src/Java/binnie/craftgui/events/EventValueChanged.java b/src/Java/binnie/craftgui/events/EventValueChanged.java
new file mode 100644
index 0000000000..df804cbfa5
--- /dev/null
+++ b/src/Java/binnie/craftgui/events/EventValueChanged.java
@@ -0,0 +1,29 @@
+package binnie.craftgui.events;
+
+import binnie.craftgui.core.IWidget;
+
+public class EventValueChanged<T>
+ extends Event
+{
+ public T value;
+
+ public EventValueChanged(IWidget origin, T value)
+ {
+ super(origin);
+ this.value = value;
+ }
+
+ public T getValue()
+ {
+ return this.value;
+ }
+
+ public static abstract class Handler
+ extends EventHandler<EventValueChanged>
+ {
+ public Handler()
+ {
+ super();
+ }
+ }
+}
diff --git a/src/Java/binnie/craftgui/events/EventValuesChanged.java b/src/Java/binnie/craftgui/events/EventValuesChanged.java
new file mode 100644
index 0000000000..e102487f14
--- /dev/null
+++ b/src/Java/binnie/craftgui/events/EventValuesChanged.java
@@ -0,0 +1,20 @@
+package binnie.craftgui.events;
+
+import binnie.craftgui.core.IWidget;
+
+public class EventValuesChanged<T>
+ extends Event
+{
+ public T[] values;
+
+ public EventValuesChanged(IWidget origin, T[] values)
+ {
+ super(origin);
+ this.values = values;
+ }
+
+ public T[] getValues()
+ {
+ return this.values;
+ }
+}
diff --git a/src/Java/binnie/craftgui/events/EventWidget.java b/src/Java/binnie/craftgui/events/EventWidget.java
new file mode 100644
index 0000000000..87ca98521f
--- /dev/null
+++ b/src/Java/binnie/craftgui/events/EventWidget.java
@@ -0,0 +1,272 @@
+package binnie.craftgui.events;
+
+import binnie.craftgui.core.IWidget;
+
+public class EventWidget
+ extends Event
+{
+ public EventWidget(IWidget origin)
+ {
+ super(origin);
+ }
+
+ public static class Enable
+ extends EventWidget
+ {
+ public Enable(IWidget origin)
+ {
+ super();
+ }
+
+ public static abstract class Handler
+ extends EventHandler<EventWidget.Enable>
+ {
+ public Handler()
+ {
+ super();
+ }
+ }
+ }
+
+ public static class Disable
+ extends EventWidget
+ {
+ public Disable(IWidget origin)
+ {
+ super();
+ }
+
+ public static abstract class Handler
+ extends EventHandler<EventWidget.Disable>
+ {
+ public Handler()
+ {
+ super();
+ }
+ }
+ }
+
+ public static class Show
+ extends EventWidget
+ {
+ public Show(IWidget origin)
+ {
+ super();
+ }
+
+ public static abstract class Handler
+ extends EventHandler<EventWidget.Show>
+ {
+ public Handler()
+ {
+ super();
+ }
+ }
+ }
+
+ public static class Hide
+ extends EventWidget
+ {
+ public Hide(IWidget origin)
+ {
+ super();
+ }
+
+ public static abstract class Handler
+ extends EventHandler<EventWidget.Hide>
+ {
+ public Handler()
+ {
+ super();
+ }
+ }
+ }
+
+ public static class ChangePosition
+ extends EventWidget
+ {
+ public ChangePosition(IWidget origin)
+ {
+ super();
+ }
+
+ public static abstract class Handler
+ extends EventHandler<EventWidget.ChangePosition>
+ {
+ public Handler()
+ {
+ super();
+ }
+ }
+ }
+
+ public static class ChangeSize
+ extends EventWidget
+ {
+ public ChangeSize(IWidget origin)
+ {
+ super();
+ }
+
+ public static abstract class Handler
+ extends EventHandler<EventWidget.ChangeSize>
+ {
+ public Handler()
+ {
+ super();
+ }
+ }
+ }
+
+ public static class ChangeOffset
+ extends EventWidget
+ {
+ public ChangeOffset(IWidget origin)
+ {
+ super();
+ }
+
+ public static abstract class Handler
+ extends EventHandler<EventWidget.ChangeOffset>
+ {
+ public Handler()
+ {
+ super();
+ }
+ }
+ }
+
+ public static class ChangeColour
+ extends EventWidget
+ {
+ public ChangeColour(IWidget origin)
+ {
+ super();
+ }
+
+ public static abstract class Handler
+ extends EventHandler<EventWidget.ChangeColour>
+ {
+ public Handler()
+ {
+ super();
+ }
+ }
+ }
+
+ public static class StartMouseOver
+ extends EventWidget
+ {
+ public StartMouseOver(IWidget origin)
+ {
+ super();
+ }
+
+ public static abstract class Handler
+ extends EventHandler<EventWidget.StartMouseOver>
+ {
+ public Handler()
+ {
+ super();
+ }
+ }
+ }
+
+ public static class EndMouseOver
+ extends EventWidget
+ {
+ public EndMouseOver(IWidget origin)
+ {
+ super();
+ }
+
+ public static abstract class Handler
+ extends EventHandler<EventWidget.EndMouseOver>
+ {
+ public Handler()
+ {
+ super();
+ }
+ }
+ }
+
+ public static class StartDrag
+ extends EventWidget
+ {
+ int button;
+
+ public StartDrag(IWidget origin, int button)
+ {
+ super();
+ this.button = button;
+ }
+
+ public int getButton()
+ {
+ return this.button;
+ }
+
+ public static abstract class Handler
+ extends EventHandler<EventWidget.StartDrag>
+ {
+ public Handler()
+ {
+ super();
+ }
+ }
+ }
+
+ public static class EndDrag
+ extends EventWidget
+ {
+ public EndDrag(IWidget origin)
+ {
+ super();
+ }
+
+ public static abstract class Handler
+ extends EventHandler<EventWidget.EndDrag>
+ {
+ public Handler()
+ {
+ super();
+ }
+ }
+ }
+
+ public static class GainFocus
+ extends EventWidget
+ {
+ public GainFocus(IWidget origin)
+ {
+ super();
+ }
+
+ public static abstract class Handler
+ extends EventHandler<EventWidget.GainFocus>
+ {
+ public Handler()
+ {
+ super();
+ }
+ }
+ }
+
+ public static class LoseFocus
+ extends EventWidget
+ {
+ public LoseFocus(IWidget origin)
+ {
+ super();
+ }
+
+ public static abstract class Handler
+ extends EventHandler<EventWidget.LoseFocus>
+ {
+ public Handler()
+ {
+ super();
+ }
+ }
+ }
+}
diff --git a/src/Java/binnie/craftgui/extratrees/dictionary/ControlBlockIconDisplay.java b/src/Java/binnie/craftgui/extratrees/dictionary/ControlBlockIconDisplay.java
new file mode 100644
index 0000000000..58b93a2782
--- /dev/null
+++ b/src/Java/binnie/craftgui/extratrees/dictionary/ControlBlockIconDisplay.java
@@ -0,0 +1,25 @@
+package binnie.craftgui.extratrees.dictionary;
+
+import binnie.craftgui.controls.core.Control;
+import binnie.craftgui.core.CraftGUI;
+import binnie.craftgui.core.IWidget;
+import binnie.craftgui.core.geometry.IPoint;
+import binnie.craftgui.core.renderer.Renderer;
+import net.minecraft.util.IIcon;
+
+public class ControlBlockIconDisplay
+ extends Control
+{
+ IIcon icon;
+
+ public ControlBlockIconDisplay(IWidget parent, float x, float y, IIcon icon)
+ {
+ super(parent, x, y, 18.0F, 18.0F);
+ this.icon = icon;
+ }
+
+ public void onRenderBackground()
+ {
+ CraftGUI.Render.iconBlock(IPoint.ZERO, this.icon);
+ }
+}
diff --git a/src/Java/binnie/craftgui/extratrees/dictionary/ControlBreweryProgress.java b/src/Java/binnie/craftgui/extratrees/dictionary/ControlBreweryProgress.java
new file mode 100644
index 0000000000..d6d18d3a69
--- /dev/null
+++ b/src/Java/binnie/craftgui/extratrees/dictionary/ControlBreweryProgress.java
@@ -0,0 +1,115 @@
+package binnie.craftgui.extratrees.dictionary;
+
+import binnie.core.machines.Machine;
+import binnie.core.util.ItemStackSet;
+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.renderer.Renderer;
+import binnie.craftgui.minecraft.Window;
+import binnie.craftgui.minecraft.control.ControlProgressBase;
+import binnie.craftgui.resource.Texture;
+import binnie.craftgui.resource.minecraft.StandardTexture;
+import binnie.extratrees.core.ExtraTreeTexture;
+import binnie.extratrees.machines.Brewery;
+import binnie.extratrees.machines.Brewery.BreweryCrafting;
+import binnie.extratrees.machines.Brewery.ComponentBreweryLogic;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.IIcon;
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidStack;
+import org.lwjgl.opengl.GL11;
+
+public class ControlBreweryProgress
+ extends ControlProgressBase
+{
+ static Texture Brewery = new StandardTexture(0, 69, 34, 39, ExtraTreeTexture.Gui);
+ static Texture BreweryOverlay = new StandardTexture(34, 69, 34, 39, ExtraTreeTexture.Gui);
+
+ public void onRenderBackground()
+ {
+ CraftGUI.Render.texture(Brewery, new IPoint(0.0F, 0.0F));
+
+ Brewery.ComponentBreweryLogic logic = (Brewery.ComponentBreweryLogic)Machine.getInterface(Brewery.ComponentBreweryLogic.class, Window.get(this).getInventory());
+ if (logic.currentCrafting == null) {
+ return;
+ }
+ if (logic.currentCrafting.currentInput == null) {
+ return;
+ }
+ int fermentedHeight = (int)(32.0F * logic.getProgress() / 100.0F);
+
+ CraftGUI.Render.limitArea(new IArea(new IPoint(1.0F, 6.0F).add(getAbsolutePosition()), new IPoint(32.0F, 32 - fermentedHeight)));
+
+ GL11.glEnable(3089);
+
+ renderFluid(logic.currentCrafting.currentInput, new IPoint(1.0F, 6.0F));
+ renderFluid(logic.currentCrafting.currentInput, new IPoint(17.0F, 6.0F));
+ renderFluid(logic.currentCrafting.currentInput, new IPoint(1.0F, 22.0F));
+ 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(getAbsolutePosition()), new IPoint(32.0F, fermentedHeight)));
+
+
+ GL11.glEnable(3089);
+
+ renderFluid(Brewery.getOutput(logic.currentCrafting), new IPoint(1.0F, 6.0F));
+ renderFluid(Brewery.getOutput(logic.currentCrafting), new IPoint(17.0F, 6.0F));
+ renderFluid(Brewery.getOutput(logic.currentCrafting), new IPoint(1.0F, 22.0F));
+ renderFluid(Brewery.getOutput(logic.currentCrafting), new IPoint(17.0F, 22.0F));
+
+ GL11.glDisable(3089);
+
+ ItemStackSet stacks = new ItemStackSet();
+ for (ItemStack stack : logic.currentCrafting.inputs) {
+ stacks.add(stack);
+ }
+ stacks.add(logic.currentCrafting.ingr);
+
+ int x = 1;
+ int y = 6;
+ for (ItemStack stack : stacks)
+ {
+ CraftGUI.Render.item(new IPoint(x, y), stack);
+ x += 16;
+ if (x > 18)
+ {
+ x = 1;
+ y += 16;
+ }
+ }
+ }
+
+ public void onRenderForeground() {}
+
+ protected ControlBreweryProgress(IWidget parent, float x, float y)
+ {
+ super(parent, x, y, 34.0F, 39.0F);
+ addAttribute(Attribute.MouseOver);
+ }
+
+ public void renderFluid(FluidStack fluid, IPoint pos)
+ {
+ int hex = fluid.getFluid().getColor(fluid);
+
+ int r = (hex & 0xFF0000) >> 16;
+ int g = (hex & 0xFF00) >> 8;
+ int b = hex & 0xFF;
+
+ 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);
+ }
+}
diff --git a/src/Java/binnie/craftgui/extratrees/dictionary/ControlDistilleryProgress.java b/src/Java/binnie/craftgui/extratrees/dictionary/ControlDistilleryProgress.java
new file mode 100644
index 0000000000..5a44b09ca3
--- /dev/null
+++ b/src/Java/binnie/craftgui/extratrees/dictionary/ControlDistilleryProgress.java
@@ -0,0 +1,104 @@
+package binnie.craftgui.extratrees.dictionary;
+
+import binnie.core.machines.Machine;
+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.Position;
+import binnie.craftgui.core.renderer.Renderer;
+import binnie.craftgui.events.EventMouse.Down;
+import binnie.craftgui.events.EventMouse.Down.Handler;
+import binnie.craftgui.minecraft.Window;
+import binnie.craftgui.minecraft.control.ControlProgressBase;
+import binnie.craftgui.resource.Texture;
+import binnie.craftgui.resource.minecraft.StandardTexture;
+import binnie.extratrees.core.ExtraTreeTexture;
+import binnie.extratrees.machines.Distillery.ComponentDistilleryLogic;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.IIcon;
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidStack;
+import org.lwjgl.opengl.GL11;
+
+public class ControlDistilleryProgress
+ extends ControlProgressBase
+{
+ static Texture DistilleryBase = new StandardTexture(43, 0, 58, 66, ExtraTreeTexture.Gui);
+ static Texture DistilleryOverlay = new StandardTexture(139, 0, 18, 66, ExtraTreeTexture.Gui);
+ static Texture LiquidFlow = new StandardTexture(101, 0, 38, 66, ExtraTreeTexture.Gui);
+ static Texture Output = new StandardTexture(68, 66, 17, 7, ExtraTreeTexture.Gui);
+
+ public void onRenderBackground()
+ {
+ CraftGUI.Render.texture(DistilleryBase, new IPoint(0.0F, 0.0F));
+ CraftGUI.Render.texturePercentage(LiquidFlow, new IArea(18.0F, 0.0F, 38.0F, 66.0F), Position.Left, this.progress);
+
+ Distillery.ComponentDistilleryLogic component = (Distillery.ComponentDistilleryLogic)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++) {
+ renderFluid(stack, new IPoint(1.0F, 1 + y * 16));
+ }
+ }
+ }
+
+ public void onRenderForeground()
+ {
+ int level = ((Distillery.ComponentDistilleryLogic)Machine.getInterface(Distillery.ComponentDistilleryLogic.class, Window.get(this).getInventory())).level;
+ CraftGUI.Render.texture(Output, new IPoint(47.0F, 14 + level * 15));
+ CraftGUI.Render.texture(DistilleryOverlay, new IPoint(0.0F, 0.0F));
+ }
+
+ protected ControlDistilleryProgress(IWidget parent, float x, float y)
+ {
+ super(parent, x, y, 58.0F, 66.0F);
+
+ addSelfEventHandler(new EventMouse.Down.Handler()
+ {
+ public void onEvent(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)
+ {
+ NBTTagCompound nbt = new NBTTagCompound();
+ nbt.setByte("i", (byte)distillationLevel);
+ Window.get(ControlDistilleryProgress.this.getWidget()).sendClientAction("still-level", nbt);
+ }
+ }
+ });
+ }
+
+ public void renderFluid(FluidStack fluid, IPoint pos)
+ {
+ int hex = fluid.getFluid().getColor(fluid);
+
+ int r = (hex & 0xFF0000) >> 16;
+ int g = (hex & 0xFF00) >> 8;
+ int b = hex & 0xFF;
+
+ 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);
+ }
+}
diff --git a/src/Java/binnie/craftgui/extratrees/dictionary/ControlFruitPressProgress.java b/src/Java/binnie/craftgui/extratrees/dictionary/ControlFruitPressProgress.java
new file mode 100644
index 0000000000..79d21a3025
--- /dev/null
+++ b/src/Java/binnie/craftgui/extratrees/dictionary/ControlFruitPressProgress.java
@@ -0,0 +1,90 @@
+package binnie.craftgui.extratrees.dictionary;
+
+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.EventMouse.Down;
+import binnie.craftgui.events.EventMouse.Down.Handler;
+import binnie.craftgui.minecraft.ContainerCraftGUI;
+import binnie.craftgui.minecraft.Window;
+import binnie.craftgui.minecraft.control.ControlProgressBase;
+import binnie.craftgui.resource.Texture;
+import binnie.craftgui.resource.minecraft.StandardTexture;
+import binnie.extratrees.core.ExtraTreeTexture;
+import binnie.extratrees.machines.Press;
+import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.IIcon;
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidStack;
+import org.lwjgl.opengl.GL11;
+
+public class ControlFruitPressProgress
+ extends ControlProgressBase
+{
+ static Texture PressTexture = new StandardTexture(6, 0, 24, 52, ExtraTreeTexture.Gui);
+ static Texture PressSlot = new StandardTexture(9, 52, 34, 17, ExtraTreeTexture.Gui);
+
+ public void onRenderBackground()
+ {
+ CraftGUI.Render.texture(PressSlot, new IPoint(3.0F, 52.0F));
+
+ ItemStack input = Window.get(this).getContainer().getSlotFromInventory(Window.get(this).getInventory(), Press.slotCurrent).getStack();
+ if ((input == null) || (Press.getOutput(input) == null)) {
+ return;
+ }
+ Fluid fluid = Press.getOutput(input).getFluid();
+
+ int hex = fluid.getColor(Press.getOutput(input));
+
+ int r = (hex & 0xFF0000) >> 16;
+ int g = (hex & 0xFF00) >> 8;
+ 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);
+ }
+
+ public void onRenderForeground()
+ {
+ CraftGUI.Render.texture(PressTexture, new IPoint(0.0F, 16.0F * this.progress));
+ }
+
+ protected ControlFruitPressProgress(IWidget parent, float x, float y)
+ {
+ super(parent, x, y, 37.0F, 69.0F);
+ addAttribute(Attribute.MouseOver);
+
+ addSelfEventHandler(new EventMouse.Down.Handler()
+ {
+ public void onEvent(EventMouse.Down event)
+ {
+ if (event.getButton() == 0)
+ {
+ NBTTagCompound action = new NBTTagCompound();
+ Window.get(ControlFruitPressProgress.this.getWidget()).sendClientAction("fruitpress-click", action);
+ }
+ else if (event.getButton() == 1)
+ {
+ NBTTagCompound action = new NBTTagCompound();
+ Window.get(ControlFruitPressProgress.this.getWidget()).sendClientAction("clear-fruit", action);
+ }
+ }
+ });
+ }
+}
diff --git a/src/Java/binnie/craftgui/extratrees/dictionary/ControlLumbermillProgress.java b/src/Java/binnie/craftgui/extratrees/dictionary/ControlLumbermillProgress.java
new file mode 100644
index 0000000000..b315c23927
--- /dev/null
+++ b/src/Java/binnie/craftgui/extratrees/dictionary/ControlLumbermillProgress.java
@@ -0,0 +1,96 @@
+package binnie.craftgui.extratrees.dictionary;
+
+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.renderer.Renderer;
+import binnie.craftgui.minecraft.MinecraftGUI.PanelType;
+import binnie.craftgui.minecraft.Window;
+import binnie.craftgui.minecraft.control.ControlProgressBase;
+import binnie.craftgui.resource.Texture;
+import binnie.craftgui.resource.minecraft.StandardTexture;
+import binnie.craftgui.window.Panel;
+import binnie.extratrees.core.ExtraTreeTexture;
+import binnie.extratrees.machines.Lumbermill;
+import net.minecraft.block.Block;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.item.ItemBlock;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.IIcon;
+import org.lwjgl.opengl.GL11;
+
+public class ControlLumbermillProgress
+ extends ControlProgressBase
+{
+ public void onUpdateClient()
+ {
+ super.onUpdateClient();
+ if (this.oldProgress != this.progress)
+ {
+ this.oldProgress = this.progress;
+ this.animation += 5.0F;
+ }
+ }
+
+ float oldProgress = 0.0F;
+ float animation = 0.0F;
+ static Texture Saw = new StandardTexture(0, 0, 6, 32, ExtraTreeTexture.Gui);
+ static Texture Saw2 = new StandardTexture(2, 0, 4, 32, ExtraTreeTexture.Gui);
+
+ public void onRenderForeground()
+ {
+ GL11.glDisable(2896);
+ int sawX = (int)(63.0F * this.progress);
+
+ CraftGUI.Render.texture(Saw, new IPoint(sawX, -8.0F + 6.0F * (float)Math.sin(this.animation)));
+
+ 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;
+ }
+ 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);
+ }
+ 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;
+ }
+ IIcon icon2 = block2.getIcon(2, result.getItemDamage());
+
+ IPoint size = getSize();
+ IPoint pos = 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 i = 0; i < 4; i++) {
+ CraftGUI.Render.iconBlock(new IPoint(1 + i * 16, 1.0F), icon2);
+ }
+ GL11.glDisable(3089);
+
+ CraftGUI.Render.texture(Saw2, new IPoint(sawX + 2, -8.0F + 6.0F * (float)Math.sin(this.animation)));
+ }
+
+ protected ControlLumbermillProgress(IWidget parent, float x, float y)
+ {
+ super(parent, x, y, 66.0F, 18.0F);
+ new Panel(this, 0.0F, 0.0F, 66.0F, 18.0F, MinecraftGUI.PanelType.Black);
+ }
+}
diff --git a/src/Java/binnie/craftgui/extratrees/dictionary/ControlRecipeSlot.java b/src/Java/binnie/craftgui/extratrees/dictionary/ControlRecipeSlot.java
new file mode 100644
index 0000000000..d65e825cb8
--- /dev/null
+++ b/src/Java/binnie/craftgui/extratrees/dictionary/ControlRecipeSlot.java
@@ -0,0 +1,42 @@
+package binnie.craftgui.extratrees.dictionary;
+
+import binnie.core.machines.Machine;
+import binnie.core.machines.TileEntityMachine;
+import binnie.core.machines.component.IComponentRecipe;
+import binnie.craftgui.core.IWidget;
+import binnie.craftgui.events.EventMouse.Down;
+import binnie.craftgui.events.EventMouse.Down.Handler;
+import binnie.craftgui.minecraft.Window;
+import binnie.craftgui.minecraft.control.ControlSlotBase;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+
+public class ControlRecipeSlot
+ extends ControlSlotBase
+{
+ public ControlRecipeSlot(IWidget parent, int x, int y)
+ {
+ super(parent, x, y, 50);
+
+ addSelfEventHandler(new EventMouse.Down.Handler()
+ {
+ public void onEvent(EventMouse.Down event)
+ {
+ TileEntity tile = (TileEntity)Window.get(ControlRecipeSlot.this.getWidget()).getInventory();
+ if ((tile == null) || (!(tile instanceof TileEntityMachine))) {
+ return;
+ }
+ NBTTagCompound nbt = new NBTTagCompound();
+ Window.get(ControlRecipeSlot.this.getWidget()).sendClientAction("recipe", nbt);
+ }
+ });
+ setRotating();
+ }
+
+ public ItemStack getItemStack()
+ {
+ IComponentRecipe recipe = (IComponentRecipe)Machine.getInterface(IComponentRecipe.class, Window.get(this).getInventory());
+ return recipe.isRecipe() ? recipe.getProduct() : null;
+ }
+}
diff --git a/src/Java/binnie/craftgui/extratrees/dictionary/ControlTileSelect.java b/src/Java/binnie/craftgui/extratrees/dictionary/ControlTileSelect.java
new file mode 100644
index 0000000000..cc5c79c529
--- /dev/null
+++ b/src/Java/binnie/craftgui/extratrees/dictionary/ControlTileSelect.java
@@ -0,0 +1,197 @@
+package binnie.craftgui.extratrees.dictionary;
+
+import binnie.Binnie;
+import binnie.core.BinnieCore;
+import binnie.core.language.ManagerLanguage;
+import binnie.core.machines.Machine;
+import binnie.core.machines.TileEntityMachine;
+import binnie.craftgui.controls.ControlText;
+import binnie.craftgui.controls.core.Control;
+import binnie.craftgui.controls.core.IControlValue;
+import binnie.craftgui.controls.scroll.IControlScrollable;
+import binnie.craftgui.core.Attribute;
+import binnie.craftgui.core.CraftGUI;
+import binnie.craftgui.core.ITooltip;
+import binnie.craftgui.core.IWidget;
+import binnie.craftgui.core.Tooltip;
+import binnie.craftgui.core.geometry.IArea;
+import binnie.craftgui.core.geometry.IPoint;
+import binnie.craftgui.core.renderer.Renderer;
+import binnie.craftgui.events.EventMouse.Down;
+import binnie.craftgui.events.EventMouse.Down.Handler;
+import binnie.craftgui.minecraft.Window;
+import binnie.craftgui.resource.minecraft.CraftGUITexture;
+import binnie.extratrees.api.CarpentryManager;
+import binnie.extratrees.api.ICarpentryInterface;
+import binnie.extratrees.api.IDesign;
+import binnie.extratrees.api.IDesignCategory;
+import binnie.extratrees.carpentry.EnumDesign;
+import binnie.extratrees.machines.Designer.ComponentWoodworkerRecipe;
+import binnie.extratrees.machines.DesignerType;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+
+public class ControlTileSelect
+ extends Control
+ implements IControlValue<IDesign>, IControlScrollable
+{
+ public static class ControlTile
+ extends Control
+ implements IControlValue<IDesign>, ITooltip
+ {
+ IDesign value;
+
+ protected ControlTile(IWidget parent, float x, float y, IDesign value)
+ {
+ super(x, y, 18.0F, 18.0F);
+ setValue(value);
+ addAttribute(Attribute.MouseOver);
+
+ addSelfEventHandler(new EventMouse.Down.Handler()
+ {
+ public void onEvent(EventMouse.Down event)
+ {
+ TileEntityMachine tile = (TileEntityMachine)Window.get(ControlTileSelect.ControlTile.this.getWidget()).getInventory();
+ if (tile == null) {
+ return;
+ }
+ Designer.ComponentWoodworkerRecipe recipe = (Designer.ComponentWoodworkerRecipe)tile.getMachine().getComponent(Designer.ComponentWoodworkerRecipe.class);
+
+ NBTTagCompound nbt = new NBTTagCompound();
+ nbt.setShort("d", (short)CarpentryManager.carpentryInterface.getDesignIndex(ControlTileSelect.ControlTile.this.getValue()));
+
+ Window.get(ControlTileSelect.ControlTile.this.getWidget()).sendClientAction("design", nbt);
+ }
+ });
+ }
+
+ public void getTooltip(Tooltip tooltip)
+ {
+ tooltip.add(Binnie.Language.localise(BinnieCore.instance, "gui.designer.pattern", new Object[] { getValue().getName() }));
+ }
+
+ public IDesign getValue()
+ {
+ return this.value;
+ }
+
+ public void onRenderBackground()
+ {
+ CraftGUI.Render.texture(CraftGUITexture.Slot, IPoint.ZERO);
+ }
+
+ public void onRenderForeground()
+ {
+ ItemStack image = ((WindowWoodworker)getSuperParent()).getDesignerType().getDisplayStack(getValue());
+ CraftGUI.Render.item(new IPoint(1.0F, 1.0F), image);
+ if (((IControlValue)getParent()).getValue() != getValue()) {
+ if (Window.get(this).getMousedOverWidget() == this) {
+ CraftGUI.Render.gradientRect(getArea().inset(1), 1157627903, 1157627903);
+ } else {
+ CraftGUI.Render.gradientRect(getArea().inset(1), -1433892728, -1433892728);
+ }
+ }
+ }
+
+ public void setValue(IDesign value)
+ {
+ this.value = value;
+ }
+ }
+
+ IDesign value = EnumDesign.Blank;
+ float shownHeight = 92.0F;
+
+ protected ControlTileSelect(IWidget parent, float x, float y)
+ {
+ super(parent, x, y, 102.0F, 20 * (CarpentryManager.carpentryInterface.getSortedDesigns().size() / 4) + 22);
+
+ refresh("");
+ }
+
+ public float getPercentageIndex()
+ {
+ return 0.0F;
+ }
+
+ public float getPercentageShown()
+ {
+ return 0.0F;
+ }
+
+ public IDesign getValue()
+ {
+ return this.value;
+ }
+
+ public void movePercentage(float percentage) {}
+
+ public void onUpdateClient()
+ {
+ super.onUpdateClient();
+ TileEntityMachine tile = (TileEntityMachine)Window.get(this).getInventory();
+ if (tile == null) {
+ return;
+ }
+ Designer.ComponentWoodworkerRecipe recipe = (Designer.ComponentWoodworkerRecipe)tile.getMachine().getComponent(Designer.ComponentWoodworkerRecipe.class);
+
+ setValue(recipe.getDesign());
+ }
+
+ public void refresh(String filterText)
+ {
+ deleteAllChildren();
+ int cx = 2;
+ int cy = 2;
+
+ Map<IDesignCategory, List<IDesign>> designs = new HashMap();
+ for (IDesignCategory category : CarpentryManager.carpentryInterface.getAllDesignCategories())
+ {
+ designs.put(category, new ArrayList());
+ for (IDesign tile : category.getDesigns()) {
+ if ((filterText == "") || (tile.getName().toLowerCase().contains(filterText))) {
+ ((List)designs.get(category)).add(tile);
+ }
+ }
+ if (((List)designs.get(category)).isEmpty()) {
+ designs.remove(category);
+ }
+ }
+ for (IDesignCategory category : designs.keySet())
+ {
+ cx = 2;
+ new ControlText(this, new IPoint(cx, cy + 3), category.getName());
+ cy += 16;
+ for (IDesign tile : (List)designs.get(category))
+ {
+ if (cx > 90)
+ {
+ cx = 2;
+ cy += 20;
+ }
+ new ControlTile(this, cx, cy, tile);
+ cx += 20;
+ }
+ cy += 20;
+ }
+ int height = cy;
+
+ setSize(new IPoint(getSize().x(), height));
+ }
+
+ public void setPercentageIndex(float index) {}
+
+ public void setValue(IDesign value)
+ {
+ this.value = value;
+ }
+
+ public float getMovementRange()
+ {
+ return 0.0F;
+ }
+}
diff --git a/src/Java/binnie/craftgui/extratrees/dictionary/DialogBreweryRecipe.java b/src/Java/binnie/craftgui/extratrees/dictionary/DialogBreweryRecipe.java
new file mode 100644
index 0000000000..f761aaea29
--- /dev/null
+++ b/src/Java/binnie/craftgui/extratrees/dictionary/DialogBreweryRecipe.java
@@ -0,0 +1,17 @@
+package binnie.craftgui.extratrees.dictionary;
+
+import binnie.craftgui.core.IWidget;
+import binnie.craftgui.minecraft.Dialog;
+
+public class DialogBreweryRecipe
+ extends Dialog
+{
+ public DialogBreweryRecipe(IWidget parent, float w, float h)
+ {
+ super(parent, w, h);
+ }
+
+ public void initialise() {}
+
+ public void onClose() {}
+}
diff --git a/src/Java/binnie/craftgui/extratrees/dictionary/PageFruit.java b/src/Java/binnie/craftgui/extratrees/dictionary/PageFruit.java
new file mode 100644
index 0000000000..c6983deef9
--- /dev/null
+++ b/src/Java/binnie/craftgui/extratrees/dictionary/PageFruit.java
@@ -0,0 +1,47 @@
+package binnie.craftgui.extratrees.dictionary;
+
+import binnie.core.genetics.TreeBreedingSystem;
+import binnie.craftgui.controls.ControlText;
+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.mod.database.ControlSpeciesBox;
+import binnie.craftgui.mod.database.DatabaseTab;
+import binnie.craftgui.mod.database.PageAbstract;
+import binnie.craftgui.mod.database.WindowAbstractDatabase;
+import binnie.extratrees.ExtraTrees;
+import binnie.extratrees.proxy.Proxy;
+import forestry.api.genetics.IAlleleSpecies;
+import java.util.Collection;
+import net.minecraft.item.ItemStack;
+
+public class PageFruit
+ extends PageAbstract<ItemStack>
+{
+ boolean treesThatBearFruit;
+
+ public PageFruit(IWidget parent, DatabaseTab tab, boolean treesThatBearFruit)
+ {
+ super(parent, tab);
+ this.treesThatBearFruit = treesThatBearFruit;
+ }
+
+ public void onValueChanged(ItemStack species)
+ {
+ deleteAllChildren();
+ WindowAbstractDatabase database = (WindowAbstractDatabase)WindowAbstractDatabase.get(this);
+ new ControlText(this, new IArea(0.0F, 0.0F, size().x(), 24.0F), ExtraTrees.proxy.localise("gui.database.tab.fruit." + (this.treesThatBearFruit ? "natural" : "potential")), TextJustification.MiddleCenter);
+
+
+ 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, size().x() - 8.0F, size().y() - 4.0F - 24.0F).setOptions(trees);
+ }
+}
diff --git a/src/Java/binnie/craftgui/extratrees/dictionary/PagePlanksOverview.java b/src/Java/binnie/craftgui/extratrees/dictionary/PagePlanksOverview.java
new file mode 100644
index 0000000000..f27fa6967b
--- /dev/null
+++ b/src/Java/binnie/craftgui/extratrees/dictionary/PagePlanksOverview.java
@@ -0,0 +1,103 @@
+package binnie.craftgui.extratrees.dictionary;
+
+import binnie.core.BinnieCore;
+import binnie.core.proxy.BinnieProxy;
+import binnie.craftgui.controls.ControlText;
+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.minecraft.control.ControlItemDisplay;
+import binnie.craftgui.mod.database.DatabaseTab;
+import binnie.craftgui.mod.database.PageAbstract;
+import binnie.craftgui.mod.database.WindowAbstractDatabase;
+import binnie.extratrees.ExtraTrees;
+import binnie.extratrees.block.DoorType;
+import binnie.extratrees.block.IPlankType;
+import binnie.extratrees.block.WoodManager;
+import binnie.extratrees.block.decor.FenceType;
+import binnie.extratrees.proxy.Proxy;
+import net.minecraft.item.ItemStack;
+
+public class PagePlanksOverview
+ extends PageAbstract<ItemStack>
+{
+ public PagePlanksOverview(IWidget parent, DatabaseTab tab)
+ {
+ super(parent, tab);
+ }
+
+ public void onValueChanged(ItemStack species)
+ {
+ deleteAllChildren();
+ WindowAbstractDatabase database = (WindowAbstractDatabase)WindowAbstractDatabase.get(this);
+ new ControlText(this, new IArea(0.0F, 0.0F, size().x(), 24.0F), species.getDisplayName(), TextJustification.MiddleCenter);
+
+
+
+ new ControlText(this, new IArea(12.0F, 24.0F, size().x() - 24.0F, 24.0F), ExtraTrees.proxy.localise("gui.database.planks.use"), TextJustification.MiddleLeft);
+
+
+ IPlankType type = WoodManager.get(species);
+
+ int x = 12;
+ if (type != null)
+ {
+ ItemStack fence = WoodManager.getFence(type, new FenceType(0), 1);
+ ItemStack gate = WoodManager.getGate(type);
+ 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;
+ }
+ }
+ ControlText controlDescription = new ControlText(this, new IArea(8.0F, 84.0F, getSize().x() - 16.0F, 0.0F), "", TextJustification.MiddleCenter);
+
+
+ ControlText controlSignature = new ControlText(this, new IArea(8.0F, 84.0F, 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 = descBody + BinnieCore.proxy.localise("gui.database.nodescription");
+ }
+ else
+ {
+ String[] descStrings = desc.split("\\|");
+ descBody = descBody + descStrings[0];
+ for (int i = 1; i < descStrings.length - 1; i++) {
+ descBody = descBody + " " + descStrings[i];
+ }
+ if (descStrings.length > 1) {
+ descSig = descSig + descStrings[(descStrings.length - 1)];
+ }
+ }
+ controlDescription.setValue(descBody + "§r");
+ controlSignature.setValue(descSig + "§r");
+
+ float descHeight = CraftGUI.Render.textHeight(controlDescription.getValue(), controlDescription.getSize().x());
+
+
+ controlSignature.setPosition(new IPoint(controlSignature.pos().x(), controlDescription.getPosition().y() + descHeight + 10.0F));
+ }
+}
diff --git a/src/Java/binnie/craftgui/extratrees/dictionary/PagePlanksTrees.java b/src/Java/binnie/craftgui/extratrees/dictionary/PagePlanksTrees.java
new file mode 100644
index 0000000000..8702edbe95
--- /dev/null
+++ b/src/Java/binnie/craftgui/extratrees/dictionary/PagePlanksTrees.java
@@ -0,0 +1,40 @@
+package binnie.craftgui.extratrees.dictionary;
+
+import binnie.core.genetics.TreeBreedingSystem;
+import binnie.craftgui.controls.ControlText;
+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.mod.database.ControlSpeciesBox;
+import binnie.craftgui.mod.database.DatabaseTab;
+import binnie.craftgui.mod.database.PageAbstract;
+import binnie.craftgui.mod.database.WindowAbstractDatabase;
+import forestry.api.genetics.IAlleleSpecies;
+import java.util.Collection;
+import net.minecraft.item.ItemStack;
+
+public class PagePlanksTrees
+ extends PageAbstract<ItemStack>
+{
+ public PagePlanksTrees(IWidget parent, DatabaseTab tab)
+ {
+ super(parent, tab);
+ }
+
+ public void onValueChanged(ItemStack species)
+ {
+ deleteAllChildren();
+ WindowAbstractDatabase database = (WindowAbstractDatabase)WindowAbstractDatabase.get(this);
+ new ControlText(this, new IArea(0.0F, 0.0F, size().x(), 24.0F), species.getDisplayName(), TextJustification.MiddleCenter);
+
+
+
+ Collection<IAlleleSpecies> trees = ((TreeBreedingSystem)database.getBreedingSystem()).getTreesThatMakePlanks(species, database.isNEI(), database.getWorld(), database.getUsername());
+
+
+
+
+ new ControlSpeciesBox(this, 4.0F, 24.0F, size().x() - 8.0F, size().y() - 4.0F - 24.0F).setOptions(trees);
+ }
+}
diff --git a/src/Java/binnie/craftgui/extratrees/dictionary/PageSpeciesImage.java b/src/Java/binnie/craftgui/extratrees/dictionary/PageSpeciesImage.java
new file mode 100644
index 0000000000..d6fd929447
--- /dev/null
+++ b/src/Java/binnie/craftgui/extratrees/dictionary/PageSpeciesImage.java
@@ -0,0 +1,31 @@
+package binnie.craftgui.extratrees.dictionary;
+
+import binnie.craftgui.controls.ControlTextCentered;
+import binnie.craftgui.core.IWidget;
+import binnie.craftgui.minecraft.MinecraftGUI.PanelType;
+import binnie.craftgui.mod.database.ControlDatabaseIndividualDisplay;
+import binnie.craftgui.mod.database.DatabaseTab;
+import binnie.craftgui.mod.database.EnumDiscoveryState;
+import binnie.craftgui.mod.database.PageSpecies;
+import binnie.craftgui.window.Panel;
+import forestry.api.genetics.IAlleleSpecies;
+
+public class PageSpeciesImage
+ extends PageSpecies
+{
+ ControlDatabaseIndividualDisplay display;
+
+ public PageSpeciesImage(IWidget parent, 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, ((DatabaseTab)getValue()).toString());
+ }
+
+ public void onValueChanged(IAlleleSpecies species)
+ {
+ this.display.setSpecies(species, EnumDiscoveryState.Show);
+ }
+}
diff --git a/src/Java/binnie/craftgui/extratrees/dictionary/PageSpeciesTreeGenome.java b/src/Java/binnie/craftgui/extratrees/dictionary/PageSpeciesTreeGenome.java
new file mode 100644
index 0000000000..22a1a67b29
--- /dev/null
+++ b/src/Java/binnie/craftgui/extratrees/dictionary/PageSpeciesTreeGenome.java
@@ -0,0 +1,175 @@
+package binnie.craftgui.extratrees.dictionary;
+
+import binnie.Binnie;
+import binnie.core.BinnieCore;
+import binnie.core.genetics.BreedingSystem;
+import binnie.core.genetics.ManagerGenetics;
+import binnie.core.proxy.BinnieProxy;
+import binnie.craftgui.controls.ControlText;
+import binnie.craftgui.controls.core.Control;
+import binnie.craftgui.controls.scroll.ControlScrollableContent;
+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.minecraft.control.ControlItemDisplay;
+import binnie.craftgui.mod.database.DatabaseTab;
+import binnie.craftgui.mod.database.PageSpecies;
+import binnie.extratrees.ExtraTrees;
+import binnie.extratrees.proxy.Proxy;
+import forestry.api.arboriculture.EnumTreeChromosome;
+import forestry.api.arboriculture.IAlleleTreeSpecies;
+import forestry.api.arboriculture.IFruitProvider;
+import forestry.api.arboriculture.IGrowthProvider;
+import forestry.api.arboriculture.ITree;
+import forestry.api.arboriculture.ITreeGenome;
+import forestry.api.arboriculture.ITreeRoot;
+import forestry.api.core.EnumTemperature;
+import forestry.api.core.ForestryAPI;
+import forestry.api.core.ITextureManager;
+import forestry.api.genetics.IAllele;
+import forestry.api.genetics.IAlleleSpecies;
+import java.util.ArrayList;
+import java.util.List;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.IIcon;
+import net.minecraftforge.common.EnumPlantType;
+
+public class PageSpeciesTreeGenome
+ extends PageSpecies
+{
+ public PageSpeciesTreeGenome(IWidget parent, DatabaseTab tab)
+ {
+ super(parent, tab);
+ }
+
+ public void onValueChanged(IAlleleSpecies species)
+ {
+ deleteAllChildren();
+ IAllele[] template = Binnie.Genetics.getTreeRoot().getTemplate(species.getUID());
+ if (template == null) {
+ return;
+ }
+ ITree tree = Binnie.Genetics.getTreeRoot().templateAsIndividual(template);
+ if (tree == null) {
+ return;
+ }
+ ITreeGenome genome = tree.getGenome();
+ IAlleleTreeSpecies treeSpecies = genome.getPrimary();
+
+ int w = 144;
+ int h = 176;
+
+ new ControlText(this, new IArea(0.0F, 4.0F, w, 16.0F), ((DatabaseTab)getValue()).toString(), TextJustification.MiddleCenter);
+
+ ControlScrollableContent scrollable = new ControlScrollableContent(this, 4.0F, 20.0F, w - 8, h - 8 - 16, 12.0F);
+
+ Control contents = new Control(scrollable, 0.0F, 0.0F, w - 8 - 12, h - 8 - 16);
+
+ int tw = w - 8 - 12;
+ int w1 = 65;
+ int w2 = tw - 50;
+ int y = 0;
+ int th = 14;
+ int th2 = 18;
+
+ BreedingSystem syst = Binnie.Genetics.treeBreedingSystem;
+
+ new ControlText(contents, new IArea(0.0F, y, w1, th), syst.getChromosomeShortName(EnumTreeChromosome.PLANT) + " : ", TextJustification.MiddleRight);
+ new ControlText(contents, new IArea(w1, y, w2, th), treeSpecies.getPlantType().toString(), TextJustification.MiddleLeft);
+
+ y += th;
+
+ new ControlText(contents, new IArea(0.0F, y, w1, th), BinnieCore.proxy.localise("gui.temperature.short") + " : ", TextJustification.MiddleRight);
+ new ControlText(contents, new IArea(w1, y, w2, th), treeSpecies.getTemperature().getName(), TextJustification.MiddleLeft);
+
+ y += th;
+
+ IIcon leaf = ForestryAPI.textureManager.getIcon(treeSpecies.getLeafIconIndex(tree, false));
+
+ IIcon fruit = null;
+ int fruitColour = 16777215;
+ try
+ {
+ fruit = ForestryAPI.textureManager.getIcon(genome.getFruitProvider().getIconIndex(genome, null, 0, 0, 0, 100, false));
+ fruitColour = genome.getFruitProvider().getColour(genome, null, 0, 0, 0, 100);
+ }
+ catch (Exception e) {}
+ if (leaf != null)
+ {
+ new ControlText(contents, new IArea(0.0F, y, w1, th2), ExtraTrees.proxy.localise("gui.database.leaves") + " : ", TextJustification.MiddleRight);
+
+ new ControlBlockIconDisplay(contents, w1, y, leaf).setColour(treeSpecies.getLeafColour(tree));
+ if ((fruit != null) && (!treeSpecies.getUID().equals("forestry.treeOak"))) {
+ new ControlBlockIconDisplay(contents, w1, y, fruit).setColour(fruitColour);
+ }
+ y += th2;
+ }
+ ItemStack log = treeSpecies.getLogStacks().length > 0 ? treeSpecies.getLogStacks()[0] : null;
+ if (log != null)
+ {
+ new ControlText(contents, new IArea(0.0F, y, w1, th2), ExtraTrees.proxy.localise("gui.database.log") + " : ", TextJustification.MiddleRight);
+
+ ControlItemDisplay display = new ControlItemDisplay(contents, w1, y);
+ display.setItemStack(log);
+ display.setTooltip();
+
+ y += th2;
+ }
+ new ControlText(contents, new IArea(0.0F, y, w1, th), syst.getChromosomeShortName(EnumTreeChromosome.GROWTH) + " : ", TextJustification.MiddleRight);
+ new ControlText(contents, new IArea(w1, y, w2, th), genome.getGrowthProvider().getDescription(), TextJustification.MiddleLeft);
+ y += th;
+
+ new ControlText(contents, new IArea(0.0F, y, w1, th), syst.getChromosomeShortName(EnumTreeChromosome.HEIGHT) + " : ", TextJustification.MiddleRight);
+ new ControlText(contents, new IArea(w1, y, w2, th), genome.getHeight() + "x", TextJustification.MiddleLeft);
+ y += th;
+
+ new ControlText(contents, new IArea(0.0F, y, w1, th), syst.getChromosomeShortName(EnumTreeChromosome.FERTILITY) + " : ", TextJustification.MiddleRight);
+ new ControlText(contents, new IArea(w1, y, w2, th), genome.getFertility() + "x", TextJustification.MiddleLeft);
+ y += th;
+
+ List<ItemStack> fruits = new ArrayList();
+ for (ItemStack stack : genome.getFruitProvider().getProducts()) {
+ fruits.add(stack);
+ }
+ if (!fruits.isEmpty())
+ {
+ new ControlText(contents, new IArea(0.0F, y, w1, th2), syst.getChromosomeShortName(EnumTreeChromosome.FRUITS) + " : ", TextJustification.MiddleRight);
+ for (ItemStack fruitw : fruits)
+ {
+ ControlItemDisplay display = new ControlItemDisplay(contents, w1, y);
+ display.setItemStack(fruitw);
+ display.setTooltip();
+
+ y += th2;
+ }
+ }
+ new ControlText(contents, new IArea(0.0F, y, w1, th), syst.getChromosomeShortName(EnumTreeChromosome.YIELD) + " : ", TextJustification.MiddleRight);
+ new ControlText(contents, new IArea(w1, y, w2, th), genome.getYield() + "x", TextJustification.MiddleLeft);
+ y += th;
+
+ new ControlText(contents, new IArea(0.0F, y, w1, th), syst.getChromosomeShortName(EnumTreeChromosome.SAPPINESS) + " : ", TextJustification.MiddleRight);
+ new ControlText(contents, new IArea(w1, y, w2, th), genome.getSappiness() + "x", TextJustification.MiddleLeft);
+ y += th;
+
+ new ControlText(contents, new IArea(0.0F, y, w1, th), syst.getChromosomeShortName(EnumTreeChromosome.MATURATION) + " : ", TextJustification.MiddleRight);
+ new ControlText(contents, new IArea(w1, y, w2, th), genome.getMaturationTime() + "x", TextJustification.MiddleLeft);
+ y += th;
+
+ new ControlText(contents, new IArea(0.0F, y, w1, th), syst.getChromosomeShortName(EnumTreeChromosome.GIRTH) + " : ", TextJustification.MiddleRight);
+ new ControlText(contents, new IArea(w1, y, w2, 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(boolean t)
+ {
+ if (t) {
+ return BinnieCore.proxy.localise("gui.tolerated");
+ }
+ return BinnieCore.proxy.localise("gui.nottolerated");
+ }
+}
diff --git a/src/Java/binnie/craftgui/extratrees/dictionary/PageWood.java b/src/Java/binnie/craftgui/extratrees/dictionary/PageWood.java
new file mode 100644
index 0000000000..e7e80a1456
--- /dev/null
+++ b/src/Java/binnie/craftgui/extratrees/dictionary/PageWood.java
@@ -0,0 +1,40 @@
+package binnie.craftgui.extratrees.dictionary;
+
+import binnie.core.genetics.TreeBreedingSystem;
+import binnie.craftgui.controls.ControlText;
+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.mod.database.ControlSpeciesBox;
+import binnie.craftgui.mod.database.DatabaseTab;
+import binnie.craftgui.mod.database.PageAbstract;
+import binnie.craftgui.mod.database.WindowAbstractDatabase;
+import forestry.api.genetics.IAlleleSpecies;
+import java.util.Collection;
+import net.minecraft.item.ItemStack;
+
+public class PageWood
+ extends PageAbstract<ItemStack>
+{
+ public PageWood(IWidget parent, DatabaseTab tab)
+ {
+ super(parent, tab);
+ }
+
+ public void onValueChanged(ItemStack species)
+ {
+ deleteAllChildren();
+ WindowAbstractDatabase database = (WindowAbstractDatabase)WindowAbstractDatabase.get(this);
+ new ControlText(this, new IArea(0.0F, 0.0F, size().x(), 24.0F), ((DatabaseTab)getValue()).toString(), TextJustification.MiddleCenter);
+
+
+
+ Collection<IAlleleSpecies> trees = ((TreeBreedingSystem)database.getBreedingSystem()).getTreesThatHaveWood(species, database.isNEI(), database.getWorld(), database.getUsername());
+
+
+
+
+ new ControlSpeciesBox(this, 4.0F, 24.0F, size().x() - 8.0F, size().y() - 4.0F - 24.0F).setOptions(trees);
+ }
+}
diff --git a/src/Java/binnie/craftgui/extratrees/dictionary/WindowArboristDatabase.java b/src/Java/binnie/craftgui/extratrees/dictionary/WindowArboristDatabase.java
new file mode 100644
index 0000000000..e8096c6d77
--- /dev/null
+++ b/src/Java/binnie/craftgui/extratrees/dictionary/WindowArboristDatabase.java
@@ -0,0 +1,133 @@
+package binnie.craftgui.extratrees.dictionary;
+
+import binnie.Binnie;
+import binnie.core.AbstractMod;
+import binnie.core.genetics.ManagerGenetics;
+import binnie.core.genetics.TreeBreedingSystem;
+import binnie.craftgui.controls.listbox.ControlList;
+import binnie.craftgui.controls.listbox.ControlListBox;
+import binnie.craftgui.core.IWidget;
+import binnie.craftgui.core.geometry.IArea;
+import binnie.craftgui.minecraft.Window;
+import binnie.craftgui.mod.database.ControlItemStackOption;
+import binnie.craftgui.mod.database.DatabaseTab;
+import binnie.craftgui.mod.database.IDatabaseMode;
+import binnie.craftgui.mod.database.PageBranchOverview;
+import binnie.craftgui.mod.database.PageBranchSpecies;
+import binnie.craftgui.mod.database.PageBreeder;
+import binnie.craftgui.mod.database.PageSpeciesClassification;
+import binnie.craftgui.mod.database.PageSpeciesMutations;
+import binnie.craftgui.mod.database.PageSpeciesOverview;
+import binnie.craftgui.mod.database.PageSpeciesResultant;
+import binnie.craftgui.mod.database.WindowAbstractDatabase;
+import binnie.craftgui.mod.database.WindowAbstractDatabase.Mode;
+import binnie.craftgui.mod.database.WindowAbstractDatabase.ModeWidgets;
+import binnie.extratrees.ExtraTrees;
+import binnie.extratrees.proxy.Proxy;
+import cpw.mods.fml.relauncher.Side;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+
+public class WindowArboristDatabase
+ extends WindowAbstractDatabase
+{
+ ControlListBox<ItemStack> selectionBoxFruit;
+ ControlListBox<ItemStack> selectionBoxWood;
+ ControlListBox<ItemStack> selectionBoxPlanks;
+
+ static enum TreeMode
+ implements IDatabaseMode
+ {
+ Fruit, Wood, Planks;
+
+ private TreeMode() {}
+
+ public String getName()
+ {
+ return ExtraTrees.proxy.localise("gui.database.mode." + name().toLowerCase());
+ }
+ }
+
+ public WindowArboristDatabase(EntityPlayer player, Side side, boolean nei)
+ {
+ super(player, side, nei, Binnie.Genetics.treeBreedingSystem, 120.0F);
+ }
+
+ public static Window create(EntityPlayer player, Side side, boolean nei)
+ {
+ return new WindowArboristDatabase(player, side, nei);
+ }
+
+ protected void addTabs()
+ {
+ new PageSpeciesOverview(getInfoPages(WindowAbstractDatabase.Mode.Species), new DatabaseTab(ExtraTrees.instance, "species.overview", 0));
+ new PageSpeciesTreeGenome(getInfoPages(WindowAbstractDatabase.Mode.Species), new DatabaseTab(ExtraTrees.instance, "species.genome", 0));
+ new PageSpeciesClassification(getInfoPages(WindowAbstractDatabase.Mode.Species), new DatabaseTab(ExtraTrees.instance, "species.classification", 0));
+ new PageSpeciesResultant(getInfoPages(WindowAbstractDatabase.Mode.Species), new DatabaseTab(ExtraTrees.instance, "species.resultant", 0));
+ new PageSpeciesMutations(getInfoPages(WindowAbstractDatabase.Mode.Species), new DatabaseTab(ExtraTrees.instance, "species.further", 0));
+
+ new PageBranchOverview(getInfoPages(WindowAbstractDatabase.Mode.Branches), new DatabaseTab(ExtraTrees.instance, "branches.overview", 0));
+ new PageBranchSpecies(getInfoPages(WindowAbstractDatabase.Mode.Branches), new DatabaseTab(ExtraTrees.instance, "branches.species", 0));
+
+ new PageBreeder(getInfoPages(WindowAbstractDatabase.Mode.Breeder), getUsername(), new DatabaseTab(ExtraTrees.instance, "breeder", 0));
+
+ createMode(TreeMode.Fruit, new WindowAbstractDatabase.ModeWidgets(TreeMode.Fruit, this)
+ {
+ public void createListBox(IArea area)
+ {
+ this.listBox = new ControlListBox(this.modePage, area.x(), area.y(), area.w(), area.h(), 12.0F)
+ {
+ public IWidget createOption(ItemStack value, int y)
+ {
+ return new ControlItemStackOption((ControlList)getContent(), value, y);
+ }
+ };
+ this.listBox.setOptions(((TreeBreedingSystem)WindowArboristDatabase.this.getBreedingSystem()).allFruits);
+ }
+ });
+ createMode(TreeMode.Wood, new WindowAbstractDatabase.ModeWidgets(TreeMode.Wood, this)
+ {
+ public void createListBox(IArea area)
+ {
+ this.listBox = new ControlListBox(this.modePage, area.x(), area.y(), area.w(), area.h(), 12.0F)
+ {
+ public IWidget createOption(ItemStack value, int y)
+ {
+ return new ControlItemStackOption((ControlList)getContent(), value, y);
+ }
+ };
+ this.listBox.setOptions(((TreeBreedingSystem)WindowArboristDatabase.this.getBreedingSystem()).allWoods);
+ }
+ });
+ createMode(TreeMode.Planks, new WindowAbstractDatabase.ModeWidgets(TreeMode.Planks, this)
+ {
+ public void createListBox(IArea area)
+ {
+ this.listBox = new ControlListBox(this.modePage, area.x(), area.y(), area.w(), area.h(), 12.0F)
+ {
+ public IWidget createOption(ItemStack value, int y)
+ {
+ return new ControlItemStackOption((ControlList)getContent(), value, y);
+ }
+ };
+ }
+ });
+ new PageFruit(getInfoPages(TreeMode.Fruit), new DatabaseTab(ExtraTrees.instance, "fruit.natural", 0), true);
+ new PageFruit(getInfoPages(TreeMode.Fruit), new DatabaseTab(ExtraTrees.instance, "fruit.potential", 0), false);
+
+ new PageWood(getInfoPages(TreeMode.Wood), new DatabaseTab(ExtraTrees.instance, "wood.natural", 0));
+
+ new PagePlanksOverview(getInfoPages(TreeMode.Planks), new DatabaseTab(ExtraTrees.instance, "planks.overview", 0));
+ new PagePlanksTrees(getInfoPages(TreeMode.Planks), new DatabaseTab(ExtraTrees.instance, "planks.natural", 1));
+ }
+
+ protected AbstractMod getMod()
+ {
+ return ExtraTrees.instance;
+ }
+
+ protected String getName()
+ {
+ return "TreeDatabase";
+ }
+}
diff --git a/src/Java/binnie/craftgui/extratrees/dictionary/WindowBrewery.java b/src/Java/binnie/craftgui/extratrees/dictionary/WindowBrewery.java
new file mode 100644
index 0000000000..89e4118880
--- /dev/null
+++ b/src/Java/binnie/craftgui/extratrees/dictionary/WindowBrewery.java
@@ -0,0 +1,61 @@
+package binnie.craftgui.extratrees.dictionary;
+
+import binnie.core.AbstractMod;
+import binnie.core.machines.IMachine;
+import binnie.core.machines.Machine;
+import binnie.core.machines.MachinePackage;
+import binnie.craftgui.core.geometry.IPoint;
+import binnie.craftgui.core.geometry.Position;
+import binnie.craftgui.minecraft.Window;
+import binnie.craftgui.minecraft.control.ControlEnergyBar;
+import binnie.craftgui.minecraft.control.ControlErrorState;
+import binnie.craftgui.minecraft.control.ControlLiquidTank;
+import binnie.craftgui.minecraft.control.ControlPlayerInventory;
+import binnie.craftgui.minecraft.control.ControlSlot;
+import binnie.craftgui.minecraft.control.ControlSlotArray;
+import binnie.extratrees.ExtraTrees;
+import binnie.extratrees.machines.Brewery;
+import cpw.mods.fml.relauncher.Side;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.IInventory;
+
+public class WindowBrewery
+ extends Window
+{
+ public WindowBrewery(EntityPlayer player, IInventory inventory, Side side)
+ {
+ super(228.0F, 218.0F, player, inventory, side);
+ }
+
+ protected AbstractMod getMod()
+ {
+ return ExtraTrees.instance;
+ }
+
+ protected String getName()
+ {
+ return "Brewery";
+ }
+
+ public void initialiseClient()
+ {
+ setTitle(Machine.getMachine(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)(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(EntityPlayer player, IInventory inventory, Side side)
+ {
+ return new WindowBrewery(player, inventory, side);
+ }
+}
diff --git a/src/Java/binnie/craftgui/extratrees/dictionary/WindowDistillery.java b/src/Java/binnie/craftgui/extratrees/dictionary/WindowDistillery.java
new file mode 100644
index 0000000000..2d002c2755
--- /dev/null
+++ b/src/Java/binnie/craftgui/extratrees/dictionary/WindowDistillery.java
@@ -0,0 +1,59 @@
+package binnie.craftgui.extratrees.dictionary;
+
+import binnie.core.AbstractMod;
+import binnie.core.machines.IMachine;
+import binnie.core.machines.Machine;
+import binnie.core.machines.MachinePackage;
+import binnie.craftgui.core.geometry.Position;
+import binnie.craftgui.minecraft.Window;
+import binnie.craftgui.minecraft.control.ControlEnergyBar;
+import binnie.craftgui.minecraft.control.ControlErrorState;
+import binnie.craftgui.minecraft.control.ControlLiquidTank;
+import binnie.craftgui.minecraft.control.ControlPlayerInventory;
+import binnie.extratrees.ExtraTrees;
+import binnie.extratrees.machines.Distillery;
+import cpw.mods.fml.relauncher.Side;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.IInventory;
+
+public class WindowDistillery
+ extends Window
+{
+ public WindowDistillery(EntityPlayer player, IInventory inventory, Side side)
+ {
+ super(224.0F, 192.0F, player, inventory, side);
+ }
+
+ protected AbstractMod getMod()
+ {
+ return ExtraTrees.instance;
+ }
+
+ protected String getName()
+ {
+ return "Distillery";
+ }
+
+ public void initialiseClient()
+ {
+ setTitle(Machine.getMachine(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(EntityPlayer player, IInventory inventory, Side side)
+ {
+ return new WindowDistillery(player, inventory, side);
+ }
+}
diff --git a/src/Java/binnie/craftgui/extratrees/dictionary/WindowLepidopteristDatabase.java b/src/Java/binnie/craftgui/extratrees/dictionary/WindowLepidopteristDatabase.java
new file mode 100644
index 0000000000..5d5b6511ef
--- /dev/null
+++ b/src/Java/binnie/craftgui/extratrees/dictionary/WindowLepidopteristDatabase.java
@@ -0,0 +1,57 @@
+package binnie.craftgui.extratrees.dictionary;
+
+import binnie.Binnie;
+import binnie.core.AbstractMod;
+import binnie.core.genetics.ManagerGenetics;
+import binnie.craftgui.minecraft.Window;
+import binnie.craftgui.mod.database.DatabaseTab;
+import binnie.craftgui.mod.database.PageBranchOverview;
+import binnie.craftgui.mod.database.PageBranchSpecies;
+import binnie.craftgui.mod.database.PageBreeder;
+import binnie.craftgui.mod.database.PageSpeciesClassification;
+import binnie.craftgui.mod.database.PageSpeciesMutations;
+import binnie.craftgui.mod.database.PageSpeciesOverview;
+import binnie.craftgui.mod.database.PageSpeciesResultant;
+import binnie.craftgui.mod.database.WindowAbstractDatabase;
+import binnie.craftgui.mod.database.WindowAbstractDatabase.Mode;
+import binnie.extratrees.ExtraTrees;
+import cpw.mods.fml.relauncher.Side;
+import net.minecraft.entity.player.EntityPlayer;
+
+public class WindowLepidopteristDatabase
+ extends WindowAbstractDatabase
+{
+ public WindowLepidopteristDatabase(EntityPlayer player, Side side, boolean nei)
+ {
+ super(player, side, nei, Binnie.Genetics.mothBreedingSystem, 160.0F);
+ }
+
+ public static Window create(EntityPlayer player, Side side, boolean nei)
+ {
+ return new WindowLepidopteristDatabase(player, side, nei);
+ }
+
+ protected void addTabs()
+ {
+ new PageSpeciesOverview(getInfoPages(WindowAbstractDatabase.Mode.Species), new DatabaseTab(ExtraTrees.instance, "butterfly.species.overview", 0));
+ new PageSpeciesClassification(getInfoPages(WindowAbstractDatabase.Mode.Species), new DatabaseTab(ExtraTrees.instance, "butterfly.species.classification", 0));
+ new PageSpeciesImage(getInfoPages(WindowAbstractDatabase.Mode.Species), new DatabaseTab(ExtraTrees.instance, "butterfly.species.specimen", 0));
+ new PageSpeciesResultant(getInfoPages(WindowAbstractDatabase.Mode.Species), new DatabaseTab(ExtraTrees.instance, "butterfly.species.resultant", 0));
+ new PageSpeciesMutations(getInfoPages(WindowAbstractDatabase.Mode.Species), new DatabaseTab(ExtraTrees.instance, "butterfly.species.further", 0));
+
+ new PageBranchOverview(getInfoPages(WindowAbstractDatabase.Mode.Branches), new DatabaseTab(ExtraTrees.instance, "butterfly.branches.overview", 0));
+ new PageBranchSpecies(getInfoPages(WindowAbstractDatabase.Mode.Branches), new DatabaseTab(ExtraTrees.instance, "butterfly.branches.species", 0));
+
+ new PageBreeder(getInfoPages(WindowAbstractDatabase.Mode.Breeder), getUsername(), new DatabaseTab(ExtraTrees.instance, "butterfly.breeder", 0));
+ }
+
+ protected AbstractMod getMod()
+ {
+ return ExtraTrees.instance;
+ }
+
+ protected String getName()
+ {
+ return "MothDatabase";
+ }
+}
diff --git a/src/Java/binnie/craftgui/extratrees/dictionary/WindowLumbermill.java b/src/Java/binnie/craftgui/extratrees/dictionary/WindowLumbermill.java
new file mode 100644
index 0000000000..dc9bca1253
--- /dev/null
+++ b/src/Java/binnie/craftgui/extratrees/dictionary/WindowLumbermill.java
@@ -0,0 +1,56 @@
+package binnie.craftgui.extratrees.dictionary;
+
+import binnie.core.AbstractMod;
+import binnie.core.machines.IMachine;
+import binnie.core.machines.Machine;
+import binnie.core.machines.MachinePackage;
+import binnie.craftgui.core.geometry.Position;
+import binnie.craftgui.minecraft.Window;
+import binnie.craftgui.minecraft.control.ControlEnergyBar;
+import binnie.craftgui.minecraft.control.ControlErrorState;
+import binnie.craftgui.minecraft.control.ControlLiquidTank;
+import binnie.craftgui.minecraft.control.ControlPlayerInventory;
+import binnie.craftgui.minecraft.control.ControlSlot;
+import binnie.extratrees.ExtraTrees;
+import binnie.extratrees.machines.Lumbermill;
+import cpw.mods.fml.relauncher.Side;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.IInventory;
+
+public class WindowLumbermill
+ extends Window
+{
+ public WindowLumbermill(EntityPlayer player, IInventory inventory, Side side)
+ {
+ super(220.0F, 192.0F, player, inventory, side);
+ }
+
+ protected AbstractMod getMod()
+ {
+ return ExtraTrees.instance;
+ }
+
+ protected String getName()
+ {
+ return "Lumbermill";
+ }
+
+ public void initialiseClient()
+ {
+ setTitle(Machine.getMachine(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(EntityPlayer player, IInventory inventory, Side side)
+ {
+ return new WindowLumbermill(player, inventory, side);
+ }
+}
diff --git a/src/Java/binnie/craftgui/extratrees/dictionary/WindowPress.java b/src/Java/binnie/craftgui/extratrees/dictionary/WindowPress.java
new file mode 100644
index 0000000000..773bc70323
--- /dev/null
+++ b/src/Java/binnie/craftgui/extratrees/dictionary/WindowPress.java
@@ -0,0 +1,77 @@
+package binnie.craftgui.extratrees.dictionary;
+
+import binnie.core.AbstractMod;
+import binnie.core.machines.IMachine;
+import binnie.core.machines.Machine;
+import binnie.core.machines.MachinePackage;
+import binnie.core.machines.power.ErrorState.InsufficientPower;
+import binnie.craftgui.core.geometry.Position;
+import binnie.craftgui.minecraft.ContainerCraftGUI;
+import binnie.craftgui.minecraft.InventoryType;
+import binnie.craftgui.minecraft.Window;
+import binnie.craftgui.minecraft.control.ControlEnergyBar;
+import binnie.craftgui.minecraft.control.ControlErrorState;
+import binnie.craftgui.minecraft.control.ControlLiquidTank;
+import binnie.craftgui.minecraft.control.ControlPlayerInventory;
+import binnie.craftgui.minecraft.control.ControlSlot;
+import binnie.extratrees.ExtraTrees;
+import binnie.extratrees.machines.Press;
+import binnie.extratrees.machines.Press.ComponentFruitPressLogic;
+import cpw.mods.fml.relauncher.Side;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.nbt.NBTTagCompound;
+
+public class WindowPress
+ extends Window
+{
+ public WindowPress(EntityPlayer player, IInventory inventory, Side side)
+ {
+ super(194.0F, 192.0F, player, inventory, side);
+ }
+
+ protected AbstractMod getMod()
+ {
+ return ExtraTrees.instance;
+ }
+
+ protected String getName()
+ {
+ return "Press";
+ }
+
+ public void initialiseClient()
+ {
+ setTitle(Machine.getMachine(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)getSuperParent()).getContainer().getOrCreateSlot(InventoryType.Machine, Press.slotCurrent);
+ }
+
+ public static Window create(EntityPlayer player, IInventory inventory, Side side)
+ {
+ return new WindowPress(player, inventory, side);
+ }
+
+ public void recieveGuiNBT(Side side, EntityPlayer player, String name, NBTTagCompound action)
+ {
+ Press.ComponentFruitPressLogic logic = (Press.ComponentFruitPressLogic)Machine.getInterface(Press.ComponentFruitPressLogic.class, getInventory());
+ super.recieveGuiNBT(side, player, name, action);
+ 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);
+ getInventory().setInventorySlotContents(Press.slotCurrent, null);
+ }
+ }
+ }
+}
diff --git a/src/Java/binnie/craftgui/extratrees/dictionary/WindowSetSquare.java b/src/Java/binnie/craftgui/extratrees/dictionary/WindowSetSquare.java
new file mode 100644
index 0000000000..ba444d7b0f
--- /dev/null
+++ b/src/Java/binnie/craftgui/extratrees/dictionary/WindowSetSquare.java
@@ -0,0 +1,35 @@
+package binnie.craftgui.extratrees.dictionary;
+
+import binnie.core.AbstractMod;
+import binnie.craftgui.minecraft.Window;
+import binnie.extratrees.ExtraTrees;
+import cpw.mods.fml.relauncher.Side;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.world.World;
+
+public class WindowSetSquare
+ extends Window
+{
+ public WindowSetSquare(EntityPlayer player, IInventory inventory, Side side)
+ {
+ super(150.0F, 150.0F, player, inventory, side);
+ }
+
+ protected AbstractMod getMod()
+ {
+ return ExtraTrees.instance;
+ }
+
+ protected String getName()
+ {
+ return null;
+ }
+
+ public void initialiseClient() {}
+
+ public static Window create(EntityPlayer player, World world, int x, int y, int z, Side side)
+ {
+ return new WindowSetSquare(player, null, side);
+ }
+}
diff --git a/src/Java/binnie/craftgui/extratrees/dictionary/WindowWoodworker.java b/src/Java/binnie/craftgui/extratrees/dictionary/WindowWoodworker.java
new file mode 100644
index 0000000000..9e9c6fb7d0
--- /dev/null
+++ b/src/Java/binnie/craftgui/extratrees/dictionary/WindowWoodworker.java
@@ -0,0 +1,110 @@
+package binnie.craftgui.extratrees.dictionary;
+
+import binnie.core.AbstractMod;
+import binnie.core.BinnieCore;
+import binnie.core.machines.IMachine;
+import binnie.core.machines.Machine;
+import binnie.core.machines.MachinePackage;
+import binnie.core.proxy.BinnieProxy;
+import binnie.craftgui.controls.ControlText;
+import binnie.craftgui.controls.ControlTextEdit;
+import binnie.craftgui.controls.scroll.ControlScrollableContent;
+import binnie.craftgui.core.geometry.IArea;
+import binnie.craftgui.core.geometry.IPoint;
+import binnie.craftgui.core.geometry.TextJustification;
+import binnie.craftgui.events.EventHandler.Origin;
+import binnie.craftgui.events.EventTextEdit;
+import binnie.craftgui.events.EventTextEdit.Handler;
+import binnie.craftgui.minecraft.MinecraftGUI.PanelType;
+import binnie.craftgui.minecraft.Window;
+import binnie.craftgui.minecraft.control.ControlErrorState;
+import binnie.craftgui.minecraft.control.ControlPlayerInventory;
+import binnie.craftgui.minecraft.control.ControlSlot;
+import binnie.craftgui.window.Panel;
+import binnie.extratrees.ExtraTrees;
+import binnie.extratrees.machines.Designer;
+import binnie.extratrees.machines.Designer.ComponentWoodworkerRecipe;
+import binnie.extratrees.machines.DesignerType;
+import cpw.mods.fml.relauncher.Side;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.IInventory;
+
+public class WindowWoodworker
+ extends Window
+{
+ ControlTextEdit textEdit;
+ ControlTileSelect tileSelect;
+
+ public void initialiseClient()
+ {
+ setTitle(Machine.getMachine(getInventory()).getPackage().getDisplayName());
+
+ new ControlText(this, new IArea(190.0F, 36.0F, 114.0F, 10.0F), BinnieCore.proxy.localise("gui.design"), TextJustification.TopCenter).setColour(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);
+
+ ControlScrollableContent scroll = new ControlScrollableContent(this, 190.0F, 50.0F, 114.0F, 122.0F, 12.0F);
+
+
+
+ this.tileSelect = new ControlTileSelect(scroll, 0.0F, 0.0F);
+
+ scroll.setScrollableContent(this.tileSelect);
+
+
+
+
+
+ new ControlPlayerInventory(this).setPosition(new IPoint(14.0F, 96.0F));
+
+ new ControlErrorState(this, 76.0F, 65.0F);
+ ControlRecipeSlot slotFinished;
+ if (getInventory() != null)
+ {
+ ControlSlot slotWood1 = new ControlSlot(this, 22.0F, 34.0F);
+ slotWood1.assign(Designer.design1Slot);
+ ControlSlot slotWood2 = new ControlSlot(this, 62.0F, 34.0F);
+ slotWood2.assign(Designer.design2Slot);
+
+ ControlSlot slotBeeswax = new ControlSlot(this, 42.0F, 64.0F);
+ slotBeeswax.assign(Designer.beeswaxSlot);
+
+ slotFinished = new ControlRecipeSlot(this, 112, 34);
+ }
+ }
+
+ public WindowWoodworker(EntityPlayer player, IInventory inventory, Side side)
+ {
+ super(320.0F, 216.0F, player, inventory, side);
+
+ addEventHandler(new EventTextEdit.Handler()
+ {
+ public void onEvent(EventTextEdit event)
+ {
+ WindowWoodworker.this.tileSelect.refresh((String)event.getValue());
+ }
+ }.setOrigin(EventHandler.Origin.DirectChild, this));
+ }
+
+ public static Window create(EntityPlayer player, IInventory inventory, Side side)
+ {
+ return new WindowWoodworker(player, inventory, side);
+ }
+
+ protected AbstractMod getMod()
+ {
+ return ExtraTrees.instance;
+ }
+
+ protected String getName()
+ {
+ return "Woodworker";
+ }
+
+ public DesignerType getDesignerType()
+ {
+ return ((Designer.ComponentWoodworkerRecipe)Machine.getInterface(Designer.ComponentWoodworkerRecipe.class, getInventory())).getDesignerType();
+ }
+}
diff --git a/src/Java/binnie/craftgui/extratrees/kitchen/ControlDropDownMenu.java b/src/Java/binnie/craftgui/extratrees/kitchen/ControlDropDownMenu.java
new file mode 100644
index 0000000000..0d9c982400
--- /dev/null
+++ b/src/Java/binnie/craftgui/extratrees/kitchen/ControlDropDownMenu.java
@@ -0,0 +1,18 @@
+package binnie.craftgui.extratrees.kitchen;
+
+import binnie.craftgui.core.Attribute;
+import binnie.craftgui.core.IWidget;
+import binnie.craftgui.minecraft.MinecraftGUI.PanelType;
+import binnie.craftgui.window.Panel;
+
+public class ControlDropDownMenu
+ extends Panel
+{
+ public ControlDropDownMenu(IWidget parent, float x, float y, float width, float height)
+ {
+ super(parent, x, y, width, 2.0F, MinecraftGUI.PanelType.Gray);
+ addAttribute(Attribute.CanFocus);
+ }
+
+ public boolean stayOpenOnChildClick = false;
+}
diff --git a/src/Java/binnie/craftgui/extratrees/kitchen/ControlDropdownButton.java b/src/Java/binnie/craftgui/extratrees/kitchen/ControlDropdownButton.java
new file mode 100644
index 0000000000..069272b82a
--- /dev/null
+++ b/src/Java/binnie/craftgui/extratrees/kitchen/ControlDropdownButton.java
@@ -0,0 +1,36 @@
+package binnie.craftgui.extratrees.kitchen;
+
+import binnie.craftgui.controls.button.ControlButton;
+import binnie.craftgui.core.IWidget;
+import binnie.craftgui.events.EventMouse.Down;
+import binnie.craftgui.events.EventMouse.Down.Handler;
+import binnie.craftgui.minecraft.Window;
+
+public abstract class ControlDropdownButton
+ extends ControlButton
+{
+ public ControlDropdownButton(IWidget parent, float x, float y, float width, float height, String text)
+ {
+ super(parent, x, y, width, height, text);
+
+ addSelfEventHandler(new EventMouse.Down.Handler()
+ {
+ public void onEvent(EventMouse.Down event)
+ {
+ ControlDropDownMenu menu = (ControlDropDownMenu)ControlDropdownButton.this.getWidget(ControlDropDownMenu.class);
+ ControlDropdownButton.this.deleteChild((IWidget)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((IWidget)ControlDropdownButton.this.getWidget(ControlDropDownMenu.class));
+ }
+ }
+ });
+ }
+
+ public abstract ControlDropDownMenu createDropDownMenu();
+}
diff --git a/src/Java/binnie/craftgui/extratrees/kitchen/ControlFluidDisplay.java b/src/Java/binnie/craftgui/extratrees/kitchen/ControlFluidDisplay.java
new file mode 100644
index 0000000000..7ec1124226
--- /dev/null
+++ b/src/Java/binnie/craftgui/extratrees/kitchen/ControlFluidDisplay.java
@@ -0,0 +1,103 @@
+package binnie.craftgui.extratrees.kitchen;
+
+import binnie.craftgui.controls.core.Control;
+import binnie.craftgui.core.Attribute;
+import binnie.craftgui.core.CraftGUI;
+import binnie.craftgui.core.ITooltip;
+import binnie.craftgui.core.ITopLevelWidget;
+import binnie.craftgui.core.IWidget;
+import binnie.craftgui.core.Tooltip;
+import binnie.craftgui.core.geometry.IPoint;
+import binnie.craftgui.core.renderer.Renderer;
+import binnie.craftgui.minecraft.Window;
+import net.minecraft.util.IIcon;
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidStack;
+import org.lwjgl.opengl.GL11;
+
+public class ControlFluidDisplay
+ extends Control
+ implements ITooltip
+{
+ FluidStack itemStack = null;
+ public boolean hastooltip = false;
+
+ public void setTooltip()
+ {
+ this.hastooltip = true;
+ addAttribute(Attribute.MouseOver);
+ }
+
+ public ControlFluidDisplay(IWidget parent, float f, float y)
+ {
+ this(parent, f, y, 16.0F);
+ }
+
+ public ControlFluidDisplay(IWidget parent, float f, float y, FluidStack stack, boolean tooltip)
+ {
+ this(parent, f, y, 16.0F);
+ setItemStack(stack);
+ if (tooltip) {
+ setTooltip();
+ }
+ }
+
+ public ControlFluidDisplay(IWidget parent, float x, float y, float size)
+ {
+ super(parent, x, y, size, size);
+ }
+
+ public void onRenderForeground()
+ {
+ if (this.itemStack == null) {
+ return;
+ }
+ IPoint relativeToWindow = getAbsolutePosition().sub(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)
+ {
+ Fluid fluid = this.itemStack.getFluid();
+
+ int hex = fluid.getColor(this.itemStack);
+
+ int r = (hex & 0xFF0000) >> 16;
+ int g = (hex & 0xFF00) >> 8;
+ int b = hex & 0xFF;
+
+ 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 (getSize().x() != 16.0F)
+ {
+ GL11.glPushMatrix();
+ float scale = 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(FluidStack itemStack)
+ {
+ this.itemStack = itemStack;
+ }
+
+ public void getTooltip(Tooltip tooltip)
+ {
+ if ((this.hastooltip) && (this.itemStack != null)) {
+ tooltip.add(this.itemStack.getLocalizedName());
+ }
+ }
+}
diff --git a/src/Java/binnie/craftgui/extratrees/kitchen/ControlSlotFluid.java b/src/Java/binnie/craftgui/extratrees/kitchen/ControlSlotFluid.java
new file mode 100644
index 0000000000..5cd82c39de
--- /dev/null
+++ b/src/Java/binnie/craftgui/extratrees/kitchen/ControlSlotFluid.java
@@ -0,0 +1,77 @@
+package binnie.craftgui.extratrees.kitchen;
+
+import binnie.craftgui.controls.core.Control;
+import binnie.craftgui.core.Attribute;
+import binnie.craftgui.core.CraftGUI;
+import binnie.craftgui.core.ITooltip;
+import binnie.craftgui.core.ITopLevelWidget;
+import binnie.craftgui.core.IWidget;
+import binnie.craftgui.core.Tooltip;
+import binnie.craftgui.core.geometry.IArea;
+import binnie.craftgui.core.geometry.IPoint;
+import binnie.craftgui.core.renderer.Renderer;
+import binnie.craftgui.events.EventWidget.ChangeSize;
+import binnie.craftgui.events.EventWidget.ChangeSize.Handler;
+import binnie.craftgui.resource.minecraft.CraftGUITexture;
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidStack;
+
+public class ControlSlotFluid
+ extends Control
+ implements ITooltip
+{
+ ControlFluidDisplay itemDisplay;
+ FluidStack fluidStack;
+
+ public ControlSlotFluid(IWidget parent, int x, int y, FluidStack fluid)
+ {
+ this(parent, x, y, 18, fluid);
+ }
+
+ public ControlSlotFluid(IWidget parent, int x, int y, int size, FluidStack fluid)
+ {
+ super(parent, x, y, size, size);
+ addAttribute(Attribute.MouseOver);
+ this.itemDisplay = new ControlFluidDisplay(this, 1.0F, 1.0F, size - 2);
+ this.fluidStack = fluid;
+
+ addSelfEventHandler(new EventWidget.ChangeSize.Handler()
+ {
+ public void onEvent(EventWidget.ChangeSize event)
+ {
+ if (ControlSlotFluid.this.itemDisplay != null) {
+ ControlSlotFluid.this.itemDisplay.setSize(ControlSlotFluid.this.getSize().sub(new IPoint(2.0F, 2.0F)));
+ }
+ }
+ });
+ }
+
+ public void onRenderBackground()
+ {
+ int size = (int)getSize().x();
+ CraftGUI.Render.texture(CraftGUITexture.Slot, getArea());
+ if (getSuperParent().getMousedOverWidget() == this) {
+ CraftGUI.Render.gradientRect(new IArea(new IPoint(1.0F, 1.0F), getArea().size().sub(new IPoint(2.0F, 2.0F))), -2130706433, -2130706433);
+ }
+ }
+
+ public void onUpdateClient()
+ {
+ super.onUpdateClient();
+ this.itemDisplay.setItemStack(getFluidStack());
+ }
+
+ public void getTooltip(Tooltip tooltip)
+ {
+ FluidStack item = getFluidStack();
+ if (item == null) {
+ return;
+ }
+ tooltip.add(item.getFluid().getLocalizedName());
+ }
+
+ public FluidStack getFluidStack()
+ {
+ return this.fluidStack;
+ }
+}
diff --git a/src/Java/binnie/craftgui/extratrees/kitchen/ControlSlotGlassware.java b/src/Java/binnie/craftgui/extratrees/kitchen/ControlSlotGlassware.java
new file mode 100644
index 0000000000..fa7cd3df84
--- /dev/null
+++ b/src/Java/binnie/craftgui/extratrees/kitchen/ControlSlotGlassware.java
@@ -0,0 +1,35 @@
+package binnie.craftgui.extratrees.kitchen;
+
+import binnie.craftgui.controls.core.IControlValue;
+import binnie.craftgui.core.IWidget;
+import binnie.craftgui.minecraft.control.ControlSlotBase;
+import binnie.extratrees.alcohol.Glassware;
+import net.minecraft.item.ItemStack;
+
+public class ControlSlotGlassware
+ extends ControlSlotBase
+ implements IControlValue<Glassware>
+{
+ Glassware glassware;
+
+ public ControlSlotGlassware(IWidget parent, int x, int y, Glassware glassware)
+ {
+ super(parent, x, y);
+ this.glassware = glassware;
+ }
+
+ public Glassware getValue()
+ {
+ return this.glassware;
+ }
+
+ public void setValue(Glassware value)
+ {
+ this.glassware = value;
+ }
+
+ public ItemStack getItemStack()
+ {
+ return this.glassware.get(1);
+ }
+}
diff --git a/src/Java/binnie/craftgui/extratrees/kitchen/ControlTankSlot.java b/src/Java/binnie/craftgui/extratrees/kitchen/ControlTankSlot.java
new file mode 100644
index 0000000000..c1caf1772f
--- /dev/null
+++ b/src/Java/binnie/craftgui/extratrees/kitchen/ControlTankSlot.java
@@ -0,0 +1,49 @@
+package binnie.craftgui.extratrees.kitchen;
+
+import binnie.core.machines.power.TankInfo;
+import binnie.craftgui.core.IWidget;
+import binnie.craftgui.core.geometry.IArea;
+import binnie.craftgui.events.EventMouse.Down;
+import binnie.craftgui.events.EventMouse.Down.Handler;
+import binnie.craftgui.minecraft.ContainerCraftGUI;
+import binnie.craftgui.minecraft.Window;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraftforge.fluids.FluidStack;
+
+public class ControlTankSlot
+ extends ControlSlotFluid
+{
+ int tankID = 0;
+
+ public ControlTankSlot(IWidget parent, int x, int y, int i)
+ {
+ super(parent, x, y, null);
+ this.tankID = i;
+
+ addSelfEventHandler(new EventMouse.Down.Handler()
+ {
+ public void onEvent(EventMouse.Down event)
+ {
+ if (event.getButton() == 0)
+ {
+ NBTTagCompound nbt = new NBTTagCompound();
+ nbt.setByte("id", (byte)ControlTankSlot.this.tankID);
+ Window.get(ControlTankSlot.this.getWidget()).sendClientAction("tank-click", nbt);
+ }
+ }
+ });
+ }
+
+ public void onUpdateClient()
+ {
+ this.fluidStack = Window.get(this).getContainer().getTankInfo(this.tankID).liquid;
+ 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();
+ }
+
+ public void onRenderBackground()
+ {
+ super.onRenderBackground();
+ }
+}
diff --git a/src/Java/binnie/craftgui/extratrees/kitchen/WindowBottleRack.java b/src/Java/binnie/craftgui/extratrees/kitchen/WindowBottleRack.java
new file mode 100644
index 0000000000..8fffff9ed2
--- /dev/null
+++ b/src/Java/binnie/craftgui/extratrees/kitchen/WindowBottleRack.java
@@ -0,0 +1,48 @@
+package binnie.craftgui.extratrees.kitchen;
+
+import binnie.core.AbstractMod;
+import binnie.core.machines.IMachine;
+import binnie.core.machines.Machine;
+import binnie.core.machines.MachinePackage;
+import binnie.craftgui.minecraft.Window;
+import binnie.craftgui.minecraft.control.ControlPlayerInventory;
+import binnie.extratrees.ExtraTrees;
+import cpw.mods.fml.relauncher.Side;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.IInventory;
+
+public class WindowBottleRack
+ extends Window
+{
+ public WindowBottleRack(EntityPlayer player, IInventory inventory, Side side)
+ {
+ super(248.0F, 180.0F, player, inventory, side);
+ }
+
+ public static Window create(EntityPlayer player, IInventory inventory, Side side)
+ {
+ return new WindowBottleRack(player, inventory, side);
+ }
+
+ protected AbstractMod getMod()
+ {
+ return ExtraTrees.instance;
+ }
+
+ protected String getName()
+ {
+ return "BottleBank";
+ }
+
+ public void initialiseClient()
+ {
+ setTitle(Machine.getMachine(getInventory()).getPackage().getDisplayName());
+ for (int i = 0; i < 36; i++)
+ {
+ int x = i % 12;
+ int y = i / 12;
+ new ControlTankSlot(this, 16 + x * 18, 32 + y * 18, i);
+ }
+ new ControlPlayerInventory(this);
+ }
+}
diff --git a/src/Java/binnie/craftgui/genetics/machine/ControlGene.java b/src/Java/binnie/craftgui/genetics/machine/ControlGene.java
new file mode 100644
index 0000000000..a5c830154e
--- /dev/null
+++ b/src/Java/binnie/craftgui/genetics/machine/ControlGene.java
@@ -0,0 +1,101 @@
+package binnie.craftgui.genetics.machine;
+
+import binnie.Binnie;
+import binnie.core.genetics.BreedingSystem;
+import binnie.core.genetics.ManagerGenetics;
+import binnie.core.resource.BinnieIcon;
+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.ITooltip;
+import binnie.craftgui.core.IWidget;
+import binnie.craftgui.core.Tooltip;
+import binnie.craftgui.core.geometry.IArea;
+import binnie.craftgui.core.geometry.IPoint;
+import binnie.craftgui.core.renderer.Renderer;
+import binnie.craftgui.events.EventMouse.Down;
+import binnie.craftgui.events.EventMouse.Down.Handler;
+import binnie.craftgui.minecraft.Window;
+import binnie.genetics.api.IGene;
+import binnie.genetics.core.GeneticsTexture;
+import binnie.genetics.genetics.Engineering;
+import forestry.api.genetics.IChromosomeType;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+
+public class ControlGene
+ extends Control
+ implements IControlValue<IGene>, ITooltip
+{
+ IGene gene;
+
+ public void getTooltip(Tooltip tooltip)
+ {
+ String cName = Binnie.Genetics.getSystem(this.gene.getSpeciesRoot()).getChromosomeName(this.gene.getChromosome());
+ tooltip.add(cName + ": " + this.gene.getName());
+ if ((isMouseOver()) && (canFill(Window.get(this).getHeldItemStack())))
+ {
+ tooltip.add("Left click to assign gene");
+ IGene existingGene = Engineering.getGene(Window.get(this).getHeldItemStack(), this.gene.getChromosome().ordinal());
+ if (existingGene == null) {
+ return;
+ }
+ String dName = Binnie.Genetics.getSystem(this.gene.getSpeciesRoot()).getChromosomeName(this.gene.getChromosome());
+ tooltip.add("Will replace " + dName + ": " + existingGene.getName());
+ }
+ }
+
+ private boolean canFill(ItemStack stack)
+ {
+ return (stack != null) && (stack.stackSize == 1) && (Engineering.isGeneAcceptor(stack)) && (Engineering.canAcceptGene(stack, getValue()));
+ }
+
+ protected ControlGene(IWidget parent, float x, float y)
+ {
+ super(parent, x, y, 16.0F, 16.0F);
+ addAttribute(Attribute.MouseOver);
+
+ addSelfEventHandler(new EventMouse.Down.Handler()
+ {
+ public void onEvent(EventMouse.Down event)
+ {
+ if (ControlGene.this.canFill(Window.get(ControlGene.this.getWidget()).getHeldItemStack()))
+ {
+ NBTTagCompound action = new NBTTagCompound();
+
+ NBTTagCompound geneNBT = new NBTTagCompound();
+ ControlGene.this.getValue().writeToNBT(geneNBT);
+
+ action.setTag("gene", geneNBT);
+
+ Window.get(ControlGene.this.getWidget()).sendClientAction("gene-select", action);
+ }
+ }
+ });
+ }
+
+ public IGene getValue()
+ {
+ return this.gene;
+ }
+
+ public void setValue(IGene value)
+ {
+ this.gene = value;
+ }
+
+ public void onRenderForeground() {}
+
+ public void onRenderBackground()
+ {
+ if ((isMouseOver()) && (canFill(Window.get(this).getHeldItemStack())))
+ {
+ CraftGUI.Render.solid(getArea(), -1);
+ CraftGUI.Render.solid(getArea().inset(1), -12303292);
+ }
+ CraftGUI.Render.colour(-1);
+
+ CraftGUI.Render.iconItem(IPoint.ZERO, GeneticsTexture.dnaIcon.getIcon());
+ }
+}
diff --git a/src/Java/binnie/craftgui/genetics/machine/ControlGeneScroll.java b/src/Java/binnie/craftgui/genetics/machine/ControlGeneScroll.java
new file mode 100644
index 0000000000..a779933050
--- /dev/null
+++ b/src/Java/binnie/craftgui/genetics/machine/ControlGeneScroll.java
@@ -0,0 +1,97 @@
+package binnie.craftgui.genetics.machine;
+
+import binnie.Binnie;
+import binnie.core.genetics.BreedingSystem;
+import binnie.core.genetics.Gene;
+import binnie.core.genetics.ManagerGenetics;
+import binnie.craftgui.controls.ControlText;
+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.minecraft.Window;
+import binnie.genetics.genetics.GeneTracker;
+import forestry.api.genetics.IAllele;
+import forestry.api.genetics.IChromosomeType;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+public class ControlGeneScroll
+ extends Control
+ implements IControlValue<BreedingSystem>
+{
+ protected ControlGeneScroll(IWidget parent, float x, float y, float w, float h)
+ {
+ super(parent, x, y, w, h);
+ }
+
+ private String filter = "";
+ private BreedingSystem system = null;
+
+ public void setFilter(String filter)
+ {
+ this.filter = filter.toLowerCase();
+ refresh();
+ }
+
+ public void setGenes(BreedingSystem system)
+ {
+ this.system = system;
+ refresh();
+ }
+
+ public void refresh()
+ {
+ deleteAllChildren();
+
+ GeneTracker tracker = GeneTracker.getTracker(Window.get(this).getWorld(), Window.get(this).getUsername());
+
+ Map<IChromosomeType, List<IAllele>> genes = Binnie.Genetics.getChromosomeMap(this.system.getSpeciesRoot());
+
+ int x = 0;
+ int y = 0;
+
+ boolean isNEI = ((WindowGeneBank)Window.get(this)).isNei;
+ for (Map.Entry<IChromosomeType, List<IAllele>> entry : genes.entrySet())
+ {
+ List<IAllele> discovered = new ArrayList();
+ for (IAllele allele : (List)entry.getValue())
+ {
+ Gene gene = new Gene(allele, (IChromosomeType)entry.getKey(), this.system.getSpeciesRoot());
+ if (((isNEI) || (tracker.isSequenced(new Gene(allele, (IChromosomeType)entry.getKey(), this.system.getSpeciesRoot())))) && (gene.getName().toLowerCase().contains(this.filter))) {
+ discovered.add(allele);
+ }
+ }
+ if (discovered.size() != 0)
+ {
+ x = 0;
+ new ControlText(this, new IPoint(x, y), this.system.getChromosomeName((IChromosomeType)entry.getKey()));
+ y += 12;
+ for (IAllele allele : discovered)
+ {
+ if (x + 18 > getSize().x())
+ {
+ y += 20;
+ x = 0;
+ }
+ new ControlGene(this, x, y).setValue(new Gene(allele, (IChromosomeType)entry.getKey(), this.system.getSpeciesRoot()));
+ x += 18;
+ }
+ y += 24;
+ }
+ }
+ setSize(new IPoint(getSize().x(), y));
+ }
+
+ public void setValue(BreedingSystem system)
+ {
+ setGenes(system);
+ }
+
+ public BreedingSystem getValue()
+ {
+ return this.system;
+ }
+}
diff --git a/src/Java/binnie/craftgui/genetics/machine/ControlProcessTemporary.java b/src/Java/binnie/craftgui/genetics/machine/ControlProcessTemporary.java
new file mode 100644
index 0000000000..43e32dc9ad
--- /dev/null
+++ b/src/Java/binnie/craftgui/genetics/machine/ControlProcessTemporary.java
@@ -0,0 +1,27 @@
+package binnie.craftgui.genetics.machine;
+
+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.renderer.Renderer;
+import binnie.craftgui.minecraft.control.ControlMachineProgress;
+
+public class ControlProcessTemporary
+ extends ControlMachineProgress
+{
+ public ControlProcessTemporary(IWidget parent, int x, int y, int width, int height)
+ {
+ super(parent, x, y, null, null, null);
+ setSize(new IPoint(width, height));
+ }
+
+ public void onRenderBackground()
+ {
+ CraftGUI.Render.solid(getArea(), -4868683);
+
+ float w = getSize().y() * this.progress / 100.0F;
+
+ CraftGUI.Render.solid(new IArea(getArea().x(), getArea().y(), w, getArea().h()), -65536);
+ }
+}
diff --git a/src/Java/binnie/craftgui/genetics/machine/ControlSequencerProgress.java b/src/Java/binnie/craftgui/genetics/machine/ControlSequencerProgress.java
new file mode 100644
index 0000000000..1a80f71676
--- /dev/null
+++ b/src/Java/binnie/craftgui/genetics/machine/ControlSequencerProgress.java
@@ -0,0 +1,64 @@
+package binnie.craftgui.genetics.machine;
+
+import binnie.core.machines.IMachine;
+import binnie.core.machines.Machine;
+import binnie.core.machines.MachineUtil;
+import binnie.craftgui.controls.ControlText;
+import binnie.craftgui.core.IWidget;
+import binnie.craftgui.core.geometry.IArea;
+import binnie.craftgui.core.geometry.TextJustification;
+import binnie.craftgui.minecraft.MinecraftGUI.PanelType;
+import binnie.craftgui.minecraft.Window;
+import binnie.craftgui.minecraft.control.ControlProgressBase;
+import binnie.craftgui.window.Panel;
+import java.util.Random;
+import net.minecraft.item.ItemStack;
+
+public class ControlSequencerProgress
+ extends ControlProgressBase
+{
+ ControlText textControl;
+
+ public ControlSequencerProgress(IWidget parent, int x, int y)
+ {
+ super(parent, x, y, 100.0F, 52.0F);
+
+ Panel panel = new Panel(this, 0.0F, 0.0F, 100.0F, 52.0F, MinecraftGUI.PanelType.Gray);
+
+ this.textControl = new ControlText(panel, new IArea(4.0F, 4.0F, 92.0F, 44.0F), "", TextJustification.MiddleCenter);
+ }
+
+ public void onUpdateClient()
+ {
+ super.onUpdateClient();
+
+ ItemStack stack = Machine.getMachine(Window.get(this).getInventory()).getMachineUtil().getStack(5);
+ if (stack == null)
+ {
+ this.textControl.setValue("");
+ }
+ else
+ {
+ Random rand = new Random(stack.getDisplayName().length());
+
+ String text = "";
+ String[] codes = { "A", "T", "G", "C" };
+ String[] colors = { "a", "d", "b", "c" };
+ for (int i = 0; i < 65; i++)
+ {
+ int k = rand.nextInt(4);
+ String code = codes[k];
+ if (rand.nextFloat() < this.progress)
+ {
+ String col = "§" + colors[k];
+ text = text + "§r" + col + "§l" + code;
+ }
+ else
+ {
+ text = text + "§r§7§k§l" + code;
+ }
+ }
+ this.textControl.setValue(text);
+ }
+ }
+}
diff --git a/src/Java/binnie/craftgui/genetics/machine/ControlSplicerProgress.java b/src/Java/binnie/craftgui/genetics/machine/ControlSplicerProgress.java
new file mode 100644
index 0000000000..7afa16f31f
--- /dev/null
+++ b/src/Java/binnie/craftgui/genetics/machine/ControlSplicerProgress.java
@@ -0,0 +1,60 @@
+package binnie.craftgui.genetics.machine;
+
+import binnie.core.machines.power.ProcessInfo;
+import binnie.craftgui.core.CraftGUI;
+import binnie.craftgui.core.IWidget;
+import binnie.craftgui.core.geometry.IArea;
+import binnie.craftgui.core.renderer.Renderer;
+import binnie.craftgui.minecraft.control.ControlProgressBase;
+
+public class ControlSplicerProgress
+ extends ControlProgressBase
+{
+ float strength = 0.0F;
+
+ public ControlSplicerProgress(IWidget parent, float x, float y, float w, float h)
+ {
+ super(parent, x, y, w, h);
+ this.strength = 0.0F;
+ }
+
+ public void onRenderBackground()
+ {
+ float progress = getProcess().getCurrentProgress() / 100.0F;
+
+ float n = getProcess().getProcessTime() / 12.0F;
+ float spacing = 10.0F;
+ float range = w();
+ float h = 8.0F;
+
+ float ooy = -((n - 1.0F) * spacing) - range / 2.0F;
+ float ddy = (n - 1.0F) * spacing + range;
+ float oy = ooy + ddy * progress;
+ for (int i = 0; i < n; i++)
+ {
+ int seed = 432523;
+ int[] colours = { 10027008, 30464, 255, 10057472 };
+ int c1 = colours[((int)Math.abs(13.0D * Math.sin(i) + 48.0D * Math.cos(i) + 25.0D * Math.sin(7 * i)) % 4)];
+ int c2 = colours[((int)Math.abs(23.0D * Math.sin(i) + 28.0D * Math.cos(i) + 15.0D * Math.sin(7 * i)) % 4)];
+ int c3 = colours[((int)Math.abs(43.0D * Math.sin(i) + 38.0D * Math.cos(i) + 55.0D * Math.sin(7 * i)) % 4)];
+ int c4 = colours[((int)Math.abs(3.0D * Math.sin(i) + 18.0D * Math.cos(i) + 35.0D * Math.sin(7 * i)) % 4)];
+
+ float y = oy + i * spacing;
+ if ((y > -range / 2.0F) && (y < range / 2.0F))
+ {
+ float percentView = (float)Math.sqrt(1.0F - Math.abs(2.0F * y / range));
+ float offMovement = (h() - 2.0F * h) / 2.0F;
+ int alpha = 16777216 * (int)(255.0F * percentView);
+ c1 += alpha;
+ c2 += alpha;
+ c3 += alpha;
+ c4 += alpha;
+ CraftGUI.Render.solidAlpha(new IArea(w() / 2.0F + y, offMovement * percentView, 4.0F, h / 2.0F), c1);
+ CraftGUI.Render.solidAlpha(new IArea(w() / 2.0F + y, offMovement * percentView + 4.0F, 4.0F, h / 2.0F), y < 0.0F ? c2 : c3);
+
+ CraftGUI.Render.solidAlpha(new IArea(w() / 2.0F + y, h() - offMovement * percentView - 8.0F, 4.0F, h / 2.0F), y < 0.0F ? c3 : c2);
+ CraftGUI.Render.solidAlpha(new IArea(w() / 2.0F + y, h() - offMovement * percentView - 4.0F, 4.0F, h / 2.0F), c4);
+ }
+ }
+ }
+}
diff --git a/src/Java/binnie/craftgui/genetics/machine/WindowAcclimatiser.java b/src/Java/binnie/craftgui/genetics/machine/WindowAcclimatiser.java
new file mode 100644
index 0000000000..8ed95dd0ef
--- /dev/null
+++ b/src/Java/binnie/craftgui/genetics/machine/WindowAcclimatiser.java
@@ -0,0 +1,80 @@
+package binnie.craftgui.genetics.machine;
+
+import binnie.core.AbstractMod;
+import binnie.craftgui.core.geometry.Position;
+import binnie.craftgui.minecraft.Window;
+import binnie.craftgui.minecraft.control.ControlEnergyBar;
+import binnie.craftgui.minecraft.control.ControlErrorState;
+import binnie.craftgui.minecraft.control.ControlPlayerInventory;
+import binnie.craftgui.minecraft.control.ControlSlot;
+import binnie.craftgui.minecraft.control.ControlSlotArray;
+import binnie.craftgui.resource.Texture;
+import binnie.craftgui.resource.minecraft.StandardTexture;
+import binnie.extrabees.core.ExtraBeeTexture;
+import binnie.genetics.Genetics;
+import binnie.genetics.machine.Acclimatiser;
+import cpw.mods.fml.relauncher.Side;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.IInventory;
+
+public class WindowAcclimatiser
+ extends WindowMachine
+{
+ public static Window create(EntityPlayer player, IInventory inventory, Side side)
+ {
+ return new WindowAcclimatiser(player, inventory, side);
+ }
+
+ public WindowAcclimatiser(EntityPlayer player, IInventory inventory, Side side)
+ {
+ super(280, 198, player, inventory, side);
+ }
+
+ static Texture ProgressBase = new StandardTexture(64, 0, 130, 21, ExtraBeeTexture.GUIProgress.getTexture());
+ static Texture Progress = new StandardTexture(64, 21, 130, 21, ExtraBeeTexture.GUIProgress.getTexture());
+ public static final int[] slotReserve = { 0, 1, 2, 3 };
+ public static final int slotTarget = 4;
+ public static final int[] slotAcclimatiser = { 5, 6, 7 };
+ public static final int[] slotDone = { 8, 9, 10, 11 };
+
+ public void initialiseClient()
+ {
+ setTitle("Acclimatiser");
+
+ int x = 16;
+ int y = 32;
+
+ new ControlSlotArray(this, x, y, 2, 2).create(Acclimatiser.slotReserve);
+
+ x += 54;
+
+ new ControlSlot(this, x + 18, y).assign(4);
+ new ControlSlotArray(this, x, y + 18 + 18, 3, 1).create(Acclimatiser.slotAcclimatiser);
+
+ x += 72;
+
+ new ControlSlotArray(this, x, y, 2, 2).create(Acclimatiser.slotDone);
+
+
+ new ControlEnergyBar(this, 21, 115, 16, 60, Position.Bottom);
+
+ new ControlErrorState(this, 181.0F, 83.0F);
+
+ new ControlPlayerInventory(this);
+ }
+
+ public String getTitle()
+ {
+ return "Acclimatiser";
+ }
+
+ protected AbstractMod getMod()
+ {
+ return Genetics.instance;
+ }
+
+ protected String getName()
+ {
+ return "Acclimatiser";
+ }
+}
diff --git a/src/Java/binnie/craftgui/genetics/machine/WindowAnalyser.java b/src/Java/binnie/craftgui/genetics/machine/WindowAnalyser.java
new file mode 100644
index 0000000000..c1a2ac5305
--- /dev/null
+++ b/src/Java/binnie/craftgui/genetics/machine/WindowAnalyser.java
@@ -0,0 +1,110 @@
+package binnie.craftgui.genetics.machine;
+
+import binnie.core.AbstractMod;
+import binnie.craftgui.core.geometry.Position;
+import binnie.craftgui.minecraft.GUIIcon;
+import binnie.craftgui.minecraft.MinecraftGUI.PanelType;
+import binnie.craftgui.minecraft.Window;
+import binnie.craftgui.minecraft.control.ControlEnergyBar;
+import binnie.craftgui.minecraft.control.ControlErrorState;
+import binnie.craftgui.minecraft.control.ControlIconDisplay;
+import binnie.craftgui.minecraft.control.ControlPlayerInventory;
+import binnie.craftgui.minecraft.control.ControlProgress;
+import binnie.craftgui.minecraft.control.ControlSlot;
+import binnie.craftgui.minecraft.control.ControlSlotArray;
+import binnie.craftgui.minecraft.control.ControlSlotCharge;
+import binnie.craftgui.resource.Texture;
+import binnie.craftgui.resource.minecraft.StandardTexture;
+import binnie.craftgui.window.Panel;
+import binnie.extrabees.core.ExtraBeeTexture;
+import binnie.genetics.Genetics;
+import binnie.genetics.core.GeneticsTexture;
+import binnie.genetics.machine.Analyser;
+import cpw.mods.fml.relauncher.Side;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.IInventory;
+
+public class WindowAnalyser
+ extends WindowMachine
+{
+ public static Window create(EntityPlayer player, IInventory inventory, Side side)
+ {
+ return new WindowAnalyser(player, inventory, side);
+ }
+
+ static Texture ProgressBase = new StandardTexture(0, 218, 142, 17, ExtraBeeTexture.GUIProgress.getTexture());
+ static Texture Progress = new StandardTexture(0, 201, 142, 17, ExtraBeeTexture.GUIProgress.getTexture());
+
+ public WindowAnalyser(EntityPlayer player, IInventory inventory, Side side)
+ {
+ super(220, 210, player, inventory, side);
+ }
+
+ public void initialiseClient()
+ {
+ ProgressBase = new StandardTexture(0, 51, 66, 40, GeneticsTexture.GUIProcess.getTexture());
+ Progress = new StandardTexture(66, 51, 66, 40, GeneticsTexture.GUIProcess.getTexture());
+
+
+
+
+ int x = 16;
+ int y = 32;
+
+ new ControlSlotArray(this, x, y, 2, 3).create(Analyser.slotReserve);
+
+
+ x += 28;
+
+ new ControlSlot(this, x, y + 54 + 8).assign(13);
+ new ControlSlotCharge(this, x + 20, y + 54 + 8, 13).setColour(10040319);
+ new ControlEnergyBar(this, x + 24 + 16, y + 54 + 8 + 1, 60, 16, Position.Left);
+ new ControlErrorState(this, x + 24 + 16 + 60 + 16, y + 54 + 8 + 1);
+
+
+ x -= 28;
+
+ new ControlIconDisplay(this, x + 36 + 2, y + 18, GUIIcon.ArrowRight.getIcon());
+
+
+ x += 56;
+
+ new Panel(this, x, y, 76.0F, 50.0F, MinecraftGUI.PanelType.Tinted);
+
+ new ControlProgress(this, x + 5, y + 5, ProgressBase, Progress, Position.Left);
+
+ new ControlSlot(this, x + 38 - 9, y + 25 - 9).assign(6);
+
+ new ControlIconDisplay(this, x + 76 + 2, y + 18, GUIIcon.ArrowRight.getIcon());
+
+
+ x += 96;
+
+
+
+ new ControlSlotArray(this, x, y, 2, 3).create(Analyser.slotFinished);
+
+
+ x += 52;
+
+ setTitle("Analyser");
+
+
+ new ControlPlayerInventory(this);
+ }
+
+ public String getTitle()
+ {
+ return "Analyser";
+ }
+
+ protected AbstractMod getMod()
+ {
+ return Genetics.instance;
+ }
+
+ protected String getName()
+ {
+ return "Analyser";
+ }
+}
diff --git a/src/Java/binnie/craftgui/genetics/machine/WindowGeneBank.java b/src/Java/binnie/craftgui/genetics/machine/WindowGeneBank.java
new file mode 100644
index 0000000000..e13bca4ce5
--- /dev/null
+++ b/src/Java/binnie/craftgui/genetics/machine/WindowGeneBank.java
@@ -0,0 +1,256 @@
+package binnie.craftgui.genetics.machine;
+
+import binnie.Binnie;
+import binnie.core.AbstractMod;
+import binnie.core.genetics.BreedingSystem;
+import binnie.core.genetics.Gene;
+import binnie.core.genetics.ManagerGenetics;
+import binnie.craftgui.controls.ControlText;
+import binnie.craftgui.controls.ControlTextEdit;
+import binnie.craftgui.controls.scroll.ControlScrollableContent;
+import binnie.craftgui.controls.tab.ControlTab;
+import binnie.craftgui.controls.tab.ControlTabBar;
+import binnie.craftgui.core.IWidget;
+import binnie.craftgui.core.Tooltip;
+import binnie.craftgui.core.geometry.IPoint;
+import binnie.craftgui.core.geometry.Position;
+import binnie.craftgui.events.EventHandler.Origin;
+import binnie.craftgui.events.EventTextEdit;
+import binnie.craftgui.events.EventTextEdit.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.ControlPlayerInventory;
+import binnie.craftgui.minecraft.control.ControlTabIcon;
+import binnie.craftgui.window.Panel;
+import binnie.genetics.Genetics;
+import binnie.genetics.genetics.Engineering;
+import binnie.genetics.genetics.GeneTracker;
+import cpw.mods.fml.relauncher.Side;
+import forestry.api.genetics.IAllele;
+import forestry.api.genetics.IChromosomeType;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+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.IInventory;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.IIcon;
+
+public class WindowGeneBank
+ extends WindowMachine
+{
+ public static IIcon[] iconsDNA;
+ public boolean isNei;
+ ControlGeneScroll genes;
+
+ public void recieveGuiNBT(Side side, EntityPlayer player, String name, NBTTagCompound action)
+ {
+ super.recieveGuiNBT(side, player, name, action);
+ if ((side == Side.SERVER) && (name.equals("gene-select")))
+ {
+ Gene gene = new Gene(action.getCompoundTag("gene"));
+ if ((gene != null) && (!gene.isCorrupted()))
+ {
+ ItemStack held = getHeldItemStack();
+
+ ItemStack converted = Engineering.addGene(held, gene);
+
+ getPlayer().inventory.setItemStack(converted);
+
+ getPlayer().inventory.markDirty();
+ if ((getPlayer() instanceof EntityPlayerMP)) {
+ ((EntityPlayerMP)getPlayer()).sendContainerToPlayer(player.inventoryContainer);
+ }
+ }
+ }
+ }
+
+ public static Window create(EntityPlayer player, IInventory inventory, Side side)
+ {
+ return new WindowGeneBank(player, inventory, side, false);
+ }
+
+ public WindowGeneBank(EntityPlayer player, IInventory inventory, Side side, boolean isNEI)
+ {
+ super(320, 224, player, inventory, side);
+ this.isNei = isNEI;
+ }
+
+ public void initialiseServer()
+ {
+ GeneTracker tracker = GeneTracker.getTracker(getWorld(), getUsername());
+ if (tracker != null) {
+ tracker.synchToPlayer(getPlayer());
+ }
+ }
+
+ public void initialiseClient()
+ {
+ setTitle("Gene Bank");
+
+ addEventHandler(new EventValueChanged.Handler()
+ {
+ public void onEvent(EventValueChanged event)
+ {
+ if ((event.value instanceof BreedingSystem)) {
+ WindowGeneBank.this.genes.setValue((BreedingSystem)event.value);
+ }
+ }
+ });
+ int boxX = 100;
+
+ int x = 16;
+ int y = 32;
+
+ new ControlPlayerInventory(this, x, y);
+
+ x += 124;
+
+ boxX = x;
+
+ int geneBoxWidth = 120;
+
+ new Panel(this, boxX + 24, 32.0F, geneBoxWidth, 120.0F, MinecraftGUI.PanelType.Black);
+ new Panel(this, boxX + 24 + geneBoxWidth, 32.0F, 14.0F, 120.0F, MinecraftGUI.PanelType.Gray);
+ ControlScrollableContent scroll = new ControlScrollableContent(this, boxX + 24 + 2, 34.0F, geneBoxWidth + 10, 116.0F, 12.0F);
+
+ ControlTextEdit edit = new ControlTextEdit(this, boxX + 27 + geneBoxWidth - 70, 18.0F, 80.0F, 12.0F);
+
+ addEventHandler(new EventTextEdit.Handler()
+ {
+ public void onEvent(EventTextEdit event)
+ {
+ WindowGeneBank.this.genes.setFilter((String)event.getValue());
+ }
+ }.setOrigin(EventHandler.Origin.Self, edit));
+
+
+
+ this.genes = new ControlGeneScroll(scroll, 1.0F, 1.0F, geneBoxWidth, 116.0F);
+ scroll.setScrollableContent(this.genes);
+
+
+
+
+
+ this.genes.setGenes(Binnie.Genetics.beeBreedingSystem);
+
+ ControlTabBar<BreedingSystem> tabBar = new ControlTabBar(this, boxX, 32.0F, 24.0F, 120.0F, Position.Left)
+ {
+ public ControlTab<BreedingSystem> createTab(float x, float y, float w, float h, BreedingSystem value)
+ {
+ new ControlTabIcon(this, x, y, w, h, value)
+ {
+ public void getTooltip(Tooltip tooltip)
+ {
+ tooltip.add(((BreedingSystem)getValue()).toString());
+
+ int totalGenes = 0;
+ int seqGenes = 0;
+
+ GeneTracker tracker = GeneTracker.getTracker(WindowGeneBank.this.getWorld(), WindowGeneBank.this.getUsername());
+
+ Map<IChromosomeType, List<IAllele>> genes = Binnie.Genetics.getChromosomeMap(((BreedingSystem)getValue()).getSpeciesRoot());
+ for (Iterator i$ = genes.entrySet().iterator(); i$.hasNext();)
+ {
+ entry = (Map.Entry)i$.next();
+ totalGenes += ((List)entry.getValue()).size();
+ for (IAllele allele : (List)entry.getValue())
+ {
+ Gene gene = new Gene(allele, (IChromosomeType)entry.getKey(), ((BreedingSystem)getValue()).getSpeciesRoot());
+ if (tracker.isSequenced(gene)) {
+ seqGenes++;
+ }
+ }
+ }
+ Map.Entry<IChromosomeType, List<IAllele>> entry;
+ tooltip.add("" + seqGenes + "/" + totalGenes + " Genes");
+ }
+ };
+ }
+ };
+ tabBar.setValues(Binnie.Genetics.getActiveSystems());
+
+ tabBar.setValue(Binnie.Genetics.beeBreedingSystem);
+
+ boxX -= 8;
+
+ ControlTabBar<String> infoTabs = new ControlTabBar(this, boxX + 8, 160.0F, 16.0F, 50.0F, Position.Left);
+
+ infoTabs.setValues(Arrays.asList(new String[] { "Stats", "Ranking" }));
+
+ infoTabs.setValue("Info");
+
+ Panel panelProject = new Panel(this, boxX + 24, 160.0F, geneBoxWidth + 20, 50.0F, MinecraftGUI.PanelType.Black);
+
+ int totalGenes = 0;
+ int seqGenes = 0;
+ for (Iterator i$ = Binnie.Genetics.getActiveSystems().iterator(); i$.hasNext();)
+ {
+ system = (BreedingSystem)i$.next();
+
+ tracker = GeneTracker.getTracker(getWorld(), getUsername());
+
+ Map<IChromosomeType, List<IAllele>> genes = Binnie.Genetics.getChromosomeMap(system.getSpeciesRoot());
+ for (i$ = genes.entrySet().iterator(); i$.hasNext();)
+ {
+ entry = (Map.Entry)i$.next();
+ totalGenes += ((List)entry.getValue()).size();
+ for (IAllele allele : (List)entry.getValue())
+ {
+ Gene gene = new Gene(allele, (IChromosomeType)entry.getKey(), system.getSpeciesRoot());
+ if (tracker.isSequenced(gene)) {
+ seqGenes++;
+ }
+ }
+ }
+ }
+ BreedingSystem system;
+ GeneTracker tracker;
+ Iterator i$;
+ Map.Entry<IChromosomeType, List<IAllele>> entry;
+ new ControlText(panelProject, new IPoint(4.0F, 4.0F), "§nFull Genome Project");
+ new ControlText(panelProject, new IPoint(4.0F, 18.0F), "§oSequenced §r" + seqGenes + "/" + totalGenes + " §oGenes");
+ }
+
+ public String getTitle()
+ {
+ return "Gene Bank";
+ }
+
+ public static class ChromosomeType
+ {
+ IChromosomeType chromosome;
+ BreedingSystem system;
+
+ public ChromosomeType(IChromosomeType chromosome, BreedingSystem system)
+ {
+ this.chromosome = chromosome;
+ this.system = system;
+ }
+
+ public String toString()
+ {
+ return this.system.getChromosomeName(this.chromosome);
+ }
+ }
+
+ protected AbstractMod getMod()
+ {
+ return Genetics.instance;
+ }
+
+ protected String getName()
+ {
+ return "GeneBank";
+ }
+}
diff --git a/src/Java/binnie/craftgui/genetics/machine/WindowGeneBankNEI.java b/src/Java/binnie/craftgui/genetics/machine/WindowGeneBankNEI.java
new file mode 100644
index 0000000000..08e680c68d
--- /dev/null
+++ b/src/Java/binnie/craftgui/genetics/machine/WindowGeneBankNEI.java
@@ -0,0 +1,14 @@
+package binnie.craftgui.genetics.machine;
+
+import binnie.craftgui.minecraft.Window;
+import cpw.mods.fml.relauncher.Side;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.IInventory;
+
+public class WindowGeneBankNEI
+{
+ public static Window create(EntityPlayer player, IInventory inventory, Side side)
+ {
+ return new WindowGeneBank(player, inventory, side, true);
+ }
+}
diff --git a/src/Java/binnie/craftgui/genetics/machine/WindowGeneProject.java b/src/Java/binnie/craftgui/genetics/machine/WindowGeneProject.java
new file mode 100644
index 0000000000..c79e6f7d0c
--- /dev/null
+++ b/src/Java/binnie/craftgui/genetics/machine/WindowGeneProject.java
@@ -0,0 +1,32 @@
+package binnie.craftgui.genetics.machine;
+
+import binnie.core.AbstractMod;
+import binnie.craftgui.minecraft.Window;
+import binnie.genetics.Genetics;
+import cpw.mods.fml.relauncher.Side;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.IInventory;
+
+public class WindowGeneProject
+ extends Window
+{
+ public WindowGeneProject(EntityPlayer player, IInventory inventory, Side side)
+ {
+ super(100.0F, 100.0F, player, inventory, side);
+ }
+
+ protected AbstractMod getMod()
+ {
+ return Genetics.instance;
+ }
+
+ protected String getName()
+ {
+ return "GeneProjects";
+ }
+
+ public void initialiseClient()
+ {
+ setTitle("Gene Projects");
+ }
+}
diff --git a/src/Java/binnie/craftgui/genetics/machine/WindowGenepool.java b/src/Java/binnie/craftgui/genetics/machine/WindowGenepool.java
new file mode 100644
index 0000000000..c91b95c0bb
--- /dev/null
+++ b/src/Java/binnie/craftgui/genetics/machine/WindowGenepool.java
@@ -0,0 +1,96 @@
+package binnie.craftgui.genetics.machine;
+
+import binnie.core.AbstractMod;
+import binnie.craftgui.core.geometry.Position;
+import binnie.craftgui.minecraft.GUIIcon;
+import binnie.craftgui.minecraft.Window;
+import binnie.craftgui.minecraft.control.ControlEnergyBar;
+import binnie.craftgui.minecraft.control.ControlErrorState;
+import binnie.craftgui.minecraft.control.ControlIconDisplay;
+import binnie.craftgui.minecraft.control.ControlLiquidTank;
+import binnie.craftgui.minecraft.control.ControlMachineProgress;
+import binnie.craftgui.minecraft.control.ControlPlayerInventory;
+import binnie.craftgui.minecraft.control.ControlSlot;
+import binnie.craftgui.minecraft.control.ControlSlotArray;
+import binnie.craftgui.minecraft.control.ControlSlotCharge;
+import binnie.craftgui.resource.Texture;
+import binnie.craftgui.resource.minecraft.StandardTexture;
+import binnie.extrabees.core.ExtraBeeTexture;
+import binnie.genetics.Genetics;
+import binnie.genetics.machine.Genepool;
+import cpw.mods.fml.relauncher.Side;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.IInventory;
+
+public class WindowGenepool
+ extends WindowMachine
+{
+ public static Window create(EntityPlayer player, IInventory inventory, Side side)
+ {
+ return new WindowGenepool(player, inventory, side);
+ }
+
+ public WindowGenepool(EntityPlayer player, IInventory inventory, Side side)
+ {
+ super(280, 198, player, inventory, side);
+ }
+
+ static Texture ProgressBase = new StandardTexture(64, 0, 130, 21, ExtraBeeTexture.GUIProgress.getTexture());
+ static Texture Progress = new StandardTexture(64, 21, 130, 21, ExtraBeeTexture.GUIProgress.getTexture());
+
+ public void initialiseClient()
+ {
+ setTitle("Genepool");
+
+ int x = 16;
+ int y = 32;
+
+ new ControlLiquidTank(this, x, y).setTankID(1);
+
+ x += 26;
+
+ new ControlSlotArray(this, x, y + 3, 2, 3).create(Genepool.slotReserve);
+
+ x += 38;
+
+ new ControlIconDisplay(this, x, y + 3 + 18 + 1, GUIIcon.ArrowRight.getIcon());
+
+ x += 18;
+
+ new ControlSlot(this, x, y + 3 + 18).assign(0);
+
+ x += 18;
+
+ new ControlMachineProgress(this, x, y + 19, ProgressBase, Progress, Position.Left);
+
+ x += 130;
+
+ new ControlLiquidTank(this, x, y).setTankID(0);
+
+
+ new ControlEnergyBar(this, 21, 115, 16, 60, Position.Bottom);
+
+ new ControlSlot(this, 121.0F, 82.0F).assign(7);
+ new ControlSlotCharge(this, 143, 82, 7).setColour(15722671);
+
+
+ new ControlErrorState(this, 181.0F, 83.0F);
+
+ new ControlPlayerInventory(this);
+ }
+
+ public String getTitle()
+ {
+ return "Genepool";
+ }
+
+ protected AbstractMod getMod()
+ {
+ return Genetics.instance;
+ }
+
+ protected String getName()
+ {
+ return "Genepool";
+ }
+}
diff --git a/src/Java/binnie/craftgui/genetics/machine/WindowGenomeAssembler.java b/src/Java/binnie/craftgui/genetics/machine/WindowGenomeAssembler.java
new file mode 100644
index 0000000000..d6e31c3c69
--- /dev/null
+++ b/src/Java/binnie/craftgui/genetics/machine/WindowGenomeAssembler.java
@@ -0,0 +1,37 @@
+package binnie.craftgui.genetics.machine;
+
+import binnie.core.AbstractMod;
+import binnie.craftgui.minecraft.Window;
+import binnie.genetics.Genetics;
+import cpw.mods.fml.relauncher.Side;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.IInventory;
+
+public class WindowGenomeAssembler
+ extends WindowMachine
+{
+ public static Window create(EntityPlayer player, IInventory inventory, Side side)
+ {
+ return new WindowGenomeAssembler(player, inventory, side);
+ }
+
+ public WindowGenomeAssembler(EntityPlayer player, IInventory inventory, Side side)
+ {
+ super(320, 240, player, inventory, side);
+ }
+
+ public String getTitle()
+ {
+ return "Genome Assembler";
+ }
+
+ protected AbstractMod getMod()
+ {
+ return Genetics.instance;
+ }
+
+ protected String getName()
+ {
+ return "GenomeAssembler";
+ }
+}
diff --git a/src/Java/binnie/craftgui/genetics/machine/WindowIncubator.java b/src/Java/binnie/craftgui/genetics/machine/WindowIncubator.java
new file mode 100644
index 0000000000..f52a0b1717
--- /dev/null
+++ b/src/Java/binnie/craftgui/genetics/machine/WindowIncubator.java
@@ -0,0 +1,99 @@
+package binnie.craftgui.genetics.machine;
+
+import binnie.core.AbstractMod;
+import binnie.craftgui.core.geometry.Position;
+import binnie.craftgui.minecraft.GUIIcon;
+import binnie.craftgui.minecraft.Window;
+import binnie.craftgui.minecraft.control.ControlEnergyBar;
+import binnie.craftgui.minecraft.control.ControlErrorState;
+import binnie.craftgui.minecraft.control.ControlIconDisplay;
+import binnie.craftgui.minecraft.control.ControlLiquidTank;
+import binnie.craftgui.minecraft.control.ControlMachineProgress;
+import binnie.craftgui.minecraft.control.ControlPlayerInventory;
+import binnie.craftgui.minecraft.control.ControlSlot;
+import binnie.craftgui.minecraft.control.ControlSlotArray;
+import binnie.craftgui.resource.Texture;
+import binnie.craftgui.resource.minecraft.StandardTexture;
+import binnie.genetics.Genetics;
+import binnie.genetics.core.GeneticsTexture;
+import binnie.genetics.machine.Incubator;
+import cpw.mods.fml.relauncher.Side;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.IInventory;
+
+public class WindowIncubator
+ extends WindowMachine
+{
+ public static Window create(EntityPlayer player, IInventory inventory, Side side)
+ {
+ return new WindowIncubator(player, inventory, side);
+ }
+
+ public WindowIncubator(EntityPlayer player, IInventory inventory, Side side)
+ {
+ super(228, 196, player, inventory, side);
+ }
+
+ static Texture ProgressBase = new StandardTexture(0, 91, 38, 32, GeneticsTexture.GUIProcess);
+ static Texture Progress = new StandardTexture(38, 91, 38, 32, GeneticsTexture.GUIProcess);
+
+ public void initialiseClient()
+ {
+ setTitle("Incubator");
+
+ int x = 16;
+ int y = 32;
+
+
+ new ControlLiquidTank(this, x, y).setTankID(0);
+
+ x += 26;
+
+ new ControlSlotArray(this, x, y + 3, 1, 3).create(Incubator.slotQueue);
+
+ x += 20;
+
+ new ControlIconDisplay(this, x, y + 3 + 10, GUIIcon.ArrowRight.getIcon());
+
+ x += 18;
+
+ new ControlMachineProgress(this, x, y + 6, ProgressBase, Progress, Position.Left);
+
+ new ControlSlot(this, x + 11, y + 3 + 10).assign(3);
+
+ x += 40;
+
+ new ControlIconDisplay(this, x, y + 3 + 10, GUIIcon.ArrowRight.getIcon());
+
+ x += 18;
+
+ new ControlSlotArray(this, x, y + 3, 1, 3).create(Incubator.slotOutput);
+
+ x += 26;
+
+ new ControlLiquidTank(this, x, y).setTankID(1);
+
+ x += 34;
+
+ new ControlEnergyBar(this, x, y + 3, 16, 54, Position.Bottom);
+
+ new ControlErrorState(this, 91.0F, 82.0F);
+
+ new ControlPlayerInventory(this);
+ }
+
+ public String getTitle()
+ {
+ return "Incubator";
+ }
+
+ protected AbstractMod getMod()
+ {
+ return Genetics.instance;
+ }
+
+ protected String getName()
+ {
+ return "Incubator";
+ }
+}
diff --git a/src/Java/binnie/craftgui/genetics/machine/WindowInoculator.java b/src/Java/binnie/craftgui/genetics/machine/WindowInoculator.java
new file mode 100644
index 0000000000..894170efd0
--- /dev/null
+++ b/src/Java/binnie/craftgui/genetics/machine/WindowInoculator.java
@@ -0,0 +1,107 @@
+package binnie.craftgui.genetics.machine;
+
+import binnie.core.AbstractMod;
+import binnie.craftgui.core.IWidget;
+import binnie.craftgui.core.geometry.CraftGUIUtil;
+import binnie.craftgui.core.geometry.Position;
+import binnie.craftgui.core.geometry.TextJustification;
+import binnie.craftgui.minecraft.GUIIcon;
+import binnie.craftgui.minecraft.Window;
+import binnie.craftgui.minecraft.control.ControlEnergyBar;
+import binnie.craftgui.minecraft.control.ControlErrorState;
+import binnie.craftgui.minecraft.control.ControlIconDisplay;
+import binnie.craftgui.minecraft.control.ControlLiquidTank;
+import binnie.craftgui.minecraft.control.ControlMachineProgress;
+import binnie.craftgui.minecraft.control.ControlPlayerInventory;
+import binnie.craftgui.minecraft.control.ControlSlot;
+import binnie.craftgui.minecraft.control.ControlSlotArray;
+import binnie.craftgui.resource.Texture;
+import binnie.craftgui.resource.minecraft.StandardTexture;
+import binnie.genetics.Genetics;
+import binnie.genetics.core.GeneticsTexture;
+import binnie.genetics.machine.Inoculator;
+import cpw.mods.fml.relauncher.Side;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.IInventory;
+
+public class WindowInoculator
+ extends WindowMachine
+{
+ public static Window create(EntityPlayer player, IInventory inventory, Side side)
+ {
+ return new WindowInoculator(player, inventory, side);
+ }
+
+ public WindowInoculator(EntityPlayer player, IInventory inventory, Side side)
+ {
+ super(266, 240, player, inventory, side);
+ }
+
+ static Texture ProgressBase = new StandardTexture(0, 72, 142, 72, GeneticsTexture.GUIProcess2.getTexture());
+ static Texture Progress = new StandardTexture(0, 0, 142, 72, GeneticsTexture.GUIProcess2.getTexture());
+
+ public void initialiseClient()
+ {
+ setTitle("Inoculator");
+
+ int x = 16;
+ int y = 32;
+
+
+ new ControlLiquidTank(this, x, y + 18 + 16).setTankID(0);
+
+
+ CraftGUIUtil.horizontalGrid(x, y, new IWidget[] { new ControlSlotArray(this, 0, 0, 2, 1).create(Inoculator.slotSerumReserve), new ControlIconDisplay(this, 0.0F, 0.0F, GUIIcon.ArrowRight.getIcon()), new ControlSlot(this, 0.0F, 0.0F).assign(0), new ControlIconDisplay(this, 0.0F, 0.0F, GUIIcon.ArrowRight.getIcon()), new ControlSlotArray(this, 0, 0, 2, 1).create(Inoculator.slotSerumExpended) });
+
+
+
+
+
+
+
+
+ x += 18;
+
+ new ControlMachineProgress(this, x, y + 24, ProgressBase, Progress, Position.Left);
+
+
+ new ControlEnergyBar(this, 91, 118, 60, 16, Position.Left);
+ new ControlErrorState(this, 161.0F, 118.0F);
+
+
+ x += 142;
+
+
+ CraftGUIUtil.verticalGrid(x, y, TextJustification.MiddleLeft, 8.0F, new IWidget[] { new ControlSlotArray(this, x, y, 4, 1).create(Inoculator.slotReserve), new ControlSlot(this, x, y + 18 + 8).assign(9), new ControlSlotArray(this, x, y + 18 + 8 + 18 + 8, 4, 1).create(Inoculator.slotFinished) });
+
+
+
+
+
+ new ControlIconDisplay(this, x + 18, y + 18 + 2, GUIIcon.ArrowUpLeft.getIcon());
+ new ControlIconDisplay(this, x + 18, y + 18 + 18, GUIIcon.ArrowLeftDown.getIcon());
+
+
+
+
+
+
+
+ new ControlPlayerInventory(this);
+ }
+
+ public String getTitle()
+ {
+ return "Inoculator";
+ }
+
+ protected AbstractMod getMod()
+ {
+ return Genetics.instance;
+ }
+
+ protected String getName()
+ {
+ return "Inoculator";
+ }
+}
diff --git a/src/Java/binnie/craftgui/genetics/machine/WindowIsolator.java b/src/Java/binnie/craftgui/genetics/machine/WindowIsolator.java
new file mode 100644
index 0000000000..6d494250ee
--- /dev/null
+++ b/src/Java/binnie/craftgui/genetics/machine/WindowIsolator.java
@@ -0,0 +1,116 @@
+package binnie.craftgui.genetics.machine;
+
+import binnie.core.AbstractMod;
+import binnie.craftgui.core.geometry.Position;
+import binnie.craftgui.minecraft.GUIIcon;
+import binnie.craftgui.minecraft.Window;
+import binnie.craftgui.minecraft.control.ControlEnergyBar;
+import binnie.craftgui.minecraft.control.ControlErrorState;
+import binnie.craftgui.minecraft.control.ControlIconDisplay;
+import binnie.craftgui.minecraft.control.ControlLiquidTank;
+import binnie.craftgui.minecraft.control.ControlPlayerInventory;
+import binnie.craftgui.minecraft.control.ControlProgress;
+import binnie.craftgui.minecraft.control.ControlSlot;
+import binnie.craftgui.minecraft.control.ControlSlotArray;
+import binnie.craftgui.minecraft.control.ControlSlotCharge;
+import binnie.craftgui.resource.Texture;
+import binnie.craftgui.resource.minecraft.StandardTexture;
+import binnie.extrabees.core.ExtraBeeTexture;
+import binnie.genetics.Genetics;
+import binnie.genetics.machine.Isolator;
+import cpw.mods.fml.relauncher.Side;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.IInventory;
+
+public class WindowIsolator
+ extends WindowMachine
+{
+ public static Window create(EntityPlayer player, IInventory inventory, Side side)
+ {
+ return new WindowIsolator(player, inventory, side);
+ }
+
+ static Texture ProgressBase = new StandardTexture(0, 218, 142, 17, ExtraBeeTexture.GUIProgress.getTexture());
+ static Texture Progress = new StandardTexture(0, 201, 142, 17, ExtraBeeTexture.GUIProgress.getTexture());
+
+ public WindowIsolator(EntityPlayer player, IInventory inventory, Side side)
+ {
+ super(330, 208, player, inventory, side);
+ }
+
+ public void initialiseClient()
+ {
+ setTitle("Isolator");
+
+ int x = 16;
+ int y = 32;
+
+ new ControlLiquidTank(this, x, y).setTankID(0);
+
+ x += 26;
+
+ new ControlSlotArray(this, x, y + 3, 1, 3).create(Isolator.slotReserve);
+
+ x += 20;
+
+ new ControlIconDisplay(this, x, y + 3 + 1, GUIIcon.ArrowRight.getIcon());
+
+ x += 18;
+
+ new ControlSlot(this, x, y + 3).assign(5);
+
+ new ControlSlot(this, x, y + 36 + 3).assign(0);
+ new ControlSlotCharge(this, x + 18 + 2, y + 36 + 3, 0).setColour(15722671);
+
+
+
+ x += 18;
+
+ new ControlProgress(this, x, y + 3, ProgressBase, Progress, Position.Left);
+
+ x += 142;
+
+ new ControlSlot(this, x, y + 3).assign(6);
+
+ new ControlSlot(this, x, y + 3 + 36).assign(1);
+
+ new ControlIconDisplay(this, x + 1, y + 3 + 19, GUIIcon.ArrowUp.getIcon());
+
+ x += 20;
+
+
+ new ControlIconDisplay(this, x, y + 3 + 1, GUIIcon.ArrowRight.getIcon());
+
+ x += 18;
+
+ new ControlSlotArray(this, x, y + 3, 2, 3).create(Isolator.slotFinished);
+
+
+ new ControlEnergyBar(this, 260, 130, 16, 60, Position.Bottom);
+
+
+
+
+
+
+
+ new ControlErrorState(this, 153.0F, 81.0F);
+
+ new ControlPlayerInventory(this);
+ }
+
+ public String getTitle()
+ {
+ return "Incubator";
+ }
+
+ protected AbstractMod getMod()
+ {
+ return Genetics.instance;
+ }
+
+ protected String getName()
+ {
+ return "Isolator";
+ }
+}
diff --git a/src/Java/binnie/craftgui/genetics/machine/WindowMachine.java b/src/Java/binnie/craftgui/genetics/machine/WindowMachine.java
new file mode 100644
index 0000000000..6b357a36d7
--- /dev/null
+++ b/src/Java/binnie/craftgui/genetics/machine/WindowMachine.java
@@ -0,0 +1,22 @@
+package binnie.craftgui.genetics.machine;
+
+import binnie.craftgui.minecraft.Window;
+import cpw.mods.fml.relauncher.Side;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.IInventory;
+
+public abstract class WindowMachine
+ extends Window
+{
+ public WindowMachine(int width, int height, EntityPlayer player, IInventory inventory, Side side)
+ {
+ super(width, height, player, inventory, side);
+ }
+
+ public abstract String getTitle();
+
+ public void initialiseClient()
+ {
+ setTitle(getTitle());
+ }
+}
diff --git a/src/Java/binnie/craftgui/genetics/machine/WindowPolymeriser.java b/src/Java/binnie/craftgui/genetics/machine/WindowPolymeriser.java
new file mode 100644
index 0000000000..edf9e371f7
--- /dev/null
+++ b/src/Java/binnie/craftgui/genetics/machine/WindowPolymeriser.java
@@ -0,0 +1,101 @@
+package binnie.craftgui.genetics.machine;
+
+import binnie.core.AbstractMod;
+import binnie.craftgui.core.geometry.Position;
+import binnie.craftgui.minecraft.GUIIcon;
+import binnie.craftgui.minecraft.Window;
+import binnie.craftgui.minecraft.control.ControlEnergyBar;
+import binnie.craftgui.minecraft.control.ControlErrorState;
+import binnie.craftgui.minecraft.control.ControlIconDisplay;
+import binnie.craftgui.minecraft.control.ControlLiquidTank;
+import binnie.craftgui.minecraft.control.ControlMachineProgress;
+import binnie.craftgui.minecraft.control.ControlPlayerInventory;
+import binnie.craftgui.minecraft.control.ControlSlot;
+import binnie.craftgui.minecraft.control.ControlSlotArray;
+import binnie.craftgui.minecraft.control.ControlSlotCharge;
+import binnie.craftgui.resource.Texture;
+import binnie.craftgui.resource.minecraft.StandardTexture;
+import binnie.genetics.Genetics;
+import binnie.genetics.core.GeneticsTexture;
+import binnie.genetics.machine.Polymeriser;
+import cpw.mods.fml.relauncher.Side;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.IInventory;
+
+public class WindowPolymeriser
+ extends WindowMachine
+{
+ public static Window create(EntityPlayer player, IInventory inventory, Side side)
+ {
+ return new WindowPolymeriser(player, inventory, side);
+ }
+
+ public WindowPolymeriser(EntityPlayer player, IInventory inventory, Side side)
+ {
+ super(278, 212, player, inventory, side);
+ }
+
+ static Texture ProgressBase = new StandardTexture(76, 170, 160, 79, GeneticsTexture.GUIProcess.getTexture());
+ static Texture Progress = new StandardTexture(76, 91, 160, 79, GeneticsTexture.GUIProcess.getTexture());
+
+ public void initialiseClient()
+ {
+ super.initialiseClient();
+
+ int x = 16;
+ int y = 38;
+
+
+
+
+
+ new ControlSlotArray(this, x, y, 1, 4).create(Polymeriser.slotSerumReserve);
+ new ControlIconDisplay(this, x + 18, y + 1, GUIIcon.ArrowRight.getIcon());
+
+ x += 34;
+
+ new ControlMachineProgress(this, x + 18, y - 6, ProgressBase, Progress, Position.Left);
+
+
+ new ControlSlot(this, x, y).assign(0);
+
+
+ new ControlLiquidTank(this, x, y + 18 + 16, true).setTankID(0);
+
+ new ControlLiquidTank(this, x, y + 18 + 16 + 18 + 8, true).setTankID(1);
+
+ new ControlEnergyBar(this, x + 120, 96, 64, 16, Position.Left);
+
+ x += 40;
+
+ new ControlSlot(this, x + 30, y + 18 + 8).assign(1);
+ new ControlSlotCharge(this, x + 30 + 20, y + 18 + 8, 1).setColour(16766976);
+
+
+
+
+ x += 138;
+
+ new ControlSlotArray(this, x, y + 9, 2, 2).create(Polymeriser.slotSerumFinished);
+
+ ControlErrorState errorState = new ControlErrorState(this, 244.0F, 97.0F);
+
+
+ new ControlPlayerInventory(this);
+ }
+
+ public String getTitle()
+ {
+ return "Polymeriser";
+ }
+
+ protected AbstractMod getMod()
+ {
+ return Genetics.instance;
+ }
+
+ protected String getName()
+ {
+ return "Polymeriser";
+ }
+}
diff --git a/src/Java/binnie/craftgui/genetics/machine/WindowSequencer.java b/src/Java/binnie/craftgui/genetics/machine/WindowSequencer.java
new file mode 100644
index 0000000000..9e2f580b53
--- /dev/null
+++ b/src/Java/binnie/craftgui/genetics/machine/WindowSequencer.java
@@ -0,0 +1,116 @@
+package binnie.craftgui.genetics.machine;
+
+import binnie.core.AbstractMod;
+import binnie.craftgui.controls.ControlText;
+import binnie.craftgui.core.IWidget;
+import binnie.craftgui.core.geometry.CraftGUIUtil;
+import binnie.craftgui.core.geometry.IArea;
+import binnie.craftgui.core.geometry.Position;
+import binnie.craftgui.core.geometry.TextJustification;
+import binnie.craftgui.minecraft.GUIIcon;
+import binnie.craftgui.minecraft.Window;
+import binnie.craftgui.minecraft.control.ControlEnergyBar;
+import binnie.craftgui.minecraft.control.ControlErrorState;
+import binnie.craftgui.minecraft.control.ControlIconDisplay;
+import binnie.craftgui.minecraft.control.ControlPlayerInventory;
+import binnie.craftgui.minecraft.control.ControlSlot;
+import binnie.craftgui.minecraft.control.ControlSlotArray;
+import binnie.craftgui.minecraft.control.ControlSlotCharge;
+import binnie.craftgui.resource.Texture;
+import binnie.craftgui.resource.minecraft.StandardTexture;
+import binnie.extrabees.core.ExtraBeeTexture;
+import binnie.genetics.Genetics;
+import binnie.genetics.machine.Sequencer;
+import cpw.mods.fml.relauncher.Side;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.nbt.NBTTagCompound;
+
+public class WindowSequencer
+ extends WindowMachine
+{
+ public static Window create(EntityPlayer player, IInventory inventory, Side side)
+ {
+ return new WindowSequencer(player, inventory, side);
+ }
+
+ public WindowSequencer(EntityPlayer player, IInventory inventory, Side side)
+ {
+ super(226, 224, player, inventory, side);
+ }
+
+ static Texture ProgressBase = new StandardTexture(64, 114, 98, 9, ExtraBeeTexture.GUIProgress.getTexture());
+ static Texture Progress = new StandardTexture(64, 123, 98, 9, ExtraBeeTexture.GUIProgress.getTexture());
+ ControlText slotText;
+
+ public void recieveGuiNBT(Side side, EntityPlayer player, String name, NBTTagCompound action)
+ {
+ if ((side == Side.CLIENT) && (name.equals("username"))) {
+ this.slotText.setValue("§8Genes will be sequenced by " + action.getString("username"));
+ }
+ super.recieveGuiNBT(side, player, name, action);
+ }
+
+ public void initialiseClient()
+ {
+ setTitle("Sequencer");
+
+
+ int x = 16;
+ int y = 32;
+
+
+
+
+ CraftGUIUtil.horizontalGrid(x, y, TextJustification.MiddleCenter, 2.0F, new IWidget[] { new ControlSlotArray(this, 0, 0, 2, 2).create(Sequencer.slotReserve), new ControlIconDisplay(this, 0.0F, 0.0F, GUIIcon.ArrowRight.getIcon()), new ControlSequencerProgress(this, 0, 0), new ControlIconDisplay(this, 0.0F, 0.0F, GUIIcon.ArrowRight.getIcon()), new ControlSlot(this, 0.0F, 0.0F).assign(6) });
+
+
+
+
+
+
+
+
+ ControlSlot slotTarget = new ControlSlot(this, x + 96, y + 16);
+ slotTarget.assign(5);
+
+ x = 34;
+ y = 92;
+
+ this.slotText = new ControlText(this, new IArea(0.0F, y, w(), 12.0F), "§8Userless. Will not save sequences", TextJustification.MiddleCenter);
+
+
+
+ y += 20;
+
+ ControlSlot slotDye = new ControlSlot(this, x, y);
+ slotDye.assign(0);
+ x += 20;
+ new ControlSlotCharge(this, x, y, 0).setColour(16750848);
+
+ x += 32;
+ new ControlEnergyBar(this, x, y, 60, 16, Position.Left);
+
+ x += 92;
+ ControlErrorState errorState = new ControlErrorState(this, x, y + 1);
+
+
+
+ new ControlPlayerInventory(this);
+ }
+
+ public String getTitle()
+ {
+ return "Incubator";
+ }
+
+ protected AbstractMod getMod()
+ {
+ return Genetics.instance;
+ }
+
+ protected String getName()
+ {
+ return "Sequencer";
+ }
+}
diff --git a/src/Java/binnie/craftgui/genetics/machine/WindowSplicer.java b/src/Java/binnie/craftgui/genetics/machine/WindowSplicer.java
new file mode 100644
index 0000000000..23d7cd8015
--- /dev/null
+++ b/src/Java/binnie/craftgui/genetics/machine/WindowSplicer.java
@@ -0,0 +1,93 @@
+package binnie.craftgui.genetics.machine;
+
+import binnie.core.AbstractMod;
+import binnie.craftgui.core.IWidget;
+import binnie.craftgui.core.geometry.CraftGUIUtil;
+import binnie.craftgui.core.geometry.Position;
+import binnie.craftgui.core.geometry.TextJustification;
+import binnie.craftgui.minecraft.GUIIcon;
+import binnie.craftgui.minecraft.Window;
+import binnie.craftgui.minecraft.control.ControlEnergyBar;
+import binnie.craftgui.minecraft.control.ControlErrorState;
+import binnie.craftgui.minecraft.control.ControlIconDisplay;
+import binnie.craftgui.minecraft.control.ControlPlayerInventory;
+import binnie.craftgui.minecraft.control.ControlSlot;
+import binnie.craftgui.minecraft.control.ControlSlotArray;
+import binnie.craftgui.resource.Texture;
+import binnie.craftgui.resource.minecraft.StandardTexture;
+import binnie.genetics.Genetics;
+import binnie.genetics.core.GeneticsTexture;
+import binnie.genetics.machine.Inoculator;
+import binnie.genetics.machine.Splicer;
+import cpw.mods.fml.relauncher.Side;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.IInventory;
+
+public class WindowSplicer
+ extends WindowMachine
+{
+ public static Window create(EntityPlayer player, IInventory inventory, Side side)
+ {
+ return new WindowSplicer(player, inventory, side);
+ }
+
+ public WindowSplicer(EntityPlayer player, IInventory inventory, Side side)
+ {
+ super(280, 240, player, inventory, side);
+ }
+
+ static Texture ProgressBase = new StandardTexture(0, 72, 142, 72, GeneticsTexture.GUIProcess2.getTexture());
+ static Texture Progress = new StandardTexture(0, 0, 142, 72, GeneticsTexture.GUIProcess2.getTexture());
+
+ public void initialiseClient()
+ {
+ setTitle("Splicer");
+
+ int x = 16;
+
+
+
+
+ new ControlSplicerProgress(this, 84.0F, 32.0F, w() - 172.0F, 102.0F);
+
+ CraftGUIUtil.horizontalGrid(x, 62.0F, new IWidget[] { new ControlSlotArray(this, 0, 0, 2, 1).create(Splicer.slotSerumReserve), new ControlIconDisplay(this, 0.0F, 0.0F, GUIIcon.ArrowRight.getIcon()), new ControlSlot(this, 0.0F, 0.0F).assign(0) });
+
+
+
+
+ new ControlSlotArray(this, x + 12, 84, 2, 1).create(Splicer.slotSerumExpended);
+
+ new ControlIconDisplay(this, x + 12 + 36 + 4, 86.0F, GUIIcon.ArrowUpLeft.getIcon());
+
+
+
+ new ControlEnergyBar(this, 196, 64, 60, 16, Position.Left);
+ new ControlErrorState(this, 218.0F, 86.0F);
+
+ x += 142;
+
+ CraftGUIUtil.verticalGrid((w() - 72.0F) / 2.0F, 32.0F, TextJustification.MiddleCenter, 4.0F, new IWidget[] { new ControlSlotArray(this, 0, 0, 4, 1).create(Inoculator.slotReserve), new ControlIconDisplay(this, 0.0F, 0.0F, GUIIcon.ArrowDown.getIcon()), new ControlSlot(this, 0.0F, 0.0F).assign(9), new ControlIconDisplay(this, 0.0F, 0.0F, GUIIcon.ArrowDown.getIcon()), new ControlSlotArray(this, 0, 0, 4, 1).create(Inoculator.slotFinished) });
+
+
+
+
+
+
+ new ControlPlayerInventory(this);
+ }
+
+ public String getTitle()
+ {
+ return "Inoculator";
+ }
+
+ protected AbstractMod getMod()
+ {
+ return Genetics.instance;
+ }
+
+ protected String getName()
+ {
+ return "Inoculator";
+ }
+}
diff --git a/src/Java/binnie/craftgui/minecraft/ContainerCraftGUI.java b/src/Java/binnie/craftgui/minecraft/ContainerCraftGUI.java
new file mode 100644
index 0000000000..9b6a2809d9
--- /dev/null
+++ b/src/Java/binnie/craftgui/minecraft/ContainerCraftGUI.java
@@ -0,0 +1,549 @@
+package binnie.craftgui.minecraft;
+
+import binnie.core.BinnieCore;
+import binnie.core.machines.IMachine;
+import binnie.core.machines.Machine;
+import binnie.core.machines.network.INetwork.RecieveGuiNBT;
+import binnie.core.machines.network.INetwork.SendGuiNBT;
+import binnie.core.machines.power.ErrorState;
+import binnie.core.machines.power.IErrorStateSource;
+import binnie.core.machines.power.IPoweredMachine;
+import binnie.core.machines.power.IProcess;
+import binnie.core.machines.power.ITankMachine;
+import binnie.core.machines.power.PowerInfo;
+import binnie.core.machines.power.ProcessInfo;
+import binnie.core.machines.power.TankInfo;
+import binnie.core.machines.transfer.TransferRequest;
+import binnie.core.machines.transfer.TransferRequest.TransferSlot;
+import binnie.core.network.packet.MessageContainerUpdate;
+import binnie.core.proxy.BinnieProxy;
+import binnie.craftgui.minecraft.control.ControlSlot;
+import binnie.craftgui.minecraft.control.EnumHighlighting;
+import com.mojang.authlib.GameProfile;
+import cpw.mods.fml.relauncher.Side;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+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.inventory.Slot;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+
+public class ContainerCraftGUI
+ extends Container
+{
+ private Window window;
+
+ public ContainerCraftGUI(Window window)
+ {
+ this.window = window;
+ IMachine machine = Machine.getMachine(window.getInventory());
+ if (getSide() == Side.SERVER)
+ {
+ this.inventoryItemStacks = new ListMap();
+ this.inventorySlots = new ListMap();
+ if (machine != null)
+ {
+ GameProfile user = machine.getOwner();
+ if (user != null)
+ {
+ NBTTagCompound nbt = new NBTTagCompound();
+ nbt.setString("username", user.getName());
+ sendNBTToClient("username", nbt);
+ }
+ }
+ }
+ }
+
+ protected Slot addSlotToContainer(Slot slot)
+ {
+ return super.addSlotToContainer(slot);
+ }
+
+ private Side getSide()
+ {
+ return this.window.isServer() ? Side.SERVER : Side.CLIENT;
+ }
+
+ public Slot getSlot(int par1)
+ {
+ if ((par1 < 0) || (par1 >= this.inventorySlots.size())) {
+ return null;
+ }
+ return (Slot)this.inventorySlots.get(par1);
+ }
+
+ public void putStackInSlot(int par1, ItemStack par2ItemStack)
+ {
+ if (getSlot(par1) != null) {
+ getSlot(par1).putStack(par2ItemStack);
+ }
+ }
+
+ public void putStacksInSlots(ItemStack[] par1ArrayOfItemStack)
+ {
+ for (int i = 0; i < par1ArrayOfItemStack.length; i++) {
+ if (getSlot(i) != null) {
+ getSlot(i).putStack(par1ArrayOfItemStack[i]);
+ }
+ }
+ }
+
+ public void onContainerClosed(EntityPlayer par1EntityPlayer)
+ {
+ super.onContainerClosed(par1EntityPlayer);
+
+ WindowInventory inventory = this.window.getWindowInventory();
+ for (int i = 0; i < inventory.getSizeInventory(); i++) {
+ if (inventory.dispenseOnClose(i))
+ {
+ ItemStack stack = inventory.getStackInSlot(i);
+ if (stack != null)
+ {
+ stack = new TransferRequest(stack, par1EntityPlayer.inventory).transfer(true);
+ if (stack != null) {
+ par1EntityPlayer.dropPlayerItemWithRandomChoice(stack, false);
+ }
+ }
+ }
+ }
+ }
+
+ public ItemStack slotClick(int slotNum, int mouseButton, int modifier, EntityPlayer player)
+ {
+ Slot slot = getSlot(slotNum);
+ if (((slot instanceof CustomSlot)) && (((CustomSlot)slot).handleClick()))
+ {
+ ((CustomSlot)slot).onSlotClick(this, mouseButton, modifier, player);
+ return player.inventory.getItemStack();
+ }
+ ItemStack stack = super.slotClick(slotNum, mouseButton, modifier, player);
+ return stack;
+ }
+
+ public void sendNBTToClient(String key, NBTTagCompound nbt)
+ {
+ this.syncedNBT.put(key, nbt);
+ }
+
+ public boolean canInteractWith(EntityPlayer var1)
+ {
+ return true;
+ }
+
+ public final ItemStack transferStackInSlot(EntityPlayer player, int slotID)
+ {
+ return shiftClick(player, slotID);
+ }
+
+ private ItemStack shiftClick(EntityPlayer player, int slotnumber)
+ {
+ TransferRequest request = getShiftClickRequest(player, slotnumber);
+ if (request == null) {
+ return null;
+ }
+ ItemStack itemstack = request.transfer(true);
+ Slot shiftClickedSlot = (Slot)this.inventorySlots.get(slotnumber);
+
+ shiftClickedSlot.putStack(itemstack);
+ shiftClickedSlot.onSlotChanged();
+
+ return null;
+ }
+
+ private TransferRequest getShiftClickRequest(EntityPlayer player, int slotnumber)
+ {
+ if (slotnumber < 0) {
+ return null;
+ }
+ Slot shiftClickedSlot = (Slot)this.inventorySlots.get(slotnumber);
+
+ ItemStack itemstack = null;
+ if (shiftClickedSlot.getHasStack()) {
+ itemstack = shiftClickedSlot.getStack().copy();
+ }
+ IInventory playerInventory = player.inventory;
+ IInventory containerInventory = this.window.getInventory();
+ IInventory windowInventory = this.window.getWindowInventory();
+
+ IInventory fromPlayer = containerInventory == null ? windowInventory : containerInventory;
+
+ int[] target = new int[36];
+ for (int i = 0; i < 36; i++) {
+ target[i] = i;
+ }
+ TransferRequest request;
+ TransferRequest request;
+ if (shiftClickedSlot.inventory == playerInventory) {
+ request = new TransferRequest(itemstack, fromPlayer).setOrigin(shiftClickedSlot.inventory);
+ } else {
+ request = new TransferRequest(itemstack, playerInventory).setOrigin(shiftClickedSlot.inventory).setTargetSlots(target);
+ }
+ if ((this.window instanceof IWindowAffectsShiftClick)) {
+ ((IWindowAffectsShiftClick)this.window).alterRequest(request);
+ }
+ return request;
+ }
+
+ public final ItemStack tankClick(EntityPlayer player, int slotID)
+ {
+ if (player.inventory.getItemStack() == null) {
+ return null;
+ }
+ ItemStack heldItem = player.inventory.getItemStack().copy();
+
+ heldItem = new TransferRequest(heldItem, this.window.getInventory()).setOrigin(player.inventory).setTargetSlots(new int[0]).setTargetTanks(new int[] { slotID }).transfer(true);
+
+
+ player.inventory.setItemStack(heldItem);
+ if ((player instanceof EntityPlayerMP)) {
+ ((EntityPlayerMP)player).updateHeldItem();
+ }
+ return heldItem;
+ }
+
+ public boolean handleNBT(Side side, EntityPlayer player, String name, NBTTagCompound action)
+ {
+ if (side == Side.SERVER)
+ {
+ if (name.equals("tank-click")) {
+ tankClick(player, action.getByte("id"));
+ }
+ if (name.equals("slot-reg"))
+ {
+ int type = action.getByte("t");
+ int index = action.getShort("i");
+ int slotNumber = action.getShort("n");
+ getOrCreateSlot(InventoryType.values()[(type % 4)], index, slotNumber);
+ }
+ }
+ if (name.contains("tank-update")) {
+ onTankUpdate(action);
+ } else if (name.equals("power-update")) {
+ onPowerUpdate(action);
+ } else if (name.equals("process-update")) {
+ onProcessUpdate(action);
+ } else if (name.equals("error-update")) {
+ onErrorUpdate(action);
+ } else if (name.equals("mouse-over-slot")) {
+ onMouseOverSlot(player, action);
+ } else if (name.equals("shift-click-info")) {
+ onRecieveShiftClickHighlights(player, action);
+ }
+ return false;
+ }
+
+ private Map<String, NBTTagCompound> syncedNBT = new HashMap();
+ private Map<String, NBTTagCompound> sentNBT = new HashMap();
+
+ public void detectAndSendChanges()
+ {
+ super.detectAndSendChanges();
+
+
+
+
+ ITankMachine tanks = (ITankMachine)Machine.getInterface(ITankMachine.class, this.window.getInventory());
+ IPoweredMachine powered = (IPoweredMachine)Machine.getInterface(IPoweredMachine.class, this.window.getInventory());
+ IErrorStateSource error = (IErrorStateSource)Machine.getInterface(IErrorStateSource.class, this.window.getInventory());
+ IProcess process = (IProcess)Machine.getInterface(IProcess.class, this.window.getInventory());
+ if ((tanks != null) && (this.window.isServer())) {
+ for (int i = 0; i < tanks.getTankInfos().length; i++)
+ {
+ TankInfo tank = tanks.getTankInfos()[i];
+ if (!getTankInfo(i).equals(tank))
+ {
+ this.syncedNBT.put("tank-update-" + i, createTankNBT(i, tank));
+
+ this.syncedTanks.put(Integer.valueOf(i), tank);
+ }
+ }
+ }
+ if ((powered != null) && (this.window.isServer())) {
+ this.syncedNBT.put("power-update", createPowerNBT(powered.getPowerInfo()));
+ }
+ if ((process != null) && (this.window.isServer())) {
+ this.syncedNBT.put("process-update", createProcessNBT(process.getInfo()));
+ }
+ if ((error != null) && (this.window.isServer())) {
+ this.syncedNBT.put("error-update", createErrorNBT(error));
+ }
+ INetwork.SendGuiNBT machineSync = (INetwork.SendGuiNBT)Machine.getInterface(INetwork.SendGuiNBT.class, this.window.getInventory());
+ if (machineSync != null) {
+ machineSync.sendGuiNBT(this.syncedNBT);
+ }
+ Map<String, NBTTagCompound> sentThisTime = new HashMap();
+ for (Map.Entry<String, NBTTagCompound> nbt : this.syncedNBT.entrySet())
+ {
+ ((NBTTagCompound)nbt.getValue()).setString("type", (String)nbt.getKey());
+
+
+
+
+
+
+ boolean shouldSend = true;
+ NBTTagCompound lastSent = (NBTTagCompound)this.sentNBT.get(nbt.getKey());
+ if (lastSent != null) {
+ shouldSend = !lastSent.equals(nbt.getValue());
+ }
+ if (shouldSend)
+ {
+ for (int j = 0; j < this.crafters.size(); j++) {
+ if ((this.crafters.get(j) instanceof EntityPlayerMP))
+ {
+ EntityPlayerMP player = (EntityPlayerMP)this.crafters.get(j);
+ BinnieCore.proxy.sendToPlayer(new MessageContainerUpdate((NBTTagCompound)nbt.getValue()), player);
+ }
+ }
+ sentThisTime.put(nbt.getKey(), nbt.getValue());
+ }
+ }
+ this.sentNBT.putAll(sentThisTime);
+
+ this.syncedNBT.clear();
+ }
+
+ private NBTTagCompound createErrorNBT(IErrorStateSource error)
+ {
+ NBTTagCompound nbt = new NBTTagCompound();
+ ErrorState state = null;
+ if (error.canWork() != null)
+ {
+ nbt.setByte("type", (byte)0);
+ state = error.canWork();
+ }
+ else if (error.canProgress() != null)
+ {
+ nbt.setByte("type", (byte)1);
+ state = error.canProgress();
+ }
+ if (state != null) {
+ state.writeToNBT(nbt);
+ }
+ return nbt;
+ }
+
+ public NBTTagCompound createPowerNBT(PowerInfo powerInfo)
+ {
+ NBTTagCompound nbt = new NBTTagCompound();
+ powerInfo.writeToNBT(nbt);
+ return nbt;
+ }
+
+ public NBTTagCompound createProcessNBT(ProcessInfo powerInfo)
+ {
+ NBTTagCompound nbt = new NBTTagCompound();
+ powerInfo.writeToNBT(nbt);
+ return nbt;
+ }
+
+ public NBTTagCompound createTankNBT(int tank, TankInfo tankInfo)
+ {
+ NBTTagCompound nbt = new NBTTagCompound();
+ tankInfo.writeToNBT(nbt);
+ nbt.setByte("tank", (byte)tank);
+ return nbt;
+ }
+
+ private Map<Integer, TankInfo> syncedTanks = new HashMap();
+ private PowerInfo syncedPower = new PowerInfo();
+ private ProcessInfo syncedProcess = new ProcessInfo();
+ private int errorType = 0;
+ private ErrorState error = null;
+
+ public void onTankUpdate(NBTTagCompound nbt)
+ {
+ int tankID = nbt.getByte("tank");
+ TankInfo tank = new TankInfo();
+ tank.readFromNBT(nbt);
+ this.syncedTanks.put(Integer.valueOf(tankID), tank);
+ }
+
+ public void onProcessUpdate(NBTTagCompound nbt)
+ {
+ this.syncedProcess = new ProcessInfo();
+ this.syncedProcess.readFromNBT(nbt);
+ }
+
+ public void onPowerUpdate(NBTTagCompound nbt)
+ {
+ this.syncedPower = new PowerInfo();
+ this.syncedPower.readFromNBT(nbt);
+ }
+
+ public PowerInfo getPowerInfo()
+ {
+ return this.syncedPower;
+ }
+
+ public ProcessInfo getProcessInfo()
+ {
+ return this.syncedProcess;
+ }
+
+ public TankInfo getTankInfo(int tank)
+ {
+ return this.syncedTanks.containsKey(Integer.valueOf(tank)) ? (TankInfo)this.syncedTanks.get(Integer.valueOf(tank)) : new TankInfo();
+ }
+
+ public void onErrorUpdate(NBTTagCompound nbt)
+ {
+ this.errorType = nbt.getByte("type");
+ if (nbt.hasKey("name"))
+ {
+ this.error = new ErrorState("", "");
+ this.error.readFromNBT(nbt);
+ }
+ else
+ {
+ this.error = null;
+ }
+ }
+
+ public ErrorState getErrorState()
+ {
+ return this.error;
+ }
+
+ public int getErrorType()
+ {
+ return this.errorType;
+ }
+
+ public CustomSlot[] getCustomSlots()
+ {
+ List<CustomSlot> slots = new ArrayList();
+ for (Object object : this.inventorySlots) {
+ if ((object instanceof CustomSlot)) {
+ slots.add((CustomSlot)object);
+ }
+ }
+ return (CustomSlot[])slots.toArray(new CustomSlot[0]);
+ }
+
+ private int mousedOverSlotNumber = -1;
+
+ public void setMouseOverSlot(Slot slot)
+ {
+ if (slot.slotNumber != this.mousedOverSlotNumber)
+ {
+ this.mousedOverSlotNumber = slot.slotNumber;
+ ((List)ControlSlot.highlighting.get(EnumHighlighting.ShiftClick)).clear();
+ NBTTagCompound nbt = new NBTTagCompound();
+ nbt.setShort("slot", (short)slot.slotNumber);
+ this.window.sendClientAction("mouse-over-slot", nbt);
+ }
+ }
+
+ private void onMouseOverSlot(EntityPlayer player, NBTTagCompound data)
+ {
+ int slotnumber = data.getShort("slot");
+ TransferRequest request = getShiftClickRequest(player, slotnumber);
+ if (request == null) {
+ return;
+ }
+ request.transfer(false);
+ NBTTagCompound nbt = new NBTTagCompound();
+
+ List<Integer> slots = new ArrayList();
+ for (TransferRequest.TransferSlot tslot : request.getInsertedSlots())
+ {
+ Slot slot = getSlot(tslot.inventory, tslot.id);
+ if (slot != null) {
+ slots.add(Integer.valueOf(slot.slotNumber));
+ }
+ }
+ int[] array = new int[slots.size()];
+ for (int i = 0; i < slots.size(); i++) {
+ array[i] = ((Integer)slots.get(i)).intValue();
+ }
+ nbt.setIntArray("slots", array);
+ nbt.setShort("origin", (short)slotnumber);
+
+ this.syncedNBT.put("shift-click-info", nbt);
+ }
+
+ private void onRecieveShiftClickHighlights(EntityPlayer player, NBTTagCompound data)
+ {
+ ((List)ControlSlot.highlighting.get(EnumHighlighting.ShiftClick)).clear();
+ for (int slotnumber : data.getIntArray("slots")) {
+ ((List)ControlSlot.highlighting.get(EnumHighlighting.ShiftClick)).add(Integer.valueOf(slotnumber));
+ }
+ }
+
+ private CustomSlot getSlot(IInventory inventory, int id)
+ {
+ for (Object o : this.inventorySlots)
+ {
+ CustomSlot slot = (CustomSlot)o;
+ if ((slot.inventory == inventory) && (slot.getSlotIndex() == id)) {
+ return slot;
+ }
+ }
+ return null;
+ }
+
+ public void recieveNBT(Side side, EntityPlayer player, NBTTagCompound action)
+ {
+ String name = action.getString("type");
+ if (handleNBT(side, player, name, action)) {
+ return;
+ }
+ this.window.recieveGuiNBT(getSide(), player, name, action);
+ INetwork.RecieveGuiNBT machine = (INetwork.RecieveGuiNBT)Machine.getInterface(INetwork.RecieveGuiNBT.class, this.window.getInventory());
+ if (machine != null) {
+ machine.recieveGuiNBT(getSide(), player, name, action);
+ }
+ }
+
+ public Slot getOrCreateSlot(InventoryType type, int index)
+ {
+ IInventory inventory = getInventory(type);
+ Slot slot = getSlot(inventory, index);
+ if (slot == null)
+ {
+ slot = new CustomSlot(inventory, index);
+ addSlotToContainer(slot);
+ }
+ NBTTagCompound nbt = new NBTTagCompound();
+ nbt.setByte("t", (byte)type.ordinal());
+ nbt.setShort("i", (short)index);
+ nbt.setShort("n", (short)slot.slotNumber);
+ this.window.sendClientAction("slot-reg", nbt);
+ return slot;
+ }
+
+ protected IInventory getInventory(InventoryType type)
+ {
+ if (type == InventoryType.Machine) {
+ return this.window.getInventory();
+ }
+ if (type == InventoryType.Player) {
+ return this.window.getPlayer().inventory;
+ }
+ if (type == InventoryType.Window) {
+ return this.window.getWindowInventory();
+ }
+ return null;
+ }
+
+ private Slot getOrCreateSlot(InventoryType type, int index, int slotNumber)
+ {
+ IInventory inventory = getInventory(type);
+ if (this.inventorySlots.get(slotNumber) != null) {
+ return null;
+ }
+ Slot slot = new CustomSlot(inventory, index);
+ slot.slotNumber = slotNumber;
+ this.inventorySlots.add(slotNumber, slot);
+ this.inventoryItemStacks.add(slotNumber, (Object)null);
+ return slot;
+ }
+}
diff --git a/src/Java/binnie/craftgui/minecraft/CustomSlot.java b/src/Java/binnie/craftgui/minecraft/CustomSlot.java
new file mode 100644
index 0000000000..ae45ffb3fd
--- /dev/null
+++ b/src/Java/binnie/craftgui/minecraft/CustomSlot.java
@@ -0,0 +1,54 @@
+package binnie.craftgui.minecraft;
+
+import binnie.core.machines.Machine;
+import binnie.core.machines.inventory.IInventorySlots;
+import binnie.core.machines.inventory.InventorySlot;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemStack;
+
+public class CustomSlot
+ extends Slot
+{
+ public boolean isItemValid(ItemStack par1ItemStack)
+ {
+ return this.inventory.isItemValidForSlot(getSlotIndex(), par1ItemStack);
+ }
+
+ public CustomSlot(IInventory inventory, int index)
+ {
+ super(inventory, index, 0, 0);
+ }
+
+ public InventorySlot getInventorySlot()
+ {
+ IInventorySlots slots = (IInventorySlots)Machine.getInterface(IInventorySlots.class, this.inventory);
+ if (slots != null) {
+ return slots.getSlot(getSlotIndex());
+ }
+ return null;
+ }
+
+ public boolean handleClick()
+ {
+ InventorySlot slot = getInventorySlot();
+ return (slot != null) && (slot.isRecipe());
+ }
+
+ public void onSlotClick(ContainerCraftGUI container, int mouseButton, int modifier, EntityPlayer player)
+ {
+ ItemStack stack = player.inventory.getItemStack();
+ if ((stack == null) || (mouseButton == 2))
+ {
+ putStack(null);
+ }
+ else
+ {
+ stack = stack.copy();
+ stack.stackSize = 1;
+ putStack(stack);
+ }
+ }
+}
diff --git a/src/Java/binnie/craftgui/minecraft/Dialog.java b/src/Java/binnie/craftgui/minecraft/Dialog.java
new file mode 100644
index 0000000000..efd67dec25
--- /dev/null
+++ b/src/Java/binnie/craftgui/minecraft/Dialog.java
@@ -0,0 +1,53 @@
+package binnie.craftgui.minecraft;
+
+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.IArea;
+import binnie.craftgui.core.geometry.IPoint;
+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.resource.minecraft.CraftGUITexture;
+
+public abstract class Dialog
+ extends Control
+{
+ public Dialog(IWidget parent, float w, float h)
+ {
+ super(parent, (parent.w() - w) / 2.0F, (parent.h() - h) / 2.0F, w, h);
+ addAttribute(Attribute.MouseOver);
+ addAttribute(Attribute.AlwaysOnTop);
+ addAttribute(Attribute.BlockTooltip);
+ initialise();
+ addEventHandler(new EventMouse.Down.Handler()
+ {
+ public void onEvent(EventMouse.Down event)
+ {
+ if (!Dialog.this.getArea().contains(Dialog.this.getRelativeMousePosition()))
+ {
+ Dialog.this.onClose();
+ Dialog.this.getParent().deleteChild(Dialog.this);
+ }
+ }
+ }.setOrigin(EventHandler.Origin.Any, this));
+ }
+
+ public abstract void initialise();
+
+ public abstract void onClose();
+
+ public void onRenderBackground()
+ {
+ CraftGUI.Render.gradientRect(getArea().outset(400), -1442840576, -1442840576);
+ CraftGUI.Render.texture(CraftGUITexture.Window, getArea());
+ CraftGUI.Render.texture(CraftGUITexture.TabOutline, getArea().inset(4));
+ }
+
+ public boolean isMouseOverWidget(IPoint relativeMouse)
+ {
+ return true;
+ }
+}
diff --git a/src/Java/binnie/craftgui/minecraft/EnumColor.java b/src/Java/binnie/craftgui/minecraft/EnumColor.java
new file mode 100644
index 0000000000..e778cf31c8
--- /dev/null
+++ b/src/Java/binnie/craftgui/minecraft/EnumColor.java
@@ -0,0 +1,32 @@
+package binnie.craftgui.minecraft;
+
+public enum EnumColor
+{
+ Black("Black", 0, '0'), DarkBlue("Dark Blue", 170, '1'), DarkGreen("Dark Green", 43520, '2'), DarkAqua("Dark Aqua", 43690, '3'), DarkRed("Dark Red", 11141120, '4'), Purple("Purple", 11141290, '5'), Gold("Gold", 16755200, '6'), Grey("Grey", 11184810, '7'), DarkGrey("Dark Grey", 5592405, '8'), Blue("Blue", 5592575, '9'), Green("Green", 5635925, 'a'), Aqua("Aqua", 5636095, 'b'), Red("Red", 16733525, 'c'), Pink("Pink", 16733695, 'd'), Yellow("Yellow", 16777045, 'e'), White("White", 16777215, 'f');
+
+ int colour;
+ String name;
+ char code;
+
+ private EnumColor(String name, int colour, char code)
+ {
+ this.name = name;
+ this.colour = colour;
+ this.code = code;
+ }
+
+ public int getColour()
+ {
+ return this.colour;
+ }
+
+ public String getCode()
+ {
+ return "§" + this.code;
+ }
+
+ public String toString()
+ {
+ return this.name;
+ }
+}
diff --git a/src/Java/binnie/craftgui/minecraft/GUIIcon.java b/src/Java/binnie/craftgui/minecraft/GUIIcon.java
new file mode 100644
index 0000000000..96338b2551
--- /dev/null
+++ b/src/Java/binnie/craftgui/minecraft/GUIIcon.java
@@ -0,0 +1,30 @@
+package binnie.craftgui.minecraft;
+
+import binnie.Binnie;
+import binnie.core.BinnieCore;
+import binnie.core.resource.BinnieIcon;
+import binnie.core.resource.ManagerResource;
+import net.minecraft.util.IIcon;
+
+public enum GUIIcon
+{
+ ArrowUp("arrow-up"), ArrowDown("arrow-down"), ArrowLeft("arrow-left"), ArrowRight("arrow-right"), ArrowUpLeft("arrow-upleft"), ArrowUpRight("arrow-upright"), ArrowRightUp("arrow-rightup"), ArrowRightDown("arrow-rightdown"), ArrowDownRight("arrow-downright"), ArrowDownLeft("arrow-downleft"), ArrowLeftDown("arrow-leftdown"), ArrowLeftUp("arrow-leftup");
+
+ String path;
+ BinnieIcon icon;
+
+ private GUIIcon(String path)
+ {
+ this.path = path;
+ }
+
+ public void register()
+ {
+ this.icon = Binnie.Resource.getItemIcon(BinnieCore.instance, "gui/" + this.path);
+ }
+
+ public IIcon getIcon()
+ {
+ return this.icon.getIcon();
+ }
+}
diff --git a/src/Java/binnie/craftgui/minecraft/GuiCraftGUI.java b/src/Java/binnie/craftgui/minecraft/GuiCraftGUI.java
new file mode 100644
index 0000000000..bfd4a5f876
--- /dev/null
+++ b/src/Java/binnie/craftgui/minecraft/GuiCraftGUI.java
@@ -0,0 +1,605 @@
+package binnie.craftgui.minecraft;
+
+import binnie.core.BinnieCore;
+import binnie.core.proxy.BinnieProxy;
+import binnie.craftgui.core.CraftGUI;
+import binnie.craftgui.core.IWidget;
+import binnie.craftgui.core.Tooltip.Type;
+import binnie.craftgui.core.geometry.IArea;
+import binnie.craftgui.core.geometry.IBorder;
+import binnie.craftgui.core.geometry.IPoint;
+import binnie.craftgui.core.renderer.Renderer;
+import binnie.craftgui.events.EventKey.Down;
+import binnie.craftgui.events.EventMouse.Down;
+import binnie.craftgui.events.EventMouse.Up;
+import binnie.craftgui.events.EventMouse.Wheel;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.entity.EntityClientPlayerMP;
+import net.minecraft.client.gui.FontRenderer;
+import net.minecraft.client.gui.inventory.GuiContainer;
+import net.minecraft.client.renderer.OpenGlHelper;
+import net.minecraft.client.renderer.RenderHelper;
+import net.minecraft.client.renderer.Tessellator;
+import net.minecraft.client.renderer.entity.RenderItem;
+import net.minecraft.client.settings.GameSettings;
+import net.minecraft.client.settings.KeyBinding;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.JsonToNBT;
+import net.minecraft.nbt.NBTException;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.IIcon;
+import net.minecraft.util.ResourceLocation;
+import org.lwjgl.input.Keyboard;
+import org.lwjgl.input.Mouse;
+import org.lwjgl.opengl.GL11;
+
+@SideOnly(Side.CLIENT)
+public class GuiCraftGUI
+ extends GuiContainer
+{
+ IPoint mousePos = new IPoint(0.0F, 0.0F);
+ private Window window;
+ private ItemStack draggedItem;
+
+ public void updateScreen()
+ {
+ this.window.updateClient();
+ }
+
+ public Minecraft getMinecraft()
+ {
+ return this.mc;
+ }
+
+ public GuiCraftGUI(Window window)
+ {
+ super(window.getContainer());
+ this.window = window;
+ resize(window.getSize());
+ }
+
+ protected void drawGuiContainerBackgroundLayer(float var1, int var2, int var3) {}
+
+ public void initGui()
+ {
+ super.initGui();
+ this.mc.thePlayer.openContainer = this.inventorySlots;
+ this.guiLeft = ((this.width - this.xSize) / 2);
+ this.guiTop = ((this.height - this.ySize) / 2);
+ this.window.setSize(new IPoint(this.xSize, this.ySize));
+ this.window.setPosition(new IPoint(this.guiLeft, this.guiTop));
+ this.window.initGui();
+ }
+
+ public ItemStack getDraggedItem()
+ {
+ return this.draggedItem;
+ }
+
+ public void drawScreen(int mouseX, int mouseY, float par3)
+ {
+ this.window.setMousePosition(mouseX - (int)this.window.getPosition().x(), mouseY - (int)this.window.getPosition().y());
+
+
+ drawDefaultBackground();
+
+
+ GL11.glDisable(32826);
+ RenderHelper.disableStandardItemLighting();
+ GL11.glDisable(2896);
+ GL11.glDisable(2929);
+
+ this.zLevel = 10.0F;
+ itemRender.zLevel = this.zLevel;
+
+ this.window.render();
+
+
+ RenderHelper.enableGUIStandardItemLighting();
+ GL11.glPushMatrix();
+ GL11.glEnable(32826);
+ OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240.0F, 240.0F);
+
+
+
+
+
+ InventoryPlayer playerInventory = this.mc.thePlayer.inventory;
+ this.draggedItem = playerInventory.getItemStack();
+ if (this.draggedItem != null)
+ {
+ renderItem(new IPoint(mouseX - 8, mouseY - 8), this.draggedItem, 200, false);
+ renderItem(new IPoint(mouseX - 8, mouseY - 8), this.draggedItem, 200, false);
+ }
+ GL11.glDisable(32826);
+ GL11.glPopMatrix();
+
+
+
+
+
+ GL11.glDisable(2896);
+ GL11.glDisable(2929);
+
+
+ MinecraftTooltip tooltip = new MinecraftTooltip();
+ if (isHelpMode())
+ {
+ tooltip.setType(Tooltip.Type.Help);
+ this.window.getHelpTooltip(tooltip);
+ }
+ else
+ {
+ tooltip.setType(Tooltip.Type.Standard);
+ this.window.getTooltip(tooltip);
+ }
+ if (tooltip.exists()) {
+ renderTooltip(new IPoint(mouseX, mouseY), tooltip);
+ }
+ this.zLevel = 0.0F;
+
+ GL11.glEnable(2896);
+ GL11.glEnable(2929);
+ }
+
+ public void renderTooltip(IPoint mousePosition, MinecraftTooltip tooltip)
+ {
+ int mouseX = (int)mousePosition.x();
+ int mouseY = (int)mousePosition.y();
+ FontRenderer font = getFontRenderer();
+ GL11.glDisable(32826);
+ RenderHelper.disableStandardItemLighting();
+ GL11.glDisable(2896);
+ GL11.glDisable(2929);
+ int k = 0;
+
+ List<String> strings = new ArrayList();
+ for (String string : tooltip.getList()) {
+ if (string != null) {
+ if (!string.contains("~~~")) {
+ strings.addAll(font.listFormattedStringToWidth(string, tooltip.maxWidth));
+ } else {
+ strings.add(string);
+ }
+ }
+ }
+ Iterator iterator = strings.iterator();
+ while (iterator.hasNext())
+ {
+ String s = (String)iterator.next();
+ int l = font.getStringWidth(s);
+ if (s.contains("~~~")) {
+ l = 12 + font.getStringWidth(s.replaceAll("~~~(.*?)~~~", ""));
+ }
+ if (l > k) {
+ k = l;
+ }
+ }
+ int i1 = mouseX + 12;
+ int j1 = mouseY - 12;
+ int k1 = 8;
+ if (strings.size() > 1) {
+ k1 += 2 + (strings.size() - 1) * 10;
+ }
+ if (i1 + k > this.width) {
+ i1 -= 28 + k;
+ }
+ if (j1 + k1 + 6 > this.height) {
+ j1 = this.height - k1 - 6;
+ }
+ this.zLevel = 300.0F;
+ itemRender.zLevel = 300.0F;
+ int l1 = -267386864;
+ int i2 = 1342177280 + MinecraftTooltip.getOutline(tooltip.getType());
+ int j2 = i2;
+ drawGradientRect(i1 - 3, j1 - 4, i1 + k + 3, j1 - 3, l1, l1);
+ drawGradientRect(i1 - 3, j1 + k1 + 3, i1 + k + 3, j1 + k1 + 4, l1, l1);
+ drawGradientRect(i1 - 3, j1 - 3, i1 + k + 3, j1 + k1 + 3, l1, l1);
+ drawGradientRect(i1 - 4, j1 - 3, i1 - 3, j1 + k1 + 3, l1, l1);
+ drawGradientRect(i1 + k + 3, j1 - 3, i1 + k + 4, j1 + k1 + 3, l1, l1);
+
+ drawGradientRect(i1 - 3, j1 - 3 + 1, i1 - 3 + 1, j1 + k1 + 3 - 1, i2, j2);
+ drawGradientRect(i1 + k + 2, j1 - 3 + 1, i1 + k + 3, j1 + k1 + 3 - 1, i2, j2);
+ drawGradientRect(i1 - 3, j1 - 3, i1 + k + 3, j1 - 3 + 1, i2, i2);
+ drawGradientRect(i1 - 3, j1 + k1 + 2, i1 + k + 3, j1 + k1 + 3, j2, j2);
+ for (int k2 = 0; k2 < strings.size(); k2++)
+ {
+ String s1 = (String)strings.get(k2);
+ if (k2 == 0) {
+ s1 = MinecraftTooltip.getTitle(tooltip.getType()) + s1;
+ } else {
+ s1 = MinecraftTooltip.getBody(tooltip.getType()) + s1;
+ }
+ if (s1.contains("~~~"))
+ {
+ String split = s1.split("~~~")[1];
+ try
+ {
+ NBTTagCompound nbt = (NBTTagCompound)JsonToNBT.func_150315_a(split);
+ ItemStack stack = ItemStack.loadItemStackFromNBT(nbt);
+ GL11.glPushMatrix();
+ GL11.glTranslatef(i1, j1 - 1.5F, 0.0F);
+ GL11.glScalef(0.6F, 0.6F, 1.0F);
+ renderItem(new IPoint(0.0F, 0.0F), stack, false);
+ GL11.glPopMatrix();
+ }
+ catch (NBTException e)
+ {
+ e.printStackTrace();
+ }
+ s1 = " " + s1.replaceAll("~~~(.*?)~~~", "");
+ }
+ font.drawStringWithShadow(s1, i1, j1, -1);
+ if (k2 == 0) {
+ j1 += 2;
+ }
+ j1 += 10;
+ }
+ this.zLevel = 0.0F;
+ itemRender.zLevel = 0.0F;
+ GL11.glEnable(2896);
+ GL11.glEnable(2929);
+ RenderHelper.enableStandardItemLighting();
+ GL11.glEnable(32826);
+ }
+
+ protected void mouseClicked(int x, int y, int button)
+ {
+ IWidget origin = this.window;
+ if (this.window.getMousedOverWidget() != null) {
+ origin = this.window.getMousedOverWidget();
+ }
+ this.window.callEvent(new EventMouse.Down(origin, x, y, button));
+ }
+
+ public boolean isShiftDown()
+ {
+ return Keyboard.isKeyDown(this.mc.gameSettings.keyBindSneak.getKeyCode());
+ }
+
+ protected void keyTyped(char c, int key)
+ {
+ if ((key == 1) || ((key == this.mc.gameSettings.keyBindInventory.getKeyCode()) && (this.window.getFocusedWidget() == null))) {
+ this.mc.thePlayer.closeScreen();
+ }
+ IWidget origin = this.window.getFocusedWidget() == null ? this.window : this.window.getFocusedWidget();
+
+ this.window.callEvent(new EventKey.Down(origin, c, key));
+ }
+
+ protected void mouseMovedOrUp(int x, int y, int button)
+ {
+ IWidget origin = this.window.getMousedOverWidget() == null ? this.window : this.window.getMousedOverWidget();
+ float dy;
+ if (button == -1)
+ {
+ float dx = Mouse.getEventDX() * this.width / this.mc.displayWidth;
+ dy = -(Mouse.getEventDY() * this.height / this.mc.displayHeight);
+ }
+ else
+ {
+ this.window.callEvent(new EventMouse.Up(origin, x, y, button));
+ }
+ }
+
+ public void handleMouseInput()
+ {
+ super.handleMouseInput();
+ int dWheel = Mouse.getDWheel();
+ IWidget origin = this.window.getFocusedWidget() == null ? this.window : this.window.getFocusedWidget();
+ if (dWheel != 0) {
+ this.window.callEvent(new EventMouse.Wheel(this.window, dWheel));
+ }
+ }
+
+ public void onGuiClosed()
+ {
+ this.window.onClose();
+ }
+
+ public void renderTexturedRect(float x, float y, float u, float v, float w, float h)
+ {
+ drawTexturedModalRect((int)x, (int)y, (int)u, (int)v, (int)w, (int)h);
+ }
+
+ public void renderTexture(IPoint position, IArea textureArea)
+ {
+ drawTexturedModalRect((int)position.x(), (int)position.y(), (int)textureArea.pos().x(), (int)textureArea.pos().y(), (int)textureArea.size().x(), (int)textureArea.size().y());
+ }
+
+ private void renderTexturedRect(IArea area, IPoint uv)
+ {
+ renderTexturedRect(area.pos().x(), area.pos().y(), uv.x(), uv.y(), area.size().x(), area.size().y());
+ }
+
+ public void renderTexturePadded(IArea area, IArea texture, IBorder padding)
+ {
+ int borderLeft = (int)padding.l();
+ int borderRight = (int)padding.r();
+ int borderTop = (int)padding.t();
+ int borderBottom = (int)padding.b();
+
+ int posX = (int)area.pos().x();
+ int posY = (int)area.pos().y();
+ int width = (int)area.size().x();
+ int height = (int)area.size().y();
+
+ int textWidth = (int)texture.w();
+ int textHeight = (int)texture.h();
+
+ int u = (int)texture.x();
+ int v = (int)texture.y();
+ if (borderTop + borderBottom > height)
+ {
+ borderTop = height / 2;
+ borderBottom = height / 2;
+ }
+ if (borderLeft + borderRight > width)
+ {
+ borderLeft = width / 2;
+ borderRight = width / 2;
+ }
+ IPoint origin = area.pos();
+
+ drawTexturedModalRect(posX, posY, u, v, borderLeft, borderTop);
+
+
+ drawTexturedModalRect(posX + width - borderRight, posY, u + textWidth - borderRight, v, borderRight, borderTop);
+
+
+ drawTexturedModalRect(posX, posY + height - borderBottom, u, v + textHeight - borderBottom, borderLeft, borderBottom);
+
+
+ drawTexturedModalRect(posX + width - borderRight, posY + height - borderBottom, u + textWidth - borderRight, v + textHeight - borderBottom, borderRight, borderBottom);
+
+
+
+ int currentXPos = borderLeft;
+ while (currentXPos < width - borderRight)
+ {
+ int distanceXRemaining = width - borderRight - currentXPos;
+
+
+ int texturingWidth = textWidth - borderLeft - borderRight;
+ if (texturingWidth > distanceXRemaining) {
+ texturingWidth = distanceXRemaining;
+ }
+ if (texturingWidth <= 0) {
+ break;
+ }
+ drawTexturedModalRect(posX + currentXPos, posY, u + borderLeft, v, texturingWidth, borderTop);
+
+ drawTexturedModalRect(posX + currentXPos, posY + height - borderBottom, u + borderLeft, v + textHeight - borderBottom, texturingWidth, borderBottom);
+
+
+ int currentYPos = borderTop;
+ while (currentYPos < height - borderBottom)
+ {
+ int distanceYRemaining = height - borderBottom - currentYPos;
+
+
+ int texturingHeight = textHeight - borderTop - borderBottom;
+ if (texturingHeight > distanceYRemaining) {
+ texturingHeight = distanceYRemaining;
+ }
+ if (texturingHeight <= 0) {
+ break;
+ }
+ drawTexturedModalRect(posX + currentXPos, posY + currentYPos, u + borderLeft, v + borderTop, texturingWidth, texturingHeight);
+
+ currentYPos += texturingHeight;
+ }
+ currentXPos += texturingWidth;
+ }
+ int currentYPos = borderTop;
+ while (currentYPos < height - borderBottom)
+ {
+ int distanceYRemaining = height - borderBottom - currentYPos;
+
+
+ int texturingHeight = textHeight - borderTop - borderBottom;
+ if (texturingHeight > distanceYRemaining) {
+ texturingHeight = distanceYRemaining;
+ }
+ if (texturingHeight <= 0) {
+ break;
+ }
+ drawTexturedModalRect(posX, posY + currentYPos, u, v + borderTop, borderLeft, texturingHeight);
+
+ drawTexturedModalRect(posX + width - borderRight, posY + currentYPos, u + textWidth - borderRight, v + borderTop, borderRight, texturingHeight);
+ currentYPos += texturingHeight;
+ }
+ }
+
+ public void drawGradientArea(float p_73733_1_, float p_73733_2_, float p_73733_3_, float p_73733_4_, int p_73733_5_, int p_73733_6_)
+ {
+ float f = (p_73733_5_ >> 24 & 0xFF) / 255.0F;
+ float f1 = (p_73733_5_ >> 16 & 0xFF) / 255.0F;
+ float f2 = (p_73733_5_ >> 8 & 0xFF) / 255.0F;
+ float f3 = (p_73733_5_ & 0xFF) / 255.0F;
+ float f4 = (p_73733_6_ >> 24 & 0xFF) / 255.0F;
+ float f5 = (p_73733_6_ >> 16 & 0xFF) / 255.0F;
+ float f6 = (p_73733_6_ >> 8 & 0xFF) / 255.0F;
+ float f7 = (p_73733_6_ & 0xFF) / 255.0F;
+ GL11.glDisable(3553);
+ GL11.glEnable(3042);
+ GL11.glDisable(3008);
+ OpenGlHelper.glBlendFunc(770, 771, 1, 0);
+ GL11.glShadeModel(7425);
+ Tessellator tessellator = Tessellator.instance;
+ tessellator.startDrawingQuads();
+ tessellator.setColorRGBA_F(f1, f2, f3, f);
+ tessellator.addVertex(p_73733_3_, p_73733_2_, this.zLevel);
+ tessellator.addVertex(p_73733_1_, p_73733_2_, this.zLevel);
+ tessellator.setColorRGBA_F(f5, f6, f7, f4);
+ tessellator.addVertex(p_73733_1_, p_73733_4_, this.zLevel);
+ tessellator.addVertex(p_73733_3_, p_73733_4_, this.zLevel);
+ tessellator.draw();
+ GL11.glShadeModel(7424);
+ GL11.glDisable(3042);
+ GL11.glEnable(3008);
+ GL11.glEnable(3553);
+ }
+
+ public void renderItem(IPoint pos, ItemStack item, boolean rotating)
+ {
+ renderItem(pos, item, (int)this.zLevel + 3, rotating);
+ }
+
+ private void renderItem(IPoint pos, ItemStack item, int zLevel, boolean rotating)
+ {
+ OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240.0F, 240.0F);
+
+ GL11.glPushMatrix();
+
+ RenderHelper.enableGUIStandardItemLighting();
+ GL11.glEnable(32826);
+ GL11.glEnable(2929);
+
+
+
+
+
+
+
+ FontRenderer font = item.getItem().getFontRenderer(item);
+ if (font == null) {
+ font = getFontRenderer();
+ }
+ if (item != null)
+ {
+ BinnieCore.proxy.getMinecraftInstance();float phase = (float)Minecraft.getSystemTime() / 20.0F;
+
+ GL11.glPushMatrix();
+ if (rotating)
+ {
+ GL11.glTranslatef(8.0F, 8.0F, 0.0F);
+ GL11.glRotatef(phase, 0.0F, -0.866F, 0.5F);
+ GL11.glTranslatef(-8.0F, -8.0F, -67.099998F);
+ }
+ itemRender.renderItemAndEffectIntoGUI(font, this.mc.renderEngine, item, (int)pos.x(), (int)pos.y());
+ GL11.glPopMatrix();
+ itemRender.renderItemOverlayIntoGUI(font, this.mc.renderEngine, item, (int)pos.x(), (int)pos.y(), null);
+ }
+ GL11.glClear(256);
+ GL11.glEnable(3042);
+
+ OpenGlHelper.glBlendFunc(770, 771, 1, 0);
+
+
+ RenderHelper.disableStandardItemLighting();
+
+ CraftGUI.Render.colour(-1);
+
+ GL11.glEnable(32826);
+ GL11.glPopMatrix();
+ }
+
+ public void renderIcon(IPoint pos, IIcon icon, ResourceLocation map)
+ {
+ if (icon == null) {
+ return;
+ }
+ GL11.glPushMatrix();
+ GL11.glEnable(32826);
+
+
+ BinnieCore.proxy.bindTexture(map);
+
+
+ itemRender.zLevel = this.zLevel;
+
+ itemRender.renderIcon((int)pos.x(), (int)pos.y(), icon, 16, 16);
+
+
+
+ GL11.glEnable(32826);
+ GL11.glPopMatrix();
+ }
+
+ public boolean isHelpMode()
+ {
+ return Keyboard.isKeyDown(15);
+ }
+
+ public FontRenderer getFontRenderer()
+ {
+ return this.fontRendererObj;
+ }
+
+ public void resize(IPoint size)
+ {
+ this.xSize = ((int)size.x());
+ this.ySize = ((int)size.y());
+ this.guiLeft = ((this.width - this.xSize) / 2);
+ this.guiTop = ((this.height - this.ySize) / 2);
+ this.window.setPosition(new IPoint(this.guiLeft, this.guiTop));
+ }
+
+ public void limitArea(IArea area)
+ {
+ float x = area.pos().x();
+ float y = area.pos().y();
+ float w = area.size().x();
+ float h = area.size().y();
+
+ y = this.height - (y + h);
+ float k = this.xSize;
+ float scaleX = this.width / this.mc.displayWidth;
+ float scaleY = this.height / this.mc.displayHeight;
+
+ x += 0.0F;
+ y += 0.0F;
+ w += 0.0F;
+ h += 0.0F;
+
+
+
+ GL11.glScissor((int)(x / scaleX), (int)(y / scaleY), (int)(w / scaleX), (int)(h / scaleY));
+ }
+
+ public int getZLevel()
+ {
+ return (int)this.zLevel;
+ }
+
+ public void drawRect(float p_73734_0_, float p_73734_1_, float p_73734_2_, float p_73734_3_, int p_73734_4_)
+ {
+ if (p_73734_0_ < p_73734_2_)
+ {
+ float j1 = p_73734_0_;
+ p_73734_0_ = p_73734_2_;
+ p_73734_2_ = j1;
+ }
+ if (p_73734_1_ < p_73734_3_)
+ {
+ float j1 = p_73734_1_;
+ p_73734_1_ = p_73734_3_;
+ p_73734_3_ = j1;
+ }
+ float f3 = (p_73734_4_ >> 24 & 0xFF) / 255.0F;
+ float f = (p_73734_4_ >> 16 & 0xFF) / 255.0F;
+ float f1 = (p_73734_4_ >> 8 & 0xFF) / 255.0F;
+ float f2 = (p_73734_4_ & 0xFF) / 255.0F;
+ Tessellator tessellator = Tessellator.instance;
+ GL11.glEnable(3042);
+ GL11.glDisable(3553);
+ OpenGlHelper.glBlendFunc(770, 771, 1, 0);
+ GL11.glColor4f(f, f1, f2, f3);
+ tessellator.startDrawingQuads();
+ tessellator.addVertex(p_73734_0_, p_73734_3_, 0.0D);
+ tessellator.addVertex(p_73734_2_, p_73734_3_, 0.0D);
+ tessellator.addVertex(p_73734_2_, p_73734_1_, 0.0D);
+ tessellator.addVertex(p_73734_0_, p_73734_1_, 0.0D);
+ tessellator.draw();
+ GL11.glEnable(3553);
+ GL11.glDisable(3042);
+ }
+}
diff --git a/src/Java/binnie/craftgui/minecraft/IMachineInformation.java b/src/Java/binnie/craftgui/minecraft/IMachineInformation.java
new file mode 100644
index 0000000000..cd709bbf8a
--- /dev/null
+++ b/src/Java/binnie/craftgui/minecraft/IMachineInformation.java
@@ -0,0 +1,6 @@
+package binnie.craftgui.minecraft;
+
+public abstract interface IMachineInformation
+{
+ public abstract String getInformation();
+}
diff --git a/src/Java/binnie/craftgui/minecraft/IMinecraftTooltip.java b/src/Java/binnie/craftgui/minecraft/IMinecraftTooltip.java
new file mode 100644
index 0000000000..5bdec6e4ae
--- /dev/null
+++ b/src/Java/binnie/craftgui/minecraft/IMinecraftTooltip.java
@@ -0,0 +1,9 @@
+package binnie.craftgui.minecraft;
+
+import binnie.craftgui.core.ITooltip;
+
+public abstract interface IMinecraftTooltip
+ extends ITooltip
+{
+ public abstract void getTooltip(MinecraftTooltip paramMinecraftTooltip);
+}
diff --git a/src/Java/binnie/craftgui/minecraft/IWindowAffectsShiftClick.java b/src/Java/binnie/craftgui/minecraft/IWindowAffectsShiftClick.java
new file mode 100644
index 0000000000..ced88aa028
--- /dev/null
+++ b/src/Java/binnie/craftgui/minecraft/IWindowAffectsShiftClick.java
@@ -0,0 +1,8 @@
+package binnie.craftgui.minecraft;
+
+import binnie.core.machines.transfer.TransferRequest;
+
+public abstract interface IWindowAffectsShiftClick
+{
+ public abstract void alterRequest(TransferRequest paramTransferRequest);
+}
diff --git a/src/Java/binnie/craftgui/minecraft/InventoryType.java b/src/Java/binnie/craftgui/minecraft/InventoryType.java
new file mode 100644
index 0000000000..f10a065a99
--- /dev/null
+++ b/src/Java/binnie/craftgui/minecraft/InventoryType.java
@@ -0,0 +1,8 @@
+package binnie.craftgui.minecraft;
+
+public enum InventoryType
+{
+ Player, Machine, Window, Custom;
+
+ private InventoryType() {}
+}
diff --git a/src/Java/binnie/craftgui/minecraft/ListMap.java b/src/Java/binnie/craftgui/minecraft/ListMap.java
new file mode 100644
index 0000000000..7c0fbf37dd
--- /dev/null
+++ b/src/Java/binnie/craftgui/minecraft/ListMap.java
@@ -0,0 +1,149 @@
+package binnie.craftgui.minecraft;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Map.Entry;
+import java.util.Set;
+
+class ListMap<T>
+ implements List<T>
+{
+ private LinkedHashMap<Integer, T> map = new LinkedHashMap();
+
+ public int size()
+ {
+ int i = -1;
+ for (Iterator i$ = this.map.keySet().iterator(); i$.hasNext();)
+ {
+ int k = ((Integer)i$.next()).intValue();
+ if (k > i) {
+ i = k;
+ }
+ }
+ return i + 1;
+ }
+
+ public boolean isEmpty()
+ {
+ return this.map.isEmpty();
+ }
+
+ public boolean contains(Object o)
+ {
+ return this.map.containsValue(o);
+ }
+
+ public Iterator<T> iterator()
+ {
+ return this.map.values().iterator();
+ }
+
+ public Object[] toArray()
+ {
+ return this.map.values().toArray();
+ }
+
+ public <P> P[] toArray(P[] a)
+ {
+ return this.map.values().toArray(a);
+ }
+
+ public boolean add(T e)
+ {
+ if (get(size()) == null)
+ {
+ add(size(), e);
+ return true;
+ }
+ return false;
+ }
+
+ public boolean remove(Object o)
+ {
+ return false;
+ }
+
+ public boolean containsAll(Collection<?> c)
+ {
+ return this.map.values().containsAll(c);
+ }
+
+ public boolean addAll(Collection<? extends T> c)
+ {
+ return false;
+ }
+
+ public boolean addAll(int index, Collection<? extends T> c)
+ {
+ return false;
+ }
+
+ public boolean removeAll(Collection<?> c)
+ {
+ return false;
+ }
+
+ public boolean retainAll(Collection<?> c)
+ {
+ return false;
+ }
+
+ public void clear()
+ {
+ this.map.clear();
+ }
+
+ public T get(int index)
+ {
+ return this.map.get(Integer.valueOf(index));
+ }
+
+ public T set(int index, T element)
+ {
+ this.map.put(Integer.valueOf(index), element);
+ return element;
+ }
+
+ public void add(int index, T element)
+ {
+ this.map.put(Integer.valueOf(index), element);
+ }
+
+ public T remove(int index)
+ {
+ return null;
+ }
+
+ public int indexOf(Object o)
+ {
+ for (Map.Entry<Integer, T> entry : this.map.entrySet()) {
+ if (entry.getValue() == o) {
+ return ((Integer)entry.getKey()).intValue();
+ }
+ }
+ return 0;
+ }
+
+ public int lastIndexOf(Object o)
+ {
+ return indexOf(o);
+ }
+
+ public ListIterator<T> listIterator()
+ {
+ return null;
+ }
+
+ public ListIterator<T> listIterator(int index)
+ {
+ return null;
+ }
+
+ public List<T> subList(int fromIndex, int toIndex)
+ {
+ return null;
+ }
+}
diff --git a/src/Java/binnie/craftgui/minecraft/MinecraftGUI.java b/src/Java/binnie/craftgui/minecraft/MinecraftGUI.java
new file mode 100644
index 0000000000..a87b4deeb8
--- /dev/null
+++ b/src/Java/binnie/craftgui/minecraft/MinecraftGUI.java
@@ -0,0 +1,14 @@
+package binnie.craftgui.minecraft;
+
+import binnie.craftgui.window.Panel.IPanelType;
+
+public class MinecraftGUI
+{
+ public static enum PanelType
+ implements Panel.IPanelType
+ {
+ Black, Gray, Tinted, Coloured, Outline, TabOutline;
+
+ private PanelType() {}
+ }
+}
diff --git a/src/Java/binnie/craftgui/minecraft/MinecraftTooltip.java b/src/Java/binnie/craftgui/minecraft/MinecraftTooltip.java
new file mode 100644
index 0000000000..4b48e33e6d
--- /dev/null
+++ b/src/Java/binnie/craftgui/minecraft/MinecraftTooltip.java
@@ -0,0 +1,63 @@
+package binnie.craftgui.minecraft;
+
+import binnie.craftgui.core.Tooltip;
+import binnie.craftgui.core.Tooltip.ITooltipType;
+import net.minecraft.util.EnumChatFormatting;
+
+public class MinecraftTooltip
+ extends Tooltip
+{
+ public static enum Type
+ implements Tooltip.ITooltipType
+ {
+ Error, Warning;
+
+ private Type() {}
+ }
+
+ public static int getOutline(Tooltip.ITooltipType type)
+ {
+ return TypeColour.valueOf(type.toString()).getOutline();
+ }
+
+ public static String getTitle(Tooltip.ITooltipType type)
+ {
+ return TypeColour.valueOf(type.toString()).getTitle();
+ }
+
+ public static String getBody(Tooltip.ITooltipType type)
+ {
+ return TypeColour.valueOf(type.toString()).getBody();
+ }
+
+ private static enum TypeColour
+ {
+ Standard(5243135, EnumChatFormatting.WHITE, EnumChatFormatting.GRAY), Help(5046016, EnumChatFormatting.GREEN, EnumChatFormatting.DARK_GREEN), Information(49151, EnumChatFormatting.AQUA, EnumChatFormatting.DARK_AQUA), Error(16724224, EnumChatFormatting.RED, EnumChatFormatting.DARK_RED), Warning(16752384, EnumChatFormatting.YELLOW, EnumChatFormatting.GOLD), User(9839667, EnumChatFormatting.RED, EnumChatFormatting.DARK_RED), Power(9006592, EnumChatFormatting.YELLOW, EnumChatFormatting.GOLD);
+
+ int outline;
+ String mainText;
+ String bodyText;
+
+ private TypeColour(int outline, EnumChatFormatting mainText, EnumChatFormatting bodyText)
+ {
+ this.outline = outline;
+ this.mainText = mainText.toString();
+ this.bodyText = bodyText.toString();
+ }
+
+ public int getOutline()
+ {
+ return this.outline;
+ }
+
+ public String getTitle()
+ {
+ return this.mainText;
+ }
+
+ public String getBody()
+ {
+ return this.bodyText;
+ }
+ }
+}
diff --git a/src/Java/binnie/craftgui/minecraft/ModuleCraftGUI.java b/src/Java/binnie/craftgui/minecraft/ModuleCraftGUI.java
new file mode 100644
index 0000000000..d2655dc2fc
--- /dev/null
+++ b/src/Java/binnie/craftgui/minecraft/ModuleCraftGUI.java
@@ -0,0 +1,18 @@
+package binnie.craftgui.minecraft;
+
+import binnie.core.IInitializable;
+
+public class ModuleCraftGUI
+ implements IInitializable
+{
+ public void preInit() {}
+
+ public void init() {}
+
+ public void postInit()
+ {
+ for (GUIIcon icon : ) {
+ icon.register();
+ }
+ }
+}
diff --git a/src/Java/binnie/craftgui/minecraft/Window.java b/src/Java/binnie/craftgui/minecraft/Window.java
new file mode 100644
index 0000000000..e09cf1e376
--- /dev/null
+++ b/src/Java/binnie/craftgui/minecraft/Window.java
@@ -0,0 +1,338 @@
+package binnie.craftgui.minecraft;
+
+import binnie.Binnie;
+import binnie.core.AbstractMod;
+import binnie.core.BinnieCore;
+import binnie.core.machines.Machine;
+import binnie.core.machines.inventory.IInventoryMachine;
+import binnie.core.machines.network.INetwork.RecieveGuiNBT;
+import binnie.core.machines.power.PowerSystem;
+import binnie.core.network.packet.MessageCraftGUI;
+import binnie.core.proxy.BinnieProxy;
+import binnie.core.resource.BinnieResource;
+import binnie.core.resource.ManagerResource;
+import binnie.core.resource.ResourceType;
+import binnie.craftgui.controls.ControlText;
+import binnie.craftgui.controls.ControlTextCentered;
+import binnie.craftgui.core.Attribute;
+import binnie.craftgui.core.CraftGUI;
+import binnie.craftgui.core.ITooltip;
+import binnie.craftgui.core.ITooltipHelp;
+import binnie.craftgui.core.IWidget;
+import binnie.craftgui.core.Tooltip;
+import binnie.craftgui.core.TopLevelWidget;
+import binnie.craftgui.core.geometry.IPoint;
+import binnie.craftgui.core.renderer.Renderer;
+import binnie.craftgui.events.EventWidget.ChangeSize;
+import binnie.craftgui.events.EventWidget.ChangeSize.Handler;
+import binnie.craftgui.minecraft.control.ControlHelp;
+import binnie.craftgui.minecraft.control.ControlInfo;
+import binnie.craftgui.minecraft.control.ControlPowerSystem;
+import binnie.craftgui.minecraft.control.ControlSlot;
+import binnie.craftgui.minecraft.control.ControlUser;
+import binnie.craftgui.minecraft.control.EnumHighlighting;
+import binnie.craftgui.resource.StyleSheetManager;
+import binnie.craftgui.resource.Texture;
+import binnie.craftgui.resource.minecraft.CraftGUITexture;
+import binnie.craftgui.resource.minecraft.StandardTexture;
+import com.mojang.authlib.GameProfile;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import java.util.ArrayList;
+import java.util.Deque;
+import java.util.List;
+import java.util.Map;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.world.World;
+
+public abstract class Window
+ extends TopLevelWidget
+ implements INetwork.RecieveGuiNBT
+{
+ private GuiCraftGUI gui;
+ private ContainerCraftGUI container;
+ private WindowInventory windowInventory;
+ private ControlText title;
+
+ public void getTooltip(Tooltip tooltip)
+ {
+ Deque<IWidget> queue = calculateMousedOverWidgets();
+ while (!queue.isEmpty())
+ {
+ IWidget widget = (IWidget)queue.removeFirst();
+ if ((widget.isEnabled()) && (widget.isVisible()) && (widget.calculateIsMouseOver()))
+ {
+ if ((widget instanceof ITooltip))
+ {
+ ((ITooltip)widget).getTooltip(tooltip);
+ if (tooltip.exists()) {
+ return;
+ }
+ }
+ if (widget.hasAttribute(Attribute.BlockTooltip)) {
+ return;
+ }
+ }
+ }
+ }
+
+ public void getHelpTooltip(MinecraftTooltip tooltip)
+ {
+ Deque<IWidget> queue = calculateMousedOverWidgets();
+ while (!queue.isEmpty())
+ {
+ IWidget widget = (IWidget)queue.removeFirst();
+ if ((widget.isEnabled()) && (widget.isVisible()) && (widget.calculateIsMouseOver()))
+ {
+ if ((widget instanceof ITooltipHelp))
+ {
+ ((ITooltipHelp)widget).getHelpTooltip(tooltip);
+ if (tooltip.exists()) {
+ return;
+ }
+ }
+ if (widget.hasAttribute(Attribute.BlockTooltip)) {
+ return;
+ }
+ }
+ }
+ }
+
+ protected abstract AbstractMod getMod();
+
+ protected abstract String getName();
+
+ public BinnieResource getBackgroundTextureFile(int i)
+ {
+ return Binnie.Resource.getPNG(getMod(), ResourceType.GUI, getName() + (i == 1 ? "" : Integer.valueOf(i)));
+ }
+
+ public boolean showHelpButton()
+ {
+ return Machine.getInterface(IInventoryMachine.class, getInventory()) != null;
+ }
+
+ public String showInfoButton()
+ {
+ if (Machine.getInterface(IMachineInformation.class, getInventory()) != null) {
+ return ((IMachineInformation)Machine.getInterface(IMachineInformation.class, getInventory())).getInformation();
+ }
+ return null;
+ }
+
+ public Window(float width, float height, EntityPlayer player, IInventory inventory, Side side)
+ {
+ this.side = side;
+ setInventories(player, inventory);
+ this.container = new ContainerCraftGUI(this);
+ this.windowInventory = new WindowInventory(this);
+ if (side == Side.SERVER) {
+ return;
+ }
+ setSize(new IPoint(width, height));
+ this.gui = new GuiCraftGUI(this);
+ for (EnumHighlighting h : EnumHighlighting.values()) {
+ ControlSlot.highlighting.put(h, new ArrayList());
+ }
+ CraftGUI.Render = new Renderer(this.gui);
+ CraftGUI.Render.stylesheet(StyleSheetManager.getDefault());
+
+ this.titleButtonLeft = -14.0F;
+ if (showHelpButton()) {
+ new ControlHelp(this, this.titleButtonLeft += 22.0F, 8.0F);
+ }
+ if (showInfoButton() != null) {
+ new ControlInfo(this, this.titleButtonLeft += 22.0F, 8.0F, showInfoButton());
+ }
+ Window wind = this;
+
+ addSelfEventHandler(new EventWidget.ChangeSize.Handler()
+ {
+ public void onEvent(EventWidget.ChangeSize event)
+ {
+ if ((Window.this.isClient()) && (Window.this.getGui() != null))
+ {
+ Window.this.getGui().resize(Window.this.getSize());
+ if (Window.this.title != null) {
+ Window.this.title.setSize(new IPoint(Window.this.w(), Window.this.title.h()));
+ }
+ }
+ }
+ });
+ }
+
+ protected float titleButtonLeft = 8.0F;
+ protected float titleButtonRight = 8.0F;
+
+ public void setTitle(String title)
+ {
+ this.title = new ControlTextCentered(this, 12.0F, title);
+ this.title.setColour(4210752);
+ }
+
+ @SideOnly(Side.CLIENT)
+ public final GuiCraftGUI getGui()
+ {
+ return this.gui;
+ }
+
+ public final ContainerCraftGUI getContainer()
+ {
+ return this.container;
+ }
+
+ public final WindowInventory getWindowInventory()
+ {
+ return this.windowInventory;
+ }
+
+ private StandardTexture bgText1 = null;
+ private StandardTexture bgText2 = null;
+ private boolean hasBeenInitialised = false;
+ private EntityPlayer player;
+ private IInventory entityInventory;
+
+ public final void initGui()
+ {
+ if (this.hasBeenInitialised) {
+ return;
+ }
+ this.bgText1 = new StandardTexture(0, 0, 256, 256, getBackgroundTextureFile(1));
+ if (getSize().x() > 256.0F) {
+ this.bgText2 = new StandardTexture(0, 0, 256, 256, getBackgroundTextureFile(2));
+ }
+ if (!BinnieCore.proxy.checkTexture(this.bgText1.getTexture()))
+ {
+ this.bgText1 = null;
+ this.bgText2 = null;
+ }
+ initialiseClient();
+ this.hasBeenInitialised = true;
+ }
+
+ public abstract void initialiseClient();
+
+ public void initialiseServer() {}
+
+ public void onRenderBackground()
+ {
+ CraftGUI.Render.colour(16777215);
+ if (getBackground1() != null) {
+ CraftGUI.Render.texture(getBackground1(), IPoint.ZERO);
+ }
+ if (getBackground2() != null) {
+ CraftGUI.Render.texture(getBackground2(), new IPoint(256.0F, 0.0F));
+ }
+ CraftGUI.Render.colour(getColour());
+ CraftGUI.Render.texture(CraftGUITexture.Window, getArea());
+ }
+
+ public void onUpdateClient()
+ {
+ ((List)ControlSlot.highlighting.get(EnumHighlighting.Help)).clear();
+
+ ControlSlot.shiftClickActive = false;
+ }
+
+ public EntityPlayer getPlayer()
+ {
+ return this.player;
+ }
+
+ public GameProfile getUsername()
+ {
+ return getPlayer().getGameProfile();
+ }
+
+ public ItemStack getHeldItemStack()
+ {
+ if (this.player != null) {
+ return this.player.inventory.getItemStack();
+ }
+ return null;
+ }
+
+ public IInventory getInventory()
+ {
+ return this.entityInventory;
+ }
+
+ public void setInventories(EntityPlayer player2, IInventory inventory)
+ {
+ this.player = player2;
+ this.entityInventory = inventory;
+ }
+
+ public void onClose() {}
+
+ public void setHeldItemStack(ItemStack stack)
+ {
+ if (this.player != null) {
+ this.player.inventory.setItemStack(stack);
+ }
+ }
+
+ private Side side = Side.CLIENT;
+
+ public boolean isServer()
+ {
+ return !isClient();
+ }
+
+ public boolean isClient()
+ {
+ return this.side == Side.CLIENT;
+ }
+
+ public World getWorld()
+ {
+ if (getPlayer() != null) {
+ return getPlayer().worldObj;
+ }
+ return BinnieCore.proxy.getWorld();
+ }
+
+ public void onInventoryUpdate() {}
+
+ public void sendClientAction(String name, NBTTagCompound action)
+ {
+ action.setString("type", name);
+ MessageCraftGUI packet = new MessageCraftGUI(action);
+ BinnieCore.proxy.sendToServer(packet);
+ }
+
+ public void recieveGuiNBT(Side side, EntityPlayer player, String name, NBTTagCompound action)
+ {
+ if ((side == Side.CLIENT) && (name.equals("username")))
+ {
+ new ControlUser(this, w() - (this.titleButtonRight += 16.0F), 8.0F, action.getString("username"));
+ this.titleButtonRight += 6.0F;
+ }
+ if ((side == Side.CLIENT) && (name.equals("power-system")))
+ {
+ new ControlPowerSystem(this, w() - (this.titleButtonRight += 16.0F), 8.0F, PowerSystem.get(action.getByte("system")));
+ this.titleButtonRight += 6.0F;
+ }
+ }
+
+ public void onWindowInventoryChanged() {}
+
+ public Texture getBackground1()
+ {
+ return this.bgText1;
+ }
+
+ public Texture getBackground2()
+ {
+ return this.bgText2;
+ }
+
+ public static <T extends Window> T get(IWidget widget)
+ {
+ return (Window)widget.getSuperParent();
+ }
+}
diff --git a/src/Java/binnie/craftgui/minecraft/WindowInventory.java b/src/Java/binnie/craftgui/minecraft/WindowInventory.java
new file mode 100644
index 0000000000..9c38bf1a9b
--- /dev/null
+++ b/src/Java/binnie/craftgui/minecraft/WindowInventory.java
@@ -0,0 +1,144 @@
+package binnie.craftgui.minecraft;
+
+import binnie.core.machines.inventory.SlotValidator;
+import java.util.ArrayList;
+import java.util.HashMap;
+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.inventory.IInventory;
+import net.minecraft.item.ItemStack;
+
+public class WindowInventory
+ implements IInventory
+{
+ private Window window;
+
+ public WindowInventory(Window window)
+ {
+ this.window = window;
+ }
+
+ private Map<Integer, ItemStack> inventory = new HashMap();
+ private Map<Integer, SlotValidator> validators = new HashMap();
+ private List<Integer> disabledAutoDispenses = new ArrayList();
+
+ public int getSizeInventory()
+ {
+ if (this.inventory.size() == 0) {
+ return 0;
+ }
+ int max = 0;
+ for (Iterator i$ = this.inventory.keySet().iterator(); i$.hasNext();)
+ {
+ int i = ((Integer)i$.next()).intValue();
+ if (i > max) {
+ max = i;
+ }
+ }
+ return max + 1;
+ }
+
+ public ItemStack getStackInSlot(int var1)
+ {
+ if (this.inventory.containsKey(Integer.valueOf(var1))) {
+ return (ItemStack)this.inventory.get(Integer.valueOf(var1));
+ }
+ return null;
+ }
+
+ public ItemStack decrStackSize(int index, int amount)
+ {
+ if (this.inventory.containsKey(Integer.valueOf(index)))
+ {
+ ItemStack item = (ItemStack)this.inventory.get(Integer.valueOf(index));
+ ItemStack output = item.copy();
+ int available = item.stackSize;
+ if (amount > available) {
+ amount = available;
+ }
+ item.stackSize -= amount;
+ output.stackSize = amount;
+ if (item.stackSize == 0) {
+ setInventorySlotContents(index, null);
+ }
+ return output;
+ }
+ return null;
+ }
+
+ public ItemStack getStackInSlotOnClosing(int var1)
+ {
+ return null;
+ }
+
+ public void setInventorySlotContents(int var1, ItemStack var2)
+ {
+ this.inventory.put(Integer.valueOf(var1), var2);
+ markDirty();
+ }
+
+ public String getInventoryName()
+ {
+ return "window.inventory";
+ }
+
+ public int getInventoryStackLimit()
+ {
+ return 64;
+ }
+
+ public void markDirty()
+ {
+ this.window.onWindowInventoryChanged();
+ }
+
+ public boolean isUseableByPlayer(EntityPlayer var1)
+ {
+ return true;
+ }
+
+ public void openInventory() {}
+
+ public void closeInventory() {}
+
+ public boolean hasCustomInventoryName()
+ {
+ return false;
+ }
+
+ public boolean isItemValidForSlot(int i, ItemStack itemstack)
+ {
+ if (this.validators.containsKey(Integer.valueOf(i))) {
+ return ((SlotValidator)this.validators.get(Integer.valueOf(i))).isValid(itemstack);
+ }
+ return true;
+ }
+
+ public void createSlot(int slot)
+ {
+ this.inventory.put(Integer.valueOf(slot), null);
+ }
+
+ public void setValidator(int slot, SlotValidator validator)
+ {
+ this.validators.put(Integer.valueOf(slot), validator);
+ }
+
+ public void disableAutoDispense(int i)
+ {
+ this.disabledAutoDispenses.add(Integer.valueOf(i));
+ }
+
+ public boolean dispenseOnClose(int i)
+ {
+ return !this.disabledAutoDispenses.contains(Integer.valueOf(i));
+ }
+
+ public SlotValidator getValidator(int i)
+ {
+ return (SlotValidator)this.validators.get(Integer.valueOf(i));
+ }
+}
diff --git a/src/Java/binnie/craftgui/minecraft/control/ControlEnergyBar.java b/src/Java/binnie/craftgui/minecraft/control/ControlEnergyBar.java
new file mode 100644
index 0000000000..0337b154c1
--- /dev/null
+++ b/src/Java/binnie/craftgui/minecraft/control/ControlEnergyBar.java
@@ -0,0 +1,161 @@
+package binnie.craftgui.minecraft.control;
+
+import binnie.core.machines.Machine;
+import binnie.core.machines.TileEntityMachine;
+import binnie.core.machines.power.IPoweredMachine;
+import binnie.core.machines.power.IProcess;
+import binnie.core.machines.power.PowerInfo;
+import binnie.craftgui.controls.core.Control;
+import binnie.craftgui.core.Attribute;
+import binnie.craftgui.core.CraftGUI;
+import binnie.craftgui.core.ITooltip;
+import binnie.craftgui.core.IWidget;
+import binnie.craftgui.core.Tooltip;
+import binnie.craftgui.core.Tooltip.Type;
+import binnie.craftgui.core.geometry.IArea;
+import binnie.craftgui.core.geometry.IPoint;
+import binnie.craftgui.core.geometry.Position;
+import binnie.craftgui.core.renderer.Renderer;
+import binnie.craftgui.minecraft.ContainerCraftGUI;
+import binnie.craftgui.minecraft.GuiCraftGUI;
+import binnie.craftgui.minecraft.MinecraftTooltip;
+import binnie.craftgui.minecraft.MinecraftTooltip.Type;
+import binnie.craftgui.minecraft.Window;
+import binnie.craftgui.resource.minecraft.CraftGUITexture;
+import net.minecraft.inventory.IInventory;
+import org.lwjgl.opengl.GL11;
+
+public class ControlEnergyBar
+ extends Control
+ implements ITooltip
+{
+ public static boolean isError;
+ private Position direction;
+
+ public ControlEnergyBar(IWidget parent, int x, int y, int width, int height, Position direction)
+ {
+ super(parent, x, y, width, height);
+ this.direction = direction;
+ addAttribute(Attribute.MouseOver);
+ }
+
+ public IPoweredMachine getClientPower()
+ {
+ IInventory inventory = Window.get(this).getInventory();
+ TileEntityMachine machine = (TileEntityMachine)((inventory instanceof TileEntityMachine) ? inventory : null);
+ if (machine == null) {
+ return null;
+ }
+ IPoweredMachine clientPower = (IPoweredMachine)machine.getMachine().getInterface(IPoweredMachine.class);
+ return clientPower;
+ }
+
+ public float getPercentage()
+ {
+ float percentage = 100.0F * getStoredEnergy() / getMaxEnergy();
+ if (percentage > 100.0F) {
+ percentage = 100.0F;
+ }
+ return percentage;
+ }
+
+ private float getStoredEnergy()
+ {
+ return Window.get(this).getContainer().getPowerInfo().getStoredEnergy();
+ }
+
+ private float getMaxEnergy()
+ {
+ return Window.get(this).getContainer().getPowerInfo().getMaxEnergy();
+ }
+
+ public void getTooltip(Tooltip tooltip)
+ {
+ tooltip.add((int)getPercentage() + "% charged");
+
+ tooltip.add(getStoredEnergy() + "/" + getMaxEnergy() + " RF");
+ }
+
+ public void getHelpTooltip(Tooltip tooltip)
+ {
+ tooltip.add("Energy Bar");
+ tooltip.add("Current: " + getStoredEnergy() + " RF (" + (int)getPercentage() + "%)");
+ tooltip.add("Capacity: " + getMaxEnergy() + " RF");
+
+ IProcess process = (IProcess)Machine.getInterface(IProcess.class, Window.get(this).getInventory());
+ if (process != null) {
+ tooltip.add("Usage: " + (int)process.getEnergyPerTick() + " RF");
+ }
+ }
+
+ public void onRenderBackground()
+ {
+ CraftGUI.Render.texture(CraftGUITexture.EnergyBarBack, getArea());
+
+ float percentage = getPercentage() / 100.0F;
+
+ CraftGUI.Render.colour(getColourFromPercentage(percentage));
+
+ IArea area = getArea();
+ switch (1.$SwitchMap$binnie$craftgui$core$geometry$Position[this.direction.ordinal()])
+ {
+ case 1:
+ case 2:
+ float height = area.size().y() * percentage;
+ area.setSize(new IPoint(area.size().x(), height));
+
+ break;
+ case 3:
+ case 4:
+ float width = area.size().x() * percentage;
+ area.setSize(new IPoint(width, area.size().y()));
+ }
+ if ((isMouseOver()) && (Window.get(this).getGui().isHelpMode()))
+ {
+ int c = -1442840576 + MinecraftTooltip.getOutline(Tooltip.Type.Help);
+ CraftGUI.Render.gradientRect(getArea().inset(1), c, c);
+ }
+ else if (isError)
+ {
+ int c = -1442840576 + MinecraftTooltip.getOutline(MinecraftTooltip.Type.Error);
+ CraftGUI.Render.gradientRect(getArea().inset(1), c, c);
+ }
+ CraftGUI.Render.texture(CraftGUITexture.EnergyBarGlow, area);
+
+ GL11.glColor3d(1.0D, 1.0D, 1.0D);
+
+ CraftGUI.Render.texture(CraftGUITexture.EnergyBarGlass, getArea());
+ }
+
+ public void onRenderForeground()
+ {
+ if ((isMouseOver()) && (Window.get(this).getGui().isHelpMode()))
+ {
+ IArea area = getArea();
+ CraftGUI.Render.colour(MinecraftTooltip.getOutline(Tooltip.Type.Help));
+ CraftGUI.Render.texture(CraftGUITexture.Outline, area.outset(1));
+ }
+ else if (isError)
+ {
+ IArea area = getArea();
+ CraftGUI.Render.colour(MinecraftTooltip.getOutline(MinecraftTooltip.Type.Error));
+ CraftGUI.Render.texture(CraftGUITexture.Outline, area.outset(1));
+ }
+ }
+
+ public int getColourFromPercentage(float percentage)
+ {
+ int colour = 16777215;
+ if (percentage > 0.5D)
+ {
+ int r = (int)((1.0D - 2.0D * (percentage - 0.5D)) * 255.0D);
+ colour = (r << 16) + 65280;
+ }
+ else
+ {
+ int g = (int)(255.0F * (2.0F * percentage));
+ colour = 16711680 + (g << 8);
+ }
+ return colour;
+ }
+}
diff --git a/src/Java/binnie/craftgui/minecraft/control/ControlErrorState.java b/src/Java/binnie/craftgui/minecraft/control/ControlErrorState.java
new file mode 100644
index 0000000000..6027371297
--- /dev/null
+++ b/src/Java/binnie/craftgui/minecraft/control/ControlErrorState.java
@@ -0,0 +1,113 @@
+package binnie.craftgui.minecraft.control;
+
+import binnie.core.machines.power.ErrorState;
+import binnie.craftgui.controls.core.Control;
+import binnie.craftgui.core.Attribute;
+import binnie.craftgui.core.CraftGUI;
+import binnie.craftgui.core.ITooltip;
+import binnie.craftgui.core.IWidget;
+import binnie.craftgui.core.Tooltip;
+import binnie.craftgui.core.geometry.IPoint;
+import binnie.craftgui.core.renderer.Renderer;
+import binnie.craftgui.minecraft.ContainerCraftGUI;
+import binnie.craftgui.minecraft.CustomSlot;
+import binnie.craftgui.minecraft.MinecraftTooltip;
+import binnie.craftgui.minecraft.MinecraftTooltip.Type;
+import binnie.craftgui.minecraft.Window;
+import binnie.craftgui.resource.minecraft.CraftGUITexture;
+import java.util.List;
+import java.util.Map;
+import net.minecraft.entity.player.InventoryPlayer;
+
+public class ControlErrorState
+ extends Control
+ implements ITooltip
+{
+ private ErrorState errorState;
+
+ public void onRenderBackground()
+ {
+ Object texture = CraftGUITexture.StateWarning;
+ if (this.errorState == null) {
+ texture = CraftGUITexture.StateNone;
+ } else if (this.type == 0) {
+ texture = CraftGUITexture.StateError;
+ }
+ CraftGUI.Render.texture(texture, IPoint.ZERO);
+
+ super.onRenderBackground();
+ }
+
+ public ErrorState getError()
+ {
+ return Window.get(this).getContainer().getErrorState();
+ }
+
+ public final void onUpdateClient()
+ {
+ this.errorState = getError();
+ this.type = Window.get(this).getContainer().getErrorType();
+
+ ((List)ControlSlot.highlighting.get(EnumHighlighting.Error)).clear();
+ ((List)ControlSlot.highlighting.get(EnumHighlighting.Warning)).clear();
+ ControlLiquidTank.tankError.clear();
+ ControlEnergyBar.isError = false;
+ if ((!isMouseOver()) || (this.errorState == null)) {
+ return;
+ }
+ ControlEnergyBar.isError = this.errorState.isPowerError();
+ if (this.errorState.isItemError()) {
+ for (int slot : this.errorState.getData())
+ {
+ int id = -1;
+ for (CustomSlot cslot : Window.get(this).getContainer().getCustomSlots()) {
+ if ((!(cslot.inventory instanceof InventoryPlayer)) && (cslot.getSlotIndex() == slot)) {
+ id = cslot.slotNumber;
+ }
+ }
+ if (id >= 0) {
+ if (this.type == 0) {
+ ((List)ControlSlot.highlighting.get(EnumHighlighting.Error)).add(Integer.valueOf(id));
+ } else {
+ ((List)ControlSlot.highlighting.get(EnumHighlighting.Warning)).add(Integer.valueOf(id));
+ }
+ }
+ }
+ }
+ if (this.errorState.isTankError()) {
+ for (int slot : this.errorState.getData()) {
+ ControlLiquidTank.tankError.add(Integer.valueOf(slot));
+ }
+ }
+ }
+
+ private int type = 0;
+
+ public ControlErrorState(IWidget parent, float x, float y)
+ {
+ super(parent, x, y, 16.0F, 16.0F);
+ addAttribute(Attribute.MouseOver);
+ }
+
+ public void getTooltip(Tooltip tooltipOrig)
+ {
+ MinecraftTooltip tooltip = (MinecraftTooltip)tooltipOrig;
+ if (this.errorState != null)
+ {
+ if (this.type == 0) {
+ tooltip.setType(MinecraftTooltip.Type.Error);
+ } else {
+ tooltip.setType(MinecraftTooltip.Type.Warning);
+ }
+ tooltip.add(this.errorState.toString());
+ if (this.errorState.getTooltip().length() > 0) {
+ tooltip.add(this.errorState.getTooltip());
+ }
+ }
+ }
+
+ public ErrorState getErrorState()
+ {
+ return this.errorState;
+ }
+}
diff --git a/src/Java/binnie/craftgui/minecraft/control/ControlHelp.java b/src/Java/binnie/craftgui/minecraft/control/ControlHelp.java
new file mode 100644
index 0000000000..d2027747f2
--- /dev/null
+++ b/src/Java/binnie/craftgui/minecraft/control/ControlHelp.java
@@ -0,0 +1,41 @@
+package binnie.craftgui.minecraft.control;
+
+import binnie.craftgui.controls.core.Control;
+import binnie.craftgui.core.Attribute;
+import binnie.craftgui.core.CraftGUI;
+import binnie.craftgui.core.ITooltip;
+import binnie.craftgui.core.IWidget;
+import binnie.craftgui.core.Tooltip;
+import binnie.craftgui.core.Tooltip.Type;
+import binnie.craftgui.core.renderer.Renderer;
+import binnie.craftgui.resource.minecraft.CraftGUITexture;
+
+public class ControlHelp
+ extends Control
+ implements ITooltip
+{
+ public ControlHelp(IWidget parent, float x, float y)
+ {
+ super(parent, x, y, 16.0F, 16.0F);
+ addAttribute(Attribute.MouseOver);
+ }
+
+ public void onRenderBackground()
+ {
+ CraftGUI.Render.texture(CraftGUITexture.HelpButton, getArea());
+ }
+
+ public void getTooltip(Tooltip tooltip)
+ {
+ tooltip.setType(Tooltip.Type.Help);
+ tooltip.add("Help");
+ tooltip.add("To activate help tooltips,");
+ tooltip.add("hold down the tab key and");
+ tooltip.add("mouse over controls.");
+ }
+
+ public void getHelpTooltip(Tooltip tooltip)
+ {
+ getTooltip(tooltip);
+ }
+}
diff --git a/src/Java/binnie/craftgui/minecraft/control/ControlIconDisplay.java b/src/Java/binnie/craftgui/minecraft/control/ControlIconDisplay.java
new file mode 100644
index 0000000000..071e8ee888
--- /dev/null
+++ b/src/Java/binnie/craftgui/minecraft/control/ControlIconDisplay.java
@@ -0,0 +1,25 @@
+package binnie.craftgui.minecraft.control;
+
+import binnie.craftgui.controls.core.Control;
+import binnie.craftgui.core.CraftGUI;
+import binnie.craftgui.core.IWidget;
+import binnie.craftgui.core.geometry.IPoint;
+import binnie.craftgui.core.renderer.Renderer;
+import net.minecraft.util.IIcon;
+
+public class ControlIconDisplay
+ extends Control
+{
+ private IIcon icon = null;
+
+ public ControlIconDisplay(IWidget parent, float x, float y, IIcon icon)
+ {
+ super(parent, x, y, 16.0F, 16.0F);
+ this.icon = icon;
+ }
+
+ public void onRenderForeground()
+ {
+ CraftGUI.Render.iconItem(IPoint.ZERO, this.icon);
+ }
+}
diff --git a/src/Java/binnie/craftgui/minecraft/control/ControlImage.java b/src/Java/binnie/craftgui/minecraft/control/ControlImage.java
new file mode 100644
index 0000000000..0d08626852
--- /dev/null
+++ b/src/Java/binnie/craftgui/minecraft/control/ControlImage.java
@@ -0,0 +1,25 @@
+package binnie.craftgui.minecraft.control;
+
+import binnie.craftgui.controls.core.Control;
+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.resource.Texture;
+
+public class ControlImage
+ extends Control
+{
+ private Object key = null;
+
+ public ControlImage(IWidget parent, float x, float y, Texture text)
+ {
+ super(parent, x, y, text.w(), text.h());
+ this.key = text;
+ }
+
+ public void onRenderForeground()
+ {
+ CraftGUI.Render.texture(this.key, IPoint.ZERO);
+ }
+}
diff --git a/src/Java/binnie/craftgui/minecraft/control/ControlInfo.java b/src/Java/binnie/craftgui/minecraft/control/ControlInfo.java
new file mode 100644
index 0000000000..8d9c8e95b6
--- /dev/null
+++ b/src/Java/binnie/craftgui/minecraft/control/ControlInfo.java
@@ -0,0 +1,38 @@
+package binnie.craftgui.minecraft.control;
+
+import binnie.craftgui.controls.core.Control;
+import binnie.craftgui.core.Attribute;
+import binnie.craftgui.core.CraftGUI;
+import binnie.craftgui.core.ITooltip;
+import binnie.craftgui.core.IWidget;
+import binnie.craftgui.core.Tooltip;
+import binnie.craftgui.core.Tooltip.Type;
+import binnie.craftgui.core.renderer.Renderer;
+import binnie.craftgui.resource.minecraft.CraftGUITexture;
+
+public class ControlInfo
+ extends Control
+ implements ITooltip
+{
+ private String info;
+
+ public ControlInfo(IWidget parent, float x, float y, String info)
+ {
+ super(parent, x, y, 16.0F, 16.0F);
+ addAttribute(Attribute.MouseOver);
+ this.info = info;
+ }
+
+ public void onRenderBackground()
+ {
+ CraftGUI.Render.texture(CraftGUITexture.InfoButton, getArea());
+ }
+
+ public void getTooltip(Tooltip tooltip)
+ {
+ tooltip.setType(Tooltip.Type.Information);
+ tooltip.add("Info");
+ tooltip.add(this.info);
+ tooltip.setMaxWidth(200);
+ }
+}
diff --git a/src/Java/binnie/craftgui/minecraft/control/ControlItemDisplay.java b/src/Java/binnie/craftgui/minecraft/control/ControlItemDisplay.java
new file mode 100644
index 0000000000..8db438bcc3
--- /dev/null
+++ b/src/Java/binnie/craftgui/minecraft/control/ControlItemDisplay.java
@@ -0,0 +1,98 @@
+package binnie.craftgui.minecraft.control;
+
+import binnie.core.BinnieCore;
+import binnie.core.proxy.BinnieProxy;
+import binnie.craftgui.controls.core.Control;
+import binnie.craftgui.core.Attribute;
+import binnie.craftgui.core.CraftGUI;
+import binnie.craftgui.core.ITooltip;
+import binnie.craftgui.core.ITopLevelWidget;
+import binnie.craftgui.core.IWidget;
+import binnie.craftgui.core.Tooltip;
+import binnie.craftgui.core.geometry.IPoint;
+import binnie.craftgui.core.renderer.Renderer;
+import binnie.craftgui.minecraft.Window;
+import net.minecraft.client.Minecraft;
+import net.minecraft.item.ItemStack;
+import org.lwjgl.opengl.GL11;
+
+public class ControlItemDisplay
+ extends Control
+ implements ITooltip
+{
+ private ItemStack itemStack = null;
+ public boolean hastooltip = false;
+
+ public void setTooltip()
+ {
+ this.hastooltip = true;
+ addAttribute(Attribute.MouseOver);
+ }
+
+ public ControlItemDisplay(IWidget parent, float x, float y)
+ {
+ this(parent, x, y, 16.0F);
+ }
+
+ public ControlItemDisplay(IWidget parent, float f, float y, ItemStack stack, boolean tooltip)
+ {
+ this(parent, f, y, 16.0F);
+ setItemStack(stack);
+ if (tooltip) {
+ setTooltip();
+ }
+ }
+
+ public ControlItemDisplay(IWidget parent, float x, float y, float size)
+ {
+ super(parent, x, y, size, size);
+ }
+
+ public void onRenderBackground()
+ {
+ IPoint relativeToWindow = getAbsolutePosition().sub(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) {
+ if (getSize().x() != 16.0F)
+ {
+ GL11.glPushMatrix();
+ float scale = getSize().x() / 16.0F;
+ GL11.glScalef(scale, scale, 1.0F);
+ BinnieCore.proxy.getMinecraftInstance();float phase = (float)Minecraft.getSystemTime() / 20.0F;
+ CraftGUI.Render.item(IPoint.ZERO, this.itemStack, this.rotating);
+ GL11.glPopMatrix();
+ }
+ else
+ {
+ CraftGUI.Render.item(IPoint.ZERO, this.itemStack, this.rotating);
+ }
+ }
+ }
+
+ public void setItemStack(ItemStack itemStack)
+ {
+ this.itemStack = itemStack;
+ }
+
+ public ItemStack getItemStack()
+ {
+ return this.itemStack;
+ }
+
+ public void getTooltip(Tooltip tooltip)
+ {
+ if ((this.hastooltip) && (this.itemStack != null)) {
+ tooltip.add(this.itemStack.getTooltip(((Window)getSuperParent()).getPlayer(), false));
+ }
+ super.getTooltip(tooltip);
+ }
+
+ private boolean rotating = false;
+
+ public void setRotating()
+ {
+ this.rotating = true;
+ }
+}
diff --git a/src/Java/binnie/craftgui/minecraft/control/ControlLiquidTank.java b/src/Java/binnie/craftgui/minecraft/control/ControlLiquidTank.java
new file mode 100644
index 0000000000..d69c61136d
--- /dev/null
+++ b/src/Java/binnie/craftgui/minecraft/control/ControlLiquidTank.java
@@ -0,0 +1,223 @@
+package binnie.craftgui.minecraft.control;
+
+import binnie.core.BinnieCore;
+import binnie.core.machines.Machine;
+import binnie.core.machines.inventory.MachineSide;
+import binnie.core.machines.inventory.TankSlot;
+import binnie.core.machines.inventory.Validator;
+import binnie.core.machines.power.ITankMachine;
+import binnie.core.machines.power.TankInfo;
+import binnie.core.proxy.BinnieProxy;
+import binnie.craftgui.controls.core.Control;
+import binnie.craftgui.core.Attribute;
+import binnie.craftgui.core.CraftGUI;
+import binnie.craftgui.core.ITooltip;
+import binnie.craftgui.core.ITopLevelWidget;
+import binnie.craftgui.core.IWidget;
+import binnie.craftgui.core.Tooltip;
+import binnie.craftgui.core.Tooltip.Type;
+import binnie.craftgui.core.geometry.IArea;
+import binnie.craftgui.core.geometry.IPoint;
+import binnie.craftgui.core.renderer.Renderer;
+import binnie.craftgui.events.EventMouse.Down;
+import binnie.craftgui.events.EventMouse.Down.Handler;
+import binnie.craftgui.minecraft.ContainerCraftGUI;
+import binnie.craftgui.minecraft.GuiCraftGUI;
+import binnie.craftgui.minecraft.MinecraftTooltip;
+import binnie.craftgui.minecraft.MinecraftTooltip.Type;
+import binnie.craftgui.minecraft.Window;
+import binnie.craftgui.resource.minecraft.CraftGUITexture;
+import java.util.ArrayList;
+import java.util.List;
+import net.minecraft.client.renderer.texture.TextureMap;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.IIcon;
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidStack;
+import org.lwjgl.opengl.GL11;
+
+public class ControlLiquidTank
+ extends Control
+ implements ITooltip
+{
+ public static List<Integer> tankError = new ArrayList();
+ private int tankID = 0;
+ private boolean horizontal = false;
+
+ public ControlLiquidTank(IWidget parent, int x, int y)
+ {
+ this(parent, x, y, false);
+ }
+
+ public ControlLiquidTank(IWidget parent, int x, int y, boolean horizontal)
+ {
+ super(parent, x, y, horizontal ? 60.0F : 18.0F, horizontal ? 18.0F : 60.0F);
+ this.horizontal = horizontal;
+ addAttribute(Attribute.MouseOver);
+
+ addSelfEventHandler(new EventMouse.Down.Handler()
+ {
+ public void onEvent(EventMouse.Down event)
+ {
+ if (event.getButton() == 0)
+ {
+ NBTTagCompound nbt = new NBTTagCompound();
+ nbt.setByte("id", (byte)ControlLiquidTank.this.tankID);
+ Window.get(ControlLiquidTank.this.getWidget()).sendClientAction("tank-click", nbt);
+ }
+ }
+ });
+ }
+
+ public void setTankID(int tank)
+ {
+ this.tankID = tank;
+ }
+
+ public TankInfo getTank()
+ {
+ return Window.get(this).getContainer().getTankInfo(this.tankID);
+ }
+
+ public boolean isTankValid()
+ {
+ return !getTank().isEmpty();
+ }
+
+ public int getTankCapacity()
+ {
+ return (int)getTank().getCapacity();
+ }
+
+ public void onRenderBackground()
+ {
+ CraftGUI.Render.texture(this.horizontal ? CraftGUITexture.HorizontalLiquidTank : CraftGUITexture.LiquidTank, IPoint.ZERO);
+ if ((isMouseOver()) && (Window.get(this).getGui().isHelpMode()))
+ {
+ int c = -1442840576 + MinecraftTooltip.getOutline(Tooltip.Type.Help);
+ CraftGUI.Render.gradientRect(getArea().inset(1), c, c);
+ }
+ else if (tankError.contains(Integer.valueOf(this.tankID)))
+ {
+ int c = -1442840576 + MinecraftTooltip.getOutline(MinecraftTooltip.Type.Error);
+ CraftGUI.Render.gradientRect(getArea().inset(1), c, c);
+ }
+ else if (getSuperParent().getMousedOverWidget() == this)
+ {
+ if (Window.get(this).getGui().getDraggedItem() != null) {
+ CraftGUI.Render.gradientRect(getArea().inset(1), -1426089575, -1426089575);
+ } else {
+ CraftGUI.Render.gradientRect(getArea().inset(1), -2130706433, -2130706433);
+ }
+ }
+ if (isTankValid())
+ {
+ Object content = null;
+
+ float height = this.horizontal ? 16.0F : 58.0F;
+
+ int squaled = (int)(height * (getTank().getAmount() / getTank().getCapacity()));
+
+
+
+ int yPos = (int)height + 1;
+
+ Fluid fluid = getTank().liquid.getFluid();
+
+ int hex = fluid.getColor(getTank().liquid);
+
+ int r = (hex & 0xFF0000) >> 16;
+ int g = (hex & 0xFF00) >> 8;
+ int b = hex & 0xFF;
+
+ GL11.glColor4f(r / 255.0F, g / 255.0F, b / 255.0F, 1.0F);
+
+ GL11.glEnable(3042);
+
+ GL11.glBlendFunc(770, 771);
+
+ IPoint pos = getAbsolutePosition();
+ IPoint offset = new IPoint(0.0F, height - squaled);
+ IArea limited = getArea().inset(1);
+ if (this.horizontal) {
+ limited.setSize(new IPoint(limited.w() - 1.0F, limited.h()));
+ }
+ CraftGUI.Render.limitArea(new IArea(limited.pos().add(pos).add(offset), limited.size().sub(offset)));
+
+
+ GL11.glEnable(3089);
+
+ BinnieCore.proxy.bindTexture(TextureMap.locationItemsTexture);
+ for (int y = 0; y < height; y += 16) {
+ for (int x = 0; x < (this.horizontal ? 58 : 16); x += 16)
+ {
+ IIcon icon = fluid.getIcon();
+
+ CraftGUI.Render.iconBlock(new IPoint(1 + x, 1 + y), icon);
+ }
+ }
+ GL11.glDisable(3089);
+ GL11.glDisable(3042);
+ }
+ }
+
+ public void onRenderForeground()
+ {
+ CraftGUI.Render.texture(this.horizontal ? CraftGUITexture.HorizontalLiquidTankOverlay : CraftGUITexture.LiquidTankOverlay, IPoint.ZERO);
+ if ((isMouseOver()) && (Window.get(this).getGui().isHelpMode()))
+ {
+ IArea area = getArea();
+ CraftGUI.Render.colour(MinecraftTooltip.getOutline(Tooltip.Type.Help));
+ CraftGUI.Render.texture(CraftGUITexture.Outline, area.outset(1));
+ }
+ if (tankError.contains(Integer.valueOf(this.tankID)))
+ {
+ IArea area = getArea();
+ CraftGUI.Render.colour(MinecraftTooltip.getOutline(MinecraftTooltip.Type.Error));
+ CraftGUI.Render.texture(CraftGUITexture.Outline, area.outset(1));
+ }
+ }
+
+ public void getHelpTooltip(Tooltip tooltip)
+ {
+ if (getTankSlot() != null)
+ {
+ TankSlot slot = getTankSlot();
+ tooltip.add(slot.getName());
+ tooltip.add("Capacity: " + getTankCapacity() + " mB");
+ tooltip.add("Insert Side: " + MachineSide.asString(slot.getInputSides()));
+ tooltip.add("Extract Side: " + MachineSide.asString(slot.getOutputSides()));
+ if (slot.isReadOnly()) {
+ tooltip.add("Output Only Tank");
+ }
+ tooltip.add("Accepts: " + (slot.getValidator() == null ? "Any Item" : slot.getValidator().getTooltip()));
+
+ return;
+ }
+ }
+
+ public void getTooltip(Tooltip tooltip)
+ {
+ if (isTankValid())
+ {
+ int percentage = (int)(100.0D * getTank().getAmount() / getTankCapacity());
+
+ tooltip.add(getTank().getName());
+
+ tooltip.add(percentage + "% full");
+ tooltip.add((int)getTank().getAmount() + " mB");
+
+
+
+ return;
+ }
+ tooltip.add("Empty");
+ }
+
+ private TankSlot getTankSlot()
+ {
+ ITankMachine tank = (ITankMachine)Machine.getInterface(ITankMachine.class, Window.get(this).getInventory());
+
+ return tank != null ? tank.getTankSlot(this.tankID) : null;
+ }
+}
diff --git a/src/Java/binnie/craftgui/minecraft/control/ControlMachineProgress.java b/src/Java/binnie/craftgui/minecraft/control/ControlMachineProgress.java
new file mode 100644
index 0000000000..f2a64e3e38
--- /dev/null
+++ b/src/Java/binnie/craftgui/minecraft/control/ControlMachineProgress.java
@@ -0,0 +1,14 @@
+package binnie.craftgui.minecraft.control;
+
+import binnie.craftgui.core.IWidget;
+import binnie.craftgui.core.geometry.Position;
+import binnie.craftgui.resource.Texture;
+
+public class ControlMachineProgress
+ extends ControlProgress
+{
+ public ControlMachineProgress(IWidget parent, int x, int y, Texture base, Texture progress, Position dir)
+ {
+ super(parent, x, y, base, progress, dir);
+ }
+}
diff --git a/src/Java/binnie/craftgui/minecraft/control/ControlPlayerInventory.java b/src/Java/binnie/craftgui/minecraft/control/ControlPlayerInventory.java
new file mode 100644
index 0000000000..f15d102789
--- /dev/null
+++ b/src/Java/binnie/craftgui/minecraft/control/ControlPlayerInventory.java
@@ -0,0 +1,108 @@
+package binnie.craftgui.minecraft.control;
+
+import binnie.craftgui.controls.core.Control;
+import binnie.craftgui.core.IWidget;
+import binnie.craftgui.core.geometry.IPoint;
+import binnie.craftgui.minecraft.InventoryType;
+import java.util.ArrayList;
+import java.util.List;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemStack;
+
+public class ControlPlayerInventory
+ extends Control
+{
+ private List<ControlSlot> slots = new ArrayList();
+
+ public ControlPlayerInventory(IWidget parent, boolean wide)
+ {
+ super(parent, (int)(parent.getSize().x() / 2.0F) - (wide ? 110 : 81), (int)parent.getSize().y() - (wide ? 54 : 76) - 12, wide ? 'Ü' : '¢', wide ? 54 : 76);
+ for (int row = 0; row < 3; row++) {
+ for (int column = 0; column < 9; column++)
+ {
+ ControlSlot slot = new ControlSlot(this, (wide ? 58 : 0) + column * 18, row * 18);
+ this.slots.add(slot);
+ }
+ }
+ if (wide) {
+ for (int i1 = 0; i1 < 9; i1++)
+ {
+ ControlSlot slot = new ControlSlot(this, i1 % 3 * 18, i1 / 3 * 18);
+ this.slots.add(slot);
+ }
+ } else {
+ for (int i1 = 0; i1 < 9; i1++)
+ {
+ ControlSlot slot = new ControlSlot(this, i1 * 18, 58.0F);
+ this.slots.add(slot);
+ }
+ }
+ create();
+ }
+
+ public ControlPlayerInventory(IWidget parent)
+ {
+ this(parent, false);
+ }
+
+ public ControlPlayerInventory(IWidget parent, int x, int y)
+ {
+ super(parent, x, y, 54.0F, 220.0F);
+ for (int row = 0; row < 6; row++) {
+ for (int column = 0; column < 6; column++)
+ {
+ ControlSlot slot = new ControlSlot(this, column * 18, row * 18);
+ this.slots.add(slot);
+ }
+ }
+ create();
+ }
+
+ public void create()
+ {
+ for (int row = 0; row < 3; row++) {
+ for (int column = 0; column < 9; column++)
+ {
+ ControlSlot slot = (ControlSlot)this.slots.get(column + row * 9);
+ slot.assign(InventoryType.Player, 9 + column + row * 9);
+ }
+ }
+ for (int i1 = 0; i1 < 9; i1++)
+ {
+ ControlSlot slot = (ControlSlot)this.slots.get(27 + i1);
+ slot.assign(InventoryType.Player, i1);
+ }
+ }
+
+ public void addItem(ItemStack item)
+ {
+ if (item == null) {
+ return;
+ }
+ for (ControlSlot slot : this.slots) {
+ if (!slot.slot.getHasStack())
+ {
+ slot.slot.putStack(item);
+ return;
+ }
+ }
+ }
+
+ public void addInventory(IInventory inventory)
+ {
+ for (int i = 0; i < inventory.getSizeInventory(); i++) {
+ addItem(inventory.getStackInSlot(i));
+ }
+ }
+
+ public ControlSlot getSlot(int i)
+ {
+ if ((i < 0) || (i >= this.slots.size())) {
+ return null;
+ }
+ return (ControlSlot)this.slots.get(i);
+ }
+
+ public void onUpdateClient() {}
+}
diff --git a/src/Java/binnie/craftgui/minecraft/control/ControlPowerSystem.java b/src/Java/binnie/craftgui/minecraft/control/ControlPowerSystem.java
new file mode 100644
index 0000000000..b0f522b180
--- /dev/null
+++ b/src/Java/binnie/craftgui/minecraft/control/ControlPowerSystem.java
@@ -0,0 +1,39 @@
+package binnie.craftgui.minecraft.control;
+
+import binnie.core.machines.power.PowerSystem;
+import binnie.craftgui.controls.core.Control;
+import binnie.craftgui.core.Attribute;
+import binnie.craftgui.core.CraftGUI;
+import binnie.craftgui.core.ITooltip;
+import binnie.craftgui.core.IWidget;
+import binnie.craftgui.core.Tooltip;
+import binnie.craftgui.core.Tooltip.Type;
+import binnie.craftgui.core.renderer.Renderer;
+import binnie.craftgui.resource.minecraft.CraftGUITexture;
+
+public class ControlPowerSystem
+ extends Control
+ implements ITooltip
+{
+ private PowerSystem system;
+
+ public ControlPowerSystem(IWidget parent, float x, float y, PowerSystem system)
+ {
+ super(parent, x, y, 16.0F, 16.0F);
+ addAttribute(Attribute.MouseOver);
+ this.system = system;
+ }
+
+ public void onRenderBackground()
+ {
+ CraftGUI.Render.texture(CraftGUITexture.PowerButton, getArea());
+ }
+
+ public void getTooltip(Tooltip tooltip)
+ {
+ tooltip.setType(Tooltip.Type.Power);
+ tooltip.add("Power Supply");
+ tooltip.add("Powered by " + this.system.getUnitName());
+ tooltip.setMaxWidth(200);
+ }
+}
diff --git a/src/Java/binnie/craftgui/minecraft/control/ControlProgress.java b/src/Java/binnie/craftgui/minecraft/control/ControlProgress.java
new file mode 100644
index 0000000000..6508c84107
--- /dev/null
+++ b/src/Java/binnie/craftgui/minecraft/control/ControlProgress.java
@@ -0,0 +1,30 @@
+package binnie.craftgui.minecraft.control;
+
+import binnie.craftgui.core.CraftGUI;
+import binnie.craftgui.core.IWidget;
+import binnie.craftgui.core.geometry.Position;
+import binnie.craftgui.core.renderer.Renderer;
+import binnie.craftgui.resource.Texture;
+
+public class ControlProgress
+ extends ControlProgressBase
+{
+ private Texture progressBlank;
+ private Texture progressBar;
+ private Position direction;
+
+ public ControlProgress(IWidget parent, int x, int y, Texture progressBlank, Texture progressBar, Position dir)
+ {
+ super(parent, x, y, progressBlank == null ? 0.0F : progressBlank.w(), progressBlank == null ? 0.0F : progressBlank.h());
+ this.progressBlank = progressBlank;
+ this.progressBar = progressBar;
+ this.progress = 0.0F;
+ this.direction = dir;
+ }
+
+ public void onRenderBackground()
+ {
+ CraftGUI.Render.texture(this.progressBlank, getArea());
+ CraftGUI.Render.texturePercentage(this.progressBar, getArea(), this.direction, this.progress);
+ }
+}
diff --git a/src/Java/binnie/craftgui/minecraft/control/ControlProgressBase.java b/src/Java/binnie/craftgui/minecraft/control/ControlProgressBase.java
new file mode 100644
index 0000000000..f7e2ef4f39
--- /dev/null
+++ b/src/Java/binnie/craftgui/minecraft/control/ControlProgressBase.java
@@ -0,0 +1,100 @@
+package binnie.craftgui.minecraft.control;
+
+import binnie.core.machines.IMachine;
+import binnie.core.machines.Machine;
+import binnie.core.machines.power.IProcess;
+import binnie.core.machines.power.ProcessInfo;
+import binnie.craftgui.controls.core.Control;
+import binnie.craftgui.core.Attribute;
+import binnie.craftgui.core.IWidget;
+import binnie.craftgui.core.Tooltip;
+import binnie.craftgui.minecraft.ContainerCraftGUI;
+import binnie.craftgui.minecraft.Window;
+
+public class ControlProgressBase
+ extends Control
+{
+ protected float progress;
+
+ public ControlProgressBase(IWidget parent, float x, float y, float w, float h)
+ {
+ super(parent, x, y, w, h);
+ this.progress = 0.0F;
+ addAttribute(Attribute.MouseOver);
+ }
+
+ public void setProgress(float progress)
+ {
+ this.progress = progress;
+ if (this.progress < 0.0F) {
+ this.progress = 0.0F;
+ } else if (this.progress > 1.0F) {
+ this.progress = 1.0F;
+ }
+ }
+
+ protected ProcessInfo getProcess()
+ {
+ return Window.get(this).getContainer().getProcessInfo();
+ }
+
+ public void onUpdateClient()
+ {
+ ProcessInfo process = getProcess();
+ if (process != null) {
+ setProgress(process.getCurrentProgress() / 100.0F);
+ }
+ }
+
+ public void getHelpTooltip(Tooltip tooltip)
+ {
+ ProcessInfo process = getProcess();
+
+ IProcess machineProcess = (IProcess)Machine.getMachine(Window.get(this).getInventory()).getInterface(IProcess.class);
+ if (process != null)
+ {
+ tooltip.add("Progress");
+ if (this.progress == 0.0F) {
+ tooltip.add("Not in Progress");
+ } else if (process.getProcessTime() > 0) {
+ tooltip.add(machineProcess.getTooltip() + " (" + (int)process.getCurrentProgress() + "%)");
+ } else {
+ tooltip.add("In Progress");
+ }
+ if (process.getProcessTime() > 0)
+ {
+ tooltip.add("Time Left: " + convertTime((int)((1.0F - this.progress) * process.getProcessTime())));
+
+ tooltip.add("Total Time: " + convertTime(process.getProcessTime()));
+ tooltip.add("Energy Cost: " + process.getProcessEnergy() * 10 + " RF");
+ }
+ else
+ {
+ tooltip.add("Energy Cost: " + process.getEnergyPerTick() * 10.0F + " RF / tick");
+ }
+ }
+ }
+
+ public static String convertTime(int time)
+ {
+ int seconds = (int)(time / 20.0F);
+ int minutes = 0;
+ while (seconds >= 60)
+ {
+ minutes++;
+ seconds -= 60;
+ }
+ String ts = "";
+ if (minutes > 0) {
+ ts = ts + minutes + " minute" + (minutes == 1 ? "" : "s");
+ }
+ if (seconds > 0)
+ {
+ if (ts.length() > 0) {
+ ts = ts + " ";
+ }
+ ts = ts + seconds + " second" + (seconds == 1 ? "" : "s");
+ }
+ return ts;
+ }
+}
diff --git a/src/Java/binnie/craftgui/minecraft/control/ControlSlide.java b/src/Java/binnie/craftgui/minecraft/control/ControlSlide.java
new file mode 100644
index 0000000000..44cfe0fd37
--- /dev/null
+++ b/src/Java/binnie/craftgui/minecraft/control/ControlSlide.java
@@ -0,0 +1,113 @@
+package binnie.craftgui.minecraft.control;
+
+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.IArea;
+import binnie.craftgui.core.geometry.IBorder;
+import binnie.craftgui.core.geometry.IPoint;
+import binnie.craftgui.core.geometry.Position;
+import binnie.craftgui.core.geometry.TextJustification;
+import binnie.craftgui.core.renderer.Renderer;
+import binnie.craftgui.resource.Texture;
+import binnie.craftgui.resource.minecraft.CraftGUITexture;
+import org.lwjgl.opengl.GL11;
+
+public class ControlSlide
+ extends Control
+{
+ private IArea expanded;
+ private IArea shrunk;
+ private boolean slideActive = true;
+ private Position anchor;
+ private String label = null;
+
+ public ControlSlide(IWidget parent, float x, float y, float w, float h, Position anchor2)
+ {
+ super(parent, x, y, w, h);
+ addAttribute(Attribute.MouseOver);
+ addAttribute(Attribute.BlockTooltip);
+ this.expanded = new IArea(getPosition(), getSize());
+ this.anchor = anchor2.opposite();
+ float border = this.anchor.x() != 0 ? this.expanded.w() - 6.0F : this.expanded.h() - 6.0F;
+ this.shrunk = this.expanded.inset(new IBorder(this.anchor, border));
+
+
+ this.slideActive = false;
+ }
+
+ public void onRenderBackground()
+ {
+ super.onRenderBackground();
+ if (this.label != null)
+ {
+ float lw = CraftGUI.Render.textWidth(this.label) + 16;
+ float lh = CraftGUI.Render.textHeight() + 16;
+ boolean hor = this.anchor.x() != 0;
+ IArea ar = isSlideActive() ? this.expanded : this.shrunk;
+ IArea tabArea = new IArea(hor ? -lh / 2.0F : -lw / 2.0F, hor ? -lw / 2.0F : -lh / 2.0F, hor ? lh : lw, hor ? lw : lh);
+ IPoint shift = new IPoint(ar.w() * (1 - this.anchor.x()) / 2.0F, ar.h() * (1 - this.anchor.y()) / 2.0F);
+
+
+
+
+ tabArea = tabArea.shift(shift.x() - (-3.0F + lh / 2.0F) * this.anchor.x(), shift.y() - (-3.0F + lh / 2.0F) * this.anchor.y());
+ Texture texture = CraftGUI.Render.getTexture(isSlideActive() ? CraftGUITexture.Tab : CraftGUITexture.TabDisabled).crop(this.anchor.opposite(), 8.0F);
+ CraftGUI.Render.texture(texture, tabArea);
+ texture = CraftGUI.Render.getTexture(CraftGUITexture.TabOutline).crop(this.anchor.opposite(), 8.0F);
+ CraftGUI.Render.texture(texture, tabArea.inset(2));
+ IArea labelArea = new IArea(-lw / 2.0F, 0.0F, lw, lh);
+ GL11.glPushMatrix();
+ GL11.glTranslatef(shift.x() + this.anchor.x() * 2.0F, shift.y() + this.anchor.y() * 2.0F, 0.0F);
+ if (this.anchor.x() != 0) {
+ GL11.glRotatef(90.0F, 0.0F, 0.0F, this.anchor.x());
+ }
+ if (this.anchor.y() > 0) {
+ GL11.glTranslatef(0.0F, -lh, 0.0F);
+ }
+ CraftGUI.Render.text(labelArea, TextJustification.MiddleCenter, this.label, 16777215);
+ GL11.glPopMatrix();
+ }
+ CraftGUI.Render.texture(CraftGUITexture.Window, getArea());
+ Object slideTexture = this.anchor == Position.Left ? CraftGUITexture.SlideLeft : this.anchor == Position.Top ? CraftGUITexture.SlideUp : this.anchor == Position.Bottom ? CraftGUITexture.SlideDown : CraftGUITexture.SlideRight;
+
+ CraftGUI.Render.texture(slideTexture, new IPoint((this.anchor.x() + 1.0F) * w() / 2.0F - 8.0F, (this.anchor.y() + 1.0F) * h() / 2.0F - 8.0F));
+ }
+
+ public boolean isSlideActive()
+ {
+ return this.slideActive;
+ }
+
+ public void onUpdateClient()
+ {
+ boolean mouseOver = isMouseOverWidget(getRelativeMousePosition());
+ if (mouseOver != this.slideActive) {
+ setSlide(mouseOver);
+ }
+ }
+
+ public boolean isMouseOverWidget(IPoint relativeMouse)
+ {
+ return getArea().outset(isSlideActive() ? 16 : 8).outset(new IBorder(this.anchor.opposite(), 16.0F)).contains(relativeMouse);
+ }
+
+ public boolean isChildVisible(IWidget child)
+ {
+ return this.slideActive;
+ }
+
+ public void setSlide(boolean b)
+ {
+ this.slideActive = b;
+ IArea area = isSlideActive() ? this.expanded : this.shrunk;
+ setSize(area.size());
+ setPosition(area.pos());
+ }
+
+ public void setLabel(String l)
+ {
+ this.label = l;
+ }
+}
diff --git a/src/Java/binnie/craftgui/minecraft/control/ControlSlot.java b/src/Java/binnie/craftgui/minecraft/control/ControlSlot.java
new file mode 100644
index 0000000000..c3de12acaa
--- /dev/null
+++ b/src/Java/binnie/craftgui/minecraft/control/ControlSlot.java
@@ -0,0 +1,221 @@
+package binnie.craftgui.minecraft.control;
+
+import binnie.core.machines.inventory.InventorySlot;
+import binnie.core.machines.inventory.MachineSide;
+import binnie.core.machines.inventory.SlotValidator;
+import binnie.craftgui.core.CraftGUI;
+import binnie.craftgui.core.ITopLevelWidget;
+import binnie.craftgui.core.IWidget;
+import binnie.craftgui.core.Tooltip;
+import binnie.craftgui.core.geometry.IArea;
+import binnie.craftgui.core.geometry.IPoint;
+import binnie.craftgui.core.renderer.Renderer;
+import binnie.craftgui.events.EventMouse.Down;
+import binnie.craftgui.events.EventMouse.Down.Handler;
+import binnie.craftgui.minecraft.ContainerCraftGUI;
+import binnie.craftgui.minecraft.CustomSlot;
+import binnie.craftgui.minecraft.GuiCraftGUI;
+import binnie.craftgui.minecraft.InventoryType;
+import binnie.craftgui.minecraft.Window;
+import binnie.craftgui.minecraft.WindowInventory;
+import binnie.craftgui.resource.minecraft.CraftGUITexture;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.GuiScreen;
+import net.minecraft.client.multiplayer.PlayerControllerMP;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.IIcon;
+
+public class ControlSlot
+ extends ControlSlotBase
+{
+ public static Map<EnumHighlighting, List<Integer>> highlighting = new HashMap();
+ public static boolean shiftClickActive = false;
+
+ static
+ {
+ for (EnumHighlighting h : EnumHighlighting.values()) {
+ highlighting.put(h, new ArrayList());
+ }
+ }
+
+ public Slot slot = null;
+
+ public ControlSlot(IWidget parent, float x, float y)
+ {
+ super(parent, x, y);
+
+ addSelfEventHandler(new EventMouse.Down.Handler()
+ {
+ public void onEvent(EventMouse.Down event)
+ {
+ if (ControlSlot.this.slot != null)
+ {
+ Window.get(ControlSlot.this.getWidget()).getGui();((Window)ControlSlot.this.getSuperParent()).getGui().getMinecraft().playerController.windowClick(((Window)ControlSlot.this.getSuperParent()).getContainer().windowId, ControlSlot.this.slot.slotNumber, event.getButton(), GuiCraftGUI.isShiftKeyDown() ? 1 : 0, ((Window)ControlSlot.this.getSuperParent()).getGui().getMinecraft().thePlayer);
+ }
+ }
+ });
+ }
+
+ public ControlSlot(IWidget parent, int x, int y, Slot slot)
+ {
+ super(parent, x, y);
+ this.slot = slot;
+ }
+
+ public void onRenderBackground()
+ {
+ CraftGUI.Render.texture(CraftGUITexture.Slot, IPoint.ZERO);
+ if (this.slot == null) {
+ return;
+ }
+ InventorySlot islot = getInventorySlot();
+ if ((islot != null) && (islot.getValidator() != null))
+ {
+ IIcon icon = islot.getValidator().getIcon(!islot.getInputSides().isEmpty());
+ if (icon != null) {
+ CraftGUI.Render.iconItem(new IPoint(1.0F, 1.0F), icon);
+ }
+ }
+ boolean highlighted = false;
+ for (Map.Entry<EnumHighlighting, List<Integer>> highlight : highlighting.entrySet()) {
+ if ((highlight.getKey() != EnumHighlighting.ShiftClick) || (shiftClickActive)) {
+ if ((!highlighted) && (((List)highlight.getValue()).contains(Integer.valueOf(this.slot.slotNumber))))
+ {
+ highlighted = true;
+
+ int c = -1442840576 + Math.min(((EnumHighlighting)highlight.getKey()).getColour(), 16777215);
+ CraftGUI.Render.gradientRect(new IArea(1.0F, 1.0F, 16.0F, 16.0F), c, c);
+ }
+ }
+ }
+ if ((!highlighted) && (getSuperParent().getMousedOverWidget() == this)) {
+ if ((Window.get(this).getGui().getDraggedItem() != null) && (!this.slot.isItemValid(Window.get(this).getGui().getDraggedItem()))) {
+ CraftGUI.Render.gradientRect(new IArea(1.0F, 1.0F, 16.0F, 16.0F), -1426089575, -1426089575);
+ } else {
+ CraftGUI.Render.gradientRect(new IArea(1.0F, 1.0F, 16.0F, 16.0F), -2130706433, -2130706433);
+ }
+ }
+ }
+
+ public void onRenderOverlay()
+ {
+ if (this.slot == null) {
+ return;
+ }
+ boolean highlighted = false;
+ for (Map.Entry<EnumHighlighting, List<Integer>> highlight : highlighting.entrySet()) {
+ if ((highlight.getKey() != EnumHighlighting.ShiftClick) || (shiftClickActive)) {
+ if ((!highlighted) && (((List)highlight.getValue()).contains(Integer.valueOf(this.slot.slotNumber))))
+ {
+ highlighted = true;
+ int c = ((EnumHighlighting)highlight.getKey()).getColour();
+ IArea area = getArea();
+ if (((getParent() instanceof ControlSlotArray)) || ((getParent() instanceof ControlPlayerInventory)))
+ {
+ area = getParent().getArea();
+ area.setPosition(IPoint.ZERO.sub(getPosition()));
+ }
+ CraftGUI.Render.colour(c);
+ CraftGUI.Render.texture(CraftGUITexture.Outline, area.outset(1));
+ }
+ }
+ }
+ }
+
+ public void onUpdateClient()
+ {
+ super.onUpdateClient();
+ if (this.slot == null) {
+ return;
+ }
+ if ((isMouseOver()) && (GuiScreen.isShiftKeyDown()))
+ {
+ Window.get(this).getContainer().setMouseOverSlot(this.slot);
+ shiftClickActive = true;
+ }
+ if (Window.get(this).getGui().isHelpMode()) {
+ if (isMouseOver()) {
+ for (ControlSlot slot2 : getControlSlots()) {
+ if (slot2.slot != null) {
+ ((List)highlighting.get(EnumHighlighting.Help)).add(Integer.valueOf(slot2.slot.slotNumber));
+ }
+ }
+ }
+ }
+ }
+
+ private List<ControlSlot> getControlSlots()
+ {
+ List<ControlSlot> slots = new ArrayList();
+ if (((getParent() instanceof ControlSlotArray)) || ((getParent() instanceof ControlPlayerInventory))) {
+ for (IWidget child : getParent().getWidgets()) {
+ slots.add((ControlSlot)child);
+ }
+ } else {
+ slots.add(this);
+ }
+ return slots;
+ }
+
+ public ItemStack getItemStack()
+ {
+ if (this.slot != null) {
+ return this.slot.getStack();
+ }
+ return null;
+ }
+
+ public ControlSlot assign(int index)
+ {
+ return assign(InventoryType.Machine, index);
+ }
+
+ public ControlSlot assign(InventoryType inventory, int index)
+ {
+ if (this.slot != null) {
+ return this;
+ }
+ this.slot = ((Window)getSuperParent()).getContainer().getOrCreateSlot(inventory, index);
+ return this;
+ }
+
+ public void getHelpTooltip(Tooltip tooltip)
+ {
+ if (this.slot == null) {
+ return;
+ }
+ InventorySlot slot = getInventorySlot();
+ if (getInventorySlot() != null)
+ {
+ tooltip.add(slot.getName());
+ tooltip.add("Insert Side: " + MachineSide.asString(slot.getInputSides()));
+ tooltip.add("Extract Side: " + MachineSide.asString(slot.getOutputSides()));
+ if (slot.isReadOnly()) {
+ tooltip.add("Pickup Only Slot");
+ }
+ tooltip.add("Accepts: " + (slot.getValidator() == null ? "Any Item" : slot.getValidator().getTooltip()));
+ }
+ else if ((this.slot.inventory instanceof WindowInventory))
+ {
+ SlotValidator s = ((WindowInventory)this.slot.inventory).getValidator(this.slot.getSlotIndex());
+ tooltip.add("Accepts: " + (s == null ? "Any Item" : s.getTooltip()));
+ }
+ else if ((this.slot.inventory instanceof InventoryPlayer))
+ {
+ tooltip.add("Player Inventory");
+ }
+ }
+
+ public InventorySlot getInventorySlot()
+ {
+ return (this.slot instanceof CustomSlot) ? ((CustomSlot)this.slot).getInventorySlot() : null;
+ }
+}
diff --git a/src/Java/binnie/craftgui/minecraft/control/ControlSlotArray.java b/src/Java/binnie/craftgui/minecraft/control/ControlSlotArray.java
new file mode 100644
index 0000000000..772b9a5f85
--- /dev/null
+++ b/src/Java/binnie/craftgui/minecraft/control/ControlSlotArray.java
@@ -0,0 +1,76 @@
+package binnie.craftgui.minecraft.control;
+
+import binnie.craftgui.controls.core.Control;
+import binnie.craftgui.core.IWidget;
+import binnie.craftgui.minecraft.InventoryType;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemStack;
+
+public class ControlSlotArray
+ extends Control
+ implements Iterable<ControlSlot>
+{
+ private int rows;
+ private int columns;
+ private List<ControlSlot> slots = new ArrayList();
+
+ public ControlSlotArray(IWidget parent, int x, int y, int columns, int rows)
+ {
+ super(parent, x, y, columns * 18, rows * 18);
+ this.rows = rows;
+ this.columns = columns;
+ for (int row = 0; row < rows; row++) {
+ for (int column = 0; column < columns; column++) {
+ this.slots.add(createSlot(column * 18, row * 18));
+ }
+ }
+ }
+
+ public ControlSlot createSlot(int x, int y)
+ {
+ return new ControlSlot(this, x, y);
+ }
+
+ public void setItemStacks(ItemStack[] array)
+ {
+ int i = 0;
+ for (ItemStack item : array)
+ {
+ if (i >= this.slots.size()) {
+ return;
+ }
+ ((ControlSlot)this.slots.get(i)).slot.putStack(item);
+ i++;
+ }
+ }
+
+ public ControlSlot getControlSlot(int i)
+ {
+ if ((i < 0) || (i >= this.slots.size())) {
+ return null;
+ }
+ return (ControlSlot)this.slots.get(i);
+ }
+
+ public ControlSlotArray create(int[] index)
+ {
+ return create(InventoryType.Machine, index);
+ }
+
+ public ControlSlotArray create(InventoryType type, int[] index)
+ {
+ int i = 0;
+ for (ControlSlot slot : this.slots) {
+ slot.assign(type, index[(i++)]);
+ }
+ return this;
+ }
+
+ public Iterator<ControlSlot> iterator()
+ {
+ return this.slots.iterator();
+ }
+}
diff --git a/src/Java/binnie/craftgui/minecraft/control/ControlSlotBase.java b/src/Java/binnie/craftgui/minecraft/control/ControlSlotBase.java
new file mode 100644
index 0000000000..db7b9fa973
--- /dev/null
+++ b/src/Java/binnie/craftgui/minecraft/control/ControlSlotBase.java
@@ -0,0 +1,77 @@
+package binnie.craftgui.minecraft.control;
+
+import binnie.craftgui.controls.core.Control;
+import binnie.craftgui.core.Attribute;
+import binnie.craftgui.core.CraftGUI;
+import binnie.craftgui.core.ITooltip;
+import binnie.craftgui.core.ITopLevelWidget;
+import binnie.craftgui.core.IWidget;
+import binnie.craftgui.core.Tooltip;
+import binnie.craftgui.core.geometry.IArea;
+import binnie.craftgui.core.geometry.IPoint;
+import binnie.craftgui.core.renderer.Renderer;
+import binnie.craftgui.events.EventWidget.ChangeSize;
+import binnie.craftgui.events.EventWidget.ChangeSize.Handler;
+import binnie.craftgui.minecraft.Window;
+import binnie.craftgui.resource.minecraft.CraftGUITexture;
+import net.minecraft.item.ItemStack;
+
+public abstract class ControlSlotBase
+ extends Control
+ implements ITooltip
+{
+ private ControlItemDisplay itemDisplay;
+
+ public ControlSlotBase(IWidget parent, float x, float y)
+ {
+ this(parent, x, y, 18);
+ }
+
+ public ControlSlotBase(IWidget parent, float x, float y, int size)
+ {
+ super(parent, x, y, size, size);
+ addAttribute(Attribute.MouseOver);
+ this.itemDisplay = new ControlItemDisplay(this, 1.0F, 1.0F, size - 2);
+
+ addSelfEventHandler(new EventWidget.ChangeSize.Handler()
+ {
+ public void onEvent(EventWidget.ChangeSize event)
+ {
+ if (ControlSlotBase.this.itemDisplay != null) {
+ ControlSlotBase.this.itemDisplay.setSize(ControlSlotBase.this.getSize().sub(new IPoint(2.0F, 2.0F)));
+ }
+ }
+ });
+ }
+
+ protected void setRotating()
+ {
+ this.itemDisplay.setRotating();
+ }
+
+ public void onRenderBackground()
+ {
+ int size = (int)getSize().x();
+ CraftGUI.Render.texture(CraftGUITexture.Slot, getArea());
+ if (getSuperParent().getMousedOverWidget() == this) {
+ CraftGUI.Render.gradientRect(new IArea(new IPoint(1.0F, 1.0F), getArea().size().sub(new IPoint(2.0F, 2.0F))), -2130706433, -2130706433);
+ }
+ }
+
+ public void onUpdateClient()
+ {
+ super.onUpdateClient();
+ this.itemDisplay.setItemStack(getItemStack());
+ }
+
+ public void getTooltip(Tooltip tooltip)
+ {
+ ItemStack item = getItemStack();
+ if (item == null) {
+ return;
+ }
+ tooltip.add(item.getTooltip(((Window)getSuperParent()).getPlayer(), false));
+ }
+
+ public abstract ItemStack getItemStack();
+}
diff --git a/src/Java/binnie/craftgui/minecraft/control/ControlSlotCharge.java b/src/Java/binnie/craftgui/minecraft/control/ControlSlotCharge.java
new file mode 100644
index 0000000000..eb14237a4d
--- /dev/null
+++ b/src/Java/binnie/craftgui/minecraft/control/ControlSlotCharge.java
@@ -0,0 +1,43 @@
+package binnie.craftgui.minecraft.control;
+
+import binnie.core.machines.Machine;
+import binnie.core.machines.inventory.IChargedSlots;
+import binnie.craftgui.controls.core.Control;
+import binnie.craftgui.core.CraftGUI;
+import binnie.craftgui.core.IWidget;
+import binnie.craftgui.core.Tooltip;
+import binnie.craftgui.core.geometry.IArea;
+import binnie.craftgui.core.geometry.Position;
+import binnie.craftgui.core.renderer.Renderer;
+import binnie.craftgui.minecraft.Window;
+import binnie.craftgui.resource.minecraft.CraftGUITexture;
+
+public class ControlSlotCharge
+ extends Control
+{
+ private int slot;
+
+ float getCharge()
+ {
+ IChargedSlots slots = (IChargedSlots)Machine.getInterface(IChargedSlots.class, Window.get(this).getInventory());
+ return slots == null ? 0.0F : slots.getCharge(this.slot);
+ }
+
+ public void onRenderBackground()
+ {
+ CraftGUI.Render.texture(CraftGUITexture.PanelBlack, getArea());
+
+ CraftGUI.Render.texturePercentage(CraftGUI.Render.getTexture(CraftGUITexture.SlotCharge), getArea().inset(1), Position.Bottom, getCharge());
+ }
+
+ public ControlSlotCharge(IWidget parent, int x, int y, int slot)
+ {
+ super(parent, x, y, 4.0F, 18.0F);
+ this.slot = slot;
+ }
+
+ public void getHelpTooltip(Tooltip tooltip)
+ {
+ tooltip.add("Charge Remaining: " + (int)(getCharge() * 100.0F) + "%");
+ }
+}
diff --git a/src/Java/binnie/craftgui/minecraft/control/ControlTabIcon.java b/src/Java/binnie/craftgui/minecraft/control/ControlTabIcon.java
new file mode 100644
index 0000000000..8337dc23fc
--- /dev/null
+++ b/src/Java/binnie/craftgui/minecraft/control/ControlTabIcon.java
@@ -0,0 +1,47 @@
+package binnie.craftgui.minecraft.control;
+
+import binnie.core.genetics.IItemStackRepresentitive;
+import binnie.craftgui.controls.tab.ControlTab;
+import binnie.craftgui.controls.tab.ControlTabBar;
+import binnie.craftgui.core.geometry.IPoint;
+import binnie.craftgui.core.geometry.Position;
+import net.minecraft.item.ItemStack;
+
+public class ControlTabIcon<T>
+ extends ControlTab<T>
+{
+ private ControlItemDisplay item;
+
+ public ControlTabIcon(ControlTabBar<T> parent, float x, float y, float w, float h, T value)
+ {
+ super(parent, x, y, w, h, value);
+ this.item = new ControlItemDisplay(this, -8.0F + w / 2.0F, -8.0F + h / 2.0F);
+ this.item.hastooltip = false;
+ }
+
+ public ItemStack getItemStack()
+ {
+ if ((this.value instanceof IItemStackRepresentitive)) {
+ return ((IItemStackRepresentitive)this.value).getItemStackRepresentitive();
+ }
+ return null;
+ }
+
+ public void onUpdateClient()
+ {
+ super.onUpdateClient();
+ this.item.setItemStack(getItemStack());
+ float x = ((ControlTabBar)getParent()).getDirection().x();
+ this.item.setOffset(new IPoint((isCurrentSelection()) || (isMouseOver()) ? 0.0F : -4.0F * x, 0.0F));
+ }
+
+ public boolean hasOutline()
+ {
+ return false;
+ }
+
+ public int getOutlineColour()
+ {
+ return 16777215;
+ }
+}
diff --git a/src/Java/binnie/craftgui/minecraft/control/ControlUser.java b/src/Java/binnie/craftgui/minecraft/control/ControlUser.java
new file mode 100644
index 0000000000..41c5a3c0bd
--- /dev/null
+++ b/src/Java/binnie/craftgui/minecraft/control/ControlUser.java
@@ -0,0 +1,41 @@
+package binnie.craftgui.minecraft.control;
+
+import binnie.craftgui.controls.core.Control;
+import binnie.craftgui.core.Attribute;
+import binnie.craftgui.core.CraftGUI;
+import binnie.craftgui.core.ITooltip;
+import binnie.craftgui.core.IWidget;
+import binnie.craftgui.core.Tooltip;
+import binnie.craftgui.core.Tooltip.Type;
+import binnie.craftgui.core.renderer.Renderer;
+import binnie.craftgui.resource.minecraft.CraftGUITexture;
+
+public class ControlUser
+ extends Control
+ implements ITooltip
+{
+ private String username = "";
+ String team = "";
+
+ public ControlUser(IWidget parent, float x, float y, String username)
+ {
+ super(parent, x, y, 16.0F, 16.0F);
+ addAttribute(Attribute.MouseOver);
+ this.username = username;
+ }
+
+ public void onRenderBackground()
+ {
+ CraftGUI.Render.texture(CraftGUITexture.UserButton, getArea());
+ }
+
+ public void getTooltip(Tooltip tooltip)
+ {
+ tooltip.setType(Tooltip.Type.User);
+ tooltip.add("Owner");
+ if (this.username != "") {
+ tooltip.add(this.username);
+ }
+ tooltip.setMaxWidth(200);
+ }
+}
diff --git a/src/Java/binnie/craftgui/minecraft/control/EnumHighlighting.java b/src/Java/binnie/craftgui/minecraft/control/EnumHighlighting.java
new file mode 100644
index 0000000000..7eb1f2d988
--- /dev/null
+++ b/src/Java/binnie/craftgui/minecraft/control/EnumHighlighting.java
@@ -0,0 +1,28 @@
+package binnie.craftgui.minecraft.control;
+
+import binnie.craftgui.core.Tooltip.Type;
+import binnie.craftgui.minecraft.MinecraftTooltip;
+import binnie.craftgui.minecraft.MinecraftTooltip.Type;
+
+public enum EnumHighlighting
+{
+ Error, Warning, Help, ShiftClick;
+
+ private EnumHighlighting() {}
+
+ int getColour()
+ {
+ switch (1.$SwitchMap$binnie$craftgui$minecraft$control$EnumHighlighting[ordinal()])
+ {
+ case 1:
+ return MinecraftTooltip.getOutline(MinecraftTooltip.Type.Error);
+ case 2:
+ return MinecraftTooltip.getOutline(Tooltip.Type.Help);
+ case 3:
+ return 16776960;
+ case 4:
+ return MinecraftTooltip.getOutline(MinecraftTooltip.Type.Warning);
+ }
+ return 0;
+ }
+}
diff --git a/src/Java/binnie/craftgui/minecraft/render/MinecraftTexture.java b/src/Java/binnie/craftgui/minecraft/render/MinecraftTexture.java
new file mode 100644
index 0000000000..51addcd1db
--- /dev/null
+++ b/src/Java/binnie/craftgui/minecraft/render/MinecraftTexture.java
@@ -0,0 +1,10 @@
+package binnie.craftgui.minecraft.render;
+
+import binnie.core.resource.IBinnieTexture;
+import binnie.craftgui.core.geometry.IArea;
+
+public class MinecraftTexture
+{
+ IArea textureArea = new IArea(0.0F, 0.0F, 0.0F, 0.0F);
+ IBinnieTexture texture;
+}
diff --git a/src/Java/binnie/craftgui/minecraft/render/RenderCommand.java b/src/Java/binnie/craftgui/minecraft/render/RenderCommand.java
new file mode 100644
index 0000000000..2cfa60f08a
--- /dev/null
+++ b/src/Java/binnie/craftgui/minecraft/render/RenderCommand.java
@@ -0,0 +1,16 @@
+package binnie.craftgui.minecraft.render;
+
+import binnie.craftgui.core.IWidget;
+import binnie.craftgui.minecraft.GuiCraftGUI;
+
+public abstract class RenderCommand
+{
+ IWidget widget;
+
+ public RenderCommand(IWidget widget)
+ {
+ this.widget = widget;
+ }
+
+ public abstract void render(GuiCraftGUI paramGuiCraftGUI);
+}
diff --git a/src/Java/binnie/craftgui/mod/database/ControlBranchBox.java b/src/Java/binnie/craftgui/mod/database/ControlBranchBox.java
new file mode 100644
index 0000000000..3aaf90d53a
--- /dev/null
+++ b/src/Java/binnie/craftgui/mod/database/ControlBranchBox.java
@@ -0,0 +1,20 @@
+package binnie.craftgui.mod.database;
+
+import binnie.craftgui.controls.listbox.ControlList;
+import binnie.craftgui.controls.listbox.ControlListBox;
+import binnie.craftgui.core.IWidget;
+import forestry.api.genetics.IClassification;
+
+class ControlBranchBox
+ extends ControlListBox<IClassification>
+{
+ public IWidget createOption(IClassification value, int y)
+ {
+ return new ControlBranchBoxOption((ControlList)getContent(), value, y);
+ }
+
+ public ControlBranchBox(IWidget parent, float x, float y, float width, float height)
+ {
+ super(parent, x, y, width, height, 12.0F);
+ }
+}
diff --git a/src/Java/binnie/craftgui/mod/database/ControlBranchBoxOption.java b/src/Java/binnie/craftgui/mod/database/ControlBranchBoxOption.java
new file mode 100644
index 0000000000..a3f83f403f
--- /dev/null
+++ b/src/Java/binnie/craftgui/mod/database/ControlBranchBoxOption.java
@@ -0,0 +1,14 @@
+package binnie.craftgui.mod.database;
+
+import binnie.craftgui.controls.listbox.ControlList;
+import binnie.craftgui.controls.listbox.ControlTextOption;
+import forestry.api.genetics.IClassification;
+
+class ControlBranchBoxOption
+ extends ControlTextOption<IClassification>
+{
+ public ControlBranchBoxOption(ControlList<IClassification> controlList, IClassification option, int y)
+ {
+ super(controlList, option, option.getName().contains(".") ? option.getScientific() : option.getName() == null ? option.getScientific() : option.getName(), y);
+ }
+}
diff --git a/src/Java/binnie/craftgui/mod/database/ControlBreedingProgress.java b/src/Java/binnie/craftgui/mod/database/ControlBreedingProgress.java
new file mode 100644
index 0000000000..9340a66752
--- /dev/null
+++ b/src/Java/binnie/craftgui/mod/database/ControlBreedingProgress.java
@@ -0,0 +1,41 @@
+package binnie.craftgui.mod.database;
+
+import binnie.core.genetics.BreedingSystem;
+import binnie.craftgui.controls.core.Control;
+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.renderer.Renderer;
+import binnie.craftgui.resource.Texture;
+import binnie.craftgui.resource.minecraft.CraftGUITexture;
+import binnie.craftgui.resource.minecraft.CraftGUITextureSheet;
+import binnie.craftgui.resource.minecraft.StandardTexture;
+
+class ControlBreedingProgress
+ extends Control
+{
+ private static Texture Progress = new StandardTexture(80, 22, 4, 4, CraftGUITextureSheet.Controls2);
+ private float percentage;
+ private int colour;
+
+ public ControlBreedingProgress(IWidget parent, int x, int y, int width, int height, BreedingSystem system, float percentage)
+ {
+ super(parent, x, y, width, height);
+ this.percentage = percentage;
+ this.colour = system.getColour();
+ }
+
+ public void onRenderBackground()
+ {
+ CraftGUI.Render.texture(CraftGUITexture.PanelBlack, getArea());
+
+ IArea area = getArea().inset(1);
+
+ area.setSize(new IPoint(area.size().x() * this.percentage, area.size().y()));
+
+ CraftGUI.Render.colour(this.colour);
+
+ CraftGUI.Render.texture(Progress, area);
+ }
+}
diff --git a/src/Java/binnie/craftgui/mod/database/ControlDatabaseIndividualDisplay.java b/src/Java/binnie/craftgui/mod/database/ControlDatabaseIndividualDisplay.java
new file mode 100644
index 0000000000..e46cf94df7
--- /dev/null
+++ b/src/Java/binnie/craftgui/mod/database/ControlDatabaseIndividualDisplay.java
@@ -0,0 +1,120 @@
+package binnie.craftgui.mod.database;
+
+import binnie.Binnie;
+import binnie.core.genetics.BreedingSystem;
+import binnie.core.genetics.ManagerGenetics;
+import binnie.craftgui.core.Attribute;
+import binnie.craftgui.core.CraftGUI;
+import binnie.craftgui.core.ITooltip;
+import binnie.craftgui.core.IWidget;
+import binnie.craftgui.core.Tooltip;
+import binnie.craftgui.core.geometry.IPoint;
+import binnie.craftgui.core.renderer.Renderer;
+import binnie.craftgui.events.EventMouse.Down;
+import binnie.craftgui.events.EventMouse.Down.Handler;
+import binnie.craftgui.minecraft.Window;
+import binnie.craftgui.minecraft.control.ControlItemDisplay;
+import com.mojang.authlib.GameProfile;
+import forestry.api.genetics.IAlleleSpecies;
+import forestry.api.genetics.IIndividual;
+import forestry.api.genetics.ISpeciesRoot;
+import net.minecraft.util.IIcon;
+
+public class ControlDatabaseIndividualDisplay
+ extends ControlItemDisplay
+ implements ITooltip
+{
+ public void setSpecies(IAlleleSpecies species)
+ {
+ setSpecies(species, EnumDiscoveryState.Show);
+ }
+
+ public void setSpecies(IAlleleSpecies species, EnumDiscoveryState state)
+ {
+ ISpeciesRoot speciesRoot = Binnie.Genetics.getSpeciesRoot(species);
+
+ BreedingSystem system = Binnie.Genetics.getSystem(speciesRoot.getUID());
+
+ IIndividual ind = system.getSpeciesRoot().templateAsIndividual(system.getSpeciesRoot().getTemplate(species.getUID()));
+
+ super.setItemStack(system.getSpeciesRoot().getMemberStack(ind, system.getDefaultType()));
+ this.species = species;
+
+ GameProfile username = Window.get(this).getUsername();
+ if (state == EnumDiscoveryState.Undetermined) {
+ state = system.isSpeciesDiscovered(species, Window.get(this).getWorld(), username) ? EnumDiscoveryState.Discovered : EnumDiscoveryState.Undiscovered;
+ }
+ if (((Window.get(this) instanceof WindowAbstractDatabase)) &&
+ (((WindowAbstractDatabase)Window.get(this)).isNEI)) {
+ state = EnumDiscoveryState.Show;
+ }
+ this.discovered = state;
+
+ addAttribute(Attribute.MouseOver);
+ }
+
+ private IAlleleSpecies species = null;
+ EnumDiscoveryState discovered = EnumDiscoveryState.Show;
+
+ public ControlDatabaseIndividualDisplay(IWidget parent, float x, float y)
+ {
+ this(parent, x, y, 16.0F);
+ }
+
+ public ControlDatabaseIndividualDisplay(IWidget parent, float x, float y, float size)
+ {
+ super(parent, x, y, size);
+
+
+ addSelfEventHandler(new EventMouse.Down.Handler()
+ {
+ public void onEvent(EventMouse.Down event)
+ {
+ if ((event.getButton() == 0) && (ControlDatabaseIndividualDisplay.this.species != null) && (EnumDiscoveryState.Show == ControlDatabaseIndividualDisplay.this.discovered)) {
+ ((WindowAbstractDatabase)ControlDatabaseIndividualDisplay.this.getSuperParent()).gotoSpeciesDelayed(ControlDatabaseIndividualDisplay.this.species);
+ }
+ }
+ });
+ }
+
+ public void onRenderForeground()
+ {
+ IIcon icon = null;
+ if (this.species == null) {
+ return;
+ }
+ BreedingSystem system = Binnie.Genetics.getSystem(this.species.getRoot());
+ switch (2.$SwitchMap$binnie$craftgui$mod$database$EnumDiscoveryState[this.discovered.ordinal()])
+ {
+ case 1:
+ super.onRenderForeground();
+ return;
+ case 2:
+ icon = system.getDiscoveredIcon();
+ break;
+ case 3:
+ icon = system.getUndiscoveredIcon();
+ break;
+ }
+ if (icon != null) {
+ CraftGUI.Render.iconItem(IPoint.ZERO, icon);
+ }
+ }
+
+ public void getTooltip(Tooltip tooltip)
+ {
+ if (this.species != null) {
+ switch (2.$SwitchMap$binnie$craftgui$mod$database$EnumDiscoveryState[this.discovered.ordinal()])
+ {
+ case 1:
+ tooltip.add(this.species.getName());
+ break;
+ case 2:
+ tooltip.add("Discovered Species");
+ break;
+ case 3:
+ tooltip.add("Undiscovered Species");
+ }
+ }
+ }
+}
diff --git a/src/Java/binnie/craftgui/mod/database/ControlItemStackOption.java b/src/Java/binnie/craftgui/mod/database/ControlItemStackOption.java
new file mode 100644
index 0000000000..2dfa33b083
--- /dev/null
+++ b/src/Java/binnie/craftgui/mod/database/ControlItemStackOption.java
@@ -0,0 +1,38 @@
+package binnie.craftgui.mod.database;
+
+import binnie.craftgui.controls.ControlText;
+import binnie.craftgui.controls.listbox.ControlList;
+import binnie.craftgui.controls.listbox.ControlTextOption;
+import binnie.craftgui.core.Attribute;
+import binnie.craftgui.core.CraftGUI;
+import binnie.craftgui.core.geometry.CraftGUIUtil;
+import binnie.craftgui.core.geometry.IPoint;
+import binnie.craftgui.core.renderer.Renderer;
+import binnie.craftgui.minecraft.control.ControlItemDisplay;
+import net.minecraft.item.ItemStack;
+
+public class ControlItemStackOption
+ extends ControlTextOption<ItemStack>
+{
+ private ControlItemDisplay controlBee;
+
+ public ControlItemStackOption(ControlList<ItemStack> controlList, ItemStack option, int y)
+ {
+ super(controlList, option, option.getDisplayName(), y);
+ setSize(new IPoint(getSize().x(), 20.0F));
+
+ this.controlBee = new ControlItemDisplay(this, 2.0F, 2.0F);
+ this.controlBee.setItemStack(option);
+
+ addAttribute(Attribute.MouseOver);
+
+ CraftGUIUtil.moveWidget(this.textWidget, new IPoint(22.0F, 0.0F));
+ this.textWidget.setSize(this.textWidget.getSize().sub(new IPoint(24.0F, 0.0F)));
+
+ int th = (int)CraftGUI.Render.textHeight(this.textWidget.getValue(), this.textWidget.getSize().x());
+ int height = Math.max(20, th + 6);
+ setSize(new IPoint(size().x(), height));
+ this.textWidget.setSize(new IPoint(this.textWidget.getSize().x(), height));
+ this.controlBee.setPosition(new IPoint(this.controlBee.pos().x(), (height - 18) / 2));
+ }
+}
diff --git a/src/Java/binnie/craftgui/mod/database/ControlMutationBox.java b/src/Java/binnie/craftgui/mod/database/ControlMutationBox.java
new file mode 100644
index 0000000000..62cdda8dcf
--- /dev/null
+++ b/src/Java/binnie/craftgui/mod/database/ControlMutationBox.java
@@ -0,0 +1,71 @@
+package binnie.craftgui.mod.database;
+
+import binnie.core.genetics.BreedingSystem;
+import binnie.craftgui.controls.listbox.ControlList;
+import binnie.craftgui.controls.listbox.ControlListBox;
+import binnie.craftgui.core.IWidget;
+import binnie.craftgui.minecraft.Window;
+import forestry.api.genetics.IAlleleSpecies;
+import forestry.api.genetics.IMutation;
+import java.util.List;
+
+class ControlMutationBox
+ extends ControlListBox<IMutation>
+{
+ private int index;
+ private Type type;
+
+ public IWidget createOption(IMutation value, int y)
+ {
+ return new ControlMutationItem((ControlList)getContent(), value, this.species, y);
+ }
+
+ static enum Type
+ {
+ Resultant, Further;
+
+ private Type() {}
+ }
+
+ public ControlMutationBox(IWidget parent, int x, int y, int width, int height, Type type)
+ {
+ super(parent, x, y, width, height, 12.0F);
+ this.type = type;
+ }
+
+ private IAlleleSpecies species = null;
+
+ public void setSpecies(IAlleleSpecies species)
+ {
+ if (species != this.species)
+ {
+ this.species = species;
+ this.index = 0;
+ movePercentage(-100.0F);
+
+ BreedingSystem system = ((WindowAbstractDatabase)getSuperParent()).getBreedingSystem();
+
+ List<IMutation> discovered = system.getDiscoveredMutations(Window.get(this).getWorld(), Window.get(this).getUsername());
+ if (species != null) {
+ if (this.type == Type.Resultant)
+ {
+ setOptions(system.getResultantMutations(species));
+ }
+ else
+ {
+ List<IMutation> mutations = system.getFurtherMutations(species);
+ for (int i = 0; i < mutations.size();)
+ {
+ IMutation mutation = (IMutation)mutations.get(i);
+ if ((!discovered.contains(mutations)) && (!((IAlleleSpecies)mutation.getTemplate()[0]).isCounted())) {
+ mutations.remove(i);
+ } else {
+ i++;
+ }
+ }
+ setOptions(mutations);
+ }
+ }
+ }
+ }
+}
diff --git a/src/Java/binnie/craftgui/mod/database/ControlMutationItem.java b/src/Java/binnie/craftgui/mod/database/ControlMutationItem.java
new file mode 100644
index 0000000000..630294e458
--- /dev/null
+++ b/src/Java/binnie/craftgui/mod/database/ControlMutationItem.java
@@ -0,0 +1,51 @@
+package binnie.craftgui.mod.database;
+
+import binnie.core.genetics.BreedingSystem;
+import binnie.craftgui.controls.listbox.ControlList;
+import binnie.craftgui.controls.listbox.ControlOption;
+import binnie.craftgui.minecraft.Window;
+import forestry.api.genetics.IAlleleSpecies;
+import forestry.api.genetics.IMutation;
+
+class ControlMutationItem
+ extends ControlOption<IMutation>
+{
+ private ControlDatabaseIndividualDisplay itemWidget1;
+ private ControlDatabaseIndividualDisplay itemWidget2;
+ private ControlDatabaseIndividualDisplay itemWidget3;
+ private ControlMutationSymbol addSymbol;
+ private ControlMutationSymbol arrowSymbol;
+
+ public ControlMutationItem(ControlList<IMutation> controlList, IMutation option, IAlleleSpecies species, int y)
+ {
+ super(controlList, option, y);
+ this.itemWidget1 = new ControlDatabaseIndividualDisplay(this, 4.0F, 4.0F);
+ this.itemWidget2 = new ControlDatabaseIndividualDisplay(this, 44.0F, 4.0F);
+ this.itemWidget3 = new ControlDatabaseIndividualDisplay(this, 104.0F, 4.0F);
+ this.addSymbol = new ControlMutationSymbol(this, 24, 4, 0);
+ this.arrowSymbol = new ControlMutationSymbol(this, 64, 4, 1);
+
+ boolean isNEI = ((WindowAbstractDatabase)getSuperParent()).isNEI();
+ BreedingSystem system = ((WindowAbstractDatabase)getSuperParent()).getBreedingSystem();
+ if (getValue() != null)
+ {
+ boolean isMutationDiscovered = system.isMutationDiscovered((IMutation)getValue(), Window.get(this).getWorld(), Window.get(this).getUsername());
+
+
+ IAlleleSpecies allele = null;
+ EnumDiscoveryState state = null;
+
+ allele = (IAlleleSpecies)((IMutation)getValue()).getAllele0();
+ state = species == allele ? EnumDiscoveryState.Show : (isNEI) || (isMutationDiscovered) ? EnumDiscoveryState.Show : EnumDiscoveryState.Undetermined;
+ this.itemWidget1.setSpecies(allele, state);
+ allele = (IAlleleSpecies)((IMutation)getValue()).getAllele1();
+ state = species == allele ? EnumDiscoveryState.Show : (isNEI) || (isMutationDiscovered) ? EnumDiscoveryState.Show : EnumDiscoveryState.Undetermined;
+ this.itemWidget2.setSpecies(allele, state);
+ allele = (IAlleleSpecies)((IMutation)getValue()).getTemplate()[0];
+ state = species == allele ? EnumDiscoveryState.Show : (isNEI) || (isMutationDiscovered) ? EnumDiscoveryState.Show : EnumDiscoveryState.Undetermined;
+ this.itemWidget3.setSpecies(allele, state);
+ this.addSymbol.setValue((IMutation)getValue());
+ this.arrowSymbol.setValue((IMutation)getValue());
+ }
+ }
+}
diff --git a/src/Java/binnie/craftgui/mod/database/ControlMutationSymbol.java b/src/Java/binnie/craftgui/mod/database/ControlMutationSymbol.java
new file mode 100644
index 0000000000..5c8bdc0aed
--- /dev/null
+++ b/src/Java/binnie/craftgui/mod/database/ControlMutationSymbol.java
@@ -0,0 +1,80 @@
+package binnie.craftgui.mod.database;
+
+import binnie.core.genetics.BreedingSystem;
+import binnie.craftgui.controls.core.Control;
+import binnie.craftgui.core.Attribute;
+import binnie.craftgui.core.CraftGUI;
+import binnie.craftgui.core.ITooltip;
+import binnie.craftgui.core.IWidget;
+import binnie.craftgui.core.Tooltip;
+import binnie.craftgui.core.geometry.IPoint;
+import binnie.craftgui.core.renderer.Renderer;
+import binnie.craftgui.minecraft.Window;
+import binnie.craftgui.resource.Texture;
+import binnie.craftgui.resource.minecraft.CraftGUITextureSheet;
+import binnie.craftgui.resource.minecraft.StandardTexture;
+import forestry.api.genetics.IAllele;
+import forestry.api.genetics.IMutation;
+
+class ControlMutationSymbol
+ extends Control
+ implements ITooltip
+{
+ private static Texture MutationPlus = new StandardTexture(2, 94, 16, 16, CraftGUITextureSheet.Controls2);
+ private static Texture MutationArrow = new StandardTexture(20, 94, 32, 16, CraftGUITextureSheet.Controls2);
+ private IMutation value;
+ private boolean discovered;
+ private int type;
+
+ public void onRenderBackground()
+ {
+ super.onRenderBackground();
+ if (this.type == 0) {
+ CraftGUI.Render.texture(MutationPlus, IPoint.ZERO);
+ } else {
+ CraftGUI.Render.texture(MutationArrow, IPoint.ZERO);
+ }
+ }
+
+ protected ControlMutationSymbol(IWidget parent, int x, int y, int type)
+ {
+ super(parent, x, y, 16 + type * 16, 16.0F);
+ this.value = null;
+ this.type = type;
+ addAttribute(Attribute.MouseOver);
+ }
+
+ public void setValue(IMutation value)
+ {
+ this.value = value;
+
+ boolean isNEI = ((WindowAbstractDatabase)getSuperParent()).isNEI();
+ BreedingSystem system = ((WindowAbstractDatabase)getSuperParent()).getBreedingSystem();
+
+ this.discovered = (isNEI ? true : system.isMutationDiscovered(value, Window.get(this).getWorld(), Window.get(this).getUsername()));
+ if (this.discovered) {
+ setColour(16777215);
+ } else {
+ setColour(7829367);
+ }
+ }
+
+ public void getTooltip(Tooltip tooltip)
+ {
+ if ((this.type == 1) && (this.discovered))
+ {
+ IAllele species1 = this.value.getAllele0();
+ IAllele species2 = this.value.getAllele1();
+
+ BreedingSystem system = ((WindowAbstractDatabase)getSuperParent()).getBreedingSystem();
+
+ float chance = system.getChance(this.value, Window.get(this).getPlayer(), species1, species2);
+ tooltip.add("Current Chance - " + chance + "%");
+ if (this.value.getSpecialConditions() != null) {
+ for (String string : this.value.getSpecialConditions()) {
+ tooltip.add(string);
+ }
+ }
+ }
+ }
+}
diff --git a/src/Java/binnie/craftgui/mod/database/ControlSpeciesBox.java b/src/Java/binnie/craftgui/mod/database/ControlSpeciesBox.java
new file mode 100644
index 0000000000..4f184b0064
--- /dev/null
+++ b/src/Java/binnie/craftgui/mod/database/ControlSpeciesBox.java
@@ -0,0 +1,55 @@
+package binnie.craftgui.mod.database;
+
+import binnie.core.genetics.BreedingSystem;
+import binnie.craftgui.controls.listbox.ControlList;
+import binnie.craftgui.controls.listbox.ControlListBox;
+import binnie.craftgui.core.IWidget;
+import binnie.craftgui.minecraft.Window;
+import com.mojang.authlib.GameProfile;
+import forestry.api.genetics.IAlleleSpecies;
+import forestry.api.genetics.IClassification;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import net.minecraft.entity.player.EntityPlayer;
+
+public class ControlSpeciesBox
+ extends ControlListBox<IAlleleSpecies>
+{
+ public IWidget createOption(IAlleleSpecies value, int y)
+ {
+ return new ControlSpeciexBoxOption((ControlList)getContent(), value, y);
+ }
+
+ public ControlSpeciesBox(IWidget parent, float x, float y, float width, float height)
+ {
+ super(parent, x, y, width, height, 12.0F);
+ }
+
+ private IClassification branch = null;
+
+ public void setBranch(IClassification branch)
+ {
+ if (branch != this.branch)
+ {
+ this.branch = branch;
+ List<IAlleleSpecies> speciesList2 = new ArrayList();
+ movePercentage(-100.0F);
+ setOptions(speciesList2);
+
+ EntityPlayer player = Window.get(this).getPlayer();
+ GameProfile playerName = Window.get(this).getUsername();
+ WindowAbstractDatabase db = (WindowAbstractDatabase)Window.get(this);
+
+ Collection<IAlleleSpecies> speciesList = !db.isNEI ? db.getBreedingSystem().getDiscoveredSpecies(db.getWorld(), playerName) : db.getBreedingSystem().getAllSpecies();
+ if (branch != null) {
+ for (IAlleleSpecies species : branch.getMemberSpecies()) {
+ if (speciesList.contains(species)) {
+ speciesList2.add(species);
+ }
+ }
+ }
+ setOptions(speciesList2);
+ }
+ }
+}
diff --git a/src/Java/binnie/craftgui/mod/database/ControlSpeciexBoxOption.java b/src/Java/binnie/craftgui/mod/database/ControlSpeciexBoxOption.java
new file mode 100644
index 0000000000..36ac5446b2
--- /dev/null
+++ b/src/Java/binnie/craftgui/mod/database/ControlSpeciexBoxOption.java
@@ -0,0 +1,42 @@
+package binnie.craftgui.mod.database;
+
+import binnie.craftgui.controls.ControlText;
+import binnie.craftgui.controls.listbox.ControlList;
+import binnie.craftgui.controls.listbox.ControlTextOption;
+import binnie.craftgui.core.Attribute;
+import binnie.craftgui.core.CraftGUI;
+import binnie.craftgui.core.geometry.CraftGUIUtil;
+import binnie.craftgui.core.geometry.IPoint;
+import binnie.craftgui.core.renderer.Renderer;
+import forestry.api.genetics.IAlleleSpecies;
+
+class ControlSpeciexBoxOption
+ extends ControlTextOption<IAlleleSpecies>
+{
+ private ControlDatabaseIndividualDisplay controlBee;
+
+ public ControlSpeciexBoxOption(ControlList<IAlleleSpecies> controlList, IAlleleSpecies option, int y)
+ {
+ super(controlList, option, option.getName(), y);
+ setSize(new IPoint(getSize().x(), 20.0F));
+
+ this.controlBee = new ControlDatabaseIndividualDisplay(this, 2.0F, 2.0F);
+
+ this.controlBee.setSpecies((IAlleleSpecies)getValue(), EnumDiscoveryState.Undetermined);
+ if (this.controlBee.discovered == EnumDiscoveryState.Discovered) {
+ this.controlBee.discovered = EnumDiscoveryState.Show;
+ }
+ this.textWidget.setValue(this.controlBee.discovered == EnumDiscoveryState.Show ? option.getName() : "Undiscovered");
+ if (this.controlBee.discovered == EnumDiscoveryState.Show) {
+ addAttribute(Attribute.MouseOver);
+ }
+ CraftGUIUtil.moveWidget(this.textWidget, new IPoint(22.0F, 0.0F));
+ this.textWidget.setSize(this.textWidget.getSize().sub(new IPoint(24.0F, 0.0F)));
+
+ int th = (int)CraftGUI.Render.textHeight(this.textWidget.getValue(), this.textWidget.getSize().x());
+ int height = Math.max(20, th + 6);
+ setSize(new IPoint(size().x(), height));
+ this.textWidget.setSize(new IPoint(this.textWidget.getSize().x(), height));
+ this.controlBee.setPosition(new IPoint(this.controlBee.pos().x(), (height - 18) / 2));
+ }
+}
diff --git a/src/Java/binnie/craftgui/mod/database/DatabaseTab.java b/src/Java/binnie/craftgui/mod/database/DatabaseTab.java
new file mode 100644
index 0000000000..aee8ea5bf2
--- /dev/null
+++ b/src/Java/binnie/craftgui/mod/database/DatabaseTab.java
@@ -0,0 +1,32 @@
+package binnie.craftgui.mod.database;
+
+import binnie.Binnie;
+import binnie.core.AbstractMod;
+import binnie.core.language.ManagerLanguage;
+import binnie.craftgui.core.ITooltipHelp;
+import binnie.craftgui.core.Tooltip;
+
+public class DatabaseTab
+ implements ITooltipHelp
+{
+ private AbstractMod mod;
+ private String unloc;
+ private int colour;
+
+ public DatabaseTab(AbstractMod mod, String unloc, int colour)
+ {
+ this.mod = mod;
+ this.unloc = unloc;
+ this.colour = colour;
+ }
+
+ public String toString()
+ {
+ return Binnie.Language.localise(this.mod, "gui.database.tab." + this.unloc);
+ }
+
+ public void getHelpTooltip(Tooltip tooltip)
+ {
+ tooltip.add(Binnie.Language.localiseOrBlank(this.mod, "gui.database.tab." + this.unloc + ".help"));
+ }
+}
diff --git a/src/Java/binnie/craftgui/mod/database/EnumDiscoveryState.java b/src/Java/binnie/craftgui/mod/database/EnumDiscoveryState.java
new file mode 100644
index 0000000000..fe98cff136
--- /dev/null
+++ b/src/Java/binnie/craftgui/mod/database/EnumDiscoveryState.java
@@ -0,0 +1,8 @@
+package binnie.craftgui.mod.database;
+
+public enum EnumDiscoveryState
+{
+ Show, Undetermined, Discovered, Undiscovered;
+
+ private EnumDiscoveryState() {}
+}
diff --git a/src/Java/binnie/craftgui/mod/database/IDatabaseMode.java b/src/Java/binnie/craftgui/mod/database/IDatabaseMode.java
new file mode 100644
index 0000000000..8744a2f0b7
--- /dev/null
+++ b/src/Java/binnie/craftgui/mod/database/IDatabaseMode.java
@@ -0,0 +1,6 @@
+package binnie.craftgui.mod.database;
+
+public abstract interface IDatabaseMode
+{
+ public abstract String getName();
+}
diff --git a/src/Java/binnie/craftgui/mod/database/PageAbstract.java b/src/Java/binnie/craftgui/mod/database/PageAbstract.java
new file mode 100644
index 0000000000..9219dca0a7
--- /dev/null
+++ b/src/Java/binnie/craftgui/mod/database/PageAbstract.java
@@ -0,0 +1,16 @@
+package binnie.craftgui.mod.database;
+
+import binnie.craftgui.controls.page.ControlPage;
+import binnie.craftgui.core.IWidget;
+import binnie.craftgui.core.geometry.IPoint;
+
+public abstract class PageAbstract<T>
+ extends ControlPage<DatabaseTab>
+{
+ public PageAbstract(IWidget parent, DatabaseTab tab)
+ {
+ super(parent, 0.0F, 0.0F, parent.getSize().x(), parent.getSize().y(), tab);
+ }
+
+ public abstract void onValueChanged(T paramT);
+}
diff --git a/src/Java/binnie/craftgui/mod/database/PageBranch.java b/src/Java/binnie/craftgui/mod/database/PageBranch.java
new file mode 100644
index 0000000000..57af5128e5
--- /dev/null
+++ b/src/Java/binnie/craftgui/mod/database/PageBranch.java
@@ -0,0 +1,13 @@
+package binnie.craftgui.mod.database;
+
+import binnie.craftgui.core.IWidget;
+import forestry.api.genetics.IClassification;
+
+abstract class PageBranch
+ extends PageAbstract<IClassification>
+{
+ public PageBranch(IWidget parent, DatabaseTab tab)
+ {
+ super(parent, tab);
+ }
+}
diff --git a/src/Java/binnie/craftgui/mod/database/PageBranchOverview.java b/src/Java/binnie/craftgui/mod/database/PageBranchOverview.java
new file mode 100644
index 0000000000..57ddc63fab
--- /dev/null
+++ b/src/Java/binnie/craftgui/mod/database/PageBranchOverview.java
@@ -0,0 +1,67 @@
+package binnie.craftgui.mod.database;
+
+import binnie.craftgui.controls.ControlText;
+import binnie.craftgui.controls.ControlTextCentered;
+import binnie.craftgui.core.CraftGUI;
+import binnie.craftgui.core.IWidget;
+import binnie.craftgui.core.renderer.Renderer;
+import forestry.api.genetics.IAlleleSpecies;
+import forestry.api.genetics.IClassification;
+import java.util.ArrayList;
+import java.util.List;
+
+public class PageBranchOverview
+ extends PageBranch
+{
+ private ControlText pageBranchOverview_branchName;
+ private ControlText pageBranchOverview_branchScientific;
+ private ControlText pageBranchOverview_branchAuthority;
+
+ public PageBranchOverview(IWidget parent, DatabaseTab tab)
+ {
+ super(parent, tab);
+
+ this.pageBranchOverview_branchName = new ControlTextCentered(this, 8.0F, "");
+
+ this.pageBranchOverview_branchScientific = new ControlTextCentered(this, 32.0F, "");
+ this.pageBranchOverview_branchAuthority = new ControlTextCentered(this, 44.0F, "");
+ }
+
+ private List<ControlText> pageBranchOverview_branchDescription = new ArrayList();
+
+ public void onValueChanged(IClassification branch)
+ {
+ this.pageBranchOverview_branchName.setValue("§n" + branch.getName() + " Branch§r");
+
+ this.pageBranchOverview_branchScientific.setValue("§oApidae " + branch.getScientific() + "§r");
+
+ this.pageBranchOverview_branchAuthority.setValue("Discovered by §l" + branch.getMemberSpecies()[0].getAuthority() + "§r");
+ for (IWidget widget : this.pageBranchOverview_branchDescription) {
+ deleteChild(widget);
+ }
+ this.pageBranchOverview_branchDescription.clear();
+
+ String desc = branch.getDescription();
+ if ((desc == null) || (desc == "")) {
+ desc = "No Description Provided.";
+ }
+ String line = "";
+
+ List<String> descLines = new ArrayList();
+ for (String str : desc.split(" "))
+ {
+ if (CraftGUI.Render.textWidth(line + " " + str) > 134)
+ {
+ descLines.add("§o" + line + "§r");
+ line = "";
+ }
+ line = line + " " + str;
+ }
+ descLines.add(line);
+
+ int i = 0;
+ for (String dLine : descLines) {
+ this.pageBranchOverview_branchDescription.add(new ControlTextCentered(this, 84 + 12 * i++, dLine));
+ }
+ }
+}
diff --git a/src/Java/binnie/craftgui/mod/database/PageBranchSpecies.java b/src/Java/binnie/craftgui/mod/database/PageBranchSpecies.java
new file mode 100644
index 0000000000..600ca66674
--- /dev/null
+++ b/src/Java/binnie/craftgui/mod/database/PageBranchSpecies.java
@@ -0,0 +1,43 @@
+package binnie.craftgui.mod.database;
+
+import binnie.craftgui.controls.ControlText;
+import binnie.craftgui.controls.ControlTextCentered;
+import binnie.craftgui.core.IWidget;
+import binnie.craftgui.events.EventValueChanged;
+import binnie.craftgui.events.EventValueChanged.Handler;
+import cpw.mods.fml.common.Mod.EventHandler;
+import forestry.api.genetics.IAlleleSpecies;
+import forestry.api.genetics.IClassification;
+
+public class PageBranchSpecies
+ extends PageBranch
+{
+ private ControlText pageBranchSpecies_title;
+ private ControlSpeciesBox pageBranchSpecies_speciesList;
+
+ @Mod.EventHandler
+ public void onHandleEvent(EventValueChanged<IAlleleSpecies> event) {}
+
+ public PageBranchSpecies(IWidget parent, DatabaseTab tab)
+ {
+ super(parent, tab);
+
+ this.pageBranchSpecies_title = new ControlTextCentered(this, 8.0F, "Species");
+
+ addEventHandler(new EventValueChanged.Handler()
+ {
+ public void onEvent(EventValueChanged event)
+ {
+ if (event.isOrigin(PageBranchSpecies.this.pageBranchSpecies_speciesList)) {
+ ((WindowAbstractDatabase)PageBranchSpecies.this.getSuperParent()).gotoSpecies((IAlleleSpecies)event.getValue());
+ }
+ }
+ });
+ this.pageBranchSpecies_speciesList = new ControlSpeciesBox(this, 4.0F, 20.0F, 136.0F, 152.0F);
+ }
+
+ public void onValueChanged(IClassification branch)
+ {
+ this.pageBranchSpecies_speciesList.setBranch(branch);
+ }
+}
diff --git a/src/Java/binnie/craftgui/mod/database/PageBreeder.java b/src/Java/binnie/craftgui/mod/database/PageBreeder.java
new file mode 100644
index 0000000000..d3f0b7b617
--- /dev/null
+++ b/src/Java/binnie/craftgui/mod/database/PageBreeder.java
@@ -0,0 +1,51 @@
+package binnie.craftgui.mod.database;
+
+import binnie.core.genetics.BreedingSystem;
+import binnie.craftgui.controls.ControlTextCentered;
+import binnie.craftgui.controls.page.ControlPage;
+import binnie.craftgui.core.IWidget;
+import binnie.craftgui.core.geometry.IPoint;
+import binnie.craftgui.minecraft.Window;
+import com.mojang.authlib.GameProfile;
+import java.util.List;
+
+public class PageBreeder
+ extends ControlPage<DatabaseTab>
+{
+ private GameProfile player;
+
+ public PageBreeder(IWidget parent, GameProfile player, DatabaseTab tab)
+ {
+ super(parent, 0.0F, 0.0F, parent.getSize().x(), parent.getSize().y(), tab);
+
+ this.player = player;
+ onPageRefresh();
+ }
+
+ public void onPageRefresh()
+ {
+ while (getWidgets().size() > 0) {
+ deleteChild((IWidget)getWidgets().get(0));
+ }
+ BreedingSystem system = ((WindowAbstractDatabase)Window.get(this)).getBreedingSystem();
+
+ String descriptor = system.getDescriptor();
+
+ new ControlTextCentered(this, 8.0F, "§n" + system.getDescriptor() + " Profile§r");
+
+ new ControlTextCentered(this, 75.0F, "" + system.discoveredSpeciesCount + "/" + system.totalSpeciesCount + " Species");
+
+
+ new ControlBreedingProgress(this, 20, 87, 102, 14, system, system.discoveredSpeciesPercentage);
+
+ new ControlTextCentered(this, 115.0F, "" + system.discoveredBranchCount + "/" + system.totalBranchCount + " Branches");
+
+
+ new ControlBreedingProgress(this, 20, 127, 102, 14, system, system.discoveredBranchPercentage);
+ if (system.discoveredSecretCount > 0) {
+ new ControlTextCentered(this, 155.0F, "" + system.discoveredSecretCount + "/" + system.totalSecretCount + " Secret Species");
+ }
+ new ControlTextCentered(this, 32.0F, this.player.getName());
+ new ControlTextCentered(this, 44.0F, "§o" + system.getEpitome() + "§r");
+ }
+}
diff --git a/src/Java/binnie/craftgui/mod/database/PageBreederStats.java b/src/Java/binnie/craftgui/mod/database/PageBreederStats.java
new file mode 100644
index 0000000000..18c1f288d5
--- /dev/null
+++ b/src/Java/binnie/craftgui/mod/database/PageBreederStats.java
@@ -0,0 +1,23 @@
+package binnie.craftgui.mod.database;
+
+import binnie.core.genetics.BreedingSystem;
+import binnie.craftgui.controls.ControlText;
+import binnie.craftgui.controls.ControlTextCentered;
+import binnie.craftgui.controls.core.Control;
+import binnie.craftgui.core.IWidget;
+
+public class PageBreederStats
+ extends Control
+{
+ String player;
+
+ public PageBreederStats(IWidget parent, int w, int h, String player)
+ {
+ super(parent, 0.0F, 0.0F, w, h);
+ this.player = player;
+
+ ControlText pageBranchOverview_branchName = new ControlTextCentered(this, 8.0F, "§nStats§r");
+
+ BreedingSystem system = ((WindowAbstractDatabase)getSuperParent()).getBreedingSystem();
+ }
+}
diff --git a/src/Java/binnie/craftgui/mod/database/PageSpecies.java b/src/Java/binnie/craftgui/mod/database/PageSpecies.java
new file mode 100644
index 0000000000..c94984bd3a
--- /dev/null
+++ b/src/Java/binnie/craftgui/mod/database/PageSpecies.java
@@ -0,0 +1,13 @@
+package binnie.craftgui.mod.database;
+
+import binnie.craftgui.core.IWidget;
+import forestry.api.genetics.IAlleleSpecies;
+
+public abstract class PageSpecies
+ extends PageAbstract<IAlleleSpecies>
+{
+ public PageSpecies(IWidget parent, DatabaseTab tab)
+ {
+ super(parent, tab);
+ }
+}
diff --git a/src/Java/binnie/craftgui/mod/database/PageSpeciesClassification.java b/src/Java/binnie/craftgui/mod/database/PageSpeciesClassification.java
new file mode 100644
index 0000000000..3db09e32cf
--- /dev/null
+++ b/src/Java/binnie/craftgui/mod/database/PageSpeciesClassification.java
@@ -0,0 +1,54 @@
+package binnie.craftgui.mod.database;
+
+import binnie.craftgui.controls.ControlText;
+import binnie.craftgui.controls.ControlTextCentered;
+import binnie.craftgui.core.IWidget;
+import forestry.api.genetics.IAlleleSpecies;
+import forestry.api.genetics.IClassification;
+import forestry.api.genetics.IClassification.EnumClassLevel;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+public class PageSpeciesClassification
+ extends PageSpecies
+{
+ private Map<IClassification.EnumClassLevel, ControlText> levels = new LinkedHashMap();
+ private ControlText genus;
+
+ public PageSpeciesClassification(IWidget parent, DatabaseTab tab)
+ {
+ super(parent, tab);
+ int y = 16;
+ for (IClassification.EnumClassLevel level : IClassification.EnumClassLevel.values())
+ {
+ ControlText text = new ControlTextCentered(this, y, "");
+ text.setColour(level.getColour());
+ this.levels.put(level, text);
+ y += 12;
+ }
+ this.genus = new ControlTextCentered(this, y, "");
+ this.genus.setColour(16759415);
+ }
+
+ public void onValueChanged(IAlleleSpecies species)
+ {
+ if (species != null)
+ {
+ for (ControlText text : this.levels.values()) {
+ text.setValue("- - -");
+ }
+ this.genus.setValue(species.getBinomial());
+
+ IClassification classification = species.getBranch();
+ while (classification != null)
+ {
+ IClassification.EnumClassLevel level = classification.getLevel();
+ String text = "";
+ int n = level.ordinal();
+ text = text + classification.getScientific();
+ ((ControlText)this.levels.get(level)).setValue(text);
+ classification = classification.getParent();
+ }
+ }
+ }
+}
diff --git a/src/Java/binnie/craftgui/mod/database/PageSpeciesMutations.java b/src/Java/binnie/craftgui/mod/database/PageSpeciesMutations.java
new file mode 100644
index 0000000000..16a6e6673a
--- /dev/null
+++ b/src/Java/binnie/craftgui/mod/database/PageSpeciesMutations.java
@@ -0,0 +1,27 @@
+package binnie.craftgui.mod.database;
+
+import binnie.craftgui.controls.ControlText;
+import binnie.craftgui.controls.ControlTextCentered;
+import binnie.craftgui.core.IWidget;
+import forestry.api.genetics.IAlleleSpecies;
+
+public class PageSpeciesMutations
+ extends PageSpecies
+{
+ private ControlText pageSpeciesFurther_Title;
+ private ControlMutationBox pageSpeciesFurther_List;
+
+ public PageSpeciesMutations(IWidget parent, DatabaseTab tab)
+ {
+ super(parent, tab);
+
+ this.pageSpeciesFurther_Title = new ControlTextCentered(this, 8.0F, "Further Mutations");
+
+ this.pageSpeciesFurther_List = new ControlMutationBox(this, 4, 20, 136, 152, ControlMutationBox.Type.Further);
+ }
+
+ public void onValueChanged(IAlleleSpecies species)
+ {
+ this.pageSpeciesFurther_List.setSpecies(species);
+ }
+}
diff --git a/src/Java/binnie/craftgui/mod/database/PageSpeciesOverview.java b/src/Java/binnie/craftgui/mod/database/PageSpeciesOverview.java
new file mode 100644
index 0000000000..083162e902
--- /dev/null
+++ b/src/Java/binnie/craftgui/mod/database/PageSpeciesOverview.java
@@ -0,0 +1,88 @@
+package binnie.craftgui.mod.database;
+
+import binnie.craftgui.controls.ControlText;
+import binnie.craftgui.controls.ControlTextCentered;
+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 forestry.api.genetics.IAlleleSpecies;
+import forestry.api.genetics.IClassification;
+
+public class PageSpeciesOverview
+ extends PageSpecies
+{
+ private ControlText controlName;
+ private ControlText controlScientific;
+ private ControlText controlAuthority;
+ private ControlText controlComplexity;
+ private ControlText controlDescription;
+ private ControlText controlSignature;
+ private ControlDatabaseIndividualDisplay controlInd1;
+ private ControlDatabaseIndividualDisplay controlInd2;
+
+ public PageSpeciesOverview(IWidget parent, DatabaseTab tab)
+ {
+ super(parent, tab);
+
+ this.controlInd1 = new ControlDatabaseIndividualDisplay(this, 5.0F, 5.0F);
+ this.controlInd2 = new ControlDatabaseIndividualDisplay(this, 123.0F, 5.0F);
+
+ this.controlName = new ControlTextCentered(this, 8.0F, "");
+
+ this.controlScientific = new ControlTextCentered(this, 32.0F, "");
+ this.controlAuthority = new ControlTextCentered(this, 44.0F, "");
+ this.controlComplexity = new ControlTextCentered(this, 56.0F, "");
+
+ this.controlDescription = new ControlText(this, new IArea(8.0F, 84.0F, getSize().x() - 16.0F, 0.0F), "", TextJustification.MiddleCenter);
+
+ this.controlSignature = new ControlText(this, new IArea(8.0F, 84.0F, getSize().x() - 16.0F, 0.0F), "", TextJustification.BottomRight);
+ }
+
+ public void onValueChanged(IAlleleSpecies species)
+ {
+ this.controlInd1.setSpecies(species, EnumDiscoveryState.Show);
+ this.controlInd2.setSpecies(species, EnumDiscoveryState.Show);
+ String branchBinomial = species.getBranch() != null ? species.getBranch().getScientific() : "<Unknown>";
+
+ String branchName = species.getBranch() != null ? species.getBranch().getName() : "Unknown";
+
+
+ this.controlName.setValue("§n" + species.getName() + "§r");
+ this.controlScientific.setValue("§o" + branchBinomial + " " + species.getBinomial() + "§r");
+
+ this.controlAuthority.setValue("Discovered by §l" + species.getAuthority() + "§r");
+
+ this.controlComplexity.setValue("Complexity: " + species.getComplexity());
+
+
+
+ String desc = species.getDescription();
+
+ String descBody = "§o";
+ String descSig = "";
+ if ((desc == null) || (desc == ""))
+ {
+ descBody = descBody + "No Description Provided.";
+ }
+ else
+ {
+ String[] descStrings = desc.split("\\|");
+ descBody = descBody + descStrings[0];
+ for (int i = 1; i < descStrings.length - 1; i++) {
+ descBody = descBody + " " + descStrings[i];
+ }
+ if (descStrings.length > 1) {
+ descSig = descSig + descStrings[(descStrings.length - 1)];
+ }
+ }
+ this.controlDescription.setValue(descBody + "§r");
+ this.controlSignature.setValue(descSig + "§r");
+
+ float descHeight = CraftGUI.Render.textHeight(this.controlDescription.getValue(), this.controlDescription.getSize().x());
+
+ this.controlSignature.setPosition(new IPoint(this.controlSignature.pos().x(), this.controlDescription.getPosition().y() + descHeight + 10.0F));
+ }
+}
diff --git a/src/Java/binnie/craftgui/mod/database/PageSpeciesResultant.java b/src/Java/binnie/craftgui/mod/database/PageSpeciesResultant.java
new file mode 100644
index 0000000000..f6f2d487c0
--- /dev/null
+++ b/src/Java/binnie/craftgui/mod/database/PageSpeciesResultant.java
@@ -0,0 +1,27 @@
+package binnie.craftgui.mod.database;
+
+import binnie.craftgui.controls.ControlText;
+import binnie.craftgui.controls.ControlTextCentered;
+import binnie.craftgui.core.IWidget;
+import forestry.api.genetics.IAlleleSpecies;
+
+public class PageSpeciesResultant
+ extends PageSpecies
+{
+ private ControlText pageSpeciesResultant_Title;
+ private ControlMutationBox pageSpeciesResultant_List;
+
+ public PageSpeciesResultant(IWidget parent, DatabaseTab tab)
+ {
+ super(parent, tab);
+
+ this.pageSpeciesResultant_Title = new ControlTextCentered(this, 8.0F, "Resultant Mutations");
+
+ this.pageSpeciesResultant_List = new ControlMutationBox(this, 4, 20, 136, 152, ControlMutationBox.Type.Resultant);
+ }
+
+ public void onValueChanged(IAlleleSpecies species)
+ {
+ this.pageSpeciesResultant_List.setSpecies(species);
+ }
+}
diff --git a/src/Java/binnie/craftgui/mod/database/WindowAbstractDatabase.java b/src/Java/binnie/craftgui/mod/database/WindowAbstractDatabase.java
new file mode 100644
index 0000000000..54ca5a4aca
--- /dev/null
+++ b/src/Java/binnie/craftgui/mod/database/WindowAbstractDatabase.java
@@ -0,0 +1,314 @@
+package binnie.craftgui.mod.database;
+
+import binnie.core.BinnieCore;
+import binnie.core.genetics.BreedingSystem;
+import binnie.core.proxy.BinnieProxy;
+import binnie.core.util.IValidator;
+import binnie.craftgui.controls.ControlTextEdit;
+import binnie.craftgui.controls.listbox.ControlListBox;
+import binnie.craftgui.controls.listbox.ControlTextOption;
+import binnie.craftgui.controls.page.ControlPage;
+import binnie.craftgui.controls.page.ControlPages;
+import binnie.craftgui.controls.tab.ControlTab;
+import binnie.craftgui.controls.tab.ControlTabBar;
+import binnie.craftgui.core.IWidget;
+import binnie.craftgui.core.geometry.CraftGUIUtil;
+import binnie.craftgui.core.geometry.IArea;
+import binnie.craftgui.core.geometry.IPoint;
+import binnie.craftgui.core.geometry.Position;
+import binnie.craftgui.events.EventHandler.Origin;
+import binnie.craftgui.events.EventTextEdit;
+import binnie.craftgui.events.EventTextEdit.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.ControlHelp;
+import binnie.craftgui.window.Panel;
+import com.mojang.authlib.GameProfile;
+import cpw.mods.fml.relauncher.Side;
+import forestry.api.genetics.IAlleleSpecies;
+import forestry.api.genetics.IBreedingTracker;
+import forestry.api.genetics.IClassification;
+import forestry.api.genetics.ISpeciesRoot;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+import net.minecraft.entity.player.EntityPlayer;
+
+public abstract class WindowAbstractDatabase
+ extends Window
+{
+ private float selectionBoxWidth = 95.0F;
+ private final float infoBoxWidth = 144.0F;
+ private final float infoBoxHeight = 176.0F;
+ private final float infoTabWidth = 16.0F;
+ private final float modeTabWidth = 22.0F;
+ private final float searchBoxHeight = 16.0F;
+
+ public void changeMode(IDatabaseMode mode)
+ {
+ this.modePages.setValue(mode);
+ }
+
+ public WindowAbstractDatabase(EntityPlayer player, Side side, boolean nei, BreedingSystem system, float wid)
+ {
+ super(100.0F, 192.0F, player, null, side);
+ this.isNEI = nei;
+ this.system = system;
+ this.selectionBoxWidth = wid;
+ }
+
+ public static enum Mode
+ implements IDatabaseMode
+ {
+ Species, Branches, Breeder;
+
+ private Mode() {}
+
+ public String getName()
+ {
+ return BinnieCore.proxy.localise("gui.database.mode." + name().toLowerCase());
+ }
+ }
+
+ public static abstract class ModeWidgets
+ {
+ public WindowAbstractDatabase database;
+ public ControlPage<IDatabaseMode> modePage;
+ private ControlPages<DatabaseTab> infoPages;
+ public ControlListBox listBox;
+ private ControlTabBar<DatabaseTab> infoTabs;
+
+ public ModeWidgets(IDatabaseMode mode, WindowAbstractDatabase database)
+ {
+ this.database = database;
+ this.modePage = new ControlPage(database.modePages, 0.0F, 0.0F, database.getSize().x(), database.getSize().y(), mode);
+
+ IArea listBoxArea = database.panelSearch.area().inset(2);
+
+ createListBox(listBoxArea);
+
+ CraftGUIUtil.alignToWidget(this.listBox, database.panelSearch);
+ CraftGUIUtil.moveWidget(this.listBox, new IPoint(2.0F, 2.0F));
+
+ this.infoPages = new ControlPages(this.modePage, 0.0F, 0.0F, 144.0F, 176.0F);
+
+ CraftGUIUtil.alignToWidget(this.infoPages, database.panelInformation);
+ }
+
+ public abstract void createListBox(IArea paramIArea);
+ }
+
+ public ControlPages<DatabaseTab> getInfoPages(IDatabaseMode mode)
+ {
+ return ((ModeWidgets)this.modes.get(mode)).infoPages;
+ }
+
+ private Map<IDatabaseMode, ModeWidgets> modes = new HashMap();
+ boolean isNEI;
+ private BreedingSystem system;
+
+ public boolean isNEI()
+ {
+ return this.isNEI;
+ }
+
+ public BreedingSystem getBreedingSystem()
+ {
+ return this.system;
+ }
+
+ public WindowAbstractDatabase(EntityPlayer player, Side side, boolean nei, BreedingSystem system)
+ {
+ this(player, side, nei, system, 95.0F);
+ }
+
+ private Panel panelInformation = null;
+ private Panel panelSearch = null;
+ private ControlPages<IDatabaseMode> modePages = null;
+
+ protected ModeWidgets createMode(IDatabaseMode mode, ModeWidgets widgets)
+ {
+ this.modes.put(mode, widgets);
+
+ return widgets;
+ }
+
+ public void initialiseClient()
+ {
+ setSize(new IPoint(176.0F + this.selectionBoxWidth + 22.0F + 8.0F, 208.0F));
+
+ addEventHandler(new EventValueChanged.Handler()
+ {
+ public void onEvent(EventValueChanged event)
+ {
+ if (((event.getOrigin().getParent() instanceof ControlPage)) && (!(event.getValue() instanceof DatabaseTab)))
+ {
+ ControlPage parent = (ControlPage)event.getOrigin().getParent();
+ if ((parent.getValue() instanceof IDatabaseMode)) {
+ for (IWidget widget : parent.getWidgets()) {
+ if ((widget instanceof ControlPages)) {
+ if (event.getValue() == null)
+ {
+ widget.hide();
+ }
+ else
+ {
+ widget.show();
+ for (IWidget widget2 : widget.getWidgets()) {
+ if ((widget2 instanceof PageAbstract)) {
+ ((PageAbstract)widget2).onValueChanged(event.getValue());
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ });
+ addEventHandler(new EventTextEdit.Handler()
+ {
+ public void onEvent(final EventTextEdit event)
+ {
+ for (WindowAbstractDatabase.ModeWidgets widgets : WindowAbstractDatabase.this.modes.values()) {
+ widgets.listBox.setValidator(new IValidator()
+ {
+ public boolean isValid(IWidget object)
+ {
+ return (event.getValue() == "") || (((ControlTextOption)object).getText().toLowerCase().contains(((String)event.getValue()).toLowerCase()));
+ }
+ });
+ }
+ }
+ }.setOrigin(EventHandler.Origin.DirectChild, this));
+
+
+
+
+
+
+
+
+
+
+
+
+ new ControlHelp(this, 4.0F, 4.0F);
+
+ this.panelInformation = new Panel(this, 24.0F, 24.0F, 144.0F, 176.0F, MinecraftGUI.PanelType.Black);
+ this.panelInformation.setColour(860416);
+
+ this.panelSearch = new Panel(this, 176.0F, 24.0F, this.selectionBoxWidth, 160.0F, MinecraftGUI.PanelType.Black);
+
+ this.panelSearch.setColour(860416);
+
+ this.modePages = new ControlPages(this, 0.0F, 0.0F, getSize().x(), getSize().y());
+
+ new ControlTextEdit(this, 176.0F, 184.0F, this.selectionBoxWidth, 16.0F);
+
+
+ createMode(Mode.Species, new ModeWidgets(Mode.Species, this)
+ {
+ public void createListBox(IArea area)
+ {
+ GameProfile playerName = WindowAbstractDatabase.this.getUsername();
+
+ Collection<IAlleleSpecies> speciesList = !this.database.isNEI ? this.database.system.getDiscoveredSpecies(this.database.getWorld(), playerName) : this.database.system.getAllSpecies();
+
+
+ this.listBox = new ControlSpeciesBox(this.modePage, area.x(), area.y(), area.w(), area.h());
+ this.listBox.setOptions(speciesList);
+ }
+ });
+ createMode(Mode.Branches, new ModeWidgets(Mode.Branches, this)
+ {
+ public void createListBox(IArea area)
+ {
+ EntityPlayer player = this.database.getPlayer();
+ GameProfile playerName = WindowAbstractDatabase.this.getUsername();
+
+ Collection<IClassification> speciesList = !this.database.isNEI ? this.database.system.getDiscoveredBranches(this.database.getWorld(), playerName) : this.database.system.getAllBranches();
+
+
+ this.listBox = new ControlBranchBox(this.modePage, area.x(), area.y(), area.w(), area.h());
+ this.listBox.setOptions(speciesList);
+ }
+ });
+ createMode(Mode.Breeder, new ModeWidgets(Mode.Breeder, this)
+ {
+ public void createListBox(IArea area)
+ {
+ this.listBox = new ControlListBox(this.modePage, area.x(), area.y(), area.w(), area.h(), 12.0F);
+ }
+ });
+ addTabs();
+
+ ControlTabBar<IDatabaseMode> tab = new ControlTabBar(this, 176.0F + this.selectionBoxWidth, 24.0F, 22.0F, 176.0F, Position.Right)
+ {
+ public ControlTab<IDatabaseMode> createTab(float x, float y, float w, float h, IDatabaseMode value)
+ {
+ new ControlTab(this, x, y, w, h, value)
+ {
+ public String getName()
+ {
+ return ((IDatabaseMode)this.value).getName();
+ }
+ };
+ }
+ };
+ tab.setValues(this.modePages.getValues());
+
+ CraftGUIUtil.linkWidgets(tab, this.modePages);
+
+
+ changeMode(Mode.Species);
+ for (IDatabaseMode mode : this.modes.keySet())
+ {
+ ((ModeWidgets)this.modes.get(mode)).infoTabs = new ControlTabBar(((ModeWidgets)this.modes.get(mode)).modePage, 8.0F, 24.0F, 16.0F, 176.0F, Position.Left);
+
+
+ ((ModeWidgets)this.modes.get(mode)).infoTabs.setValues(((ModeWidgets)this.modes.get(mode)).infoPages.getValues());
+
+ CraftGUIUtil.linkWidgets(((ModeWidgets)this.modes.get(mode)).infoTabs, ((ModeWidgets)this.modes.get(mode)).infoPages);
+ }
+ }
+
+ public void initialiseServer()
+ {
+ IBreedingTracker tracker = this.system.getSpeciesRoot().getBreedingTracker(getWorld(), getUsername());
+ if (tracker != null) {
+ tracker.synchToPlayer(getPlayer());
+ }
+ }
+
+ protected void addTabs() {}
+
+ public void gotoSpecies(IAlleleSpecies value)
+ {
+ if (value != null)
+ {
+ this.modePages.setValue(Mode.Species);
+ changeMode(Mode.Species);
+ ((ModeWidgets)this.modes.get(this.modePages.getValue())).listBox.setValue(value);
+ }
+ }
+
+ public void gotoSpeciesDelayed(IAlleleSpecies species)
+ {
+ this.gotoSpecies = species;
+ }
+
+ private IAlleleSpecies gotoSpecies = null;
+
+ public void onUpdateClient()
+ {
+ super.onUpdateClient();
+ if (this.gotoSpecies != null)
+ {
+ ((WindowAbstractDatabase)getSuperParent()).gotoSpecies(this.gotoSpecies);
+ this.gotoSpecies = null;
+ }
+ }
+}
diff --git a/src/Java/binnie/craftgui/resource/IStyleSheet.java b/src/Java/binnie/craftgui/resource/IStyleSheet.java
new file mode 100644
index 0000000000..1ce8e7da2c
--- /dev/null
+++ b/src/Java/binnie/craftgui/resource/IStyleSheet.java
@@ -0,0 +1,6 @@
+package binnie.craftgui.resource;
+
+public abstract interface IStyleSheet
+{
+ public abstract Texture getTexture(Object paramObject);
+}
diff --git a/src/Java/binnie/craftgui/resource/StyleSheet.java b/src/Java/binnie/craftgui/resource/StyleSheet.java
new file mode 100644
index 0000000000..8685abd5be
--- /dev/null
+++ b/src/Java/binnie/craftgui/resource/StyleSheet.java
@@ -0,0 +1,18 @@
+package binnie.craftgui.resource;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class StyleSheet
+ implements IStyleSheet
+{
+ protected Map<Object, Texture> textures = new HashMap();
+
+ public Texture getTexture(Object key)
+ {
+ if (!this.textures.containsKey(key)) {
+ return StyleSheetManager.getTexture(key);
+ }
+ return (Texture)this.textures.get(key);
+ }
+}
diff --git a/src/Java/binnie/craftgui/resource/StyleSheetManager.java b/src/Java/binnie/craftgui/resource/StyleSheetManager.java
new file mode 100644
index 0000000000..b1bbd50272
--- /dev/null
+++ b/src/Java/binnie/craftgui/resource/StyleSheetManager.java
@@ -0,0 +1,28 @@
+package binnie.craftgui.resource;
+
+import binnie.craftgui.core.CraftGUI;
+import binnie.craftgui.resource.minecraft.CraftGUIResourceManager;
+
+public class StyleSheetManager
+{
+ static IStyleSheet defaultSS = new DefaultStyleSheet(null);
+
+ public static Texture getTexture(Object key)
+ {
+ return defaultSS.getTexture(key);
+ }
+
+ private static class DefaultStyleSheet
+ implements IStyleSheet
+ {
+ public Texture getTexture(Object key)
+ {
+ return CraftGUI.ResourceManager.getTexture(key.toString());
+ }
+ }
+
+ public static IStyleSheet getDefault()
+ {
+ return defaultSS;
+ }
+}
diff --git a/src/Java/binnie/craftgui/resource/Texture.java b/src/Java/binnie/craftgui/resource/Texture.java
new file mode 100644
index 0000000000..249be8f257
--- /dev/null
+++ b/src/Java/binnie/craftgui/resource/Texture.java
@@ -0,0 +1,128 @@
+package binnie.craftgui.resource;
+
+import binnie.core.resource.BinnieResource;
+import binnie.craftgui.core.geometry.IArea;
+import binnie.craftgui.core.geometry.IBorder;
+import binnie.craftgui.core.geometry.Position;
+
+public class Texture
+{
+ public static final Texture NULL = null;
+ IArea area;
+ IBorder padding = IBorder.ZERO;
+ IBorder border = IBorder.ZERO;
+ BinnieResource filename;
+
+ public Texture(IArea area, BinnieResource filename)
+ {
+ this(area, IBorder.ZERO, IBorder.ZERO, filename);
+ }
+
+ public Texture(IArea area, IBorder padding, BinnieResource filename)
+ {
+ this(area, padding, IBorder.ZERO, filename);
+ }
+
+ public Texture(IArea area, IBorder padding, IBorder border, BinnieResource filename)
+ {
+ this.area = new IArea(area);
+ this.padding = new IBorder(padding);
+ this.border = new IBorder(border);
+ this.filename = filename;
+ }
+
+ public IArea getArea()
+ {
+ return this.area;
+ }
+
+ public IBorder getPadding()
+ {
+ return this.padding;
+ }
+
+ public IBorder getBorder()
+ {
+ return this.border;
+ }
+
+ public BinnieResource getFilename()
+ {
+ return this.filename;
+ }
+
+ public IBorder getTotalPadding()
+ {
+ return this.padding.add(this.border);
+ }
+
+ public float w()
+ {
+ return getArea().w();
+ }
+
+ public float h()
+ {
+ return getArea().h();
+ }
+
+ public float u()
+ {
+ return getArea().x();
+ }
+
+ public float v()
+ {
+ return getArea().y();
+ }
+
+ public Texture crop(Position anchor, float dist)
+ {
+ return crop(new IBorder(anchor.opposite(), dist));
+ }
+
+ public Texture crop(IBorder crop)
+ {
+ Texture copy = new Texture(this.area, this.padding, this.border, this.filename);
+ if (crop.b() > 0.0F)
+ {
+ copy.border.b(0.0F);
+ copy.padding.b(copy.padding.b() - Math.min(crop.b(), copy.padding.b()));
+ copy.area.h(copy.area.h() - crop.b());
+ }
+ if (crop.t() > 0.0F)
+ {
+ copy.border.t(0.0F);
+ copy.padding.t(copy.padding.t() - Math.min(crop.t(), copy.padding.t()));
+ copy.area.h(copy.area.h() - crop.t());
+ copy.area.y(copy.area.y() + crop.t());
+ }
+ if (crop.r() > 0.0F)
+ {
+ copy.border.r(0.0F);
+ copy.padding.r(copy.padding.r() - Math.min(crop.r(), copy.padding.r()));
+ copy.area.w(copy.area.w() - crop.r());
+ }
+ if (crop.l() > 0.0F)
+ {
+ copy.border.l(0.0F);
+ copy.padding.l(copy.padding.l() - Math.min(crop.l(), copy.padding.l()));
+ copy.area.w(copy.area.w() - crop.l());
+ copy.area.x(copy.area.x() + crop.l());
+ }
+ return copy;
+ }
+
+ public String toString()
+ {
+ String out = "Texture[";
+ out = out + this.area.toString();
+ if (!this.padding.isNonZero()) {
+ out = out + " padding:" + this.padding.toString();
+ }
+ if (!this.border.isNonZero()) {
+ out = out + " border:" + this.border.toString();
+ }
+ return out + "]";
+ }
+}
diff --git a/src/Java/binnie/craftgui/resource/minecraft/CraftGUIResourceManager.java b/src/Java/binnie/craftgui/resource/minecraft/CraftGUIResourceManager.java
new file mode 100644
index 0000000000..42ff445f92
--- /dev/null
+++ b/src/Java/binnie/craftgui/resource/minecraft/CraftGUIResourceManager.java
@@ -0,0 +1,155 @@
+package binnie.craftgui.resource.minecraft;
+
+import binnie.core.resource.IBinnieTexture;
+import binnie.craftgui.core.geometry.IArea;
+import binnie.craftgui.core.geometry.IBorder;
+import binnie.craftgui.resource.Texture;
+import com.google.common.base.Charsets;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonParseException;
+import com.google.gson.JsonParser;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import net.minecraft.client.resources.IResource;
+import net.minecraft.client.resources.IResourceManager;
+import net.minecraft.client.resources.IResourceManagerReloadListener;
+import net.minecraft.util.ResourceLocation;
+import org.apache.commons.io.IOUtils;
+
+@SideOnly(Side.CLIENT)
+public class CraftGUIResourceManager
+ implements IResourceManagerReloadListener
+{
+ private Map<String, ParsedTextureSheet> textureSheets = new HashMap();
+ private Map<String, Texture> textures = new HashMap();
+
+ public CraftGUIResourceManager()
+ {
+ binnie.craftgui.core.CraftGUI.ResourceManager = this;
+ }
+
+ public void onResourceManagerReload(IResourceManager manager)
+ {
+ this.textureSheets.clear();
+ try
+ {
+ IResource res = manager.getResource(new ResourceLocation("binniecore", "gui/stylesheet.json"));
+
+ JsonObject jsonobject = null;
+ BufferedReader bufferedreader = null;
+ try
+ {
+ bufferedreader = new BufferedReader(new InputStreamReader(res.getInputStream(), Charsets.UTF_8));
+ jsonobject = new JsonParser().parse(bufferedreader).getAsJsonObject();
+ for (JsonElement el : jsonobject.get("texture-sheets").getAsJsonArray()) {
+ if ((el instanceof JsonObject))
+ {
+ JsonObject sheet = (JsonObject)el;
+ String name = sheet.get("name").getAsString();
+ String modid = sheet.get("modid").getAsString();
+ String path = sheet.get("path").getAsString();
+ this.textureSheets.put(name, new ParsedTextureSheet(name, modid, path));
+ }
+ }
+ for (JsonElement el : jsonobject.get("textures").getAsJsonArray()) {
+ if ((el instanceof JsonObject))
+ {
+ JsonObject sheet = (JsonObject)el;
+ String name = sheet.get("name").getAsString();
+ IBinnieTexture textureSheet = getTextureSheet(sheet.get("sheet").getAsString());
+ IArea uv = getArea(sheet.get("uv").getAsString());
+ IBorder border = IBorder.ZERO;
+ IBorder padding = IBorder.ZERO;
+ if (sheet.has("border")) {
+ border = getBorder(sheet.get("border").getAsString());
+ }
+ if (sheet.has("padding")) {
+ padding = getBorder(sheet.get("padding").getAsString());
+ }
+ this.textures.put(name, new Texture(uv, padding, border, textureSheet.getTexture()));
+ }
+ }
+ }
+ catch (RuntimeException runtimeexception)
+ {
+ throw new JsonParseException("Failed to parse stylesheet for Binnie's Mods", runtimeexception);
+ }
+ finally
+ {
+ IOUtils.closeQuietly(bufferedreader);
+ }
+ }
+ catch (IOException e)
+ {
+ throw new RuntimeException("Failed to load default stylesheet for Binnie's Mods.", e);
+ }
+ }
+
+ public IArea getArea(String name)
+ {
+ String[] split = name.split(" ");
+ if ((split.length < 1) || (split.length > 4)) {
+ throw new RuntimeException("Parameter must have between one and four numbers");
+ }
+ List<Float> f = new ArrayList();
+ for (String string : split) {
+ f.add(Float.valueOf(Float.parseFloat(string)));
+ }
+ if (f.size() == 1) {
+ return new IArea(((Float)f.get(0)).floatValue());
+ }
+ if (f.size() == 2) {
+ return new IArea(((Float)f.get(0)).floatValue(), ((Float)f.get(1)).floatValue());
+ }
+ if (f.size() == 3) {
+ return new IArea(((Float)f.get(0)).floatValue(), ((Float)f.get(1)).floatValue(), ((Float)f.get(2)).floatValue());
+ }
+ return new IArea(((Float)f.get(0)).floatValue(), ((Float)f.get(1)).floatValue(), ((Float)f.get(2)).floatValue(), ((Float)f.get(3)).floatValue());
+ }
+
+ public IBorder getBorder(String name)
+ {
+ String[] split = name.split(" ");
+ if ((split.length < 1) || (split.length > 4)) {
+ throw new RuntimeException("Parameter must have between one and four numbers");
+ }
+ List<Float> f = new ArrayList();
+ for (String string : split) {
+ f.add(Float.valueOf(Float.parseFloat(string)));
+ }
+ if (f.size() == 1) {
+ return new IBorder(((Float)f.get(0)).floatValue());
+ }
+ if (f.size() == 2) {
+ return new IBorder(((Float)f.get(0)).floatValue(), ((Float)f.get(1)).floatValue());
+ }
+ if (f.size() == 3) {
+ return new IBorder(((Float)f.get(0)).floatValue(), ((Float)f.get(1)).floatValue(), ((Float)f.get(2)).floatValue());
+ }
+ return new IBorder(((Float)f.get(0)).floatValue(), ((Float)f.get(1)).floatValue(), ((Float)f.get(2)).floatValue(), ((Float)f.get(3)).floatValue());
+ }
+
+ public IBinnieTexture getTextureSheet(String name)
+ {
+ if (!this.textureSheets.containsKey(name)) {
+ throw new RuntimeException("Missing GUI texture sheet for Binnie Mods: " + name);
+ }
+ return (IBinnieTexture)this.textureSheets.get(name);
+ }
+
+ public Texture getTexture(String name)
+ {
+ if (!this.textures.containsKey(name)) {
+ throw new RuntimeException("Missing GUI texture Binnie Mods: " + name);
+ }
+ return (Texture)this.textures.get(name);
+ }
+}
diff --git a/src/Java/binnie/craftgui/resource/minecraft/CraftGUITexture.java b/src/Java/binnie/craftgui/resource/minecraft/CraftGUITexture.java
new file mode 100644
index 0000000000..cb1ca27bd5
--- /dev/null
+++ b/src/Java/binnie/craftgui/resource/minecraft/CraftGUITexture.java
@@ -0,0 +1,18 @@
+package binnie.craftgui.resource.minecraft;
+
+public enum CraftGUITexture
+{
+ Window("window"), PanelGray("panel.gray"), PanelBlack("panel.black"), PanelTinted("panel.tinted"), ButtonDisabled("button.disabled"), Button("button"), ButtonHighlighted("button.highlighted"), Slot("slot"), SlotBorder("slot.border"), SlotOverlay("slot.overlay"), SlotCharge("slot.charge"), LiquidTank("liquidtank"), LiquidTankOverlay("liquidtank.overlay"), StateError("errorstate.error"), StateWarning("errorstate.warning"), StateNone("errorstate.none"), EnergyBarBack("energybar.back"), EnergyBarGlow("energybar.glow"), EnergyBarGlass("energybar.glass"), TabDisabled("tab.disabled"), Tab("tab"), TabHighlighted("tab.highlighted"), TabOutline("tab.outline"), TabSolid("tab.solid"), ScrollDisabled("scroll.disabled"), Scroll("scroll"), ScrollHighlighted("scroll.highlighted"), Outline("outline"), HelpButton("button.help"), InfoButton("button.info"), UserButton("button.user"), PowerButton("button.power"), HorizontalLiquidTank("horizontalliquidtank"), HorizontalLiquidTankOverlay("horizontalliquidtank.overlay"), SlideUp("slide.up"), SlideDown("slide.down"), SlideLeft("slide.left"), SlideRight("slide.right"), Checkbox("checkbox"), CheckboxHighlighted("checkbox.highlighted"), CheckboxChecked("checkbox.checked"), CheckboxCheckedHighlighted("checkbox.checked.highlighted");
+
+ String name;
+
+ private CraftGUITexture(String name)
+ {
+ this.name = name;
+ }
+
+ public String toString()
+ {
+ return this.name;
+ }
+}
diff --git a/src/Java/binnie/craftgui/resource/minecraft/CraftGUITextureSheet.java b/src/Java/binnie/craftgui/resource/minecraft/CraftGUITextureSheet.java
new file mode 100644
index 0000000000..816a422749
--- /dev/null
+++ b/src/Java/binnie/craftgui/resource/minecraft/CraftGUITextureSheet.java
@@ -0,0 +1,33 @@
+package binnie.craftgui.resource.minecraft;
+
+import binnie.core.BinnieCore;
+import binnie.core.proxy.BinnieProxy;
+import binnie.core.resource.BinnieResource;
+import binnie.core.resource.IBinnieTexture;
+import binnie.craftgui.core.CraftGUI;
+
+public enum CraftGUITextureSheet
+ implements IBinnieTexture
+{
+ Controls2("controls"), Panel2("panels"), Slots("slots");
+
+ String name;
+
+ private CraftGUITextureSheet(String name)
+ {
+ this.name = name;
+ }
+
+ public String toString()
+ {
+ return this.name;
+ }
+
+ public BinnieResource getTexture()
+ {
+ if (BinnieCore.proxy.isServer()) {
+ return null;
+ }
+ return CraftGUI.ResourceManager.getTextureSheet(this.name).getTexture();
+ }
+}
diff --git a/src/Java/binnie/craftgui/resource/minecraft/PaddedTexture.java b/src/Java/binnie/craftgui/resource/minecraft/PaddedTexture.java
new file mode 100644
index 0000000000..a682d0b37d
--- /dev/null
+++ b/src/Java/binnie/craftgui/resource/minecraft/PaddedTexture.java
@@ -0,0 +1,21 @@
+package binnie.craftgui.resource.minecraft;
+
+import binnie.core.resource.BinnieResource;
+import binnie.core.resource.IBinnieTexture;
+import binnie.craftgui.core.geometry.IArea;
+import binnie.craftgui.core.geometry.IBorder;
+import binnie.craftgui.resource.Texture;
+
+public class PaddedTexture
+ extends Texture
+{
+ public PaddedTexture(int u, int v, int w, int h, int offset, IBinnieTexture textureFile, int leftPadding, int rightPadding, int topPadding, int bottomPadding)
+ {
+ this(u, v, w, h, offset, textureFile.getTexture(), leftPadding, rightPadding, topPadding, bottomPadding);
+ }
+
+ public PaddedTexture(int u, int v, int w, int h, int offset, BinnieResource textureFile, int leftPadding, int rightPadding, int topPadding, int bottomPadding)
+ {
+ super(new IArea(u, v, w, h), new IBorder(topPadding, rightPadding, bottomPadding, leftPadding), new IBorder(offset), textureFile);
+ }
+}
diff --git a/src/Java/binnie/craftgui/resource/minecraft/ParsedTextureSheet.java b/src/Java/binnie/craftgui/resource/minecraft/ParsedTextureSheet.java
new file mode 100644
index 0000000000..4a10017b7c
--- /dev/null
+++ b/src/Java/binnie/craftgui/resource/minecraft/ParsedTextureSheet.java
@@ -0,0 +1,25 @@
+package binnie.craftgui.resource.minecraft;
+
+import binnie.core.resource.BinnieResource;
+import binnie.core.resource.IBinnieTexture;
+import binnie.core.resource.ResourceType;
+
+class ParsedTextureSheet
+ implements IBinnieTexture
+{
+ private String name;
+ private String modid;
+ private String path;
+
+ public ParsedTextureSheet(String name, String modid, String path)
+ {
+ this.name = name;
+ this.modid = modid;
+ this.path = path;
+ }
+
+ public BinnieResource getTexture()
+ {
+ return new BinnieResource(this.modid, ResourceType.GUI, this.path);
+ }
+}
diff --git a/src/Java/binnie/craftgui/resource/minecraft/StandardTexture.java b/src/Java/binnie/craftgui/resource/minecraft/StandardTexture.java
new file mode 100644
index 0000000000..b98facb505
--- /dev/null
+++ b/src/Java/binnie/craftgui/resource/minecraft/StandardTexture.java
@@ -0,0 +1,36 @@
+package binnie.craftgui.resource.minecraft;
+
+import binnie.core.resource.BinnieResource;
+import binnie.core.resource.IBinnieTexture;
+import binnie.craftgui.core.geometry.IArea;
+import binnie.craftgui.core.geometry.IBorder;
+import binnie.craftgui.resource.Texture;
+
+public class StandardTexture
+ extends Texture
+{
+ public StandardTexture(int u, int v, int w, int h, IBinnieTexture textureFile)
+ {
+ this(u, v, w, h, 0, textureFile.getTexture());
+ }
+
+ public StandardTexture(int u, int v, int w, int h, int offset, IBinnieTexture textureFile)
+ {
+ this(u, v, w, h, offset, textureFile.getTexture());
+ }
+
+ public StandardTexture(int u, int v, int w, int h, BinnieResource textureFile)
+ {
+ this(u, v, w, h, 0, textureFile);
+ }
+
+ public StandardTexture(int u, int v, int w, int h, int padding, BinnieResource textureFile)
+ {
+ super(new IArea(u, v, w, h), IBorder.ZERO, new IBorder(padding), textureFile);
+ }
+
+ public BinnieResource getTexture()
+ {
+ return getFilename();
+ }
+}
diff --git a/src/Java/binnie/craftgui/window/Panel.java b/src/Java/binnie/craftgui/window/Panel.java
new file mode 100644
index 0000000000..3b305f6d69
--- /dev/null
+++ b/src/Java/binnie/craftgui/window/Panel.java
@@ -0,0 +1,58 @@
+package binnie.craftgui.window;
+
+import binnie.craftgui.controls.core.Control;
+import binnie.craftgui.core.CraftGUI;
+import binnie.craftgui.core.IWidget;
+import binnie.craftgui.core.geometry.IArea;
+import binnie.craftgui.core.renderer.Renderer;
+import binnie.craftgui.minecraft.MinecraftGUI.PanelType;
+import binnie.craftgui.resource.minecraft.CraftGUITexture;
+
+public class Panel
+ extends Control
+{
+ IPanelType type;
+
+ public Panel(IWidget parent, float x, float y, float width, float height, IPanelType type)
+ {
+ super(parent, x, y, width, height);
+ this.type = type;
+ }
+
+ public Panel(IWidget parent, IArea area, IPanelType type)
+ {
+ this(parent, area.x(), area.y(), area.w(), area.h(), type);
+ }
+
+ public IPanelType getType()
+ {
+ return this.type;
+ }
+
+ public void onRenderBackground()
+ {
+ IPanelType panelType = getType();
+ if ((panelType instanceof MinecraftGUI.PanelType)) {
+ switch (1.$SwitchMap$binnie$craftgui$minecraft$MinecraftGUI$PanelType[((MinecraftGUI.PanelType)panelType).ordinal()])
+ {
+ case 1:
+ CraftGUI.Render.texture(CraftGUITexture.PanelBlack, getArea());
+ break;
+ case 2:
+ CraftGUI.Render.texture(CraftGUITexture.PanelGray, getArea());
+ break;
+ case 3:
+ CraftGUI.Render.texture(CraftGUITexture.PanelTinted, getArea());
+ break;
+ case 4:
+ CraftGUI.Render.texture(CraftGUITexture.Outline, getArea());
+ break;
+ case 5:
+ CraftGUI.Render.texture(CraftGUITexture.TabOutline, getArea());
+ break;
+ }
+ }
+ }
+
+ public static abstract interface IPanelType {}
+}
diff --git a/src/Java/binnie/extrabees/ExtraBees.java b/src/Java/binnie/extrabees/ExtraBees.java
new file mode 100644
index 0000000000..ef93560cc0
--- /dev/null
+++ b/src/Java/binnie/extrabees/ExtraBees.java
@@ -0,0 +1,123 @@
+package binnie.extrabees;
+
+import binnie.core.AbstractMod;
+import binnie.core.BinnieCore;
+import binnie.core.gui.IBinnieGUID;
+import binnie.core.network.BinniePacketHandler;
+import binnie.core.proxy.IProxyCore;
+import binnie.extrabees.apiary.ModuleApiary;
+import binnie.extrabees.config.ConfigurationMachines;
+import binnie.extrabees.config.ConfigurationMain;
+import binnie.extrabees.core.ExtraBeeGUID;
+import binnie.extrabees.core.ModuleCore;
+import binnie.extrabees.genetics.ModuleGenetics;
+import binnie.extrabees.liquids.ModuleLiquids;
+import binnie.extrabees.products.ModuleProducts;
+import binnie.extrabees.proxy.ExtraBeesProxy;
+import binnie.extrabees.worldgen.ModuleGeneration;
+import cpw.mods.fml.common.Mod;
+import cpw.mods.fml.common.Mod.EventHandler;
+import cpw.mods.fml.common.Mod.Instance;
+import cpw.mods.fml.common.SidedProxy;
+import cpw.mods.fml.common.event.FMLInitializationEvent;
+import cpw.mods.fml.common.event.FMLPostInitializationEvent;
+import cpw.mods.fml.common.event.FMLPreInitializationEvent;
+import net.minecraft.block.Block;
+import net.minecraft.block.material.Material;
+import net.minecraft.item.Item;
+
+@Mod(modid="ExtraBees", name="Extra Bees", useMetadata=true, dependencies="after:BinnieCore")
+public class ExtraBees
+ extends AbstractMod
+{
+ @Mod.Instance("ExtraBees")
+ public static ExtraBees instance;
+ @SidedProxy(clientSide="binnie.extrabees.proxy.ExtraBeesProxyClient", serverSide="binnie.extrabees.proxy.ExtraBeesProxyServer")
+ public static ExtraBeesProxy proxy;
+ public static Block hive;
+ public static Material materialBeehive;
+ public static Block ectoplasm;
+ public static Block apiaristMachine;
+ public static Block geneticMachine;
+ public static Block advGeneticMachine;
+ public static Item comb;
+ public static Item propolis;
+ public static Item honeyDrop;
+ public static Item honeyCrystal;
+ public static Item honeyCrystalEmpty;
+ public static Item dictionary;
+ public static Item itemMisc;
+
+ @Mod.EventHandler
+ public void preInit(FMLPreInitializationEvent evt)
+ {
+ addModule(new ModuleCore());
+ addModule(new ModuleProducts());
+ addModule(new ModuleGenetics());
+ addModule(new ModuleGeneration());
+ addModule(new ModuleLiquids());
+ addModule(new ModuleApiary());
+ preInit();
+ }
+
+ @Mod.EventHandler
+ public void init(FMLInitializationEvent evt)
+ {
+ init();
+ }
+
+ @Mod.EventHandler
+ public void postInit(FMLPostInitializationEvent evt)
+ {
+ postInit();
+ }
+
+ public ExtraBees()
+ {
+ instance = this;
+ }
+
+ public IBinnieGUID[] getGUIDs()
+ {
+ return ExtraBeeGUID.values();
+ }
+
+ public Class<?>[] getConfigs()
+ {
+ return new Class[] { ConfigurationMain.class, ConfigurationMachines.class };
+ }
+
+ public IProxyCore getProxy()
+ {
+ return proxy;
+ }
+
+ public String getChannel()
+ {
+ return "EB";
+ }
+
+ public String getModID()
+ {
+ return "extrabees";
+ }
+
+ protected Class<? extends BinniePacketHandler> getPacketHandler()
+ {
+ return PacketHandler.class;
+ }
+
+ public static class PacketHandler
+ extends BinniePacketHandler
+ {
+ public PacketHandler()
+ {
+ super();
+ }
+ }
+
+ public boolean isActive()
+ {
+ return BinnieCore.isExtraBeesActive();
+ }
+}
diff --git a/src/Java/binnie/extrabees/apiary/ComponentBeeModifier.java b/src/Java/binnie/extrabees/apiary/ComponentBeeModifier.java
new file mode 100644
index 0000000000..32cb7dcd48
--- /dev/null
+++ b/src/Java/binnie/extrabees/apiary/ComponentBeeModifier.java
@@ -0,0 +1,88 @@
+package binnie.extrabees.apiary;
+
+import binnie.core.machines.Machine;
+import binnie.core.machines.MachineComponent;
+import forestry.api.apiculture.IBee;
+import forestry.api.apiculture.IBeeGenome;
+import forestry.api.apiculture.IBeeListener;
+import forestry.api.apiculture.IBeeModifier;
+import forestry.api.genetics.IIndividual;
+import net.minecraft.item.ItemStack;
+
+public class ComponentBeeModifier
+ extends MachineComponent
+ implements IBeeModifier, IBeeListener
+{
+ public ComponentBeeModifier(Machine machine)
+ {
+ super(machine);
+ }
+
+ public float getTerritoryModifier(IBeeGenome genome, float currentModifier)
+ {
+ return 1.0F;
+ }
+
+ public float getMutationModifier(IBeeGenome genome, IBeeGenome mate, float currentModifier)
+ {
+ return 1.0F;
+ }
+
+ public float getLifespanModifier(IBeeGenome genome, IBeeGenome mate, float currentModifier)
+ {
+ return 1.0F;
+ }
+
+ public float getProductionModifier(IBeeGenome genome, float currentModifier)
+ {
+ return 1.0F;
+ }
+
+ public float getFloweringModifier(IBeeGenome genome, float currentModifier)
+ {
+ return 1.0F;
+ }
+
+ public boolean isSealed()
+ {
+ return false;
+ }
+
+ public boolean isSelfLighted()
+ {
+ return false;
+ }
+
+ public boolean isSunlightSimulated()
+ {
+ return false;
+ }
+
+ public boolean isHellish()
+ {
+ return false;
+ }
+
+ public void onQueenChange(ItemStack queen) {}
+
+ public void wearOutEquipment(int amount) {}
+
+ public void onQueenDeath(IBee queen) {}
+
+ public void onPostQueenDeath(IBee queen) {}
+
+ public boolean onPollenRetrieved(IBee queen, IIndividual pollen, boolean isHandled)
+ {
+ return false;
+ }
+
+ public boolean onEggLaid(IBee queen)
+ {
+ return false;
+ }
+
+ public float getGeneticDecay(IBeeGenome genome, float currentModifier)
+ {
+ return 1.0F;
+ }
+}
diff --git a/src/Java/binnie/extrabees/apiary/ComponentExtraBeeGUI.java b/src/Java/binnie/extrabees/apiary/ComponentExtraBeeGUI.java
new file mode 100644
index 0000000000..db2527e14c
--- /dev/null
+++ b/src/Java/binnie/extrabees/apiary/ComponentExtraBeeGUI.java
@@ -0,0 +1,28 @@
+package binnie.extrabees.apiary;
+
+import binnie.core.machines.Machine;
+import binnie.core.machines.MachineComponent;
+import binnie.core.machines.component.IInteraction.RightClick;
+import binnie.extrabees.ExtraBees;
+import binnie.extrabees.core.ExtraBeeGUID;
+import binnie.extrabees.proxy.ExtraBeesProxy;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.world.World;
+
+public class ComponentExtraBeeGUI
+ extends MachineComponent
+ implements IInteraction.RightClick
+{
+ ExtraBeeGUID id;
+
+ public ComponentExtraBeeGUI(Machine machine, ExtraBeeGUID id)
+ {
+ super(machine);
+ this.id = id;
+ }
+
+ public void onRightClick(World world, EntityPlayer player, int x, int y, int z)
+ {
+ ExtraBees.proxy.openGui(this.id, player, x, y, z);
+ }
+}
diff --git a/src/Java/binnie/extrabees/apiary/EnumHiveFrame.java b/src/Java/binnie/extrabees/apiary/EnumHiveFrame.java
new file mode 100644
index 0000000000..6a135c2532
--- /dev/null
+++ b/src/Java/binnie/extrabees/apiary/EnumHiveFrame.java
@@ -0,0 +1,140 @@
+package binnie.extrabees.apiary;
+
+import binnie.core.Mods;
+import binnie.core.Mods.Mod;
+import binnie.core.genetics.BeeModifierLogic;
+import binnie.core.genetics.EnumBeeBooleanModifier;
+import binnie.core.genetics.EnumBeeModifier;
+import binnie.extrabees.ExtraBees;
+import binnie.extrabees.proxy.ExtraBeesProxy;
+import cpw.mods.fml.common.registry.GameRegistry;
+import forestry.api.apiculture.IBee;
+import forestry.api.apiculture.IBeeGenome;
+import forestry.api.apiculture.IBeeHousing;
+import forestry.api.apiculture.IHiveFrame;
+import net.minecraft.init.Blocks;
+import net.minecraft.init.Items;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+
+public enum EnumHiveFrame
+ implements IHiveFrame
+{
+ Cocoa, Cage, Soul, Clay, Debug;
+
+ Item item;
+
+ public static void init()
+ {
+ Cocoa.logic.setModifier(EnumBeeModifier.Lifespan, 0.75F, 0.25F);
+ Cocoa.logic.setModifier(EnumBeeModifier.Production, 1.5F, 5.0F);
+
+ Cage.logic.setModifier(EnumBeeModifier.Territory, 0.5F, 0.1F);
+ Cage.logic.setModifier(EnumBeeModifier.Lifespan, 0.75F, 0.5F);
+ Cage.logic.setModifier(EnumBeeModifier.Production, 0.75F, 0.5F);
+
+ Soul.logic.setModifier(EnumBeeModifier.Mutation, 1.5F, 5.0F);
+ Soul.logic.setModifier(EnumBeeModifier.Lifespan, 0.75F, 0.5F);
+ Soul.logic.setModifier(EnumBeeModifier.Production, 0.25F, 0.1F);
+ Soul.setMaxDamage(80);
+
+ Clay.logic.setModifier(EnumBeeModifier.Lifespan, 1.5F, 5.0F);
+ Clay.logic.setModifier(EnumBeeModifier.Mutation, 0.5F, 0.2F);
+ Clay.logic.setModifier(EnumBeeModifier.Production, 0.75F, 0.2F);
+
+ Debug.logic.setModifier(EnumBeeModifier.Lifespan, 1.0E-004F, 1.0E-004F);
+
+
+
+ GameRegistry.addRecipe(new ItemStack(Cocoa.item), new Object[] { " c ", "cFc", " c ", Character.valueOf('F'), Mods.Forestry.stack("frameImpregnated"), Character.valueOf('c'), new ItemStack(Items.dye, 1, 3) });
+
+
+
+ GameRegistry.addShapelessRecipe(new ItemStack(Cage.item), new Object[] { Mods.Forestry.stack("frameImpregnated"), Blocks.iron_bars });
+
+
+ GameRegistry.addShapelessRecipe(new ItemStack(Soul.item), new Object[] { Mods.Forestry.stack("frameImpregnated"), Blocks.soul_sand });
+
+
+ GameRegistry.addRecipe(new ItemStack(Clay.item), new Object[] { " c ", "cFc", " c ", Character.valueOf('F'), Mods.Forestry.stack("frameImpregnated"), Character.valueOf('c'), Items.clay_ball });
+ }
+
+ public int getIconIndex()
+ {
+ return 55 + ordinal();
+ }
+
+ public void setMaxDamage(int damage)
+ {
+ this.maxDamage = damage;
+ }
+
+ int maxDamage = 240;
+ BeeModifierLogic logic = new BeeModifierLogic();
+
+ private EnumHiveFrame() {}
+
+ public ItemStack frameUsed(IBeeHousing house, ItemStack frame, IBee queen, int wear)
+ {
+ frame.setItemDamage(frame.getItemDamage() + wear);
+ if (frame.getItemDamage() >= frame.getMaxDamage()) {
+ return null;
+ }
+ return frame;
+ }
+
+ public float getTerritoryModifier(IBeeGenome genome, float currentModifier)
+ {
+ return this.logic.getModifier(EnumBeeModifier.Territory, currentModifier);
+ }
+
+ public float getMutationModifier(IBeeGenome genome, IBeeGenome mate, float currentModifier)
+ {
+ return this.logic.getModifier(EnumBeeModifier.Mutation, currentModifier);
+ }
+
+ public float getLifespanModifier(IBeeGenome genome, IBeeGenome mate, float currentModifier)
+ {
+ return this.logic.getModifier(EnumBeeModifier.Lifespan, currentModifier);
+ }
+
+ public float getProductionModifier(IBeeGenome genome, float currentModifier)
+ {
+ return this.logic.getModifier(EnumBeeModifier.Production, currentModifier);
+ }
+
+ public float getFloweringModifier(IBeeGenome genome, float currentModifier)
+ {
+ return this.logic.getModifier(EnumBeeModifier.Flowering, currentModifier);
+ }
+
+ public float getGeneticDecay(IBeeGenome genome, float currentModifier)
+ {
+ return this.logic.getModifier(EnumBeeModifier.GeneticDecay, currentModifier);
+ }
+
+ public boolean isSealed()
+ {
+ return this.logic.getModifier(EnumBeeBooleanModifier.Sealed);
+ }
+
+ public boolean isSelfLighted()
+ {
+ return this.logic.getModifier(EnumBeeBooleanModifier.SelfLighted);
+ }
+
+ public boolean isSunlightSimulated()
+ {
+ return this.logic.getModifier(EnumBeeBooleanModifier.SunlightStimulated);
+ }
+
+ public boolean isHellish()
+ {
+ return this.logic.getModifier(EnumBeeBooleanModifier.Hellish);
+ }
+
+ public String getName()
+ {
+ return ExtraBees.proxy.localise("item.frame." + toString().toLowerCase());
+ }
+}
diff --git a/src/Java/binnie/extrabees/apiary/IndustrialFrame.java b/src/Java/binnie/extrabees/apiary/IndustrialFrame.java
new file mode 100644
index 0000000000..f8d3e5ff7a
--- /dev/null
+++ b/src/Java/binnie/extrabees/apiary/IndustrialFrame.java
@@ -0,0 +1,141 @@
+package binnie.extrabees.apiary;
+
+import forestry.api.apiculture.IBeeGenome;
+import forestry.api.apiculture.IBeeModifier;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+
+public enum IndustrialFrame
+ implements IBeeModifier
+{
+ Empty("Empty", 5, 0), Light("Glowstone Lighting", 2, 4), Rain("Rain Shielding", 2, 4), Sunlight("Sunlight Simulator", 4, 8), Soul("Low Grade Mutagen", 5, 15), Uranium("High Grade Mutagen", 10, 50), Cage("Meshed Restrainer", 3, 12), Freedom("Territory Extension", 3, 16), Honey("Honey Amplifier", 4, 12), Jelly("Gelatin Amplifier", 8, 36), Leaf("Pollinator MK I", 3, 15), Pollen("Pollinator MK II", 7, 25), Clay("Lifespan Extensor", 2, 10), Emerald("Eon Simulator", 7, 20), NetherStar("Immortality Gate", 12, 50), Poison("Mortality Inhibitor", 8, 18);
+
+ String name;
+
+ private IndustrialFrame(String name, int wear, int power)
+ {
+ this.name = name;
+ this.wearMod = wear;
+ this.power = power;
+ }
+
+ public static ItemStack getItemStack(Item item, IndustrialFrame frame)
+ {
+ ItemStack stack = new ItemStack(item);
+ NBTTagCompound nbt = new NBTTagCompound();
+ nbt.setInteger("frame", frame.ordinal());
+ stack.setTagCompound(nbt);
+ return stack;
+ }
+
+ static
+ {
+ Light.lighted = true;
+
+ Rain.rain = true;
+
+ Sunlight.lighted = true;
+ Sunlight.sunlight = true;
+
+ Soul.mutationMod = 1.3F;
+
+ Uranium.mutationMod = 2.0F;
+
+ Cage.territoryMod = 0.4F;
+
+ Freedom.territoryMod = 1.4F;
+
+ Honey.productionMod = 1.4F;
+
+ Jelly.productionMod = 1.8F;
+
+ Leaf.floweringMod = 1.4F;
+
+ Pollen.floweringMod = 2.0F;
+
+ Clay.lifespanMod = 1.4F;
+
+ Emerald.lifespanMod = 2.0F;
+
+ NetherStar.lifespanMod = 20.0F;
+
+ Poison.lifespanMod = 0.5F;
+ }
+
+ float territoryMod = 1.0F;
+ float mutationMod = 1.0F;
+ float lifespanMod = 1.0F;
+ float productionMod = 1.0F;
+ float floweringMod = 1.0F;
+ boolean lighted = false;
+ boolean sunlight = false;
+ boolean rain = false;
+ int wearMod;
+ int power;
+
+ public float getTerritoryModifier(IBeeGenome genome, float currentModifier)
+ {
+ return this.territoryMod;
+ }
+
+ public float getMutationModifier(IBeeGenome genome, IBeeGenome mate, float currentModifier)
+ {
+ return this.mutationMod;
+ }
+
+ public float getLifespanModifier(IBeeGenome genome, IBeeGenome mate, float currentModifier)
+ {
+ return this.lifespanMod;
+ }
+
+ public float getProductionModifier(IBeeGenome genome, float currentModifier)
+ {
+ return this.productionMod;
+ }
+
+ public float getFloweringModifier(IBeeGenome genome, float currentModifier)
+ {
+ return this.floweringMod;
+ }
+
+ public boolean isSealed()
+ {
+ return this.rain;
+ }
+
+ public boolean isSelfLighted()
+ {
+ return this.lighted;
+ }
+
+ public boolean isSunlightSimulated()
+ {
+ return this.sunlight;
+ }
+
+ public boolean isHellish()
+ {
+ return false;
+ }
+
+ public Object getName()
+ {
+ return this.name;
+ }
+
+ public int getWearModifier()
+ {
+ return this.wearMod;
+ }
+
+ public int getPowerUsage()
+ {
+ return this.power;
+ }
+
+ public float getGeneticDecay(IBeeGenome genome, float currentModifier)
+ {
+ return 1.0F;
+ }
+}
diff --git a/src/Java/binnie/extrabees/apiary/ItemHiveFrame.java b/src/Java/binnie/extrabees/apiary/ItemHiveFrame.java
new file mode 100644
index 0000000000..c2e8c27fbc
--- /dev/null
+++ b/src/Java/binnie/extrabees/apiary/ItemHiveFrame.java
@@ -0,0 +1,100 @@
+package binnie.extrabees.apiary;
+
+import binnie.extrabees.ExtraBees;
+import binnie.extrabees.proxy.ExtraBeesProxy;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import forestry.api.apiculture.IBee;
+import forestry.api.apiculture.IBeeGenome;
+import forestry.api.apiculture.IBeeHousing;
+import forestry.api.apiculture.IHiveFrame;
+import forestry.api.core.Tabs;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+
+public class ItemHiveFrame
+ extends Item
+ implements IHiveFrame
+{
+ EnumHiveFrame frame;
+
+ public String getItemStackDisplayName(ItemStack par1ItemStack)
+ {
+ return this.frame.getName();
+ }
+
+ public ItemHiveFrame(EnumHiveFrame frame)
+ {
+ this.frame = frame;
+ setMaxDamage(frame.maxDamage);
+ setCreativeTab(Tabs.tabApiculture);
+ setMaxStackSize(1);
+ setUnlocalizedName("hiveFrame");
+ }
+
+ public float getTerritoryModifier(IBeeGenome genome, float currentModifier)
+ {
+ return this.frame.getTerritoryModifier(genome, currentModifier);
+ }
+
+ public float getMutationModifier(IBeeGenome genome, IBeeGenome mate, float currentModifier)
+ {
+ return this.frame.getMutationModifier(genome, mate, currentModifier);
+ }
+
+ public float getLifespanModifier(IBeeGenome genome, IBeeGenome mate, float currentModifier)
+ {
+ return this.frame.getLifespanModifier(genome, mate, currentModifier);
+ }
+
+ public float getProductionModifier(IBeeGenome genome, float currentModifier)
+ {
+ return this.frame.getProductionModifier(genome, currentModifier);
+ }
+
+ public ItemStack frameUsed(IBeeHousing housing, ItemStack frame, IBee queen, int wear)
+ {
+ frame.setItemDamage(frame.getItemDamage() + wear);
+ if (frame.getItemDamage() >= frame.getMaxDamage()) {
+ return null;
+ }
+ return frame;
+ }
+
+ public float getFloweringModifier(IBeeGenome genome, float currentModifier)
+ {
+ return 1.0F;
+ }
+
+ public boolean isSealed()
+ {
+ return false;
+ }
+
+ public boolean isSelfLighted()
+ {
+ return false;
+ }
+
+ public boolean isSunlightSimulated()
+ {
+ return false;
+ }
+
+ public boolean isHellish()
+ {
+ return false;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void registerIcons(IIconRegister register)
+ {
+ this.itemIcon = ExtraBees.proxy.getIcon(register, "frame" + this.frame.toString());
+ }
+
+ public float getGeneticDecay(IBeeGenome genome, float currentModifier)
+ {
+ return 1.0F;
+ }
+}
diff --git a/src/Java/binnie/extrabees/apiary/ItemIndustrialFrame.java b/src/Java/binnie/extrabees/apiary/ItemIndustrialFrame.java
new file mode 100644
index 0000000000..0450798b52
--- /dev/null
+++ b/src/Java/binnie/extrabees/apiary/ItemIndustrialFrame.java
@@ -0,0 +1,66 @@
+package binnie.extrabees.apiary;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import java.util.List;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+
+public class ItemIndustrialFrame
+ extends Item
+{
+ @SideOnly(Side.CLIENT)
+ public boolean requiresMultipleRenderPasses()
+ {
+ return true;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List par3List)
+ {
+ for (IndustrialFrame frame : )
+ {
+ ItemStack stack = new ItemStack(this);
+ NBTTagCompound nbt = new NBTTagCompound();
+ nbt.setInteger("frame", frame.ordinal());
+ stack.setTagCompound(nbt);
+ par3List.add(stack);
+ }
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
+ {
+ super.addInformation(par1ItemStack, par2EntityPlayer, par3List, par4);
+ IndustrialFrame frame = getFrame(par1ItemStack);
+ if (frame == null) {
+ par3List.add("Invalid Contents");
+ } else {
+ par3List.add(frame.getName());
+ }
+ }
+
+ public String getItemStackDisplayName(ItemStack par1ItemStack)
+ {
+ return "Industrial Frame";
+ }
+
+ public ItemIndustrialFrame()
+ {
+ setCreativeTab(CreativeTabs.tabMisc);
+ setMaxDamage(400);
+ setMaxStackSize(1);
+ setUnlocalizedName("industrialFrame");
+ }
+
+ public static IndustrialFrame getFrame(ItemStack stack)
+ {
+ if ((stack == null) || (!stack.hasTagCompound()) || (!stack.getTagCompound().hasKey("frame"))) {
+ return null;
+ }
+ return IndustrialFrame.values()[stack.getTagCompound().getInteger("frame")];
+ }
+}
diff --git a/src/Java/binnie/extrabees/apiary/ModuleApiary.java b/src/Java/binnie/extrabees/apiary/ModuleApiary.java
new file mode 100644
index 0000000000..bcf9da626b
--- /dev/null
+++ b/src/Java/binnie/extrabees/apiary/ModuleApiary.java
@@ -0,0 +1,96 @@
+package binnie.extrabees.apiary;
+
+import binnie.core.BinnieCore;
+import binnie.core.IInitializable;
+import binnie.core.Mods;
+import binnie.core.Mods.Mod;
+import binnie.core.circuits.BinnieCircuitLayout;
+import binnie.core.machines.MachineGroup;
+import binnie.core.proxy.BinnieProxy;
+import binnie.extrabees.ExtraBees;
+import binnie.extrabees.apiary.machine.AlvearyMachine;
+import binnie.extrabees.apiary.machine.AlvearyMutator;
+import binnie.extrabees.apiary.machine.AlvearyStimulator.CircuitType;
+import cpw.mods.fml.common.registry.GameRegistry;
+import forestry.api.core.Tabs;
+import net.minecraft.block.Block;
+import net.minecraft.init.Blocks;
+import net.minecraft.init.Items;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.oredict.ShapedOreRecipe;
+
+public class ModuleApiary
+ implements IInitializable
+{
+ public static Block blockComponent;
+ BinnieCircuitLayout stimulatorLayout;
+
+ public void preInit()
+ {
+ MachineGroup machineGroup = new MachineGroup(ExtraBees.instance, "alveay", "alveary", AlvearyMachine.values());
+ machineGroup.setCreativeTab(Tabs.tabApiculture);
+
+ BinnieCore.proxy.registerTileEntity(TileExtraBeeAlveary.class, "extrabees.tile.alveary", BinnieCore.proxy.createObject("binnie.core.machines.RendererMachine"));
+
+
+
+
+
+ blockComponent = machineGroup.getBlock();
+
+ AlvearyMutator.addMutationItem(new ItemStack(Blocks.soul_sand), 1.5F);
+
+ AlvearyMutator.addMutationItem(Mods.IC2.stack("UranFuel"), 4.0F);
+ AlvearyMutator.addMutationItem(Mods.IC2.stack("MOXFuel"), 10.0F);
+ AlvearyMutator.addMutationItem(Mods.IC2.stack("Plutonium"), 8.0F);
+ AlvearyMutator.addMutationItem(Mods.IC2.stack("smallPlutonium"), 5.0F);
+ AlvearyMutator.addMutationItem(Mods.IC2.stack("Uran235"), 4.0F);
+ AlvearyMutator.addMutationItem(Mods.IC2.stack("smallUran235"), 2.5F);
+ AlvearyMutator.addMutationItem(Mods.IC2.stack("Uran238"), 2.0F);
+
+ AlvearyMutator.addMutationItem(new ItemStack(Items.ender_pearl), 2.0F);
+ AlvearyMutator.addMutationItem(new ItemStack(Items.ender_eye), 4.0F);
+ for (EnumHiveFrame frame : EnumHiveFrame.values())
+ {
+ frame.item = new ItemHiveFrame(frame);
+ GameRegistry.registerItem(frame.item, "hiveFrame." + frame.name().toLowerCase());
+ }
+ }
+
+ public void postInit()
+ {
+ EnumHiveFrame.init();
+
+ GameRegistry.addRecipe(AlvearyMachine.Mutator.get(1), new Object[] { "g g", " a ", "t t", Character.valueOf('g'), Items.gold_ingot, Character.valueOf('a'), Mods.Forestry.block("alveary"), Character.valueOf('t'), new ItemStack(Mods.Forestry.item("thermionicTubes"), 1, 5) });
+
+
+
+ GameRegistry.addRecipe(AlvearyMachine.Frame.get(1), new Object[] { "iii", "tat", " t ", Character.valueOf('i'), Items.iron_ingot, Character.valueOf('a'), Mods.Forestry.block("alveary"), Character.valueOf('t'), new ItemStack(Mods.Forestry.item("thermionicTubes"), 1, 4) });
+
+
+
+ GameRegistry.addRecipe(AlvearyMachine.RainShield.get(1), new Object[] { " b ", "bab", "t t", Character.valueOf('b'), Items.brick, Character.valueOf('a'), Mods.Forestry.block("alveary"), Character.valueOf('t'), new ItemStack(Mods.Forestry.item("thermionicTubes"), 1, 4) });
+
+
+
+
+ GameRegistry.addRecipe(AlvearyMachine.Lighting.get(1), new Object[] { "iii", "iai", " t ", Character.valueOf('i'), Items.glowstone_dust, Character.valueOf('a'), Mods.Forestry.block("alveary"), Character.valueOf('t'), new ItemStack(Mods.Forestry.item("thermionicTubes"), 1, 4) });
+
+
+ GameRegistry.addRecipe(AlvearyMachine.Stimulator.get(1), new Object[] { "kik", "iai", " t ", Character.valueOf('i'), Items.gold_nugget, Character.valueOf('a'), Mods.Forestry.block("alveary"), Character.valueOf('t'), new ItemStack(Mods.Forestry.item("thermionicTubes"), 1, 4), Character.valueOf('k'), new ItemStack(Mods.Forestry.item("chipsets"), 1, 2) });
+
+
+ GameRegistry.addRecipe(AlvearyMachine.Hatchery.get(1), new Object[] { "i i", " a ", "iti", Character.valueOf('i'), Blocks.glass_pane, Character.valueOf('a'), Mods.Forestry.block("alveary"), Character.valueOf('t'), new ItemStack(Mods.Forestry.item("thermionicTubes"), 1, 5) });
+
+
+ GameRegistry.addRecipe(new ShapedOreRecipe(AlvearyMachine.Transmission.get(1), new Object[] { " t ", "tat", " t ", Character.valueOf('a'), Mods.Forestry.block("alveary"), Character.valueOf('t'), "gearTin" }));
+ for (AlvearyStimulator.CircuitType type : AlvearyStimulator.CircuitType.values()) {
+ type.createCircuit(this.stimulatorLayout);
+ }
+ }
+
+ public void init()
+ {
+ this.stimulatorLayout = new BinnieCircuitLayout(ExtraBees.instance, "Stimulator");
+ }
+}
diff --git a/src/Java/binnie/extrabees/apiary/TileExtraBeeAlveary.java b/src/Java/binnie/extrabees/apiary/TileExtraBeeAlveary.java
new file mode 100644
index 0000000000..3edf7e4a9c
--- /dev/null
+++ b/src/Java/binnie/extrabees/apiary/TileExtraBeeAlveary.java
@@ -0,0 +1,355 @@
+package binnie.extrabees.apiary;
+
+import binnie.Binnie;
+import binnie.core.BinnieCore;
+import binnie.core.genetics.ManagerGenetics;
+import binnie.core.machines.Machine;
+import binnie.core.machines.TileEntityMachine;
+import binnie.core.proxy.BinnieProxy;
+import binnie.extrabees.apiary.machine.AlvearyMachine.AlvearyPackage;
+import forestry.api.apiculture.IAlvearyComponent;
+import forestry.api.apiculture.IBee;
+import forestry.api.apiculture.IBeeGenome;
+import forestry.api.apiculture.IBeeHousing;
+import forestry.api.apiculture.IBeeListener;
+import forestry.api.apiculture.IBeeModifier;
+import forestry.api.apiculture.IBeeRoot;
+import forestry.api.core.IStructureLogic;
+import forestry.api.core.ITileStructure;
+import forestry.api.genetics.IIndividual;
+import java.util.ArrayList;
+import java.util.List;
+import net.minecraft.inventory.ISidedInventory;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.world.World;
+
+public class TileExtraBeeAlveary
+ extends TileEntityMachine
+ implements IAlvearyComponent, IBeeModifier, IBeeListener
+{
+ boolean init = false;
+ IStructureLogic structureLogic;
+ private boolean isMaster;
+ protected int masterX;
+ protected int masterZ;
+
+ public void updateEntity()
+ {
+ super.updateEntity();
+ if (!BinnieCore.proxy.isSimulating(this.worldObj)) {
+ return;
+ }
+ if (this.worldObj.getWorldTime() % 200L == 0L)
+ {
+ if ((!isIntegratedIntoStructure()) || (isMaster())) {
+ validateStructure();
+ }
+ ITileStructure master = getCentralTE();
+ if (master == null) {
+ return;
+ }
+ if (getBeeListener() != null) {
+ ((IAlvearyComponent)master).registerBeeListener(getBeeListener());
+ }
+ if (getBeeModifier() != null) {
+ ((IAlvearyComponent)master).registerBeeModifier(getBeeModifier());
+ }
+ this.init = true;
+ }
+ }
+
+ public void readFromNBT(NBTTagCompound nbttagcompound)
+ {
+ super.readFromNBT(nbttagcompound);
+
+ this.isMaster = nbttagcompound.getBoolean("IsMaster");
+ this.masterX = nbttagcompound.getInteger("MasterX");
+ this.masterY = nbttagcompound.getInteger("MasterY");
+ this.masterZ = nbttagcompound.getInteger("MasterZ");
+ if (this.isMaster) {
+ makeMaster();
+ }
+ this.structureLogic.readFromNBT(nbttagcompound);
+
+ updateAlvearyBlocks();
+
+ this.init = false;
+ }
+
+ public void writeToNBT(NBTTagCompound nbttagcompound)
+ {
+ super.writeToNBT(nbttagcompound);
+
+ nbttagcompound.setBoolean("IsMaster", this.isMaster);
+ nbttagcompound.setInteger("MasterX", this.masterX);
+ nbttagcompound.setInteger("MasterY", this.masterY);
+ nbttagcompound.setInteger("MasterZ", this.masterZ);
+
+
+ this.structureLogic.writeToNBT(nbttagcompound);
+ }
+
+ AlvearyMachine.AlvearyPackage getAlvearyPackage()
+ {
+ return (AlvearyMachine.AlvearyPackage)getMachine().getPackage();
+ }
+
+ public TileExtraBeeAlveary()
+ {
+ this.structureLogic = Binnie.Genetics.getBeeRoot().createAlvearyStructureLogic(this);
+ }
+
+ public TileExtraBeeAlveary(AlvearyMachine.AlvearyPackage alvearyPackage)
+ {
+ super(alvearyPackage);
+ this.structureLogic = Binnie.Genetics.getBeeRoot().createAlvearyStructureLogic(this);
+ }
+
+ public String getTypeUID()
+ {
+ return this.structureLogic.getTypeUID();
+ }
+
+ protected int masterY = -99;
+
+ public void makeMaster() {}
+
+ public void onStructureReset()
+ {
+ setCentralTE(null);
+ this.isMaster = false;
+ this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
+ updateAlvearyBlocks();
+ }
+
+ public ITileStructure getCentralTE()
+ {
+ if ((this.worldObj == null) || (!isIntegratedIntoStructure())) {
+ return null;
+ }
+ if (!isMaster())
+ {
+ TileEntity tile = this.worldObj.getTileEntity(this.masterX, this.masterY, this.masterZ);
+ if ((tile instanceof ITileStructure))
+ {
+ ITileStructure master = (ITileStructure)this.worldObj.getTileEntity(this.masterX, this.masterY, this.masterZ);
+ if (master.isMaster()) {
+ return master;
+ }
+ return null;
+ }
+ return null;
+ }
+ return this;
+ }
+
+ public void validateStructure()
+ {
+ this.structureLogic.validateStructure();
+ updateAlvearyBlocks();
+ }
+
+ private boolean isSameTile(TileEntity tile)
+ {
+ return (tile.xCoord == this.xCoord) && (tile.yCoord == this.yCoord) && (tile.zCoord == this.zCoord);
+ }
+
+ public void setCentralTE(TileEntity tile)
+ {
+ if ((tile == null) || (tile == this) || (isSameTile(tile)))
+ {
+ this.masterX = (this.masterZ = 0);
+ this.masterY = -99;
+ updateAlvearyBlocks();
+ return;
+ }
+ this.isMaster = false;
+ this.masterX = tile.xCoord;
+ this.masterY = tile.yCoord;
+ this.masterZ = tile.zCoord;
+
+
+ markDirty();
+ if (getBeeListener() != null) {
+ ((IAlvearyComponent)tile).registerBeeListener(getBeeListener());
+ }
+ if (getBeeModifier() != null) {
+ ((IAlvearyComponent)tile).registerBeeModifier(getBeeModifier());
+ }
+ updateAlvearyBlocks();
+ }
+
+ public boolean isMaster()
+ {
+ return this.isMaster;
+ }
+
+ protected boolean hasMaster()
+ {
+ return this.masterY >= 0;
+ }
+
+ public boolean isIntegratedIntoStructure()
+ {
+ return (this.isMaster) || (this.masterY >= 0);
+ }
+
+ public void registerBeeModifier(IBeeModifier modifier) {}
+
+ public void removeBeeModifier(IBeeModifier modifier) {}
+
+ public void addTemperatureChange(float change, float boundaryDown, float boundaryUp) {}
+
+ public void addHumidityChange(float change, float boundaryDown, float boundaryUp) {}
+
+ public boolean hasFunction()
+ {
+ return true;
+ }
+
+ public IBeeModifier getBeeModifier()
+ {
+ return (IBeeModifier)getMachine().getInterface(IBeeModifier.class);
+ }
+
+ public IBeeListener getBeeListener()
+ {
+ return (IBeeListener)getMachine().getInterface(IBeeListener.class);
+ }
+
+ public float getTerritoryModifier(IBeeGenome genome, float currentModifier)
+ {
+ return getBeeModifier() == null ? 1.0F : getBeeModifier().getTerritoryModifier(genome, currentModifier);
+ }
+
+ public float getMutationModifier(IBeeGenome genome, IBeeGenome mate, float currentModifier)
+ {
+ return getBeeModifier() == null ? 1.0F : getBeeModifier().getMutationModifier(genome, mate, currentModifier);
+ }
+
+ public float getLifespanModifier(IBeeGenome genome, IBeeGenome mate, float currentModifier)
+ {
+ return getBeeModifier() == null ? 1.0F : getBeeModifier().getLifespanModifier(genome, mate, currentModifier);
+ }
+
+ public float getProductionModifier(IBeeGenome genome, float currentModifier)
+ {
+ return getBeeModifier() == null ? 1.0F : getBeeModifier().getProductionModifier(genome, currentModifier);
+ }
+
+ public float getFloweringModifier(IBeeGenome genome, float currentModifier)
+ {
+ return getBeeModifier() == null ? 1.0F : getBeeModifier().getFloweringModifier(genome, currentModifier);
+ }
+
+ public boolean isSealed()
+ {
+ return getBeeModifier() == null ? false : getBeeModifier().isSealed();
+ }
+
+ public boolean isSelfLighted()
+ {
+ return getBeeModifier() == null ? false : getBeeModifier().isSelfLighted();
+ }
+
+ public boolean isSunlightSimulated()
+ {
+ return getBeeModifier() == null ? false : getBeeModifier().isSunlightSimulated();
+ }
+
+ public boolean isHellish()
+ {
+ return getBeeModifier() == null ? false : getBeeModifier().isHellish();
+ }
+
+ public void registerBeeListener(IBeeListener event) {}
+
+ public void removeBeeListener(IBeeListener event) {}
+
+ public void onQueenChange(ItemStack queen)
+ {
+ if (getBeeListener() != null) {
+ getBeeListener().onQueenChange(queen);
+ }
+ }
+
+ public void wearOutEquipment(int amount)
+ {
+ if (getBeeListener() != null) {
+ getBeeListener().wearOutEquipment(amount);
+ }
+ }
+
+ public void onQueenDeath(IBee queen)
+ {
+ if (getBeeListener() != null) {
+ getBeeListener().onQueenDeath(queen);
+ }
+ }
+
+ public void onPostQueenDeath(IBee queen)
+ {
+ if (getBeeListener() != null) {
+ getBeeListener().onPostQueenDeath(queen);
+ }
+ }
+
+ public boolean onPollenRetrieved(IBee queen, IIndividual pollen, boolean isHandled)
+ {
+ return false;
+ }
+
+ public boolean onEggLaid(IBee queen)
+ {
+ return false;
+ }
+
+ public float getGeneticDecay(IBeeGenome genome, float currentModifier)
+ {
+ return 1.0F;
+ }
+
+ public IBeeHousing getBeeHousing()
+ {
+ return getCentralTE() == null ? null : (IBeeHousing)getCentralTE();
+ }
+
+ List<TileEntity> tiles = new ArrayList();
+
+ public List<TileEntity> getAlvearyBlocks()
+ {
+ updateAlvearyBlocks();
+ return this.tiles;
+ }
+
+ private void updateAlvearyBlocks()
+ {
+ this.tiles.clear();
+ if (getCentralTE() != null)
+ {
+ ITileStructure struct = getCentralTE();
+ if (!struct.isIntegratedIntoStructure()) {
+ return;
+ }
+ TileEntity central = (TileEntity)struct;
+ for (int x = -2; x <= 2; x++) {
+ for (int z = -2; z <= 2; z++) {
+ for (int y = -2; y <= 2; y++)
+ {
+ TileEntity tile = getWorldObj().getTileEntity(this.xCoord + x, this.yCoord + y, this.zCoord + z);
+ if ((tile != null) && ((tile instanceof ITileStructure)) && (((ITileStructure)tile).getCentralTE() == struct)) {
+ this.tiles.add(tile);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ public ISidedInventory getStructureInventory()
+ {
+ return (ISidedInventory)getMachine().getInterface(ISidedInventory.class);
+ }
+}
diff --git a/src/Java/binnie/extrabees/apiary/machine/AlvearyFrame.java b/src/Java/binnie/extrabees/apiary/machine/AlvearyFrame.java
new file mode 100644
index 0000000000..a910e101f9
--- /dev/null
+++ b/src/Java/binnie/extrabees/apiary/machine/AlvearyFrame.java
@@ -0,0 +1,125 @@
+package binnie.extrabees.apiary.machine;
+
+import binnie.Binnie;
+import binnie.core.genetics.ManagerGenetics;
+import binnie.core.machines.IMachine;
+import binnie.core.machines.Machine;
+import binnie.core.machines.inventory.ComponentInventorySlots;
+import binnie.core.machines.inventory.InventorySlot;
+import binnie.core.machines.inventory.SlotValidator;
+import binnie.craftgui.minecraft.IMachineInformation;
+import binnie.extrabees.apiary.ComponentBeeModifier;
+import binnie.extrabees.apiary.ComponentExtraBeeGUI;
+import binnie.extrabees.apiary.TileExtraBeeAlveary;
+import binnie.extrabees.core.ExtraBeeGUID;
+import binnie.extrabees.core.ExtraBeeTexture;
+import forestry.api.apiculture.IBeeGenome;
+import forestry.api.apiculture.IBeeHousing;
+import forestry.api.apiculture.IBeeListener;
+import forestry.api.apiculture.IBeeModifier;
+import forestry.api.apiculture.IBeeRoot;
+import forestry.api.apiculture.IBeekeepingMode;
+import forestry.api.apiculture.IHiveFrame;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.item.ItemStack;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.world.World;
+
+public class AlvearyFrame
+{
+ public static int slotFrame = 0;
+
+ public static class PackageAlvearyFrame
+ extends AlvearyMachine.AlvearyPackage
+ implements IMachineInformation
+ {
+ public PackageAlvearyFrame()
+ {
+ super(ExtraBeeTexture.AlvearyFrame.getTexture(), false);
+ }
+
+ public void createMachine(Machine machine)
+ {
+ new ComponentExtraBeeGUI(machine, ExtraBeeGUID.AlvearyFrame);
+
+ ComponentInventorySlots inventory = new ComponentInventorySlots(machine);
+
+ inventory.addSlot(AlvearyFrame.slotFrame, "frame");
+ inventory.getSlot(AlvearyFrame.slotFrame).setValidator(new AlvearyFrame.SlotValidatorFrame());
+
+ new AlvearyFrame.ComponentFrameModifier(machine);
+ }
+ }
+
+ public static class SlotValidatorFrame
+ extends SlotValidator
+ {
+ public SlotValidatorFrame()
+ {
+ super();
+ }
+
+ public boolean isValid(ItemStack itemStack)
+ {
+ return (itemStack != null) && ((itemStack.getItem() instanceof IHiveFrame));
+ }
+
+ public String getTooltip()
+ {
+ return "Hive Frames";
+ }
+ }
+
+ public static class ComponentFrameModifier
+ extends ComponentBeeModifier
+ implements IBeeModifier, IBeeListener
+ {
+ public ComponentFrameModifier(Machine machine)
+ {
+ super();
+ }
+
+ public void wearOutEquipment(int amount)
+ {
+ if (getHiveFrame() == null) {
+ return;
+ }
+ World world = getMachine().getTileEntity().getWorldObj();
+ int wear = Math.round(amount * 5 * Binnie.Genetics.getBeeRoot().getBeekeepingMode(world).getWearModifier());
+ getInventory().setInventorySlotContents(AlvearyFrame.slotFrame, getHiveFrame().frameUsed((IBeeHousing)((TileExtraBeeAlveary)getMachine().getTileEntity()).getCentralTE(), getInventory().getStackInSlot(AlvearyFrame.slotFrame), null, wear));
+ }
+
+ public IHiveFrame getHiveFrame()
+ {
+ if (getInventory().getStackInSlot(AlvearyFrame.slotFrame) != null) {
+ return (IHiveFrame)getInventory().getStackInSlot(AlvearyFrame.slotFrame).getItem();
+ }
+ return null;
+ }
+
+ public float getTerritoryModifier(IBeeGenome genome, float currentModifier)
+ {
+ return getHiveFrame() == null ? 1.0F : getHiveFrame().getTerritoryModifier(genome, currentModifier);
+ }
+
+ public float getMutationModifier(IBeeGenome genome, IBeeGenome mate, float currentModifier)
+ {
+ return getHiveFrame() == null ? 1.0F : getHiveFrame().getMutationModifier(genome, mate, currentModifier);
+ }
+
+ public float getLifespanModifier(IBeeGenome genome, IBeeGenome mate, float currentModifier)
+ {
+ return getHiveFrame() == null ? 1.0F : getHiveFrame().getLifespanModifier(genome, mate, currentModifier);
+ }
+
+ public float getProductionModifier(IBeeGenome genome, float currentModifier)
+ {
+ return getHiveFrame() == null ? 1.0F : getHiveFrame().getProductionModifier(genome, currentModifier);
+ }
+
+ public float getFloweringModifier(IBeeGenome genome, float currentModifier)
+ {
+ return getHiveFrame() == null ? 1.0F : getHiveFrame().getFloweringModifier(genome, currentModifier);
+ }
+ }
+}
diff --git a/src/Java/binnie/extrabees/apiary/machine/AlvearyHatchery.java b/src/Java/binnie/extrabees/apiary/machine/AlvearyHatchery.java
new file mode 100644
index 0000000000..276683b860
--- /dev/null
+++ b/src/Java/binnie/extrabees/apiary/machine/AlvearyHatchery.java
@@ -0,0 +1,106 @@
+package binnie.extrabees.apiary.machine;
+
+import binnie.Binnie;
+import binnie.core.genetics.ManagerGenetics;
+import binnie.core.machines.IMachine;
+import binnie.core.machines.Machine;
+import binnie.core.machines.inventory.ComponentInventorySlots;
+import binnie.core.machines.inventory.InventorySlot;
+import binnie.core.machines.inventory.SlotValidator;
+import binnie.core.machines.transfer.TransferRequest;
+import binnie.craftgui.minecraft.IMachineInformation;
+import binnie.extrabees.apiary.ComponentBeeModifier;
+import binnie.extrabees.apiary.ComponentExtraBeeGUI;
+import binnie.extrabees.apiary.TileExtraBeeAlveary;
+import binnie.extrabees.core.ExtraBeeGUID;
+import binnie.extrabees.core.ExtraBeeTexture;
+import forestry.api.apiculture.EnumBeeType;
+import forestry.api.apiculture.IBee;
+import forestry.api.apiculture.IBeeHousing;
+import forestry.api.apiculture.IBeeListener;
+import forestry.api.apiculture.IBeeModifier;
+import forestry.api.apiculture.IBeeRoot;
+import forestry.core.EnumErrorCode;
+import java.util.Random;
+import net.minecraft.item.ItemStack;
+import net.minecraft.tileentity.TileEntity;
+
+public class AlvearyHatchery
+{
+ public static int[] slotLarvae = { 0, 1, 2, 3, 4 };
+
+ public static class PackageAlvearyHatchery
+ extends AlvearyMachine.AlvearyPackage
+ implements IMachineInformation
+ {
+ public PackageAlvearyHatchery()
+ {
+ super(ExtraBeeTexture.AlvearyHatchery.getTexture(), false);
+ }
+
+ public void createMachine(Machine machine)
+ {
+ new ComponentExtraBeeGUI(machine, ExtraBeeGUID.AlvearyHatchery);
+
+ ComponentInventorySlots inventory = new ComponentInventorySlots(machine);
+ for (InventorySlot slot : inventory.addSlotArray(AlvearyHatchery.slotLarvae, "hatchery")) {
+ slot.setValidator(new AlvearyHatchery.SlotValidatorLarvae());
+ }
+ new AlvearyHatchery.ComponentFrameModifier(machine);
+ }
+ }
+
+ public static class SlotValidatorLarvae
+ extends SlotValidator
+ {
+ public SlotValidatorLarvae()
+ {
+ super();
+ }
+
+ public boolean isValid(ItemStack itemStack)
+ {
+ return (Binnie.Genetics.getBeeRoot().isMember(itemStack)) && (Binnie.Genetics.getBeeRoot().getType(itemStack) == EnumBeeType.LARVAE);
+ }
+
+ public String getTooltip()
+ {
+ return "Larvae";
+ }
+ }
+
+ public static class ComponentFrameModifier
+ extends ComponentBeeModifier
+ implements IBeeModifier, IBeeListener
+ {
+ public ComponentFrameModifier(Machine machine)
+ {
+ super();
+ }
+
+ public void onUpdate()
+ {
+ if (new Random().nextInt(2400) == 0)
+ {
+ TileEntity tile = getMachine().getTileEntity();
+ if ((tile instanceof TileExtraBeeAlveary))
+ {
+ IBeeHousing house = ((TileExtraBeeAlveary)tile).getBeeHousing();
+ if ((house != null) && (house.getErrorState() == EnumErrorCode.OK))
+ {
+ ItemStack queenStack = house.getQueen();
+ IBee queen = queenStack == null ? null : Binnie.Genetics.getBeeRoot().getMember(queenStack);
+ if (queen != null)
+ {
+ ItemStack larvae = Binnie.Genetics.getBeeRoot().getMemberStack(Binnie.Genetics.getBeeRoot().getBee(getMachine().getWorld(), queen.getGenome()), EnumBeeType.LARVAE.ordinal());
+
+
+
+ new TransferRequest(larvae, getInventory()).transfer(true);
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/Java/binnie/extrabees/apiary/machine/AlvearyLighting.java b/src/Java/binnie/extrabees/apiary/machine/AlvearyLighting.java
new file mode 100644
index 0000000000..fad796c889
--- /dev/null
+++ b/src/Java/binnie/extrabees/apiary/machine/AlvearyLighting.java
@@ -0,0 +1,41 @@
+package binnie.extrabees.apiary.machine;
+
+import binnie.core.machines.Machine;
+import binnie.craftgui.minecraft.IMachineInformation;
+import binnie.extrabees.apiary.ComponentBeeModifier;
+import binnie.extrabees.core.ExtraBeeTexture;
+import forestry.api.apiculture.IBeeListener;
+import forestry.api.apiculture.IBeeModifier;
+
+public class AlvearyLighting
+{
+ public static class PackageAlvearyLighting
+ extends AlvearyMachine.AlvearyPackage
+ implements IMachineInformation
+ {
+ public PackageAlvearyLighting()
+ {
+ super(ExtraBeeTexture.AlvearyLighting.getTexture(), false);
+ }
+
+ public void createMachine(Machine machine)
+ {
+ new AlvearyLighting.ComponentLighting(machine);
+ }
+ }
+
+ public static class ComponentLighting
+ extends ComponentBeeModifier
+ implements IBeeModifier, IBeeListener
+ {
+ public ComponentLighting(Machine machine)
+ {
+ super();
+ }
+
+ public boolean isSelfLighted()
+ {
+ return true;
+ }
+ }
+}
diff --git a/src/Java/binnie/extrabees/apiary/machine/AlvearyMachine.java b/src/Java/binnie/extrabees/apiary/machine/AlvearyMachine.java
new file mode 100644
index 0000000000..2dc0410770
--- /dev/null
+++ b/src/Java/binnie/extrabees/apiary/machine/AlvearyMachine.java
@@ -0,0 +1,66 @@
+package binnie.extrabees.apiary.machine;
+
+import binnie.core.machines.IMachineType;
+import binnie.core.machines.Machine;
+import binnie.core.machines.MachinePackage;
+import binnie.core.machines.MachineRendererBlock;
+import binnie.core.resource.BinnieResource;
+import binnie.extrabees.apiary.ModuleApiary;
+import binnie.extrabees.apiary.TileExtraBeeAlveary;
+import net.minecraft.client.renderer.RenderBlocks;
+import net.minecraft.item.ItemStack;
+import net.minecraft.tileentity.TileEntity;
+
+public enum AlvearyMachine
+ implements IMachineType
+{
+ Mutator(AlvearyMutator.PackageAlvearyMutator.class), Frame(AlvearyFrame.PackageAlvearyFrame.class), RainShield(AlvearyRainShield.PackageAlvearyRainShield.class), Lighting(AlvearyLighting.PackageAlvearyLighting.class), Stimulator(AlvearyStimulator.PackageAlvearyStimulator.class), Hatchery(AlvearyHatchery.PackageAlvearyHatchery.class), Transmission(AlvearyTransmission.PackageAlvearyTransmission.class);
+
+ Class<? extends MachinePackage> clss;
+
+ private AlvearyMachine(Class<? extends MachinePackage> clss)
+ {
+ this.clss = clss;
+ }
+
+ public Class<? extends MachinePackage> getPackageClass()
+ {
+ return this.clss;
+ }
+
+ public ItemStack get(int size)
+ {
+ return new ItemStack(ModuleApiary.blockComponent, size, ordinal());
+ }
+
+ public static abstract class AlvearyPackage
+ extends MachinePackage
+ {
+ BinnieResource machineTexture;
+
+ public AlvearyPackage(String id, BinnieResource machineTexture, boolean powered)
+ {
+ super(powered);
+ this.machineTexture = machineTexture;
+ }
+
+ public void createMachine(Machine machine) {}
+
+ public TileEntity createTileEntity()
+ {
+ return new TileExtraBeeAlveary(this);
+ }
+
+ public void register() {}
+
+ public void renderMachine(Machine machine, double x, double y, double z, float var8, RenderBlocks renderer)
+ {
+ MachineRendererBlock.instance.renderMachine(this.machineTexture, x, y, z, var8);
+ }
+ }
+
+ public boolean isActive()
+ {
+ return true;
+ }
+}
diff --git a/src/Java/binnie/extrabees/apiary/machine/AlvearyMutator.java b/src/Java/binnie/extrabees/apiary/machine/AlvearyMutator.java
new file mode 100644
index 0000000000..9c9fafc15a
--- /dev/null
+++ b/src/Java/binnie/extrabees/apiary/machine/AlvearyMutator.java
@@ -0,0 +1,125 @@
+package binnie.extrabees.apiary.machine;
+
+import binnie.core.machines.Machine;
+import binnie.core.machines.MachineUtil;
+import binnie.core.machines.inventory.ComponentInventorySlots;
+import binnie.core.machines.inventory.InventorySlot;
+import binnie.core.machines.inventory.SlotValidator;
+import binnie.core.machines.inventory.ValidatorIcon;
+import binnie.craftgui.minecraft.IMachineInformation;
+import binnie.extrabees.ExtraBees;
+import binnie.extrabees.apiary.ComponentBeeModifier;
+import binnie.extrabees.apiary.ComponentExtraBeeGUI;
+import binnie.extrabees.core.ExtraBeeGUID;
+import binnie.extrabees.core.ExtraBeeTexture;
+import forestry.api.apiculture.IBee;
+import forestry.api.apiculture.IBeeGenome;
+import forestry.api.apiculture.IBeeListener;
+import forestry.api.apiculture.IBeeModifier;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+import net.minecraft.item.ItemStack;
+
+public class AlvearyMutator
+{
+ public static int slotMutator = 0;
+
+ public static class PackageAlvearyMutator
+ extends AlvearyMachine.AlvearyPackage
+ implements IMachineInformation
+ {
+ public PackageAlvearyMutator()
+ {
+ super(ExtraBeeTexture.AlvearyMutator.getTexture(), false);
+ }
+
+ public void createMachine(Machine machine)
+ {
+ new ComponentExtraBeeGUI(machine, ExtraBeeGUID.AlvearyMutator);
+
+ ComponentInventorySlots inventory = new ComponentInventorySlots(machine);
+
+ inventory.addSlot(AlvearyMutator.slotMutator, "mutator");
+ inventory.getSlot(AlvearyMutator.slotMutator).setValidator(new AlvearyMutator.SlotValidatorMutator());
+
+ new AlvearyMutator.ComponentMutatorModifier(machine);
+ }
+ }
+
+ public static class SlotValidatorMutator
+ extends SlotValidator
+ {
+ public SlotValidatorMutator()
+ {
+ super();
+ }
+
+ public boolean isValid(ItemStack itemStack)
+ {
+ return AlvearyMutator.isMutationItem(itemStack);
+ }
+
+ public String getTooltip()
+ {
+ return "Mutagenic Agents";
+ }
+ }
+
+ public static class ComponentMutatorModifier
+ extends ComponentBeeModifier
+ implements IBeeModifier, IBeeListener
+ {
+ public ComponentMutatorModifier(Machine machine)
+ {
+ super();
+ }
+
+ public float getMutationModifier(IBeeGenome genome, IBeeGenome mate, float currentModifier)
+ {
+ if (getUtil().isSlotEmpty(AlvearyMutator.slotMutator)) {
+ return 1.0F;
+ }
+ float mult = AlvearyMutator.getMutationMult(getUtil().getStack(AlvearyMutator.slotMutator));
+ return Math.min(mult, 15.0F / currentModifier);
+ }
+
+ public void onPostQueenDeath(IBee queen)
+ {
+ getUtil().decreaseStack(AlvearyMutator.slotMutator, 1);
+ }
+ }
+
+ static Map<ItemStack, Float> mutations = new HashMap();
+
+ public static boolean isMutationItem(ItemStack item)
+ {
+ return getMutationMult(item) > 0.0F;
+ }
+
+ public static float getMutationMult(ItemStack item)
+ {
+ if (item == null) {
+ return 1.0F;
+ }
+ for (ItemStack comp : mutations.keySet()) {
+ if ((ItemStack.areItemStackTagsEqual(item, comp)) && (item.isItemEqual(comp))) {
+ return ((Float)mutations.get(comp)).floatValue();
+ }
+ }
+ return 1.0F;
+ }
+
+ public static void addMutationItem(ItemStack item, float chance)
+ {
+ if (item == null) {
+ return;
+ }
+ mutations.put(item, Float.valueOf(chance));
+ }
+
+ public static Collection<ItemStack> getMutagens()
+ {
+ return mutations.keySet();
+ }
+}
diff --git a/src/Java/binnie/extrabees/apiary/machine/AlvearyRainShield.java b/src/Java/binnie/extrabees/apiary/machine/AlvearyRainShield.java
new file mode 100644
index 0000000000..18b5dcee34
--- /dev/null
+++ b/src/Java/binnie/extrabees/apiary/machine/AlvearyRainShield.java
@@ -0,0 +1,41 @@
+package binnie.extrabees.apiary.machine;
+
+import binnie.core.machines.Machine;
+import binnie.craftgui.minecraft.IMachineInformation;
+import binnie.extrabees.apiary.ComponentBeeModifier;
+import binnie.extrabees.core.ExtraBeeTexture;
+import forestry.api.apiculture.IBeeListener;
+import forestry.api.apiculture.IBeeModifier;
+
+public class AlvearyRainShield
+{
+ public static class PackageAlvearyRainShield
+ extends AlvearyMachine.AlvearyPackage
+ implements IMachineInformation
+ {
+ public PackageAlvearyRainShield()
+ {
+ super(ExtraBeeTexture.AlvearyRainShield.getTexture(), false);
+ }
+
+ public void createMachine(Machine machine)
+ {
+ new AlvearyRainShield.ComponentRainShield(machine);
+ }
+ }
+
+ public static class ComponentRainShield
+ extends ComponentBeeModifier
+ implements IBeeModifier, IBeeListener
+ {
+ public ComponentRainShield(Machine machine)
+ {
+ super();
+ }
+
+ public boolean isSealed()
+ {
+ return true;
+ }
+ }
+}
diff --git a/src/Java/binnie/extrabees/apiary/machine/AlvearyStimulator.java b/src/Java/binnie/extrabees/apiary/machine/AlvearyStimulator.java
new file mode 100644
index 0000000000..47b6dab48b
--- /dev/null
+++ b/src/Java/binnie/extrabees/apiary/machine/AlvearyStimulator.java
@@ -0,0 +1,430 @@
+package binnie.extrabees.apiary.machine;
+
+import binnie.core.Mods;
+import binnie.core.Mods.Mod;
+import binnie.core.circuits.BinnieCircuit;
+import binnie.core.genetics.BeeModifierLogic;
+import binnie.core.genetics.EnumBeeBooleanModifier;
+import binnie.core.genetics.EnumBeeModifier;
+import binnie.core.machines.Machine;
+import binnie.core.machines.MachineUtil;
+import binnie.core.machines.inventory.ComponentInventorySlots;
+import binnie.core.machines.inventory.InventorySlot;
+import binnie.core.machines.inventory.SlotValidator;
+import binnie.core.machines.power.ComponentPowerReceptor;
+import binnie.craftgui.minecraft.IMachineInformation;
+import binnie.extrabees.apiary.ComponentBeeModifier;
+import binnie.extrabees.apiary.ComponentExtraBeeGUI;
+import binnie.extrabees.core.ExtraBeeGUID;
+import binnie.extrabees.core.ExtraBeeTexture;
+import forestry.api.apiculture.IBeeGenome;
+import forestry.api.apiculture.IBeeListener;
+import forestry.api.apiculture.IBeeModifier;
+import forestry.api.circuits.ChipsetManager;
+import forestry.api.circuits.ICircuit;
+import forestry.api.circuits.ICircuitBoard;
+import forestry.api.circuits.ICircuitLayout;
+import forestry.api.circuits.ICircuitRegistry;
+import java.util.ArrayList;
+import java.util.List;
+import net.minecraft.item.ItemStack;
+
+public class AlvearyStimulator
+{
+ public static int slotCircuit = 0;
+
+ public static class PackageAlvearyStimulator
+ extends AlvearyMachine.AlvearyPackage
+ implements IMachineInformation
+ {
+ public PackageAlvearyStimulator()
+ {
+ super(ExtraBeeTexture.AlvearyStimulator.getTexture(), true);
+ }
+
+ public void createMachine(Machine machine)
+ {
+ new ComponentExtraBeeGUI(machine, ExtraBeeGUID.AlvearyStimulator);
+
+ ComponentInventorySlots inventory = new ComponentInventorySlots(machine);
+
+ inventory.addSlot(AlvearyStimulator.slotCircuit, "circuit");
+ inventory.getSlot(AlvearyStimulator.slotCircuit).setValidator(new AlvearyStimulator.SlotValidatorCircuit());
+
+ ComponentPowerReceptor power = new ComponentPowerReceptor(machine);
+
+
+ new AlvearyStimulator.ComponentStimulatorModifier(machine);
+ }
+ }
+
+ public static class SlotValidatorCircuit
+ extends SlotValidator
+ {
+ public SlotValidatorCircuit()
+ {
+ super();
+ }
+
+ public boolean isValid(ItemStack itemStack)
+ {
+ return (itemStack != null) && (ChipsetManager.circuitRegistry.isChipset(itemStack));
+ }
+
+ public String getTooltip()
+ {
+ return "Forestry Circuits";
+ }
+ }
+
+ public static class ComponentStimulatorModifier
+ extends ComponentBeeModifier
+ implements IBeeModifier, IBeeListener
+ {
+ public ComponentStimulatorModifier(Machine machine)
+ {
+ super();
+ }
+
+ float powerUsage = 0.0F;
+ boolean powered = false;
+
+ public void onUpdate()
+ {
+ super.onUpdate();
+ this.modifiers = getCircuits();
+ this.powerUsage = 0.0F;
+ for (AlvearyStimulator.StimulatorCircuit beeMod : this.modifiers) {
+ this.powerUsage += beeMod.getPowerUsage();
+ }
+ this.powered = getUtil().hasEnergyMJ(this.powerUsage);
+ }
+
+ AlvearyStimulator.StimulatorCircuit[] modifiers = new AlvearyStimulator.StimulatorCircuit[0];
+
+ public ICircuitBoard getHiveFrame()
+ {
+ if (!getUtil().isSlotEmpty(AlvearyStimulator.slotCircuit)) {
+ return ChipsetManager.circuitRegistry.getCircuitboard(getUtil().getStack(AlvearyStimulator.slotCircuit));
+ }
+ return null;
+ }
+
+ public AlvearyStimulator.StimulatorCircuit[] getCircuits()
+ {
+ ICircuitBoard board = getHiveFrame();
+ if (board == null) {
+ return new AlvearyStimulator.StimulatorCircuit[0];
+ }
+ ICircuit[] circuits = board.getCircuits();
+ List<IBeeModifier> mod = new ArrayList();
+ for (ICircuit circuit : circuits) {
+ if ((circuit instanceof AlvearyStimulator.StimulatorCircuit)) {
+ mod.add((AlvearyStimulator.StimulatorCircuit)circuit);
+ }
+ }
+ return (AlvearyStimulator.StimulatorCircuit[])mod.toArray(new AlvearyStimulator.StimulatorCircuit[0]);
+ }
+
+ public float getTerritoryModifier(IBeeGenome genome, float currentModifier)
+ {
+ float mod = 1.0F;
+ if (!this.powered) {
+ return mod;
+ }
+ for (IBeeModifier beeMod : this.modifiers) {
+ mod *= beeMod.getTerritoryModifier(genome, mod);
+ }
+ return mod;
+ }
+
+ public float getMutationModifier(IBeeGenome genome, IBeeGenome mate, float currentModifier)
+ {
+ float mod = 1.0F;
+ if (!this.powered) {
+ return mod;
+ }
+ for (IBeeModifier beeMod : this.modifiers) {
+ mod *= beeMod.getMutationModifier(genome, mate, mod);
+ }
+ return mod;
+ }
+
+ public float getLifespanModifier(IBeeGenome genome, IBeeGenome mate, float currentModifier)
+ {
+ float mod = 1.0F;
+ if (!this.powered) {
+ return mod;
+ }
+ for (IBeeModifier beeMod : this.modifiers) {
+ mod *= beeMod.getLifespanModifier(genome, mate, mod);
+ }
+ return mod;
+ }
+
+ public float getProductionModifier(IBeeGenome genome, float currentModifier)
+ {
+ float mod = 1.0F;
+ if (!this.powered) {
+ return mod;
+ }
+ for (IBeeModifier beeMod : this.modifiers) {
+ mod *= beeMod.getProductionModifier(genome, mod);
+ }
+ return mod;
+ }
+
+ public float getFloweringModifier(IBeeGenome genome, float currentModifier)
+ {
+ float mod = 1.0F;
+ if (!this.powered) {
+ return mod;
+ }
+ for (IBeeModifier beeMod : this.modifiers) {
+ mod *= beeMod.getFloweringModifier(genome, mod);
+ }
+ return mod;
+ }
+
+ public float getGeneticDecay(IBeeGenome genome, float currentModifier)
+ {
+ float mod = 1.0F;
+ if (!this.powered) {
+ return mod;
+ }
+ for (IBeeModifier beeMod : this.modifiers) {
+ mod *= beeMod.getGeneticDecay(genome, mod);
+ }
+ return mod;
+ }
+
+ public boolean isSealed()
+ {
+ if (!this.powered) {
+ return false;
+ }
+ for (IBeeModifier beeMod : this.modifiers) {
+ if (beeMod.isSealed()) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public boolean isSelfLighted()
+ {
+ if (!this.powered) {
+ return false;
+ }
+ for (IBeeModifier beeMod : this.modifiers) {
+ if (beeMod.isSelfLighted()) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public boolean isSunlightSimulated()
+ {
+ if (!this.powered) {
+ return false;
+ }
+ for (IBeeModifier beeMod : this.modifiers) {
+ if (beeMod.isSunlightSimulated()) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public boolean isHellish()
+ {
+ if (!this.powered) {
+ return false;
+ }
+ for (IBeeModifier beeMod : this.modifiers) {
+ if (beeMod.isHellish()) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public void wearOutEquipment(int amount)
+ {
+ getUtil().useEnergyMJ(this.powerUsage);
+ }
+ }
+
+ public static class StimulatorCircuit
+ extends BinnieCircuit
+ implements IBeeModifier
+ {
+ AlvearyStimulator.CircuitType type;
+
+ public StimulatorCircuit(AlvearyStimulator.CircuitType type, ICircuitLayout layout)
+ {
+ super(4, layout, Mods.Forestry.item("thermionicTubes"), type.recipe);
+ this.type = type;
+ }
+
+ public int getPowerUsage()
+ {
+ return this.type.power;
+ }
+
+ public float getTerritoryModifier(IBeeGenome genome, float currentModifier)
+ {
+ return this.type.getTerritoryModifier(genome, currentModifier);
+ }
+
+ public float getMutationModifier(IBeeGenome genome, IBeeGenome mate, float currentModifier)
+ {
+ return this.type.getMutationModifier(genome, mate, currentModifier);
+ }
+
+ public float getLifespanModifier(IBeeGenome genome, IBeeGenome mate, float currentModifier)
+ {
+ return this.type.getLifespanModifier(genome, mate, currentModifier);
+ }
+
+ public float getProductionModifier(IBeeGenome genome, float currentModifier)
+ {
+ return this.type.getProductionModifier(genome, currentModifier);
+ }
+
+ public float getFloweringModifier(IBeeGenome genome, float currentModifier)
+ {
+ return this.type.getFloweringModifier(genome, currentModifier);
+ }
+
+ public boolean isSealed()
+ {
+ return this.type.isSealed();
+ }
+
+ public boolean isSelfLighted()
+ {
+ return this.type.isSelfLighted();
+ }
+
+ public boolean isSunlightSimulated()
+ {
+ return this.type.isSunlightSimulated();
+ }
+
+ public boolean isHellish()
+ {
+ return this.type.isHellish();
+ }
+
+ public float getGeneticDecay(IBeeGenome genome, float currentModifier)
+ {
+ return this.type.getGeneticDecay(genome, currentModifier);
+ }
+ }
+
+ public static enum CircuitType
+ implements IBeeModifier
+ {
+ LowVoltage(3, 10), HighVoltage(5, 20), Plant(10, 10), Death(6, 10), Life(11, 10), Nether(7, 15), Mutation(4, 15), Inhibitor(1, 10), Territory(2, 10);
+
+ public int recipe;
+ public int power;
+ BeeModifierLogic logic = new BeeModifierLogic();
+
+ static
+ {
+ LowVoltage.logic.setModifier(EnumBeeModifier.Production, 1.5F, 5.0F);
+ HighVoltage.logic.setModifier(EnumBeeModifier.Production, 2.5F, 10.0F);
+ Plant.logic.setModifier(EnumBeeModifier.Flowering, 1.5F, 5.0F);
+ Death.logic.setModifier(EnumBeeModifier.Lifespan, 0.8F, 0.2F);
+ Life.logic.setModifier(EnumBeeModifier.Lifespan, 1.5F, 5.0F);
+ Nether.logic.setModifier(EnumBeeBooleanModifier.Hellish);
+ Mutation.logic.setModifier(EnumBeeModifier.Mutation, 1.5F, 5.0F);
+ Inhibitor.logic.setModifier(EnumBeeModifier.Territory, 0.4F, 0.1F);
+ Inhibitor.logic.setModifier(EnumBeeModifier.Production, 0.9F, 0.5F);
+ Territory.logic.setModifier(EnumBeeModifier.Territory, 1.5F, 5.0F);
+ for (CircuitType type : values()) {
+ type.logic.setModifier(EnumBeeModifier.GeneticDecay, 1.5F, 10.0F);
+ }
+ }
+
+ private CircuitType(int recipe, int power)
+ {
+ this.recipe = recipe;
+ this.power = power;
+ }
+
+ public void createCircuit(ICircuitLayout layout)
+ {
+ AlvearyStimulator.StimulatorCircuit circuit = new AlvearyStimulator.StimulatorCircuit(this, layout);
+ for (EnumBeeModifier modifier : EnumBeeModifier.values())
+ {
+ float mod = this.logic.getModifier(modifier, 1.0F);
+ if (mod != 1.0F) {
+ if (mod > 1.0F)
+ {
+ int increase = (int)((mod - 1.0F) * 100.0F);
+ circuit.addTooltipString("Increases " + modifier.getName() + " by " + increase + "%");
+ }
+ else
+ {
+ int decrease = (int)((1.0F - mod) * 100.0F);
+ circuit.addTooltipString("Decreases " + modifier.getName() + " by " + decrease + "%");
+ }
+ }
+ }
+ }
+
+ public float getTerritoryModifier(IBeeGenome genome, float currentModifier)
+ {
+ return this.logic.getModifier(EnumBeeModifier.Territory, currentModifier);
+ }
+
+ public float getMutationModifier(IBeeGenome genome, IBeeGenome mate, float currentModifier)
+ {
+ return this.logic.getModifier(EnumBeeModifier.Mutation, currentModifier);
+ }
+
+ public float getLifespanModifier(IBeeGenome genome, IBeeGenome mate, float currentModifier)
+ {
+ return this.logic.getModifier(EnumBeeModifier.Lifespan, currentModifier);
+ }
+
+ public float getProductionModifier(IBeeGenome genome, float currentModifier)
+ {
+ return this.logic.getModifier(EnumBeeModifier.Production, currentModifier);
+ }
+
+ public float getFloweringModifier(IBeeGenome genome, float currentModifier)
+ {
+ return this.logic.getModifier(EnumBeeModifier.Flowering, currentModifier);
+ }
+
+ public float getGeneticDecay(IBeeGenome genome, float currentModifier)
+ {
+ return this.logic.getModifier(EnumBeeModifier.GeneticDecay, currentModifier);
+ }
+
+ public boolean isSealed()
+ {
+ return this.logic.getModifier(EnumBeeBooleanModifier.Sealed);
+ }
+
+ public boolean isSelfLighted()
+ {
+ return this.logic.getModifier(EnumBeeBooleanModifier.SelfLighted);
+ }
+
+ public boolean isSunlightSimulated()
+ {
+ return this.logic.getModifier(EnumBeeBooleanModifier.SunlightStimulated);
+ }
+
+ public boolean isHellish()
+ {
+ return this.logic.getModifier(EnumBeeBooleanModifier.Hellish);
+ }
+ }
+}
diff --git a/src/Java/binnie/extrabees/apiary/machine/AlvearyTransmission.java b/src/Java/binnie/extrabees/apiary/machine/AlvearyTransmission.java
new file mode 100644
index 0000000000..b041bf1c37
--- /dev/null
+++ b/src/Java/binnie/extrabees/apiary/machine/AlvearyTransmission.java
@@ -0,0 +1,81 @@
+package binnie.extrabees.apiary.machine;
+
+import binnie.core.machines.IMachine;
+import binnie.core.machines.Machine;
+import binnie.core.machines.MachineComponent;
+import binnie.core.machines.MachineUtil;
+import binnie.core.machines.power.ComponentPowerReceptor;
+import binnie.core.machines.power.IPoweredMachine;
+import binnie.craftgui.minecraft.IMachineInformation;
+import binnie.extrabees.apiary.TileExtraBeeAlveary;
+import binnie.extrabees.core.ExtraBeeTexture;
+import cofh.api.energy.IEnergyHandler;
+import java.util.ArrayList;
+import java.util.List;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraftforge.common.util.ForgeDirection;
+
+public class AlvearyTransmission
+{
+ public static class PackageAlvearyTransmission
+ extends AlvearyMachine.AlvearyPackage
+ implements IMachineInformation
+ {
+ public PackageAlvearyTransmission()
+ {
+ super(ExtraBeeTexture.AlvearyTransmission.getTexture(), false);
+ }
+
+ public void createMachine(Machine machine)
+ {
+ new ComponentPowerReceptor(machine, 1000);
+ new AlvearyTransmission.ComponentTransmission(machine);
+ }
+ }
+
+ public static class ComponentTransmission
+ extends MachineComponent
+ {
+ public ComponentTransmission(Machine machine)
+ {
+ super();
+ }
+
+ public void onUpdate()
+ {
+ super.onUpdate();
+ int energy = getUtil().getPoweredMachine().getEnergyStored(ForgeDirection.NORTH);
+ if (energy == 0) {
+ return;
+ }
+ TileExtraBeeAlveary tile = (TileExtraBeeAlveary)getMachine().getTileEntity();
+
+ List<IEnergyHandler> handlers = new ArrayList();
+ for (TileEntity alvearyTile : tile.getAlvearyBlocks()) {
+ if (((alvearyTile instanceof IEnergyHandler)) && (alvearyTile != tile)) {
+ handlers.add((IEnergyHandler)alvearyTile);
+ }
+ }
+ if (handlers.isEmpty()) {
+ return;
+ }
+ int maxOutput = 500;
+ int output = energy / handlers.size();
+ if (output > maxOutput) {
+ output = maxOutput;
+ }
+ if (output < 1) {
+ output = 1;
+ }
+ for (IEnergyHandler handler : handlers)
+ {
+ int recieved = handler.receiveEnergy(ForgeDirection.NORTH, output, false);
+ getUtil().getPoweredMachine().extractEnergy(ForgeDirection.NORTH, recieved, false);
+ energy = getUtil().getPoweredMachine().getEnergyStored(ForgeDirection.NORTH);
+ if (energy == 0) {
+ return;
+ }
+ }
+ }
+ }
+}
diff --git a/src/Java/binnie/extrabees/config/ConfigurationMachines.java b/src/Java/binnie/extrabees/config/ConfigurationMachines.java
new file mode 100644
index 0000000000..7d08d216f2
--- /dev/null
+++ b/src/Java/binnie/extrabees/config/ConfigurationMachines.java
@@ -0,0 +1,17 @@
+package binnie.extrabees.config;
+
+import binnie.core.mod.config.ConfigFile;
+import binnie.core.mod.config.ConfigProperty;
+import binnie.core.mod.config.PropDouble;
+import binnie.core.mod.config.PropPercentage;
+
+@ConfigFile(filename="/config/forestry/extrabees/machines.conf")
+public class ConfigurationMachines
+{
+ @ConfigProperty(key="isolatorConsumptionChance", comment={"Percentage chance of Isolator consuming bee, in x%."})
+ @PropPercentage
+ public static int isolatorConsumptionChance = 30;
+ @ConfigProperty(key="geneticErrorModifier", comment={"Modifier that changes how severe splicer/inoculator erros are.", "0 would result in no errors, even for awful serums.", "2.0 would result in twice as severe errors"})
+ @PropDouble
+ public static double geneticErrorModifier = 1.0D;
+}
diff --git a/src/Java/binnie/extrabees/config/ConfigurationMain.java b/src/Java/binnie/extrabees/config/ConfigurationMain.java
new file mode 100644
index 0000000000..e6ee442a14
--- /dev/null
+++ b/src/Java/binnie/extrabees/config/ConfigurationMain.java
@@ -0,0 +1,26 @@
+package binnie.extrabees.config;
+
+import binnie.core.mod.config.ConfigFile;
+import binnie.core.mod.config.ConfigProperty;
+import binnie.core.mod.config.PropBoolean;
+import binnie.core.mod.config.PropInteger;
+
+@ConfigFile(filename="/config/forestry/extrabees/main.conf")
+public class ConfigurationMain
+{
+ @ConfigProperty(key="canQuarryMineHives")
+ @PropBoolean
+ public static boolean canQuarryMineHives = true;
+ @ConfigProperty(key="waterHiveRate")
+ @PropInteger
+ public static int waterHiveRate = 1;
+ @ConfigProperty(key="rockHiveRate")
+ @PropInteger
+ public static int rockHiveRate = 2;
+ @ConfigProperty(key="netherHiveRate")
+ @PropInteger
+ public static int netherHiveRate = 2;
+ @ConfigProperty(key="marbleHiveRate")
+ @PropInteger
+ public static int marbleHiveRate = 2;
+}
diff --git a/src/Java/binnie/extrabees/core/ExtraBeeGUID.java b/src/Java/binnie/extrabees/core/ExtraBeeGUID.java
new file mode 100644
index 0000000000..4d9667460c
--- /dev/null
+++ b/src/Java/binnie/extrabees/core/ExtraBeeGUID.java
@@ -0,0 +1,54 @@
+package binnie.extrabees.core;
+
+import binnie.core.gui.IBinnieGUID;
+import binnie.craftgui.minecraft.Window;
+import binnie.extrabees.gui.WindowAlvearyFrame;
+import binnie.extrabees.gui.WindowAlvearyHatchery;
+import binnie.extrabees.gui.WindowAlvearyMutator;
+import binnie.extrabees.gui.WindowAlvearyStimulator;
+import binnie.extrabees.gui.database.WindowApiaristDatabase;
+import cpw.mods.fml.relauncher.Side;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.world.World;
+
+public enum ExtraBeeGUID
+ implements IBinnieGUID
+{
+ Database, DatabaseNEI, AlvearyMutator, AlvearyFrame, AlvearyStimulator, PunnettSquare, AlvearyHatchery;
+
+ private ExtraBeeGUID() {}
+
+ public Window getWindow(EntityPlayer player, World world, int x, int y, int z, Side side)
+ {
+ Window window = null;
+
+ TileEntity tileEntity = world.getTileEntity(x, y, z);
+
+ IInventory object = null;
+ if ((tileEntity instanceof IInventory)) {
+ object = (IInventory)tileEntity;
+ }
+ switch (1.$SwitchMap$binnie$extrabees$core$ExtraBeeGUID[ordinal()])
+ {
+ case 1:
+ case 2:
+ window = WindowApiaristDatabase.create(player, side, this != Database);
+ break;
+ case 3:
+ window = WindowAlvearyMutator.create(player, object, side);
+ break;
+ case 4:
+ window = WindowAlvearyFrame.create(player, object, side);
+ break;
+ case 5:
+ window = WindowAlvearyStimulator.create(player, object, side);
+ break;
+ case 6:
+ window = WindowAlvearyHatchery.create(player, object, side);
+ break;
+ }
+ return window;
+ }
+}
diff --git a/src/Java/binnie/extrabees/core/ExtraBeeItems.java b/src/Java/binnie/extrabees/core/ExtraBeeItems.java
new file mode 100644
index 0000000000..3bcea19f08
--- /dev/null
+++ b/src/Java/binnie/extrabees/core/ExtraBeeItems.java
@@ -0,0 +1,172 @@
+package binnie.extrabees.core;
+
+import binnie.Binnie;
+import binnie.core.Mods;
+import binnie.core.Mods.Mod;
+import binnie.core.item.IItemMisc;
+import binnie.core.liquid.ManagerLiquid;
+import binnie.extrabees.ExtraBees;
+import binnie.extrabees.proxy.ExtraBeesProxy;
+import cpw.mods.fml.common.registry.GameRegistry;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import forestry.api.recipes.ICarpenterManager;
+import forestry.api.recipes.RecipeManagers;
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.List;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.init.Blocks;
+import net.minecraft.init.Items;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.IIcon;
+import net.minecraftforge.oredict.OreDictionary;
+
+public enum ExtraBeeItems
+ implements IItemMisc
+{
+ ScentedGear("Scented Gear", "scentedGear"), DiamondShard("Diamond Fragment", "diamondShard"), EmeraldShard("Emerald Fragment", "emeraldShard"), RubyShard("Ruby Fragment", "rubyShard"), SapphireShard("Sapphire Fragment", "sapphireShard"), LapisShard("Lapis Fragment", "lapisShard"), IronDust("Iron Grains", "ironDust"), GoldDust("Gold Grains", "goldDust"), SilverDust("Silver Grains", "silverDust"), PlatinumDust("Platinum Grains", "platinumDust"), CopperDust("Copper Grains", "copperDust"), TinDust("Tin Grains", "tinDust"), NickelDust("Nickel Grains", "nickelDust"), LeadDust("Lead Grains", "leadDust"), ZincDust("Zinc Grains", "zincDust"), TitaniumDust("Titanium Grains", "titaniumDust"), TungstenDust("Tungsten Grains", "tungstenDust"), UraniumDust("Radioactive Fragments", "radioactiveDust"), CoalDust("Coal Grains", "coalDust"), RedDye("Red Dye", "dyeRed"), YellowDye("Yellow Dye", "dyeYellow"), BlueDye("Blue Dye", "dyeBlue"), GreenDye("Green Dye", "dyeGreen"), WhiteDye("White Dye", "dyeWhite"), BlackDye("Black Dye", "dyeBlack"), BrownDye("Brown Dye", "dyeBrown"), ClayDust("Clay Dust", "clayDust"), YelloriumDust("Yellorium Grains", "yelloriumDust"), BlutoniumDust("Blutonium Grains", "blutoniumDust"), CyaniteDust("Cyanite Grains", "cyaniteDust");
+
+ String name;
+ String iconPath;
+ IIcon icon;
+
+ static
+ {
+ TinDust.setMetal("Tin");
+ ZincDust.setMetal("Zinc");
+ CopperDust.setMetal("Copper");
+ IronDust.setMetal("Iron");
+ NickelDust.setMetal("Nickel");
+ LeadDust.setMetal("Lead");
+ SilverDust.setMetal("Silver");
+ GoldDust.setMetal("Gold");
+ PlatinumDust.setMetal("Platinum");
+ TungstenDust.setMetal("Tungsten");
+ TitaniumDust.setMetal("Titanium");
+ CoalDust.setMetal("Coal");
+
+ YelloriumDust.setMetal("Yellorium");
+ BlutoniumDust.setMetal("Blutonium");
+ CyaniteDust.setMetal("Cyanite");
+
+ DiamondShard.setGem("Diamond");
+ EmeraldShard.setGem("Emerald");
+ RubyShard.setGem("Ruby");
+ SapphireShard.setGem("Sapphire");
+ }
+
+ public static void init()
+ {
+ OreDictionary.registerOre("dyeRed", RedDye.get(1));
+ OreDictionary.registerOre("dyeYellow", YellowDye.get(1));
+ OreDictionary.registerOre("dyeBlue", BlueDye.get(1));
+ OreDictionary.registerOre("dyeGreen", GreenDye.get(1));
+ OreDictionary.registerOre("dyeBlack", BlackDye.get(1));
+ OreDictionary.registerOre("dyeWhite", WhiteDye.get(1));
+ OreDictionary.registerOre("dyeBrown", BrownDye.get(1));
+ }
+
+ public static void postInit()
+ {
+ ItemStack lapisShard = LapisShard.get(1);
+ GameRegistry.addShapelessRecipe(new ItemStack(Items.dye, 1, 4), new Object[] { lapisShard, lapisShard, lapisShard, lapisShard });
+ for (ExtraBeeItems item : values()) {
+ if (item.metalString != null)
+ {
+ ItemStack dust = null;
+ ItemStack ingot = null;
+ if (!OreDictionary.getOres("ingot" + item.metalString).isEmpty()) {
+ ingot = ((ItemStack)OreDictionary.getOres("ingot" + item.metalString).get(0)).copy();
+ }
+ if (!OreDictionary.getOres("dust" + item.metalString).isEmpty()) {
+ dust = ((ItemStack)OreDictionary.getOres("dust" + item.metalString).get(0)).copy();
+ }
+ ItemStack input = item.get(1);
+ if (dust != null) {
+ GameRegistry.addShapelessRecipe(dust, new Object[] { input, input, input, input });
+ } else if (ingot != null) {
+ GameRegistry.addShapelessRecipe(ingot, new Object[] { input, input, input, input, input, input, input, input, input });
+ } else if (item == CoalDust) {
+ GameRegistry.addShapelessRecipe(new ItemStack(Items.coal), new Object[] { input, input, input, input });
+ }
+ }
+ else if (item.gemString != null)
+ {
+ ItemStack gem = null;
+ if (!OreDictionary.getOres("gem" + item.gemString).isEmpty()) {
+ gem = (ItemStack)OreDictionary.getOres("gem" + item.gemString).get(0);
+ }
+ ItemStack input = item.get(1);
+ if (gem != null) {
+ GameRegistry.addShapelessRecipe(gem.copy(), new Object[] { input, input, input, input, input, input, input, input, input });
+ }
+ }
+ }
+ Item woodGear = null;
+ try
+ {
+ woodGear = (Item)Class.forName("buildcraft.BuildCraftCore").getField("woodenGearItem").get(null);
+ }
+ catch (Exception e) {}
+ ItemStack gear = new ItemStack(Blocks.planks, 1);
+ if (woodGear != null) {
+ gear = new ItemStack(woodGear, 1);
+ }
+ RecipeManagers.carpenterManager.addRecipe(100, Binnie.Liquid.getLiquidStack("for.honey", 500), null, ScentedGear.get(1), new Object[] { " j ", "bgb", " p ", Character.valueOf('j'), Mods.Forestry.item("royalJelly"), Character.valueOf('b'), Mods.Forestry.item("beeswax"), Character.valueOf('p'), Mods.Forestry.item("pollen"), Character.valueOf('g'), gear });
+ }
+
+ String metalString = null;
+ String gemString = null;
+
+ private ExtraBeeItems(String name, String iconPath)
+ {
+ this.name = name;
+ this.iconPath = iconPath;
+ }
+
+ private void setGem(String string)
+ {
+ this.gemString = string;
+ }
+
+ private void setMetal(String string)
+ {
+ this.metalString = string;
+ }
+
+ public boolean isActive()
+ {
+ if (this.metalString != null) {
+ return (!OreDictionary.getOres("ingot" + this.metalString).isEmpty()) || (!OreDictionary.getOres("dust" + this.metalString).isEmpty()) || (this == CoalDust);
+ }
+ if (this.gemString != null) {
+ return !OreDictionary.getOres("gem" + this.gemString).isEmpty();
+ }
+ return true;
+ }
+
+ public IIcon getIcon(ItemStack stack)
+ {
+ return this.icon;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void registerIcons(IIconRegister register)
+ {
+ this.icon = ExtraBees.proxy.getIcon(register, "misc/" + this.iconPath);
+ }
+
+ public String getName(ItemStack stack)
+ {
+ return this.name;
+ }
+
+ public ItemStack get(int i)
+ {
+ return new ItemStack(ExtraBees.itemMisc, i, ordinal());
+ }
+
+ public void addInformation(List par3List) {}
+}
diff --git a/src/Java/binnie/extrabees/core/ExtraBeeTexture.java b/src/Java/binnie/extrabees/core/ExtraBeeTexture.java
new file mode 100644
index 0000000000..6827b81144
--- /dev/null
+++ b/src/Java/binnie/extrabees/core/ExtraBeeTexture.java
@@ -0,0 +1,28 @@
+package binnie.extrabees.core;
+
+import binnie.Binnie;
+import binnie.core.resource.BinnieResource;
+import binnie.core.resource.IBinnieTexture;
+import binnie.core.resource.ManagerResource;
+import binnie.core.resource.ResourceType;
+import binnie.extrabees.ExtraBees;
+
+public enum ExtraBeeTexture
+ implements IBinnieTexture
+{
+ AlvearyMutator(ResourceType.Tile, "alveary/AlvearyMutator"), AlvearyNovaBlock(ResourceType.Tile, "alveary/AlvearyNovaBlock"), AlvearyFrame(ResourceType.Tile, "alveary/AlvearyFrame"), AlvearyLighting(ResourceType.Tile, "alveary/AlvearyLighting"), AlvearyRainShield(ResourceType.Tile, "alveary/AlvearyRainShield"), AlvearyStimulator(ResourceType.Tile, "alveary/AlvearyStimulator"), AlvearyHatchery(ResourceType.Tile, "alveary/AlvearyHatchery"), FX(ResourceType.FX, "fx"), GUIPunnett(ResourceType.GUI, "punnett"), GUIProgress(ResourceType.GUI, "processes"), GUIProgress2(ResourceType.GUI, "processes2"), AlvearyTransmission(ResourceType.Tile, "alveary/AlvearyTransmission");
+
+ String texture;
+ ResourceType type;
+
+ private ExtraBeeTexture(ResourceType base, String texture)
+ {
+ this.texture = texture;
+ this.type = base;
+ }
+
+ public BinnieResource getTexture()
+ {
+ return Binnie.Resource.getPNG(ExtraBees.instance, this.type, this.texture);
+ }
+}
diff --git a/src/Java/binnie/extrabees/core/ModuleCore.java b/src/Java/binnie/extrabees/core/ModuleCore.java
new file mode 100644
index 0000000000..14786ddc77
--- /dev/null
+++ b/src/Java/binnie/extrabees/core/ModuleCore.java
@@ -0,0 +1,19 @@
+package binnie.extrabees.core;
+
+import binnie.Binnie;
+import binnie.core.IInitializable;
+import binnie.core.item.ManagerItem;
+import forestry.api.core.Tabs;
+
+public class ModuleCore
+ implements IInitializable
+{
+ public void preInit()
+ {
+ binnie.extrabees.ExtraBees.itemMisc = Binnie.Item.registerMiscItems(ExtraBeeItems.values(), Tabs.tabApiculture);
+ }
+
+ public void init() {}
+
+ public void postInit() {}
+}
diff --git a/src/Java/binnie/extrabees/genetics/ExtraBeeMutation.java b/src/Java/binnie/extrabees/genetics/ExtraBeeMutation.java
new file mode 100644
index 0000000000..c3a849c9e5
--- /dev/null
+++ b/src/Java/binnie/extrabees/genetics/ExtraBeeMutation.java
@@ -0,0 +1,478 @@
+package binnie.extrabees.genetics;
+
+import binnie.Binnie;
+import binnie.core.genetics.ForestryAllele.BeeSpecies;
+import binnie.core.genetics.ManagerGenetics;
+import com.mojang.authlib.GameProfile;
+import forestry.api.apiculture.IAlleleBeeSpecies;
+import forestry.api.apiculture.IBeeGenome;
+import forestry.api.apiculture.IBeeHousing;
+import forestry.api.apiculture.IBeeMutation;
+import forestry.api.apiculture.IBeeRoot;
+import forestry.api.apiculture.IBeekeepingMode;
+import forestry.api.genetics.IAllele;
+import forestry.api.genetics.IGenome;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import net.minecraft.world.World;
+import net.minecraft.world.biome.BiomeGenBase;
+import net.minecraftforge.common.BiomeDictionary;
+import net.minecraftforge.common.BiomeDictionary.Type;
+
+public class ExtraBeeMutation
+ implements IBeeMutation
+{
+ public static void doInit()
+ {
+ IAlleleBeeSpecies[] vanilla = new IAlleleBeeSpecies[0];
+
+
+
+
+ new ExtraBeeMutation(ForestryAllele.BeeSpecies.Meadows.getAllele(), ForestryAllele.BeeSpecies.Frugal.getAllele(), ExtraBeesSpecies.ARID, 10);
+ new ExtraBeeMutation(ForestryAllele.BeeSpecies.Forest.getAllele(), ForestryAllele.BeeSpecies.Frugal.getAllele(), ExtraBeesSpecies.ARID, 10);
+ new ExtraBeeMutation(ExtraBeesSpecies.ARID, ForestryAllele.BeeSpecies.Common.getAllele(), ExtraBeesSpecies.BARREN, 8);
+ new ExtraBeeMutation(ExtraBeesSpecies.ARID, ExtraBeesSpecies.BARREN, ExtraBeesSpecies.DESOLATE, 8);
+
+
+
+
+
+ new ExtraBeeMutation(ExtraBeesSpecies.BARREN, ForestryAllele.BeeSpecies.Forest.getAllele(), ExtraBeesSpecies.GNAWING, 15);
+ new ExtraBeeMutation(ExtraBeesSpecies.DESOLATE, ForestryAllele.BeeSpecies.Meadows.getAllele(), ExtraBeesSpecies.ROTTEN, 15);
+ new ExtraBeeMutation(ExtraBeesSpecies.DESOLATE, ForestryAllele.BeeSpecies.Forest.getAllele(), ExtraBeesSpecies.BONE, 15);
+ new ExtraBeeMutation(ExtraBeesSpecies.DESOLATE, ForestryAllele.BeeSpecies.Modest.getAllele(), ExtraBeesSpecies.CREEPER, 15);
+ new ExtraBeeMutation(ExtraBeesSpecies.BARREN, ForestryAllele.BeeSpecies.Marshy.getAllele(), ExtraBeesSpecies.DECOMPOSING, 15);
+
+
+
+
+ new ExtraBeeMutation(ExtraBeesSpecies.ROCK, ForestryAllele.BeeSpecies.Diligent.getAllele(), ExtraBeesSpecies.STONE, 12);
+ new ExtraBeeMutation(ExtraBeesSpecies.STONE, ForestryAllele.BeeSpecies.Unweary.getAllele(), ExtraBeesSpecies.GRANITE, 10);
+ new ExtraBeeMutation(ExtraBeesSpecies.GRANITE, ForestryAllele.BeeSpecies.Industrious.getAllele(), ExtraBeesSpecies.MINERAL, 6);
+
+
+
+
+ new ExtraBeeMutation(ExtraBeesSpecies.MINERAL, ForestryAllele.BeeSpecies.Meadows.getAllele(), ExtraBeesSpecies.IRON, 5);
+ new ExtraBeeMutation(ExtraBeesSpecies.MINERAL, ForestryAllele.BeeSpecies.Forest.getAllele(), ExtraBeesSpecies.IRON, 5);
+ new ExtraBeeMutation(ExtraBeesSpecies.MINERAL, ForestryAllele.BeeSpecies.Wintry.getAllele(), ExtraBeesSpecies.COPPER, 5);
+ new ExtraBeeMutation(ExtraBeesSpecies.MINERAL, ForestryAllele.BeeSpecies.Modest.getAllele(), ExtraBeesSpecies.COPPER, 5);
+ new ExtraBeeMutation(ExtraBeesSpecies.MINERAL, ForestryAllele.BeeSpecies.Marshy.getAllele(), ExtraBeesSpecies.TIN, 5);
+ new ExtraBeeMutation(ExtraBeesSpecies.MINERAL, ForestryAllele.BeeSpecies.Tropical.getAllele(), ExtraBeesSpecies.TIN, 5);
+ new ExtraBeeMutation(ExtraBeesSpecies.MINERAL, ForestryAllele.BeeSpecies.Meadows.getAllele(), ExtraBeesSpecies.LEAD, 5);
+ new ExtraBeeMutation(ExtraBeesSpecies.MINERAL, ForestryAllele.BeeSpecies.Modest.getAllele(), ExtraBeesSpecies.LEAD, 5);
+ new ExtraBeeMutation(ExtraBeesSpecies.MINERAL, ForestryAllele.BeeSpecies.Wintry.getAllele(), ExtraBeesSpecies.ZINC, 5);
+ new ExtraBeeMutation(ExtraBeesSpecies.MINERAL, ForestryAllele.BeeSpecies.Tropical.getAllele(), ExtraBeesSpecies.ZINC, 5);
+ new ExtraBeeMutation(ExtraBeesSpecies.MINERAL, ForestryAllele.BeeSpecies.Forest.getAllele(), ExtraBeesSpecies.NICKEL, 5);
+ new ExtraBeeMutation(ExtraBeesSpecies.MINERAL, ForestryAllele.BeeSpecies.Marshy.getAllele(), ExtraBeesSpecies.NICKEL, 5);
+ new ExtraBeeMutation(ExtraBeesSpecies.MINERAL, ForestryAllele.BeeSpecies.Cultivated.getAllele(), ExtraBeesSpecies.TITANIUM, 3);
+ new ExtraBeeMutation(ExtraBeesSpecies.MINERAL, ForestryAllele.BeeSpecies.Common.getAllele(), ExtraBeesSpecies.TUNGSTATE, 3);
+
+
+
+
+ new ExtraBeeMutation(ExtraBeesSpecies.ZINC, ForestryAllele.BeeSpecies.Majestic.getAllele(), ExtraBeesSpecies.SILVER, 2);
+ new ExtraBeeMutation(ExtraBeesSpecies.TIN, ForestryAllele.BeeSpecies.Majestic.getAllele(), ExtraBeesSpecies.SILVER, 2);
+ new ExtraBeeMutation(ExtraBeesSpecies.LEAD, ForestryAllele.BeeSpecies.Majestic.getAllele(), ExtraBeesSpecies.SILVER, 2);
+ new ExtraBeeMutation(ExtraBeesSpecies.TITANIUM, ForestryAllele.BeeSpecies.Majestic.getAllele(), ExtraBeesSpecies.SILVER, 3);
+
+ new ExtraBeeMutation(ExtraBeesSpecies.IRON, ForestryAllele.BeeSpecies.Majestic.getAllele(), ExtraBeesSpecies.GOLD, 2);
+ new ExtraBeeMutation(ExtraBeesSpecies.COPPER, ForestryAllele.BeeSpecies.Majestic.getAllele(), ExtraBeesSpecies.GOLD, 2);
+ new ExtraBeeMutation(ExtraBeesSpecies.NICKEL, ForestryAllele.BeeSpecies.Majestic.getAllele(), ExtraBeesSpecies.GOLD, 2);
+ new ExtraBeeMutation(ExtraBeesSpecies.TUNGSTATE, ForestryAllele.BeeSpecies.Majestic.getAllele(), ExtraBeesSpecies.GOLD, 3);
+
+ new ExtraBeeMutation(ExtraBeesSpecies.GOLD, ExtraBeesSpecies.SILVER, ExtraBeesSpecies.PLATINUM, 2);
+
+
+
+
+ new ExtraBeeMutation(ExtraBeesSpecies.MINERAL, ForestryAllele.BeeSpecies.Imperial.getAllele(), ExtraBeesSpecies.LAPIS, 5);
+ new ExtraBeeMutation(ExtraBeesSpecies.LAPIS, ForestryAllele.BeeSpecies.Forest.getAllele(), ExtraBeesSpecies.EMERALD, 5);
+ new ExtraBeeMutation(ExtraBeesSpecies.LAPIS, ForestryAllele.BeeSpecies.Modest.getAllele(), ExtraBeesSpecies.RUBY, 5);
+ new ExtraBeeMutation(ExtraBeesSpecies.LAPIS, ExtraBeesSpecies.WATER, ExtraBeesSpecies.SAPPHIRE, 5);
+ new ExtraBeeMutation(ExtraBeesSpecies.LAPIS, ForestryAllele.BeeSpecies.Cultivated.getAllele(), ExtraBeesSpecies.DIAMOND, 5);
+
+
+
+
+ new ExtraBeeMutation(ExtraBeesSpecies.PREHISTORIC, ExtraBeesSpecies.MINERAL, ExtraBeesSpecies.UNSTABLE, 5);
+ new ExtraBeeMutation(ExtraBeesSpecies.UNSTABLE, ExtraBeesSpecies.IRON, ExtraBeesSpecies.NUCLEAR, 5);
+ new ExtraBeeMutation(ExtraBeesSpecies.UNSTABLE, ExtraBeesSpecies.COPPER, ExtraBeesSpecies.NUCLEAR, 5);
+ new ExtraBeeMutation(ExtraBeesSpecies.UNSTABLE, ExtraBeesSpecies.TIN, ExtraBeesSpecies.NUCLEAR, 5);
+ new ExtraBeeMutation(ExtraBeesSpecies.UNSTABLE, ExtraBeesSpecies.ZINC, ExtraBeesSpecies.NUCLEAR, 5);
+ new ExtraBeeMutation(ExtraBeesSpecies.UNSTABLE, ExtraBeesSpecies.NICKEL, ExtraBeesSpecies.NUCLEAR, 5);
+ new ExtraBeeMutation(ExtraBeesSpecies.UNSTABLE, ExtraBeesSpecies.LEAD, ExtraBeesSpecies.NUCLEAR, 5);
+ new ExtraBeeMutation(ExtraBeesSpecies.NUCLEAR, ExtraBeesSpecies.GOLD, ExtraBeesSpecies.RADIOACTIVE, 5);
+ new ExtraBeeMutation(ExtraBeesSpecies.NUCLEAR, ExtraBeesSpecies.SILVER, ExtraBeesSpecies.RADIOACTIVE, 5);
+
+
+
+
+ new ExtraBeeMutation(ExtraBeesSpecies.NUCLEAR, ForestryAllele.BeeSpecies.Frugal.getAllele(), ExtraBeesSpecies.YELLORIUM, 5);
+ new ExtraBeeMutation(ExtraBeesSpecies.NUCLEAR, ExtraBeesSpecies.YELLORIUM, ExtraBeesSpecies.CYANITE, 5);
+ new ExtraBeeMutation(ExtraBeesSpecies.YELLORIUM, ExtraBeesSpecies.CYANITE, ExtraBeesSpecies.BLUTONIUM, 5);
+
+
+
+
+
+ new ExtraBeeMutation(ForestryAllele.BeeSpecies.Noble.getAllele(), ForestryAllele.BeeSpecies.Diligent.getAllele(), ExtraBeesSpecies.ANCIENT, 10);
+ new ExtraBeeMutation(ExtraBeesSpecies.ANCIENT, ForestryAllele.BeeSpecies.Secluded.getAllele(), ExtraBeesSpecies.PRIMEVAL, 8);
+ new ExtraBeeMutation(ExtraBeesSpecies.PRIMEVAL, ExtraBeesSpecies.ANCIENT, ExtraBeesSpecies.PREHISTORIC, 8);
+ new ExtraBeeMutation(ExtraBeesSpecies.PREHISTORIC, ForestryAllele.BeeSpecies.Imperial.getAllele(), ExtraBeesSpecies.RELIC, 8);
+
+
+
+
+
+ new ExtraBeeMutation(ExtraBeesSpecies.PRIMEVAL, ExtraBeesSpecies.GROWING, ExtraBeesSpecies.COAL, 8);
+ new ExtraBeeMutation(ExtraBeesSpecies.PRIMEVAL, ForestryAllele.BeeSpecies.Rural.getAllele(), ExtraBeesSpecies.COAL, 8);
+ new ExtraBeeMutation(ExtraBeesSpecies.PRIMEVAL, ForestryAllele.BeeSpecies.Miry.getAllele(), ExtraBeesSpecies.RESIN, 8);
+ new ExtraBeeMutation(ExtraBeesSpecies.PRIMEVAL, ExtraBeesSpecies.OCEAN, ExtraBeesSpecies.OIL, 8);
+ new ExtraBeeMutation(ExtraBeesSpecies.PRIMEVAL, ForestryAllele.BeeSpecies.Frugal.getAllele(), ExtraBeesSpecies.OIL, 8);
+
+
+
+
+
+
+
+ new ExtraBeeMutation(ExtraBeesSpecies.OIL, ForestryAllele.BeeSpecies.Industrious.getAllele(), ExtraBeesSpecies.DISTILLED, 8);
+ new ExtraBeeMutation(ExtraBeesSpecies.DISTILLED, ExtraBeesSpecies.OIL, ExtraBeesSpecies.FUEL, 8);
+ new ExtraBeeMutation(ExtraBeesSpecies.DISTILLED, ExtraBeesSpecies.COAL, ExtraBeesSpecies.CREOSOTE, 8);
+ new ExtraBeeMutation(ExtraBeesSpecies.DISTILLED, ExtraBeesSpecies.RESIN, ExtraBeesSpecies.LATEX, 8);
+
+
+
+
+ new ExtraBeeMutation(ExtraBeesSpecies.WATER, ForestryAllele.BeeSpecies.Diligent.getAllele(), ExtraBeesSpecies.RIVER, 10, new RequirementBiomeType(BiomeDictionary.Type.RIVER));
+ new ExtraBeeMutation(ExtraBeesSpecies.WATER, ForestryAllele.BeeSpecies.Diligent.getAllele(), ExtraBeesSpecies.OCEAN, 10, new RequirementBiomeType(BiomeDictionary.Type.OCEAN));
+ new ExtraBeeMutation(ExtraBeesSpecies.BLACK, ExtraBeesSpecies.OCEAN, ExtraBeesSpecies.INK, 8);
+
+
+
+
+ new ExtraBeeMutation(ForestryAllele.BeeSpecies.Forest.getAllele(), ForestryAllele.BeeSpecies.Diligent.getAllele(), ExtraBeesSpecies.GROWING, 10);
+ new ExtraBeeMutation(ExtraBeesSpecies.GROWING, ForestryAllele.BeeSpecies.Unweary.getAllele(), ExtraBeesSpecies.THRIVING, 10);
+ new ExtraBeeMutation(ExtraBeesSpecies.THRIVING, ForestryAllele.BeeSpecies.Industrious.getAllele(), ExtraBeesSpecies.BLOOMING, 8);
+
+
+
+
+ new ExtraBeeMutation(ForestryAllele.BeeSpecies.Valiant.getAllele(), ForestryAllele.BeeSpecies.Diligent.getAllele(), ExtraBeesSpecies.SWEET, 15);
+ new ExtraBeeMutation(ExtraBeesSpecies.SWEET, ForestryAllele.BeeSpecies.Rural.getAllele(), ExtraBeesSpecies.SUGAR, 15);
+ new ExtraBeeMutation(ExtraBeesSpecies.SWEET, ExtraBeesSpecies.GROWING, ExtraBeesSpecies.RIPENING, 5);
+ new ExtraBeeMutation(ExtraBeesSpecies.SWEET, ExtraBeesSpecies.THRIVING, ExtraBeesSpecies.FRUIT, 5);
+
+
+
+
+ new ExtraBeeMutation(ForestryAllele.BeeSpecies.Farmerly.getAllele(), ForestryAllele.BeeSpecies.Meadows.getAllele(), ExtraBeesSpecies.ALCOHOL, 10);
+ new ExtraBeeMutation(ForestryAllele.BeeSpecies.Farmerly.getAllele(), ForestryAllele.BeeSpecies.Meadows.getAllele(), ExtraBeesSpecies.FARM, 10);
+ new ExtraBeeMutation(ForestryAllele.BeeSpecies.Farmerly.getAllele(), ExtraBeesSpecies.WATER, ExtraBeesSpecies.MILK, 10);
+ new ExtraBeeMutation(ForestryAllele.BeeSpecies.Farmerly.getAllele(), ForestryAllele.BeeSpecies.Tropical.getAllele(), ExtraBeesSpecies.COFFEE, 10);
+
+
+
+
+
+
+
+
+
+
+
+
+ new ExtraBeeMutation(ExtraBeesSpecies.WATER, ForestryAllele.BeeSpecies.Miry.getAllele(), ExtraBeesSpecies.SWAMP, 10);
+ new ExtraBeeMutation(ExtraBeesSpecies.SWAMP, ForestryAllele.BeeSpecies.Boggy.getAllele(), ExtraBeesSpecies.BOGGY, 8);
+ new ExtraBeeMutation(ExtraBeesSpecies.BOGGY, ExtraBeesSpecies.SWAMP, ExtraBeesSpecies.FUNGAL, 8);
+ new ExtraBeeMutation(ForestryAllele.BeeSpecies.Boggy.getAllele(), ForestryAllele.BeeSpecies.Miry.getAllele(), ExtraBeesSpecies.FUNGAL, 8);
+
+
+
+
+ new ExtraBeeMutation(ExtraBeesSpecies.WATER, ForestryAllele.BeeSpecies.Forest.getAllele(), ForestryAllele.BeeSpecies.Common.getTemplate(), 15);
+ new ExtraBeeMutation(ExtraBeesSpecies.WATER, ForestryAllele.BeeSpecies.Meadows.getAllele(), ForestryAllele.BeeSpecies.Common.getTemplate(), 15);
+ new ExtraBeeMutation(ExtraBeesSpecies.WATER, ForestryAllele.BeeSpecies.Modest.getAllele(), ForestryAllele.BeeSpecies.Common.getTemplate(), 15);
+ new ExtraBeeMutation(ExtraBeesSpecies.WATER, ForestryAllele.BeeSpecies.Tropical.getAllele(), ForestryAllele.BeeSpecies.Common.getTemplate(), 15);
+ new ExtraBeeMutation(ExtraBeesSpecies.WATER, ForestryAllele.BeeSpecies.Marshy.getAllele(), ForestryAllele.BeeSpecies.Common.getTemplate(), 15);
+ new ExtraBeeMutation(ExtraBeesSpecies.WATER, ForestryAllele.BeeSpecies.Wintry.getAllele(), ForestryAllele.BeeSpecies.Common.getTemplate(), 15);
+ new ExtraBeeMutation(ExtraBeesSpecies.WATER, ExtraBeesSpecies.ROCK, ForestryAllele.BeeSpecies.Common.getTemplate(), 15);
+ new ExtraBeeMutation(ExtraBeesSpecies.WATER, ExtraBeesSpecies.BASALT, ForestryAllele.BeeSpecies.Common.getTemplate(), 15);
+ new ExtraBeeMutation(ExtraBeesSpecies.ROCK, ForestryAllele.BeeSpecies.Forest.getAllele(), ForestryAllele.BeeSpecies.Common.getTemplate(), 15);
+ new ExtraBeeMutation(ExtraBeesSpecies.ROCK, ForestryAllele.BeeSpecies.Meadows.getAllele(), ForestryAllele.BeeSpecies.Common.getTemplate(), 15);
+ new ExtraBeeMutation(ExtraBeesSpecies.ROCK, ForestryAllele.BeeSpecies.Modest.getAllele(), ForestryAllele.BeeSpecies.Common.getTemplate(), 15);
+ new ExtraBeeMutation(ExtraBeesSpecies.ROCK, ForestryAllele.BeeSpecies.Tropical.getAllele(), ForestryAllele.BeeSpecies.Common.getTemplate(), 15);
+ new ExtraBeeMutation(ExtraBeesSpecies.ROCK, ForestryAllele.BeeSpecies.Marshy.getAllele(), ForestryAllele.BeeSpecies.Common.getTemplate(), 15);
+ new ExtraBeeMutation(ExtraBeesSpecies.ROCK, ForestryAllele.BeeSpecies.Wintry.getAllele(), ForestryAllele.BeeSpecies.Common.getTemplate(), 15);
+ new ExtraBeeMutation(ExtraBeesSpecies.ROCK, ExtraBeesSpecies.BASALT, ForestryAllele.BeeSpecies.Common.getTemplate(), 15);
+ new ExtraBeeMutation(ExtraBeesSpecies.BASALT, ForestryAllele.BeeSpecies.Forest.getAllele(), ForestryAllele.BeeSpecies.Common.getTemplate(), 15);
+ new ExtraBeeMutation(ExtraBeesSpecies.BASALT, ForestryAllele.BeeSpecies.Meadows.getAllele(), ForestryAllele.BeeSpecies.Common.getTemplate(), 15);
+ new ExtraBeeMutation(ExtraBeesSpecies.BASALT, ForestryAllele.BeeSpecies.Modest.getAllele(), ForestryAllele.BeeSpecies.Common.getTemplate(), 15);
+ new ExtraBeeMutation(ExtraBeesSpecies.BASALT, ForestryAllele.BeeSpecies.Tropical.getAllele(), ForestryAllele.BeeSpecies.Common.getTemplate(), 15);
+ new ExtraBeeMutation(ExtraBeesSpecies.BASALT, ForestryAllele.BeeSpecies.Marshy.getAllele(), ForestryAllele.BeeSpecies.Common.getTemplate(), 15);
+ new ExtraBeeMutation(ExtraBeesSpecies.BASALT, ForestryAllele.BeeSpecies.Wintry.getAllele(), ForestryAllele.BeeSpecies.Common.getTemplate(), 15);
+
+ new ExtraBeeMutation(ExtraBeesSpecies.WATER, ForestryAllele.BeeSpecies.Common.getAllele(), ForestryAllele.BeeSpecies.Cultivated.getTemplate(), 12);
+ new ExtraBeeMutation(ExtraBeesSpecies.ROCK, ForestryAllele.BeeSpecies.Common.getAllele(), ForestryAllele.BeeSpecies.Cultivated.getTemplate(), 12);
+ new ExtraBeeMutation(ExtraBeesSpecies.BASALT, ForestryAllele.BeeSpecies.Common.getAllele(), ForestryAllele.BeeSpecies.Cultivated.getTemplate(), 12);
+
+
+
+
+ new ExtraBeeMutation(ExtraBeesSpecies.BASALT, ForestryAllele.BeeSpecies.Fiendish.getAllele(), ExtraBeesSpecies.TEMPERED, 30, new RequirementBiomeType(BiomeDictionary.Type.NETHER));
+ new ExtraBeeMutation(ExtraBeesSpecies.TEMPERED, ForestryAllele.BeeSpecies.Demonic.getAllele(), ExtraBeesSpecies.VOLCANIC, 20, new RequirementBiomeType(BiomeDictionary.Type.NETHER));
+
+
+
+
+ new ExtraBeeMutation(ExtraBeesSpecies.BASALT, ForestryAllele.BeeSpecies.Cultivated.getAllele(), ForestryAllele.BeeSpecies.Sinister.getTemplate(), 60, new RequirementBiomeType(BiomeDictionary.Type.NETHER));
+
+ new ExtraBeeMutation(ExtraBeesSpecies.BASALT, ForestryAllele.BeeSpecies.Sinister.getAllele(), ForestryAllele.BeeSpecies.Fiendish.getTemplate(), 40, new RequirementBiomeType(BiomeDictionary.Type.NETHER));
+
+
+
+
+
+ new ExtraBeeMutation(ForestryAllele.BeeSpecies.Sinister.getAllele(), ForestryAllele.BeeSpecies.Tropical.getAllele(), ExtraBeesSpecies.MALICIOUS, 10);
+ new ExtraBeeMutation(ExtraBeesSpecies.MALICIOUS, ForestryAllele.BeeSpecies.Tropical.getAllele(), ExtraBeesSpecies.INFECTIOUS, 8);
+ new ExtraBeeMutation(ExtraBeesSpecies.MALICIOUS, ExtraBeesSpecies.INFECTIOUS, ExtraBeesSpecies.VIRULENT, 8);
+
+ new ExtraBeeMutation(ExtraBeesSpecies.WATER, ForestryAllele.BeeSpecies.Exotic.getAllele(), ExtraBeesSpecies.VISCOUS, 10);
+ new ExtraBeeMutation(ExtraBeesSpecies.VISCOUS, ForestryAllele.BeeSpecies.Exotic.getAllele(), ExtraBeesSpecies.GLUTINOUS, 8);
+ new ExtraBeeMutation(ExtraBeesSpecies.VISCOUS, ExtraBeesSpecies.GLUTINOUS, ExtraBeesSpecies.STICKY, 8);
+
+ new ExtraBeeMutation(ExtraBeesSpecies.MALICIOUS, ExtraBeesSpecies.VISCOUS, ExtraBeesSpecies.CORROSIVE, 10);
+ new ExtraBeeMutation(ExtraBeesSpecies.CORROSIVE, ForestryAllele.BeeSpecies.Fiendish.getAllele(), ExtraBeesSpecies.CAUSTIC, 8);
+ new ExtraBeeMutation(ExtraBeesSpecies.CORROSIVE, ExtraBeesSpecies.CAUSTIC, ExtraBeesSpecies.ACIDIC, 4);
+
+
+
+
+ new ExtraBeeMutation(ForestryAllele.BeeSpecies.Cultivated.getAllele(), ForestryAllele.BeeSpecies.Valiant.getAllele(), ExtraBeesSpecies.EXCITED, 10);
+ new ExtraBeeMutation(ExtraBeesSpecies.EXCITED, ForestryAllele.BeeSpecies.Diligent.getAllele(), ExtraBeesSpecies.ENERGETIC, 8);
+ new ExtraBeeMutation(ExtraBeesSpecies.EXCITED, ExtraBeesSpecies.ENERGETIC, ExtraBeesSpecies.ECSTATIC, 8);
+
+
+
+
+ new ExtraBeeMutation(ForestryAllele.BeeSpecies.Wintry.getAllele(), ForestryAllele.BeeSpecies.Diligent.getAllele(), ExtraBeesSpecies.ARTIC, 10);
+ new ExtraBeeMutation(ExtraBeesSpecies.OCEAN, ExtraBeesSpecies.ARTIC, ExtraBeesSpecies.FREEZING, 10);
+
+
+
+
+ new ExtraBeeMutation(ExtraBeesSpecies.ROCK, ForestryAllele.BeeSpecies.Sinister.getAllele(), ExtraBeesSpecies.SHADOW, 10);
+ new ExtraBeeMutation(ExtraBeesSpecies.SHADOW, ExtraBeesSpecies.ROCK, ExtraBeesSpecies.DARKENED, 8);
+ new ExtraBeeMutation(ExtraBeesSpecies.SHADOW, ExtraBeesSpecies.DARKENED, ExtraBeesSpecies.ABYSS, 8);
+
+
+
+
+ new ExtraBeeMutation(ForestryAllele.BeeSpecies.Forest.getAllele(), ForestryAllele.BeeSpecies.Valiant.getAllele(), ExtraBeesSpecies.RED, 5);
+ new ExtraBeeMutation(ForestryAllele.BeeSpecies.Meadows.getAllele(), ForestryAllele.BeeSpecies.Valiant.getAllele(), ExtraBeesSpecies.YELLOW, 5);
+ new ExtraBeeMutation(ExtraBeesSpecies.WATER, ForestryAllele.BeeSpecies.Valiant.getAllele(), ExtraBeesSpecies.BLUE, 5);
+ new ExtraBeeMutation(ForestryAllele.BeeSpecies.Tropical.getAllele(), ForestryAllele.BeeSpecies.Valiant.getAllele(), ExtraBeesSpecies.GREEN, 5);
+ new ExtraBeeMutation(ExtraBeesSpecies.ROCK, ForestryAllele.BeeSpecies.Valiant.getAllele(), ExtraBeesSpecies.BLACK, 5);
+ new ExtraBeeMutation(ForestryAllele.BeeSpecies.Wintry.getAllele(), ForestryAllele.BeeSpecies.Valiant.getAllele(), ExtraBeesSpecies.WHITE, 5);
+ new ExtraBeeMutation(ForestryAllele.BeeSpecies.Marshy.getAllele(), ForestryAllele.BeeSpecies.Valiant.getAllele(), ExtraBeesSpecies.BROWN, 5);
+
+ new ExtraBeeMutation(ExtraBeesSpecies.RED, ExtraBeesSpecies.YELLOW, ExtraBeesSpecies.ORANGE, 5);
+ new ExtraBeeMutation(ExtraBeesSpecies.GREEN, ExtraBeesSpecies.BLUE, ExtraBeesSpecies.CYAN, 5);
+ new ExtraBeeMutation(ExtraBeesSpecies.RED, ExtraBeesSpecies.BLUE, ExtraBeesSpecies.PURPLE, 5);
+ new ExtraBeeMutation(ExtraBeesSpecies.BLACK, ExtraBeesSpecies.WHITE, ExtraBeesSpecies.GRAY, 5);
+ new ExtraBeeMutation(ExtraBeesSpecies.BLUE, ExtraBeesSpecies.WHITE, ExtraBeesSpecies.LIGHTBLUE, 5);
+ new ExtraBeeMutation(ExtraBeesSpecies.RED, ExtraBeesSpecies.WHITE, ExtraBeesSpecies.PINK, 5);
+ new ExtraBeeMutation(ExtraBeesSpecies.GREEN, ExtraBeesSpecies.WHITE, ExtraBeesSpecies.LIMEGREEN, 5);
+
+ new ExtraBeeMutation(ExtraBeesSpecies.PURPLE, ExtraBeesSpecies.PINK, ExtraBeesSpecies.MAGENTA, 5);
+ new ExtraBeeMutation(ExtraBeesSpecies.GRAY, ExtraBeesSpecies.WHITE, ExtraBeesSpecies.LIGHTGRAY, 5);
+
+
+
+
+ new ExtraBeeMutation(ExtraBeesSpecies.TEMPERED, ExtraBeesSpecies.EXCITED, ExtraBeesSpecies.GLOWSTONE, 5);
+
+
+
+
+ new ExtraBeeMutation(ForestryAllele.BeeSpecies.Austere.getAllele(), ExtraBeesSpecies.DESOLATE, ExtraBeesSpecies.HAZARDOUS, 5);
+
+ new ExtraBeeMutation(ForestryAllele.BeeSpecies.Ended.getAllele(), ExtraBeesSpecies.RELIC, ExtraBeesSpecies.JADED, 2, new RequirementPerson("jadedcat"));
+ new ExtraBeeMutation(ForestryAllele.BeeSpecies.Austere.getAllele(), ExtraBeesSpecies.EXCITED, ExtraBeesSpecies.CELEBRATORY, 5);
+
+ new ExtraBeeMutation(ForestryAllele.BeeSpecies.Secluded.getAllele(), ForestryAllele.BeeSpecies.Ended.getAllele(), ExtraBeesSpecies.UNUSUAL, 5);
+ new ExtraBeeMutation(ExtraBeesSpecies.UNUSUAL, ForestryAllele.BeeSpecies.Hermitic.getAllele(), ExtraBeesSpecies.SPATIAL, 5);
+ new ExtraBeeMutation(ExtraBeesSpecies.SPATIAL, ForestryAllele.BeeSpecies.Spectral.getAllele(), ExtraBeesSpecies.QUANTUM, 5);
+
+ new ExtraBeeMutation(ForestryAllele.BeeSpecies.Noble.getAllele(), ForestryAllele.BeeSpecies.Monastic.getAllele(), ExtraBeesSpecies.MYSTICAL, 5);
+ for (IBeeMutation mutation : mutations) {
+ Binnie.Genetics.getBeeRoot().registerMutation(mutation);
+ }
+ }
+
+ public static List<IBeeMutation> mutations = new ArrayList();
+ MutationRequirement req;
+
+ public ExtraBeeMutation(IAlleleBeeSpecies allele0, IAlleleBeeSpecies allele1, ExtraBeesSpecies mutation, int chance)
+ {
+ this(allele0, allele1, mutation.getTemplate(), chance, null);
+ }
+
+ public ExtraBeeMutation(IAlleleBeeSpecies allele0, IAlleleBeeSpecies allele1, ExtraBeesSpecies mutation, int chance, MutationRequirement req)
+ {
+ this(allele0, allele1, mutation.getTemplate(), chance, req);
+ }
+
+ public ExtraBeeMutation(IAlleleBeeSpecies allele0, IAlleleBeeSpecies allele1, IAllele[] mutation, int chance)
+ {
+ this(allele0, allele1, mutation, chance, null);
+ }
+
+ public ExtraBeeMutation(IAlleleBeeSpecies allele0, IAlleleBeeSpecies allele1, IAllele[] mutation, int chance, MutationRequirement req)
+ {
+ this.chance = chance;
+ this.req = req;
+ this.species0 = allele0;
+ this.species1 = allele1;
+ this.template = mutation;
+ if ((this.species0 != null) && (this.species1 != null) && (this.template != null)) {
+ mutations.add(this);
+ }
+ }
+
+ IAlleleBeeSpecies species0 = null;
+ IAlleleBeeSpecies species1 = null;
+ IAllele[] template = new IAllele[0];
+ int chance = 80;
+
+ public IAllele getAllele0()
+ {
+ return this.species0;
+ }
+
+ public IAllele getAllele1()
+ {
+ return this.species1;
+ }
+
+ public IAllele[] getTemplate()
+ {
+ return this.template;
+ }
+
+ public float getBaseChance()
+ {
+ return this.chance;
+ }
+
+ public boolean isPartner(IAllele allele)
+ {
+ return (allele.getUID().equals(this.species0.getUID())) || (allele.getUID().equals(this.species1.getUID()));
+ }
+
+ public IAllele getPartner(IAllele allele)
+ {
+ return allele.getUID().equals(this.species0.getUID()) ? this.species1 : this.species0;
+ }
+
+ public boolean isSecret()
+ {
+ return false;
+ }
+
+ public float getChance(IBeeHousing housing, IAlleleBeeSpecies allele0, IAlleleBeeSpecies allele1, IBeeGenome genome0, IBeeGenome genome1)
+ {
+ return getChance(housing, allele0, allele1, genome0, genome1);
+ }
+
+ public float getChance(IBeeHousing housing, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1)
+ {
+ if ((this.species0 == null) || (this.species1 == null) || (allele0 == null) || (allele1 == null)) {
+ return 0.0F;
+ }
+ World world = housing.getWorld();
+ int x = housing.getXCoord();
+ int y = housing.getYCoord();
+ int z = housing.getZCoord();
+ BiomeGenBase biome = housing.getBiome();
+ if ((this.req != null) && (!this.req.fufilled(housing, allele0, allele1, genome0, genome1))) {
+ return 0.0F;
+ }
+ int processedChance = Math.round(this.chance * housing.getMutationModifier((IBeeGenome)genome0, (IBeeGenome)genome1, 1.0F) * Binnie.Genetics.getBeeRoot().getBeekeepingMode(world).getMutationModifier((IBeeGenome)genome0, (IBeeGenome)genome1, 1.0F));
+ if ((this.species0.getUID().equals(allele0.getUID())) && (this.species1.getUID().equals(allele1.getUID()))) {
+ return processedChance;
+ }
+ if ((this.species1.getUID().equals(allele0.getUID())) && (this.species0.getUID().equals(allele1.getUID()))) {
+ return processedChance;
+ }
+ return 0.0F;
+ }
+
+ public Collection<String> getSpecialConditions()
+ {
+ List<String> conditions = new ArrayList();
+ if (this.req != null) {
+ for (String s : this.req.tooltip()) {
+ conditions.add(s);
+ }
+ }
+ return conditions;
+ }
+
+ public IBeeRoot getRoot()
+ {
+ return Binnie.Genetics.getBeeRoot();
+ }
+
+ static abstract class MutationRequirement
+ {
+ public abstract String[] tooltip();
+
+ public abstract boolean fufilled(IBeeHousing paramIBeeHousing, IAllele paramIAllele1, IAllele paramIAllele2, IGenome paramIGenome1, IGenome paramIGenome2);
+ }
+
+ static class RequirementBiomeType
+ extends ExtraBeeMutation.MutationRequirement
+ {
+ BiomeDictionary.Type type;
+
+ public RequirementBiomeType(BiomeDictionary.Type type)
+ {
+ this.type = type;
+ }
+
+ public String[] tooltip()
+ {
+ return new String[] { "Is restricted to " + this.type + "-like biomes." };
+ }
+
+ public boolean fufilled(IBeeHousing housing, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1)
+ {
+ return BiomeDictionary.isBiomeOfType(housing.getBiome(), this.type);
+ }
+ }
+
+ static class RequirementPerson
+ extends ExtraBeeMutation.MutationRequirement
+ {
+ String name;
+
+ public RequirementPerson(String name)
+ {
+ this.name = name;
+ }
+
+ public String[] tooltip()
+ {
+ return new String[] { "Can only be bred by " + this.name };
+ }
+
+ public boolean fufilled(IBeeHousing housing, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1)
+ {
+ return (housing.getOwnerName() != null) && (housing.getOwnerName().equals(this.name));
+ }
+ }
+}
diff --git a/src/Java/binnie/extrabees/genetics/ExtraBeesBranch.java b/src/Java/binnie/extrabees/genetics/ExtraBeesBranch.java
new file mode 100644
index 0000000000..de978231c6
--- /dev/null
+++ b/src/Java/binnie/extrabees/genetics/ExtraBeesBranch.java
@@ -0,0 +1,313 @@
+package binnie.extrabees.genetics;
+
+import binnie.extrabees.ExtraBees;
+import binnie.extrabees.proxy.ExtraBeesProxy;
+import forestry.api.apiculture.IAlleleBeeSpecies;
+import forestry.api.genetics.AlleleManager;
+import forestry.api.genetics.IAlleleRegistry;
+import forestry.api.genetics.IAlleleSpecies;
+import forestry.api.genetics.IClassification;
+import forestry.api.genetics.IClassification.EnumClassLevel;
+import java.util.LinkedHashSet;
+import java.util.Set;
+
+public enum ExtraBeesBranch
+ implements IClassification
+{
+ BARREN("Vacapis"), HOSTILE("Infenapis"), ROCKY("Monapis"), METALLIC("Lamminapis"), METALLIC2("Metalapis"), ALLOY("Allapis"), PRECIOUS("Pluriapis"), MINERAL("Niphapis"), GEMSTONE("Gemmapis"), NUCLEAR("Levapis"), HISTORIC("Priscapis"), FOSSILIZED("Fosiapis"), REFINED("Petrapis"), AQUATIC("Aquapis"), SACCHARINE("Sacchapis"), CLASSICAL("Grecapis"), VOLCANIC("Irrapis"), VIRULENT("Virapis"), VISCOUS("Viscapis"), CAUSTIC("Morbapis"), ENERGETIC("Incitapis"), FARMING("Agriapis"), SHADOW("Pullapis"), PRIMARY("Primapis"), SECONDARY("Secapis"), TERTIARY("Tertiapis"), FTB("Eftebeapis"), QUANTUM("Quantapis"), BOTANIA("Botaniapis");
+
+ private String uid = "";
+ private String scientific = "";
+ private Set<IAlleleBeeSpecies> speciesSet = new LinkedHashSet();
+ IClassification parent;
+
+ public String getUID()
+ {
+ return "extrabees.genus." + this.uid;
+ }
+
+ public String getName()
+ {
+ return ExtraBees.proxy.localise("branch." + toString().toLowerCase() + ".name");
+ }
+
+ public String getScientific()
+ {
+ return this.scientific;
+ }
+
+ public String getDescription()
+ {
+ return ExtraBees.proxy.localiseOrBlank("branch." + toString().toLowerCase() + ".desc");
+ }
+
+ private ExtraBeesBranch(String scientific)
+ {
+ this.scientific = scientific;
+ this.uid = toString().toLowerCase();
+ }
+
+ public void register()
+ {
+ if (!this.speciesSet.isEmpty())
+ {
+ AlleleManager.alleleRegistry.registerClassification(this);
+ IClassification parent = AlleleManager.alleleRegistry.getClassification("family.apidae");
+ if (parent != null)
+ {
+ parent.addMemberGroup(this);
+ setParent(parent);
+ }
+ }
+ }
+
+ public static void doInit()
+ {
+ IClassification frozenBranch = AlleleManager.alleleRegistry.getClassification("genus.bees.frozen");
+ if (frozenBranch != null)
+ {
+ frozenBranch.addMemberSpecies(ExtraBeesSpecies.ARTIC);
+ ExtraBeesSpecies.ARTIC.setBranch(frozenBranch);
+ frozenBranch.addMemberSpecies(ExtraBeesSpecies.FREEZING);
+ ExtraBeesSpecies.FREEZING.setBranch(frozenBranch);
+ }
+ IClassification agrarianBranch = AlleleManager.alleleRegistry.getClassification("genus.bees.agrarian");
+ if (agrarianBranch != null)
+ {
+ agrarianBranch.addMemberSpecies(ExtraBeesSpecies.FARM);
+ ExtraBeesSpecies.FARM.setBranch(agrarianBranch);
+ ExtraBeesSpecies.GROWING.setBranch(agrarianBranch);
+ ExtraBeesSpecies.THRIVING.setBranch(agrarianBranch);
+ ExtraBeesSpecies.BLOOMING.setBranch(agrarianBranch);
+ }
+ IClassification boggyBranch = AlleleManager.alleleRegistry.getClassification("genus.bees.boggy");
+ if (boggyBranch != null)
+ {
+ boggyBranch.addMemberSpecies(ExtraBeesSpecies.SWAMP);
+ boggyBranch.addMemberSpecies(ExtraBeesSpecies.BOGGY);
+ boggyBranch.addMemberSpecies(ExtraBeesSpecies.FUNGAL);
+ ExtraBeesSpecies.SWAMP.setBranch(boggyBranch);
+ ExtraBeesSpecies.BOGGY.setBranch(boggyBranch);
+ ExtraBeesSpecies.FUNGAL.setBranch(boggyBranch);
+ }
+ IClassification festiveBranch = AlleleManager.alleleRegistry.getClassification("genus.bees.festive");
+ if (festiveBranch != null)
+ {
+ festiveBranch.addMemberSpecies(ExtraBeesSpecies.CELEBRATORY);
+ ExtraBeesSpecies.CELEBRATORY.setBranch(festiveBranch);
+ }
+ IClassification austereBranch = AlleleManager.alleleRegistry.getClassification("genus.bees.austere");
+ if (austereBranch != null)
+ {
+ austereBranch.addMemberSpecies(ExtraBeesSpecies.HAZARDOUS);
+ ExtraBeesSpecies.HAZARDOUS.setBranch(austereBranch);
+ }
+ FARMING.addMemberSpecies(ExtraBeesSpecies.ALCOHOL);
+ FARMING.addMemberSpecies(ExtraBeesSpecies.MILK);
+ FARMING.addMemberSpecies(ExtraBeesSpecies.COFFEE);
+ FARMING.addMemberSpecies(ExtraBeesSpecies.CITRUS);
+ FARMING.addMemberSpecies(ExtraBeesSpecies.MINT);
+ FARMING.register();
+
+ BARREN.addMemberSpecies(ExtraBeesSpecies.ARID);
+ BARREN.addMemberSpecies(ExtraBeesSpecies.BARREN);
+ BARREN.addMemberSpecies(ExtraBeesSpecies.DESOLATE);
+ BARREN.addMemberSpecies(ExtraBeesSpecies.DECOMPOSING);
+ BARREN.addMemberSpecies(ExtraBeesSpecies.GNAWING);
+ BARREN.register();
+
+ HOSTILE.addMemberSpecies(ExtraBeesSpecies.ROTTEN);
+ HOSTILE.addMemberSpecies(ExtraBeesSpecies.BONE);
+ HOSTILE.addMemberSpecies(ExtraBeesSpecies.CREEPER);
+ HOSTILE.register();
+
+ ROCKY.addMemberSpecies(ExtraBeesSpecies.ROCK);
+ ROCKY.addMemberSpecies(ExtraBeesSpecies.STONE);
+ ROCKY.addMemberSpecies(ExtraBeesSpecies.GRANITE);
+ ROCKY.addMemberSpecies(ExtraBeesSpecies.MINERAL);
+ ROCKY.register();
+
+ METALLIC.addMemberSpecies(ExtraBeesSpecies.IRON);
+ METALLIC.addMemberSpecies(ExtraBeesSpecies.COPPER);
+ METALLIC.addMemberSpecies(ExtraBeesSpecies.TIN);
+ METALLIC.addMemberSpecies(ExtraBeesSpecies.LEAD);
+ METALLIC.register();
+
+ METALLIC2.addMemberSpecies(ExtraBeesSpecies.NICKEL);
+ METALLIC2.addMemberSpecies(ExtraBeesSpecies.ZINC);
+ METALLIC2.addMemberSpecies(ExtraBeesSpecies.TUNGSTATE);
+ METALLIC2.addMemberSpecies(ExtraBeesSpecies.TITANIUM);
+ METALLIC2.register();
+
+ ALLOY.addMemberSpecies(ExtraBeesSpecies.BRONZE);
+ ALLOY.addMemberSpecies(ExtraBeesSpecies.BRASS);
+ ALLOY.addMemberSpecies(ExtraBeesSpecies.STEEL);
+ ALLOY.addMemberSpecies(ExtraBeesSpecies.INVAR);
+ ALLOY.register();
+
+ PRECIOUS.addMemberSpecies(ExtraBeesSpecies.SILVER);
+ PRECIOUS.addMemberSpecies(ExtraBeesSpecies.GOLD);
+ PRECIOUS.addMemberSpecies(ExtraBeesSpecies.ELECTRUM);
+ PRECIOUS.addMemberSpecies(ExtraBeesSpecies.PLATINUM);
+ PRECIOUS.register();
+
+ MINERAL.addMemberSpecies(ExtraBeesSpecies.LAPIS);
+ MINERAL.addMemberSpecies(ExtraBeesSpecies.SODALITE);
+ MINERAL.addMemberSpecies(ExtraBeesSpecies.PYRITE);
+ MINERAL.addMemberSpecies(ExtraBeesSpecies.BAUXITE);
+ MINERAL.addMemberSpecies(ExtraBeesSpecies.CINNABAR);
+ MINERAL.addMemberSpecies(ExtraBeesSpecies.SPHALERITE);
+ MINERAL.register();
+
+ GEMSTONE.addMemberSpecies(ExtraBeesSpecies.EMERALD);
+ GEMSTONE.addMemberSpecies(ExtraBeesSpecies.RUBY);
+ GEMSTONE.addMemberSpecies(ExtraBeesSpecies.SAPPHIRE);
+ GEMSTONE.addMemberSpecies(ExtraBeesSpecies.OLIVINE);
+ GEMSTONE.addMemberSpecies(ExtraBeesSpecies.DIAMOND);
+ GEMSTONE.register();
+
+ NUCLEAR.addMemberSpecies(ExtraBeesSpecies.UNSTABLE);
+ NUCLEAR.addMemberSpecies(ExtraBeesSpecies.NUCLEAR);
+ NUCLEAR.addMemberSpecies(ExtraBeesSpecies.RADIOACTIVE);
+ NUCLEAR.addMemberSpecies(ExtraBeesSpecies.YELLORIUM);
+ NUCLEAR.addMemberSpecies(ExtraBeesSpecies.CYANITE);
+ NUCLEAR.addMemberSpecies(ExtraBeesSpecies.BLUTONIUM);
+ NUCLEAR.register();
+
+ HISTORIC.addMemberSpecies(ExtraBeesSpecies.ANCIENT);
+ HISTORIC.addMemberSpecies(ExtraBeesSpecies.PRIMEVAL);
+ HISTORIC.addMemberSpecies(ExtraBeesSpecies.PREHISTORIC);
+ HISTORIC.addMemberSpecies(ExtraBeesSpecies.RELIC);
+ HISTORIC.register();
+
+ FOSSILIZED.addMemberSpecies(ExtraBeesSpecies.COAL);
+ FOSSILIZED.addMemberSpecies(ExtraBeesSpecies.RESIN);
+ FOSSILIZED.addMemberSpecies(ExtraBeesSpecies.OIL);
+ FOSSILIZED.addMemberSpecies(ExtraBeesSpecies.PEAT);
+ FOSSILIZED.register();
+
+ REFINED.addMemberSpecies(ExtraBeesSpecies.DISTILLED);
+ REFINED.addMemberSpecies(ExtraBeesSpecies.FUEL);
+ REFINED.addMemberSpecies(ExtraBeesSpecies.CREOSOTE);
+ REFINED.addMemberSpecies(ExtraBeesSpecies.LATEX);
+ REFINED.register();
+
+ AQUATIC.addMemberSpecies(ExtraBeesSpecies.WATER);
+ AQUATIC.addMemberSpecies(ExtraBeesSpecies.RIVER);
+ AQUATIC.addMemberSpecies(ExtraBeesSpecies.OCEAN);
+ AQUATIC.addMemberSpecies(ExtraBeesSpecies.INK);
+ AQUATIC.register();
+
+ SACCHARINE.addMemberSpecies(ExtraBeesSpecies.SWEET);
+ SACCHARINE.addMemberSpecies(ExtraBeesSpecies.SUGAR);
+ SACCHARINE.addMemberSpecies(ExtraBeesSpecies.FRUIT);
+ SACCHARINE.addMemberSpecies(ExtraBeesSpecies.RIPENING);
+ SACCHARINE.register();
+
+ CLASSICAL.addMemberSpecies(ExtraBeesSpecies.MARBLE);
+ CLASSICAL.addMemberSpecies(ExtraBeesSpecies.ROMAN);
+ CLASSICAL.addMemberSpecies(ExtraBeesSpecies.GREEK);
+ CLASSICAL.addMemberSpecies(ExtraBeesSpecies.CLASSICAL);
+ CLASSICAL.register();
+
+ VOLCANIC.addMemberSpecies(ExtraBeesSpecies.BASALT);
+ VOLCANIC.addMemberSpecies(ExtraBeesSpecies.TEMPERED);
+ VOLCANIC.addMemberSpecies(ExtraBeesSpecies.ANGRY);
+ VOLCANIC.addMemberSpecies(ExtraBeesSpecies.VOLCANIC);
+ VOLCANIC.addMemberSpecies(ExtraBeesSpecies.GLOWSTONE);
+ VOLCANIC.register();
+
+ VISCOUS.addMemberSpecies(ExtraBeesSpecies.VISCOUS);
+ VISCOUS.addMemberSpecies(ExtraBeesSpecies.GLUTINOUS);
+ VISCOUS.addMemberSpecies(ExtraBeesSpecies.STICKY);
+ VISCOUS.register();
+
+ VIRULENT.addMemberSpecies(ExtraBeesSpecies.MALICIOUS);
+ VIRULENT.addMemberSpecies(ExtraBeesSpecies.INFECTIOUS);
+ VIRULENT.addMemberSpecies(ExtraBeesSpecies.VIRULENT);
+ VIRULENT.register();
+
+ CAUSTIC.addMemberSpecies(ExtraBeesSpecies.CORROSIVE);
+ CAUSTIC.addMemberSpecies(ExtraBeesSpecies.CAUSTIC);
+ CAUSTIC.addMemberSpecies(ExtraBeesSpecies.ACIDIC);
+ CAUSTIC.register();
+
+ ENERGETIC.addMemberSpecies(ExtraBeesSpecies.EXCITED);
+ ENERGETIC.addMemberSpecies(ExtraBeesSpecies.ENERGETIC);
+ ENERGETIC.addMemberSpecies(ExtraBeesSpecies.ECSTATIC);
+ ENERGETIC.register();
+
+ SHADOW.addMemberSpecies(ExtraBeesSpecies.SHADOW);
+ SHADOW.addMemberSpecies(ExtraBeesSpecies.DARKENED);
+ SHADOW.addMemberSpecies(ExtraBeesSpecies.ABYSS);
+ SHADOW.register();
+
+ PRIMARY.addMemberSpecies(ExtraBeesSpecies.RED);
+ PRIMARY.addMemberSpecies(ExtraBeesSpecies.YELLOW);
+ PRIMARY.addMemberSpecies(ExtraBeesSpecies.BLUE);
+ PRIMARY.addMemberSpecies(ExtraBeesSpecies.GREEN);
+ PRIMARY.addMemberSpecies(ExtraBeesSpecies.BLACK);
+ PRIMARY.addMemberSpecies(ExtraBeesSpecies.WHITE);
+ PRIMARY.addMemberSpecies(ExtraBeesSpecies.BROWN);
+ PRIMARY.register();
+
+ SECONDARY.addMemberSpecies(ExtraBeesSpecies.ORANGE);
+ SECONDARY.addMemberSpecies(ExtraBeesSpecies.CYAN);
+ SECONDARY.addMemberSpecies(ExtraBeesSpecies.PURPLE);
+ SECONDARY.addMemberSpecies(ExtraBeesSpecies.GRAY);
+ SECONDARY.addMemberSpecies(ExtraBeesSpecies.LIGHTBLUE);
+ SECONDARY.addMemberSpecies(ExtraBeesSpecies.PINK);
+ SECONDARY.addMemberSpecies(ExtraBeesSpecies.LIMEGREEN);
+ SECONDARY.register();
+
+ TERTIARY.addMemberSpecies(ExtraBeesSpecies.MAGENTA);
+ TERTIARY.addMemberSpecies(ExtraBeesSpecies.LIGHTGRAY);
+ TERTIARY.register();
+
+ FTB.addMemberSpecies(ExtraBeesSpecies.JADED);
+ FTB.register();
+
+ QUANTUM.addMemberSpecies(ExtraBeesSpecies.UNUSUAL);
+ QUANTUM.addMemberSpecies(ExtraBeesSpecies.SPATIAL);
+ QUANTUM.addMemberSpecies(ExtraBeesSpecies.QUANTUM);
+ QUANTUM.register();
+
+ BOTANIA.addMemberSpecies(ExtraBeesSpecies.MYSTICAL);
+ BOTANIA.register();
+ }
+
+ public IClassification.EnumClassLevel getLevel()
+ {
+ return IClassification.EnumClassLevel.GENUS;
+ }
+
+ public IClassification[] getMemberGroups()
+ {
+ return null;
+ }
+
+ public void addMemberGroup(IClassification group) {}
+
+ public IAlleleSpecies[] getMemberSpecies()
+ {
+ return (IAlleleSpecies[])this.speciesSet.toArray(new IAlleleSpecies[0]);
+ }
+
+ public void addMemberSpecies(IAlleleSpecies species)
+ {
+ this.speciesSet.add((IAlleleBeeSpecies)species);
+ if ((species instanceof ExtraBeesSpecies)) {
+ ((ExtraBeesSpecies)species).setBranch(this);
+ }
+ }
+
+ public IClassification getParent()
+ {
+ return this.parent;
+ }
+
+ public void setParent(IClassification parent)
+ {
+ this.parent = parent;
+ }
+}
diff --git a/src/Java/binnie/extrabees/genetics/ExtraBeesFlowers.java b/src/Java/binnie/extrabees/genetics/ExtraBeesFlowers.java
new file mode 100644
index 0000000000..743c7a55a8
--- /dev/null
+++ b/src/Java/binnie/extrabees/genetics/ExtraBeesFlowers.java
@@ -0,0 +1,202 @@
+package binnie.extrabees.genetics;
+
+import binnie.core.Mods;
+import binnie.core.Mods.Mod;
+import binnie.extrabees.ExtraBees;
+import binnie.extrabees.proxy.ExtraBeesProxy;
+import forestry.api.genetics.AlleleManager;
+import forestry.api.genetics.IAlleleFlowers;
+import forestry.api.genetics.IAlleleRegistry;
+import forestry.api.genetics.IFlower;
+import forestry.api.genetics.IFlowerProvider;
+import forestry.api.genetics.IFruitBearer;
+import forestry.api.genetics.IIndividual;
+import forestry.api.genetics.IPollinatable;
+import java.util.ArrayList;
+import java.util.EnumSet;
+import java.util.List;
+import java.util.Random;
+import net.minecraft.block.Block;
+import net.minecraft.block.material.Material;
+import net.minecraft.init.Blocks;
+import net.minecraft.init.Items;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.world.World;
+import net.minecraftforge.common.EnumPlantType;
+
+public enum ExtraBeesFlowers
+ implements IFlowerProvider, IAlleleFlowers
+{
+ WATER, SUGAR, ROCK, BOOK, DEAD, REDSTONE, WOOD, LEAVES, Sapling, Fruit, Mystical;
+
+ boolean dominant = true;
+
+ private ExtraBeesFlowers() {}
+
+ public String getUID()
+ {
+ return "extrabees.flower." + toString().toLowerCase();
+ }
+
+ public boolean isDominant()
+ {
+ return this.dominant;
+ }
+
+ public IFlowerProvider getProvider()
+ {
+ return this;
+ }
+
+ public String getDescription()
+ {
+ return ExtraBees.proxy.localise("flowers." + name().toString().toLowerCase() + ".name");
+ }
+
+ public void register()
+ {
+ AlleleManager.alleleRegistry.registerAllele(this);
+ }
+
+ public static void doInit()
+ {
+ for (ExtraBeesFlowers effect : ) {
+ effect.register();
+ }
+ }
+
+ public ItemStack[] getItemStacks()
+ {
+ switch (1.$SwitchMap$binnie$extrabees$genetics$ExtraBeesFlowers[ordinal()])
+ {
+ case 1:
+ return new ItemStack[] { new ItemStack(Blocks.waterlily) };
+ case 2:
+ return new ItemStack[] { new ItemStack(Blocks.reeds) };
+ case 3:
+ return new ItemStack[] { new ItemStack(Blocks.cobblestone) };
+ case 4:
+ return new ItemStack[] { new ItemStack(Blocks.bookshelf) };
+ case 5:
+ return new ItemStack[] { new ItemStack(Blocks.redstone_torch) };
+ case 6:
+ return new ItemStack[] { new ItemStack(Blocks.deadbush) };
+ case 7:
+ return new ItemStack[] { new ItemStack(Items.apple) };
+ case 8:
+ return new ItemStack[] { new ItemStack(Blocks.leaves) };
+ case 9:
+ return new ItemStack[] { new ItemStack(Blocks.sapling) };
+ case 10:
+ return new ItemStack[] { new ItemStack(Blocks.log) };
+ }
+ return new ItemStack[0];
+ }
+
+ public boolean isAcceptedPollinatable(World world, IPollinatable pollinatable)
+ {
+ EnumSet<EnumPlantType> types = pollinatable.getPlantType();
+ return (types.size() > 1) || (!types.contains(EnumPlantType.Nether));
+ }
+
+ public boolean isAcceptedFlower(World world, IIndividual individual, int x, int y, int z)
+ {
+ Block block = world.getBlock(x, y, z);
+ if (block == null) {
+ return false;
+ }
+ switch (1.$SwitchMap$binnie$extrabees$genetics$ExtraBeesFlowers[ordinal()])
+ {
+ case 1:
+ return block == Blocks.waterlily;
+ case 3:
+ return block.getMaterial() == Material.rock;
+ case 2:
+ return block == Blocks.reeds;
+ case 4:
+ return block == Blocks.bookshelf;
+ case 5:
+ return block == Blocks.redstone_torch;
+ case 6:
+ return block == Blocks.deadbush;
+ case 10:
+ return block.isWood(world, x, y, z);
+ case 7:
+ return world.getTileEntity(x, y, z) instanceof IFruitBearer;
+ case 8:
+ return block.isLeaves(world, x, y, z);
+ case 9:
+ return block.getClass().getName().toLowerCase().contains("sapling");
+ case 11:
+ return block == Mods.Botania.block("flower");
+ }
+ return false;
+ }
+
+ public boolean growFlower(World world, IIndividual individual, int x, int y, int z)
+ {
+ switch (1.$SwitchMap$binnie$extrabees$genetics$ExtraBeesFlowers[ordinal()])
+ {
+ case 1:
+ if ((world.isAirBlock(x, y, z)) && (world.getBlock(x, y - 1, z) == Blocks.water)) {
+ return world.setBlock(x, y, z, Blocks.waterlily, 0, 2);
+ }
+ return false;
+ case 2:
+ if ((world.getBlock(x, y - 1, z) == Blocks.reeds) && (world.isAirBlock(x, y, z))) {
+ return world.setBlock(x, y, z, Blocks.reeds, 0, 0);
+ }
+ return false;
+ }
+ return false;
+ }
+
+ public ItemStack[] affectProducts(World world, IIndividual individual, int x, int y, int z, ItemStack[] products)
+ {
+ if (this == Mystical)
+ {
+ List<ItemStack> prods = new ArrayList();
+ for (ItemStack stack : products) {
+ prods.add(stack);
+ }
+ for (int k = 0; k < 50; k++)
+ {
+ int tX = 7;
+ int tY = 7;
+ int tZ = 3;
+ int x2 = x - tX + world.rand.nextInt(1 + 2 * tX);
+ int y2 = y - tY + world.rand.nextInt(1 + 2 * tY);
+ int z2 = z - tZ + world.rand.nextInt(1 + 2 * tZ);
+ Block block = world.getBlock(x2, y2, z2);
+ if (block != null) {
+ if (block == Mods.Botania.block("flower"))
+ {
+ int meta = world.getBlockMetadata(x2, y2, z2);
+ Item item = Mods.Botania.item("petal");
+ if (item != null) {
+ prods.add(new ItemStack(item, 1, meta));
+ }
+ }
+ }
+ }
+ return (ItemStack[])prods.toArray(new ItemStack[0]);
+ }
+ return products;
+ }
+
+ public String getName()
+ {
+ return getDescription();
+ }
+
+ public String getUnlocalizedName()
+ {
+ return getUID();
+ }
+
+ public List<IFlower> getFlowers()
+ {
+ return new ArrayList();
+ }
+}
diff --git a/src/Java/binnie/extrabees/genetics/ExtraBeesSpecies.java b/src/Java/binnie/extrabees/genetics/ExtraBeesSpecies.java
new file mode 100644
index 0000000000..cc166a3644
--- /dev/null
+++ b/src/Java/binnie/extrabees/genetics/ExtraBeesSpecies.java
@@ -0,0 +1,1139 @@
+package binnie.extrabees.genetics;
+
+import binnie.Binnie;
+import binnie.core.BinnieCore;
+import binnie.core.Mods;
+import binnie.core.Mods.Mod;
+import binnie.core.genetics.ForestryAllele.BeeSpecies;
+import binnie.core.genetics.ForestryAllele.Fertility;
+import binnie.core.genetics.ForestryAllele.Flowering;
+import binnie.core.genetics.ForestryAllele.Lifespan;
+import binnie.core.genetics.ForestryAllele.Speed;
+import binnie.core.genetics.ForestryAllele.Territory;
+import binnie.core.genetics.ManagerGenetics;
+import binnie.core.genetics.Tolerance;
+import binnie.core.item.IItemEnum;
+import binnie.core.proxy.BinnieProxy;
+import binnie.extrabees.ExtraBees;
+import binnie.extrabees.genetics.effect.ExtraBeesEffect;
+import binnie.extrabees.products.EnumHoneyComb;
+import binnie.extrabees.products.ItemHoneyComb.VanillaComb;
+import binnie.extrabees.proxy.ExtraBeesProxy;
+import com.mojang.authlib.GameProfile;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import forestry.api.apiculture.EnumBeeChromosome;
+import forestry.api.apiculture.EnumBeeType;
+import forestry.api.apiculture.IAlleleBeeEffect;
+import forestry.api.apiculture.IAlleleBeeSpecies;
+import forestry.api.apiculture.IBeeGenome;
+import forestry.api.apiculture.IBeeHousing;
+import forestry.api.apiculture.IBeeRoot;
+import forestry.api.core.EnumHumidity;
+import forestry.api.core.EnumTemperature;
+import forestry.api.core.IIconProvider;
+import forestry.api.genetics.AlleleManager;
+import forestry.api.genetics.IAllele;
+import forestry.api.genetics.IAlleleFlowers;
+import forestry.api.genetics.IAlleleRegistry;
+import forestry.api.genetics.IAlleleSpecies;
+import forestry.api.genetics.IClassification;
+import forestry.api.genetics.IIndividual;
+import forestry.api.genetics.IMutation;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Random;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.init.Items;
+import net.minecraft.item.ItemStack;
+import net.minecraft.stats.Achievement;
+import net.minecraft.util.IIcon;
+import net.minecraft.world.World;
+
+public enum ExtraBeesSpecies
+ implements IAlleleBeeSpecies, IIconProvider
+{
+ ARID("aridus", 12511316), BARREN("infelix", 14733923), DESOLATE("desolo", 13744272), GNAWING("apica", 15234224), ROTTEN("caries", 12574902), BONE("os", 15330792), CREEPER("erepo", 2942485), DECOMPOSING("aegrus", 5388049), ROCK("saxum", 11053224), STONE("lapis", 7697781), GRANITE("granum", 6903125), MINERAL("minerale", 7239037), COPPER("cuprous", 13722376), TIN("stannus", 12431805), IRON("ferrous", 11038808), LEAD("plumbous", 11373483), ZINC("spelta", 15592447), TITANIUM("titania", 11578083), BRONZE, BRASS, STEEL, TUNGSTATE("wolfram", 1249812), GOLD("aureus", 15125515), SILVER("argentus", 14408667), ELECTRUM, PLATINUM("platina", 14408667), LAPIS("lazuli", 4009179), SODALITE, PYRITE, BAUXITE, CINNABAR, SPHALERITE, EMERALD("emerala", 1900291), RUBY("ruba", 14024704), SAPPHIRE("saphhira", 673791), OLIVINE, DIAMOND("diama", 8371706), UNSTABLE("levis", 4099124), NUCLEAR("nucleus", 4312111), RADIOACTIVE("fervens", 2031360), ANCIENT("antiquus", 15915919), PRIMEVAL("priscus", 11773563), PREHISTORIC("pristinus", 7232064), RELIC("sapiens", 5062166), COAL("carbo", 8025672), RESIN("lacrima", 10908443), OIL("lubricus", 5719920), PEAT, DISTILLED("distilli", 3498838), FUEL("refina", 16760835), CREOSOTE("creosota", 9936403), LATEX("latex", 4803134), WATER("aqua", 9741055), RIVER("flumen", 8631252), OCEAN("mare", 1912493), INK("atramentum", 922695), GROWING("tyrelli", 6024152), THRIVING("thriva", 3466109), BLOOMING("blooma", 704308), SWEET("mellitus", 16536049), SUGAR("dulcis", 15127520), RIPENING("ripa", 11716445), FRUIT("pomum", 14375030), ALCOHOL("vinum", 15239777), FARM("ager", 7723872), MILK("lacteus", 14936296), COFFEE("arabica", 9199152), CITRUS, MINT, SWAMP("paludis", 3500339), BOGGY("lama", 7887913), FUNGAL("boletus", 13722112), MARBLE, ROMAN, GREEK, CLASSICAL, BASALT("aceri", 9202025), TEMPERED("iratus", 9062472), ANGRY, VOLCANIC("volcano", 5049356), MALICIOUS("acerbus", 7875191), INFECTIOUS("contagio", 12070581), VIRULENT("morbus", 15733740), VISCOUS("liquidus", 608014), GLUTINOUS("glutina", 1936423), STICKY("lentesco", 1565480), CORROSIVE("corrumpo", 4873227), CAUSTIC("torrens", 8691997), ACIDIC("acidus", 12644374), EXCITED("excita", 16729413), ENERGETIC("energia", 15218119), ECSTATIC("ecstatica", 11482600), ARTIC("artica", 11395296), FREEZING("glacia", 8119267), SHADOW("shadowa", 5855577), DARKENED("darka", 3354163), ABYSS("abyssba", 2164769), RED("rubra", 16711680), YELLOW("fulvus", 16768256), BLUE("caeruleus", 8959), GREEN("prasinus", 39168), BLACK("niger", 5723991), WHITE("albus", 16777215), BROWN("fuscus", 6042895), ORANGE("flammeus", 16751872), CYAN("cyana", 65509), PURPLE("purpureus", 11403519), GRAY("ravus", 12237498), LIGHTBLUE("aqua", 40447), PINK("rosaceus", 16744671), LIMEGREEN("lima", 65288), MAGENTA("fuchsia", 16711884), LIGHTGRAY("canus", 13224393), CELEBRATORY("celeba", 16386666), JADED("jadeca", 16386666), GLOWSTONE("glowia", 14730779), HAZARDOUS("infensus", 11562024), NICKEL("claro", 16768764), INVAR, QUANTUM("quanta", 3655131), SPATIAL("spatia", 4987872), UNUSUAL("daniella", 5874874), YELLORIUM("yellori", 14019840), CYANITE("cyanita", 34541), BLUTONIUM("caruthus", 1769702), MYSTICAL("mystica", 4630306);
+
+ private ExtraBeesSpecies(String binomial, int colour)
+ {
+ this.uid = toString().toLowerCase();
+ this.binomial = binomial;
+ this.primaryColor = colour;
+ }
+
+ private ExtraBeesSpecies()
+ {
+ this.state = State.Deprecated;
+ }
+
+ private int primaryColor = 16777215;
+ private int secondaryColor = 16768022;
+ private EnumTemperature temperature = EnumTemperature.NORMAL;
+ private EnumHumidity humidity = EnumHumidity.NORMAL;
+ private boolean hasEffect = false;
+ private boolean isSecret = true;
+ private boolean isCounted = true;
+ private String binomial = "";
+ private IClassification branch = null;
+ private String uid = "";
+ private Achievement achievement = null;
+ private boolean dominant = true;
+ private HashMap<ItemStack, Integer> products = new LinkedHashMap();
+ private HashMap<ItemStack, Integer> specialties = new LinkedHashMap();
+ public HashMap<ItemStack, Integer> allProducts = new LinkedHashMap();
+ public HashMap<ItemStack, Integer> allSpecialties = new LinkedHashMap();
+ private IAllele[] template;
+
+ public static enum State
+ {
+ Active, Inactive, Deprecated;
+
+ private State() {}
+ }
+
+ public State state = State.Active;
+ @SideOnly(Side.CLIENT)
+ private IIcon[][] icons;
+
+ public String getName()
+ {
+ return ExtraBees.proxy.localise("species." + name().toLowerCase() + ".name");
+ }
+
+ public String getDescription()
+ {
+ return ExtraBees.proxy.localiseOrBlank("species." + name().toLowerCase() + ".desc");
+ }
+
+ public EnumTemperature getTemperature()
+ {
+ return this.temperature;
+ }
+
+ public EnumHumidity getHumidity()
+ {
+ return this.humidity;
+ }
+
+ public boolean hasEffect()
+ {
+ return this.hasEffect;
+ }
+
+ public boolean isSecret()
+ {
+ return this.isSecret;
+ }
+
+ public boolean isCounted()
+ {
+ return this.isCounted;
+ }
+
+ public String getBinomial()
+ {
+ return this.binomial;
+ }
+
+ public String getAuthority()
+ {
+ return "Binnie";
+ }
+
+ public IClassification getBranch()
+ {
+ return this.branch;
+ }
+
+ public String getUID()
+ {
+ return "extrabees.species." + this.uid;
+ }
+
+ public boolean isDominant()
+ {
+ return this.dominant;
+ }
+
+ public HashMap<ItemStack, Integer> getProducts()
+ {
+ return this.products;
+ }
+
+ public HashMap<ItemStack, Integer> getSpecialty()
+ {
+ return this.specialties;
+ }
+
+ private void setState(State state)
+ {
+ this.state = state;
+ }
+
+ public void registerTemplate()
+ {
+ Binnie.Genetics.getBeeRoot().registerTemplate(getTemplate());
+ if (this.state != State.Active) {
+ AlleleManager.alleleRegistry.blacklistAllele(getUID());
+ }
+ }
+
+ public void addProduct(ItemStack product, int chance)
+ {
+ if (product == null)
+ {
+ setState(State.Inactive);
+ }
+ else
+ {
+ this.products.put(product, Integer.valueOf(chance));
+ this.allProducts.put(product, Integer.valueOf(chance));
+ }
+ }
+
+ public void addProduct(IItemEnum product, int chance)
+ {
+ if (product.isActive())
+ {
+ addProduct(product.get(1), chance);
+ }
+ else
+ {
+ this.allProducts.put(product.get(1), Integer.valueOf(chance));
+ setState(State.Inactive);
+ }
+ }
+
+ public void addSpecialty(ItemStack product, int chance)
+ {
+ if (product == null)
+ {
+ setState(State.Inactive);
+ }
+ else
+ {
+ this.specialties.put(product, Integer.valueOf(chance));
+ this.allSpecialties.put(product, Integer.valueOf(chance));
+ }
+ }
+
+ private void addSpecialty(IItemEnum product, int chance)
+ {
+ if (product.isActive())
+ {
+ addSpecialty(product.get(1), chance);
+ }
+ else
+ {
+ setState(State.Inactive);
+ this.allSpecialties.put(product.get(1), Integer.valueOf(chance));
+ }
+ }
+
+ private void setHumidity(EnumHumidity humidity)
+ {
+ this.humidity = humidity;
+ }
+
+ private void setTemperature(EnumTemperature temperature)
+ {
+ this.temperature = temperature;
+ }
+
+ public static IAllele[] getDefaultTemplate()
+ {
+ return Binnie.Genetics.getBeeRoot().getDefaultTemplate();
+ }
+
+ public IAllele[] getTemplate()
+ {
+ this.template[EnumBeeChromosome.SPECIES.ordinal()] = this;
+ return this.template;
+ }
+
+ public void importTemplate(ForestryAllele.BeeSpecies species)
+ {
+ importTemplate(species.getTemplate());
+ }
+
+ public void importTemplate(ExtraBeesSpecies species)
+ {
+ importTemplate(species.getTemplate());
+ }
+
+ public void importTemplate(IAllele[] template)
+ {
+ this.template = ((IAllele[])template.clone());
+ setHumidity(((IAlleleSpecies)template[0]).getHumidity());
+ setTemperature(((IAlleleSpecies)template[0]).getTemperature());
+ setSecondaryColor(((IAlleleSpecies)template[0]).getIconColour(1));
+ this.template[EnumBeeChromosome.SPECIES.ordinal()] = this;
+ }
+
+ public void recessive()
+ {
+ this.dominant = false;
+ }
+
+ public void setIsSecret(boolean secret)
+ {
+ this.isSecret = secret;
+ }
+
+ public void setHasEffect(boolean effect)
+ {
+ this.hasEffect = effect;
+ }
+
+ public void setSecondaryColor(int colour)
+ {
+ this.secondaryColor = colour;
+ }
+
+ public static void doInit()
+ {
+ for (ExtraBeesSpecies species : ) {
+ species.template = getDefaultTemplate();
+ }
+ int aridBody = 13362036;
+ int rockBody = 10066329;
+ int endBody = 14278302;
+
+ ARID.importTemplate(ForestryAllele.BeeSpecies.Modest);
+ ARID.addProduct(EnumHoneyComb.BARREN, 30);
+ ARID.setHumidity(EnumHumidity.ARID);
+ ARID.setFlowerProvider(ExtraBeesFlowers.DEAD.getUID());
+ ARID.setTemperatureTolerance(Tolerance.Up1);
+ ARID.setSecondaryColor(aridBody);
+
+ BARREN.importTemplate(ARID);
+ BARREN.setFertility(ForestryAllele.Fertility.Low);
+ BARREN.addProduct(EnumHoneyComb.BARREN, 30);
+
+ DESOLATE.addProduct(EnumHoneyComb.BARREN, 30);
+ DESOLATE.importTemplate(BARREN);
+ DESOLATE.setEffect(ExtraBeesEffect.HUNGER.getUID());
+ DESOLATE.recessive();
+ DESOLATE.setNocturnal();
+ DESOLATE.setHasEffect(true);
+
+ GNAWING.importTemplate(BARREN);
+ GNAWING.setFlowerProvider(ExtraBeesFlowers.WOOD.getUID());
+ GNAWING.addProduct(EnumHoneyComb.BARREN, 25);
+ GNAWING.addSpecialty(EnumHoneyComb.SAWDUST, 25);
+
+ ROTTEN.importTemplate(DESOLATE);
+ ROTTEN.setNocturnal();
+ ROTTEN.setCaveDwelling();
+ ROTTEN.setTolerantFlyer();
+ ROTTEN.setEffect(ExtraBeesEffect.SPAWN_ZOMBIE.getUID());
+ ROTTEN.addProduct(EnumHoneyComb.BARREN, 30);
+ ROTTEN.addSpecialty(EnumHoneyComb.ROTTEN, 10);
+
+ BONE.importTemplate(ROTTEN);
+ BONE.addProduct(EnumHoneyComb.BARREN, 30);
+ BONE.addSpecialty(EnumHoneyComb.BONE, 10);
+ BONE.setEffect(ExtraBeesEffect.SPAWN_SKELETON.getUID());
+
+ CREEPER.importTemplate(ROTTEN);
+ CREEPER.setAllDay();
+ CREEPER.addProduct(EnumHoneyComb.BARREN, 30);
+ CREEPER.addSpecialty(ItemHoneyComb.VanillaComb.POWDERY.get(), 8);
+ CREEPER.setEffect(ExtraBeesEffect.SPAWN_CREEPER.getUID());
+
+ DECOMPOSING.importTemplate(BARREN);
+ DECOMPOSING.addProduct(EnumHoneyComb.BARREN, 30);
+ DECOMPOSING.addSpecialty(EnumHoneyComb.COMPOST, 8);
+
+ ROCK.addProduct(EnumHoneyComb.STONE, 30);
+ ROCK.setIsSecret(false);
+ ROCK.setAllDay();
+ ROCK.setCaveDwelling();
+ ROCK.setTolerantFlyer();
+ ROCK.setTemperatureTolerance(Tolerance.Both1);
+ ROCK.setHumidityTolerance(Tolerance.Both1);
+ ROCK.setFlowerProvider(ExtraBeesFlowers.ROCK.getUID());
+ ROCK.setFertility(ForestryAllele.Fertility.Low);
+ ROCK.setLifespan(ForestryAllele.Lifespan.Short);
+ ROCK.setSecondaryColor(rockBody);
+
+ STONE.addProduct(EnumHoneyComb.STONE, 30);
+ STONE.importTemplate(ROCK);
+ STONE.recessive();
+ STONE.setSecondaryColor(rockBody);
+
+ GRANITE.addProduct(EnumHoneyComb.STONE, 30);
+ GRANITE.importTemplate(STONE);
+ GRANITE.setTemperatureTolerance(Tolerance.Both2);
+ GRANITE.setHumidityTolerance(Tolerance.Both2);
+ GRANITE.setSecondaryColor(rockBody);
+
+ MINERAL.addProduct(EnumHoneyComb.STONE, 30);
+ MINERAL.importTemplate(GRANITE);
+ MINERAL.setSecondaryColor(rockBody);
+
+
+
+ COPPER.addProduct(EnumHoneyComb.STONE, 20);
+ COPPER.addSpecialty(EnumHoneyComb.COPPER, 6);
+ COPPER.importTemplate(MINERAL);
+ COPPER.setSecondaryColor(rockBody);
+
+ TIN.addProduct(EnumHoneyComb.STONE, 20);
+ TIN.addSpecialty(EnumHoneyComb.TIN, 6);
+ TIN.importTemplate(MINERAL);
+ TIN.setSecondaryColor(rockBody);
+
+ IRON.addProduct(EnumHoneyComb.STONE, 20);
+ IRON.addSpecialty(EnumHoneyComb.IRON, 5);
+ IRON.importTemplate(MINERAL);
+ IRON.recessive();
+ IRON.setSecondaryColor(rockBody);
+
+ LEAD.addProduct(EnumHoneyComb.STONE, 20);
+ LEAD.addSpecialty(EnumHoneyComb.LEAD, 5);
+ LEAD.importTemplate(MINERAL);
+ LEAD.setSecondaryColor(rockBody);
+
+ NICKEL.addProduct(EnumHoneyComb.STONE, 20);
+ NICKEL.addSpecialty(EnumHoneyComb.NICKEL, 5);
+ NICKEL.importTemplate(MINERAL);
+ NICKEL.setSecondaryColor(rockBody);
+
+
+
+ ZINC.addProduct(EnumHoneyComb.STONE, 20);
+ ZINC.addSpecialty(EnumHoneyComb.ZINC, 5);
+ ZINC.importTemplate(MINERAL);
+ ZINC.setSecondaryColor(rockBody);
+
+ TITANIUM.addProduct(EnumHoneyComb.STONE, 20);
+ TITANIUM.addSpecialty(EnumHoneyComb.TITANIUM, 2);
+ TITANIUM.importTemplate(MINERAL);
+ TITANIUM.setSecondaryColor(rockBody);
+
+ TUNGSTATE.addProduct(EnumHoneyComb.STONE, 20);
+ TUNGSTATE.addSpecialty(EnumHoneyComb.TUNGSTEN, 1);
+ TUNGSTATE.importTemplate(MINERAL);
+ TUNGSTATE.setSecondaryColor(rockBody);
+
+
+
+
+ GOLD.addProduct(EnumHoneyComb.STONE, 20);
+ GOLD.addSpecialty(EnumHoneyComb.GOLD, 2);
+ GOLD.importTemplate(MINERAL);
+ GOLD.setSecondaryColor(rockBody);
+
+ SILVER.addProduct(EnumHoneyComb.STONE, 20);
+ SILVER.addSpecialty(EnumHoneyComb.SILVER, 2);
+ SILVER.importTemplate(MINERAL);
+ SILVER.recessive();
+ SILVER.recessive();
+ SILVER.setSecondaryColor(rockBody);
+
+ PLATINUM.addProduct(EnumHoneyComb.STONE, 20);
+ PLATINUM.addSpecialty(EnumHoneyComb.PLATINUM, 1);
+ PLATINUM.importTemplate(MINERAL);
+ PLATINUM.recessive();
+ PLATINUM.setSecondaryColor(rockBody);
+
+
+ LAPIS.addProduct(EnumHoneyComb.STONE, 20);
+ LAPIS.addSpecialty(EnumHoneyComb.LAPIS, 5);
+ LAPIS.importTemplate(MINERAL);
+ LAPIS.setSecondaryColor(rockBody);
+
+ EMERALD.addProduct(EnumHoneyComb.STONE, 20);
+ EMERALD.addSpecialty(EnumHoneyComb.EMERALD, 4);
+ EMERALD.importTemplate(MINERAL);
+ EMERALD.setSecondaryColor(rockBody);
+
+ RUBY.addProduct(EnumHoneyComb.STONE, 20);
+ RUBY.addSpecialty(EnumHoneyComb.RUBY, 3);
+ RUBY.importTemplate(MINERAL);
+ RUBY.setSecondaryColor(rockBody);
+
+ SAPPHIRE.addProduct(EnumHoneyComb.STONE, 20);
+ SAPPHIRE.addSpecialty(EnumHoneyComb.SAPPHIRE, 3);
+ SAPPHIRE.importTemplate(MINERAL);
+ SAPPHIRE.setSecondaryColor(rockBody);
+
+ DIAMOND.addProduct(EnumHoneyComb.STONE, 20);
+ DIAMOND.addSpecialty(EnumHoneyComb.DIAMOND, 1);
+ DIAMOND.importTemplate(MINERAL);
+ DIAMOND.setSecondaryColor(rockBody);
+
+ UNSTABLE.importTemplate(MINERAL);
+ UNSTABLE.addProduct(EnumHoneyComb.BARREN, 20);
+ UNSTABLE.setEffect(ExtraBeesEffect.RADIOACTIVE.getUID());
+ UNSTABLE.setFertility(ForestryAllele.Fertility.Low);
+ UNSTABLE.setLifespan(ForestryAllele.Lifespan.Shortest);
+ UNSTABLE.recessive();
+
+ NUCLEAR.importTemplate(UNSTABLE);
+ NUCLEAR.addProduct(EnumHoneyComb.BARREN, 20);
+ NUCLEAR.recessive();
+
+ RADIOACTIVE.importTemplate(NUCLEAR);
+ RADIOACTIVE.addProduct(EnumHoneyComb.BARREN, 20);
+ RADIOACTIVE.addSpecialty(EnumHoneyComb.URANIUM, 2);
+ RADIOACTIVE.setHasEffect(true);
+ RADIOACTIVE.recessive();
+
+ ANCIENT.importTemplate(ForestryAllele.BeeSpecies.Noble);
+ ANCIENT.addProduct(EnumHoneyComb.OLD, 30);
+ ANCIENT.setLifespan(ForestryAllele.Lifespan.Elongated);
+
+ PRIMEVAL.importTemplate(ANCIENT);
+ PRIMEVAL.addProduct(EnumHoneyComb.OLD, 30);
+ PRIMEVAL.setLifespan(ForestryAllele.Lifespan.Long);
+
+ PREHISTORIC.importTemplate(ANCIENT);
+ PREHISTORIC.addProduct(EnumHoneyComb.OLD, 30);
+ PREHISTORIC.setLifespan(ForestryAllele.Lifespan.Longer);
+ PREHISTORIC.setFertility(ForestryAllele.Fertility.Low);
+ PREHISTORIC.recessive();
+
+ RELIC.importTemplate(ANCIENT);
+ RELIC.addProduct(EnumHoneyComb.OLD, 30);
+ RELIC.setHasEffect(true);
+ RELIC.setLifespan(ForestryAllele.Lifespan.Longest);
+
+ COAL.importTemplate(ANCIENT);
+ COAL.setLifespan(ForestryAllele.Lifespan.Normal);
+ COAL.addProduct(EnumHoneyComb.OLD, 20);
+ COAL.addSpecialty(EnumHoneyComb.COAL, 8);
+
+ RESIN.importTemplate(COAL);
+ RESIN.addProduct(EnumHoneyComb.OLD, 20);
+ RESIN.addSpecialty(EnumHoneyComb.RESIN, 5);
+ RESIN.recessive();
+
+ OIL.importTemplate(COAL);
+ OIL.addProduct(EnumHoneyComb.OLD, 20);
+ OIL.addSpecialty(EnumHoneyComb.OIL, 5);
+
+
+
+
+
+
+ DISTILLED.importTemplate(OIL);
+ DISTILLED.addProduct(EnumHoneyComb.OIL, 10);
+ DISTILLED.recessive();
+
+ FUEL.importTemplate(OIL);
+ FUEL.addProduct(EnumHoneyComb.OIL, 10);
+ FUEL.addSpecialty(EnumHoneyComb.FUEL, 4);
+ FUEL.setHasEffect(true);
+
+ CREOSOTE.importTemplate(COAL);
+ CREOSOTE.addProduct(EnumHoneyComb.COAL, 10);
+ CREOSOTE.addSpecialty(EnumHoneyComb.CREOSOTE, 7);
+ CREOSOTE.setHasEffect(true);
+
+ LATEX.importTemplate(RESIN);
+ LATEX.addProduct(EnumHoneyComb.RESIN, 10);
+ LATEX.addSpecialty(EnumHoneyComb.LATEX, 5);
+ LATEX.setHasEffect(true);
+
+ WATER.addProduct(EnumHoneyComb.WATER, 30);
+ WATER.setIsSecret(false);
+ WATER.setTolerantFlyer();
+ WATER.setHumidityTolerance(Tolerance.Both1);
+ WATER.setFlowerProvider(ExtraBeesFlowers.WATER.getUID());
+ WATER.setFlowering(ForestryAllele.Flowering.Slow);
+ WATER.setEffect(ExtraBeesEffect.WATER.getUID());
+ WATER.setHumidity(EnumHumidity.DAMP);
+
+ RIVER.importTemplate(WATER);
+ RIVER.addProduct(EnumHoneyComb.WATER, 30);
+ RIVER.addSpecialty(EnumHoneyComb.CLAY, 20);
+ RIVER.importTemplate(WATER);
+
+ OCEAN.importTemplate(WATER);
+ OCEAN.addProduct(EnumHoneyComb.WATER, 30);
+ OCEAN.importTemplate(WATER);
+ OCEAN.recessive();
+
+ INK.importTemplate(OCEAN);
+ INK.addProduct(EnumHoneyComb.WATER, 30);
+ INK.addSpecialty(new ItemStack(Items.dye, 1, 0), 10);
+
+ GROWING.importTemplate(ForestryAllele.BeeSpecies.Forest);
+ GROWING.addProduct(ItemHoneyComb.VanillaComb.HONEY.get(), 35);
+ GROWING.setFlowering(ForestryAllele.Flowering.Average);
+ GROWING.setFlowerProvider(ExtraBeesFlowers.LEAVES.getUID());
+
+ THRIVING.importTemplate(GROWING);
+ THRIVING.addProduct(ItemHoneyComb.VanillaComb.HONEY.get(), 35);
+ THRIVING.setFlowering(ForestryAllele.Flowering.Fast);
+
+ BLOOMING.importTemplate(THRIVING);
+ BLOOMING.setFlowering(ForestryAllele.Flowering.Fastest);
+ BLOOMING.addProduct(ItemHoneyComb.VanillaComb.HONEY.get(), 35);
+ BLOOMING.setFlowerProvider(ExtraBeesFlowers.Sapling.getUID());
+ BLOOMING.setEffect(ExtraBeesEffect.BonemealSapling.getUID());
+
+ SWEET.importTemplate(ForestryAllele.BeeSpecies.Rural);
+ SWEET.addProduct(ItemHoneyComb.VanillaComb.HONEY.get(), 40);
+ SWEET.addProduct(new ItemStack(Items.sugar, 1, 0), 10);
+ SWEET.setFlowerProvider(ExtraBeesFlowers.SUGAR.getUID());
+
+ SUGAR.addProduct(ItemHoneyComb.VanillaComb.HONEY.get(), 40);
+ SUGAR.addProduct(new ItemStack(Items.sugar, 1, 0), 20);
+ SUGAR.importTemplate(SWEET);
+
+ RIPENING.addProduct(ItemHoneyComb.VanillaComb.HONEY.get(), 30);
+ RIPENING.addProduct(new ItemStack(Items.sugar, 1, 0), 10);
+ RIPENING.addSpecialty(EnumHoneyComb.FRUIT, 10);
+ RIPENING.setFlowerProvider(ExtraBeesFlowers.Fruit.getUID());
+ RIPENING.importTemplate(SUGAR);
+
+ FRUIT.importTemplate(RIPENING);
+ FRUIT.addProduct(ItemHoneyComb.VanillaComb.HONEY.get(), 30);
+ FRUIT.addProduct(new ItemStack(Items.sugar, 1, 0), 15);
+ FRUIT.addSpecialty(EnumHoneyComb.FRUIT, 20);
+ FRUIT.setEffect(ExtraBeesEffect.BonemealFruit.getUID());
+ FRUIT.setHasEffect(true);
+
+ ALCOHOL.importTemplate(SWEET);
+ ALCOHOL.addProduct(ItemHoneyComb.VanillaComb.WHEATEN.get(), 30);
+ ALCOHOL.addSpecialty(EnumHoneyComb.ALCOHOL, 10);
+ ALCOHOL.setEffect("forestry.effectDrunkard");
+ ALCOHOL.recessive();
+
+ FARM.addProduct(ItemHoneyComb.VanillaComb.WHEATEN.get(), 30);
+ FARM.addSpecialty(EnumHoneyComb.SEED, 10);
+ FARM.importTemplate(ForestryAllele.BeeSpecies.Rural);
+
+ MILK.addProduct(ItemHoneyComb.VanillaComb.WHEATEN.get(), 30);
+ MILK.addSpecialty(EnumHoneyComb.MILK, 10);
+ MILK.importTemplate(ForestryAllele.BeeSpecies.Rural);
+
+ COFFEE.addProduct(ItemHoneyComb.VanillaComb.WHEATEN.get(), 30);
+ COFFEE.addSpecialty(EnumHoneyComb.COFFEE, 8);
+ COFFEE.importTemplate(ForestryAllele.BeeSpecies.Rural);
+
+
+
+
+
+
+
+
+
+ SWAMP.addProduct(ItemHoneyComb.VanillaComb.MOSSY.get(), 30);
+ SWAMP.importTemplate(ForestryAllele.BeeSpecies.Marshy);
+ SWAMP.setHumidity(EnumHumidity.DAMP);
+ SWAMP.setEffect(ExtraBeesEffect.SLOW.getUID());
+
+ BOGGY.importTemplate(SWAMP);
+ BOGGY.addProduct(ItemHoneyComb.VanillaComb.MOSSY.get(), 30);
+ BOGGY.importTemplate(SWAMP);
+ BOGGY.recessive();
+
+ FUNGAL.importTemplate(BOGGY);
+ FUNGAL.addProduct(ItemHoneyComb.VanillaComb.MOSSY.get(), 30);
+ FUNGAL.addSpecialty(EnumHoneyComb.FUNGAL, 15);
+ FUNGAL.importTemplate(BOGGY);
+ FUNGAL.setEffect(ExtraBeesEffect.BonemealMushroom.getUID());
+ FUNGAL.setHasEffect(true);
+
+ BASALT.addProduct(ItemHoneyComb.VanillaComb.SIMMERING.get(), 25);
+ BASALT.importTemplate(ForestryAllele.BeeSpecies.Sinister);
+ BASALT.setEffect("forestry.effectAggressive");
+ BASALT.setSecondaryColor(10101539);
+ BASALT.setHumidity(EnumHumidity.ARID);
+ BASALT.setTemperature(EnumTemperature.HELLISH);
+
+ TEMPERED.addProduct(ItemHoneyComb.VanillaComb.SIMMERING.get(), 25);
+ TEMPERED.importTemplate(BASALT);
+ TEMPERED.setEffect(ExtraBeesEffect.METEOR.getUID());
+ TEMPERED.recessive();
+ TEMPERED.setSecondaryColor(10101539);
+
+ VOLCANIC.importTemplate(TEMPERED);
+ VOLCANIC.addProduct(ItemHoneyComb.VanillaComb.SIMMERING.get(), 25);
+ VOLCANIC.addSpecialty(EnumHoneyComb.BLAZE, 10);
+ VOLCANIC.setHasEffect(true);
+ VOLCANIC.setSecondaryColor(10101539);
+
+ MALICIOUS.importTemplate(ForestryAllele.BeeSpecies.Tropical);
+ MALICIOUS.addProduct(ItemHoneyComb.VanillaComb.SILKY.get(), 25);
+ MALICIOUS.setSecondaryColor(431972);
+ MALICIOUS.setHumidity(EnumHumidity.DAMP);
+ MALICIOUS.setTemperature(EnumTemperature.WARM);
+
+ INFECTIOUS.importTemplate(MALICIOUS);
+ INFECTIOUS.addProduct(ItemHoneyComb.VanillaComb.SILKY.get(), 25);
+ INFECTIOUS.setFlowering(ForestryAllele.Flowering.Slow);
+ INFECTIOUS.setSecondaryColor(431972);
+
+ VIRULENT.importTemplate(INFECTIOUS);
+ VIRULENT.addProduct(ItemHoneyComb.VanillaComb.SILKY.get(), 25);
+ VIRULENT.addSpecialty(EnumHoneyComb.VENOMOUS, 12);
+ VIRULENT.setFlowering(ForestryAllele.Flowering.Average);
+ VIRULENT.recessive();
+ VIRULENT.setHasEffect(true);
+ VIRULENT.setSecondaryColor(431972);
+
+ VISCOUS.importTemplate(ForestryAllele.BeeSpecies.Tropical);
+ VISCOUS.setEffect(ExtraBeesEffect.ECTOPLASM.getUID());
+ VISCOUS.addProduct(ItemHoneyComb.VanillaComb.SILKY.get(), 25);
+ VISCOUS.setSecondaryColor(431972);
+ VISCOUS.setHumidity(EnumHumidity.DAMP);
+ VISCOUS.setSpeed(ForestryAllele.Speed.Slow);
+ VISCOUS.setTemperature(EnumTemperature.WARM);
+
+ GLUTINOUS.importTemplate(VISCOUS);
+ GLUTINOUS.addProduct(ItemHoneyComb.VanillaComb.SILKY.get(), 25);
+ GLUTINOUS.setSpeed(ForestryAllele.Speed.Norm);
+ GLUTINOUS.setSecondaryColor(431972);
+
+ STICKY.importTemplate(GLUTINOUS);
+ STICKY.addProduct(ItemHoneyComb.VanillaComb.SILKY.get(), 25);
+ STICKY.addSpecialty(EnumHoneyComb.SLIME, 12);
+ STICKY.setSpeed(ForestryAllele.Speed.Fast);
+ STICKY.setHasEffect(true);
+ STICKY.setSecondaryColor(431972);
+
+ CORROSIVE.importTemplate(STICKY);
+ CORROSIVE.setHumidity(EnumHumidity.DAMP);
+ CORROSIVE.setTemperature(EnumTemperature.WARM);
+ CORROSIVE.setEffect(ExtraBeesEffect.ACID.getUID());
+ CORROSIVE.setFlowering(ForestryAllele.Flowering.Average);
+ CORROSIVE.addProduct(ItemHoneyComb.VanillaComb.SILKY.get(), 20);
+ CORROSIVE.recessive();
+ CORROSIVE.setSecondaryColor(431972);
+
+ CAUSTIC.importTemplate(CORROSIVE);
+ CAUSTIC.addProduct(ItemHoneyComb.VanillaComb.SILKY.get(), 25);
+ CAUSTIC.addSpecialty(EnumHoneyComb.ACIDIC, 3);
+ CAUSTIC.setSecondaryColor(431972);
+
+ ACIDIC.importTemplate(CAUSTIC);
+ ACIDIC.addProduct(ItemHoneyComb.VanillaComb.SILKY.get(), 20);
+ ACIDIC.addSpecialty(EnumHoneyComb.ACIDIC, 16);
+ ACIDIC.setHasEffect(true);
+ ACIDIC.setSecondaryColor(431972);
+
+ EXCITED.setEffect(ExtraBeesEffect.LIGHTNING.getUID());
+ EXCITED.addProduct(EnumHoneyComb.REDSTONE, 10);
+ EXCITED.setCaveDwelling();
+ EXCITED.setFlowerProvider(ExtraBeesFlowers.REDSTONE.getUID());
+
+ ENERGETIC.importTemplate(EXCITED);
+ ENERGETIC.setEffect(ExtraBeesEffect.LIGHTNING.getUID());
+ ENERGETIC.addProduct(EnumHoneyComb.REDSTONE, 12);
+ ENERGETIC.recessive();
+
+ ECSTATIC.importTemplate(ENERGETIC);
+ ECSTATIC.setEffect(ExtraBeesEffect.Power.getUID());
+ ECSTATIC.addProduct(EnumHoneyComb.REDSTONE, 20);
+ ECSTATIC.addSpecialty(EnumHoneyComb.IC2ENERGY, 8);
+ ECSTATIC.setHasEffect(true);
+
+ ARTIC.importTemplate(ForestryAllele.BeeSpecies.Wintry);
+ ARTIC.addProduct(ItemHoneyComb.VanillaComb.FROZEN.get(), 25);
+ ARTIC.setTemperature(EnumTemperature.ICY);
+ ARTIC.setSecondaryColor(14349811);
+
+ FREEZING.importTemplate(ARTIC);
+ FREEZING.addProduct(ItemHoneyComb.VanillaComb.FROZEN.get(), 20);
+ FREEZING.addSpecialty(EnumHoneyComb.GLACIAL, 10);
+ FREEZING.setSecondaryColor(14349811);
+
+ SHADOW.importTemplate(BASALT);
+ SHADOW.setNocturnal();
+ SHADOW.addProduct(EnumHoneyComb.SHADOW, 5);
+ SHADOW.setEffect(ExtraBeesEffect.BLINDNESS.getUID());
+ SHADOW.setAllDay(false);
+ SHADOW.recessive();
+ SHADOW.setSecondaryColor(3355443);
+
+ DARKENED.addProduct(EnumHoneyComb.SHADOW, 10);
+ DARKENED.setNocturnal();
+ DARKENED.importTemplate(SHADOW);
+ DARKENED.setSecondaryColor(3355443);
+
+ ABYSS.importTemplate(DARKENED);
+ ABYSS.setNocturnal();
+ ABYSS.addProduct(EnumHoneyComb.SHADOW, 25);
+ ABYSS.setEffect(ExtraBeesEffect.WITHER.getUID());
+ ABYSS.setHasEffect(true);
+ ABYSS.setSecondaryColor(3355443);
+
+ CELEBRATORY.importTemplate(ForestryAllele.BeeSpecies.Merry);
+ CELEBRATORY.setEffect(ExtraBeesEffect.FIREWORKS.getUID());
+
+ GLOWSTONE.importTemplate(BASALT);
+ GLOWSTONE.addProduct(EnumHoneyComb.GLOWSTONE, 15);
+ GLOWSTONE.setSecondaryColor(10101539);
+
+ HAZARDOUS.importTemplate(ForestryAllele.BeeSpecies.Austere);
+ HAZARDOUS.addProduct(EnumHoneyComb.SALTPETER, 12);
+
+ JADED.importTemplate(ForestryAllele.BeeSpecies.Imperial);
+ JADED.setFertility(ForestryAllele.Fertility.Maximum);
+ JADED.setFlowering(ForestryAllele.Flowering.Maximum);
+ JADED.setTerritory(ForestryAllele.Territory.Largest);
+ JADED.addProduct(ItemHoneyComb.VanillaComb.HONEY.get(), 30);
+ JADED.addSpecialty(Mods.Forestry.stack("pollen"), 20);
+ JADED.setHasEffect(true);
+ JADED.setSecondaryColor(14453483);
+
+ UNUSUAL.importTemplate(ForestryAllele.BeeSpecies.Ended);
+ UNUSUAL.setEffect(ExtraBeesEffect.GRAVITY.getUID());
+ UNUSUAL.setSecondaryColor(12231403);
+ UNUSUAL.addProduct(ItemHoneyComb.VanillaComb.QUARTZ.get(), 25);
+
+ SPATIAL.importTemplate(UNUSUAL);
+ SPATIAL.setEffect(ExtraBeesEffect.GRAVITY.getUID());
+ SPATIAL.setSecondaryColor(10768076);
+ SPATIAL.addProduct(ItemHoneyComb.VanillaComb.QUARTZ.get(), 25);
+ SPATIAL.addSpecialty(EnumHoneyComb.CERTUS, 5);
+
+ QUANTUM.importTemplate(QUANTUM);
+ QUANTUM.setEffect(ExtraBeesEffect.TELEPORT.getUID());
+ QUANTUM.setSecondaryColor(13963227);
+ QUANTUM.addProduct(ItemHoneyComb.VanillaComb.QUARTZ.get(), 25);
+ QUANTUM.addSpecialty(EnumHoneyComb.CERTUS, 15);
+ QUANTUM.addSpecialty(EnumHoneyComb.ENDERPEARL, 15);
+
+ JADED.addSpecialty(EnumHoneyComb.PURPLE, 15);
+ JADED.isCounted = false;
+
+ YELLORIUM.importTemplate(NUCLEAR);
+ YELLORIUM.addProduct(EnumHoneyComb.BARREN, 20);
+ YELLORIUM.addSpecialty(EnumHoneyComb.YELLORIUM, 2);
+ YELLORIUM.setEffect(ExtraBeesEffect.RADIOACTIVE.getUID());
+ YELLORIUM.setFertility(ForestryAllele.Fertility.Low);
+ YELLORIUM.setLifespan(ForestryAllele.Lifespan.Shortest);
+
+ CYANITE.importTemplate(YELLORIUM);
+ CYANITE.addProduct(EnumHoneyComb.BARREN, 20);
+ CYANITE.addSpecialty(EnumHoneyComb.CYANITE, 1);
+
+ BLUTONIUM.importTemplate(CYANITE);
+ BLUTONIUM.addProduct(EnumHoneyComb.BARREN, 20);
+ BLUTONIUM.addSpecialty(EnumHoneyComb.BLUTONIUM, 1);
+
+ MYSTICAL.importTemplate(ForestryAllele.BeeSpecies.Noble);
+ for (Map.Entry<ItemStack, Integer> entry : ForestryAllele.BeeSpecies.Noble.getAllele().getProducts().entrySet()) {
+ MYSTICAL.addProduct((ItemStack)entry.getKey(), ((Integer)entry.getValue()).intValue());
+ }
+ MYSTICAL.setFlowerProvider(ExtraBeesFlowers.Mystical.getUID());
+ for (ExtraBeesSpecies species : values())
+ {
+ if (species.state != State.Active) {
+ AlleleManager.alleleRegistry.blacklistAllele(species.getUID());
+ }
+ for (EnumBeeChromosome chromo : EnumBeeChromosome.values()) {
+ if (chromo != EnumBeeChromosome.HUMIDITY)
+ {
+ IAllele allele = species.template[chromo.ordinal()];
+ if ((allele == null) || (!chromo.getAlleleClass().isInstance(allele))) {
+ throw new RuntimeException(species.getName() + " has an invalid " + chromo.toString() + " chromosome!");
+ }
+ }
+ }
+ }
+ for (int i = 0; i < 16; i++)
+ {
+ ExtraBeesSpecies species = values()[(RED.ordinal() + i)];
+ EnumHoneyComb comb = EnumHoneyComb.values()[(EnumHoneyComb.RED.ordinal() + i)];
+ species.addProduct(ItemHoneyComb.VanillaComb.HONEY.get(), 75);
+ species.addSpecialty(comb, 25);
+ species.setSecondaryColor(9240320);
+ }
+ for (ExtraBeesSpecies species : values()) {
+ species.registerTemplate();
+ }
+ }
+
+ void setBranch(IClassification branch)
+ {
+ this.branch = branch;
+ }
+
+ public boolean isJubilant(World world, int biomeid, int x, int y, int z)
+ {
+ return true;
+ }
+
+ public boolean isJubilant(IBeeGenome genome, IBeeHousing housing)
+ {
+ return true;
+ }
+
+ public int getIconColour(int renderPass)
+ {
+ return renderPass == 1 ? this.secondaryColor : renderPass == 0 ? this.primaryColor : 16777215;
+ }
+
+ public IIconProvider getIconProvider()
+ {
+ return this;
+ }
+
+ public IIcon getIcon(short texUID)
+ {
+ return null;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void registerIcons(IIconRegister register)
+ {
+ String iconType = "default";
+ String mod = "forestry";
+ if (this == JADED)
+ {
+ iconType = "jaded";
+ mod = "extrabees";
+ }
+ this.icons = new IIcon[EnumBeeType.values().length][3];
+
+ IIcon body1 = BinnieCore.proxy.getIcon(register, mod, "bees/" + iconType + "/body1");
+ for (int i = 0; i < EnumBeeType.values().length; i++) {
+ if (EnumBeeType.values()[i] != EnumBeeType.NONE)
+ {
+ this.icons[i][0] = BinnieCore.proxy.getIcon(register, mod, "bees/" + iconType + "/" + EnumBeeType.values()[i].toString().toLowerCase(Locale.ENGLISH) + ".outline");
+
+
+ this.icons[i][1] = (EnumBeeType.values()[i] != EnumBeeType.LARVAE ? body1 : BinnieCore.proxy.getIcon(register, mod, "bees/" + iconType + "/" + EnumBeeType.values()[i].toString().toLowerCase(Locale.ENGLISH) + ".body"));
+
+ this.icons[i][2] = BinnieCore.proxy.getIcon(register, mod, "bees/" + iconType + "/" + EnumBeeType.values()[i].toString().toLowerCase(Locale.ENGLISH) + ".body2");
+ }
+ }
+ }
+
+ @SideOnly(Side.CLIENT)
+ public IIcon getIcon(EnumBeeType type, int renderPass)
+ {
+ if (this.icons == null) {
+ return ARID.getIcon(type, renderPass);
+ }
+ return this.icons[type.ordinal()][renderPass];
+ }
+
+ public IBeeRoot getRoot()
+ {
+ return Binnie.Genetics.getBeeRoot();
+ }
+
+ boolean nocturnal = false;
+
+ public boolean isNocturnal()
+ {
+ return this.nocturnal;
+ }
+
+ public void setNocturnal()
+ {
+ this.nocturnal = true;
+ }
+
+ public void setAllDay()
+ {
+ setAllDay(true);
+ }
+
+ public void setAllDay(boolean allDay)
+ {
+ if (allDay) {
+ this.template[EnumBeeChromosome.NOCTURNAL.ordinal()] = AlleleManager.alleleRegistry.getAllele("forestry.boolTrue");
+ } else {
+ this.template[EnumBeeChromosome.NOCTURNAL.ordinal()] = AlleleManager.alleleRegistry.getAllele("forestry.boolFalse");
+ }
+ }
+
+ public void setCaveDwelling()
+ {
+ this.template[EnumBeeChromosome.CAVE_DWELLING.ordinal()] = AlleleManager.alleleRegistry.getAllele("forestry.boolTrue");
+ }
+
+ public void setTolerantFlyer()
+ {
+ this.template[EnumBeeChromosome.TOLERANT_FLYER.ordinal()] = AlleleManager.alleleRegistry.getAllele("forestry.boolTrue");
+ }
+
+ public void setFlowerProvider(String uid)
+ {
+ IAllele allele = AlleleManager.alleleRegistry.getAllele(uid);
+ if ((allele instanceof IAlleleFlowers)) {
+ this.template[EnumBeeChromosome.FLOWER_PROVIDER.ordinal()] = allele;
+ }
+ }
+
+ public void setEffect(String uid)
+ {
+ IAllele allele = AlleleManager.alleleRegistry.getAllele(uid);
+ if ((allele instanceof IAlleleBeeEffect)) {
+ this.template[EnumBeeChromosome.EFFECT.ordinal()] = AlleleManager.alleleRegistry.getAllele(uid);
+ }
+ }
+
+ private void setFertility(ForestryAllele.Fertility fert)
+ {
+ this.template[EnumBeeChromosome.FERTILITY.ordinal()] = fert.getAllele();
+ }
+
+ private void setLifespan(ForestryAllele.Lifespan fert)
+ {
+ this.template[EnumBeeChromosome.LIFESPAN.ordinal()] = fert.getAllele();
+ }
+
+ private void setSpeed(ForestryAllele.Speed fert)
+ {
+ this.template[EnumBeeChromosome.SPEED.ordinal()] = fert.getAllele();
+ }
+
+ private void setTerritory(ForestryAllele.Territory fert)
+ {
+ this.template[EnumBeeChromosome.TERRITORY.ordinal()] = fert.getAllele();
+ }
+
+ private void setFlowering(ForestryAllele.Flowering fert)
+ {
+ this.template[EnumBeeChromosome.FLOWERING.ordinal()] = fert.getAllele();
+ }
+
+ private void setHumidityTolerance(Tolerance fert)
+ {
+ this.template[EnumBeeChromosome.HUMIDITY_TOLERANCE.ordinal()] = fert.getAllele();
+ }
+
+ private void setTemperatureTolerance(Tolerance both1)
+ {
+ this.template[EnumBeeChromosome.TEMPERATURE_TOLERANCE.ordinal()] = both1.getAllele();
+ }
+
+ public float getResearchSuitability(ItemStack itemstack)
+ {
+ if (itemstack == null) {
+ return 0.0F;
+ }
+ for (ItemStack stack : this.products.keySet()) {
+ if (stack.isItemEqual(itemstack)) {
+ return 1.0F;
+ }
+ }
+ for (ItemStack stack : this.specialties.keySet()) {
+ if (stack.isItemEqual(itemstack)) {
+ return 1.0F;
+ }
+ }
+ if (itemstack.getItem() == Items.glass_bottle) {
+ return 0.9F;
+ }
+ if (itemstack.getItem() == Mods.Forestry.item("honeyDrop")) {
+ return 0.5F;
+ }
+ if (itemstack.getItem() == Mods.Forestry.item("honeydew")) {
+ return 0.7F;
+ }
+ if (itemstack.getItem() == Mods.Forestry.item("beeComb")) {
+ return 0.4F;
+ }
+ if (AlleleManager.alleleRegistry.isIndividual(itemstack)) {
+ return 1.0F;
+ }
+ for (Map.Entry<ItemStack, Float> entry : getRoot().getResearchCatalysts().entrySet()) {
+ if (((ItemStack)entry.getKey()).isItemEqual(itemstack)) {
+ return ((Float)entry.getValue()).floatValue();
+ }
+ }
+ return 0.0F;
+ }
+
+ public ItemStack[] getResearchBounty(World world, GameProfile researcher, IIndividual individual, int bountyLevel)
+ {
+ ArrayList<ItemStack> bounty = new ArrayList();
+ ItemStack research = null;
+ if (world.rand.nextFloat() < 10.0F / bountyLevel)
+ {
+ Collection<? extends IMutation> combinations = getRoot().getCombinations(this);
+ if (combinations.size() > 0)
+ {
+ IMutation[] candidates = (IMutation[])combinations.toArray(new IMutation[0]);
+ research = AlleleManager.alleleRegistry.getMutationNoteStack(researcher, candidates[world.rand.nextInt(candidates.length)]);
+ }
+ }
+ if (research != null) {
+ bounty.add(research);
+ }
+ if (bountyLevel > 10) {
+ for (ItemStack stack : this.specialties.keySet())
+ {
+ ItemStack stack2 = stack.copy();
+ stack2.stackSize = (world.rand.nextInt((int)(bountyLevel / 2.0F)) + 1);
+ bounty.add(stack2);
+ }
+ }
+ for (ItemStack stack : this.products.keySet())
+ {
+ ItemStack stack2 = stack.copy();
+ stack2.stackSize = (world.rand.nextInt((int)(bountyLevel / 2.0F)) + 1);
+ bounty.add(stack2);
+ }
+ return (ItemStack[])bounty.toArray(new ItemStack[0]);
+ }
+
+ public String getEntityTexture()
+ {
+ return "/gfx/forestry/entities/bees/honeyBee.png";
+ }
+
+ public int getComplexity()
+ {
+ return 1 + getGeneticAdvancement(this, new ArrayList());
+ }
+
+ private int getGeneticAdvancement(IAllele species, ArrayList<IAllele> exclude)
+ {
+ int own = 1;
+ int highest = 0;
+ exclude.add(species);
+ for (IMutation mutation : getRoot().getPaths(species, EnumBeeChromosome.SPECIES))
+ {
+ if (!exclude.contains(mutation.getAllele0()))
+ {
+ int otherAdvance = getGeneticAdvancement(mutation.getAllele0(), exclude);
+ if (otherAdvance > highest) {
+ highest = otherAdvance;
+ }
+ }
+ if (!exclude.contains(mutation.getAllele1()))
+ {
+ int otherAdvance = getGeneticAdvancement(mutation.getAllele1(), exclude);
+ if (otherAdvance > highest) {
+ highest = otherAdvance;
+ }
+ }
+ }
+ return own + (highest < 0 ? 0 : highest);
+ }
+
+ public String getUnlocalizedName()
+ {
+ return getUID();
+ }
+
+ public Map<ItemStack, Float> getProductChances()
+ {
+ return null;
+ }
+
+ public Map<ItemStack, Float> getSpecialtyChances()
+ {
+ return null;
+ }
+}
diff --git a/src/Java/binnie/extrabees/genetics/ModuleGenetics.java b/src/Java/binnie/extrabees/genetics/ModuleGenetics.java
new file mode 100644
index 0000000000..626796266d
--- /dev/null
+++ b/src/Java/binnie/extrabees/genetics/ModuleGenetics.java
@@ -0,0 +1,88 @@
+package binnie.extrabees.genetics;
+
+import binnie.Binnie;
+import binnie.core.BinnieCore;
+import binnie.core.IInitializable;
+import binnie.core.genetics.ManagerGenetics;
+import binnie.core.liquid.ManagerLiquid;
+import binnie.core.proxy.BinnieProxy;
+import binnie.extrabees.ExtraBees;
+import binnie.extrabees.genetics.effect.BlockEctoplasm;
+import binnie.extrabees.genetics.effect.ExtraBeesEffect;
+import binnie.extrabees.genetics.items.ItemDictionary;
+import cpw.mods.fml.common.registry.GameRegistry;
+import forestry.api.apiculture.EnumBeeType;
+import forestry.api.apiculture.IAlleleBeeSpecies;
+import forestry.api.apiculture.IBee;
+import forestry.api.apiculture.IBeeGenome;
+import forestry.api.apiculture.IBeeRoot;
+import forestry.api.genetics.AlleleManager;
+import forestry.api.genetics.IAllele;
+import forestry.api.genetics.IAlleleRegistry;
+import forestry.api.genetics.IGenome;
+import forestry.api.recipes.ICarpenterManager;
+import forestry.api.recipes.RecipeManagers;
+import net.minecraft.init.Blocks;
+import net.minecraft.init.Items;
+import net.minecraft.item.ItemStack;
+
+public class ModuleGenetics
+ implements IInitializable
+{
+ public void preInit()
+ {
+ for (ExtraBeesSpecies species : ) {
+ AlleleManager.alleleRegistry.registerAllele(species);
+ }
+ ExtraBees.dictionary = new ItemDictionary();
+ ExtraBees.ectoplasm = new BlockEctoplasm();
+
+ GameRegistry.registerBlock(ExtraBees.ectoplasm, "ectoplasm");
+ }
+
+ public void init()
+ {
+ ExtraBeesEffect.doInit();
+ ExtraBeesFlowers.doInit();
+ ExtraBeesSpecies.doInit();
+ ExtraBeeMutation.doInit();
+ ExtraBeesBranch.doInit();
+ }
+
+ public void postInit()
+ {
+ int ebSpeciesCount = 0;
+ int ebTotalSpeciesCount = 0;
+ for (ExtraBeesSpecies species : ExtraBeesSpecies.values())
+ {
+ ebTotalSpeciesCount++;
+ if (!AlleleManager.alleleRegistry.isBlacklisted(species.getUID())) {
+ ebSpeciesCount++;
+ }
+ }
+ RecipeManagers.carpenterManager.addRecipe(100, Binnie.Liquid.getLiquidStack("water", 2000), null, new ItemStack(ExtraBees.dictionary), new Object[] { "X#X", "YEY", "RDR", Character.valueOf('#'), Blocks.glass_pane, Character.valueOf('X'), Items.gold_ingot, Character.valueOf('Y'), "ingotTin", Character.valueOf('R'), Items.redstone, Character.valueOf('D'), Items.diamond, Character.valueOf('E'), Items.emerald });
+ }
+
+ public static IGenome getGenome(IAlleleBeeSpecies allele0)
+ {
+ return Binnie.Genetics.getBeeRoot().templateAsGenome(Binnie.Genetics.getBeeRoot().getTemplate(allele0.getUID()));
+ }
+
+ public static ItemStack getBeeIcon(IAlleleBeeSpecies species)
+ {
+ if (species == null) {
+ return null;
+ }
+ IAllele[] template = Binnie.Genetics.getBeeRoot().getTemplate(species.getUID());
+ if (template == null) {
+ return null;
+ }
+ IBeeGenome genome = Binnie.Genetics.getBeeRoot().templateAsGenome(template);
+
+ IBee bee = Binnie.Genetics.getBeeRoot().getBee(BinnieCore.proxy.getWorld(), genome);
+
+ ItemStack item = Binnie.Genetics.getBeeRoot().getMemberStack(bee, EnumBeeType.PRINCESS.ordinal());
+
+ return item;
+ }
+}
diff --git a/src/Java/binnie/extrabees/genetics/effect/BlockEctoplasm.java b/src/Java/binnie/extrabees/genetics/effect/BlockEctoplasm.java
new file mode 100644
index 0000000000..2baf9ba2f1
--- /dev/null
+++ b/src/Java/binnie/extrabees/genetics/effect/BlockEctoplasm.java
@@ -0,0 +1,42 @@
+package binnie.extrabees.genetics.effect;
+
+import binnie.extrabees.ExtraBees;
+import binnie.extrabees.proxy.ExtraBeesProxy;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import java.util.Random;
+import net.minecraft.block.BlockWeb;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.init.Items;
+import net.minecraft.item.Item;
+
+public class BlockEctoplasm
+ extends BlockWeb
+{
+ @SideOnly(Side.CLIENT)
+ public void registerBlockIcons(IIconRegister register)
+ {
+ this.blockIcon = ExtraBees.proxy.getIcon(register, "ectoplasm");
+ }
+
+ public BlockEctoplasm()
+ {
+ setLightOpacity(1);
+ setHardness(0.5F);
+ }
+
+ public int quantityDropped(Random rand)
+ {
+ return rand.nextInt(5) == 0 ? 1 : 0;
+ }
+
+ public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_)
+ {
+ return Items.slime_ball;
+ }
+
+ public String getUnlocalizedName()
+ {
+ return "extrabees.block.ectoplasm";
+ }
+}
diff --git a/src/Java/binnie/extrabees/genetics/effect/EntityBeeLightning.java b/src/Java/binnie/extrabees/genetics/effect/EntityBeeLightning.java
new file mode 100644
index 0000000000..eef4f27a6b
--- /dev/null
+++ b/src/Java/binnie/extrabees/genetics/effect/EntityBeeLightning.java
@@ -0,0 +1,68 @@
+package binnie.extrabees.genetics.effect;
+
+import java.util.List;
+import java.util.Random;
+import net.minecraft.block.BlockFire;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.effect.EntityLightningBolt;
+import net.minecraft.init.Blocks;
+import net.minecraft.util.AxisAlignedBB;
+import net.minecraft.util.MathHelper;
+import net.minecraft.world.World;
+
+public class EntityBeeLightning
+ extends EntityLightningBolt
+{
+ int lightningState = 2;
+ int boltLivingTime;
+
+ public EntityBeeLightning(World par1World, double par2, double par4, double par6)
+ {
+ super(par1World, par2, par4, par6);
+ this.boltLivingTime = (this.rand.nextInt(3) + 1);
+ }
+
+ public void onUpdate()
+ {
+ onEntityUpdate();
+
+ this.lightningState -= 1;
+ if (this.lightningState < 0) {
+ if (this.boltLivingTime == 0)
+ {
+ setDead();
+ }
+ else if (this.lightningState < -this.rand.nextInt(10))
+ {
+ this.boltLivingTime -= 1;
+ this.lightningState = 1;
+ this.boltVertex = this.rand.nextLong();
+ if ((!this.worldObj.isRemote) && (this.worldObj.doChunksNearChunkExist(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ), 10)))
+ {
+ int i = MathHelper.floor_double(this.posX);
+ int j = MathHelper.floor_double(this.posY);
+ int k = MathHelper.floor_double(this.posZ);
+ if ((this.worldObj.getBlock(i, j, k) == null) && (Blocks.fire.canPlaceBlockAt(this.worldObj, i, j, k))) {
+ this.worldObj.setBlock(i, j, k, Blocks.fire);
+ }
+ }
+ }
+ }
+ if (this.lightningState >= 0) {
+ if (this.worldObj.isRemote)
+ {
+ this.worldObj.lastLightningBolt = 2;
+ }
+ else
+ {
+ double d0 = 3.0D;
+ List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, AxisAlignedBB.getBoundingBox(this.posX - d0, this.posY - d0, this.posZ - d0, this.posX + d0, this.posY + 6.0D + d0, this.posZ + d0));
+ for (int l = 0; l < list.size(); l++)
+ {
+ Entity entity = (Entity)list.get(l);
+ entity.onStruckByLightning(this);
+ }
+ }
+ }
+ }
+}
diff --git a/src/Java/binnie/extrabees/genetics/effect/ExtraBeesEffect.java b/src/Java/binnie/extrabees/genetics/effect/ExtraBeesEffect.java
new file mode 100644
index 0000000000..b36091ce91
--- /dev/null
+++ b/src/Java/binnie/extrabees/genetics/effect/ExtraBeesEffect.java
@@ -0,0 +1,585 @@
+package binnie.extrabees.genetics.effect;
+
+import binnie.Binnie;
+import binnie.core.liquid.ManagerLiquid;
+import binnie.extrabees.ExtraBees;
+import binnie.extrabees.genetics.ExtraBeesFlowers;
+import binnie.extrabees.proxy.ExtraBeesProxy;
+import cofh.api.energy.IEnergyReceiver;
+import forestry.api.apiculture.IAlleleBeeEffect;
+import forestry.api.apiculture.IAlleleBeeSpecies;
+import forestry.api.apiculture.IArmorApiarist;
+import forestry.api.apiculture.IBeeGenome;
+import forestry.api.apiculture.IBeeHousing;
+import forestry.api.genetics.AlleleManager;
+import forestry.api.genetics.IAlleleRegistry;
+import forestry.api.genetics.IEffectData;
+import forestry.apiculture.proxy.ProxyApiculture;
+import forestry.plugins.PluginApiculture;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.List;
+import java.util.Random;
+import net.minecraft.block.Block;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityList;
+import net.minecraft.entity.EntityLiving;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.item.EntityFireworkRocket;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.projectile.EntitySmallFireball;
+import net.minecraft.init.Blocks;
+import net.minecraft.item.ItemDye;
+import net.minecraft.item.ItemStack;
+import net.minecraft.potion.Potion;
+import net.minecraft.potion.PotionEffect;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.AxisAlignedBB;
+import net.minecraft.util.DamageSource;
+import net.minecraft.util.FoodStats;
+import net.minecraft.world.World;
+import net.minecraft.world.WorldServer;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.IFluidHandler;
+
+public enum ExtraBeesEffect
+ implements IAlleleBeeEffect
+{
+ ECTOPLASM, ACID, SPAWN_ZOMBIE, SPAWN_SKELETON, SPAWN_CREEPER, LIGHTNING, RADIOACTIVE, METEOR, HUNGER, FOOD, BLINDNESS, CONFUSION, FIREWORKS, FESTIVAL, BIRTHDAY, TELEPORT, GRAVITY, THIEF, WITHER, WATER, SLOW, BonemealSapling, BonemealFruit, BonemealMushroom, Power;
+
+ private ExtraBeesEffect()
+ {
+ this.uid = toString().toLowerCase();
+ this.combinable = false;
+ this.dominant = true;
+ }
+
+ String fx = "";
+ public boolean combinable;
+ public boolean dominant;
+ public int id;
+ private String uid;
+ static List<Birthday> birthdays;
+
+ public static void doInit()
+ {
+ BLINDNESS.setFX("blindness");
+ FOOD.setFX("food");
+ GRAVITY.setFX("gravity");
+ THIEF.setFX("gravity");
+ TELEPORT.setFX("gravity");
+ LIGHTNING.setFX("lightning");
+ METEOR.setFX("meteor");
+ RADIOACTIVE.setFX("radioactive");
+ WATER.setFX("water");
+ WITHER.setFX("wither");
+ for (ExtraBeesEffect effect : values()) {
+ effect.register();
+ }
+ }
+
+ private void setFX(String string)
+ {
+ this.fx = ("particles/" + string);
+ }
+
+ public void register()
+ {
+ AlleleManager.alleleRegistry.registerAllele(this);
+ }
+
+ public boolean isCombinable()
+ {
+ return this.combinable;
+ }
+
+ public IEffectData validateStorage(IEffectData storedData)
+ {
+ return storedData;
+ }
+
+ public String getName()
+ {
+ return ExtraBees.proxy.localise("effect." + name().toString().toLowerCase() + ".name");
+ }
+
+ public boolean isDominant()
+ {
+ return this.dominant;
+ }
+
+ public void spawnMob(World world, int x, int y, int z, String name)
+ {
+ if (anyPlayerInRange(world, x, y, z, 16))
+ {
+ double var1 = x + world.rand.nextFloat();
+ double var3 = y + world.rand.nextFloat();
+ double var5 = z + world.rand.nextFloat();
+ world.spawnParticle("smoke", var1, var3, var5, 0.0D, 0.0D, 0.0D);
+ world.spawnParticle("flame", var1, var3, var5, 0.0D, 0.0D, 0.0D);
+ EntityLiving var9 = (EntityLiving)EntityList.createEntityByName(name, world);
+ if (var9 == null) {
+ return;
+ }
+ int var10 = world.getEntitiesWithinAABB(var9.getClass(), AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 1, z + 1).expand(8.0D, 4.0D, 8.0D)).size();
+ if (var10 >= 6) {
+ return;
+ }
+ if (var9 != null)
+ {
+ double var11 = x + (world.rand.nextDouble() - world.rand.nextDouble()) * 4.0D;
+
+
+ double var13 = y + world.rand.nextInt(3) - 1;
+ double var15 = z + (world.rand.nextDouble() - world.rand.nextDouble()) * 4.0D;
+
+
+ var9.setLocationAndAngles(var11, var13, var15, world.rand.nextFloat() * 360.0F, 0.0F);
+ if (var9.getCanSpawnHere())
+ {
+ world.spawnEntityInWorld(var9);
+ world.playAuxSFX(2004, x, y, z, 0);
+ var9.spawnExplosionParticle();
+ }
+ }
+ }
+ }
+
+ private boolean anyPlayerInRange(World world, int x, int y, int z, int distance)
+ {
+ return world.getClosestPlayer(x + 0.5D, y + 0.5D, z + 0.5D, distance) != null;
+ }
+
+ public static void doAcid(World world, int x, int y, int z)
+ {
+ Block block = world.getBlock(x, y, z);
+ if ((block == Blocks.cobblestone) || (block == Blocks.stone)) {
+ world.setBlock(x, y, z, Blocks.gravel, 0, 0);
+ } else if (((block == Blocks.dirt ? 1 : 0) | (block == Blocks.grass ? 1 : 0)) != 0) {
+ world.setBlock(x, y, z, Blocks.sand, 0, 0);
+ }
+ }
+
+ public String getUID()
+ {
+ return "extrabees.effect." + this.uid;
+ }
+
+ public IEffectData doEffect(IBeeGenome genome, IEffectData storedData, IBeeHousing housing)
+ {
+ World world = housing.getWorld();
+ int xHouse = housing.getXCoord();
+ int yHouse = housing.getYCoord();
+ int zHouse = housing.getZCoord();
+
+ int[] area = getModifiedArea(genome, housing);
+
+ int xd = 1 + area[0] / 2;
+ int yd = 1 + area[1] / 2;
+ int zd = 1 + area[2] / 2;
+ int x1 = xHouse - xd + world.rand.nextInt(2 * xd + 1);
+ int y1 = yHouse - yd + world.rand.nextInt(2 * yd + 1);
+ int z1 = zHouse - zd + world.rand.nextInt(2 * zd + 1);
+ switch (1.$SwitchMap$binnie$extrabees$genetics$effect$ExtraBeesEffect[ordinal()])
+ {
+ case 4:
+ if (world.rand.nextInt(100) < 4)
+ {
+ if ((world.isAirBlock(x1, y1, z1)) && ((world.isBlockNormalCubeDefault(x1, y1 - 1, z1, false)) || (world.getBlock(x1, y1 - 1, z1) == ExtraBees.ectoplasm))) {
+ world.setBlock(x1, y1, z1, ExtraBees.ectoplasm, 0, 0);
+ }
+ return null;
+ }
+ break;
+ case 5:
+ if (world.rand.nextInt(100) < 6) {
+ doAcid(world, x1, y1, z1);
+ }
+ break;
+ case 6:
+ if (world.rand.nextInt(200) < 2) {
+ spawnMob(world, x1, y1, z1, "Zombie");
+ }
+ break;
+ case 7:
+ if (world.rand.nextInt(200) < 2) {
+ spawnMob(world, x1, y1, z1, "Skeleton");
+ }
+ break;
+ case 8:
+ if (world.rand.nextInt(200) < 2) {
+ spawnMob(world, x1, y1, z1, "Creeper");
+ }
+ break;
+ case 9:
+ if (world.rand.nextInt(100) < 1) {
+ if ((world.canBlockSeeTheSky(x1, y1, z1)) &&
+ ((world instanceof WorldServer))) {
+ ((WorldServer)world).addWeatherEffect(new EntityBeeLightning(world, x1, y1, z1));
+ }
+ }
+ break;
+ case 10:
+ if (world.rand.nextInt(100) < 1) {
+ if (world.canBlockSeeTheSky(x1, y1, z1)) {
+ ((WorldServer)world).spawnEntityInWorld(new EntitySmallFireball(world, x1, y1 + 64, z1, 0.0D, -0.6D, 0.0D));
+ }
+ }
+ break;
+ case 11:
+ for (EntityLivingBase entity : getEntities(EntityLivingBase.class, genome, housing))
+ {
+ int damage = 4;
+ if ((entity instanceof EntityPlayer))
+ {
+ int count = wearsItems((EntityPlayer)entity);
+ if (count > 3) {
+ continue;
+ }
+ if (count > 2) {
+ damage = 1;
+ } else if (count > 1) {
+ damage = 2;
+ } else if (count > 0) {
+ damage = 3;
+ }
+ }
+ entity.attackEntityFrom(DamageSource.generic, damage);
+ }
+ break;
+ case 12:
+ for (EntityLivingBase entity : getEntities(EntityLivingBase.class, genome, housing)) {
+ if ((entity instanceof EntityPlayer))
+ {
+ EntityPlayer player = (EntityPlayer)entity;
+ player.getFoodStats().addStats(2, 0.2F);
+ }
+ }
+ break;
+ case 13:
+ for (EntityLivingBase entity : getEntities(EntityLivingBase.class, genome, housing)) {
+ if ((entity instanceof EntityPlayer))
+ {
+ EntityPlayer player = (EntityPlayer)entity;
+ if (world.rand.nextInt(4) >= wearsItems(player))
+ {
+ player.getFoodStats().addExhaustion(4.0F);
+ player.addPotionEffect(new PotionEffect(Potion.hunger.id, 100));
+ }
+ }
+ }
+ break;
+ case 14:
+ for (EntityLivingBase entity : getEntities(EntityLivingBase.class, genome, housing)) {
+ if ((entity instanceof EntityPlayer))
+ {
+ EntityPlayer player = (EntityPlayer)entity;
+ if (world.rand.nextInt(4) >= wearsItems(player)) {
+ player.addPotionEffect(new PotionEffect(Potion.blindness.id, 200));
+ }
+ }
+ }
+ break;
+ case 15:
+ for (EntityLivingBase entity : getEntities(EntityLivingBase.class, genome, housing)) {
+ if ((entity instanceof EntityPlayer))
+ {
+ EntityPlayer player = (EntityPlayer)entity;
+ if (world.rand.nextInt(4) >= wearsItems(player)) {
+ player.addPotionEffect(new PotionEffect(Potion.weakness.id, 200));
+ }
+ }
+ }
+ break;
+ case 16:
+ for (EntityLivingBase entity : getEntities(EntityLivingBase.class, genome, housing)) {
+ if ((entity instanceof EntityPlayer))
+ {
+ EntityPlayer player = (EntityPlayer)entity;
+ if (world.rand.nextInt(4) >= wearsItems(player)) {
+ player.addPotionEffect(new PotionEffect(Potion.confusion.id, 200));
+ }
+ }
+ }
+ break;
+ case 1:
+ case 2:
+ case 3:
+ if (world.rand.nextInt(this == FIREWORKS ? 8 : 12) < 1)
+ {
+ FireworkCreator.Firework firework = new FireworkCreator.Firework();
+ switch (1.$SwitchMap$binnie$extrabees$genetics$effect$ExtraBeesEffect[ordinal()])
+ {
+ case 1:
+ firework.setShape(FireworkCreator.Shape.Star);
+ firework.addColor(16768256);
+ for (Birthday birthday : birthdays) {
+ if (birthday.isToday())
+ {
+ firework.addColor(16711680);
+ firework.addColor(65280);
+ firework.addColor(255);
+ firework.setTrail();
+ break;
+ }
+ }
+ break;
+ case 2:
+ break;
+ case 3:
+ firework.setShape(FireworkCreator.Shape.Ball);
+ firework.addColor(genome.getPrimary().getIconColour(0));
+ firework.addColor(genome.getPrimary().getIconColour(0));
+ firework.addColor(genome.getPrimary().getIconColour(1));
+ firework.addColor(genome.getSecondary().getIconColour(0));
+ firework.addColor(genome.getSecondary().getIconColour(0));
+ firework.addColor(genome.getPrimary().getIconColour(1));
+ firework.setTrail();
+ break;
+ }
+ EntityFireworkRocket var11 = new EntityFireworkRocket(world, x1, y1, z1, firework.getFirework());
+ if (world.canBlockSeeTheSky(x1, y1, z1)) {
+ ((WorldServer)world).spawnEntityInWorld(var11);
+ }
+ }
+ break;
+ case 17:
+ List<Entity> entities2 = getEntities(Entity.class, genome, housing);
+ for (Entity entity : entities2)
+ {
+ float entityStrength = 1.0F;
+ if ((entity instanceof EntityPlayer)) {
+ entityStrength *= 100.0F;
+ }
+ double dx = x1 - entity.posX;
+ double dy = y1 - entity.posY;
+ double dz = z1 - entity.posZ;
+ if (dx * dx + dy * dy + dz * dz < 2.0D) {
+ return null;
+ }
+ double strength = 0.5D / (dx * dx + dy * dy + dz * dz) * entityStrength;
+ entity.addVelocity(dx * strength, dy * strength, dz * strength);
+ }
+ break;
+ case 18:
+ List<EntityPlayer> entities3 = getEntities(EntityPlayer.class, genome, housing);
+ for (EntityPlayer entity : entities3)
+ {
+ double dx = x1 - entity.posX;
+ double dy = y1 - entity.posY;
+ double dz = z1 - entity.posZ;
+ if (dx * dx + dy * dy + dz * dz < 2.0D) {
+ return null;
+ }
+ double strength = 0.5D / (dx * dx + dy * dy + dz * dz);
+ entity.addVelocity(-dx * strength, -dy * strength, -dz * strength);
+ }
+ break;
+ case 19:
+ if (world.rand.nextInt(80) > 1) {
+ return null;
+ }
+ List<Entity> entities = getEntities(Entity.class, genome, housing);
+ if (entities.size() == 0) {
+ return null;
+ }
+ Entity entity = (Entity)entities.get(world.rand.nextInt(entities.size()));
+ if (!(entity instanceof EntityLiving)) {
+ return null;
+ }
+ float jumpDist = 5.0F;
+ if (y1 < 4) {
+ y1 = 4;
+ }
+ if ((!world.isAirBlock(x1, y1, z1)) || (!world.isAirBlock(x1, y1 + 1, z1))) {
+ return null;
+ }
+ ((EntityLiving)entity).setPositionAndUpdate(x1, y1, z1);
+
+
+
+
+ ((EntityLiving)entity).addPotionEffect(new PotionEffect(Potion.confusion.id, 160, 10));
+
+
+ break;
+ case 20:
+ if (world.rand.nextInt(120) > 1) {
+ return null;
+ }
+ TileEntity tile = world.getTileEntity(x1, y1, z1);
+ if ((tile instanceof IFluidHandler)) {
+ ((IFluidHandler)tile).fill(ForgeDirection.UP, Binnie.Liquid.getLiquidStack("water", 100), true);
+ }
+ break;
+ case 21:
+ if (world.rand.nextInt(20) > 1) {
+ return null;
+ }
+ if (ExtraBeesFlowers.Sapling.isAcceptedFlower(world, null, x1, y1, z1)) {
+ ItemDye.applyBonemeal(new ItemStack(Blocks.dirt, 1), world, x1, y1, z1, null);
+ }
+ break;
+ case 22:
+ if (world.rand.nextInt(20) > 1) {
+ return null;
+ }
+ if (ExtraBeesFlowers.Fruit.isAcceptedFlower(world, null, x1, y1, z1)) {
+ ItemDye.applyBonemeal(new ItemStack(Blocks.dirt, 1), world, x1, y1, z1, null);
+ }
+ break;
+ case 23:
+ if (world.rand.nextInt(20) > 1) {
+ return null;
+ }
+ if ((world.getBlock(x1, y1, z1) == Blocks.brown_mushroom) || (world.getBlock(x1, y1, z1) == Blocks.red_mushroom)) {
+ ItemDye.applyBonemeal(new ItemStack(Blocks.dirt, 1), world, x1, y1, z1, null);
+ }
+ break;
+ case 24:
+ TileEntity tile2 = world.getTileEntity(x1, y1, z1);
+ if ((tile2 instanceof IEnergyReceiver)) {
+ ((IEnergyReceiver)tile2).receiveEnergy(ForgeDirection.getOrientation(0), 5, true);
+ }
+ break;
+ case 25:
+ break;
+ }
+ return null;
+ }
+
+ protected int[] getModifiedArea(IBeeGenome genome, IBeeHousing housing)
+ {
+ int[] area = genome.getTerritory(); int
+ tmp9_8 = 0; int[] tmp9_7 = area;tmp9_7[tmp9_8] = ((int)(tmp9_7[tmp9_8] * (housing.getTerritoryModifier(genome, 1.0F) * 3.0F))); int
+ tmp29_28 = 1; int[] tmp29_27 = area;tmp29_27[tmp29_28] = ((int)(tmp29_27[tmp29_28] * (housing.getTerritoryModifier(genome, 1.0F) * 3.0F))); int
+ tmp49_48 = 2; int[] tmp49_47 = area;tmp49_47[tmp49_48] = ((int)(tmp49_47[tmp49_48] * (housing.getTerritoryModifier(genome, 1.0F) * 3.0F)));
+ if (area[0] < 1) {
+ area[0] = 1;
+ }
+ if (area[1] < 1) {
+ area[1] = 1;
+ }
+ if (area[2] < 1) {
+ area[2] = 1;
+ }
+ return area;
+ }
+
+ public IEffectData doFX(IBeeGenome genome, IEffectData storedData, IBeeHousing housing)
+ {
+ int[] area = genome.getTerritory(); int
+ tmp11_10 = 0; int[] tmp11_8 = area;tmp11_8[tmp11_10] = ((int)(tmp11_8[tmp11_10] * housing.getTerritoryModifier(genome, 1.0F))); int
+ tmp28_27 = 1; int[] tmp28_25 = area;tmp28_25[tmp28_27] = ((int)(tmp28_25[tmp28_27] * housing.getTerritoryModifier(genome, 1.0F))); int
+ tmp45_44 = 2; int[] tmp45_42 = area;tmp45_42[tmp45_44] = ((int)(tmp45_42[tmp45_44] * housing.getTerritoryModifier(genome, 1.0F)));
+ if (area[0] < 1) {
+ area[0] = 1;
+ }
+ if (area[1] < 1) {
+ area[1] = 1;
+ }
+ if (area[2] < 1) {
+ area[2] = 1;
+ }
+ PluginApiculture.proxy.addBeeHiveFX("particles/swarm_bee", housing.getWorld(), housing.getXCoord(), housing.getYCoord(), housing.getZCoord(), genome.getPrimary().getIconColour(0), area[0], area[1], area[2]);
+
+ return storedData;
+ }
+
+ public String getFX()
+ {
+ return this.fx;
+ }
+
+ public <T extends Entity> List<T> getEntities(Class<T> eClass, IBeeGenome genome, IBeeHousing housing)
+ {
+ int[] area = genome.getTerritory();
+ int[] offset = { -Math.round(area[0] / 2), -Math.round(area[1] / 2), -Math.round(area[2] / 2) };
+
+
+ int[] min = { housing.getXCoord() + offset[0], housing.getYCoord() + offset[1], housing.getZCoord() + offset[2] };
+ int[] max = { housing.getXCoord() + offset[0] + area[0], housing.getYCoord() + offset[1] + area[1], housing.getZCoord() + offset[2] + area[2] };
+
+ AxisAlignedBB box = AxisAlignedBB.getBoundingBox(min[0], min[1], min[2], max[0], max[1], max[2]);
+ return housing.getWorld().getEntitiesWithinAABB(eClass, box);
+ }
+
+ public static boolean wearsHelmet(EntityPlayer player)
+ {
+ ItemStack armorItem = player.inventory.armorInventory[3];
+ return (armorItem != null) && ((armorItem.getItem() instanceof IArmorApiarist));
+ }
+
+ public static boolean wearsChest(EntityPlayer player)
+ {
+ ItemStack armorItem = player.inventory.armorInventory[2];
+ return (armorItem != null) && ((armorItem.getItem() instanceof IArmorApiarist));
+ }
+
+ public static boolean wearsLegs(EntityPlayer player)
+ {
+ ItemStack armorItem = player.inventory.armorInventory[1];
+ return (armorItem != null) && ((armorItem.getItem() instanceof IArmorApiarist));
+ }
+
+ public static boolean wearsBoots(EntityPlayer player)
+ {
+ ItemStack armorItem = player.inventory.armorInventory[0];
+ return (armorItem != null) && ((armorItem.getItem() instanceof IArmorApiarist));
+ }
+
+ public static int wearsItems(EntityPlayer player)
+ {
+ int count = 0;
+ if (wearsHelmet(player)) {
+ count++;
+ }
+ if (wearsChest(player)) {
+ count++;
+ }
+ if (wearsLegs(player)) {
+ count++;
+ }
+ if (wearsBoots(player)) {
+ count++;
+ }
+ return count;
+ }
+
+ public static class Birthday
+ {
+ int day;
+ int month;
+ String name;
+
+ public boolean isToday()
+ {
+ return (Calendar.getInstance().get(5) == this.month) && (Calendar.getInstance().get(2) == this.day);
+ }
+
+ public String getName()
+ {
+ return this.name;
+ }
+
+ private Birthday(int day, int month, String name)
+ {
+ this.day = day;
+ this.month = (month + 1);
+ this.name = name;
+ }
+ }
+
+ static
+ {
+ birthdays = new ArrayList();
+
+
+ birthdays.add(new Birthday(3, 10, "Binnie", null));
+ }
+
+ public String getUnlocalizedName()
+ {
+ return getUID();
+ }
+}
diff --git a/src/Java/binnie/extrabees/genetics/effect/FireworkCreator.java b/src/Java/binnie/extrabees/genetics/effect/FireworkCreator.java
new file mode 100644
index 0000000000..29e5e42ada
--- /dev/null
+++ b/src/Java/binnie/extrabees/genetics/effect/FireworkCreator.java
@@ -0,0 +1,83 @@
+package binnie.extrabees.genetics.effect;
+
+import java.util.ArrayList;
+import net.minecraft.init.Items;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.nbt.NBTTagList;
+
+public class FireworkCreator
+{
+ public static enum Shape
+ {
+ Ball, LargeBall, Star, Creeper, Burst;
+
+ private Shape() {}
+ }
+
+ public static class Firework
+ {
+ boolean flicker = false;
+ boolean trail = false;
+ ArrayList<Integer> colors = new ArrayList();
+ byte shape = 0;
+
+ public void setFlicker()
+ {
+ this.flicker = true;
+ }
+
+ public void setTrail()
+ {
+ this.trail = true;
+ }
+
+ public void setShape(FireworkCreator.Shape shape)
+ {
+ this.shape = ((byte)shape.ordinal());
+ }
+
+ public void addColor(int color)
+ {
+ this.colors.add(Integer.valueOf(color));
+ }
+
+ NBTTagCompound getNBT()
+ {
+ NBTTagCompound nbt = new NBTTagCompound();
+ if (this.flicker) {
+ nbt.setBoolean("Flicker", true);
+ }
+ if (this.trail) {
+ nbt.setBoolean("Trail", true);
+ }
+ if (this.colors.size() == 0) {
+ addColor(16777215);
+ }
+ int[] array = new int[this.colors.size()];
+ for (int i = 0; i < this.colors.size(); i++) {
+ array[i] = ((Integer)this.colors.get(i)).intValue();
+ }
+ nbt.setIntArray("Colors", array);
+ nbt.setByte("Type", this.shape);
+ return nbt;
+ }
+
+ public ItemStack getFirework()
+ {
+ NBTTagCompound var15 = new NBTTagCompound();
+
+ NBTTagCompound var18 = new NBTTagCompound();
+ NBTTagList var25 = new NBTTagList();
+ var25.appendTag(getNBT());
+
+ var18.setTag("Explosions", var25);
+ var18.setByte("Flight", (byte)0);
+ var15.setTag("Fireworks", var18);
+
+ ItemStack item = new ItemStack(Items.fireworks);
+ item.setTagCompound(var15);
+ return item;
+ }
+ }
+}
diff --git a/src/Java/binnie/extrabees/genetics/items/ItemDictionary.java b/src/Java/binnie/extrabees/genetics/items/ItemDictionary.java
new file mode 100644
index 0000000000..82e5754484
--- /dev/null
+++ b/src/Java/binnie/extrabees/genetics/items/ItemDictionary.java
@@ -0,0 +1,73 @@
+package binnie.extrabees.genetics.items;
+
+import binnie.extrabees.ExtraBees;
+import binnie.extrabees.core.ExtraBeeGUID;
+import binnie.extrabees.proxy.ExtraBeesProxy;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import forestry.api.core.Tabs;
+import java.util.List;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.IIcon;
+import net.minecraft.world.World;
+
+public class ItemDictionary
+ extends Item
+{
+ IIcon iconMaster;
+
+ @SideOnly(Side.CLIENT)
+ public void registerIcons(IIconRegister register)
+ {
+ this.itemIcon = ExtraBees.proxy.getIcon(register, "apiaristDatabase");
+ this.iconMaster = ExtraBees.proxy.getIcon(register, "masterApiaristDatabase");
+ }
+
+ @SideOnly(Side.CLIENT)
+ public IIcon getIconFromDamage(int par1)
+ {
+ return par1 == 0 ? this.itemIcon : this.iconMaster;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
+ {
+ super.addInformation(par1ItemStack, par2EntityPlayer, par3List, par4);
+ if (par1ItemStack.getItemDamage() > 0) {
+ par3List.add("Flora-in-a-box");
+ }
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List par3List)
+ {
+ super.getSubItems(par1, par2CreativeTabs, par3List);
+ par3List.add(new ItemStack(par1, 1, 1));
+ }
+
+ public ItemDictionary()
+ {
+ setCreativeTab(Tabs.tabApiculture);
+ setUnlocalizedName("dictionary");
+ setMaxStackSize(1);
+ }
+
+ public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer player)
+ {
+ if (itemstack.getItemDamage() == 0) {
+ ExtraBees.proxy.openGui(ExtraBeeGUID.Database, player, (int)player.posX, (int)player.posY, (int)player.posZ);
+ } else {
+ ExtraBees.proxy.openGui(ExtraBeeGUID.DatabaseNEI, player, (int)player.posX, (int)player.posY, (int)player.posZ);
+ }
+ return itemstack;
+ }
+
+ public String getItemStackDisplayName(ItemStack i)
+ {
+ return i.getItemDamage() == 0 ? "Apiarist Database" : "Master Apiarist Database";
+ }
+}
diff --git a/src/Java/binnie/extrabees/genetics/items/ItemPunnettSquare.java b/src/Java/binnie/extrabees/genetics/items/ItemPunnettSquare.java
new file mode 100644
index 0000000000..7534802687
--- /dev/null
+++ b/src/Java/binnie/extrabees/genetics/items/ItemPunnettSquare.java
@@ -0,0 +1,41 @@
+package binnie.extrabees.genetics.items;
+
+import binnie.extrabees.ExtraBees;
+import binnie.extrabees.core.ExtraBeeGUID;
+import binnie.extrabees.proxy.ExtraBeesProxy;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.world.World;
+
+public class ItemPunnettSquare
+ extends Item
+{
+ @SideOnly(Side.CLIENT)
+ public void registerIcons(IIconRegister register)
+ {
+ this.itemIcon = ExtraBees.proxy.getIcon(register, "");
+ }
+
+ public ItemPunnettSquare()
+ {
+ setCreativeTab(CreativeTabs.tabTools);
+ setMaxStackSize(1);
+ }
+
+ public String getItemStackDisplayName(ItemStack itemstack)
+ {
+ return "Punnett Square";
+ }
+
+ public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer player)
+ {
+ ExtraBees.proxy.openGui(ExtraBeeGUID.PunnettSquare, player, (int)player.posX, (int)player.posY, (int)player.posZ);
+
+ return itemstack;
+ }
+}
diff --git a/src/Java/binnie/extrabees/gui/WindowAlvearyFrame.java b/src/Java/binnie/extrabees/gui/WindowAlvearyFrame.java
new file mode 100644
index 0000000000..a14d9a0a8f
--- /dev/null
+++ b/src/Java/binnie/extrabees/gui/WindowAlvearyFrame.java
@@ -0,0 +1,53 @@
+package binnie.extrabees.gui;
+
+import binnie.core.AbstractMod;
+import binnie.core.machines.Machine;
+import binnie.core.machines.TileEntityMachine;
+import binnie.craftgui.minecraft.Window;
+import binnie.craftgui.minecraft.control.ControlPlayerInventory;
+import binnie.craftgui.minecraft.control.ControlSlot;
+import binnie.extrabees.ExtraBees;
+import cpw.mods.fml.relauncher.Side;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.IInventory;
+
+public class WindowAlvearyFrame
+ extends Window
+{
+ Machine machine;
+ ControlPlayerInventory playerInventory;
+
+ public WindowAlvearyFrame(EntityPlayer player, IInventory inventory, Side side)
+ {
+ super(176.0F, 144.0F, player, inventory, side);
+ this.machine = ((TileEntityMachine)inventory).getMachine();
+ }
+
+ public static Window create(EntityPlayer player, IInventory inventory, Side side)
+ {
+ if ((player == null) || (inventory == null)) {
+ return null;
+ }
+ return new WindowAlvearyFrame(player, inventory, side);
+ }
+
+ public void initialiseClient()
+ {
+ setTitle("Frame Housing");
+
+ this.playerInventory = new ControlPlayerInventory(this);
+
+ ControlSlot slot = new ControlSlot(this, 79.0F, 30.0F);
+ slot.assign(0);
+ }
+
+ public AbstractMod getMod()
+ {
+ return ExtraBees.instance;
+ }
+
+ public String getName()
+ {
+ return "AlvearyFrame";
+ }
+}
diff --git a/src/Java/binnie/extrabees/gui/WindowAlvearyHatchery.java b/src/Java/binnie/extrabees/gui/WindowAlvearyHatchery.java
new file mode 100644
index 0000000000..081425acf5
--- /dev/null
+++ b/src/Java/binnie/extrabees/gui/WindowAlvearyHatchery.java
@@ -0,0 +1,54 @@
+package binnie.extrabees.gui;
+
+import binnie.core.AbstractMod;
+import binnie.core.machines.Machine;
+import binnie.core.machines.TileEntityMachine;
+import binnie.craftgui.minecraft.Window;
+import binnie.craftgui.minecraft.control.ControlPlayerInventory;
+import binnie.craftgui.minecraft.control.ControlSlotArray;
+import binnie.extrabees.ExtraBees;
+import binnie.extrabees.apiary.machine.AlvearyHatchery;
+import cpw.mods.fml.relauncher.Side;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.IInventory;
+
+public class WindowAlvearyHatchery
+ extends Window
+{
+ Machine machine;
+ ControlPlayerInventory playerInventory;
+
+ public WindowAlvearyHatchery(EntityPlayer player, IInventory inventory, Side side)
+ {
+ super(176.0F, 144.0F, player, inventory, side);
+ this.machine = ((TileEntityMachine)inventory).getMachine();
+ }
+
+ public static Window create(EntityPlayer player, IInventory inventory, Side side)
+ {
+ if ((player == null) || (inventory == null)) {
+ return null;
+ }
+ return new WindowAlvearyHatchery(player, inventory, side);
+ }
+
+ public void initialiseClient()
+ {
+ setTitle("Hatchery");
+
+ this.playerInventory = new ControlPlayerInventory(this);
+
+ ControlSlotArray slot = new ControlSlotArray(this, 43, 30, 5, 1);
+ slot.create(AlvearyHatchery.slotLarvae);
+ }
+
+ public AbstractMod getMod()
+ {
+ return ExtraBees.instance;
+ }
+
+ public String getName()
+ {
+ return "AlvearyHatchery";
+ }
+}
diff --git a/src/Java/binnie/extrabees/gui/WindowAlvearyIndustrialFrame.java b/src/Java/binnie/extrabees/gui/WindowAlvearyIndustrialFrame.java
new file mode 100644
index 0000000000..07b47f03c9
--- /dev/null
+++ b/src/Java/binnie/extrabees/gui/WindowAlvearyIndustrialFrame.java
@@ -0,0 +1,53 @@
+package binnie.extrabees.gui;
+
+import binnie.core.AbstractMod;
+import binnie.core.machines.Machine;
+import binnie.core.machines.TileEntityMachine;
+import binnie.craftgui.minecraft.Window;
+import binnie.craftgui.minecraft.control.ControlPlayerInventory;
+import binnie.craftgui.minecraft.control.ControlSlot;
+import binnie.extrabees.ExtraBees;
+import cpw.mods.fml.relauncher.Side;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.IInventory;
+
+public class WindowAlvearyIndustrialFrame
+ extends Window
+{
+ Machine machine;
+ ControlPlayerInventory playerInventory;
+
+ public WindowAlvearyIndustrialFrame(EntityPlayer player, IInventory inventory, Side side)
+ {
+ super(176.0F, 144.0F, player, inventory, side);
+ this.machine = ((TileEntityMachine)inventory).getMachine();
+ }
+
+ public static Window create(EntityPlayer player, IInventory inventory, Side side)
+ {
+ if ((player == null) || (inventory == null)) {
+ return null;
+ }
+ return new WindowAlvearyIndustrialFrame(player, inventory, side);
+ }
+
+ public void initialiseClient()
+ {
+ setTitle("Industrial Frame Housing");
+
+ this.playerInventory = new ControlPlayerInventory(this);
+
+ ControlSlot slot = new ControlSlot(this, 79.0F, 30.0F);
+ slot.assign(0);
+ }
+
+ public AbstractMod getMod()
+ {
+ return ExtraBees.instance;
+ }
+
+ public String getName()
+ {
+ return "AlvearyIndustrialFrame";
+ }
+}
diff --git a/src/Java/binnie/extrabees/gui/WindowAlvearyMutator.java b/src/Java/binnie/extrabees/gui/WindowAlvearyMutator.java
new file mode 100644
index 0000000000..f2cf458145
--- /dev/null
+++ b/src/Java/binnie/extrabees/gui/WindowAlvearyMutator.java
@@ -0,0 +1,78 @@
+package binnie.extrabees.gui;
+
+import binnie.core.AbstractMod;
+import binnie.core.machines.Machine;
+import binnie.core.machines.TileEntityMachine;
+import binnie.craftgui.controls.ControlText;
+import binnie.craftgui.core.geometry.IArea;
+import binnie.craftgui.core.geometry.TextJustification;
+import binnie.craftgui.minecraft.Window;
+import binnie.craftgui.minecraft.control.ControlItemDisplay;
+import binnie.craftgui.minecraft.control.ControlPlayerInventory;
+import binnie.craftgui.minecraft.control.ControlSlot;
+import binnie.extrabees.ExtraBees;
+import binnie.extrabees.apiary.machine.AlvearyMutator;
+import cpw.mods.fml.relauncher.Side;
+import java.util.Collection;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.item.ItemStack;
+
+public class WindowAlvearyMutator
+ extends Window
+{
+ Machine machine;
+ ControlPlayerInventory playerInventory;
+
+ public WindowAlvearyMutator(EntityPlayer player, IInventory inventory, Side side)
+ {
+ super(176.0F, 176.0F, player, inventory, side);
+ this.machine = ((TileEntityMachine)inventory).getMachine();
+ }
+
+ public static Window create(EntityPlayer player, IInventory inventory, Side side)
+ {
+ if ((player == null) || (inventory == null)) {
+ return null;
+ }
+ return new WindowAlvearyMutator(player, inventory, side);
+ }
+
+ public void initialiseClient()
+ {
+ setTitle("Mutator");
+
+ this.playerInventory = new ControlPlayerInventory(this);
+
+ ControlSlot slot = new ControlSlot(this, 79.0F, 30.0F);
+ slot.assign(0);
+
+ new ControlText(this, new IArea(0.0F, 52.0F, w(), 16.0F), "Possible Mutagens:", TextJustification.MiddleCenter).setColour(5592405);
+
+ int size = AlvearyMutator.getMutagens().size();
+
+ int w = size * 18;
+ float x;
+ if (size > 0)
+ {
+ x = (w() - w) / 2.0F;
+ for (ItemStack stack : AlvearyMutator.getMutagens())
+ {
+ ControlItemDisplay display = new ControlItemDisplay(this, x, 66.0F);
+ display.setItemStack(stack);
+ display.hastooltip = true;
+ x += 18.0F;
+ }
+ }
+ }
+
+ public AbstractMod getMod()
+ {
+ return ExtraBees.instance;
+ }
+
+ public String getName()
+ {
+ return "AlvearyMutator";
+ }
+}
diff --git a/src/Java/binnie/extrabees/gui/WindowAlvearyStimulator.java b/src/Java/binnie/extrabees/gui/WindowAlvearyStimulator.java
new file mode 100644
index 0000000000..2e3b9736a5
--- /dev/null
+++ b/src/Java/binnie/extrabees/gui/WindowAlvearyStimulator.java
@@ -0,0 +1,56 @@
+package binnie.extrabees.gui;
+
+import binnie.core.AbstractMod;
+import binnie.core.machines.Machine;
+import binnie.core.machines.TileEntityMachine;
+import binnie.craftgui.core.geometry.Position;
+import binnie.craftgui.minecraft.Window;
+import binnie.craftgui.minecraft.control.ControlEnergyBar;
+import binnie.craftgui.minecraft.control.ControlPlayerInventory;
+import binnie.craftgui.minecraft.control.ControlSlot;
+import binnie.extrabees.ExtraBees;
+import binnie.extrabees.apiary.machine.AlvearyStimulator;
+import cpw.mods.fml.relauncher.Side;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.IInventory;
+
+public class WindowAlvearyStimulator
+ extends Window
+{
+ Machine machine;
+ ControlPlayerInventory playerInventory;
+
+ public WindowAlvearyStimulator(EntityPlayer player, IInventory inventory, Side side)
+ {
+ super(176.0F, 144.0F, player, inventory, side);
+ this.machine = ((TileEntityMachine)inventory).getMachine();
+ }
+
+ public static Window create(EntityPlayer player, IInventory inventory, Side side)
+ {
+ if ((player == null) || (inventory == null)) {
+ return null;
+ }
+ return new WindowAlvearyStimulator(player, inventory, side);
+ }
+
+ public void initialiseClient()
+ {
+ setTitle("Stimulator");
+ new ControlEnergyBar(this, 75, 29, 60, 16, Position.Left);
+ ControlSlot slot = new ControlSlot(this, 41.0F, 28.0F);
+ slot.assign(AlvearyStimulator.slotCircuit);
+
+ this.playerInventory = new ControlPlayerInventory(this);
+ }
+
+ public AbstractMod getMod()
+ {
+ return ExtraBees.instance;
+ }
+
+ public String getName()
+ {
+ return "AlvearyStimulator";
+ }
+}
diff --git a/src/Java/binnie/extrabees/gui/database/ControlBiomes.java b/src/Java/binnie/extrabees/gui/database/ControlBiomes.java
new file mode 100644
index 0000000000..1299df72ca
--- /dev/null
+++ b/src/Java/binnie/extrabees/gui/database/ControlBiomes.java
@@ -0,0 +1,75 @@
+package binnie.extrabees.gui.database;
+
+import binnie.Binnie;
+import binnie.core.BinnieCore;
+import binnie.core.genetics.ManagerGenetics;
+import binnie.core.proxy.BinnieProxy;
+import binnie.craftgui.controls.core.Control;
+import binnie.craftgui.core.Attribute;
+import binnie.craftgui.core.CraftGUI;
+import binnie.craftgui.core.ITooltip;
+import binnie.craftgui.core.IWidget;
+import binnie.craftgui.core.Tooltip;
+import binnie.craftgui.core.geometry.IArea;
+import binnie.craftgui.core.geometry.IPoint;
+import binnie.craftgui.core.renderer.Renderer;
+import binnie.craftgui.resource.minecraft.CraftGUITexture;
+import forestry.api.apiculture.IAlleleBeeSpecies;
+import forestry.api.apiculture.IBee;
+import forestry.api.apiculture.IBeeGenome;
+import forestry.api.apiculture.IBeeRoot;
+import java.util.ArrayList;
+import java.util.List;
+import net.minecraft.world.biome.BiomeGenBase;
+
+public class ControlBiomes
+ extends Control
+ implements ITooltip
+{
+ public ControlBiomes(IWidget parent, int x, int y, int width, int height)
+ {
+ super(parent, x, y, width * 16, height * 16);
+ addAttribute(Attribute.MouseOver);
+ }
+
+ List<Integer> tolerated = new ArrayList();
+
+ public void getTooltip(Tooltip list)
+ {
+ if (this.tolerated.isEmpty()) {
+ return;
+ }
+ int x = (int)(getRelativeMousePosition().x() / 16.0F);
+ int y = (int)(getRelativeMousePosition().y() / 16.0F);
+
+ int i = x + y * 8;
+ if (i < this.tolerated.size()) {
+ list.add(BiomeGenBase.getBiome(((Integer)this.tolerated.get(i)).intValue()).biomeName);
+ }
+ }
+
+ public void onRenderForeground()
+ {
+ for (int i = 0; i < this.tolerated.size(); i++)
+ {
+ int x = i % 8 * 16;
+ int y = i / 8 * 16;
+ if (BiomeGenBase.getBiome(i) != null) {
+ CraftGUI.Render.colour(BiomeGenBase.getBiome(i).color);
+ }
+ CraftGUI.Render.texture(CraftGUITexture.Button, new IArea(x, y, 16.0F, 16.0F));
+ }
+ }
+
+ public void setSpecies(IAlleleBeeSpecies species)
+ {
+ this.tolerated.clear();
+ if (species == null) {
+ return;
+ }
+ IBeeGenome genome = Binnie.Genetics.getBeeRoot().templateAsGenome(Binnie.Genetics.getBeeRoot().getTemplate(species.getUID()));
+
+
+ IBee bee = Binnie.Genetics.getBeeRoot().getBee(BinnieCore.proxy.getWorld(), genome);
+ }
+}
diff --git a/src/Java/binnie/extrabees/gui/database/ControlClimateBar.java b/src/Java/binnie/extrabees/gui/database/ControlClimateBar.java
new file mode 100644
index 0000000000..688bbd40c5
--- /dev/null
+++ b/src/Java/binnie/extrabees/gui/database/ControlClimateBar.java
@@ -0,0 +1,153 @@
+package binnie.extrabees.gui.database;
+
+import binnie.Binnie;
+import binnie.core.genetics.ManagerGenetics;
+import binnie.craftgui.controls.core.Control;
+import binnie.craftgui.core.Attribute;
+import binnie.craftgui.core.CraftGUI;
+import binnie.craftgui.core.ITooltip;
+import binnie.craftgui.core.IWidget;
+import binnie.craftgui.core.Tooltip;
+import binnie.craftgui.core.geometry.IArea;
+import binnie.craftgui.core.geometry.IPoint;
+import binnie.craftgui.core.renderer.Renderer;
+import binnie.craftgui.resource.minecraft.CraftGUITexture;
+import forestry.api.apiculture.IAlleleBeeSpecies;
+import forestry.api.apiculture.IBeeGenome;
+import forestry.api.apiculture.IBeeRoot;
+import forestry.api.core.EnumHumidity;
+import forestry.api.core.EnumTemperature;
+import forestry.api.genetics.EnumTolerance;
+import java.util.ArrayList;
+import java.util.List;
+
+public class ControlClimateBar
+ extends Control
+ implements ITooltip
+{
+ public ControlClimateBar(IWidget parent, int x, int y, int width, int height)
+ {
+ super(parent, x, y, width, height);
+ addAttribute(Attribute.MouseOver);
+ }
+
+ public ControlClimateBar(IWidget parent, int x, int y, int width, int height, boolean humidity)
+ {
+ super(parent, x, y, width, height);
+ addAttribute(Attribute.MouseOver);
+ this.isHumidity = true;
+ }
+
+ boolean isHumidity = false;
+ List<Integer> tolerated = new ArrayList();
+
+ public void getTooltip(Tooltip list)
+ {
+ if (this.tolerated.isEmpty()) {
+ return;
+ }
+ int types = this.isHumidity ? 3 : 6;
+
+ int type = (int)((int)(getRelativeMousePosition().x() - 1.0F) / ((getSize().x() - 2.0F) / types));
+ if (!this.tolerated.contains(Integer.valueOf(type))) {
+ return;
+ }
+ if (type < types) {
+ if (this.isHumidity) {
+ list.add(EnumHumidity.values()[type].name);
+ } else {
+ list.add(EnumTemperature.values()[(type + 1)].name);
+ }
+ }
+ }
+
+ int[] tempColours = { 65531, 7912447, 5242672, 16776960, 16753152, 16711680 };
+ int[] humidColours = { 16770979, 1769216, 3177727 };
+
+ public void onRenderBackground()
+ {
+ CraftGUI.Render.texture(CraftGUITexture.EnergyBarBack, getArea());
+
+ int types = this.isHumidity ? 3 : 6;
+ int w = (int)((getSize().x() - 2.0F) / types);
+ for (int i = 0; i < types; i++)
+ {
+ int x = i * w;
+ if (this.tolerated.contains(Integer.valueOf(i)))
+ {
+ int colour = 0;
+ if (this.isHumidity) {
+ colour = this.humidColours[i];
+ } else {
+ colour = this.tempColours[i];
+ }
+ CraftGUI.Render.solid(new IArea(x + 1, 1.0F, w, getSize().y() - 2.0F), colour);
+ }
+ }
+ CraftGUI.Render.texture(CraftGUITexture.EnergyBarGlass, getArea());
+ }
+
+ public void setSpecies(IAlleleBeeSpecies species)
+ {
+ this.tolerated.clear();
+ if (species == null) {
+ return;
+ }
+ EnumTolerance tolerance;
+ int main;
+ EnumTolerance tolerance;
+ if (!this.isHumidity)
+ {
+ int main = species.getTemperature().ordinal() - 1;
+ IBeeGenome genome = Binnie.Genetics.getBeeRoot().templateAsGenome(Binnie.Genetics.getBeeRoot().getTemplate(species.getUID()));
+
+
+ tolerance = genome.getToleranceTemp();
+ }
+ else
+ {
+ main = species.getHumidity().ordinal();
+ IBeeGenome genome = Binnie.Genetics.getBeeRoot().templateAsGenome(Binnie.Genetics.getBeeRoot().getTemplate(species.getUID()));
+
+
+ tolerance = genome.getToleranceHumid();
+ }
+ this.tolerated.add(Integer.valueOf(main));
+ switch (1.$SwitchMap$forestry$api$genetics$EnumTolerance[tolerance.ordinal()])
+ {
+ case 1:
+ case 2:
+ this.tolerated.add(Integer.valueOf(main + 5));
+ case 3:
+ case 4:
+ this.tolerated.add(Integer.valueOf(main + 4));
+ case 5:
+ case 6:
+ this.tolerated.add(Integer.valueOf(main + 3));
+ case 7:
+ case 8:
+ this.tolerated.add(Integer.valueOf(main + 2));
+ case 9:
+ case 10:
+ this.tolerated.add(Integer.valueOf(main + 1));
+ }
+ switch (1.$SwitchMap$forestry$api$genetics$EnumTolerance[tolerance.ordinal()])
+ {
+ case 1:
+ case 11:
+ this.tolerated.add(Integer.valueOf(main - 5));
+ case 3:
+ case 12:
+ this.tolerated.add(Integer.valueOf(main - 4));
+ case 5:
+ case 13:
+ this.tolerated.add(Integer.valueOf(main - 3));
+ case 7:
+ case 14:
+ this.tolerated.add(Integer.valueOf(main - 2));
+ case 9:
+ case 15:
+ this.tolerated.add(Integer.valueOf(main - 1));
+ }
+ }
+}
diff --git a/src/Java/binnie/extrabees/gui/database/ControlProductsBox.java b/src/Java/binnie/extrabees/gui/database/ControlProductsBox.java
new file mode 100644
index 0000000000..f6103f9bba
--- /dev/null
+++ b/src/Java/binnie/extrabees/gui/database/ControlProductsBox.java
@@ -0,0 +1,92 @@
+package binnie.extrabees.gui.database;
+
+import binnie.Binnie;
+import binnie.core.BinnieCore;
+import binnie.core.genetics.ManagerGenetics;
+import binnie.core.proxy.BinnieProxy;
+import binnie.craftgui.controls.listbox.ControlList;
+import binnie.craftgui.controls.listbox.ControlListBox;
+import binnie.craftgui.core.IWidget;
+import forestry.api.apiculture.IAlleleBeeSpecies;
+import forestry.api.apiculture.IBeeGenome;
+import forestry.api.apiculture.IBeeRoot;
+import forestry.api.apiculture.IBeekeepingMode;
+import forestry.api.genetics.IAllele;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import net.minecraft.item.ItemStack;
+
+public class ControlProductsBox
+ extends ControlListBox<Product>
+{
+ private int index;
+ private Type type;
+
+ public IWidget createOption(Product value, int y)
+ {
+ return new ControlProductsItem((ControlList)getContent(), value, y);
+ }
+
+ static enum Type
+ {
+ Products, Specialties;
+
+ private Type() {}
+ }
+
+ class Product
+ {
+ ItemStack item;
+ float chance;
+
+ public Product(ItemStack item, float chance)
+ {
+ this.item = item;
+ this.chance = chance;
+ }
+ }
+
+ public ControlProductsBox(IWidget parent, int x, int y, int width, int height, Type type)
+ {
+ super(parent, x, y, width, height, 12.0F);
+ this.type = type;
+ }
+
+ IAlleleBeeSpecies species = null;
+
+ public void setSpecies(IAlleleBeeSpecies species)
+ {
+ if (species != this.species)
+ {
+ this.species = species;
+ if (species != null)
+ {
+ IAllele[] template = Binnie.Genetics.getBeeRoot().getTemplate(species.getUID());
+ if (template == null) {
+ return;
+ }
+ IBeeGenome genome = Binnie.Genetics.getBeeRoot().templateAsGenome(template);
+
+ float speed = genome.getSpeed();
+
+ float modeSpeed = Binnie.Genetics.getBeeRoot().getBeekeepingMode(BinnieCore.proxy.getWorld()).getProductionModifier(genome, 1.0F);
+
+
+
+ List<Product> strings = new ArrayList();
+ if (this.type == Type.Products) {
+ for (Map.Entry<ItemStack, Integer> entry : species.getProducts().entrySet()) {
+ strings.add(new Product((ItemStack)entry.getKey(), speed * modeSpeed * ((Integer)entry.getValue()).intValue()));
+ }
+ } else {
+ for (Map.Entry<ItemStack, Integer> entry : species.getSpecialty().entrySet()) {
+ strings.add(new Product((ItemStack)entry.getKey(), speed * modeSpeed * ((Integer)entry.getValue()).intValue()));
+ }
+ }
+ setOptions(strings);
+ }
+ }
+ }
+}
diff --git a/src/Java/binnie/extrabees/gui/database/ControlProductsItem.java b/src/Java/binnie/extrabees/gui/database/ControlProductsItem.java
new file mode 100644
index 0000000000..4f449e3558
--- /dev/null
+++ b/src/Java/binnie/extrabees/gui/database/ControlProductsItem.java
@@ -0,0 +1,44 @@
+package binnie.extrabees.gui.database;
+
+import binnie.craftgui.controls.ControlText;
+import binnie.craftgui.controls.ControlTextCentered;
+import binnie.craftgui.controls.listbox.ControlList;
+import binnie.craftgui.controls.listbox.ControlOption;
+import binnie.craftgui.core.geometry.CraftGUIUtil;
+import binnie.craftgui.core.geometry.IPoint;
+import binnie.craftgui.minecraft.control.ControlItemDisplay;
+import java.text.DecimalFormat;
+
+public class ControlProductsItem
+ extends ControlOption<ControlProductsBox.Product>
+{
+ ControlItemDisplay item;
+
+ public ControlProductsItem(ControlList<ControlProductsBox.Product> controlList, ControlProductsBox.Product value, int y)
+ {
+ super(controlList, value, y);
+ this.item = new ControlItemDisplay(this, 4.0F, 4.0F);
+ this.item.setTooltip();
+
+ ControlText textWidget = new ControlTextCentered(this, 2.0F, "");
+ CraftGUIUtil.moveWidget(textWidget, new IPoint(12.0F, 0.0F));
+ if (value != null)
+ {
+ this.item.setItemStack(value.item);
+ float time = (int)(55000.0D / value.chance);
+
+ float seconds = time / 20.0F;
+ float minutes = seconds / 60.0F;
+ float hours = minutes / 60.0F;
+
+ DecimalFormat df = new DecimalFormat("#.0");
+ if (hours > 1.0F) {
+ textWidget.setValue("Every " + df.format(hours) + " hours");
+ } else if (minutes > 1.0F) {
+ textWidget.setValue("Every " + df.format(minutes) + " min.");
+ } else {
+ textWidget.setValue("Every " + df.format(seconds) + " sec.");
+ }
+ }
+ }
+}
diff --git a/src/Java/binnie/extrabees/gui/database/PageSpeciesClimate.java b/src/Java/binnie/extrabees/gui/database/PageSpeciesClimate.java
new file mode 100644
index 0000000000..3b93ff1b3c
--- /dev/null
+++ b/src/Java/binnie/extrabees/gui/database/PageSpeciesClimate.java
@@ -0,0 +1,36 @@
+package binnie.extrabees.gui.database;
+
+import binnie.craftgui.controls.ControlTextCentered;
+import binnie.craftgui.core.IWidget;
+import binnie.craftgui.mod.database.DatabaseTab;
+import binnie.craftgui.mod.database.PageSpecies;
+import forestry.api.apiculture.IAlleleBeeSpecies;
+import forestry.api.genetics.IAlleleSpecies;
+
+public class PageSpeciesClimate
+ extends PageSpecies
+{
+ ControlClimateBar tempBar;
+ ControlClimateBar humidBar;
+ ControlBiomes biomes;
+
+ public PageSpeciesClimate(IWidget parent, DatabaseTab tab)
+ {
+ super(parent, tab);
+
+ new ControlTextCentered(this, 8.0F, "Climate");
+
+ this.tempBar = new ControlClimateBar(this, 8, 24, 128, 12);
+ this.humidBar = new ControlClimateBar(this, 8, 42, 128, 12, true);
+ new ControlTextCentered(this, 70.0F, "Biomes");
+
+ this.biomes = new ControlBiomes(this, 8, 90, 8, 4);
+ }
+
+ public void onValueChanged(IAlleleSpecies species)
+ {
+ this.tempBar.setSpecies((IAlleleBeeSpecies)species);
+ this.humidBar.setSpecies((IAlleleBeeSpecies)species);
+ this.biomes.setSpecies((IAlleleBeeSpecies)species);
+ }
+}
diff --git a/src/Java/binnie/extrabees/gui/database/PageSpeciesGenome.java b/src/Java/binnie/extrabees/gui/database/PageSpeciesGenome.java
new file mode 100644
index 0000000000..a69e528d51
--- /dev/null
+++ b/src/Java/binnie/extrabees/gui/database/PageSpeciesGenome.java
@@ -0,0 +1,206 @@
+package binnie.extrabees.gui.database;
+
+import binnie.Binnie;
+import binnie.core.BinnieCore;
+import binnie.core.genetics.ManagerGenetics;
+import binnie.core.proxy.BinnieProxy;
+import binnie.craftgui.controls.ControlText;
+import binnie.craftgui.controls.ControlTextCentered;
+import binnie.craftgui.core.IWidget;
+import binnie.craftgui.core.geometry.IArea;
+import binnie.craftgui.core.geometry.TextJustification;
+import binnie.craftgui.mod.database.DatabaseTab;
+import binnie.craftgui.mod.database.PageSpecies;
+import forestry.api.apiculture.IAlleleBeeEffect;
+import forestry.api.apiculture.IAlleleBeeSpecies;
+import forestry.api.apiculture.IBee;
+import forestry.api.apiculture.IBeeGenome;
+import forestry.api.apiculture.IBeeRoot;
+import forestry.api.genetics.IAllele;
+import forestry.api.genetics.IAlleleSpecies;
+import forestry.api.genetics.IFlowerProvider;
+
+public class PageSpeciesGenome
+ extends PageSpecies
+{
+ ControlText pageSpeciesGenome_Title;
+ ControlText pageSpeciesGenome_SpeedText;
+ ControlText pageSpeciesGenome_LifespanText;
+ ControlText pageSpeciesGenome_FertilityText;
+ ControlText pageSpeciesGenome_FloweringText;
+ ControlText pageSpeciesGenome_TerritoryText;
+ ControlText pageSpeciesGenome_NocturnalText;
+ ControlText pageSpeciesGenome_CaveDwellingText;
+ ControlText pageSpeciesGenome_TolerantFlyerText;
+ ControlText pageSpeciesGenome_FlowerText;
+ ControlText pageSpeciesGenome_EffectText;
+
+ public PageSpeciesGenome(IWidget parent, DatabaseTab tab)
+ {
+ super(parent, tab);
+
+ this.pageSpeciesGenome_Title = new ControlTextCentered(this, 8.0F, "Genome");
+
+ new ControlText(this, new IArea(0.0F, 32.0F, 68.0F, 30.0F), "Speed:", TextJustification.TopRight);
+ new ControlText(this, new IArea(0.0F, 44.0F, 68.0F, 30.0F), "Lifespan:", TextJustification.TopRight);
+ new ControlText(this, new IArea(0.0F, 56.0F, 68.0F, 30.0F), "Fertility:", TextJustification.TopRight);
+ new ControlText(this, new IArea(0.0F, 68.0F, 68.0F, 30.0F), "Flowering:", TextJustification.TopRight);
+ new ControlText(this, new IArea(0.0F, 80.0F, 68.0F, 30.0F), "Territory:", TextJustification.TopRight);
+ new ControlText(this, new IArea(0.0F, 97.0F, 68.0F, 30.0F), "Behavior:", TextJustification.TopRight);
+ new ControlText(this, new IArea(0.0F, 109.0F, 68.0F, 30.0F), "Sunlight:", TextJustification.TopRight);
+ new ControlText(this, new IArea(0.0F, 121.0F, 68.0F, 30.0F), "Rain:", TextJustification.TopRight);
+ new ControlText(this, new IArea(0.0F, 138.0F, 68.0F, 30.0F), "Flower:", TextJustification.TopRight);
+ new ControlText(this, new IArea(0.0F, 155.0F, 68.0F, 30.0F), "Effect:", TextJustification.TopRight);
+
+ int x = 72;
+
+ this.pageSpeciesGenome_SpeedText = new ControlText(this, new IArea(x, 32.0F, 72.0F, 30.0F), "", TextJustification.TopLeft);
+
+ this.pageSpeciesGenome_LifespanText = new ControlText(this, new IArea(x, 44.0F, 72.0F, 30.0F), "", TextJustification.TopLeft);
+
+ this.pageSpeciesGenome_FertilityText = new ControlText(this, new IArea(x, 56.0F, 72.0F, 30.0F), "", TextJustification.TopLeft);
+
+ this.pageSpeciesGenome_FloweringText = new ControlText(this, new IArea(x, 68.0F, 72.0F, 30.0F), "", TextJustification.TopLeft);
+
+ this.pageSpeciesGenome_TerritoryText = new ControlText(this, new IArea(x, 80.0F, 72.0F, 30.0F), "", TextJustification.TopLeft);
+
+ this.pageSpeciesGenome_NocturnalText = new ControlText(this, new IArea(x, 97.0F, 72.0F, 30.0F), "", TextJustification.TopLeft);
+
+ this.pageSpeciesGenome_CaveDwellingText = new ControlText(this, new IArea(x, 109.0F, 72.0F, 30.0F), "", TextJustification.TopLeft);
+
+ this.pageSpeciesGenome_TolerantFlyerText = new ControlText(this, new IArea(x, 121.0F, 72.0F, 30.0F), "", TextJustification.TopLeft);
+
+ this.pageSpeciesGenome_FlowerText = new ControlText(this, new IArea(x, 138.0F, 72.0F, 30.0F), "", TextJustification.TopLeft);
+
+ this.pageSpeciesGenome_EffectText = new ControlText(this, new IArea(x, 155.0F, 72.0F, 30.0F), "", TextJustification.TopLeft);
+ }
+
+ public void onValueChanged(IAlleleSpecies species)
+ {
+ IAllele[] template = Binnie.Genetics.getBeeRoot().getTemplate(species.getUID());
+ if (template != null)
+ {
+ IBeeGenome genome = Binnie.Genetics.getBeeRoot().templateAsGenome(template);
+
+ IBee bee = Binnie.Genetics.getBeeRoot().getBee(BinnieCore.proxy.getWorld(), genome);
+
+
+ this.pageSpeciesGenome_SpeedText.setValue(rateSpeed(genome.getSpeed()));
+ this.pageSpeciesGenome_LifespanText.setValue(rateLifespan(genome.getLifespan()));
+
+ this.pageSpeciesGenome_FertilityText.setValue(genome.getFertility() + " children");
+
+ this.pageSpeciesGenome_FloweringText.setValue(rateFlowering(genome.getFlowering()));
+ int[] area = genome.getTerritory();
+ this.pageSpeciesGenome_TerritoryText.setValue(area[0] + "x" + area[1] + "x" + area[2]);
+
+
+ String behavior = "Daytime";
+ if (genome.getPrimary().isNocturnal()) {
+ behavior = "Nighttime";
+ }
+ if (genome.getNocturnal()) {
+ behavior = "All Day";
+ }
+ this.pageSpeciesGenome_NocturnalText.setValue(behavior);
+ if (genome.getCaveDwelling()) {
+ this.pageSpeciesGenome_CaveDwellingText.setValue("Not Needed");
+ } else {
+ this.pageSpeciesGenome_CaveDwellingText.setValue("Required");
+ }
+ this.pageSpeciesGenome_TolerantFlyerText.setValue(tolerated(genome.getTolerantFlyer()));
+ if (genome.getFlowerProvider() != null) {
+ this.pageSpeciesGenome_FlowerText.setValue(genome.getFlowerProvider().getDescription());
+ } else {
+ this.pageSpeciesGenome_FlowerText.setValue("None");
+ }
+ this.pageSpeciesGenome_EffectText.setValue(genome.getEffect().getName());
+ }
+ }
+
+ public static String rateFlowering(int flowering)
+ {
+ if (flowering >= 99) {
+ return "Maximum";
+ }
+ if (flowering >= 35) {
+ return "Fastest";
+ }
+ if (flowering >= 30) {
+ return "Faster";
+ }
+ if (flowering >= 25) {
+ return "Fast";
+ }
+ if (flowering >= 20) {
+ return "Normal";
+ }
+ if (flowering >= 15) {
+ return "Slow";
+ }
+ if (flowering >= 10) {
+ return "Slower";
+ }
+ return "Slowest";
+ }
+
+ public static String rateSpeed(float speed)
+ {
+ if (speed >= 1.7F) {
+ return "Fastest";
+ }
+ if (speed >= 1.4F) {
+ return "Faster";
+ }
+ if (speed >= 1.2F) {
+ return "Fast";
+ }
+ if (speed >= 1.0F) {
+ return "Normal";
+ }
+ if (speed >= 0.8F) {
+ return "Slow";
+ }
+ if (speed >= 0.6F) {
+ return "Slower";
+ }
+ return "Slowest";
+ }
+
+ public static String rateLifespan(int life)
+ {
+ if (life >= 70) {
+ return "Longest";
+ }
+ if (life >= 60) {
+ return "Longer";
+ }
+ if (life >= 50) {
+ return "Long";
+ }
+ if (life >= 45) {
+ return "Elongated";
+ }
+ if (life >= 40) {
+ return "Normal";
+ }
+ if (life >= 35) {
+ return "Shortened";
+ }
+ if (life >= 30) {
+ return "Short";
+ }
+ if (life >= 20) {
+ return "Shorter";
+ }
+ return "Shortest";
+ }
+
+ public static String tolerated(boolean t)
+ {
+ if (t) {
+ return "Tolerated";
+ }
+ return "Not Tolerated";
+ }
+}
diff --git a/src/Java/binnie/extrabees/gui/database/PageSpeciesProducts.java b/src/Java/binnie/extrabees/gui/database/PageSpeciesProducts.java
new file mode 100644
index 0000000000..f8af0ef3bd
--- /dev/null
+++ b/src/Java/binnie/extrabees/gui/database/PageSpeciesProducts.java
@@ -0,0 +1,38 @@
+package binnie.extrabees.gui.database;
+
+import binnie.craftgui.controls.ControlText;
+import binnie.craftgui.controls.ControlTextCentered;
+import binnie.craftgui.core.IWidget;
+import binnie.craftgui.mod.database.DatabaseTab;
+import binnie.craftgui.mod.database.PageSpecies;
+import forestry.api.apiculture.IAlleleBeeSpecies;
+import forestry.api.genetics.IAlleleSpecies;
+
+public class PageSpeciesProducts
+ extends PageSpecies
+{
+ ControlText pageSpeciesProducts_Title;
+ ControlProductsBox pageSpeciesProducts_Products;
+ ControlText pageSpeciesProducts_Title2;
+ ControlProductsBox pageSpeciesProducts_Specialties;
+
+ public PageSpeciesProducts(IWidget parent, DatabaseTab tab)
+ {
+ super(parent, tab);
+
+ this.pageSpeciesProducts_Title = new ControlTextCentered(this, 8.0F, "Products");
+
+ this.pageSpeciesProducts_Products = new ControlProductsBox(this, 4, 20, 136, 48, ControlProductsBox.Type.Products);
+
+
+ this.pageSpeciesProducts_Title2 = new ControlTextCentered(this, 68.0F, "Specialties");
+
+ this.pageSpeciesProducts_Specialties = new ControlProductsBox(this, 4, 80, 136, 48, ControlProductsBox.Type.Specialties);
+ }
+
+ public void onValueChanged(IAlleleSpecies species)
+ {
+ this.pageSpeciesProducts_Products.setSpecies((IAlleleBeeSpecies)species);
+ this.pageSpeciesProducts_Specialties.setSpecies((IAlleleBeeSpecies)species);
+ }
+}
diff --git a/src/Java/binnie/extrabees/gui/database/WindowApiaristDatabase.java b/src/Java/binnie/extrabees/gui/database/WindowApiaristDatabase.java
new file mode 100644
index 0000000000..d77ee87251
--- /dev/null
+++ b/src/Java/binnie/extrabees/gui/database/WindowApiaristDatabase.java
@@ -0,0 +1,83 @@
+package binnie.extrabees.gui.database;
+
+import binnie.Binnie;
+import binnie.core.AbstractMod;
+import binnie.core.genetics.ManagerGenetics;
+import binnie.craftgui.minecraft.Window;
+import binnie.craftgui.mod.database.DatabaseTab;
+import binnie.craftgui.mod.database.PageBranchOverview;
+import binnie.craftgui.mod.database.PageBranchSpecies;
+import binnie.craftgui.mod.database.PageBreeder;
+import binnie.craftgui.mod.database.PageSpeciesClassification;
+import binnie.craftgui.mod.database.PageSpeciesMutations;
+import binnie.craftgui.mod.database.PageSpeciesOverview;
+import binnie.craftgui.mod.database.PageSpeciesResultant;
+import binnie.craftgui.mod.database.WindowAbstractDatabase;
+import binnie.craftgui.mod.database.WindowAbstractDatabase.Mode;
+import binnie.extrabees.ExtraBees;
+import cpw.mods.fml.relauncher.Side;
+import net.minecraft.entity.player.EntityPlayer;
+
+public class WindowApiaristDatabase
+ extends WindowAbstractDatabase
+{
+ static enum SpeciesTab
+ {
+ Overview(255), Genome(16776960), Productivity(65535), Climate(16711680), ResultantMutations(16711935), FurtherMutations(65280);
+
+ public int colour;
+
+ private SpeciesTab(int colour)
+ {
+ this.colour = colour;
+ }
+ }
+
+ static enum BranchesTab
+ {
+ Overview(255), Species(16711680);
+
+ public int colour;
+
+ private BranchesTab(int colour)
+ {
+ this.colour = colour;
+ }
+ }
+
+ protected void addTabs()
+ {
+ new PageSpeciesOverview(getInfoPages(WindowAbstractDatabase.Mode.Species), new DatabaseTab(ExtraBees.instance, "species.overview", 0));
+ new PageSpeciesClassification(getInfoPages(WindowAbstractDatabase.Mode.Species), new DatabaseTab(ExtraBees.instance, "species.classification", 0));
+ new PageSpeciesGenome(getInfoPages(WindowAbstractDatabase.Mode.Species), new DatabaseTab(ExtraBees.instance, "species.genome", 0));
+ new PageSpeciesProducts(getInfoPages(WindowAbstractDatabase.Mode.Species), new DatabaseTab(ExtraBees.instance, "species.products", 0));
+ new PageSpeciesClimate(getInfoPages(WindowAbstractDatabase.Mode.Species), new DatabaseTab(ExtraBees.instance, "species.climate", 0));
+ new PageSpeciesResultant(getInfoPages(WindowAbstractDatabase.Mode.Species), new DatabaseTab(ExtraBees.instance, "species.resultant", 0));
+ new PageSpeciesMutations(getInfoPages(WindowAbstractDatabase.Mode.Species), new DatabaseTab(ExtraBees.instance, "species.further", 0));
+
+ new PageBranchOverview(getInfoPages(WindowAbstractDatabase.Mode.Branches), new DatabaseTab(ExtraBees.instance, "branches.overview", 0));
+ new PageBranchSpecies(getInfoPages(WindowAbstractDatabase.Mode.Branches), new DatabaseTab(ExtraBees.instance, "branches.species", 0));
+
+ new PageBreeder(getInfoPages(WindowAbstractDatabase.Mode.Breeder), getUsername(), new DatabaseTab(ExtraBees.instance, "breeder", 0));
+ }
+
+ public WindowApiaristDatabase(EntityPlayer player, Side side, boolean nei)
+ {
+ super(player, side, nei, Binnie.Genetics.beeBreedingSystem, 110.0F);
+ }
+
+ public static Window create(EntityPlayer player, Side side, boolean nei)
+ {
+ return new WindowApiaristDatabase(player, side, nei);
+ }
+
+ public AbstractMod getMod()
+ {
+ return ExtraBees.instance;
+ }
+
+ public String getName()
+ {
+ return "Database";
+ }
+}
diff --git a/src/Java/binnie/extrabees/gui/punnett/ControlChromosome.java b/src/Java/binnie/extrabees/gui/punnett/ControlChromosome.java
new file mode 100644
index 0000000000..f4a7ffc507
--- /dev/null
+++ b/src/Java/binnie/extrabees/gui/punnett/ControlChromosome.java
@@ -0,0 +1,49 @@
+package binnie.extrabees.gui.punnett;
+
+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.ITooltip;
+import binnie.craftgui.core.IWidget;
+import binnie.craftgui.core.Tooltip;
+import binnie.craftgui.core.renderer.Renderer;
+import forestry.api.genetics.IChromosomeType;
+
+public class ControlChromosome
+ extends Control
+ implements IControlValue<IChromosomeType>, ITooltip
+{
+ IChromosomeType value;
+
+ protected ControlChromosome(IWidget parent, float x, float y, IChromosomeType type)
+ {
+ super(parent, x, y, 16.0F, 16.0F);
+ setValue(type);
+ addAttribute(Attribute.MouseOver);
+ }
+
+ public IChromosomeType getValue()
+ {
+ return this.value;
+ }
+
+ public void setValue(IChromosomeType value)
+ {
+ this.value = value;
+ }
+
+ public void onRenderBackground()
+ {
+ CraftGUI.Render.texture(ExtraBeeGUITexture.Chromosome, getArea());
+ CraftGUI.Render.colour(16711680);
+ CraftGUI.Render.texture(ExtraBeeGUITexture.Chromosome2, getArea());
+ }
+
+ public void getTooltip(Tooltip tooltip)
+ {
+ if (this.value != null) {
+ tooltip.add(this.value.getName());
+ }
+ }
+}
diff --git a/src/Java/binnie/extrabees/gui/punnett/ControlPunnett.java b/src/Java/binnie/extrabees/gui/punnett/ControlPunnett.java
new file mode 100644
index 0000000000..56b2f6c916
--- /dev/null
+++ b/src/Java/binnie/extrabees/gui/punnett/ControlPunnett.java
@@ -0,0 +1,86 @@
+package binnie.extrabees.gui.punnett;
+
+import binnie.craftgui.controls.ControlText;
+import binnie.craftgui.controls.core.Control;
+import binnie.craftgui.core.CraftGUI;
+import binnie.craftgui.core.IWidget;
+import binnie.craftgui.core.geometry.IArea;
+import binnie.craftgui.core.geometry.TextJustification;
+import binnie.craftgui.core.renderer.Renderer;
+import forestry.api.genetics.IAllele;
+import forestry.api.genetics.IChromosomeType;
+import forestry.api.genetics.IGenome;
+import forestry.api.genetics.IIndividual;
+import forestry.api.genetics.ISpeciesRoot;
+import java.util.LinkedList;
+import java.util.List;
+
+public class ControlPunnett
+ extends Control
+{
+ protected ControlPunnett(IWidget parent, float x, float y)
+ {
+ super(parent, x, y, boxWidth * 3, boxWidth * 3);
+ }
+
+ static int boxWidth = 80;
+ static int boxHeight = 28;
+
+ public void onRenderBackground()
+ {
+ CraftGUI.Render.solid(new IArea(0.0F, boxHeight, boxWidth * 3, 1.0F), 11184810);
+ CraftGUI.Render.solid(new IArea(boxWidth / 2.0F, boxHeight * 2, boxWidth * 2.5F, 1.0F), 11184810);
+
+ CraftGUI.Render.solid(new IArea(boxWidth, 0.0F, 1.0F, boxHeight * 3), 11184810);
+ CraftGUI.Render.solid(new IArea(boxWidth * 2, boxHeight / 2.0F, 1.0F, boxHeight * 2.5F), 11184810);
+ }
+
+ public void setup(IChromosomeType chromosome, IIndividual ind1, IIndividual ind2, ISpeciesRoot root)
+ {
+ deleteAllChildren();
+ if ((chromosome == null) || (ind1 == null) || (ind2 == null) || (root == null)) {
+ return;
+ }
+ IAllele primary1 = ind1.getGenome().getActiveAllele(chromosome);
+ IAllele primary2 = ind2.getGenome().getActiveAllele(chromosome);
+ IAllele secondary1 = ind1.getGenome().getInactiveAllele(chromosome);
+ IAllele secondary2 = ind2.getGenome().getInactiveAllele(chromosome);
+
+ int x = 1;
+ int y = 1;
+ for (IAllele allele1 : new IAllele[] { primary1, secondary1 })
+ {
+ y = 1;
+ for (IAllele allele2 : new IAllele[] { primary2, secondary2 })
+ {
+ List<IAllele> alleles = new LinkedList();
+ if ((allele1.isDominant()) && (!allele2.isDominant()))
+ {
+ alleles.add(allele1);
+ }
+ else if ((allele2.isDominant()) && (!allele1.isDominant()))
+ {
+ alleles.add(allele2);
+ }
+ else
+ {
+ alleles.add(allele1);
+ if (allele1 != allele2) {
+ alleles.add(allele2);
+ }
+ }
+ String text = "";
+ for (IAllele allele : alleles) {
+ text = text + allele.getName() + ": " + 25.0F / alleles.size() + "%\n";
+ }
+ new ControlText(this, new IArea(x * boxWidth, boxHeight * y, boxWidth, boxHeight), text, TextJustification.TopCenter).setColour(11184810);
+ y++;
+ }
+ x++;
+ }
+ new ControlText(this, new IArea(boxWidth, 0.0F, boxWidth, boxHeight), "\n" + primary1.getName(), TextJustification.TopCenter).setColour(11184810);
+ new ControlText(this, new IArea(boxWidth * 2, 0.0F, boxWidth, boxHeight), "\n" + secondary1.getName(), TextJustification.TopCenter).setColour(11184810);
+ new ControlText(this, new IArea(0.0F, boxHeight, boxWidth, boxHeight), primary2.getName(), TextJustification.TopCenter).setColour(11184810);
+ new ControlText(this, new IArea(0.0F, boxHeight * 2, boxWidth, boxHeight), primary2.getName(), TextJustification.TopCenter).setColour(11184810);
+ }
+}
diff --git a/src/Java/binnie/extrabees/gui/punnett/ExtraBeeGUITexture.java b/src/Java/binnie/extrabees/gui/punnett/ExtraBeeGUITexture.java
new file mode 100644
index 0000000000..eac77aabf9
--- /dev/null
+++ b/src/Java/binnie/extrabees/gui/punnett/ExtraBeeGUITexture.java
@@ -0,0 +1,8 @@
+package binnie.extrabees.gui.punnett;
+
+public enum ExtraBeeGUITexture
+{
+ Chromosome, Chromosome2;
+
+ private ExtraBeeGUITexture() {}
+}
diff --git a/src/Java/binnie/extrabees/gui/punnett/WindowPunnettSquare.java b/src/Java/binnie/extrabees/gui/punnett/WindowPunnettSquare.java
new file mode 100644
index 0000000000..488f2b6922
--- /dev/null
+++ b/src/Java/binnie/extrabees/gui/punnett/WindowPunnettSquare.java
@@ -0,0 +1,67 @@
+package binnie.extrabees.gui.punnett;
+
+import binnie.core.AbstractMod;
+import binnie.craftgui.core.CraftGUI;
+import binnie.craftgui.core.renderer.Renderer;
+import binnie.craftgui.minecraft.Window;
+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.ExtraBees;
+import binnie.extrabees.core.ExtraBeeTexture;
+import cpw.mods.fml.relauncher.Side;
+import forestry.api.genetics.ISpeciesRoot;
+import java.util.Map;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.IInventory;
+
+public class WindowPunnettSquare
+ extends Window
+{
+ ControlSlot bee1;
+ ControlSlot bee2;
+ ControlPunnett punnett;
+
+ public static Window create(EntityPlayer player, IInventory inventory, Side side)
+ {
+ return new WindowPunnettSquare(player, inventory, side);
+ }
+
+ public WindowPunnettSquare(EntityPlayer player, IInventory inventory, Side side)
+ {
+ super(245.0F, 205.0F, player, inventory, side);
+ }
+
+ public AbstractMod getMod()
+ {
+ return ExtraBees.instance;
+ }
+
+ public String getName()
+ {
+ return "Punnett";
+ }
+
+ public void initialiseClient()
+ {
+ setTitle("Punnett Square");
+
+ CraftGUI.Render.stylesheet(new StyleSheetPunnett());
+ }
+
+ ISpeciesRoot root = null;
+
+ 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));
+ }
+ }
+}
diff --git a/src/Java/binnie/extrabees/liquids/ExtraBeeLiquid.java b/src/Java/binnie/extrabees/liquids/ExtraBeeLiquid.java
new file mode 100644
index 0000000000..a7ed929fb7
--- /dev/null
+++ b/src/Java/binnie/extrabees/liquids/ExtraBeeLiquid.java
@@ -0,0 +1,80 @@
+package binnie.extrabees.liquids;
+
+import binnie.Binnie;
+import binnie.core.liquid.FluidContainer;
+import binnie.core.liquid.ILiquidType;
+import binnie.core.liquid.ManagerLiquid;
+import binnie.extrabees.ExtraBees;
+import binnie.extrabees.proxy.ExtraBeesProxy;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.util.IIcon;
+import net.minecraftforge.fluids.FluidStack;
+
+public enum ExtraBeeLiquid
+ implements ILiquidType
+{
+ ACID("acid", 11528985), POISON("poison", 15406315), GLACIAL("liquidnitrogen", 9881800);
+
+ String ident;
+ IIcon icon;
+ int colour;
+
+ private ExtraBeeLiquid(String ident, int colour)
+ {
+ this.ident = ident;
+ this.colour = colour;
+ }
+
+ public IIcon getIcon()
+ {
+ return this.icon;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void registerIcon(IIconRegister register)
+ {
+ this.icon = ExtraBees.proxy.getIcon(register, "liquids/" + getIdentifier());
+ }
+
+ public String getName()
+ {
+ return ExtraBees.proxy.localise(toString().toLowerCase());
+ }
+
+ public String getIdentifier()
+ {
+ return this.ident;
+ }
+
+ public int getColour()
+ {
+ return 16777215;
+ }
+
+ public FluidStack get(int amount)
+ {
+ return Binnie.Liquid.getLiquidStack(this.ident, amount);
+ }
+
+ public int getTransparency()
+ {
+ return 255;
+ }
+
+ public boolean canPlaceIn(FluidContainer container)
+ {
+ return true;
+ }
+
+ public boolean showInCreative(FluidContainer container)
+ {
+ return (container == FluidContainer.Bucket) || (container == FluidContainer.Can) || (container == FluidContainer.Capsule) || (container == FluidContainer.Refractory);
+ }
+
+ public int getContainerColour()
+ {
+ return this.colour;
+ }
+}
diff --git a/src/Java/binnie/extrabees/liquids/ModuleLiquids.java b/src/Java/binnie/extrabees/liquids/ModuleLiquids.java
new file mode 100644
index 0000000000..5db86e205a
--- /dev/null
+++ b/src/Java/binnie/extrabees/liquids/ModuleLiquids.java
@@ -0,0 +1,19 @@
+package binnie.extrabees.liquids;
+
+import binnie.Binnie;
+import binnie.core.IInitializable;
+import binnie.core.liquid.ItemFluidContainer;
+import binnie.core.liquid.ManagerLiquid;
+
+public class ModuleLiquids
+ implements IInitializable
+{
+ public void preInit()
+ {
+ Binnie.Liquid.createLiquids(ExtraBeeLiquid.values(), ItemFluidContainer.LiquidExtraBee);
+ }
+
+ public void init() {}
+
+ public void postInit() {}
+}
diff --git a/src/Java/binnie/extrabees/products/EnumHoneyComb.java b/src/Java/binnie/extrabees/products/EnumHoneyComb.java
new file mode 100644
index 0000000000..5c480d0a04
--- /dev/null
+++ b/src/Java/binnie/extrabees/products/EnumHoneyComb.java
@@ -0,0 +1,109 @@
+package binnie.extrabees.products;
+
+import binnie.core.item.IItemEnum;
+import binnie.extrabees.ExtraBees;
+import binnie.extrabees.proxy.ExtraBeesProxy;
+import forestry.api.recipes.ICentrifugeManager;
+import forestry.api.recipes.RecipeManagers;
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.oredict.OreDictionary;
+
+public enum EnumHoneyComb
+ implements IItemEnum
+{
+ BARREN(7564356, 12762791), ROTTEN(4084257, 11652233), BONE(12895407, 14606017), OIL(394760, 2894646), COAL(10392696, 3682590), FUEL(10252096, 16761856), WATER(2568911, 7973065), MILK(14145991, 16777215), FRUIT(8202548, 14372706), SEED(3428147, 7457902), ALCOHOL(4293921, 14604622), STONE(9211025, 13027020), REDSTONE(16422550, 15077392), RESIN(16762703, 13208064), IC2ENERGY(15332623, 2143177), IRON(3552564, 11038808), GOLD(3552564, 15125515), COPPER(3552564, 13722376), TIN(3552564, 12431805), SILVER(3552564, 14408667), BRONZE, URANIUM(2031360, 4303667), CLAY(7034426, 11583702), OLD(4535060, 11769444), FUNGAL(7234891, 2856003), CREOSOTE(10256652, 12429911), LATEX(5854529, 11051653), ACIDIC(3441987, 1374014), VENOMOUS(8198269, 16724991), SLIME(3884860, 8442245), BLAZE(16738816, 16763904), COFFEE(5519389, 11763531), GLACIAL(5146503, 13366002), MINT, CITRUS, PEAT, SHADOW(0, 3545141), LEAD(3552564, 10125468), BRASS, ELECTRUM, ZINC(3552564, 15592447), TITANIUM(3552564, 11578083), TUNGSTEN(3552564, 1249812), STEEL, IRIDIUM, PLATINUM(3552564, 10125468), LAPIS(3552564, 4009179), SODALITE, PYRITE, BAUXITE, CINNABAR, SPHALERITE, EMERALD(3552564, 1900291), RUBY(3552564, 14024704), SAPPHIRE(3552564, 673791), OLIVINE, DIAMOND(3552564, 8371706), RED(13388876, 16711680), YELLOW(15066419, 16768256), BLUE(10072818, 8959), GREEN(6717235, 39168), BLACK(1644825, 5723991), WHITE(14079702, 16777215), BROWN(8349260, 6042895), ORANGE(15905331, 16751872), CYAN(5020082, 65509), PURPLE(11691749, 11403519), GRAY(5000268, 12237498), LIGHTBLUE(10072818, 40447), PINK(15905484, 16744671), LIMEGREEN(8375321, 65288), MAGENTA(15040472, 16711884), LIGHTGRAY(10066329, 13224393), NICKEL(3552564, 16768764), INVAR, GLOWSTONE(10919006, 14730249), SALTPETER(10919006, 14730249), PULP, MULCH, COMPOST(4338440, 7036475), SAWDUST(12561009, 15913854), CERTUS(13029631, 3755363), ENDERPEARL(3446662, 206368), YELLORIUM(2564173, 14019840), CYANITE(2564173, 34541), BLUTONIUM(2564173, 1769702);
+
+ int[] colour = new int[0];
+ public Map<ItemStack, Integer> products = new LinkedHashMap();
+ boolean active = true;
+ public boolean deprecated = false;
+
+ private EnumHoneyComb()
+ {
+ this(16777215, 16777215);
+ this.active = false;
+ this.deprecated = true;
+ }
+
+ private EnumHoneyComb(int colour, int colour2)
+ {
+ this.colour = new int[] { colour, colour2 };
+ }
+
+ public void addRecipe()
+ {
+ int[] chancesI = new int[this.products.size()];
+ ItemStack[] productsI = new ItemStack[this.products.size()];
+
+ int i = 0;
+ for (Map.Entry<ItemStack, Integer> entry : this.products.entrySet())
+ {
+ chancesI[i] = ((Integer)entry.getValue()).intValue();
+ productsI[i] = ((ItemStack)entry.getKey());
+ i++;
+ }
+ RecipeManagers.centrifugeManager.addRecipe(20, get(1), productsI, chancesI);
+ }
+
+ public boolean isActive()
+ {
+ return this.active;
+ }
+
+ public static EnumHoneyComb get(ItemStack itemStack)
+ {
+ int i = itemStack.getItemDamage();
+ if ((i >= 0) && (i < values().length)) {
+ return values()[i];
+ }
+ return values()[0];
+ }
+
+ public ItemStack get(int size)
+ {
+ return new ItemStack(ExtraBees.comb, size, ordinal());
+ }
+
+ public String getName(ItemStack stack)
+ {
+ return ExtraBees.proxy.localise("item.comb." + name().toLowerCase());
+ }
+
+ public boolean addProduct(ItemStack item, int chance)
+ {
+ if (item == null) {
+ return false;
+ }
+ this.products.put(item.copy(), Integer.valueOf(chance));
+ return true;
+ }
+
+ public void tryAddProduct(ItemStack item, int chance)
+ {
+ this.active = addProduct(item, chance);
+ }
+
+ public void tryAddProduct(String oreDict, int chance)
+ {
+ if (!OreDictionary.getOres(oreDict).isEmpty()) {
+ tryAddProduct((ItemStack)OreDictionary.getOres(oreDict).get(0), chance);
+ } else {
+ this.active = false;
+ }
+ }
+
+ public void tryAddProduct(IItemEnum type, int chance)
+ {
+ tryAddProduct(type.get(1), chance);
+ this.active = ((this.active) && (type.isActive()));
+ }
+
+ public void copyProducts(EnumHoneyComb comb)
+ {
+ this.products.putAll(comb.products);
+ }
+}
diff --git a/src/Java/binnie/extrabees/products/EnumHoneyDrop.java b/src/Java/binnie/extrabees/products/EnumHoneyDrop.java
new file mode 100644
index 0000000000..c3ea6c2cdd
--- /dev/null
+++ b/src/Java/binnie/extrabees/products/EnumHoneyDrop.java
@@ -0,0 +1,72 @@
+package binnie.extrabees.products;
+
+import binnie.Binnie;
+import binnie.core.item.IItemEnum;
+import binnie.core.liquid.ManagerLiquid;
+import binnie.extrabees.ExtraBees;
+import binnie.extrabees.proxy.ExtraBeesProxy;
+import forestry.api.recipes.ISqueezerManager;
+import forestry.api.recipes.RecipeManagers;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.fluids.FluidRegistry;
+import net.minecraftforge.fluids.FluidStack;
+
+public enum EnumHoneyDrop
+ implements IItemEnum
+{
+ ENERGY(10242418, 14905713, ""), ACID(4961601, 4841020, "acid"), POISON(13698745, 16712674, "poison"), APPLE(13062738, 13183530, "juice"), CITRUS, ICE(11462882, 9895925, "liquidnitrogen"), MILK(14737632, 16777215, "milk"), SEED(8176242, 12762791, "seedoil"), ALCOHOL(14411853, 10872909, "short.mead"), FRUIT, VEGETABLE, PUMPKIN, MELON, RED(13388876, 16711680, "for.honey"), YELLOW(15066419, 16768256, "for.honey"), BLUE(10072818, 8959, "for.honey"), GREEN(6717235, 39168, "for.honey"), BLACK(1644825, 5723991, "for.honey"), WHITE(14079702, 16777215, "for.honey"), BROWN(8349260, 6042895, "for.honey"), ORANGE(15905331, 16751872, "for.honey"), CYAN(5020082, 65509, "for.honey"), PURPLE(11691749, 11403519, "for.honey"), GRAY(5000268, 12237498, "for.honey"), LIGHTBLUE(10072818, 40447, "for.honey"), PINK(15905484, 16744671, "for.honey"), LIMEGREEN(8375321, 65288, "for.honey"), MAGENTA(15040472, 16711884, "for.honey"), LIGHTGRAY(10066329, 13224393, "for.honey");
+
+ int[] colour;
+ String liquidName = "";
+ ItemStack remenant = null;
+ public boolean deprecated = false;
+
+ public void addRemenant(ItemStack stack)
+ {
+ this.remenant = stack;
+ this.deprecated = true;
+ }
+
+ private EnumHoneyDrop()
+ {
+ this(16777215, 16777215, "");
+ }
+
+ private EnumHoneyDrop(int colour, int colour2, String liquid)
+ {
+ this.colour = new int[] { colour, colour2 };
+ this.liquidName = liquid;
+ }
+
+ public void addRecipe()
+ {
+ FluidStack liquid = Binnie.Liquid.getLiquidStack(this.liquidName, 200);
+ if (liquid != null) {
+ RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[] { get(1) }, liquid, this.remenant, 100);
+ }
+ }
+
+ public boolean isActive()
+ {
+ return (!this.deprecated) && ((this.liquidName == null) || (FluidRegistry.isFluidRegistered(this.liquidName)));
+ }
+
+ public static EnumHoneyDrop get(ItemStack itemStack)
+ {
+ int i = itemStack.getItemDamage();
+ if ((i >= 0) && (i < values().length)) {
+ return values()[i];
+ }
+ return values()[0];
+ }
+
+ public ItemStack get(int size)
+ {
+ return new ItemStack(ExtraBees.honeyDrop, size, ordinal());
+ }
+
+ public String getName(ItemStack stack)
+ {
+ return ExtraBees.proxy.localise("item.honeydrop." + name().toLowerCase());
+ }
+}
diff --git a/src/Java/binnie/extrabees/products/EnumPropolis.java b/src/Java/binnie/extrabees/products/EnumPropolis.java
new file mode 100644
index 0000000000..0e8a11f18b
--- /dev/null
+++ b/src/Java/binnie/extrabees/products/EnumPropolis.java
@@ -0,0 +1,65 @@
+package binnie.extrabees.products;
+
+import binnie.Binnie;
+import binnie.core.item.IItemEnum;
+import binnie.core.liquid.ManagerLiquid;
+import binnie.extrabees.ExtraBees;
+import binnie.extrabees.proxy.ExtraBeesProxy;
+import forestry.api.recipes.ISqueezerManager;
+import forestry.api.recipes.RecipeManagers;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.fluids.FluidStack;
+
+public enum EnumPropolis
+ implements IItemEnum
+{
+ WATER(2405321, 12762791, "Water"), OIL(1519411, 12762791, "oil"), FUEL(10718482, 12762791, "fuel"), MILK, FRUIT, SEED, ALCOHOL, CREOSOTE(8877313, 12428819, "creosote"), GLACIAL, PEAT;
+
+ int[] colour = new int[0];
+ String liquidName;
+ boolean active = true;
+
+ private EnumPropolis()
+ {
+ this(16777215, 16777215, "");
+ this.active = false;
+ }
+
+ private EnumPropolis(int colour, int colour2, String liquid)
+ {
+ this.colour = new int[] { colour, colour2 };
+ this.liquidName = liquid;
+ }
+
+ public void addRecipe()
+ {
+ FluidStack liquid = Binnie.Liquid.getLiquidStack(this.liquidName, 500);
+ if (liquid != null) {
+ RecipeManagers.squeezerManager.addRecipe(20, new ItemStack[] { get(1) }, liquid, null, 0);
+ }
+ }
+
+ public boolean isActive()
+ {
+ return (this.active) && (Binnie.Liquid.getLiquidStack(this.liquidName, 100) != null);
+ }
+
+ public static EnumPropolis get(ItemStack itemStack)
+ {
+ int i = itemStack.getItemDamage();
+ if ((i >= 0) && (i < values().length)) {
+ return values()[i];
+ }
+ return values()[0];
+ }
+
+ public ItemStack get(int size)
+ {
+ return new ItemStack(ExtraBees.propolis, size, ordinal());
+ }
+
+ public String getName(ItemStack stack)
+ {
+ return ExtraBees.proxy.localise("item.propolis." + name().toLowerCase());
+ }
+}
diff --git a/src/Java/binnie/extrabees/products/ItemHoneyComb.java b/src/Java/binnie/extrabees/products/ItemHoneyComb.java
new file mode 100644
index 0000000000..5cbbf8fe63
--- /dev/null
+++ b/src/Java/binnie/extrabees/products/ItemHoneyComb.java
@@ -0,0 +1,335 @@
+package binnie.extrabees.products;
+
+import binnie.core.BinnieCore;
+import binnie.core.Mods;
+import binnie.core.Mods.Mod;
+import binnie.core.proxy.BinnieProxy;
+import binnie.extrabees.ExtraBees;
+import binnie.extrabees.core.ExtraBeeItems;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import forestry.api.core.Tabs;
+import java.util.ArrayList;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.init.Blocks;
+import net.minecraft.init.Items;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.IIcon;
+import net.minecraftforge.oredict.OreDictionary;
+
+public class ItemHoneyComb
+ extends ItemProduct
+{
+ IIcon icon1;
+ IIcon icon2;
+
+ @SideOnly(Side.CLIENT)
+ public boolean requiresMultipleRenderPasses()
+ {
+ return true;
+ }
+
+ public ItemHoneyComb()
+ {
+ super(EnumHoneyComb.values());
+ setCreativeTab(Tabs.tabApiculture);
+ setUnlocalizedName("honeyComb");
+ }
+
+ public static void addSubtypes()
+ {
+ ItemStack beeswax = Mods.Forestry.stack("beeswax");
+ ItemStack honeyDrop = Mods.Forestry.stack("honeyDrop");
+
+ OreDictionary.registerOre("ingotIron", Items.iron_ingot);
+ OreDictionary.registerOre("ingotGold", Items.gold_ingot);
+
+ OreDictionary.registerOre("gemDiamond", Items.diamond);
+ OreDictionary.registerOre("gemEmerald", Items.emerald);
+ OreDictionary.registerOre("gemLapis", new ItemStack(Items.dye, 1, 4));
+
+ EnumHoneyComb.BARREN.addProduct(beeswax, 100);
+ EnumHoneyComb.BARREN.addProduct(honeyDrop, 50);
+
+ EnumHoneyComb.ROTTEN.addProduct(beeswax, 20);
+ EnumHoneyComb.ROTTEN.addProduct(honeyDrop, 20);
+ EnumHoneyComb.ROTTEN.addProduct(new ItemStack(Items.rotten_flesh, 1, 0), 80);
+
+ EnumHoneyComb.BONE.addProduct(beeswax, 20);
+ EnumHoneyComb.BONE.addProduct(honeyDrop, 20);
+ EnumHoneyComb.BONE.addProduct(new ItemStack(Items.dye, 1, 15), 80);
+
+ EnumHoneyComb.OIL.tryAddProduct(EnumPropolis.OIL, 60);
+ EnumHoneyComb.OIL.addProduct(honeyDrop, 75);
+
+ EnumHoneyComb.COAL.addProduct(beeswax, 80);
+ EnumHoneyComb.COAL.addProduct(honeyDrop, 75);
+ EnumHoneyComb.COAL.tryAddProduct(ExtraBeeItems.CoalDust, 100);
+
+ EnumHoneyComb.WATER.tryAddProduct(EnumPropolis.WATER, 100);
+ EnumHoneyComb.WATER.addProduct(honeyDrop, 90);
+
+ EnumHoneyComb.STONE.addProduct(beeswax, 50);
+ EnumHoneyComb.STONE.addProduct(honeyDrop, 25);
+
+ EnumHoneyComb.MILK.tryAddProduct(EnumHoneyDrop.MILK, 100);
+ EnumHoneyComb.MILK.addProduct(honeyDrop, 90);
+
+ EnumHoneyComb.FRUIT.tryAddProduct(EnumHoneyDrop.APPLE, 100);
+ EnumHoneyComb.FRUIT.addProduct(honeyDrop, 90);
+
+ EnumHoneyComb.SEED.tryAddProduct(EnumHoneyDrop.SEED, 100);
+ EnumHoneyComb.SEED.addProduct(honeyDrop, 90);
+
+ EnumHoneyComb.ALCOHOL.tryAddProduct(EnumHoneyDrop.ALCOHOL, 100);
+ EnumHoneyComb.ALCOHOL.addProduct(honeyDrop, 90);
+
+ EnumHoneyComb.FUEL.tryAddProduct(EnumPropolis.FUEL, 60);
+ EnumHoneyComb.FUEL.addProduct(honeyDrop, 50);
+
+ EnumHoneyComb.CREOSOTE.tryAddProduct(EnumPropolis.CREOSOTE, 70);
+ EnumHoneyComb.CREOSOTE.addProduct(honeyDrop, 50);
+
+ EnumHoneyComb.LATEX.addProduct(honeyDrop, 50);
+ EnumHoneyComb.LATEX.addProduct(beeswax, 85);
+ if (!OreDictionary.getOres("itemRubber").isEmpty()) {
+ EnumHoneyComb.LATEX.tryAddProduct((ItemStack)OreDictionary.getOres("itemRubber").get(0), 100);
+ } else {
+ EnumHoneyComb.LATEX.active = false;
+ }
+ EnumHoneyComb.REDSTONE.addProduct(beeswax, 80);
+ EnumHoneyComb.REDSTONE.addProduct(new ItemStack(Items.redstone, 1, 0), 100);
+ EnumHoneyComb.REDSTONE.addProduct(honeyDrop, 50);
+
+ EnumHoneyComb.RESIN.addProduct(beeswax, 100);
+
+ EnumHoneyComb.RESIN.tryAddProduct(Mods.IC2.stack("itemHarz"), 100);
+ EnumHoneyComb.RESIN.tryAddProduct(Mods.IC2.stack("itemHarz"), 50);
+
+ EnumHoneyComb.IC2ENERGY.addProduct(beeswax, 80);
+ EnumHoneyComb.IC2ENERGY.addProduct(new ItemStack(Items.redstone, 1, 0), 75);
+ EnumHoneyComb.IC2ENERGY.tryAddProduct(EnumHoneyDrop.ENERGY, 100);
+
+ EnumHoneyComb.IRON.copyProducts(EnumHoneyComb.STONE);
+ EnumHoneyComb.IRON.tryAddProduct(ExtraBeeItems.IronDust, 100);
+
+ EnumHoneyComb.GOLD.copyProducts(EnumHoneyComb.STONE);
+ EnumHoneyComb.GOLD.tryAddProduct(ExtraBeeItems.GoldDust, 100);
+
+ EnumHoneyComb.COPPER.copyProducts(EnumHoneyComb.STONE);
+ EnumHoneyComb.COPPER.tryAddProduct(ExtraBeeItems.CopperDust, 100);
+
+ EnumHoneyComb.TIN.copyProducts(EnumHoneyComb.STONE);
+ EnumHoneyComb.TIN.tryAddProduct(ExtraBeeItems.TinDust, 100);
+
+ EnumHoneyComb.NICKEL.copyProducts(EnumHoneyComb.STONE);
+ EnumHoneyComb.NICKEL.tryAddProduct(ExtraBeeItems.NickelDust, 100);
+
+ EnumHoneyComb.SILVER.copyProducts(EnumHoneyComb.STONE);
+ EnumHoneyComb.SILVER.tryAddProduct(ExtraBeeItems.SilverDust, 100);
+
+ EnumHoneyComb.URANIUM.copyProducts(EnumHoneyComb.STONE);
+ if (!OreDictionary.getOres("crushedUranium").isEmpty()) {
+ EnumHoneyComb.URANIUM.tryAddProduct((ItemStack)OreDictionary.getOres("crushedUranium").get(0), 50);
+ }
+ EnumHoneyComb.CLAY.addProduct(beeswax, 25);
+ EnumHoneyComb.CLAY.addProduct(honeyDrop, 80);
+ EnumHoneyComb.CLAY.addProduct(new ItemStack(Items.clay_ball), 80);
+
+ EnumHoneyComb.OLD.addProduct(beeswax, 100);
+ EnumHoneyComb.OLD.addProduct(honeyDrop, 90);
+
+ EnumHoneyComb.FUNGAL.addProduct(beeswax, 90);
+ EnumHoneyComb.FUNGAL.addProduct(new ItemStack(Blocks.brown_mushroom_block, 1, 0), 100);
+ EnumHoneyComb.FUNGAL.addProduct(new ItemStack(Blocks.red_mushroom_block, 1, 0), 75);
+
+ EnumHoneyComb.ACIDIC.addProduct(beeswax, 80);
+ EnumHoneyComb.ACIDIC.tryAddProduct(EnumHoneyDrop.ACID, 50);
+ if (!OreDictionary.getOres("dustSulfur").isEmpty()) {
+ EnumHoneyComb.ACIDIC.addProduct((ItemStack)OreDictionary.getOres("dustSulfur").get(0), 75);
+ }
+ EnumHoneyComb.VENOMOUS.addProduct(beeswax, 80);
+ EnumHoneyComb.VENOMOUS.tryAddProduct(EnumHoneyDrop.POISON, 80);
+
+ EnumHoneyComb.SLIME.addProduct(beeswax, 100);
+ EnumHoneyComb.SLIME.addProduct(honeyDrop, 75);
+ EnumHoneyComb.SLIME.addProduct(new ItemStack(Items.slime_ball, 1, 0), 75);
+
+ EnumHoneyComb.BLAZE.addProduct(beeswax, 75);
+ EnumHoneyComb.BLAZE.addProduct(new ItemStack(Items.blaze_powder, 1, 0), 100);
+
+ EnumHoneyComb.COFFEE.addProduct(beeswax, 90);
+ EnumHoneyComb.COFFEE.addProduct(honeyDrop, 75);
+ EnumHoneyComb.COFFEE.tryAddProduct(Mods.IC2.stack("itemCofeePowder"), 75);
+
+ EnumHoneyComb.GLACIAL.tryAddProduct(EnumHoneyDrop.ICE, 80);
+ EnumHoneyComb.GLACIAL.addProduct(honeyDrop, 75);
+
+
+
+
+ EnumHoneyComb.SHADOW.addProduct(honeyDrop, 50);
+ if (!OreDictionary.getOres("dustObsidian").isEmpty()) {
+ EnumHoneyComb.SHADOW.tryAddProduct((ItemStack)OreDictionary.getOres("dustObsidian").get(0), 75);
+ } else {
+ EnumHoneyComb.SHADOW.active = false;
+ }
+ EnumHoneyComb.LEAD.copyProducts(EnumHoneyComb.STONE);
+ EnumHoneyComb.LEAD.tryAddProduct(ExtraBeeItems.LeadDust, 100);
+
+ EnumHoneyComb.ZINC.copyProducts(EnumHoneyComb.STONE);
+ EnumHoneyComb.ZINC.tryAddProduct(ExtraBeeItems.ZincDust, 100);
+
+ EnumHoneyComb.TITANIUM.copyProducts(EnumHoneyComb.STONE);
+ EnumHoneyComb.TITANIUM.tryAddProduct(ExtraBeeItems.TitaniumDust, 100);
+
+ EnumHoneyComb.TUNGSTEN.copyProducts(EnumHoneyComb.STONE);
+ EnumHoneyComb.TUNGSTEN.tryAddProduct(ExtraBeeItems.TungstenDust, 100);
+
+ EnumHoneyComb.PLATINUM.copyProducts(EnumHoneyComb.STONE);
+ EnumHoneyComb.PLATINUM.tryAddProduct(ExtraBeeItems.PlatinumDust, 100);
+
+ EnumHoneyComb.LAPIS.copyProducts(EnumHoneyComb.STONE);
+ EnumHoneyComb.LAPIS.addProduct(new ItemStack(Items.dye, 6, 4), 100);
+
+ EnumHoneyComb.EMERALD.copyProducts(EnumHoneyComb.STONE);
+ EnumHoneyComb.EMERALD.tryAddProduct(ExtraBeeItems.EmeraldShard, 100);
+
+ EnumHoneyComb.RUBY.copyProducts(EnumHoneyComb.STONE);
+ EnumHoneyComb.RUBY.tryAddProduct(ExtraBeeItems.RubyShard, 100);
+
+ EnumHoneyComb.SAPPHIRE.copyProducts(EnumHoneyComb.STONE);
+ EnumHoneyComb.SAPPHIRE.tryAddProduct(ExtraBeeItems.SapphireShard, 100);
+
+ EnumHoneyComb.DIAMOND.copyProducts(EnumHoneyComb.STONE);
+ EnumHoneyComb.DIAMOND.tryAddProduct(ExtraBeeItems.DiamondShard, 100);
+
+ EnumHoneyComb.RED.addProduct(honeyDrop, 80);
+ EnumHoneyComb.RED.addProduct(beeswax, 80);
+
+ EnumHoneyComb.GLOWSTONE.addProduct(honeyDrop, 25);
+ EnumHoneyComb.GLOWSTONE.addProduct(new ItemStack(Items.glowstone_dust), 100);
+
+ EnumHoneyComb.SALTPETER.addProduct(honeyDrop, 25);
+ EnumHoneyComb.SALTPETER.tryAddProduct(getOreDictionary("dustSaltpeter"), 100);
+
+ EnumHoneyComb.COMPOST.addProduct(honeyDrop, 25);
+ EnumHoneyComb.COMPOST.tryAddProduct(Mods.Forestry.stack("fertilizerBio"), 100);
+
+ EnumHoneyComb.SAWDUST.addProduct(honeyDrop, 25);
+ if (!OreDictionary.getOres("dustSawdust").isEmpty()) {
+ EnumHoneyComb.SAWDUST.tryAddProduct((ItemStack)OreDictionary.getOres("dustSawdust").get(0), 100);
+ } else if (!OreDictionary.getOres("sawdust").isEmpty()) {
+ EnumHoneyComb.SAWDUST.tryAddProduct((ItemStack)OreDictionary.getOres("sawdust").get(0), 100);
+ }
+ EnumHoneyComb.CERTUS.addProduct(honeyDrop, 25);
+ EnumHoneyComb.CERTUS.addProduct(new ItemStack(Items.quartz), 25);
+ if (!OreDictionary.getOres("dustCertusQuartz").isEmpty()) {
+ EnumHoneyComb.CERTUS.tryAddProduct((ItemStack)OreDictionary.getOres("dustCertusQuartz").get(0), 20);
+ }
+ EnumHoneyComb.ENDERPEARL.addProduct(honeyDrop, 25);
+ if (!OreDictionary.getOres("dustEnderPearl").isEmpty()) {
+ EnumHoneyComb.ENDERPEARL.tryAddProduct((ItemStack)OreDictionary.getOres("dustEnderPearl").get(0), 25);
+ }
+ EnumHoneyComb.YELLORIUM.copyProducts(EnumHoneyComb.STONE);
+ EnumHoneyComb.CYANITE.copyProducts(EnumHoneyComb.STONE);
+ EnumHoneyComb.BLUTONIUM.copyProducts(EnumHoneyComb.STONE);
+
+ EnumHoneyComb.YELLORIUM.tryAddProduct(ExtraBeeItems.YelloriumDust, 25);
+ EnumHoneyComb.CYANITE.tryAddProduct(ExtraBeeItems.CyaniteDust, 25);
+ EnumHoneyComb.BLUTONIUM.tryAddProduct(ExtraBeeItems.BlutoniumDust, 25);
+
+
+ OreDictionary.registerOre("beeComb", new ItemStack(ExtraBees.comb, 1, 32767));
+ for (int i = 0; i < 16; i++)
+ {
+ EnumHoneyComb type = EnumHoneyComb.values()[(EnumHoneyComb.RED.ordinal() + i)];
+ if (type != EnumHoneyComb.RED) {
+ type.copyProducts(EnumHoneyComb.RED);
+ }
+ }
+ for (int i = 0; i < 16; i++)
+ {
+ EnumHoneyComb type = EnumHoneyComb.values()[(EnumHoneyComb.RED.ordinal() + i)];
+ EnumHoneyDrop drop = EnumHoneyDrop.values()[(EnumHoneyDrop.RED.ordinal() + i)];
+
+ int[] dyeC = { 1, 11, 4, 2, 0, 15, 3, 14, 6, 5, 8, 12, 9, 10, 13, 7 };
+
+ int k = dyeC[i];
+
+ ItemStack dye = new ItemStack(Items.dye, 1, k);
+ switch (k)
+ {
+ case 0:
+ dye = ExtraBeeItems.BlackDye.get(1);
+ break;
+ case 1:
+ dye = ExtraBeeItems.RedDye.get(1);
+ break;
+ case 2:
+ dye = ExtraBeeItems.GreenDye.get(1);
+ break;
+ case 3:
+ dye = ExtraBeeItems.BrownDye.get(1);
+ break;
+ case 4:
+ dye = ExtraBeeItems.BlueDye.get(1);
+ break;
+ case 11:
+ dye = ExtraBeeItems.YellowDye.get(1);
+ break;
+ case 15:
+ dye = ExtraBeeItems.WhiteDye.get(1);
+ }
+ type.addProduct(drop.get(1), 100);
+ drop.addRemenant(dye);
+ }
+ }
+
+ private static ItemStack getOreDictionary(String string)
+ {
+ if (OreDictionary.getOres(string).size() > 0) {
+ return (ItemStack)OreDictionary.getOres(string).get(0);
+ }
+ return null;
+ }
+
+ public int getColorFromItemStack(ItemStack itemStack, int j)
+ {
+ if (EnumHoneyComb.get(itemStack) == null) {
+ return 16777215;
+ }
+ if (j == 0) {
+ return EnumHoneyComb.get(itemStack).colour[0];
+ }
+ return EnumHoneyComb.get(itemStack).colour[1];
+ }
+
+ public static enum VanillaComb
+ {
+ HONEY, COCOA, SIMMERING, STRINGY, FROZEN, DRIPPING, SILKY, PARCHED, MYSTERIOUS, IRRADIATED, POWDERY, REDDENED, DARKENED, OMEGA, WHEATEN, MOSSY, QUARTZ;
+
+ private VanillaComb() {}
+
+ public ItemStack get()
+ {
+ return new ItemStack(Mods.Forestry.item("beeCombs"), 1, ordinal());
+ }
+ }
+
+ @SideOnly(Side.CLIENT)
+ public IIcon getIconFromDamageForRenderPass(int i, int j)
+ {
+ if (j > 0) {
+ return this.icon1;
+ }
+ return this.icon2;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void registerIcons(IIconRegister register)
+ {
+ this.icon1 = BinnieCore.proxy.getIcon(register, "forestry", "beeCombs.0");
+ this.icon2 = BinnieCore.proxy.getIcon(register, "forestry", "beeCombs.1");
+ }
+}
diff --git a/src/Java/binnie/extrabees/products/ItemHoneyCrystal.java b/src/Java/binnie/extrabees/products/ItemHoneyCrystal.java
new file mode 100644
index 0000000000..334342d49a
--- /dev/null
+++ b/src/Java/binnie/extrabees/products/ItemHoneyCrystal.java
@@ -0,0 +1,51 @@
+package binnie.extrabees.products;
+
+import binnie.extrabees.ExtraBees;
+import binnie.extrabees.proxy.ExtraBeesProxy;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import forestry.api.core.Tabs;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+
+public class ItemHoneyCrystal
+ extends Item
+{
+ private int maxCharge = 8000;
+ private int transferLimit = 500;
+ private int tier = 1;
+
+ @SideOnly(Side.CLIENT)
+ public void registerIcons(IIconRegister register)
+ {
+ this.itemIcon = ExtraBees.proxy.getIcon(register, "honeyCrystal");
+ }
+
+ public ItemHoneyCrystal()
+ {
+ setMaxDamage(27);
+ setMaxStackSize(1);
+
+ setCreativeTab(Tabs.tabApiculture);
+ setUnlocalizedName("honeyCrystal");
+ }
+
+ public String getItemStackDisplayName(ItemStack i)
+ {
+ return ExtraBees.proxy.localise("item.honeycrystal");
+ }
+
+ public static NBTTagCompound getOrCreateNbtData(ItemStack itemStack)
+ {
+ NBTTagCompound ret = itemStack.getTagCompound();
+ if (ret == null)
+ {
+ ret = new NBTTagCompound();
+
+ itemStack.setTagCompound(ret);
+ }
+ return ret;
+ }
+}
diff --git a/src/Java/binnie/extrabees/products/ItemHoneyCrystalEmpty.java b/src/Java/binnie/extrabees/products/ItemHoneyCrystalEmpty.java
new file mode 100644
index 0000000000..03dad2115f
--- /dev/null
+++ b/src/Java/binnie/extrabees/products/ItemHoneyCrystalEmpty.java
@@ -0,0 +1,30 @@
+package binnie.extrabees.products;
+
+import binnie.extrabees.ExtraBees;
+import binnie.extrabees.proxy.ExtraBeesProxy;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.item.ItemStack;
+
+public class ItemHoneyCrystalEmpty
+ extends ItemHoneyCrystal
+{
+ public ItemHoneyCrystalEmpty()
+ {
+ setMaxDamage(0);
+ setMaxStackSize(64);
+ setUnlocalizedName("honeyCrystalEmpty");
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void registerIcons(IIconRegister register)
+ {
+ this.itemIcon = ExtraBees.proxy.getIcon(register, "honeyCrystalEmpty");
+ }
+
+ public String getItemStackDisplayName(ItemStack i)
+ {
+ return ExtraBees.proxy.localise("item.honeycrystal.empty");
+ }
+}
diff --git a/src/Java/binnie/extrabees/products/ItemHoneyDrop.java b/src/Java/binnie/extrabees/products/ItemHoneyDrop.java
new file mode 100644
index 0000000000..67abfed7cb
--- /dev/null
+++ b/src/Java/binnie/extrabees/products/ItemHoneyDrop.java
@@ -0,0 +1,55 @@
+package binnie.extrabees.products;
+
+import binnie.core.BinnieCore;
+import binnie.core.proxy.BinnieProxy;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import forestry.api.core.Tabs;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.IIcon;
+
+public class ItemHoneyDrop
+ extends ItemProduct
+{
+ IIcon icon1;
+ IIcon icon2;
+
+ @SideOnly(Side.CLIENT)
+ public boolean requiresMultipleRenderPasses()
+ {
+ return true;
+ }
+
+ public ItemHoneyDrop()
+ {
+ super(EnumHoneyDrop.values());
+ setCreativeTab(Tabs.tabApiculture);
+ setUnlocalizedName("honeyDrop");
+ }
+
+ public int getColorFromItemStack(ItemStack itemStack, int j)
+ {
+ int i = itemStack.getItemDamage();
+ if (j == 0) {
+ return EnumHoneyDrop.get(itemStack).colour[0];
+ }
+ return EnumHoneyDrop.get(itemStack).colour[1];
+ }
+
+ @SideOnly(Side.CLIENT)
+ public IIcon getIconFromDamageForRenderPass(int i, int j)
+ {
+ if (j > 0) {
+ return this.icon1;
+ }
+ return this.icon2;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void registerIcons(IIconRegister register)
+ {
+ this.icon1 = BinnieCore.proxy.getIcon(register, "forestry", "honeyDrop.0");
+ this.icon2 = BinnieCore.proxy.getIcon(register, "forestry", "honeyDrop.1");
+ }
+}
diff --git a/src/Java/binnie/extrabees/products/ItemProduct.java b/src/Java/binnie/extrabees/products/ItemProduct.java
new file mode 100644
index 0000000000..f2d6b16e35
--- /dev/null
+++ b/src/Java/binnie/extrabees/products/ItemProduct.java
@@ -0,0 +1,44 @@
+package binnie.extrabees.products;
+
+import binnie.core.item.IItemEnum;
+import java.util.List;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+
+public class ItemProduct
+ extends Item
+{
+ IItemEnum[] types;
+
+ public ItemProduct(IItemEnum[] types)
+ {
+ setMaxStackSize(64);
+ setMaxDamage(0);
+ setHasSubtypes(true);
+ this.types = types;
+ }
+
+ public IItemEnum get(ItemStack stack)
+ {
+ int i = stack.getItemDamage();
+ if ((i >= 0) && (i < this.types.length)) {
+ return this.types[i];
+ }
+ return this.types[0];
+ }
+
+ public String getItemStackDisplayName(ItemStack itemstack)
+ {
+ return get(itemstack).getName(itemstack);
+ }
+
+ public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List itemList)
+ {
+ for (IItemEnum type : this.types) {
+ if (type.isActive()) {
+ itemList.add(new ItemStack(this, 1, type.ordinal()));
+ }
+ }
+ }
+}
diff --git a/src/Java/binnie/extrabees/products/ItemPropolis.java b/src/Java/binnie/extrabees/products/ItemPropolis.java
new file mode 100644
index 0000000000..a66c10da46
--- /dev/null
+++ b/src/Java/binnie/extrabees/products/ItemPropolis.java
@@ -0,0 +1,35 @@
+package binnie.extrabees.products;
+
+import binnie.core.BinnieCore;
+import binnie.core.proxy.BinnieProxy;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import forestry.api.core.Tabs;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.item.ItemStack;
+
+public class ItemPropolis
+ extends ItemProduct
+{
+ public ItemPropolis()
+ {
+ super(EnumPropolis.values());
+ setCreativeTab(Tabs.tabApiculture);
+ setUnlocalizedName("propolis");
+ }
+
+ public int getColorFromItemStack(ItemStack itemStack, int j)
+ {
+ int i = itemStack.getItemDamage();
+ if (j == 0) {
+ return EnumPropolis.get(itemStack).colour[0];
+ }
+ return EnumPropolis.get(itemStack).colour[1];
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void registerIcons(IIconRegister register)
+ {
+ this.itemIcon = BinnieCore.proxy.getIcon(register, "forestry", "propolis.0");
+ }
+}
diff --git a/src/Java/binnie/extrabees/products/ModuleProducts.java b/src/Java/binnie/extrabees/products/ModuleProducts.java
new file mode 100644
index 0000000000..7d2386872a
--- /dev/null
+++ b/src/Java/binnie/extrabees/products/ModuleProducts.java
@@ -0,0 +1,43 @@
+package binnie.extrabees.products;
+
+import binnie.core.IInitializable;
+import binnie.core.Mods;
+import binnie.core.Mods.Mod;
+import binnie.extrabees.ExtraBees;
+import cpw.mods.fml.common.registry.GameRegistry;
+import net.minecraft.init.Items;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.oredict.OreDictionary;
+
+public class ModuleProducts
+ implements IInitializable
+{
+ public void preInit()
+ {
+ ExtraBees.honeyCrystal = new ItemHoneyCrystal();
+ ExtraBees.honeyCrystalEmpty = new ItemHoneyCrystalEmpty();
+ ExtraBees.honeyDrop = new ItemHoneyDrop();
+ ExtraBees.comb = new ItemHoneyComb();
+ ExtraBees.propolis = new ItemPropolis();
+
+ OreDictionary.registerOre("ingotIron", Items.iron_ingot);
+ OreDictionary.registerOre("ingotGold", Items.gold_ingot);
+ OreDictionary.registerOre("gemDiamond", Items.diamond);
+ }
+
+ public void init() {}
+
+ public void postInit()
+ {
+ GameRegistry.addRecipe(new ItemStack(ExtraBees.honeyCrystalEmpty), new Object[] { "#@#", "@#@", "#@#", Character.valueOf('@'), Mods.Forestry.stack("honeyDrop"), Character.valueOf('#'), EnumHoneyDrop.ENERGY.get(1) });
+ for (EnumHoneyComb info : EnumHoneyComb.values()) {
+ info.addRecipe();
+ }
+ for (EnumHoneyDrop info : EnumHoneyDrop.values()) {
+ info.addRecipe();
+ }
+ for (EnumPropolis info : EnumPropolis.values()) {
+ info.addRecipe();
+ }
+ }
+}
diff --git a/src/Java/binnie/extrabees/proxy/ExtraBeesProxy.java b/src/Java/binnie/extrabees/proxy/ExtraBeesProxy.java
new file mode 100644
index 0000000000..2b7499f94a
--- /dev/null
+++ b/src/Java/binnie/extrabees/proxy/ExtraBeesProxy.java
@@ -0,0 +1,13 @@
+package binnie.extrabees.proxy;
+
+import binnie.core.proxy.BinnieModProxy;
+import binnie.extrabees.ExtraBees;
+
+public class ExtraBeesProxy
+ extends BinnieModProxy
+{
+ public ExtraBeesProxy()
+ {
+ super(ExtraBees.instance);
+ }
+}
diff --git a/src/Java/binnie/extrabees/proxy/ExtraBeesProxyClient.java b/src/Java/binnie/extrabees/proxy/ExtraBeesProxyClient.java
new file mode 100644
index 0000000000..87198021d2
--- /dev/null
+++ b/src/Java/binnie/extrabees/proxy/ExtraBeesProxyClient.java
@@ -0,0 +1,5 @@
+package binnie.extrabees.proxy;
+
+public class ExtraBeesProxyClient
+ extends ExtraBeesProxy
+{}
diff --git a/src/Java/binnie/extrabees/proxy/ExtraBeesProxyServer.java b/src/Java/binnie/extrabees/proxy/ExtraBeesProxyServer.java
new file mode 100644
index 0000000000..f8aae382a5
--- /dev/null
+++ b/src/Java/binnie/extrabees/proxy/ExtraBeesProxyServer.java
@@ -0,0 +1,5 @@
+package binnie.extrabees.proxy;
+
+public class ExtraBeesProxyServer
+ extends ExtraBeesProxy
+{}
diff --git a/src/Java/binnie/extrabees/worldgen/BlockExtraBeeHive.java b/src/Java/binnie/extrabees/worldgen/BlockExtraBeeHive.java
new file mode 100644
index 0000000000..1923c93283
--- /dev/null
+++ b/src/Java/binnie/extrabees/worldgen/BlockExtraBeeHive.java
@@ -0,0 +1,109 @@
+package binnie.extrabees.worldgen;
+
+import binnie.extrabees.ExtraBees;
+import binnie.extrabees.proxy.ExtraBeesProxy;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import forestry.api.apiculture.IHiveDrop;
+import forestry.api.core.Tabs;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Random;
+import net.minecraft.block.Block;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.IIcon;
+import net.minecraft.world.World;
+
+public class BlockExtraBeeHive
+ extends Block
+{
+ IIcon[][] icons;
+
+ public BlockExtraBeeHive()
+ {
+ super(ExtraBees.materialBeehive);
+ setLightLevel(0.2F);
+ setHardness(1.0F);
+ setTickRandomly(true);
+ setBlockName("hive");
+
+ setCreativeTab(Tabs.tabApiculture);
+ }
+
+ public String getUnlocalizedName(ItemStack par1ItemStack)
+ {
+ return "extrabees.block.hive." + par1ItemStack.getItemDamage();
+ }
+
+ public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List itemList)
+ {
+ for (int i = 0; i < 4; i++) {
+ itemList.add(new ItemStack(this, 1, i));
+ }
+ }
+
+ public IIcon getIcon(int side, int metadata)
+ {
+ if (metadata >= EnumHiveType.values().length) {
+ return null;
+ }
+ if (side < 2) {
+ return this.icons[metadata][1];
+ }
+ return this.icons[metadata][0];
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void registerBlockIcons(IIconRegister register)
+ {
+ this.icons = new IIcon[EnumHiveType.values().length][2];
+ for (EnumHiveType hive : EnumHiveType.values())
+ {
+ this.icons[hive.ordinal()][0] = ExtraBees.proxy.getIcon(register, "hive/" + hive.toString().toLowerCase() + ".0");
+ this.icons[hive.ordinal()][1] = ExtraBees.proxy.getIcon(register, "hive/" + hive.toString().toLowerCase() + ".1");
+ }
+ }
+
+ public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune)
+ {
+ ArrayList<ItemStack> ret = new ArrayList();
+
+ List<IHiveDrop> dropList = EnumHiveType.values()[metadata].drops;
+
+ Collections.shuffle(dropList);
+
+ int tries = 0;
+ boolean hasPrincess = false;
+ while ((tries <= 10) && (!hasPrincess))
+ {
+ tries++;
+ for (IHiveDrop drop : dropList) {
+ if (world.rand.nextInt(100) < drop.getChance(world, x, y, z))
+ {
+ ret.add(drop.getPrincess(world, x, y, z, fortune));
+ hasPrincess = true;
+ break;
+ }
+ }
+ }
+ for (IHiveDrop drop : dropList) {
+ if (world.rand.nextInt(100) < drop.getChance(world, x, y, z))
+ {
+ ret.addAll(drop.getDrones(world, x, y, z, fortune));
+ break;
+ }
+ }
+ for (IHiveDrop drop : dropList) {
+ if (world.rand.nextInt(100) < drop.getChance(world, x, y, z))
+ {
+ ret.addAll(drop.getAdditional(world, x, y, z, fortune));
+ break;
+ }
+ }
+ return ret;
+ }
+}
diff --git a/src/Java/binnie/extrabees/worldgen/EnumHiveType.java b/src/Java/binnie/extrabees/worldgen/EnumHiveType.java
new file mode 100644
index 0000000000..d115afb24f
--- /dev/null
+++ b/src/Java/binnie/extrabees/worldgen/EnumHiveType.java
@@ -0,0 +1,14 @@
+package binnie.extrabees.worldgen;
+
+import forestry.api.apiculture.IHiveDrop;
+import java.util.ArrayList;
+import java.util.List;
+
+public enum EnumHiveType
+{
+ Water, Rock, Nether, Marble;
+
+ public List<IHiveDrop> drops = new ArrayList();
+
+ private EnumHiveType() {}
+}
diff --git a/src/Java/binnie/extrabees/worldgen/HiveDrop.java b/src/Java/binnie/extrabees/worldgen/HiveDrop.java
new file mode 100644
index 0000000000..10d8db4c26
--- /dev/null
+++ b/src/Java/binnie/extrabees/worldgen/HiveDrop.java
@@ -0,0 +1,65 @@
+package binnie.extrabees.worldgen;
+
+import binnie.Binnie;
+import binnie.core.genetics.ManagerGenetics;
+import forestry.api.apiculture.EnumBeeType;
+import forestry.api.apiculture.IAlleleBeeSpecies;
+import forestry.api.apiculture.IBeeRoot;
+import forestry.api.apiculture.IHiveDrop;
+import forestry.api.genetics.IAllele;
+import java.util.ArrayList;
+import net.minecraft.item.ItemStack;
+import net.minecraft.world.World;
+
+public class HiveDrop
+ implements IHiveDrop
+{
+ private IAllele[] template;
+ private ArrayList<ItemStack> additional = new ArrayList();
+ private int chance;
+
+ public HiveDrop(IAlleleBeeSpecies species, int chance)
+ {
+ this(Binnie.Genetics.getBeeRoot().getTemplate(species.getUID()), new ItemStack[0], chance);
+ }
+
+ public HiveDrop(IAllele[] template, ItemStack[] bonus, int chance)
+ {
+ if (template == null) {
+ template = Binnie.Genetics.getBeeRoot().getDefaultTemplate();
+ }
+ this.template = template;
+ this.chance = chance;
+ for (ItemStack stack : bonus) {
+ this.additional.add(stack);
+ }
+ }
+
+ public ItemStack getPrincess(World world, int x, int y, int z, int fortune)
+ {
+ return Binnie.Genetics.getBeeRoot().getMemberStack(Binnie.Genetics.getBeeRoot().getBee(world, Binnie.Genetics.getBeeRoot().templateAsGenome(this.template)), EnumBeeType.PRINCESS.ordinal());
+ }
+
+ public ArrayList<ItemStack> getDrones(World world, int x, int y, int z, int fortune)
+ {
+ ArrayList<ItemStack> ret = new ArrayList();
+ ret.add(Binnie.Genetics.getBeeRoot().getMemberStack(Binnie.Genetics.getBeeRoot().templateAsIndividual(this.template), EnumBeeType.DRONE.ordinal()));
+
+
+ return ret;
+ }
+
+ public ArrayList<ItemStack> getAdditional(World world, int x, int y, int z, int fortune)
+ {
+ ArrayList<ItemStack> ret = new ArrayList();
+ for (ItemStack stack : this.additional) {
+ ret.add(stack.copy());
+ }
+ return ret;
+ }
+
+ public int getChance(World world, int x, int y, int z)
+ {
+ return this.chance;
+ }
+}
diff --git a/src/Java/binnie/extrabees/worldgen/ItemBeehive.java b/src/Java/binnie/extrabees/worldgen/ItemBeehive.java
new file mode 100644
index 0000000000..e853a055b3
--- /dev/null
+++ b/src/Java/binnie/extrabees/worldgen/ItemBeehive.java
@@ -0,0 +1,37 @@
+package binnie.extrabees.worldgen;
+
+import java.util.List;
+import net.minecraft.block.Block;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemBlock;
+import net.minecraft.item.ItemStack;
+
+public class ItemBeehive
+ extends ItemBlock
+{
+ public ItemBeehive(Block block)
+ {
+ super(block);
+ setMaxDamage(0);
+ setHasSubtypes(true);
+ setCreativeTab(CreativeTabs.tabBlock);
+ }
+
+ public int getMetadata(int i)
+ {
+ return i;
+ }
+
+ public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List itemList)
+ {
+ for (int i = 0; i < 4; i++) {
+ itemList.add(new ItemStack(this, 1, i));
+ }
+ }
+
+ public String getItemStackDisplayName(ItemStack itemStack)
+ {
+ return EnumHiveType.values()[itemStack.getItemDamage()].toString() + " Hive";
+ }
+}
diff --git a/src/Java/binnie/extrabees/worldgen/MaterialBeehive.java b/src/Java/binnie/extrabees/worldgen/MaterialBeehive.java
new file mode 100644
index 0000000000..b94960c494
--- /dev/null
+++ b/src/Java/binnie/extrabees/worldgen/MaterialBeehive.java
@@ -0,0 +1,20 @@
+package binnie.extrabees.worldgen;
+
+import net.minecraft.block.material.MapColor;
+import net.minecraft.block.material.Material;
+
+public class MaterialBeehive
+ extends Material
+{
+ public MaterialBeehive()
+ {
+ super(MapColor.stoneColor);
+ setRequiresTool();
+ setImmovableMobility();
+ }
+
+ public boolean isOpaque()
+ {
+ return true;
+ }
+}
diff --git a/src/Java/binnie/extrabees/worldgen/ModuleGeneration.java b/src/Java/binnie/extrabees/worldgen/ModuleGeneration.java
new file mode 100644
index 0000000000..8708ca7bf7
--- /dev/null
+++ b/src/Java/binnie/extrabees/worldgen/ModuleGeneration.java
@@ -0,0 +1,85 @@
+package binnie.extrabees.worldgen;
+
+import binnie.core.IInitializable;
+import binnie.core.genetics.ForestryAllele.BeeSpecies;
+import binnie.extrabees.ExtraBees;
+import binnie.extrabees.config.ConfigurationMain;
+import binnie.extrabees.genetics.ExtraBeesSpecies;
+import buildcraft.api.core.BuildCraftAPI;
+import cpw.mods.fml.common.IWorldGenerator;
+import cpw.mods.fml.common.registry.GameRegistry;
+import java.util.List;
+import java.util.Random;
+import java.util.Set;
+import net.minecraft.block.Block;
+import net.minecraft.world.World;
+import net.minecraft.world.chunk.IChunkProvider;
+
+public class ModuleGeneration
+ implements IWorldGenerator, IInitializable
+{
+ static int waterRate = 2;
+ static int rockRate = 2;
+ static int netherRate = 2;
+ static int marbleRate = 2;
+
+ public void preInit()
+ {
+ ExtraBees.materialBeehive = new MaterialBeehive();
+ ExtraBees.hive = new BlockExtraBeeHive();
+ GameRegistry.registerBlock(ExtraBees.hive, ItemBeehive.class, "hive");
+ }
+
+ public void init()
+ {
+ waterRate = ConfigurationMain.waterHiveRate;
+ rockRate = ConfigurationMain.rockHiveRate;
+ netherRate = ConfigurationMain.netherHiveRate;
+ GameRegistry.registerWorldGenerator(new ModuleGeneration(), 0);
+ if (!ConfigurationMain.canQuarryMineHives) {
+ BuildCraftAPI.softBlocks.add(ExtraBees.hive);
+ }
+ }
+
+ public void postInit()
+ {
+ EnumHiveType.Water.drops.add(new HiveDrop(ExtraBeesSpecies.WATER, 80));
+ EnumHiveType.Water.drops.add(new HiveDrop(ForestryAllele.BeeSpecies.Valiant.getAllele(), 3));
+ EnumHiveType.Rock.drops.add(new HiveDrop(ExtraBeesSpecies.ROCK, 80));
+ EnumHiveType.Rock.drops.add(new HiveDrop(ForestryAllele.BeeSpecies.Valiant.getAllele(), 3));
+ EnumHiveType.Nether.drops.add(new HiveDrop(ExtraBeesSpecies.BASALT, 80));
+ EnumHiveType.Nether.drops.add(new HiveDrop(ForestryAllele.BeeSpecies.Valiant.getAllele(), 3));
+
+ ExtraBees.hive.setHarvestLevel("scoop", 0, 0);
+ ExtraBees.hive.setHarvestLevel("scoop", 0, 1);
+ ExtraBees.hive.setHarvestLevel("scoop", 0, 2);
+ ExtraBees.hive.setHarvestLevel("scoop", 0, 3);
+ }
+
+ public void generate(Random rand, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider)
+ {
+ chunkX <<= 4;
+ chunkZ <<= 4;
+ for (int i = 0; i < waterRate; i++)
+ {
+ int randPosX = chunkX + rand.nextInt(16);
+ int randPosY = rand.nextInt(50) + 20;
+ int randPosZ = chunkZ + rand.nextInt(16);
+ new WorldGenHiveWater().generate(world, rand, randPosX, randPosY, randPosZ);
+ }
+ for (int i = 0; i < rockRate; i++)
+ {
+ int randPosX = chunkX + rand.nextInt(16);
+ int randPosY = rand.nextInt(50) + 20;
+ int randPosZ = chunkZ + rand.nextInt(16);
+ new WorldGenHiveRock().generate(world, rand, randPosX, randPosY, randPosZ);
+ }
+ for (int i = 0; i < netherRate; i++)
+ {
+ int randPosX = chunkX + rand.nextInt(16);
+ int randPosY = rand.nextInt(50) + 20;
+ int randPosZ = chunkZ + rand.nextInt(16);
+ new WorldGenHiveNether().generate(world, rand, randPosX, randPosY, randPosZ);
+ }
+ }
+}
diff --git a/src/Java/binnie/extrabees/worldgen/WorldGenHiveNether.java b/src/Java/binnie/extrabees/worldgen/WorldGenHiveNether.java
new file mode 100644
index 0000000000..4585adde12
--- /dev/null
+++ b/src/Java/binnie/extrabees/worldgen/WorldGenHiveNether.java
@@ -0,0 +1,33 @@
+package binnie.extrabees.worldgen;
+
+import binnie.extrabees.ExtraBees;
+import java.util.Random;
+import net.minecraft.block.Block;
+import net.minecraft.init.Blocks;
+import net.minecraft.world.World;
+import net.minecraft.world.biome.BiomeGenBase;
+import net.minecraft.world.biome.WorldChunkManager;
+import net.minecraft.world.gen.feature.WorldGenerator;
+import net.minecraftforge.common.BiomeDictionary;
+import net.minecraftforge.common.BiomeDictionary.Type;
+
+public class WorldGenHiveNether
+ extends WorldGenerator
+{
+ public boolean generate(World world, Random random, int i, int j, int k)
+ {
+ BiomeGenBase biome = world.getWorldChunkManager().getBiomeGenAt(i, k);
+ if (!BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.NETHER)) {
+ return true;
+ }
+ if (embedInWall(world, Blocks.netherrack, i, j, k)) {
+ world.setBlock(i, j, k, ExtraBees.hive, 2, 0);
+ }
+ return true;
+ }
+
+ public boolean embedInWall(World world, Block blockID, int i, int j, int k)
+ {
+ return (world.getBlock(i, j, k) == blockID) && (world.getBlock(i, j + 1, k) == blockID) && (world.getBlock(i, j - 1, k) == blockID) && ((world.isAirBlock(i + 1, j, k)) || (world.isAirBlock(i - 1, j, k)) || (world.isAirBlock(i, j, k + 1)) || (world.isAirBlock(i, j, k - 1)));
+ }
+}
diff --git a/src/Java/binnie/extrabees/worldgen/WorldGenHiveRock.java b/src/Java/binnie/extrabees/worldgen/WorldGenHiveRock.java
new file mode 100644
index 0000000000..e6598fdcb7
--- /dev/null
+++ b/src/Java/binnie/extrabees/worldgen/WorldGenHiveRock.java
@@ -0,0 +1,27 @@
+package binnie.extrabees.worldgen;
+
+import binnie.extrabees.ExtraBees;
+import java.util.Random;
+import net.minecraft.block.Block;
+import net.minecraft.init.Blocks;
+import net.minecraft.world.World;
+import net.minecraft.world.biome.BiomeGenBase;
+import net.minecraft.world.biome.WorldChunkManager;
+import net.minecraft.world.gen.feature.WorldGenerator;
+
+public class WorldGenHiveRock
+ extends WorldGenerator
+{
+ public boolean generate(World world, Random random, int i, int j, int k)
+ {
+ BiomeGenBase biome = world.getWorldChunkManager().getBiomeGenAt(i, k);
+ Block block = world.getBlock(i, j, k);
+ if (block == null) {
+ return true;
+ }
+ if (block.isReplaceableOreGen(world, i, j, k, Blocks.stone)) {
+ world.setBlock(i, j, k, ExtraBees.hive, 1, 0);
+ }
+ return true;
+ }
+}
diff --git a/src/Java/binnie/extrabees/worldgen/WorldGenHiveWater.java b/src/Java/binnie/extrabees/worldgen/WorldGenHiveWater.java
new file mode 100644
index 0000000000..f672945288
--- /dev/null
+++ b/src/Java/binnie/extrabees/worldgen/WorldGenHiveWater.java
@@ -0,0 +1,31 @@
+package binnie.extrabees.worldgen;
+
+import binnie.extrabees.ExtraBees;
+import java.util.Random;
+import net.minecraft.block.Block;
+import net.minecraft.block.material.Material;
+import net.minecraft.init.Blocks;
+import net.minecraft.world.World;
+import net.minecraft.world.biome.BiomeGenBase;
+import net.minecraft.world.biome.WorldChunkManager;
+import net.minecraft.world.gen.feature.WorldGenerator;
+
+public class WorldGenHiveWater
+ extends WorldGenerator
+{
+ public boolean generate(World world, Random random, int i, int j, int k)
+ {
+ BiomeGenBase biome = world.getWorldChunkManager().getBiomeGenAt(i, k);
+
+ int i1 = i + random.nextInt(8) - random.nextInt(8);
+ int j1 = j + random.nextInt(4) - random.nextInt(4);
+ int k1 = k + random.nextInt(8) - random.nextInt(8);
+ if ((world.getBlock(i1, j1, k1) != Blocks.water) && (world.getBlock(i1, j1, k1) != Blocks.water)) {
+ return false;
+ }
+ if ((world.getBlock(i1, j1 - 1, k1).getMaterial() == Material.sand) || (world.getBlock(i1, j1 - 1, k1).getMaterial() == Material.clay) || (world.getBlock(i1, j1 - 1, k1).getMaterial() == Material.ground) || (world.getBlock(i1, j1 - 1, k1).getMaterial() == Material.rock)) {
+ world.setBlock(i1, j1, k1, ExtraBees.hive, 0, 0);
+ }
+ return true;
+ }
+}
diff --git a/src/Java/mcmod.info b/src/Java/mcmod.info
new file mode 100644
index 0000000000..0c2b859007
--- /dev/null
+++ b/src/Java/mcmod.info
@@ -0,0 +1,19 @@
+/**
+ * @version 0.1
+ * @author Alkalus
+ * In-game info for project: Hello World.
+ */
+[ { "modid" : "miscutils"
+ , "name" : "miscutils"
+ , "description" : "Adds a few various things. Supported mods include GregTech, EnderIO, Big Reactors, Thaumcraft, ExtraUtils, Pnuematicraft & Simply Jetpacks."
+ , "version" : "0.7.8gtu"
+ , "mcversion" : "1.7.10"
+ , "url" : ""
+ , "updateUrl" : ""
+ , "authorList" : ["Alkalus"]
+ , "credits" : ""
+ , "logoFile" : ""
+ , "screenshots" : []
+ , "dependencies" : ["Forge10.13.0.1180"]
+ }
+]
diff --git a/src/Java/miscutil/MiscUtils.java b/src/Java/miscutil/MiscUtils.java
new file mode 100644
index 0000000000..518d570d67
--- /dev/null
+++ b/src/Java/miscutil/MiscUtils.java
@@ -0,0 +1,118 @@
+package miscutil;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import miscutil.core.CommonProxy;
+import miscutil.core.commands.CommandMath;
+import miscutil.core.creativetabs.TMCreativeTabs;
+import miscutil.core.handler.CraftingManager;
+import miscutil.core.lib.Strings;
+import miscutil.core.util.Utils;
+import net.minecraftforge.common.MinecraftForge;
+import cpw.mods.fml.common.FMLCommonHandler;
+import cpw.mods.fml.common.Mod;
+import cpw.mods.fml.common.Mod.EventHandler;
+import cpw.mods.fml.common.SidedProxy;
+import cpw.mods.fml.common.event.FMLInitializationEvent;
+import cpw.mods.fml.common.event.FMLPostInitializationEvent;
+import cpw.mods.fml.common.event.FMLPreInitializationEvent;
+import cpw.mods.fml.common.event.FMLServerStartingEvent;
+import cpw.mods.fml.common.event.FMLServerStoppingEvent;
+
+@Mod(modid=Strings.MODID, name="Misc. Utils", version=Strings.VERSION, dependencies="required-after:gregtech")
+public class MiscUtils
+implements ActionListener
+{
+
+ //Vars
+
+
+ @Mod.Instance(Strings.MODID)
+ public static MiscUtils instance;
+
+ @SidedProxy(clientSide="miscutil.core.proxy.ClientProxy", serverSide="miscutil.core.proxy.ServerProxy")
+ public static CommonProxy proxy;
+
+
+ //Pre-Init
+ @Mod.EventHandler
+ public void preInit(FMLPreInitializationEvent event)
+ {
+
+ Utils.LOG_INFO("Doing some house cleaning.");
+ TMCreativeTabs.initialiseTabs();
+ //TMEntity.mainRegistry();
+ CraftingManager.mainRegistry();
+ //TMWorld.mainRegistry();
+ //TMHooks.mainRegistry();
+ proxy.registerTileEntities();
+ proxy.registerRenderThings();
+ proxy.preInit(event);
+
+
+
+ }
+
+ //Init
+ @Mod.EventHandler
+ public void init(FMLInitializationEvent event)
+ {
+ /* Utils.LOG_INFO("Double checking floating point precision.");
+ try {
+ Thread.sleep(100);
+ Benchmark GammeRayBurst = new Benchmark();
+ GammeRayBurst.math();
+ } catch (InterruptedException | ParseException | NumberFormatException | UnknownFormatConversionException | MissingFormatArgumentException e) {
+ if (Strings.DEBUG){
+ e.printStackTrace();
+ Utils.LOG_INFO("Math went wrong somewhere.");
+ }
+ ;
+ }*/
+ proxy.init(event);
+ /*if (Strings.DEBUG){
+ Benchmark GammeRayBurst = new Benchmark();
+ String Insight = GammeRayBurst.superhash("This is Absolution");
+ FMLLog.info(Insight);
+ Utils.LOG_INFO("Math is ok.");
+ }*/
+
+ MinecraftForge.EVENT_BUS.register(this);
+ FMLCommonHandler.instance().bus().register(this);
+ proxy.registerNetworkStuff();
+ }
+
+ //Post-Init
+ @Mod.EventHandler
+ public void postInit(FMLPostInitializationEvent event) {
+ Utils.LOG_INFO("Tidying things up.");
+ proxy.postInit(event);
+ }
+
+ @EventHandler
+ public void serverStarting(FMLServerStartingEvent event)
+ {
+
+ event.registerServerCommand(new CommandMath());
+
+ //while (Strings.DEBUG){
+ //Thread.setDefaultUncaughtExceptionHandler(null);
+ //}
+
+ }
+
+ @Mod.EventHandler
+ public void serverStopping(FMLServerStoppingEvent event)
+ {
+
+
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent arg0) {
+ // TODO Auto-generated method stub
+
+ }
+
+}
diff --git a/src/Java/miscutil/core/CommonProxy.java b/src/Java/miscutil/core/CommonProxy.java
new file mode 100644
index 0000000000..8b0f6c8b2a
--- /dev/null
+++ b/src/Java/miscutil/core/CommonProxy.java
@@ -0,0 +1,70 @@
+package miscutil.core;
+
+import miscutil.core.block.ModBlocks;
+import miscutil.core.gui.ModGUI;
+import miscutil.core.item.ModItems;
+import miscutil.core.lib.Strings;
+import miscutil.core.tileentities.ModTileEntities;
+import miscutil.core.util.Utils;
+import miscutil.gregtech.init.InitGregtech;
+import cpw.mods.fml.common.Loader;
+import cpw.mods.fml.common.event.FMLInitializationEvent;
+import cpw.mods.fml.common.event.FMLPostInitializationEvent;
+import cpw.mods.fml.common.event.FMLPreInitializationEvent;
+
+public class CommonProxy {
+
+ public void preInit(FMLPreInitializationEvent e) {
+ ModItems.init();
+ ModBlocks.init();
+
+
+ //Register Gregtech related items
+ if (Loader.isModLoaded("gregtech") == true) {
+ Utils.LOG_INFO("Gregtech Found - Loading Resources.");
+ Strings.GREGTECH = true;
+ Utils.LOG_INFO("Begining registration & initialization of Gregtech related content.");
+ // Init Gregtech
+ InitGregtech.run();
+
+ }
+ else {
+ Utils.LOG_WARNING("Gregtech not Found - Skipping Resources.");
+ Strings.GREGTECH = false;
+ }
+
+ }
+
+ public void init(FMLInitializationEvent e) {
+
+
+
+ }
+
+ public void postInit(FMLPostInitializationEvent e) {
+
+ }
+
+ public void registerNetworkStuff(){
+ ModGUI.init();
+ //NetworkRegistry.INSTANCE.registerGuiHandler(MiscUtils.instance, new BloodSteelFurnaceGuiHandler());
+
+ }
+
+ public void registerTileEntities(){
+ ModTileEntities.init();
+ //GameRegistry.registerTileEntity(TileEntityBloodSteelChest.class, "tileEntityBloodSteelChest");
+ //GameRegistry.registerTileEntity(TileEntityBloodSteelFurnace.class, "tileEntityBloodSteelFurnace");
+ //GameRegistry.registerTileEntity(TileEntityBloodSteelChest.class, Strings.MODID);
+ //GameRegistry.registerTileEntity(TileEntityArcaneInfuser.class, "TileEntityArcaneInfuser");
+ }
+
+ public void registerRenderThings() {
+
+ }
+
+ public int addArmor(String armor) {
+ return 0;
+ }
+
+}
diff --git a/src/Java/miscutil/core/block/AdvancedBlock.java b/src/Java/miscutil/core/block/AdvancedBlock.java
new file mode 100644
index 0000000000..2a81341838
--- /dev/null
+++ b/src/Java/miscutil/core/block/AdvancedBlock.java
@@ -0,0 +1,31 @@
+package miscutil.core.block;
+
+import miscutil.core.lib.Strings;
+import net.minecraft.block.Block;
+import net.minecraft.block.material.Material;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.world.World;
+
+public class AdvancedBlock extends Block {
+
+ protected AdvancedBlock(String unlocalizedName, Material material, CreativeTabs x, float blockHardness, float blockResistance, float blockLightLevel,
+ String blockHarvestTool, int blockHarvestLevel, SoundType BlockSound) {
+ super(material);
+ this.setBlockName(unlocalizedName);
+ this.setBlockTextureName(Strings.MODID + ":" + unlocalizedName);
+ this.setCreativeTab(x);
+ this.setHardness(blockHardness); //block Hardness
+ this.setResistance(blockResistance);
+ this.setLightLevel(blockLightLevel);
+ this.setHarvestLevel(blockHarvestTool, blockHarvestLevel);
+ this.setStepSound(BlockSound);
+ }
+
+ @Override
+ public boolean onBlockActivated(World p_149727_1_, int p_149727_2_, int p_149727_3_, int p_149727_4_, EntityPlayer p_149727_5_, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_)
+ {
+ return false;
+ }
+
+}
diff --git a/src/Java/miscutil/core/block/BasicBlock.java b/src/Java/miscutil/core/block/BasicBlock.java
new file mode 100644
index 0000000000..63c1044b03
--- /dev/null
+++ b/src/Java/miscutil/core/block/BasicBlock.java
@@ -0,0 +1,22 @@
+package miscutil.core.block;
+
+import miscutil.core.creativetabs.TMCreativeTabs;
+import miscutil.core.lib.Strings;
+import net.minecraft.block.Block;
+import net.minecraft.block.material.Material;
+
+public class BasicBlock extends Block {
+
+ protected BasicBlock(String unlocalizedName, Material material) {
+ super(material);
+ this.setBlockName(unlocalizedName);
+ this.setBlockTextureName(Strings.MODID + ":" + unlocalizedName);
+ this.setCreativeTab(TMCreativeTabs.tabBlock);
+ this.setHardness(2.0F);
+ this.setResistance(6.0F);
+ this.setLightLevel(0.0F);
+ this.setHarvestLevel("pickaxe", 2);
+ this.setStepSound(soundTypeMetal);
+ }
+
+}
diff --git a/src/Java/miscutil/core/block/ModBlocks.java b/src/Java/miscutil/core/block/ModBlocks.java
new file mode 100644
index 0000000000..7f1df843be
--- /dev/null
+++ b/src/Java/miscutil/core/block/ModBlocks.java
@@ -0,0 +1,90 @@
+package miscutil.core.block;
+
+import miscutil.core.util.Utils;
+import net.minecraft.block.Block;
+import net.minecraft.block.material.Material;
+import cpw.mods.fml.common.registry.GameRegistry;
+
+public final class ModBlocks {
+
+ //Blood Steel
+ public static Block blockBloodSteel;
+ public static Block blockStaballoy;
+ public static Block blockToolBuilder;
+ //public static Block blockBloodSteelChest;
+
+ //BloodSteelorial Furnace
+ //public static Block tutFurnace;
+ //public static Block tutFurnaceActive;
+
+ //BloodSteelorial Chest
+ //public static Block tutChest;
+
+ //Arcane Infuser
+ //public static Block arcaneInfuser;
+ //public static Block arcaneInfuserActive;
+
+ //Block Storage
+ //public static Block emxBlockStorage;
+
+
+ public static void init() {
+ Utils.LOG_INFO("Initializing Blocks.");
+ //BloodSteelorial Furnace - Must Init blocks first as they're not static.
+ /** if (Strings.DEBUG){
+ FMLLog.info("Loading Furnace.");}
+ tutFurnace= new BloodSteelFurnace(false).setBlockName("BloodSteelFurnace").setCreativeTab(TMCreativeTabs.tabBlock);
+ tutFurnaceActive= new BloodSteelFurnace(true).setBlockName("BloodSteelFurnaceActive");
+
+ //Arcane Infuser - Must Init blocks first as they're not static.
+ if (Strings.DEBUG){
+ FMLLog.info("Loading Arcane Infuser.");}
+ arcaneInfuser = new ArcaneInfuser(false).setBlockName("ArcaneInfuser").setCreativeTab(TMCreativeTabs.tabBlock);
+ arcaneInfuserActive = new ArcaneInfuser(true).setBlockName("ArcaneInfuserActive");
+
+ //Blood Steel Chest
+ if (Strings.DEBUG){
+ FMLLog.info("Loading Blood Steel Chest.");}
+ tutChest = new BloodSteelChest(0).setBlockName("BloodSteelChest").setCreativeTab(TMCreativeTabs.tabBlock);
+
+ */
+ //BlockStorage
+ //emxBlockStorage = new BlockStorage();
+
+ //Register Blocks next - TODO
+ registerBlocks();
+ }
+
+ public static void registerBlocks(){
+
+ Utils.LOG_INFO("Registering Blocks.");
+
+ //Blood Steel Block
+ GameRegistry.registerBlock(blockBloodSteel = new BasicBlock("blockBloodSteel", Material.iron), "blockBloodSteel");
+
+ //Staballoy Block
+ GameRegistry.registerBlock(blockStaballoy = new BasicBlock("blockStaballoy", Material.iron), "blockStaballoy");
+
+ //Blood Steel Block //Name, Material, Hardness, Resistance, Light level, Tool, tool level, sound
+ //GameRegistry.registerBlock(blockToolBuilder = new AdvancedBlock("blockToolBuilder", Material.circuits, TMCreativeTabs.tabMachines, 1F, 5F, 0F, "pickaxe", 1, Block.soundTypeWood), "blockToolBuilder");
+
+ /** TODO re-enable blocks when working.
+
+
+ //Blood Steel Chest
+ GameRegistry.registerBlock(tutChest, tutChest.getUnlocalizedName());
+
+ //BloodSteelorial Furnace
+ GameRegistry.registerBlock(tutFurnace, tutFurnace.getUnlocalizedName());
+ GameRegistry.registerBlock(tutFurnaceActive, tutFurnaceActive.getUnlocalizedName());
+
+ //Arcane Infuser
+ GameRegistry.registerBlock(arcaneInfuser, arcaneInfuser.getUnlocalizedName());
+ GameRegistry.registerBlock(arcaneInfuserActive, arcaneInfuserActive.getUnlocalizedName());
+ **/
+
+ //Block Storage
+ //GameRegistry.registerBlock(emxBlockStorage, emxBlockStorage.getUnlocalizedName());
+ }
+
+} \ No newline at end of file
diff --git a/src/Java/miscutil/core/commands/CommandMath.java b/src/Java/miscutil/core/commands/CommandMath.java
new file mode 100644
index 0000000000..933684d277
--- /dev/null
+++ b/src/Java/miscutil/core/commands/CommandMath.java
@@ -0,0 +1,195 @@
+package miscutil.core.commands;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import miscutil.core.util.Utils;
+import net.minecraft.command.ICommand;
+import net.minecraft.command.ICommandSender;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.item.EntityXPOrb;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.util.ChunkCoordinates;
+import net.minecraft.world.World;
+
+
+public class CommandMath implements ICommand
+{
+ private final List aliases;
+
+ protected String fullEntityName;
+ protected Entity conjuredEntity;
+
+ public CommandMath()
+ {
+ aliases = new ArrayList();
+
+ aliases.add("hometele");
+
+ aliases.add("warphome");
+
+ }
+
+ @Override
+ public int compareTo(Object o)
+ {
+ return 0;
+
+ }
+
+ @Override
+ public String getCommandName()
+ {
+ return "bed";
+
+ }
+
+ @Override
+ public String getCommandUsage(ICommandSender var1)
+ {
+ return "/bed [Teleports you to your bed for XP]";
+
+ }
+
+ @Override
+ public List getCommandAliases()
+ {
+ return this.aliases;
+
+ }
+
+ public void processCommand(ICommandSender S, String[] argString)
+ {
+ World W = S.getEntityWorld();
+ CommandUtils C = new CommandUtils();
+ EntityPlayer P = C.getPlayer(S);
+ //System.out.println(P.getCommandSenderName());
+ //System.out.println(P.getDisplayName());
+ if (W.isRemote)
+
+ {
+
+ System.out.println("Not processing on Client side");
+
+ }
+
+ else
+
+ {
+
+ System.out.println("Processing on Server side - Home Teleport engaged by: "+P.getDisplayName());
+
+ int XP_TOTAL = P.experienceTotal;
+ Utils.LOG_WARNING("Total Xp:" + XP_TOTAL);
+ ChunkCoordinates X = P.getPlayerCoordinates();
+ Utils.LOG_WARNING("Player Location: "+X);
+ ChunkCoordinates Y = null;
+ Utils.LOG_WARNING("Bed Location: "+Y);
+ if (!P.getBedLocation(0).equals(null)){
+ Y = P.getBedLocation(0);
+ Utils.LOG_WARNING("Bed Location: "+Y);
+ }
+ else {
+ Y = W.getSpawnPoint();
+ Utils.LOG_WARNING("Spawn Location: "+Y);
+ }
+ if (Y == null) {
+ Y = W.getSpawnPoint();
+ Utils.LOG_WARNING("Spawn Location: "+Y);
+ }
+
+ int x1 = X.posX;
+ Utils.LOG_WARNING("X1: "+x1);
+ int x2 = Y.posX;
+ Utils.LOG_WARNING("X2: "+x2);
+ int y1 = X.posY;
+ Utils.LOG_WARNING("Y1: "+y1);
+ int y2 = Y.posY;
+ Utils.LOG_WARNING("Y2: "+y2);
+ int z1 = X.posZ;
+ Utils.LOG_WARNING("Z1: "+z1);
+ int z2 = Y.posZ;
+ Utils.LOG_WARNING("Z2: "+z2);
+
+
+ double d = Math.sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)+(z2-z1)*(z2-z1));
+ String xpCost = String.valueOf((int)(d*0.15));
+
+ Utils.LOG_WARNING("d:" + d);
+ Utils.LOG_WARNING("-----------------------------------------");
+ Utils.LOG_WARNING("Actual math formulae");
+ Utils.LOG_WARNING(String.valueOf(d));
+ Utils.LOG_WARNING("-----------------------------------------");
+ Utils.LOG_WARNING("Xp Cost based on answer B.");
+ Utils.LOG_WARNING(String.valueOf(d*0.15) + " | " + String.valueOf(xpCost));
+ Utils.LOG_WARNING("-----------------------------------------");
+ Utils.LOG_WARNING("Xp Total");
+ Utils.LOG_WARNING(String.valueOf(XP_TOTAL));
+ Utils.LOG_WARNING("-----------------------------------------");
+
+
+
+ if ((XP_TOTAL-Float.valueOf(xpCost)) > 0){
+ EntityXPOrb E = new EntityXPOrb(W, P.posX, P.posY + 1.62D - (double) P.yOffset, P.posZ, 1);
+ //E.moveTowards((double) Y.posX + 0.5D, (int) Y.posY + 3, (double) Y.posZ + 0.5D);
+ E.setVelocity((double) Y.posX + 0.5D, (int) Y.posY + 0.1, (double) Y.posZ + 0.5D);
+ W.spawnEntityInWorld(E);
+ W.playAuxSFXAtEntity((EntityPlayer) null, 1002, (int) P.posX, (int) P.posY, (int) P.posZ, 0);
+ P.setPositionAndUpdate(x2, y2+1, z2);
+
+ //gregtech.api.util.GT_Utility.sendChatToPlayer(P, "Movement | X:"+x2+" | Y:"+y2+" | Z:"+z2);
+ gregtech.api.util.GT_Utility.sendChatToPlayer(P, "Distance Traveled | "+String.valueOf((int)(d)) + " Blocks & " + xpCost + "xp");
+ gregtech.api.util.GT_Utility.sendChatToPlayer(P, "You suddenly feel at home.");
+ P.experienceTotal = (int) (XP_TOTAL-Float.valueOf(xpCost));
+ if (!xpCost.equals("0") && Float.valueOf(xpCost) > 0){
+ gregtech.api.util.GT_Utility.sendChatToPlayer(P, "...At the loss of "+xpCost+" xp.");
+ }
+ else if (xpCost.equals("0")){
+ gregtech.api.util.GT_Utility.sendChatToPlayer(P, "...At the loss of very little xp.");
+ }
+ else {
+ gregtech.api.util.GT_Utility.sendChatToPlayer(P, "Something went wrong with the math, have this one on the house. :)");
+ }
+ }
+
+ else {
+ gregtech.api.util.GT_Utility.sendChatToPlayer(P, "You don't feel you're able to do this yet.");
+ }
+
+ }
+ }
+
+ @Override
+ public boolean canCommandSenderUseCommand(ICommandSender var1)
+ {
+ return true;
+
+ }
+
+ @Override
+ public List addTabCompletionOptions(ICommandSender var1, String[] var2)
+ {
+ // TODO Auto-generated method stub
+
+ return null;
+
+ }
+
+ @Override
+ public boolean isUsernameIndex(String[] var1, int var2)
+ {
+ // TODO Auto-generated method stub
+
+ return false;
+
+ }
+
+ public boolean playerUsesCommand(World W, EntityPlayer P, int cost)
+ {
+
+
+ return true;
+ }
+
+}
+
diff --git a/src/Java/miscutil/core/commands/CommandUtils.java b/src/Java/miscutil/core/commands/CommandUtils.java
new file mode 100644
index 0000000000..f33263fa40
--- /dev/null
+++ b/src/Java/miscutil/core/commands/CommandUtils.java
@@ -0,0 +1,20 @@
+package miscutil.core.commands;
+
+import net.minecraft.command.ICommandSender;
+import net.minecraft.entity.player.EntityPlayer;
+
+public class CommandUtils {
+
+ public EntityPlayer getPlayer(ICommandSender icommandsender){
+ EntityPlayer player;
+
+ if(icommandsender instanceof EntityPlayer){
+ player = (EntityPlayer)icommandsender;
+ return player;
+ }
+ else {
+ return null;
+ }
+ }
+
+}
diff --git a/src/Java/miscutil/core/creativetabs/MiscUtilCreativeTabBlock.java b/src/Java/miscutil/core/creativetabs/MiscUtilCreativeTabBlock.java
new file mode 100644
index 0000000000..2db845e04c
--- /dev/null
+++ b/src/Java/miscutil/core/creativetabs/MiscUtilCreativeTabBlock.java
@@ -0,0 +1,18 @@
+package miscutil.core.creativetabs;
+
+import miscutil.core.block.ModBlocks;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.item.Item;
+
+public class MiscUtilCreativeTabBlock extends CreativeTabs {
+
+ public MiscUtilCreativeTabBlock(String lable) {
+ super(lable);
+ }
+
+ @Override
+ public Item getTabIconItem() {
+ return Item.getItemFromBlock(ModBlocks.blockBloodSteel);
+ }
+
+}
diff --git a/src/Java/miscutil/core/creativetabs/MiscUtilCreativeTabMachines.java b/src/Java/miscutil/core/creativetabs/MiscUtilCreativeTabMachines.java
new file mode 100644
index 0000000000..620648d6c0
--- /dev/null
+++ b/src/Java/miscutil/core/creativetabs/MiscUtilCreativeTabMachines.java
@@ -0,0 +1,18 @@
+package miscutil.core.creativetabs;
+
+import miscutil.core.block.ModBlocks;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.item.Item;
+
+public class MiscUtilCreativeTabMachines extends CreativeTabs {
+
+ public MiscUtilCreativeTabMachines(String lable) {
+ super(lable);
+ }
+
+ @Override
+ public Item getTabIconItem() {
+ return Item.getItemFromBlock(ModBlocks.blockToolBuilder);
+ }
+
+}
diff --git a/src/Java/miscutil/core/creativetabs/MiscUtilCreativeTabMisc.java b/src/Java/miscutil/core/creativetabs/MiscUtilCreativeTabMisc.java
new file mode 100644
index 0000000000..2893146f93
--- /dev/null
+++ b/src/Java/miscutil/core/creativetabs/MiscUtilCreativeTabMisc.java
@@ -0,0 +1,18 @@
+package miscutil.core.creativetabs;
+
+import miscutil.core.item.ModItems;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.item.Item;
+
+public class MiscUtilCreativeTabMisc extends CreativeTabs {
+
+ public MiscUtilCreativeTabMisc(String lable) {
+ super(lable);
+ }
+
+ @Override
+ public Item getTabIconItem() {
+ return ModItems.itemIngotBloodSteel;
+ }
+
+}
diff --git a/src/Java/miscutil/core/creativetabs/MiscUtilCreativeTabTools.java b/src/Java/miscutil/core/creativetabs/MiscUtilCreativeTabTools.java
new file mode 100644
index 0000000000..aa7cf227aa
--- /dev/null
+++ b/src/Java/miscutil/core/creativetabs/MiscUtilCreativeTabTools.java
@@ -0,0 +1,18 @@
+package miscutil.core.creativetabs;
+
+import miscutil.core.item.ModItems;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.item.Item;
+
+public class MiscUtilCreativeTabTools extends CreativeTabs {
+
+ public MiscUtilCreativeTabTools(String lable) {
+ super(lable);
+ }
+
+ @Override
+ public Item getTabIconItem() {
+ return ModItems.itemStaballoyPickaxe;
+ }
+
+}
diff --git a/src/Java/miscutil/core/creativetabs/TMCreativeTabs.java b/src/Java/miscutil/core/creativetabs/TMCreativeTabs.java
new file mode 100644
index 0000000000..05d170d6e1
--- /dev/null
+++ b/src/Java/miscutil/core/creativetabs/TMCreativeTabs.java
@@ -0,0 +1,20 @@
+package miscutil.core.creativetabs;
+
+import net.minecraft.creativetab.CreativeTabs;
+
+public class TMCreativeTabs {
+
+ public static CreativeTabs tabBlock;
+ public static CreativeTabs tabMisc;
+ public static CreativeTabs tabCombat;
+ public static CreativeTabs tabTools;
+ public static CreativeTabs tabMachines;
+
+ public static void initialiseTabs(){
+ tabBlock = new MiscUtilCreativeTabBlock("MiscUtilBlockTab");
+ tabMisc = new MiscUtilCreativeTabMisc("MiscUtilMiscTab");
+ //tabMachines = new MiscUtilCreativeTabMachines("MiscUtilMachineTab");
+ //tabCombat = new MiscUtilCreativeTabCombat("MiscUtilCombatTab");
+ tabTools = new MiscUtilCreativeTabTools("MiscUtilToolsTab");
+ }
+}
diff --git a/src/Java/miscutil/core/gui/GUI_Bat_Buf.java b/src/Java/miscutil/core/gui/GUI_Bat_Buf.java
new file mode 100644
index 0000000000..efe42c7257
--- /dev/null
+++ b/src/Java/miscutil/core/gui/GUI_Bat_Buf.java
@@ -0,0 +1,247 @@
+package miscutil.core.gui;
+
+import miscutil.core.lib.Strings;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.GuiButton;
+import net.minecraft.client.gui.GuiScreen;
+import net.minecraft.client.resources.I18n;
+import net.minecraft.util.ResourceLocation;
+
+import org.lwjgl.input.Keyboard;
+import org.lwjgl.opengl.GL11;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+
+
+
+public class GUI_Bat_Buf extends GuiScreen
+{
+ private final int bookImageHeight = 192;
+ private final int bookImageWidth = 192;
+ private int currPage = 0;
+ private static final int bookTotalPages = 4;
+ private static ResourceLocation[] bookPageTextures =
+
+ new ResourceLocation[bookTotalPages];
+ private static String[] stringPageText = new String[bookTotalPages];
+ private GuiButton buttonDone;
+ private NextPageButton buttonNextPage;
+ private NextPageButton buttonPreviousPage;
+
+ public GUI_Bat_Buf()
+ {
+
+ bookPageTextures[0] = new ResourceLocation(
+
+ Strings.MODID+":textures/gui/book_cover.png");
+
+ bookPageTextures[1] = new ResourceLocation(
+
+ Strings.MODID+":textures/gui/book.png");
+
+ bookPageTextures[2] = new ResourceLocation(
+
+ Strings.MODID+":textures/gui/book.png");
+
+ stringPageText[0] = "";
+
+ stringPageText[1] = "The Mysterious Stranger admired your family cow and asked if it was for sale.\n\nWhen you nodded, he offered to trade some Magic Beans, that (if planted in tilled dirt) would lead to more wealth than you could imagine.";
+
+ stringPageText[2]="So you handed him your cow, and grabbed the Magic Beans.\n\nPleased with yourself, you hurried away, looking for tilled dirt in which to plant the Magic Beans.\n\nYou couldn't wait to see how proud your mother would be for";
+ stringPageText[3]="being so shrewd! Untold wealth in return for an old, milkless cow; what a good deal you made!\n\nSo off you went, looking for a place to plant the Magic Beans with room to grow...";
+ }
+
+ /**
+ * Adds the buttons (and other controls) to the screen in question.
+ */
+ @Override
+ public void initGui()
+ {
+ // DEBUG
+ System.out.println("GuiMysteriousStranger initGUI()");
+ buttonList.clear();
+ Keyboard.enableRepeatEvents(true);
+
+ buttonDone = new GuiButton(0, width / 2 + 2, 4 + bookImageHeight,
+
+ 98, 20, I18n.format("gui.done", new Object[0]));
+
+ buttonList.add(buttonDone);
+ int offsetFromScreenLeft = (width - bookImageWidth) / 2;
+ buttonList.add(buttonNextPage = new NextPageButton(1,
+
+ offsetFromScreenLeft + 120, 156, true));
+ buttonList.add(buttonPreviousPage = new NextPageButton(2,
+
+ offsetFromScreenLeft + 38, 156, false));
+ }
+
+ /**
+ * Called from the main game loop to update the screen.
+ */
+ @Override
+ public void updateScreen()
+ {
+ buttonDone.visible = (currPage == bookTotalPages - 1);
+ buttonNextPage.visible = (currPage < bookTotalPages - 1);
+ buttonPreviousPage.visible = currPage > 0;
+ }
+
+ /**
+ * Draws the screen and all the components in it.
+ */
+ @Override
+ public void drawScreen(int parWidth, int parHeight, float p_73863_3_)
+ {
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ if (currPage == 0)
+ {
+ mc.getTextureManager().bindTexture(bookPageTextures[0]);
+ }
+ else
+ {
+ mc.getTextureManager().bindTexture(bookPageTextures[1]);
+ }
+ int offsetFromScreenLeft = (width - bookImageWidth ) / 2;
+ drawTexturedModalRect(offsetFromScreenLeft, 2, 0, 0, bookImageWidth,
+
+ bookImageHeight);
+ int widthOfString;
+ String stringPageIndicator = I18n.format("book.pageIndicator",
+
+ new Object[] {Integer.valueOf(currPage + 1), bookTotalPages});
+
+ widthOfString = fontRendererObj.getStringWidth(stringPageIndicator);
+ fontRendererObj.drawString(stringPageIndicator,
+
+ offsetFromScreenLeft - widthOfString + bookImageWidth - 44,
+
+ 18, 0);
+
+ fontRendererObj.drawSplitString(stringPageText[currPage],
+
+ offsetFromScreenLeft + 36, 34, 116, 0);
+
+ super.drawScreen(parWidth, parHeight, p_73863_3_);
+
+ }
+
+ /**
+ * Called when a mouse button is pressed and the mouse is moved around.
+
+ * Parameters are : mouseX, mouseY, lastButtonClicked &
+
+ * timeSinceMouseClick.
+ */
+ @Override
+ protected void mouseClickMove(int parMouseX, int parMouseY,
+
+ int parLastButtonClicked, long parTimeSinceMouseClick)
+
+ {
+
+ }
+
+ @Override
+ protected void actionPerformed(GuiButton parButton)
+ {
+ if (parButton == buttonDone)
+ {
+ // You can send a packet to server here if you need server to do
+
+ // something
+ mc.displayGuiScreen((GuiScreen)null);
+ }
+ else if (parButton == buttonNextPage)
+ {
+ if (currPage < bookTotalPages - 1)
+ {
+ ++currPage;
+ }
+ }
+ else if (parButton == buttonPreviousPage)
+ {
+ if (currPage > 0)
+ {
+ --currPage;
+ }
+ }
+ }
+
+ /**
+ * Called when the screen is unloaded. Used to disable keyboard repeat
+
+ * events
+ */
+ @Override
+ public void onGuiClosed()
+ {
+
+ }
+
+ /**
+ * Returns true if this GUI should pause the game when it is displayed in
+
+ * single-player
+ */
+ @Override
+ public boolean doesGuiPauseGame()
+ {
+ return true;
+ }
+
+ @SideOnly(Side.CLIENT)
+ static class NextPageButton extends GuiButton
+ {
+ private final boolean isNextButton;
+
+ public NextPageButton(int parButtonId, int parPosX, int parPosY,
+
+ boolean parIsNextButton)
+ {
+ super(parButtonId, parPosX, parPosY, 23, 13, "");
+ isNextButton = parIsNextButton;
+ }
+
+ /**
+ * Draws this button to the screen.
+ */
+ @Override
+ public void drawButton(Minecraft mc, int parX, int parY)
+ {
+ if (visible)
+ {
+ boolean isButtonPressed = (parX >= xPosition
+
+ && parY >= yPosition
+
+ && parX < xPosition + width
+
+ && parY < yPosition + height);
+
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ mc.getTextureManager().bindTexture(bookPageTextures[1]);
+ int textureX = 0;
+ int textureY = 192;
+
+ if (isButtonPressed)
+ {
+ textureX += 23;
+ }
+
+ if (!isNextButton)
+ {
+ textureY += 13;
+ }
+
+ drawTexturedModalRect(xPosition, yPosition,
+
+ textureX, textureY,
+
+ 23, 13);
+ }
+ }
+ }
+}
+
diff --git a/src/Java/miscutil/core/gui/GUI_Battery_Buffer.java b/src/Java/miscutil/core/gui/GUI_Battery_Buffer.java
new file mode 100644
index 0000000000..c4bdf3666b
--- /dev/null
+++ b/src/Java/miscutil/core/gui/GUI_Battery_Buffer.java
@@ -0,0 +1,51 @@
+package miscutil.core.gui;
+
+import net.minecraft.client.gui.GuiButton;
+import net.minecraft.client.gui.GuiScreen;
+
+public class GUI_Battery_Buffer extends GuiScreen {
+
+ private GuiButton a;
+ private GuiButton b;
+
+ @Override
+ public void drawScreen(int mouseX, int mouseY, float partialTicks) {
+ this.drawDefaultBackground();
+ super.drawScreen(mouseX, mouseY, partialTicks);
+ }
+
+ @Override
+ public boolean doesGuiPauseGame() {
+ return false;
+ }
+
+ /*
+ @SuppressWarnings("unchecked")
+ public void initGui() {
+ this.buttonList.add(this.a = new GuiButton(0, this.width / 2 - 100, this.height / 2 - 24, "This is button a"));
+ this.buttonList.add(this.b = new GuiButton(1, this.width / 2 - 100, this.height / 2 + 4, "This is button b"));
+ }*/
+
+ /* @Override
+ protected void actionPerformed(GuiButton button) {
+ if (button == this.a) {
+ //Main.packetHandler.sendToServer(...);
+ this.mc.displayGuiScreen(null);
+ if (this.mc.currentScreen == null)
+ this.mc.setIngameFocus();
+ }
+ if (button == this.b){
+ //Main.packetHandler.sendToServer(...);
+ this.mc.displayGuiScreen(null);
+ if (this.mc.currentScreen == null)
+ this.mc.setIngameFocus();
+ }
+ }*/
+ /**
+ * if (worldIn.isRemote) {
+ playerIn.openGui(Main.instance, 0, worldIn, (int) playerIn.posX, (int) playerIn.posY, (int) playerIn.posZ);
+ }
+ */
+
+
+} \ No newline at end of file
diff --git a/src/Java/miscutil/core/gui/GUI_Tool_Builder.java b/src/Java/miscutil/core/gui/GUI_Tool_Builder.java
new file mode 100644
index 0000000000..e6a81a7d80
--- /dev/null
+++ b/src/Java/miscutil/core/gui/GUI_Tool_Builder.java
@@ -0,0 +1,5 @@
+package miscutil.core.gui;
+
+public class GUI_Tool_Builder {
+
+}
diff --git a/src/Java/miscutil/core/gui/Gui_No_Inventory_Base.java b/src/Java/miscutil/core/gui/Gui_No_Inventory_Base.java
new file mode 100644
index 0000000000..7a8f7d3e97
--- /dev/null
+++ b/src/Java/miscutil/core/gui/Gui_No_Inventory_Base.java
@@ -0,0 +1,51 @@
+package miscutil.core.gui;
+
+import net.minecraft.client.gui.GuiButton;
+import net.minecraft.client.gui.GuiScreen;
+
+public class Gui_No_Inventory_Base extends GuiScreen {
+
+ private GuiButton a;
+ private GuiButton b;
+
+ @Override
+ public void drawScreen(int mouseX, int mouseY, float partialTicks) {
+ this.drawDefaultBackground();
+ super.drawScreen(mouseX, mouseY, partialTicks);
+ }
+
+ @Override
+ public boolean doesGuiPauseGame() {
+ return false;
+ }
+
+ /*
+ @SuppressWarnings("unchecked")
+ public void initGui() {
+ this.buttonList.add(this.a = new GuiButton(0, this.width / 2 - 100, this.height / 2 - 24, "This is button a"));
+ this.buttonList.add(this.b = new GuiButton(1, this.width / 2 - 100, this.height / 2 + 4, "This is button b"));
+ }*/
+
+ /* @Override
+ protected void actionPerformed(GuiButton button) {
+ if (button == this.a) {
+ //Main.packetHandler.sendToServer(...);
+ this.mc.displayGuiScreen(null);
+ if (this.mc.currentScreen == null)
+ this.mc.setIngameFocus();
+ }
+ if (button == this.b){
+ //Main.packetHandler.sendToServer(...);
+ this.mc.displayGuiScreen(null);
+ if (this.mc.currentScreen == null)
+ this.mc.setIngameFocus();
+ }
+ }*/
+ /**
+ * if (worldIn.isRemote) {
+ playerIn.openGui(Main.instance, 0, worldIn, (int) playerIn.posX, (int) playerIn.posY, (int) playerIn.posZ);
+ }
+ */
+
+
+} \ No newline at end of file
diff --git a/src/Java/miscutil/core/gui/ModGUI.java b/src/Java/miscutil/core/gui/ModGUI.java
new file mode 100644
index 0000000000..28987ccc1b
--- /dev/null
+++ b/src/Java/miscutil/core/gui/ModGUI.java
@@ -0,0 +1,15 @@
+package miscutil.core.gui;
+
+import miscutil.core.util.Utils;
+
+public class ModGUI {
+
+
+ public static void init(){
+
+ Utils.LOG_INFO("Registering GUIs.");
+
+ //Register GuiHandler
+ //NetworkRegistry.INSTANCE.registerGuiHandler(MiscUtils.instance, new GuiHandler());
+ }
+}
diff --git a/src/Java/miscutil/core/handler/CraftingManager.java b/src/Java/miscutil/core/handler/CraftingManager.java
new file mode 100644
index 0000000000..42b602440d
--- /dev/null
+++ b/src/Java/miscutil/core/handler/CraftingManager.java
@@ -0,0 +1,21 @@
+package miscutil.core.handler;
+
+public class CraftingManager {
+
+ public static void mainRegistry() {
+ addCraftingRecipies();
+ addSmeltingRecipies();
+ }
+
+ public static void addCraftingRecipies() {
+ // Shaped Recipie
+ //GameRegistry.addRecipe(new ItemStack(ModItems.tutPickaxe, 1), new Object[] { "###", " S ", " S ", '#', ModItems.tutItem, 'S', Items.stick });
+
+ //Shapeless Recipie
+ //GameRegistry.addShapelessRecipe(new ItemStack(ModItems.tutItem, 10), new Object[]{Blocks.dirt , Blocks.cobblestone});
+ }
+
+ public static void addSmeltingRecipies() {
+ //GameRegistry.addSmelting(ModItems.tutItem, new ItemStack(Blocks.diamond_block, 5), 20.0F);
+ }
+}
diff --git a/src/Java/miscutil/core/handler/GuiHandler.java b/src/Java/miscutil/core/handler/GuiHandler.java
new file mode 100644
index 0000000000..9412ed8983
--- /dev/null
+++ b/src/Java/miscutil/core/handler/GuiHandler.java
@@ -0,0 +1,39 @@
+package miscutil.core.handler;
+
+import miscutil.core.gui.GUI_Bat_Buf;
+import miscutil.core.gui.GUI_Battery_Buffer;
+import miscutil.core.util.Utils;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.world.World;
+import cpw.mods.fml.common.network.IGuiHandler;
+
+public class GuiHandler implements IGuiHandler {
+
+ private static final int GUI1 = 0; //Nothing Yet
+ private static final int GUI2 = 1; //Energy Buffer
+
+
+
+ @Override //ContainerModTileEntity
+ public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
+ if (ID == GUI1)
+ return new GUI_Battery_Buffer();
+
+ return null;
+ }
+
+ @Override //GuiModTileEntity
+ public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
+ Utils.LOG_WARNING("getClientGuiElement Called by: "+player+", in world: "+player.dimension+" at x:"+x+", y:"+y+", z:"+z+".");
+ if (ID == GUI1){
+ Utils.LOG_WARNING("Opening Gui with Id: "+ID);
+ return new GUI_Battery_Buffer();
+ }
+ else if (ID == GUI2){
+ Utils.LOG_WARNING("Opening Gui with Id: "+ID+" Energy Buffer");
+ return new GUI_Bat_Buf();
+ }
+ return null;
+ }
+
+} \ No newline at end of file
diff --git a/src/Java/miscutil/core/handler/ResourceHandler.java b/src/Java/miscutil/core/handler/ResourceHandler.java
new file mode 100644
index 0000000000..e8f81f4d02
--- /dev/null
+++ b/src/Java/miscutil/core/handler/ResourceHandler.java
@@ -0,0 +1,83 @@
+package miscutil.core.handler;
+
+import org.apache.commons.lang3.Validate;
+
+public class ResourceHandler
+{
+ private final String resourceDomain;
+ private final String resourcePath;
+ private static final String __OBFID = "CL_00001082";
+
+ public ResourceHandler(String p_i1292_1_, String p_i1292_2_)
+ {
+ Validate.notNull(p_i1292_2_);
+
+ if (p_i1292_1_ != null && p_i1292_1_.length() != 0)
+ {
+ this.resourceDomain = p_i1292_1_;
+ }
+ else
+ {
+ this.resourceDomain = "minecraft";
+ }
+
+ this.resourcePath = p_i1292_2_;
+ }
+
+ public ResourceHandler(String p_i1293_1_)
+ {
+ String s1 = "miscUtils";
+ String s2 = p_i1293_1_;
+ int i = p_i1293_1_.indexOf(58);
+
+ if (i >= 0)
+ {
+ s2 = p_i1293_1_.substring(i + 1, p_i1293_1_.length());
+
+ if (i > 1)
+ {
+ s1 = p_i1293_1_.substring(0, i);
+ }
+ }
+
+ this.resourceDomain = s1.toLowerCase();
+ this.resourcePath = s2;
+ }
+
+ public String getResourcePath()
+ {
+ return this.resourcePath;
+ }
+
+ public String getResourceDomain()
+ {
+ return this.resourceDomain;
+ }
+
+ public String toString()
+ {
+ return this.resourceDomain + ":" + this.resourcePath;
+ }
+
+ public boolean equals(Object p_equals_1_)
+ {
+ if (this == p_equals_1_)
+ {
+ return true;
+ }
+ else if (!(p_equals_1_ instanceof ResourceHandler))
+ {
+ return false;
+ }
+ else
+ {
+ ResourceHandler resourcelocation = (ResourceHandler)p_equals_1_;
+ return this.resourceDomain.equals(resourcelocation.resourceDomain) && this.resourcePath.equals(resourcelocation.resourcePath);
+ }
+ }
+
+ public int hashCode()
+ {
+ return 31 * this.resourceDomain.hashCode() + this.resourcePath.hashCode();
+ }
+} \ No newline at end of file
diff --git a/src/Java/miscutil/core/item/BaseMetaItemTool.java b/src/Java/miscutil/core/item/BaseMetaItemTool.java
new file mode 100644
index 0000000000..c0b552f721
--- /dev/null
+++ b/src/Java/miscutil/core/item/BaseMetaItemTool.java
@@ -0,0 +1,5 @@
+package miscutil.core.item;
+
+public class BaseMetaItemTool {
+
+}
diff --git a/src/Java/miscutil/core/item/EntityTeleportFX.java b/src/Java/miscutil/core/item/EntityTeleportFX.java
new file mode 100644
index 0000000000..d67ee77968
--- /dev/null
+++ b/src/Java/miscutil/core/item/EntityTeleportFX.java
@@ -0,0 +1,236 @@
+package miscutil.core.item;
+
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.item.EntityItem;
+import net.minecraft.init.Items;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.MathHelper;
+import net.minecraft.world.World;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+
+public class EntityTeleportFX extends Entity
+{
+ /** 'x' location the eye should float towards. */
+ private double targetX;
+ /** 'y' location the eye should float towards. */
+ private double targetY;
+ /** 'z' location the eye should float towards. */
+ private double targetZ;
+ private int despawnTimer;
+ private boolean shatterOrDrop;
+ private static final String __OBFID = "CL_00001716";
+
+ public EntityTeleportFX(World p_i1757_1_)
+ {
+ super(p_i1757_1_);
+ this.setSize(0.25F, 0.25F);
+ }
+
+ protected void entityInit() {}
+
+ /**
+ * Checks if the entity is in range to render by using the past in distance and comparing it to its average edge
+ * length * 64 * renderDistanceWeight Args: distance
+ */
+ @SideOnly(Side.CLIENT)
+ public boolean isInRangeToRenderDist(double p_70112_1_)
+ {
+ double d1 = this.boundingBox.getAverageEdgeLength() * 4.0D;
+ d1 *= 64.0D;
+ return p_70112_1_ < d1 * d1;
+ }
+
+ public EntityTeleportFX(World p_i1758_1_, double p_i1758_2_, double p_i1758_4_, double p_i1758_6_)
+ {
+ super(p_i1758_1_);
+ this.despawnTimer = 0;
+ this.setSize(0.25F, 0.25F);
+ this.setPosition(p_i1758_2_, p_i1758_4_, p_i1758_6_);
+ this.yOffset = 0.0F;
+ }
+
+ /**
+ * The location the eye should float/move towards. Currently used for moving towards the nearest stronghold. Args:
+ * strongholdX, strongholdY, strongholdZ
+ */
+ public void moveTowards(double p_70220_1_, int p_70220_3_, double p_70220_4_)
+ {
+ double d2 = p_70220_1_ - this.posX;
+ double d3 = p_70220_4_ - this.posZ;
+ float f = MathHelper.sqrt_double(d2 * d2 + d3 * d3);
+
+ if (f > 12.0F)
+ {
+ this.targetX = this.posX + d2 / (double)f * 12.0D;
+ this.targetZ = this.posZ + d3 / (double)f * 12.0D;
+ this.targetY = this.posY + 8.0D;
+ }
+ else
+ {
+ this.targetX = p_70220_1_;
+ this.targetY = (double)p_70220_3_;
+ this.targetZ = p_70220_4_;
+ }
+
+ this.despawnTimer = 0;
+ this.shatterOrDrop = this.rand.nextInt(5) > 0;
+ }
+
+ /**
+ * Sets the velocity to the args. Args: x, y, z
+ */
+ @SideOnly(Side.CLIENT)
+ public void setVelocity(double p_70016_1_, double p_70016_3_, double p_70016_5_)
+ {
+ this.motionX = p_70016_1_;
+ this.motionY = p_70016_3_;
+ this.motionZ = p_70016_5_;
+
+ if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F)
+ {
+ float f = MathHelper.sqrt_double(p_70016_1_ * p_70016_1_ + p_70016_5_ * p_70016_5_);
+ this.prevRotationYaw = this.rotationYaw = (float)(Math.atan2(p_70016_1_, p_70016_5_) * 180.0D / Math.PI);
+ this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(p_70016_3_, (double)f) * 180.0D / Math.PI);
+ }
+ }
+
+ /**
+ * Called to update the entity's position/logic.
+ */
+ public void onUpdate()
+ {
+ this.lastTickPosX = this.posX;
+ this.lastTickPosY = this.posY;
+ this.lastTickPosZ = this.posZ;
+ super.onUpdate();
+ this.posX += this.motionX;
+ this.posY += this.motionY;
+ this.posZ += this.motionZ;
+ float f = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
+ this.rotationYaw = (float)(Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI);
+
+ for (this.rotationPitch = (float)(Math.atan2(this.motionY, (double)f) * 180.0D / Math.PI); this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F)
+ {
+ ;
+ }
+
+ while (this.rotationPitch - this.prevRotationPitch >= 180.0F)
+ {
+ this.prevRotationPitch += 360.0F;
+ }
+
+ while (this.rotationYaw - this.prevRotationYaw < -180.0F)
+ {
+ this.prevRotationYaw -= 360.0F;
+ }
+
+ while (this.rotationYaw - this.prevRotationYaw >= 180.0F)
+ {
+ this.prevRotationYaw += 360.0F;
+ }
+
+ this.rotationPitch = this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) * 0.2F;
+ this.rotationYaw = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F;
+
+ if (!this.worldObj.isRemote)
+ {
+ double d0 = this.targetX - this.posX;
+ double d1 = this.targetZ - this.posZ;
+ float f1 = (float)Math.sqrt(d0 * d0 + d1 * d1);
+ float f2 = (float)Math.atan2(d1, d0);
+ double d2 = (double)f + (double)(f1 - f) * 0.0025D;
+
+ if (f1 < 1.0F)
+ {
+ d2 *= 0.8D;
+ this.motionY *= 0.8D;
+ }
+
+ this.motionX = Math.cos((double)f2) * d2;
+ this.motionZ = Math.sin((double)f2) * d2;
+
+ if (this.posY < this.targetY)
+ {
+ this.motionY += (1.0D - this.motionY) * 0.014999999664723873D;
+ }
+ else
+ {
+ this.motionY += (-1.0D - this.motionY) * 0.014999999664723873D;
+ }
+ }
+
+ float f3 = 0.25F;
+
+ if (this.isInWater())
+ {
+ for (int i = 0; i < 4; ++i)
+ {
+ this.worldObj.spawnParticle("bubble", this.posX - this.motionX * (double)f3, this.posY - this.motionY * (double)f3, this.posZ - this.motionZ * (double)f3, this.motionX, this.motionY, this.motionZ);
+ }
+ }
+ else
+ {
+ this.worldObj.spawnParticle("portal", this.posX - this.motionX * (double)f3 + this.rand.nextDouble() * 0.6D - 0.3D, this.posY - this.motionY * (double)f3 - 0.5D, this.posZ - this.motionZ * (double)f3 + this.rand.nextDouble() * 0.6D - 0.3D, this.motionX, this.motionY, this.motionZ);
+ }
+
+ if (!this.worldObj.isRemote)
+ {
+ this.setPosition(this.posX, this.posY, this.posZ);
+ ++this.despawnTimer;
+
+ if (this.despawnTimer > 80 && !this.worldObj.isRemote)
+ {
+ this.setDead();
+
+ if (this.shatterOrDrop)
+ {
+ this.worldObj.spawnEntityInWorld(new EntityItem(this.worldObj, this.posX, this.posY, this.posZ, new ItemStack(Items.ender_eye)));
+ }
+ else
+ {
+ this.worldObj.playAuxSFX(2003, (int)Math.round(this.posX), (int)Math.round(this.posY), (int)Math.round(this.posZ), 0);
+ }
+ }
+ }
+ }
+
+ /**
+ * (abstract) Protected helper method to write subclass entity data to NBT.
+ */
+ public void writeEntityToNBT(NBTTagCompound p_70014_1_) {}
+
+ /**
+ * (abstract) Protected helper method to read subclass entity data from NBT.
+ */
+ public void readEntityFromNBT(NBTTagCompound p_70037_1_) {}
+
+ @SideOnly(Side.CLIENT)
+ public float getShadowSize()
+ {
+ return 0.0F;
+ }
+
+ /**
+ * Gets how bright this entity is.
+ */
+ public float getBrightness(float p_70013_1_)
+ {
+ return 1.0F;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public int getBrightnessForRender(float p_70070_1_)
+ {
+ return 15728880;
+ }
+
+ /**
+ * If returns false, the item will not inflict any damage against entities.
+ */
+ public boolean canAttackWithItem()
+ {
+ return false;
+ }
+} \ No newline at end of file
diff --git a/src/Java/miscutil/core/item/ModItems.java b/src/Java/miscutil/core/item/ModItems.java
new file mode 100644
index 0000000000..7b84f3c589
--- /dev/null
+++ b/src/Java/miscutil/core/item/ModItems.java
@@ -0,0 +1,311 @@
+package miscutil.core.item;
+
+import miscutil.core.creativetabs.TMCreativeTabs;
+import miscutil.core.item.effects.RarityUncommon;
+import miscutil.core.item.tool.staballoy.StaballoyPickaxe;
+import miscutil.core.lib.Strings;
+import miscutil.core.util.Utils;
+import net.minecraft.item.Item;
+import net.minecraft.item.Item.ToolMaterial;
+import net.minecraft.item.ItemArmor.ArmorMaterial;
+import net.minecraftforge.common.util.EnumHelper;
+import cpw.mods.fml.common.Loader;
+import cpw.mods.fml.common.registry.GameRegistry;
+
+public final class ModItems {
+/* A name for the material. This should be the same as the name of the variable we use to store the material (in this case "TUTORIAL").
+ A harvest level for pickaxes. This is a value between 0 and 3 and defines which blocks can be mined with this tool. Its also possible to create blocks which need a higher harvest level than 3, but then you are not able to mine them with vanilla tools.
+ Common values for the harvest level are:
+ Wood/Gold Tool: 0
+ Stone Tool: 1
+ Iron Tool: 2
+ Diamond Tool: 3
+ The durability of the tool or sword. This value defines how often you can use a tool until it breaks. The tools always last one use longer than the entered value.
+ Common values for the durability are:
+ Wood Tool: 59
+ Stone Tool: 131
+ Iron Tool: 250
+ Diamond Tool: 1561
+ Gold Tool: 32
+ The mining speed of the tool. This value defines how much faster you are with this tool than with your hand.
+ Common values for the mining speed are:
+ Wood Tool: 2.0F
+ Stone Tool: 4.0F
+ Iron Tool: 6.0F
+ Diamond Tool: 8.0F
+ Gold Tool: 12.0F
+ The damage versus Entites. This value is used to calculate the damage an entity takes if you hit it with this tool/sword. This value defines the basic damage to which different values are added, depending on the type of tool. A sword always causes 4 more damage than written in the ToolMaterial. So, if you want to create a sword which adds 10 damage to your normal damage, the value in the ToolMaterial needs to be 6.0F. Of course the values can be below zero.
+ Common values for the damage versus Entities are:
+ Wood Tool: 0.0F (Sword adds 4.0 damage)
+ Stone Tool: 1.0F (Sword adds 5.0 damage)
+ Iron Tool: 2.0F (Sword adds 6.0 damage)
+ Diamond Tool: 3.0F (Sword adds 7.0 damage)
+ Gold Tool: 0.0F (Sword adds 4.0 damage)
+ The enchantability of this tool. This value is quite complex to understand and I have to admit that I don't quite know how it is calculated. Basically you can say that a higher enchantability leads to better enchantements with the same amount of XP.
+ Common values for the enchantability are:
+ Wood Tool: 15
+ Stone Tool: 5
+ Iron Tool: 14
+ Diamond Tool: 10
+ Gold Tool: 22*/
+
+ //Tool Materials
+ //public static ToolMaterial TUTORIAL = EnumHelper.addToolMaterial("TUTORIAL", harvestLevel, durability, miningSpeed, damageVsEntities, enchantability);
+ public static ToolMaterial tutMaterial = EnumHelper.addToolMaterial("BloodSteel Tool Material", 3, 200, 15.0F, 4.0F, 10);
+ public static ToolMaterial STABALLOY = EnumHelper.addToolMaterial("Staballoy", 3, 2500, 7, 1.0F, 18);
+
+ //Armour Materials
+ public static ArmorMaterial tutArmorMaterial = EnumHelper.addArmorMaterial("BloodSteel Armor Material", 33, new int[]{2, 5, 4, 2}, 10);
+
+ //Base Classes For Items
+ public static Item tutPickaxe;
+ public static Item tutAxe;
+ public static Item tutSword;
+ public static Item tutHoe;
+ public static Item tutSpade;
+
+ //Base Classes For Armour
+ public static Item tutHelmet;
+ public static Item tutPlate;
+ public static Item tutPants;
+ public static Item tutBoots;
+
+ //EnderIO
+ public static Item itemPlateSoularium;
+ public static Item itemPlateRedstoneAlloy;
+ public static Item itemPlateElectricalSteel;
+ public static Item itemPlatePulsatingIron;
+ public static Item itemPlateEnergeticAlloy;
+ public static Item itemPlateVibrantAlloy;
+ public static Item itemPlateConductiveIron;
+ public static Item itemPlateDarkSteel;
+
+ //Big Reactors
+ public static Item itemPlateBlutonium;
+ public static Item itemPlateCyanite;
+ public static Item itemPlateLudicrite;
+
+ //Thaumcraft
+ public static Item itemPlateVoidMetal;
+
+ //ExtraUtils
+ public static Item itemPlateBedrockium;
+
+ //Pneumaticraft
+ public static Item itemPlateCompressedIron;
+
+ //SimplyJetpacks
+ public static Item itemPlateEnrichedSoularium;
+
+ //rfTools
+ public static Item itemPlateDimensionShard;
+
+ //Misc Items
+ public static Item itemIngotBloodSteel;
+ public static Item itemPlateBloodSteel;
+
+ //Staballoy
+ public static Item itemStaballoyPickaxe;
+ public static Item itemPlateStaballoy;
+ public static Item itemIngotStaballoy;
+
+
+
+
+ //@SuppressWarnings("unused")
+ @SuppressWarnings("unused")
+ public static final void init(){
+
+ /*
+ *
+ * Strings.DEBUG Parameters area
+ *
+ */
+ //Logs
+ if (!Strings.DEBUG){
+ Utils.LOG_INFO("Development mode not enabled.");
+ }
+ else if (Strings.DEBUG){
+ Utils.LOG_INFO("Development mode enabled.");
+ }
+ else {
+ Utils.LOG_WARNING("Development mode not set.");
+ }
+ /*
+ * End Strings.DEBUG
+ */
+
+
+
+ /* //Blood Steel Equipment
+
+ //Item Init
+ tutPickaxe = new BloodSteelPickaxe(tutMaterial).setUnlocalizedName("BloodSteelPickaxe").setCreativeTab(TMCreativeTabs.tabTools).setTextureName(Strings.MODID + ":BloodSteelPickaxe");
+ tutAxe = new BloodSteelAxe(tutMaterial).setUnlocalizedName("BloodSteelAxe").setCreativeTab(TMCreativeTabs.tabTools).setTextureName(Strings.MODID + ":BloodSteelAxe");
+ tutSword = new BloodSteelSword(tutMaterial).setUnlocalizedName("BloodSteelSword").setCreativeTab(TMCreativeTabs.tabCombat).setTextureName(Strings.MODID + ":BloodSteelSword");
+ tutHoe = new BloodSteelHoe(tutMaterial).setUnlocalizedName("BloodSteelHoe").setCreativeTab(TMCreativeTabs.tabTools).setTextureName(Strings.MODID + ":BloodSteelHoe");
+ tutSpade = new BloodSteelSpade(tutMaterial).setUnlocalizedName("BloodSteelSpade").setCreativeTab(TMCreativeTabs.tabTools).setTextureName(Strings.MODID + ":BloodSteelSpade");
+ tutHelmet = new BloodSteelArmor(tutArmorMaterial, MiscUtils.proxy.addArmor("BloodSteelArmor"), 0).setUnlocalizedName("BloodSteelHelmet").setCreativeTab(TMCreativeTabs.tabCombat).setTextureName(Strings.MODID + ":BloodSteelHelmet");
+ tutPlate = new BloodSteelArmor(tutArmorMaterial, MiscUtils.proxy.addArmor("BloodSteelArmor"), 1).setUnlocalizedName("BloodSteelPlate").setCreativeTab(TMCreativeTabs.tabCombat).setTextureName(Strings.MODID + ":BloodSteelPlate");
+ tutPants = new BloodSteelArmor(tutArmorMaterial, MiscUtils.proxy.addArmor("BloodSteelArmor"), 2).setUnlocalizedName("BloodSteelPants").setCreativeTab(TMCreativeTabs.tabCombat).setTextureName(Strings.MODID + ":BloodSteelPants");
+ tutBoots = new BloodSteelArmor(tutArmorMaterial, MiscUtils.proxy.addArmor("BloodSteelArmor"), 3).setUnlocalizedName("BloodSteelBoots").setCreativeTab(TMCreativeTabs.tabCombat).setTextureName(Strings.MODID + ":BloodSteelBoots");
+
+ //Registry
+ GameRegistry.registerItem(tutPickaxe, tutPickaxe.getUnlocalizedName());
+ GameRegistry.registerItem(tutAxe, tutAxe.getUnlocalizedName());
+ GameRegistry.registerItem(tutSword, tutSword.getUnlocalizedName());
+ GameRegistry.registerItem(tutHoe, tutHoe.getUnlocalizedName());
+ GameRegistry.registerItem(tutSpade, tutSpade.getUnlocalizedName());
+ GameRegistry.registerItem(tutHelmet, tutHelmet.getUnlocalizedName());
+ GameRegistry.registerItem(tutPlate, tutPlate.getUnlocalizedName());
+ GameRegistry.registerItem(tutPants, tutPants.getUnlocalizedName());
+ GameRegistry.registerItem(tutBoots, tutBoots.getUnlocalizedName()); */
+
+
+
+
+
+
+ //EnderIO Resources
+ if (Loader.isModLoaded("EnderIO") == true || Strings.LOAD_ALL_CONTENT){
+ Utils.LOG_INFO("EnderIO Found - Loading Resources.");
+ //Item Init
+ itemPlateSoularium = new Item().setUnlocalizedName("itemPlateSoularium").setCreativeTab(TMCreativeTabs.tabMisc).setTextureName(Strings.MODID + ":itemPlateSoularium");;
+ itemPlateRedstoneAlloy = new Item().setUnlocalizedName("itemPlateRedstoneAlloy").setCreativeTab(TMCreativeTabs.tabMisc).setTextureName(Strings.MODID + ":itemPlateRedstoneAlloy");;
+ itemPlateElectricalSteel = new Item().setUnlocalizedName("itemPlateElectricalSteel").setCreativeTab(TMCreativeTabs.tabMisc).setTextureName(Strings.MODID + ":itemPlateElectricalSteel");;
+ itemPlatePulsatingIron = new Item().setUnlocalizedName("itemPlatePulsatingIron").setCreativeTab(TMCreativeTabs.tabMisc).setTextureName(Strings.MODID + ":itemPlatePulsatingIron");;
+ itemPlateEnergeticAlloy = new Item().setUnlocalizedName("itemPlateEnergeticAlloy").setCreativeTab(TMCreativeTabs.tabMisc).setTextureName(Strings.MODID + ":itemPlateEnergeticAlloy");;
+ itemPlateVibrantAlloy = new Item().setUnlocalizedName("itemPlateVibrantAlloy").setCreativeTab(TMCreativeTabs.tabMisc).setTextureName(Strings.MODID + ":itemPlateVibrantAlloy");;
+ itemPlateConductiveIron = new Item().setUnlocalizedName("itemPlateConductiveIron").setCreativeTab(TMCreativeTabs.tabMisc).setTextureName(Strings.MODID + ":itemPlateConductiveIron");;
+ itemPlateDarkSteel = new Item().setUnlocalizedName("itemPlateDarkSteel").setCreativeTab(TMCreativeTabs.tabMisc).setTextureName(Strings.MODID + ":itemPlateDarkSteel");;
+
+
+ //Registry
+ GameRegistry.registerItem(itemPlateSoularium, "itemPlateSoularium");
+ GameRegistry.registerItem(itemPlateRedstoneAlloy, "itemPlateRedstoneAlloy");
+ GameRegistry.registerItem(itemPlateElectricalSteel, "itemPlateElectricalSteel");
+ GameRegistry.registerItem(itemPlatePulsatingIron, "itemPlatePulsatingIron");
+ GameRegistry.registerItem(itemPlateEnergeticAlloy, "itemPlateEnergeticAlloy");
+ GameRegistry.registerItem(itemPlateVibrantAlloy, "itemPlateVibrantAlloy");
+ GameRegistry.registerItem(itemPlateConductiveIron, "itemPlateConductiveIron");
+ GameRegistry.registerItem(itemPlateDarkSteel, "itemPlateDarkSteel");
+ }
+ else {
+ Utils.LOG_WARNING("EnderIO not Found - Skipping Resources.");
+ }
+
+ //Big Reactors
+ if (Loader.isModLoaded("BigReactors") == true || Strings.LOAD_ALL_CONTENT){
+ Utils.LOG_INFO("BigReactors Found - Loading Resources.");
+ //Item Init
+ itemPlateBlutonium = new Item().setUnlocalizedName("itemPlateBlutonium").setCreativeTab(TMCreativeTabs.tabMisc).setTextureName(Strings.MODID + ":itemPlateBlutonium");;
+ itemPlateCyanite = new Item().setUnlocalizedName("itemPlateCyanite").setCreativeTab(TMCreativeTabs.tabMisc).setTextureName(Strings.MODID + ":itemPlateCyanite");;
+ itemPlateLudicrite = new Item().setUnlocalizedName("itemPlateLudicrite").setCreativeTab(TMCreativeTabs.tabMisc).setTextureName(Strings.MODID + ":itemPlateLudicrite");;
+
+ //Registry
+ GameRegistry.registerItem(itemPlateBlutonium, "itemPlateBlutonium");
+ GameRegistry.registerItem(itemPlateCyanite, "itemPlateCyanite");
+ GameRegistry.registerItem(itemPlateLudicrite, "itemPlateLudicrite");
+
+ }
+ else {
+ Utils.LOG_WARNING("BigReactors not Found - Skipping Resources.");
+ }
+
+ //Thaumcraft
+ if (Loader.isModLoaded("Thaumcraft") == true || Strings.LOAD_ALL_CONTENT){
+ Utils.LOG_INFO("Thaumcraft Found - Loading Resources.");
+ //Item Init
+ itemPlateVoidMetal = new Item().setUnlocalizedName("itemPlateVoidMetal").setCreativeTab(TMCreativeTabs.tabMisc).setTextureName(Strings.MODID + ":itemPlateVoidMetal");;
+
+ //Registry
+ GameRegistry.registerItem(itemPlateVoidMetal, "itemPlateVoidMetal");
+
+ }
+ else {
+ Utils.LOG_WARNING("Thaumcraft not Found - Skipping Resources.");
+ }
+
+ //ExtraUtils
+ if (Loader.isModLoaded("ExtraUtilities") == true || Strings.LOAD_ALL_CONTENT){
+ Utils.LOG_INFO("ExtraUtilities Found - Loading Resources.");
+ //Item Init
+ itemPlateBedrockium = new Item().setUnlocalizedName("itemPlateBedrockium").setCreativeTab(TMCreativeTabs.tabMisc).setTextureName(Strings.MODID + ":itemPlateBedrockium");;
+
+ //Registry
+ GameRegistry.registerItem(itemPlateBedrockium, "itemPlateBedrockium");
+
+ }
+ else {
+ Utils.LOG_WARNING("ExtraUtilities not Found - Skipping Resources.");
+ }
+
+ //Pneumaticraft
+ if (Loader.isModLoaded("PneumaticCraft") == true || Strings.LOAD_ALL_CONTENT){
+ Utils.LOG_INFO("PneumaticCraft Found - Loading Resources.");
+ //Item Init
+ itemPlateCompressedIron = new Item().setUnlocalizedName("itemPlateCompressedIron").setCreativeTab(TMCreativeTabs.tabMisc).setTextureName(Strings.MODID + ":itemPlateCompressedIron");;
+
+ //Registry
+ GameRegistry.registerItem(itemPlateCompressedIron, "itemPlateCompressedIron");
+
+ }
+ else {
+ Utils.LOG_WARNING("PneumaticCraft not Found - Skipping Resources.");
+ }
+
+ //Simply Jetpacks
+ if (Loader.isModLoaded("simplyjetpacks") == true || Strings.LOAD_ALL_CONTENT){
+ Utils.LOG_INFO("SimplyJetpacks Found - Loading Resources.");
+ //Item Init
+ itemPlateEnrichedSoularium = new RarityUncommon().setUnlocalizedName("itemPlateEnrichedSoularium").setCreativeTab(TMCreativeTabs.tabMisc).setTextureName(Strings.MODID + ":itemPlateSoularium");;
+
+ //Registry
+ GameRegistry.registerItem(itemPlateEnrichedSoularium, "itemPlateEnrichedSoularium");
+
+ }
+ else {
+ Utils.LOG_WARNING("SimplyJetpacks not Found - Skipping Resources.");
+ }
+
+
+ //rfTools
+ if (Loader.isModLoaded("rftools") == true || Strings.LOAD_ALL_CONTENT){
+ Utils.LOG_INFO("rfTools Found - Loading Resources.");
+ //Item Init
+ itemPlateDimensionShard = new Item().setUnlocalizedName("itemPlateDimensionShard").setCreativeTab(TMCreativeTabs.tabMisc).setTextureName(Strings.MODID + ":itemPlateDimensionShard");;
+
+ //Registry
+ GameRegistry.registerItem(itemPlateDimensionShard, "itemPlateDimensionShard");
+
+ }
+ else {
+ Utils.LOG_WARNING("rfTools not Found - Skipping Resources.");
+ }
+
+ /*
+ * Misc Items
+ */
+
+ //Staballoy Equipment
+ Utils.LOG_INFO("Interest in Stablloy Found - Loading Resources.");
+ //Pickaxe
+ itemStaballoyPickaxe = new StaballoyPickaxe("itemStaballoyPickaxe", STABALLOY).setCreativeTab(TMCreativeTabs.tabTools);
+ GameRegistry.registerItem(itemStaballoyPickaxe, itemStaballoyPickaxe.getUnlocalizedName());
+ //Staballoy Ingot/Plate
+ itemIngotStaballoy = new Item().setUnlocalizedName("itemIngotStaballoy").setCreativeTab(TMCreativeTabs.tabMisc).setTextureName(Strings.MODID + ":itemIngotStaballoy");;
+ GameRegistry.registerItem(itemIngotStaballoy, "itemIngotStaballoy");
+ itemPlateStaballoy = new Item().setUnlocalizedName("itemPlateStaballoy").setCreativeTab(TMCreativeTabs.tabMisc).setTextureName(Strings.MODID + ":itemPlateStaballoy");;
+ GameRegistry.registerItem(itemPlateStaballoy, "itemPlateStaballoy");
+ //GregTech_API.sRecipeAdder.addAlloySmelterRecipe(, aInput2, aOutput1, aDuration, aEUt)
+
+
+
+ //Blood Steel Ingot
+ itemIngotBloodSteel = new Item().setUnlocalizedName("itemIngotBloodSteel").setCreativeTab(TMCreativeTabs.tabMisc).setTextureName(Strings.MODID + ":itemIngotBloodSteel");;
+ GameRegistry.registerItem(itemIngotBloodSteel, "itemIngotBloodSteel");
+
+
+ }
+
+}
diff --git a/src/Java/miscutil/core/item/effects/RarityEffect.java b/src/Java/miscutil/core/item/effects/RarityEffect.java
new file mode 100644
index 0000000000..41ba2d6baf
--- /dev/null
+++ b/src/Java/miscutil/core/item/effects/RarityEffect.java
@@ -0,0 +1,41 @@
+package miscutil.core.item.effects;
+
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.item.EnumRarity;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+
+/*
+ *
+This determines the name colour. EnumRarity can be:
+EnumRarity.common - the standard white colour.
+EnumRarity.uncommon - a yellow colour.
+EnumRarity.rare - a light blue colour. This is used for enchanted items.
+EnumRarity.epic - the purple colour used on the Golden Apple.
+@SideOnly is an FML annotation. It marks the method below it for existing only on one side. Possible values are:
+Side.CLIENT is probably the most common one. This marks the method as existing only on the client side.
+Side.SERVER marks the method as existing only on the server side.
+ *
+ */
+
+public class RarityEffect extends Item {
+
+ public RarityEffect(int par1){
+ super();
+ this.setCreativeTab(CreativeTabs.tabMaterials);
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public EnumRarity getRarity(ItemStack par1ItemStack){
+ return EnumRarity.common;
+ }
+
+ @Override
+ public boolean hasEffect(ItemStack par1ItemStack){
+ return true;
+ }
+
+}
diff --git a/src/Java/miscutil/core/item/effects/RarityEpic.java b/src/Java/miscutil/core/item/effects/RarityEpic.java
new file mode 100644
index 0000000000..dfcaaa9007
--- /dev/null
+++ b/src/Java/miscutil/core/item/effects/RarityEpic.java
@@ -0,0 +1,28 @@
+package miscutil.core.item.effects;
+
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.item.EnumRarity;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+
+public class RarityEpic extends Item {
+
+ public RarityEpic(int par1){
+ super();
+ this.setCreativeTab(CreativeTabs.tabMaterials);
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public EnumRarity getRarity(ItemStack par1ItemStack){
+ return EnumRarity.epic;
+ }
+
+ @Override
+ public boolean hasEffect(ItemStack par1ItemStack){
+ return true;
+ }
+
+}
diff --git a/src/Java/miscutil/core/item/effects/RarityRare.java b/src/Java/miscutil/core/item/effects/RarityRare.java
new file mode 100644
index 0000000000..6afc9b6733
--- /dev/null
+++ b/src/Java/miscutil/core/item/effects/RarityRare.java
@@ -0,0 +1,28 @@
+package miscutil.core.item.effects;
+
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.item.EnumRarity;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+
+public class RarityRare extends Item {
+
+ public RarityRare(int par1){
+ super();
+ this.setCreativeTab(CreativeTabs.tabMaterials);
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public EnumRarity getRarity(ItemStack par1ItemStack){
+ return EnumRarity.rare;
+ }
+
+ @Override
+ public boolean hasEffect(ItemStack par1ItemStack){
+ return true;
+ }
+
+}
diff --git a/src/Java/miscutil/core/item/effects/RarityUncommon.java b/src/Java/miscutil/core/item/effects/RarityUncommon.java
new file mode 100644
index 0000000000..4347dc70f5
--- /dev/null
+++ b/src/Java/miscutil/core/item/effects/RarityUncommon.java
@@ -0,0 +1,22 @@
+package miscutil.core.item.effects;
+
+import net.minecraft.item.EnumRarity;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+
+public class RarityUncommon extends Item {
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public EnumRarity getRarity(ItemStack par1ItemStack){
+ return EnumRarity.uncommon;
+ }
+
+ @Override
+ public boolean hasEffect(ItemStack par1ItemStack){
+ return true;
+ }
+
+}
diff --git a/src/Java/miscutil/core/item/materials/MaterialHandler.java b/src/Java/miscutil/core/item/materials/MaterialHandler.java
new file mode 100644
index 0000000000..3c57d21f90
--- /dev/null
+++ b/src/Java/miscutil/core/item/materials/MaterialHandler.java
@@ -0,0 +1,9 @@
+package miscutil.core.item.materials;
+
+public class MaterialHandler {
+
+ private String Staballoy;
+
+
+
+}
diff --git a/src/Java/miscutil/core/item/tool/bloodsteel/BloodSteelArmor.java b/src/Java/miscutil/core/item/tool/bloodsteel/BloodSteelArmor.java
new file mode 100644
index 0000000000..11bc400587
--- /dev/null
+++ b/src/Java/miscutil/core/item/tool/bloodsteel/BloodSteelArmor.java
@@ -0,0 +1,56 @@
+package miscutil.core.item.tool.bloodsteel;
+
+import miscutil.core.item.ModItems;
+import miscutil.core.lib.Strings;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemArmor;
+import net.minecraft.item.ItemStack;
+import net.minecraft.potion.Potion;
+import net.minecraft.potion.PotionEffect;
+import net.minecraft.world.World;
+
+public class BloodSteelArmor extends ItemArmor {
+
+ public BloodSteelArmor(ArmorMaterial p_i45325_1_, int p_i45325_2_, int p_i45325_3_) {
+ super(p_i45325_1_, p_i45325_2_, p_i45325_3_);
+ // TODO Auto-generated constructor stub
+ }
+
+ public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) {
+ if (stack.getItem() == ModItems.tutHelmet || stack.getItem() == ModItems.tutPlate || stack.getItem() == ModItems.tutBoots) {
+ return Strings.MODID + ":textures/armor/BloodSteelArmor1.png";
+ } else if (stack.getItem() == ModItems.tutPants) {
+ return Strings.MODID + ":textures/armor/BloodSteelArmor2.png";
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Called to tick armor in the armor slot. Override to do something
+ *
+ * @param world
+ * @param player
+ * @param itemStack
+ */
+ public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) {
+ if(player.getCurrentArmor(3) != null && player.getCurrentArmor(2) != null && player.getCurrentArmor(1) != null){
+ ItemStack helmet = player.getCurrentArmor(3);
+ ItemStack plate = player.getCurrentArmor(2);
+ ItemStack pants = player.getCurrentArmor(1);
+ if(helmet.getItem() == ModItems.tutHelmet && plate.getItem() == ModItems.tutPlate && pants.getItem() == ModItems.tutPants){
+ //player.addPotionEffect(new PotionEffect(Potion.confusion.getId(), 100, 1));
+ player.capabilities.allowFlying = true;
+ }
+ }
+
+ if(player.getCurrentArmor(0) != null){
+ ItemStack boots = player.getCurrentArmor(0);
+ if(boots.getItem() == ModItems.tutBoots){
+ player.addPotionEffect(new PotionEffect(Potion.jump.getId(), 100, 1));
+ }
+ }
+ }
+
+}
diff --git a/src/Java/miscutil/core/item/tool/bloodsteel/BloodSteelAxe.java b/src/Java/miscutil/core/item/tool/bloodsteel/BloodSteelAxe.java
new file mode 100644
index 0000000000..6353aa3631
--- /dev/null
+++ b/src/Java/miscutil/core/item/tool/bloodsteel/BloodSteelAxe.java
@@ -0,0 +1,12 @@
+package miscutil.core.item.tool.bloodsteel;
+
+import net.minecraft.item.ItemAxe;
+
+public class BloodSteelAxe extends ItemAxe{
+
+ protected BloodSteelAxe(ToolMaterial p_i45327_1_) {
+ super(p_i45327_1_);
+ // TODO Auto-generated constructor stub
+ }
+
+}
diff --git a/src/Java/miscutil/core/item/tool/bloodsteel/BloodSteelHoe.java b/src/Java/miscutil/core/item/tool/bloodsteel/BloodSteelHoe.java
new file mode 100644
index 0000000000..0115c08d00
--- /dev/null
+++ b/src/Java/miscutil/core/item/tool/bloodsteel/BloodSteelHoe.java
@@ -0,0 +1,12 @@
+package miscutil.core.item.tool.bloodsteel;
+
+import net.minecraft.item.ItemHoe;
+
+public class BloodSteelHoe extends ItemHoe{
+
+ public BloodSteelHoe(ToolMaterial p_i45343_1_) {
+ super(p_i45343_1_);
+ // TODO Auto-generated constructor stub
+ }
+
+}
diff --git a/src/Java/miscutil/core/item/tool/bloodsteel/BloodSteelPickaxe.java b/src/Java/miscutil/core/item/tool/bloodsteel/BloodSteelPickaxe.java
new file mode 100644
index 0000000000..d2c5d467b5
--- /dev/null
+++ b/src/Java/miscutil/core/item/tool/bloodsteel/BloodSteelPickaxe.java
@@ -0,0 +1,12 @@
+package miscutil.core.item.tool.bloodsteel;
+
+import net.minecraft.item.ItemPickaxe;
+
+public class BloodSteelPickaxe extends ItemPickaxe{
+
+ protected BloodSteelPickaxe(ToolMaterial p_i45347_1_) {
+ super(p_i45347_1_);
+ // TODO Auto-generated constructor stub
+ }
+
+}
diff --git a/src/Java/miscutil/core/item/tool/bloodsteel/BloodSteelSpade.java b/src/Java/miscutil/core/item/tool/bloodsteel/BloodSteelSpade.java
new file mode 100644
index 0000000000..15318d7382
--- /dev/null
+++ b/src/Java/miscutil/core/item/tool/bloodsteel/BloodSteelSpade.java
@@ -0,0 +1,12 @@
+package miscutil.core.item.tool.bloodsteel;
+
+import net.minecraft.item.ItemSpade;
+
+public class BloodSteelSpade extends ItemSpade{
+
+ public BloodSteelSpade(ToolMaterial p_i45353_1_) {
+ super(p_i45353_1_);
+ // TODO Auto-generated constructor stub
+ }
+
+}
diff --git a/src/Java/miscutil/core/item/tool/bloodsteel/BloodSteelSword.java b/src/Java/miscutil/core/item/tool/bloodsteel/BloodSteelSword.java
new file mode 100644
index 0000000000..96d11331a0
--- /dev/null
+++ b/src/Java/miscutil/core/item/tool/bloodsteel/BloodSteelSword.java
@@ -0,0 +1,12 @@
+package miscutil.core.item.tool.bloodsteel;
+
+import net.minecraft.item.ItemSword;
+
+public class BloodSteelSword extends ItemSword{
+
+ public BloodSteelSword(ToolMaterial p_i45356_1_) {
+ super(p_i45356_1_);
+ // TODO Auto-generated constructor stub
+ }
+
+}
diff --git a/src/Java/miscutil/core/item/tool/staballoy/StaballoyPickaxe.java b/src/Java/miscutil/core/item/tool/staballoy/StaballoyPickaxe.java
new file mode 100644
index 0000000000..2453f9f6e2
--- /dev/null
+++ b/src/Java/miscutil/core/item/tool/staballoy/StaballoyPickaxe.java
@@ -0,0 +1,14 @@
+package miscutil.core.item.tool.staballoy;
+
+import miscutil.core.lib.Strings;
+import net.minecraft.item.ItemPickaxe;
+
+public class StaballoyPickaxe extends ItemPickaxe{
+
+ public StaballoyPickaxe(String unlocalizedName, ToolMaterial material) {
+ super(material);
+ this.setUnlocalizedName(unlocalizedName);
+ this.setTextureName(Strings.MODID + ":" + unlocalizedName);
+ }
+
+}
diff --git a/src/Java/miscutil/core/lib/Strings.java b/src/Java/miscutil/core/lib/Strings.java
new file mode 100644
index 0000000000..1213dc56ef
--- /dev/null
+++ b/src/Java/miscutil/core/lib/Strings.java
@@ -0,0 +1,19 @@
+package miscutil.core.lib;
+
+public class Strings {
+
+ public static final String name = "Misc. Utils";
+ public static final String MODID = "miscutils";
+ public static final String VERSION = "0.7.8gtu";
+ public static final boolean DEBUG = true;
+ public static boolean GREGTECH;
+ public static final boolean LOAD_ALL_CONTENT = false;
+ public static final int GREG_FIRST_ID = 760;
+
+ //GUIS
+ public enum GUI_ENUM
+ {
+ ENERGYBUFFER, TOOLBUILDER, NULL, NULL1, NULL2
+ }
+
+}
diff --git a/src/Java/miscutil/core/proxy/ClientProxy.java b/src/Java/miscutil/core/proxy/ClientProxy.java
new file mode 100644
index 0000000000..f0f21549e8
--- /dev/null
+++ b/src/Java/miscutil/core/proxy/ClientProxy.java
@@ -0,0 +1,42 @@
+package miscutil.core.proxy;
+
+import miscutil.core.CommonProxy;
+import cpw.mods.fml.client.registry.RenderingRegistry;
+import cpw.mods.fml.common.event.FMLInitializationEvent;
+import cpw.mods.fml.common.event.FMLPostInitializationEvent;
+import cpw.mods.fml.common.event.FMLPreInitializationEvent;
+
+public class ClientProxy extends CommonProxy{
+
+ @Override
+ public void preInit(FMLPreInitializationEvent e) {
+ // TODO Auto-generated method stub
+ super.preInit(e);
+ }
+
+ @Override
+ public void init(FMLInitializationEvent e) {
+ // TODO Auto-generated method stub
+ super.init(e);
+ }
+
+ @Override
+ public void postInit(FMLPostInitializationEvent e) {
+ // TODO Auto-generated method stub
+ super.postInit(e);
+ }
+
+ public void registerRenderThings(){
+ //RenderingRegistry.registerEntityRenderingHandler(EntityBloodSteelMob.class, new RenderBloodSteelMob(new ModelBloodSteelMob(), 0));
+ //RenderingRegistry.registerEntityRenderingHandler(EntityBloodSteelHostileMob.class, new RenderBloodSteelMobHostile(new ModelBloodSteelMob(), 0));
+ //RenderingRegistry.registerEntityRenderingHandler(EntityGrenade.class, new RenderSnowball(ModItems.tutGrenade));
+
+ //ClientRegistry.bindTileEntitySpecialRenderer(TileEntityBloodSteelChest.class, new BloodSteelChestRenderer());
+ //MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.tutChest), new ItemRenderBloodSteelChest());
+ }
+
+ public int addArmor(String armor){
+ return RenderingRegistry.addNewArmourRendererPrefix(armor);
+ }
+
+}
diff --git a/src/Java/miscutil/core/proxy/ServerProxy.java b/src/Java/miscutil/core/proxy/ServerProxy.java
new file mode 100644
index 0000000000..59e625eaed
--- /dev/null
+++ b/src/Java/miscutil/core/proxy/ServerProxy.java
@@ -0,0 +1,28 @@
+package miscutil.core.proxy;
+
+import miscutil.core.CommonProxy;
+import cpw.mods.fml.common.event.FMLInitializationEvent;
+import cpw.mods.fml.common.event.FMLPostInitializationEvent;
+import cpw.mods.fml.common.event.FMLPreInitializationEvent;
+
+public class ServerProxy extends CommonProxy{
+
+ @Override
+ public void preInit(FMLPreInitializationEvent e) {
+ // TODO Auto-generated method stub
+ super.preInit(e);
+ }
+
+ @Override
+ public void init(FMLInitializationEvent e) {
+ // TODO Auto-generated method stub
+ super.init(e);
+ }
+
+ @Override
+ public void postInit(FMLPostInitializationEvent e) {
+ // TODO Auto-generated method stub
+ super.postInit(e);
+ }
+
+}
diff --git a/src/Java/miscutil/core/tileentities/ModTileEntities.java b/src/Java/miscutil/core/tileentities/ModTileEntities.java
new file mode 100644
index 0000000000..6126c5793e
--- /dev/null
+++ b/src/Java/miscutil/core/tileentities/ModTileEntities.java
@@ -0,0 +1,13 @@
+package miscutil.core.tileentities;
+
+import miscutil.core.util.Utils;
+
+public class ModTileEntities {
+
+
+ public static void init(){
+ Utils.LOG_INFO("Registering Tile Entities.");
+ //GameRegistry.registerTileEntity(TileEntityStorage.class, "TE_Storage");
+ }
+
+}
diff --git a/src/Java/miscutil/core/util/Benchmark.java b/src/Java/miscutil/core/util/Benchmark.java
new file mode 100644
index 0000000000..1e17175c3b
--- /dev/null
+++ b/src/Java/miscutil/core/util/Benchmark.java
@@ -0,0 +1,153 @@
+package miscutil.core.util;
+
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Random;
+
+import cpw.mods.fml.common.FMLLog;
+
+@SuppressWarnings("unused")
+public class Benchmark {
+
+ public void math() throws ParseException{
+ Random r = new Random();
+
+ FMLLog.info("Looking at the stars in the sky");
+
+ // generate some random boolean values
+ boolean[] booleans = new boolean[10];
+ for (int i = 0; i < booleans.length; i++) {
+ booleans[i] = r.nextBoolean();
+ }
+
+ //FMLLog.info(getSha256(booleans.toString()));
+
+ /*for (boolean b : booleans) {
+ FMLLog.info(b + ", ");
+ }*/
+
+ // generate a uniformly distributed int random numbers
+ int[] integers = new int[10];
+ for (int i = 0; i < integers.length; i++) {
+ integers[i] = r.nextInt();
+ }
+
+ FMLLog.info(getSha256(integers.toString()));
+
+ /*for (int i : integers) {s
+ FMLLog.info(i + ", ");
+ }*/
+
+ // generate a uniformly distributed float random numbers
+ float[] floats = new float[10];
+ for (int i = 0; i < floats.length; i++) {
+ floats[i] = r.nextFloat();
+ }
+
+ FMLLog.info(getSha256(floats.toString()));
+
+ /*for (float f : floats) {
+ FMLLog.info(f + ", ");
+ }*/
+
+ // generate a Gaussian normally distributed random numbers
+ double[] gaussians = new double[10];
+ for (int i = 0; i < gaussians.length; i++) {
+ gaussians[i] = r.nextGaussian();
+ }
+
+ FMLLog.info(getSha256(gaussians.toString()));
+ }
+
+ private String dateTime(){
+ DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd - HH:mm:ss");
+ //get current date time with Calendar()
+ Calendar cal = Calendar.getInstance();
+ return dateFormat.format(cal.getTime());
+ }
+
+ public String superhash(String a){
+ FMLLog.info("Calculating the cost of life & the universe");
+ int i = 1;
+ String b = a;
+ while (i < 3358 && i > 0){
+ if (!b.equals(a)){
+ b = a;
+ }
+ getSha256(b);
+ a = b;
+ try {
+ Thread.sleep(2);
+ } catch (InterruptedException e) {
+ FMLLog.info("Hashbrown order failed");
+ e.printStackTrace();
+ }
+ if (i == 500 || i == 1000 || i == 1500 || i == 2000 || i == 2500 || i == 3000 || i == 3500 || i == 4000 || i == 5000){
+ //FMLLog.info("Calculating orbits around the sun: "+i);
+ }
+ i++;
+ }
+ return b;
+ }
+
+ private String getSha256(String message) {
+ if (message == null || message.isEmpty()) {
+ return "";
+ }
+ String chiper = generateString("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890-=!@#$%^&*()_+`~[];',./{}:<>?|'", 32);
+ String key = generateString("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890-=!@#$%^&*()_+`~[];',./{}:<>?|'", 16); // key is used to construct a new SHA-256 key/salt
+
+ // Initialize SHA-256
+ MessageDigest digest = null;
+ try {
+ digest = MessageDigest.getInstance("SHA-256");
+ } catch (NoSuchAlgorithmException e) {
+ System.err.println(e.getMessage());
+ }
+
+ // Hashing entered key to construct a new key/salt
+ byte[] keyAsSHA256 = digest.digest(key.getBytes());
+
+ // Encoding the message with CBC
+ char[] messageAsChars = message.toCharArray();
+ messageAsChars[0] ^= keyAsSHA256[0]; // Avoiding buffer underflow
+ for (int i = 1; i < messageAsChars.length; i++) {
+ messageAsChars[i] ^= messageAsChars[i - 1]; // XOR with previous character
+ messageAsChars[i] ^= keyAsSHA256[i % keyAsSHA256.length]; // XOR with keys hash
+ }
+ // build cipher from the chars
+ chiper = new String(messageAsChars);
+ String cipher = MD5(chiper);
+ return chiper + "|" + cipher;
+ }
+
+ public String MD5(String md5) {
+ try {
+ java.security.MessageDigest md = java.security.MessageDigest.getInstance("MD5");
+ byte[] array = md.digest(md5.getBytes());
+ StringBuffer sb = new StringBuffer();
+ for (int i = 0; i < array.length; ++i) {
+ sb.append(Integer.toHexString((array[i] & 0xFF) | 0x100).substring(1,3));
+ }
+ return sb.toString();
+ } catch (java.security.NoSuchAlgorithmException e) {
+ }
+ return null;
+ }
+
+ public static String generateString(String characters, int length)
+ {
+ Random r = new Random();
+ char[] text = new char[length];
+ for (int i = 0; i < length; i++)
+ {
+ text[i] = characters.charAt(r.nextInt(characters.length()));
+ }
+ return new String(text);
+ }
+
+} \ No newline at end of file
diff --git a/src/Java/miscutil/core/util/Utils.java b/src/Java/miscutil/core/util/Utils.java
new file mode 100644
index 0000000000..00acfba45f
--- /dev/null
+++ b/src/Java/miscutil/core/util/Utils.java
@@ -0,0 +1,61 @@
+package miscutil.core.util;
+
+import java.awt.Graphics;
+
+import miscutil.core.lib.Strings;
+import net.minecraft.item.ItemStack;
+import cpw.mods.fml.common.FMLLog;
+
+public class Utils {
+
+ public static final int WILDCARD_VALUE = Short.MAX_VALUE;
+ public static boolean containsMatch(boolean strict, ItemStack[] inputs, ItemStack... targets)
+ {
+ for (ItemStack input : inputs)
+ {
+ for (ItemStack target : targets)
+ {
+ if (itemMatches(target, input, strict))
+ {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ public static boolean itemMatches(ItemStack target, ItemStack input, boolean strict)
+ {
+ if (input == null && target != null || input != null && target == null)
+ {
+ return false;
+ }
+ return (target.getItem() == input.getItem() && ((target.getItemDamage() == WILDCARD_VALUE && !strict) || target.getItemDamage() == input.getItemDamage()));
+ }
+
+ //Non-Dev Comments
+ public static void LOG_INFO(String s){
+ //if (Strings.DEBUG){
+ FMLLog.info("MiscUtils: "+s);
+ //}
+ }
+
+ //Developer Comments
+ public static void LOG_WARNING(String s){
+ if (Strings.DEBUG){
+ FMLLog.warning("MiscUtils: "+s);
+ }
+ }
+
+ //Errors
+ public static void LOG_ERROR(String s){
+ if (Strings.DEBUG){
+ FMLLog.severe("MiscUtils: "+s);
+ }
+ }
+
+ public static void paintBox(Graphics g, int MinA, int MinB, int MaxA, int MaxB){
+ g.drawRect (MinA, MinB, MaxA, MaxB);
+ }
+
+}
diff --git a/src/Java/miscutil/gregtech/energy/IC2ElectricItem.java b/src/Java/miscutil/gregtech/energy/IC2ElectricItem.java
new file mode 100644
index 0000000000..1e8ecd563a
--- /dev/null
+++ b/src/Java/miscutil/gregtech/energy/IC2ElectricItem.java
@@ -0,0 +1,55 @@
+package miscutil.gregtech.energy;
+
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+
+/**
+ * Provides the ability to store energy on the implementing item.
+ *
+ * The item should have a maximum damage of 13.
+ */
+public interface IC2ElectricItem {
+ /**
+ * Determine if the item can be used in a machine or as an armor part to supply energy.
+ *
+ * @return Whether the item can supply energy
+ */
+ boolean canProvideEnergy(ItemStack itemStack);
+
+ /**
+ * Get the item ID to use for a charge energy greater than 0.
+ *
+ * @return Item ID to use
+ */
+ Item getChargedItem(ItemStack itemStack);
+
+ /**
+ * Get the item ID to use for a charge energy of 0.
+ *
+ * @return Item ID to use
+ */
+ Item getEmptyItem(ItemStack itemStack);
+
+ /**
+ * Get the item's maximum charge energy in EU.
+ *
+ * @return Maximum charge energy
+ */
+ double getMaxCharge(ItemStack itemStack);
+
+ /**
+ * Get the item's tier, lower tiers can't send energy to higher ones.
+ * Batteries are Tier 1, Energy Crystals are Tier 2, Lapotron Crystals are Tier 3.
+ *
+ * @return Item's tier
+ */
+ int getTier(ItemStack itemStack);
+
+ /**
+ * Get the item's transfer limit in EU per transfer operation.
+ *
+ * @return Transfer limit
+ */
+ double getTransferLimit(ItemStack itemStack);
+}
+
diff --git a/src/Java/miscutil/gregtech/energy/IC2ElectricItemManager.java b/src/Java/miscutil/gregtech/energy/IC2ElectricItemManager.java
new file mode 100644
index 0000000000..8607d2109b
--- /dev/null
+++ b/src/Java/miscutil/gregtech/energy/IC2ElectricItemManager.java
@@ -0,0 +1,95 @@
+package miscutil.gregtech.energy;
+
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.item.ItemStack;
+
+/**
+ * This interface specifies a manager to handle the various tasks for electric items.
+ *
+ * The default implementation does the following:
+ * - store and retrieve the charge
+ * - handle charging, taking amount, tier, transfer limit, canProvideEnergy and simulate into account
+ * - replace item IDs if appropriate (getChargedItemId() and getEmptyItemId())
+ * - update and manage the damage value for the visual charge indicator
+ *
+ * @note If you're implementing your own variant (ISpecialElectricItem), you can delegate to the
+ * default implementations through ElectricItem.rawManager. The default implementation is designed
+ * to minimize its dependency on its own constraints/structure and delegates most work back to the
+ * more atomic features in the gateway manager.
+ */
+public interface IC2ElectricItemManager {
+ /**
+ * Charge an item with a specified amount of energy.
+ *
+ * @param itemStack electric item's stack
+ * @param amount amount of energy to charge in EU
+ * @param tier tier of the charging device, has to be at least as high as the item to charge
+ * @param ignoreTransferLimit ignore the transfer limit specified by getTransferLimit()
+ * @param simulate don't actually change the item, just determine the return value
+ * @return Energy transferred into the electric item
+ */
+ double charge(ItemStack stack, double amount, int tier, boolean ignoreTransferLimit, boolean simulate);
+
+ /**
+ * Discharge an item by a specified amount of energy
+ *
+ * @param itemStack electric item's stack
+ * @param amount amount of energy to discharge in EU
+ * @param tier tier of the discharging device, has to be at least as high as the item to discharge
+ * @param ignoreTransferLimit ignore the transfer limit specified by getTransferLimit()
+ * @param externally use the supplied item externally, i.e. to power something else as if it was a battery
+ * @param simulate don't actually discharge the item, just determine the return value
+ * @return Energy retrieved from the electric item
+ */
+ double discharge(ItemStack stack, double amount, int tier, boolean ignoreTransferLimit, boolean externally, boolean simulate);
+
+ /**
+ * Determine the charge level for the specified item.
+ *
+ * @param itemStack ItemStack containing the electric item
+ * @return charge level in EU
+ */
+ double getCharge(ItemStack stack);
+
+ /**
+ * Determine if the specified electric item has at least a specific amount of EU.
+ * This is supposed to be used in the item code during operation, for example if you want to implement your own electric item.
+ * BatPacks are not taken into account.
+ *
+ * @param itemStack electric item's stack
+ * @param amount minimum amount of energy required
+ * @return true if there's enough energy
+ */
+ boolean canUse(ItemStack stack, double amount);
+
+ /**
+ * Try to retrieve a specific amount of energy from an Item, and if applicable, a BatPack.
+ * This is supposed to be used in the item code during operation, for example if you want to implement your own electric item.
+ *
+ * @param itemStack electric item's stack
+ * @param amount amount of energy to discharge in EU
+ * @param entity entity holding the item
+ * @return true if the operation succeeded
+ */
+ boolean use(ItemStack stack, double amount, EntityLivingBase entity);
+
+ /**
+ * Charge an item from the BatPack a player is wearing.
+ * This is supposed to be used in the item code during operation, for example if you want to implement your own electric item.
+ * use() already contains this functionality.
+ *
+ * @param itemStack electric item's stack
+ * @param entity entity holding the item
+ */
+ void chargeFromArmor(ItemStack stack, EntityLivingBase entity);
+
+ /**
+ * Get the tool tip to display for electric items.
+ *
+ * @param itemStack ItemStack to determine the tooltip for
+ * @return tool tip string or null for none
+ */
+ String getToolTip(ItemStack stack);
+
+ // TODO: add tier getter
+}
diff --git a/src/Java/miscutil/gregtech/enums/AddExtraOreDict.java b/src/Java/miscutil/gregtech/enums/AddExtraOreDict.java
new file mode 100644
index 0000000000..4b3e352292
--- /dev/null
+++ b/src/Java/miscutil/gregtech/enums/AddExtraOreDict.java
@@ -0,0 +1,16 @@
+package miscutil.gregtech.enums;
+
+import gregtech.api.util.GT_OreDictUnificator;
+import gregtech.loaders.preload.GT_Loader_OreDictionary;
+import miscutil.gregtech.init.machines.GregtechEnergyBuffer;
+import net.minecraft.item.ItemStack;
+
+public class AddExtraOreDict extends GT_Loader_OreDictionary {
+
+ @Override
+ public void run()
+ {
+ GT_OreDictUnificator.registerOre(ExtraOreDictNames.buffer_core, new ItemStack(GregtechEnergyBuffer.itemBufferCore));
+ }
+
+}
diff --git a/src/Java/miscutil/gregtech/enums/ExtraOreDictNames.java b/src/Java/miscutil/gregtech/enums/ExtraOreDictNames.java
new file mode 100644
index 0000000000..aca2b63434
--- /dev/null
+++ b/src/Java/miscutil/gregtech/enums/ExtraOreDictNames.java
@@ -0,0 +1,5 @@
+package miscutil.gregtech.enums;
+
+public enum ExtraOreDictNames {
+ buffer_core
+}
diff --git a/src/Java/miscutil/gregtech/enums/GregtechItemList.java b/src/Java/miscutil/gregtech/enums/GregtechItemList.java
new file mode 100644
index 0000000000..fb09dc36cb
--- /dev/null
+++ b/src/Java/miscutil/gregtech/enums/GregtechItemList.java
@@ -0,0 +1,153 @@
+package miscutil.gregtech.enums;
+
+import static gregtech.api.enums.GT_Values.W;
+import gregtech.api.util.GT_ModHandler;
+import gregtech.api.util.GT_OreDictUnificator;
+import gregtech.api.util.GT_Utility;
+import miscutil.gregtech.interfaces.GregtechItemContainer;
+import net.minecraft.block.Block;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.fluids.Fluid;
+
+/**
+ * Class containing all non-OreDict Items of GregTech.
+ */
+public enum GregtechItemList implements GregtechItemContainer {
+
+ Credit_Copper,
+ Credit_Iron,
+ Credit_Silver,
+ Credit_Gold,
+ Credit_Platinum,
+ Credit_Osmium,
+ Credit_Greg_Copper,
+ Credit_Greg_Cupronickel,
+ Credit_Greg_Silver,
+ Credit_Greg_Gold,
+ Credit_Greg_Platinum,
+ Credit_Greg_Osmium,
+ Credit_Greg_Naquadah,
+ Energy_Buffer_CREATIVE,
+ //Energy Buffes
+ Energy_Buffer_1by1_ULV, Energy_Buffer_1by1_LV, Energy_Buffer_1by1_MV, Energy_Buffer_1by1_HV, Energy_Buffer_1by1_EV, Energy_Buffer_1by1_IV, Energy_Buffer_1by1_LuV, Energy_Buffer_1by1_ZPM, Energy_Buffer_1by1_UV, Energy_Buffer_1by1_MAX,
+ Cobble_Generator_ULV, Cobble_Generator_LV, Cobble_Generator_MV, Cobble_Generator_HV, Cobble_Generator_EV, Cobble_Generator_IV, Cobble_Generator_LuV, Cobble_Generator_ZPM, Cobble_Generator_UV, Cobble_Generator_MAX;
+
+ public static final GregtechItemList[]
+ DYE_ONLY_ITEMS = {
+ Energy_Buffer_1by1_EV, Energy_Buffer_1by1_EV };
+ private ItemStack mStack;
+ private boolean mHasNotBeenSet = true;
+
+ public static Fluid sOilExtraHeavy, sOilHeavy, sOilMedium, sOilLight, sNaturalGas;
+
+ @Override
+ public GregtechItemList set(Item aItem) {
+ mHasNotBeenSet = false;
+ if (aItem == null) return this;
+ ItemStack aStack = new ItemStack(aItem, 1, 0);
+ mStack = GT_Utility.copyAmount(1, aStack);
+ return this;
+ }
+
+ @Override
+ public GregtechItemList set(ItemStack aStack) {
+ mHasNotBeenSet = false;
+ mStack = GT_Utility.copyAmount(1, aStack);
+ return this;
+ }
+
+ @Override
+ public Item getItem() {
+ if (mHasNotBeenSet) throw new IllegalAccessError("The Enum '" + name() + "' has not been set to an Item at this time!");
+ if (GT_Utility.isStackInvalid(mStack)) return null;
+ return mStack.getItem();
+ }
+
+ @Override
+ public Block getBlock() {
+ if (mHasNotBeenSet) throw new IllegalAccessError("The Enum '" + name() + "' has not been set to an Item at this time!");
+ return GT_Utility.getBlockFromStack(getItem());
+ }
+
+ @Override
+ public final boolean hasBeenSet() {
+ return !mHasNotBeenSet;
+ }
+
+ @Override
+ public boolean isStackEqual(Object aStack) {
+ return isStackEqual(aStack, false, false);
+ }
+
+ @Override
+ public boolean isStackEqual(Object aStack, boolean aWildcard, boolean aIgnoreNBT) {
+ if (GT_Utility.isStackInvalid(aStack)) return false;
+ return GT_Utility.areUnificationsEqual((ItemStack)aStack, aWildcard?getWildcard(1):get(1), aIgnoreNBT);
+ }
+
+ @Override
+ public ItemStack get(long aAmount, Object... aReplacements) {
+ if (mHasNotBeenSet) throw new IllegalAccessError("The Enum '" + name() + "' has not been set to an Item at this time!");
+ if (GT_Utility.isStackInvalid(mStack)) return GT_Utility.copyAmount(aAmount, aReplacements);
+ return GT_Utility.copyAmount(aAmount, GT_OreDictUnificator.get(mStack));
+ }
+
+ @Override
+ public ItemStack getWildcard(long aAmount, Object... aReplacements) {
+ if (mHasNotBeenSet) throw new IllegalAccessError("The Enum '" + name() + "' has not been set to an Item at this time!");
+ if (GT_Utility.isStackInvalid(mStack)) return GT_Utility.copyAmount(aAmount, aReplacements);
+ return GT_Utility.copyAmountAndMetaData(aAmount, W, GT_OreDictUnificator.get(mStack));
+ }
+
+ @Override
+ public ItemStack getUndamaged(long aAmount, Object... aReplacements) {
+ if (mHasNotBeenSet) throw new IllegalAccessError("The Enum '" + name() + "' has not been set to an Item at this time!");
+ if (GT_Utility.isStackInvalid(mStack)) return GT_Utility.copyAmount(aAmount, aReplacements);
+ return GT_Utility.copyAmountAndMetaData(aAmount, 0, GT_OreDictUnificator.get(mStack));
+ }
+
+ @Override
+ public ItemStack getAlmostBroken(long aAmount, Object... aReplacements) {
+ if (mHasNotBeenSet) throw new IllegalAccessError("The Enum '" + name() + "' has not been set to an Item at this time!");
+ if (GT_Utility.isStackInvalid(mStack)) return GT_Utility.copyAmount(aAmount, aReplacements);
+ return GT_Utility.copyAmountAndMetaData(aAmount, mStack.getMaxDamage()-1, GT_OreDictUnificator.get(mStack));
+ }
+
+ @Override
+ public ItemStack getWithName(long aAmount, String aDisplayName, Object... aReplacements) {
+ ItemStack rStack = get(1, aReplacements);
+ if (GT_Utility.isStackInvalid(rStack)) return null;
+ rStack.setStackDisplayName(aDisplayName);
+ return GT_Utility.copyAmount(aAmount, rStack);
+ }
+
+ @Override
+ public ItemStack getWithCharge(long aAmount, int aEnergy, Object... aReplacements) {
+ ItemStack rStack = get(1, aReplacements);
+ if (GT_Utility.isStackInvalid(rStack)) return null;
+ GT_ModHandler.chargeElectricItem(rStack, aEnergy, Integer.MAX_VALUE, true, false);
+ return GT_Utility.copyAmount(aAmount, rStack);
+ }
+
+ @Override
+ public ItemStack getWithDamage(long aAmount, long aMetaValue, Object... aReplacements) {
+ if (mHasNotBeenSet) throw new IllegalAccessError("The Enum '" + name() + "' has not been set to an Item at this time!");
+ if (GT_Utility.isStackInvalid(mStack)) return GT_Utility.copyAmount(aAmount, aReplacements);
+ return GT_Utility.copyAmountAndMetaData(aAmount, aMetaValue, GT_OreDictUnificator.get(mStack));
+ }
+
+ @Override
+ public GregtechItemList registerOre(Object... aOreNames) {
+ if (mHasNotBeenSet) throw new IllegalAccessError("The Enum '" + name() + "' has not been set to an Item at this time!");
+ for (Object tOreName : aOreNames) GT_OreDictUnificator.registerOre(tOreName, get(1));
+ return this;
+ }
+
+ @Override
+ public GregtechItemList registerWildcardAsOre(Object... aOreNames) {
+ if (mHasNotBeenSet) throw new IllegalAccessError("The Enum '" + name() + "' has not been set to an Item at this time!");
+ for (Object tOreName : aOreNames) GT_OreDictUnificator.registerOre(tOreName, getWildcard(1));
+ return this;
+ }
+} \ No newline at end of file
diff --git a/src/Java/miscutil/gregtech/init/InitGregtech.java b/src/Java/miscutil/gregtech/init/InitGregtech.java
new file mode 100644
index 0000000000..46e9217f24
--- /dev/null
+++ b/src/Java/miscutil/gregtech/init/InitGregtech.java
@@ -0,0 +1,23 @@
+package miscutil.gregtech.init;
+
+import miscutil.core.lib.Strings;
+import miscutil.gregtech.init.machines.GregtechEnergyBuffer;
+import cpw.mods.fml.common.FMLLog;
+
+public class InitGregtech {
+
+ public static void run() {
+ if (Strings.GREGTECH) {
+ FMLLog.info("MiscUtils|Gregtech5u Content: Registering MetaTileEntities.");
+ }
+
+ /***
+ * Load up Blocks classes
+ ***/
+
+ // Machines
+ // GregtechCobbleGenerator.run(); TODO - Weird Textures
+ GregtechEnergyBuffer.run();
+
+ }
+}
diff --git a/src/Java/miscutil/gregtech/init/machines/GregtechCobbleGenerator.java b/src/Java/miscutil/gregtech/init/machines/GregtechCobbleGenerator.java
new file mode 100644
index 0000000000..bb83ea91b2
--- /dev/null
+++ b/src/Java/miscutil/gregtech/init/machines/GregtechCobbleGenerator.java
@@ -0,0 +1,51 @@
+package miscutil.gregtech.init.machines;
+
+import gregtech.api.enums.ItemList;
+import gregtech.api.enums.Materials;
+import gregtech.api.enums.OreDictNames;
+import gregtech.api.enums.OrePrefixes;
+import gregtech.api.util.GT_ModHandler;
+import miscutil.core.lib.Strings;
+import miscutil.gregtech.enums.GregtechItemList;
+import miscutil.gregtech.metatileentity.implementations.GregtechSteelBoiler;
+import cpw.mods.fml.common.FMLLog;
+
+public class GregtechCobbleGenerator
+{
+ public static void run()
+ {
+ if (Strings.GREGTECH){
+ FMLLog.info("MiscUtils: Registering Cobblestone Powered Engines.");
+ }
+ run1();
+ }
+
+ private static void run1()
+ {
+ //Cobble Generators
+ // ItemList.Machine_Steel_Boiler.set(new GT_MetaTileEntity_Boiler_Steel(101, "boiler.steel", "High Pressure Coal Boiler").getStackForm(1L));
+ // GT_ModHandler.addCraftingRecipe(ItemList.Machine_Steel_Boiler.get(1L, new Object[0]), GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, new Object[] { "PPP", "P P", "BFB", Character.valueOf('F'), OreDictNames.craftingFurnace, Character.valueOf('P'), OrePrefixes.plate.get(Materials.Steel), Character.valueOf('B'), new ItemStack(Blocks.brick_block, 1) });
+
+ GregtechItemList.Cobble_Generator_ULV.set(new GregtechSteelBoiler(760, "CobGen.01.tier.00", "Ultra Low Voltage Cobblestone Generator", 0, "You're shit.").getStackForm(1L));
+ GregtechItemList.Cobble_Generator_LV.set(new GregtechSteelBoiler(761, "CobGen.01.tier.01", "Low Voltage Cobblestone Generator", 1, "Still Pretty garbage, bro.").getStackForm(1L));
+ GregtechItemList.Cobble_Generator_MV.set(new GregtechSteelBoiler(762, "CobGen.01.tier.02", "Medium Voltage Cobblestone Generator", 2, "Testy Test.").getStackForm(1L));
+ GregtechItemList.Cobble_Generator_HV.set(new GregtechSteelBoiler(763, "CobGen.01.tier.03", "High Voltage Cobblestone Generator", 3, "").getStackForm(1L));
+ GregtechItemList.Cobble_Generator_EV.set(new GregtechSteelBoiler(764, "CobGen.01.tier.04", "Extreme Voltage Cobblestone Generator", 4, "").getStackForm(1L));
+ GregtechItemList.Cobble_Generator_IV.set(new GregtechSteelBoiler(765, "CobGen.01.tier.05", "Insane Voltage Cobblestone Generator", 5, "").getStackForm(1L));
+ GregtechItemList.Cobble_Generator_LuV.set(new GregtechSteelBoiler(766, "CobGen.01.tier.06", "Ludicrous Voltage Cobblestone Generator", 6, "").getStackForm(1L));
+ GregtechItemList.Cobble_Generator_ZPM.set(new GregtechSteelBoiler(767, "CobGen.01.tier.07", "ZPM Voltage Cobblestone Generator", 7, "").getStackForm(1L));
+ GregtechItemList.Cobble_Generator_UV.set(new GregtechSteelBoiler(768, "CobGen.01.tier.08", "Ultimate Voltage Cobblestone Generator", 8, "").getStackForm(1L));
+ GregtechItemList.Cobble_Generator_MAX.set(new GregtechSteelBoiler(769, "CobGen.01.tier.09", "MAX Voltage Cobblestone Generator", 9, "").getStackForm(1L));
+
+ GT_ModHandler.addCraftingRecipe(GregtechItemList.Cobble_Generator_ULV.get(1L, new Object[0]), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, new Object[] { "WTW", "WMW", Character.valueOf('M'), ItemList.Hull_ULV, Character.valueOf('W'), OrePrefixes.wireGt04.get(Materials.Lead), Character.valueOf('T'), OreDictNames.craftingChest });
+ GT_ModHandler.addCraftingRecipe(GregtechItemList.Cobble_Generator_LV.get(1L, new Object[0]), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, new Object[] { "WTW", "WMW", Character.valueOf('M'), ItemList.Hull_LV, Character.valueOf('W'), OrePrefixes.wireGt04.get(Materials.Tin), Character.valueOf('T'), OreDictNames.craftingChest });
+ GT_ModHandler.addCraftingRecipe(GregtechItemList.Cobble_Generator_MV.get(1L, new Object[0]), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, new Object[] { "WTW", "WMW", Character.valueOf('M'), ItemList.Hull_MV, Character.valueOf('W'), OrePrefixes.wireGt04.get(Materials.AnyCopper), Character.valueOf('T'), OreDictNames.craftingChest });
+ GT_ModHandler.addCraftingRecipe(GregtechItemList.Cobble_Generator_HV.get(1L, new Object[0]), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, new Object[] { "WTW", "WMW", Character.valueOf('M'), ItemList.Hull_HV, Character.valueOf('W'), OrePrefixes.wireGt04.get(Materials.Gold), Character.valueOf('T'), OreDictNames.craftingChest });
+ GT_ModHandler.addCraftingRecipe(GregtechItemList.Cobble_Generator_EV.get(1L, new Object[0]), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, new Object[] { "WTW", "WMW", Character.valueOf('M'), ItemList.Hull_EV, Character.valueOf('W'), OrePrefixes.wireGt04.get(Materials.Aluminium), Character.valueOf('T'), OreDictNames.craftingChest });
+ GT_ModHandler.addCraftingRecipe(GregtechItemList.Cobble_Generator_IV.get(1L, new Object[0]), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, new Object[] { "WTW", "WMW", Character.valueOf('M'), ItemList.Hull_IV, Character.valueOf('W'), OrePrefixes.wireGt04.get(Materials.Tungsten), Character.valueOf('T'), OreDictNames.craftingChest });
+ GT_ModHandler.addCraftingRecipe(GregtechItemList.Cobble_Generator_LuV.get(1L, new Object[0]), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, new Object[] { "WTW", "WMW", Character.valueOf('M'), ItemList.Hull_LuV, Character.valueOf('W'), OrePrefixes.wireGt04.get(Materials.Osmium), Character.valueOf('T'), OreDictNames.craftingChest });
+ GT_ModHandler.addCraftingRecipe(GregtechItemList.Cobble_Generator_ZPM.get(1L, new Object[0]), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, new Object[] { "WTW", "WMW", Character.valueOf('M'), ItemList.Hull_ZPM, Character.valueOf('W'), OrePrefixes.wireGt04.get(Materials.Osmium), Character.valueOf('T'), OreDictNames.craftingChest });
+ GT_ModHandler.addCraftingRecipe(GregtechItemList.Cobble_Generator_UV.get(1L, new Object[0]), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, new Object[] { "WTW", "WMW", Character.valueOf('M'), ItemList.Hull_UV, Character.valueOf('W'), OrePrefixes.wireGt04.get(Materials.Osmium), Character.valueOf('T'), OreDictNames.craftingChest });
+ GT_ModHandler.addCraftingRecipe(GregtechItemList.Cobble_Generator_MAX.get(1L, new Object[0]), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, new Object[] { "WTW", "WMW", Character.valueOf('M'), ItemList.Hull_MAX, Character.valueOf('W'), OrePrefixes.wireGt04.get(Materials.Superconductor), Character.valueOf('T'), OreDictNames.craftingChest });
+ }
+}
diff --git a/src/Java/miscutil/gregtech/init/machines/GregtechEnergyBuffer.java b/src/Java/miscutil/gregtech/init/machines/GregtechEnergyBuffer.java
new file mode 100644
index 0000000000..8f74f71b69
--- /dev/null
+++ b/src/Java/miscutil/gregtech/init/machines/GregtechEnergyBuffer.java
@@ -0,0 +1,88 @@
+package miscutil.gregtech.init.machines;
+
+import gregtech.api.enums.ItemList;
+import gregtech.api.enums.Materials;
+import gregtech.api.enums.OrePrefixes;
+import gregtech.api.util.GT_ModHandler;
+import miscutil.core.creativetabs.TMCreativeTabs;
+import miscutil.core.lib.Strings;
+import miscutil.gregtech.enums.ExtraOreDictNames;
+import miscutil.gregtech.enums.GregtechItemList;
+import miscutil.gregtech.metatileentity.implementations.GregtechMetaCreativeEnergyBuffer;
+import miscutil.gregtech.metatileentity.implementations.GregtechMetaEnergyBuffer;
+import net.minecraft.item.Item;
+import net.minecraftforge.oredict.OreDictionary;
+import cpw.mods.fml.common.FMLLog;
+import cpw.mods.fml.common.registry.GameRegistry;
+import cpw.mods.fml.common.registry.LanguageRegistry;
+
+public class GregtechEnergyBuffer
+{
+
+ //Misc Items
+ public static Item itemBufferCore;
+
+ public static void run()
+ {
+ if (Strings.GREGTECH){
+ FMLLog.info("MiscUtils: Registering Energy Buffer Blocks.");
+ }
+ run1();
+ }
+
+ @SuppressWarnings("deprecation")
+ private static void run1()
+ {
+
+ itemBufferCore = new Item().setUnlocalizedName("itemBufferCore").setCreativeTab(TMCreativeTabs.tabMisc).setTextureName(Strings.MODID + ":itemBufferCore");;
+
+ //Registry
+ GameRegistry.registerItem(itemBufferCore, "itemBufferCore");
+ LanguageRegistry.addName(itemBufferCore, "Buffer Core");
+ OreDictionary.registerOre("itemBufferCore", itemBufferCore);
+
+
+ //Energy Buffers
+ GregtechItemList.Energy_Buffer_1by1_ULV.set(new GregtechMetaEnergyBuffer(770, "energybuffer.01.tier.00", "Ultra Low Voltage Energy Buffer", 0, "", 1).getStackForm(1L));
+ GregtechItemList.Energy_Buffer_1by1_LV.set(new GregtechMetaEnergyBuffer(771, "energybuffer.01.tier.01", "Low Voltage Energy Buffer", 1, "", 1).getStackForm(1L));
+ GregtechItemList.Energy_Buffer_1by1_MV.set(new GregtechMetaEnergyBuffer(772, "energybuffer.01.tier.02", "Medium Voltage Energy Buffer", 2, "", 1).getStackForm(1L));
+ GregtechItemList.Energy_Buffer_1by1_HV.set(new GregtechMetaEnergyBuffer(773, "energybuffer.01.tier.03", "High Voltage Energy Buffer", 3, "", 1).getStackForm(1L));
+ GregtechItemList.Energy_Buffer_1by1_EV.set(new GregtechMetaEnergyBuffer(774, "energybuffer.01.tier.04", "Extreme Voltage Energy Buffer", 4, "", 1).getStackForm(1L));
+ GregtechItemList.Energy_Buffer_1by1_IV.set(new GregtechMetaEnergyBuffer(775, "energybuffer.01.tier.05", "Insane Voltage Energy Buffer", 5, "", 1).getStackForm(1L));
+ GregtechItemList.Energy_Buffer_1by1_LuV.set(new GregtechMetaEnergyBuffer(776, "energybuffer.01.tier.06", "Ludicrous Voltage Energy Buffer", 6, "", 1).getStackForm(1L));
+ GregtechItemList.Energy_Buffer_1by1_ZPM.set(new GregtechMetaEnergyBuffer(777, "energybuffer.01.tier.07", "ZPM Voltage Energy Buffer", 7, "", 1).getStackForm(1L));
+ GregtechItemList.Energy_Buffer_1by1_UV.set(new GregtechMetaEnergyBuffer(778, "energybuffer.01.tier.08", "Ultimate Voltage Energy Buffer", 8, "", 1).getStackForm(1L));
+ GregtechItemList.Energy_Buffer_1by1_MAX.set(new GregtechMetaEnergyBuffer(779, "energybuffer.01.tier.09", "MAX Voltage Energy Buffer", 9, "", 1).getStackForm(1L));
+ // Creative Buffer Has Special ID
+ GregtechItemList.Energy_Buffer_CREATIVE
+ .set(new GregtechMetaCreativeEnergyBuffer(750,
+ "energybuffer.01.tier.xx",
+ "512V Creative Energy Buffer", 3, "", 0)
+ .getStackForm(1L));
+
+ GT_ModHandler.addCraftingRecipe(GregtechItemList.Energy_Buffer_1by1_ULV.get(1L, new Object[0]), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, new Object[] { "WTW", "WMW", Character.valueOf('M'), ItemList.Hull_ULV, Character.valueOf('W'), OrePrefixes.wireGt08.get(Materials.Lead), Character.valueOf('T'), ExtraOreDictNames.buffer_core });
+ GT_ModHandler.addCraftingRecipe(GregtechItemList.Energy_Buffer_1by1_LV.get(1L, new Object[0]), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, new Object[] { "WTW", "WMW", Character.valueOf('M'), ItemList.Hull_LV, Character.valueOf('W'), OrePrefixes.wireGt08.get(Materials.Tin), Character.valueOf('T'), ExtraOreDictNames.buffer_core });
+ GT_ModHandler.addCraftingRecipe(GregtechItemList.Energy_Buffer_1by1_MV.get(1L, new Object[0]), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, new Object[] { "WTW", "WMW", Character.valueOf('M'), ItemList.Hull_MV, Character.valueOf('W'), OrePrefixes.wireGt08.get(Materials.AnyCopper), Character.valueOf('T'), ExtraOreDictNames.buffer_core });
+ GT_ModHandler.addCraftingRecipe(GregtechItemList.Energy_Buffer_1by1_HV.get(1L, new Object[0]), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, new Object[] { "WTW", "WMW", Character.valueOf('M'), ItemList.Hull_HV, Character.valueOf('W'), OrePrefixes.wireGt08.get(Materials.Gold), Character.valueOf('T'), ExtraOreDictNames.buffer_core });
+ GT_ModHandler.addCraftingRecipe(GregtechItemList.Energy_Buffer_1by1_EV.get(1L, new Object[0]), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, new Object[] { "WTW", "WMW", Character.valueOf('M'), ItemList.Hull_EV, Character.valueOf('W'), OrePrefixes.wireGt08.get(Materials.Aluminium), Character.valueOf('T'), ExtraOreDictNames.buffer_core });
+ GT_ModHandler.addCraftingRecipe(GregtechItemList.Energy_Buffer_1by1_IV.get(1L, new Object[0]), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, new Object[] { "WTW", "WMW", Character.valueOf('M'), ItemList.Hull_IV, Character.valueOf('W'), OrePrefixes.wireGt08.get(Materials.Tungsten), Character.valueOf('T'), ExtraOreDictNames.buffer_core });
+ GT_ModHandler.addCraftingRecipe(GregtechItemList.Energy_Buffer_1by1_LuV.get(1L, new Object[0]), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, new Object[] { "WTW", "WMW", Character.valueOf('M'), ItemList.Hull_LuV, Character.valueOf('W'), OrePrefixes.wireGt08.get(Materials.Osmium), Character.valueOf('T'), ExtraOreDictNames.buffer_core });
+ GT_ModHandler.addCraftingRecipe(GregtechItemList.Energy_Buffer_1by1_ZPM.get(1L, new Object[0]), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, new Object[] { "WTW", "WMW", Character.valueOf('M'), ItemList.Hull_ZPM, Character.valueOf('W'), OrePrefixes.wireGt08.get(Materials.Osmium), Character.valueOf('T'), ExtraOreDictNames.buffer_core });
+ GT_ModHandler.addCraftingRecipe(GregtechItemList.Energy_Buffer_1by1_UV.get(1L, new Object[0]), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, new Object[] { "WTW", "WMW", Character.valueOf('M'), ItemList.Hull_UV, Character.valueOf('W'), OrePrefixes.wireGt08.get(Materials.Osmium), Character.valueOf('T'), ExtraOreDictNames.buffer_core });
+ GT_ModHandler.addCraftingRecipe(GregtechItemList.Energy_Buffer_1by1_MAX.get(1L, new Object[0]), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, new Object[] { "WTW", "WMW", Character.valueOf('M'), ItemList.Hull_MAX, Character.valueOf('W'), OrePrefixes.wireGt08.get(Materials.Superconductor), Character.valueOf('T'), ExtraOreDictNames.buffer_core });
+ GT_ModHandler.addCraftingRecipe(
+ GregtechItemList.Energy_Buffer_1by1_MAX.get(1L, new Object[0]),
+ GT_ModHandler.RecipeBits.DISMANTLEABLE
+ | GT_ModHandler.RecipeBits.NOT_REMOVABLE
+ | GT_ModHandler.RecipeBits.REVERSIBLE
+ | GT_ModHandler.RecipeBits.BUFFERED, new Object[] {
+ "WTW", "WMW", Character.valueOf('M'),
+ ItemList.Hull_MAX, Character.valueOf('W'),
+ OrePrefixes.wireGt08.get(Materials.Superconductor),
+ Character.valueOf('T'), ExtraOreDictNames.buffer_core });
+
+
+
+
+ }
+}
diff --git a/src/Java/miscutil/gregtech/interfaces/GregtechItemContainer.java b/src/Java/miscutil/gregtech/interfaces/GregtechItemContainer.java
new file mode 100644
index 0000000000..e871c19fcf
--- /dev/null
+++ b/src/Java/miscutil/gregtech/interfaces/GregtechItemContainer.java
@@ -0,0 +1,24 @@
+package miscutil.gregtech.interfaces;
+
+import net.minecraft.block.Block;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+
+public interface GregtechItemContainer {
+ public Item getItem();
+ public Block getBlock();
+ public boolean isStackEqual(Object aStack);
+ public boolean isStackEqual(Object aStack, boolean aWildcard, boolean aIgnoreNBT);
+ public ItemStack get(long aAmount, Object... aReplacements);
+ public ItemStack getWildcard(long aAmount, Object... aReplacements);
+ public ItemStack getUndamaged(long aAmount, Object... aReplacements);
+ public ItemStack getAlmostBroken(long aAmount, Object... aReplacements);
+ public ItemStack getWithDamage(long aAmount, long aMetaValue, Object... aReplacements);
+ public GregtechItemContainer set(Item aItem);
+ public GregtechItemContainer set(ItemStack aStack);
+ public GregtechItemContainer registerOre(Object... aOreNames);
+ public GregtechItemContainer registerWildcardAsOre(Object... aOreNames);
+ public ItemStack getWithCharge(long aAmount, int aEnergy, Object... aReplacements);
+ public ItemStack getWithName(long aAmount, String aDisplayName, Object... aReplacements);
+ public boolean hasBeenSet();
+} \ No newline at end of file
diff --git a/src/Java/miscutil/gregtech/metatileentity/implementations/GregtechMetaCreativeEnergyBuffer.java b/src/Java/miscutil/gregtech/metatileentity/implementations/GregtechMetaCreativeEnergyBuffer.java
new file mode 100644
index 0000000000..a176aab00f
--- /dev/null
+++ b/src/Java/miscutil/gregtech/metatileentity/implementations/GregtechMetaCreativeEnergyBuffer.java
@@ -0,0 +1,261 @@
+package miscutil.gregtech.metatileentity.implementations;
+
+import static gregtech.api.enums.GT_Values.V;
+import gregtech.api.enums.Textures;
+import gregtech.api.gui.GT_Container_1by1;
+import gregtech.api.gui.GT_Container_2by2;
+import gregtech.api.gui.GT_Container_3by3;
+import gregtech.api.gui.GT_Container_4by4;
+import gregtech.api.gui.GT_GUIContainer_1by1;
+import gregtech.api.gui.GT_GUIContainer_2by2;
+import gregtech.api.gui.GT_GUIContainer_3by3;
+import gregtech.api.gui.GT_GUIContainer_4by4;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.items.GT_MetaBase_Item;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_ModHandler;
+import gregtech.api.util.GT_Utility;
+import ic2.api.item.IElectricItem;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+
+/**
+ * NEVER INCLUDE THIS FILE IN YOUR MOD!!!
+ *
+ * This is the main construct for my Basic Machines such as the Automatic Extractor
+ * Extend this class to make a simple Machine
+ */
+public class GregtechMetaCreativeEnergyBuffer extends GregtechMetaEnergyBuffer {
+
+
+ public GregtechMetaCreativeEnergyBuffer(String aName, int aTier,
+ String aDescription, ITexture[][][] aTextures, int aSlotCount) {
+ super(aName, aTier, aDescription, aTextures, aSlotCount);
+ // TODO Auto-generated constructor stub
+ }
+
+ public GregtechMetaCreativeEnergyBuffer(int aID, String aName,
+ String aNameRegional, int aTier, String aDescription, int aSlotCount) {
+ super(aID, aName, aNameRegional, aTier, aDescription, aSlotCount);
+ }
+
+ public boolean mCharge = false, mDecharge = false;
+ public int mBatteryCount = 1, mChargeableCount = 1;
+
+ /*
+ * MACHINE_STEEL_SIDE
+ */
+ @Override
+ public ITexture[][][] getTextureSet(ITexture[] aTextures) {
+ ITexture[][][] rTextures = new ITexture[2][17][];
+ for (byte i = -1; i < 16; i++) {
+ rTextures[0][i + 1] = new ITexture[] { new GT_RenderedTexture(
+ Textures.BlockIcons.MACHINE_STEEL_SIDE) };
+ rTextures[1][i + 1] = new ITexture[] {
+ new GT_RenderedTexture(
+ Textures.BlockIcons.MACHINE_STEEL_SIDE),
+ mInventory.length > 4 ? Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[mTier]
+ : Textures.BlockIcons.OVERLAYS_ENERGY_OUT[mTier] };
+ }
+ return rTextures;
+ }
+
+ @Override
+ public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity,
+ byte aSide, byte aFacing, byte aColorIndex, boolean aActive,
+ boolean aRedstone) {
+ return mTextures[aSide == aFacing ? 1 : 0][aColorIndex + 1];
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaCreativeEnergyBuffer(mName, mTier, mDescription,
+ mTextures, mInventory.length);
+ }
+
+ @Override public boolean isSimpleMachine() {return false;}
+ @Override public boolean isElectric() {return true;}
+ @Override public boolean isValidSlot(int aIndex) {return true;}
+ @Override public boolean isFacingValid(byte aFacing) {return true;}
+ @Override public boolean isEnetInput() {return true;}
+ @Override public boolean isEnetOutput() {return true;}
+ @Override public boolean isInputFacing(byte aSide) {return aSide!=getBaseMetaTileEntity().getFrontFacing();}
+ @Override public boolean isOutputFacing(byte aSide) {return aSide==getBaseMetaTileEntity().getFrontFacing();}
+ @Override public boolean isTeleporterCompatible() {return false;}
+
+ @Override
+ public long getMinimumStoredEU() {
+ return 1;
+ }
+
+ @Override
+ public long maxEUStore() {
+ return Long.MAX_VALUE;
+ }
+
+ @Override
+ public long maxEUInput() {
+ return V[mTier];
+ }
+
+ @Override
+ public long maxEUOutput() {
+ return V[mTier];
+ }
+
+ @Override
+ public long maxAmperesIn() {
+ return mChargeableCount * 16;
+ }
+
+ @Override
+ public long maxAmperesOut() {
+ return mChargeableCount * 16;
+ }
+ @Override public int rechargerSlotStartIndex() {return 0;}
+ @Override public int dechargerSlotStartIndex() {return 0;}
+ @Override public int rechargerSlotCount() {return mCharge?mInventory.length:0;}
+ @Override public int dechargerSlotCount() {return mDecharge?mInventory.length:0;}
+ @Override public int getProgresstime() {return Integer.MAX_VALUE;}
+ @Override public int maxProgresstime() {return (int)getBaseMetaTileEntity().getUniversalEnergyCapacity();}
+ @Override public boolean isAccessAllowed(EntityPlayer aPlayer) {return true;}
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ //
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ //
+ }
+
+ @Override
+ public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory,
+ IGregTechTileEntity aBaseMetaTileEntity) {
+ switch (mInventory.length) {
+ case 1: return new GT_Container_1by1(aPlayerInventory, aBaseMetaTileEntity);
+ case 4: return new GT_Container_2by2(aPlayerInventory, aBaseMetaTileEntity);
+ case 9: return new GT_Container_3by3(aPlayerInventory, aBaseMetaTileEntity);
+ case 16: return new GT_Container_4by4(aPlayerInventory, aBaseMetaTileEntity);
+ }
+ return new GT_Container_1by1(aPlayerInventory, aBaseMetaTileEntity);
+ }
+
+ @Override
+ public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory,
+ IGregTechTileEntity aBaseMetaTileEntity) {
+ switch (mInventory.length) {
+ case 1: return new GT_GUIContainer_1by1(aPlayerInventory, aBaseMetaTileEntity, getLocalName());
+ case 4: return new GT_GUIContainer_2by2(aPlayerInventory, aBaseMetaTileEntity, getLocalName());
+ case 9: return new GT_GUIContainer_3by3(aPlayerInventory, aBaseMetaTileEntity, getLocalName());
+ case 16: return new GT_GUIContainer_4by4(aPlayerInventory, aBaseMetaTileEntity, getLocalName());
+ }
+ return new GT_GUIContainer_1by1(aPlayerInventory, aBaseMetaTileEntity, getLocalName());
+ }
+
+ @Override
+ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ this.getBaseMetaTileEntity().increaseStoredEnergyUnits(Integer.MAX_VALUE, true);
+ if (aBaseMetaTileEntity.isServerSide()) {
+ mCharge = aBaseMetaTileEntity.getStoredEU() / 2 > aBaseMetaTileEntity
+ .getEUCapacity() / 3;
+ mDecharge = aBaseMetaTileEntity.getStoredEU() < aBaseMetaTileEntity.getEUCapacity() / 3;
+ mBatteryCount = 1;
+ mChargeableCount = 1;
+ this.getBaseMetaTileEntity().increaseStoredEnergyUnits(mMax, true);
+ for (ItemStack tStack : mInventory) if (GT_ModHandler.isElectricItem(tStack, mTier)) {
+ if (GT_ModHandler.isChargerItem(tStack)) mBatteryCount++;
+ mChargeableCount++;
+ }
+ }
+ }
+
+ @Override
+ public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ if(GT_ModHandler.isElectricItem(aStack)&&aStack.getUnlocalizedName().startsWith("gt.metaitem.01.")){
+ String name = aStack.getUnlocalizedName();
+ if(name.equals("gt.metaitem.01.32510")||
+ name.equals("gt.metaitem.01.32511")||
+ name.equals("gt.metaitem.01.32520")||
+ name.equals("gt.metaitem.01.32521")||
+ name.equals("gt.metaitem.01.32530")||
+ name.equals("gt.metaitem.01.32531")){
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ if(!GT_Utility.isStackValid(aStack)){
+ return false;
+ }
+ if(GT_ModHandler.isElectricItem(aStack, this.mTier)){
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public long[] getStoredEnergy(){
+ long tScale = getBaseMetaTileEntity().getEUCapacity();
+ long tStored = getBaseMetaTileEntity().getStoredEU();
+ if (mInventory != null) {
+ for (ItemStack aStack : mInventory) {
+ if (GT_ModHandler.isElectricItem(aStack)) {
+
+ if (aStack.getItem() instanceof GT_MetaBase_Item) {
+ Long[] stats = ((GT_MetaBase_Item) aStack.getItem())
+ .getElectricStats(aStack);
+ if (stats != null) {
+ tScale = tScale + stats[0];
+ tStored = tStored
+ + ((GT_MetaBase_Item) aStack.getItem())
+ .getRealCharge(aStack);
+ }
+ } else if (aStack.getItem() instanceof IElectricItem) {
+ tStored = tStored
+ + (long) ic2.api.item.ElectricItem.manager
+ .getCharge(aStack);
+ tScale = tScale
+ + (long) ((IElectricItem) aStack.getItem())
+ .getMaxCharge(aStack);
+ }
+ }
+ }
+
+ }
+ return new long[] { tStored, tScale };
+ }
+
+ private long count=0;
+ private long mStored=0;
+ private long mMax=0;
+
+ @Override
+ public String[] getInfoData() {
+ count++;
+ if(mMax==0||count%20==0){
+ long[] tmp = getStoredEnergy();
+ mStored=tmp[0];
+ mMax=tmp[1];
+ }
+
+ return new String[] {
+ getLocalName(),
+ "Stored Items:",
+ GT_Utility.formatNumbers(mStored)+" EU /",
+ GT_Utility.formatNumbers(mMax)+" EU"};
+ }
+
+ @Override
+ public boolean isGivingInformation() {
+ return true;
+ }
+} \ No newline at end of file
diff --git a/src/Java/miscutil/gregtech/metatileentity/implementations/GregtechMetaEnergyBuffer.java b/src/Java/miscutil/gregtech/metatileentity/implementations/GregtechMetaEnergyBuffer.java
new file mode 100644
index 0000000000..46add14c15
--- /dev/null
+++ b/src/Java/miscutil/gregtech/metatileentity/implementations/GregtechMetaEnergyBuffer.java
@@ -0,0 +1,401 @@
+package miscutil.gregtech.metatileentity.implementations;
+
+import static gregtech.api.enums.GT_Values.V;
+import gregtech.api.enums.Textures;
+import gregtech.api.gui.GT_Container_1by1;
+import gregtech.api.gui.GT_Container_2by2;
+import gregtech.api.gui.GT_Container_3by3;
+import gregtech.api.gui.GT_Container_4by4;
+import gregtech.api.gui.GT_GUIContainer_1by1;
+import gregtech.api.gui.GT_GUIContainer_2by2;
+import gregtech.api.gui.GT_GUIContainer_3by3;
+import gregtech.api.gui.GT_GUIContainer_4by4;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.items.GT_MetaBase_Item;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_ModHandler;
+import gregtech.api.util.GT_Utility;
+import ic2.api.item.IElectricItem;
+import miscutil.core.handler.GuiHandler;
+import miscutil.core.util.Utils;
+import miscutil.gregtech.util.IMessage;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.world.World;
+
+/**
+ * NEVER INCLUDE THIS FILE IN YOUR MOD!!!
+ *
+ * This is the main construct for my Basic Machines such as the Automatic Extractor
+ * Extend this class to make a simple Machine
+ */
+public class GregtechMetaEnergyBuffer extends GregtechMetaTileEntity {
+
+ /*
+ * public GregtechMetaEnergyBuffer() { super.this
+ * setCreativeTab(GregTech_API.TAB_GREGTECH); }
+ */
+
+ public boolean mCharge = false, mDecharge = false;
+ public int mBatteryCount = 1, mChargeableCount = 1;
+
+ public GregtechMetaEnergyBuffer(int aID, String aName, String aNameRegional, int aTier, String aDescription, int aSlotCount) {
+ super(aID, aName, aNameRegional, aTier, aSlotCount, aDescription);
+ }
+
+ public GregtechMetaEnergyBuffer(String aName, int aTier, String aDescription, ITexture[][][] aTextures, int aSlotCount) {
+ super(aName, aTier, aSlotCount, aDescription, aTextures);
+ }
+
+ @Override
+ public String[] getDescription() {
+ return new String[] {mDescription, mInventory.length + " Slots"};
+ }
+
+ /*
+ * MACHINE_STEEL_SIDE
+ */
+ @Override
+ public ITexture[][][] getTextureSet(ITexture[] aTextures) {
+ ITexture[][][] rTextures = new ITexture[2][17][];
+ for (byte i = -1; i < 16; i++) {
+ rTextures[0][i + 1] = new ITexture[] { new GT_RenderedTexture(
+ Textures.BlockIcons.MACHINE_CASING_FROST_PROOF) };
+ rTextures[1][i + 1] = new ITexture[] {
+ new GT_RenderedTexture(
+ Textures.BlockIcons.MACHINE_CASING_FROST_PROOF),
+ mInventory.length > 4 ? Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[mTier]
+ : Textures.BlockIcons.OVERLAYS_ENERGY_OUT[mTier] };
+ }
+ return rTextures;
+ }
+
+ /*
+ * @Override public ITexture[][][] getTextureSet(ITexture[] aTextures) {
+ * ITexture[][][] rTextures = new ITexture[5][17][]; for (byte i = -1; i <
+ * 16; i = (byte) (i + 1)) { ITexture[] tmp0 = { new GT_RenderedTexture(
+ * Textures.BlockIcons.MACHINE_STEEL_BOTTOM, Dyes.getModulation(i,
+ * Dyes._NULL.mRGBa)) }; rTextures[0][(i + 1)] = tmp0; ITexture[] tmp1 = {
+ * new GT_RenderedTexture( Textures.BlockIcons.MACHINE_STEEL_TOP) };
+ * rTextures[1][(i + 1)] = tmp1; ITexture[] tmp2 = { new GT_RenderedTexture(
+ * Textures.BlockIcons.MACHINE_STEEL_SIDE, Dyes.getModulation(i,
+ * Dyes._NULL.mRGBa)), new
+ * GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE) }; rTextures[2][(i +
+ * 1)] = tmp2; ITexture[] tmp4 = { new GT_RenderedTexture(
+ * Textures.BlockIcons.MACHINE_STEEL_SIDE, Dyes.getModulation(i,
+ * Dyes._NULL.mRGBa)), new
+ * GT_RenderedTexture(Textures.BlockIcons.BOILER_FRONT) }; rTextures[3][(i +
+ * 1)] = tmp4; ITexture[] tmp5 = { new GT_RenderedTexture(
+ * Textures.BlockIcons.MACHINE_STEEL_SIDE, Dyes.getModulation(i,
+ * Dyes._NULL.mRGBa)), new GT_RenderedTexture(
+ * Textures.BlockIcons.BOILER_FRONT_ACTIVE) }; rTextures[4][(i + 1)] = tmp5;
+ * } return rTextures; }
+ */
+
+ @Override
+ public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
+ return mTextures[aSide == aFacing ? 1 : 0][aColorIndex+1];
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaEnergyBuffer(mName, mTier, mDescription, mTextures, mInventory.length);
+ }
+
+ @Override public boolean isSimpleMachine() {return false;}
+ @Override public boolean isElectric() {return true;}
+ @Override public boolean isValidSlot(int aIndex) {return true;}
+ @Override public boolean isFacingValid(byte aFacing) {return true;}
+ @Override public boolean isEnetInput() {return true;}
+ @Override public boolean isEnetOutput() {return true;}
+ @Override public boolean isInputFacing(byte aSide) {return aSide!=getBaseMetaTileEntity().getFrontFacing();}
+ @Override public boolean isOutputFacing(byte aSide) {return aSide==getBaseMetaTileEntity().getFrontFacing();}
+ @Override public boolean isTeleporterCompatible() {return false;}
+ @Override public long getMinimumStoredEU() {return V[mTier]*16*mInventory.length;}
+ @Override public long maxEUStore() {return V[mTier]*250000;}
+
+ @Override
+ public long maxEUInput() {
+ return V[mTier];
+ }
+
+ @Override
+ public long maxEUOutput() {
+ return V[mTier];
+ }
+
+ @Override
+ public long maxAmperesIn() {
+ return mChargeableCount * 4;
+ }
+
+ @Override
+ public long maxAmperesOut() {
+ return mChargeableCount * 4;
+ }
+ @Override public int rechargerSlotStartIndex() {return 0;}
+ @Override public int dechargerSlotStartIndex() {return 0;}
+ @Override public int rechargerSlotCount() {return mCharge?mInventory.length:0;}
+ @Override public int dechargerSlotCount() {return mDecharge?mInventory.length:0;}
+ @Override public int getProgresstime() {return (int)getBaseMetaTileEntity().getUniversalEnergyStored();}
+ @Override public int maxProgresstime() {return (int)getBaseMetaTileEntity().getUniversalEnergyCapacity();}
+ @Override public boolean isAccessAllowed(EntityPlayer aPlayer) {return true;}
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ //
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ //
+ }
+
+ @Override
+ public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) {
+ Utils.LOG_WARNING("Right Click on MTE by Player");
+ if (aBaseMetaTileEntity.isClientSide()) return true;
+ //aBaseMetaTileEntity.openGUI(aPlayer);
+
+ Utils.LOG_WARNING("MTE is Client-side");
+ showEnergy(aPlayer.getEntityWorld(), aPlayer);
+ return true;
+ }
+
+ private void showEnergy(World worldIn, EntityPlayer playerIn){
+ Utils.LOG_WARNING("Begin Show Energy");
+ final double c = ((double) getProgresstime() / maxProgresstime()) * 100;
+ Utils.LOG_WARNING(""+c);
+ final double roundOff = Math.round(c * 100.0) / 100.0;
+ IMessage.messageThePlayer("Energy: " + getProgresstime() + " EU at "+V[mTier]+"v ("+roundOff+"%)");
+ Utils.LOG_WARNING("Making new instance of Guihandler");
+ GuiHandler block = new GuiHandler();
+ Utils.LOG_WARNING("Guihandler.toString(): "+block.toString());
+ block.getClientGuiElement(1, playerIn, worldIn, (int) playerIn.posX, (int) playerIn.posY, (int) playerIn.posZ);
+
+ }
+
+ @Override
+ public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory,
+ IGregTechTileEntity aBaseMetaTileEntity) {
+ switch (mInventory.length) {
+ case 1: return new GT_Container_1by1(aPlayerInventory, aBaseMetaTileEntity);
+ case 4: return new GT_Container_2by2(aPlayerInventory, aBaseMetaTileEntity);
+ case 9: return new GT_Container_3by3(aPlayerInventory, aBaseMetaTileEntity);
+ case 16: return new GT_Container_4by4(aPlayerInventory, aBaseMetaTileEntity);
+ }
+ return new GT_Container_1by1(aPlayerInventory, aBaseMetaTileEntity);
+ }
+
+ @Override
+ public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory,
+ IGregTechTileEntity aBaseMetaTileEntity) {
+ switch (mInventory.length) {
+ case 1: return new GT_GUIContainer_1by1(aPlayerInventory, aBaseMetaTileEntity, getLocalName());
+ case 4: return new GT_GUIContainer_2by2(aPlayerInventory, aBaseMetaTileEntity, getLocalName());
+ case 9: return new GT_GUIContainer_3by3(aPlayerInventory, aBaseMetaTileEntity, getLocalName());
+ case 16: return new GT_GUIContainer_4by4(aPlayerInventory, aBaseMetaTileEntity, getLocalName());
+ }
+ return new GT_GUIContainer_1by1(aPlayerInventory, aBaseMetaTileEntity, getLocalName());
+ }
+
+ @Override
+ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ if (aBaseMetaTileEntity.isServerSide()) {
+ mCharge = aBaseMetaTileEntity.getStoredEU() / 2 > aBaseMetaTileEntity
+ .getEUCapacity() / 3;
+ mDecharge = aBaseMetaTileEntity.getStoredEU() < aBaseMetaTileEntity.getEUCapacity() / 3;
+ mBatteryCount = 1;
+ mChargeableCount = 1;
+ for (ItemStack tStack : mInventory) if (GT_ModHandler.isElectricItem(tStack, mTier)) {
+ if (GT_ModHandler.isChargerItem(tStack)) mBatteryCount++;
+ mChargeableCount++;
+ }
+ }
+ }
+
+ @Override
+ public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ if(GT_ModHandler.isElectricItem(aStack)&&aStack.getUnlocalizedName().startsWith("gt.metaitem.01.")){
+ String name = aStack.getUnlocalizedName();
+ if(name.equals("gt.metaitem.01.32510")||
+ name.equals("gt.metaitem.01.32511")||
+ name.equals("gt.metaitem.01.32520")||
+ name.equals("gt.metaitem.01.32521")||
+ name.equals("gt.metaitem.01.32530")||
+ name.equals("gt.metaitem.01.32531")){
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ if(!GT_Utility.isStackValid(aStack)){
+ return false;
+ }
+ if(GT_ModHandler.isElectricItem(aStack, this.mTier)){
+ return true;
+ }
+ return false;
+ }
+
+ public long[] getStoredEnergy(){
+ long tScale = getBaseMetaTileEntity().getEUCapacity();
+ long tStored = getBaseMetaTileEntity().getStoredEU();
+ if (mInventory != null) {
+ for (ItemStack aStack : mInventory) {
+ if (GT_ModHandler.isElectricItem(aStack)) {
+
+ if (aStack.getItem() instanceof GT_MetaBase_Item) {
+ Long[] stats = ((GT_MetaBase_Item) aStack.getItem())
+ .getElectricStats(aStack);
+ if (stats != null) {
+ tScale = tScale + stats[0];
+ tStored = tStored
+ + ((GT_MetaBase_Item) aStack.getItem())
+ .getRealCharge(aStack);
+ }
+ } else if (aStack.getItem() instanceof IElectricItem) {
+ tStored = tStored
+ + (long) ic2.api.item.ElectricItem.manager
+ .getCharge(aStack);
+ tScale = tScale
+ + (long) ((IElectricItem) aStack.getItem())
+ .getMaxCharge(aStack);
+ }
+ }
+ }
+
+ }
+ return new long[] { tStored, tScale };
+ }
+
+ private long count=0;
+ private long mStored=0;
+ private long mMax=0;
+
+ @Override
+ public String[] getInfoData() {
+ count++;
+ if(mMax==0||count%20==0){
+ long[] tmp = getStoredEnergy();
+ mStored=tmp[0];
+ mMax=tmp[1];
+ }
+
+ return new String[] {
+ getLocalName(),
+ "Stored Items:",
+ GT_Utility.formatNumbers(mStored)+" EU /",
+ GT_Utility.formatNumbers(mMax)+" EU"};
+ }
+
+ @Override
+ public boolean isGivingInformation() {
+ return true;
+ }
+
+ @Override
+ public int[] getAccessibleSlotsFromSide(int p_94128_1_) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public boolean canInsertItem(int p_102007_1_, ItemStack p_102007_2_,
+ int p_102007_3_) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean canExtractItem(int p_102008_1_, ItemStack p_102008_2_,
+ int p_102008_3_) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public int getSizeInventory() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public ItemStack getStackInSlot(int p_70301_1_) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public ItemStack decrStackSize(int p_70298_1_, int p_70298_2_) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public ItemStack getStackInSlotOnClosing(int p_70304_1_) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void setInventorySlotContents(int p_70299_1_, ItemStack p_70299_2_) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public String getInventoryName() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public boolean hasCustomInventoryName() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public int getInventoryStackLimit() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public void markDirty() {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public boolean isUseableByPlayer(EntityPlayer p_70300_1_) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public void openInventory() {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void closeInventory() {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public boolean isItemValidForSlot(int p_94041_1_, ItemStack p_94041_2_) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+} \ No newline at end of file
diff --git a/src/Java/miscutil/gregtech/metatileentity/implementations/GregtechMetaTileEntity.java b/src/Java/miscutil/gregtech/metatileentity/implementations/GregtechMetaTileEntity.java
new file mode 100644
index 0000000000..c95c7ba75a
--- /dev/null
+++ b/src/Java/miscutil/gregtech/metatileentity/implementations/GregtechMetaTileEntity.java
@@ -0,0 +1,65 @@
+package miscutil.gregtech.metatileentity.implementations;
+
+import static gregtech.api.enums.GT_Values.GT;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.metatileentity.MetaTileEntity;
+
+public abstract class GregtechMetaTileEntity extends MetaTileEntity {
+ /**
+ * Value between [0 - 9] to describe the Tier of this Machine.
+ */
+ public final byte mTier;
+
+ /**
+ * A simple Description.
+ */
+ public final String mDescription;
+
+ /**
+ * Contains all Textures used by this Block.
+ */
+ public final ITexture[][][] mTextures;
+
+ public GregtechMetaTileEntity(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount, String aDescription, ITexture... aTextures) {
+ super(aID, aName, aNameRegional, aInvSlotCount);
+ mTier = (byte)Math.max(0, Math.min(aTier, 9));
+ mDescription = aDescription;
+
+ // must always be the last call!
+ if (GT.isClientSide()) mTextures = getTextureSet(aTextures); else mTextures = null;
+ }
+
+ public GregtechMetaTileEntity(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) {
+ super(aName, aInvSlotCount);
+ mTier = (byte)aTier;
+ mDescription = aDescription;
+ mTextures = aTextures;
+ }
+
+ @Override
+ public byte getTileEntityBaseType() {
+ return (byte)(Math.min(3, mTier<=0?0:1+((mTier-1) / 4)));
+ }
+
+ @Override
+ public long getInputTier() {
+ return mTier;
+ }
+
+ @Override
+ public long getOutputTier() {
+ return mTier;
+ }
+
+ @Override
+ public String[] getDescription() {
+ return new String[] {mDescription};
+ }
+
+ /**
+ * Used Client Side to get a Texture Set for this Block.
+ * Called after setting the Tier and the Description so that those two are accessible.
+ * @param aTextures is the optional Array you can give to the Constructor.
+ */
+ public abstract ITexture[][][] getTextureSet(ITexture[] aTextures);
+} \ No newline at end of file
diff --git a/src/Java/miscutil/gregtech/metatileentity/implementations/GregtechSteelBoiler.java b/src/Java/miscutil/gregtech/metatileentity/implementations/GregtechSteelBoiler.java
new file mode 100644
index 0000000000..45b6fa5f86
--- /dev/null
+++ b/src/Java/miscutil/gregtech/metatileentity/implementations/GregtechSteelBoiler.java
@@ -0,0 +1,290 @@
+package miscutil.gregtech.metatileentity.implementations;
+
+import gregtech.api.enums.Dyes;
+import gregtech.api.enums.Materials;
+import gregtech.api.enums.OrePrefixes;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.MetaTileEntity;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_ModHandler;
+import gregtech.api.util.GT_OreDictUnificator;
+import gregtech.common.gui.GT_Container_Boiler;
+import gregtech.common.gui.GT_GUIContainer_Boiler;
+import gregtech.common.tileentities.boilers.GT_MetaTileEntity_Boiler;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.FluidStack;
+import net.minecraftforge.fluids.IFluidHandler;
+
+public class GregtechSteelBoiler
+ extends GT_MetaTileEntity_Boiler
+{
+ public GregtechSteelBoiler(int aID, String aName, String aNameRegional, int aTier, String aDescription)
+ {
+ super(aID, aName, aNameRegional, "Put it to good use!", new ITexture[0]);
+ }
+
+ public GregtechSteelBoiler(String aName, int aTier, String aDescription, ITexture[][][] aTextures)
+ {
+ super(aName, aTier, aDescription, aTextures);
+ }
+
+ public ITexture[][][] getTextureSet(ITexture[] aTextures)
+ {
+ ITexture[][][] rTextures = new ITexture[5][17][];
+ for (byte i = -1; i < 16; i = (byte)(i + 1))
+ {ITexture[] tmp0 ={ new GT_RenderedTexture(Textures.BlockIcons.MACHINE_STEEL_BOTTOM, Dyes.getModulation(i, Dyes._NULL.mRGBa)) };
+ rTextures[0][(i + 1)] = tmp0;
+ ITexture[] tmp1 ={ new GT_RenderedTexture(Textures.BlockIcons.STEAM_TURBINE_SIDE)};
+rTextures[1][(i + 1)] = tmp1;
+ ITexture[] tmp2 ={ new GT_RenderedTexture(Textures.BlockIcons.MACHINE_STEEL_SIDE, Dyes.getModulation(i, Dyes._NULL.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE) };
+rTextures[2][(i + 1)] = tmp2;
+ ITexture[] tmp4 ={ new GT_RenderedTexture(Textures.BlockIcons.MACHINE_STEEL_SIDE, Dyes.getModulation(i, Dyes._NULL.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.BOILER_FRONT) };
+rTextures[3][(i + 1)] = tmp4;
+ ITexture[] tmp5 ={ new GT_RenderedTexture(Textures.BlockIcons.MACHINE_STEEL_SIDE, Dyes.getModulation(i, Dyes._NULL.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.BOILER_FRONT_ACTIVE) };
+rTextures[4][(i + 1)] = tmp5;
+ }
+ return rTextures;
+ }
+
+ public int maxProgresstime()
+ {
+ return 1000;
+ }
+
+ public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity)
+ {
+ return new GT_Container_Boiler(aPlayerInventory, aBaseMetaTileEntity, 32000);
+ }
+
+ public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity)
+ {
+ return new GT_GUIContainer_Boiler(aPlayerInventory, aBaseMetaTileEntity, "SteelBoiler.png", 32000);
+ }
+
+ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity)
+ {
+ return new GregtechSteelBoiler(this.mName, this.mTier, this.mDescription, this.mTextures);
+ }
+
+ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick)
+ {
+ if ((aBaseMetaTileEntity.isServerSide()) && (aTick > 20L))
+ {
+ if (this.mTemperature <= 20)
+ {
+ this.mTemperature = 20;
+ this.mLossTimer = 0;
+ }
+ if (++this.mLossTimer > 40)
+ {
+ this.mTemperature -= 1;
+ this.mLossTimer = 0;
+ }
+ for (byte i = 1; (this.mSteam != null) && (i < 6); i = (byte)(i + 1)) {
+ if (i != aBaseMetaTileEntity.getFrontFacing())
+ {
+ IFluidHandler tTileEntity = aBaseMetaTileEntity.getITankContainerAtSide(i);
+ if (tTileEntity != null)
+ {
+ FluidStack tDrained = aBaseMetaTileEntity.drain(ForgeDirection.getOrientation(i), Math.max(1, this.mSteam.amount / 2), false);
+ if (tDrained != null)
+ {
+ int tFilledAmount = tTileEntity.fill(ForgeDirection.getOrientation(i).getOpposite(), tDrained, false);
+ if (tFilledAmount > 0) {
+ tTileEntity.fill(ForgeDirection.getOrientation(i).getOpposite(), aBaseMetaTileEntity.drain(ForgeDirection.getOrientation(i), tFilledAmount, true), true);
+ }
+ }
+ }
+ }
+ }
+ if (aTick % 10L == 0L) {
+ if (this.mTemperature > 100)
+ {
+ if ((this.mFluid == null) || (!GT_ModHandler.isWater(this.mFluid)) || (this.mFluid.amount <= 0))
+ {
+ this.mHadNoWater = true;
+ }
+ else
+ {
+ if (this.mHadNoWater)
+ {
+ aBaseMetaTileEntity.doExplosion(2048L);
+ return;
+ }
+ this.mFluid.amount -= 1;
+ if (this.mSteam == null) {
+ this.mSteam = GT_ModHandler.getSteam(150L);
+ } else if (GT_ModHandler.isSteam(this.mSteam)) {
+ this.mSteam.amount += 150;
+ } else {
+ this.mSteam = GT_ModHandler.getSteam(150L);
+ }
+ }
+ }
+ else {
+ this.mHadNoWater = false;
+ }
+ }
+ if ((this.mSteam != null) &&
+ (this.mSteam.amount > 32000))
+ {
+ sendSound((byte)1);
+ this.mSteam.amount = 24000;
+ }
+ if ((this.mProcessingEnergy <= 0) && (aBaseMetaTileEntity.isAllowedToWork()) &&
+ (this.mInventory[2] != null)) {
+ if ((GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.gem.get(Materials.Coal))) || (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.dust.get(Materials.Coal))) || (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.dustImpure.get(Materials.Coal))) || (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.crushed.get(Materials.Coal))))
+ {
+ this.mProcessingEnergy += 160;
+ aBaseMetaTileEntity.decrStackSize(2, 1);
+ if (aBaseMetaTileEntity.getRandomNumber(3) == 0) {
+ aBaseMetaTileEntity.addStackToSlot(3, GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.DarkAsh, 1L));
+ }
+ }
+ else if ((GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.gem.get(Materials.Charcoal))) || (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.dust.get(Materials.Charcoal))) || (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.dustImpure.get(Materials.Charcoal))) || (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.crushed.get(Materials.Charcoal))))
+ {
+ this.mProcessingEnergy += 160;
+ aBaseMetaTileEntity.decrStackSize(2, 1);
+ if (aBaseMetaTileEntity.getRandomNumber(3) == 0) {
+ aBaseMetaTileEntity.addStackToSlot(3, GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.Ash, 1L));
+ }
+ }
+ else if (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], "fuelCoke"))
+ {
+ this.mProcessingEnergy += 640;
+ aBaseMetaTileEntity.decrStackSize(2, 1);
+ if (aBaseMetaTileEntity.getRandomNumber(2) == 0) {
+ aBaseMetaTileEntity.addStackToSlot(3, GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.Ash, 1L));
+ }
+ }
+ else if ((GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.gem.get(Materials.Lignite))) || (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.dust.get(Materials.Lignite))) || (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.dustImpure.get(Materials.Lignite))) || (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.crushed.get(Materials.Lignite))))
+ {
+ this.mProcessingEnergy += 40;
+ aBaseMetaTileEntity.decrStackSize(2, 1);
+ if (aBaseMetaTileEntity.getRandomNumber(8) == 0) {
+ aBaseMetaTileEntity.addStackToSlot(3, GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.DarkAsh, 1L));
+ }
+ }
+ }
+ if ((this.mTemperature < 1000) && (this.mProcessingEnergy > 0) && (aTick % 12L == 0L))
+ {
+ this.mProcessingEnergy -= 2;
+ this.mTemperature += 1;
+ }
+ aBaseMetaTileEntity.setActive(this.mProcessingEnergy > 0);
+ }
+ }
+
+@Override
+public int[] getAccessibleSlotsFromSide(int p_94128_1_) {
+ // TODO Auto-generated method stub
+ return null;
+}
+
+@Override
+public boolean canInsertItem(int p_102007_1_, ItemStack p_102007_2_,
+ int p_102007_3_) {
+ // TODO Auto-generated method stub
+ return false;
+}
+
+@Override
+public boolean canExtractItem(int p_102008_1_, ItemStack p_102008_2_,
+ int p_102008_3_) {
+ // TODO Auto-generated method stub
+ return false;
+}
+
+@Override
+public int getSizeInventory() {
+ // TODO Auto-generated method stub
+ return 0;
+}
+
+@Override
+public ItemStack getStackInSlot(int p_70301_1_) {
+ // TODO Auto-generated method stub
+ return null;
+}
+
+@Override
+public ItemStack decrStackSize(int p_70298_1_, int p_70298_2_) {
+ // TODO Auto-generated method stub
+ return null;
+}
+
+@Override
+public ItemStack getStackInSlotOnClosing(int p_70304_1_) {
+ // TODO Auto-generated method stub
+ return null;
+}
+
+@Override
+public void setInventorySlotContents(int p_70299_1_, ItemStack p_70299_2_) {
+ // TODO Auto-generated method stub
+
+}
+
+@Override
+public String getInventoryName() {
+ // TODO Auto-generated method stub
+ return null;
+}
+
+@Override
+public boolean hasCustomInventoryName() {
+ // TODO Auto-generated method stub
+ return false;
+}
+
+@Override
+public int getInventoryStackLimit() {
+ // TODO Auto-generated method stub
+ return 0;
+}
+
+@Override
+public void markDirty() {
+ // TODO Auto-generated method stub
+
+}
+
+@Override
+public boolean isUseableByPlayer(EntityPlayer p_70300_1_) {
+ // TODO Auto-generated method stub
+ return false;
+}
+
+@Override
+public void openInventory() {
+ // TODO Auto-generated method stub
+
+}
+
+@Override
+public void closeInventory() {
+ // TODO Auto-generated method stub
+
+}
+
+@Override
+public boolean isItemValidForSlot(int p_94041_1_, ItemStack p_94041_2_) {
+ // TODO Auto-generated method stub
+ return false;
+}
+}
+
+
+
+/* Location: F:\Torrent\minecraft\jd-gui-0.3.6.windows\gregtech_1.7.10-5.07.07-dev.jar
+
+ * Qualified Name: gregtech.common.tileentities.boilers.GT_MetaTileEntity_Boiler_Steel
+
+ * JD-Core Version: 0.7.0.1
+
+ */ \ No newline at end of file
diff --git a/src/Java/miscutil/gregtech/util/IMessage.java b/src/Java/miscutil/gregtech/util/IMessage.java
new file mode 100644
index 0000000000..8891e2adde
--- /dev/null
+++ b/src/Java/miscutil/gregtech/util/IMessage.java
@@ -0,0 +1,21 @@
+package miscutil.gregtech.util;
+
+import net.minecraft.client.Minecraft;
+import net.minecraft.util.ChatComponentText;
+
+public class IMessage {
+
+ public static void messageThePlayer(String s){
+ if(Minecraft.getMinecraft().thePlayer.worldObj.isRemote){
+ Minecraft.getMinecraft().thePlayer.addChatComponentMessage(new ChatComponentText(s));
+ }
+ else if(!Minecraft.getMinecraft().thePlayer.worldObj.isRemote){
+ Minecraft.getMinecraft().thePlayer.addChatComponentMessage(new ChatComponentText(s));
+ }
+ }
+
+ public void messageOtherPlayer(String s){
+ Minecraft.getMinecraft().thePlayer.addChatComponentMessage(new ChatComponentText(s));
+ }
+
+}
diff --git a/src/Java/miscutil/gregtech/util/VanillaChatCommandSender.java b/src/Java/miscutil/gregtech/util/VanillaChatCommandSender.java
new file mode 100644
index 0000000000..ee77211b21
--- /dev/null
+++ b/src/Java/miscutil/gregtech/util/VanillaChatCommandSender.java
@@ -0,0 +1,35 @@
+package miscutil.gregtech.util;
+
+import net.minecraft.util.ChunkCoordinates;
+import net.minecraft.util.IChatComponent;
+import net.minecraft.world.World;
+
+public interface VanillaChatCommandSender {
+
+ /**
+ * Gets the name of this command sender (usually username, but possibly "Rcon")
+ */
+ String getCommandSenderName();
+
+ IChatComponent func_145748_c_();
+
+ /**
+ * Notifies this sender of some sort of information. This is for messages intended to display to the user. Used
+ * for typical output (like "you asked for whether or not this game rule is set, so here's your answer"), warnings
+ * (like "I fetched this block for you by ID, but I'd like you to know that every time you do this, I die a little
+ * inside"), and errors (like "it's not called iron_pixacke, silly").
+ */
+ void addChatMessage(IChatComponent p_145747_1_);
+
+ /**
+ * Returns true if the command sender is allowed to use the given command.
+ */
+ boolean canCommandSenderUseCommand(int p_70003_1_, String p_70003_2_);
+
+ /**
+ * Return the position for this command sender.
+ */
+ ChunkCoordinates getPlayerCoordinates();
+
+ World getEntityWorld();
+ }
diff --git a/src/resources/assets/miscutils/lang/en_US.lang b/src/resources/assets/miscutils/lang/en_US.lang
new file mode 100644
index 0000000000..190cd9e9d2
--- /dev/null
+++ b/src/resources/assets/miscutils/lang/en_US.lang
@@ -0,0 +1,53 @@
+itemGroup.MiscUtilBlockTab=Misc. Utils Blocks
+itemGroup.MiscUtilMiscTab=Misc. Utils Items
+itemGroup.MiscUtilCombatTab=Misc. Utils Combat
+itemGroup.MiscUtilToolsTab=Misc. Utils Tools
+
+
+item.BloodSteelPickaxe.name=Blood Steel Pickaxe
+item.BloodSteelAxe.name=Blood Steel Hatchet
+item.BloodSteelSword.name=Blood Steel Blade
+item.BloodSteelHoe.name=Blood Steel Hoe
+item.BloodSteelSpade.name=Blood Steel Shovel
+item.BloodSteelHelmet.name=Blood Steel Battle Helmet
+item.BloodSteelPlate.name=Blood Steel Battle Plate
+item.BloodSteelPants.name=Blood Steel War Casings
+item.BloodSteelBoots.name=Blood Steel War Treads
+
+
+
+item.itemPlateSoularium.name=Soularium Plate
+item.itemPlateRedstoneAlloy.name=Redstone Alloy Plate
+item.itemPlateElectricalSteel.name=Electrical Steel Plate
+item.itemPlatePulsatingIron.name=Pulsating Iron Plate
+item.itemPlateEnergeticAlloy.name=Energetic Alloy Plate
+item.itemPlateVibrantAlloy.name=Vibrant Alloy Plate
+item.itemPlateConductiveIron.name=Conductive Iron Plate
+item.itemPlateDarkSteel.name=Dark Steel Plate
+item.itemPlateBlutonium.name=Blutonium Plate
+item.itemPlateCyanite.name=Cyanite Plate
+item.itemPlateLudicrite.name=Ludicrite Plate
+item.itemPlateVoidMetal.name=Void Metal Plate
+item.itemPlateBedrockium.name=Bedrockium Plate
+item.itemPlateCompressedIron.name=Compressed Iron Plate
+item.itemPlateEnrichedSoularium.name=Enriched Soularium Plate
+item.itemPlateDimensionShard.name=Dimensional Plate
+item.itemIngotBloodSteel.name=Blood Steel Ingot
+item.itemPlateBloodSteel.name=Blood Steel Plate
+
+
+tile.blockBloodSteel.name=Block of Blood Steel
+tile.BloodSteelFurnace.name=Blood Steel Industrial Furnace
+tile.BloodSteelChest.name=Blood Steel Chest
+tile.ArcaneInfuser.name=Arcane Infuser
+
+tile.blockToolBuilder.name=GregTech Tool Constructor
+item.itemBufferCore.name=Buffer Core
+item.itemStaballoyPickaxe.name=Pick of the Ages
+item.itemIngotStaballoy.name=Staballoy Ingot
+item.itemPlateStaballoy.name=Staballoy Plate
+
+entity.BloodSteelMob.name=Friendly Fellow [WIP]
+entity.BloodSteelHostileMob.name=Hostile Mob [WIP]
+
+tile.storage.name=[WIP] Storage Block \ No newline at end of file
diff --git a/src/resources/assets/miscutils/textures/blocks/blockBloodSteel.png b/src/resources/assets/miscutils/textures/blocks/blockBloodSteel.png
new file mode 100644
index 0000000000..6ce0c8615f
--- /dev/null
+++ b/src/resources/assets/miscutils/textures/blocks/blockBloodSteel.png
Binary files differ
diff --git a/src/resources/assets/miscutils/textures/blocks/blockStaballoy.png b/src/resources/assets/miscutils/textures/blocks/blockStaballoy.png
new file mode 100644
index 0000000000..f90f75723e
--- /dev/null
+++ b/src/resources/assets/miscutils/textures/blocks/blockStaballoy.png
Binary files differ
diff --git a/src/resources/assets/miscutils/textures/items/itemBufferCore.png b/src/resources/assets/miscutils/textures/items/itemBufferCore.png
new file mode 100644
index 0000000000..fc6c4163a6
--- /dev/null
+++ b/src/resources/assets/miscutils/textures/items/itemBufferCore.png
Binary files differ
diff --git a/src/resources/assets/miscutils/textures/items/itemIngotBloodSteel.png b/src/resources/assets/miscutils/textures/items/itemIngotBloodSteel.png
new file mode 100644
index 0000000000..4d7a627065
--- /dev/null
+++ b/src/resources/assets/miscutils/textures/items/itemIngotBloodSteel.png
Binary files differ
diff --git a/src/resources/assets/miscutils/textures/items/itemIngotStaballoy.png b/src/resources/assets/miscutils/textures/items/itemIngotStaballoy.png
new file mode 100644
index 0000000000..af251b7711
--- /dev/null
+++ b/src/resources/assets/miscutils/textures/items/itemIngotStaballoy.png
Binary files differ
diff --git a/src/resources/assets/miscutils/textures/items/itemPlateBedrockium.png b/src/resources/assets/miscutils/textures/items/itemPlateBedrockium.png
new file mode 100644
index 0000000000..33248e37d7
--- /dev/null
+++ b/src/resources/assets/miscutils/textures/items/itemPlateBedrockium.png
Binary files differ
diff --git a/src/resources/assets/miscutils/textures/items/itemPlateBloodSteel.png b/src/resources/assets/miscutils/textures/items/itemPlateBloodSteel.png
new file mode 100644
index 0000000000..87bde2ffa1
--- /dev/null
+++ b/src/resources/assets/miscutils/textures/items/itemPlateBloodSteel.png
Binary files differ
diff --git a/src/resources/assets/miscutils/textures/items/itemPlateBlutonium.png b/src/resources/assets/miscutils/textures/items/itemPlateBlutonium.png
new file mode 100644
index 0000000000..284a631828
--- /dev/null
+++ b/src/resources/assets/miscutils/textures/items/itemPlateBlutonium.png
Binary files differ
diff --git a/src/resources/assets/miscutils/textures/items/itemPlateCompressedIron.png b/src/resources/assets/miscutils/textures/items/itemPlateCompressedIron.png
new file mode 100644
index 0000000000..ed9d98811b
--- /dev/null
+++ b/src/resources/assets/miscutils/textures/items/itemPlateCompressedIron.png
Binary files differ
diff --git a/src/resources/assets/miscutils/textures/items/itemPlateConductiveIron.png b/src/resources/assets/miscutils/textures/items/itemPlateConductiveIron.png
new file mode 100644
index 0000000000..a2e2d8e923
--- /dev/null
+++ b/src/resources/assets/miscutils/textures/items/itemPlateConductiveIron.png
Binary files differ
diff --git a/src/resources/assets/miscutils/textures/items/itemPlateCyanite.png b/src/resources/assets/miscutils/textures/items/itemPlateCyanite.png
new file mode 100644
index 0000000000..3674a721ec
--- /dev/null
+++ b/src/resources/assets/miscutils/textures/items/itemPlateCyanite.png
Binary files differ
diff --git a/src/resources/assets/miscutils/textures/items/itemPlateDarkSteel.png b/src/resources/assets/miscutils/textures/items/itemPlateDarkSteel.png
new file mode 100644
index 0000000000..698cdf21cb
--- /dev/null
+++ b/src/resources/assets/miscutils/textures/items/itemPlateDarkSteel.png
Binary files differ
diff --git a/src/resources/assets/miscutils/textures/items/itemPlateDimensionShard.png b/src/resources/assets/miscutils/textures/items/itemPlateDimensionShard.png
new file mode 100644
index 0000000000..9fe6440406
--- /dev/null
+++ b/src/resources/assets/miscutils/textures/items/itemPlateDimensionShard.png
Binary files differ
diff --git a/src/resources/assets/miscutils/textures/items/itemPlateElectricalSteel.png b/src/resources/assets/miscutils/textures/items/itemPlateElectricalSteel.png
new file mode 100644
index 0000000000..fe2ce84ab7
--- /dev/null
+++ b/src/resources/assets/miscutils/textures/items/itemPlateElectricalSteel.png
Binary files differ
diff --git a/src/resources/assets/miscutils/textures/items/itemPlateElectricalSteel2.png b/src/resources/assets/miscutils/textures/items/itemPlateElectricalSteel2.png
new file mode 100644
index 0000000000..d8b79ae78a
--- /dev/null
+++ b/src/resources/assets/miscutils/textures/items/itemPlateElectricalSteel2.png
Binary files differ
diff --git a/src/resources/assets/miscutils/textures/items/itemPlateEnergeticAlloy.png b/src/resources/assets/miscutils/textures/items/itemPlateEnergeticAlloy.png
new file mode 100644
index 0000000000..c7d063f69a
--- /dev/null
+++ b/src/resources/assets/miscutils/textures/items/itemPlateEnergeticAlloy.png
Binary files differ
diff --git a/src/resources/assets/miscutils/textures/items/itemPlateLudicrite.png b/src/resources/assets/miscutils/textures/items/itemPlateLudicrite.png
new file mode 100644
index 0000000000..11a10a2ed3
--- /dev/null
+++ b/src/resources/assets/miscutils/textures/items/itemPlateLudicrite.png
Binary files differ
diff --git a/src/resources/assets/miscutils/textures/items/itemPlatePulsatingIron.png b/src/resources/assets/miscutils/textures/items/itemPlatePulsatingIron.png
new file mode 100644
index 0000000000..454eb39071
--- /dev/null
+++ b/src/resources/assets/miscutils/textures/items/itemPlatePulsatingIron.png
Binary files differ
diff --git a/src/resources/assets/miscutils/textures/items/itemPlateRedstoneAlloy.png b/src/resources/assets/miscutils/textures/items/itemPlateRedstoneAlloy.png
new file mode 100644
index 0000000000..7d48dd4bea
--- /dev/null
+++ b/src/resources/assets/miscutils/textures/items/itemPlateRedstoneAlloy.png
Binary files differ
diff --git a/src/resources/assets/miscutils/textures/items/itemPlateSoularium.png b/src/resources/assets/miscutils/textures/items/itemPlateSoularium.png
new file mode 100644
index 0000000000..6420cc30de
--- /dev/null
+++ b/src/resources/assets/miscutils/textures/items/itemPlateSoularium.png
Binary files differ
diff --git a/src/resources/assets/miscutils/textures/items/itemPlateStaballoy.png b/src/resources/assets/miscutils/textures/items/itemPlateStaballoy.png
new file mode 100644
index 0000000000..6ab2e79ed9
--- /dev/null
+++ b/src/resources/assets/miscutils/textures/items/itemPlateStaballoy.png
Binary files differ
diff --git a/src/resources/assets/miscutils/textures/items/itemPlateVibrantAlloy.png b/src/resources/assets/miscutils/textures/items/itemPlateVibrantAlloy.png
new file mode 100644
index 0000000000..13c71932fd
--- /dev/null
+++ b/src/resources/assets/miscutils/textures/items/itemPlateVibrantAlloy.png
Binary files differ
diff --git a/src/resources/assets/miscutils/textures/items/itemPlateVoidMetal.png b/src/resources/assets/miscutils/textures/items/itemPlateVoidMetal.png
new file mode 100644
index 0000000000..8026035309
--- /dev/null
+++ b/src/resources/assets/miscutils/textures/items/itemPlateVoidMetal.png
Binary files differ
diff --git a/src/resources/assets/miscutils/textures/items/itemStaballoyPickaxe.png b/src/resources/assets/miscutils/textures/items/itemStaballoyPickaxe.png
new file mode 100644
index 0000000000..d1d6a487df
--- /dev/null
+++ b/src/resources/assets/miscutils/textures/items/itemStaballoyPickaxe.png
Binary files differ