From 8abf6e52823feda75c4edfa61d89239159bbfa69 Mon Sep 17 00:00:00 2001 From: modmuss50 Date: Sun, 8 Nov 2015 12:15:45 +0000 Subject: [PATCH] Moved to RebornCore --- build.gradle | 9 +- gourceVis.bat | 2 +- src/main/java/cofh/api/CoFHAPIProps.java | 11 - .../java/cofh/api/energy/EnergyStorage.java | 158 - .../cofh/api/energy/IEnergyConnection.java | 21 - .../cofh/api/energy/IEnergyContainerItem.java | 52 - .../java/cofh/api/energy/IEnergyHandler.java | 58 - .../java/cofh/api/energy/IEnergyProvider.java | 38 - .../java/cofh/api/energy/IEnergyReceiver.java | 38 - .../java/cofh/api/energy/IEnergyStorage.java | 46 - .../cofh/api/energy/ItemEnergyContainer.java | 117 - .../cofh/api/energy/TileEnergyHandler.java | 65 - .../java/cofh/api/energy/package-info.java | 10 - src/main/java/cofh/api/package-info.java | 9 - src/main/java/erogenousbeef/LICENSE.txt | 21 - src/main/java/erogenousbeef/README.txt | 5 - .../coreTR/common/BeefCoreLog.java | 45 - .../coreTR/common/CoordTriplet.java | 213 -- .../multiblock/BlockMultiblockBase.java | 16 - .../coreTR/multiblock/IMultiblockPart.java | 231 -- .../MultiblockClientTickHandler.java | 17 - .../multiblock/MultiblockControllerBase.java | 1268 -------- .../multiblock/MultiblockEventHandler.java | 32 - .../coreTR/multiblock/MultiblockRegistry.java | 179 -- .../MultiblockServerTickHandler.java | 24 - .../multiblock/MultiblockTileEntityBase.java | 437 --- .../MultiblockValidationException.java | 15 - .../multiblock/MultiblockWorldRegistry.java | 538 ---- .../multiblock/rectangular/PartPosition.java | 22 - .../RectangularMultiblockControllerBase.java | 206 -- .../RectangularMultiblockTileEntityBase.java | 132 - .../api/IDeepStorageUnit.java | 35 - src/main/java/techreborn/Core.java | 43 +- .../achievement/AchievementTriggerer.java | 2 + .../achievement/ICraftAchievement.java | 13 - .../achievement/IPickupAchievement.java | 13 - .../techreborn/api/IListInfoProvider.java | 9 - .../java/techreborn/api/TechRebornBlocks.java | 4 +- .../java/techreborn/api/TechRebornItems.java | 4 +- .../api/fuel/FluidPowerManager.java | 14 - .../techreborn/api/fuel/package-info.java | 4 - .../api/power/IEnergyInterfaceItem.java | 2 +- .../techreborn/api/recipe/RecipeCrafter.java | 19 +- .../techreborn/api/recipe/RecipeHandler.java | 8 +- .../api/upgrade/UpgradeHandler.java | 2 +- .../techreborn/asm/ClassTransformation.java | 129 - .../java/techreborn/asm/LoadingPlugin.java | 63 - src/main/java/techreborn/asm/Strippable.java | 18 - .../techreborn/blocks/BlockComputerCube.java | 1 - .../techreborn/blocks/BlockMachineBase.java | 26 +- .../techreborn/blocks/BlockMachineCasing.java | 443 +-- src/main/java/techreborn/blocks/BlockOre.java | 17 +- .../generator/BlockDieselGenerator.java | 4 - .../generator/BlockDragonEggSiphoner.java | 4 - .../blocks/generator/BlockGasTurbine.java | 4 - .../blocks/generator/BlockHeatGenerator.java | 4 - .../blocks/generator/BlockLightningRod.java | 4 - .../generator/BlockMagicEnergyAbsorber.java | 4 - .../generator/BlockMagicEnergyConverter.java | 4 - .../generator/BlockPlasmaGenerator.java | 4 - .../generator/BlockSemiFluidGenerator.java | 4 - .../generator/BlockThermalGenerator.java | 4 - .../blocks/machine/BlockAlloyFurnace.java | 4 +- .../blocks/machine/BlockAlloySmelter.java | 8 +- .../machine/BlockAssemblingMachine.java | 8 +- .../blocks/machine/BlockBlastFurnace.java | 8 +- .../blocks/machine/BlockCentrifuge.java | 36 +- .../blocks/machine/BlockChargeBench.java | 4 +- .../blocks/machine/BlockChemicalReactor.java | 8 +- .../machine/BlockDistillationTower.java | 8 +- .../blocks/machine/BlockGrinder.java | 8 +- .../machine/BlockImplosionCompressor.java | 8 +- .../machine/BlockIndustrialElectrolyzer.java | 8 +- .../machine/BlockIndustrialSawmill.java | 8 +- .../blocks/machine/BlockMatterFabricator.java | 4 - .../blocks/machine/BlockRollingMachine.java | 8 +- .../blocks/machine/BlockVacuumFreezer.java | 8 +- .../blocks/storage/BlockLesuStorage.java | 472 +-- .../java/techreborn/client/GuiHandler.java | 5 +- src/main/java/techreborn/client/GuiUtil.java | 60 - src/main/java/techreborn/client/SlotFake.java | 36 - .../techreborn/client/SlotFilteredVoid.java | 37 - .../java/techreborn/client/SlotFluid.java | 21 - .../java/techreborn/client/SlotInput.java | 20 - .../java/techreborn/client/SlotOutput.java | 20 - .../techreborn/client/StackToolTipEvent.java | 4 +- .../client/VersionCheckerClient.java | 1 + .../client/container/ContainerAesu.java | 5 +- .../container/ContainerAlloyFurnace.java | 13 +- .../container/ContainerAlloySmelter.java | 2 +- .../container/ContainerAssemblingMachine.java | 2 +- .../container/ContainerBlastFurnace.java | 2 +- .../client/container/ContainerCentrifuge.java | 6 +- .../container/ContainerChargeBench.java | 3 +- .../container/ContainerChemicalReactor.java | 2 +- .../container/ContainerChunkloader.java | 3 +- .../client/container/ContainerCrafting.java | 3 +- .../container/ContainerDestructoPack.java | 7 +- .../container/ContainerDieselGenerator.java | 10 +- .../container/ContainerDigitalChest.java | 7 +- .../client/container/ContainerGasTurbine.java | 7 +- .../client/container/ContainerGrinder.java | 2 +- .../client/container/ContainerIDSU.java | 3 +- .../ContainerImplosionCompressor.java | 2 +- .../ContainerIndustrialElectrolyzer.java | 2 +- .../container/ContainerIndustrialSawmill.java | 2 +- .../client/container/ContainerLesu.java | 3 +- .../container/ContainerMatterFabricator.java | 5 +- .../client/container/ContainerPda.java | 3 +- .../container/ContainerQuantumChest.java | 7 +- .../container/ContainerQuantumTank.java | 9 +- .../container/ContainerRollingMachine.java | 20 +- .../ContainerSemifluidGenerator.java | 7 +- .../container/ContainerThermalGenerator.java | 9 +- .../client/container/TechRebornContainer.java | 114 - .../java/techreborn/client/gui/GuiAesu.java | 2 +- .../client/gui/GuiAlloyFurnace.java | 4 +- .../client/gui/GuiBlastFurnace.java | 122 +- .../techreborn/client/gui/GuiCentrifuge.java | 2 +- .../techreborn/client/gui/GuiGrinder.java | 2 +- .../java/techreborn/client/gui/GuiIDSU.java | 62 +- .../client/gui/GuiIndustrialSawmill.java | 2 +- .../client/gui/GuiQuantumChest.java | 2 +- .../client/gui/componets/GuiHiddenButton.java | 44 - .../client/gui/componets/TabIDConfig.java | 13 - .../java/techreborn/client/hud/ChargeHud.java | 2 +- .../keybindings/KeyInputEventHandler.java | 4 +- .../multiblock/IMultiblockRenderHook.java | 28 - .../client/multiblock/Multiblock.java | 152 - .../client/multiblock/MultiblockSet.java | 42 - .../component/MultiblockComponent.java | 67 - .../client/render/MultiblockRenderEvent.java | 151 +- .../client/render/RenderCablePart.java | 9 +- .../CasingConnectedTextureGenerator.java | 13 +- .../client/texture/ConnectedTexture.java | 47 - .../LesuConnectedTextureGenerator.java | 13 +- .../techreborn/cofhLib/audio/SoundBase.java | 172 -- .../java/techreborn/cofhLib/gui/GuiBase.java | 763 ----- .../java/techreborn/cofhLib/gui/GuiBook.java | 10 - .../java/techreborn/cofhLib/gui/GuiColor.java | 107 - .../java/techreborn/cofhLib/gui/GuiProps.java | 18 - .../techreborn/cofhLib/gui/TabTracker.java | 35 - .../cofhLib/gui/element/ElementBase.java | 226 -- .../cofhLib/gui/element/ElementButton.java | 164 - .../gui/element/ElementButtonManaged.java | 77 - .../gui/element/ElementButtonOption.java | 71 - .../gui/element/ElementDualScaled.java | 62 - .../cofhLib/gui/element/ElementListBox.java | 340 --- .../cofhLib/gui/element/ElementSimple.java | 40 - .../cofhLib/gui/element/ElementSlider.java | 186 -- .../cofhLib/gui/element/ElementTextField.java | 640 ---- .../gui/element/ElementTextFieldFiltered.java | 43 - .../gui/element/ElementTextFieldLimited.java | 37 - .../cofhLib/gui/element/TabBase.java | 234 -- .../gui/element/listbox/IListBoxElement.java | 14 - .../element/listbox/ListBoxElementText.java | 39 - .../gui/element/listbox/SliderHorizontal.java | 31 - .../gui/element/listbox/SliderVertical.java | 31 - .../cofhLib/gui/slot/ISlotValidator.java | 17 - .../gui/slot/SlotAcceptAssignable.java | 27 - .../gui/slot/SlotAcceptInsertable.java | 35 - .../cofhLib/gui/slot/SlotAcceptValid.java | 23 - .../cofhLib/gui/slot/SlotCraftingLocked.java | 32 - .../cofhLib/gui/slot/SlotFalseCopy.java | 45 - .../cofhLib/gui/slot/SlotInvisible.java | 57 - .../cofhLib/gui/slot/SlotPotion.java | 24 - .../gui/slot/SlotPotionIngredient.java | 23 - .../cofhLib/gui/slot/SlotRemoveOnly.java | 23 - .../cofhLib/gui/slot/SlotValidated.java | 28 - .../cofhLib/gui/slot/SlotViewOnly.java | 58 - .../cofhLib/render/RenderHelper.java | 176 -- .../cofhLib/util/CharacterSingleton.java | 29 - .../techreborn/cofhLib/util/Rectangle4i.java | 117 - .../cofhLib/util/helpers/MathHelper.java | 206 -- .../cofhLib/util/helpers/StringHelper.java | 222 -- .../command/TechRebornDevCommand.java | 14 +- .../java/techreborn/compat/CompatManager.java | 17 +- .../compat/minetweaker/MTAlloySmelter.java | 192 +- .../minetweaker/MTAssemblingMachine.java | 191 +- .../compat/minetweaker/MTBlastFurnace.java | 191 +- .../compat/minetweaker/MTCentrifuge.java | 304 +- .../compat/minetweaker/MTChemicalReactor.java | 51 +- .../compat/minetweaker/MTGrinder.java | 59 +- .../minetweaker/MTImplosionCompressor.java | 49 +- .../minetweaker/MTIndustrialElectrolyzer.java | 51 +- .../minetweaker/MTIndustrialSawmill.java | 67 +- .../minetweaker/MTPlateCuttingMachine.java | 2 +- .../compat/minetweaker/MinetweakerCompat.java | 88 +- .../recipes/AlloySmelterRecipeHandler.java | 2 +- .../AssemblingMachineRecipeHandler.java | 2 +- .../recipes/BlastFurnaceRecipeHandler.java | 2 +- .../nei/recipes/CentrifugeRecipeHandler.java | 2 +- .../recipes/ChemicalReactorRecipeHandler.java | 2 +- .../nei/recipes/GenericRecipeHander.java | 2 +- .../nei/recipes/GrinderRecipeHandler.java | 4 +- .../ImplosionCompressorRecipeHandler.java | 2 +- .../IndustrialElectrolyzerRecipeHandler.java | 2 +- .../IndustrialSawmillRecipeHandler.java | 2 +- .../compat/recipes/RecipesBiomesOPlenty.java | 116 +- .../compat/recipes/RecipesBuildcraft.java | 24 +- .../compat/recipes/RecipesForestry.java | 3 +- .../techreborn/compat/recipes/RecipesIC2.java | 68 +- .../compat/recipes/RecipesNatura.java | 100 +- .../compat/waila/WailaProviderMachines.java | 4 +- .../techreborn/config/ConfigTechReborn.java | 4 +- .../config/TechRebornConfigGui.java | 2 +- src/main/java/techreborn/init/ModBlocks.java | 6 +- src/main/java/techreborn/init/ModFluids.java | 4 +- src/main/java/techreborn/init/ModItems.java | 8 +- src/main/java/techreborn/init/ModRecipes.java | 2684 ++++++++--------- .../techreborn/itemblocks/ItemBlockBase.java | 33 - .../itemblocks/ItemBlockMachineFrame.java | 1 + .../techreborn/itemblocks/ItemBlockOre.java | 1 + .../itemblocks/ItemBlockStorage.java | 1 + .../itemblocks/ItemBlockStorage2.java | 1 + src/main/java/techreborn/items/ItemCells.java | 4 +- src/main/java/techreborn/items/ItemParts.java | 2 +- .../items/armor/ItemLapotronPack.java | 7 - .../items/armor/ItemLithiumBatpack.java | 7 - .../items/tools/ItemAdvancedDrill.java | 8 +- .../items/tools/ItemCloakingDevice.java | 6 +- .../techreborn/items/tools/ItemOmniTool.java | 10 +- .../items/tools/ItemRockCutter.java | 6 +- src/main/java/techreborn/lib/Functions.java | 45 - src/main/java/techreborn/lib/Location.java | 256 -- src/main/java/techreborn/lib/ModInfo.java | 25 +- .../java/techreborn/lib/vecmath/Vecs3d.java | 435 --- .../techreborn/lib/vecmath/Vecs3dCube.java | 165 - .../multiblocks/MultiBlockCasing.java | 17 +- .../techreborn/packets/AbstractPacket.java | 50 - .../java/techreborn/packets/PacketAesu.java | 1 + .../techreborn/packets/PacketHandler.java | 84 - .../java/techreborn/packets/PacketIdsu.java | 63 +- .../techreborn/packets/PacketPipeline.java | 224 -- .../java/techreborn/packets/SimplePacket.java | 122 - .../java/techreborn/partSystem/IModPart.java | 4 +- .../techreborn/partSystem/IPartProvider.java | 4 +- .../java/techreborn/partSystem/ModPart.java | 2 +- .../partSystem/ModPartRegistry.java | 12 +- .../techreborn/partSystem/ModPartUtils.java | 4 +- .../partSystem/QLib/ModLib2QLib.java | 4 +- .../techreborn/partSystem/QLib/QModPart.java | 6 +- .../partSystem/QLib/QModPartFactory.java | 4 +- .../client/PartPlacementRenderer.java | 4 +- .../techreborn/partSystem/fmp/FMPFactory.java | 9 +- .../techreborn/partSystem/fmp/FMPModPart.java | 13 +- .../partSystem/parts/CableConverter.java | 59 +- .../partSystem/parts/CablePart.java | 8 +- .../techreborn/partSystem/parts/NullPart.java | 4 +- src/main/java/techreborn/pda/GuiManual.java | 294 +- .../java/techreborn/pda/PageCollection.java | 125 +- .../java/techreborn/pda/pages/BasePage.java | 153 +- .../techreborn/pda/pages/ContentsPage.java | 80 +- .../pda/pages/CraftingInfoPage.java | 478 ++- .../java/techreborn/pda/pages/IndexPage.java | 94 +- .../java/techreborn/pda/pages/ItemsPage.java | 113 +- .../techreborn/pda/pages/MultiBlockPage.java | 178 +- .../java/techreborn/pda/pages/TitledPage.java | 28 +- .../techreborn/pda/pages/VersionPage.java | 103 +- .../techreborn/pda/util/GuiButtonAHeight.java | 79 +- .../pda/util/GuiButtonCustomTexture.java | 30 +- .../pda/util/GuiButtonTextOnly.java | 95 +- .../techreborn/powerSystem/PoweredArmor.java | 6 - .../techreborn/powerSystem/PoweredItem.java | 6 - .../powerSystem/PoweredPickaxe.java | 6 - .../powerSystem/RFProviderTile.java | 5 +- .../powerSystem/TilePowerAcceptor.java | 30 +- .../java/techreborn/proxies/ClientProxy.java | 9 +- src/main/java/techreborn/tiles/TileAesu.java | 4 +- .../techreborn/tiles/TileAlloyFurnace.java | 123 +- .../techreborn/tiles/TileAlloySmelter.java | 2 +- .../tiles/TileAssemblingMachine.java | 2 +- .../techreborn/tiles/TileBlastFurnace.java | 10 +- .../java/techreborn/tiles/TileCentrifuge.java | 4 +- .../techreborn/tiles/TileChargeBench.java | 4 +- .../techreborn/tiles/TileChemicalReactor.java | 2 +- .../techreborn/tiles/TileChunkLoader.java | 2 +- .../techreborn/tiles/TileDieselGenerator.java | 44 +- .../techreborn/tiles/TileDigitalChest.java | 6 +- .../tiles/TileDragonEggSiphoner.java | 2 +- .../java/techreborn/tiles/TileGasTurbine.java | 6 +- .../java/techreborn/tiles/TileGrinder.java | 6 +- .../tiles/TileImplosionCompressor.java | 4 +- .../tiles/TileIndustrialElectrolyzer.java | 2 +- .../tiles/TileIndustrialSawmill.java | 10 +- .../techreborn/tiles/TileMachineBase.java | 12 +- .../techreborn/tiles/TileMachineCasing.java | 6 +- .../tiles/TileMatterFabricator.java | 4 +- .../techreborn/tiles/TileQuantumChest.java | 49 +- .../techreborn/tiles/TileQuantumTank.java | 10 +- .../techreborn/tiles/TileRollingMachine.java | 4 +- .../tiles/TileSemifluidGenerator.java | 8 +- .../tiles/TileThermalGenerator.java | 10 +- .../techreborn/tiles/idsu/IDSUManager.java | 2 +- .../java/techreborn/tiles/idsu/TileIDSU.java | 8 +- .../java/techreborn/tiles/lesu/TileLesu.java | 4 +- .../java/techreborn/util/BucketHandler.java | 49 - src/main/java/techreborn/util/Color.java | 44 - .../java/techreborn/util/CraftingHelper.java | 22 - src/main/java/techreborn/util/FluidUtils.java | 73 - src/main/java/techreborn/util/Inventory.java | 164 - src/main/java/techreborn/util/ItemUtils.java | 119 - src/main/java/techreborn/util/LogHelper.java | 45 - src/main/java/techreborn/util/OreDrop.java | 61 - src/main/java/techreborn/util/OreDropSet.java | 24 - src/main/java/techreborn/util/OreUtil.java | 13 - .../java/techreborn/util/RecipeRemover.java | 41 - src/main/java/techreborn/util/Tank.java | 78 - .../java/techreborn/util/TorchHelper.java | 40 - .../java/techreborn/util/VersionChecker.java | 132 - .../{util => utils}/RecipeUtils.java | 6 +- src/main/java/techreborn/world/TROreGen.java | 4 +- src/test/java/techreborn/TechRebornTests.java | 5 +- 313 files changed, 3987 insertions(+), 16508 deletions(-) delete mode 100644 src/main/java/cofh/api/CoFHAPIProps.java delete mode 100644 src/main/java/cofh/api/energy/EnergyStorage.java delete mode 100644 src/main/java/cofh/api/energy/IEnergyConnection.java delete mode 100644 src/main/java/cofh/api/energy/IEnergyContainerItem.java delete mode 100644 src/main/java/cofh/api/energy/IEnergyHandler.java delete mode 100644 src/main/java/cofh/api/energy/IEnergyProvider.java delete mode 100644 src/main/java/cofh/api/energy/IEnergyReceiver.java delete mode 100644 src/main/java/cofh/api/energy/IEnergyStorage.java delete mode 100644 src/main/java/cofh/api/energy/ItemEnergyContainer.java delete mode 100644 src/main/java/cofh/api/energy/TileEnergyHandler.java delete mode 100644 src/main/java/cofh/api/energy/package-info.java delete mode 100644 src/main/java/cofh/api/package-info.java delete mode 100644 src/main/java/erogenousbeef/LICENSE.txt delete mode 100644 src/main/java/erogenousbeef/README.txt delete mode 100644 src/main/java/erogenousbeef/coreTR/common/BeefCoreLog.java delete mode 100644 src/main/java/erogenousbeef/coreTR/common/CoordTriplet.java delete mode 100644 src/main/java/erogenousbeef/coreTR/multiblock/BlockMultiblockBase.java delete mode 100644 src/main/java/erogenousbeef/coreTR/multiblock/IMultiblockPart.java delete mode 100644 src/main/java/erogenousbeef/coreTR/multiblock/MultiblockClientTickHandler.java delete mode 100644 src/main/java/erogenousbeef/coreTR/multiblock/MultiblockControllerBase.java delete mode 100644 src/main/java/erogenousbeef/coreTR/multiblock/MultiblockEventHandler.java delete mode 100644 src/main/java/erogenousbeef/coreTR/multiblock/MultiblockRegistry.java delete mode 100644 src/main/java/erogenousbeef/coreTR/multiblock/MultiblockServerTickHandler.java delete mode 100644 src/main/java/erogenousbeef/coreTR/multiblock/MultiblockTileEntityBase.java delete mode 100644 src/main/java/erogenousbeef/coreTR/multiblock/MultiblockValidationException.java delete mode 100644 src/main/java/erogenousbeef/coreTR/multiblock/MultiblockWorldRegistry.java delete mode 100644 src/main/java/erogenousbeef/coreTR/multiblock/rectangular/PartPosition.java delete mode 100644 src/main/java/erogenousbeef/coreTR/multiblock/rectangular/RectangularMultiblockControllerBase.java delete mode 100644 src/main/java/erogenousbeef/coreTR/multiblock/rectangular/RectangularMultiblockTileEntityBase.java delete mode 100644 src/main/java/powercrystals/minefactoryreloaded/api/IDeepStorageUnit.java delete mode 100644 src/main/java/techreborn/achievement/ICraftAchievement.java delete mode 100644 src/main/java/techreborn/achievement/IPickupAchievement.java delete mode 100644 src/main/java/techreborn/api/IListInfoProvider.java delete mode 100644 src/main/java/techreborn/api/fuel/FluidPowerManager.java delete mode 100644 src/main/java/techreborn/api/fuel/package-info.java delete mode 100644 src/main/java/techreborn/asm/ClassTransformation.java delete mode 100644 src/main/java/techreborn/asm/LoadingPlugin.java delete mode 100644 src/main/java/techreborn/asm/Strippable.java delete mode 100644 src/main/java/techreborn/client/GuiUtil.java delete mode 100644 src/main/java/techreborn/client/SlotFake.java delete mode 100644 src/main/java/techreborn/client/SlotFilteredVoid.java delete mode 100644 src/main/java/techreborn/client/SlotFluid.java delete mode 100644 src/main/java/techreborn/client/SlotInput.java delete mode 100644 src/main/java/techreborn/client/SlotOutput.java delete mode 100644 src/main/java/techreborn/client/container/TechRebornContainer.java delete mode 100644 src/main/java/techreborn/client/gui/componets/GuiHiddenButton.java delete mode 100644 src/main/java/techreborn/client/gui/componets/TabIDConfig.java delete mode 100755 src/main/java/techreborn/client/multiblock/IMultiblockRenderHook.java delete mode 100755 src/main/java/techreborn/client/multiblock/Multiblock.java delete mode 100755 src/main/java/techreborn/client/multiblock/MultiblockSet.java delete mode 100755 src/main/java/techreborn/client/multiblock/component/MultiblockComponent.java delete mode 100644 src/main/java/techreborn/client/texture/ConnectedTexture.java delete mode 100755 src/main/java/techreborn/cofhLib/audio/SoundBase.java delete mode 100755 src/main/java/techreborn/cofhLib/gui/GuiBase.java delete mode 100755 src/main/java/techreborn/cofhLib/gui/GuiBook.java delete mode 100755 src/main/java/techreborn/cofhLib/gui/GuiColor.java delete mode 100755 src/main/java/techreborn/cofhLib/gui/GuiProps.java delete mode 100755 src/main/java/techreborn/cofhLib/gui/TabTracker.java delete mode 100755 src/main/java/techreborn/cofhLib/gui/element/ElementBase.java delete mode 100755 src/main/java/techreborn/cofhLib/gui/element/ElementButton.java delete mode 100755 src/main/java/techreborn/cofhLib/gui/element/ElementButtonManaged.java delete mode 100755 src/main/java/techreborn/cofhLib/gui/element/ElementButtonOption.java delete mode 100755 src/main/java/techreborn/cofhLib/gui/element/ElementDualScaled.java delete mode 100755 src/main/java/techreborn/cofhLib/gui/element/ElementListBox.java delete mode 100755 src/main/java/techreborn/cofhLib/gui/element/ElementSimple.java delete mode 100755 src/main/java/techreborn/cofhLib/gui/element/ElementSlider.java delete mode 100755 src/main/java/techreborn/cofhLib/gui/element/ElementTextField.java delete mode 100755 src/main/java/techreborn/cofhLib/gui/element/ElementTextFieldFiltered.java delete mode 100755 src/main/java/techreborn/cofhLib/gui/element/ElementTextFieldLimited.java delete mode 100755 src/main/java/techreborn/cofhLib/gui/element/TabBase.java delete mode 100755 src/main/java/techreborn/cofhLib/gui/element/listbox/IListBoxElement.java delete mode 100755 src/main/java/techreborn/cofhLib/gui/element/listbox/ListBoxElementText.java delete mode 100755 src/main/java/techreborn/cofhLib/gui/element/listbox/SliderHorizontal.java delete mode 100755 src/main/java/techreborn/cofhLib/gui/element/listbox/SliderVertical.java delete mode 100755 src/main/java/techreborn/cofhLib/gui/slot/ISlotValidator.java delete mode 100755 src/main/java/techreborn/cofhLib/gui/slot/SlotAcceptAssignable.java delete mode 100755 src/main/java/techreborn/cofhLib/gui/slot/SlotAcceptInsertable.java delete mode 100755 src/main/java/techreborn/cofhLib/gui/slot/SlotAcceptValid.java delete mode 100755 src/main/java/techreborn/cofhLib/gui/slot/SlotCraftingLocked.java delete mode 100755 src/main/java/techreborn/cofhLib/gui/slot/SlotFalseCopy.java delete mode 100755 src/main/java/techreborn/cofhLib/gui/slot/SlotInvisible.java delete mode 100755 src/main/java/techreborn/cofhLib/gui/slot/SlotPotion.java delete mode 100755 src/main/java/techreborn/cofhLib/gui/slot/SlotPotionIngredient.java delete mode 100755 src/main/java/techreborn/cofhLib/gui/slot/SlotRemoveOnly.java delete mode 100755 src/main/java/techreborn/cofhLib/gui/slot/SlotValidated.java delete mode 100755 src/main/java/techreborn/cofhLib/gui/slot/SlotViewOnly.java delete mode 100755 src/main/java/techreborn/cofhLib/render/RenderHelper.java delete mode 100755 src/main/java/techreborn/cofhLib/util/CharacterSingleton.java delete mode 100755 src/main/java/techreborn/cofhLib/util/Rectangle4i.java delete mode 100755 src/main/java/techreborn/cofhLib/util/helpers/MathHelper.java delete mode 100755 src/main/java/techreborn/cofhLib/util/helpers/StringHelper.java delete mode 100644 src/main/java/techreborn/itemblocks/ItemBlockBase.java delete mode 100644 src/main/java/techreborn/lib/Functions.java delete mode 100644 src/main/java/techreborn/lib/Location.java delete mode 100644 src/main/java/techreborn/lib/vecmath/Vecs3d.java delete mode 100644 src/main/java/techreborn/lib/vecmath/Vecs3dCube.java delete mode 100644 src/main/java/techreborn/packets/AbstractPacket.java delete mode 100644 src/main/java/techreborn/packets/PacketHandler.java delete mode 100644 src/main/java/techreborn/packets/PacketPipeline.java delete mode 100644 src/main/java/techreborn/packets/SimplePacket.java delete mode 100644 src/main/java/techreborn/util/BucketHandler.java delete mode 100644 src/main/java/techreborn/util/Color.java delete mode 100644 src/main/java/techreborn/util/CraftingHelper.java delete mode 100644 src/main/java/techreborn/util/FluidUtils.java delete mode 100644 src/main/java/techreborn/util/Inventory.java delete mode 100644 src/main/java/techreborn/util/ItemUtils.java delete mode 100644 src/main/java/techreborn/util/LogHelper.java delete mode 100644 src/main/java/techreborn/util/OreDrop.java delete mode 100644 src/main/java/techreborn/util/OreDropSet.java delete mode 100644 src/main/java/techreborn/util/OreUtil.java delete mode 100644 src/main/java/techreborn/util/RecipeRemover.java delete mode 100644 src/main/java/techreborn/util/Tank.java delete mode 100644 src/main/java/techreborn/util/TorchHelper.java delete mode 100644 src/main/java/techreborn/util/VersionChecker.java rename src/main/java/techreborn/{util => utils}/RecipeUtils.java (75%) diff --git a/build.gradle b/build.gradle index 0cc73ea70..455bf5617 100644 --- a/build.gradle +++ b/build.gradle @@ -116,8 +116,9 @@ dependencies { compile 'Azanor:Thaumcraft:4.2.3.5:deobf@jar' compile "com.github.azanor:baubles:1.0.1.10:deobf@jar" compile name: "MineTweaker3", version: "1.7.10-3.0.9C", classifier: "Dev" - shade 'IC2-Classic-API-STANDALONE:IC2-Classic-API-STANDALONE:1.1.0.19-5:api' - + shade 'IC2-Classic-API-STANDALONE:IC2-Classic-API-STANDALONE:0.0.0.1:dev' + compile 'RebornCore:RebornCore:1.1.0.19-5:api' + testCompile 'junit:junit:4.12' } @@ -151,10 +152,6 @@ task deobfJar(type: Jar) { } jar { - manifest { - attributes 'FMLCorePlugin': 'techreborn.asm.LoadingPlugin' - attributes 'FMLCorePluginContainsFMLMod': 'true' - } exclude "**/*.psd" classifier = 'universal' configurations.shade.each { dep -> diff --git a/gourceVis.bat b/gourceVis.bat index 658963b49..61c22856a 100644 --- a/gourceVis.bat +++ b/gourceVis.bat @@ -1,2 +1,2 @@ -gource -f -1920x1080 --seconds-per-day 4 --auto-skip-seconds 1 --key --title "TechReborn" +gource -f -1920x1080 --seconds-per-day 1 --auto-skip-seconds 1 --key --title "TechReborn" --camera-mode overview --multi-sampling --hide filenames,mouse --file-idle-time 0 --bloom-multiplier 0.05 --bloom-intensity 0.75 pause \ No newline at end of file diff --git a/src/main/java/cofh/api/CoFHAPIProps.java b/src/main/java/cofh/api/CoFHAPIProps.java deleted file mode 100644 index 9b528304a..000000000 --- a/src/main/java/cofh/api/CoFHAPIProps.java +++ /dev/null @@ -1,11 +0,0 @@ -package cofh.api; - -public class CoFHAPIProps { - - private CoFHAPIProps() { - - } - - public static final String VERSION = "1.7.10R1.0.2"; - -} diff --git a/src/main/java/cofh/api/energy/EnergyStorage.java b/src/main/java/cofh/api/energy/EnergyStorage.java deleted file mode 100644 index d1ac57706..000000000 --- a/src/main/java/cofh/api/energy/EnergyStorage.java +++ /dev/null @@ -1,158 +0,0 @@ -package cofh.api.energy; - -import net.minecraft.nbt.NBTTagCompound; - -/** - * Reference implementation of {@link cofh.api.energy.IEnergyStorage}. Use/extend this or implement your own. - * - * @author King Lemming - * - */ -public class EnergyStorage implements IEnergyStorage { - - protected int energy; - protected int capacity; - protected int maxReceive; - protected int maxExtract; - - public EnergyStorage(int capacity) { - - this(capacity, capacity, capacity); - } - - public EnergyStorage(int capacity, int maxTransfer) { - - this(capacity, maxTransfer, maxTransfer); - } - - public EnergyStorage(int capacity, int maxReceive, int maxExtract) { - - this.capacity = capacity; - this.maxReceive = maxReceive; - this.maxExtract = maxExtract; - } - - public EnergyStorage readFromNBT(NBTTagCompound nbt) { - - this.energy = nbt.getInteger("Energy"); - - if (energy > capacity) { - energy = capacity; - } - return this; - } - - public NBTTagCompound writeToNBT(NBTTagCompound nbt) { - - if (energy < 0) { - energy = 0; - } - nbt.setInteger("Energy", energy); - return nbt; - } - - public void setCapacity(int capacity) { - - this.capacity = capacity; - - if (energy > capacity) { - energy = capacity; - } - } - - public void setMaxTransfer(int maxTransfer) { - - setMaxReceive(maxTransfer); - setMaxExtract(maxTransfer); - } - - public void setMaxReceive(int maxReceive) { - - this.maxReceive = maxReceive; - } - - public void setMaxExtract(int maxExtract) { - - this.maxExtract = maxExtract; - } - - public int getMaxReceive() { - - return maxReceive; - } - - public int getMaxExtract() { - - return maxExtract; - } - - /** - * This function is included to allow for server -> client sync. Do not call this externally to the containing Tile Entity, as not all IEnergyHandlers - * are guaranteed to have it. - * - * @param energy - */ - public void setEnergyStored(int energy) { - - this.energy = energy; - - if (this.energy > capacity) { - this.energy = capacity; - } else if (this.energy < 0) { - this.energy = 0; - } - } - - /** - * This function is included to allow the containing tile to directly and efficiently modify the energy contained in the EnergyStorage. Do not rely on this - * externally, as not all IEnergyHandlers are guaranteed to have it. - * - * @param energy - */ - public void modifyEnergyStored(int energy) { - - this.energy += energy; - - if (this.energy > capacity) { - this.energy = capacity; - } else if (this.energy < 0) { - this.energy = 0; - } - } - - /* IEnergyStorage */ - @Override - public int receiveEnergy(int maxReceive, boolean simulate) { - - int energyReceived = Math.min(capacity - energy, Math.min(this.maxReceive, maxReceive)); - - if (!simulate) { - energy += energyReceived; - } - return energyReceived; - } - - @Override - public int extractEnergy(int maxExtract, boolean simulate) { - - int energyExtracted = Math.min(energy, Math.min(this.maxExtract, maxExtract)); - - if (!simulate) { - energy -= energyExtracted; - } - return energyExtracted; - } - - @Override - public int getEnergyStored() { - - return energy; - } - - @Override - public int getMaxEnergyStored() { - - return capacity; - } - -} diff --git a/src/main/java/cofh/api/energy/IEnergyConnection.java b/src/main/java/cofh/api/energy/IEnergyConnection.java deleted file mode 100644 index 0858bf170..000000000 --- a/src/main/java/cofh/api/energy/IEnergyConnection.java +++ /dev/null @@ -1,21 +0,0 @@ -package cofh.api.energy; - -import net.minecraftforge.common.util.ForgeDirection; - -/** - * Implement this interface on TileEntities which should connect to energy transportation blocks. This is intended for blocks which generate energy but do not - * accept it; otherwise just use IEnergyHandler. - *

- * Note that {@link cofh.api.energy.IEnergyHandler} is an extension of this. - * - * @author King Lemming - * - */ -public interface IEnergyConnection { - - /** - * Returns TRUE if the TileEntity can connect on a given side. - */ - boolean canConnectEnergy(ForgeDirection from); - -} diff --git a/src/main/java/cofh/api/energy/IEnergyContainerItem.java b/src/main/java/cofh/api/energy/IEnergyContainerItem.java deleted file mode 100644 index 0dcb533bd..000000000 --- a/src/main/java/cofh/api/energy/IEnergyContainerItem.java +++ /dev/null @@ -1,52 +0,0 @@ -package cofh.api.energy; - -import net.minecraft.item.ItemStack; - -/** - * Implement this interface on Item classes that support external manipulation of their internal energy storages. - *

- * A reference implementation is provided {@link cofh.api.energy.ItemEnergyContainer}. - * - * @author King Lemming - * - */ -public interface IEnergyContainerItem { - - /** - * Adds energy to a container item. Returns the quantity of energy that was accepted. This should always return 0 if the item cannot be externally charged. - * - * @param container - * ItemStack to be charged. - * @param maxReceive - * Maximum amount of energy to be sent into the item. - * @param simulate - * If TRUE, the charge will only be simulated. - * @return Amount of energy that was (or would have been, if simulated) received by the item. - */ - int receiveEnergy(ItemStack container, int maxReceive, boolean simulate); - - /** - * Removes energy from a container item. Returns the quantity of energy that was removed. This should always return 0 if the item cannot be externally - * discharged. - * - * @param container - * ItemStack to be discharged. - * @param maxExtract - * Maximum amount of energy to be extracted from the item. - * @param simulate - * If TRUE, the discharge will only be simulated. - * @return Amount of energy that was (or would have been, if simulated) extracted from the item. - */ - int extractEnergy(ItemStack container, int maxExtract, boolean simulate); - - /** - * Get the amount of energy currently stored in the container item. - */ - int getEnergyStored(ItemStack container); - - /** - * Get the max amount of energy that can be stored in the container item. - */ - int getMaxEnergyStored(ItemStack container); - -} diff --git a/src/main/java/cofh/api/energy/IEnergyHandler.java b/src/main/java/cofh/api/energy/IEnergyHandler.java deleted file mode 100644 index 3e9d46cba..000000000 --- a/src/main/java/cofh/api/energy/IEnergyHandler.java +++ /dev/null @@ -1,58 +0,0 @@ -package cofh.api.energy; - -import net.minecraftforge.common.util.ForgeDirection; - -/** - * Implement this interface on Tile Entities which should handle energy, generally storing it in one or more internal {@link cofh.api.energy.IEnergyStorage} objects. - *

- * A reference implementation is provided {@link cofh.api.energy.TileEnergyHandler}. - * - * @author King Lemming - * - */ -public interface IEnergyHandler extends IEnergyProvider, IEnergyReceiver { - - // merely a convenience interface (remove these methods in 1.8; provided here for back-compat via compiler doing things) - - /** - * Add energy to an IEnergyReceiver, internal distribution is left entirely to the IEnergyReceiver. - * - * @param from - * Orientation the energy is received from. - * @param maxReceive - * Maximum amount of energy to receive. - * @param simulate - * If TRUE, the charge will only be simulated. - * @return Amount of energy that was (or would have been, if simulated) received. - */ - @Override - int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate); - - /** - * Remove energy from an IEnergyProvider, internal distribution is left entirely to the IEnergyProvider. - * - * @param from - * Orientation the energy is extracted from. - * @param maxExtract - * Maximum amount of energy to extract. - * @param simulate - * If TRUE, the extraction will only be simulated. - * @return Amount of energy that was (or would have been, if simulated) extracted. - */ - @Override - int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate); - - - /** - * Returns the amount of energy currently stored. - */ - @Override - int getEnergyStored(ForgeDirection from); - - /** - * Returns the maximum amount of energy that can be stored. - */ - @Override - int getMaxEnergyStored(ForgeDirection from); - -} diff --git a/src/main/java/cofh/api/energy/IEnergyProvider.java b/src/main/java/cofh/api/energy/IEnergyProvider.java deleted file mode 100644 index f7f0280a1..000000000 --- a/src/main/java/cofh/api/energy/IEnergyProvider.java +++ /dev/null @@ -1,38 +0,0 @@ -package cofh.api.energy; - -import net.minecraftforge.common.util.ForgeDirection; - -/** - * Implement this interface on Tile Entities which should provide energy, generally storing it in one or more internal {@link cofh.api.energy.IEnergyStorage} objects. - *

- * A reference implementation is provided {@link cofh.api.energy.TileEnergyHandler}. - * - * @author King Lemming - * - */ -public interface IEnergyProvider extends IEnergyConnection { - - /** - * Remove energy from an IEnergyProvider, internal distribution is left entirely to the IEnergyProvider. - * - * @param from - * Orientation the energy is extracted from. - * @param maxExtract - * Maximum amount of energy to extract. - * @param simulate - * If TRUE, the extraction will only be simulated. - * @return Amount of energy that was (or would have been, if simulated) extracted. - */ - int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate); - - /** - * Returns the amount of energy currently stored. - */ - int getEnergyStored(ForgeDirection from); - - /** - * Returns the maximum amount of energy that can be stored. - */ - int getMaxEnergyStored(ForgeDirection from); - -} diff --git a/src/main/java/cofh/api/energy/IEnergyReceiver.java b/src/main/java/cofh/api/energy/IEnergyReceiver.java deleted file mode 100644 index 89d4cecf1..000000000 --- a/src/main/java/cofh/api/energy/IEnergyReceiver.java +++ /dev/null @@ -1,38 +0,0 @@ -package cofh.api.energy; - -import net.minecraftforge.common.util.ForgeDirection; - -/** - * Implement this interface on Tile Entities which should receive energy, generally storing it in one or more internal {@link cofh.api.energy.IEnergyStorage} objects. - *

- * A reference implementation is provided {@link cofh.api.energy.TileEnergyHandler}. - * - * @author King Lemming - * - */ -public interface IEnergyReceiver extends IEnergyConnection { - - /** - * Add energy to an IEnergyReceiver, internal distribution is left entirely to the IEnergyReceiver. - * - * @param from - * Orientation the energy is received from. - * @param maxReceive - * Maximum amount of energy to receive. - * @param simulate - * If TRUE, the charge will only be simulated. - * @return Amount of energy that was (or would have been, if simulated) received. - */ - int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate); - - /** - * Returns the amount of energy currently stored. - */ - int getEnergyStored(ForgeDirection from); - - /** - * Returns the maximum amount of energy that can be stored. - */ - int getMaxEnergyStored(ForgeDirection from); - -} diff --git a/src/main/java/cofh/api/energy/IEnergyStorage.java b/src/main/java/cofh/api/energy/IEnergyStorage.java deleted file mode 100644 index 85d4f5471..000000000 --- a/src/main/java/cofh/api/energy/IEnergyStorage.java +++ /dev/null @@ -1,46 +0,0 @@ -package cofh.api.energy; - -/** - * An energy storage is the unit of interaction with Energy inventories.
- * This is not to be implemented on TileEntities. This is for internal use only. - *

- * A reference implementation can be found at {@link cofh.api.energy.EnergyStorage}. - * - * @author King Lemming - * - */ -public interface IEnergyStorage { - - /** - * Adds energy to the storage. Returns quantity of energy that was accepted. - * - * @param maxReceive - * Maximum amount of energy to be inserted. - * @param simulate - * If TRUE, the insertion will only be simulated. - * @return Amount of energy that was (or would have been, if simulated) accepted by the storage. - */ - int receiveEnergy(int maxReceive, boolean simulate); - - /** - * Removes energy from the storage. Returns quantity of energy that was removed. - * - * @param maxExtract - * Maximum amount of energy to be extracted. - * @param simulate - * If TRUE, the extraction will only be simulated. - * @return Amount of energy that was (or would have been, if simulated) extracted from the storage. - */ - int extractEnergy(int maxExtract, boolean simulate); - - /** - * Returns the amount of energy currently stored. - */ - int getEnergyStored(); - - /** - * Returns the maximum amount of energy that can be stored. - */ - int getMaxEnergyStored(); - -} diff --git a/src/main/java/cofh/api/energy/ItemEnergyContainer.java b/src/main/java/cofh/api/energy/ItemEnergyContainer.java deleted file mode 100644 index 890f95b93..000000000 --- a/src/main/java/cofh/api/energy/ItemEnergyContainer.java +++ /dev/null @@ -1,117 +0,0 @@ -package cofh.api.energy; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; - -import java.util.List; - -/** - * Reference implementation of {@link cofh.api.energy.IEnergyContainerItem}. Use/extend this or implement your own. - * - * @author King Lemming - * - */ -public class ItemEnergyContainer extends Item implements IEnergyContainerItem { - - protected int capacity; - protected int maxReceive; - protected int maxExtract; - - public ItemEnergyContainer() { - - } - - public ItemEnergyContainer(int capacity) { - - this(capacity, capacity, capacity); - } - - public ItemEnergyContainer(int capacity, int maxTransfer) { - - this(capacity, maxTransfer, maxTransfer); - } - - public ItemEnergyContainer(int capacity, int maxReceive, int maxExtract) { - - this.capacity = capacity; - this.maxReceive = maxReceive; - this.maxExtract = maxExtract; - } - - public ItemEnergyContainer setCapacity(int capacity) { - - this.capacity = capacity; - return this; - } - - public void setMaxTransfer(int maxTransfer) { - - setMaxReceive(maxTransfer); - setMaxExtract(maxTransfer); - } - - public void setMaxReceive(int maxReceive) { - - this.maxReceive = maxReceive; - } - - public void setMaxExtract(int maxExtract) { - - this.maxExtract = maxExtract; - } - - /* IEnergyContainerItem */ - @Override - public int receiveEnergy(ItemStack container, int maxReceive, boolean simulate) { - - if (container.stackTagCompound == null) { - container.stackTagCompound = new NBTTagCompound(); - } - int energy = container.stackTagCompound.getInteger("Energy"); - int energyReceived = Math.min(capacity - energy, Math.min(this.maxReceive, maxReceive)); - - if (!simulate) { - energy += energyReceived; - container.stackTagCompound.setInteger("Energy", energy); - } - return energyReceived; - } - - @Override - public int extractEnergy(ItemStack container, int maxExtract, boolean simulate) { - - if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) { - return 0; - } - int energy = container.stackTagCompound.getInteger("Energy"); - int energyExtracted = Math.min(energy, Math.min(this.maxExtract, maxExtract)); - - if (!simulate) { - energy -= energyExtracted; - container.stackTagCompound.setInteger("Energy", energy); - } - return energyExtracted; - } - - @Override - public int getEnergyStored(ItemStack container) { - - if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) { - return 0; - } - return container.stackTagCompound.getInteger("Energy"); - } - - @Override - public int getMaxEnergyStored(ItemStack container) { - - return capacity; - } - - @Override - public void addInformation(ItemStack itemStack, EntityPlayer p_77624_2_, List list, boolean p_77624_4_) { - list.add(Integer.toString(getEnergyStored(itemStack)) + "/"); - } -} diff --git a/src/main/java/cofh/api/energy/TileEnergyHandler.java b/src/main/java/cofh/api/energy/TileEnergyHandler.java deleted file mode 100644 index 0f642cc59..000000000 --- a/src/main/java/cofh/api/energy/TileEnergyHandler.java +++ /dev/null @@ -1,65 +0,0 @@ -package cofh.api.energy; - -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.util.ForgeDirection; - -/** - * Reference implementation of {@link cofh.api.energy.IEnergyHandler}. Use/extend this or implement your own. - * - * @author King Lemming - * - */ -public class TileEnergyHandler extends TileEntity implements IEnergyHandler { - - protected EnergyStorage storage = new EnergyStorage(32000); - - @Override - public void readFromNBT(NBTTagCompound nbt) { - - super.readFromNBT(nbt); - storage.readFromNBT(nbt); - } - - @Override - public void writeToNBT(NBTTagCompound nbt) { - - super.writeToNBT(nbt); - storage.writeToNBT(nbt); - } - - /* IEnergyConnection */ - @Override - public boolean canConnectEnergy(ForgeDirection from) { - - return true; - } - - /* IEnergyReceiver */ - @Override - public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate) { - - return storage.receiveEnergy(maxReceive, simulate); - } - - /* IEnergyProvider */ - @Override - public int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate) { - - return storage.extractEnergy(maxExtract, simulate); - } - - /* IEnergyReceiver and IEnergyProvider */ - @Override - public int getEnergyStored(ForgeDirection from) { - - return storage.getEnergyStored(); - } - - @Override - public int getMaxEnergyStored(ForgeDirection from) { - - return storage.getMaxEnergyStored(); - } - -} diff --git a/src/main/java/cofh/api/energy/package-info.java b/src/main/java/cofh/api/energy/package-info.java deleted file mode 100644 index 7379702b8..000000000 --- a/src/main/java/cofh/api/energy/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -/** - * (C) 2014 Team CoFH / CoFH / Cult of the Full Hub - * http://www.teamcofh.com - */ -@API(apiVersion = CoFHAPIProps.VERSION, owner = "CoFHAPI", provides = "CoFHAPI|energy") -package cofh.api.energy; - -import cofh.api.CoFHAPIProps; -import cpw.mods.fml.common.API; - diff --git a/src/main/java/cofh/api/package-info.java b/src/main/java/cofh/api/package-info.java deleted file mode 100644 index 08ff5fcb6..000000000 --- a/src/main/java/cofh/api/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -/** - * (C) 2014 Team CoFH / CoFH / Cult of the Full Hub - * http://www.teamcofh.com - */ -@API(apiVersion = CoFHAPIProps.VERSION, owner = "CoFHLib", provides = "CoFHAPI") -package cofh.api; - -import cpw.mods.fml.common.API; - diff --git a/src/main/java/erogenousbeef/LICENSE.txt b/src/main/java/erogenousbeef/LICENSE.txt deleted file mode 100644 index 4c6ffd00f..000000000 --- a/src/main/java/erogenousbeef/LICENSE.txt +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2013 "Erogenous Beef" - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff --git a/src/main/java/erogenousbeef/README.txt b/src/main/java/erogenousbeef/README.txt deleted file mode 100644 index ece451511..000000000 --- a/src/main/java/erogenousbeef/README.txt +++ /dev/null @@ -1,5 +0,0 @@ -This code is not ours! We are using BeefCore. - -https://github.com/erogenousbeef/BeefCore - -For Licence infomation look at https://github.com/erogenousbeef/BeefCore/blob/master/README.md \ No newline at end of file diff --git a/src/main/java/erogenousbeef/coreTR/common/BeefCoreLog.java b/src/main/java/erogenousbeef/coreTR/common/BeefCoreLog.java deleted file mode 100644 index 96debaced..000000000 --- a/src/main/java/erogenousbeef/coreTR/common/BeefCoreLog.java +++ /dev/null @@ -1,45 +0,0 @@ -package erogenousbeef.coreTR.common; - -import org.apache.logging.log4j.Level; - -import cpw.mods.fml.common.FMLLog; - -public class BeefCoreLog { - - private static final String CHANNEL = "BeefCore"; - - public static void log(Level level, String format, Object... data) - { - FMLLog.log(level, format, data); - } - - public static void fatal(String format, Object... data) - { - log(Level.FATAL, format, data); - } - - public static void error(String format, Object... data) - { - log(Level.ERROR, format, data); - } - - public static void warning(String format, Object... data) - { - log(Level.WARN, format, data); - } - - public static void info(String format, Object... data) - { - log(Level.INFO, format, data); - } - - public static void debug(String format, Object... data) - { - log(Level.DEBUG, format, data); - } - - public static void trace(String format, Object... data) - { - log(Level.TRACE, format, data); - } -} diff --git a/src/main/java/erogenousbeef/coreTR/common/CoordTriplet.java b/src/main/java/erogenousbeef/coreTR/common/CoordTriplet.java deleted file mode 100644 index c5a821fc7..000000000 --- a/src/main/java/erogenousbeef/coreTR/common/CoordTriplet.java +++ /dev/null @@ -1,213 +0,0 @@ -package erogenousbeef.coreTR.common; - -import net.minecraft.world.ChunkCoordIntPair; -import net.minecraftforge.common.util.ForgeDirection; - -/* - * Simple wrapper class for XYZ coordinates. - */ -public class CoordTriplet implements Comparable { - public int x, y, z; - - public CoordTriplet(int x, int y, int z) - { - this.x = x; - this.y = y; - this.z = z; - } - - public int getChunkX() - { - return x >> 4; - } - - public int getChunkZ() - { - return z >> 4; - } - - public long getChunkXZHash() - { - return ChunkCoordIntPair.chunkXZ2Int(x >> 4, z >> 4); - } - - @Override - public boolean equals(Object other) - { - if (other == null) - { - return false; - } else if (other instanceof CoordTriplet) - { - CoordTriplet otherTriplet = (CoordTriplet) other; - return this.x == otherTriplet.x && this.y == otherTriplet.y - && this.z == otherTriplet.z; - } else - { - return false; - } - } - - public void translate(ForgeDirection dir) - { - this.x += dir.offsetX; - this.y += dir.offsetY; - this.z += dir.offsetZ; - } - - public boolean equals(int x, int y, int z) - { - return this.x == x && this.y == y && this.z == z; - } - - // Suggested implementation from NetBeans 7.1 - public int hashCode() - { - int hash = 7; - hash = 71 * hash + this.x; - hash = 71 * hash + this.y; - hash = 71 * hash + this.z; - return hash; - } - - public CoordTriplet copy() - { - return new CoordTriplet(x, y, z); - } - - public void copy(CoordTriplet other) - { - this.x = other.x; - this.y = other.y; - this.z = other.z; - } - - public CoordTriplet[] getNeighbors() - { - return new CoordTriplet[] - { new CoordTriplet(x + 1, y, z), new CoordTriplet(x - 1, y, z), - new CoordTriplet(x, y + 1, z), new CoordTriplet(x, y - 1, z), - new CoordTriplet(x, y, z + 1), new CoordTriplet(x, y, z - 1) }; - } - - // /// IComparable - - @Override - public int compareTo(Object o) - { - if (o instanceof CoordTriplet) - { - CoordTriplet other = (CoordTriplet) o; - if (this.x < other.x) - { - return -1; - } else if (this.x > other.x) - { - return 1; - } else if (this.y < other.y) - { - return -1; - } else if (this.y > other.y) - { - return 1; - } else if (this.z < other.z) - { - return -1; - } else if (this.z > other.z) - { - return 1; - } else - { - return 0; - } - } - return 0; - } - - // /// Really confusing code that should be cleaned up - - public ForgeDirection getDirectionFromSourceCoords(int x, int y, int z) - { - if (this.x < x) - { - return ForgeDirection.WEST; - } else if (this.x > x) - { - return ForgeDirection.EAST; - } else if (this.y < y) - { - return ForgeDirection.DOWN; - } else if (this.y > y) - { - return ForgeDirection.UP; - } else if (this.z < z) - { - return ForgeDirection.SOUTH; - } else if (this.z > z) - { - return ForgeDirection.NORTH; - } else - { - return ForgeDirection.UNKNOWN; - } - } - - public ForgeDirection getOppositeDirectionFromSourceCoords(int x, int y, - int z) - { - if (this.x < x) - { - return ForgeDirection.EAST; - } else if (this.x > x) - { - return ForgeDirection.WEST; - } else if (this.y < y) - { - return ForgeDirection.UP; - } else if (this.y > y) - { - return ForgeDirection.DOWN; - } else if (this.z < z) - { - return ForgeDirection.NORTH; - } else if (this.z > z) - { - return ForgeDirection.SOUTH; - } else - { - return ForgeDirection.UNKNOWN; - } - } - - @Override - public String toString() - { - return String.format("(%d, %d, %d)", this.x, this.y, this.z); - } - - public int compareTo(int xCoord, int yCoord, int zCoord) - { - if (this.x < xCoord) - { - return -1; - } else if (this.x > xCoord) - { - return 1; - } else if (this.y < yCoord) - { - return -1; - } else if (this.y > yCoord) - { - return 1; - } else if (this.z < zCoord) - { - return -1; - } else if (this.z > zCoord) - { - return 1; - } else - { - return 0; - } - } -} diff --git a/src/main/java/erogenousbeef/coreTR/multiblock/BlockMultiblockBase.java b/src/main/java/erogenousbeef/coreTR/multiblock/BlockMultiblockBase.java deleted file mode 100644 index f9263c542..000000000 --- a/src/main/java/erogenousbeef/coreTR/multiblock/BlockMultiblockBase.java +++ /dev/null @@ -1,16 +0,0 @@ -package erogenousbeef.coreTR.multiblock; - -import net.minecraft.block.BlockContainer; -import net.minecraft.block.material.Material; - -/* - * Base class for multiblock-capable blocks. This is only a reference implementation - * and can be safely ignored. - */ -public abstract class BlockMultiblockBase extends BlockContainer { - - protected BlockMultiblockBase(Material material) - { - super(material); - } -} diff --git a/src/main/java/erogenousbeef/coreTR/multiblock/IMultiblockPart.java b/src/main/java/erogenousbeef/coreTR/multiblock/IMultiblockPart.java deleted file mode 100644 index 93b5506fe..000000000 --- a/src/main/java/erogenousbeef/coreTR/multiblock/IMultiblockPart.java +++ /dev/null @@ -1,231 +0,0 @@ -package erogenousbeef.coreTR.multiblock; - -import java.util.Set; - -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import erogenousbeef.coreTR.common.CoordTriplet; - -/** - * Basic interface for a multiblock machine part. This is defined as an abstract - * class as we need the basic functionality of a TileEntity as well. Preferably, - * you should derive from MultiblockTileEntityBase, which does all the hard work - * for you. - * - * {@link erogenousbeef.coreTR.multiblock.MultiblockTileEntityBase} - */ -public abstract class IMultiblockPart extends TileEntity { - public static final int INVALID_DISTANCE = Integer.MAX_VALUE; - - /** - * @return True if this block is connected to a multiblock controller. False - * otherwise. - */ - public abstract boolean isConnected(); - - /** - * @return The attached multiblock controller for this tile entity. - */ - public abstract MultiblockControllerBase getMultiblockController(); - - /** - * Returns the location of this tile entity in the world, in CoordTriplet - * form. - * - * @return A CoordTriplet with its x,y,z members set to the location of this - * tile entity in the world. - */ - public abstract CoordTriplet getWorldLocation(); - - // Multiblock connection-logic callbacks - - /** - * Called after this block has been attached to a new multiblock controller. - * - * @param newController - * The new multiblock controller to which this tile entity is - * attached. - */ - public abstract void onAttached(MultiblockControllerBase newController); - - /** - * Called after this block has been detached from a multiblock controller. - * - * @param multiblockController - * The multiblock controller that no longer controls this tile - * entity. - */ - public abstract void onDetached( - MultiblockControllerBase multiblockController); - - /** - * Called when this block is being orphaned. Use this to copy game-data - * values that should persist despite a machine being broken. This should - * NOT mark the part as disconnected. onDetached will be called immediately - * afterwards. - * - * @see #onDetached(MultiblockControllerBase) - * @param oldController - * The controller which is orphaning this block. - * @param oldControllerSize - * The number of connected blocks in the controller prior to - * shedding orphans. - * @param newControllerSize - * The number of connected blocks in the controller after - * shedding orphans. - */ - public abstract void onOrphaned(MultiblockControllerBase oldController, - int oldControllerSize, int newControllerSize); - - // Multiblock fuse/split helper methods. Here there be dragons. - /** - * Factory method. Creates a new multiblock controller and returns it. Does - * not attach this tile entity to it. Override this in your game code! - * - * @return A new Multiblock Controller, derived from - * MultiblockControllerBase. - */ - public abstract MultiblockControllerBase createNewMultiblock(); - - /** - * Retrieve the type of multiblock controller which governs this part. Used - * to ensure that incompatible multiblocks are not merged. - * - * @return The class/type of the multiblock controller which governs this - * type of part. - */ - public abstract Class getMultiblockControllerType(); - - /** - * Called when this block is moved from its current controller into a new - * controller. A special case of attach/detach, done here for efficiency to - * avoid triggering lots of recalculation logic. - * - * @param newController - * The new controller into which this tile entity is being - * merged. - */ - public abstract void onAssimilated(MultiblockControllerBase newController); - - // Multiblock connection data access. - // You generally shouldn't toy with these! - // They're for use by Multiblock Controllers. - - /** - * Set that this block has been visited by your validation algorithms. - */ - public abstract void setVisited(); - - /** - * Set that this block has not been visited by your validation algorithms; - */ - public abstract void setUnvisited(); - - /** - * @return True if this block has been visited by your validation algorithms - * since the last reset. - */ - public abstract boolean isVisited(); - - /** - * Called when this block becomes the designated block for saving data and - * transmitting data across the wire. - */ - public abstract void becomeMultiblockSaveDelegate(); - - /** - * Called when this block is no longer the designated block for saving data - * and transmitting data across the wire. - */ - public abstract void forfeitMultiblockSaveDelegate(); - - /** - * Is this block the designated save/load & network delegate? - */ - public abstract boolean isMultiblockSaveDelegate(); - - /** - * Returns an array containing references to neighboring IMultiblockPart - * tile entities. Primarily a utility method. Only works after tileentity - * construction, so it cannot be used in - * MultiblockControllerBase::attachBlock. - * - * This method is chunk-safe on the server; it will not query for parts in - * chunks that are unloaded. Note that no method is chunk-safe on the - * client, because ChunkProviderClient is stupid. - * - * @return An array of references to neighboring IMultiblockPart tile - * entities. - */ - public abstract IMultiblockPart[] getNeighboringParts(); - - // Multiblock business-logic callbacks - implement these! - /** - * Called when a machine is fully assembled from the disassembled state, - * meaning it was broken by a player/entity action, not by chunk unloads. - * Note that, for non-square machines, the min/max coordinates may not - * actually be part of the machine! They form an outer bounding box for the - * whole machine itself. - * - * @param multiblockControllerBase - * The controller to which this part is being assembled. - */ - public abstract void onMachineAssembled( - MultiblockControllerBase multiblockControllerBase); - - /** - * Called when the machine is broken for game reasons, e.g. a player removed - * a block or an explosion occurred. - */ - public abstract void onMachineBroken(); - - /** - * Called when the user activates the machine. This is not called by - * default, but is included as most machines have this game-logical concept. - */ - public abstract void onMachineActivated(); - - /** - * Called when the user deactivates the machine. This is not called by - * default, but is included as most machines have this game-logical concept. - */ - public abstract void onMachineDeactivated(); - - // Block events - /** - * Called when this part should check its neighbors. This method MUST NOT - * cause additional chunks to load. ALWAYS check to see if a chunk is loaded - * before querying for its tile entity This part should inform the - * controller that it is attaching at this time. - * - * @return A Set of multiblock controllers to which this object would like - * to attach. It should have attached to one of the controllers in - * this list. Return null if there are no compatible controllers - * nearby. - */ - public abstract Set attachToNeighbors(); - - /** - * Assert that this part is detached. If not, log a warning and set the - * part's controller to null. Do NOT fire the full disconnection logic. - */ - public abstract void assertDetached(); - - /** - * @return True if a part has multiblock game-data saved inside it. - */ - public abstract boolean hasMultiblockSaveData(); - - /** - * @return The part's saved multiblock game-data in NBT format, or null if - * there isn't any. - */ - public abstract NBTTagCompound getMultiblockSaveData(); - - /** - * Called after a block is added and the controller has incorporated the - * part's saved multiblock game-data into itself. Generally, you should - * clear the saved data here. - */ - public abstract void onMultiblockDataAssimilated(); -} diff --git a/src/main/java/erogenousbeef/coreTR/multiblock/MultiblockClientTickHandler.java b/src/main/java/erogenousbeef/coreTR/multiblock/MultiblockClientTickHandler.java deleted file mode 100644 index 6ba022277..000000000 --- a/src/main/java/erogenousbeef/coreTR/multiblock/MultiblockClientTickHandler.java +++ /dev/null @@ -1,17 +0,0 @@ -package erogenousbeef.coreTR.multiblock; - -import net.minecraft.client.Minecraft; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import cpw.mods.fml.common.gameevent.TickEvent; - -public class MultiblockClientTickHandler { - - @SubscribeEvent - public void onClientTick(TickEvent.ClientTickEvent event) - { - if (event.phase == TickEvent.Phase.START) - { - MultiblockRegistry.tickStart(Minecraft.getMinecraft().theWorld); - } - } -} diff --git a/src/main/java/erogenousbeef/coreTR/multiblock/MultiblockControllerBase.java b/src/main/java/erogenousbeef/coreTR/multiblock/MultiblockControllerBase.java deleted file mode 100644 index e28a796b7..000000000 --- a/src/main/java/erogenousbeef/coreTR/multiblock/MultiblockControllerBase.java +++ /dev/null @@ -1,1268 +0,0 @@ -package erogenousbeef.coreTR.multiblock; - -import java.util.HashSet; -import java.util.LinkedList; -import java.util.Set; - -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; -import net.minecraft.world.chunk.Chunk; -import net.minecraft.world.chunk.IChunkProvider; -import erogenousbeef.coreTR.common.BeefCoreLog; -import erogenousbeef.coreTR.common.CoordTriplet; - -/** - * This class contains the base logic for "multiblock controllers". - * Conceptually, they are meta-TileEntities. They govern the logic for an - * associated group of TileEntities. - * - * Subordinate TileEntities implement the IMultiblockPart class and, generally, - * should not have an update() loop. - */ -public abstract class MultiblockControllerBase { - public static final short DIMENSION_UNBOUNDED = -1; - - // Multiblock stuff - do not mess with - protected World worldObj; - - // Disassembled -> Assembled; Assembled -> Disassembled OR Paused; Paused -> - // Assembled - protected enum AssemblyState - { - Disassembled, Assembled, Paused - }; - - protected AssemblyState assemblyState; - - public HashSet connectedParts; - - /** - * This is a deterministically-picked coordinate that identifies this - * multiblock uniquely in its dimension. Currently, this is the coord with - * the lowest X, Y and Z coordinates, in that order of evaluation. i.e. If - * something has a lower X but higher Y/Z coordinates, it will still be the - * reference. If something has the same X but a lower Y coordinate, it will - * be the reference. Etc. - */ - private CoordTriplet referenceCoord; - - /** - * Minimum bounding box coordinate. Blocks do not necessarily exist at this - * coord if your machine is not a cube/rectangular prism. - */ - private CoordTriplet minimumCoord; - - /** - * Maximum bounding box coordinate. Blocks do not necessarily exist at this - * coord if your machine is not a cube/rectangular prism. - */ - private CoordTriplet maximumCoord; - - /** - * Set to true whenever a part is removed from this controller. - */ - private boolean shouldCheckForDisconnections; - - /** - * Set whenever we validate the multiblock - */ - private MultiblockValidationException lastValidationException; - - protected boolean debugMode; - - protected MultiblockControllerBase(World world) - { - // Multiblock stuff - worldObj = world; - connectedParts = new HashSet(); - - referenceCoord = null; - assemblyState = AssemblyState.Disassembled; - - minimumCoord = null; - maximumCoord = null; - - shouldCheckForDisconnections = true; - lastValidationException = null; - - debugMode = false; - } - - public void setDebugMode(boolean active) - { - debugMode = active; - } - - public boolean isDebugMode() - { - return debugMode; - } - - /** - * Call when a block with cached save-delegate data is added to the - * multiblock. The part will be notified that the data has been used after - * this call completes. - * - * @param part - * The NBT tag containing this controller's data. - */ - public abstract void onAttachedPartWithMultiblockData(IMultiblockPart part, - NBTTagCompound data); - - /** - * Check if a block is being tracked by this machine. - * - * @param blockCoord - * Coordinate to check. - * @return True if the tile entity at blockCoord is being tracked by this - * machine, false otherwise. - */ - public boolean hasBlock(CoordTriplet blockCoord) - { - return connectedParts.contains(blockCoord); - } - - /** - * Attach a new part to this machine. - * - * @param part - * The part to add. - */ - public void attachBlock(IMultiblockPart part) - { - IMultiblockPart candidate; - CoordTriplet coord = part.getWorldLocation(); - - if (!connectedParts.add(part)) - { - BeefCoreLog - .warning( - "[%s] Controller %s is double-adding part %d @ %s. This is unusual. If you encounter odd behavior, please tear down the machine and rebuild it.", - (worldObj.isRemote ? "CLIENT" : "SERVER"), - hashCode(), part.hashCode(), coord); - } - - part.onAttached(this); - this.onBlockAdded(part); - - if (part.hasMultiblockSaveData()) - { - NBTTagCompound savedData = part.getMultiblockSaveData(); - onAttachedPartWithMultiblockData(part, savedData); - part.onMultiblockDataAssimilated(); - } - - if (this.referenceCoord == null) - { - referenceCoord = coord; - part.becomeMultiblockSaveDelegate(); - } else if (coord.compareTo(referenceCoord) < 0) - { - TileEntity te = this.worldObj.getTileEntity(referenceCoord.x, - referenceCoord.y, referenceCoord.z); - ((IMultiblockPart) te).forfeitMultiblockSaveDelegate(); - - referenceCoord = coord; - part.becomeMultiblockSaveDelegate(); - } else - { - part.forfeitMultiblockSaveDelegate(); - } - - if (minimumCoord != null) - { - if (part.xCoord < minimumCoord.x) - { - minimumCoord.x = part.xCoord; - } - if (part.yCoord < minimumCoord.y) - { - minimumCoord.y = part.yCoord; - } - if (part.zCoord < minimumCoord.z) - { - minimumCoord.z = part.zCoord; - } - } - - if (maximumCoord != null) - { - if (part.xCoord > maximumCoord.x) - { - maximumCoord.x = part.xCoord; - } - if (part.yCoord > maximumCoord.y) - { - maximumCoord.y = part.yCoord; - } - if (part.zCoord > maximumCoord.z) - { - maximumCoord.z = part.zCoord; - } - } - - MultiblockRegistry.addDirtyController(worldObj, this); - } - - /** - * Called when a new part is added to the machine. Good time to register - * things into lists. - * - * @param newPart - * The part being added. - */ - protected abstract void onBlockAdded(IMultiblockPart newPart); - - /** - * Called when a part is removed from the machine. Good time to clean up - * lists. - * - * @param oldPart - * The part being removed. - */ - protected abstract void onBlockRemoved(IMultiblockPart oldPart); - - /** - * Called when a machine is assembled from a disassembled state. - */ - protected abstract void onMachineAssembled(); - - /** - * Called when a machine is restored to the assembled state from a paused - * state. - */ - protected abstract void onMachineRestored(); - - /** - * Called when a machine is paused from an assembled state This generally - * only happens due to chunk-loads and other "system" events. - */ - protected abstract void onMachinePaused(); - - /** - * Called when a machine is disassembled from an assembled state. This - * happens due to user or in-game actions (e.g. explosions) - */ - protected abstract void onMachineDisassembled(); - - /** - * Callback whenever a part is removed (or will very shortly be removed) - * from a controller. Do housekeeping/callbacks, also nulls min/max coords. - * - * @param part - * The part being removed. - */ - private void onDetachBlock(IMultiblockPart part) - { - // Strip out this part - part.onDetached(this); - this.onBlockRemoved(part); - part.forfeitMultiblockSaveDelegate(); - - minimumCoord = maximumCoord = null; - - if (referenceCoord != null - && referenceCoord.equals(part.xCoord, part.yCoord, part.zCoord)) - { - referenceCoord = null; - } - - shouldCheckForDisconnections = true; - } - - /** - * Call to detach a block from this machine. Generally, this should be - * called when the tile entity is being released, e.g. on block destruction. - * - * @param part - * The part to detach from this machine. - * @param chunkUnloading - * Is this entity detaching due to the chunk unloading? If true, - * the multiblock will be paused instead of broken. - */ - public void detachBlock(IMultiblockPart part, boolean chunkUnloading) - { - if (chunkUnloading && this.assemblyState == AssemblyState.Assembled) - { - this.assemblyState = AssemblyState.Paused; - this.onMachinePaused(); - } - - // Strip out this part - onDetachBlock(part); - if (!connectedParts.remove(part)) - { - BeefCoreLog - .warning( - "[%s] Double-removing part (%d) @ %d, %d, %d, this is unexpected and may cause problems. If you encounter anomalies, please tear down the reactor and rebuild it.", - worldObj.isRemote ? "CLIENT" : "SERVER", - part.hashCode(), part.xCoord, part.yCoord, - part.zCoord); - } - - if (connectedParts.isEmpty()) - { - // Destroy/unregister - MultiblockRegistry.addDeadController(this.worldObj, this); - return; - } - - MultiblockRegistry.addDirtyController(this.worldObj, this); - - // Find new save delegate if we need to. - if (referenceCoord == null) - { - selectNewReferenceCoord(); - } - } - - /** - * Helper method so we don't check for a whole machine until we have enough - * blocks to actually assemble it. This isn't as simple as xmax*ymax*zmax - * for non-cubic machines or for machines with hollow/complex interiors. - * - * @return The minimum number of blocks connected to the machine for it to - * be assembled. - */ - protected abstract int getMinimumNumberOfBlocksForAssembledMachine(); - - /** - * Returns the maximum X dimension size of the machine, or -1 - * (DIMENSION_UNBOUNDED) to disable dimension checking in X. (This is not - * recommended.) - * - * @return The maximum X dimension size of the machine, or -1 - */ - protected abstract int getMaximumXSize(); - - /** - * Returns the maximum Z dimension size of the machine, or -1 - * (DIMENSION_UNBOUNDED) to disable dimension checking in X. (This is not - * recommended.) - * - * @return The maximum Z dimension size of the machine, or -1 - */ - protected abstract int getMaximumZSize(); - - /** - * Returns the maximum Y dimension size of the machine, or -1 - * (DIMENSION_UNBOUNDED) to disable dimension checking in X. (This is not - * recommended.) - * - * @return The maximum Y dimension size of the machine, or -1 - */ - protected abstract int getMaximumYSize(); - - /** - * Returns the minimum X dimension size of the machine. Must be at least 1, - * because nothing else makes sense. - * - * @return The minimum X dimension size of the machine - */ - protected int getMinimumXSize() - { - return 1; - } - - /** - * Returns the minimum Y dimension size of the machine. Must be at least 1, - * because nothing else makes sense. - * - * @return The minimum Y dimension size of the machine - */ - protected int getMinimumYSize() - { - return 1; - } - - /** - * Returns the minimum Z dimension size of the machine. Must be at least 1, - * because nothing else makes sense. - * - * @return The minimum Z dimension size of the machine - */ - protected int getMinimumZSize() - { - return 1; - } - - /** - * @return An exception representing the last error encountered when trying - * to assemble this multiblock, or null if there is no error. - */ - public MultiblockValidationException getLastValidationException() - { - return lastValidationException; - } - - /** - * Checks if a machine is whole. If not, throws an exception with the reason - * why. - */ - protected abstract void isMachineWhole() - throws MultiblockValidationException; - - /** - * Check if the machine is whole or not. If the machine was not whole, but - * now is, assemble the machine. If the machine was whole, but no longer is, - * disassemble the machine. - * - * @return - */ - public void checkIfMachineIsWhole() - { - AssemblyState oldState = this.assemblyState; - boolean isWhole; - lastValidationException = null; - try - { - isMachineWhole(); - isWhole = true; - } catch (MultiblockValidationException e) - { - lastValidationException = e; - isWhole = false; - } - - if (isWhole) - { - // This will alter assembly state - assembleMachine(oldState); - } else if (oldState == AssemblyState.Assembled) - { - // This will alter assembly state - disassembleMachine(); - } - // Else Paused, do nothing - } - - /** - * Called when a machine becomes "whole" and should begin functioning as a - * game-logically finished machine. Calls onMachineAssembled on all attached - * parts. - */ - private void assembleMachine(AssemblyState oldState) - { - for (IMultiblockPart part : connectedParts) - { - part.onMachineAssembled(this); - } - - this.assemblyState = AssemblyState.Assembled; - if (oldState == assemblyState.Paused) - { - onMachineRestored(); - } else - { - onMachineAssembled(); - } - } - - /** - * Called when the machine needs to be disassembled. It is not longer - * "whole" and should not be functional, usually as a result of a block - * being removed. Calls onMachineBroken on all attached parts. - */ - private void disassembleMachine() - { - for (IMultiblockPart part : connectedParts) - { - part.onMachineBroken(); - } - - this.assemblyState = AssemblyState.Disassembled; - onMachineDisassembled(); - } - - /** - * Assimilate another controller into this controller. Acquire all of the - * other controller's blocks and attach them to this one. - * - * @param other - * The controller to merge into this one. - */ - public void assimilate(MultiblockControllerBase other) - { - CoordTriplet otherReferenceCoord = other.getReferenceCoord(); - if (otherReferenceCoord != null - && getReferenceCoord().compareTo(otherReferenceCoord) >= 0) - { - throw new IllegalArgumentException( - "The controller with the lowest minimum-coord value must consume the one with the higher coords"); - } - - TileEntity te; - Set partsToAcquire = new HashSet( - other.connectedParts); - - // releases all blocks and references gently so they can be incorporated - // into another multiblock - other._onAssimilated(this); - - for (IMultiblockPart acquiredPart : partsToAcquire) - { - // By definition, none of these can be the minimum block. - if (acquiredPart.isInvalid()) - { - continue; - } - - connectedParts.add(acquiredPart); - acquiredPart.onAssimilated(this); - this.onBlockAdded(acquiredPart); - } - - this.onAssimilate(other); - other.onAssimilated(this); - } - - /** - * Called when this machine is consumed by another controller. Essentially, - * forcibly tear down this object. - * - * @param otherController - * The controller consuming this controller. - */ - private void _onAssimilated(MultiblockControllerBase otherController) - { - if (referenceCoord != null) - { - if (worldObj.getChunkProvider().chunkExists( - referenceCoord.getChunkX(), referenceCoord.getChunkZ())) - { - TileEntity te = this.worldObj.getTileEntity(referenceCoord.x, - referenceCoord.y, referenceCoord.z); - if (te instanceof IMultiblockPart) - { - ((IMultiblockPart) te).forfeitMultiblockSaveDelegate(); - } - } - this.referenceCoord = null; - } - - connectedParts.clear(); - } - - /** - * Callback. Called after this controller assimilates all the blocks from - * another controller. Use this to absorb that controller's game data. - * - * @param assimilated - * The controller whose uniqueness was added to our own. - */ - protected abstract void onAssimilate(MultiblockControllerBase assimilated); - - /** - * Callback. Called after this controller is assimilated into another - * controller. All blocks have been stripped out of this object and handed - * over to the other controller. This is intended primarily for cleanup. - * - * @param assimilator - * The controller which has assimilated this controller. - */ - protected abstract void onAssimilated(MultiblockControllerBase assimilator); - - /** - * Driver for the update loop. If the machine is assembled, runs the game - * logic update method. - * - * @see erogenousbeef.coreTR.multiblock.MultiblockControllerBase#update() - * //TODO Fix this Javadoc - */ - public final void updateMultiblockEntity() - { - if (connectedParts.isEmpty()) - { - // This shouldn't happen, but just in case... - MultiblockRegistry.addDeadController(this.worldObj, this); - return; - } - - if (this.assemblyState != AssemblyState.Assembled) - { - // Not assembled - don't run game logic - return; - } - - if (worldObj.isRemote) - { - updateClient(); - } else if (updateServer()) - { - // If this returns true, the server has changed its internal data. - // If our chunks are loaded (they should be), we must mark our - // chunks as dirty. - if (minimumCoord != null - && maximumCoord != null - && this.worldObj.checkChunksExist(minimumCoord.x, - minimumCoord.y, minimumCoord.z, maximumCoord.x, - maximumCoord.y, maximumCoord.z)) - { - int minChunkX = minimumCoord.x >> 4; - int minChunkZ = minimumCoord.z >> 4; - int maxChunkX = maximumCoord.x >> 4; - int maxChunkZ = maximumCoord.z >> 4; - - for (int x = minChunkX; x <= maxChunkX; x++) - { - for (int z = minChunkZ; z <= maxChunkZ; z++) - { - // Ensure that we save our data, even if the our save - // delegate is in has no TEs. - Chunk chunkToSave = this.worldObj - .getChunkFromChunkCoords(x, z); - chunkToSave.setChunkModified(); - } - } - } - } - // Else: Server, but no need to save data. - } - - /** - * The server-side update loop! Use this similarly to a TileEntity's update - * loop. You do not need to call your superclass' update() if you're - * directly derived from MultiblockControllerBase. This is a callback. Note - * that this will only be called when the machine is assembled. - * - * @return True if the multiblock should save data, i.e. its internal game - * state has changed. False otherwise. - */ - protected abstract boolean updateServer(); - - /** - * Client-side update loop. Generally, this shouldn't do anything, but if - * you want to do some interpolation or something, do it here. - */ - protected abstract void updateClient(); - - // Validation helpers - /** - * The "frame" consists of the outer edges of the machine, plus the corners. - * - * @param world - * World object for the world in which this controller is - * located. - * @param x - * X coordinate of the block being tested - * @param y - * Y coordinate of the block being tested - * @param z - * Z coordinate of the block being tested - * @throws MultiblockValidationException - * if the tested block is not allowed on the machine's frame - */ - protected void isBlockGoodForFrame(World world, int x, int y, int z) - throws MultiblockValidationException - { - throw new MultiblockValidationException( - String.format( - "%d, %d, %d - Block is not valid for use in the machine's interior", - x, y, z)); - } - - /** - * The top consists of the top face, minus the edges. - * - * @param world - * World object for the world in which this controller is - * located. - * @param x - * X coordinate of the block being tested - * @param y - * Y coordinate of the block being tested - * @param z - * Z coordinate of the block being tested - * @throws MultiblockValidationException - * if the tested block is not allowed on the machine's top face - */ - protected void isBlockGoodForTop(World world, int x, int y, int z) - throws MultiblockValidationException - { - throw new MultiblockValidationException( - String.format( - "%d, %d, %d - Block is not valid for use in the machine's interior", - x, y, z)); - } - - /** - * The bottom consists of the bottom face, minus the edges. - * - * @param world - * World object for the world in which this controller is - * located. - * @param x - * X coordinate of the block being tested - * @param y - * Y coordinate of the block being tested - * @param z - * Z coordinate of the block being tested - * @throws MultiblockValidationException - * if the tested block is not allowed on the machine's bottom - * face - */ - protected void isBlockGoodForBottom(World world, int x, int y, int z) - throws MultiblockValidationException - { - throw new MultiblockValidationException( - String.format( - "%d, %d, %d - Block is not valid for use in the machine's interior", - x, y, z)); - } - - /** - * The sides consists of the N/E/S/W-facing faces, minus the edges. - * - * @param world - * World object for the world in which this controller is - * located. - * @param x - * X coordinate of the block being tested - * @param y - * Y coordinate of the block being tested - * @param z - * Z coordinate of the block being tested - * @throws MultiblockValidationException - * if the tested block is not allowed on the machine's side - * faces - */ - protected void isBlockGoodForSides(World world, int x, int y, int z) - throws MultiblockValidationException - { - throw new MultiblockValidationException( - String.format( - "%d, %d, %d - Block is not valid for use in the machine's interior", - x, y, z)); - } - - /** - * The interior is any block that does not touch blocks outside the machine. - * - * @param world - * World object for the world in which this controller is - * located. - * @param x - * X coordinate of the block being tested - * @param y - * Y coordinate of the block being tested - * @param z - * Z coordinate of the block being tested - * @throws MultiblockValidationException - * if the tested block is not allowed in the machine's interior - */ - protected void isBlockGoodForInterior(World world, int x, int y, int z) - throws MultiblockValidationException - { - throw new MultiblockValidationException( - String.format( - "%d, %d, %d - Block is not valid for use in the machine's interior", - x, y, z)); - } - - /** - * @return The reference coordinate, the block with the lowest x, y, z - * coordinates, evaluated in that order. - */ - public CoordTriplet getReferenceCoord() - { - if (referenceCoord == null) - { - selectNewReferenceCoord(); - } - return referenceCoord; - } - - /** - * @return The number of blocks connected to this controller. - */ - public int getNumConnectedBlocks() - { - return connectedParts.size(); - } - - public abstract void writeToNBT(NBTTagCompound data); - - public abstract void readFromNBT(NBTTagCompound data); - - /** - * Force this multiblock to recalculate its minimum and maximum coordinates - * from the list of connected parts. - */ - public void recalculateMinMaxCoords() - { - minimumCoord = new CoordTriplet(Integer.MAX_VALUE, Integer.MAX_VALUE, - Integer.MAX_VALUE); - maximumCoord = new CoordTriplet(Integer.MIN_VALUE, Integer.MIN_VALUE, - Integer.MIN_VALUE); - - for (IMultiblockPart part : connectedParts) - { - if (part.xCoord < minimumCoord.x) - { - minimumCoord.x = part.xCoord; - } - if (part.xCoord > maximumCoord.x) - { - maximumCoord.x = part.xCoord; - } - if (part.yCoord < minimumCoord.y) - { - minimumCoord.y = part.yCoord; - } - if (part.yCoord > maximumCoord.y) - { - maximumCoord.y = part.yCoord; - } - if (part.zCoord < minimumCoord.z) - { - minimumCoord.z = part.zCoord; - } - if (part.zCoord > maximumCoord.z) - { - maximumCoord.z = part.zCoord; - } - } - } - - /** - * @return The minimum bounding-box coordinate containing this machine's - * blocks. - */ - public CoordTriplet getMinimumCoord() - { - if (minimumCoord == null) - { - recalculateMinMaxCoords(); - } - return minimumCoord.copy(); - } - - /** - * @return The maximum bounding-box coordinate containing this machine's - * blocks. - */ - public CoordTriplet getMaximumCoord() - { - if (maximumCoord == null) - { - recalculateMinMaxCoords(); - } - return maximumCoord.copy(); - } - - /** - * Called when the save delegate's tile entity is being asked for its - * description packet - * - * @param data - * A fresh compound tag to write your multiblock data into - */ - public abstract void formatDescriptionPacket(NBTTagCompound data); - - /** - * Called when the save delegate's tile entity receiving a description - * packet - * - * @param data - * A compound tag containing multiblock data to import - */ - public abstract void decodeDescriptionPacket(NBTTagCompound data); - - /** - * @return True if this controller has no associated blocks, false otherwise - */ - public boolean isEmpty() - { - return connectedParts.isEmpty(); - } - - /** - * Tests whether this multiblock should consume the other multiblock and - * become the new multiblock master when the two multiblocks are adjacent. - * Assumes both multiblocks are the same type. - * - * @param otherController - * The other multiblock controller. - * @return True if this multiblock should consume the other, false - * otherwise. - */ - public boolean shouldConsume(MultiblockControllerBase otherController) - { - if (!otherController.getClass().equals(getClass())) - { - throw new IllegalArgumentException( - "Attempting to merge two multiblocks with different master classes - this should never happen!"); - } - - if (otherController == this) - { - return false; - } // Don't be silly, don't eat yourself. - - int res = _shouldConsume(otherController); - if (res < 0) - { - return true; - } else if (res > 0) - { - return false; - } else - { - // Strip dead parts from both and retry - BeefCoreLog - .warning( - "[%s] Encountered two controllers with the same reference coordinate. Auditing connected parts and retrying.", - worldObj.isRemote ? "CLIENT" : "SERVER"); - auditParts(); - otherController.auditParts(); - - res = _shouldConsume(otherController); - if (res < 0) - { - return true; - } else if (res > 0) - { - return false; - } else - { - BeefCoreLog - .error("My Controller (%d): size (%d), parts: %s", - hashCode(), connectedParts.size(), - getPartsListString()); - BeefCoreLog.error( - "Other Controller (%d): size (%d), coords: %s", - otherController.hashCode(), - otherController.connectedParts.size(), - otherController.getPartsListString()); - throw new IllegalArgumentException( - "[" - + (worldObj.isRemote ? "CLIENT" : "SERVER") - + "] Two controllers with the same reference coord that somehow both have valid parts - this should never happen!"); - } - - } - } - - private int _shouldConsume(MultiblockControllerBase otherController) - { - CoordTriplet myCoord = getReferenceCoord(); - CoordTriplet theirCoord = otherController.getReferenceCoord(); - - // Always consume other controllers if their reference coordinate is - // null - this means they're empty and can be assimilated on the cheap - if (theirCoord == null) - { - return -1; - } else - { - return myCoord.compareTo(theirCoord); - } - } - - private String getPartsListString() - { - StringBuilder sb = new StringBuilder(); - boolean first = true; - for (IMultiblockPart part : connectedParts) - { - if (!first) - { - sb.append(", "); - } - sb.append(String.format("(%d: %d, %d, %d)", part.hashCode(), - part.xCoord, part.yCoord, part.zCoord)); - first = false; - } - - return sb.toString(); - } - - /** - * Checks all of the parts in the controller. If any are dead or do not - * exist in the world, they are removed. - */ - private void auditParts() - { - HashSet deadParts = new HashSet(); - for (IMultiblockPart part : connectedParts) - { - if (part.isInvalid() - || worldObj.getTileEntity(part.xCoord, part.yCoord, - part.zCoord) != part) - { - onDetachBlock(part); - deadParts.add(part); - } - } - - connectedParts.removeAll(deadParts); - BeefCoreLog - .warning( - "[%s] Controller found %d dead parts during an audit, %d parts remain attached", - worldObj.isRemote ? "CLIENT" : "SERVER", - deadParts.size(), connectedParts.size()); - } - - /** - * Called when this machine may need to check for blocks that are no longer - * physically connected to the reference coordinate. - * - * @return - */ - public Set checkForDisconnections() - { - if (!this.shouldCheckForDisconnections) - { - return null; - } - - if (this.isEmpty()) - { - MultiblockRegistry.addDeadController(worldObj, this); - return null; - } - - TileEntity te; - IChunkProvider chunkProvider = worldObj.getChunkProvider(); - - // Invalidate our reference coord, we'll recalculate it shortly - referenceCoord = null; - - // Reset visitations and find the minimum coordinate - Set deadParts = new HashSet(); - CoordTriplet c; - IMultiblockPart referencePart = null; - - int originalSize = connectedParts.size(); - - for (IMultiblockPart part : connectedParts) - { - // This happens during chunk unload. - if (!chunkProvider.chunkExists(part.xCoord >> 4, part.zCoord >> 4) - || part.isInvalid()) - { - deadParts.add(part); - onDetachBlock(part); - continue; - } - - if (worldObj.getTileEntity(part.xCoord, part.yCoord, part.zCoord) != part) - { - deadParts.add(part); - onDetachBlock(part); - continue; - } - - part.setUnvisited(); - part.forfeitMultiblockSaveDelegate(); - - c = part.getWorldLocation(); - if (referenceCoord == null) - { - referenceCoord = c; - referencePart = part; - } else if (c.compareTo(referenceCoord) < 0) - { - referenceCoord = c; - referencePart = part; - } - } - - connectedParts.removeAll(deadParts); - deadParts.clear(); - - if (referencePart == null || isEmpty()) - { - // There are no valid parts remaining. The entire multiblock was - // unloaded during a chunk unload. Halt. - shouldCheckForDisconnections = false; - MultiblockRegistry.addDeadController(worldObj, this); - return null; - } else - { - referencePart.becomeMultiblockSaveDelegate(); - } - - // Now visit all connected parts, breadth-first, starting from reference - // coord's part - IMultiblockPart part; - LinkedList partsToCheck = new LinkedList(); - IMultiblockPart[] nearbyParts = null; - int visitedParts = 0; - - partsToCheck.add(referencePart); - - while (!partsToCheck.isEmpty()) - { - part = partsToCheck.removeFirst(); - part.setVisited(); - visitedParts++; - - nearbyParts = part.getNeighboringParts(); // Chunk-safe on server, - // but not on client - for (IMultiblockPart nearbyPart : nearbyParts) - { - // Ignore different machines - if (nearbyPart.getMultiblockController() != this) - { - continue; - } - - if (!nearbyPart.isVisited()) - { - nearbyPart.setVisited(); - partsToCheck.add(nearbyPart); - } - } - } - - // Finally, remove all parts that remain disconnected. - Set removedParts = new HashSet(); - for (IMultiblockPart orphanCandidate : connectedParts) - { - if (!orphanCandidate.isVisited()) - { - deadParts.add(orphanCandidate); - orphanCandidate.onOrphaned(this, originalSize, visitedParts); - onDetachBlock(orphanCandidate); - removedParts.add(orphanCandidate); - } - } - - // Trim any blocks that were invalid, or were removed. - connectedParts.removeAll(deadParts); - - // Cleanup. Not necessary, really. - deadParts.clear(); - - // Juuuust in case. - if (referenceCoord == null) - { - selectNewReferenceCoord(); - } - - // We've run the checks from here on out. - shouldCheckForDisconnections = false; - - return removedParts; - } - - /** - * Detach all parts. Return a set of all parts which still have a valid tile - * entity. Chunk-safe. - * - * @return A set of all parts which still have a valid tile entity. - */ - public Set detachAllBlocks() - { - if (worldObj == null) - { - return new HashSet(); - } - - IChunkProvider chunkProvider = worldObj.getChunkProvider(); - for (IMultiblockPart part : connectedParts) - { - if (chunkProvider.chunkExists(part.xCoord >> 4, part.zCoord >> 4)) - { - onDetachBlock(part); - } - } - - Set detachedParts = connectedParts; - connectedParts = new HashSet(); - return detachedParts; - } - - /** - * @return True if this multiblock machine is considered assembled and ready - * to go. - */ - public boolean isAssembled() - { - return this.assemblyState == AssemblyState.Assembled; - } - - private void selectNewReferenceCoord() - { - IChunkProvider chunkProvider = worldObj.getChunkProvider(); - TileEntity theChosenOne = null; - referenceCoord = null; - - for (IMultiblockPart part : connectedParts) - { - if (part.isInvalid() - || !chunkProvider.chunkExists(part.xCoord >> 4, - part.zCoord >> 4)) - { - // Chunk is unloading, skip this coord to prevent chunk - // thrashing - continue; - } - - if (referenceCoord == null - || referenceCoord.compareTo(part.xCoord, part.yCoord, - part.zCoord) > 0) - { - referenceCoord = part.getWorldLocation(); - theChosenOne = part; - } - } - - if (theChosenOne != null) - { - ((IMultiblockPart) theChosenOne).becomeMultiblockSaveDelegate(); - } - } - - /** - * Marks the reference coord dirty & updateable. - * - * On the server, this will mark the for a data-update, so that nearby - * clients will receive an updated description packet from the server after - * a short time. The block's chunk will also be marked dirty and the block's - * chunk will be saved to disk the next time chunks are saved. - * - * On the client, this will mark the block for a rendering update. - */ - protected void markReferenceCoordForUpdate() - { - CoordTriplet rc = getReferenceCoord(); - if (worldObj != null && rc != null) - { - worldObj.markBlockForUpdate(rc.x, rc.y, rc.z); - } - } - - /** - * Marks the reference coord dirty. - * - * On the server, this marks the reference coord's chunk as dirty; the block - * (and chunk) will be saved to disk the next time chunks are saved. This - * does NOT mark it dirty for a description-packet update. - * - * On the client, does nothing. - * - * @see MultiblockControllerBase#markReferenceCoordForUpdate() - */ - protected void markReferenceCoordDirty() - { - if (worldObj == null || worldObj.isRemote) - { - return; - } - - CoordTriplet referenceCoord = getReferenceCoord(); - if (referenceCoord == null) - { - return; - } - - TileEntity saveTe = worldObj.getTileEntity(referenceCoord.x, - referenceCoord.y, referenceCoord.z); - worldObj.markTileEntityChunkModified(referenceCoord.x, - referenceCoord.y, referenceCoord.z, saveTe); - } - -} \ No newline at end of file diff --git a/src/main/java/erogenousbeef/coreTR/multiblock/MultiblockEventHandler.java b/src/main/java/erogenousbeef/coreTR/multiblock/MultiblockEventHandler.java deleted file mode 100644 index b188eeeda..000000000 --- a/src/main/java/erogenousbeef/coreTR/multiblock/MultiblockEventHandler.java +++ /dev/null @@ -1,32 +0,0 @@ -package erogenousbeef.coreTR.multiblock; - -import net.minecraft.world.World; -import net.minecraft.world.chunk.Chunk; -import net.minecraftforge.event.world.ChunkEvent; -import net.minecraftforge.event.world.WorldEvent; -import cpw.mods.fml.common.eventhandler.EventPriority; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; - -/** - * In your mod, subscribe this on both the client and server sides side to - * handle chunk load events for your multiblock machines. Chunks can load - * asynchronously in environments like MCPC+, so we cannot process any blocks - * that are in chunks which are still loading. - */ -public class MultiblockEventHandler { - @SubscribeEvent(priority = EventPriority.NORMAL) - public void onChunkLoad(ChunkEvent.Load loadEvent) - { - Chunk chunk = loadEvent.getChunk(); - World world = loadEvent.world; - MultiblockRegistry.onChunkLoaded(world, chunk.xPosition, - chunk.zPosition); - } - - // Cleanup, for nice memory usageness - @SubscribeEvent(priority = EventPriority.NORMAL) - public void onWorldUnload(WorldEvent.Unload unloadWorldEvent) - { - MultiblockRegistry.onWorldUnloaded(unloadWorldEvent.world); - } -} diff --git a/src/main/java/erogenousbeef/coreTR/multiblock/MultiblockRegistry.java b/src/main/java/erogenousbeef/coreTR/multiblock/MultiblockRegistry.java deleted file mode 100644 index 9559b0a54..000000000 --- a/src/main/java/erogenousbeef/coreTR/multiblock/MultiblockRegistry.java +++ /dev/null @@ -1,179 +0,0 @@ -package erogenousbeef.coreTR.multiblock; - -import java.util.HashMap; -import java.util.Set; - -import net.minecraft.world.World; -import erogenousbeef.coreTR.common.BeefCoreLog; - -/** - * This is a very static singleton registry class which directs incoming events - * to sub-objects, which actually manage each individual world's multiblocks. - * - * @author Erogenous Beef - */ -public class MultiblockRegistry { - // World > WorldRegistry map - private static HashMap registries = new HashMap(); - - /** - * Called before Tile Entities are ticked in the world. Do bookkeeping here. - * - * @param world - * The world being ticked - */ - public static void tickStart(World world) - { - if (registries.containsKey(world)) - { - MultiblockWorldRegistry registry = registries.get(world); - registry.processMultiblockChanges(); - registry.tickStart(); - } - } - - /** - * Called when the world has finished loading a chunk. - * - * @param world - * The world which has finished loading a chunk - * @param chunkX - * The X coordinate of the chunk - * @param chunkZ - * The Z coordinate of the chunk - */ - public static void onChunkLoaded(World world, int chunkX, int chunkZ) - { - if (registries.containsKey(world)) - { - registries.get(world).onChunkLoaded(chunkX, chunkZ); - } - } - - /** - * Register a new part in the system. The part has been created either - * through user action or via a chunk loading. - * - * @param world - * The world into which this part is loading. - * @param part - * The part being loaded. - */ - public static void onPartAdded(World world, IMultiblockPart part) - { - MultiblockWorldRegistry registry = getOrCreateRegistry(world); - registry.onPartAdded(part); - } - - /** - * Call to remove a part from world lists. - * - * @param world - * The world from which a multiblock part is being removed. - * @param part - * The part being removed. - */ - public static void onPartRemovedFromWorld(World world, IMultiblockPart part) - { - if (registries.containsKey(world)) - { - registries.get(world).onPartRemovedFromWorld(part); - } - - } - - /** - * Called whenever a world is unloaded. Unload the relevant registry, if we - * have one. - * - * @param world - * The world being unloaded. - */ - public static void onWorldUnloaded(World world) - { - if (registries.containsKey(world)) - { - registries.get(world).onWorldUnloaded(); - registries.remove(world); - } - } - - /** - * Call to mark a controller as dirty. Dirty means that parts have been - * added or removed this tick. - * - * @param world - * The world containing the multiblock - * @param controller - * The dirty controller - */ - public static void addDirtyController(World world, - MultiblockControllerBase controller) - { - if (registries.containsKey(world)) - { - registries.get(world).addDirtyController(controller); - } else - { - throw new IllegalArgumentException( - "Adding a dirty controller to a world that has no registered controllers!"); - } - } - - /** - * Call to mark a controller as dead. It should only be marked as dead when - * it has no connected parts. It will be removed after the next world tick. - * - * @param world - * The world formerly containing the multiblock - * @param controller - * The dead controller - */ - public static void addDeadController(World world, - MultiblockControllerBase controller) - { - if (registries.containsKey(world)) - { - registries.get(world).addDeadController(controller); - } else - { - BeefCoreLog - .warning( - "Controller %d in world %s marked as dead, but that world is not tracked! Controller is being ignored.", - controller.hashCode(), world); - } - } - - /** - * @param world - * The world whose controllers you wish to retrieve. - * @return An unmodifiable set of controllers active in the given world, or - * null if there are none. - */ - public static Set getControllersFromWorld( - World world) - { - if (registries.containsKey(world)) - { - return registries.get(world).getControllers(); - } - return null; - } - - // / *** PRIVATE HELPERS *** /// - - private static MultiblockWorldRegistry getOrCreateRegistry(World world) - { - if (registries.containsKey(world)) - { - return registries.get(world); - } else - { - MultiblockWorldRegistry newRegistry = new MultiblockWorldRegistry( - world); - registries.put(world, newRegistry); - return newRegistry; - } - } - -} diff --git a/src/main/java/erogenousbeef/coreTR/multiblock/MultiblockServerTickHandler.java b/src/main/java/erogenousbeef/coreTR/multiblock/MultiblockServerTickHandler.java deleted file mode 100644 index 4d7f185df..000000000 --- a/src/main/java/erogenousbeef/coreTR/multiblock/MultiblockServerTickHandler.java +++ /dev/null @@ -1,24 +0,0 @@ -package erogenousbeef.coreTR.multiblock; - -import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import cpw.mods.fml.common.gameevent.TickEvent; - -/** - * This is a generic multiblock tick handler. If you are using this code on your - * own, you will need to register this with the Forge TickRegistry on both the - * client AND server sides. Note that different types of ticks run on different - * parts of the system. CLIENT ticks only run on the client, at the start/end of - * each game loop. SERVER and WORLD ticks only run on the server. WORLDLOAD - * ticks run only on the server, and only when worlds are loaded. - */ -public class MultiblockServerTickHandler { - - @SubscribeEvent - public void onWorldTick(TickEvent.WorldTickEvent event) - { - if (event.phase == TickEvent.Phase.START) - { - MultiblockRegistry.tickStart(event.world); - } - } -} diff --git a/src/main/java/erogenousbeef/coreTR/multiblock/MultiblockTileEntityBase.java b/src/main/java/erogenousbeef/coreTR/multiblock/MultiblockTileEntityBase.java deleted file mode 100644 index b59668420..000000000 --- a/src/main/java/erogenousbeef/coreTR/multiblock/MultiblockTileEntityBase.java +++ /dev/null @@ -1,437 +0,0 @@ -package erogenousbeef.coreTR.multiblock; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.network.NetworkManager; -import net.minecraft.network.Packet; -import net.minecraft.network.play.server.S35PacketUpdateTileEntity; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.chunk.IChunkProvider; -import erogenousbeef.coreTR.common.BeefCoreLog; -import erogenousbeef.coreTR.common.CoordTriplet; - -/** - * Base logic class for Multiblock-connected tile entities. Most multiblock - * machines should derive from this and implement their game logic in certain - * abstract methods. - */ -public abstract class MultiblockTileEntityBase extends IMultiblockPart { - private MultiblockControllerBase controller; - private boolean visited; - - private boolean saveMultiblockData; - private NBTTagCompound cachedMultiblockData; - private boolean paused; - - public MultiblockTileEntityBase() - { - super(); - controller = null; - visited = false; - saveMultiblockData = false; - paused = false; - cachedMultiblockData = null; - } - - // /// Multiblock Connection Base Logic - @Override - public Set attachToNeighbors() - { - Set controllers = null; - MultiblockControllerBase bestController = null; - - // Look for a compatible controller in our neighboring parts. - IMultiblockPart[] partsToCheck = getNeighboringParts(); - for (IMultiblockPart neighborPart : partsToCheck) - { - if (neighborPart.isConnected()) - { - MultiblockControllerBase candidate = neighborPart - .getMultiblockController(); - if (!candidate.getClass().equals( - this.getMultiblockControllerType())) - { - // Skip multiblocks with incompatible types - continue; - } - - if (controllers == null) - { - controllers = new HashSet(); - bestController = candidate; - } else if (!controllers.contains(candidate) - && candidate.shouldConsume(bestController)) - { - bestController = candidate; - } - - controllers.add(candidate); - } - } - - // If we've located a valid neighboring controller, attach to it. - if (bestController != null) - { - // attachBlock will call onAttached, which will set the controller. - this.controller = bestController; - bestController.attachBlock(this); - } - - return controllers; - } - - @Override - public void assertDetached() - { - if (this.controller != null) - { - BeefCoreLog - .info("[assert] Part @ (%d, %d, %d) should be detached already, but detected that it was not. This is not a fatal error, and will be repaired, but is unusual.", - xCoord, yCoord, zCoord); - this.controller = null; - } - } - - // /// Overrides from base TileEntity methods - - @Override - public void readFromNBT(NBTTagCompound data) - { - super.readFromNBT(data); - - // We can't directly initialize a multiblock controller yet, so we cache - // the data here until - // we receive a validate() call, which creates the controller and hands - // off the cached data. - if (data.hasKey("multiblockData")) - { - this.cachedMultiblockData = data.getCompoundTag("multiblockData"); - } - } - - @Override - public void writeToNBT(NBTTagCompound data) - { - super.writeToNBT(data); - - if (isMultiblockSaveDelegate() && isConnected()) - { - NBTTagCompound multiblockData = new NBTTagCompound(); - this.controller.writeToNBT(multiblockData); - data.setTag("multiblockData", multiblockData); - } - } - - /** - * Generally, TileEntities that are part of a multiblock should not - * subscribe to updates from the main game loop. Instead, you should have - * lists of TileEntities which need to be notified during an update() in - * your Controller and perform callbacks from there. - * - * @see net.minecraft.tileentity.TileEntity#canUpdate() - */ - @Override - public boolean canUpdate() - { - return false; - } - - /** - * Called when a block is removed by game actions, such as a player breaking - * the block or the block being changed into another block. - * - * @see net.minecraft.tileentity.TileEntity#invalidate() - */ - @Override - public void invalidate() - { - super.invalidate(); - detachSelf(false); - } - - /** - * Called from Minecraft's tile entity loop, after all tile entities have - * been ticked, as the chunk in which this tile entity is contained is - * unloading. Happens before the Forge TickEnd event. - * - * @see net.minecraft.tileentity.TileEntity#onChunkUnload() - */ - @Override - public void onChunkUnload() - { - super.onChunkUnload(); - detachSelf(true); - } - - /** - * This is called when a block is being marked as valid by the chunk, but - * has not yet fully been placed into the world's TileEntity cache. - * this.worldObj, xCoord, yCoord and zCoord have been initialized, but any - * attempts to read data about the world can cause infinite loops - if you - * call getTileEntity on this TileEntity's coordinate from within - * validate(), you will blow your call stack. - * - * TL;DR: Here there be dragons. - * - * @see net.minecraft.tileentity.TileEntity#validate() - */ - @Override - public void validate() - { - super.validate(); - MultiblockRegistry.onPartAdded(this.worldObj, this); - } - - // Network Communication - @Override - public Packet getDescriptionPacket() - { - NBTTagCompound packetData = new NBTTagCompound(); - encodeDescriptionPacket(packetData); - return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 0, - packetData); - } - - @Override - public void onDataPacket(NetworkManager network, - S35PacketUpdateTileEntity packet) - { - decodeDescriptionPacket(packet.func_148857_g()); - } - - // /// Things to override in most implementations (IMultiblockPart) - /** - * Override this to easily modify the description packet's data without - * having to worry about sending the packet itself. Decode this data in - * decodeDescriptionPacket. - * - * @param packetData - * An NBT compound tag into which you should write your custom - * description data. - * @see erogenousbeef.coreTR.multiblock.MultiblockTileEntityBase#decodeDescriptionPacket(NBTTagCompound) - */ - protected void encodeDescriptionPacket(NBTTagCompound packetData) - { - if (this.isMultiblockSaveDelegate() && isConnected()) - { - NBTTagCompound tag = new NBTTagCompound(); - getMultiblockController().formatDescriptionPacket(tag); - packetData.setTag("multiblockData", tag); - } - } - - /** - * Override this to easily read in data from a TileEntity's description - * packet. Encoded in encodeDescriptionPacket. - * - * @param packetData - * The NBT data from the tile entity's description packet. - * @see erogenousbeef.coreTR.multiblock.MultiblockTileEntityBase#encodeDescriptionPacket(NBTTagCompound) - */ - protected void decodeDescriptionPacket(NBTTagCompound packetData) - { - if (packetData.hasKey("multiblockData")) - { - NBTTagCompound tag = packetData.getCompoundTag("multiblockData"); - if (isConnected()) - { - getMultiblockController().decodeDescriptionPacket(tag); - } else - { - // This part hasn't been added to a machine yet, so cache the - // data. - this.cachedMultiblockData = tag; - } - } - } - - @Override - public boolean hasMultiblockSaveData() - { - return this.cachedMultiblockData != null; - } - - @Override - public NBTTagCompound getMultiblockSaveData() - { - return this.cachedMultiblockData; - } - - @Override - public void onMultiblockDataAssimilated() - { - this.cachedMultiblockData = null; - } - - // /// Game logic callbacks (IMultiblockPart) - - @Override - public abstract void onMachineAssembled( - MultiblockControllerBase multiblockControllerBase); - - @Override - public abstract void onMachineBroken(); - - @Override - public abstract void onMachineActivated(); - - @Override - public abstract void onMachineDeactivated(); - - // /// Miscellaneous multiblock-assembly callbacks and support methods - // (IMultiblockPart) - - @Override - public boolean isConnected() - { - return (controller != null); - } - - @Override - public MultiblockControllerBase getMultiblockController() - { - return controller; - } - - @Override - public CoordTriplet getWorldLocation() - { - return new CoordTriplet(this.xCoord, this.yCoord, this.zCoord); - } - - @Override - public void becomeMultiblockSaveDelegate() - { - this.saveMultiblockData = true; - } - - @Override - public void forfeitMultiblockSaveDelegate() - { - this.saveMultiblockData = false; - } - - @Override - public boolean isMultiblockSaveDelegate() - { - return this.saveMultiblockData; - } - - @Override - public void setUnvisited() - { - this.visited = false; - } - - @Override - public void setVisited() - { - this.visited = true; - } - - @Override - public boolean isVisited() - { - return this.visited; - } - - @Override - public void onAssimilated(MultiblockControllerBase newController) - { - assert (this.controller != newController); - this.controller = newController; - } - - @Override - public void onAttached(MultiblockControllerBase newController) - { - this.controller = newController; - } - - @Override - public void onDetached(MultiblockControllerBase oldController) - { - this.controller = null; - } - - @Override - public abstract MultiblockControllerBase createNewMultiblock(); - - @Override - public IMultiblockPart[] getNeighboringParts() - { - CoordTriplet[] neighbors = new CoordTriplet[] - { new CoordTriplet(this.xCoord - 1, this.yCoord, this.zCoord), - new CoordTriplet(this.xCoord, this.yCoord - 1, this.zCoord), - new CoordTriplet(this.xCoord, this.yCoord, this.zCoord - 1), - new CoordTriplet(this.xCoord, this.yCoord, this.zCoord + 1), - new CoordTriplet(this.xCoord, this.yCoord + 1, this.zCoord), - new CoordTriplet(this.xCoord + 1, this.yCoord, this.zCoord) }; - - TileEntity te; - List neighborParts = new ArrayList(); - IChunkProvider chunkProvider = worldObj.getChunkProvider(); - for (CoordTriplet neighbor : neighbors) - { - if (!chunkProvider.chunkExists(neighbor.getChunkX(), - neighbor.getChunkZ())) - { - // Chunk not loaded, skip it. - continue; - } - - te = this.worldObj - .getTileEntity(neighbor.x, neighbor.y, neighbor.z); - if (te instanceof IMultiblockPart) - { - neighborParts.add((IMultiblockPart) te); - } - } - IMultiblockPart[] tmp = new IMultiblockPart[neighborParts.size()]; - return neighborParts.toArray(tmp); - } - - @Override - public void onOrphaned(MultiblockControllerBase controller, int oldSize, - int newSize) - { - this.markDirty(); - worldObj.markTileEntityChunkModified(xCoord, yCoord, zCoord, this); - } - - // // Helper functions for notifying neighboring blocks - protected void notifyNeighborsOfBlockChange() - { - worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, - getBlockType()); - } - - protected void notifyNeighborsOfTileChange() - { - worldObj.func_147453_f(xCoord, yCoord, zCoord, getBlockType()); - } - - // /// Private/Protected Logic Helpers - /* - * Detaches this block from its controller. Calls detachBlock() and clears - * the controller member. - */ - protected void detachSelf(boolean chunkUnloading) - { - if (this.controller != null) - { - // Clean part out of controller - this.controller.detachBlock(this, chunkUnloading); - - // The above should call onDetached, but, just in case... - this.controller = null; - } - - // Clean part out of lists in the registry - MultiblockRegistry.onPartRemovedFromWorld(worldObj, this); - } -} diff --git a/src/main/java/erogenousbeef/coreTR/multiblock/MultiblockValidationException.java b/src/main/java/erogenousbeef/coreTR/multiblock/MultiblockValidationException.java deleted file mode 100644 index 3ad0b29c5..000000000 --- a/src/main/java/erogenousbeef/coreTR/multiblock/MultiblockValidationException.java +++ /dev/null @@ -1,15 +0,0 @@ -package erogenousbeef.coreTR.multiblock; - -/** - * An exception thrown when trying to validate a multiblock. Requires a string - * describing why the multiblock could not assemble. - * - * @author Erogenous Beef - */ -public class MultiblockValidationException extends Exception { - - public MultiblockValidationException(String reason) - { - super(reason); - } -} diff --git a/src/main/java/erogenousbeef/coreTR/multiblock/MultiblockWorldRegistry.java b/src/main/java/erogenousbeef/coreTR/multiblock/MultiblockWorldRegistry.java deleted file mode 100644 index 2b0e903b2..000000000 --- a/src/main/java/erogenousbeef/coreTR/multiblock/MultiblockWorldRegistry.java +++ /dev/null @@ -1,538 +0,0 @@ -package erogenousbeef.coreTR.multiblock; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import net.minecraft.world.ChunkCoordIntPair; -import net.minecraft.world.World; -import net.minecraft.world.chunk.IChunkProvider; -import erogenousbeef.coreTR.common.BeefCoreLog; -import erogenousbeef.coreTR.common.CoordTriplet; - -/** - * This class manages all the multiblock controllers that exist in a given - * world, either client- or server-side. You must create different registries - * for server and client worlds. - * - * @author Erogenous Beef - */ -public class MultiblockWorldRegistry { - - private World worldObj; - - private Set controllers; // Active controllers - private Set dirtyControllers; // Controllers whose - // parts lists have - // changed - private Set deadControllers; // Controllers which - // are empty - - // A list of orphan parts - parts which currently have no master, but should - // seek one this tick - // Indexed by the hashed chunk coordinate - // This can be added-to asynchronously via chunk loads! - private Set orphanedParts; - - // A list of parts which have been detached during internal operations - private Set detachedParts; - - // A list of parts whose chunks have not yet finished loading - // They will be added to the orphan list when they are finished loading. - // Indexed by the hashed chunk coordinate - // This can be added-to asynchronously via chunk loads! - private HashMap> partsAwaitingChunkLoad; - - // Mutexes to protect lists which may be changed due to asynchronous events, - // such as chunk loads - private Object partsAwaitingChunkLoadMutex; - private Object orphanedPartsMutex; - - public MultiblockWorldRegistry(World world) - { - worldObj = world; - - controllers = new HashSet(); - deadControllers = new HashSet(); - dirtyControllers = new HashSet(); - - detachedParts = new HashSet(); - orphanedParts = new HashSet(); - - partsAwaitingChunkLoad = new HashMap>(); - partsAwaitingChunkLoadMutex = new Object(); - orphanedPartsMutex = new Object(); - } - - /** - * Called before Tile Entities are ticked in the world. Run game logic. - */ - public void tickStart() - { - if (controllers.size() > 0) - { - for (MultiblockControllerBase controller : controllers) - { - if (controller.worldObj == worldObj - && controller.worldObj.isRemote == worldObj.isRemote) - { - if (controller.isEmpty()) - { - // This happens on the server when the user breaks the - // last block. It's fine. - // Mark 'er dead and move on. - deadControllers.add(controller); - } else - { - // Run the game logic for this world - controller.updateMultiblockEntity(); - } - } - } - } - } - - /** - * Called prior to processing multiblock controllers. Do bookkeeping. - */ - public void processMultiblockChanges() - { - IChunkProvider chunkProvider = worldObj.getChunkProvider(); - CoordTriplet coord; - - // Merge pools - sets of adjacent machines which should be merged later - // on in processing - List> mergePools = null; - if (orphanedParts.size() > 0) - { - Set orphansToProcess = null; - - // Keep the synchronized block small. We can't iterate over - // orphanedParts directly - // because the client does not know which chunks are actually - // loaded, so attachToNeighbors() - // is not chunk-safe on the client, because Minecraft is stupid. - // It's possible to polyfill this, but the polyfill is too slow for - // comfort. - synchronized (orphanedPartsMutex) - { - if (orphanedParts.size() > 0) - { - orphansToProcess = orphanedParts; - orphanedParts = new HashSet(); - } - } - - if (orphansToProcess != null && orphansToProcess.size() > 0) - { - Set compatibleControllers; - - // Process orphaned blocks - // These are blocks that exist in a valid chunk and require a - // controller - for (IMultiblockPart orphan : orphansToProcess) - { - coord = orphan.getWorldLocation(); - if (!chunkProvider.chunkExists(coord.getChunkX(), - coord.getChunkZ())) - { - continue; - } - - // This can occur on slow machines. - if (orphan.isInvalid()) - { - continue; - } - - if (worldObj.getTileEntity(coord.x, coord.y, coord.z) != orphan) - { - // This block has been replaced by another. - continue; - } - - // THIS IS THE ONLY PLACE WHERE PARTS ATTACH TO MACHINES - // Try to attach to a neighbor's master controller - compatibleControllers = orphan.attachToNeighbors(); - if (compatibleControllers == null) - { - // FOREVER ALONE! Create and register a new controller. - // THIS IS THE ONLY PLACE WHERE NEW CONTROLLERS ARE - // CREATED. - MultiblockControllerBase newController = orphan - .createNewMultiblock(); - newController.attachBlock(orphan); - this.controllers.add(newController); - } else if (compatibleControllers.size() > 1) - { - if (mergePools == null) - { - mergePools = new ArrayList>(); - } - - // THIS IS THE ONLY PLACE WHERE MERGES ARE DETECTED - // Multiple compatible controllers indicates an - // impending merge. - // Locate the appropriate merge pool(s) - boolean hasAddedToPool = false; - List> candidatePools = new ArrayList>(); - for (Set candidatePool : mergePools) - { - if (!Collections.disjoint(candidatePool, - compatibleControllers)) - { - // They share at least one element, so that - // means they will all touch after the merge - candidatePools.add(candidatePool); - } - } - - if (candidatePools.size() <= 0) - { - // No pools nearby, create a new merge pool - mergePools.add(compatibleControllers); - } else if (candidatePools.size() == 1) - { - // Only one pool nearby, simply add to that one - candidatePools.get(0).addAll(compatibleControllers); - } else - { - // Multiple pools- merge into one, then add the - // compatible controllers - Set masterPool = candidatePools - .get(0); - Set consumedPool; - for (int i = 1; i < candidatePools.size(); i++) - { - consumedPool = candidatePools.get(i); - masterPool.addAll(consumedPool); - mergePools.remove(consumedPool); - } - masterPool.addAll(compatibleControllers); - } - } - } - } - } - - if (mergePools != null && mergePools.size() > 0) - { - // Process merges - any machines that have been marked for merge - // should be merged - // into the "master" machine. - // To do this, we combine lists of machines that are touching one - // another and therefore - // should voltron the fuck up. - for (Set mergePool : mergePools) - { - // Search for the new master machine, which will take over all - // the blocks contained in the other machines - MultiblockControllerBase newMaster = null; - for (MultiblockControllerBase controller : mergePool) - { - if (newMaster == null - || controller.shouldConsume(newMaster)) - { - newMaster = controller; - } - } - - if (newMaster == null) - { - BeefCoreLog - .fatal("Multiblock system checked a merge pool of size %d, found no master candidates. This should never happen.", - mergePool.size()); - } else - { - // Merge all the other machines into the master machine, - // then unregister them - addDirtyController(newMaster); - for (MultiblockControllerBase controller : mergePool) - { - if (controller != newMaster) - { - newMaster.assimilate(controller); - addDeadController(controller); - addDirtyController(newMaster); - } - } - } - } - } - - // Process splits and assembly - // Any controllers which have had parts removed must be checked to see - // if some parts are no longer - // physically connected to their master. - if (dirtyControllers.size() > 0) - { - Set newlyDetachedParts = null; - for (MultiblockControllerBase controller : dirtyControllers) - { - // Tell the machine to check if any parts are disconnected. - // It should return a set of parts which are no longer - // connected. - // POSTCONDITION: The controller must have informed those parts - // that - // they are no longer connected to this machine. - newlyDetachedParts = controller.checkForDisconnections(); - - if (!controller.isEmpty()) - { - controller.recalculateMinMaxCoords(); - controller.checkIfMachineIsWhole(); - } else - { - addDeadController(controller); - } - - if (newlyDetachedParts != null && newlyDetachedParts.size() > 0) - { - // Controller has shed some parts - add them to the detached - // list for delayed processing - detachedParts.addAll(newlyDetachedParts); - } - } - - dirtyControllers.clear(); - } - - // Unregister dead controllers - if (deadControllers.size() > 0) - { - for (MultiblockControllerBase controller : deadControllers) - { - // Go through any controllers which have marked themselves as - // potentially dead. - // Validate that they are empty/dead, then unregister them. - if (!controller.isEmpty()) - { - BeefCoreLog - .fatal("Found a non-empty controller. Forcing it to shed its blocks and die. This should never happen!"); - detachedParts.addAll(controller.detachAllBlocks()); - } - - // THIS IS THE ONLY PLACE WHERE CONTROLLERS ARE UNREGISTERED. - this.controllers.remove(controller); - } - - deadControllers.clear(); - } - - // Process detached blocks - // Any blocks which have been detached this tick should be moved to the - // orphaned - // list, and will be checked next tick to see if their chunk is still - // loaded. - for (IMultiblockPart part : detachedParts) - { - // Ensure parts know they're detached - part.assertDetached(); - } - - addAllOrphanedPartsThreadsafe(detachedParts); - detachedParts.clear(); - } - - /** - * Called when a multiblock part is added to the world, either via - * chunk-load or user action. If its chunk is loaded, it will be processed - * during the next tick. If the chunk is not loaded, it will be added to a - * list of objects waiting for a chunkload. - * - * @param part - * The part which is being added to this world. - */ - public void onPartAdded(IMultiblockPart part) - { - CoordTriplet worldLocation = part.getWorldLocation(); - - if (!worldObj.getChunkProvider().chunkExists(worldLocation.getChunkX(), - worldLocation.getChunkZ())) - { - // Part goes into the waiting-for-chunk-load list - Set partSet; - long chunkHash = worldLocation.getChunkXZHash(); - synchronized (partsAwaitingChunkLoadMutex) - { - if (!partsAwaitingChunkLoad.containsKey(chunkHash)) - { - partSet = new HashSet(); - partsAwaitingChunkLoad.put(chunkHash, partSet); - } else - { - partSet = partsAwaitingChunkLoad.get(chunkHash); - } - - partSet.add(part); - } - } else - { - // Part goes into the orphan queue, to be checked this tick - addOrphanedPartThreadsafe(part); - } - } - - /** - * Called when a part is removed from the world, via user action or via - * chunk unloads. This part is removed from any lists in which it may be, - * and its machine is marked for recalculation. - * - * @param part - * The part which is being removed. - */ - public void onPartRemovedFromWorld(IMultiblockPart part) - { - CoordTriplet coord = part.getWorldLocation(); - if (coord != null) - { - long hash = coord.getChunkXZHash(); - - if (partsAwaitingChunkLoad.containsKey(hash)) - { - synchronized (partsAwaitingChunkLoadMutex) - { - if (partsAwaitingChunkLoad.containsKey(hash)) - { - partsAwaitingChunkLoad.get(hash).remove(part); - if (partsAwaitingChunkLoad.get(hash).size() <= 0) - { - partsAwaitingChunkLoad.remove(hash); - } - } - } - } - } - - detachedParts.remove(part); - if (orphanedParts.contains(part)) - { - synchronized (orphanedPartsMutex) - { - orphanedParts.remove(part); - } - } - - part.assertDetached(); - } - - /** - * Called when the world which this World Registry represents is fully - * unloaded from the system. Does some housekeeping just to be nice. - */ - public void onWorldUnloaded() - { - controllers.clear(); - deadControllers.clear(); - dirtyControllers.clear(); - - detachedParts.clear(); - - synchronized (partsAwaitingChunkLoadMutex) - { - partsAwaitingChunkLoad.clear(); - } - - synchronized (orphanedPartsMutex) - { - orphanedParts.clear(); - } - - worldObj = null; - } - - /** - * Called when a chunk has finished loading. Adds all of the parts which are - * awaiting load to the list of parts which are orphans and therefore will - * be added to machines after the next world tick. - * - * @param chunkX - * Chunk X coordinate (world coordate >> 4) of the chunk that was - * loaded - * @param chunkZ - * Chunk Z coordinate (world coordate >> 4) of the chunk that was - * loaded - */ - public void onChunkLoaded(int chunkX, int chunkZ) - { - long chunkHash = ChunkCoordIntPair.chunkXZ2Int(chunkX, chunkZ); - if (partsAwaitingChunkLoad.containsKey(chunkHash)) - { - synchronized (partsAwaitingChunkLoadMutex) - { - if (partsAwaitingChunkLoad.containsKey(chunkHash)) - { - addAllOrphanedPartsThreadsafe(partsAwaitingChunkLoad - .get(chunkHash)); - partsAwaitingChunkLoad.remove(chunkHash); - } - } - } - } - - /** - * Registers a controller as dead. It will be cleaned up at the end of the - * next world tick. Note that a controller must shed all of its blocks - * before being marked as dead, or the system will complain at you. - * - * @param deadController - * The controller which is dead. - */ - public void addDeadController(MultiblockControllerBase deadController) - { - this.deadControllers.add(deadController); - } - - /** - * Registers a controller as dirty - its list of attached blocks has - * changed, and it must be re-checked for assembly and, possibly, for - * orphans. - * - * @param dirtyController - * The dirty controller. - */ - public void addDirtyController(MultiblockControllerBase dirtyController) - { - this.dirtyControllers.add(dirtyController); - } - - /** - * Use this only if you know what you're doing. You should rarely need to - * iterate over all controllers in a world! - * - * @return An (unmodifiable) set of controllers which are active in this - * world. - */ - public Set getControllers() - { - return Collections.unmodifiableSet(controllers); - } - - /* *** PRIVATE HELPERS *** */ - - private void addOrphanedPartThreadsafe(IMultiblockPart part) - { - synchronized (orphanedPartsMutex) - { - orphanedParts.add(part); - } - } - - private void addAllOrphanedPartsThreadsafe( - Collection parts) - { - synchronized (orphanedPartsMutex) - { - orphanedParts.addAll(parts); - } - } - - private String clientOrServer() - { - return worldObj.isRemote ? "CLIENT" : "SERVER"; - } -} diff --git a/src/main/java/erogenousbeef/coreTR/multiblock/rectangular/PartPosition.java b/src/main/java/erogenousbeef/coreTR/multiblock/rectangular/PartPosition.java deleted file mode 100644 index f53be9f26..000000000 --- a/src/main/java/erogenousbeef/coreTR/multiblock/rectangular/PartPosition.java +++ /dev/null @@ -1,22 +0,0 @@ -package erogenousbeef.coreTR.multiblock.rectangular; - -public enum PartPosition -{ - Unknown, Interior, FrameCorner, Frame, TopFace, BottomFace, NorthFace, SouthFace, EastFace, WestFace; - - public boolean isFace(PartPosition position) - { - switch (position) - { - case TopFace: - case BottomFace: - case NorthFace: - case SouthFace: - case EastFace: - case WestFace: - return true; - default: - return false; - } - } -} diff --git a/src/main/java/erogenousbeef/coreTR/multiblock/rectangular/RectangularMultiblockControllerBase.java b/src/main/java/erogenousbeef/coreTR/multiblock/rectangular/RectangularMultiblockControllerBase.java deleted file mode 100644 index ff82677d4..000000000 --- a/src/main/java/erogenousbeef/coreTR/multiblock/rectangular/RectangularMultiblockControllerBase.java +++ /dev/null @@ -1,206 +0,0 @@ -package erogenousbeef.coreTR.multiblock.rectangular; - -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; -import erogenousbeef.coreTR.common.CoordTriplet; -import erogenousbeef.coreTR.multiblock.MultiblockControllerBase; -import erogenousbeef.coreTR.multiblock.MultiblockValidationException; - -public abstract class RectangularMultiblockControllerBase extends - MultiblockControllerBase { - - protected RectangularMultiblockControllerBase(World world) - { - super(world); - } - - /** - * @return True if the machine is "whole" and should be assembled. False - * otherwise. - */ - protected void isMachineWhole() throws MultiblockValidationException - { - if (connectedParts.size() < getMinimumNumberOfBlocksForAssembledMachine()) - { - throw new MultiblockValidationException("Machine is too small."); - } - - CoordTriplet maximumCoord = getMaximumCoord(); - CoordTriplet minimumCoord = getMinimumCoord(); - - // Quickly check for exceeded dimensions - int deltaX = maximumCoord.x - minimumCoord.x + 1; - int deltaY = maximumCoord.y - minimumCoord.y + 1; - int deltaZ = maximumCoord.z - minimumCoord.z + 1; - - int maxX = getMaximumXSize(); - int maxY = getMaximumYSize(); - int maxZ = getMaximumZSize(); - int minX = getMinimumXSize(); - int minY = getMinimumYSize(); - int minZ = getMinimumZSize(); - - if (maxX > 0 && deltaX > maxX) - { - throw new MultiblockValidationException( - String.format( - "Machine is too large, it may be at most %d blocks in the X dimension", - maxX)); - } - if (maxY > 0 && deltaY > maxY) - { - throw new MultiblockValidationException( - String.format( - "Machine is too large, it may be at most %d blocks in the Y dimension", - maxY)); - } - if (maxZ > 0 && deltaZ > maxZ) - { - throw new MultiblockValidationException( - String.format( - "Machine is too large, it may be at most %d blocks in the Z dimension", - maxZ)); - } - if (deltaX < minX) - { - throw new MultiblockValidationException( - String.format( - "Machine is too small, it must be at least %d blocks in the X dimension", - minX)); - } - if (deltaY < minY) - { - throw new MultiblockValidationException( - String.format( - "Machine is too small, it must be at least %d blocks in the Y dimension", - minY)); - } - if (deltaZ < minZ) - { - throw new MultiblockValidationException( - String.format( - "Machine is too small, it must be at least %d blocks in the Z dimension", - minZ)); - } - - // Now we run a simple check on each block within that volume. - // Any block deviating = NO DEAL SIR - TileEntity te; - RectangularMultiblockTileEntityBase part; - Class myClass = this - .getClass(); - - for (int x = minimumCoord.x; x <= maximumCoord.x; x++) - { - for (int y = minimumCoord.y; y <= maximumCoord.y; y++) - { - for (int z = minimumCoord.z; z <= maximumCoord.z; z++) - { - // Okay, figure out what sort of block this should be. - - te = this.worldObj.getTileEntity(x, y, z); - if (te instanceof RectangularMultiblockTileEntityBase) - { - part = (RectangularMultiblockTileEntityBase) te; - - // Ensure this part should actually be allowed within a - // cube of this controller's type - if (!myClass.equals(part.getMultiblockControllerType())) - { - throw new MultiblockValidationException( - String.format( - "Part @ %d, %d, %d is incompatible with machines of type %s", - x, y, z, myClass.getSimpleName())); - } - } else - { - // This is permitted so that we can incorporate certain - // non-multiblock parts inside interiors - part = null; - } - - // Validate block type against both part-level and - // material-level validators. - int extremes = 0; - if (x == minimumCoord.x) - { - extremes++; - } - if (y == minimumCoord.y) - { - extremes++; - } - if (z == minimumCoord.z) - { - extremes++; - } - - if (x == maximumCoord.x) - { - extremes++; - } - if (y == maximumCoord.y) - { - extremes++; - } - if (z == maximumCoord.z) - { - extremes++; - } - - if (extremes >= 2) - { - if (part != null) - { - part.isGoodForFrame(); - } else - { - isBlockGoodForFrame(this.worldObj, x, y, z); - } - } else if (extremes == 1) - { - if (y == maximumCoord.y) - { - if (part != null) - { - part.isGoodForTop(); - } else - { - isBlockGoodForTop(this.worldObj, x, y, z); - } - } else if (y == minimumCoord.y) - { - if (part != null) - { - part.isGoodForBottom(); - } else - { - isBlockGoodForBottom(this.worldObj, x, y, z); - } - } else - { - // Side - if (part != null) - { - part.isGoodForSides(); - } else - { - isBlockGoodForSides(this.worldObj, x, y, z); - } - } - } else - { - if (part != null) - { - part.isGoodForInterior(); - } else - { - isBlockGoodForInterior(this.worldObj, x, y, z); - } - } - } - } - } - } - -} diff --git a/src/main/java/erogenousbeef/coreTR/multiblock/rectangular/RectangularMultiblockTileEntityBase.java b/src/main/java/erogenousbeef/coreTR/multiblock/rectangular/RectangularMultiblockTileEntityBase.java deleted file mode 100644 index fb9b70f75..000000000 --- a/src/main/java/erogenousbeef/coreTR/multiblock/rectangular/RectangularMultiblockTileEntityBase.java +++ /dev/null @@ -1,132 +0,0 @@ -package erogenousbeef.coreTR.multiblock.rectangular; - -import net.minecraftforge.common.util.ForgeDirection; -import erogenousbeef.coreTR.common.CoordTriplet; -import erogenousbeef.coreTR.multiblock.MultiblockControllerBase; -import erogenousbeef.coreTR.multiblock.MultiblockTileEntityBase; -import erogenousbeef.coreTR.multiblock.MultiblockValidationException; - -public abstract class RectangularMultiblockTileEntityBase extends - MultiblockTileEntityBase { - - PartPosition position; - ForgeDirection outwards; - - public RectangularMultiblockTileEntityBase() - { - super(); - - position = PartPosition.Unknown; - outwards = ForgeDirection.UNKNOWN; - } - - // Positional Data - public ForgeDirection getOutwardsDir() - { - return outwards; - } - - public PartPosition getPartPosition() - { - return position; - } - - // Handlers from MultiblockTileEntityBase - @Override - public void onAttached(MultiblockControllerBase newController) - { - super.onAttached(newController); - recalculateOutwardsDirection(newController.getMinimumCoord(), - newController.getMaximumCoord()); - } - - @Override - public void onMachineAssembled(MultiblockControllerBase controller) - { - CoordTriplet maxCoord = controller.getMaximumCoord(); - CoordTriplet minCoord = controller.getMinimumCoord(); - - // Discover where I am on the reactor - recalculateOutwardsDirection(minCoord, maxCoord); - } - - @Override - public void onMachineBroken() - { - position = PartPosition.Unknown; - outwards = ForgeDirection.UNKNOWN; - } - - // Positional helpers - public void recalculateOutwardsDirection(CoordTriplet minCoord, - CoordTriplet maxCoord) - { - outwards = ForgeDirection.UNKNOWN; - position = PartPosition.Unknown; - - int facesMatching = 0; - if (maxCoord.x == this.xCoord || minCoord.x == this.xCoord) - { - facesMatching++; - } - if (maxCoord.y == this.yCoord || minCoord.y == this.yCoord) - { - facesMatching++; - } - if (maxCoord.z == this.zCoord || minCoord.z == this.zCoord) - { - facesMatching++; - } - - if (facesMatching <= 0) - { - position = PartPosition.Interior; - } else if (facesMatching >= 3) - { - position = PartPosition.FrameCorner; - } else if (facesMatching == 2) - { - position = PartPosition.Frame; - } else - { - // 1 face matches - if (maxCoord.x == this.xCoord) - { - position = PartPosition.EastFace; - outwards = ForgeDirection.EAST; - } else if (minCoord.x == this.xCoord) - { - position = PartPosition.WestFace; - outwards = ForgeDirection.WEST; - } else if (maxCoord.z == this.zCoord) - { - position = PartPosition.SouthFace; - outwards = ForgeDirection.SOUTH; - } else if (minCoord.z == this.zCoord) - { - position = PartPosition.NorthFace; - outwards = ForgeDirection.NORTH; - } else if (maxCoord.y == this.yCoord) - { - position = PartPosition.TopFace; - outwards = ForgeDirection.UP; - } else - { - position = PartPosition.BottomFace; - outwards = ForgeDirection.DOWN; - } - } - } - - // /// Validation Helpers (IMultiblockPart) - public abstract void isGoodForFrame() throws MultiblockValidationException; - - public abstract void isGoodForSides() throws MultiblockValidationException; - - public abstract void isGoodForTop() throws MultiblockValidationException; - - public abstract void isGoodForBottom() throws MultiblockValidationException; - - public abstract void isGoodForInterior() - throws MultiblockValidationException; -} diff --git a/src/main/java/powercrystals/minefactoryreloaded/api/IDeepStorageUnit.java b/src/main/java/powercrystals/minefactoryreloaded/api/IDeepStorageUnit.java deleted file mode 100644 index 2ec1f76b3..000000000 --- a/src/main/java/powercrystals/minefactoryreloaded/api/IDeepStorageUnit.java +++ /dev/null @@ -1,35 +0,0 @@ -package powercrystals.minefactoryreloaded.api; - -import net.minecraft.item.ItemStack; - -public interface IDeepStorageUnit { - - /** - * @return A populated ItemStack with stackSize for the full amount of - * materials in the DSU.
- * May have a stackSize > getMaxStackSize(). May have a stackSize of - * 0 (indicating locked contents). - */ - ItemStack getStoredItemType(); - - /** - * Sets the total amount of the item currently being stored, or zero if all - * items are to be removed. - */ - void setStoredItemCount(int amount); - - /** - * Sets the type of the stored item and initializes the number of stored - * items to amount. - *

- * Will overwrite any existing stored items. - */ - void setStoredItemType(ItemStack type, int amount); - - /** - * @return The maximum number of items the DSU can hold.
- * May change based on the current type stored. - */ - int getMaxStoredCount(); - -} diff --git a/src/main/java/techreborn/Core.java b/src/main/java/techreborn/Core.java index 60310219e..241e57f6d 100644 --- a/src/main/java/techreborn/Core.java +++ b/src/main/java/techreborn/Core.java @@ -11,10 +11,13 @@ import cpw.mods.fml.common.event.FMLServerStartingEvent; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.network.NetworkRegistry; import cpw.mods.fml.common.registry.GameRegistry; -import erogenousbeef.coreTR.multiblock.MultiblockEventHandler; -import erogenousbeef.coreTR.multiblock.MultiblockServerTickHandler; import net.minecraftforge.common.MinecraftForge; import org.apache.commons.lang3.time.StopWatch; +import reborncore.common.multiblock.MultiblockEventHandler; +import reborncore.common.multiblock.MultiblockServerTickHandler; +import reborncore.common.packets.AddDiscriminatorEvent; +import reborncore.common.util.LogHelper; +import reborncore.common.util.VersionChecker; import techreborn.achievement.TRAchievements; import techreborn.api.recipe.RecipeHandler; import techreborn.api.recipe.recipeConfig.RecipeConfigManager; @@ -26,12 +29,10 @@ import techreborn.config.ConfigTechReborn; import techreborn.events.TRTickHandler; import techreborn.init.*; import techreborn.lib.ModInfo; -import techreborn.packets.PacketHandler; -import techreborn.packets.PacketPipeline; +import techreborn.packets.PacketAesu; +import techreborn.packets.PacketIdsu; import techreborn.proxies.CommonProxy; import techreborn.tiles.idsu.IDSUManager; -import techreborn.util.LogHelper; -import techreborn.util.VersionChecker; import techreborn.world.TROreGen; import java.io.File; @@ -46,14 +47,17 @@ public class Core { @Mod.Instance public static Core INSTANCE; - public static final PacketPipeline packetPipeline = new PacketPipeline(); - public VersionChecker versionChecker; + public static LogHelper logHelper = new LogHelper(new ModInfo()); + @Mod.EventHandler public void preinit(FMLPreInitializationEvent event) { event.getModMetadata().version = ModInfo.MOD_VERSION; INSTANCE = this; + FMLCommonHandler.instance().bus().register(this); + MinecraftForge.EVENT_BUS.register(this); + String path = event.getSuggestedConfigurationFile().getAbsolutePath() .replace(ModInfo.MOD_ID, "TechReborn"); @@ -64,9 +68,9 @@ public class Core { } RecipeConfigManager.load(event.getModConfigurationDirectory()); - versionChecker = new VersionChecker("TechReborn"); + versionChecker = new VersionChecker("TechReborn", new ModInfo()); versionChecker.checkVersionThreaded(); - LogHelper.info("PreInitialization Complete"); + logHelper.info("PreInitialization Complete"); } @Mod.EventHandler @@ -83,7 +87,7 @@ public class Core { StopWatch watch = new StopWatch(); watch.start(); ModRecipes.init(); - LogHelper.all(watch + " : main recipes"); + logHelper.all(watch + " : main recipes"); watch.stop(); //Client only init, needs to be done before parts system proxy.init(); @@ -96,9 +100,7 @@ public class Core { // DungeonLoot.init(); // Register Gui Handler NetworkRegistry.INSTANCE.registerGuiHandler(INSTANCE, new GuiHandler()); - // packets - PacketHandler.setChannels(NetworkRegistry.INSTANCE.newChannel( - ModInfo.MOD_ID + "_packets", new PacketHandler())); + // Achievements TRAchievements.init(); // Multiblock events @@ -108,8 +110,7 @@ public class Core { MinecraftForge.EVENT_BUS.register(IDSUManager.INSTANCE); FMLCommonHandler.instance().bus().register(new MultiblockServerTickHandler()); FMLCommonHandler.instance().bus().register(new TRTickHandler()); - packetPipeline.initalise(); - LogHelper.info("Initialization Complete"); + logHelper.info("Initialization Complete"); } @Mod.EventHandler @@ -118,8 +119,7 @@ public class Core { for (ICompatModule compatModule : CompatManager.INSTANCE.compatModules) { compatModule.postInit(event); } - packetPipeline.postInitialise(); - LogHelper.info(RecipeHandler.recipeList.size() + " recipes loaded"); + logHelper.info(RecipeHandler.recipeList.size() + " recipes loaded"); // RecipeHandler.scanForDupeRecipes(); @@ -140,4 +140,11 @@ public class Core { ConfigTechReborn.Configs(); } } + + + @SubscribeEvent + public void addDiscriminator(AddDiscriminatorEvent event) { + event.getPacketHandler().addDiscriminator(event.getPacketHandler().nextDiscriminator, PacketAesu.class); + event.getPacketHandler().addDiscriminator(event.getPacketHandler().nextDiscriminator, PacketIdsu.class); + } } diff --git a/src/main/java/techreborn/achievement/AchievementTriggerer.java b/src/main/java/techreborn/achievement/AchievementTriggerer.java index 112ff9145..79339c45a 100644 --- a/src/main/java/techreborn/achievement/AchievementTriggerer.java +++ b/src/main/java/techreborn/achievement/AchievementTriggerer.java @@ -5,6 +5,8 @@ import cpw.mods.fml.common.gameevent.PlayerEvent.ItemCraftedEvent; import cpw.mods.fml.common.gameevent.PlayerEvent.ItemPickupEvent; import net.minecraft.item.ItemStack; import net.minecraft.stats.Achievement; +import reborncore.common.achievement.ICraftAchievement; +import reborncore.common.achievement.IPickupAchievement; public class AchievementTriggerer { diff --git a/src/main/java/techreborn/achievement/ICraftAchievement.java b/src/main/java/techreborn/achievement/ICraftAchievement.java deleted file mode 100644 index 911952c99..000000000 --- a/src/main/java/techreborn/achievement/ICraftAchievement.java +++ /dev/null @@ -1,13 +0,0 @@ -package techreborn.achievement; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.stats.Achievement; - -public interface ICraftAchievement { - - public Achievement getAchievementOnCraft(ItemStack stack, - EntityPlayer player, IInventory matrix); - -} diff --git a/src/main/java/techreborn/achievement/IPickupAchievement.java b/src/main/java/techreborn/achievement/IPickupAchievement.java deleted file mode 100644 index aff033e8d..000000000 --- a/src/main/java/techreborn/achievement/IPickupAchievement.java +++ /dev/null @@ -1,13 +0,0 @@ -package techreborn.achievement; - -import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.stats.Achievement; - -public interface IPickupAchievement { - - public Achievement getAchievementOnPickup(ItemStack stack, - EntityPlayer player, EntityItem item); - -} diff --git a/src/main/java/techreborn/api/IListInfoProvider.java b/src/main/java/techreborn/api/IListInfoProvider.java deleted file mode 100644 index 081064f46..000000000 --- a/src/main/java/techreborn/api/IListInfoProvider.java +++ /dev/null @@ -1,9 +0,0 @@ -package techreborn.api; - - -import java.util.List; - -public interface IListInfoProvider { - - void addInfo(List info, boolean isRealTile); -} diff --git a/src/main/java/techreborn/api/TechRebornBlocks.java b/src/main/java/techreborn/api/TechRebornBlocks.java index 1a9452074..723e2c5aa 100644 --- a/src/main/java/techreborn/api/TechRebornBlocks.java +++ b/src/main/java/techreborn/api/TechRebornBlocks.java @@ -5,10 +5,10 @@ import net.minecraft.block.Block; public class TechRebornBlocks { - public static Block getBlock(String name){ + public static Block getBlock(String name) { try { Object e = Class.forName("techreborn.init.ModBlocks").getField(name).get(null); - return e instanceof Block ?(Block)e:null; + return e instanceof Block ? (Block) e : null; } catch (NoSuchFieldException e1) { e1.printStackTrace(); return null; diff --git a/src/main/java/techreborn/api/TechRebornItems.java b/src/main/java/techreborn/api/TechRebornItems.java index 715d8ed6e..3930d41fd 100644 --- a/src/main/java/techreborn/api/TechRebornItems.java +++ b/src/main/java/techreborn/api/TechRebornItems.java @@ -4,10 +4,10 @@ import net.minecraft.item.Item; public class TechRebornItems { - public static Item getItem(String name){ + public static Item getItem(String name) { try { Object e = Class.forName("techreborn.init.ModItems").getField(name).get(null); - return e instanceof Item ?(Item)e:null; + return e instanceof Item ? (Item) e : null; } catch (NoSuchFieldException e1) { e1.printStackTrace(); return null; diff --git a/src/main/java/techreborn/api/fuel/FluidPowerManager.java b/src/main/java/techreborn/api/fuel/FluidPowerManager.java deleted file mode 100644 index 8e532cb96..000000000 --- a/src/main/java/techreborn/api/fuel/FluidPowerManager.java +++ /dev/null @@ -1,14 +0,0 @@ -package techreborn.api.fuel; - -import net.minecraftforge.fluids.Fluid; - -import java.util.HashMap; - -public class FluidPowerManager { - - /** - * Use this to register a fluid with a power value - */ - public static HashMap fluidPowerValues = new HashMap(); - -} diff --git a/src/main/java/techreborn/api/fuel/package-info.java b/src/main/java/techreborn/api/fuel/package-info.java deleted file mode 100644 index a2597367e..000000000 --- a/src/main/java/techreborn/api/fuel/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -@API(apiVersion = "@MODVERSION@", owner = "techreborn", provides = "techrebornAPI") package techreborn.api.fuel; - -import cpw.mods.fml.common.API; - diff --git a/src/main/java/techreborn/api/power/IEnergyInterfaceItem.java b/src/main/java/techreborn/api/power/IEnergyInterfaceItem.java index 2051b74cc..416c87ef0 100644 --- a/src/main/java/techreborn/api/power/IEnergyInterfaceItem.java +++ b/src/main/java/techreborn/api/power/IEnergyInterfaceItem.java @@ -77,7 +77,7 @@ public interface IEnergyInterfaceItem { /** * @return if it can provide energy */ - public boolean canProvideEnergy(ItemStack stack ); + public boolean canProvideEnergy(ItemStack stack); public double getMaxTransfer(ItemStack stack); diff --git a/src/main/java/techreborn/api/recipe/RecipeCrafter.java b/src/main/java/techreborn/api/recipe/RecipeCrafter.java index b2a342a35..fee2c862d 100644 --- a/src/main/java/techreborn/api/recipe/RecipeCrafter.java +++ b/src/main/java/techreborn/api/recipe/RecipeCrafter.java @@ -2,13 +2,10 @@ package techreborn.api.recipe; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.network.Packet; -import net.minecraft.network.play.server.S35PacketUpdateTileEntity; +import reborncore.common.util.Inventory; +import reborncore.common.util.ItemUtils; import techreborn.api.power.IEnergyInterfaceTile; -import techreborn.packets.PacketHandler; import techreborn.tiles.TileMachineBase; -import techreborn.util.Inventory; -import techreborn.util.ItemUtils; import java.util.ArrayList; @@ -283,7 +280,7 @@ public class RecipeCrafter { private boolean isActive() { return currentRecipe != null && energy.getEnergy() >= currentRecipe.euPerTick(); -} + } public void addSpeedMulti(double amount) { if (speedMultiplier + amount <= 0.99) { @@ -319,11 +316,11 @@ public class RecipeCrafter { public void setIsActive() { - if(isActive()){ - parentTile.getWorldObj().setBlockMetadataWithNotify(parentTile.xCoord, parentTile.yCoord, parentTile.zCoord, 1, 2); - } else { - parentTile.getWorldObj().setBlockMetadataWithNotify(parentTile.xCoord, parentTile.yCoord, parentTile.zCoord, 0, 2); - } + if (isActive()) { + parentTile.getWorldObj().setBlockMetadataWithNotify(parentTile.xCoord, parentTile.yCoord, parentTile.zCoord, 1, 2); + } else { + parentTile.getWorldObj().setBlockMetadataWithNotify(parentTile.xCoord, parentTile.yCoord, parentTile.zCoord, 0, 2); + } parentTile.getWorldObj().markBlockForUpdate(parentTile.xCoord, parentTile.yCoord, parentTile.zCoord); } diff --git a/src/main/java/techreborn/api/recipe/RecipeHandler.java b/src/main/java/techreborn/api/recipe/RecipeHandler.java index a39e0fbda..b18f9571c 100644 --- a/src/main/java/techreborn/api/recipe/RecipeHandler.java +++ b/src/main/java/techreborn/api/recipe/RecipeHandler.java @@ -2,9 +2,9 @@ package techreborn.api.recipe; import net.minecraft.item.ItemStack; import org.apache.commons.lang3.time.StopWatch; +import reborncore.common.util.ItemUtils; +import techreborn.Core; import techreborn.api.recipe.recipeConfig.RecipeConfigManager; -import techreborn.util.ItemUtils; -import techreborn.util.LogHelper; import java.util.ArrayList; import java.util.HashMap; @@ -89,14 +89,14 @@ public class RecipeHandler { for (ItemStack inputs : baseRecipeType.getInputs()) { itemInfo.append(":" + inputs.getItem().getUnlocalizedName() + "," + inputs.getDisplayName() + "," + inputs.stackSize); } - LogHelper.all(stackMap.get(baseRecipeType)); + Core.logHelper.all(stackMap.get(baseRecipeType)); // throw new Exception("Found a duplicate recipe for " + baseRecipeType.getRecipeName() + " with inputs " + itemInfo.toString()); } } } } } - LogHelper.all(watch + " : Scanning dupe recipes"); + Core.logHelper.all(watch + " : Scanning dupe recipes"); watch.stop(); } diff --git a/src/main/java/techreborn/api/upgrade/UpgradeHandler.java b/src/main/java/techreborn/api/upgrade/UpgradeHandler.java index f915ddc3c..89823d768 100644 --- a/src/main/java/techreborn/api/upgrade/UpgradeHandler.java +++ b/src/main/java/techreborn/api/upgrade/UpgradeHandler.java @@ -1,8 +1,8 @@ package techreborn.api.upgrade; import net.minecraft.item.ItemStack; +import reborncore.common.util.Inventory; import techreborn.api.recipe.RecipeCrafter; -import techreborn.util.Inventory; import java.util.ArrayList; diff --git a/src/main/java/techreborn/asm/ClassTransformation.java b/src/main/java/techreborn/asm/ClassTransformation.java deleted file mode 100644 index 517689852..000000000 --- a/src/main/java/techreborn/asm/ClassTransformation.java +++ /dev/null @@ -1,129 +0,0 @@ -package techreborn.asm; - -import cpw.mods.fml.common.Loader; -import net.minecraft.launchwrapper.IClassTransformer; -import org.objectweb.asm.ClassReader; -import org.objectweb.asm.ClassWriter; -import org.objectweb.asm.Type; -import org.objectweb.asm.tree.AnnotationNode; -import org.objectweb.asm.tree.ClassNode; -import org.objectweb.asm.tree.FieldNode; -import org.objectweb.asm.tree.MethodNode; - -import java.util.Iterator; -import java.util.List; - -public class ClassTransformation implements IClassTransformer { - - private static final String[] emptyList = {}; - static String strippableDesc; - - public ClassTransformation() { - strippableDesc = Type.getDescriptor(Strippable.class); - } - - static boolean strip(ClassNode cn) { - boolean altered = false; - if (cn.methods != null) { - Iterator iter = cn.methods.iterator(); - while (iter.hasNext()) { - MethodNode mn = iter.next(); - if (mn.visibleAnnotations != null) { - for (AnnotationNode node : mn.visibleAnnotations) { - if (checkRemove(parseAnnotation(node, strippableDesc), iter)) { - altered = true; - break; - } - } - } - } - } - if (cn.fields != null) { - Iterator iter = cn.fields.iterator(); - while (iter.hasNext()) { - FieldNode fn = iter.next(); - if (fn.visibleAnnotations != null) { - for (AnnotationNode node : fn.visibleAnnotations) { - if (checkRemove(parseAnnotation(node, strippableDesc), iter)) { - altered = true; - break; - } - } - } - } - } - return altered; - } - - - static AnnotationInfo parseAnnotation(AnnotationNode node, String desc) { - AnnotationInfo info = null; - if (node.desc.equals(desc)) { - info = new AnnotationInfo(); - if (node.values != null) { - List values = node.values; - for (int i = 0, e = values.size(); i < e; ) { - Object k = values.get(i++); - Object v = values.get(i++); - if ("value".equals(k)) { - if (!(v instanceof List && ((List) v).size() > 0 && ((List) v).get(0) instanceof String)) { - continue; - } - info.values = ((List) v).toArray(emptyList); - } - } - } - } - return info; - } - - static boolean checkRemove(AnnotationInfo node, Iterator iter) { - if (node != null) { - boolean needsRemoved = false; - String[] value = node.values; - for (int j = 0, l = value.length; j < l; ++j) { - String clazz = value[j]; - String mod = clazz.substring(4); - if (clazz.startsWith("mod:")) { - int i = mod.indexOf('@'); - if (i > 0) { - mod = mod.substring(0, i); - } - if (!Loader.isModLoaded(mod)) { - needsRemoved = true; - } - } - if (needsRemoved) { - break; - } - } - if (needsRemoved) { - iter.remove(); - return true; - } - } - return false; - } - - @Override - public byte[] transform(String name, String transformedName, byte[] bytes) { - if (bytes == null) { - return null; - } - ClassReader cr = new ClassReader(bytes); - ClassNode cn = new ClassNode(); - cr.accept(cn, 0); - if (strip(cn)) { - ClassWriter cw = new ClassWriter(0); - cn.accept(cw); - bytes = cw.toByteArray(); - LoadingPlugin.stripedClases++; - } - return bytes; - } - - static class AnnotationInfo { - public String side = "NONE"; - public String[] values = emptyList; - } -} \ No newline at end of file diff --git a/src/main/java/techreborn/asm/LoadingPlugin.java b/src/main/java/techreborn/asm/LoadingPlugin.java deleted file mode 100644 index 77b66a2c7..000000000 --- a/src/main/java/techreborn/asm/LoadingPlugin.java +++ /dev/null @@ -1,63 +0,0 @@ -package techreborn.asm; - -import cpw.mods.fml.common.DummyModContainer; -import cpw.mods.fml.common.ModMetadata; -import cpw.mods.fml.relauncher.IFMLCallHook; -import cpw.mods.fml.relauncher.IFMLLoadingPlugin; -import techreborn.lib.ModInfo; - -import java.util.Map; - -@IFMLLoadingPlugin.MCVersion("1.7.10") -public class LoadingPlugin implements IFMLLoadingPlugin { - - public static boolean runtimeDeobfEnabled = false; - public static int stripedClases = 0; - - @Override - public String[] getASMTransformerClass() { - return new String[]{"techreborn.asm.ClassTransformation"}; - } - - @Override - public String getModContainerClass() { - return DummyMod.class.getName(); - } - - @Override - public String getSetupClass() { - return DummyMod.class.getName(); - } - - @Override - public void injectData(Map data) { - runtimeDeobfEnabled = (Boolean) data.get("runtimeDeobfuscationEnabled"); - } - - @Override - public String getAccessTransformerClass() { - return null; - } - - public static class DummyMod extends DummyModContainer implements IFMLCallHook { - public DummyMod() { - super(new ModMetadata()); - ModMetadata md = getMetadata(); - md.autogenerated = true; - md.modId = ModInfo.MOD_ID + "asm"; - md.name = md.description = "Techreborn-ASM"; - md.parent = ModInfo.MOD_ID; - md.version = "000"; - } - - @Override - public void injectData(Map data) { - - } - - @Override - public Void call() throws Exception { - return null; - } - } -} diff --git a/src/main/java/techreborn/asm/Strippable.java b/src/main/java/techreborn/asm/Strippable.java deleted file mode 100644 index f5bf86a05..000000000 --- a/src/main/java/techreborn/asm/Strippable.java +++ /dev/null @@ -1,18 +0,0 @@ -package techreborn.asm; - -import java.lang.annotation.*; - -/** - * When used on a class, methods from referenced interfaces will not be removed
- * When using this annotation on methods, ensure you do not switch on an enum inside that method. JavaC implementation details means this will cause crashes. - *

- * Can also strip on modid using "mod:" as a value
- */ -@Documented -@Retention(RetentionPolicy.RUNTIME) -@Target({ElementType.METHOD, ElementType.CONSTRUCTOR, ElementType.FIELD, ElementType.TYPE}) -public @interface Strippable { - - public String[] value(); - -} \ No newline at end of file diff --git a/src/main/java/techreborn/blocks/BlockComputerCube.java b/src/main/java/techreborn/blocks/BlockComputerCube.java index 320cf4bb8..e98dce22b 100644 --- a/src/main/java/techreborn/blocks/BlockComputerCube.java +++ b/src/main/java/techreborn/blocks/BlockComputerCube.java @@ -6,7 +6,6 @@ import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; public class BlockComputerCube extends BlockMachineBase { diff --git a/src/main/java/techreborn/blocks/BlockMachineBase.java b/src/main/java/techreborn/blocks/BlockMachineBase.java index f79317f5b..17a5b4ccd 100644 --- a/src/main/java/techreborn/blocks/BlockMachineBase.java +++ b/src/main/java/techreborn/blocks/BlockMachineBase.java @@ -2,7 +2,10 @@ package techreborn.blocks; import cpw.mods.fml.common.Loader; import ic2.api.item.IC2Items; -import net.minecraft.block.*; +import net.minecraft.block.Block; +import net.minecraft.block.BlockContainer; +import net.minecraft.block.BlockDynamicLiquid; +import net.minecraft.block.BlockStaticLiquid; import net.minecraft.block.material.Material; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EnumCreatureType; @@ -20,7 +23,6 @@ import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.BlockFluidBase; import techreborn.client.TechRebornCreativeTab; import techreborn.init.ModBlocks; -import techreborn.lib.Functions; import techreborn.tiles.TileMachineBase; import java.util.ArrayList; @@ -149,48 +151,48 @@ public class BlockMachineBase extends BlockContainer { } } - public void setTileRotation(World world, int x, int y, int z, int meta){ - if(world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileMachineBase){ + public void setTileRotation(World world, int x, int y, int z, int meta) { + if (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileMachineBase) { ((TileMachineBase) world.getTileEntity(x, y, z)).setRotation(meta); } } - public int getTileRotation(World world, int x, int y, int z){ - if(world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileMachineBase){ + public int getTileRotation(World world, int x, int y, int z) { + if (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileMachineBase) { return ((TileMachineBase) world.getTileEntity(x, y, z)).getRotation(); } return 0; } - public int getTileRotation(IBlockAccess blockAccess, int x, int y, int z){ + public int getTileRotation(IBlockAccess blockAccess, int x, int y, int z) { return blockAccess.getTileEntity(x, y, z) != null ? getTileRotation(blockAccess.getTileEntity(x, y, z).getWorldObj(), x, y, z) : 0; } @Override public ArrayList getDrops(World world, int x, int y, int z, int metadata, int fortune) { ArrayList items = new ArrayList(); - if(Loader.isModLoaded("IC2")){ + if (Loader.isModLoaded("IC2")) { ItemStack stack = IC2Items.getItem(isAdvanced() ? "advancedMachine" : "machine").copy(); stack.stackSize = 1; items.add(stack); } else { - items.add(isAdvanced()? new ItemStack(Item.getItemFromBlock(ModBlocks.MachineCasing), 1, 2) : new ItemStack(Item.getItemFromBlock(ModBlocks.MachineCasing), 1, 0)); + items.add(isAdvanced() ? new ItemStack(Item.getItemFromBlock(ModBlocks.MachineCasing), 1, 2) : new ItemStack(Item.getItemFromBlock(ModBlocks.MachineCasing), 1, 0)); } System.out.println(items.toString()); return items; } - public boolean isAdvanced(){ + public boolean isAdvanced() { return false; } @Override public boolean rotateBlock(World worldObj, int x, int y, int z, ForgeDirection axis) { - if(axis == ForgeDirection.UNKNOWN){ + if (axis == ForgeDirection.UNKNOWN) { return false; } else { TileEntity tile = worldObj.getTileEntity(x, y, z); - if(tile != null && tile instanceof TileMachineBase){ + if (tile != null && tile instanceof TileMachineBase) { TileMachineBase machineBase = (TileMachineBase) tile; machineBase.setRotation(ForgeDirection.getOrientation(machineBase.getRotation()).getRotation(axis).ordinal()); return true; diff --git a/src/main/java/techreborn/blocks/BlockMachineCasing.java b/src/main/java/techreborn/blocks/BlockMachineCasing.java index 840f74bf5..87ec2a629 100644 --- a/src/main/java/techreborn/blocks/BlockMachineCasing.java +++ b/src/main/java/techreborn/blocks/BlockMachineCasing.java @@ -2,7 +2,6 @@ package techreborn.blocks; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import erogenousbeef.coreTR.multiblock.BlockMultiblockBase; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -13,8 +12,9 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import reborncore.client.texture.ConnectedTexture; +import reborncore.common.multiblock.BlockMultiblockBase; import techreborn.client.TechRebornCreativeTab; -import techreborn.client.texture.ConnectedTexture; import techreborn.client.texture.CasingConnectedTextureGenerator; import techreborn.config.ConfigTechReborn; import techreborn.tiles.TileMachineCasing; @@ -69,7 +69,7 @@ public class BlockMachineCasing extends BlockMultiblockBase { @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconRegister) { this.icons = new IIcon[types.length][16]; - if(!ConfigTechReborn.useConnectedTextures){ + if (!ConfigTechReborn.useConnectedTextures) { for (int i = 0; i < types.length; i++) { for (int j = 0; j < 15; j++) { icons[i][j] = iconRegister.registerIcon("techreborn:" + "machine/casing" @@ -79,7 +79,7 @@ public class BlockMachineCasing extends BlockMultiblockBase { return; } for (int i = 0; i < types.length; i++) { - // up down left right + // up down left right icons[i][0] = CasingConnectedTextureGenerator.genIcon(new ConnectedTexture(true, true, true, true), iconRegister, 0, i, types); icons[i][1] = CasingConnectedTextureGenerator.genIcon(new ConnectedTexture(true, false, true, true), iconRegister, 1, i, types); icons[i][2] = CasingConnectedTextureGenerator.genIcon(new ConnectedTexture(false, true, true, true), iconRegister, 2, i, types); @@ -120,501 +120,301 @@ public class BlockMachineCasing extends BlockMultiblockBase { /** * This is taken from https://github.com/SlimeKnights/TinkersConstruct/blob/a7405a3d10318bb5c486ec75fb62897a8149d1a6/src/main/java/tconstruct/smeltery/blocks/GlassBlockConnected.java */ - public IIcon getConnectedBlockTexture (IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5, IIcon[] icons) - { + public IIcon getConnectedBlockTexture(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5, IIcon[] icons) { boolean isOpenUp = false, isOpenDown = false, isOpenLeft = false, isOpenRight = false; - switch (par5) - { + switch (par5) { case 0: - if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2 - 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 - 1, par3, par4))) - { + if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2 - 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 - 1, par3, par4))) { isOpenDown = true; } - if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2 + 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 + 1, par3, par4))) - { + if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2 + 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 + 1, par3, par4))) { isOpenUp = true; } - if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3, par4 - 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 - 1))) - { + if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3, par4 - 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 - 1))) { isOpenLeft = true; } - if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3, par4 + 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 + 1))) - { + if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3, par4 + 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 + 1))) { isOpenRight = true; } - if (isOpenUp && isOpenDown && isOpenLeft && isOpenRight) - { + if (isOpenUp && isOpenDown && isOpenLeft && isOpenRight) { return icons[15]; - } - else if (isOpenUp && isOpenDown && isOpenLeft) - { + } else if (isOpenUp && isOpenDown && isOpenLeft) { return icons[11]; - } - else if (isOpenUp && isOpenDown && isOpenRight) - { + } else if (isOpenUp && isOpenDown && isOpenRight) { return icons[12]; - } - else if (isOpenUp && isOpenLeft && isOpenRight) - { + } else if (isOpenUp && isOpenLeft && isOpenRight) { return icons[13]; - } - else if (isOpenDown && isOpenLeft && isOpenRight) - { + } else if (isOpenDown && isOpenLeft && isOpenRight) { return icons[14]; - } - else if (isOpenDown && isOpenUp) - { + } else if (isOpenDown && isOpenUp) { return icons[5]; - } - else if (isOpenLeft && isOpenRight) - { + } else if (isOpenLeft && isOpenRight) { return icons[6]; - } - else if (isOpenDown && isOpenLeft) - { + } else if (isOpenDown && isOpenLeft) { return icons[8]; - } - else if (isOpenDown && isOpenRight) - { + } else if (isOpenDown && isOpenRight) { return icons[10]; - } - else if (isOpenUp && isOpenLeft) - { + } else if (isOpenUp && isOpenLeft) { return icons[7]; - } - else if (isOpenUp && isOpenRight) - { + } else if (isOpenUp && isOpenRight) { return icons[9]; - } - else if (isOpenDown) - { + } else if (isOpenDown) { return icons[3]; - } - else if (isOpenUp) - { + } else if (isOpenUp) { return icons[4]; - } - else if (isOpenLeft) - { + } else if (isOpenLeft) { return icons[2]; - } - else if (isOpenRight) - { + } else if (isOpenRight) { return icons[1]; } break; case 1: - if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2 - 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 - 1, par3, par4))) - { + if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2 - 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 - 1, par3, par4))) { isOpenDown = true; } - if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2 + 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 + 1, par3, par4))) - { + if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2 + 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 + 1, par3, par4))) { isOpenUp = true; } - if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3, par4 - 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 - 1))) - { + if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3, par4 - 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 - 1))) { isOpenLeft = true; } - if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3, par4 + 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 + 1))) - { + if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3, par4 + 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 + 1))) { isOpenRight = true; } - if (isOpenUp && isOpenDown && isOpenLeft && isOpenRight) - { + if (isOpenUp && isOpenDown && isOpenLeft && isOpenRight) { return icons[15]; - } - else if (isOpenUp && isOpenDown && isOpenLeft) - { + } else if (isOpenUp && isOpenDown && isOpenLeft) { return icons[11]; - } - else if (isOpenUp && isOpenDown && isOpenRight) - { + } else if (isOpenUp && isOpenDown && isOpenRight) { return icons[12]; - } - else if (isOpenUp && isOpenLeft && isOpenRight) - { + } else if (isOpenUp && isOpenLeft && isOpenRight) { return icons[13]; - } - else if (isOpenDown && isOpenLeft && isOpenRight) - { + } else if (isOpenDown && isOpenLeft && isOpenRight) { return icons[14]; - } - else if (isOpenDown && isOpenUp) - { + } else if (isOpenDown && isOpenUp) { return icons[5]; - } - else if (isOpenLeft && isOpenRight) - { + } else if (isOpenLeft && isOpenRight) { return icons[6]; - } - else if (isOpenDown && isOpenLeft) - { + } else if (isOpenDown && isOpenLeft) { return icons[8]; - } - else if (isOpenDown && isOpenRight) - { + } else if (isOpenDown && isOpenRight) { return icons[10]; - } - else if (isOpenUp && isOpenLeft) - { + } else if (isOpenUp && isOpenLeft) { return icons[7]; - } - else if (isOpenUp && isOpenRight) - { + } else if (isOpenUp && isOpenRight) { return icons[9]; - } - else if (isOpenDown) - { + } else if (isOpenDown) { return icons[3]; - } - else if (isOpenUp) - { + } else if (isOpenUp) { return icons[4]; - } - else if (isOpenLeft) - { + } else if (isOpenLeft) { return icons[2]; - } - else if (isOpenRight) - { + } else if (isOpenRight) { return icons[1]; } break; case 2: - if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3 - 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 - 1, par4))) - { + if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3 - 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 - 1, par4))) { isOpenDown = true; } - if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3 + 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 + 1, par4))) - { + if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3 + 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 + 1, par4))) { isOpenUp = true; } - if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2 - 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 - 1, par3, par4))) - { + if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2 - 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 - 1, par3, par4))) { isOpenLeft = true; } - if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2 + 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 + 1, par3, par4))) - { + if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2 + 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 + 1, par3, par4))) { isOpenRight = true; } - if (isOpenUp && isOpenDown && isOpenLeft && isOpenRight) - { + if (isOpenUp && isOpenDown && isOpenLeft && isOpenRight) { return icons[15]; - } - else if (isOpenUp && isOpenDown && isOpenLeft) - { + } else if (isOpenUp && isOpenDown && isOpenLeft) { return icons[13]; - } - else if (isOpenUp && isOpenDown && isOpenRight) - { + } else if (isOpenUp && isOpenDown && isOpenRight) { return icons[14]; - } - else if (isOpenUp && isOpenLeft && isOpenRight) - { + } else if (isOpenUp && isOpenLeft && isOpenRight) { return icons[11]; - } - else if (isOpenDown && isOpenLeft && isOpenRight) - { + } else if (isOpenDown && isOpenLeft && isOpenRight) { return icons[12]; - } - else if (isOpenDown && isOpenUp) - { + } else if (isOpenDown && isOpenUp) { return icons[6]; - } - else if (isOpenLeft && isOpenRight) - { + } else if (isOpenLeft && isOpenRight) { return icons[5]; - } - else if (isOpenDown && isOpenLeft) - { + } else if (isOpenDown && isOpenLeft) { return icons[9]; - } - else if (isOpenDown && isOpenRight) - { + } else if (isOpenDown && isOpenRight) { return icons[10]; - } - else if (isOpenUp && isOpenLeft) - { + } else if (isOpenUp && isOpenLeft) { return icons[7]; - } - else if (isOpenUp && isOpenRight) - { + } else if (isOpenUp && isOpenRight) { return icons[8]; - } - else if (isOpenDown) - { + } else if (isOpenDown) { return icons[1]; - } - else if (isOpenUp) - { + } else if (isOpenUp) { return icons[2]; - } - else if (isOpenLeft) - { + } else if (isOpenLeft) { return icons[4]; - } - else if (isOpenRight) - { + } else if (isOpenRight) { return icons[3]; } break; case 3: - if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3 - 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 - 1, par4))) - { + if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3 - 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 - 1, par4))) { isOpenDown = true; } - if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3 + 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 + 1, par4))) - { + if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3 + 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 + 1, par4))) { isOpenUp = true; } - if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2 - 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 - 1, par3, par4))) - { + if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2 - 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 - 1, par3, par4))) { isOpenLeft = true; } - if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2 + 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 + 1, par3, par4))) - { + if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2 + 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 + 1, par3, par4))) { isOpenRight = true; } - if (isOpenUp && isOpenDown && isOpenLeft && isOpenRight) - { + if (isOpenUp && isOpenDown && isOpenLeft && isOpenRight) { return icons[15]; - } - else if (isOpenUp && isOpenDown && isOpenLeft) - { + } else if (isOpenUp && isOpenDown && isOpenLeft) { return icons[14]; - } - else if (isOpenUp && isOpenDown && isOpenRight) - { + } else if (isOpenUp && isOpenDown && isOpenRight) { return icons[13]; - } - else if (isOpenUp && isOpenLeft && isOpenRight) - { + } else if (isOpenUp && isOpenLeft && isOpenRight) { return icons[11]; - } - else if (isOpenDown && isOpenLeft && isOpenRight) - { + } else if (isOpenDown && isOpenLeft && isOpenRight) { return icons[12]; - } - else if (isOpenDown && isOpenUp) - { + } else if (isOpenDown && isOpenUp) { return icons[6]; - } - else if (isOpenLeft && isOpenRight) - { + } else if (isOpenLeft && isOpenRight) { return icons[5]; - } - else if (isOpenDown && isOpenLeft) - { + } else if (isOpenDown && isOpenLeft) { return icons[10]; - } - else if (isOpenDown && isOpenRight) - { + } else if (isOpenDown && isOpenRight) { return icons[9]; - } - else if (isOpenUp && isOpenLeft) - { + } else if (isOpenUp && isOpenLeft) { return icons[8]; - } - else if (isOpenUp && isOpenRight) - { + } else if (isOpenUp && isOpenRight) { return icons[7]; - } - else if (isOpenDown) - { + } else if (isOpenDown) { return icons[1]; - } - else if (isOpenUp) - { + } else if (isOpenUp) { return icons[2]; - } - else if (isOpenLeft) - { + } else if (isOpenLeft) { return icons[3]; - } - else if (isOpenRight) - { + } else if (isOpenRight) { return icons[4]; } break; case 4: - if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3 - 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 - 1, par4))) - { + if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3 - 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 - 1, par4))) { isOpenDown = true; } - if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3 + 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 + 1, par4))) - { + if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3 + 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 + 1, par4))) { isOpenUp = true; } - if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3, par4 - 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 - 1))) - { + if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3, par4 - 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 - 1))) { isOpenLeft = true; } - if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3, par4 + 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 + 1))) - { + if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3, par4 + 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 + 1))) { isOpenRight = true; } - if (isOpenUp && isOpenDown && isOpenLeft && isOpenRight) - { + if (isOpenUp && isOpenDown && isOpenLeft && isOpenRight) { return icons[15]; - } - else if (isOpenUp && isOpenDown && isOpenLeft) - { + } else if (isOpenUp && isOpenDown && isOpenLeft) { return icons[14]; - } - else if (isOpenUp && isOpenDown && isOpenRight) - { + } else if (isOpenUp && isOpenDown && isOpenRight) { return icons[13]; - } - else if (isOpenUp && isOpenLeft && isOpenRight) - { + } else if (isOpenUp && isOpenLeft && isOpenRight) { return icons[11]; - } - else if (isOpenDown && isOpenLeft && isOpenRight) - { + } else if (isOpenDown && isOpenLeft && isOpenRight) { return icons[12]; - } - else if (isOpenDown && isOpenUp) - { + } else if (isOpenDown && isOpenUp) { return icons[6]; - } - else if (isOpenLeft && isOpenRight) - { + } else if (isOpenLeft && isOpenRight) { return icons[5]; - } - else if (isOpenDown && isOpenLeft) - { + } else if (isOpenDown && isOpenLeft) { return icons[10]; - } - else if (isOpenDown && isOpenRight) - { + } else if (isOpenDown && isOpenRight) { return icons[9]; - } - else if (isOpenUp && isOpenLeft) - { + } else if (isOpenUp && isOpenLeft) { return icons[8]; - } - else if (isOpenUp && isOpenRight) - { + } else if (isOpenUp && isOpenRight) { return icons[7]; - } - else if (isOpenDown) - { + } else if (isOpenDown) { return icons[1]; - } - else if (isOpenUp) - { + } else if (isOpenUp) { return icons[2]; - } - else if (isOpenLeft) - { + } else if (isOpenLeft) { return icons[3]; - } - else if (isOpenRight) - { + } else if (isOpenRight) { return icons[4]; } break; case 5: - if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3 - 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 - 1, par4))) - { + if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3 - 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 - 1, par4))) { isOpenDown = true; } - if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3 + 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 + 1, par4))) - { + if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3 + 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 + 1, par4))) { isOpenUp = true; } - if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3, par4 - 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 - 1))) - { + if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3, par4 - 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 - 1))) { isOpenLeft = true; } - if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3, par4 + 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 + 1))) - { + if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3, par4 + 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 + 1))) { isOpenRight = true; } - if (isOpenUp && isOpenDown && isOpenLeft && isOpenRight) - { + if (isOpenUp && isOpenDown && isOpenLeft && isOpenRight) { return icons[15]; - } - else if (isOpenUp && isOpenDown && isOpenLeft) - { + } else if (isOpenUp && isOpenDown && isOpenLeft) { return icons[13]; - } - else if (isOpenUp && isOpenDown && isOpenRight) - { + } else if (isOpenUp && isOpenDown && isOpenRight) { return icons[14]; - } - else if (isOpenUp && isOpenLeft && isOpenRight) - { + } else if (isOpenUp && isOpenLeft && isOpenRight) { return icons[11]; - } - else if (isOpenDown && isOpenLeft && isOpenRight) - { + } else if (isOpenDown && isOpenLeft && isOpenRight) { return icons[12]; - } - else if (isOpenDown && isOpenUp) - { + } else if (isOpenDown && isOpenUp) { return icons[6]; - } - else if (isOpenLeft && isOpenRight) - { + } else if (isOpenLeft && isOpenRight) { return icons[5]; - } - else if (isOpenDown && isOpenLeft) - { + } else if (isOpenDown && isOpenLeft) { return icons[9]; - } - else if (isOpenDown && isOpenRight) - { + } else if (isOpenDown && isOpenRight) { return icons[10]; - } - else if (isOpenUp && isOpenLeft) - { + } else if (isOpenUp && isOpenLeft) { return icons[7]; - } - else if (isOpenUp && isOpenRight) - { + } else if (isOpenUp && isOpenRight) { return icons[8]; - } - else if (isOpenDown) - { + } else if (isOpenDown) { return icons[1]; - } - else if (isOpenUp) - { + } else if (isOpenUp) { return icons[2]; - } - else if (isOpenLeft) - { + } else if (isOpenLeft) { return icons[4]; - } - else if (isOpenRight) - { + } else if (isOpenRight) { return icons[3]; } break; @@ -624,8 +424,7 @@ public class BlockMachineCasing extends BlockMultiblockBase { } @Override - public boolean shouldSideBeRendered (IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) - { + public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) { Block b = par1IBlockAccess.getBlock(par2, par3, par4); return b == (Block) this ? false : super.shouldSideBeRendered(par1IBlockAccess, par2, par3, par4, par5); } diff --git a/src/main/java/techreborn/blocks/BlockOre.java b/src/main/java/techreborn/blocks/BlockOre.java index 3edf609ad..b89b82ba9 100644 --- a/src/main/java/techreborn/blocks/BlockOre.java +++ b/src/main/java/techreborn/blocks/BlockOre.java @@ -15,12 +15,13 @@ import net.minecraft.util.MathHelper; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; +import reborncore.common.util.OreDrop; +import reborncore.common.util.OreDropSet; import techreborn.client.TechRebornCreativeTabMisc; +import techreborn.config.ConfigTechReborn; import techreborn.init.ModBlocks; import techreborn.items.ItemDusts; import techreborn.items.ItemGems; -import techreborn.util.OreDrop; -import techreborn.util.OreDropSet; import java.util.ArrayList; import java.util.List; @@ -60,7 +61,7 @@ public class BlockOre extends Block { public ArrayList getDrops(World world, int x, int y, int z, int metadata, int fortune) { //Ruby if (metadata == 2) { - OreDrop ruby = new OreDrop(ItemGems.getGemByName("ruby")); + OreDrop ruby = new OreDrop(ItemGems.getGemByName("ruby"), ConfigTechReborn.FortuneSecondaryOreMultiplierPerLevel); OreDrop redGarnet = new OreDrop(ItemGems.getGemByName("redGarnet"), 0.02); OreDropSet set = new OreDropSet(ruby, redGarnet); return set.drop(fortune, world.rand); @@ -68,7 +69,7 @@ public class BlockOre extends Block { //Sapphire if (metadata == 3) { - OreDrop sapphire = new OreDrop(ItemGems.getGemByName("sapphire")); + OreDrop sapphire = new OreDrop(ItemGems.getGemByName("sapphire"), ConfigTechReborn.FortuneSecondaryOreMultiplierPerLevel); OreDrop peridot = new OreDrop(ItemGems.getGemByName("peridot"), 0.03); OreDropSet set = new OreDropSet(sapphire, peridot); return set.drop(fortune, world.rand); @@ -76,14 +77,14 @@ public class BlockOre extends Block { //Pyrite if (metadata == 5) { - OreDrop pyriteDust = new OreDrop(ItemDusts.getDustByName("pyrite")); + OreDrop pyriteDust = new OreDrop(ItemDusts.getDustByName("pyrite"), ConfigTechReborn.FortuneSecondaryOreMultiplierPerLevel); OreDropSet set = new OreDropSet(pyriteDust); return set.drop(fortune, world.rand); } //Sodolite if (metadata == 11) { - OreDrop sodalite = new OreDrop(ItemDusts.getDustByName("sodalite", 6)); + OreDrop sodalite = new OreDrop(ItemDusts.getDustByName("sodalite", 6), ConfigTechReborn.FortuneSecondaryOreMultiplierPerLevel); OreDrop aluminum = new OreDrop(ItemDusts.getDustByName("aluminum"), 0.50); OreDropSet set = new OreDropSet(sodalite, aluminum); return set.drop(fortune, world.rand); @@ -91,7 +92,7 @@ public class BlockOre extends Block { //Cinnabar if (metadata == 6) { - OreDrop cinnabar = new OreDrop(ItemDusts.getDustByName("cinnabar")); + OreDrop cinnabar = new OreDrop(ItemDusts.getDustByName("cinnabar"), ConfigTechReborn.FortuneSecondaryOreMultiplierPerLevel); OreDrop redstone = new OreDrop(new ItemStack(Items.redstone), 0.25); OreDropSet set = new OreDropSet(cinnabar, redstone); return set.drop(fortune, world.rand); @@ -99,7 +100,7 @@ public class BlockOre extends Block { //Sphalerite 1, 1/8 yellow garnet if (metadata == 7) { - OreDrop sphalerite = new OreDrop(ItemDusts.getDustByName("sphalerite")); + OreDrop sphalerite = new OreDrop(ItemDusts.getDustByName("sphalerite"), ConfigTechReborn.FortuneSecondaryOreMultiplierPerLevel); OreDrop yellowGarnet = new OreDrop(ItemGems.getGemByName("yellowGarnet"), 0.125); OreDropSet set = new OreDropSet(sphalerite, yellowGarnet); return set.drop(fortune, world.rand); diff --git a/src/main/java/techreborn/blocks/generator/BlockDieselGenerator.java b/src/main/java/techreborn/blocks/generator/BlockDieselGenerator.java index 5d1a4a028..1b95c910f 100644 --- a/src/main/java/techreborn/blocks/generator/BlockDieselGenerator.java +++ b/src/main/java/techreborn/blocks/generator/BlockDieselGenerator.java @@ -2,11 +2,9 @@ package techreborn.blocks.generator; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import ic2.api.item.IC2Items; import net.minecraft.block.material.Material; 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.world.World; @@ -15,8 +13,6 @@ import techreborn.blocks.BlockMachineBase; import techreborn.client.GuiHandler; import techreborn.tiles.TileDieselGenerator; -import java.util.Random; - public class BlockDieselGenerator extends BlockMachineBase { @SideOnly(Side.CLIENT) diff --git a/src/main/java/techreborn/blocks/generator/BlockDragonEggSiphoner.java b/src/main/java/techreborn/blocks/generator/BlockDragonEggSiphoner.java index 98ebe3d1e..e5035dca6 100644 --- a/src/main/java/techreborn/blocks/generator/BlockDragonEggSiphoner.java +++ b/src/main/java/techreborn/blocks/generator/BlockDragonEggSiphoner.java @@ -2,18 +2,14 @@ package techreborn.blocks.generator; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import ic2.api.item.IC2Items; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.item.Item; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.world.World; import techreborn.blocks.BlockMachineBase; import techreborn.tiles.TileDragonEggSiphoner; -import java.util.Random; - public class BlockDragonEggSiphoner extends BlockMachineBase { @SideOnly(Side.CLIENT) diff --git a/src/main/java/techreborn/blocks/generator/BlockGasTurbine.java b/src/main/java/techreborn/blocks/generator/BlockGasTurbine.java index 7af3ded9d..f11cba5d0 100644 --- a/src/main/java/techreborn/blocks/generator/BlockGasTurbine.java +++ b/src/main/java/techreborn/blocks/generator/BlockGasTurbine.java @@ -2,11 +2,9 @@ package techreborn.blocks.generator; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import ic2.api.item.IC2Items; import net.minecraft.block.material.Material; 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.world.World; @@ -15,8 +13,6 @@ import techreborn.blocks.BlockMachineBase; import techreborn.client.GuiHandler; import techreborn.tiles.TileGasTurbine; -import java.util.Random; - public class BlockGasTurbine extends BlockMachineBase { @SideOnly(Side.CLIENT) diff --git a/src/main/java/techreborn/blocks/generator/BlockHeatGenerator.java b/src/main/java/techreborn/blocks/generator/BlockHeatGenerator.java index 8982bdc37..32c311cdc 100644 --- a/src/main/java/techreborn/blocks/generator/BlockHeatGenerator.java +++ b/src/main/java/techreborn/blocks/generator/BlockHeatGenerator.java @@ -2,18 +2,14 @@ package techreborn.blocks.generator; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import ic2.api.item.IC2Items; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.item.Item; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.world.World; import techreborn.blocks.BlockMachineBase; import techreborn.tiles.TileHeatGenerator; -import java.util.Random; - public class BlockHeatGenerator extends BlockMachineBase { @SideOnly(Side.CLIENT) diff --git a/src/main/java/techreborn/blocks/generator/BlockLightningRod.java b/src/main/java/techreborn/blocks/generator/BlockLightningRod.java index 5195a4ba6..4b43e8c51 100644 --- a/src/main/java/techreborn/blocks/generator/BlockLightningRod.java +++ b/src/main/java/techreborn/blocks/generator/BlockLightningRod.java @@ -2,15 +2,11 @@ package techreborn.blocks.generator; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import ic2.api.item.IC2Items; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.item.Item; import net.minecraft.util.IIcon; import techreborn.blocks.BlockMachineBase; -import java.util.Random; - public class BlockLightningRod extends BlockMachineBase { @SideOnly(Side.CLIENT) diff --git a/src/main/java/techreborn/blocks/generator/BlockMagicEnergyAbsorber.java b/src/main/java/techreborn/blocks/generator/BlockMagicEnergyAbsorber.java index 62cfbca91..1dfa17262 100644 --- a/src/main/java/techreborn/blocks/generator/BlockMagicEnergyAbsorber.java +++ b/src/main/java/techreborn/blocks/generator/BlockMagicEnergyAbsorber.java @@ -2,15 +2,11 @@ package techreborn.blocks.generator; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import ic2.api.item.IC2Items; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.item.Item; import net.minecraft.util.IIcon; import techreborn.blocks.BlockMachineBase; -import java.util.Random; - public class BlockMagicEnergyAbsorber extends BlockMachineBase { @SideOnly(Side.CLIENT) diff --git a/src/main/java/techreborn/blocks/generator/BlockMagicEnergyConverter.java b/src/main/java/techreborn/blocks/generator/BlockMagicEnergyConverter.java index 7cc6e5a8d..5f8a75427 100644 --- a/src/main/java/techreborn/blocks/generator/BlockMagicEnergyConverter.java +++ b/src/main/java/techreborn/blocks/generator/BlockMagicEnergyConverter.java @@ -2,15 +2,11 @@ package techreborn.blocks.generator; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import ic2.api.item.IC2Items; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.item.Item; import net.minecraft.util.IIcon; import techreborn.blocks.BlockMachineBase; -import java.util.Random; - public class BlockMagicEnergyConverter extends BlockMachineBase { @SideOnly(Side.CLIENT) diff --git a/src/main/java/techreborn/blocks/generator/BlockPlasmaGenerator.java b/src/main/java/techreborn/blocks/generator/BlockPlasmaGenerator.java index 004445057..66513c71e 100644 --- a/src/main/java/techreborn/blocks/generator/BlockPlasmaGenerator.java +++ b/src/main/java/techreborn/blocks/generator/BlockPlasmaGenerator.java @@ -2,15 +2,11 @@ package techreborn.blocks.generator; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import ic2.api.item.IC2Items; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.item.Item; import net.minecraft.util.IIcon; import techreborn.blocks.BlockMachineBase; -import java.util.Random; - public class BlockPlasmaGenerator extends BlockMachineBase { @SideOnly(Side.CLIENT) diff --git a/src/main/java/techreborn/blocks/generator/BlockSemiFluidGenerator.java b/src/main/java/techreborn/blocks/generator/BlockSemiFluidGenerator.java index 6d5181c7e..5e43065d2 100644 --- a/src/main/java/techreborn/blocks/generator/BlockSemiFluidGenerator.java +++ b/src/main/java/techreborn/blocks/generator/BlockSemiFluidGenerator.java @@ -2,11 +2,9 @@ package techreborn.blocks.generator; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import ic2.api.item.IC2Items; import net.minecraft.block.material.Material; 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.world.World; @@ -15,8 +13,6 @@ import techreborn.blocks.BlockMachineBase; import techreborn.client.GuiHandler; import techreborn.tiles.TileSemifluidGenerator; -import java.util.Random; - public class BlockSemiFluidGenerator extends BlockMachineBase { @SideOnly(Side.CLIENT) diff --git a/src/main/java/techreborn/blocks/generator/BlockThermalGenerator.java b/src/main/java/techreborn/blocks/generator/BlockThermalGenerator.java index 5d47edcb6..94bb6216d 100644 --- a/src/main/java/techreborn/blocks/generator/BlockThermalGenerator.java +++ b/src/main/java/techreborn/blocks/generator/BlockThermalGenerator.java @@ -2,11 +2,9 @@ package techreborn.blocks.generator; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import ic2.api.item.IC2Items; import net.minecraft.block.material.Material; 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.world.World; @@ -15,8 +13,6 @@ import techreborn.blocks.BlockMachineBase; import techreborn.client.GuiHandler; import techreborn.tiles.TileThermalGenerator; -import java.util.Random; - public class BlockThermalGenerator extends BlockMachineBase { @SideOnly(Side.CLIENT) diff --git a/src/main/java/techreborn/blocks/machine/BlockAlloyFurnace.java b/src/main/java/techreborn/blocks/machine/BlockAlloyFurnace.java index 8e5cb4c2d..451ad1f59 100644 --- a/src/main/java/techreborn/blocks/machine/BlockAlloyFurnace.java +++ b/src/main/java/techreborn/blocks/machine/BlockAlloyFurnace.java @@ -72,9 +72,9 @@ public class BlockAlloyFurnace extends BlockMachineBase { @Override public IIcon getIcon(int side, int meta) { - if(side == 1){ + if (side == 1) { return this.iconTop; - } else if(side == 3){ + } else if (side == 3) { return this.iconFront; } else { return this.blockIcon; diff --git a/src/main/java/techreborn/blocks/machine/BlockAlloySmelter.java b/src/main/java/techreborn/blocks/machine/BlockAlloySmelter.java index e67f10913..3f6069bde 100644 --- a/src/main/java/techreborn/blocks/machine/BlockAlloySmelter.java +++ b/src/main/java/techreborn/blocks/machine/BlockAlloySmelter.java @@ -2,11 +2,9 @@ package techreborn.blocks.machine; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import ic2.api.item.IC2Items; import net.minecraft.block.material.Material; 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.world.IBlockAccess; @@ -16,8 +14,6 @@ import techreborn.blocks.BlockMachineBase; import techreborn.client.GuiHandler; import techreborn.tiles.TileAlloySmelter; -import java.util.Random; - public class BlockAlloySmelter extends BlockMachineBase { @SideOnly(Side.CLIENT) @@ -76,9 +72,9 @@ public class BlockAlloySmelter extends BlockMachineBase { @Override public IIcon getIcon(int side, int meta) { - if(side == 1){ + if (side == 1) { return this.iconTop; - } else if(side == 3){ + } else if (side == 3) { return this.iconFront; } else { return this.blockIcon; diff --git a/src/main/java/techreborn/blocks/machine/BlockAssemblingMachine.java b/src/main/java/techreborn/blocks/machine/BlockAssemblingMachine.java index ec7a2dbea..bf402589c 100644 --- a/src/main/java/techreborn/blocks/machine/BlockAssemblingMachine.java +++ b/src/main/java/techreborn/blocks/machine/BlockAssemblingMachine.java @@ -2,11 +2,9 @@ package techreborn.blocks.machine; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import ic2.api.item.IC2Items; import net.minecraft.block.material.Material; 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.world.IBlockAccess; @@ -16,8 +14,6 @@ import techreborn.blocks.BlockMachineBase; import techreborn.client.GuiHandler; import techreborn.tiles.TileAssemblingMachine; -import java.util.Random; - public class BlockAssemblingMachine extends BlockMachineBase { @SideOnly(Side.CLIENT) @@ -76,9 +72,9 @@ public class BlockAssemblingMachine extends BlockMachineBase { @Override public IIcon getIcon(int side, int meta) { - if(side == 1){ + if (side == 1) { return this.iconTop; - } else if(side == 3){ + } else if (side == 3) { return this.iconFront; } else { return this.blockIcon; diff --git a/src/main/java/techreborn/blocks/machine/BlockBlastFurnace.java b/src/main/java/techreborn/blocks/machine/BlockBlastFurnace.java index ce20100b4..987a4954c 100644 --- a/src/main/java/techreborn/blocks/machine/BlockBlastFurnace.java +++ b/src/main/java/techreborn/blocks/machine/BlockBlastFurnace.java @@ -2,11 +2,9 @@ package techreborn.blocks.machine; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import ic2.api.item.IC2Items; import net.minecraft.block.material.Material; 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.world.IBlockAccess; @@ -16,8 +14,6 @@ import techreborn.blocks.BlockMachineBase; import techreborn.client.GuiHandler; import techreborn.tiles.TileBlastFurnace; -import java.util.Random; - public class BlockBlastFurnace extends BlockMachineBase { @SideOnly(Side.CLIENT) @@ -81,9 +77,9 @@ public class BlockBlastFurnace extends BlockMachineBase { @Override public IIcon getIcon(int side, int meta) { - if(side == 1){ + if (side == 1) { return this.iconTop; - } else if(side == 3){ + } else if (side == 3) { return this.iconFront; } else { return this.blockIcon; diff --git a/src/main/java/techreborn/blocks/machine/BlockCentrifuge.java b/src/main/java/techreborn/blocks/machine/BlockCentrifuge.java index 21ecc64b8..0ae87f72f 100644 --- a/src/main/java/techreborn/blocks/machine/BlockCentrifuge.java +++ b/src/main/java/techreborn/blocks/machine/BlockCentrifuge.java @@ -2,11 +2,9 @@ package techreborn.blocks.machine; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import ic2.api.item.IC2Items; import net.minecraft.block.material.Material; 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.world.IBlockAccess; @@ -16,8 +14,6 @@ import techreborn.blocks.BlockMachineBase; import techreborn.client.GuiHandler; import techreborn.tiles.TileCentrifuge; -import java.util.Random; - public class BlockCentrifuge extends BlockMachineBase { @SideOnly(Side.CLIENT) @@ -69,31 +65,31 @@ public class BlockCentrifuge extends BlockMachineBase { public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) { int metadata = getTileRotation(blockAccess, x, y, z); if (blockAccess.getBlockMetadata(x, y, z) == 1) { - if(side == 1){ - return this.iconTopOn; - } else if(side == 0){ - return this.iconBottom; - } - return this.iconFrontOn; + if (side == 1) { + return this.iconTopOn; + } else if (side == 0) { + return this.iconBottom; + } + return this.iconFrontOn; } else { - if(side == 1){ - return this.iconTop; - } else if(side == 0){ - return this.iconBottom; - } - return this.iconFront; - } + if (side == 1) { + return this.iconTop; + } else if (side == 0) { + return this.iconBottom; + } + return this.iconFront; + } } @Override public IIcon getIcon(int side, int meta) { - if(side == 1){ + if (side == 1) { return this.iconTop; - } else if(side == 3){ + } else if (side == 3) { return this.iconFront; } else { - return this.iconFront; + return this.iconFront; } } diff --git a/src/main/java/techreborn/blocks/machine/BlockChargeBench.java b/src/main/java/techreborn/blocks/machine/BlockChargeBench.java index 64819752c..93cefe1f2 100644 --- a/src/main/java/techreborn/blocks/machine/BlockChargeBench.java +++ b/src/main/java/techreborn/blocks/machine/BlockChargeBench.java @@ -71,9 +71,9 @@ public class BlockChargeBench extends BlockMachineBase { @Override public IIcon getIcon(int side, int meta) { - if(side == 1){ + if (side == 1) { return this.iconTop; - } else if(side == 3){ + } else if (side == 3) { return this.iconFront; } else { return this.blockIcon; diff --git a/src/main/java/techreborn/blocks/machine/BlockChemicalReactor.java b/src/main/java/techreborn/blocks/machine/BlockChemicalReactor.java index c78126a73..63d7620e9 100644 --- a/src/main/java/techreborn/blocks/machine/BlockChemicalReactor.java +++ b/src/main/java/techreborn/blocks/machine/BlockChemicalReactor.java @@ -2,11 +2,9 @@ package techreborn.blocks.machine; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import ic2.api.item.IC2Items; import net.minecraft.block.material.Material; 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.world.IBlockAccess; @@ -16,8 +14,6 @@ import techreborn.blocks.BlockMachineBase; import techreborn.client.GuiHandler; import techreborn.tiles.TileChemicalReactor; -import java.util.Random; - public class BlockChemicalReactor extends BlockMachineBase { @SideOnly(Side.CLIENT) @@ -76,9 +72,9 @@ public class BlockChemicalReactor extends BlockMachineBase { @Override public IIcon getIcon(int side, int meta) { - if(side == 1){ + if (side == 1) { return this.iconTop; - } else if(side == 3){ + } else if (side == 3) { return this.iconFront; } else { return this.blockIcon; diff --git a/src/main/java/techreborn/blocks/machine/BlockDistillationTower.java b/src/main/java/techreborn/blocks/machine/BlockDistillationTower.java index 65db25175..11ede7ce0 100644 --- a/src/main/java/techreborn/blocks/machine/BlockDistillationTower.java +++ b/src/main/java/techreborn/blocks/machine/BlockDistillationTower.java @@ -2,16 +2,12 @@ package techreborn.blocks.machine; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import ic2.api.item.IC2Items; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.item.Item; import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import techreborn.blocks.BlockMachineBase; -import java.util.Random; - public class BlockDistillationTower extends BlockMachineBase { @SideOnly(Side.CLIENT) @@ -50,9 +46,9 @@ public class BlockDistillationTower extends BlockMachineBase { @Override public IIcon getIcon(int side, int meta) { - if(side == 1){ + if (side == 1) { return this.iconTop; - } else if(side == 3){ + } else if (side == 3) { return this.iconFront; } else { return this.blockIcon; diff --git a/src/main/java/techreborn/blocks/machine/BlockGrinder.java b/src/main/java/techreborn/blocks/machine/BlockGrinder.java index 12e9331a9..bef1ac4d5 100644 --- a/src/main/java/techreborn/blocks/machine/BlockGrinder.java +++ b/src/main/java/techreborn/blocks/machine/BlockGrinder.java @@ -2,11 +2,9 @@ package techreborn.blocks.machine; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import ic2.api.item.IC2Items; import net.minecraft.block.material.Material; 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.world.IBlockAccess; @@ -16,8 +14,6 @@ import techreborn.blocks.BlockMachineBase; import techreborn.client.GuiHandler; import techreborn.tiles.TileGrinder; -import java.util.Random; - public class BlockGrinder extends BlockMachineBase { @SideOnly(Side.CLIENT) @@ -80,9 +76,9 @@ public class BlockGrinder extends BlockMachineBase { @Override public IIcon getIcon(int side, int meta) { - if(side == 1){ + if (side == 1) { return this.iconTop; - } else if(side == 3){ + } else if (side == 3) { return this.iconFront; } else { return this.blockIcon; diff --git a/src/main/java/techreborn/blocks/machine/BlockImplosionCompressor.java b/src/main/java/techreborn/blocks/machine/BlockImplosionCompressor.java index ec1de16c6..40ab78b44 100644 --- a/src/main/java/techreborn/blocks/machine/BlockImplosionCompressor.java +++ b/src/main/java/techreborn/blocks/machine/BlockImplosionCompressor.java @@ -2,11 +2,9 @@ package techreborn.blocks.machine; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import ic2.api.item.IC2Items; import net.minecraft.block.material.Material; 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.world.IBlockAccess; @@ -16,8 +14,6 @@ import techreborn.blocks.BlockMachineBase; import techreborn.client.GuiHandler; import techreborn.tiles.TileImplosionCompressor; -import java.util.Random; - public class BlockImplosionCompressor extends BlockMachineBase { @SideOnly(Side.CLIENT) @@ -81,9 +77,9 @@ public class BlockImplosionCompressor extends BlockMachineBase { @Override public IIcon getIcon(int side, int meta) { - if(side == 1){ + if (side == 1) { return this.iconTop; - } else if(side == 3){ + } else if (side == 3) { return this.iconFront; } else { return this.blockIcon; diff --git a/src/main/java/techreborn/blocks/machine/BlockIndustrialElectrolyzer.java b/src/main/java/techreborn/blocks/machine/BlockIndustrialElectrolyzer.java index 0eb4ed6a5..f49d8bdc4 100644 --- a/src/main/java/techreborn/blocks/machine/BlockIndustrialElectrolyzer.java +++ b/src/main/java/techreborn/blocks/machine/BlockIndustrialElectrolyzer.java @@ -2,11 +2,9 @@ package techreborn.blocks.machine; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import ic2.api.item.IC2Items; import net.minecraft.block.material.Material; 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.world.IBlockAccess; @@ -16,8 +14,6 @@ import techreborn.blocks.BlockMachineBase; import techreborn.client.GuiHandler; import techreborn.tiles.TileIndustrialElectrolyzer; -import java.util.Random; - public class BlockIndustrialElectrolyzer extends BlockMachineBase { @SideOnly(Side.CLIENT) @@ -78,9 +74,9 @@ public class BlockIndustrialElectrolyzer extends BlockMachineBase { @Override public IIcon getIcon(int side, int meta) { - if(side == 1){ + if (side == 1) { return this.iconTop; - } else if(side == 3){ + } else if (side == 3) { return this.iconFront; } else { return this.blockIcon; diff --git a/src/main/java/techreborn/blocks/machine/BlockIndustrialSawmill.java b/src/main/java/techreborn/blocks/machine/BlockIndustrialSawmill.java index e2416f290..dda80f67c 100644 --- a/src/main/java/techreborn/blocks/machine/BlockIndustrialSawmill.java +++ b/src/main/java/techreborn/blocks/machine/BlockIndustrialSawmill.java @@ -2,11 +2,9 @@ package techreborn.blocks.machine; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import ic2.api.item.IC2Items; import net.minecraft.block.material.Material; 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.world.IBlockAccess; @@ -16,8 +14,6 @@ import techreborn.blocks.BlockMachineBase; import techreborn.client.GuiHandler; import techreborn.tiles.TileIndustrialSawmill; -import java.util.Random; - public class BlockIndustrialSawmill extends BlockMachineBase { @SideOnly(Side.CLIENT) @@ -81,9 +77,9 @@ public class BlockIndustrialSawmill extends BlockMachineBase { @Override public IIcon getIcon(int side, int meta) { - if(side == 1){ + if (side == 1) { return this.iconTop; - } else if(side == 3){ + } else if (side == 3) { return this.iconFront; } else { return this.blockIcon; diff --git a/src/main/java/techreborn/blocks/machine/BlockMatterFabricator.java b/src/main/java/techreborn/blocks/machine/BlockMatterFabricator.java index 88f91bacb..5d86b3b1c 100644 --- a/src/main/java/techreborn/blocks/machine/BlockMatterFabricator.java +++ b/src/main/java/techreborn/blocks/machine/BlockMatterFabricator.java @@ -2,11 +2,9 @@ package techreborn.blocks.machine; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import ic2.api.item.IC2Items; import net.minecraft.block.material.Material; 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.world.IBlockAccess; @@ -16,8 +14,6 @@ import techreborn.blocks.BlockMachineBase; import techreborn.client.GuiHandler; import techreborn.tiles.TileMatterFabricator; -import java.util.Random; - public class BlockMatterFabricator extends BlockMachineBase { @SideOnly(Side.CLIENT) diff --git a/src/main/java/techreborn/blocks/machine/BlockRollingMachine.java b/src/main/java/techreborn/blocks/machine/BlockRollingMachine.java index 1494ac7bd..a3f4a6680 100644 --- a/src/main/java/techreborn/blocks/machine/BlockRollingMachine.java +++ b/src/main/java/techreborn/blocks/machine/BlockRollingMachine.java @@ -2,11 +2,9 @@ package techreborn.blocks.machine; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import ic2.api.item.IC2Items; import net.minecraft.block.material.Material; 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.world.IBlockAccess; @@ -16,8 +14,6 @@ import techreborn.blocks.BlockMachineBase; import techreborn.client.GuiHandler; import techreborn.tiles.TileRollingMachine; -import java.util.Random; - public class BlockRollingMachine extends BlockMachineBase { @SideOnly(Side.CLIENT) @@ -69,9 +65,9 @@ public class BlockRollingMachine extends BlockMachineBase { @Override public IIcon getIcon(int side, int meta) { - if(side == 1){ + if (side == 1) { return this.iconTop; - } else if(side == 3){ + } else if (side == 3) { return this.iconFront; } else { return this.blockIcon; diff --git a/src/main/java/techreborn/blocks/machine/BlockVacuumFreezer.java b/src/main/java/techreborn/blocks/machine/BlockVacuumFreezer.java index df7d4385c..99394c518 100644 --- a/src/main/java/techreborn/blocks/machine/BlockVacuumFreezer.java +++ b/src/main/java/techreborn/blocks/machine/BlockVacuumFreezer.java @@ -2,16 +2,12 @@ package techreborn.blocks.machine; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import ic2.api.item.IC2Items; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.item.Item; import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import techreborn.blocks.BlockMachineBase; -import java.util.Random; - public class BlockVacuumFreezer extends BlockMachineBase { @SideOnly(Side.CLIENT) @@ -54,9 +50,9 @@ public class BlockVacuumFreezer extends BlockMachineBase { @Override public IIcon getIcon(int side, int meta) { - if(side == 1){ + if (side == 1) { return this.iconTop; - } else if(side == 3){ + } else if (side == 3) { return this.iconFront; } else { return this.blockIcon; diff --git a/src/main/java/techreborn/blocks/storage/BlockLesuStorage.java b/src/main/java/techreborn/blocks/storage/BlockLesuStorage.java index 362f3dd32..c978255fc 100644 --- a/src/main/java/techreborn/blocks/storage/BlockLesuStorage.java +++ b/src/main/java/techreborn/blocks/storage/BlockLesuStorage.java @@ -11,8 +11,8 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import reborncore.client.texture.ConnectedTexture; import techreborn.blocks.BlockMachineBase; -import techreborn.client.texture.ConnectedTexture; import techreborn.client.texture.LesuConnectedTextureGenerator; import techreborn.config.ConfigTechReborn; import techreborn.tiles.lesu.TileLesuStorage; @@ -30,8 +30,8 @@ public class BlockLesuStorage extends BlockMachineBase { @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconRegister) { this.icons = new IIcon[1][16]; - // up down left right - if(!ConfigTechReborn.useConnectedTextures){ + // up down left right + if (!ConfigTechReborn.useConnectedTextures) { for (int j = 0; j < 15; j++) { icons[0][j] = iconRegister.registerIcon("techreborn:" + "machine/lesu_block"); } @@ -39,22 +39,22 @@ public class BlockLesuStorage extends BlockMachineBase { } int i = 0; - icons[i][0] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(true, true, true, true), iconRegister, 0, i); - icons[i][1] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(true, false, true, true), iconRegister, 1, i); - icons[i][2] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(false, true, true, true), iconRegister, 2, i); - icons[i][3] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(true, true, true, false), iconRegister, 3, i); - icons[i][4] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(true, true, false, true), iconRegister, 4, i); - icons[i][5] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(true, true, false, false), iconRegister, 5, i); - icons[i][6] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(false, false, true, true), iconRegister, 6, i); - icons[i][7] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(false, true, false, true), iconRegister, 7, i); - icons[i][8] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(false, true, true, false), iconRegister, 8, i); - icons[i][9] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(true, false, false, true), iconRegister, 9, i); - icons[i][10] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(true, false, true, false), iconRegister, 10, i); - icons[i][11] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(false, true, false, false), iconRegister, 11, i); - icons[i][12] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(true, false, false, false), iconRegister, 12, i); - icons[i][13] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(false, false, false, true), iconRegister, 13, i); - icons[i][14] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(false, false, true, false), iconRegister, 14, i); - icons[i][15] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(false, false, false, false), iconRegister, 15, i); + icons[i][0] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(true, true, true, true), iconRegister, 0, i); + icons[i][1] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(true, false, true, true), iconRegister, 1, i); + icons[i][2] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(false, true, true, true), iconRegister, 2, i); + icons[i][3] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(true, true, true, false), iconRegister, 3, i); + icons[i][4] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(true, true, false, true), iconRegister, 4, i); + icons[i][5] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(true, true, false, false), iconRegister, 5, i); + icons[i][6] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(false, false, true, true), iconRegister, 6, i); + icons[i][7] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(false, true, false, true), iconRegister, 7, i); + icons[i][8] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(false, true, true, false), iconRegister, 8, i); + icons[i][9] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(true, false, false, true), iconRegister, 9, i); + icons[i][10] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(true, false, true, false), iconRegister, 10, i); + icons[i][11] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(false, true, false, false), iconRegister, 11, i); + icons[i][12] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(true, false, false, false), iconRegister, 12, i); + icons[i][13] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(false, false, false, true), iconRegister, 13, i); + icons[i][14] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(false, false, true, false), iconRegister, 14, i); + icons[i][15] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(false, false, false, false), iconRegister, 15, i); } @Override @@ -69,8 +69,6 @@ public class BlockLesuStorage extends BlockMachineBase { } - - @Override public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemstack) { super.onBlockPlacedBy(world, x, y, z, player, itemstack); @@ -97,501 +95,301 @@ public class BlockLesuStorage extends BlockMachineBase { /** * This is taken from https://github.com/SlimeKnights/TinkersConstruct/blob/a7405a3d10318bb5c486ec75fb62897a8149d1a6/src/main/java/tconstruct/smeltery/blocks/GlassBlockConnected.java */ - public IIcon getConnectedBlockTexture (IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5, IIcon[] icons) - { + public IIcon getConnectedBlockTexture(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5, IIcon[] icons) { boolean isOpenUp = false, isOpenDown = false, isOpenLeft = false, isOpenRight = false; - switch (par5) - { + switch (par5) { case 0: - if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2 - 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 - 1, par3, par4))) - { + if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2 - 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 - 1, par3, par4))) { isOpenDown = true; } - if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2 + 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 + 1, par3, par4))) - { + if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2 + 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 + 1, par3, par4))) { isOpenUp = true; } - if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3, par4 - 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 - 1))) - { + if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3, par4 - 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 - 1))) { isOpenLeft = true; } - if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3, par4 + 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 + 1))) - { + if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3, par4 + 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 + 1))) { isOpenRight = true; } - if (isOpenUp && isOpenDown && isOpenLeft && isOpenRight) - { + if (isOpenUp && isOpenDown && isOpenLeft && isOpenRight) { return icons[15]; - } - else if (isOpenUp && isOpenDown && isOpenLeft) - { + } else if (isOpenUp && isOpenDown && isOpenLeft) { return icons[11]; - } - else if (isOpenUp && isOpenDown && isOpenRight) - { + } else if (isOpenUp && isOpenDown && isOpenRight) { return icons[12]; - } - else if (isOpenUp && isOpenLeft && isOpenRight) - { + } else if (isOpenUp && isOpenLeft && isOpenRight) { return icons[13]; - } - else if (isOpenDown && isOpenLeft && isOpenRight) - { + } else if (isOpenDown && isOpenLeft && isOpenRight) { return icons[14]; - } - else if (isOpenDown && isOpenUp) - { + } else if (isOpenDown && isOpenUp) { return icons[5]; - } - else if (isOpenLeft && isOpenRight) - { + } else if (isOpenLeft && isOpenRight) { return icons[6]; - } - else if (isOpenDown && isOpenLeft) - { + } else if (isOpenDown && isOpenLeft) { return icons[8]; - } - else if (isOpenDown && isOpenRight) - { + } else if (isOpenDown && isOpenRight) { return icons[10]; - } - else if (isOpenUp && isOpenLeft) - { + } else if (isOpenUp && isOpenLeft) { return icons[7]; - } - else if (isOpenUp && isOpenRight) - { + } else if (isOpenUp && isOpenRight) { return icons[9]; - } - else if (isOpenDown) - { + } else if (isOpenDown) { return icons[3]; - } - else if (isOpenUp) - { + } else if (isOpenUp) { return icons[4]; - } - else if (isOpenLeft) - { + } else if (isOpenLeft) { return icons[2]; - } - else if (isOpenRight) - { + } else if (isOpenRight) { return icons[1]; } break; case 1: - if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2 - 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 - 1, par3, par4))) - { + if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2 - 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 - 1, par3, par4))) { isOpenDown = true; } - if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2 + 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 + 1, par3, par4))) - { + if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2 + 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 + 1, par3, par4))) { isOpenUp = true; } - if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3, par4 - 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 - 1))) - { + if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3, par4 - 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 - 1))) { isOpenLeft = true; } - if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3, par4 + 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 + 1))) - { + if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3, par4 + 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 + 1))) { isOpenRight = true; } - if (isOpenUp && isOpenDown && isOpenLeft && isOpenRight) - { + if (isOpenUp && isOpenDown && isOpenLeft && isOpenRight) { return icons[15]; - } - else if (isOpenUp && isOpenDown && isOpenLeft) - { + } else if (isOpenUp && isOpenDown && isOpenLeft) { return icons[11]; - } - else if (isOpenUp && isOpenDown && isOpenRight) - { + } else if (isOpenUp && isOpenDown && isOpenRight) { return icons[12]; - } - else if (isOpenUp && isOpenLeft && isOpenRight) - { + } else if (isOpenUp && isOpenLeft && isOpenRight) { return icons[13]; - } - else if (isOpenDown && isOpenLeft && isOpenRight) - { + } else if (isOpenDown && isOpenLeft && isOpenRight) { return icons[14]; - } - else if (isOpenDown && isOpenUp) - { + } else if (isOpenDown && isOpenUp) { return icons[5]; - } - else if (isOpenLeft && isOpenRight) - { + } else if (isOpenLeft && isOpenRight) { return icons[6]; - } - else if (isOpenDown && isOpenLeft) - { + } else if (isOpenDown && isOpenLeft) { return icons[8]; - } - else if (isOpenDown && isOpenRight) - { + } else if (isOpenDown && isOpenRight) { return icons[10]; - } - else if (isOpenUp && isOpenLeft) - { + } else if (isOpenUp && isOpenLeft) { return icons[7]; - } - else if (isOpenUp && isOpenRight) - { + } else if (isOpenUp && isOpenRight) { return icons[9]; - } - else if (isOpenDown) - { + } else if (isOpenDown) { return icons[3]; - } - else if (isOpenUp) - { + } else if (isOpenUp) { return icons[4]; - } - else if (isOpenLeft) - { + } else if (isOpenLeft) { return icons[2]; - } - else if (isOpenRight) - { + } else if (isOpenRight) { return icons[1]; } break; case 2: - if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3 - 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 - 1, par4))) - { + if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3 - 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 - 1, par4))) { isOpenDown = true; } - if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3 + 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 + 1, par4))) - { + if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3 + 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 + 1, par4))) { isOpenUp = true; } - if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2 - 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 - 1, par3, par4))) - { + if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2 - 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 - 1, par3, par4))) { isOpenLeft = true; } - if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2 + 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 + 1, par3, par4))) - { + if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2 + 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 + 1, par3, par4))) { isOpenRight = true; } - if (isOpenUp && isOpenDown && isOpenLeft && isOpenRight) - { + if (isOpenUp && isOpenDown && isOpenLeft && isOpenRight) { return icons[15]; - } - else if (isOpenUp && isOpenDown && isOpenLeft) - { + } else if (isOpenUp && isOpenDown && isOpenLeft) { return icons[13]; - } - else if (isOpenUp && isOpenDown && isOpenRight) - { + } else if (isOpenUp && isOpenDown && isOpenRight) { return icons[14]; - } - else if (isOpenUp && isOpenLeft && isOpenRight) - { + } else if (isOpenUp && isOpenLeft && isOpenRight) { return icons[11]; - } - else if (isOpenDown && isOpenLeft && isOpenRight) - { + } else if (isOpenDown && isOpenLeft && isOpenRight) { return icons[12]; - } - else if (isOpenDown && isOpenUp) - { + } else if (isOpenDown && isOpenUp) { return icons[6]; - } - else if (isOpenLeft && isOpenRight) - { + } else if (isOpenLeft && isOpenRight) { return icons[5]; - } - else if (isOpenDown && isOpenLeft) - { + } else if (isOpenDown && isOpenLeft) { return icons[9]; - } - else if (isOpenDown && isOpenRight) - { + } else if (isOpenDown && isOpenRight) { return icons[10]; - } - else if (isOpenUp && isOpenLeft) - { + } else if (isOpenUp && isOpenLeft) { return icons[7]; - } - else if (isOpenUp && isOpenRight) - { + } else if (isOpenUp && isOpenRight) { return icons[8]; - } - else if (isOpenDown) - { + } else if (isOpenDown) { return icons[1]; - } - else if (isOpenUp) - { + } else if (isOpenUp) { return icons[2]; - } - else if (isOpenLeft) - { + } else if (isOpenLeft) { return icons[4]; - } - else if (isOpenRight) - { + } else if (isOpenRight) { return icons[3]; } break; case 3: - if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3 - 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 - 1, par4))) - { + if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3 - 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 - 1, par4))) { isOpenDown = true; } - if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3 + 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 + 1, par4))) - { + if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3 + 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 + 1, par4))) { isOpenUp = true; } - if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2 - 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 - 1, par3, par4))) - { + if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2 - 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 - 1, par3, par4))) { isOpenLeft = true; } - if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2 + 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 + 1, par3, par4))) - { + if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2 + 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 + 1, par3, par4))) { isOpenRight = true; } - if (isOpenUp && isOpenDown && isOpenLeft && isOpenRight) - { + if (isOpenUp && isOpenDown && isOpenLeft && isOpenRight) { return icons[15]; - } - else if (isOpenUp && isOpenDown && isOpenLeft) - { + } else if (isOpenUp && isOpenDown && isOpenLeft) { return icons[14]; - } - else if (isOpenUp && isOpenDown && isOpenRight) - { + } else if (isOpenUp && isOpenDown && isOpenRight) { return icons[13]; - } - else if (isOpenUp && isOpenLeft && isOpenRight) - { + } else if (isOpenUp && isOpenLeft && isOpenRight) { return icons[11]; - } - else if (isOpenDown && isOpenLeft && isOpenRight) - { + } else if (isOpenDown && isOpenLeft && isOpenRight) { return icons[12]; - } - else if (isOpenDown && isOpenUp) - { + } else if (isOpenDown && isOpenUp) { return icons[6]; - } - else if (isOpenLeft && isOpenRight) - { + } else if (isOpenLeft && isOpenRight) { return icons[5]; - } - else if (isOpenDown && isOpenLeft) - { + } else if (isOpenDown && isOpenLeft) { return icons[10]; - } - else if (isOpenDown && isOpenRight) - { + } else if (isOpenDown && isOpenRight) { return icons[9]; - } - else if (isOpenUp && isOpenLeft) - { + } else if (isOpenUp && isOpenLeft) { return icons[8]; - } - else if (isOpenUp && isOpenRight) - { + } else if (isOpenUp && isOpenRight) { return icons[7]; - } - else if (isOpenDown) - { + } else if (isOpenDown) { return icons[1]; - } - else if (isOpenUp) - { + } else if (isOpenUp) { return icons[2]; - } - else if (isOpenLeft) - { + } else if (isOpenLeft) { return icons[3]; - } - else if (isOpenRight) - { + } else if (isOpenRight) { return icons[4]; } break; case 4: - if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3 - 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 - 1, par4))) - { + if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3 - 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 - 1, par4))) { isOpenDown = true; } - if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3 + 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 + 1, par4))) - { + if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3 + 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 + 1, par4))) { isOpenUp = true; } - if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3, par4 - 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 - 1))) - { + if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3, par4 - 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 - 1))) { isOpenLeft = true; } - if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3, par4 + 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 + 1))) - { + if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3, par4 + 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 + 1))) { isOpenRight = true; } - if (isOpenUp && isOpenDown && isOpenLeft && isOpenRight) - { + if (isOpenUp && isOpenDown && isOpenLeft && isOpenRight) { return icons[15]; - } - else if (isOpenUp && isOpenDown && isOpenLeft) - { + } else if (isOpenUp && isOpenDown && isOpenLeft) { return icons[14]; - } - else if (isOpenUp && isOpenDown && isOpenRight) - { + } else if (isOpenUp && isOpenDown && isOpenRight) { return icons[13]; - } - else if (isOpenUp && isOpenLeft && isOpenRight) - { + } else if (isOpenUp && isOpenLeft && isOpenRight) { return icons[11]; - } - else if (isOpenDown && isOpenLeft && isOpenRight) - { + } else if (isOpenDown && isOpenLeft && isOpenRight) { return icons[12]; - } - else if (isOpenDown && isOpenUp) - { + } else if (isOpenDown && isOpenUp) { return icons[6]; - } - else if (isOpenLeft && isOpenRight) - { + } else if (isOpenLeft && isOpenRight) { return icons[5]; - } - else if (isOpenDown && isOpenLeft) - { + } else if (isOpenDown && isOpenLeft) { return icons[10]; - } - else if (isOpenDown && isOpenRight) - { + } else if (isOpenDown && isOpenRight) { return icons[9]; - } - else if (isOpenUp && isOpenLeft) - { + } else if (isOpenUp && isOpenLeft) { return icons[8]; - } - else if (isOpenUp && isOpenRight) - { + } else if (isOpenUp && isOpenRight) { return icons[7]; - } - else if (isOpenDown) - { + } else if (isOpenDown) { return icons[1]; - } - else if (isOpenUp) - { + } else if (isOpenUp) { return icons[2]; - } - else if (isOpenLeft) - { + } else if (isOpenLeft) { return icons[3]; - } - else if (isOpenRight) - { + } else if (isOpenRight) { return icons[4]; } break; case 5: - if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3 - 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 - 1, par4))) - { + if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3 - 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 - 1, par4))) { isOpenDown = true; } - if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3 + 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 + 1, par4))) - { + if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3 + 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 + 1, par4))) { isOpenUp = true; } - if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3, par4 - 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 - 1))) - { + if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3, par4 - 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 - 1))) { isOpenLeft = true; } - if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3, par4 + 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 + 1))) - { + if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3, par4 + 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 + 1))) { isOpenRight = true; } - if (isOpenUp && isOpenDown && isOpenLeft && isOpenRight) - { + if (isOpenUp && isOpenDown && isOpenLeft && isOpenRight) { return icons[15]; - } - else if (isOpenUp && isOpenDown && isOpenLeft) - { + } else if (isOpenUp && isOpenDown && isOpenLeft) { return icons[13]; - } - else if (isOpenUp && isOpenDown && isOpenRight) - { + } else if (isOpenUp && isOpenDown && isOpenRight) { return icons[14]; - } - else if (isOpenUp && isOpenLeft && isOpenRight) - { + } else if (isOpenUp && isOpenLeft && isOpenRight) { return icons[11]; - } - else if (isOpenDown && isOpenLeft && isOpenRight) - { + } else if (isOpenDown && isOpenLeft && isOpenRight) { return icons[12]; - } - else if (isOpenDown && isOpenUp) - { + } else if (isOpenDown && isOpenUp) { return icons[6]; - } - else if (isOpenLeft && isOpenRight) - { + } else if (isOpenLeft && isOpenRight) { return icons[5]; - } - else if (isOpenDown && isOpenLeft) - { + } else if (isOpenDown && isOpenLeft) { return icons[9]; - } - else if (isOpenDown && isOpenRight) - { + } else if (isOpenDown && isOpenRight) { return icons[10]; - } - else if (isOpenUp && isOpenLeft) - { + } else if (isOpenUp && isOpenLeft) { return icons[7]; - } - else if (isOpenUp && isOpenRight) - { + } else if (isOpenUp && isOpenRight) { return icons[8]; - } - else if (isOpenDown) - { + } else if (isOpenDown) { return icons[1]; - } - else if (isOpenUp) - { + } else if (isOpenUp) { return icons[2]; - } - else if (isOpenLeft) - { + } else if (isOpenLeft) { return icons[4]; - } - else if (isOpenRight) - { + } else if (isOpenRight) { return icons[3]; } break; diff --git a/src/main/java/techreborn/client/GuiHandler.java b/src/main/java/techreborn/client/GuiHandler.java index b74739623..911615a47 100644 --- a/src/main/java/techreborn/client/GuiHandler.java +++ b/src/main/java/techreborn/client/GuiHandler.java @@ -6,7 +6,6 @@ import net.minecraft.world.World; import techreborn.client.container.*; import techreborn.client.gui.*; import techreborn.pda.GuiManual; -import techreborn.pda.pages.BasePage; import techreborn.tiles.*; import techreborn.tiles.idsu.TileIDSU; import techreborn.tiles.lesu.TileLesu; @@ -89,7 +88,7 @@ public class GuiHandler implements IGuiHandler { } else if (ID == assemblingmachineID) { return new ContainerAssemblingMachine( (TileAssemblingMachine) world.getTileEntity(x, y, z), player); - }else if (ID == dieselGeneratorID) { + } else if (ID == dieselGeneratorID) { return new ContainerDieselGenerator( (TileDieselGenerator) world.getTileEntity(x, y, z), player); } else if (ID == industrialElectrolyzerID) { @@ -171,7 +170,7 @@ public class GuiHandler implements IGuiHandler { } else if (ID == assemblingmachineID) { return new GuiAssemblingMachine(player, (TileAssemblingMachine) world.getTileEntity(x, y, z)); - }else if (ID == dieselGeneratorID) { + } else if (ID == dieselGeneratorID) { return new GuiDieselGenerator(player, (TileDieselGenerator) world.getTileEntity(x, y, z)); } else if (ID == industrialElectrolyzerID) { diff --git a/src/main/java/techreborn/client/GuiUtil.java b/src/main/java/techreborn/client/GuiUtil.java deleted file mode 100644 index 0314cd5ba..000000000 --- a/src/main/java/techreborn/client/GuiUtil.java +++ /dev/null @@ -1,60 +0,0 @@ -package techreborn.client; - -import net.minecraft.client.gui.Gui; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.util.IIcon; - -public class GuiUtil { - - - public static void drawRepeated(IIcon icon, double x, double y, double width, double height, double z) { - double iconWidthStep = (icon.getMaxU() - icon.getMinU()) / 16.0D; - double iconHeightStep = (icon.getMaxV() - icon.getMinV()) / 16.0D; - - Tessellator tessellator = Tessellator.instance; - tessellator.startDrawingQuads(); - for (double cy = y; cy < y + height; cy += 16.0D) { - double quadHeight = Math.min(16.0D, height + y - cy); - double maxY = cy + quadHeight; - double maxV = icon.getMinV() + iconHeightStep * quadHeight; - for (double cx = x; cx < x + width; cx += 16.0D) { - double quadWidth = Math.min(16.0D, width + x - cx); - double maxX = cx + quadWidth; - double maxU = icon.getMinU() + iconWidthStep * quadWidth; - - tessellator.addVertexWithUV(cx, maxY, z, icon.getMinU(), maxV); - tessellator.addVertexWithUV(maxX, maxY, z, maxU, maxV); - tessellator.addVertexWithUV(maxX, cy, z, maxU, icon.getMinV()); - tessellator.addVertexWithUV(cx, cy, z, icon.getMinU(), icon.getMinV()); - } - } - tessellator.draw(); - } - - public static void drawTooltipBox(int x, int y, int w, int h) { - int bg = 0xf0100010; - drawGradientRect(x + 1, y, w - 1, 1, bg, bg); - drawGradientRect(x + 1, y + h, w - 1, 1, bg, bg); - drawGradientRect(x + 1, y + 1, w - 1, h - 1, bg, bg);//center - drawGradientRect(x, y + 1, 1, h - 1, bg, bg); - drawGradientRect(x + w, y + 1, 1, h - 1, bg, bg); - int grad1 = 0x505000ff; - int grad2 = 0x5028007F; - drawGradientRect(x + 1, y + 2, 1, h - 3, grad1, grad2); - drawGradientRect(x + w - 1, y + 2, 1, h - 3, grad1, grad2); - - drawGradientRect(x + 1, y + 1, w - 1, 1, grad1, grad1); - drawGradientRect(x + 1, y + h - 1, w - 1, 1, grad2, grad2); - } - - public static void drawGradientRect(int x, int y, int w, int h, int colour1, int colour2) { - new GuiHook().drawGradientRect(x, y, x + w, y + h, colour1, colour2); - } - - public static class GuiHook extends Gui { - @Override - public void drawGradientRect(int par1, int par2, int par3, int par4, int par5, int par6) { - super.drawGradientRect(par1, par2, par3, par4, par5, par6); - } - } -} diff --git a/src/main/java/techreborn/client/SlotFake.java b/src/main/java/techreborn/client/SlotFake.java deleted file mode 100644 index e32d69238..000000000 --- a/src/main/java/techreborn/client/SlotFake.java +++ /dev/null @@ -1,36 +0,0 @@ -package techreborn.client; - -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; - -public class SlotFake extends Slot { - - public boolean mCanInsertItem; - public boolean mCanStackItem; - public int mMaxStacksize = 127; - - public SlotFake(IInventory par1iInventory, int par2, int par3, int par4, - boolean aCanInsertItem, boolean aCanStackItem, int aMaxStacksize) { - super(par1iInventory, par2, par3, par4); - this.mCanInsertItem = aCanInsertItem; - this.mCanStackItem = aCanStackItem; - this.mMaxStacksize = aMaxStacksize; - } - - public boolean isItemValid(ItemStack par1ItemStack) { - return this.mCanInsertItem; - } - - public int getSlotStackLimit() { - return this.mMaxStacksize; - } - - public boolean getHasStack() { - return false; - } - - public ItemStack decrStackSize(int par1) { - return !this.mCanStackItem ? null : super.decrStackSize(par1); - } -} diff --git a/src/main/java/techreborn/client/SlotFilteredVoid.java b/src/main/java/techreborn/client/SlotFilteredVoid.java deleted file mode 100644 index 63043de5a..000000000 --- a/src/main/java/techreborn/client/SlotFilteredVoid.java +++ /dev/null @@ -1,37 +0,0 @@ -package techreborn.client; - - -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; - -import java.util.ArrayList; -import java.util.List; - -public class SlotFilteredVoid extends Slot { - - private List filter = new ArrayList(); - - public SlotFilteredVoid(IInventory par1iInventory, int id, int x, int y) { - super(par1iInventory, id, x, y); - } - - public SlotFilteredVoid(IInventory par1iInventory, int id, int x, int y, ItemStack[] filterList) { - super(par1iInventory, id, x, y); - for (ItemStack itemStack : filterList) - this.filter.add(itemStack); - } - - @Override - public boolean isItemValid(ItemStack stack) { - for (ItemStack itemStack : filter) - if (itemStack.getItem().equals(stack.getItem()) && itemStack.getItemDamage() == stack.getItemDamage()) - return false; - - return super.isItemValid(stack); - } - - @Override - public void putStack(ItemStack arg0) { - } -} diff --git a/src/main/java/techreborn/client/SlotFluid.java b/src/main/java/techreborn/client/SlotFluid.java deleted file mode 100644 index 1018a0a7c..000000000 --- a/src/main/java/techreborn/client/SlotFluid.java +++ /dev/null @@ -1,21 +0,0 @@ -package techreborn.client; - - -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidContainerRegistry; -import net.minecraftforge.fluids.IFluidContainerItem; - -public class SlotFluid extends Slot { - public SlotFluid(IInventory p_i1824_1_, int p_i1824_2_, int p_i1824_3_, int p_i1824_4_) { - super(p_i1824_1_, p_i1824_2_, p_i1824_3_, p_i1824_4_); - } - - @Override - public boolean isItemValid(ItemStack stack) { - - return FluidContainerRegistry.isContainer(stack) || (stack != null && stack.getItem() instanceof IFluidContainerItem); - - } -} diff --git a/src/main/java/techreborn/client/SlotInput.java b/src/main/java/techreborn/client/SlotInput.java deleted file mode 100644 index 576b89f6f..000000000 --- a/src/main/java/techreborn/client/SlotInput.java +++ /dev/null @@ -1,20 +0,0 @@ -package techreborn.client; - -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; - -public class SlotInput extends Slot { - - public SlotInput(IInventory par1iInventory, int par2, int par3, int par4) { - super(par1iInventory, par2, par3, par4); - } - - public boolean isItemValid(ItemStack par1ItemStack) { - return false; - } - - public int getSlotStackLimit() { - return 64; - } -} \ No newline at end of file diff --git a/src/main/java/techreborn/client/SlotOutput.java b/src/main/java/techreborn/client/SlotOutput.java deleted file mode 100644 index 39be3da1e..000000000 --- a/src/main/java/techreborn/client/SlotOutput.java +++ /dev/null @@ -1,20 +0,0 @@ -package techreborn.client; - -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; - -public class SlotOutput extends Slot { - - public SlotOutput(IInventory par1iInventory, int par2, int par3, int par4) { - super(par1iInventory, par2, par3, par4); - } - - public boolean isItemValid(ItemStack par1ItemStack) { - return false; - } - - public int getSlotStackLimit() { - return 64; - } -} \ No newline at end of file diff --git a/src/main/java/techreborn/client/StackToolTipEvent.java b/src/main/java/techreborn/client/StackToolTipEvent.java index ca58049e7..78bec689c 100644 --- a/src/main/java/techreborn/client/StackToolTipEvent.java +++ b/src/main/java/techreborn/client/StackToolTipEvent.java @@ -8,9 +8,9 @@ import net.minecraft.client.Minecraft; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.event.entity.player.ItemTooltipEvent; import org.lwjgl.input.Keyboard; -import techreborn.api.IListInfoProvider; +import reborncore.api.IListInfoProvider; +import reborncore.common.util.Color; import techreborn.api.power.IEnergyInterfaceItem; -import techreborn.util.Color; public class StackToolTipEvent { diff --git a/src/main/java/techreborn/client/VersionCheckerClient.java b/src/main/java/techreborn/client/VersionCheckerClient.java index c0e76f812..ea2b520a7 100644 --- a/src/main/java/techreborn/client/VersionCheckerClient.java +++ b/src/main/java/techreborn/client/VersionCheckerClient.java @@ -4,6 +4,7 @@ import cpw.mods.fml.client.GuiModList; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.event.GuiScreenEvent; +import reborncore.client.gui.GuiUtil; import techreborn.Core; import java.awt.*; diff --git a/src/main/java/techreborn/client/container/ContainerAesu.java b/src/main/java/techreborn/client/container/ContainerAesu.java index f882a5a11..865e88344 100644 --- a/src/main/java/techreborn/client/container/ContainerAesu.java +++ b/src/main/java/techreborn/client/container/ContainerAesu.java @@ -5,9 +5,10 @@ import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.ICrafting; import net.minecraft.inventory.Slot; +import reborncore.common.container.RebornContainer; import techreborn.tiles.TileAesu; -public class ContainerAesu extends TechRebornContainer { +public class ContainerAesu extends RebornContainer { EntityPlayer player; @@ -29,7 +30,7 @@ public class ContainerAesu extends TechRebornContainer { // input //this.addSlotToContainer(new Slot(tileaesu.inventory, 0, 116, 23)); - // this.addSlotToContainer(new Slot(tileaesu.inventory, 1, 116, 59)); + // this.addSlotToContainer(new Slot(tileaesu.inventory, 1, 116, 59)); int i; diff --git a/src/main/java/techreborn/client/container/ContainerAlloyFurnace.java b/src/main/java/techreborn/client/container/ContainerAlloyFurnace.java index 98720f866..ccbaa4e64 100644 --- a/src/main/java/techreborn/client/container/ContainerAlloyFurnace.java +++ b/src/main/java/techreborn/client/container/ContainerAlloyFurnace.java @@ -3,10 +3,11 @@ package techreborn.client.container; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.ICrafting; import net.minecraft.inventory.Slot; -import techreborn.client.SlotOutput; +import reborncore.client.gui.SlotOutput; +import reborncore.common.container.RebornContainer; import techreborn.tiles.TileAlloyFurnace; -public class ContainerAlloyFurnace extends TechRebornContainer { +public class ContainerAlloyFurnace extends RebornContainer { EntityPlayer player; @@ -69,7 +70,7 @@ public class ContainerAlloyFurnace extends TechRebornContainer { if (this.burnTime != tile.burnTime) { crafting.sendProgressBarUpdate(this, 1, tile.burnTime); } - if (this.cookTime != tile.cookTime) { + if (this.cookTime != tile.cookTime) { crafting.sendProgressBarUpdate(this, 2, tile.cookTime); } } @@ -79,11 +80,11 @@ public class ContainerAlloyFurnace extends TechRebornContainer { @Override public void updateProgressBar(int id, int value) { super.updateProgressBar(id, value); - if(id == 0){ + if (id == 0) { this.currentItemBurnTime = value; - } else if(id ==1){ + } else if (id == 1) { this.burnTime = value; - } else if(id == 2){ + } else if (id == 2) { this.cookTime = value; } this.tile.currentItemBurnTime = this.currentItemBurnTime; diff --git a/src/main/java/techreborn/client/container/ContainerAlloySmelter.java b/src/main/java/techreborn/client/container/ContainerAlloySmelter.java index 06873b4dc..b1a919755 100644 --- a/src/main/java/techreborn/client/container/ContainerAlloySmelter.java +++ b/src/main/java/techreborn/client/container/ContainerAlloySmelter.java @@ -2,7 +2,7 @@ package techreborn.client.container; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Slot; -import techreborn.client.SlotOutput; +import reborncore.client.gui.SlotOutput; import techreborn.tiles.TileAlloySmelter; public class ContainerAlloySmelter extends ContainerCrafting { diff --git a/src/main/java/techreborn/client/container/ContainerAssemblingMachine.java b/src/main/java/techreborn/client/container/ContainerAssemblingMachine.java index 20f793226..8468be08e 100644 --- a/src/main/java/techreborn/client/container/ContainerAssemblingMachine.java +++ b/src/main/java/techreborn/client/container/ContainerAssemblingMachine.java @@ -2,7 +2,7 @@ package techreborn.client.container; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Slot; -import techreborn.client.SlotOutput; +import reborncore.client.gui.SlotOutput; import techreborn.tiles.TileAssemblingMachine; public class ContainerAssemblingMachine extends ContainerCrafting { diff --git a/src/main/java/techreborn/client/container/ContainerBlastFurnace.java b/src/main/java/techreborn/client/container/ContainerBlastFurnace.java index b5865d773..08cc0aefe 100644 --- a/src/main/java/techreborn/client/container/ContainerBlastFurnace.java +++ b/src/main/java/techreborn/client/container/ContainerBlastFurnace.java @@ -3,7 +3,7 @@ package techreborn.client.container; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.ICrafting; import net.minecraft.inventory.Slot; -import techreborn.client.SlotOutput; +import reborncore.client.gui.SlotOutput; import techreborn.tiles.TileBlastFurnace; public class ContainerBlastFurnace extends ContainerCrafting { diff --git a/src/main/java/techreborn/client/container/ContainerCentrifuge.java b/src/main/java/techreborn/client/container/ContainerCentrifuge.java index 8f03b70ac..dac27e416 100644 --- a/src/main/java/techreborn/client/container/ContainerCentrifuge.java +++ b/src/main/java/techreborn/client/container/ContainerCentrifuge.java @@ -2,7 +2,7 @@ package techreborn.client.container; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Slot; -import techreborn.client.SlotOutput; +import reborncore.client.gui.SlotOutput; import techreborn.tiles.TileCentrifuge; public class ContainerCentrifuge extends ContainerCrafting { @@ -19,8 +19,8 @@ public class ContainerCentrifuge extends ContainerCrafting { } public ContainerCentrifuge(TileCentrifuge tileCentrifuge, EntityPlayer player) { - super(tileCentrifuge.crafter); - tile = tileCentrifuge; + super(tileCentrifuge.crafter); + tile = tileCentrifuge; this.player = player; // input diff --git a/src/main/java/techreborn/client/container/ContainerChargeBench.java b/src/main/java/techreborn/client/container/ContainerChargeBench.java index cc4076ed5..931b1ab99 100644 --- a/src/main/java/techreborn/client/container/ContainerChargeBench.java +++ b/src/main/java/techreborn/client/container/ContainerChargeBench.java @@ -2,9 +2,10 @@ package techreborn.client.container; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Slot; +import reborncore.common.container.RebornContainer; import techreborn.tiles.TileChargeBench; -public class ContainerChargeBench extends TechRebornContainer { +public class ContainerChargeBench extends RebornContainer { EntityPlayer player; diff --git a/src/main/java/techreborn/client/container/ContainerChemicalReactor.java b/src/main/java/techreborn/client/container/ContainerChemicalReactor.java index 38870a5f7..66fbfa53b 100644 --- a/src/main/java/techreborn/client/container/ContainerChemicalReactor.java +++ b/src/main/java/techreborn/client/container/ContainerChemicalReactor.java @@ -2,7 +2,7 @@ package techreborn.client.container; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Slot; -import techreborn.client.SlotOutput; +import reborncore.client.gui.SlotOutput; import techreborn.tiles.TileChemicalReactor; public class ContainerChemicalReactor extends ContainerCrafting { diff --git a/src/main/java/techreborn/client/container/ContainerChunkloader.java b/src/main/java/techreborn/client/container/ContainerChunkloader.java index c5ce37011..de27e9aeb 100644 --- a/src/main/java/techreborn/client/container/ContainerChunkloader.java +++ b/src/main/java/techreborn/client/container/ContainerChunkloader.java @@ -2,9 +2,10 @@ package techreborn.client.container; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Slot; +import reborncore.common.container.RebornContainer; import techreborn.tiles.TileChunkLoader; -public class ContainerChunkloader extends TechRebornContainer { +public class ContainerChunkloader extends RebornContainer { EntityPlayer player; diff --git a/src/main/java/techreborn/client/container/ContainerCrafting.java b/src/main/java/techreborn/client/container/ContainerCrafting.java index 2aa4a49c6..5c8b3c899 100644 --- a/src/main/java/techreborn/client/container/ContainerCrafting.java +++ b/src/main/java/techreborn/client/container/ContainerCrafting.java @@ -3,9 +3,10 @@ package techreborn.client.container; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.inventory.ICrafting; +import reborncore.common.container.RebornContainer; import techreborn.api.recipe.RecipeCrafter; -public abstract class ContainerCrafting extends TechRebornContainer { +public abstract class ContainerCrafting extends RebornContainer { RecipeCrafter crafter; diff --git a/src/main/java/techreborn/client/container/ContainerDestructoPack.java b/src/main/java/techreborn/client/container/ContainerDestructoPack.java index dd3d5e8d3..7c8bce02f 100644 --- a/src/main/java/techreborn/client/container/ContainerDestructoPack.java +++ b/src/main/java/techreborn/client/container/ContainerDestructoPack.java @@ -3,11 +3,12 @@ package techreborn.client.container; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -import techreborn.client.SlotFilteredVoid; +import reborncore.client.gui.SlotFilteredVoid; +import reborncore.common.container.RebornContainer; +import reborncore.common.util.Inventory; import techreborn.init.ModItems; -import techreborn.util.Inventory; -public class ContainerDestructoPack extends TechRebornContainer { +public class ContainerDestructoPack extends RebornContainer { private EntityPlayer player; private Inventory inv; diff --git a/src/main/java/techreborn/client/container/ContainerDieselGenerator.java b/src/main/java/techreborn/client/container/ContainerDieselGenerator.java index 07329fda4..144991d3a 100644 --- a/src/main/java/techreborn/client/container/ContainerDieselGenerator.java +++ b/src/main/java/techreborn/client/container/ContainerDieselGenerator.java @@ -5,11 +5,12 @@ import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.ICrafting; import net.minecraft.inventory.Slot; -import techreborn.client.SlotFake; -import techreborn.client.SlotOutput; +import reborncore.client.gui.SlotFake; +import reborncore.client.gui.SlotOutput; +import reborncore.common.container.RebornContainer; import techreborn.tiles.TileDieselGenerator; -public class ContainerDieselGenerator extends TechRebornContainer { +public class ContainerDieselGenerator extends RebornContainer { public TileDieselGenerator tiledieselGenerator; public EntityPlayer player; public int energy; @@ -74,8 +75,7 @@ public class ContainerDieselGenerator extends TechRebornContainer { public void updateProgressBar(int id, int value) { if (id == 0) { this.energy = value; - }else - if (id == 1) { + } else if (id == 1) { this.fluid = value; } } diff --git a/src/main/java/techreborn/client/container/ContainerDigitalChest.java b/src/main/java/techreborn/client/container/ContainerDigitalChest.java index a0e25691b..80425ba0b 100644 --- a/src/main/java/techreborn/client/container/ContainerDigitalChest.java +++ b/src/main/java/techreborn/client/container/ContainerDigitalChest.java @@ -2,11 +2,12 @@ package techreborn.client.container; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Slot; -import techreborn.client.SlotFake; -import techreborn.client.SlotOutput; +import reborncore.client.gui.SlotFake; +import reborncore.client.gui.SlotOutput; +import reborncore.common.container.RebornContainer; import techreborn.tiles.TileDigitalChest; -public class ContainerDigitalChest extends TechRebornContainer { +public class ContainerDigitalChest extends RebornContainer { public TileDigitalChest tileDigitalChest; public EntityPlayer player; diff --git a/src/main/java/techreborn/client/container/ContainerGasTurbine.java b/src/main/java/techreborn/client/container/ContainerGasTurbine.java index f2a89cc5b..6e068f914 100644 --- a/src/main/java/techreborn/client/container/ContainerGasTurbine.java +++ b/src/main/java/techreborn/client/container/ContainerGasTurbine.java @@ -2,11 +2,12 @@ package techreborn.client.container; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Slot; -import techreborn.client.SlotFake; -import techreborn.client.SlotOutput; +import reborncore.client.gui.SlotFake; +import reborncore.client.gui.SlotOutput; +import reborncore.common.container.RebornContainer; import techreborn.tiles.TileGasTurbine; -public class ContainerGasTurbine extends TechRebornContainer { +public class ContainerGasTurbine extends RebornContainer { public TileGasTurbine tileGasTurbine; public EntityPlayer player; diff --git a/src/main/java/techreborn/client/container/ContainerGrinder.java b/src/main/java/techreborn/client/container/ContainerGrinder.java index 427d190e3..e359e1d51 100644 --- a/src/main/java/techreborn/client/container/ContainerGrinder.java +++ b/src/main/java/techreborn/client/container/ContainerGrinder.java @@ -2,7 +2,7 @@ package techreborn.client.container; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Slot; -import techreborn.client.SlotOutput; +import reborncore.client.gui.SlotOutput; import techreborn.tiles.TileGrinder; public class ContainerGrinder extends ContainerCrafting { diff --git a/src/main/java/techreborn/client/container/ContainerIDSU.java b/src/main/java/techreborn/client/container/ContainerIDSU.java index 759281b49..c38e34c67 100644 --- a/src/main/java/techreborn/client/container/ContainerIDSU.java +++ b/src/main/java/techreborn/client/container/ContainerIDSU.java @@ -5,10 +5,11 @@ import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.ICrafting; import net.minecraft.inventory.Slot; +import reborncore.common.container.RebornContainer; import techreborn.tiles.idsu.TileIDSU; -public class ContainerIDSU extends TechRebornContainer { +public class ContainerIDSU extends RebornContainer { EntityPlayer player; diff --git a/src/main/java/techreborn/client/container/ContainerImplosionCompressor.java b/src/main/java/techreborn/client/container/ContainerImplosionCompressor.java index 6ec855ab5..ac3ac36ae 100644 --- a/src/main/java/techreborn/client/container/ContainerImplosionCompressor.java +++ b/src/main/java/techreborn/client/container/ContainerImplosionCompressor.java @@ -2,7 +2,7 @@ package techreborn.client.container; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Slot; -import techreborn.client.SlotOutput; +import reborncore.client.gui.SlotOutput; import techreborn.tiles.TileImplosionCompressor; public class ContainerImplosionCompressor extends ContainerCrafting { diff --git a/src/main/java/techreborn/client/container/ContainerIndustrialElectrolyzer.java b/src/main/java/techreborn/client/container/ContainerIndustrialElectrolyzer.java index 72ac9c1fd..25dc24bd9 100644 --- a/src/main/java/techreborn/client/container/ContainerIndustrialElectrolyzer.java +++ b/src/main/java/techreborn/client/container/ContainerIndustrialElectrolyzer.java @@ -2,7 +2,7 @@ package techreborn.client.container; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Slot; -import techreborn.client.SlotOutput; +import reborncore.client.gui.SlotOutput; import techreborn.tiles.TileIndustrialElectrolyzer; public class ContainerIndustrialElectrolyzer extends ContainerCrafting { diff --git a/src/main/java/techreborn/client/container/ContainerIndustrialSawmill.java b/src/main/java/techreborn/client/container/ContainerIndustrialSawmill.java index c5dbe3c5e..3fd31a3c4 100644 --- a/src/main/java/techreborn/client/container/ContainerIndustrialSawmill.java +++ b/src/main/java/techreborn/client/container/ContainerIndustrialSawmill.java @@ -2,7 +2,7 @@ package techreborn.client.container; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Slot; -import techreborn.client.SlotOutput; +import reborncore.client.gui.SlotOutput; import techreborn.tiles.TileIndustrialSawmill; public class ContainerIndustrialSawmill extends ContainerCrafting { diff --git a/src/main/java/techreborn/client/container/ContainerLesu.java b/src/main/java/techreborn/client/container/ContainerLesu.java index 1215da65f..e0724129c 100644 --- a/src/main/java/techreborn/client/container/ContainerLesu.java +++ b/src/main/java/techreborn/client/container/ContainerLesu.java @@ -5,10 +5,11 @@ import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.ICrafting; import net.minecraft.inventory.Slot; +import reborncore.common.container.RebornContainer; import techreborn.config.ConfigTechReborn; import techreborn.tiles.lesu.TileLesu; -public class ContainerLesu extends TechRebornContainer { +public class ContainerLesu extends RebornContainer { EntityPlayer player; diff --git a/src/main/java/techreborn/client/container/ContainerMatterFabricator.java b/src/main/java/techreborn/client/container/ContainerMatterFabricator.java index cca240311..a46cdfbdd 100644 --- a/src/main/java/techreborn/client/container/ContainerMatterFabricator.java +++ b/src/main/java/techreborn/client/container/ContainerMatterFabricator.java @@ -5,10 +5,11 @@ import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.ICrafting; import net.minecraft.inventory.Slot; -import techreborn.client.SlotOutput; +import reborncore.client.gui.SlotOutput; +import reborncore.common.container.RebornContainer; import techreborn.tiles.TileMatterFabricator; -public class ContainerMatterFabricator extends TechRebornContainer { +public class ContainerMatterFabricator extends RebornContainer { EntityPlayer player; diff --git a/src/main/java/techreborn/client/container/ContainerPda.java b/src/main/java/techreborn/client/container/ContainerPda.java index f4e598e3c..f5c62ef52 100644 --- a/src/main/java/techreborn/client/container/ContainerPda.java +++ b/src/main/java/techreborn/client/container/ContainerPda.java @@ -1,8 +1,9 @@ package techreborn.client.container; import net.minecraft.entity.player.EntityPlayer; +import reborncore.common.container.RebornContainer; -public class ContainerPda extends TechRebornContainer { +public class ContainerPda extends RebornContainer { EntityPlayer player; diff --git a/src/main/java/techreborn/client/container/ContainerQuantumChest.java b/src/main/java/techreborn/client/container/ContainerQuantumChest.java index 5335c51c2..9aa2798be 100644 --- a/src/main/java/techreborn/client/container/ContainerQuantumChest.java +++ b/src/main/java/techreborn/client/container/ContainerQuantumChest.java @@ -2,11 +2,12 @@ package techreborn.client.container; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Slot; -import techreborn.client.SlotFake; -import techreborn.client.SlotOutput; +import reborncore.client.gui.SlotFake; +import reborncore.client.gui.SlotOutput; +import reborncore.common.container.RebornContainer; import techreborn.tiles.TileQuantumChest; -public class ContainerQuantumChest extends TechRebornContainer { +public class ContainerQuantumChest extends RebornContainer { public TileQuantumChest tileQuantumChest; public EntityPlayer player; diff --git a/src/main/java/techreborn/client/container/ContainerQuantumTank.java b/src/main/java/techreborn/client/container/ContainerQuantumTank.java index 6adf79bec..497df43a2 100644 --- a/src/main/java/techreborn/client/container/ContainerQuantumTank.java +++ b/src/main/java/techreborn/client/container/ContainerQuantumTank.java @@ -2,12 +2,13 @@ package techreborn.client.container; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Slot; -import techreborn.client.SlotFake; -import techreborn.client.SlotFluid; -import techreborn.client.SlotOutput; +import reborncore.client.gui.SlotFake; +import reborncore.client.gui.SlotFluid; +import reborncore.client.gui.SlotOutput; +import reborncore.common.container.RebornContainer; import techreborn.tiles.TileQuantumTank; -public class ContainerQuantumTank extends TechRebornContainer { +public class ContainerQuantumTank extends RebornContainer { public TileQuantumTank tileQuantumTank; public EntityPlayer player; diff --git a/src/main/java/techreborn/client/container/ContainerRollingMachine.java b/src/main/java/techreborn/client/container/ContainerRollingMachine.java index 25a0d3646..665e8f0b3 100644 --- a/src/main/java/techreborn/client/container/ContainerRollingMachine.java +++ b/src/main/java/techreborn/client/container/ContainerRollingMachine.java @@ -5,12 +5,13 @@ import net.minecraft.inventory.ICrafting; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; +import reborncore.client.gui.SlotFake; +import reborncore.client.gui.SlotOutput; +import reborncore.common.container.RebornContainer; import techreborn.api.RollingMachineRecipe; -import techreborn.client.SlotFake; -import techreborn.client.SlotOutput; import techreborn.tiles.TileRollingMachine; -public class ContainerRollingMachine extends TechRebornContainer { +public class ContainerRollingMachine extends RebornContainer { EntityPlayer player; TileRollingMachine tile; @@ -85,7 +86,7 @@ public class ContainerRollingMachine extends TechRebornContainer { if (this.burnTime != tile.tickTime) { crafting.sendProgressBarUpdate(this, 1, tile.tickTime); } - if (this.energy != (int) tile.getEnergy()) { + if (this.energy != (int) tile.getEnergy()) { crafting.sendProgressBarUpdate(this, 2, (int) tile.getEnergy()); } } @@ -95,11 +96,11 @@ public class ContainerRollingMachine extends TechRebornContainer { @Override public void updateProgressBar(int id, int value) { super.updateProgressBar(id, value); - if(id == 0){ + if (id == 0) { this.currentItemBurnTime = value; - } else if(id ==1){ + } else if (id == 1) { this.burnTime = value; - } else if(id == 2){ + } else if (id == 2) { this.energy = value; } this.tile.runTime = this.currentItemBurnTime; @@ -107,9 +108,8 @@ public class ContainerRollingMachine extends TechRebornContainer { this.tile.setEnergy(this.energy); } - public int getBurnTimeRemainingScaled(int scale) - { - if(burnTime == 0 || this.currentItemBurnTime == 0){ + public int getBurnTimeRemainingScaled(int scale) { + if (burnTime == 0 || this.currentItemBurnTime == 0) { return 0; } return this.burnTime * scale / this.currentItemBurnTime; diff --git a/src/main/java/techreborn/client/container/ContainerSemifluidGenerator.java b/src/main/java/techreborn/client/container/ContainerSemifluidGenerator.java index ea30c2515..e35d2bb57 100644 --- a/src/main/java/techreborn/client/container/ContainerSemifluidGenerator.java +++ b/src/main/java/techreborn/client/container/ContainerSemifluidGenerator.java @@ -2,11 +2,12 @@ package techreborn.client.container; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Slot; -import techreborn.client.SlotFake; -import techreborn.client.SlotOutput; +import reborncore.client.gui.SlotFake; +import reborncore.client.gui.SlotOutput; +import reborncore.common.container.RebornContainer; import techreborn.tiles.TileSemifluidGenerator; -public class ContainerSemifluidGenerator extends TechRebornContainer { +public class ContainerSemifluidGenerator extends RebornContainer { public TileSemifluidGenerator tileSemifluidGenerator; public EntityPlayer player; diff --git a/src/main/java/techreborn/client/container/ContainerThermalGenerator.java b/src/main/java/techreborn/client/container/ContainerThermalGenerator.java index 37e8d951f..a1442d3af 100644 --- a/src/main/java/techreborn/client/container/ContainerThermalGenerator.java +++ b/src/main/java/techreborn/client/container/ContainerThermalGenerator.java @@ -2,12 +2,13 @@ package techreborn.client.container; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Slot; -import techreborn.client.SlotFake; -import techreborn.client.SlotFluid; -import techreborn.client.SlotOutput; +import reborncore.client.gui.SlotFake; +import reborncore.client.gui.SlotFluid; +import reborncore.client.gui.SlotOutput; +import reborncore.common.container.RebornContainer; import techreborn.tiles.TileThermalGenerator; -public class ContainerThermalGenerator extends TechRebornContainer { +public class ContainerThermalGenerator extends RebornContainer { public TileThermalGenerator tileThermalGenerator; public EntityPlayer player; diff --git a/src/main/java/techreborn/client/container/TechRebornContainer.java b/src/main/java/techreborn/client/container/TechRebornContainer.java deleted file mode 100644 index 2c074ca01..000000000 --- a/src/main/java/techreborn/client/container/TechRebornContainer.java +++ /dev/null @@ -1,114 +0,0 @@ -package techreborn.client.container; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; -import techreborn.client.SlotFake; - -public abstract class TechRebornContainer extends Container { - - @Override - public ItemStack transferStackInSlot(EntityPlayer player, int slotIndex) { - ItemStack originalStack = null; - Slot slot = (Slot) inventorySlots.get(slotIndex); - int numSlots = inventorySlots.size(); - if (slot != null && slot.getHasStack()) { - ItemStack stackInSlot = slot.getStack(); - originalStack = stackInSlot.copy(); - if (slotIndex >= numSlots - 9 * 4 && tryShiftItem(stackInSlot, numSlots)) { - // NOOP - } else if (slotIndex >= numSlots - 9 * 4 && slotIndex < numSlots - 9) { - if (!shiftItemStack(stackInSlot, numSlots - 9, numSlots)) { - return null; - } - } else if (slotIndex >= numSlots - 9 && slotIndex < numSlots) { - if (!shiftItemStack(stackInSlot, numSlots - 9 * 4, numSlots - 9)) { - return null; - } - } else if (!shiftItemStack(stackInSlot, numSlots - 9 * 4, numSlots)) { - return null; - } - slot.onSlotChange(stackInSlot, originalStack); - if (stackInSlot.stackSize <= 0) { - slot.putStack(null); - } else { - slot.onSlotChanged(); - } - if (stackInSlot.stackSize == originalStack.stackSize) { - return null; - } - slot.onPickupFromSlot(player, stackInSlot); - } - return originalStack; - } - - protected boolean shiftItemStack(ItemStack stackToShift, int start, int end) { - boolean changed = false; - if (stackToShift.isStackable()) { - for (int slotIndex = start; stackToShift.stackSize > 0 && slotIndex < end; slotIndex++) { - Slot slot = (Slot) inventorySlots.get(slotIndex); - ItemStack stackInSlot = slot.getStack(); - if (stackInSlot != null && canStacksMerge(stackInSlot, stackToShift)) { - int resultingStackSize = stackInSlot.stackSize + stackToShift.stackSize; - int max = Math.min(stackToShift.getMaxStackSize(), slot.getSlotStackLimit()); - if (resultingStackSize <= max) { - stackToShift.stackSize = 0; - stackInSlot.stackSize = resultingStackSize; - slot.onSlotChanged(); - changed = true; - } else if (stackInSlot.stackSize < max) { - stackToShift.stackSize -= max - stackInSlot.stackSize; - stackInSlot.stackSize = max; - slot.onSlotChanged(); - changed = true; - } - } - } - } - if (stackToShift.stackSize > 0) { - for (int slotIndex = start; stackToShift.stackSize > 0 && slotIndex < end; slotIndex++) { - Slot slot = (Slot) inventorySlots.get(slotIndex); - ItemStack stackInSlot = slot.getStack(); - if (stackInSlot == null) { - int max = Math.min(stackToShift.getMaxStackSize(), slot.getSlotStackLimit()); - stackInSlot = stackToShift.copy(); - stackInSlot.stackSize = Math.min(stackToShift.stackSize, max); - stackToShift.stackSize -= stackInSlot.stackSize; - slot.putStack(stackInSlot); - slot.onSlotChanged(); - changed = true; - } - } - } - return changed; - } - - private boolean tryShiftItem(ItemStack stackToShift, int numSlots) { - for (int machineIndex = 0; machineIndex < numSlots - 9 * 4; machineIndex++) { - Slot slot = (Slot) inventorySlots.get(machineIndex); - if (slot instanceof SlotFake) { - continue; - } - if (!slot.isItemValid(stackToShift)) - continue; - if (shiftItemStack(stackToShift, machineIndex, machineIndex + 1)) - return true; - } - return false; - } - - public static boolean canStacksMerge(ItemStack stack1, ItemStack stack2) { - if (stack1 == null || stack2 == null) { - return false; - } - if (!stack1.isItemEqual(stack2)) { - return false; - } - if (!ItemStack.areItemStackTagsEqual(stack1, stack2)) { - return false; - } - return true; - - } -} diff --git a/src/main/java/techreborn/client/gui/GuiAesu.java b/src/main/java/techreborn/client/gui/GuiAesu.java index 4c617af35..adfceeb46 100644 --- a/src/main/java/techreborn/client/gui/GuiAesu.java +++ b/src/main/java/techreborn/client/gui/GuiAesu.java @@ -5,9 +5,9 @@ import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ResourceLocation; import net.minecraft.util.StatCollector; +import reborncore.common.packets.PacketHandler; import techreborn.client.container.ContainerAesu; import techreborn.packets.PacketAesu; -import techreborn.packets.PacketHandler; import techreborn.tiles.TileAesu; import java.awt.*; diff --git a/src/main/java/techreborn/client/gui/GuiAlloyFurnace.java b/src/main/java/techreborn/client/gui/GuiAlloyFurnace.java index b0507148e..e06b97b4f 100644 --- a/src/main/java/techreborn/client/gui/GuiAlloyFurnace.java +++ b/src/main/java/techreborn/client/gui/GuiAlloyFurnace.java @@ -41,8 +41,7 @@ public class GuiAlloyFurnace extends GuiContainer { int l = (this.height - this.ySize) / 2; this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize); - if (this.alloyfurnace.isBurning()) - { + if (this.alloyfurnace.isBurning()) { int i1 = this.alloyfurnace.getBurnTimeRemainingScaled(13); this.drawTexturedModalRect(k + 56, l + 36 + 12 - i1, 176, 12 - i1, 14, i1 + 1); i1 = this.alloyfurnace.getCookProgressScaled(24); @@ -51,7 +50,6 @@ public class GuiAlloyFurnace extends GuiContainer { } - protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) { String name = StatCollector.translateToLocal("tile.techreborn.alloyfurnace.name"); diff --git a/src/main/java/techreborn/client/gui/GuiBlastFurnace.java b/src/main/java/techreborn/client/gui/GuiBlastFurnace.java index 6aa90664c..016e88565 100644 --- a/src/main/java/techreborn/client/gui/GuiBlastFurnace.java +++ b/src/main/java/techreborn/client/gui/GuiBlastFurnace.java @@ -8,10 +8,10 @@ import net.minecraft.util.ChunkCoordinates; import net.minecraft.util.ResourceLocation; import net.minecraft.util.StatCollector; import net.minecraftforge.common.util.ForgeDirection; -import techreborn.client.GuiUtil; +import reborncore.client.gui.GuiUtil; +import reborncore.client.multiblock.Multiblock; +import reborncore.client.multiblock.MultiblockSet; import techreborn.client.container.ContainerBlastFurnace; -import techreborn.client.multiblock.Multiblock; -import techreborn.client.multiblock.MultiblockSet; import techreborn.init.ModBlocks; import techreborn.lib.ModInfo; import techreborn.proxies.ClientProxy; @@ -38,8 +38,8 @@ public class GuiBlastFurnace extends GuiContainer { public void initGui() { int k = (this.width - this.xSize) / 2; int l = (this.height - this.ySize) / 2; - GuiButton button = new GuiButton(212, k + 4, l + 6, 20, 20, ""); - buttonList.add(button); + GuiButton button = new GuiButton(212, k + 4, l + 6, 20, 20, ""); + buttonList.add(button); super.initGui(); } @@ -78,60 +78,60 @@ public class GuiBlastFurnace extends GuiContainer { } this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752); } - - @Override - public void actionPerformed(GuiButton button) { - super.actionPerformed(button); - if(button.id == 212){ - if(ClientProxy.multiblockRenderEvent.currentMultiblock == null){ - {//This code here makes a basic multiblock and then sets to the selected one. - Multiblock multiblock = new Multiblock(); - multiblock.addComponent(0, 0, 0, ModBlocks.MachineCasing, 0); - multiblock.addComponent(1, 0, 0, ModBlocks.MachineCasing, 0); - multiblock.addComponent(0, 0, 1, ModBlocks.MachineCasing, 0); - multiblock.addComponent(-1, 0, 0, ModBlocks.MachineCasing, 0); - multiblock.addComponent(0, 0, -1, ModBlocks.MachineCasing, 0); - multiblock.addComponent(-1, 0, -1, ModBlocks.MachineCasing, 0); - multiblock.addComponent(-1, 0, 1, ModBlocks.MachineCasing, 0); - multiblock.addComponent(1, 0, -1, ModBlocks.MachineCasing, 0); - multiblock.addComponent(1, 0, 1, ModBlocks.MachineCasing, 0); - - multiblock.addComponent(1, 1, 0, ModBlocks.MachineCasing, 0); - multiblock.addComponent(0, 1, 1, ModBlocks.MachineCasing, 0); - multiblock.addComponent(-1, 1, 0, ModBlocks.MachineCasing, 0); - multiblock.addComponent(0, 1, -1, ModBlocks.MachineCasing, 0); - multiblock.addComponent(-1, 1, -1, ModBlocks.MachineCasing, 0); - multiblock.addComponent(-1, 1, 1, ModBlocks.MachineCasing, 0); - multiblock.addComponent(1, 1, -1, ModBlocks.MachineCasing, 0); - multiblock.addComponent(1, 1, 1, ModBlocks.MachineCasing, 0); - - multiblock.addComponent(1, 2, 0, ModBlocks.MachineCasing, 0); - multiblock.addComponent(0, 2, 1, ModBlocks.MachineCasing, 0); - multiblock.addComponent(-1, 2, 0, ModBlocks.MachineCasing, 0); - multiblock.addComponent(0, 2, -1, ModBlocks.MachineCasing, 0); - multiblock.addComponent(-1, 2, -1, ModBlocks.MachineCasing, 0); - multiblock.addComponent(-1, 2, 1, ModBlocks.MachineCasing, 0); - multiblock.addComponent(1, 2, -1, ModBlocks.MachineCasing, 0); - multiblock.addComponent(1, 2, 1, ModBlocks.MachineCasing, 0); - - multiblock.addComponent(1, 3, 0, ModBlocks.MachineCasing, 0); - multiblock.addComponent(0, 3, 1, ModBlocks.MachineCasing, 0); - multiblock.addComponent(-1, 3, 0, ModBlocks.MachineCasing, 0); - multiblock.addComponent(0, 3, -1, ModBlocks.MachineCasing, 0); - multiblock.addComponent(-1, 3, -1, ModBlocks.MachineCasing, 0); - multiblock.addComponent(-1, 3, 1, ModBlocks.MachineCasing, 0); - multiblock.addComponent(1, 3, -1, ModBlocks.MachineCasing, 0); - multiblock.addComponent(1, 3, 1, ModBlocks.MachineCasing, 0); - - MultiblockSet set = new MultiblockSet(multiblock); - ClientProxy.multiblockRenderEvent.setMultiblock(set); - ClientProxy.multiblockRenderEvent.anchor = new ChunkCoordinates(blastfurnace.xCoord - (ForgeDirection.getOrientation(blastfurnace.getRotation()).offsetX * 2), blastfurnace.yCoord - 1, blastfurnace.zCoord - (ForgeDirection.getOrientation(blastfurnace.getRotation()).offsetZ * 2)); - } - button.displayString = "A"; - } else { - ClientProxy.multiblockRenderEvent.setMultiblock(null); - button.displayString = "B"; - } - } - } + + @Override + public void actionPerformed(GuiButton button) { + super.actionPerformed(button); + if (button.id == 212) { + if (ClientProxy.multiblockRenderEvent.currentMultiblock == null) { + {//This code here makes a basic multiblock and then sets to the selected one. + Multiblock multiblock = new Multiblock(); + multiblock.addComponent(0, 0, 0, ModBlocks.MachineCasing, 0); + multiblock.addComponent(1, 0, 0, ModBlocks.MachineCasing, 0); + multiblock.addComponent(0, 0, 1, ModBlocks.MachineCasing, 0); + multiblock.addComponent(-1, 0, 0, ModBlocks.MachineCasing, 0); + multiblock.addComponent(0, 0, -1, ModBlocks.MachineCasing, 0); + multiblock.addComponent(-1, 0, -1, ModBlocks.MachineCasing, 0); + multiblock.addComponent(-1, 0, 1, ModBlocks.MachineCasing, 0); + multiblock.addComponent(1, 0, -1, ModBlocks.MachineCasing, 0); + multiblock.addComponent(1, 0, 1, ModBlocks.MachineCasing, 0); + + multiblock.addComponent(1, 1, 0, ModBlocks.MachineCasing, 0); + multiblock.addComponent(0, 1, 1, ModBlocks.MachineCasing, 0); + multiblock.addComponent(-1, 1, 0, ModBlocks.MachineCasing, 0); + multiblock.addComponent(0, 1, -1, ModBlocks.MachineCasing, 0); + multiblock.addComponent(-1, 1, -1, ModBlocks.MachineCasing, 0); + multiblock.addComponent(-1, 1, 1, ModBlocks.MachineCasing, 0); + multiblock.addComponent(1, 1, -1, ModBlocks.MachineCasing, 0); + multiblock.addComponent(1, 1, 1, ModBlocks.MachineCasing, 0); + + multiblock.addComponent(1, 2, 0, ModBlocks.MachineCasing, 0); + multiblock.addComponent(0, 2, 1, ModBlocks.MachineCasing, 0); + multiblock.addComponent(-1, 2, 0, ModBlocks.MachineCasing, 0); + multiblock.addComponent(0, 2, -1, ModBlocks.MachineCasing, 0); + multiblock.addComponent(-1, 2, -1, ModBlocks.MachineCasing, 0); + multiblock.addComponent(-1, 2, 1, ModBlocks.MachineCasing, 0); + multiblock.addComponent(1, 2, -1, ModBlocks.MachineCasing, 0); + multiblock.addComponent(1, 2, 1, ModBlocks.MachineCasing, 0); + + multiblock.addComponent(1, 3, 0, ModBlocks.MachineCasing, 0); + multiblock.addComponent(0, 3, 1, ModBlocks.MachineCasing, 0); + multiblock.addComponent(-1, 3, 0, ModBlocks.MachineCasing, 0); + multiblock.addComponent(0, 3, -1, ModBlocks.MachineCasing, 0); + multiblock.addComponent(-1, 3, -1, ModBlocks.MachineCasing, 0); + multiblock.addComponent(-1, 3, 1, ModBlocks.MachineCasing, 0); + multiblock.addComponent(1, 3, -1, ModBlocks.MachineCasing, 0); + multiblock.addComponent(1, 3, 1, ModBlocks.MachineCasing, 0); + + MultiblockSet set = new MultiblockSet(multiblock); + ClientProxy.multiblockRenderEvent.setMultiblock(set); + ClientProxy.multiblockRenderEvent.anchor = new ChunkCoordinates(blastfurnace.xCoord - (ForgeDirection.getOrientation(blastfurnace.getRotation()).offsetX * 2), blastfurnace.yCoord - 1, blastfurnace.zCoord - (ForgeDirection.getOrientation(blastfurnace.getRotation()).offsetZ * 2)); + } + button.displayString = "A"; + } else { + ClientProxy.multiblockRenderEvent.setMultiblock(null); + button.displayString = "B"; + } + } + } } diff --git a/src/main/java/techreborn/client/gui/GuiCentrifuge.java b/src/main/java/techreborn/client/gui/GuiCentrifuge.java index 22a38ba7a..7a6a26565 100644 --- a/src/main/java/techreborn/client/gui/GuiCentrifuge.java +++ b/src/main/java/techreborn/client/gui/GuiCentrifuge.java @@ -58,6 +58,6 @@ public class GuiCentrifuge extends GuiContainer { this.fontRendererObj.drawString(namePt1, 98, 6, 4210752); this.fontRendererObj.drawString(namePt2, 98, 14, 4210752); this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752); - this.fontRendererObj.drawString(centrifuge.getProgressScaled(100) + "%", 98, this.ySize - 96 + 2, 4210752); + this.fontRendererObj.drawString(centrifuge.getProgressScaled(100) + "%", 98, this.ySize - 96 + 2, 4210752); } } diff --git a/src/main/java/techreborn/client/gui/GuiGrinder.java b/src/main/java/techreborn/client/gui/GuiGrinder.java index 883f698f0..fb0c683a7 100644 --- a/src/main/java/techreborn/client/gui/GuiGrinder.java +++ b/src/main/java/techreborn/client/gui/GuiGrinder.java @@ -8,7 +8,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.IIcon; import net.minecraft.util.ResourceLocation; import net.minecraft.util.StatCollector; -import techreborn.client.GuiUtil; +import reborncore.client.gui.GuiUtil; import techreborn.client.container.ContainerGrinder; import techreborn.lib.ModInfo; import techreborn.tiles.TileGrinder; diff --git a/src/main/java/techreborn/client/gui/GuiIDSU.java b/src/main/java/techreborn/client/gui/GuiIDSU.java index 876054c33..a03f64678 100644 --- a/src/main/java/techreborn/client/gui/GuiIDSU.java +++ b/src/main/java/techreborn/client/gui/GuiIDSU.java @@ -1,30 +1,27 @@ package techreborn.client.gui; import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ResourceLocation; import net.minecraft.util.StatCollector; -import techreborn.Core; +import reborncore.common.packets.PacketHandler; import techreborn.client.container.ContainerIDSU; -import techreborn.cofhLib.gui.GuiBase; -import techreborn.cofhLib.gui.element.ElementListBox; -import techreborn.cofhLib.gui.element.ElementTextField; -import techreborn.cofhLib.gui.element.ElementTextFieldLimited; import techreborn.packets.PacketIdsu; import techreborn.tiles.idsu.TileIDSU; -import techreborn.util.LogHelper; -public class GuiIDSU extends GuiBase { +import java.awt.*; + +public class GuiIDSU extends GuiContainer { + + private static final ResourceLocation texture = new ResourceLocation( + "techreborn", "textures/gui/aesu.png"); TileIDSU idsu; ContainerIDSU containerIDSU; - public static ElementListBox listBox = new ElementListBox(null, 10, 28, 100, 40); - - ElementTextFieldLimited idFeild; - ElementTextField nameFeild; public GuiIDSU(EntityPlayer player, TileIDSU tileIDSU) { super(new ContainerIDSU(tileIDSU, player)); @@ -32,10 +29,6 @@ public class GuiIDSU extends GuiBase { this.ySize = 165; idsu = tileIDSU; this.containerIDSU = (ContainerIDSU) this.inventorySlots; - texture = new ResourceLocation("techreborn", "textures/gui/aesu.png"); - drawTitle = false; - drawInventory = false; - name = StatCollector.translateToLocal("tile.techreborn.aesu.name"); } @Override @@ -49,36 +42,29 @@ public class GuiIDSU extends GuiBase { this.buttonList.add(new GuiButton(2, k + 128, l + 5 + (20 * 2), 15, 15, "-")); this.buttonList.add(new GuiButton(3, k + 128, l + 5 + (20 * 3), 15, 15, "--")); this.buttonList.add(new GuiButton(4, k + 40, l + 10, 10, 10, "+")); + } - listBox.gui = this; - listBox.setSelectedIndex(containerIDSU.channel); - -// listBox.borderColor = new GuiColor(120, 120, 120, 0).getColor(); -// listBox.backgroundColor = new GuiColor(0, 0, 0, 32).getColor(); - addElement(listBox); - - idFeild = new ElementTextFieldLimited(this, 10, 10, 30, 10, (short) 4); - idFeild.setFilter("1234567890", false); - - addElement(idFeild); - - nameFeild = new ElementTextField(this, 70, 10, 50, 10); - - addElement(nameFeild); - -// tabs.add(new TabIDConfig(this)); - + @Override + protected void drawGuiContainerBackgroundLayer(float p_146976_1_, + int p_146976_2_, int p_146976_3_) { + this.mc.getTextureManager().bindTexture(texture); + int k = (this.width - this.xSize) / 2; + int l = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize); + } + protected void drawGuiContainerForegroundLayer(int p_146979_1_, + int p_146979_2_) { + this.fontRendererObj.drawString(StatCollector.translateToLocal("tile.techreborn.idsu.name"), 40, 10, Color.WHITE.getRGB()); + this.fontRendererObj.drawString(containerIDSU.euOut + " eu/tick", 10, 20, Color.WHITE.getRGB()); + this.fontRendererObj.drawString(containerIDSU.storedEu + " eu", 10, 30, Color.WHITE.getRGB()); + this.fontRendererObj.drawString(containerIDSU.euChange + " eu change", 10, 40, Color.WHITE.getRGB()); } @Override protected void actionPerformed(GuiButton button) { super.actionPerformed(button); - if (isInteger(idFeild.getText())) { - Core.packetPipeline.sendToServer(new PacketIdsu(button.id, idsu, Integer.parseInt(idFeild.getText()), nameFeild.getText())); - } else { - LogHelper.info("There was an issue in the gui!, Please report this to the TechReborn Devs"); - } + PacketHandler.sendPacketToServer(new PacketIdsu(button.id, idsu)); } diff --git a/src/main/java/techreborn/client/gui/GuiIndustrialSawmill.java b/src/main/java/techreborn/client/gui/GuiIndustrialSawmill.java index 7350852ad..e9ef64ac7 100644 --- a/src/main/java/techreborn/client/gui/GuiIndustrialSawmill.java +++ b/src/main/java/techreborn/client/gui/GuiIndustrialSawmill.java @@ -7,7 +7,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.IIcon; import net.minecraft.util.ResourceLocation; import net.minecraft.util.StatCollector; -import techreborn.client.GuiUtil; +import reborncore.client.gui.GuiUtil; import techreborn.client.container.ContainerIndustrialSawmill; import techreborn.lib.ModInfo; import techreborn.tiles.TileIndustrialSawmill; diff --git a/src/main/java/techreborn/client/gui/GuiQuantumChest.java b/src/main/java/techreborn/client/gui/GuiQuantumChest.java index d68d4c4db..b6449b30a 100644 --- a/src/main/java/techreborn/client/gui/GuiQuantumChest.java +++ b/src/main/java/techreborn/client/gui/GuiQuantumChest.java @@ -39,7 +39,7 @@ public class GuiQuantumChest extends GuiContainer { I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752); this.fontRendererObj.drawString("Amount", 10, 20, 16448255); - if (tile.storedItem != null && tile.getStackInSlot(1) !=null) + if (tile.storedItem != null && tile.getStackInSlot(1) != null) this.fontRendererObj.drawString(tile.storedItem.stackSize + tile.getStackInSlot(1).stackSize + "", 10, 30, 16448255); } diff --git a/src/main/java/techreborn/client/gui/componets/GuiHiddenButton.java b/src/main/java/techreborn/client/gui/componets/GuiHiddenButton.java deleted file mode 100644 index ca7f4353d..000000000 --- a/src/main/java/techreborn/client/gui/componets/GuiHiddenButton.java +++ /dev/null @@ -1,44 +0,0 @@ -package techreborn.client.gui.componets; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.GuiButton; -import net.minecraft.client.renderer.OpenGlHelper; -import org.lwjgl.opengl.GL11; - - -public class GuiHiddenButton extends GuiButton { - - public GuiHiddenButton(int id, int xPosition, int yPosition, String displayString) { - super(id, xPosition, yPosition, displayString); - } - - public GuiHiddenButton(int id, int xPosition, int yPosition, int width, int height, String displayString) { - super(id, xPosition, yPosition, width, height, displayString); - } - - @Override - public void drawButton(Minecraft p_146112_1_, int p_146112_2_, int p_146112_3_) { - if (this.visible) { - FontRenderer fontrenderer = p_146112_1_.fontRenderer; - p_146112_1_.getTextureManager().bindTexture(buttonTextures); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - this.field_146123_n = p_146112_2_ >= this.xPosition && p_146112_3_ >= this.yPosition && p_146112_2_ < this.xPosition + this.width && p_146112_3_ < this.yPosition + this.height; - GL11.glEnable(GL11.GL_BLEND); - OpenGlHelper.glBlendFunc(770, 771, 1, 0); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - this.mouseDragged(p_146112_1_, p_146112_2_, p_146112_3_); - int l = 14737632; - - if (packedFGColour != 0) { - l = packedFGColour; - } else if (!this.enabled) { - l = 10526880; - } else if (this.field_146123_n) { - l = 16777120; - } - - this.drawCenteredString(fontrenderer, this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height - 8) / 2, l); - } - } -} diff --git a/src/main/java/techreborn/client/gui/componets/TabIDConfig.java b/src/main/java/techreborn/client/gui/componets/TabIDConfig.java deleted file mode 100644 index 9f7efbe73..000000000 --- a/src/main/java/techreborn/client/gui/componets/TabIDConfig.java +++ /dev/null @@ -1,13 +0,0 @@ -package techreborn.client.gui.componets; - -import techreborn.cofhLib.gui.GuiBase; -import techreborn.cofhLib.gui.element.TabBase; - -/** - * Created by mark on 18/06/15. - */ -public class TabIDConfig extends TabBase { - public TabIDConfig(GuiBase gui) { - super(gui); - } -} diff --git a/src/main/java/techreborn/client/hud/ChargeHud.java b/src/main/java/techreborn/client/hud/ChargeHud.java index 6c2a68590..3c15550ca 100644 --- a/src/main/java/techreborn/client/hud/ChargeHud.java +++ b/src/main/java/techreborn/client/hud/ChargeHud.java @@ -13,10 +13,10 @@ import net.minecraft.item.ItemStack; import net.minecraftforge.client.event.RenderGameOverlayEvent; import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType; import org.lwjgl.opengl.GL11; +import reborncore.common.util.Color; import techreborn.api.power.IEnergyInterfaceItem; import techreborn.client.keybindings.KeyBindings; import techreborn.config.ConfigTechReborn; -import techreborn.util.Color; public class ChargeHud { public static final ChargeHud instance = new ChargeHud(); diff --git a/src/main/java/techreborn/client/keybindings/KeyInputEventHandler.java b/src/main/java/techreborn/client/keybindings/KeyInputEventHandler.java index 07c43f6e3..85ba370e5 100644 --- a/src/main/java/techreborn/client/keybindings/KeyInputEventHandler.java +++ b/src/main/java/techreborn/client/keybindings/KeyInputEventHandler.java @@ -2,8 +2,8 @@ package techreborn.client.keybindings; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.InputEvent; +import techreborn.Core; import techreborn.lib.Key; -import techreborn.util.LogHelper; public class KeyInputEventHandler { private static Key getPressedKeybinding() { @@ -16,7 +16,7 @@ public class KeyInputEventHandler { @SubscribeEvent public void handleKeyInputEvent(InputEvent.KeyInputEvent event) { - LogHelper.info(getPressedKeybinding()); + Core.logHelper.info(getPressedKeybinding()); } } diff --git a/src/main/java/techreborn/client/multiblock/IMultiblockRenderHook.java b/src/main/java/techreborn/client/multiblock/IMultiblockRenderHook.java deleted file mode 100755 index 5a8cae16e..000000000 --- a/src/main/java/techreborn/client/multiblock/IMultiblockRenderHook.java +++ /dev/null @@ -1,28 +0,0 @@ -/** - * This class was created by . It's distributed as - * part of the Botania Mod. Get the Source Code in github: - * https://github.com/Vazkii/Botania - * - * Botania is Open Source and distributed under the - * Botania License: http://botaniamod.net/license.php - * - */ -package techreborn.client.multiblock; - -import java.util.HashMap; -import java.util.Map; - -import net.minecraft.block.Block; -import net.minecraft.client.renderer.RenderBlocks; -import net.minecraft.world.IBlockAccess; - -/** - * A hook for rendering blocks in the multiblock display. - */ -public interface IMultiblockRenderHook { - - public static Map renderHooks = new HashMap(); - - public void renderBlockForMultiblock(IBlockAccess world, Multiblock mb, Block block, int meta, RenderBlocks renderBlocks); - -} diff --git a/src/main/java/techreborn/client/multiblock/Multiblock.java b/src/main/java/techreborn/client/multiblock/Multiblock.java deleted file mode 100755 index 2d4d6156e..000000000 --- a/src/main/java/techreborn/client/multiblock/Multiblock.java +++ /dev/null @@ -1,152 +0,0 @@ -/** - * This class was created by . It's distributed as - * part of the Botania Mod. Get the Source Code in github: - * https://github.com/Vazkii/Botania - * - * Botania is Open Source and distributed under the - * Botania License: http://botaniamod.net/license.php - * - */ -package techreborn.client.multiblock; - -import java.util.ArrayList; -import java.util.List; - -import net.minecraft.block.Block; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ChunkCoordinates; -import techreborn.client.multiblock.component.MultiblockComponent; - -/** - * This class describes a Mutiblock object. It's used to display a - * multiblock in the pda and to show the player in a ghost-like - * look in the world. - */ -public class Multiblock { - - public List components = new ArrayList(); - public List materials = new ArrayList(); - - public int minX, minY, minZ, maxX, maxY, maxZ, offX, offY, offZ; - - /** - * Adds a multiblock component to this multiblock. The component's x y z - * coords should be pivoted to the center of the structure. - */ - public void addComponent(MultiblockComponent component) { - components.add(component); - changeAxisForNewComponent(component.relPos.posX, component.relPos.posY, component.relPos.posZ); - calculateCostForNewComponent(component); - } - - /** - * Constructs and adds a multiblock component to this multiblock. The x y z - * coords should be pivoted to the center of the structure. - */ - public void addComponent(int x, int y, int z, Block block, int meta) { - addComponent(new MultiblockComponent(new ChunkCoordinates(x, y, z), block, meta)); - } - - private void changeAxisForNewComponent(int x, int y, int z) { - if(x < minX) - minX = x; - else if(x > maxX) - maxX = x; - - if(y < minY) - minY = y; - else if(y > maxY) - maxY = y; - - if(z < minZ) - minZ = z; - else if(z > maxZ) - maxZ = z; - } - - private void calculateCostForNewComponent(MultiblockComponent comp) { - ItemStack[] materials = comp.getMaterials(); - if(materials != null) - for(ItemStack stack : materials) - addStack(stack); - } - - private void addStack(ItemStack stack) { - if(stack == null) - return; - - for(ItemStack oStack : materials) - if(oStack.isItemEqual(stack) && ItemStack.areItemStackTagsEqual(oStack, stack)) { - oStack.stackSize += stack.stackSize; - return; - } - - materials.add(stack); - } - - public void setRenderOffset(int x, int y, int z) { - offX = x; - offY = y; - offZ = z; - } - - public List getComponents() { - return components; - } - - /** - * Rotates this multiblock by the angle passed in. For the best results, use - * only multiples of pi/2. - */ - public void rotate(double angle) { - for(MultiblockComponent comp : getComponents()) - comp.rotate(angle); - } - - public Multiblock copy() { - Multiblock mb = new Multiblock(); - for(MultiblockComponent comp : getComponents()) - mb.addComponent(comp.copy()); - - return mb; - } - - /** - * Creates a length 4 array of all the rotations multiple of pi/2 required - * to render this multiblock in the world relevant to the 4 cardinal - * orientations. - */ - public Multiblock[] createRotations() { - Multiblock[] blocks = new Multiblock[4]; - blocks[0] = this; - blocks[1] = blocks[0].copy(); - blocks[1].rotate(Math.PI / 2); - blocks[2] = blocks[1].copy(); - blocks[2].rotate(Math.PI / 2); - blocks[3] = blocks[2].copy(); - blocks[3].rotate(Math.PI / 2); - - return blocks; - } - - /** - * Makes a MultiblockSet from this Multiblock and its rotations using - * createRotations(). - */ - public MultiblockSet makeSet() { - return new MultiblockSet(this); - } - - public int getXSize() { - return Math.abs(minX) + Math.abs(maxX) + 1; - } - - public int getYSize() { - return Math.abs(minY) + Math.abs(maxY) + 1; - } - - public int getZSize() { - return Math.abs(minZ) + Math.abs(maxZ) + 1; - } - -} diff --git a/src/main/java/techreborn/client/multiblock/MultiblockSet.java b/src/main/java/techreborn/client/multiblock/MultiblockSet.java deleted file mode 100755 index 412ad696f..000000000 --- a/src/main/java/techreborn/client/multiblock/MultiblockSet.java +++ /dev/null @@ -1,42 +0,0 @@ -/** - * This class was created by . It's distributed as - * part of the Botania Mod. Get the Source Code in github: - * https://github.com/Vazkii/Botania - * - * Botania is Open Source and distributed under the - * Botania License: http://botaniamod.net/license.php - * - */ -package techreborn.client.multiblock; - -import net.minecraft.entity.Entity; -import net.minecraft.util.MathHelper; - -/** - * A set of Multiblock objects for various rotations. - */ -public class MultiblockSet { - - private final Multiblock[] mbs; - - public MultiblockSet(Multiblock[] mbs) { - this.mbs = mbs; - } - - public MultiblockSet(Multiblock mb) { - this(mb.createRotations()); - } - - public Multiblock getForEntity(Entity e) { - return getForRotation(e.rotationYaw); - } - - public Multiblock getForRotation(double rotation) { - int facing = MathHelper.floor_double(rotation * 4.0 / 360.0 + 0.5) & 3; - return getForIndex(facing); - } - - public Multiblock getForIndex(int index) { - return mbs[index]; - } -} diff --git a/src/main/java/techreborn/client/multiblock/component/MultiblockComponent.java b/src/main/java/techreborn/client/multiblock/component/MultiblockComponent.java deleted file mode 100755 index 456a5b9c4..000000000 --- a/src/main/java/techreborn/client/multiblock/component/MultiblockComponent.java +++ /dev/null @@ -1,67 +0,0 @@ -/** - * This class was created by . It's distributed as - * part of the Botania Mod. Get the Source Code in github: - * https://github.com/Vazkii/Botania - * - * Botania is Open Source and distributed under the - * Botania License: http://botaniamod.net/license.php - * - */ -package techreborn.client.multiblock.component; - -import net.minecraft.block.Block; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ChunkCoordinates; -import net.minecraft.world.World; - -/** - * A component of a multiblock, the normal one - * is just a block. - */ -public class MultiblockComponent { - - public ChunkCoordinates relPos; - public final Block block; - public final int meta; - - public MultiblockComponent(ChunkCoordinates relPos, Block block, int meta) { - this.relPos = relPos; - this.block = block; - this.meta = meta; - } - - public ChunkCoordinates getRelativePosition() { - return relPos; - } - - public Block getBlock() { - return block; - } - - public int getMeta() { - return meta; - } - - public boolean matches(World world, int x, int y, int z) { - return world.getBlock(x, y, z) == getBlock() && (meta == -1 || world.getBlockMetadata(x, y, z) == meta); - } - - public ItemStack[] getMaterials() { - return new ItemStack[] { new ItemStack(block, 1, meta) }; - } - - public void rotate(double angle) { - double x = relPos.posX; - double z = relPos.posZ; - double sin = Math.sin(angle); - double cos = Math.cos(angle); - - double xn = x * cos - z * sin; - double zn = x * sin + z * cos; - relPos = new ChunkCoordinates((int) Math.round(xn), relPos.posY, (int) Math.round(zn)); - } - - public MultiblockComponent copy() { - return new MultiblockComponent(relPos, block, meta); - } -} diff --git a/src/main/java/techreborn/client/render/MultiblockRenderEvent.java b/src/main/java/techreborn/client/render/MultiblockRenderEvent.java index f3a87d4aa..d898243f3 100644 --- a/src/main/java/techreborn/client/render/MultiblockRenderEvent.java +++ b/src/main/java/techreborn/client/render/MultiblockRenderEvent.java @@ -2,10 +2,9 @@ * This class was created by . It's distributed as * part of the Botania Mod. Get the Source Code in github: * https://github.com/Vazkii/Botania - * + *

* Botania is Open Source and distributed under the * Botania License: http://botaniamod.net/license.php - * */ package techreborn.client.render; @@ -16,97 +15,91 @@ import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.ChatComponentText; -import net.minecraft.util.ChatStyle; -import net.minecraft.util.ChunkCoordinates; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.MathHelper; -import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.*; import net.minecraft.world.World; import net.minecraftforge.client.event.RenderWorldLastEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent.Action; - import org.lwjgl.opengl.GL11; -import techreborn.client.multiblock.IMultiblockRenderHook; -import techreborn.client.multiblock.Multiblock; -import techreborn.client.multiblock.MultiblockSet; -import techreborn.client.multiblock.component.MultiblockComponent; +import reborncore.client.multiblock.IMultiblockRenderHook; +import reborncore.client.multiblock.Multiblock; +import reborncore.client.multiblock.MultiblockSet; +import reborncore.client.multiblock.component.MultiblockComponent; public class MultiblockRenderEvent { - public static boolean rendering = false; + public static boolean rendering = false; - private static RenderBlocks blockRender = RenderBlocks.getInstance(); - public MultiblockSet currentMultiblock; - public static ChunkCoordinates anchor; - public static int angle; + private static RenderBlocks blockRender = RenderBlocks.getInstance(); + public MultiblockSet currentMultiblock; + public static ChunkCoordinates anchor; + public static int angle; - public void setMultiblock(MultiblockSet set) { - currentMultiblock = set; - anchor = null; - angle = 0; - } + public void setMultiblock(MultiblockSet set) { + currentMultiblock = set; + anchor = null; + angle = 0; + } - @SubscribeEvent - public void onWorldRenderLast(RenderWorldLastEvent event) { - Minecraft mc = Minecraft.getMinecraft(); - if(mc.thePlayer != null && mc.objectMouseOver != null && !mc.thePlayer.isSneaking()) { - mc.thePlayer.getCurrentEquippedItem(); - renderPlayerLook(mc.thePlayer, mc.objectMouseOver); - } - } - - @SubscribeEvent - public void onPlayerInteract(PlayerInteractEvent event) { - if(currentMultiblock != null && anchor == null && event.action == Action.RIGHT_CLICK_BLOCK && event.entityPlayer == Minecraft.getMinecraft().thePlayer) { - anchor = new ChunkCoordinates(event.x, event.y, event.z); - angle = MathHelper.floor_double(event.entityPlayer.rotationYaw * 4.0 / 360.0 + 0.5) & 3; - event.setCanceled(true); - } - } + @SubscribeEvent + public void onWorldRenderLast(RenderWorldLastEvent event) { + Minecraft mc = Minecraft.getMinecraft(); + if (mc.thePlayer != null && mc.objectMouseOver != null && !mc.thePlayer.isSneaking()) { + mc.thePlayer.getCurrentEquippedItem(); + renderPlayerLook(mc.thePlayer, mc.objectMouseOver); + } + } - private void renderPlayerLook(EntityPlayer player, MovingObjectPosition src) { - if(currentMultiblock != null) { - int anchorX = anchor != null ? anchor.posX : src.blockX; - int anchorY = anchor != null ? anchor.posY +1 : src.blockY + 1; - int anchorZ = anchor != null ? anchor.posZ : src.blockZ; + @SubscribeEvent + public void onPlayerInteract(PlayerInteractEvent event) { + if (currentMultiblock != null && anchor == null && event.action == Action.RIGHT_CLICK_BLOCK && event.entityPlayer == Minecraft.getMinecraft().thePlayer) { + anchor = new ChunkCoordinates(event.x, event.y, event.z); + angle = MathHelper.floor_double(event.entityPlayer.rotationYaw * 4.0 / 360.0 + 0.5) & 3; + event.setCanceled(true); + } + } - rendering = true; - Multiblock mb =currentMultiblock.getForEntity(player); - boolean didAny = false; - for(MultiblockComponent comp : mb.getComponents()) - if(renderComponent(player.worldObj, mb, comp, anchorX, anchorY, anchorZ)) - didAny = true; - rendering = false; + private void renderPlayerLook(EntityPlayer player, MovingObjectPosition src) { + if (currentMultiblock != null) { + int anchorX = anchor != null ? anchor.posX : src.blockX; + int anchorY = anchor != null ? anchor.posY + 1 : src.blockY + 1; + int anchorZ = anchor != null ? anchor.posZ : src.blockZ; - if(!didAny) { - setMultiblock(null); - player.addChatComponentMessage(new ChatComponentText("Structure Complete!").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.GREEN))); - } - } - } + rendering = true; + Multiblock mb = currentMultiblock.getForEntity(player); + boolean didAny = false; + for (MultiblockComponent comp : mb.getComponents()) + if (renderComponent(player.worldObj, mb, comp, anchorX, anchorY, anchorZ)) + didAny = true; + rendering = false; - private boolean renderComponent(World world, Multiblock mb, MultiblockComponent comp, int anchorX, int anchorY, int anchorZ) { - ChunkCoordinates pos = comp.getRelativePosition(); - int x = pos.posX + anchorX; - int y = pos.posY + anchorY; - int z = pos.posZ + anchorZ; + if (!didAny) { + setMultiblock(null); + player.addChatComponentMessage(new ChatComponentText("Structure Complete!").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.GREEN))); + } + } + } - GL11.glPushMatrix(); - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - GL11.glDisable(GL11.GL_DEPTH_TEST); - GL11.glColor4f(1F, 1F, 1F, 0.4F); - GL11.glTranslated(x + 0.5 - RenderManager.renderPosX, y + 0.5 - RenderManager.renderPosY, z + 0.5 - RenderManager.renderPosZ); - Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture); + private boolean renderComponent(World world, Multiblock mb, MultiblockComponent comp, int anchorX, int anchorY, int anchorZ) { + ChunkCoordinates pos = comp.getRelativePosition(); + int x = pos.posX + anchorX; + int y = pos.posY + anchorY; + int z = pos.posZ + anchorZ; - blockRender.useInventoryTint = false; - Block block = comp.getBlock(); - if(IMultiblockRenderHook.renderHooks.containsKey(block)) - IMultiblockRenderHook.renderHooks.get(block).renderBlockForMultiblock(world, mb, block, comp.getMeta(), blockRender); - else blockRender.renderBlockAsItem(comp.getBlock(), comp.getMeta(), 1F); - GL11.glEnable(GL11.GL_DEPTH_TEST); - GL11.glPopMatrix(); - return true; - } + GL11.glPushMatrix(); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + GL11.glDisable(GL11.GL_DEPTH_TEST); + GL11.glColor4f(1F, 1F, 1F, 0.4F); + GL11.glTranslated(x + 0.5 - RenderManager.renderPosX, y + 0.5 - RenderManager.renderPosY, z + 0.5 - RenderManager.renderPosZ); + Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture); + + blockRender.useInventoryTint = false; + Block block = comp.getBlock(); + if (IMultiblockRenderHook.renderHooks.containsKey(block)) + IMultiblockRenderHook.renderHooks.get(block).renderBlockForMultiblock(world, mb, block, comp.getMeta(), blockRender); + else blockRender.renderBlockAsItem(comp.getBlock(), comp.getMeta(), 1F); + GL11.glEnable(GL11.GL_DEPTH_TEST); + GL11.glPopMatrix(); + return true; + } } diff --git a/src/main/java/techreborn/client/render/RenderCablePart.java b/src/main/java/techreborn/client/render/RenderCablePart.java index 220fd816d..8fe344dc6 100644 --- a/src/main/java/techreborn/client/render/RenderCablePart.java +++ b/src/main/java/techreborn/client/render/RenderCablePart.java @@ -7,13 +7,12 @@ import ic2.api.item.IC2Items; import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.Tessellator; -import net.minecraft.item.ItemBlock; import net.minecraft.util.IIcon; import net.minecraftforge.common.util.ForgeDirection; +import reborncore.common.misc.Functions; +import reborncore.common.misc.vecmath.Vecs3d; +import reborncore.common.misc.vecmath.Vecs3dCube; import techreborn.client.IconSupplier; -import techreborn.lib.Functions; -import techreborn.lib.vecmath.Vecs3d; -import techreborn.lib.vecmath.Vecs3dCube; import techreborn.partSystem.parts.CablePart; @@ -59,7 +58,7 @@ public class RenderCablePart { @SideOnly(Side.CLIENT) public static IIcon getIconFromType(int cableType) { - if(IC2Classic.getLoadedIC2Type() == IC2Classic.IC2Type.SpeigersClassic){ + if (IC2Classic.getLoadedIC2Type() == IC2Classic.IC2Type.SpeigersClassic) { return Block.getBlockFromItem(IC2Items.getItem("copperCableBlock").getItem()).getIcon(0, cableType * 16); } IIcon p = null; diff --git a/src/main/java/techreborn/client/texture/CasingConnectedTextureGenerator.java b/src/main/java/techreborn/client/texture/CasingConnectedTextureGenerator.java index ddcfd80cd..a45f04fb8 100644 --- a/src/main/java/techreborn/client/texture/CasingConnectedTextureGenerator.java +++ b/src/main/java/techreborn/client/texture/CasingConnectedTextureGenerator.java @@ -11,6 +11,7 @@ import net.minecraft.client.resources.IResourceManager; import net.minecraft.client.resources.data.AnimationMetadataSection; import net.minecraft.util.IIcon; import net.minecraft.util.ResourceLocation; +import reborncore.client.texture.ConnectedTexture; import techreborn.lib.ModInfo; import javax.imageio.ImageIO; @@ -42,17 +43,17 @@ public class CasingConnectedTextureGenerator extends TextureAtlasSprite { for (int i = 0; i < type_data.length; i += 1) { int x = (i % w); int y = (i - x) / w; - if(getAlpha(edge_data[i]) != 0){ - if(y <= 1 && connectedTexture.isUp()){ + if (getAlpha(edge_data[i]) != 0) { + if (y <= 1 && connectedTexture.isUp()) { new_data[i] = edge_data[i]; } - if(y >= 14 && connectedTexture.isDown()){ + if (y >= 14 && connectedTexture.isDown()) { new_data[i] = edge_data[i]; } - if(x <= 1 && connectedTexture.isRight()){ + if (x <= 1 && connectedTexture.isRight()) { new_data[i] = edge_data[i]; } - if(x >= 14 && connectedTexture.isLeft()){ + if (x >= 14 && connectedTexture.isLeft()) { new_data[i] = edge_data[i]; } } @@ -109,7 +110,7 @@ public class CasingConnectedTextureGenerator extends TextureAtlasSprite { output_image = new BufferedImage(w, h, 2); int[] type_data = new int[w * w]; int[] edge_data = new int[w * w]; - + for (int y = 0; y < h; y += w) { type_image[0].getRGB(0, y, w, w, type_data, 0, w); edge_image[0].getRGB(0, y, w, w, edge_data, 0, w); diff --git a/src/main/java/techreborn/client/texture/ConnectedTexture.java b/src/main/java/techreborn/client/texture/ConnectedTexture.java deleted file mode 100644 index 819e9a58b..000000000 --- a/src/main/java/techreborn/client/texture/ConnectedTexture.java +++ /dev/null @@ -1,47 +0,0 @@ -package techreborn.client.texture; - -public class ConnectedTexture { - - private boolean up, down, left, right; - - - public ConnectedTexture(boolean up, boolean down, boolean left, boolean right) { - this.up = up; - this.down = down; - this.left = left; - this.right = right; - } - - public boolean isUp() { - return up; - } - - public void setUp(boolean up) { - this.up = up; - } - - public boolean isDown() { - return down; - } - - public void setDown(boolean down) { - this.down = down; - } - - public boolean isLeft() { - return left; - } - - public void setLeft(boolean left) { - this.left = left; - } - - public boolean isRight() { - return right; - } - - public void setRight(boolean right) { - this.right = right; - } - -} diff --git a/src/main/java/techreborn/client/texture/LesuConnectedTextureGenerator.java b/src/main/java/techreborn/client/texture/LesuConnectedTextureGenerator.java index 62e95c6ab..4d1f08f19 100644 --- a/src/main/java/techreborn/client/texture/LesuConnectedTextureGenerator.java +++ b/src/main/java/techreborn/client/texture/LesuConnectedTextureGenerator.java @@ -9,6 +9,7 @@ import net.minecraft.client.resources.IResourceManager; import net.minecraft.client.resources.data.AnimationMetadataSection; import net.minecraft.util.IIcon; import net.minecraft.util.ResourceLocation; +import reborncore.client.texture.ConnectedTexture; import techreborn.lib.ModInfo; import javax.imageio.ImageIO; @@ -45,17 +46,17 @@ public class LesuConnectedTextureGenerator extends TextureAtlasSprite { for (int i = 0; i < type_data.length; i += 1) { int x = (i % w); int y = (i - x) / w; - if(getAlpha(edge_data[i]) != 0){ - if(y <= 1 && connectedTexture.isUp()){ + if (getAlpha(edge_data[i]) != 0) { + if (y <= 1 && connectedTexture.isUp()) { new_data[i] = edge_data[i]; } - if(y >= 14 && connectedTexture.isDown()){ + if (y >= 14 && connectedTexture.isDown()) { new_data[i] = edge_data[i]; } - if(x <= 1 && connectedTexture.isRight()){ + if (x <= 1 && connectedTexture.isRight()) { new_data[i] = edge_data[i]; } - if(x >= 14 && connectedTexture.isLeft()){ + if (x >= 14 && connectedTexture.isLeft()) { new_data[i] = edge_data[i]; } } @@ -112,7 +113,7 @@ public class LesuConnectedTextureGenerator extends TextureAtlasSprite { output_image = new BufferedImage(w, h, 2); int[] type_data = new int[w * w]; int[] edge_data = new int[w * w]; - + for (int y = 0; y < h; y += w) { try { type_image[0].getRGB(0, y, w, w, type_data, 0, w); diff --git a/src/main/java/techreborn/cofhLib/audio/SoundBase.java b/src/main/java/techreborn/cofhLib/audio/SoundBase.java deleted file mode 100755 index 728335d09..000000000 --- a/src/main/java/techreborn/cofhLib/audio/SoundBase.java +++ /dev/null @@ -1,172 +0,0 @@ -package techreborn.cofhLib.audio; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.client.audio.ISound; -import net.minecraft.util.ResourceLocation; - -/** - * Generic ISound class with lots of constructor functionality. Required because - of course - Mojang has no generic that lets you specify *any* arguments for - * this. - * - * @author skyboy - */ -@SideOnly(Side.CLIENT) -public class SoundBase implements ISound { - - protected AttenuationType attenuation; - protected final ResourceLocation sound; - protected float volume; - protected float pitch; - protected float x; - protected float y; - protected float z; - protected boolean repeat; - protected int repeatDelay; - - public SoundBase(String sound) { - - this(sound, 0); - } - - public SoundBase(String sound, float volume) { - - this(sound, volume, 0); - } - - public SoundBase(String sound, float volume, float pitch) { - - this(sound, volume, pitch, false, 0); - } - - public SoundBase(String sound, float volume, float pitch, boolean repeat, int repeatDelay) { - - this(sound, volume, pitch, repeat, repeatDelay, 0, 0, 0, AttenuationType.NONE); - } - - public SoundBase(String sound, float volume, float pitch, double x, double y, double z) { - - this(sound, volume, pitch, false, 0, x, y, z); - } - - public SoundBase(String sound, float volume, float pitch, boolean repeat, int repeatDelay, double x, double y, double z) { - - this(sound, volume, pitch, repeat, repeatDelay, x, y, z, AttenuationType.LINEAR); - } - - public SoundBase(String sound, float volume, float pitch, boolean repeat, int repeatDelay, double x, double y, double z, AttenuationType attenuation) { - - this(new ResourceLocation(sound), volume, pitch, repeat, repeatDelay, x, y, z, attenuation); - } - - public SoundBase(ResourceLocation sound) { - - this(sound, 0); - } - - public SoundBase(ResourceLocation sound, float volume) { - - this(sound, volume, 0); - } - - public SoundBase(ResourceLocation sound, float volume, float pitch) { - - this(sound, volume, pitch, false, 0); - } - - public SoundBase(ResourceLocation sound, float volume, float pitch, boolean repeat, int repeatDelay) { - - this(sound, volume, pitch, repeat, repeatDelay, 0, 0, 0, AttenuationType.NONE); - } - - public SoundBase(ResourceLocation sound, float volume, float pitch, double x, double y, double z) { - - this(sound, volume, pitch, false, 0, x, y, z); - } - - public SoundBase(ResourceLocation sound, float volume, float pitch, boolean repeat, int repeatDelay, double x, double y, double z) { - - this(sound, volume, pitch, repeat, repeatDelay, x, y, z, AttenuationType.LINEAR); - } - - public SoundBase(ResourceLocation sound, float volume, float pitch, boolean repeat, int repeatDelay, double x, double y, double z, AttenuationType attenuation) { - - this.attenuation = attenuation; - this.sound = sound; - this.volume = volume; - this.pitch = pitch; - this.x = (float) x; - this.y = (float) y; - this.z = (float) z; - this.repeat = repeat; - this.repeatDelay = repeatDelay; - } - - public SoundBase(SoundBase other) { - - this.attenuation = other.attenuation; - this.sound = other.sound; - this.volume = other.volume; - this.pitch = other.pitch; - this.x = other.x; - this.y = other.y; - this.z = other.z; - this.repeat = other.repeat; - this.repeatDelay = other.repeatDelay; - } - - @Override - public AttenuationType getAttenuationType() { - - return attenuation; - } - - @Override - public ResourceLocation getPositionedSoundLocation() { - - return sound; - } - - @Override - public float getVolume() { - - return volume; - } - - @Override - public float getPitch() { - - return pitch; - } - - @Override - public float getXPosF() { - - return x; - } - - @Override - public float getYPosF() { - - return y; - } - - @Override - public float getZPosF() { - - return z; - } - - @Override - public boolean canRepeat() { - - return repeat; - } - - @Override - public int getRepeatDelay() { - - return repeatDelay; - } - -} diff --git a/src/main/java/techreborn/cofhLib/gui/GuiBase.java b/src/main/java/techreborn/cofhLib/gui/GuiBase.java deleted file mode 100755 index 51149cacd..000000000 --- a/src/main/java/techreborn/cofhLib/gui/GuiBase.java +++ /dev/null @@ -1,763 +0,0 @@ -package techreborn.cofhLib.gui; - -import cpw.mods.fml.client.FMLClientHandler; -import net.minecraft.client.audio.SoundHandler; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; -import net.minecraft.util.IIcon; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.StatCollector; -import net.minecraftforge.fluids.FluidStack; -import org.lwjgl.input.Mouse; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL12; -import techreborn.cofhLib.audio.SoundBase; -import techreborn.cofhLib.gui.element.ElementBase; -import techreborn.cofhLib.gui.element.TabBase; -import techreborn.cofhLib.gui.slot.SlotFalseCopy; -import techreborn.cofhLib.render.RenderHelper; -import techreborn.cofhLib.util.helpers.StringHelper; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; - -/** - * Base class for a modular GUIs. Works with Elements {@link techreborn.cofhLib.gui.element.ElementBase} and Tabs {@link techreborn.cofhLib.gui.element.TabBase} which are both modular elements. - * - * @author King Lemming - */ -public abstract class GuiBase extends GuiContainer { - - public static final SoundHandler guiSoundManager = FMLClientHandler.instance().getClient().getSoundHandler(); - - protected boolean drawTitle = true; - protected boolean drawInventory = true; - protected int mouseX = 0; - protected int mouseY = 0; - - protected int lastIndex = -1; - - protected String name; - protected ResourceLocation texture; - - public ArrayList tabs = new ArrayList(); - protected ArrayList elements = new ArrayList(); - - protected List tooltip = new LinkedList(); - protected boolean tooltips = true; - - public static void playSound(String name, float volume, float pitch) { - - guiSoundManager.playSound(new SoundBase(name, volume, pitch)); - } - - public GuiBase(Container container) { - - super(container); - } - - public GuiBase(Container container, ResourceLocation texture) { - - super(container); - this.texture = texture; - } - - @Override - public void initGui() { - - super.initGui(); - tabs.clear(); - elements.clear(); - } - - @Override - public void drawScreen(int x, int y, float partialTick) { - - updateElementInformation(); - - super.drawScreen(x, y, partialTick); - - if (tooltips && mc.thePlayer.inventory.getItemStack() == null) { - addTooltips(tooltip); - drawTooltip(tooltip); - } - mouseX = x - guiLeft; - mouseY = y - guiTop; - - updateElements(); - } - - @Override - protected void drawGuiContainerForegroundLayer(int x, int y) { - - if (drawTitle) { - fontRendererObj.drawString(StringHelper.localize(name), getCenteredOffset(StringHelper.localize(name)), 6, 0x404040); - } - if (drawInventory) { - fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 8, ySize - 96 + 3, 0x404040); - } - drawElements(0, true); - drawTabs(0, true); - } - - @Override - protected void drawGuiContainerBackgroundLayer(float partialTick, int x, int y) { - - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - bindTexture(texture); - drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize); - - mouseX = x - guiLeft; - mouseY = y - guiTop; - - GL11.glPushMatrix(); - GL11.glTranslatef(guiLeft, guiTop, 0.0F); - drawElements(partialTick, false); - drawTabs(partialTick, false); - GL11.glPopMatrix(); - } - - @Override - protected void keyTyped(char characterTyped, int keyPressed) { - - for (int i = elements.size(); i-- > 0; ) { - ElementBase c = elements.get(i); - if (!c.isVisible() || !c.isEnabled()) { - continue; - } - if (c.onKeyTyped(characterTyped, keyPressed)) { - return; - } - } - super.keyTyped(characterTyped, keyPressed); - } - - @Override - public void handleMouseInput() { - - int x = Mouse.getEventX() * width / mc.displayWidth; - int y = height - Mouse.getEventY() * height / mc.displayHeight - 1; - - mouseX = x - guiLeft; - mouseY = y - guiTop; - - int wheelMovement = Mouse.getEventDWheel(); - - if (wheelMovement != 0) { - for (int i = elements.size(); i-- > 0; ) { - ElementBase c = elements.get(i); - if (!c.isVisible() || !c.isEnabled() || !c.intersectsWith(mouseX, mouseY)) { - continue; - } - if (c.onMouseWheel(mouseX, mouseY, wheelMovement)) { - return; - } - } - TabBase tab = getTabAtPosition(mouseX, mouseY); - - if (tab != null && tab.onMouseWheel(mouseX, mouseY, wheelMovement)) { - return; - } - } - super.handleMouseInput(); - } - - @Override - protected void mouseClicked(int mX, int mY, int mouseButton) { - - mX -= guiLeft; - mY -= guiTop; - - for (int i = elements.size(); i-- > 0; ) { - ElementBase c = elements.get(i); - if (!c.isVisible() || !c.isEnabled() || !c.intersectsWith(mX, mY)) { - continue; - } - if (c.onMousePressed(mX, mY, mouseButton)) { - return; - } - } - - TabBase tab = getTabAtPosition(mX, mY); - if (tab != null) { - int tMx = mX; - - if (!tab.onMousePressed(tMx, mY, mouseButton)) { - for (int i = tabs.size(); i-- > 0; ) { - TabBase other = tabs.get(i); - if (other != tab && other.open && other.side == tab.side) { - other.toggleOpen(); - } - } - tab.toggleOpen(); - return; - } - } - - mX += guiLeft; - mY += guiTop; - - if (tab != null) { - switch (tab.side) { - case TabBase.LEFT: - // guiLeft -= tab.currentWidth; - break; - case TabBase.RIGHT: - xSize += tab.currentWidth; - break; - } - } - super.mouseClicked(mX, mY, mouseButton); - if (tab != null) { - switch (tab.side) { - case TabBase.LEFT: - // guiLeft += tab.currentWidth; - break; - case TabBase.RIGHT: - xSize -= tab.currentWidth; - break; - } - } - } - - @Override - protected void mouseMovedOrUp(int mX, int mY, int mouseButton) { - - mX -= guiLeft; - mY -= guiTop; - - if (mouseButton >= 0 && mouseButton <= 2) { // 0:left, 1:right, 2: middle - for (int i = elements.size(); i-- > 0; ) { - ElementBase c = elements.get(i); - if (!c.isVisible() || !c.isEnabled()) { // no bounds checking on mouseUp events - continue; - } - c.onMouseReleased(mX, mY); - } - } - mX += guiLeft; - mY += guiTop; - - super.mouseMovedOrUp(mX, mY, mouseButton); - } - - @Override - protected void mouseClickMove(int mX, int mY, int lastClick, long timeSinceClick) { - - Slot slot = getSlotAtPosition(mX, mY); - ItemStack itemstack = this.mc.thePlayer.inventory.getItemStack(); - - if (this.field_147007_t && slot != null && itemstack != null && slot instanceof SlotFalseCopy) { - if (lastIndex != slot.slotNumber) { - lastIndex = slot.slotNumber; - this.handleMouseClick(slot, slot.slotNumber, 0, 0); - } - } else { - lastIndex = -1; - super.mouseClickMove(mX, mY, lastClick, timeSinceClick); - } - } - - public Slot getSlotAtPosition(int xCoord, int yCoord) { - - for (int k = 0; k < this.inventorySlots.inventorySlots.size(); ++k) { - Slot slot = (Slot) this.inventorySlots.inventorySlots.get(k); - - if (this.isMouseOverSlot(slot, xCoord, yCoord)) { - return slot; - } - } - return null; - } - - public boolean isMouseOverSlot(Slot theSlot, int xCoord, int yCoord) { - - return this.func_146978_c(theSlot.xDisplayPosition, theSlot.yDisplayPosition, 16, 16, xCoord, yCoord); - } - - /** - * Draws the elements for this GUI. - */ - protected void drawElements(float partialTick, boolean foreground) { - - if (foreground) { - for (int i = 0; i < elements.size(); i++) { - ElementBase element = elements.get(i); - if (element.isVisible()) { - element.drawForeground(mouseX, mouseY); - } - } - } else { - for (int i = 0; i < elements.size(); i++) { - ElementBase element = elements.get(i); - if (element.isVisible()) { - element.drawBackground(mouseX, mouseY, partialTick); - } - } - } - } - - /** - * Draws the tabs for this GUI. Handles Tab open/close animation. - */ - protected void drawTabs(float partialTick, boolean foreground) { - - int yPosRight = 4; - int yPosLeft = 4; - - if (foreground) { - for (int i = 0; i < tabs.size(); i++) { - TabBase tab = tabs.get(i); - tab.update(); - if (!tab.isVisible()) { - continue; - } - if (tab.side == TabBase.LEFT) { - tab.drawForeground(mouseX, mouseY); - yPosLeft += tab.currentHeight; - } else { - tab.drawForeground(mouseX, mouseY); - yPosRight += tab.currentHeight; - } - } - } else { - for (int i = 0; i < tabs.size(); i++) { - TabBase tab = tabs.get(i); - tab.update(); - if (!tab.isVisible()) { - continue; - } - if (tab.side == TabBase.LEFT) { - tab.setPosition(0, yPosLeft); - tab.drawBackground(mouseX, mouseY, partialTick); - yPosLeft += tab.currentHeight; - } else { - tab.setPosition(xSize, yPosRight); - tab.drawBackground(mouseX, mouseY, partialTick); - yPosRight += tab.currentHeight; - } - } - } - } - - /** - * Called by NEI if installed - */ - // @Override - public List handleTooltip(int mousex, int mousey, List tooltip) { - - if (mc.thePlayer.inventory.getItemStack() == null) { - addTooltips(tooltip); - } - return tooltip; - } - - public void addTooltips(List tooltip) { - - TabBase tab = getTabAtPosition(mouseX, mouseY); - - if (tab != null) { - tab.addTooltip(tooltip); - } - ElementBase element = getElementAtPosition(mouseX, mouseY); - - if (element != null && element.isVisible()) { - element.addTooltip(tooltip); - } - } - - /* ELEMENTS */ - public ElementBase addElement(ElementBase element) { - - elements.add(element); - return element; - } - - public TabBase addTab(TabBase tab) { - - int yOffset = 4; - for (int i = 0; i < tabs.size(); i++) { - if (tabs.get(i).side == tab.side && tabs.get(i).isVisible()) { - yOffset += tabs.get(i).currentHeight; - } - } - tab.setPosition(tab.side == TabBase.LEFT ? 0 : xSize, yOffset); - tabs.add(tab); - - if (TabTracker.getOpenedLeftTab() != null && tab.getClass().equals(TabTracker.getOpenedLeftTab())) { - tab.setFullyOpen(); - } else if (TabTracker.getOpenedRightTab() != null && tab.getClass().equals(TabTracker.getOpenedRightTab())) { - tab.setFullyOpen(); - } - return tab; - } - - protected ElementBase getElementAtPosition(int mX, int mY) { - - for (int i = elements.size(); i-- > 0; ) { - ElementBase element = elements.get(i); - if (element.intersectsWith(mX, mY)) { - return element; - } - } - return null; - } - - protected TabBase getTabAtPosition(int mX, int mY) { - - int xShift = 0; - int yShift = 4; - - for (int i = 0; i < tabs.size(); i++) { - TabBase tab = tabs.get(i); - if (!tab.isVisible() || tab.side == TabBase.RIGHT) { - continue; - } - tab.setCurrentShift(xShift, yShift); - if (tab.intersectsWith(mX, mY, xShift, yShift)) { - return tab; - } - yShift += tab.currentHeight; - } - - xShift = xSize; - yShift = 4; - - for (int i = 0; i < tabs.size(); i++) { - TabBase tab = tabs.get(i); - if (!tab.isVisible() || tab.side == TabBase.LEFT) { - continue; - } - tab.setCurrentShift(xShift, yShift); - if (tab.intersectsWith(mX, mY, xShift, yShift)) { - return tab; - } - yShift += tab.currentHeight; - } - return null; - } - - protected final void updateElements() { - - for (int i = elements.size(); i-- > 0; ) { - ElementBase c = elements.get(i); - if (c.isVisible() && c.isEnabled()) { - c.update(mouseX, mouseY); - } - } - } - - protected void updateElementInformation() { - - } - - public void handleElementButtonClick(String buttonName, int mouseButton) { - - } - - /* HELPERS */ - public void bindTexture(ResourceLocation texture) { - - mc.renderEngine.bindTexture(texture); - } - - /** - * Abstract method to retrieve icons by name from a registry. You must override this if you use any of the String methods below. - */ - public IIcon getIcon(String name) { - - return null; - } - - /** - * Essentially a placeholder method for tabs to use should they need to draw a button. - */ - public void drawButton(IIcon icon, int x, int y, int spriteSheet, int mode) { - - drawIcon(icon, x, y, spriteSheet); - } - - public void drawButton(String iconName, int x, int y, int spriteSheet, int mode) { - - drawButton(getIcon(iconName), x, y, spriteSheet, mode); - } - - /** - * Simple method used to draw a fluid of arbitrary size. - */ - public void drawFluid(int x, int y, FluidStack fluid, int width, int height) { - - if (fluid == null || fluid.getFluid() == null) { - return; - } - RenderHelper.setBlockTextureSheet(); - RenderHelper.setColor3ub(fluid.getFluid().getColor(fluid)); - - drawTiledTexture(x, y, fluid.getFluid().getIcon(fluid), width, height); - } - - public void drawTiledTexture(int x, int y, IIcon icon, int width, int height) { - - int i = 0; - int j = 0; - - int drawHeight = 0; - int drawWidth = 0; - - for (i = 0; i < width; i += 16) { - for (j = 0; j < height; j += 16) { - drawWidth = Math.min(width - i, 16); - drawHeight = Math.min(height - j, 16); - drawScaledTexturedModelRectFromIcon(x + i, y + j, icon, drawWidth, drawHeight); - } - } - GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0F); - } - - public void drawIcon(IIcon icon, int x, int y, int spriteSheet) { - - if (spriteSheet == 0) { - RenderHelper.setBlockTextureSheet(); - } else { - RenderHelper.setItemTextureSheet(); - } - GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0F); - drawTexturedModelRectFromIcon(x, y, icon, 16, 16); - } - - public void drawColorIcon(IIcon icon, int x, int y, int spriteSheet) { - - if (spriteSheet == 0) { - RenderHelper.setBlockTextureSheet(); - } else { - RenderHelper.setItemTextureSheet(); - } - drawTexturedModelRectFromIcon(x, y, icon, 16, 16); - } - - public void drawIcon(String iconName, int x, int y, int spriteSheet) { - - drawIcon(getIcon(iconName), x, y, spriteSheet); - } - - public void drawSizedModalRect(int x1, int y1, int x2, int y2, int color) { - - int temp; - - if (x1 < x2) { - temp = x1; - x1 = x2; - x2 = temp; - } - if (y1 < y2) { - temp = y1; - y1 = y2; - y2 = temp; - } - - float a = (color >> 24 & 255) / 255.0F; - float r = (color >> 16 & 255) / 255.0F; - float g = (color >> 8 & 255) / 255.0F; - float b = (color & 255) / 255.0F; - Tessellator tessellator = Tessellator.instance; - GL11.glEnable(GL11.GL_BLEND); - GL11.glDisable(GL11.GL_TEXTURE_2D); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - GL11.glColor4f(r, g, b, a); - tessellator.startDrawingQuads(); - tessellator.addVertex(x1, y2, this.zLevel); - tessellator.addVertex(x2, y2, this.zLevel); - tessellator.addVertex(x2, y1, this.zLevel); - tessellator.addVertex(x1, y1, this.zLevel); - tessellator.draw(); - GL11.glEnable(GL11.GL_TEXTURE_2D); - GL11.glDisable(GL11.GL_BLEND); - } - - public void drawSizedRect(int x1, int y1, int x2, int y2, int color) { - - int temp; - - if (x1 < x2) { - temp = x1; - x1 = x2; - x2 = temp; - } - if (y1 < y2) { - temp = y1; - y1 = y2; - y2 = temp; - } - - float a = (color >> 24 & 255) / 255.0F; - float r = (color >> 16 & 255) / 255.0F; - float g = (color >> 8 & 255) / 255.0F; - float b = (color & 255) / 255.0F; - Tessellator tessellator = Tessellator.instance; - GL11.glDisable(GL11.GL_TEXTURE_2D); - GL11.glColor4f(r, g, b, a); - tessellator.startDrawingQuads(); - tessellator.addVertex(x1, y2, this.zLevel); - tessellator.addVertex(x2, y2, this.zLevel); - tessellator.addVertex(x2, y1, this.zLevel); - tessellator.addVertex(x1, y1, this.zLevel); - tessellator.draw(); - GL11.glEnable(GL11.GL_TEXTURE_2D); - } - - public void drawSizedTexturedModalRect(int x, int y, int u, int v, int width, int height, float texW, float texH) { - - float texU = 1 / texW; - float texV = 1 / texH; - Tessellator tessellator = Tessellator.instance; - tessellator.startDrawingQuads(); - tessellator.addVertexWithUV(x + 0, y + height, this.zLevel, (u + 0) * texU, (v + height) * texV); - tessellator.addVertexWithUV(x + width, y + height, this.zLevel, (u + width) * texU, (v + height) * texV); - tessellator.addVertexWithUV(x + width, y + 0, this.zLevel, (u + width) * texU, (v + 0) * texV); - tessellator.addVertexWithUV(x + 0, y + 0, this.zLevel, (u + 0) * texU, (v + 0) * texV); - tessellator.draw(); - } - - public void drawScaledTexturedModelRectFromIcon(int x, int y, IIcon icon, int width, int height) { - - if (icon == null) { - return; - } - double minU = icon.getMinU(); - double maxU = icon.getMaxU(); - double minV = icon.getMinV(); - double maxV = icon.getMaxV(); - - Tessellator tessellator = Tessellator.instance; - tessellator.startDrawingQuads(); - tessellator.addVertexWithUV(x + 0, y + height, this.zLevel, minU, minV + (maxV - minV) * height / 16F); - tessellator.addVertexWithUV(x + width, y + height, this.zLevel, minU + (maxU - minU) * width / 16F, minV + (maxV - minV) * height / 16F); - tessellator.addVertexWithUV(x + width, y + 0, this.zLevel, minU + (maxU - minU) * width / 16F, minV); - tessellator.addVertexWithUV(x + 0, y + 0, this.zLevel, minU, minV); - tessellator.draw(); - } - - public void drawTooltip(List list) { - - drawTooltipHoveringText(list, mouseX + guiLeft, mouseY + guiTop, fontRendererObj); - tooltip.clear(); - } - - @SuppressWarnings("rawtypes") - protected void drawTooltipHoveringText(List list, int x, int y, FontRenderer font) { - - if (list == null || list.isEmpty()) { - return; - } - GL11.glDisable(GL12.GL_RESCALE_NORMAL); - GL11.glDisable(GL11.GL_LIGHTING); - GL11.glDisable(GL11.GL_DEPTH_TEST); - int k = 0; - Iterator iterator = list.iterator(); - - while (iterator.hasNext()) { - String s = (String) iterator.next(); - int l = font.getStringWidth(s); - - if (l > k) { - k = l; - } - } - int i1 = x + 12; - int j1 = y - 12; - int k1 = 8; - - if (list.size() > 1) { - k1 += 2 + (list.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; - this.drawGradientRect(i1 - 3, j1 - 4, i1 + k + 3, j1 - 3, l1, l1); - this.drawGradientRect(i1 - 3, j1 + k1 + 3, i1 + k + 3, j1 + k1 + 4, l1, l1); - this.drawGradientRect(i1 - 3, j1 - 3, i1 + k + 3, j1 + k1 + 3, l1, l1); - this.drawGradientRect(i1 - 4, j1 - 3, i1 - 3, j1 + k1 + 3, l1, l1); - this.drawGradientRect(i1 + k + 3, j1 - 3, i1 + k + 4, j1 + k1 + 3, l1, l1); - int i2 = 1347420415; - int j2 = (i2 & 16711422) >> 1 | i2 & -16777216; - this.drawGradientRect(i1 - 3, j1 - 3 + 1, i1 - 3 + 1, j1 + k1 + 3 - 1, i2, j2); - this.drawGradientRect(i1 + k + 2, j1 - 3 + 1, i1 + k + 3, j1 + k1 + 3 - 1, i2, j2); - this.drawGradientRect(i1 - 3, j1 - 3, i1 + k + 3, j1 - 3 + 1, i2, i2); - this.drawGradientRect(i1 - 3, j1 + k1 + 2, i1 + k + 3, j1 + k1 + 3, j2, j2); - - for (int k2 = 0; k2 < list.size(); ++k2) { - String s1 = (String) list.get(k2); - font.drawStringWithShadow(s1, i1, j1, -1); - - if (k2 == 0) { - j1 += 2; - } - j1 += 10; - } - this.zLevel = 0.0F; - itemRender.zLevel = 0.0F; - GL11.glEnable(GL11.GL_LIGHTING); - GL11.glEnable(GL11.GL_DEPTH_TEST); - GL11.glEnable(GL12.GL_RESCALE_NORMAL); - } - - /** - * Passthrough method for tab use. - */ - public void mouseClicked(int mouseButton) { - - super.mouseClicked(guiLeft + mouseX, guiTop + mouseY, mouseButton); - } - - public FontRenderer getFontRenderer() { - - return fontRendererObj; - } - - protected int getCenteredOffset(String string) { - - return this.getCenteredOffset(string, xSize); - } - - protected int getCenteredOffset(String string, int xWidth) { - - return (xWidth - fontRendererObj.getStringWidth(string)) / 2; - } - - public int getGuiLeft() { - - return guiLeft; - } - - public int getGuiTop() { - - return guiTop; - } - - public int getMouseX() { - - return mouseX; - } - - public int getMouseY() { - - return mouseY; - } - - public void overlayRecipe() { - - } - -} \ No newline at end of file diff --git a/src/main/java/techreborn/cofhLib/gui/GuiBook.java b/src/main/java/techreborn/cofhLib/gui/GuiBook.java deleted file mode 100755 index 48e5141e7..000000000 --- a/src/main/java/techreborn/cofhLib/gui/GuiBook.java +++ /dev/null @@ -1,10 +0,0 @@ -package techreborn.cofhLib.gui; - -import net.minecraft.client.gui.GuiScreen; - -public class GuiBook extends GuiScreen { - - protected int mouseX = 0; - protected int mouseY = 0; - -} diff --git a/src/main/java/techreborn/cofhLib/gui/GuiColor.java b/src/main/java/techreborn/cofhLib/gui/GuiColor.java deleted file mode 100755 index ab9815b49..000000000 --- a/src/main/java/techreborn/cofhLib/gui/GuiColor.java +++ /dev/null @@ -1,107 +0,0 @@ -package techreborn.cofhLib.gui; - -public class GuiColor extends Number { - - private static final long serialVersionUID = 7024827242888861187L; - private final int _color; - - public GuiColor(int argb) { - - _color = argb; - } - - public GuiColor(int rgba, Void dummy) { - - this(rgba >>> 24, rgba >> 16, rgba >> 8, rgba); - } - - public GuiColor(byte alpha, int argb) { - - this(argb >> 16, argb >> 8, argb, alpha); - } - - public GuiColor(int rgba, byte alpha) { - - this(rgba >>> 24, rgba >> 16, rgba >> 8, alpha); - } - - public GuiColor(int r, int g, int b) { - - this(r, g, b, 255); - } - - public GuiColor(int r, int g, int b, int a) { - - _color = (b & 0xFF) | (g & 0xFF) << 8 | (r & 0xFF) << 16 | (a & 0xFF) << 24; - } - - public int getColor() { - - return _color; - } - - public int getIntR() { - - return (_color >> 16) & 0xFF; - } - - public int getIntG() { - - return (_color >> 8) & 0xFF; - } - - public int getIntB() { - - return (_color >> 0) & 0xFF; - } - - public int getIntA() { - - return (_color >> 24) & 0xFF; - } - - public float getFloatR() { - - return getIntR() / 255f; - } - - public float getFloatG() { - - return getIntG() / 255f; - } - - public float getFloatB() { - - return getIntB() / 255f; - } - - public float getFloatA() { - - return getIntA() / 255f; - } - - @Override - public int intValue() { - - return getColor(); - } - - @Override - public long longValue() { - - return getColor(); - } - - @Override - public float floatValue() { - - return getColor(); - } - - @Override - public double doubleValue() { - - return getColor(); - } - -} diff --git a/src/main/java/techreborn/cofhLib/gui/GuiProps.java b/src/main/java/techreborn/cofhLib/gui/GuiProps.java deleted file mode 100755 index a9fcc589c..000000000 --- a/src/main/java/techreborn/cofhLib/gui/GuiProps.java +++ /dev/null @@ -1,18 +0,0 @@ -package techreborn.cofhLib.gui; - -import techreborn.lib.ModInfo; - -public class GuiProps { - - - public static final String RESOURCE_PREFIX = ModInfo.MOD_ID + ":"; - - /* GUI */ - public static final String PATH_GFX = RESOURCE_PREFIX + "textures/"; - public static final String PATH_ARMOR = PATH_GFX + "armor/"; - public static final String PATH_GUI = PATH_GFX + "gui/"; - public static final String PATH_RENDER = PATH_GFX + "blocks/"; - public static final String PATH_ELEMENTS = PATH_GUI + "elements/"; - public static final String PATH_ICON = PATH_GUI + "icons/"; - -} diff --git a/src/main/java/techreborn/cofhLib/gui/TabTracker.java b/src/main/java/techreborn/cofhLib/gui/TabTracker.java deleted file mode 100755 index a272ab063..000000000 --- a/src/main/java/techreborn/cofhLib/gui/TabTracker.java +++ /dev/null @@ -1,35 +0,0 @@ -package techreborn.cofhLib.gui; - -import techreborn.cofhLib.gui.element.TabBase; - -/** - * Keeps track of which tabs should be open by default when a player opens a GUI. - * - * @author King Lemming - */ -public class TabTracker { - - private static Class openedLeftTab; - private static Class openedRightTab; - - public static Class getOpenedLeftTab() { - - return openedLeftTab; - } - - public static Class getOpenedRightTab() { - - return openedRightTab; - } - - public static void setOpenedLeftTab(Class tabClass) { - - openedLeftTab = tabClass; - } - - public static void setOpenedRightTab(Class tabClass) { - - openedRightTab = tabClass; - } - -} diff --git a/src/main/java/techreborn/cofhLib/gui/element/ElementBase.java b/src/main/java/techreborn/cofhLib/gui/element/ElementBase.java deleted file mode 100755 index 56c9b20b0..000000000 --- a/src/main/java/techreborn/cofhLib/gui/element/ElementBase.java +++ /dev/null @@ -1,226 +0,0 @@ -package techreborn.cofhLib.gui.element; - -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.util.ResourceLocation; -import org.lwjgl.opengl.GL11; -import techreborn.cofhLib.gui.GuiBase; - -import java.util.List; - -/** - * Base class for a modular GUI element. Has self-contained rendering methods and a link back to the {@link techreborn.cofhLib.gui.GuiBase} it is a part of. - * - * @author King Lemming - */ -public abstract class ElementBase { - - public GuiBase gui; - protected ResourceLocation texture; - - protected int posX; - protected int posY; - - protected int sizeX; - protected int sizeY; - - protected int texW = 256; - protected int texH = 256; - - protected String name; - - private boolean visible = true; - private boolean enabled = true; - - public ElementBase(GuiBase gui, int posX, int posY) { - - this.gui = gui; - this.posX = posX; - this.posY = posY; - } - - public ElementBase(GuiBase gui, int posX, int posY, int width, int height) { - - this.gui = gui; - this.posX = posX; - this.posY = posY; - this.sizeX = width; - this.sizeY = height; - } - - public ElementBase setName(String name) { - - this.name = name; - return this; - } - - public ElementBase setPosition(int posX, int posY) { - - this.posX = posX; - this.posY = posY; - return this; - } - - public ElementBase setSize(int sizeX, int sizeY) { - - this.sizeX = sizeX; - this.sizeY = sizeY; - return this; - } - - public ElementBase setTexture(String texture, int texW, int texH) { - - this.texture = new ResourceLocation(texture); - this.texW = texW; - this.texH = texH; - return this; - } - - public ElementBase setTexture(ResourceLocation texture, int texW, int texH) { - - this.texture = texture; - this.texW = texW; - this.texH = texH; - return this; - } - - public final ElementBase setVisible(boolean visible) { - - this.visible = visible; - return this; - } - - public boolean isVisible() { - - return visible; - } - - public final ElementBase setEnabled(boolean enabled) { - - this.enabled = enabled; - return this; - } - - public boolean isEnabled() { - - return enabled; - } - - public void update(int mouseX, int mouseY) { - - update(); - } - - public void update() { - - } - - public abstract void drawBackground(int mouseX, int mouseY, float gameTicks); - - public abstract void drawForeground(int mouseX, int mouseY); - - public void addTooltip(List list) { - - } - - public void drawModalRect(int x, int y, int width, int height, int color) { - - gui.drawSizedModalRect(x, y, width, height, color); - } - - public void drawStencil(int xStart, int yStart, int xEnd, int yEnd, int flag) { - GL11.glDisable(GL11.GL_TEXTURE_2D); - GL11.glStencilFunc(GL11.GL_ALWAYS, flag, flag); - GL11.glStencilOp(GL11.GL_KEEP, GL11.GL_KEEP, GL11.GL_REPLACE); - GL11.glStencilMask(1); - GL11.glColorMask(false, false, false, false); - GL11.glDepthMask(false); - Tessellator.instance.startDrawingQuads(); - Tessellator.instance.addVertex(xStart, yEnd, 0); - Tessellator.instance.addVertex(xEnd, yEnd, 0); - Tessellator.instance.addVertex(xEnd, yStart, 0); - Tessellator.instance.addVertex(xStart, yStart, 0); - Tessellator.instance.draw(); - GL11.glEnable(GL11.GL_TEXTURE_2D); - GL11.glStencilFunc(GL11.GL_EQUAL, flag, flag); - GL11.glStencilMask(0); - GL11.glColorMask(true, true, true, true); - GL11.glDepthMask(true); - } - - public void drawTexturedModalRect(int x, int y, int u, int v, int width, int height) { - - gui.drawSizedTexturedModalRect(x, y, u, v, width, height, texW, texH); - } - - public void drawCenteredString(FontRenderer fontRenderer, String text, int x, int y, int color) { - - fontRenderer.drawStringWithShadow(text, x - fontRenderer.getStringWidth(text) / 2, y, color); - } - - public boolean onMousePressed(int mouseX, int mouseY, int mouseButton) { - - return false; - } - - public void onMouseReleased(int mouseX, int mouseY) { - - } - - public boolean onMouseWheel(int mouseX, int mouseY, int movement) { - - return false; - } - - public boolean onKeyTyped(char characterTyped, int keyPressed) { - - return false; - } - - public boolean intersectsWith(int mouseX, int mouseY) { - - return mouseX >= this.posX && mouseX <= this.posX + this.sizeX && mouseY >= this.posY && mouseY <= this.posY + this.sizeY; - } - - public final String getName() { - - return name; - } - - public final GuiBase getContainerScreen() { - - return gui; - } - - public final FontRenderer getFontRenderer() { - - return gui.getFontRenderer(); - } - - /** - * This method is relative to the GUI's y coordinate - */ - public final int getPosY() { - - return posY; - } - - /** - * This method is relative to the GUI's x coordinate - */ - public final int getPosX() { - - return posX; - } - - public final int getHeight() { - - return sizeY; - } - - public final int getWidth() { - - return sizeX; - } - -} diff --git a/src/main/java/techreborn/cofhLib/gui/element/ElementButton.java b/src/main/java/techreborn/cofhLib/gui/element/ElementButton.java deleted file mode 100755 index 6fa164f89..000000000 --- a/src/main/java/techreborn/cofhLib/gui/element/ElementButton.java +++ /dev/null @@ -1,164 +0,0 @@ -package techreborn.cofhLib.gui.element; - -import com.pahimar.ee3.util.ResourceLocationHelper; -import net.minecraft.util.ResourceLocation; -import techreborn.cofhLib.render.RenderHelper; -import techreborn.cofhLib.util.helpers.StringHelper; - -import java.util.List; - -public class ElementButton extends ElementBase { - - int sheetX; - int sheetY; - int hoverX; - int hoverY; - int disabledX = 0; - int disabledY = 0; - boolean tooltipLocalized = false; - String tooltip; - - public ElementButton(techreborn.cofhLib.gui.GuiBase gui, int posX, int posY, String name, int sheetX, int sheetY, int hoverX, int hoverY, int sizeX, int sizeY, String texture) { - this(gui, posX, posY, name, sheetX, sheetY, hoverX, hoverY, sizeX, sizeY, 256, 256, texture); - } - - public ElementButton(techreborn.cofhLib.gui.GuiBase gui, int posX, int posY, String name, int sheetX, int sheetY, int hoverX, int hoverY, int sizeX, int sizeY, ResourceLocation texture) { - this(gui, posX, posY, name, sheetX, sheetY, hoverX, hoverY, sizeX, sizeY, 256, 256, texture); - } - - public ElementButton(techreborn.cofhLib.gui.GuiBase gui, int posX, int posY, String name, int sheetX, int sheetY, int hoverX, int hoverY, int sizeX, int sizeY, int texW, int texH, String texture) { - this(gui, posX, posY, name, sheetX, sheetY, hoverX, hoverY, sizeX, sizeY, texW, texH, ResourceLocationHelper.getResourceLocation(texture)); - } - - public ElementButton(techreborn.cofhLib.gui.GuiBase gui, int posX, int posY, String name, int sheetX, int sheetY, int hoverX, int hoverY, int sizeX, int sizeY, int texW, int texH, ResourceLocation texture) { - super(gui, posX, posY); - setName(name); - setSize(sizeX, sizeY); - setTexture(texture, texW, texH); - this.sheetX = sheetX; - this.sheetY = sheetY; - this.hoverX = hoverX; - this.hoverY = hoverY; - } - - public ElementButton(techreborn.cofhLib.gui.GuiBase gui, int posX, int posY, String name, int sheetX, int sheetY, int hoverX, int hoverY, int disabledX, int disabledY, int sizeX, int sizeY, int texW, int texH, String texture) { - this(gui, posX, posY, name, sheetX, sheetY, hoverX, hoverY, disabledX, disabledY, sizeX, sizeY, texW, texH, ResourceLocationHelper.getResourceLocation(texture)); - } - - public ElementButton(techreborn.cofhLib.gui.GuiBase gui, int posX, int posY, String name, int sheetX, int sheetY, int hoverX, int hoverY, int disabledX, int disabledY, int sizeX, int sizeY, int texW, int texH, ResourceLocation texture) { - super(gui, posX, posY); - setName(name); - setSize(sizeX, sizeY); - setTexture(texture, texW, texH); - this.sheetX = sheetX; - this.sheetY = sheetY; - this.hoverX = hoverX; - this.hoverY = hoverY; - this.disabledX = disabledX; - this.disabledY = disabledY; - } - - public ElementButton clearToolTip() { - - this.tooltip = null; - return this; - } - - public ElementButton setToolTip(String tooltip) { - - this.tooltip = tooltip; - return this; - } - - public ElementButton setToolTipLocalized(boolean localized) { - - this.tooltipLocalized = localized; - return this; - } - - @Override - public void drawBackground(int mouseX, int mouseY, float gameTicks) { - - RenderHelper.bindTexture(texture); - if (isEnabled()) { - if (intersectsWith(mouseX, mouseY)) { - - drawTexturedModalRect(posX, posY, hoverX, hoverY, sizeX, sizeY); - } else { - drawTexturedModalRect(posX, posY, sheetX, sheetY, sizeX, sizeY); - } - } else { - drawTexturedModalRect(posX, posY, disabledX, disabledY, sizeX, sizeY); - } - } - - @Override - public void drawForeground(int mouseX, int mouseY) { - - } - - @Override - public void addTooltip(List list) { - - if (tooltip != null) { - if (tooltipLocalized) { - list.add(tooltip); - } else { - list.add(StringHelper.localize(tooltip)); - } - } - } - - @Override - public boolean onMousePressed(int x, int y, int mouseButton) { - - if (isEnabled()) { - gui.handleElementButtonClick(getName(), mouseButton); - return true; - } - return false; - } - - public void setSheetX(int pos) { - - sheetX = pos; - } - - public void setSheetY(int pos) { - - sheetY = pos; - } - - public void setHoverX(int pos) { - - hoverX = pos; - } - - public void setHoverY(int pos) { - - hoverY = pos; - } - - public ElementButton setDisabledX(int pos) { - - disabledX = pos; - return this; - } - - public ElementButton setDisabledY(int pos) { - - disabledY = pos; - return this; - } - - public void setActive() { - - setEnabled(true); - } - - public void setDisabled() { - - setEnabled(false); - } - -} diff --git a/src/main/java/techreborn/cofhLib/gui/element/ElementButtonManaged.java b/src/main/java/techreborn/cofhLib/gui/element/ElementButtonManaged.java deleted file mode 100755 index 9ba89643d..000000000 --- a/src/main/java/techreborn/cofhLib/gui/element/ElementButtonManaged.java +++ /dev/null @@ -1,77 +0,0 @@ -package techreborn.cofhLib.gui.element; - -import net.minecraft.util.ResourceLocation; -import org.lwjgl.opengl.GL11; -import techreborn.cofhLib.gui.GuiProps; - -public abstract class ElementButtonManaged extends ElementBase { - - public static final ResourceLocation HOVER = new ResourceLocation(GuiProps.PATH_ELEMENTS + "Button_Hover.png"); - public static final ResourceLocation ENABLED = new ResourceLocation(GuiProps.PATH_ELEMENTS + "Button_Enabled.png"); - public static final ResourceLocation DISABLED = new ResourceLocation(GuiProps.PATH_ELEMENTS + "Button_Disabled.png"); - private String _text; - - public ElementButtonManaged(techreborn.cofhLib.gui.GuiBase containerScreen, int posX, int posY, int sizeX, int sizeY, String text) { - super(containerScreen, posX, posY, sizeX, sizeY); - _text = text; - } - - public void setText(String text) { - _text = text; - } - - @Override - public void drawBackground(int mouseX, int mouseY, float gameTicks) { - if (!isEnabled()) { - gui.bindTexture(DISABLED); - } else if (intersectsWith(mouseX, mouseY)) { - gui.bindTexture(HOVER); - } else { - gui.bindTexture(ENABLED); - } - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - drawTexturedModalRect(posX, posY, 0, 0, sizeX / 2, sizeY / 2); - drawTexturedModalRect(posX, posY + sizeY / 2, 0, 256 - sizeY / 2, sizeX / 2, sizeY / 2); - drawTexturedModalRect(posX + sizeX / 2, posY, 256 - sizeX / 2, 0, sizeX / 2, sizeY / 2); - drawTexturedModalRect(posX + sizeX / 2, posY + sizeY / 2, 256 - sizeX / 2, 256 - sizeY / 2, sizeX / 2, sizeY / 2); - } - - @Override - public void drawForeground(int mouseX, int mouseY) { - String text = getFontRenderer().trimStringToWidth(_text, sizeX - 4); - drawCenteredString(getFontRenderer(), text, posX + sizeX / 2, posY + (sizeY - 8) / 2, getTextColor(mouseX, mouseY)); - } - - protected int getTextColor(int mouseX, int mouseY) { - if (!isEnabled()) { - return -6250336; - } else if (intersectsWith(mouseX, mouseY)) { - return 16777120; - } else { - return 14737632; - } - } - - @Override - public boolean onMousePressed(int mouseX, int mouseY, int mouseButton) { - techreborn.cofhLib.gui.GuiBase.playSound("random.click", 1.0F, 1.0F); - if (mouseButton == 0) { - onClick(); - } else if (mouseButton == 1) { - onRightClick(); - } else if (mouseButton == 2) { - onMiddleClick(); - } - return true; - } - - public abstract void onClick(); - - public void onRightClick() { - - } - - public void onMiddleClick() { - - } -} diff --git a/src/main/java/techreborn/cofhLib/gui/element/ElementButtonOption.java b/src/main/java/techreborn/cofhLib/gui/element/ElementButtonOption.java deleted file mode 100755 index 9a5d80cc3..000000000 --- a/src/main/java/techreborn/cofhLib/gui/element/ElementButtonOption.java +++ /dev/null @@ -1,71 +0,0 @@ -package techreborn.cofhLib.gui.element; - -import java.util.HashMap; -import java.util.Map; - -public abstract class ElementButtonOption extends ElementButtonManaged { - - private final Map _values = new HashMap(); - private int _currentValue = 0; - private int _maxValue; - - public ElementButtonOption(techreborn.cofhLib.gui.GuiBase containerScreen, int x, int y, int width, int height) { - - super(containerScreen, x, y, width, height, ""); - } - - public void setValue(int value, String label) { - - _values.put(value, label); - if (value > _maxValue) { - _maxValue = value; - } - } - - @Override - public void onClick() { - - int nextValue = _currentValue; - do { - nextValue++; - if (nextValue > _maxValue) { - nextValue = 0; - } - } while (_values.get(nextValue) == null); - setSelectedIndex(nextValue); - } - - @Override - public void onRightClick() { - - int nextValue = _currentValue; - - do { - nextValue--; - if (nextValue < 0) { - nextValue = _maxValue; - } - } while (_values.get(nextValue) == null); - setSelectedIndex(nextValue); - } - - public int getSelectedIndex() { - - return _currentValue; - } - - public void setSelectedIndex(int index) { - - _currentValue = index; - setText(_values.get(_currentValue)); - onValueChanged(_currentValue, _values.get(_currentValue)); - } - - public String getValue() { - - return _values.get(_currentValue); - } - - public abstract void onValueChanged(int value, String label); - -} diff --git a/src/main/java/techreborn/cofhLib/gui/element/ElementDualScaled.java b/src/main/java/techreborn/cofhLib/gui/element/ElementDualScaled.java deleted file mode 100755 index 9a57f0ff0..000000000 --- a/src/main/java/techreborn/cofhLib/gui/element/ElementDualScaled.java +++ /dev/null @@ -1,62 +0,0 @@ -package techreborn.cofhLib.gui.element; - -import techreborn.cofhLib.render.RenderHelper; - -public class ElementDualScaled extends ElementBase { - - public int quantity; - public int mode; - public boolean background = true; - - public ElementDualScaled(techreborn.cofhLib.gui.GuiBase gui, int posX, int posY) { - - super(gui, posX, posY); - } - - public ElementDualScaled setBackground(boolean background) { - - this.background = background; - return this; - } - - public ElementDualScaled setMode(int mode) { - - this.mode = mode; - return this; - } - - public ElementDualScaled setQuantity(int quantity) { - - this.quantity = quantity; - return this; - } - - @Override - public void drawBackground(int mouseX, int mouseY, float gameTicks) { - - RenderHelper.bindTexture(texture); - - if (background) { - drawTexturedModalRect(posX, posY, 0, 0, sizeX, sizeY); - } - switch (mode) { - case 0: - // vertical bottom -> top - drawTexturedModalRect(posX, posY + sizeY - quantity, sizeX, sizeY - quantity, sizeX, quantity); - return; - case 1: - // horizontal left -> right - drawTexturedModalRect(posX, posY, sizeX, 0, quantity, sizeY); - return; - case 2: - // horizontal right -> left - drawTexturedModalRect(posX + sizeX - quantity, posY, sizeX + sizeX - quantity, 0, quantity, sizeY); - } - } - - @Override - public void drawForeground(int mouseX, int mouseY) { - - } - -} diff --git a/src/main/java/techreborn/cofhLib/gui/element/ElementListBox.java b/src/main/java/techreborn/cofhLib/gui/element/ElementListBox.java deleted file mode 100755 index 33ab5bfe2..000000000 --- a/src/main/java/techreborn/cofhLib/gui/element/ElementListBox.java +++ /dev/null @@ -1,340 +0,0 @@ -package techreborn.cofhLib.gui.element; - -import techreborn.cofhLib.gui.GuiBase; -import techreborn.cofhLib.gui.GuiColor; -import techreborn.cofhLib.gui.element.listbox.IListBoxElement; -import techreborn.cofhLib.util.helpers.StringHelper; - -import java.util.Collection; -import java.util.LinkedList; -import java.util.List; - -import static org.lwjgl.opengl.GL11.*; - -public class ElementListBox extends ElementBase { - - public int borderColor = new GuiColor(120, 120, 120, 255).getColor(); - public int backgroundColor = new GuiColor(0, 0, 0, 255).getColor(); - public int selectedLineColor = new GuiColor(0, 0, 0, 255).getColor(); - public int textColor = new GuiColor(150, 150, 150, 255).getColor(); - public int selectedTextColor = new GuiColor(255, 255, 255, 255).getColor(); - - private final int _marginTop = 2; - private final int _marginLeft = 2; - private final int _marginRight = 2; - private final int _marginBottom = 2; - - public List _elements = new LinkedList(); - - private int _firstIndexDisplayed; - private int _selectedIndex; - private int scrollHoriz; - - public ElementListBox(GuiBase containerScreen, int x, int y, int width, int height) { - - super(containerScreen, x, y, width, height); - } - - public void add(IListBoxElement element) { - - _elements.add(element); - } - - public void add(Collection elements) { - - _elements.addAll(elements); - } - - public void remove(IListBoxElement element) { - - _elements.remove(element); - } - - public void removeAt(int index) { - - _elements.remove(index); - } - - public void removeAll() { - - _elements.clear(); - } - - public int getInternalWidth() { - - int width = 0; - for (int i = 0; i < _elements.size(); i++) { - width = Math.max(_elements.get(i).getWidth(), width); - } - return width; - } - - public int getInternalHeight() { - - int height = 0; - for (int i = 0; i < _elements.size(); i++) { - height += _elements.get(i).getHeight(); - } - return height; - } - - public int getContentWidth() { - - return sizeX - _marginLeft - _marginRight; - } - - public int getContentHeight() { - - return sizeY - _marginTop - _marginBottom; - } - - public int getContentTop() { - - return posY + _marginTop; - } - - public int getContentLeft() { - - return posX + _marginLeft; - } - - public final int getContentBottom() { - - return getContentTop() + getContentHeight(); - } - - public final int getContentRight() { - - return getContentLeft() + getContentWidth(); - } - - public ElementListBox setTextColor(Number textColor, Number selectedTextColor) { - - if (textColor != null) { - this.textColor = textColor.intValue(); - } - if (selectedTextColor != null) { - this.selectedTextColor = selectedTextColor.intValue(); - } - return this; - } - - public ElementListBox setSelectionColor(Number selectedLineColor) { - - if (selectedLineColor != null) { - this.selectedLineColor = selectedLineColor.intValue(); - } - return this; - } - - public ElementListBox setBackgroundColor(Number backgroundColor, Number borderColor) { - - if (backgroundColor != null) { - this.backgroundColor = backgroundColor.intValue(); - } - if (borderColor != null) { - this.borderColor = borderColor.intValue(); - } - return this; - } - - @Override - public void drawBackground(int mouseX, int mouseY, float gameTicks) { - - drawModalRect(posX - 1, posY - 1, posX + sizeX + 1, posY + sizeY + 1, borderColor); - drawModalRect(posX, posY, posX + sizeX, posY + sizeY, backgroundColor); - } - - @Override - public void drawForeground(int mouseX, int mouseY) { - - int heightDrawn = 0; - int nextElement = _firstIndexDisplayed; - - glPushMatrix(); - //glDisable(GL_LIGHTING); - - //glEnable(GL_STENCIL_TEST); - //glClear(GL_STENCIL_BUFFER_BIT); - //drawStencil(getContentLeft(), getContentTop(), getContentRight(), getContentBottom(), 1); - - glTranslated(-scrollHoriz, 0, 0); - - int e = _elements.size(); - while (nextElement < e && heightDrawn <= getContentHeight()) { - if (nextElement == _selectedIndex) { - _elements.get(nextElement).draw(this, getContentLeft(), getContentTop() + heightDrawn, selectedLineColor, selectedTextColor); - } else { - _elements.get(nextElement).draw(this, getContentLeft(), getContentTop() + heightDrawn, backgroundColor, textColor); - } - heightDrawn += _elements.get(nextElement).getHeight(); - nextElement++; - } - //glDisable(GL_STENCIL_TEST); - glPopMatrix(); - } - - @Override - public boolean onMousePressed(int mouseX, int mouseY, int mouseButton) { - - int heightChecked = 0; - for (int i = _firstIndexDisplayed; i < _elements.size(); i++) { - if (heightChecked > getContentHeight()) { - break; - } - int elementHeight = _elements.get(i).getHeight(); - if (getContentTop() + heightChecked <= mouseY && getContentTop() + heightChecked + elementHeight >= mouseY) { - setSelectedIndex(i); - onElementClicked(_elements.get(i)); - break; - } - heightChecked += elementHeight; - } - return true; - } - - @Override - public boolean onMouseWheel(int mouseX, int mouseY, int movement) { - - if (StringHelper.isControlKeyDown()) { - if (movement > 0) { - scrollLeft(); - } else if (movement < 0) { - scrollRight(); - } - } else { - if (movement > 0) { - scrollUp(); - } else if (movement < 0) { - scrollDown(); - } - } - return true; - } - - public void scrollDown() { - - int heightDisplayed = 0; - int elementsDisplayed = 0; - for (int i = _firstIndexDisplayed; i < _elements.size(); i++) { - if (heightDisplayed + _elements.get(i).getHeight() > sizeY) { - break; - } - heightDisplayed += _elements.get(i).getHeight(); - elementsDisplayed++; - } - if (_firstIndexDisplayed + elementsDisplayed < _elements.size()) { - _firstIndexDisplayed++; - } - onScrollV(_firstIndexDisplayed); - } - - public void scrollUp() { - - if (_firstIndexDisplayed > 0) { - _firstIndexDisplayed--; - } - onScrollV(_firstIndexDisplayed); - } - - public void scrollLeft() { - - scrollHoriz = Math.max(scrollHoriz - 15, 0); - onScrollH(scrollHoriz); - } - - public void scrollRight() { - - scrollHoriz = Math.min(scrollHoriz + 15, getLastScrollPositionH()); - onScrollH(scrollHoriz); - } - - public int getLastScrollPosition() { - - int position = _elements.size() - 1; - int heightUsed = _elements.get(position).getHeight(); - - while (position > 0 && heightUsed < sizeY) { - position--; - heightUsed += _elements.get(position).getHeight(); - } - return position + 1; - } - - public int getLastScrollPositionH() { - - return Math.max(getInternalWidth() - getContentWidth(), 0); - } - - public int getSelectedIndex() { - - return _selectedIndex; - } - - public int getIndexOf(Object value) { - - for (int i = 0; i < _elements.size(); i++) { - if (_elements.get(i).getValue().equals(value)) { - return i; - } - } - return -1; - } - - public IListBoxElement getSelectedElement() { - - if (_selectedIndex == -1 || _selectedIndex == _elements.size()) { - return null; - } - return _elements.get(_selectedIndex); - } - - public void setSelectedIndex(int index) { - - if (index >= -1 && index != _selectedIndex && index < _elements.size()) { - _selectedIndex = index; - onSelectionChanged(_selectedIndex, getSelectedElement()); - } - } - - public IListBoxElement getElement(int index) { - - return _elements.get(index); - } - - public int getElementCount() { - - return _elements.size(); - } - - public void scrollToV(int index) { - - if (index >= 0 && index < _elements.size()) { - _firstIndexDisplayed = index; - } - } - - public void scrollToH(int index) { - - if (index >= 0 && index <= getLastScrollPositionH()) { - scrollHoriz = index; - } - } - - protected void onElementClicked(IListBoxElement element) { - - } - - protected void onScrollV(int newStartIndex) { - - } - - protected void onScrollH(int newStartIndex) { - - } - - protected void onSelectionChanged(int newIndex, IListBoxElement newElement) { - - } - -} \ No newline at end of file diff --git a/src/main/java/techreborn/cofhLib/gui/element/ElementSimple.java b/src/main/java/techreborn/cofhLib/gui/element/ElementSimple.java deleted file mode 100755 index c51ef571b..000000000 --- a/src/main/java/techreborn/cofhLib/gui/element/ElementSimple.java +++ /dev/null @@ -1,40 +0,0 @@ -package techreborn.cofhLib.gui.element; - -import techreborn.cofhLib.render.RenderHelper; - -/** - * Basic element which can render an arbitrary texture. - * - * @author King Lemming - */ -public class ElementSimple extends ElementBase { - - int texU = 0; - int texV = 0; - - public ElementSimple(techreborn.cofhLib.gui.GuiBase gui, int posX, int posY) { - - super(gui, posX, posY); - } - - public ElementSimple setTextureOffsets(int u, int v) { - - texU = u; - texV = v; - return this; - } - - @Override - public void drawBackground(int mouseX, int mouseY, float gameTicks) { - - RenderHelper.bindTexture(texture); - drawTexturedModalRect(posX, posY, texU, texV, sizeX, sizeY); - } - - @Override - public void drawForeground(int mouseX, int mouseY) { - - return; - } - -} diff --git a/src/main/java/techreborn/cofhLib/gui/element/ElementSlider.java b/src/main/java/techreborn/cofhLib/gui/element/ElementSlider.java deleted file mode 100755 index b54c41760..000000000 --- a/src/main/java/techreborn/cofhLib/gui/element/ElementSlider.java +++ /dev/null @@ -1,186 +0,0 @@ -package techreborn.cofhLib.gui.element; - -import com.pahimar.ee3.reference.Textures; -import net.minecraft.util.ResourceLocation; -import org.lwjgl.opengl.GL11; -import techreborn.cofhLib.gui.GuiBase; -import techreborn.cofhLib.gui.GuiColor; - -public abstract class ElementSlider extends ElementBase { - protected int _value; - protected int _valueMin; - protected int _valueMax; - protected int _sliderWidth; - protected int _sliderHeight; - - protected boolean _isDragging; - - public int borderColor = new GuiColor(120, 120, 120, 255).getColor(); - public int backgroundColor = new GuiColor(0, 0, 0, 255).getColor(); - - protected ResourceLocation enabledTexture = Textures.Gui.Elements.BUTTON_ENABLED; - protected ResourceLocation hoverTexture = Textures.Gui.Elements.BUTTON_HOVER; - protected ResourceLocation disabledTexture = Textures.Gui.Elements.BUTTON_DISABLED; - - protected ElementSlider(GuiBase containerScreen, int x, int y, int width, int height, int maxValue) { - this(containerScreen, x, y, width, height, maxValue, 0); - } - - protected ElementSlider(GuiBase containerScreen, int x, int y, int width, int height, int maxValue, int minValue) { - super(containerScreen, x, y, width, height); - _valueMax = maxValue; - _valueMin = minValue; - } - - protected ElementSlider(GuiBase containerScreen, String elementName, int x, int y, int width, int height, int maxValue, int minValue) { - super(containerScreen, x, y, width, height); - this.name = elementName; - _valueMax = maxValue; - _valueMin = minValue; - } - - public ElementSlider setColor(int backgroundColor, int borderColor) { - this.borderColor = borderColor; - this.backgroundColor = backgroundColor; - return this; - } - - public ElementSlider setSliderSize(int width, int height) { - _sliderWidth = width; - _sliderHeight = height; - return this; - } - - public int getValue() { - return this._value; - } - - public int getValueMin() { - return this._valueMin; - } - - public int getValueMax() { - return this._valueMax; - } - - public ElementSlider setValue(int value) { - value = Math.max(_valueMin, Math.min(_valueMax, value)); - if (value != _value) { - _value = value; - onValueChanged(_value); - } - return this; - } - - public ElementSlider setMinValue(int minValue) { - _valueMin = minValue; - return this; - } - - public ElementSlider setMaxValue(int maxValue) { - _valueMax = maxValue; - return this; - } - - @Override - public void drawBackground(int mouseX, int mouseY, float gameTicks) { - drawModalRect(posX - 1, posY - 1, posX + sizeX + 1, posY + sizeY + 1, borderColor); - drawModalRect(posX, posY, posX + sizeX, posY + sizeY, backgroundColor); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - } - - protected void drawSlider(int mouseX, int mouseY, int sliderX, int sliderY) { - int sliderMidX = _sliderWidth / 2; - int sliderMidY = _sliderHeight / 2; - int sliderEndX = _sliderWidth - sliderMidX; - int sliderEndY = _sliderHeight - sliderMidY; - - if (!isEnabled()) { - gui.bindTexture(disabledTexture); - } else if (isHovering(mouseX, mouseY)) { - gui.bindTexture(hoverTexture); - } else { - gui.bindTexture(enabledTexture); - } - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - drawTexturedModalRect(sliderX, sliderY, 0, 0, sliderMidX, sliderMidY); - drawTexturedModalRect(sliderX, sliderY + sliderMidY, 0, 256 - sliderEndY, sliderMidX, sliderEndY); - drawTexturedModalRect(sliderX + sliderMidX, sliderY, 256 - sliderEndX, 0, sliderEndX, sliderMidY); - drawTexturedModalRect(sliderX + sliderMidX, sliderY + sliderMidY, 256 - sliderEndX, 256 - sliderEndY, sliderEndX, sliderEndY); - } - - @Override - public void drawForeground(int mouseX, int mouseY) { - int sliderX = posX + getSliderX(); - int sliderY = posY + getSliderY(); - - drawSlider(mouseX, mouseY, sliderX, sliderY); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - } - - protected boolean isHovering(int x, int y) { - return intersectsWith(x, y); - } - - public int getSliderX() { - return 0; - } - - public int getSliderY() { - return 0; - } - - @Override - public boolean onMousePressed(int mouseX, int mouseY, int mouseButton) { - _isDragging = mouseButton == 0; - update(mouseX, mouseY); - return true; - } - - @Override - public void onMouseReleased(int mouseX, int mouseY) { - if (_isDragging) { - onStopDragging(); - } - _isDragging = false; - } - - @Override - public void update(int mouseX, int mouseY) { - if (_isDragging) { - dragSlider(mouseX - posX, mouseY - posY); - } - } - - protected abstract void dragSlider(int x, int y); - - @Override - public boolean onMouseWheel(int mouseX, int mouseY, int movement) { - if (movement > 0) { - setValue(_value - 1); - } else if (movement < 0) { - setValue(_value + 1); - } - return true; - } - - public void onValueChanged(int value) { - return; - } - - public void onStopDragging() { - return; - } - - public void setEnabledTexture(ResourceLocation enabledTexture) { - this.enabledTexture = enabledTexture; - } - - public void setDisabledTexture(ResourceLocation disabledTexture) { - this.disabledTexture = disabledTexture; - } - - public void setHoverTexture(ResourceLocation hoverTexture) { - this.hoverTexture = hoverTexture; - } -} diff --git a/src/main/java/techreborn/cofhLib/gui/element/ElementTextField.java b/src/main/java/techreborn/cofhLib/gui/element/ElementTextField.java deleted file mode 100755 index 6e1d15601..000000000 --- a/src/main/java/techreborn/cofhLib/gui/element/ElementTextField.java +++ /dev/null @@ -1,640 +0,0 @@ -package techreborn.cofhLib.gui.element; - -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.GuiScreen; -import net.minecraft.util.ChatAllowedCharacters; -import org.lwjgl.input.Keyboard; -import org.lwjgl.opengl.GL11; -import techreborn.cofhLib.gui.GuiBase; -import techreborn.cofhLib.gui.GuiColor; -import techreborn.cofhLib.util.helpers.MathHelper; - -import static org.lwjgl.opengl.GL11.*; - - -public class ElementTextField extends ElementBase { - public int borderColor = new GuiColor(55, 55, 55).getColor(); - public int backgroundColor = new GuiColor(139, 139, 139).getColor(); - public int disabledColor = new GuiColor(198, 198, 198).getColor(); - public int selectedLineColor = new GuiColor(160, 160, 224).getColor(); - public int textColor = new GuiColor(224, 224, 224).getColor(); - public int selectedTextColor = new GuiColor(224, 224, 224).getColor(); - public int defaultCaretColor = new GuiColor(255, 255, 255).getColor(); - - protected char[] text; - protected int textLength; - protected int selectionStart, selectionEnd; - protected int renderStart, caret; - - private int paddingLeft, paddingRight, paddingTop, paddingBottom; - - private boolean isFocused; - private boolean canFocusChange = true; - - private boolean selecting; - - private byte caretCounter; - protected boolean caretInsert; - protected boolean smartCaret = true; - protected boolean smartCaretCase = true; - - protected boolean enableStencil = false; - - public ElementTextField(GuiBase gui, int posX, int posY, int width, int height) { - this(gui, posX, posY, width, height, (short) 32); - } - - public ElementTextField(GuiBase gui, int posX, int posY, int width, int height, short limit) { - super(gui, posX, posY, width, height); - setPadding(1, 1, 1, 1); - setMaxLength(limit); - } - - public ElementTextField(GuiBase gui, int posX, int posY, String name, int width, int height) { - this(gui, posX, posY, name, width, height, (short) 32); - } - - public ElementTextField(GuiBase gui, int posX, int posY, String name, int width, int height, short limit) { - super(gui, posX, posY, width, height); - setName(name); - setPadding(1, 1, 1, 1); - setMaxLength(limit); - } - - public ElementTextField setTextColor(Number textColor, Number selectedTextColor) { - if (textColor != null) { - this.textColor = textColor.intValue(); - } - if (selectedTextColor != null) { - this.selectedTextColor = selectedTextColor.intValue(); - } - return this; - } - - public ElementTextField setPaddingLeft(int paddingLeft) { - this.paddingLeft = paddingLeft; - return this; - } - - public ElementTextField setPaddingRight(int paddingRight) { - this.paddingRight = paddingRight; - return this; - } - - public ElementTextField setPaddingTop(int paddingTop) { - this.paddingTop = paddingTop; - return this; - } - - public ElementTextField setPaddingBottom(int paddingBottom) { - this.paddingBottom = paddingBottom; - return this; - } - - public ElementTextField setPadding(int paddingTop, int paddingRight, int paddingBottom, int paddingLeft) { - this.paddingTop = paddingTop; - this.paddingRight = paddingRight; - this.paddingBottom = paddingBottom; - this.paddingLeft = paddingLeft; - return this; - } - - public ElementTextField setSelectionColor(Number selectedLineColor, Number defaultCaretColor) { - if (selectedLineColor != null) { - this.selectedLineColor = selectedLineColor.intValue(); - } - if (defaultCaretColor != null) { - this.defaultCaretColor = defaultCaretColor.intValue(); - } - return this; - } - - public ElementTextField setBackgroundColor(Number backgroundColor, Number disabledColor, Number borderColor) { - if (backgroundColor != null) { - this.backgroundColor = backgroundColor.intValue(); - } - if (disabledColor != null) { - this.disabledColor = disabledColor.intValue(); - } - if (borderColor != null) { - this.borderColor = borderColor.intValue(); - } - return this; - } - - public ElementTextField setFocusable(boolean focusable) { - canFocusChange = focusable; - return this; - } - - public ElementTextField setFocused(boolean focused) { - if (canFocusChange) { - isFocused = focused; - caretCounter = 0; - } - return this; - } - - public ElementTextField setText(String text) { - selectionStart = 0; - selectionEnd = textLength; - writeText(text); - return this; - } - - public ElementTextField setMaxLength(short limit) { - char[] oldText = text; - text = new char[limit]; - textLength = Math.min(limit, textLength); - if (oldText != null) { - System.arraycopy(oldText, 0, text, 0, textLength); - } - findRenderStart(); - return this; - } - - public int getMaxStringLength() { - return text.length; - } - - public boolean isFocused() { - return isEnabled() && isFocused; - } - - public boolean isFocusable() { - return canFocusChange; - } - - public int getContentWidth() { - FontRenderer font = getFontRenderer(); - int width = 0; - for (int i = 0; i < textLength; ++i) { - width += font.getCharWidth(text[i]); - } - return width; - } - - public int getPaddingLeft() { - return paddingLeft; - } - - public int getPaddingRight() { - return paddingRight; - } - - public int getPaddingTop() { - return paddingTop; - } - - public int getPaddingBottom() { - return paddingBottom; - } - - public int getVisibleWidth() { - FontRenderer font = getFontRenderer(); - int width = 0, endX = sizeX - 1; - for (int i = renderStart; i < textLength; ++i) { - int charW = font.getCharWidth(text[i]); - if (!enableStencil && (width + charW) > endX) { - break; - } - width += charW; - if (width >= endX) { - width = Math.min(width, endX); - break; - } - } - return width; - } - - public String getText() { - return new String(text, 0, textLength); - } - - public String getSelectedText() { - - if (selectionStart != selectionEnd) { - return new String(text, selectionStart, selectionEnd); - } - return getText(); - } - - public void writeText(String text) { - int i = 0; - for (int e = text.length(); i < e; ++i) { - if (!insertCharacter(text.charAt(i))) { - break; - } - } - clearSelection(); - findRenderStart(); - onCharacterEntered(i > 0); - } - - public boolean isAllowedCharacter(char charTyped) { - return ChatAllowedCharacters.isAllowedCharacter(charTyped); - } - - protected boolean onEnter() { - return false; - } - - protected void onFocusLost() { - - } - - protected void onCharacterEntered(boolean success) { - - } - - protected boolean insertCharacter(char charTyped) { - - if (isAllowedCharacter(charTyped)) { - - if (selectionStart != selectionEnd) { - if (caret == selectionStart) { - ++caret; - } - text[selectionStart++] = charTyped; - return true; - } - - if ((caretInsert && caret == text.length) || textLength == text.length) { - return false; - } - - if (!caretInsert) { - if (caret < textLength) { - System.arraycopy(text, caret, text, caret + 1, textLength - caret); - } - ++textLength; - } - text[caret++] = charTyped; - return true; - } else { - return true; - } - } - - protected void findRenderStart() { - - caret = MathHelper.clampI(caret, 0, textLength); - if (caret < renderStart) { - renderStart = caret; - return; - } - - FontRenderer font = getFontRenderer(); - int endX = sizeX - 2; - - for (int i = renderStart, width = 0; i < caret; ++i) { - width += font.getCharWidth(text[i]); - while (width >= endX) { - width -= font.getCharWidth(text[renderStart++]); - if (renderStart >= textLength) { - return; - } - } - } - } - - protected void clearSelection() { - - if (selectionStart != selectionEnd) { - if (selectionEnd < textLength) { - System.arraycopy(text, selectionEnd, text, selectionStart, textLength - selectionEnd); - } - textLength -= selectionEnd - selectionStart; - - selectionEnd = caret = selectionStart; - findRenderStart(); - } - } - - protected final int seekNextCaretLocation(int pos) { - - return seekNextCaretLocation(pos, true); - } - - protected int seekNextCaretLocation(int pos, boolean forward) { - - int dir = forward ? 1 : -1; - int e = forward ? textLength : 0; - if (pos == textLength) { - --pos; - } - char prevChar = text[pos]; - while (pos != e && Character.isSpaceChar(prevChar)) { - prevChar = text[pos += dir]; - } - - if (smartCaret) { - for (int i = pos; i != e; i += dir) { - char curChar = text[i]; - boolean caze = Character.isUpperCase(curChar) != Character.isUpperCase(prevChar); - if (caze || Character.isSpaceChar(curChar) != Character.isSpaceChar(prevChar) || - Character.isLetterOrDigit(curChar) != Character.isLetterOrDigit(prevChar)) { - if ((pos + dir) != i || !Character.isLetterOrDigit(curChar)) { - return i + (smartCaretCase && caze && Character.isUpperCase(prevChar) ? -dir : 0); - } - } - prevChar = curChar; - } - } - for (int i = pos; i != e; i += dir) { - char curChar = text[i]; - if (Character.isSpaceChar(curChar) != Character.isSpaceChar(prevChar)) { - return i; - } - } - return forward ? textLength : 0; - } - - @Override - public boolean onKeyTyped(char charTyped, int keyTyped) { - if (!isFocused()) { - return false; - } - - switch (charTyped) { - case 1: // ^A - selectionEnd = caret = textLength; - selectionStart = 0; - findRenderStart(); - return true; - case 3: // ^C - if (selectionStart != selectionEnd) { - GuiScreen.setClipboardString(getSelectedText()); - } - return true; - case 24: // ^X - if (selectionStart != selectionEnd) { - GuiScreen.setClipboardString(getSelectedText()); - clearSelection(); - } - - return true; - case 22: // ^V - writeText(GuiScreen.getClipboardString()); - - return true; - default: - switch (keyTyped) { - case Keyboard.KEY_ESCAPE: - setFocused(false); - return !isFocused(); - case Keyboard.KEY_RETURN: - case Keyboard.KEY_NUMPADENTER: - return onEnter(); - case Keyboard.KEY_INSERT: - if (GuiScreen.isShiftKeyDown()) { - writeText(GuiScreen.getClipboardString()); - } else { - caretInsert = !caretInsert; - } - - return true; - case Keyboard.KEY_CLEAR: // mac only (clear selection) - clearSelection(); - - return true; - case Keyboard.KEY_DELETE: // delete - if (!GuiScreen.isShiftKeyDown()) { - if (selectionStart != selectionEnd) { - clearSelection(); - } else if (GuiScreen.isCtrlKeyDown()) { - int size = seekNextCaretLocation(caret, true) - caret; - selectionStart = caret; - selectionEnd = caret + size; - clearSelection(); - } else { - if (caret < textLength && textLength > 0) { - --textLength; - System.arraycopy(text, caret + 1, text, caret, textLength - caret); - } - } - if (caret <= renderStart) { - renderStart = MathHelper.clampI(caret - 3, 0, textLength); - } - findRenderStart(); - onCharacterEntered(true); - return true; - } - // continue.. (shift+delete = backspace) - case Keyboard.KEY_BACK: // backspace - if (selectionStart != selectionEnd) { - clearSelection(); - } else if (GuiScreen.isCtrlKeyDown()) { - int size = seekNextCaretLocation(caret, false) - caret; - selectionStart = caret + size; - selectionEnd = caret; - clearSelection(); - } else { - if (caret > 0 && textLength > 0) { - --caret; - System.arraycopy(text, caret + 1, text, caret, textLength - caret); - --textLength; - } - } - if (caret <= renderStart) { - renderStart = MathHelper.clampI(caret - 3, 0, textLength); - } - findRenderStart(); - onCharacterEntered(true); - return true; - case Keyboard.KEY_HOME: // home - if (GuiScreen.isShiftKeyDown()) { - if (caret > selectionEnd) { - selectionEnd = selectionStart; - } - selectionStart = 0; - } else { - selectionStart = selectionEnd = 0; - } - renderStart = caret = 0; - - return true; - case Keyboard.KEY_END: // end - if (GuiScreen.isShiftKeyDown()) { - if (caret < selectionStart) { - selectionStart = selectionEnd; - } - selectionEnd = textLength; - } else { - selectionStart = selectionEnd = textLength; - } - caret = textLength; - findRenderStart(); - - return true; - case Keyboard.KEY_LEFT: // left arrow - case Keyboard.KEY_RIGHT: // right arrow - int size = keyTyped == 203 ? -1 : 1; - if (GuiScreen.isCtrlKeyDown()) { - size = seekNextCaretLocation(caret, keyTyped == 205) - caret; - } - - if (selectionStart == selectionEnd || !GuiScreen.isShiftKeyDown()) { - selectionStart = selectionEnd = caret; - } - - { - int t = caret; - caret = MathHelper.clampI(caret + size, 0, textLength); - size = caret - t; - } - findRenderStart(); - - if (GuiScreen.isShiftKeyDown()) { - if (caret == selectionStart + size) { - selectionStart = caret; - } else if (caret == selectionEnd + size) { - selectionEnd = caret; - } - // this logic is 'broken' in that the selection doesn't wrap - // such that a|bc|def becomes abc|def| but it will highlight - // the rest of the word the caret is on i.e., a|bc|def -> a|bcdef| - // i don't know that it matters (home+end exhibit the former) - - if (selectionStart > selectionEnd) { - int t = selectionStart; - selectionStart = selectionEnd; - selectionEnd = t; - } - } - - return true; - default: - if (isAllowedCharacter(charTyped)) { - boolean typed = insertCharacter(charTyped); - clearSelection(); - findRenderStart(); - onCharacterEntered(typed); - return true; - } else { - return false; - } - } - } - } - - @Override - public boolean onMousePressed(int mouseX, int mouseY, int mouseButton) { - - selecting = mouseButton == 0; - l: - if (selecting) { - if (textLength == 0) { - selectionStart = selectionEnd = caret = 0; - break l; - } - FontRenderer font = getFontRenderer(); - int pos = mouseX - posX - 1; - for (int i = renderStart, width = 0; ; ) { - int charW = font.getCharWidth(text[i]); - if ((width += charW) > pos || ++i >= textLength) { - selectionStart = selectionEnd = caret = i; - break; - } - } - } - - setFocused(true); - return true; - } - - @Override - public void update(int mouseX, int mouseY) { - - ++caretCounter; - //if (selecting) { - // FontRenderer font = getFontRenderer(); - // int pos = mouseX - posX - 1; - // for (int i = renderStart, width = 0; i < textLength; ++i) { - // } - //} - } - - @Override - public void onMouseReleased(int mouseX, int mouseY) { - - if (!selecting) { - boolean focus = isFocused(); - setFocused(false); - if (focus && !isFocused()) { - onFocusLost(); - } - } - selecting = false; - } - - @Override - public void drawBackground(int mouseX, int mouseY, float gameTicks) { - - drawModalRect(posX - 1, posY - 1, posX + sizeX + 1, posY + sizeY + 1, borderColor); - drawModalRect(posX, posY, posX + sizeX, posY + sizeY, isEnabled() ? backgroundColor : disabledColor); - } - - @Override - public void drawForeground(int mouseX, int mouseY) { - - if (enableStencil) { - glEnable(GL_STENCIL_TEST); - glClear(GL_STENCIL_BUFFER_BIT); - drawStencil(posX + 1, posY + 1, posX + sizeX - 1, posY + sizeY - 1, 1); - } - - FontRenderer font = getFontRenderer(); - char[] text = this.text; - int startX = posX + paddingLeft, endX = sizeX - paddingRight, startY = posY + paddingTop, endY = startY + font.FONT_HEIGHT + paddingBottom; - for (int i = renderStart, width = 0; i <= textLength; ++i) { - boolean end = i == textLength; - int charW = 2; - if (!end) { - charW = font.getCharWidth(text[i]); - if (!enableStencil && (width + charW) > endX) { - break; - } - } - - boolean drawCaret = i == caret && (caretCounter &= 31) < 16 && isFocused(); - if (drawCaret) { - int caretEnd = width + 2; - if (caretInsert) { - caretEnd = width + charW; - } - drawModalRect(startX + width, startY - 1, startX + caretEnd, endY, (0xFF000000 & defaultCaretColor) | (~defaultCaretColor & 0xFFFFFF)); - } - - if (!end) { - boolean selected = i >= selectionStart & i < selectionEnd; - if (selected) { - drawModalRect(startX + width, startY, startX + width + charW, endY, selectedLineColor); - } - font.drawStringWithShadow(String.valueOf(text[i]), startX + width, startY, selected ? selectedTextColor : textColor); - } - - if (drawCaret) { - int caretEnd = width + 2; - if (caretInsert) { - caretEnd = width + charW; - } - - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_ONE_MINUS_DST_COLOR, GL11.GL_ZERO); - gui.drawSizedModalRect(startX + width, startY - 1, startX + caretEnd, endY, -1); - GL11.glDisable(GL11.GL_BLEND); - } - - width += charW; - if (width > endX) { - break; - } - } - - if (enableStencil) { - glDisable(GL_STENCIL_TEST); - } - } - -} diff --git a/src/main/java/techreborn/cofhLib/gui/element/ElementTextFieldFiltered.java b/src/main/java/techreborn/cofhLib/gui/element/ElementTextFieldFiltered.java deleted file mode 100755 index 94f498b1c..000000000 --- a/src/main/java/techreborn/cofhLib/gui/element/ElementTextFieldFiltered.java +++ /dev/null @@ -1,43 +0,0 @@ -package techreborn.cofhLib.gui.element; - -import techreborn.cofhLib.util.CharacterSingleton; - -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -public class ElementTextFieldFiltered extends ElementTextField { - protected boolean includeVanilla = true; - protected CharacterSingleton seq = new CharacterSingleton(); - protected Matcher filter; - - public ElementTextFieldFiltered(techreborn.cofhLib.gui.GuiBase gui, int posX, int posY, int width, int height) { - - super(gui, posX, posY, width, height); - } - - public ElementTextFieldFiltered(techreborn.cofhLib.gui.GuiBase gui, int posX, int posY, int width, int height, short limit) { - - super(gui, posX, posY, width, height, limit); - } - - /** - * @param pattern Regex limit what characters can be typed - * @param includeVanilla Include vanilla disallowed characters - * @return this - */ - public ElementTextFieldFiltered setFilter(Pattern pattern, boolean includeVanilla) { - - filter = pattern.matcher(seq); - this.includeVanilla = includeVanilla; - return this; - } - - @Override - public boolean isAllowedCharacter(char charTyped) { - - seq.character = charTyped; - return (!includeVanilla || super.isAllowedCharacter(charTyped)) && (filter == null || filter.reset().matches()); - } - -} - diff --git a/src/main/java/techreborn/cofhLib/gui/element/ElementTextFieldLimited.java b/src/main/java/techreborn/cofhLib/gui/element/ElementTextFieldLimited.java deleted file mode 100755 index de5994730..000000000 --- a/src/main/java/techreborn/cofhLib/gui/element/ElementTextFieldLimited.java +++ /dev/null @@ -1,37 +0,0 @@ -package techreborn.cofhLib.gui.element; - -public class ElementTextFieldLimited extends ElementTextField { - - protected boolean includeVanilla = true; - protected String filter; - - public ElementTextFieldLimited(techreborn.cofhLib.gui.GuiBase gui, int posX, int posY, int width, int height) { - - super(gui, posX, posY, width, height); - } - - public ElementTextFieldLimited(techreborn.cofhLib.gui.GuiBase gui, int posX, int posY, int width, int height, short limit) { - - super(gui, posX, posY, width, height, limit); - } - - /** - * @param pattern String containing all characters permitted - * @param includeVanilla Include vanilla disallowed characters - * @return this - */ - public ElementTextFieldLimited setFilter(String pattern, boolean includeVanilla) { - - filter = pattern; - this.includeVanilla = includeVanilla; - return this; - } - - @Override - public boolean isAllowedCharacter(char charTyped) { - - return (!includeVanilla || super.isAllowedCharacter(charTyped)) && (filter == null || filter.indexOf(charTyped) >= 0); - } - -} - diff --git a/src/main/java/techreborn/cofhLib/gui/element/TabBase.java b/src/main/java/techreborn/cofhLib/gui/element/TabBase.java deleted file mode 100755 index 4359e93f0..000000000 --- a/src/main/java/techreborn/cofhLib/gui/element/TabBase.java +++ /dev/null @@ -1,234 +0,0 @@ -package techreborn.cofhLib.gui.element; - -import net.minecraft.util.ResourceLocation; -import org.lwjgl.opengl.GL11; -import techreborn.cofhLib.render.RenderHelper; - -/** - * Base class for a tab element. Has self-contained rendering methods and a link back to the {@link techreborn.cofhLib.gui.GuiBase} it is a part of. - * - * @author King Lemming - */ -public abstract class TabBase extends ElementBase { - - public static int tabExpandSpeed = 8; - - public static final int LEFT = 0; - public static final int RIGHT = 1; - - protected int offsetX = 0; - protected int offsetY = 0; - - public boolean open; - public boolean fullyOpen; - public int side = RIGHT; - - public int headerColor = 0xe1c92f; - public int subheaderColor = 0xaaafb8; - public int textColor = 0x000000; - public int backgroundColor = 0xffffff; - - protected int currentShiftX = 0; - protected int currentShiftY = 0; - - public int minWidth = 22; - public int maxWidth = 124; - public int currentWidth = minWidth; - - public int minHeight = 22; - public int maxHeight = 22; - public int currentHeight = minHeight; - - public static final ResourceLocation DEFAULT_TEXTURE_LEFT = new ResourceLocation(techreborn.cofhLib.gui.GuiProps.PATH_ELEMENTS + "Tab_Left.png"); - public static final ResourceLocation DEFAULT_TEXTURE_RIGHT = new ResourceLocation(techreborn.cofhLib.gui.GuiProps.PATH_ELEMENTS + "Tab_Right.png"); - - public TabBase(techreborn.cofhLib.gui.GuiBase gui) { - - super(gui, 0, 0); - texture = DEFAULT_TEXTURE_RIGHT; - } - - public TabBase(techreborn.cofhLib.gui.GuiBase gui, int side) { - - super(gui, 0, 0); - this.side = side; - - if (side == LEFT) { - texture = DEFAULT_TEXTURE_LEFT; - } else { - texture = DEFAULT_TEXTURE_RIGHT; - } - } - - public TabBase setOffsets(int x, int y) { - - offsetX = x; - offsetY = y; - - return this; - } - - public void draw(int x, int y) { - - posX = x + offsetX; - posY = y + offsetY; - draw(); - } - - public void draw() { - - return; - } - - @Override - public void drawBackground(int mouseX, int mouseY, float gameTicks) { - - } - - @Override - public void drawForeground(int mouseX, int mouseY) { - - } - - @Override - public void update() { - - if (open && currentWidth < maxWidth) { - currentWidth += tabExpandSpeed; - } else if (!open && currentWidth > minWidth) { - currentWidth -= tabExpandSpeed; - } - if (currentWidth > maxWidth) { - currentWidth = maxWidth; - } else if (currentWidth < minWidth) { - currentWidth = minWidth; - } - if (open && currentHeight < maxHeight) { - currentHeight += tabExpandSpeed; - } else if (!open && currentHeight > minHeight) { - currentHeight -= tabExpandSpeed; - } - if (currentHeight > maxHeight) { - currentHeight = maxHeight; - } else if (currentHeight < minHeight) { - currentHeight = minHeight; - } - if (!fullyOpen && open && currentWidth == maxWidth && currentHeight == maxHeight) { - setFullyOpen(); - } - } - - protected void drawBackground() { - - float colorR = (backgroundColor >> 16 & 255) / 255.0F; - float colorG = (backgroundColor >> 8 & 255) / 255.0F; - float colorB = (backgroundColor & 255) / 255.0F; - - GL11.glColor4f(colorR, colorG, colorB, 1.0F); - - RenderHelper.bindTexture(texture); - - int xPosition = posX(); - - gui.drawTexturedModalRect(xPosition, posY + 4, 0, 256 - currentHeight + 4, 4, currentHeight - 4); - gui.drawTexturedModalRect(xPosition + 4, posY, 256 - currentWidth + 4, 0, currentWidth - 4, 4); - gui.drawTexturedModalRect(xPosition, posY, 0, 0, 4, 4); - gui.drawTexturedModalRect(xPosition + 4, posY + 4, 256 - currentWidth + 4, 256 - currentHeight + 4, currentWidth - 4, currentHeight - 4); - - GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0F); - } - - protected void drawTabIcon(String iconName) { - - gui.drawIcon(iconName, posXOffset(), posY + 3, 1); - } - - /** - * Shortcut to correct for the proper X position. - */ - protected int posX() { - - if (side == LEFT) { - return posX - currentWidth; - } - return posX; - } - - /** - * Corrects for shadowing differences in tabs to ensure that they always look nice - used in font rendering, typically. - */ - protected int posXOffset() { - - return posX() + sideOffset(); - } - - protected int sideOffset() { - - return (side == LEFT ? 4 : 2); - } - - public boolean intersectsWith(int mouseX, int mouseY, int shiftX, int shiftY) { - - shiftX += offsetX; - shiftY += offsetY; - - if (side == LEFT) { - if (mouseX <= shiftX && mouseX >= shiftX - currentWidth && mouseY >= shiftY && mouseY <= shiftY + currentHeight) { - return true; - } - } else if (mouseX >= shiftX && mouseX <= shiftX + currentWidth && mouseY >= shiftY && mouseY <= shiftY + currentHeight) { - return true; - } - return false; - } - - public boolean isFullyOpened() { - - return fullyOpen; - } - - public void setCurrentShift(int x, int y) { - - currentShiftX = x + offsetX; - currentShiftY = y + offsetY; - } - - public void setFullyOpen() { - - open = true; - currentWidth = maxWidth; - currentHeight = maxHeight; - fullyOpen = true; - } - - public void toggleOpen() { - - if (open) { - open = false; - if (side == LEFT) { - techreborn.cofhLib.gui.TabTracker.setOpenedLeftTab(null); - } else { - techreborn.cofhLib.gui.TabTracker.setOpenedRightTab(null); - } - fullyOpen = false; - } else { - open = true; - if (side == LEFT) { - techreborn.cofhLib.gui.TabTracker.setOpenedLeftTab(this.getClass()); - } else { - techreborn.cofhLib.gui.TabTracker.setOpenedRightTab(this.getClass()); - } - } - } - - public techreborn.cofhLib.util.Rectangle4i getBounds() { - - if (isVisible()) { - return new techreborn.cofhLib.util.Rectangle4i(posX() + gui.getGuiLeft(), posY + gui.getGuiTop(), currentWidth, currentHeight); - } else { - return new techreborn.cofhLib.util.Rectangle4i(posX() + gui.getGuiLeft(), posY + gui.getGuiTop(), 0, 0); - } - - } - -} diff --git a/src/main/java/techreborn/cofhLib/gui/element/listbox/IListBoxElement.java b/src/main/java/techreborn/cofhLib/gui/element/listbox/IListBoxElement.java deleted file mode 100755 index 6ba0556f5..000000000 --- a/src/main/java/techreborn/cofhLib/gui/element/listbox/IListBoxElement.java +++ /dev/null @@ -1,14 +0,0 @@ -package techreborn.cofhLib.gui.element.listbox; - -import techreborn.cofhLib.gui.element.ElementListBox; - -public interface IListBoxElement { - - public int getHeight(); - - public int getWidth(); - - public Object getValue(); - - public void draw(ElementListBox listBox, int x, int y, int backColor, int textColor); -} diff --git a/src/main/java/techreborn/cofhLib/gui/element/listbox/ListBoxElementText.java b/src/main/java/techreborn/cofhLib/gui/element/listbox/ListBoxElementText.java deleted file mode 100755 index cd81aff0f..000000000 --- a/src/main/java/techreborn/cofhLib/gui/element/listbox/ListBoxElementText.java +++ /dev/null @@ -1,39 +0,0 @@ -package techreborn.cofhLib.gui.element.listbox; - -import net.minecraft.client.Minecraft; -import techreborn.cofhLib.gui.element.ElementListBox; - -public class ListBoxElementText implements IListBoxElement { - - private final String _text; - - public ListBoxElementText(String text) { - - _text = text; - } - - @Override - public Object getValue() { - - return _text; - } - - @Override - public int getHeight() { - - return 10; - } - - @Override - public int getWidth() { - - return Minecraft.getMinecraft().fontRenderer.getStringWidth(_text); - } - - @Override - public void draw(ElementListBox listBox, int x, int y, int backColor, int textColor) { - - Minecraft.getMinecraft().fontRenderer.drawString(_text, x, y, textColor); - } - -} diff --git a/src/main/java/techreborn/cofhLib/gui/element/listbox/SliderHorizontal.java b/src/main/java/techreborn/cofhLib/gui/element/listbox/SliderHorizontal.java deleted file mode 100755 index caedd2391..000000000 --- a/src/main/java/techreborn/cofhLib/gui/element/listbox/SliderHorizontal.java +++ /dev/null @@ -1,31 +0,0 @@ -package techreborn.cofhLib.gui.element.listbox; - -public class SliderHorizontal extends techreborn.cofhLib.gui.element.ElementSlider { - - public SliderHorizontal(techreborn.cofhLib.gui.GuiBase containerScreen, int x, int y, int width, int height, int maxValue) { - - this(containerScreen, x, y, width, height, maxValue, 0); - } - - public SliderHorizontal(techreborn.cofhLib.gui.GuiBase containerScreen, int x, int y, int width, int height, int maxValue, int minValue) { - - super(containerScreen, x, y, width, height, maxValue, minValue); - int dist = maxValue - minValue; - setSliderSize(dist <= 0 ? width : Math.max(width / ++dist, 9), height); - } - - @Override - public int getSliderX() { - - int dist = _valueMax - _valueMin; - int maxPos = sizeX - _sliderWidth; - return Math.min(dist == 0 ? 0 : maxPos * (_value - _valueMin) / dist, maxPos); - } - - @Override - public void dragSlider(int v, int y) { - - v += Math.round(_sliderWidth * (v / (float) sizeX) + (_sliderWidth * 0.25f)); - setValue(_valueMin + ((_valueMax - _valueMin) * v / sizeX)); - } -} diff --git a/src/main/java/techreborn/cofhLib/gui/element/listbox/SliderVertical.java b/src/main/java/techreborn/cofhLib/gui/element/listbox/SliderVertical.java deleted file mode 100755 index 4572a7932..000000000 --- a/src/main/java/techreborn/cofhLib/gui/element/listbox/SliderVertical.java +++ /dev/null @@ -1,31 +0,0 @@ -package techreborn.cofhLib.gui.element.listbox; - -public class SliderVertical extends techreborn.cofhLib.gui.element.ElementSlider { - - public SliderVertical(techreborn.cofhLib.gui.GuiBase containerScreen, int x, int y, int width, int height, int maxValue) { - - this(containerScreen, x, y, width, height, maxValue, 0); - } - - public SliderVertical(techreborn.cofhLib.gui.GuiBase containerScreen, int x, int y, int width, int height, int maxValue, int minValue) { - - super(containerScreen, x, y, width, height, maxValue, minValue); - int dist = maxValue - minValue; - setSliderSize(width, dist <= 0 ? height : Math.max(height / ++dist, 9)); - } - - @Override - public int getSliderY() { - - int dist = _valueMax - _valueMin; - int maxPos = sizeY - _sliderHeight; - return Math.min(dist == 0 ? 0 : maxPos * (_value - _valueMin) / dist, maxPos); - } - - @Override - public void dragSlider(int x, int v) { - - v += Math.round(_sliderHeight * (v / (float) sizeY) + (_sliderHeight * 0.25f)); - setValue(_valueMin + ((_valueMax - _valueMin) * v / sizeY)); - } -} diff --git a/src/main/java/techreborn/cofhLib/gui/slot/ISlotValidator.java b/src/main/java/techreborn/cofhLib/gui/slot/ISlotValidator.java deleted file mode 100755 index 7900ea357..000000000 --- a/src/main/java/techreborn/cofhLib/gui/slot/ISlotValidator.java +++ /dev/null @@ -1,17 +0,0 @@ -package techreborn.cofhLib.gui.slot; - -import net.minecraft.item.ItemStack; - -/** - * Interface used in conjunction with {@link SlotValidated}. - * - * @author King Lemming - */ -public interface ISlotValidator { - - /** - * Essentially a passthrough so an arbitrary criterion can be checked against. - */ - boolean isItemValid(ItemStack stack); - -} diff --git a/src/main/java/techreborn/cofhLib/gui/slot/SlotAcceptAssignable.java b/src/main/java/techreborn/cofhLib/gui/slot/SlotAcceptAssignable.java deleted file mode 100755 index 3ea3794fd..000000000 --- a/src/main/java/techreborn/cofhLib/gui/slot/SlotAcceptAssignable.java +++ /dev/null @@ -1,27 +0,0 @@ -package techreborn.cofhLib.gui.slot; - -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.Slot; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; - -/** - * Slot that will only accept ItemStacks whose items are a subclass of the given class. - */ -public class SlotAcceptAssignable extends Slot { - - protected Class clazz; - - public SlotAcceptAssignable(IInventory inventory, int index, int x, int y, Class c) { - - super(inventory, index, x, y); - clazz = c; - } - - @Override - public boolean isItemValid(ItemStack stack) { - - return stack != null && clazz.isInstance(stack.getItem()); - } - -} diff --git a/src/main/java/techreborn/cofhLib/gui/slot/SlotAcceptInsertable.java b/src/main/java/techreborn/cofhLib/gui/slot/SlotAcceptInsertable.java deleted file mode 100755 index ef95c172a..000000000 --- a/src/main/java/techreborn/cofhLib/gui/slot/SlotAcceptInsertable.java +++ /dev/null @@ -1,35 +0,0 @@ -package techreborn.cofhLib.gui.slot; - -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.ISidedInventory; -import net.minecraft.item.ItemStack; - -/** - * Slot that will only accept ItemStacks when the IInventory returns true from isItemValidForSlot. - *

- * If an ISidedInventory, canInsertItem (from side 6 (UNKNOWN)) must also return true. - */ -public class SlotAcceptInsertable extends SlotAcceptValid { - - protected ISidedInventory sidedInv; - - public SlotAcceptInsertable(IInventory inventory, int index, int x, int y) { - - super(inventory, index, x, y); - - if (inventory instanceof ISidedInventory) { - sidedInv = (ISidedInventory) inventory; - } else { - sidedInv = null; - } - } - - @Override - public boolean isItemValid(ItemStack stack) { - - boolean valid = super.isItemValid(stack); - - return valid && sidedInv != null ? sidedInv.canInsertItem(slotNumber, stack, 6) : valid; - } - -} diff --git a/src/main/java/techreborn/cofhLib/gui/slot/SlotAcceptValid.java b/src/main/java/techreborn/cofhLib/gui/slot/SlotAcceptValid.java deleted file mode 100755 index 3fa06a265..000000000 --- a/src/main/java/techreborn/cofhLib/gui/slot/SlotAcceptValid.java +++ /dev/null @@ -1,23 +0,0 @@ -package techreborn.cofhLib.gui.slot; - -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; - -/** - * Slot that will only accept ItemStacks when the IInventory returns true from isItemValidForSlot. - */ -public class SlotAcceptValid extends Slot { - - public SlotAcceptValid(IInventory inventory, int index, int x, int y) { - - super(inventory, index, x, y); - } - - @Override - public boolean isItemValid(ItemStack stack) { - - return stack != null && this.inventory.isItemValidForSlot(this.slotNumber, stack); - } - -} diff --git a/src/main/java/techreborn/cofhLib/gui/slot/SlotCraftingLocked.java b/src/main/java/techreborn/cofhLib/gui/slot/SlotCraftingLocked.java deleted file mode 100755 index aabd9531a..000000000 --- a/src/main/java/techreborn/cofhLib/gui/slot/SlotCraftingLocked.java +++ /dev/null @@ -1,32 +0,0 @@ -package techreborn.cofhLib.gui.slot; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.SlotCrafting; -import net.minecraft.item.ItemStack; - -/** - * Crafting result slot where the result cannot be removed. - * - * @author King Lemming - */ -public class SlotCraftingLocked extends SlotCrafting { - - public SlotCraftingLocked(EntityPlayer player, IInventory craftMatrix, IInventory inventory, int index, int x, int y) { - - super(player, craftMatrix, inventory, index, x, y); - } - - @Override - public boolean isItemValid(ItemStack stack) { - - return false; - } - - @Override - public boolean canTakeStack(EntityPlayer player) { - - return false; - } - -} diff --git a/src/main/java/techreborn/cofhLib/gui/slot/SlotFalseCopy.java b/src/main/java/techreborn/cofhLib/gui/slot/SlotFalseCopy.java deleted file mode 100755 index a1995cca6..000000000 --- a/src/main/java/techreborn/cofhLib/gui/slot/SlotFalseCopy.java +++ /dev/null @@ -1,45 +0,0 @@ -package techreborn.cofhLib.gui.slot; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; - -/** - * Slot which copies an ItemStack when clicked on, does not decrement the ItemStack on the cursor. - * - * @author King Lemming - */ -public class SlotFalseCopy extends Slot { - - public int slotIndex = 0; - - public SlotFalseCopy(IInventory inventory, int index, int x, int y) { - - super(inventory, index, x, y); - slotIndex = index; - } - - @Override - public boolean canTakeStack(EntityPlayer player) { - - return false; - } - - @Override - public boolean isItemValid(ItemStack stack) { - - return true; - } - - @Override - public void putStack(ItemStack stack) { - - if (stack != null) { - stack.stackSize = 1; - } - this.inventory.setInventorySlotContents(this.slotIndex, stack); - this.onSlotChanged(); - } - -} diff --git a/src/main/java/techreborn/cofhLib/gui/slot/SlotInvisible.java b/src/main/java/techreborn/cofhLib/gui/slot/SlotInvisible.java deleted file mode 100755 index d8daee6df..000000000 --- a/src/main/java/techreborn/cofhLib/gui/slot/SlotInvisible.java +++ /dev/null @@ -1,57 +0,0 @@ -package techreborn.cofhLib.gui.slot; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; - -/** - * Slot that will redirect inserts to another inventory slot (other than index), but not be visible. - *

- * Used primarily for containers that have a larger internal inventory than external (e.g., DeepStorageUnit) - */ -public class SlotInvisible extends Slot { - - protected final int slotIndex; - - public SlotInvisible(IInventory inventory, int index, int x, int y, int slot) { - - super(inventory, index, x, y); - slotIndex = slot; - } - - @Override - public void putStack(ItemStack stack) { - - this.inventory.setInventorySlotContents(slotIndex, stack); - this.onSlotChanged(); - } - - @Override - public ItemStack getStack() { - - return null; - } - - @Override - public ItemStack decrStackSize(int par1) { - - return null; - } - - @Override - public boolean canTakeStack(EntityPlayer p) { - - return false; - } - - @Override - @SideOnly(Side.CLIENT) - public boolean func_111238_b() { - - return false; - } - -} diff --git a/src/main/java/techreborn/cofhLib/gui/slot/SlotPotion.java b/src/main/java/techreborn/cofhLib/gui/slot/SlotPotion.java deleted file mode 100755 index 04a81f20f..000000000 --- a/src/main/java/techreborn/cofhLib/gui/slot/SlotPotion.java +++ /dev/null @@ -1,24 +0,0 @@ -package techreborn.cofhLib.gui.slot; - -import net.minecraft.init.Items; -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; - -/** - * Slot that will only accept Potions. - */ -public class SlotPotion extends Slot { - - public SlotPotion(IInventory inventory, int index, int x, int y) { - - super(inventory, index, x, y); - } - - @Override - public boolean isItemValid(ItemStack stack) { - - return stack != null && stack.getItem().equals(Items.potionitem); - } - -} diff --git a/src/main/java/techreborn/cofhLib/gui/slot/SlotPotionIngredient.java b/src/main/java/techreborn/cofhLib/gui/slot/SlotPotionIngredient.java deleted file mode 100755 index 4fa0376ac..000000000 --- a/src/main/java/techreborn/cofhLib/gui/slot/SlotPotionIngredient.java +++ /dev/null @@ -1,23 +0,0 @@ -package techreborn.cofhLib.gui.slot; - -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; - -/** - * Slot that will only accept Potion Ingredients. - */ -public class SlotPotionIngredient extends Slot { - - public SlotPotionIngredient(IInventory inventory, int index, int x, int y) { - - super(inventory, index, x, y); - } - - @Override - public boolean isItemValid(ItemStack stack) { - - return stack != null && stack.getItem().isPotionIngredient(stack); - } - -} diff --git a/src/main/java/techreborn/cofhLib/gui/slot/SlotRemoveOnly.java b/src/main/java/techreborn/cofhLib/gui/slot/SlotRemoveOnly.java deleted file mode 100755 index 5e77cd0bd..000000000 --- a/src/main/java/techreborn/cofhLib/gui/slot/SlotRemoveOnly.java +++ /dev/null @@ -1,23 +0,0 @@ -package techreborn.cofhLib.gui.slot; - -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; - -/** - * Slot which players can only remove items from. - */ -public class SlotRemoveOnly extends Slot { - - public SlotRemoveOnly(IInventory inventory, int index, int x, int y) { - - super(inventory, index, x, y); - } - - @Override - public boolean isItemValid(ItemStack stack) { - - return false; - } - -} diff --git a/src/main/java/techreborn/cofhLib/gui/slot/SlotValidated.java b/src/main/java/techreborn/cofhLib/gui/slot/SlotValidated.java deleted file mode 100755 index 21c7bec02..000000000 --- a/src/main/java/techreborn/cofhLib/gui/slot/SlotValidated.java +++ /dev/null @@ -1,28 +0,0 @@ -package techreborn.cofhLib.gui.slot; - -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; - -/** - * A slot where the input can be validated based on any arbitrary criteria by using a passthrough method to an {@link ISlotValidator}. - * - * @author King Lemming - */ -public class SlotValidated extends Slot { - - ISlotValidator validator; - - public SlotValidated(ISlotValidator validator, IInventory inventory, int index, int x, int y) { - - super(inventory, index, x, y); - this.validator = validator; - } - - @Override - public boolean isItemValid(ItemStack stack) { - - return validator.isItemValid(stack); - } - -} diff --git a/src/main/java/techreborn/cofhLib/gui/slot/SlotViewOnly.java b/src/main/java/techreborn/cofhLib/gui/slot/SlotViewOnly.java deleted file mode 100755 index d52c65110..000000000 --- a/src/main/java/techreborn/cofhLib/gui/slot/SlotViewOnly.java +++ /dev/null @@ -1,58 +0,0 @@ -package techreborn.cofhLib.gui.slot; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; - -/** - * A slot that can only be used to display an item, not edited. Can optionally not highlight when moused over. - */ -public class SlotViewOnly extends Slot { - - protected boolean showHighlight; - - public SlotViewOnly(IInventory inventory, int index, int x, int y) { - - this(inventory, index, x, y, false); - } - - public SlotViewOnly(IInventory inventory, int index, int x, int y, boolean highlight) { - - super(inventory, index, x, y); - showHighlight = highlight; - } - - @Override - public void putStack(ItemStack stack) { - - } - - @Override - public ItemStack decrStackSize(int i) { - - return null; - } - - @Override - public boolean canTakeStack(EntityPlayer player) { - - return false; - } - - @Override - public boolean isItemValid(ItemStack stack) { - - return false; - } - - @Override - @SideOnly(Side.CLIENT) - public boolean func_111238_b() { - - return showHighlight; - } - -} \ No newline at end of file diff --git a/src/main/java/techreborn/cofhLib/render/RenderHelper.java b/src/main/java/techreborn/cofhLib/render/RenderHelper.java deleted file mode 100755 index 3486b7ded..000000000 --- a/src/main/java/techreborn/cofhLib/render/RenderHelper.java +++ /dev/null @@ -1,176 +0,0 @@ -package techreborn.cofhLib.render; - -import net.minecraft.block.Block; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.ItemRenderer; -import net.minecraft.client.renderer.RenderBlocks; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.texture.TextureManager; -import net.minecraft.init.Blocks; -import net.minecraft.item.ItemStack; -import net.minecraft.util.IIcon; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidRegistry; -import net.minecraftforge.fluids.FluidStack; -import org.lwjgl.opengl.GL11; - -/** - * Contains various helper functions to assist with rendering. - * - * @author King Lemming - */ -public final class RenderHelper { - - public static final double RENDER_OFFSET = 1.0D / 1024.0D; - public static final ResourceLocation MC_BLOCK_SHEET = new ResourceLocation("textures/atlas/blocks.png"); - public static final ResourceLocation MC_ITEM_SHEET = new ResourceLocation("textures/atlas/items.png"); - public static final ResourceLocation MC_FONT_DEFAULT = new ResourceLocation("textures/font/ascii.png"); - public static final ResourceLocation MC_FONT_ALTERNATE = new ResourceLocation("textures/font/ascii_sga.png"); - public static final ResourceLocation MC_ITEM_GLINT = new ResourceLocation("textures/misc/enchanted_item_glint.png"); - - private RenderHelper() { - - } - - public static final TextureManager engine() { - - return Minecraft.getMinecraft().renderEngine; - } - - public static final Tessellator tessellator() { - - return Tessellator.instance; - } - - public static void setColor3ub(int color) { - - GL11.glColor3ub((byte) (color >> 16 & 0xFF), (byte) (color >> 8 & 0xFF), (byte) (color & 0xFF)); - } - - public static void setColor4ub(int color) { - - GL11.glColor4ub((byte) (color >> 24 & 0xFF), (byte) (color >> 16 & 0xFF), (byte) (color >> 8 & 0xFF), (byte) (color & 0xFF)); - } - - public static void resetColor() { - - GL11.glColor4f(1F, 1F, 1F, 1F); - } - - public static void renderItemAsBlock(RenderBlocks renderer, ItemStack item, double translateX, double translateY, double translateZ) { - - renderTextureAsBlock(renderer, item.getIconIndex(), translateX, translateY, translateZ); - } - - public static void renderTextureAsBlock(RenderBlocks renderer, IIcon texture, double translateX, double translateY, double translateZ) { - - Tessellator tessellator = Tessellator.instance; - Block block = Blocks.stone; - - if (texture == null) { - return; - } - renderer.setRenderBoundsFromBlock(block); - GL11.glTranslated(translateX, translateY, translateZ); - tessellator.startDrawingQuads(); - - tessellator.setNormal(0.0F, -1.0F, 0.0F); - renderer.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, texture); - - tessellator.setNormal(0.0F, 1.0F, 0.0F); - renderer.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, texture); - - tessellator.setNormal(0.0F, 0.0F, -1.0F); - renderer.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, texture); - - tessellator.setNormal(0.0F, 0.0F, 1.0F); - renderer.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, texture); - - tessellator.setNormal(-1.0F, 0.0F, 0.0F); - renderer.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, texture); - - tessellator.setNormal(1.0F, 0.0F, 0.0F); - renderer.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, texture); - - tessellator.draw(); - } - - public static void renderItemIn2D(IIcon icon) { - - ItemRenderer.renderItemIn2D(Tessellator.instance, icon.getMaxU(), icon.getMinV(), icon.getMinU(), icon.getMaxV(), icon.getIconWidth(), icon.getIconHeight(), 0.0625F); - } - - public static void renderIcon(IIcon icon, double z) { - - Tessellator.instance.startDrawingQuads(); - Tessellator.instance.addVertexWithUV(0, 16, z, icon.getMinU(), icon.getMaxV()); - Tessellator.instance.addVertexWithUV(16, 16, z, icon.getMaxU(), icon.getMaxV()); - Tessellator.instance.addVertexWithUV(16, 0, z, icon.getMaxU(), icon.getMinV()); - Tessellator.instance.addVertexWithUV(0, 0, z, icon.getMinU(), icon.getMinV()); - Tessellator.instance.draw(); - } - - public static void renderIcon(double x, double y, double z, IIcon icon, int width, int height) { - - Tessellator tessellator = Tessellator.instance; - tessellator.startDrawingQuads(); - tessellator.addVertexWithUV(x, y + height, z, icon.getMinU(), icon.getMaxV()); - tessellator.addVertexWithUV(x + width, y + height, z, icon.getMaxU(), icon.getMaxV()); - tessellator.addVertexWithUV(x + width, y, z, icon.getMaxU(), icon.getMinV()); - tessellator.addVertexWithUV(x, y, z, icon.getMinU(), icon.getMinV()); - tessellator.draw(); - } - - public static final IIcon getFluidTexture(Fluid fluid) { - - if (fluid == null) { - return FluidRegistry.LAVA.getIcon(); - } - return fluid.getIcon(); - } - - public static final IIcon getFluidTexture(FluidStack fluid) { - - if (fluid == null || fluid.getFluid() == null || fluid.getFluid().getIcon(fluid) == null) { - return FluidRegistry.LAVA.getIcon(); - } - return fluid.getFluid().getIcon(fluid); - } - - public static final void bindItemTexture(ItemStack stack) { - - engine().bindTexture(stack.getItemSpriteNumber() == 0 ? MC_BLOCK_SHEET : MC_ITEM_SHEET); - } - - public static final void bindTexture(ResourceLocation texture) { - - engine().bindTexture(texture); - } - - public static final void setBlockTextureSheet() { - - bindTexture(MC_BLOCK_SHEET); - } - - public static final void setItemTextureSheet() { - - bindTexture(MC_ITEM_SHEET); - } - - public static final void setDefaultFontTextureSheet() { - - bindTexture(MC_FONT_DEFAULT); - } - - public static final void setSGAFontTextureSheet() { - - bindTexture(MC_FONT_ALTERNATE); - } - - public static final void enableGUIStandardItemLighting() { - - net.minecraft.client.renderer.RenderHelper.enableGUIStandardItemLighting(); - } - -} diff --git a/src/main/java/techreborn/cofhLib/util/CharacterSingleton.java b/src/main/java/techreborn/cofhLib/util/CharacterSingleton.java deleted file mode 100755 index 0c1c3b870..000000000 --- a/src/main/java/techreborn/cofhLib/util/CharacterSingleton.java +++ /dev/null @@ -1,29 +0,0 @@ -package techreborn.cofhLib.util; - -public class CharacterSingleton implements CharSequence { - - public char character; - - @Override - public int length() { - - return 1; - } - - @Override - public char charAt(int index) { - - return character; - } - - @Override - public CharSequence subSequence(int start, int end) { - - if (start == end) { - return ""; - } - return this; - } - -} - diff --git a/src/main/java/techreborn/cofhLib/util/Rectangle4i.java b/src/main/java/techreborn/cofhLib/util/Rectangle4i.java deleted file mode 100755 index 423e77cab..000000000 --- a/src/main/java/techreborn/cofhLib/util/Rectangle4i.java +++ /dev/null @@ -1,117 +0,0 @@ -package techreborn.cofhLib.util; - -/** - * Generic rectangle class. - * - * @author Chicken Bones - */ -public class Rectangle4i { - - public int x; - public int y; - public int w; - public int h; - - public Rectangle4i() { - - } - - public Rectangle4i(int x, int y, int w, int h) { - - this.x = x; - this.y = y; - this.w = w; - this.h = h; - } - - public int x1() { - - return x; - } - - public int y1() { - - return y; - } - - public int x2() { - - return x + w - 1; - } - - public int y2() { - - return y + h - 1; - } - - public void set(int x, int y, int w, int h) { - - this.x = x; - this.y = y; - this.w = w; - this.h = h; - } - - public Rectangle4i offset(int dx, int dy) { - - x += dx; - y += dy; - return this; - } - - public Rectangle4i include(int px, int py) { - - if (px < x) { - expand(px - x, 0); - } - if (px >= x + w) { - expand(px - x - w + 1, 0); - } - if (py < y) { - expand(0, py - y); - } - if (py >= y + h) { - expand(0, py - y - h + 1); - } - return this; - } - - public Rectangle4i include(Rectangle4i r) { - - include(r.x, r.y); - return include(r.x2(), r.y2()); - } - - public Rectangle4i expand(int px, int py) { - - if (px > 0) { - w += px; - } else { - x += px; - w -= px; - } - if (py > 0) { - h += py; - } else { - y += py; - h -= py; - } - return this; - } - - public boolean contains(int px, int py) { - - return x <= px && px < x + w && y <= py && py < y + h; - } - - public boolean intersects(Rectangle4i r) { - - return r.x + r.w > x && r.x < x + w && r.y + r.h > y && r.y < y + h; - } - - public int area() { - - return w * h; - } - -} diff --git a/src/main/java/techreborn/cofhLib/util/helpers/MathHelper.java b/src/main/java/techreborn/cofhLib/util/helpers/MathHelper.java deleted file mode 100755 index ea9fb4ab6..000000000 --- a/src/main/java/techreborn/cofhLib/util/helpers/MathHelper.java +++ /dev/null @@ -1,206 +0,0 @@ -package techreborn.cofhLib.util.helpers; - -import java.util.Random; - -/** - * Contains various math-related helper functions. Often faster than conventional implementations. - * - * @author King Lemming - */ -public final class MathHelper { - - private MathHelper() { - - } - - public static final Random RANDOM = new Random(); - public static final double PHI = 1.618034; - public static final double[] SIN_TABLE = new double[65536]; - - static { - for (int i = 0; i < 65536; i++) { - SIN_TABLE[i] = Math.sin(i / 65536D * 2 * Math.PI); - } - SIN_TABLE[0] = 0; - SIN_TABLE[16384] = 1; - SIN_TABLE[32768] = 0; - SIN_TABLE[49152] = 1; - } - - public static double sin(double d) { - - return SIN_TABLE[(int) ((float) d * 10430.378F) & 65535]; - } - - public static double cos(double d) { - - return SIN_TABLE[(int) ((float) d * 10430.378F + 16384.0F) & 65535]; - } - - public static int clampI(int a, int min, int max) { - - return a < min ? min : (a > max ? max : a); - } - - public static float clampF(float a, float min, float max) { - - return a < min ? min : (a > max ? max : a); - } - - public static float approachLinear(float a, float b, float max) { - - return a > b ? a - b < max ? b : a - max : b - a < max ? b : a + max; - } - - public static double approachLinear(double a, double b, double max) { - - return a > b ? a - b < max ? b : a - max : b - a < max ? b : a + max; - } - - public static float interpolate(float a, float b, float d) { - - return a + (b - a) * d; - } - - public static double interpolate(double a, double b, double d) { - - return a + (b - a) * d; - } - - public static double approachExp(double a, double b, double ratio) { - - return a + (b - a) * ratio; - } - - public static double approachExp(double a, double b, double ratio, double cap) { - - double d = (b - a) * ratio; - - if (Math.abs(d) > cap) { - d = Math.signum(d) * cap; - } - return a + d; - } - - public static double retreatExp(double a, double b, double c, double ratio, double kick) { - - double d = (Math.abs(c - a) + kick) * ratio; - - if (d > Math.abs(b - a)) { - return b; - } - return a + Math.signum(b - a) * d; - } - - public static double clip(double value, double min, double max) { - - if (value > max) { - value = max; - } else if (value < min) { - value = min; - } - return value; - } - - public static boolean between(double a, double x, double b) { - - return a <= x && x <= b; - } - - public static int approachExpI(int a, int b, double ratio) { - - int r = (int) Math.round(approachExp(a, b, ratio)); - return r == a ? b : r; - } - - public static int retreatExpI(int a, int b, int c, double ratio, int kick) { - - int r = (int) Math.round(retreatExp(a, b, c, ratio, kick)); - return r == a ? b : r; - } - - /** - * Unchecked implementation to round a number. Parameter should be known to be valid in advance. - */ - public static int round(double d) { - - return (int) (d + 0.5D); - } - - /** - * Unchecked implementation to round a number up. Parameter should be known to be valid in advance. - */ - public static int ceil(double d) { - - return (int) (d + 0.9999D); - } - - /** - * Unchecked implementation to round a number down. Parameter should be known to be valid in advance. - */ - public static int floor(double d) { - - int i = (int) d; - return d < i ? i - 1 : i; - } - - /** - * Unchecked implementation to determine the smaller of two Floats. Parameters should be known to be valid in advance. - */ - public static float minF(float a, float b) { - - return a < b ? a : b; - } - - public static float minF(int a, float b) { - - return a < b ? a : b; - } - - public static float minF(float a, int b) { - - return a < b ? a : b; - } - - /** - * Unchecked implementation to determine the larger of two Floats. Parameters should be known to be valid in advance. - */ - public static float maxF(float a, float b) { - - return a > b ? a : b; - } - - public static float maxF(int a, float b) { - - return a > b ? a : b; - } - - public static float maxF(float a, int b) { - - return a > b ? a : b; - } - - public static double maxAbs(double a, double b) { - - if (a < 0.0D) { - a = -a; - } - if (b < 0.0D) { - b = -b; - } - return a > b ? a : b; - } - - public static int setBit(int mask, int bit, boolean value) { - - mask |= (value ? 1 : 0) << bit; - return mask; - } - - public static boolean isBitSet(int mask, int bit) { - - return (mask & 1 << bit) != 0; - } - -} - diff --git a/src/main/java/techreborn/cofhLib/util/helpers/StringHelper.java b/src/main/java/techreborn/cofhLib/util/helpers/StringHelper.java deleted file mode 100755 index 771dff501..000000000 --- a/src/main/java/techreborn/cofhLib/util/helpers/StringHelper.java +++ /dev/null @@ -1,222 +0,0 @@ -package techreborn.cofhLib.util.helpers; - -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.item.EnumRarity; -import net.minecraft.item.ItemStack; -import net.minecraft.util.StatCollector; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; -import org.lwjgl.input.Keyboard; - -import java.util.List; - -/** - * Contains various helper functions to assist with String manipulation. - * - * @author King Lemming - */ -public final class StringHelper { - - private StringHelper() { - - } - - /* KEY HELPERS */ - public static boolean isAltKeyDown() { - - return Keyboard.isKeyDown(Keyboard.KEY_LMENU) || Keyboard.isKeyDown(Keyboard.KEY_RMENU); - } - - public static boolean isControlKeyDown() { - - return Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) || Keyboard.isKeyDown(Keyboard.KEY_RCONTROL); - } - - public static boolean isShiftKeyDown() { - - return Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT); - } - - /* FORMAT HELPERS */ - public static int getSplitStringHeight(FontRenderer fontRenderer, String input, int width) { - - @SuppressWarnings("rawtypes") List stringRows = fontRenderer.listFormattedStringToWidth(input, width); - return stringRows.size() * fontRenderer.FONT_HEIGHT; - } - - public static String camelCase(String input) { - - return input.substring(0, 1).toLowerCase() + input.substring(1); - } - - public static String titleCase(String input) { - - return input.substring(0, 1).toUpperCase() + input.substring(1); - } - - public static String localize(String key) { - - return StatCollector.translateToLocal(key); - } - - public static String getFluidName(FluidStack stack) { - - Fluid fluid = stack.getFluid(); - - String name = "" + END; - if (fluid.getRarity() == EnumRarity.uncommon) { - name += YELLOW; - } else if (fluid.getRarity() == EnumRarity.rare) { - name += BRIGHT_BLUE; - } else if (fluid.getRarity() == EnumRarity.epic) { - name += PINK; - } - name += fluid.getLocalizedName(stack) + END; - - return name; - } - - public static String getFluidName(FluidStack stack, String defaultName) { - - if (stack == null) { - return defaultName; - } - return getFluidName(stack); - } - - public static String getItemName(ItemStack stack) { - - String name = "" + END; - if (stack.getRarity() == EnumRarity.uncommon) { - name += YELLOW; - } else if (stack.getRarity() == EnumRarity.rare) { - name += BRIGHT_BLUE; - } else if (stack.getRarity() == EnumRarity.epic) { - name += PINK; - } - name += stack.getDisplayName() + END; - - return name; - } - - public static String getScaledNumber(long number) { - - if (number >= 1000000000) { - return number / 1000000000 + "." + (number % 1000000000 / 10000000) + "G"; - } else if (number >= 1000000) { - return number / 1000000 + "." + (number % 1000000 / 10000) + "M"; - } else if (number >= 1000) { - return number / 1000 + "." + (number % 1000 / 10) + "k"; - } else { - return String.valueOf(number); - } - } - - @Deprecated - public static String getScaledNumber(long number, int minDigits) { - - return getScaledNumber(number); - } - - /* ITEM TEXT HELPERS */ - public static String getActivationText(String key) { - - return BRIGHT_BLUE + localize(key) + END; - } - - public static String getDeactivationText(String key) { - - return YELLOW + localize(key) + END; - } - - public static String getInfoText(String key) { - - return BRIGHT_GREEN + localize(key) + END; - } - - public static String getFlavorText(String key) { - - return LIGHT_GRAY + ITALIC + localize(key) + END; - } - - public static String getRarity(int level) { - - switch (level) { - case 2: - return StringHelper.YELLOW; - case 3: - return StringHelper.BRIGHT_BLUE; - default: - return StringHelper.LIGHT_GRAY; - } - } - - public static String shiftForDetails() { - - return LIGHT_GRAY + localize("info.cofh.hold") + " " + YELLOW + ITALIC + localize("info.cofh.shift") + " " + END + LIGHT_GRAY + localize("info.cofh.forDetails") + END; - } - - /* TUTORIAL TAB HELPERS */ - public static String tutorialTabAugment() { - - return localize("info.cofh.tutorial.tabAugment"); - } - - public static String tutorialTabConfiguration() { - - return localize("info.cofh.tutorial.tabConfiguration.0"); - } - - public static String tutorialTabOperation() { - - return localize("info.cofh.tutorial.tabConfiguration.1"); - } - - public static String tutorialTabRedstone() { - - return localize("info.cofh.tutorial.tabRedstone"); - } - - public static String tutorialTabSecurity() { - - return localize("info.cofh.tutorial.tabSecurity"); - } - - public static String tutorialTabFluxRequired() { - - return localize("info.cofh.tutorial.fluxRequired"); - } - - /** - * When formatting a string, always apply color before font modification. - */ - public static final String BLACK = (char) 167 + "0"; - public static final String BLUE = (char) 167 + "1"; - public static final String GREEN = (char) 167 + "2"; - public static final String TEAL = (char) 167 + "3"; - public static final String RED = (char) 167 + "4"; - public static final String PURPLE = (char) 167 + "5"; - public static final String ORANGE = (char) 167 + "6"; - public static final String LIGHT_GRAY = (char) 167 + "7"; - public static final String GRAY = (char) 167 + "8"; - public static final String LIGHT_BLUE = (char) 167 + "9"; - public static final String BRIGHT_GREEN = (char) 167 + "a"; - public static final String BRIGHT_BLUE = (char) 167 + "b"; - public static final String LIGHT_RED = (char) 167 + "c"; - public static final String PINK = (char) 167 + "d"; - public static final String YELLOW = (char) 167 + "e"; - public static final String WHITE = (char) 167 + "f"; - - public static final String OBFUSCATED = (char) 167 + "k"; - public static final String BOLD = (char) 167 + "l"; - public static final String STRIKETHROUGH = (char) 167 + "m"; - public static final String UNDERLINE = (char) 167 + "n"; - public static final String ITALIC = (char) 167 + "o"; - public static final String END = (char) 167 + "r"; - - public static final String[] ROMAN_NUMERAL = {"", "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX", "X"}; - - public static boolean displayShiftForDetail = true; - public static boolean displayStackCount = false; - -} diff --git a/src/main/java/techreborn/command/TechRebornDevCommand.java b/src/main/java/techreborn/command/TechRebornDevCommand.java index d7a80a1a2..599686e4b 100644 --- a/src/main/java/techreborn/command/TechRebornDevCommand.java +++ b/src/main/java/techreborn/command/TechRebornDevCommand.java @@ -5,13 +5,11 @@ import net.minecraft.command.CommandBase; import net.minecraft.command.ICommandSender; import net.minecraft.util.ChatComponentText; import net.minecraftforge.fluids.Fluid; -import techreborn.api.fuel.FluidPowerManager; +import reborncore.api.fuel.FluidPowerManager; import techreborn.api.recipe.RecipeHandler; import techreborn.partSystem.IModPart; import techreborn.partSystem.ModPartRegistry; -import java.util.Objects; - public class TechRebornDevCommand extends CommandBase { @Override @@ -38,17 +36,17 @@ public class TechRebornDevCommand extends CommandBase { sender.addChatMessage(new ChatComponentText("fluid - Lists the fluid power values")); } else if ("recipes".equals(args[0])) { sender.addChatMessage(new ChatComponentText(RecipeHandler.recipeList.size() + " recipes loaded")); - } else if ("fluid".equals(args[0])){ - for(Object object : FluidPowerManager.fluidPowerValues.keySet().toArray()){ - if(object instanceof Fluid){ + } else if ("fluid".equals(args[0])) { + for (Object object : FluidPowerManager.fluidPowerValues.keySet().toArray()) { + if (object instanceof Fluid) { Fluid fluid = (Fluid) object; sender.addChatMessage(new ChatComponentText(fluid.getUnlocalizedName() + " : " + FluidPowerManager.fluidPowerValues.get(fluid))); } else { sender.addChatMessage(new ChatComponentText("Found invalid fluid entry")); } } - } else if ("parts".equals(args[0])){ - for (IModPart part : ModPartRegistry.parts){ + } else if ("parts".equals(args[0])) { + for (IModPart part : ModPartRegistry.parts) { sender.addChatMessage(new ChatComponentText(part.getName())); } } diff --git a/src/main/java/techreborn/compat/CompatManager.java b/src/main/java/techreborn/compat/CompatManager.java index 63428d81b..6502511a8 100644 --- a/src/main/java/techreborn/compat/CompatManager.java +++ b/src/main/java/techreborn/compat/CompatManager.java @@ -35,10 +35,10 @@ public class CompatManager { } public void registerCompact(Class moduleClass, Object... objs) { - for(Object obj : objs){ - if(obj instanceof String){ + for (Object obj : objs) { + if (obj instanceof String) { String modid = (String) obj; - if(modid.startsWith("!")){ + if (modid.startsWith("!")) { if (Loader.isModLoaded(modid.replaceAll("!", ""))) { return; } @@ -47,11 +47,12 @@ public class CompatManager { return; } } - } else if(obj instanceof Boolean){ + } else if (obj instanceof Boolean) { Boolean boo = (Boolean) obj; - if(boo == false){} - return; + if (boo == false) { } + return; + } } try { compatModules.add((ICompatModule) moduleClass.newInstance()); @@ -62,11 +63,11 @@ public class CompatManager { } } - public boolean isForestry4(){ + public boolean isForestry4() { try { Class.forName("forestry.api.arboriculture.EnumWoodType"); return true; - } catch( ClassNotFoundException e ) { + } catch (ClassNotFoundException e) { return false; } } diff --git a/src/main/java/techreborn/compat/minetweaker/MTAlloySmelter.java b/src/main/java/techreborn/compat/minetweaker/MTAlloySmelter.java index 27ec75afd..7fdd2ec37 100644 --- a/src/main/java/techreborn/compat/minetweaker/MTAlloySmelter.java +++ b/src/main/java/techreborn/compat/minetweaker/MTAlloySmelter.java @@ -5,14 +5,13 @@ import minetweaker.MineTweakerAPI; import minetweaker.api.item.IIngredient; import minetweaker.api.item.IItemStack; import net.minecraft.item.ItemStack; +import reborncore.common.util.ItemUtils; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; import techreborn.api.recipe.IBaseRecipeType; import techreborn.api.recipe.RecipeHandler; import techreborn.api.recipe.machines.AlloySmelterRecipe; import techreborn.lib.Reference; -import techreborn.util.CraftingHelper; -import techreborn.util.ItemUtils; import java.util.ArrayList; import java.util.List; @@ -25,111 +24,110 @@ import java.util.List; public class MTAlloySmelter { - @ZenMethod - public static void addRecipe(IItemStack output, IIngredient input1, IIngredient input2, int ticktime, int euTick) { - ItemStack oInput1 = (ItemStack) MinetweakerCompat.toObject(input1); - ItemStack oInput2 = (ItemStack) MinetweakerCompat.toObject(input2); + @ZenMethod + public static void addRecipe(IItemStack output, IIngredient input1, IIngredient input2, int ticktime, int euTick) { + ItemStack oInput1 = (ItemStack) MinetweakerCompat.toObject(input1); + ItemStack oInput2 = (ItemStack) MinetweakerCompat.toObject(input2); - AlloySmelterRecipe r = new AlloySmelterRecipe(oInput1, oInput2, MinetweakerCompat.toStack(output), ticktime, euTick); + AlloySmelterRecipe r = new AlloySmelterRecipe(oInput1, oInput2, MinetweakerCompat.toStack(output), ticktime, euTick); - MineTweakerAPI.apply(new Add(r)); - } + MineTweakerAPI.apply(new Add(r)); + } - private static class Add implements IUndoableAction { - private final AlloySmelterRecipe recipe; + private static class Add implements IUndoableAction { + private final AlloySmelterRecipe recipe; - public Add(AlloySmelterRecipe recipe) { - this.recipe = recipe; - } + public Add(AlloySmelterRecipe recipe) { + this.recipe = recipe; + } - @Override - public void apply() { - RecipeHandler.addRecipe(recipe); - } + @Override + public void apply() { + RecipeHandler.addRecipe(recipe); + } - @Override - public boolean canUndo() { - return true; - } + @Override + public boolean canUndo() { + return true; + } - @Override - public void undo() { - RecipeHandler.recipeList.remove(recipe); - } + @Override + public void undo() { + RecipeHandler.recipeList.remove(recipe); + } - @Override - public String describe() { - return "Adding Alloy Smelter Recipe for " + recipe.getOutput(0).getDisplayName(); - } + @Override + public String describe() { + return "Adding Alloy Smelter Recipe for " + recipe.getOutput(0).getDisplayName(); + } - @Override - public String describeUndo() { - return "Removing Alloy Smelter Recipe for " + recipe.getOutput(0).getDisplayName(); - } + @Override + public String describeUndo() { + return "Removing Alloy Smelter Recipe for " + recipe.getOutput(0).getDisplayName(); + } - @Override - public Object getOverrideKey() { - return null; - } - } + @Override + public Object getOverrideKey() { + return null; + } + } - @ZenMethod - public static void removeRecipe(IItemStack output) - { - MineTweakerAPI.apply(new Remove(MinetweakerCompat.toStack(output))); - } - private static class Remove implements IUndoableAction - { - private final ItemStack output; - List removedRecipes = new ArrayList(); - public Remove(ItemStack output) - { - this.output = output; - } - @Override - public void apply() - { - for(IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(Reference.alloySmelteRecipe)){ - for(ItemStack stack : recipeType.getOutputs()){ - if(ItemUtils.isItemEqual(stack, output, true, false)){ - removedRecipes.add((AlloySmelterRecipe) recipeType); - RecipeHandler.recipeList.remove(recipeType); - break; - } - } - } - } - @Override - public void undo() - { - if(removedRecipes!=null){ - for(AlloySmelterRecipe recipe : removedRecipes){ - if(recipe!=null){ - RecipeHandler.addRecipe(recipe); - } - } - } + @ZenMethod + public static void removeRecipe(IItemStack output) { + MineTweakerAPI.apply(new Remove(MinetweakerCompat.toStack(output))); + } - } - @Override - public String describe() - { - return "Removing Alloy Smelter Recipe for " + output.getDisplayName(); - } - @Override - public String describeUndo() - { - return "Re-Adding Alloy Smelter Recipe for " + output.getDisplayName(); - } - @Override - public Object getOverrideKey() - { - return null; - } - @Override - public boolean canUndo() - { - return true; - } - } + private static class Remove implements IUndoableAction { + private final ItemStack output; + List removedRecipes = new ArrayList(); + + public Remove(ItemStack output) { + this.output = output; + } + + @Override + public void apply() { + for (IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(Reference.alloySmelteRecipe)) { + for (ItemStack stack : recipeType.getOutputs()) { + if (ItemUtils.isItemEqual(stack, output, true, false)) { + removedRecipes.add((AlloySmelterRecipe) recipeType); + RecipeHandler.recipeList.remove(recipeType); + break; + } + } + } + } + + @Override + public void undo() { + if (removedRecipes != null) { + for (AlloySmelterRecipe recipe : removedRecipes) { + if (recipe != null) { + RecipeHandler.addRecipe(recipe); + } + } + } + + } + + @Override + public String describe() { + return "Removing Alloy Smelter Recipe for " + output.getDisplayName(); + } + + @Override + public String describeUndo() { + return "Re-Adding Alloy Smelter Recipe for " + output.getDisplayName(); + } + + @Override + public Object getOverrideKey() { + return null; + } + + @Override + public boolean canUndo() { + return true; + } + } } diff --git a/src/main/java/techreborn/compat/minetweaker/MTAssemblingMachine.java b/src/main/java/techreborn/compat/minetweaker/MTAssemblingMachine.java index a15257e73..65250ab67 100644 --- a/src/main/java/techreborn/compat/minetweaker/MTAssemblingMachine.java +++ b/src/main/java/techreborn/compat/minetweaker/MTAssemblingMachine.java @@ -5,13 +5,13 @@ import minetweaker.MineTweakerAPI; import minetweaker.api.item.IIngredient; import minetweaker.api.item.IItemStack; import net.minecraft.item.ItemStack; +import reborncore.common.util.ItemUtils; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; import techreborn.api.recipe.IBaseRecipeType; import techreborn.api.recipe.RecipeHandler; import techreborn.api.recipe.machines.AssemblingMachineRecipe; import techreborn.lib.Reference; -import techreborn.util.ItemUtils; import java.util.ArrayList; import java.util.List; @@ -19,111 +19,110 @@ import java.util.List; @ZenClass("mods.techreborn.assemblingMachine") public class MTAssemblingMachine { - @ZenMethod - public static void addRecipe(IItemStack output, IIngredient input1, IIngredient input2, int ticktime, int euTick) { - ItemStack oInput1 = (ItemStack) MinetweakerCompat.toObject(input1); - ItemStack oInput2 = (ItemStack) MinetweakerCompat.toObject(input2); + @ZenMethod + public static void addRecipe(IItemStack output, IIngredient input1, IIngredient input2, int ticktime, int euTick) { + ItemStack oInput1 = (ItemStack) MinetweakerCompat.toObject(input1); + ItemStack oInput2 = (ItemStack) MinetweakerCompat.toObject(input2); - AssemblingMachineRecipe r = new AssemblingMachineRecipe(oInput1, oInput2, MinetweakerCompat.toStack(output), ticktime, euTick); + AssemblingMachineRecipe r = new AssemblingMachineRecipe(oInput1, oInput2, MinetweakerCompat.toStack(output), ticktime, euTick); - MineTweakerAPI.apply(new Add(r)); - } + MineTweakerAPI.apply(new Add(r)); + } - private static class Add implements IUndoableAction { - private final AssemblingMachineRecipe recipe; + private static class Add implements IUndoableAction { + private final AssemblingMachineRecipe recipe; - public Add(AssemblingMachineRecipe recipe) { - this.recipe = recipe; - } + public Add(AssemblingMachineRecipe recipe) { + this.recipe = recipe; + } - @Override - public void apply() { - RecipeHandler.addRecipe(recipe); - } + @Override + public void apply() { + RecipeHandler.addRecipe(recipe); + } - @Override - public boolean canUndo() { - return true; - } + @Override + public boolean canUndo() { + return true; + } - @Override - public void undo() { - RecipeHandler.recipeList.remove(recipe); - } + @Override + public void undo() { + RecipeHandler.recipeList.remove(recipe); + } - @Override - public String describe() { - return "Adding Assembling Machine Recipe for " + recipe.getOutput(0).getDisplayName(); - } + @Override + public String describe() { + return "Adding Assembling Machine Recipe for " + recipe.getOutput(0).getDisplayName(); + } - @Override - public String describeUndo() { - return "Removing Assembling Machine Recipe for " + recipe.getOutput(0).getDisplayName(); - } + @Override + public String describeUndo() { + return "Removing Assembling Machine Recipe for " + recipe.getOutput(0).getDisplayName(); + } - @Override - public Object getOverrideKey() { - return null; - } - } + @Override + public Object getOverrideKey() { + return null; + } + } - @ZenMethod - public static void removeRecipe(IItemStack output) - { - MineTweakerAPI.apply(new Remove(MinetweakerCompat.toStack(output))); - } - private static class Remove implements IUndoableAction - { - private final ItemStack output; - List removedRecipes = new ArrayList(); - public Remove(ItemStack output) - { - this.output = output; - } - @Override - public void apply() - { - for(IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(Reference.assemblingMachineRecipe)){ - for(ItemStack stack : recipeType.getOutputs()){ - if(ItemUtils.isItemEqual(stack, output, true, false)){ - removedRecipes.add((AssemblingMachineRecipe) recipeType); - RecipeHandler.recipeList.remove(recipeType); - break; - } - } - } - } - @Override - public void undo() - { - if(removedRecipes!=null){ - for(AssemblingMachineRecipe recipe : removedRecipes){ - if(recipe!=null){ - RecipeHandler.addRecipe(recipe); - } - } - } + @ZenMethod + public static void removeRecipe(IItemStack output) { + MineTweakerAPI.apply(new Remove(MinetweakerCompat.toStack(output))); + } - } - @Override - public String describe() - { - return "Removing Assembling Machine Recipe for " + output.getDisplayName(); - } - @Override - public String describeUndo() - { - return "Re-Adding Assembling Machine Recipe for " + output.getDisplayName(); - } - @Override - public Object getOverrideKey() - { - return null; - } - @Override - public boolean canUndo() - { - return true; - } - } + private static class Remove implements IUndoableAction { + private final ItemStack output; + List removedRecipes = new ArrayList(); + + public Remove(ItemStack output) { + this.output = output; + } + + @Override + public void apply() { + for (IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(Reference.assemblingMachineRecipe)) { + for (ItemStack stack : recipeType.getOutputs()) { + if (ItemUtils.isItemEqual(stack, output, true, false)) { + removedRecipes.add((AssemblingMachineRecipe) recipeType); + RecipeHandler.recipeList.remove(recipeType); + break; + } + } + } + } + + @Override + public void undo() { + if (removedRecipes != null) { + for (AssemblingMachineRecipe recipe : removedRecipes) { + if (recipe != null) { + RecipeHandler.addRecipe(recipe); + } + } + } + + } + + @Override + public String describe() { + return "Removing Assembling Machine Recipe for " + output.getDisplayName(); + } + + @Override + public String describeUndo() { + return "Re-Adding Assembling Machine Recipe for " + output.getDisplayName(); + } + + @Override + public Object getOverrideKey() { + return null; + } + + @Override + public boolean canUndo() { + return true; + } + } } diff --git a/src/main/java/techreborn/compat/minetweaker/MTBlastFurnace.java b/src/main/java/techreborn/compat/minetweaker/MTBlastFurnace.java index c06238002..fa32a8213 100644 --- a/src/main/java/techreborn/compat/minetweaker/MTBlastFurnace.java +++ b/src/main/java/techreborn/compat/minetweaker/MTBlastFurnace.java @@ -5,124 +5,123 @@ import minetweaker.MineTweakerAPI; import minetweaker.api.item.IIngredient; import minetweaker.api.item.IItemStack; import net.minecraft.item.ItemStack; +import reborncore.common.util.ItemUtils; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; import techreborn.api.recipe.IBaseRecipeType; import techreborn.api.recipe.RecipeHandler; import techreborn.api.recipe.machines.BlastFurnaceRecipe; import techreborn.lib.Reference; -import techreborn.util.ItemUtils; import java.util.ArrayList; import java.util.List; @ZenClass("mods.techreborn.blastFurnace") public class MTBlastFurnace { - @ZenMethod - public static void addRecipe(IItemStack output1,IItemStack output2, IIngredient input1, IIngredient input2, int ticktime, int euTick, int neededHeat) { - ItemStack oInput1 = (ItemStack) MinetweakerCompat.toObject(input1); - ItemStack oInput2 = (ItemStack) MinetweakerCompat.toObject(input2); + @ZenMethod + public static void addRecipe(IItemStack output1, IItemStack output2, IIngredient input1, IIngredient input2, int ticktime, int euTick, int neededHeat) { + ItemStack oInput1 = (ItemStack) MinetweakerCompat.toObject(input1); + ItemStack oInput2 = (ItemStack) MinetweakerCompat.toObject(input2); - BlastFurnaceRecipe r = new BlastFurnaceRecipe(oInput1, oInput2, MinetweakerCompat.toStack(output1), MinetweakerCompat.toStack(output2), ticktime, euTick, neededHeat); + BlastFurnaceRecipe r = new BlastFurnaceRecipe(oInput1, oInput2, MinetweakerCompat.toStack(output1), MinetweakerCompat.toStack(output2), ticktime, euTick, neededHeat); - MineTweakerAPI.apply(new Add(r)); - } + MineTweakerAPI.apply(new Add(r)); + } - private static class Add implements IUndoableAction { - private final BlastFurnaceRecipe recipe; + private static class Add implements IUndoableAction { + private final BlastFurnaceRecipe recipe; - public Add(BlastFurnaceRecipe recipe) { - this.recipe = recipe; - } + public Add(BlastFurnaceRecipe recipe) { + this.recipe = recipe; + } - @Override - public void apply() { - RecipeHandler.addRecipe(recipe); - } + @Override + public void apply() { + RecipeHandler.addRecipe(recipe); + } - @Override - public boolean canUndo() { - return true; - } + @Override + public boolean canUndo() { + return true; + } - @Override - public void undo() { - RecipeHandler.recipeList.remove(recipe); - } + @Override + public void undo() { + RecipeHandler.recipeList.remove(recipe); + } - @Override - public String describe() { - return "Adding Blast Furnace Recipe for " + recipe.getOutput(0).getDisplayName(); - } + @Override + public String describe() { + return "Adding Blast Furnace Recipe for " + recipe.getOutput(0).getDisplayName(); + } - @Override - public String describeUndo() { - return "Removing Blast Furnace Recipe for " + recipe.getOutput(0).getDisplayName(); - } + @Override + public String describeUndo() { + return "Removing Blast Furnace Recipe for " + recipe.getOutput(0).getDisplayName(); + } - @Override - public Object getOverrideKey() { - return null; - } - } + @Override + public Object getOverrideKey() { + return null; + } + } - @ZenMethod - public static void removeRecipe(IItemStack output) - { - MineTweakerAPI.apply(new Remove(MinetweakerCompat.toStack(output))); - } - private static class Remove implements IUndoableAction - { - private final ItemStack output; - List removedRecipes = new ArrayList(); - public Remove(ItemStack output) - { - this.output = output; - } - @Override - public void apply() - { - for(IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(Reference.blastFurnaceRecipe)){ - for(ItemStack stack : recipeType.getOutputs()){ - if(ItemUtils.isItemEqual(stack, output, true, false)){ - removedRecipes.add((BlastFurnaceRecipe) recipeType); - RecipeHandler.recipeList.remove(recipeType); - break; - } - } - } - } - @Override - public void undo() - { - if(removedRecipes!=null){ - for(BlastFurnaceRecipe recipe : removedRecipes){ - if(recipe!=null){ - RecipeHandler.addRecipe(recipe); - } - } - } + @ZenMethod + public static void removeRecipe(IItemStack output) { + MineTweakerAPI.apply(new Remove(MinetweakerCompat.toStack(output))); + } - } - @Override - public String describe() - { - return "Removing Blast Furnace Recipe for " + output.getDisplayName(); - } - @Override - public String describeUndo() - { - return "Re-Adding Blast Furnace Recipe for " + output.getDisplayName(); - } - @Override - public Object getOverrideKey() - { - return null; - } - @Override - public boolean canUndo() - { - return true; - } - } + private static class Remove implements IUndoableAction { + private final ItemStack output; + List removedRecipes = new ArrayList(); + + public Remove(ItemStack output) { + this.output = output; + } + + @Override + public void apply() { + for (IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(Reference.blastFurnaceRecipe)) { + for (ItemStack stack : recipeType.getOutputs()) { + if (ItemUtils.isItemEqual(stack, output, true, false)) { + removedRecipes.add((BlastFurnaceRecipe) recipeType); + RecipeHandler.recipeList.remove(recipeType); + break; + } + } + } + } + + @Override + public void undo() { + if (removedRecipes != null) { + for (BlastFurnaceRecipe recipe : removedRecipes) { + if (recipe != null) { + RecipeHandler.addRecipe(recipe); + } + } + } + + } + + @Override + public String describe() { + return "Removing Blast Furnace Recipe for " + output.getDisplayName(); + } + + @Override + public String describeUndo() { + return "Re-Adding Blast Furnace Recipe for " + output.getDisplayName(); + } + + @Override + public Object getOverrideKey() { + return null; + } + + @Override + public boolean canUndo() { + return true; + } + } } diff --git a/src/main/java/techreborn/compat/minetweaker/MTCentrifuge.java b/src/main/java/techreborn/compat/minetweaker/MTCentrifuge.java index 69b2dca4c..b109bc614 100644 --- a/src/main/java/techreborn/compat/minetweaker/MTCentrifuge.java +++ b/src/main/java/techreborn/compat/minetweaker/MTCentrifuge.java @@ -5,186 +5,182 @@ import minetweaker.MineTweakerAPI; import minetweaker.api.item.IIngredient; import minetweaker.api.item.IItemStack; import net.minecraft.item.ItemStack; +import reborncore.common.util.ItemUtils; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; import techreborn.api.recipe.IBaseRecipeType; import techreborn.api.recipe.RecipeHandler; import techreborn.api.recipe.machines.CentrifugeRecipe; import techreborn.lib.Reference; -import techreborn.util.ItemUtils; import java.util.ArrayList; import java.util.List; @ZenClass("mods.techreborn.centrifuge") public class MTCentrifuge { - @ZenMethod - public static void addRecipe(IItemStack output1,IItemStack output2,IItemStack output3,IItemStack output4, IIngredient input1, IIngredient input2, int ticktime, int euTick) { - ItemStack oInput1 = (ItemStack) MinetweakerCompat.toObject(input1); - ItemStack oInput2 = (ItemStack) MinetweakerCompat.toObject(input2); + @ZenMethod + public static void addRecipe(IItemStack output1, IItemStack output2, IItemStack output3, IItemStack output4, IIngredient input1, IIngredient input2, int ticktime, int euTick) { + ItemStack oInput1 = (ItemStack) MinetweakerCompat.toObject(input1); + ItemStack oInput2 = (ItemStack) MinetweakerCompat.toObject(input2); - CentrifugeRecipe r = new CentrifugeRecipe(oInput1, oInput2, MinetweakerCompat.toStack(output1), MinetweakerCompat.toStack(output2),MinetweakerCompat.toStack(output3), MinetweakerCompat.toStack(output4), ticktime, euTick); + CentrifugeRecipe r = new CentrifugeRecipe(oInput1, oInput2, MinetweakerCompat.toStack(output1), MinetweakerCompat.toStack(output2), MinetweakerCompat.toStack(output3), MinetweakerCompat.toStack(output4), ticktime, euTick); - MineTweakerAPI.apply(new Add(r)); - } + MineTweakerAPI.apply(new Add(r)); + } - private static class Add implements IUndoableAction { - private final CentrifugeRecipe recipe; + private static class Add implements IUndoableAction { + private final CentrifugeRecipe recipe; - public Add(CentrifugeRecipe recipe) { - this.recipe = recipe; - } + public Add(CentrifugeRecipe recipe) { + this.recipe = recipe; + } - @Override - public void apply() { - RecipeHandler.addRecipe(recipe); - } + @Override + public void apply() { + RecipeHandler.addRecipe(recipe); + } - @Override - public boolean canUndo() { - return true; - } + @Override + public boolean canUndo() { + return true; + } - @Override - public void undo() { - RecipeHandler.recipeList.remove(recipe); - } + @Override + public void undo() { + RecipeHandler.recipeList.remove(recipe); + } - @Override - public String describe() { - return "Adding Centrifuge Recipe for " + recipe.getOutput(0).getDisplayName(); - } + @Override + public String describe() { + return "Adding Centrifuge Recipe for " + recipe.getOutput(0).getDisplayName(); + } - @Override - public String describeUndo() { - return "Removing Centrifuge Recipe for " + recipe.getOutput(0).getDisplayName(); - } + @Override + public String describeUndo() { + return "Removing Centrifuge Recipe for " + recipe.getOutput(0).getDisplayName(); + } - @Override - public Object getOverrideKey() { - return null; - } - } + @Override + public Object getOverrideKey() { + return null; + } + } - @ZenMethod - public static void removeRecipe(IItemStack output) - { - MineTweakerAPI.apply(new Remove(MinetweakerCompat.toStack(output))); - } + @ZenMethod + public static void removeRecipe(IItemStack output) { + MineTweakerAPI.apply(new Remove(MinetweakerCompat.toStack(output))); + } - @ZenMethod - public static void removeInputRecipe(IItemStack output) - { - MineTweakerAPI.apply(new RemoveInput(MinetweakerCompat.toStack(output))); - } + @ZenMethod + public static void removeInputRecipe(IItemStack output) { + MineTweakerAPI.apply(new RemoveInput(MinetweakerCompat.toStack(output))); + } - private static class RemoveInput implements IUndoableAction - { - private final ItemStack output; - List removedRecipes = new ArrayList(); - public RemoveInput(ItemStack output) - { - this.output = output; - } - @Override - public void apply() - { - for(IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(Reference.centrifugeRecipe)){ - for(ItemStack stack : recipeType.getInputs()){ - if(ItemUtils.isItemEqual(stack, output, true, false)){ - removedRecipes.add((CentrifugeRecipe) recipeType); - RecipeHandler.recipeList.remove(recipeType); - break; - } - } - } - } - @Override - public void undo() - { - if(removedRecipes!=null){ - for(CentrifugeRecipe recipe : removedRecipes){ - if(recipe!=null){ - RecipeHandler.addRecipe(recipe); - } - } - } + private static class RemoveInput implements IUndoableAction { + private final ItemStack output; + List removedRecipes = new ArrayList(); - } - @Override - public String describe() - { - return "Removing Centrifuge Recipe for " + output.getDisplayName(); - } - @Override - public String describeUndo() - { - return "Re-Adding Centrifuge Recipe for " + output.getDisplayName(); - } - @Override - public Object getOverrideKey() - { - return null; - } - @Override - public boolean canUndo() - { - return true; - } - } + public RemoveInput(ItemStack output) { + this.output = output; + } - private static class Remove implements IUndoableAction - { - private final ItemStack output; - List removedRecipes = new ArrayList(); - public Remove(ItemStack output) - { - this.output = output; - } - @Override - public void apply() - { - for(IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(Reference.centrifugeRecipe)){ - for(ItemStack stack : recipeType.getOutputs()){ - if(ItemUtils.isItemEqual(stack, output, true, false)){ - removedRecipes.add((CentrifugeRecipe) recipeType); - RecipeHandler.recipeList.remove(recipeType); - break; - } - } - } - } - @Override - public void undo() - { - if(removedRecipes!=null){ - for(CentrifugeRecipe recipe : removedRecipes){ - if(recipe!=null){ - RecipeHandler.addRecipe(recipe); - } - } - } + @Override + public void apply() { + for (IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(Reference.centrifugeRecipe)) { + for (ItemStack stack : recipeType.getInputs()) { + if (ItemUtils.isItemEqual(stack, output, true, false)) { + removedRecipes.add((CentrifugeRecipe) recipeType); + RecipeHandler.recipeList.remove(recipeType); + break; + } + } + } + } - } - @Override - public String describe() - { - return "Removing Centrifuge Recipe for " + output.getDisplayName(); - } - @Override - public String describeUndo() - { - return "Re-Adding Centrifuge Recipe for " + output.getDisplayName(); - } - @Override - public Object getOverrideKey() - { - return null; - } - @Override - public boolean canUndo() - { - return true; - } - } + @Override + public void undo() { + if (removedRecipes != null) { + for (CentrifugeRecipe recipe : removedRecipes) { + if (recipe != null) { + RecipeHandler.addRecipe(recipe); + } + } + } + + } + + @Override + public String describe() { + return "Removing Centrifuge Recipe for " + output.getDisplayName(); + } + + @Override + public String describeUndo() { + return "Re-Adding Centrifuge Recipe for " + output.getDisplayName(); + } + + @Override + public Object getOverrideKey() { + return null; + } + + @Override + public boolean canUndo() { + return true; + } + } + + private static class Remove implements IUndoableAction { + private final ItemStack output; + List removedRecipes = new ArrayList(); + + public Remove(ItemStack output) { + this.output = output; + } + + @Override + public void apply() { + for (IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(Reference.centrifugeRecipe)) { + for (ItemStack stack : recipeType.getOutputs()) { + if (ItemUtils.isItemEqual(stack, output, true, false)) { + removedRecipes.add((CentrifugeRecipe) recipeType); + RecipeHandler.recipeList.remove(recipeType); + break; + } + } + } + } + + @Override + public void undo() { + if (removedRecipes != null) { + for (CentrifugeRecipe recipe : removedRecipes) { + if (recipe != null) { + RecipeHandler.addRecipe(recipe); + } + } + } + + } + + @Override + public String describe() { + return "Removing Centrifuge Recipe for " + output.getDisplayName(); + } + + @Override + public String describeUndo() { + return "Re-Adding Centrifuge Recipe for " + output.getDisplayName(); + } + + @Override + public Object getOverrideKey() { + return null; + } + + @Override + public boolean canUndo() { + return true; + } + } } diff --git a/src/main/java/techreborn/compat/minetweaker/MTChemicalReactor.java b/src/main/java/techreborn/compat/minetweaker/MTChemicalReactor.java index 56c2bf06a..9f005d1fc 100644 --- a/src/main/java/techreborn/compat/minetweaker/MTChemicalReactor.java +++ b/src/main/java/techreborn/compat/minetweaker/MTChemicalReactor.java @@ -5,19 +5,19 @@ import minetweaker.MineTweakerAPI; import minetweaker.api.item.IIngredient; import minetweaker.api.item.IItemStack; import net.minecraft.item.ItemStack; +import reborncore.common.util.ItemUtils; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; import techreborn.api.recipe.IBaseRecipeType; import techreborn.api.recipe.RecipeHandler; import techreborn.api.recipe.machines.ChemicalReactorRecipe; import techreborn.lib.Reference; -import techreborn.util.ItemUtils; import java.util.ArrayList; import java.util.List; @ZenClass("mods.techreborn.chemicalReactorRecipe") -public class MTChemicalReactor{ +public class MTChemicalReactor { @ZenMethod public static void addRecipe(IItemStack output1, IIngredient input1, IIngredient input2, int ticktime, int euTick) { ItemStack oInput1 = (ItemStack) MinetweakerCompat.toObject(input1); @@ -67,24 +67,23 @@ public class MTChemicalReactor{ } @ZenMethod - public static void removeRecipe(IItemStack output) - { + public static void removeRecipe(IItemStack output) { MineTweakerAPI.apply(new Remove(MinetweakerCompat.toStack(output))); } - private static class Remove implements IUndoableAction - { + + private static class Remove implements IUndoableAction { private final ItemStack output; List removedRecipes = new ArrayList(); - public Remove(ItemStack output) - { + + public Remove(ItemStack output) { this.output = output; } + @Override - public void apply() - { - for(IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(Reference.chemicalReactorRecipe)){ - for(ItemStack stack : recipeType.getOutputs()){ - if(ItemUtils.isItemEqual(stack, output, true, false)){ + public void apply() { + for (IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(Reference.chemicalReactorRecipe)) { + for (ItemStack stack : recipeType.getOutputs()) { + if (ItemUtils.isItemEqual(stack, output, true, false)) { removedRecipes.add((ChemicalReactorRecipe) recipeType); RecipeHandler.recipeList.remove(recipeType); break; @@ -92,36 +91,36 @@ public class MTChemicalReactor{ } } } + @Override - public void undo() - { - if(removedRecipes!=null){ - for(ChemicalReactorRecipe recipe : removedRecipes){ - if(recipe!=null){ + public void undo() { + if (removedRecipes != null) { + for (ChemicalReactorRecipe recipe : removedRecipes) { + if (recipe != null) { RecipeHandler.addRecipe(recipe); } } } } + @Override - public String describe() - { + public String describe() { return "Removing Chemical Recipe for " + output.getDisplayName(); } + @Override - public String describeUndo() - { + public String describeUndo() { return "Re-Adding Chemical Recipe for " + output.getDisplayName(); } + @Override - public Object getOverrideKey() - { + public Object getOverrideKey() { return null; } + @Override - public boolean canUndo() - { + public boolean canUndo() { return true; } } diff --git a/src/main/java/techreborn/compat/minetweaker/MTGrinder.java b/src/main/java/techreborn/compat/minetweaker/MTGrinder.java index 9d2b6497b..058cc6691 100644 --- a/src/main/java/techreborn/compat/minetweaker/MTGrinder.java +++ b/src/main/java/techreborn/compat/minetweaker/MTGrinder.java @@ -7,13 +7,13 @@ import minetweaker.api.item.IItemStack; import minetweaker.api.liquid.ILiquidStack; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; +import reborncore.common.util.ItemUtils; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; import techreborn.api.recipe.IBaseRecipeType; import techreborn.api.recipe.RecipeHandler; import techreborn.api.recipe.machines.GrinderRecipe; import techreborn.lib.Reference; -import techreborn.util.ItemUtils; import java.util.ArrayList; import java.util.List; @@ -21,22 +21,22 @@ import java.util.List; @ZenClass("mods.techreborn.grinder") public class MTGrinder { @ZenMethod - public static void addRecipe(IItemStack output1 ,IItemStack output2 ,IItemStack output3,IItemStack output4, IIngredient input1, IIngredient input2, int ticktime, int euTick) { - addRecipe(output1, output2, output3, output4, input1, input2, null, ticktime, euTick); + public static void addRecipe(IItemStack output1, IItemStack output2, IItemStack output3, IItemStack output4, IIngredient input1, IIngredient input2, int ticktime, int euTick) { + addRecipe(output1, output2, output3, output4, input1, input2, null, ticktime, euTick); } @ZenMethod - public static void addRecipe(IItemStack output1 ,IItemStack output2 ,IItemStack output3,IItemStack output4, IIngredient input1, IIngredient input2, ILiquidStack fluid, int ticktime, int euTick) { + public static void addRecipe(IItemStack output1, IItemStack output2, IItemStack output3, IItemStack output4, IIngredient input1, IIngredient input2, ILiquidStack fluid, int ticktime, int euTick) { ItemStack oInput1 = (ItemStack) MinetweakerCompat.toObject(input1); ItemStack oInput2 = (ItemStack) MinetweakerCompat.toObject(input2); FluidStack fluidStack = null; - if(fluid != null){ + if (fluid != null) { fluidStack = MinetweakerCompat.toFluidStack(fluid); } - GrinderRecipe r = new GrinderRecipe(oInput1, oInput2,fluidStack, MinetweakerCompat.toStack(output1), MinetweakerCompat.toStack(output2), MinetweakerCompat.toStack(output3), MinetweakerCompat.toStack(output4), ticktime, euTick); + GrinderRecipe r = new GrinderRecipe(oInput1, oInput2, fluidStack, MinetweakerCompat.toStack(output1), MinetweakerCompat.toStack(output2), MinetweakerCompat.toStack(output3), MinetweakerCompat.toStack(output4), ticktime, euTick); MineTweakerAPI.apply(new Add(r)); } @@ -80,24 +80,23 @@ public class MTGrinder { } @ZenMethod - public static void removeRecipe(IItemStack output) - { + public static void removeRecipe(IItemStack output) { MineTweakerAPI.apply(new Remove(MinetweakerCompat.toStack(output))); } - private static class Remove implements IUndoableAction - { + + private static class Remove implements IUndoableAction { private final ItemStack output; List removedRecipes = new ArrayList(); - public Remove(ItemStack output) - { + + public Remove(ItemStack output) { this.output = output; } + @Override - public void apply() - { - for(IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(Reference.grinderRecipe)){ - for(ItemStack stack : recipeType.getOutputs()){ - if(ItemUtils.isItemEqual(stack, output, true, false)){ + public void apply() { + for (IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(Reference.grinderRecipe)) { + for (ItemStack stack : recipeType.getOutputs()) { + if (ItemUtils.isItemEqual(stack, output, true, false)) { removedRecipes.add((GrinderRecipe) recipeType); RecipeHandler.recipeList.remove(recipeType); break; @@ -105,36 +104,36 @@ public class MTGrinder { } } } + @Override - public void undo() - { - if(removedRecipes!=null){ - for(GrinderRecipe recipe : removedRecipes){ - if(recipe!=null){ + public void undo() { + if (removedRecipes != null) { + for (GrinderRecipe recipe : removedRecipes) { + if (recipe != null) { RecipeHandler.addRecipe(recipe); } } } } + @Override - public String describe() - { + public String describe() { return "Removing Grinder Recipe for " + output.getDisplayName(); } + @Override - public String describeUndo() - { + public String describeUndo() { return "Re-Adding Grinder Recipe for " + output.getDisplayName(); } + @Override - public Object getOverrideKey() - { + public Object getOverrideKey() { return null; } + @Override - public boolean canUndo() - { + public boolean canUndo() { return true; } } diff --git a/src/main/java/techreborn/compat/minetweaker/MTImplosionCompressor.java b/src/main/java/techreborn/compat/minetweaker/MTImplosionCompressor.java index a5bf1a49b..ea90d028d 100644 --- a/src/main/java/techreborn/compat/minetweaker/MTImplosionCompressor.java +++ b/src/main/java/techreborn/compat/minetweaker/MTImplosionCompressor.java @@ -5,13 +5,13 @@ import minetweaker.MineTweakerAPI; import minetweaker.api.item.IIngredient; import minetweaker.api.item.IItemStack; import net.minecraft.item.ItemStack; +import reborncore.common.util.ItemUtils; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; import techreborn.api.recipe.IBaseRecipeType; import techreborn.api.recipe.RecipeHandler; import techreborn.api.recipe.machines.ImplosionCompressorRecipe; import techreborn.lib.Reference; -import techreborn.util.ItemUtils; import java.util.ArrayList; import java.util.List; @@ -68,24 +68,23 @@ public class MTImplosionCompressor { } @ZenMethod - public static void removeRecipe(IItemStack output) - { + public static void removeRecipe(IItemStack output) { MineTweakerAPI.apply(new Remove(MinetweakerCompat.toStack(output))); } - private static class Remove implements IUndoableAction - { + + private static class Remove implements IUndoableAction { private final ItemStack output; List removedRecipes = new ArrayList(); - public Remove(ItemStack output) - { + + public Remove(ItemStack output) { this.output = output; } + @Override - public void apply() - { - for(IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(Reference.implosionCompressorRecipe)){ - for(ItemStack stack : recipeType.getOutputs()){ - if(ItemUtils.isItemEqual(stack, output, true, false)){ + public void apply() { + for (IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(Reference.implosionCompressorRecipe)) { + for (ItemStack stack : recipeType.getOutputs()) { + if (ItemUtils.isItemEqual(stack, output, true, false)) { removedRecipes.add((ImplosionCompressorRecipe) recipeType); RecipeHandler.recipeList.remove(recipeType); break; @@ -93,36 +92,36 @@ public class MTImplosionCompressor { } } } + @Override - public void undo() - { - if(removedRecipes!=null){ - for(ImplosionCompressorRecipe recipe : removedRecipes){ - if(recipe!=null){ + public void undo() { + if (removedRecipes != null) { + for (ImplosionCompressorRecipe recipe : removedRecipes) { + if (recipe != null) { RecipeHandler.addRecipe(recipe); } } } } + @Override - public String describe() - { + public String describe() { return "Removing Implosion Recipe for " + output.getDisplayName(); } + @Override - public String describeUndo() - { + public String describeUndo() { return "Re-Adding Implosion Recipe for " + output.getDisplayName(); } + @Override - public Object getOverrideKey() - { + public Object getOverrideKey() { return null; } + @Override - public boolean canUndo() - { + public boolean canUndo() { return true; } } diff --git a/src/main/java/techreborn/compat/minetweaker/MTIndustrialElectrolyzer.java b/src/main/java/techreborn/compat/minetweaker/MTIndustrialElectrolyzer.java index 6b3da5322..037e9a531 100644 --- a/src/main/java/techreborn/compat/minetweaker/MTIndustrialElectrolyzer.java +++ b/src/main/java/techreborn/compat/minetweaker/MTIndustrialElectrolyzer.java @@ -5,13 +5,13 @@ import minetweaker.MineTweakerAPI; import minetweaker.api.item.IIngredient; import minetweaker.api.item.IItemStack; import net.minecraft.item.ItemStack; +import reborncore.common.util.ItemUtils; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; import techreborn.api.recipe.IBaseRecipeType; import techreborn.api.recipe.RecipeHandler; import techreborn.api.recipe.machines.IndustrialElectrolyzerRecipe; import techreborn.lib.Reference; -import techreborn.util.ItemUtils; import java.util.ArrayList; import java.util.List; @@ -19,7 +19,7 @@ import java.util.List; @ZenClass("mods.techreborn.industrialElectrolyzer") public class MTIndustrialElectrolyzer { @ZenMethod - public static void addRecipe(IItemStack output1, IItemStack output2, IItemStack output3, IItemStack output4,IIngredient cells, IIngredient input2, int ticktime, int euTick) { + public static void addRecipe(IItemStack output1, IItemStack output2, IItemStack output3, IItemStack output4, IIngredient cells, IIngredient input2, int ticktime, int euTick) { ItemStack oInput1 = (ItemStack) MinetweakerCompat.toObject(cells); ItemStack oInput2 = (ItemStack) MinetweakerCompat.toObject(input2); @@ -67,24 +67,23 @@ public class MTIndustrialElectrolyzer { } @ZenMethod - public static void removeRecipe(IItemStack output) - { + public static void removeRecipe(IItemStack output) { MineTweakerAPI.apply(new Remove(MinetweakerCompat.toStack(output))); } - private static class Remove implements IUndoableAction - { + + private static class Remove implements IUndoableAction { private final ItemStack output; List removedRecipes = new ArrayList(); - public Remove(ItemStack output) - { + + public Remove(ItemStack output) { this.output = output; } + @Override - public void apply() - { - for(IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(Reference.industrialElectrolyzerRecipe)){ - for(ItemStack stack : recipeType.getOutputs()){ - if(ItemUtils.isItemEqual(stack, output, true, false)){ + public void apply() { + for (IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(Reference.industrialElectrolyzerRecipe)) { + for (ItemStack stack : recipeType.getOutputs()) { + if (ItemUtils.isItemEqual(stack, output, true, false)) { removedRecipes.add((IndustrialElectrolyzerRecipe) recipeType); RecipeHandler.recipeList.remove(recipeType); break; @@ -92,36 +91,36 @@ public class MTIndustrialElectrolyzer { } } } + @Override - public void undo() - { - if(removedRecipes!=null){ - for(IndustrialElectrolyzerRecipe recipe : removedRecipes){ - if(recipe!=null){ + public void undo() { + if (removedRecipes != null) { + for (IndustrialElectrolyzerRecipe recipe : removedRecipes) { + if (recipe != null) { RecipeHandler.addRecipe(recipe); } } } } + @Override - public String describe() - { + public String describe() { return "Removing IndustrialElectrolyzerRecipe for " + output.getDisplayName(); } + @Override - public String describeUndo() - { + public String describeUndo() { return "Re-Adding IndustrialElectrolyzerRecipe for " + output.getDisplayName(); } + @Override - public Object getOverrideKey() - { + public Object getOverrideKey() { return null; } + @Override - public boolean canUndo() - { + public boolean canUndo() { return true; } } diff --git a/src/main/java/techreborn/compat/minetweaker/MTIndustrialSawmill.java b/src/main/java/techreborn/compat/minetweaker/MTIndustrialSawmill.java index 9fdd278ce..c58f686a2 100644 --- a/src/main/java/techreborn/compat/minetweaker/MTIndustrialSawmill.java +++ b/src/main/java/techreborn/compat/minetweaker/MTIndustrialSawmill.java @@ -7,13 +7,13 @@ import minetweaker.api.item.IItemStack; import minetweaker.api.liquid.ILiquidStack; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; +import reborncore.common.util.ItemUtils; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; import techreborn.api.recipe.IBaseRecipeType; import techreborn.api.recipe.RecipeHandler; import techreborn.api.recipe.machines.IndustrialSawmillRecipe; import techreborn.lib.Reference; -import techreborn.util.ItemUtils; import java.util.ArrayList; import java.util.List; @@ -22,32 +22,32 @@ import java.util.List; public class MTIndustrialSawmill { @ZenMethod - public static void addRecipe(IItemStack output1 ,IItemStack output2 ,IItemStack output3, IIngredient input1, IIngredient input2, ILiquidStack fluid, int ticktime, int euTick) { - addRecipe(output1, output2, output3, input1, input2, fluid, ticktime, euTick, true); + public static void addRecipe(IItemStack output1, IItemStack output2, IItemStack output3, IIngredient input1, IIngredient input2, ILiquidStack fluid, int ticktime, int euTick) { + addRecipe(output1, output2, output3, input1, input2, fluid, ticktime, euTick, true); } @ZenMethod - public static void addRecipe(IItemStack output1 ,IItemStack output2 ,IItemStack output3, IIngredient input1, IIngredient input2, int ticktime, int euTick) { - addRecipe(output1, output2, output3, input1, input2, null, ticktime, euTick, true); + public static void addRecipe(IItemStack output1, IItemStack output2, IItemStack output3, IIngredient input1, IIngredient input2, int ticktime, int euTick) { + addRecipe(output1, output2, output3, input1, input2, null, ticktime, euTick, true); } @ZenMethod - public static void addRecipe(IItemStack output1 ,IItemStack output2 ,IItemStack output3, IIngredient input1, IIngredient input2, int ticktime, int euTick, boolean useOreDic) { - addRecipe(output1, output2, output3, input1, input2, null, ticktime, euTick, useOreDic); + public static void addRecipe(IItemStack output1, IItemStack output2, IItemStack output3, IIngredient input1, IIngredient input2, int ticktime, int euTick, boolean useOreDic) { + addRecipe(output1, output2, output3, input1, input2, null, ticktime, euTick, useOreDic); } @ZenMethod - public static void addRecipe(IItemStack output1 ,IItemStack output2 ,IItemStack output3, IIngredient input1, IIngredient input2, ILiquidStack fluid, int ticktime, int euTick, boolean useOreDic) { + public static void addRecipe(IItemStack output1, IItemStack output2, IItemStack output3, IIngredient input1, IIngredient input2, ILiquidStack fluid, int ticktime, int euTick, boolean useOreDic) { ItemStack oInput1 = (ItemStack) MinetweakerCompat.toObject(input1); ItemStack oInput2 = (ItemStack) MinetweakerCompat.toObject(input2); FluidStack fluidStack = null; - if(fluid != null){ + if (fluid != null) { fluidStack = MinetweakerCompat.toFluidStack(fluid); } - IndustrialSawmillRecipe r = new IndustrialSawmillRecipe(oInput1, oInput2,fluidStack, MinetweakerCompat.toStack(output1), MinetweakerCompat.toStack(output2), MinetweakerCompat.toStack(output3), ticktime, euTick, useOreDic); + IndustrialSawmillRecipe r = new IndustrialSawmillRecipe(oInput1, oInput2, fluidStack, MinetweakerCompat.toStack(output1), MinetweakerCompat.toStack(output2), MinetweakerCompat.toStack(output3), ticktime, euTick, useOreDic); MineTweakerAPI.apply(new Add(r)); } @@ -91,24 +91,23 @@ public class MTIndustrialSawmill { } @ZenMethod - public static void removeRecipe(IItemStack output) - { + public static void removeRecipe(IItemStack output) { MineTweakerAPI.apply(new Remove(MinetweakerCompat.toStack(output))); } - private static class Remove implements IUndoableAction - { + + private static class Remove implements IUndoableAction { private final ItemStack output; List removedRecipes = new ArrayList(); - public Remove(ItemStack output) - { + + public Remove(ItemStack output) { this.output = output; } + @Override - public void apply() - { - for(IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(Reference.industrialSawmillRecipe)){ - for(ItemStack stack : recipeType.getOutputs()){ - if(ItemUtils.isItemEqual(stack, output, true, false)){ + public void apply() { + for (IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(Reference.industrialSawmillRecipe)) { + for (ItemStack stack : recipeType.getOutputs()) { + if (ItemUtils.isItemEqual(stack, output, true, false)) { removedRecipes.add((IndustrialSawmillRecipe) recipeType); RecipeHandler.recipeList.remove(recipeType); break; @@ -116,36 +115,36 @@ public class MTIndustrialSawmill { } } } + @Override - public void undo() - { - if(removedRecipes!=null){ - for(IndustrialSawmillRecipe recipe : removedRecipes){ - if(recipe!=null){ + public void undo() { + if (removedRecipes != null) { + for (IndustrialSawmillRecipe recipe : removedRecipes) { + if (recipe != null) { RecipeHandler.addRecipe(recipe); } } } } + @Override - public String describe() - { + public String describe() { return "Removing Sawmill Recipe for " + output.getDisplayName(); } + @Override - public String describeUndo() - { + public String describeUndo() { return "Re-Adding Sawmill Recipe for " + output.getDisplayName(); } + @Override - public Object getOverrideKey() - { + public Object getOverrideKey() { return null; } + @Override - public boolean canUndo() - { + public boolean canUndo() { return true; } } diff --git a/src/main/java/techreborn/compat/minetweaker/MTPlateCuttingMachine.java b/src/main/java/techreborn/compat/minetweaker/MTPlateCuttingMachine.java index eb25dd1d4..7d83d37a2 100644 --- a/src/main/java/techreborn/compat/minetweaker/MTPlateCuttingMachine.java +++ b/src/main/java/techreborn/compat/minetweaker/MTPlateCuttingMachine.java @@ -5,13 +5,13 @@ import minetweaker.MineTweakerAPI; import minetweaker.api.item.IIngredient; import minetweaker.api.item.IItemStack; import net.minecraft.item.ItemStack; +import reborncore.common.util.ItemUtils; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; import techreborn.api.recipe.IBaseRecipeType; import techreborn.api.recipe.RecipeHandler; import techreborn.api.recipe.machines.PlateCuttingMachineRecipe; import techreborn.lib.Reference; -import techreborn.util.ItemUtils; import java.util.ArrayList; import java.util.List; diff --git a/src/main/java/techreborn/compat/minetweaker/MinetweakerCompat.java b/src/main/java/techreborn/compat/minetweaker/MinetweakerCompat.java index 6f277cda6..83eed0d0b 100644 --- a/src/main/java/techreborn/compat/minetweaker/MinetweakerCompat.java +++ b/src/main/java/techreborn/compat/minetweaker/MinetweakerCompat.java @@ -20,57 +20,57 @@ import static minetweaker.api.minecraft.MineTweakerMC.getLiquidStack; public class MinetweakerCompat implements ICompatModule { - @Override - public void preInit(FMLPreInitializationEvent event) { + @Override + public void preInit(FMLPreInitializationEvent event) { - } + } - @Override - public void init(FMLInitializationEvent event) { + @Override + public void init(FMLInitializationEvent event) { - } + } - @Override - public void postInit(FMLPostInitializationEvent event) { - MineTweakerAPI.registerClass(MTAlloySmelter.class); - MineTweakerAPI.registerClass(MTAssemblingMachine.class); - MineTweakerAPI.registerClass(MTBlastFurnace.class); - MineTweakerAPI.registerClass(MTCentrifuge.class); - MineTweakerAPI.registerClass(MTChemicalReactor.class); - MineTweakerAPI.registerClass(MTGrinder.class); - MineTweakerAPI.registerClass(MTImplosionCompressor.class); - MineTweakerAPI.registerClass(MTIndustrialElectrolyzer.class); - MineTweakerAPI.registerClass(MTIndustrialSawmill.class); - MineTweakerAPI.registerClass(MTPlateCuttingMachine.class); - } + @Override + public void postInit(FMLPostInitializationEvent event) { + MineTweakerAPI.registerClass(MTAlloySmelter.class); + MineTweakerAPI.registerClass(MTAssemblingMachine.class); + MineTweakerAPI.registerClass(MTBlastFurnace.class); + MineTweakerAPI.registerClass(MTCentrifuge.class); + MineTweakerAPI.registerClass(MTChemicalReactor.class); + MineTweakerAPI.registerClass(MTGrinder.class); + MineTweakerAPI.registerClass(MTImplosionCompressor.class); + MineTweakerAPI.registerClass(MTIndustrialElectrolyzer.class); + MineTweakerAPI.registerClass(MTIndustrialSawmill.class); + MineTweakerAPI.registerClass(MTPlateCuttingMachine.class); + } - @Override - public void serverStarting(FMLServerStartingEvent event) { + @Override + public void serverStarting(FMLServerStartingEvent event) { - } + } - public static ItemStack toStack(IItemStack iStack) { - return getItemStack(iStack); - } + public static ItemStack toStack(IItemStack iStack) { + return getItemStack(iStack); + } - public static Object toObject(IIngredient iStack) { - if (iStack == null) - return null; - else { - if (iStack instanceof IOreDictEntry) - return ((IOreDictEntry) iStack).getName(); - else if (iStack instanceof IItemStack) - return getItemStack((IItemStack) iStack); - else if (iStack instanceof IngredientStack) { - IIngredient ingr = ReflectionHelper.getPrivateValue(IngredientStack.class, (IngredientStack) iStack, "ingredient"); - return toObject(ingr); - } else - return null; - } - } - public static FluidStack toFluidStack(ILiquidStack iStack) - { - return getLiquidStack(iStack); - } + public static Object toObject(IIngredient iStack) { + if (iStack == null) + return null; + else { + if (iStack instanceof IOreDictEntry) + return ((IOreDictEntry) iStack).getName(); + else if (iStack instanceof IItemStack) + return getItemStack((IItemStack) iStack); + else if (iStack instanceof IngredientStack) { + IIngredient ingr = ReflectionHelper.getPrivateValue(IngredientStack.class, (IngredientStack) iStack, "ingredient"); + return toObject(ingr); + } else + return null; + } + } + + public static FluidStack toFluidStack(ILiquidStack iStack) { + return getLiquidStack(iStack); + } } diff --git a/src/main/java/techreborn/compat/nei/recipes/AlloySmelterRecipeHandler.java b/src/main/java/techreborn/compat/nei/recipes/AlloySmelterRecipeHandler.java index 8bd9ea541..206566cce 100644 --- a/src/main/java/techreborn/compat/nei/recipes/AlloySmelterRecipeHandler.java +++ b/src/main/java/techreborn/compat/nei/recipes/AlloySmelterRecipeHandler.java @@ -3,10 +3,10 @@ package techreborn.compat.nei.recipes; import codechicken.nei.PositionedStack; import codechicken.nei.recipe.TemplateRecipeHandler; import net.minecraft.client.gui.inventory.GuiContainer; +import reborncore.common.util.ItemUtils; import techreborn.api.recipe.IBaseRecipeType; import techreborn.client.gui.GuiAlloySmelter; import techreborn.lib.Reference; -import techreborn.util.ItemUtils; import java.awt.*; import java.util.List; diff --git a/src/main/java/techreborn/compat/nei/recipes/AssemblingMachineRecipeHandler.java b/src/main/java/techreborn/compat/nei/recipes/AssemblingMachineRecipeHandler.java index 52bd030a3..e9563ce93 100644 --- a/src/main/java/techreborn/compat/nei/recipes/AssemblingMachineRecipeHandler.java +++ b/src/main/java/techreborn/compat/nei/recipes/AssemblingMachineRecipeHandler.java @@ -3,10 +3,10 @@ package techreborn.compat.nei.recipes; import codechicken.nei.PositionedStack; import codechicken.nei.recipe.TemplateRecipeHandler; import net.minecraft.client.gui.inventory.GuiContainer; +import reborncore.common.util.ItemUtils; import techreborn.api.recipe.IBaseRecipeType; import techreborn.client.gui.GuiAssemblingMachine; import techreborn.lib.Reference; -import techreborn.util.ItemUtils; import java.awt.*; import java.util.List; diff --git a/src/main/java/techreborn/compat/nei/recipes/BlastFurnaceRecipeHandler.java b/src/main/java/techreborn/compat/nei/recipes/BlastFurnaceRecipeHandler.java index 8e0627df7..de8341ccb 100644 --- a/src/main/java/techreborn/compat/nei/recipes/BlastFurnaceRecipeHandler.java +++ b/src/main/java/techreborn/compat/nei/recipes/BlastFurnaceRecipeHandler.java @@ -4,11 +4,11 @@ import codechicken.lib.gui.GuiDraw; import codechicken.nei.PositionedStack; import codechicken.nei.recipe.TemplateRecipeHandler; import net.minecraft.client.gui.inventory.GuiContainer; +import reborncore.common.util.ItemUtils; import techreborn.api.recipe.IBaseRecipeType; import techreborn.api.recipe.machines.BlastFurnaceRecipe; import techreborn.client.gui.GuiBlastFurnace; import techreborn.lib.Reference; -import techreborn.util.ItemUtils; import java.awt.*; import java.util.List; diff --git a/src/main/java/techreborn/compat/nei/recipes/CentrifugeRecipeHandler.java b/src/main/java/techreborn/compat/nei/recipes/CentrifugeRecipeHandler.java index 8cc8796a3..5a5f5fa42 100644 --- a/src/main/java/techreborn/compat/nei/recipes/CentrifugeRecipeHandler.java +++ b/src/main/java/techreborn/compat/nei/recipes/CentrifugeRecipeHandler.java @@ -3,10 +3,10 @@ package techreborn.compat.nei.recipes; import codechicken.nei.PositionedStack; import codechicken.nei.recipe.TemplateRecipeHandler; import net.minecraft.client.gui.inventory.GuiContainer; +import reborncore.common.util.ItemUtils; import techreborn.api.recipe.IBaseRecipeType; import techreborn.client.gui.GuiCentrifuge; import techreborn.lib.Reference; -import techreborn.util.ItemUtils; import java.awt.*; import java.util.List; diff --git a/src/main/java/techreborn/compat/nei/recipes/ChemicalReactorRecipeHandler.java b/src/main/java/techreborn/compat/nei/recipes/ChemicalReactorRecipeHandler.java index d5576e086..f93ec3efe 100644 --- a/src/main/java/techreborn/compat/nei/recipes/ChemicalReactorRecipeHandler.java +++ b/src/main/java/techreborn/compat/nei/recipes/ChemicalReactorRecipeHandler.java @@ -3,10 +3,10 @@ package techreborn.compat.nei.recipes; import codechicken.nei.PositionedStack; import codechicken.nei.recipe.TemplateRecipeHandler; import net.minecraft.client.gui.inventory.GuiContainer; +import reborncore.common.util.ItemUtils; import techreborn.api.recipe.IBaseRecipeType; import techreborn.client.gui.GuiChemicalReactor; import techreborn.lib.Reference; -import techreborn.util.ItemUtils; import java.awt.*; import java.util.List; diff --git a/src/main/java/techreborn/compat/nei/recipes/GenericRecipeHander.java b/src/main/java/techreborn/compat/nei/recipes/GenericRecipeHander.java index 1be2d31c0..0717de9fc 100644 --- a/src/main/java/techreborn/compat/nei/recipes/GenericRecipeHander.java +++ b/src/main/java/techreborn/compat/nei/recipes/GenericRecipeHander.java @@ -6,9 +6,9 @@ import codechicken.nei.recipe.TemplateRecipeHandler; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.item.ItemStack; import org.lwjgl.opengl.GL11; +import reborncore.common.util.ItemUtils; import techreborn.api.recipe.IBaseRecipeType; import techreborn.api.recipe.RecipeHandler; -import techreborn.util.ItemUtils; import java.awt.*; import java.text.DecimalFormat; diff --git a/src/main/java/techreborn/compat/nei/recipes/GrinderRecipeHandler.java b/src/main/java/techreborn/compat/nei/recipes/GrinderRecipeHandler.java index b15f2fbca..e582b1b14 100644 --- a/src/main/java/techreborn/compat/nei/recipes/GrinderRecipeHandler.java +++ b/src/main/java/techreborn/compat/nei/recipes/GrinderRecipeHandler.java @@ -7,12 +7,12 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.util.IIcon; +import reborncore.client.gui.GuiUtil; +import reborncore.common.util.ItemUtils; import techreborn.api.recipe.IBaseRecipeType; import techreborn.api.recipe.machines.GrinderRecipe; -import techreborn.client.GuiUtil; import techreborn.client.gui.GuiGrinder; import techreborn.lib.Reference; -import techreborn.util.ItemUtils; import java.awt.*; import java.util.List; diff --git a/src/main/java/techreborn/compat/nei/recipes/ImplosionCompressorRecipeHandler.java b/src/main/java/techreborn/compat/nei/recipes/ImplosionCompressorRecipeHandler.java index 3adde44ef..0e0cb06e8 100644 --- a/src/main/java/techreborn/compat/nei/recipes/ImplosionCompressorRecipeHandler.java +++ b/src/main/java/techreborn/compat/nei/recipes/ImplosionCompressorRecipeHandler.java @@ -3,10 +3,10 @@ package techreborn.compat.nei.recipes; import codechicken.nei.PositionedStack; import codechicken.nei.recipe.TemplateRecipeHandler; import net.minecraft.client.gui.inventory.GuiContainer; +import reborncore.common.util.ItemUtils; import techreborn.api.recipe.IBaseRecipeType; import techreborn.client.gui.GuiImplosionCompressor; import techreborn.lib.Reference; -import techreborn.util.ItemUtils; import java.awt.*; import java.util.List; diff --git a/src/main/java/techreborn/compat/nei/recipes/IndustrialElectrolyzerRecipeHandler.java b/src/main/java/techreborn/compat/nei/recipes/IndustrialElectrolyzerRecipeHandler.java index e89a1ce56..08d402a65 100644 --- a/src/main/java/techreborn/compat/nei/recipes/IndustrialElectrolyzerRecipeHandler.java +++ b/src/main/java/techreborn/compat/nei/recipes/IndustrialElectrolyzerRecipeHandler.java @@ -3,10 +3,10 @@ package techreborn.compat.nei.recipes; import codechicken.nei.PositionedStack; import codechicken.nei.recipe.TemplateRecipeHandler; import net.minecraft.client.gui.inventory.GuiContainer; +import reborncore.common.util.ItemUtils; import techreborn.api.recipe.IBaseRecipeType; import techreborn.client.gui.GuiIndustrialElectrolyzer; import techreborn.lib.Reference; -import techreborn.util.ItemUtils; import java.awt.*; import java.util.List; diff --git a/src/main/java/techreborn/compat/nei/recipes/IndustrialSawmillRecipeHandler.java b/src/main/java/techreborn/compat/nei/recipes/IndustrialSawmillRecipeHandler.java index 1aab80c20..e74cd843f 100644 --- a/src/main/java/techreborn/compat/nei/recipes/IndustrialSawmillRecipeHandler.java +++ b/src/main/java/techreborn/compat/nei/recipes/IndustrialSawmillRecipeHandler.java @@ -7,9 +7,9 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.util.IIcon; +import reborncore.client.gui.GuiUtil; import techreborn.api.recipe.IBaseRecipeType; import techreborn.api.recipe.machines.IndustrialSawmillRecipe; -import techreborn.client.GuiUtil; import techreborn.client.gui.GuiIndustrialSawmill; import techreborn.lib.Reference; diff --git a/src/main/java/techreborn/compat/recipes/RecipesBiomesOPlenty.java b/src/main/java/techreborn/compat/recipes/RecipesBiomesOPlenty.java index 64bb15bf9..149807950 100644 --- a/src/main/java/techreborn/compat/recipes/RecipesBiomesOPlenty.java +++ b/src/main/java/techreborn/compat/recipes/RecipesBiomesOPlenty.java @@ -25,64 +25,64 @@ public class RecipesBiomesOPlenty implements ICompatModule { @Override public void init(FMLInitializationEvent event) { - if (ConfigTechReborn.AllowBOPRecipes){ - ItemStack pulpStack = OreDictionary.getOres("pulpWood").get(0); - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs1, 1, 0), null, new FluidStack(FluidRegistry.WATER, 1000), new ItemStack(BOPCBlocks.planks, 6, 0), pulpStack, null, 200, 30, false)); - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs1, 1, 0), IC2Items.getItem("waterCell"), null, new ItemStack(BOPCBlocks.planks, 6, 0), pulpStack, IC2Items.getItem("cell"), 200, 30, false)); - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs1, 1, 0), new ItemStack(Items.water_bucket), null, new ItemStack(BOPCBlocks.planks, 6, 0), pulpStack, new ItemStack(Items.bucket), 200, 30, false)); - - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs1, 1, 1), null, new FluidStack(FluidRegistry.WATER, 1000), new ItemStack(BOPCBlocks.planks, 6, 1), pulpStack, null, 200, 30, false)); - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs1, 1, 1), IC2Items.getItem("waterCell"), null, new ItemStack(BOPCBlocks.planks, 6, 1), pulpStack, IC2Items.getItem("cell"), 200, 30, false)); - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs1, 1, 1), new ItemStack(Items.water_bucket), null, new ItemStack(BOPCBlocks.planks, 6, 1), pulpStack, new ItemStack(Items.bucket), 200, 30, false)); - - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs1, 1, 2), null, new FluidStack(FluidRegistry.WATER, 1000), new ItemStack(BOPCBlocks.planks, 6, 2), pulpStack, null, 200, 30, false)); - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs1, 1, 2), IC2Items.getItem("waterCell"), null, new ItemStack(BOPCBlocks.planks, 6, 2), pulpStack, IC2Items.getItem("cell"), 200, 30, false)); - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs1, 1, 2), new ItemStack(Items.water_bucket), null, new ItemStack(BOPCBlocks.planks, 6, 2), pulpStack, new ItemStack(Items.bucket), 200, 30, false)); - - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs1, 1, 3), null, new FluidStack(FluidRegistry.WATER, 1000), new ItemStack(BOPCBlocks.planks, 6, 3), pulpStack, null, 200, 30, false)); - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs1, 1, 3), IC2Items.getItem("waterCell"), null, new ItemStack(BOPCBlocks.planks, 6, 3), pulpStack, IC2Items.getItem("cell"), 200, 30, false)); - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs1, 1, 3), new ItemStack(Items.water_bucket), null, new ItemStack(BOPCBlocks.planks, 6, 3), pulpStack, new ItemStack(Items.bucket), 200, 30, false)); - - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs2, 1, 0), null, new FluidStack(FluidRegistry.WATER, 1000), new ItemStack(BOPCBlocks.planks, 6, 4), pulpStack, null, 200, 30, false)); - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs2, 1, 0), IC2Items.getItem("waterCell"), null, new ItemStack(BOPCBlocks.planks, 6, 4), pulpStack, IC2Items.getItem("cell"), 200, 30, false)); - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs2, 1, 0), new ItemStack(Items.water_bucket), null, new ItemStack(BOPCBlocks.planks, 6, 4), pulpStack, new ItemStack(Items.bucket), 200, 30, false)); - - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs2, 1, 1), null, new FluidStack(FluidRegistry.WATER, 1000), new ItemStack(BOPCBlocks.planks, 6, 5), pulpStack, null, 200, 30, false)); - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs2, 1, 1), IC2Items.getItem("waterCell"), null, new ItemStack(BOPCBlocks.planks, 6, 5), pulpStack, IC2Items.getItem("cell"), 200, 30, false)); - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs2, 1, 1), new ItemStack(Items.water_bucket), null, new ItemStack(BOPCBlocks.planks, 6, 5), pulpStack, new ItemStack(Items.bucket), 200, 30, false)); - - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs2, 1, 2), null, new FluidStack(FluidRegistry.WATER, 1000), new ItemStack(BOPCBlocks.planks, 6, 6), pulpStack, null, 200, 30, false)); - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs2, 1, 2), IC2Items.getItem("waterCell"), null, new ItemStack(BOPCBlocks.planks, 6, 6), pulpStack, IC2Items.getItem("cell"), 200, 30, false)); - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs2, 1, 2), new ItemStack(Items.water_bucket), null, new ItemStack(BOPCBlocks.planks, 6, 6), pulpStack, new ItemStack(Items.bucket), 200, 30, false)); - - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs2, 1, 3), null, new FluidStack(FluidRegistry.WATER, 1000), new ItemStack(BOPCBlocks.planks, 6, 7), pulpStack, null, 200, 30, false)); - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs2, 1, 3), IC2Items.getItem("waterCell"), null, new ItemStack(BOPCBlocks.planks, 6, 7), pulpStack, IC2Items.getItem("cell"), 200, 30, false)); - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs2, 1, 3), new ItemStack(Items.water_bucket), null, new ItemStack(BOPCBlocks.planks, 6, 7), pulpStack, new ItemStack(Items.bucket), 200, 30, false)); - - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs3, 1, 0), null, new FluidStack(FluidRegistry.WATER, 1000), new ItemStack(BOPCBlocks.planks, 6, 8), pulpStack, null, 200, 30, false)); - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs3, 1, 0), IC2Items.getItem("waterCell"), null, new ItemStack(BOPCBlocks.planks, 6, 8), pulpStack, IC2Items.getItem("cell"), 200, 30, false)); - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs3, 1, 0), new ItemStack(Items.water_bucket), null, new ItemStack(BOPCBlocks.planks, 6, 8), pulpStack, new ItemStack(Items.bucket), 200, 30, false)); - - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs3, 1, 1), null, new FluidStack(FluidRegistry.WATER, 1000), new ItemStack(BOPCBlocks.planks, 6, 9), pulpStack, null, 200, 30, false)); - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs3, 1, 1), IC2Items.getItem("waterCell"), null, new ItemStack(BOPCBlocks.planks, 6, 9), pulpStack, IC2Items.getItem("cell"), 200, 30, false)); - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs3, 1, 1), new ItemStack(Items.water_bucket), null, new ItemStack(BOPCBlocks.planks, 6, 9), pulpStack, new ItemStack(Items.bucket), 200, 30, false)); - - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs4, 1, 0), null, new FluidStack(FluidRegistry.WATER, 1000), new ItemStack(BOPCBlocks.planks, 6, 11), pulpStack, null, 200, 30, false)); - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs4, 1, 0), IC2Items.getItem("waterCell"), null, new ItemStack(BOPCBlocks.planks, 6, 11), pulpStack, IC2Items.getItem("cell"), 200, 30, false)); - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs4, 1, 0), new ItemStack(Items.water_bucket), null, new ItemStack(BOPCBlocks.planks, 6, 11), pulpStack, new ItemStack(Items.bucket), 200, 30, false)); - - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs4, 1, 1), null, new FluidStack(FluidRegistry.WATER, 1000), new ItemStack(BOPCBlocks.planks, 6, 12), pulpStack, null, 200, 30, false)); - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs4, 1, 1), IC2Items.getItem("waterCell"), null, new ItemStack(BOPCBlocks.planks, 6, 12), pulpStack, IC2Items.getItem("cell"), 200, 30, false)); - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs4, 1, 1), new ItemStack(Items.water_bucket), null, new ItemStack(BOPCBlocks.planks, 6, 12), pulpStack, new ItemStack(Items.bucket), 200, 30, false)); - - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs4, 1, 2), null, new FluidStack(FluidRegistry.WATER, 1000), new ItemStack(BOPCBlocks.planks, 6, 13), pulpStack, null, 200, 30, false)); - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs4, 1, 2), IC2Items.getItem("waterCell"), null, new ItemStack(BOPCBlocks.planks, 6, 13), pulpStack, IC2Items.getItem("cell"), 200, 30, false)); - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs4, 1, 2), new ItemStack(Items.water_bucket), null, new ItemStack(BOPCBlocks.planks, 6, 13), pulpStack, new ItemStack(Items.bucket), 200, 30, false)); - - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs4, 1, 3), null, new FluidStack(FluidRegistry.WATER, 1000), new ItemStack(BOPCBlocks.planks, 6, 14), pulpStack, null, 200, 30, false)); - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs4, 1, 3), IC2Items.getItem("waterCell"), null, new ItemStack(BOPCBlocks.planks, 6, 14), pulpStack, IC2Items.getItem("cell"), 200, 30, false)); - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs4, 1, 3), new ItemStack(Items.water_bucket), null, new ItemStack(BOPCBlocks.planks, 6, 14), pulpStack, new ItemStack(Items.bucket), 200, 30, false)); - } + if (ConfigTechReborn.AllowBOPRecipes) { + ItemStack pulpStack = OreDictionary.getOres("pulpWood").get(0); + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs1, 1, 0), null, new FluidStack(FluidRegistry.WATER, 1000), new ItemStack(BOPCBlocks.planks, 6, 0), pulpStack, null, 200, 30, false)); + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs1, 1, 0), IC2Items.getItem("waterCell"), null, new ItemStack(BOPCBlocks.planks, 6, 0), pulpStack, IC2Items.getItem("cell"), 200, 30, false)); + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs1, 1, 0), new ItemStack(Items.water_bucket), null, new ItemStack(BOPCBlocks.planks, 6, 0), pulpStack, new ItemStack(Items.bucket), 200, 30, false)); + + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs1, 1, 1), null, new FluidStack(FluidRegistry.WATER, 1000), new ItemStack(BOPCBlocks.planks, 6, 1), pulpStack, null, 200, 30, false)); + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs1, 1, 1), IC2Items.getItem("waterCell"), null, new ItemStack(BOPCBlocks.planks, 6, 1), pulpStack, IC2Items.getItem("cell"), 200, 30, false)); + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs1, 1, 1), new ItemStack(Items.water_bucket), null, new ItemStack(BOPCBlocks.planks, 6, 1), pulpStack, new ItemStack(Items.bucket), 200, 30, false)); + + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs1, 1, 2), null, new FluidStack(FluidRegistry.WATER, 1000), new ItemStack(BOPCBlocks.planks, 6, 2), pulpStack, null, 200, 30, false)); + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs1, 1, 2), IC2Items.getItem("waterCell"), null, new ItemStack(BOPCBlocks.planks, 6, 2), pulpStack, IC2Items.getItem("cell"), 200, 30, false)); + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs1, 1, 2), new ItemStack(Items.water_bucket), null, new ItemStack(BOPCBlocks.planks, 6, 2), pulpStack, new ItemStack(Items.bucket), 200, 30, false)); + + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs1, 1, 3), null, new FluidStack(FluidRegistry.WATER, 1000), new ItemStack(BOPCBlocks.planks, 6, 3), pulpStack, null, 200, 30, false)); + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs1, 1, 3), IC2Items.getItem("waterCell"), null, new ItemStack(BOPCBlocks.planks, 6, 3), pulpStack, IC2Items.getItem("cell"), 200, 30, false)); + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs1, 1, 3), new ItemStack(Items.water_bucket), null, new ItemStack(BOPCBlocks.planks, 6, 3), pulpStack, new ItemStack(Items.bucket), 200, 30, false)); + + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs2, 1, 0), null, new FluidStack(FluidRegistry.WATER, 1000), new ItemStack(BOPCBlocks.planks, 6, 4), pulpStack, null, 200, 30, false)); + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs2, 1, 0), IC2Items.getItem("waterCell"), null, new ItemStack(BOPCBlocks.planks, 6, 4), pulpStack, IC2Items.getItem("cell"), 200, 30, false)); + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs2, 1, 0), new ItemStack(Items.water_bucket), null, new ItemStack(BOPCBlocks.planks, 6, 4), pulpStack, new ItemStack(Items.bucket), 200, 30, false)); + + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs2, 1, 1), null, new FluidStack(FluidRegistry.WATER, 1000), new ItemStack(BOPCBlocks.planks, 6, 5), pulpStack, null, 200, 30, false)); + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs2, 1, 1), IC2Items.getItem("waterCell"), null, new ItemStack(BOPCBlocks.planks, 6, 5), pulpStack, IC2Items.getItem("cell"), 200, 30, false)); + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs2, 1, 1), new ItemStack(Items.water_bucket), null, new ItemStack(BOPCBlocks.planks, 6, 5), pulpStack, new ItemStack(Items.bucket), 200, 30, false)); + + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs2, 1, 2), null, new FluidStack(FluidRegistry.WATER, 1000), new ItemStack(BOPCBlocks.planks, 6, 6), pulpStack, null, 200, 30, false)); + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs2, 1, 2), IC2Items.getItem("waterCell"), null, new ItemStack(BOPCBlocks.planks, 6, 6), pulpStack, IC2Items.getItem("cell"), 200, 30, false)); + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs2, 1, 2), new ItemStack(Items.water_bucket), null, new ItemStack(BOPCBlocks.planks, 6, 6), pulpStack, new ItemStack(Items.bucket), 200, 30, false)); + + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs2, 1, 3), null, new FluidStack(FluidRegistry.WATER, 1000), new ItemStack(BOPCBlocks.planks, 6, 7), pulpStack, null, 200, 30, false)); + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs2, 1, 3), IC2Items.getItem("waterCell"), null, new ItemStack(BOPCBlocks.planks, 6, 7), pulpStack, IC2Items.getItem("cell"), 200, 30, false)); + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs2, 1, 3), new ItemStack(Items.water_bucket), null, new ItemStack(BOPCBlocks.planks, 6, 7), pulpStack, new ItemStack(Items.bucket), 200, 30, false)); + + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs3, 1, 0), null, new FluidStack(FluidRegistry.WATER, 1000), new ItemStack(BOPCBlocks.planks, 6, 8), pulpStack, null, 200, 30, false)); + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs3, 1, 0), IC2Items.getItem("waterCell"), null, new ItemStack(BOPCBlocks.planks, 6, 8), pulpStack, IC2Items.getItem("cell"), 200, 30, false)); + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs3, 1, 0), new ItemStack(Items.water_bucket), null, new ItemStack(BOPCBlocks.planks, 6, 8), pulpStack, new ItemStack(Items.bucket), 200, 30, false)); + + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs3, 1, 1), null, new FluidStack(FluidRegistry.WATER, 1000), new ItemStack(BOPCBlocks.planks, 6, 9), pulpStack, null, 200, 30, false)); + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs3, 1, 1), IC2Items.getItem("waterCell"), null, new ItemStack(BOPCBlocks.planks, 6, 9), pulpStack, IC2Items.getItem("cell"), 200, 30, false)); + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs3, 1, 1), new ItemStack(Items.water_bucket), null, new ItemStack(BOPCBlocks.planks, 6, 9), pulpStack, new ItemStack(Items.bucket), 200, 30, false)); + + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs4, 1, 0), null, new FluidStack(FluidRegistry.WATER, 1000), new ItemStack(BOPCBlocks.planks, 6, 11), pulpStack, null, 200, 30, false)); + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs4, 1, 0), IC2Items.getItem("waterCell"), null, new ItemStack(BOPCBlocks.planks, 6, 11), pulpStack, IC2Items.getItem("cell"), 200, 30, false)); + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs4, 1, 0), new ItemStack(Items.water_bucket), null, new ItemStack(BOPCBlocks.planks, 6, 11), pulpStack, new ItemStack(Items.bucket), 200, 30, false)); + + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs4, 1, 1), null, new FluidStack(FluidRegistry.WATER, 1000), new ItemStack(BOPCBlocks.planks, 6, 12), pulpStack, null, 200, 30, false)); + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs4, 1, 1), IC2Items.getItem("waterCell"), null, new ItemStack(BOPCBlocks.planks, 6, 12), pulpStack, IC2Items.getItem("cell"), 200, 30, false)); + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs4, 1, 1), new ItemStack(Items.water_bucket), null, new ItemStack(BOPCBlocks.planks, 6, 12), pulpStack, new ItemStack(Items.bucket), 200, 30, false)); + + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs4, 1, 2), null, new FluidStack(FluidRegistry.WATER, 1000), new ItemStack(BOPCBlocks.planks, 6, 13), pulpStack, null, 200, 30, false)); + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs4, 1, 2), IC2Items.getItem("waterCell"), null, new ItemStack(BOPCBlocks.planks, 6, 13), pulpStack, IC2Items.getItem("cell"), 200, 30, false)); + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs4, 1, 2), new ItemStack(Items.water_bucket), null, new ItemStack(BOPCBlocks.planks, 6, 13), pulpStack, new ItemStack(Items.bucket), 200, 30, false)); + + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs4, 1, 3), null, new FluidStack(FluidRegistry.WATER, 1000), new ItemStack(BOPCBlocks.planks, 6, 14), pulpStack, null, 200, 30, false)); + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs4, 1, 3), IC2Items.getItem("waterCell"), null, new ItemStack(BOPCBlocks.planks, 6, 14), pulpStack, IC2Items.getItem("cell"), 200, 30, false)); + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(BOPCBlocks.logs4, 1, 3), new ItemStack(Items.water_bucket), null, new ItemStack(BOPCBlocks.planks, 6, 14), pulpStack, new ItemStack(Items.bucket), 200, 30, false)); + } } @Override diff --git a/src/main/java/techreborn/compat/recipes/RecipesBuildcraft.java b/src/main/java/techreborn/compat/recipes/RecipesBuildcraft.java index 8e3d8be83..9c256d4fc 100644 --- a/src/main/java/techreborn/compat/recipes/RecipesBuildcraft.java +++ b/src/main/java/techreborn/compat/recipes/RecipesBuildcraft.java @@ -12,12 +12,12 @@ import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraftforge.oredict.OreDictionary; -import techreborn.api.fuel.FluidPowerManager; +import reborncore.api.fuel.FluidPowerManager; +import reborncore.common.util.CraftingHelper; +import reborncore.common.util.RecipeRemover; +import techreborn.Core; import techreborn.compat.ICompatModule; import techreborn.config.ConfigTechReborn; -import techreborn.util.CraftingHelper; -import techreborn.util.LogHelper; -import techreborn.util.RecipeRemover; public class RecipesBuildcraft implements ICompatModule { @@ -56,7 +56,7 @@ public class RecipesBuildcraft implements ICompatModule { @Override public void postInit(FMLPostInitializationEvent event) { - LogHelper.info("Trying to change the quarry recipe"); + Core.logHelper.info("Trying to change the quarry recipe"); try { String itemClass = "buildcraft.BuildCraftBuilders"; if (!Version.getVersion().startsWith("7")) {//Buildcraft 6 @@ -64,27 +64,27 @@ public class RecipesBuildcraft implements ICompatModule { itemClass = "buildcraft.BuildCraftFactory"; } } else if (!Version.getVersion().startsWith("7") && !Loader.isModLoaded("BuildCraft|Builders")) { //Buildcraft 7 - LogHelper.info("Buildcraft not found"); + Core.logHelper.info("Buildcraft not found"); return; } Object obj = Class.forName(itemClass).getField("quarryBlock").get(null); if (obj instanceof Block) { quarryBlock = (Block) obj; - LogHelper.info("Found Quarry Block from buildcraft at " + itemClass + ":quarryBlock"); + Core.logHelper.info("Found Quarry Block from buildcraft at " + itemClass + ":quarryBlock"); } else { - LogHelper.fatal("Could not retrieve quarry block from Buildcraft! This is a fatal error!"); + Core.logHelper.fatal("Could not retrieve quarry block from Buildcraft! This is a fatal error!"); return; } } catch (Exception ex) { - LogHelper.fatal("Could not retrieve quarry block from Buildcraft! This is a fatal error!"); + Core.logHelper.fatal("Could not retrieve quarry block from Buildcraft! This is a fatal error!"); ex.printStackTrace(); return; } removeRecipes(); addRecipies(); - for(IFuel fuel : buildcraft.energy.fuels.FuelManager.INSTANCE.getFuels()){ - FluidPowerManager.fluidPowerValues.put(fuel.getFluid(), (double) fuel.getPowerPerCycle() / ConfigTechReborn.euPerRF); - } + for (IFuel fuel : buildcraft.energy.fuels.FuelManager.INSTANCE.getFuels()) { + FluidPowerManager.fluidPowerValues.put(fuel.getFluid(), (double) fuel.getPowerPerCycle() / ConfigTechReborn.euPerRF); + } } @Override diff --git a/src/main/java/techreborn/compat/recipes/RecipesForestry.java b/src/main/java/techreborn/compat/recipes/RecipesForestry.java index 329f40ffc..064f12047 100644 --- a/src/main/java/techreborn/compat/recipes/RecipesForestry.java +++ b/src/main/java/techreborn/compat/recipes/RecipesForestry.java @@ -8,7 +8,6 @@ import forestry.api.arboriculture.EnumWoodType; import forestry.api.arboriculture.TreeManager; import forestry.api.fuels.FuelManager; import forestry.api.fuels.GeneratorFuel; -import forestry.core.config.Version; import ic2.api.item.IC2Items; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; @@ -16,7 +15,7 @@ import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.oredict.OreDictionary; -import techreborn.api.fuel.FluidPowerManager; +import reborncore.api.fuel.FluidPowerManager; import techreborn.api.recipe.RecipeHandler; import techreborn.api.recipe.machines.IndustrialSawmillRecipe; import techreborn.compat.ICompatModule; diff --git a/src/main/java/techreborn/compat/recipes/RecipesIC2.java b/src/main/java/techreborn/compat/recipes/RecipesIC2.java index eae9bf664..4304d5c89 100644 --- a/src/main/java/techreborn/compat/recipes/RecipesIC2.java +++ b/src/main/java/techreborn/compat/recipes/RecipesIC2.java @@ -19,6 +19,9 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.oredict.OreDictionary; +import reborncore.common.util.CraftingHelper; +import reborncore.common.util.RecipeRemover; +import techreborn.Core; import techreborn.api.recipe.RecipeHandler; import techreborn.api.recipe.machines.*; import techreborn.compat.ICompatModule; @@ -27,9 +30,6 @@ import techreborn.init.ModBlocks; import techreborn.init.ModFluids; import techreborn.init.ModItems; import techreborn.items.*; -import techreborn.util.CraftingHelper; -import techreborn.util.LogHelper; -import techreborn.util.RecipeRemover; public class RecipesIC2 implements ICompatModule { @@ -461,7 +461,7 @@ public class RecipesIC2 implements ICompatModule { RecipeHandler.addRecipe(new GrinderRecipe(oreStack, ItemCells.getCellByName("mercury", 1), null, ItemDusts.getDustByName("copper", 2), ItemDustsSmall.getSmallDustByName("Gold", 1), ItemDusts.getDustByName("nickel", 1), IC2Items.getItem("cell"), 100, 120)); } catch (Exception e) { - LogHelper.info("Failed to Load Grinder Recipe for Copper Ore"); + Core.logHelper.info("Failed to Load Grinder Recipe for Copper Ore"); } } @@ -472,7 +472,7 @@ public class RecipesIC2 implements ICompatModule { RecipeHandler.addRecipe(new GrinderRecipe(oreStack, IC2Items.getItem("waterCell"), null, ItemDusts.getDustByName("tin", 2), ItemDustsSmall.getSmallDustByName("Iron", 1), ItemDustsSmall.getSmallDustByName("Zinc", 1), IC2Items.getItem("cell"), 100, 120)); RecipeHandler.addRecipe(new GrinderRecipe(oreStack, ItemCells.getCellByName("sodiumPersulfate", 1), null, ItemDusts.getDustByName("tin", 2), ItemDustsSmall.getSmallDustByName("Iron", 1), ItemDusts.getDustByName("zinc", 1), IC2Items.getItem("cell"), 100, 120)); } catch (Exception e) { - LogHelper.info("Failed to Load Grinder Recipe for Tin Ore"); + Core.logHelper.info("Failed to Load Grinder Recipe for Tin Ore"); } } @@ -484,7 +484,7 @@ public class RecipesIC2 implements ICompatModule { RecipeHandler.addRecipe(new GrinderRecipe(oreStack, ItemCells.getCellByName("sodiumPersulfate", 1), null, ItemDusts.getDustByName("nickel", 3), ItemDustsSmall.getSmallDustByName("Iron", 1), ItemDustsSmall.getSmallDustByName("Platinum", 1), IC2Items.getItem("cell"), 100, 120)); RecipeHandler.addRecipe(new GrinderRecipe(oreStack, ItemCells.getCellByName("mercury", 1), null, ItemDusts.getDustByName("nickel", 2), ItemDustsSmall.getSmallDustByName("Iron", 1), ItemDusts.getDustByName("platinum", 1), IC2Items.getItem("cell"), 100, 120)); } catch (Exception e) { - LogHelper.info("Failed to Load Grinder Recipe for Nickel Ore"); + Core.logHelper.info("Failed to Load Grinder Recipe for Nickel Ore"); } } @@ -495,7 +495,7 @@ public class RecipesIC2 implements ICompatModule { RecipeHandler.addRecipe(new GrinderRecipe(oreStack, IC2Items.getItem("waterCell"), null, ItemDusts.getDustByName("zinc", 2), ItemDustsSmall.getSmallDustByName("Iron", 1), ItemDustsSmall.getSmallDustByName("Tin", 1), IC2Items.getItem("cell"), 100, 120)); RecipeHandler.addRecipe(new GrinderRecipe(oreStack, ItemCells.getCellByName("sodiumPersulfate", 1), null, ItemDusts.getDustByName("zinc", 2), ItemDustsSmall.getSmallDustByName("Iron", 1), ItemDusts.getDustByName("iron", 1), IC2Items.getItem("cell"), 100, 120)); } catch (Exception e) { - LogHelper.info("Failed to Load Grinder Recipe for Zinc Ore"); + Core.logHelper.info("Failed to Load Grinder Recipe for Zinc Ore"); } } @@ -506,7 +506,7 @@ public class RecipesIC2 implements ICompatModule { RecipeHandler.addRecipe(new GrinderRecipe(oreStack, IC2Items.getItem("waterCell"), null, ItemDusts.getDustByName("silver", 2), ItemDustsSmall.getSmallDustByName("Lead", 1), ItemDustsSmall.getSmallDustByName("Sulfur", 1), IC2Items.getItem("cell"), 100, 120)); RecipeHandler.addRecipe(new GrinderRecipe(oreStack, ItemCells.getCellByName("mercury", 1), null, ItemDusts.getDustByName("silver", 3), ItemDustsSmall.getSmallDustByName("Lead", 1), ItemDustsSmall.getSmallDustByName("Sulfur", 1), IC2Items.getItem("cell"), 100, 120)); } catch (Exception e) { - LogHelper.info("Failed to Load Grinder Recipe for Silver Ore"); + Core.logHelper.info("Failed to Load Grinder Recipe for Silver Ore"); } } @@ -517,7 +517,7 @@ public class RecipesIC2 implements ICompatModule { RecipeHandler.addRecipe(new GrinderRecipe(oreStack, IC2Items.getItem("waterCell"), null, ItemDusts.getDustByName("lead", 2), ItemDustsSmall.getSmallDustByName("Silver", 1), ItemDustsSmall.getSmallDustByName("Sulfur", 1), IC2Items.getItem("cell"), 100, 120)); RecipeHandler.addRecipe(new GrinderRecipe(oreStack, ItemCells.getCellByName("mercury", 1), null, ItemDusts.getDustByName("lead", 2), ItemDusts.getDustByName("silver", 1), ItemDustsSmall.getSmallDustByName("Sulfur", 1), IC2Items.getItem("cell"), 100, 120)); } catch (Exception e) { - LogHelper.info("Failed to Load Grinder Recipe for Lead Ore"); + Core.logHelper.info("Failed to Load Grinder Recipe for Lead Ore"); } } @@ -533,7 +533,7 @@ public class RecipesIC2 implements ICompatModule { RecipeHandler.addRecipe(new GrinderRecipe(oreStack, IC2Items.getItem("waterCell"), null, uranium238Stack, uranium235Stack, null, IC2Items.getItem("cell"), 100, 120)); RecipeHandler.addRecipe(new GrinderRecipe(oreStack, new ItemStack(Items.water_bucket), null, uranium238Stack, uranium235Stack, null, new ItemStack(Items.bucket), 100, 120)); } catch (Exception e) { - LogHelper.info("Failed to Load Grinder Recipe for Uranium Ore"); + Core.logHelper.info("Failed to Load Grinder Recipe for Uranium Ore"); } } @@ -549,7 +549,7 @@ public class RecipesIC2 implements ICompatModule { RecipeHandler.addRecipe(new GrinderRecipe(oreStack, IC2Items.getItem("waterCell"), null, uranium238Stack, uranium235Stack, null, IC2Items.getItem("cell"), 100, 120)); RecipeHandler.addRecipe(new GrinderRecipe(oreStack, new ItemStack(Items.water_bucket), null, uranium238Stack, uranium235Stack, null, new ItemStack(Items.bucket), 100, 120)); } catch (Exception e) { - LogHelper.info("Failed to Load Grinder Recipe for Uranium Ore"); + Core.logHelper.info("Failed to Load Grinder Recipe for Uranium Ore"); } } @@ -559,7 +559,7 @@ public class RecipesIC2 implements ICompatModule { ItemStack oreStack = OreDictionary.getOres("oreAluminum").get(0); RecipeHandler.addRecipe(new GrinderRecipe(oreStack, IC2Items.getItem("waterCell"), null, ItemDusts.getDustByName("aluminum", 2), ItemDustsSmall.getSmallDustByName("Bauxite", 1), ItemDustsSmall.getSmallDustByName("Bauxite", 1), IC2Items.getItem("cell"), 100, 120)); } catch (Exception e) { - LogHelper.info("Failed to Load Grinder Recipe for Lead Ore"); + Core.logHelper.info("Failed to Load Grinder Recipe for Lead Ore"); } } @@ -569,7 +569,7 @@ public class RecipesIC2 implements ICompatModule { ItemStack oreStack = OreDictionary.getOres("oreArdite").get(0); RecipeHandler.addRecipe(new GrinderRecipe(oreStack, IC2Items.getItem("waterCell"), null, ItemDusts.getDustByName("ardite", 2), ItemDustsSmall.getSmallDustByName("Ardite", 1), ItemDustsSmall.getSmallDustByName("Ardite", 1), IC2Items.getItem("cell"), 100, 120)); } catch (Exception e) { - LogHelper.info("Failed to Load Grinder Recipe for Ardite Ore"); + Core.logHelper.info("Failed to Load Grinder Recipe for Ardite Ore"); } } @@ -579,7 +579,7 @@ public class RecipesIC2 implements ICompatModule { ItemStack oreStack = OreDictionary.getOres("oreCobalt").get(0); RecipeHandler.addRecipe(new GrinderRecipe(oreStack, IC2Items.getItem("waterCell"), null, ItemDusts.getDustByName("cobalt", 2), ItemDustsSmall.getSmallDustByName("Cobalt", 1), ItemDustsSmall.getSmallDustByName("Cobalt", 1), IC2Items.getItem("cell"), 100, 120)); } catch (Exception e) { - LogHelper.info("Failed to Load Grinder Recipe for Cobalt Ore"); + Core.logHelper.info("Failed to Load Grinder Recipe for Cobalt Ore"); } } @@ -589,7 +589,7 @@ public class RecipesIC2 implements ICompatModule { ItemStack oreStack = OreDictionary.getOres("oreDarkIron").get(0); RecipeHandler.addRecipe(new GrinderRecipe(oreStack, IC2Items.getItem("waterCell"), null, ItemDusts.getDustByName("darkIron", 2), ItemDustsSmall.getSmallDustByName("DarkIron", 1), ItemDustsSmall.getSmallDustByName("Iron", 1), IC2Items.getItem("cell"), 100, 120)); } catch (Exception e) { - LogHelper.info("Failed to Load Grinder Recipe for Dark Iron Ore"); + Core.logHelper.info("Failed to Load Grinder Recipe for Dark Iron Ore"); } } @@ -599,7 +599,7 @@ public class RecipesIC2 implements ICompatModule { ItemStack oreStack = OreDictionary.getOres("oreCadmium").get(0); RecipeHandler.addRecipe(new GrinderRecipe(oreStack, IC2Items.getItem("waterCell"), null, ItemDusts.getDustByName("cadmium", 2), ItemDustsSmall.getSmallDustByName("Cadmium", 1), ItemDustsSmall.getSmallDustByName("Cadmium", 1), IC2Items.getItem("cell"), 100, 120)); } catch (Exception e) { - LogHelper.info("Failed to Load Grinder Recipe for Cadmium Ore"); + Core.logHelper.info("Failed to Load Grinder Recipe for Cadmium Ore"); } } @@ -609,7 +609,7 @@ public class RecipesIC2 implements ICompatModule { ItemStack oreStack = OreDictionary.getOres("oreIndium").get(0); RecipeHandler.addRecipe(new GrinderRecipe(oreStack, IC2Items.getItem("waterCell"), null, ItemDusts.getDustByName("indium", 2), ItemDustsSmall.getSmallDustByName("Indium", 1), ItemDustsSmall.getSmallDustByName("Indium", 1), IC2Items.getItem("cell"), 100, 120)); } catch (Exception e) { - LogHelper.info("Failed to Load Grinder Recipe for Indium Ore"); + Core.logHelper.info("Failed to Load Grinder Recipe for Indium Ore"); } } @@ -620,7 +620,7 @@ public class RecipesIC2 implements ICompatModule { ItemStack gemStack = OreDictionary.getOres("gemCalcite").get(0); RecipeHandler.addRecipe(new GrinderRecipe(oreStack, IC2Items.getItem("waterCell"), null, gemStack, ItemDustsSmall.getSmallDustByName("Calcite", 6), null, IC2Items.getItem("cell"), 100, 120)); } catch (Exception e) { - LogHelper.info("Failed to Load Grinder Recipe for Calcite Ore"); + Core.logHelper.info("Failed to Load Grinder Recipe for Calcite Ore"); } } @@ -631,7 +631,7 @@ public class RecipesIC2 implements ICompatModule { ItemStack chunkStack = OreDictionary.getOres("chunkMagnetite").get(0); RecipeHandler.addRecipe(new GrinderRecipe(oreStack, IC2Items.getItem("waterCell"), null, chunkStack, ItemDustsSmall.getSmallDustByName("Magnetite", 6), null, IC2Items.getItem("cell"), 100, 120)); } catch (Exception e) { - LogHelper.info("Failed to Load Grinder Recipe for Magnetite Ore"); + Core.logHelper.info("Failed to Load Grinder Recipe for Magnetite Ore"); } } @@ -642,7 +642,7 @@ public class RecipesIC2 implements ICompatModule { ItemStack chunkStack = OreDictionary.getOres("chunkGraphite").get(0); RecipeHandler.addRecipe(new GrinderRecipe(oreStack, IC2Items.getItem("waterCell"), null, chunkStack, ItemDustsSmall.getSmallDustByName("Graphite", 6), null, IC2Items.getItem("cell"), 100, 120)); } catch (Exception e) { - LogHelper.info("Failed to Load Grinder Recipe for Graphite Ore"); + Core.logHelper.info("Failed to Load Grinder Recipe for Graphite Ore"); } } @@ -652,7 +652,7 @@ public class RecipesIC2 implements ICompatModule { ItemStack oreStack = OreDictionary.getOres("oreOsmium").get(0); RecipeHandler.addRecipe(new GrinderRecipe(oreStack, IC2Items.getItem("waterCell"), null, ItemDusts.getDustByName("osmium", 2), ItemDustsSmall.getSmallDustByName("Osmium", 1), ItemDustsSmall.getSmallDustByName("Osmium", 1), IC2Items.getItem("cell"), 100, 120)); } catch (Exception e) { - LogHelper.info("Failed to Load Grinder Recipe for Osmium Ore"); + Core.logHelper.info("Failed to Load Grinder Recipe for Osmium Ore"); } } @@ -664,7 +664,7 @@ public class RecipesIC2 implements ICompatModule { dustStack.stackSize = 10; RecipeHandler.addRecipe(new GrinderRecipe(oreStack, IC2Items.getItem("waterCell"), null, dustStack, ItemDustsSmall.getSmallDustByName("Sodalite", 1), ItemDustsSmall.getSmallDustByName("Glowstone", 1), IC2Items.getItem("cell"), 100, 120)); } catch (Exception e) { - LogHelper.info("Failed to Load Grinder Recipe for Teslatite Ore"); + Core.logHelper.info("Failed to Load Grinder Recipe for Teslatite Ore"); } } @@ -674,7 +674,7 @@ public class RecipesIC2 implements ICompatModule { ItemStack oreStack = OreDictionary.getOres("oreSulfur").get(0); RecipeHandler.addRecipe(new GrinderRecipe(oreStack, IC2Items.getItem("waterCell"), null, ItemDusts.getDustByName("sulfur", 2), ItemDustsSmall.getSmallDustByName("Sulfur", 1), ItemDustsSmall.getSmallDustByName("Sulfur", 1), IC2Items.getItem("cell"), 100, 120)); } catch (Exception e) { - LogHelper.info("Failed to Load Grinder Recipe for Sulfur Ore"); + Core.logHelper.info("Failed to Load Grinder Recipe for Sulfur Ore"); } } @@ -684,7 +684,7 @@ public class RecipesIC2 implements ICompatModule { ItemStack oreStack = OreDictionary.getOres("oreSaltpeter").get(0); RecipeHandler.addRecipe(new GrinderRecipe(oreStack, IC2Items.getItem("waterCell"), null, ItemDusts.getDustByName("saltpeter", 2), ItemDustsSmall.getSmallDustByName("Saltpeter", 1), ItemDustsSmall.getSmallDustByName("Saltpeter", 1), IC2Items.getItem("cell"), 100, 120)); } catch (Exception e) { - LogHelper.info("Failed to Load Grinder Recipe for Saltpeter Ore"); + Core.logHelper.info("Failed to Load Grinder Recipe for Saltpeter Ore"); } } @@ -696,7 +696,7 @@ public class RecipesIC2 implements ICompatModule { gemStack.stackSize = 6; RecipeHandler.addRecipe(new GrinderRecipe(oreStack, IC2Items.getItem("waterCell"), null, gemStack, gemStack, ItemDustsSmall.getSmallDustByName("Phosphorous", 4), IC2Items.getItem("cell"), 100, 120)); } catch (Exception e) { - LogHelper.info("Failed to Load Grinder Recipe for Apatite Ore"); + Core.logHelper.info("Failed to Load Grinder Recipe for Apatite Ore"); } } @@ -707,7 +707,7 @@ public class RecipesIC2 implements ICompatModule { dustStack.stackSize = 4; RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(Blocks.quartz_ore, 1), IC2Items.getItem("waterCell"), null, new ItemStack(Items.quartz, 2), dustStack, ItemDustsSmall.getSmallDustByName("Netherrack", 2), IC2Items.getItem("cell"), 100, 120)); } catch (Exception e) { - LogHelper.info("Failed to Load Grinder Recipe for Nether Quartz Ore"); + Core.logHelper.info("Failed to Load Grinder Recipe for Nether Quartz Ore"); } } @@ -720,7 +720,7 @@ public class RecipesIC2 implements ICompatModule { dustStack.stackSize = 2; RecipeHandler.addRecipe(new GrinderRecipe(oreStack, IC2Items.getItem("waterCell"), null, gemStack, dustStack, null, IC2Items.getItem("cell"), 100, 120)); } catch (Exception e) { - LogHelper.info("Failed to Load Grinder Recipe for Certus Quartz Ore"); + Core.logHelper.info("Failed to Load Grinder Recipe for Certus Quartz Ore"); } } @@ -733,7 +733,7 @@ public class RecipesIC2 implements ICompatModule { dustStack.stackSize = 2; RecipeHandler.addRecipe(new GrinderRecipe(oreStack, IC2Items.getItem("waterCell"), null, gemStack, dustStack, null, IC2Items.getItem("cell"), 100, 120)); } catch (Exception e) { - LogHelper.info("Failed to Load Grinder Recipe for Charged Certus Quartz Ore"); + Core.logHelper.info("Failed to Load Grinder Recipe for Charged Certus Quartz Ore"); } } @@ -747,7 +747,7 @@ public class RecipesIC2 implements ICompatModule { dustStack.stackSize = 1; RecipeHandler.addRecipe(new GrinderRecipe(oreStack, IC2Items.getItem("waterCell"), null, gemStack, dustStack, null, IC2Items.getItem("cell"), 100, 120)); } catch (Exception e) { - LogHelper.info("Failed to Load Grinder Recipe for Certus Quartz Ore"); + Core.logHelper.info("Failed to Load Grinder Recipe for Certus Quartz Ore"); } } @@ -761,7 +761,7 @@ public class RecipesIC2 implements ICompatModule { dustStack.stackSize = 1; RecipeHandler.addRecipe(new GrinderRecipe(oreStack, IC2Items.getItem("waterCell"), null, gemStack, dustStack, null, IC2Items.getItem("cell"), 100, 120)); } catch (Exception e) { - LogHelper.info("Failed to Load Grinder Recipe for Topaz Ore"); + Core.logHelper.info("Failed to Load Grinder Recipe for Topaz Ore"); } } @@ -775,7 +775,7 @@ public class RecipesIC2 implements ICompatModule { dustStack.stackSize = 1; RecipeHandler.addRecipe(new GrinderRecipe(oreStack, IC2Items.getItem("waterCell"), null, gemStack, dustStack, null, IC2Items.getItem("cell"), 100, 120)); } catch (Exception e) { - LogHelper.info("Failed to Load Grinder Recipe for Tanzanite Ore"); + Core.logHelper.info("Failed to Load Grinder Recipe for Tanzanite Ore"); } } @@ -789,7 +789,7 @@ public class RecipesIC2 implements ICompatModule { dustStack.stackSize = 1; RecipeHandler.addRecipe(new GrinderRecipe(oreStack, IC2Items.getItem("waterCell"), null, gemStack, dustStack, null, IC2Items.getItem("cell"), 100, 120)); } catch (Exception e) { - LogHelper.info("Failed to Load Grinder Recipe for Malachite Ore"); + Core.logHelper.info("Failed to Load Grinder Recipe for Malachite Ore"); } } @@ -1132,7 +1132,7 @@ public class RecipesIC2 implements ICompatModule { RecipeRemover.removeAnyRecipe(IC2Items.getItem("windMill")); } - LogHelper.info("IC2 Recipes Removed"); + Core.logHelper.info("IC2 Recipes Removed"); } static void addShappedIc2Recipes() { @@ -1178,7 +1178,7 @@ public class RecipesIC2 implements ICompatModule { 'D', ItemDusts.getDustByName("diamond"), 'A', IC2Items.getItem("advancedAlloy")); - LogHelper.info("Added Expensive IC2 Recipes"); + Core.logHelper.info("Added Expensive IC2 Recipes"); } static void addTRMaceratorRecipes() { diff --git a/src/main/java/techreborn/compat/recipes/RecipesNatura.java b/src/main/java/techreborn/compat/recipes/RecipesNatura.java index 4226b6144..102338a4c 100644 --- a/src/main/java/techreborn/compat/recipes/RecipesNatura.java +++ b/src/main/java/techreborn/compat/recipes/RecipesNatura.java @@ -25,56 +25,56 @@ public class RecipesNatura implements ICompatModule { @Override public void init(FMLInitializationEvent event) { - if (ConfigTechReborn.AllowNaturaRecipes) { - ItemStack pulpStack = OreDictionary.getOres("pulpWood").get(0); - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(NContent.tree, 1, 0), null, new FluidStack(FluidRegistry.WATER, 1000), new ItemStack(NContent.planks, 6, 0), pulpStack, null, 200, 30, false)); - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(NContent.tree, 1, 0), IC2Items.getItem("waterCell"), null, new ItemStack(NContent.planks, 6, 0), pulpStack, IC2Items.getItem("cell"), 200, 30, false)); - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(NContent.tree, 1, 0), new ItemStack(Items.water_bucket), null, new ItemStack(NContent.planks, 6, 0), pulpStack, new ItemStack(Items.bucket), 200, 30, false)); - - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(NContent.tree, 1, 1), null, new FluidStack(FluidRegistry.WATER, 1000), new ItemStack(NContent.planks, 6, 1), pulpStack, null, 200, 30, false)); - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(NContent.tree, 1, 1), IC2Items.getItem("waterCell"), null, new ItemStack(NContent.planks, 6, 1), pulpStack, IC2Items.getItem("cell"), 200, 30, false)); - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(NContent.tree, 1, 1), new ItemStack(Items.water_bucket), null, new ItemStack(NContent.planks, 6, 1), pulpStack, new ItemStack(Items.bucket), 200, 30, false)); - - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(NContent.tree, 1, 2), null, new FluidStack(FluidRegistry.WATER, 1000), new ItemStack(NContent.planks, 6, 2), pulpStack, null, 200, 30, false)); - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(NContent.tree, 1, 2), IC2Items.getItem("waterCell"), null, new ItemStack(NContent.planks, 6, 2), pulpStack, IC2Items.getItem("cell"), 200, 30, false)); - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(NContent.tree, 1, 2), new ItemStack(Items.water_bucket), null, new ItemStack(NContent.planks, 6, 2), pulpStack, new ItemStack(Items.bucket), 200, 30, false)); - - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(NContent.tree, 1, 3), null, new FluidStack(FluidRegistry.WATER, 1000), new ItemStack(NContent.planks, 6, 5), pulpStack, null, 200, 30, false)); - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(NContent.tree, 1, 3), IC2Items.getItem("waterCell"), null, new ItemStack(NContent.planks, 6, 5), pulpStack, IC2Items.getItem("cell"), 200, 30, false)); - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(NContent.tree, 1, 3), new ItemStack(Items.water_bucket), null, new ItemStack(NContent.planks, 6, 5), pulpStack, new ItemStack(Items.bucket), 200, 30, false)); - - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(NContent.redwood, 1, 1), null, new FluidStack(FluidRegistry.WATER, 1000), new ItemStack(NContent.planks, 6, 3), pulpStack, null, 200, 30, false)); - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(NContent.redwood, 1, 1), IC2Items.getItem("waterCell"), null, new ItemStack(NContent.planks, 6, 3), pulpStack, IC2Items.getItem("cell"), 200, 30, false)); - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(NContent.redwood, 1, 1), new ItemStack(Items.water_bucket), null, new ItemStack(NContent.planks, 6, 3), pulpStack, new ItemStack(Items.bucket), 200, 30, false)); - - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(NContent.willow, 1, 0), null, new FluidStack(FluidRegistry.WATER, 1000), new ItemStack(NContent.planks, 6, 10), pulpStack, null, 200, 30, false)); - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(NContent.willow, 1, 0), IC2Items.getItem("waterCell"), null, new ItemStack(NContent.planks, 6, 10), pulpStack, IC2Items.getItem("cell"), 200, 30, false)); - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(NContent.willow, 1, 0), new ItemStack(Items.water_bucket), null, new ItemStack(NContent.planks, 6, 10), pulpStack, new ItemStack(Items.bucket), 200, 30, false)); - - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(NContent.rareTree, 1, 0), null, new FluidStack(FluidRegistry.WATER, 1000), new ItemStack(NContent.planks, 6, 6), pulpStack, null, 200, 30, false)); - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(NContent.rareTree, 1, 0), IC2Items.getItem("waterCell"), null, new ItemStack(NContent.planks, 6, 6), pulpStack, IC2Items.getItem("cell"), 200, 30, false)); - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(NContent.rareTree, 1, 0), new ItemStack(Items.water_bucket), null, new ItemStack(NContent.planks, 6, 6), pulpStack, new ItemStack(Items.bucket), 200, 30, false)); - - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(NContent.rareTree, 1, 1), null, new FluidStack(FluidRegistry.WATER, 1000), new ItemStack(NContent.planks, 6, 7), pulpStack, null, 200, 30, false)); - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(NContent.rareTree, 1, 1), IC2Items.getItem("waterCell"), null, new ItemStack(NContent.planks, 6, 7), pulpStack, IC2Items.getItem("cell"), 200, 30, false)); - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(NContent.rareTree, 1, 1), new ItemStack(Items.water_bucket), null, new ItemStack(NContent.planks, 6, 7), pulpStack, new ItemStack(Items.bucket), 200, 30, false)); - - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(NContent.rareTree, 1, 2), null, new FluidStack(FluidRegistry.WATER, 1000), new ItemStack(NContent.planks, 6, 8), pulpStack, null, 200, 30, false)); - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(NContent.rareTree, 1, 2), IC2Items.getItem("waterCell"), null, new ItemStack(NContent.planks, 6, 8), pulpStack, IC2Items.getItem("cell"), 200, 30, false)); - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(NContent.rareTree, 1, 2), new ItemStack(Items.water_bucket), null, new ItemStack(NContent.planks, 6, 8), pulpStack, new ItemStack(Items.bucket), 200, 30, false)); - - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(NContent.rareTree, 1, 3), null, new FluidStack(FluidRegistry.WATER, 1000), new ItemStack(NContent.planks, 6, 9), pulpStack, null, 200, 30, false)); - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(NContent.rareTree, 1, 3), IC2Items.getItem("waterCell"), null, new ItemStack(NContent.planks, 6, 9), pulpStack, IC2Items.getItem("cell"), 200, 30, false)); - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(NContent.rareTree, 1, 3), new ItemStack(Items.water_bucket), null, new ItemStack(NContent.planks, 6, 9), pulpStack, new ItemStack(Items.bucket), 200, 30, false)); - - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(NContent.darkTree, 1, 0), null, new FluidStack(FluidRegistry.WATER, 1000), new ItemStack(NContent.planks, 6, 11), pulpStack, null, 200, 30, false)); - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(NContent.darkTree, 1, 0), IC2Items.getItem("waterCell"), null, new ItemStack(NContent.planks, 6, 11), pulpStack, IC2Items.getItem("cell"), 200, 30, false)); - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(NContent.darkTree, 1, 0), new ItemStack(Items.water_bucket), null, new ItemStack(NContent.planks, 6, 11), pulpStack, new ItemStack(Items.bucket), 200, 30, false)); - - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(NContent.darkTree, 1, 1), null, new FluidStack(FluidRegistry.WATER, 1000), new ItemStack(NContent.planks, 6, 12), pulpStack, null, 200, 30, false)); - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(NContent.darkTree, 1, 1), IC2Items.getItem("waterCell"), null, new ItemStack(NContent.planks, 6, 12), pulpStack, IC2Items.getItem("cell"), 200, 30, false)); - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(NContent.darkTree, 1, 1), new ItemStack(Items.water_bucket), null, new ItemStack(NContent.planks, 6, 12), pulpStack, new ItemStack(Items.bucket), 200, 30, false)); - } + if (ConfigTechReborn.AllowNaturaRecipes) { + ItemStack pulpStack = OreDictionary.getOres("pulpWood").get(0); + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(NContent.tree, 1, 0), null, new FluidStack(FluidRegistry.WATER, 1000), new ItemStack(NContent.planks, 6, 0), pulpStack, null, 200, 30, false)); + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(NContent.tree, 1, 0), IC2Items.getItem("waterCell"), null, new ItemStack(NContent.planks, 6, 0), pulpStack, IC2Items.getItem("cell"), 200, 30, false)); + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(NContent.tree, 1, 0), new ItemStack(Items.water_bucket), null, new ItemStack(NContent.planks, 6, 0), pulpStack, new ItemStack(Items.bucket), 200, 30, false)); + + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(NContent.tree, 1, 1), null, new FluidStack(FluidRegistry.WATER, 1000), new ItemStack(NContent.planks, 6, 1), pulpStack, null, 200, 30, false)); + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(NContent.tree, 1, 1), IC2Items.getItem("waterCell"), null, new ItemStack(NContent.planks, 6, 1), pulpStack, IC2Items.getItem("cell"), 200, 30, false)); + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(NContent.tree, 1, 1), new ItemStack(Items.water_bucket), null, new ItemStack(NContent.planks, 6, 1), pulpStack, new ItemStack(Items.bucket), 200, 30, false)); + + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(NContent.tree, 1, 2), null, new FluidStack(FluidRegistry.WATER, 1000), new ItemStack(NContent.planks, 6, 2), pulpStack, null, 200, 30, false)); + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(NContent.tree, 1, 2), IC2Items.getItem("waterCell"), null, new ItemStack(NContent.planks, 6, 2), pulpStack, IC2Items.getItem("cell"), 200, 30, false)); + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(NContent.tree, 1, 2), new ItemStack(Items.water_bucket), null, new ItemStack(NContent.planks, 6, 2), pulpStack, new ItemStack(Items.bucket), 200, 30, false)); + + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(NContent.tree, 1, 3), null, new FluidStack(FluidRegistry.WATER, 1000), new ItemStack(NContent.planks, 6, 5), pulpStack, null, 200, 30, false)); + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(NContent.tree, 1, 3), IC2Items.getItem("waterCell"), null, new ItemStack(NContent.planks, 6, 5), pulpStack, IC2Items.getItem("cell"), 200, 30, false)); + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(NContent.tree, 1, 3), new ItemStack(Items.water_bucket), null, new ItemStack(NContent.planks, 6, 5), pulpStack, new ItemStack(Items.bucket), 200, 30, false)); + + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(NContent.redwood, 1, 1), null, new FluidStack(FluidRegistry.WATER, 1000), new ItemStack(NContent.planks, 6, 3), pulpStack, null, 200, 30, false)); + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(NContent.redwood, 1, 1), IC2Items.getItem("waterCell"), null, new ItemStack(NContent.planks, 6, 3), pulpStack, IC2Items.getItem("cell"), 200, 30, false)); + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(NContent.redwood, 1, 1), new ItemStack(Items.water_bucket), null, new ItemStack(NContent.planks, 6, 3), pulpStack, new ItemStack(Items.bucket), 200, 30, false)); + + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(NContent.willow, 1, 0), null, new FluidStack(FluidRegistry.WATER, 1000), new ItemStack(NContent.planks, 6, 10), pulpStack, null, 200, 30, false)); + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(NContent.willow, 1, 0), IC2Items.getItem("waterCell"), null, new ItemStack(NContent.planks, 6, 10), pulpStack, IC2Items.getItem("cell"), 200, 30, false)); + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(NContent.willow, 1, 0), new ItemStack(Items.water_bucket), null, new ItemStack(NContent.planks, 6, 10), pulpStack, new ItemStack(Items.bucket), 200, 30, false)); + + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(NContent.rareTree, 1, 0), null, new FluidStack(FluidRegistry.WATER, 1000), new ItemStack(NContent.planks, 6, 6), pulpStack, null, 200, 30, false)); + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(NContent.rareTree, 1, 0), IC2Items.getItem("waterCell"), null, new ItemStack(NContent.planks, 6, 6), pulpStack, IC2Items.getItem("cell"), 200, 30, false)); + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(NContent.rareTree, 1, 0), new ItemStack(Items.water_bucket), null, new ItemStack(NContent.planks, 6, 6), pulpStack, new ItemStack(Items.bucket), 200, 30, false)); + + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(NContent.rareTree, 1, 1), null, new FluidStack(FluidRegistry.WATER, 1000), new ItemStack(NContent.planks, 6, 7), pulpStack, null, 200, 30, false)); + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(NContent.rareTree, 1, 1), IC2Items.getItem("waterCell"), null, new ItemStack(NContent.planks, 6, 7), pulpStack, IC2Items.getItem("cell"), 200, 30, false)); + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(NContent.rareTree, 1, 1), new ItemStack(Items.water_bucket), null, new ItemStack(NContent.planks, 6, 7), pulpStack, new ItemStack(Items.bucket), 200, 30, false)); + + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(NContent.rareTree, 1, 2), null, new FluidStack(FluidRegistry.WATER, 1000), new ItemStack(NContent.planks, 6, 8), pulpStack, null, 200, 30, false)); + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(NContent.rareTree, 1, 2), IC2Items.getItem("waterCell"), null, new ItemStack(NContent.planks, 6, 8), pulpStack, IC2Items.getItem("cell"), 200, 30, false)); + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(NContent.rareTree, 1, 2), new ItemStack(Items.water_bucket), null, new ItemStack(NContent.planks, 6, 8), pulpStack, new ItemStack(Items.bucket), 200, 30, false)); + + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(NContent.rareTree, 1, 3), null, new FluidStack(FluidRegistry.WATER, 1000), new ItemStack(NContent.planks, 6, 9), pulpStack, null, 200, 30, false)); + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(NContent.rareTree, 1, 3), IC2Items.getItem("waterCell"), null, new ItemStack(NContent.planks, 6, 9), pulpStack, IC2Items.getItem("cell"), 200, 30, false)); + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(NContent.rareTree, 1, 3), new ItemStack(Items.water_bucket), null, new ItemStack(NContent.planks, 6, 9), pulpStack, new ItemStack(Items.bucket), 200, 30, false)); + + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(NContent.darkTree, 1, 0), null, new FluidStack(FluidRegistry.WATER, 1000), new ItemStack(NContent.planks, 6, 11), pulpStack, null, 200, 30, false)); + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(NContent.darkTree, 1, 0), IC2Items.getItem("waterCell"), null, new ItemStack(NContent.planks, 6, 11), pulpStack, IC2Items.getItem("cell"), 200, 30, false)); + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(NContent.darkTree, 1, 0), new ItemStack(Items.water_bucket), null, new ItemStack(NContent.planks, 6, 11), pulpStack, new ItemStack(Items.bucket), 200, 30, false)); + + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(NContent.darkTree, 1, 1), null, new FluidStack(FluidRegistry.WATER, 1000), new ItemStack(NContent.planks, 6, 12), pulpStack, null, 200, 30, false)); + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(NContent.darkTree, 1, 1), IC2Items.getItem("waterCell"), null, new ItemStack(NContent.planks, 6, 12), pulpStack, IC2Items.getItem("cell"), 200, 30, false)); + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(NContent.darkTree, 1, 1), new ItemStack(Items.water_bucket), null, new ItemStack(NContent.planks, 6, 12), pulpStack, new ItemStack(Items.bucket), 200, 30, false)); + } } @Override diff --git a/src/main/java/techreborn/compat/waila/WailaProviderMachines.java b/src/main/java/techreborn/compat/waila/WailaProviderMachines.java index 35fa84495..7e5594526 100644 --- a/src/main/java/techreborn/compat/waila/WailaProviderMachines.java +++ b/src/main/java/techreborn/compat/waila/WailaProviderMachines.java @@ -8,7 +8,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; -import techreborn.api.IListInfoProvider; +import reborncore.api.IListInfoProvider; import techreborn.tiles.TileMachineBase; import java.util.ArrayList; @@ -24,7 +24,7 @@ public class WailaProviderMachines implements IWailaDataProvider { TileMachineBase machine = (TileMachineBase) accessor.getTileEntity(); - if(accessor.getTileEntity() instanceof IListInfoProvider){ + if (accessor.getTileEntity() instanceof IListInfoProvider) { ((IListInfoProvider) accessor.getTileEntity()).addInfo(info, true); } tip.addAll(info); diff --git a/src/main/java/techreborn/config/ConfigTechReborn.java b/src/main/java/techreborn/config/ConfigTechReborn.java index 594a0eac5..79f77e423 100644 --- a/src/main/java/techreborn/config/ConfigTechReborn.java +++ b/src/main/java/techreborn/config/ConfigTechReborn.java @@ -102,7 +102,7 @@ public class ConfigTechReborn { public static int CloakingDeviceTier; public static int GravityTier; public static int CentrifugeTier; - public static int ThermalGeneratorTier; + public static int ThermalGeneratorTier; // EU/T public static int CloakingDeviceEUTick; // Crafting @@ -675,7 +675,7 @@ public class ConfigTechReborn { rainExplosions = config.get(CATEGORY_POWER, StatCollector.translateToLocal("config.techreborn.rainExplosions"), true, StatCollector.translateToLocal("config.techreborn.rainExplosions.tooltip")).getBoolean(true); - + //Integration AllowBOPRecipes = config.get(CATEGORY_INTEGRATION, StatCollector.translateToLocal("config.techreborn.allowBopRecipes"), true, StatCollector.translateToLocal("config.techreborn.allowBopRecipes.tooltip")).getBoolean(true); diff --git a/src/main/java/techreborn/config/TechRebornConfigGui.java b/src/main/java/techreborn/config/TechRebornConfigGui.java index 51e323e97..6fc0d5b1d 100644 --- a/src/main/java/techreborn/config/TechRebornConfigGui.java +++ b/src/main/java/techreborn/config/TechRebornConfigGui.java @@ -182,7 +182,7 @@ public class TechRebornConfigGui extends GuiConfig { .toString())); } } - + //Mod Integration public static class TRINT extends CategoryEntry { public TRINT(GuiConfig owningScreen, GuiConfigEntries owningEntryList, IConfigElement configElement) { diff --git a/src/main/java/techreborn/init/ModBlocks.java b/src/main/java/techreborn/init/ModBlocks.java index d90633b07..9ff0e8f42 100644 --- a/src/main/java/techreborn/init/ModBlocks.java +++ b/src/main/java/techreborn/init/ModBlocks.java @@ -6,6 +6,7 @@ import net.minecraft.block.material.Material; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraftforge.oredict.OreDictionary; +import techreborn.Core; import techreborn.blocks.*; import techreborn.blocks.generator.*; import techreborn.blocks.machine.*; @@ -18,7 +19,6 @@ import techreborn.tiles.*; import techreborn.tiles.idsu.TileIDSU; import techreborn.tiles.lesu.TileLesu; import techreborn.tiles.lesu.TileLesuStorage; -import techreborn.util.LogHelper; public class ModBlocks { @@ -230,10 +230,8 @@ public class ModBlocks { GameRegistry.registerBlock(machineframe, ItemBlockMachineFrame.class, "techreborn.machineFrame"); - - registerOreDict(); - LogHelper.info("TechReborns Blocks Loaded"); + Core.logHelper.info("TechReborns Blocks Loaded"); } public static void registerOreDict() { diff --git a/src/main/java/techreborn/init/ModFluids.java b/src/main/java/techreborn/init/ModFluids.java index 01ad1bf2d..8daab3e7a 100644 --- a/src/main/java/techreborn/init/ModFluids.java +++ b/src/main/java/techreborn/init/ModFluids.java @@ -5,7 +5,7 @@ import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; -import techreborn.api.fuel.FluidPowerManager; +import reborncore.api.fuel.FluidPowerManager; import techreborn.blocks.fluid.BlockFluidTechReborn; import techreborn.lib.ModInfo; @@ -150,7 +150,7 @@ public class ModFluids { BlockFluidNitrocoalfuel = new BlockFluidTechReborn(fluidNitrocoalfuel, Material.water, "techreborn.nitrocoalfuel"); GameRegistry.registerBlock(BlockFluidNitrocoalfuel, ModInfo.MOD_ID + "_" + BlockFluidNitrocoalfuel.getUnlocalizedName().substring(5)); fluidNitrocoalfuel.setUnlocalizedName(fluidNitrocoalfuel.getUnlocalizedName()); - FluidPowerManager.fluidPowerValues.put(fluidNitrocoalfuel, 48.0); + FluidPowerManager.fluidPowerValues.put(fluidNitrocoalfuel, 48.0); FluidRegistry.registerFluid(fluidNitrofuel); BlockFluidNitrofuel = new BlockFluidTechReborn(fluidNitrofuel, Material.water, "techreborn.nitrofuel"); diff --git a/src/main/java/techreborn/init/ModItems.java b/src/main/java/techreborn/init/ModItems.java index a450cf24b..411931e64 100644 --- a/src/main/java/techreborn/init/ModItems.java +++ b/src/main/java/techreborn/init/ModItems.java @@ -10,12 +10,12 @@ import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fluids.FluidContainerRegistry; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.oredict.OreDictionary; +import reborncore.common.util.BucketHandler; +import techreborn.Core; import techreborn.items.*; import techreborn.items.armor.ItemLapotronPack; import techreborn.items.armor.ItemLithiumBatpack; import techreborn.items.tools.*; -import techreborn.util.BucketHandler; -import techreborn.util.LogHelper; public class ModItems { @@ -71,7 +71,7 @@ public class ModItems { public static Item bucketSodiumpersulfate; public static Item bucketTritium; public static Item bucketWolframium; - + public static Item upgrades; @@ -261,7 +261,7 @@ public class ModItems { MinecraftForge.EVENT_BUS.register(BucketHandler.INSTANCE); - LogHelper.info("TechReborns Items Loaded"); + Core.logHelper.info("TechReborns Items Loaded"); registerOreDict(); } diff --git a/src/main/java/techreborn/init/ModRecipes.java b/src/main/java/techreborn/init/ModRecipes.java index d6de51285..4e1c7a1a3 100644 --- a/src/main/java/techreborn/init/ModRecipes.java +++ b/src/main/java/techreborn/init/ModRecipes.java @@ -8,1426 +8,1412 @@ import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.oredict.OreDictionary; import org.apache.commons.lang3.ArrayUtils; +import reborncore.common.util.CraftingHelper; +import reborncore.common.util.OreUtil; +import techreborn.Core; import techreborn.api.TechRebornAPI; import techreborn.api.recipe.RecipeHandler; -import techreborn.api.recipe.machines.AlloySmelterRecipe; -import techreborn.api.recipe.machines.BlastFurnaceRecipe; -import techreborn.api.recipe.machines.CentrifugeRecipe; -import techreborn.api.recipe.machines.ChemicalReactorRecipe; -import techreborn.api.recipe.machines.GrinderRecipe; -import techreborn.api.recipe.machines.IndustrialElectrolyzerRecipe; -import techreborn.api.recipe.machines.IndustrialSawmillRecipe; -import techreborn.api.recipe.machines.PlateCuttingMachineRecipe; -import techreborn.blocks.BlockMachineFrame; +import techreborn.api.recipe.machines.*; import techreborn.blocks.BlockOre; import techreborn.blocks.BlockStorage; import techreborn.blocks.BlockStorage2; import techreborn.config.ConfigTechReborn; -import techreborn.items.ItemCells; -import techreborn.items.ItemDusts; -import techreborn.items.ItemDustsSmall; -import techreborn.items.ItemGems; -import techreborn.items.ItemIngots; -import techreborn.items.ItemParts; -import techreborn.items.ItemPlates; -import techreborn.util.CraftingHelper; -import techreborn.util.LogHelper; -import techreborn.util.OreUtil; -import techreborn.util.RecipeUtils; +import techreborn.items.*; +import techreborn.utils.RecipeUtils; import java.security.InvalidParameterException; public class - ModRecipes { - public static ConfigTechReborn config; - - public static void init() { - addShapelessRecipes(); - addGeneralShapedRecipes(); - addMachineRecipes(); - - addSmeltingRecipes(); - addUUrecipes(); - - addAlloySmelterRecipes(); - addPlateCuttingMachineRecipes(); - addIndustrialCentrifugeRecipes(); - addChemicalReactorRecipes(); - addIndustrialElectrolyzerRecipes(); - - addIndustrialSawmillRecipes(); - addBlastFurnaceRecipes(); - addIndustrialGrinderRecipes(); - addImplosionCompressorRecipes(); - } - - static void addGeneralShapedRecipes() { - - // Storage Blocks - for (String name : ArrayUtils.addAll(BlockStorage.types, BlockStorage2.types)) { - CraftingHelper.addShapedOreRecipe(BlockStorage.getStorageBlockByName(name), - "AAA", "AAA", "AAA", - 'A', "ingot" + name.substring(0, 1).toUpperCase() + name.substring(1)); - } - - CraftingHelper.addShapedOreRecipe(BlockStorage.getStorageBlockByName("sapphire"), - "AAA", "AAA", "AAA", - 'A', "gemSapphire"); - - CraftingHelper.addShapedOreRecipe(BlockStorage.getStorageBlockByName("ruby"), - "AAA", "AAA", "AAA", - 'A', "gemRuby"); - - - CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.parts, 1, 40), - "PLP", "RGB", "PYP", - 'P', "plateAluminum", - 'L', "dyeLime", - 'R', "dyeRed", - 'G', "paneGlass", - 'B', "dyeBlue", - 'Y', Items.glowstone_dust); - - CraftingHelper.addShapedOreRecipe(ItemParts.getPartByName("dataStorageCircuit"), - "EEE", "ECE", "EEE", - 'E', new ItemStack(Items.emerald), - 'C', ItemParts.getPartByName("basicCircuitBoard")); - - CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.parts, 4, 8), - "DSD", "S S", "DSD", - 'D', "dustDiamond", - 'S', "ingotSteel"); - - CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.parts, 1, 15), - "AAA", "AMA", "AAA", - 'A', "ingotAluminium", - 'M', new ItemStack(ModItems.parts, 1, 13)); - - CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.Supercondensator), - "EOE", "SAS", "EOE", - 'E', ItemParts.getPartByName("energyFlowCircuit"), - 'O', ModItems.lapotronicOrb, - 'S', ItemParts.getPartByName("superconductor"), - 'A', ModBlocks.HighAdvancedMachineBlock); - - CraftingHelper.addShapedOreRecipe(ItemParts.getPartByName("diamondSawBlade"), - "DSD", "S S", "DSD", - 'S', "plateSteel", - 'D', "dustDiamond"); - - CraftingHelper.addShapedOreRecipe(ItemParts.getPartByName("tungstenGrindingHead", 2), - "TST", "SBS", "TST", - 'T', "plateTungsten", - 'S', "plateSteel", - 'B', "blockSteel"); - - CraftingHelper.addShapedOreRecipe(ItemParts.getPartByName("destructoPack"), - "CIC", "IBI", "CIC", - 'C', ItemParts.getPartByName("basicCircuitBoard"), - 'I', "ingotAluminum", - 'B', new ItemStack(Items.lava_bucket) - ); - - CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.cloakingDevice), - "CIC", "IOI", "CIC", - 'C', "ingotChrome", - 'I', "plateIridium", - 'O', new ItemStack(ModItems.lapotronicOrb) - ); - - CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.rockCutter), - "DT ", "DT ", "DCB", - 'D', ItemParts.getPartByName("rockCutterBlade"), - 'T', "ingotTitanium", - 'C', ItemParts.getPartByName("basicCircuitBoard"), - 'B', new ItemStack(Items.diamond) - ); - - CraftingHelper.addShapedOreRecipe(ItemParts.getPartByName("rockCutterBlade"), - "SDS", "SDS", "SDS", - 'D', new ItemStack(Items.diamond), - 'S', "ingotSteel" - ); - - for (String part : ItemParts.types) { - if (part.endsWith("Gear")) { - CraftingHelper.addShapedOreRecipe(ItemParts.getPartByName(part), - " O ", "OIO", " O ", - 'I', new ItemStack(Items.iron_ingot), - 'O', "ingot" + capitalizeFirstLetter(part.replace("Gear", "")) - ); - } - } - - CraftingHelper.addShapedOreRecipe(ItemParts.getPartByName("nichromeHeatingCoil"), - " N ", "NCN", " N ", - 'N', "ingotNickel", - 'C', "ingotChrome" - ); - - CraftingHelper.addShapedOreRecipe(ItemParts.getPartByName("kanthalHeatingCoil"), - "III", "CAA", "AAA", - 'I', "ingotSteel", - 'C', "ingotChrome", - 'A', "ingotAluminum" - ); - - CraftingHelper.addShapedOreRecipe(ItemParts.getPartByName("heliumCoolantSimple"), - " T ", "TCT", " T ", - 'T', "ingotTin", - 'C', ItemCells.getCellByName("helium", 1, false) - ); - - CraftingHelper.addShapedOreRecipe(ItemParts.getPartByName("HeliumCoolantTriple"), - "TTT", "CCC", "TTT", - 'T', "ingotTin", - 'C', ItemParts.getPartByName("heliumCoolantSimple") - ); - - CraftingHelper.addShapedOreRecipe(ItemParts.getPartByName("HeliumCoolantSix"), - "THT", "TCT", "THT", - 'T', "ingotTin", - 'C', "ingotCopper", - 'H', ItemParts.getPartByName("HeliumCoolantTriple") - ); - - CraftingHelper.addShapedOreRecipe(ItemParts.getPartByName("NaKCoolantTriple"), - "TTT", "CCC", "TTT", - 'T', "ingotTin", - 'C', ItemParts.getPartByName("NaKCoolantSimple") - ); - - CraftingHelper.addShapedOreRecipe(ItemParts.getPartByName("NaKCoolantSix"), - "THT", "TCT", "THT", - 'T', "ingotTin", - 'C', "ingotCopper", - 'H', ItemParts.getPartByName("NaKCoolantTriple") - ); - - GameRegistry.addShapelessRecipe(ItemCells.getCellByName("heliumPlasma"), ItemCells.getCellByName("tritium"), ItemCells.getCellByName("deuterium")); - - LogHelper.info("Shapped Recipes Added"); - } - - public static String capitalizeFirstLetter(String original) { - if (original.length() == 0) - return original; - return original.substring(0, 1).toUpperCase() + original.substring(1); - } - - static void addShapelessRecipes() { - - for (String name : ArrayUtils.addAll(BlockStorage.types, BlockStorage2.types)) { - ItemStack item = null; - try { - item = ItemIngots.getIngotByName(name, 9); - } catch (InvalidParameterException e) { - try { - item = ItemGems.getGemByName(name, 9); - } catch (InvalidParameterException e2) { - continue; - } - } - - if (item == null) { - continue; - } - - GameRegistry.addShapelessRecipe(BlockStorage.getStorageBlockByName(name), item, item, item, item, item, item, item, item, item); - GameRegistry.addShapelessRecipe(item, BlockStorage.getStorageBlockByName(name, 9)); - - } - - for (String name : ItemDustsSmall.types) { - GameRegistry.addShapelessRecipe(ItemDustsSmall.getSmallDustByName(name, 4), ItemDusts.getDustByName(name)); - GameRegistry.addShapelessRecipe(ItemDusts.getDustByName(name, 1), ItemDustsSmall.getSmallDustByName(name), ItemDustsSmall.getSmallDustByName(name), ItemDustsSmall.getSmallDustByName(name), ItemDustsSmall.getSmallDustByName(name)); - } - - LogHelper.info("Shapless Recipes Added"); - } - - static void addMachineRecipes() { - CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.quantumTank), - "EPE", "PCP", "EPE", - 'P', "platePlatinum", - 'E', "circuitMaster", - 'C', ModBlocks.quantumChest); - - CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.digitalChest), - "PPP", "PDP", "PCP", - 'P', "plateAluminum", - 'D', ItemParts.getPartByName("dataOrb"), - 'C', ItemParts.getPartByName("computerMonitor")); - - CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.digitalChest), - "PPP", "PDP", "PCP", - 'P', "plateSteel", - 'D', ItemParts.getPartByName("dataOrb"), - 'C', ItemParts.getPartByName("computerMonitor")); - - CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.AlloySmelter), - "IHI", "CFC", "IHI", - 'I', "plateInvar", - 'C', "circuitBasic", - 'H', new ItemStack(ModItems.parts, 1, 17), - 'F', ModBlocks.AlloyFurnace); - - CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.LesuStorage), - "LLL", "LCL", "LLL", - 'L', "blockLapis", - 'C', "circuitBasic"); - - TechRebornAPI.addRollingMachinceRecipe(ItemParts.getPartByName("cupronickelHeatingCoil"), - "NCN", "C C", "NCN", - 'N', ItemIngots.getIngotByName("cupronickel"), - 'C', ItemIngots.getIngotByName("copper")); - - } - - static void addSmeltingRecipes() { - GameRegistry.addSmelting(ItemDusts.getDustByName("iron", 1), new ItemStack(Items.iron_ingot), 1F); - GameRegistry.addSmelting(ItemDusts.getDustByName("gold", 1), new ItemStack(Items.gold_ingot), 1F); - - LogHelper.info("Smelting Recipes Added"); - } - - static void addAlloySmelterRecipes() { - //Bronze - RecipeHandler.addRecipe(new AlloySmelterRecipe(ItemIngots.getIngotByName("copper", 3), ItemIngots.getIngotByName("tin", 1), ItemIngots.getIngotByName("bronze", 4), 200, 16)); - RecipeHandler.addRecipe(new AlloySmelterRecipe(ItemIngots.getIngotByName("copper", 3), ItemDusts.getDustByName("tin", 1), ItemIngots.getIngotByName("bronze", 4), 200, 16)); - RecipeHandler.addRecipe(new AlloySmelterRecipe(ItemDusts.getDustByName("copper", 3), ItemIngots.getIngotByName("tin", 1), ItemIngots.getIngotByName("bronze", 4), 200, 16)); - RecipeHandler.addRecipe(new AlloySmelterRecipe(ItemDusts.getDustByName("copper", 3), ItemDusts.getDustByName("tin", 1), ItemIngots.getIngotByName("bronze", 4), 200, 16)); - - //Electrum - RecipeHandler.addRecipe(new AlloySmelterRecipe(new ItemStack(Items.gold_ingot, 1), ItemIngots.getIngotByName("silver", 1), ItemIngots.getIngotByName("electrum", 2), 200, 16)); - RecipeHandler.addRecipe(new AlloySmelterRecipe(new ItemStack(Items.gold_ingot, 1), ItemDusts.getDustByName("silver", 1), ItemIngots.getIngotByName("electrum", 2), 200, 16)); - RecipeHandler.addRecipe(new AlloySmelterRecipe(ItemDusts.getDustByName("gold", 1), ItemIngots.getIngotByName("silver", 1), ItemIngots.getIngotByName("electrum", 2), 200, 16)); - RecipeHandler.addRecipe(new AlloySmelterRecipe(ItemDusts.getDustByName("gold", 1), ItemDusts.getDustByName("silver", 1), ItemIngots.getIngotByName("electrum", 2), 200, 16)); - - //Invar - RecipeHandler.addRecipe(new AlloySmelterRecipe(new ItemStack(Items.iron_ingot, 2), ItemIngots.getIngotByName("nickel", 1), ItemIngots.getIngotByName("invar", 3), 200, 16)); - RecipeHandler.addRecipe(new AlloySmelterRecipe(new ItemStack(Items.iron_ingot, 2), ItemDusts.getDustByName("nickel", 1), ItemIngots.getIngotByName("invar", 3), 200, 16)); - RecipeHandler.addRecipe(new AlloySmelterRecipe(ItemDusts.getDustByName("iron", 2), ItemIngots.getIngotByName("nickel", 1), ItemIngots.getIngotByName("invar", 3), 200, 16)); - RecipeHandler.addRecipe(new AlloySmelterRecipe(ItemDusts.getDustByName("iron", 2), ItemDusts.getDustByName("nickel", 1), ItemIngots.getIngotByName("invar", 3), 200, 16)); - - //Cupronickel - RecipeHandler.addRecipe(new AlloySmelterRecipe(ItemIngots.getIngotByName("copper", 1), ItemIngots.getIngotByName("nickel", 1), ItemIngots.getIngotByName("cupronickel", 2), 200, 16)); - RecipeHandler.addRecipe(new AlloySmelterRecipe(ItemIngots.getIngotByName("copper", 1), ItemDusts.getDustByName("nickel", 1), ItemIngots.getIngotByName("cupronickel", 2), 200, 16)); - RecipeHandler.addRecipe(new AlloySmelterRecipe(ItemDusts.getDustByName("copper", 1), ItemIngots.getIngotByName("nickel", 1), ItemIngots.getIngotByName("cupronickel", 2), 200, 16)); - RecipeHandler.addRecipe(new AlloySmelterRecipe(ItemDusts.getDustByName("copper", 1), ItemDusts.getDustByName("nickel", 1), ItemIngots.getIngotByName("cupronickel", 2), 200, 16)); - - //Nichrome - RecipeHandler.addRecipe(new AlloySmelterRecipe(ItemIngots.getIngotByName("chrome", 1), ItemIngots.getIngotByName("nickel", 4), ItemIngots.getIngotByName("nichrome", 5), 200, 16)); - RecipeHandler.addRecipe(new AlloySmelterRecipe(ItemIngots.getIngotByName("chrome", 1), ItemDusts.getDustByName("nickel", 4), ItemIngots.getIngotByName("nichrome", 5), 200, 16)); - RecipeHandler.addRecipe(new AlloySmelterRecipe(ItemDusts.getDustByName("chrome", 1), ItemIngots.getIngotByName("nickel", 4), ItemIngots.getIngotByName("nichrome", 5), 200, 16)); - RecipeHandler.addRecipe(new AlloySmelterRecipe(ItemDusts.getDustByName("chrome", 1), ItemDusts.getDustByName("nickel", 4), ItemIngots.getIngotByName("nichrome", 5), 200, 16)); - - //Magnalium - RecipeHandler.addRecipe(new AlloySmelterRecipe(ItemDusts.getDustByName("magnesium", 1), ItemIngots.getIngotByName("aluminum", 4), ItemIngots.getIngotByName("magnalium", 3), 200, 16)); - RecipeHandler.addRecipe(new AlloySmelterRecipe(ItemDusts.getDustByName("magnesium", 1), ItemDusts.getDustByName("aluminum", 4), ItemIngots.getIngotByName("magnalium", 3), 200, 16)); - - //Battery Alloy - RecipeHandler.addRecipe(new AlloySmelterRecipe(ItemIngots.getIngotByName("lead", 4), ItemIngots.getIngotByName("antimony", 1), ItemIngots.getIngotByName("batteryAlloy", 5), 200, 16)); - RecipeHandler.addRecipe(new AlloySmelterRecipe(ItemIngots.getIngotByName("lead", 4), ItemDusts.getDustByName("antimony", 1), ItemIngots.getIngotByName("batteryAlloy", 5), 200, 16)); - RecipeHandler.addRecipe(new AlloySmelterRecipe(ItemDusts.getDustByName("lead", 4), ItemIngots.getIngotByName("antimony", 1), ItemIngots.getIngotByName("batteryAlloy", 5), 200, 16)); - RecipeHandler.addRecipe(new AlloySmelterRecipe(ItemDusts.getDustByName("lead", 4), ItemDusts.getDustByName("antimony", 1), ItemIngots.getIngotByName("batteryAlloy", 5), 200, 16)); - - //Brass - if (OreUtil.doesOreExistAndValid("ingotBrass")) { - ItemStack brassStack = OreDictionary.getOres("ingotBrass").get(0); - brassStack.stackSize = 4; - RecipeHandler.addRecipe(new AlloySmelterRecipe(ItemIngots.getIngotByName("copper", 3), ItemIngots.getIngotByName("zinc", 1), brassStack, 200, 16)); - RecipeHandler.addRecipe(new AlloySmelterRecipe(ItemIngots.getIngotByName("copper", 3), ItemDusts.getDustByName("zinc", 1), brassStack, 200, 16)); - RecipeHandler.addRecipe(new AlloySmelterRecipe(ItemDusts.getDustByName("copper", 3), ItemIngots.getIngotByName("zinc", 1), brassStack, 200, 16)); - RecipeHandler.addRecipe(new AlloySmelterRecipe(ItemDusts.getDustByName("copper", 3), ItemDusts.getDustByName("zinc", 1), brassStack, 200, 16)); - } - - //Red Alloy - if (OreUtil.doesOreExistAndValid("ingotRedAlloy")) { - ItemStack redAlloyStack = OreDictionary.getOres("ingotRedAlloy").get(0); - redAlloyStack.stackSize = 1; - RecipeHandler.addRecipe(new AlloySmelterRecipe(new ItemStack(Items.redstone, 4), ItemIngots.getIngotByName("copper", 1), redAlloyStack, 200, 16)); - RecipeHandler.addRecipe(new AlloySmelterRecipe(new ItemStack(Items.redstone, 4), new ItemStack(Items.iron_ingot, 1), redAlloyStack, 200, 16)); - } - - //Blue Alloy - if (OreUtil.doesOreExistAndValid("ingotBlueAlloy")) { - ItemStack blueAlloyStack = OreDictionary.getOres("ingotBlueAlloy").get(0); - blueAlloyStack.stackSize = 1; - RecipeHandler.addRecipe(new AlloySmelterRecipe(ItemDusts.getDustByName("teslatite", 4), ItemIngots.getIngotByName("silver", 1), blueAlloyStack, 200, 16)); - } - - //Blue Alloy - if (OreUtil.doesOreExistAndValid("ingotPurpleAlloy") && OreUtil.doesOreExistAndValid("dustInfusedTeslatite")) { - ItemStack purpleAlloyStack = OreDictionary.getOres("ingotPurpleAlloy").get(0); - purpleAlloyStack.stackSize = 1; - ItemStack infusedTeslatiteStack = OreDictionary.getOres("ingotPurpleAlloy").get(0); - infusedTeslatiteStack.stackSize = 8; - RecipeHandler.addRecipe(new AlloySmelterRecipe(ItemIngots.getIngotByName("redAlloy", 1), ItemIngots.getIngotByName("blueAlloy", 1), purpleAlloyStack, 200, 16)); - RecipeHandler.addRecipe(new AlloySmelterRecipe(new ItemStack(Items.gold_ingot, 1), infusedTeslatiteStack, purpleAlloyStack, 200, 16)); - } - - //Aluminum Brass - if (OreUtil.doesOreExistAndValid("ingotAluminumBrass")) { - ItemStack aluminumBrassStack = OreDictionary.getOres("ingotAluminumBrass").get(0); - aluminumBrassStack.stackSize = 4; - RecipeHandler.addRecipe(new AlloySmelterRecipe(ItemIngots.getIngotByName("copper", 3), ItemIngots.getIngotByName("aluminum", 1), aluminumBrassStack, 200, 16)); - RecipeHandler.addRecipe(new AlloySmelterRecipe(ItemIngots.getIngotByName("copper", 3), ItemDusts.getDustByName("aluminum", 1), aluminumBrassStack, 200, 16)); - RecipeHandler.addRecipe(new AlloySmelterRecipe(ItemDusts.getDustByName("copper", 3), ItemIngots.getIngotByName("aluminum", 1), aluminumBrassStack, 200, 16)); - RecipeHandler.addRecipe(new AlloySmelterRecipe(ItemDusts.getDustByName("copper", 3), ItemDusts.getDustByName("aluminum", 1), aluminumBrassStack, 200, 16)); - } - - //Manyullyn - if (OreUtil.doesOreExistAndValid("ingotManyullyn") && OreUtil.doesOreExistAndValid("ingotCobalt") && OreUtil.doesOreExistAndValid("ingotArdite")) { - ItemStack manyullynStack = OreDictionary.getOres("ingotManyullyn").get(0); - manyullynStack.stackSize = 1; - ItemStack cobaltStack = OreDictionary.getOres("ingotCobalt").get(0); - cobaltStack.stackSize = 1; - ItemStack arditeStack = OreDictionary.getOres("ingotArdite").get(0); - arditeStack.stackSize = 1; - RecipeHandler.addRecipe(new AlloySmelterRecipe(cobaltStack, arditeStack, manyullynStack, 200, 16)); - RecipeHandler.addRecipe(new AlloySmelterRecipe(cobaltStack, ItemDusts.getDustByName("ardite", 1), manyullynStack, 200, 16)); - RecipeHandler.addRecipe(new AlloySmelterRecipe(ItemDusts.getDustByName("cobalt", 1), arditeStack, manyullynStack, 200, 16)); - RecipeHandler.addRecipe(new AlloySmelterRecipe(ItemDusts.getDustByName("cobalt", 1), ItemDusts.getDustByName("ardite", 1), manyullynStack, 200, 16)); - } - - //Conductive Iron - if (OreUtil.doesOreExistAndValid("ingotConductiveIron")) { - ItemStack conductiveIronStack = OreDictionary.getOres("ingotConductiveIron").get(0); - conductiveIronStack.stackSize = 1; - RecipeHandler.addRecipe(new AlloySmelterRecipe(new ItemStack(Items.redstone, 1), new ItemStack(Items.iron_ingot, 1), conductiveIronStack, 200, 16)); - } - - //Redstone Alloy - if (OreUtil.doesOreExistAndValid("ingotRedstoneAlloy") && OreUtil.doesOreExistAndValid("itemSilicon")) { - ItemStack redstoneAlloyStack = OreDictionary.getOres("ingotRedstoneAlloy").get(0); - redstoneAlloyStack.stackSize = 1; - ItemStack siliconStack = OreDictionary.getOres("itemSilicon").get(0); - siliconStack.stackSize = 1; - RecipeHandler.addRecipe(new AlloySmelterRecipe(new ItemStack(Items.redstone, 1), siliconStack, redstoneAlloyStack, 200, 16)); - } - - //Pulsating Iron - if (OreUtil.doesOreExistAndValid("ingotPhasedIron")) { - ItemStack pulsatingIronStack = OreDictionary.getOres("ingotPhasedIron").get(0); - pulsatingIronStack.stackSize = 1; - RecipeHandler.addRecipe(new AlloySmelterRecipe(new ItemStack(Items.iron_ingot, 1), new ItemStack(Items.ender_pearl, 1), pulsatingIronStack, 200, 16)); - RecipeHandler.addRecipe(new AlloySmelterRecipe(new ItemStack(Items.iron_ingot, 1), ItemDusts.getDustByName("enderPearl", 1), pulsatingIronStack, 200, 16)); - } - - //Vibrant Alloy - if (OreUtil.doesOreExistAndValid("ingotEnergeticAlloy") && OreUtil.doesOreExistAndValid("ingotPhasedGold")) { - ItemStack energeticAlloyStack = OreDictionary.getOres("ingotEnergeticAlloy").get(0); - energeticAlloyStack.stackSize = 1; - ItemStack vibrantAlloyStack = OreDictionary.getOres("ingotPhasedGold").get(0); - vibrantAlloyStack.stackSize = 1; - RecipeHandler.addRecipe(new AlloySmelterRecipe(energeticAlloyStack, new ItemStack(Items.ender_pearl, 1), vibrantAlloyStack, 200, 16)); - RecipeHandler.addRecipe(new AlloySmelterRecipe(energeticAlloyStack, ItemDusts.getDustByName("enderPearl", 1), vibrantAlloyStack, 200, 16)); - } - - //Soularium - if (OreUtil.doesOreExistAndValid("ingotSoularium")) { - ItemStack soulariumStack = OreDictionary.getOres("ingotSoularium").get(0); - soulariumStack.stackSize = 1; - RecipeHandler.addRecipe(new AlloySmelterRecipe(new ItemStack(Blocks.soul_sand, 1), new ItemStack(Items.gold_ingot, 1), soulariumStack, 200, 16)); - } - - } - - static void addPlateCuttingMachineRecipes() { - //Storage Blocks - if (OreUtil.doesOreExistAndValid("blockAluminum")) { - ItemStack blockStack = OreDictionary.getOres("blockAluminum").get(0); - RecipeHandler.addRecipe(new PlateCuttingMachineRecipe(blockStack, ItemPlates.getPlateByName("aluminum", 9), 200, 16)); - } - if (OreUtil.doesOreExistAndValid("blockBrass")) { - ItemStack blockStack = OreDictionary.getOres("blockBrass").get(0); - RecipeHandler.addRecipe(new PlateCuttingMachineRecipe(blockStack, ItemPlates.getPlateByName("brass", 9), 200, 116)); - } - if (OreUtil.doesOreExistAndValid("blockBronze")) { - ItemStack blockStack = OreDictionary.getOres("blockBronze").get(0); - RecipeHandler.addRecipe(new PlateCuttingMachineRecipe(blockStack, ItemPlates.getPlateByName("bronze", 9), 200, 16)); - } - if (OreUtil.doesOreExistAndValid("blockCoal")) { - ItemStack blockStack = OreDictionary.getOres("blockCoal").get(0); - RecipeHandler.addRecipe(new PlateCuttingMachineRecipe(blockStack, ItemPlates.getPlateByName("carbon", 9), 200, 16)); - } - if (OreUtil.doesOreExistAndValid("blockChrome")) { - ItemStack blockStack = OreDictionary.getOres("blockChrome").get(0); - RecipeHandler.addRecipe(new PlateCuttingMachineRecipe(blockStack, ItemPlates.getPlateByName("chrome", 9), 200, 16)); - } - if (OreUtil.doesOreExistAndValid("blockCopper")) { - ItemStack blockStack = OreDictionary.getOres("blockCopper").get(0); - RecipeHandler.addRecipe(new PlateCuttingMachineRecipe(blockStack, ItemPlates.getPlateByName("copper", 9), 200, 16)); - } - if (OreUtil.doesOreExistAndValid("blockDiamond")) { - ItemStack blockStack = OreDictionary.getOres("blockDiamond").get(0); - RecipeHandler.addRecipe(new PlateCuttingMachineRecipe(blockStack, ItemPlates.getPlateByName("diamond", 9), 200, 16)); - } - if (OreUtil.doesOreExistAndValid("blockElectrum")) { - ItemStack blockStack = OreDictionary.getOres("blockElectrum").get(0); - RecipeHandler.addRecipe(new PlateCuttingMachineRecipe(blockStack, ItemPlates.getPlateByName("electrum", 9), 200, 16)); - } - if (OreUtil.doesOreExistAndValid("blockEmerald")) { - ItemStack blockStack = OreDictionary.getOres("blockEmerald").get(0); - RecipeHandler.addRecipe(new PlateCuttingMachineRecipe(blockStack, ItemPlates.getPlateByName("emerald", 9), 200, 16)); - } - if (OreUtil.doesOreExistAndValid("blockGold")) { - ItemStack blockStack = OreDictionary.getOres("blockGold").get(0); - RecipeHandler.addRecipe(new PlateCuttingMachineRecipe(blockStack, ItemPlates.getPlateByName("gold", 9), 200, 16)); - } - if (OreUtil.doesOreExistAndValid("blockInvar")) { - ItemStack blockStack = OreDictionary.getOres("blockInvar").get(0); - RecipeHandler.addRecipe(new PlateCuttingMachineRecipe(blockStack, ItemPlates.getPlateByName("invar", 9), 200, 16)); - } - if (OreUtil.doesOreExistAndValid("blockIridium")) { - ItemStack blockStack = OreDictionary.getOres("blockIridium").get(0); - RecipeHandler.addRecipe(new PlateCuttingMachineRecipe(blockStack, ItemPlates.getPlateByName("iridium", 9), 200, 16)); - } - if (OreUtil.doesOreExistAndValid("blockIron")) { - ItemStack blockStack = OreDictionary.getOres("blockIron").get(0); - RecipeHandler.addRecipe(new PlateCuttingMachineRecipe(blockStack, ItemPlates.getPlateByName("iron", 9), 200, 16)); - } - if (OreUtil.doesOreExistAndValid("blockLapis")) { - ItemStack blockStack = OreDictionary.getOres("blockLapis").get(0); - RecipeHandler.addRecipe(new PlateCuttingMachineRecipe(blockStack, ItemPlates.getPlateByName("lapis", 9), 200, 16)); - } - if (OreUtil.doesOreExistAndValid("blockLead")) { - ItemStack blockStack = OreDictionary.getOres("blockLead").get(0); - RecipeHandler.addRecipe(new PlateCuttingMachineRecipe(blockStack, ItemPlates.getPlateByName("lead", 9), 200, 16)); - } - if (OreUtil.doesOreExistAndValid("blockNickel")) { - ItemStack blockStack = OreDictionary.getOres("blockNickel").get(0); - RecipeHandler.addRecipe(new PlateCuttingMachineRecipe(blockStack, ItemPlates.getPlateByName("nickel", 9), 200, 16)); - } - if (OreUtil.doesOreExistAndValid("blockOsmium")) { - ItemStack blockStack = OreDictionary.getOres("blockOsmium").get(0); - RecipeHandler.addRecipe(new PlateCuttingMachineRecipe(blockStack, ItemPlates.getPlateByName("osmium", 9), 200, 16)); - } - if (OreUtil.doesOreExistAndValid("blockPeridot")) { - ItemStack blockStack = OreDictionary.getOres("blockPeridot").get(0); - RecipeHandler.addRecipe(new PlateCuttingMachineRecipe(blockStack, ItemPlates.getPlateByName("peridot", 9), 200, 16)); - } - if (OreUtil.doesOreExistAndValid("blockPlatinum")) { - ItemStack blockStack = OreDictionary.getOres("blockPlatinum").get(0); - RecipeHandler.addRecipe(new PlateCuttingMachineRecipe(blockStack, ItemPlates.getPlateByName("platinum", 9), 200, 16)); - } - if (OreUtil.doesOreExistAndValid("blockRedGarnet")) { - ItemStack blockStack = OreDictionary.getOres("blockRedGarnet").get(0); - RecipeHandler.addRecipe(new PlateCuttingMachineRecipe(blockStack, ItemPlates.getPlateByName("redGarnet", 9), 200, 16)); - } - if (OreUtil.doesOreExistAndValid("BlockRedstone")) { - ItemStack blockStack = OreDictionary.getOres("blockRedstone").get(0); - RecipeHandler.addRecipe(new PlateCuttingMachineRecipe(blockStack, ItemPlates.getPlateByName("redstone", 9), 200, 16)); - } - if (OreUtil.doesOreExistAndValid("blockRuby")) { - ItemStack blockStack = OreDictionary.getOres("blockRuby").get(0); - RecipeHandler.addRecipe(new PlateCuttingMachineRecipe(blockStack, ItemPlates.getPlateByName("ruby", 9), 200, 16)); - } - if (OreUtil.doesOreExistAndValid("blockSapphire")) { - ItemStack blockStack = OreDictionary.getOres("blockSapphire").get(0); - RecipeHandler.addRecipe(new PlateCuttingMachineRecipe(blockStack, ItemPlates.getPlateByName("sapphire", 9), 200, 16)); - } - if (OreUtil.doesOreExistAndValid("blockSilver")) { - ItemStack blockStack = OreDictionary.getOres("blockSilver").get(0); - RecipeHandler.addRecipe(new PlateCuttingMachineRecipe(blockStack, ItemPlates.getPlateByName("silver", 9), 200, 16)); - } - if (OreUtil.doesOreExistAndValid("blockSteel")) { - ItemStack blockStack = OreDictionary.getOres("blockSteel").get(0); - RecipeHandler.addRecipe(new PlateCuttingMachineRecipe(blockStack, ItemPlates.getPlateByName("steel", 9), 200, 16)); - } - if (OreUtil.doesOreExistAndValid("blockTeslatite")) { - ItemStack blockStack = OreDictionary.getOres("blockTeslatite").get(0); - RecipeHandler.addRecipe(new PlateCuttingMachineRecipe(blockStack, ItemPlates.getPlateByName("teslatite", 9), 200, 16)); - } - if (OreUtil.doesOreExistAndValid("blockTin")) { - ItemStack blockStack = OreDictionary.getOres("blockTin").get(0); - RecipeHandler.addRecipe(new PlateCuttingMachineRecipe(blockStack, ItemPlates.getPlateByName("tin", 9), 200, 16)); - } - if (OreUtil.doesOreExistAndValid("blockTitanium")) { - ItemStack blockStack = OreDictionary.getOres("blockTitanium").get(0); - RecipeHandler.addRecipe(new PlateCuttingMachineRecipe(blockStack, ItemPlates.getPlateByName("titanium", 9), 200, 16)); - } - if (OreUtil.doesOreExistAndValid("blockTungsten")) { - ItemStack blockStack = OreDictionary.getOres("blockTungsten").get(0); - RecipeHandler.addRecipe(new PlateCuttingMachineRecipe(blockStack, ItemPlates.getPlateByName("tungsten", 9), 200, 16)); - } - if (OreUtil.doesOreExistAndValid("blockTungstensteel")) { - ItemStack blockStack = OreDictionary.getOres("blockTungstensteel").get(0); - RecipeHandler.addRecipe(new PlateCuttingMachineRecipe(blockStack, ItemPlates.getPlateByName("tungstensteel", 9), 200, 16)); - } - if (OreUtil.doesOreExistAndValid("blockYellowGarnet")) { - ItemStack blockStack = OreDictionary.getOres("blockYellowGarnet").get(0); - RecipeHandler.addRecipe(new PlateCuttingMachineRecipe(blockStack, ItemPlates.getPlateByName("yellowGarnet", 9), 200, 16)); - } - if (OreUtil.doesOreExistAndValid("blockZinc")) { - ItemStack blockStack = OreDictionary.getOres("blockZinc").get(0); - RecipeHandler.addRecipe(new PlateCuttingMachineRecipe(blockStack, ItemPlates.getPlateByName("zinc", 9), 200, 16)); - } - - //Obsidian - RecipeHandler.addRecipe(new PlateCuttingMachineRecipe(new ItemStack(Blocks.obsidian), ItemPlates.getPlateByName("obsidian", 9), 100, 4)); - } - - static void addIndustrialSawmillRecipes() { - ItemStack pulpStack = OreDictionary.getOres("pulpWood").get(0); - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(Blocks.log, 1, 0), null, new FluidStack(FluidRegistry.WATER, 1000), new ItemStack(Blocks.planks, 6, 0), pulpStack, null, 200, 30, false)); - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(Blocks.log, 1, 0), new ItemStack(Items.water_bucket), null, new ItemStack(Blocks.planks, 6, 0), pulpStack, new ItemStack(Items.bucket), 200, 30, false)); - - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(Blocks.log, 1, 1), null, new FluidStack(FluidRegistry.WATER, 1000), new ItemStack(Blocks.planks, 6, 1), pulpStack, null, 200, 30, false)); - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(Blocks.log, 1, 1), new ItemStack(Items.water_bucket), null, new ItemStack(Blocks.planks, 6, 1), pulpStack, new ItemStack(Items.bucket), 200, 30, false)); - - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(Blocks.log, 1, 2), null, new FluidStack(FluidRegistry.WATER, 1000), new ItemStack(Blocks.planks, 6, 2), pulpStack, null, 200, 30, false)); - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(Blocks.log, 1, 2), new ItemStack(Items.water_bucket), null, new ItemStack(Blocks.planks, 6, 2), pulpStack, new ItemStack(Items.bucket), 200, 30, false)); - - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(Blocks.log, 1, 3), null, new FluidStack(FluidRegistry.WATER, 1000), new ItemStack(Blocks.planks, 6, 3), pulpStack, null, 200, 30, false)); - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(Blocks.log, 1, 3), new ItemStack(Items.water_bucket), null, new ItemStack(Blocks.planks, 6, 3), pulpStack, new ItemStack(Items.bucket), 200, 30, false)); - - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(Blocks.log2, 1, 0), null, new FluidStack(FluidRegistry.WATER, 1000), new ItemStack(Blocks.planks, 6, 4), pulpStack, null, 200, 30, false)); - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(Blocks.log2, 1, 0), new ItemStack(Items.water_bucket), null, new ItemStack(Blocks.planks, 6, 4), pulpStack, new ItemStack(Items.bucket), 200, 30, false)); - - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(Blocks.log2, 1, 1), null, new FluidStack(FluidRegistry.WATER, 1000), new ItemStack(Blocks.planks, 6, 5), pulpStack, null, 200, 30, false)); - RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(Blocks.log2, 1, 1), new ItemStack(Items.water_bucket), null, new ItemStack(Blocks.planks, 6, 5), pulpStack, new ItemStack(Items.bucket), 200, 30, false)); - } - - static void addBlastFurnaceRecipes() { - RecipeHandler.addRecipe(new BlastFurnaceRecipe(ItemDusts.getDustByName("titanium"), null, ItemIngots.getIngotByName("titanium"), null, 3600, 120, 1500)); - RecipeHandler.addRecipe(new BlastFurnaceRecipe(ItemDustsSmall.getSmallDustByName("titanium", 4), null, ItemIngots.getIngotByName("titanium"), null, 3600, 120, 1500)); + ModRecipes { + public static ConfigTechReborn config; + + public static void init() { + addShapelessRecipes(); + addGeneralShapedRecipes(); + addMachineRecipes(); + + addSmeltingRecipes(); + addUUrecipes(); + + addAlloySmelterRecipes(); + addPlateCuttingMachineRecipes(); + addIndustrialCentrifugeRecipes(); + addChemicalReactorRecipes(); + addIndustrialElectrolyzerRecipes(); + + addIndustrialSawmillRecipes(); + addBlastFurnaceRecipes(); + addIndustrialGrinderRecipes(); + addImplosionCompressorRecipes(); + } + + static void addGeneralShapedRecipes() { + + // Storage Blocks + for (String name : ArrayUtils.addAll(BlockStorage.types, BlockStorage2.types)) { + CraftingHelper.addShapedOreRecipe(BlockStorage.getStorageBlockByName(name), + "AAA", "AAA", "AAA", + 'A', "ingot" + name.substring(0, 1).toUpperCase() + name.substring(1)); + } + + CraftingHelper.addShapedOreRecipe(BlockStorage.getStorageBlockByName("sapphire"), + "AAA", "AAA", "AAA", + 'A', "gemSapphire"); + + CraftingHelper.addShapedOreRecipe(BlockStorage.getStorageBlockByName("ruby"), + "AAA", "AAA", "AAA", + 'A', "gemRuby"); + + + CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.parts, 1, 40), + "PLP", "RGB", "PYP", + 'P', "plateAluminum", + 'L', "dyeLime", + 'R', "dyeRed", + 'G', "paneGlass", + 'B', "dyeBlue", + 'Y', Items.glowstone_dust); + + CraftingHelper.addShapedOreRecipe(ItemParts.getPartByName("dataStorageCircuit"), + "EEE", "ECE", "EEE", + 'E', new ItemStack(Items.emerald), + 'C', ItemParts.getPartByName("basicCircuitBoard")); + + CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.parts, 4, 8), + "DSD", "S S", "DSD", + 'D', "dustDiamond", + 'S', "ingotSteel"); + + CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.parts, 1, 15), + "AAA", "AMA", "AAA", + 'A', "ingotAluminium", + 'M', new ItemStack(ModItems.parts, 1, 13)); + + CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.Supercondensator), + "EOE", "SAS", "EOE", + 'E', ItemParts.getPartByName("energyFlowCircuit"), + 'O', ModItems.lapotronicOrb, + 'S', ItemParts.getPartByName("superconductor"), + 'A', ModBlocks.HighAdvancedMachineBlock); + + CraftingHelper.addShapedOreRecipe(ItemParts.getPartByName("diamondSawBlade"), + "DSD", "S S", "DSD", + 'S', "plateSteel", + 'D', "dustDiamond"); + + CraftingHelper.addShapedOreRecipe(ItemParts.getPartByName("tungstenGrindingHead", 2), + "TST", "SBS", "TST", + 'T', "plateTungsten", + 'S', "plateSteel", + 'B', "blockSteel"); + + CraftingHelper.addShapedOreRecipe(ItemParts.getPartByName("destructoPack"), + "CIC", "IBI", "CIC", + 'C', ItemParts.getPartByName("basicCircuitBoard"), + 'I', "ingotAluminum", + 'B', new ItemStack(Items.lava_bucket) + ); + + CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.cloakingDevice), + "CIC", "IOI", "CIC", + 'C', "ingotChrome", + 'I', "plateIridium", + 'O', new ItemStack(ModItems.lapotronicOrb) + ); + + CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.rockCutter), + "DT ", "DT ", "DCB", + 'D', ItemParts.getPartByName("rockCutterBlade"), + 'T', "ingotTitanium", + 'C', ItemParts.getPartByName("basicCircuitBoard"), + 'B', new ItemStack(Items.diamond) + ); + + CraftingHelper.addShapedOreRecipe(ItemParts.getPartByName("rockCutterBlade"), + "SDS", "SDS", "SDS", + 'D', new ItemStack(Items.diamond), + 'S', "ingotSteel" + ); + + for (String part : ItemParts.types) { + if (part.endsWith("Gear")) { + CraftingHelper.addShapedOreRecipe(ItemParts.getPartByName(part), + " O ", "OIO", " O ", + 'I', new ItemStack(Items.iron_ingot), + 'O', "ingot" + capitalizeFirstLetter(part.replace("Gear", "")) + ); + } + } + + CraftingHelper.addShapedOreRecipe(ItemParts.getPartByName("nichromeHeatingCoil"), + " N ", "NCN", " N ", + 'N', "ingotNickel", + 'C', "ingotChrome" + ); + + CraftingHelper.addShapedOreRecipe(ItemParts.getPartByName("kanthalHeatingCoil"), + "III", "CAA", "AAA", + 'I', "ingotSteel", + 'C', "ingotChrome", + 'A', "ingotAluminum" + ); + + CraftingHelper.addShapedOreRecipe(ItemParts.getPartByName("heliumCoolantSimple"), + " T ", "TCT", " T ", + 'T', "ingotTin", + 'C', ItemCells.getCellByName("helium", 1, false) + ); + + CraftingHelper.addShapedOreRecipe(ItemParts.getPartByName("HeliumCoolantTriple"), + "TTT", "CCC", "TTT", + 'T', "ingotTin", + 'C', ItemParts.getPartByName("heliumCoolantSimple") + ); + + CraftingHelper.addShapedOreRecipe(ItemParts.getPartByName("HeliumCoolantSix"), + "THT", "TCT", "THT", + 'T', "ingotTin", + 'C', "ingotCopper", + 'H', ItemParts.getPartByName("HeliumCoolantTriple") + ); + + CraftingHelper.addShapedOreRecipe(ItemParts.getPartByName("NaKCoolantTriple"), + "TTT", "CCC", "TTT", + 'T', "ingotTin", + 'C', ItemParts.getPartByName("NaKCoolantSimple") + ); + + CraftingHelper.addShapedOreRecipe(ItemParts.getPartByName("NaKCoolantSix"), + "THT", "TCT", "THT", + 'T', "ingotTin", + 'C', "ingotCopper", + 'H', ItemParts.getPartByName("NaKCoolantTriple") + ); + + GameRegistry.addShapelessRecipe(ItemCells.getCellByName("heliumPlasma"), ItemCells.getCellByName("tritium"), ItemCells.getCellByName("deuterium")); + + Core.logHelper.info("Shapped Recipes Added"); + } + + public static String capitalizeFirstLetter(String original) { + if (original.length() == 0) + return original; + return original.substring(0, 1).toUpperCase() + original.substring(1); + } + + static void addShapelessRecipes() { + + for (String name : ArrayUtils.addAll(BlockStorage.types, BlockStorage2.types)) { + ItemStack item = null; + try { + item = ItemIngots.getIngotByName(name, 9); + } catch (InvalidParameterException e) { + try { + item = ItemGems.getGemByName(name, 9); + } catch (InvalidParameterException e2) { + continue; + } + } + + if (item == null) { + continue; + } + + GameRegistry.addShapelessRecipe(BlockStorage.getStorageBlockByName(name), item, item, item, item, item, item, item, item, item); + GameRegistry.addShapelessRecipe(item, BlockStorage.getStorageBlockByName(name, 9)); + + } + + for (String name : ItemDustsSmall.types) { + GameRegistry.addShapelessRecipe(ItemDustsSmall.getSmallDustByName(name, 4), ItemDusts.getDustByName(name)); + GameRegistry.addShapelessRecipe(ItemDusts.getDustByName(name, 1), ItemDustsSmall.getSmallDustByName(name), ItemDustsSmall.getSmallDustByName(name), ItemDustsSmall.getSmallDustByName(name), ItemDustsSmall.getSmallDustByName(name)); + } + + Core.logHelper.info("Shapless Recipes Added"); + } + + static void addMachineRecipes() { + CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.quantumTank), + "EPE", "PCP", "EPE", + 'P', "platePlatinum", + 'E', "circuitMaster", + 'C', ModBlocks.quantumChest); + + CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.digitalChest), + "PPP", "PDP", "PCP", + 'P', "plateAluminum", + 'D', ItemParts.getPartByName("dataOrb"), + 'C', ItemParts.getPartByName("computerMonitor")); + + CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.digitalChest), + "PPP", "PDP", "PCP", + 'P', "plateSteel", + 'D', ItemParts.getPartByName("dataOrb"), + 'C', ItemParts.getPartByName("computerMonitor")); + + CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.AlloySmelter), + "IHI", "CFC", "IHI", + 'I', "plateInvar", + 'C', "circuitBasic", + 'H', new ItemStack(ModItems.parts, 1, 17), + 'F', ModBlocks.AlloyFurnace); + + CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.LesuStorage), + "LLL", "LCL", "LLL", + 'L', "blockLapis", + 'C', "circuitBasic"); + + TechRebornAPI.addRollingMachinceRecipe(ItemParts.getPartByName("cupronickelHeatingCoil"), + "NCN", "C C", "NCN", + 'N', ItemIngots.getIngotByName("cupronickel"), + 'C', ItemIngots.getIngotByName("copper")); + + } + + static void addSmeltingRecipes() { + GameRegistry.addSmelting(ItemDusts.getDustByName("iron", 1), new ItemStack(Items.iron_ingot), 1F); + GameRegistry.addSmelting(ItemDusts.getDustByName("gold", 1), new ItemStack(Items.gold_ingot), 1F); + + Core.logHelper.info("Smelting Recipes Added"); + } + + static void addAlloySmelterRecipes() { + //Bronze + RecipeHandler.addRecipe(new AlloySmelterRecipe(ItemIngots.getIngotByName("copper", 3), ItemIngots.getIngotByName("tin", 1), ItemIngots.getIngotByName("bronze", 4), 200, 16)); + RecipeHandler.addRecipe(new AlloySmelterRecipe(ItemIngots.getIngotByName("copper", 3), ItemDusts.getDustByName("tin", 1), ItemIngots.getIngotByName("bronze", 4), 200, 16)); + RecipeHandler.addRecipe(new AlloySmelterRecipe(ItemDusts.getDustByName("copper", 3), ItemIngots.getIngotByName("tin", 1), ItemIngots.getIngotByName("bronze", 4), 200, 16)); + RecipeHandler.addRecipe(new AlloySmelterRecipe(ItemDusts.getDustByName("copper", 3), ItemDusts.getDustByName("tin", 1), ItemIngots.getIngotByName("bronze", 4), 200, 16)); + + //Electrum + RecipeHandler.addRecipe(new AlloySmelterRecipe(new ItemStack(Items.gold_ingot, 1), ItemIngots.getIngotByName("silver", 1), ItemIngots.getIngotByName("electrum", 2), 200, 16)); + RecipeHandler.addRecipe(new AlloySmelterRecipe(new ItemStack(Items.gold_ingot, 1), ItemDusts.getDustByName("silver", 1), ItemIngots.getIngotByName("electrum", 2), 200, 16)); + RecipeHandler.addRecipe(new AlloySmelterRecipe(ItemDusts.getDustByName("gold", 1), ItemIngots.getIngotByName("silver", 1), ItemIngots.getIngotByName("electrum", 2), 200, 16)); + RecipeHandler.addRecipe(new AlloySmelterRecipe(ItemDusts.getDustByName("gold", 1), ItemDusts.getDustByName("silver", 1), ItemIngots.getIngotByName("electrum", 2), 200, 16)); + + //Invar + RecipeHandler.addRecipe(new AlloySmelterRecipe(new ItemStack(Items.iron_ingot, 2), ItemIngots.getIngotByName("nickel", 1), ItemIngots.getIngotByName("invar", 3), 200, 16)); + RecipeHandler.addRecipe(new AlloySmelterRecipe(new ItemStack(Items.iron_ingot, 2), ItemDusts.getDustByName("nickel", 1), ItemIngots.getIngotByName("invar", 3), 200, 16)); + RecipeHandler.addRecipe(new AlloySmelterRecipe(ItemDusts.getDustByName("iron", 2), ItemIngots.getIngotByName("nickel", 1), ItemIngots.getIngotByName("invar", 3), 200, 16)); + RecipeHandler.addRecipe(new AlloySmelterRecipe(ItemDusts.getDustByName("iron", 2), ItemDusts.getDustByName("nickel", 1), ItemIngots.getIngotByName("invar", 3), 200, 16)); + + //Cupronickel + RecipeHandler.addRecipe(new AlloySmelterRecipe(ItemIngots.getIngotByName("copper", 1), ItemIngots.getIngotByName("nickel", 1), ItemIngots.getIngotByName("cupronickel", 2), 200, 16)); + RecipeHandler.addRecipe(new AlloySmelterRecipe(ItemIngots.getIngotByName("copper", 1), ItemDusts.getDustByName("nickel", 1), ItemIngots.getIngotByName("cupronickel", 2), 200, 16)); + RecipeHandler.addRecipe(new AlloySmelterRecipe(ItemDusts.getDustByName("copper", 1), ItemIngots.getIngotByName("nickel", 1), ItemIngots.getIngotByName("cupronickel", 2), 200, 16)); + RecipeHandler.addRecipe(new AlloySmelterRecipe(ItemDusts.getDustByName("copper", 1), ItemDusts.getDustByName("nickel", 1), ItemIngots.getIngotByName("cupronickel", 2), 200, 16)); + + //Nichrome + RecipeHandler.addRecipe(new AlloySmelterRecipe(ItemIngots.getIngotByName("chrome", 1), ItemIngots.getIngotByName("nickel", 4), ItemIngots.getIngotByName("nichrome", 5), 200, 16)); + RecipeHandler.addRecipe(new AlloySmelterRecipe(ItemIngots.getIngotByName("chrome", 1), ItemDusts.getDustByName("nickel", 4), ItemIngots.getIngotByName("nichrome", 5), 200, 16)); + RecipeHandler.addRecipe(new AlloySmelterRecipe(ItemDusts.getDustByName("chrome", 1), ItemIngots.getIngotByName("nickel", 4), ItemIngots.getIngotByName("nichrome", 5), 200, 16)); + RecipeHandler.addRecipe(new AlloySmelterRecipe(ItemDusts.getDustByName("chrome", 1), ItemDusts.getDustByName("nickel", 4), ItemIngots.getIngotByName("nichrome", 5), 200, 16)); + + //Magnalium + RecipeHandler.addRecipe(new AlloySmelterRecipe(ItemDusts.getDustByName("magnesium", 1), ItemIngots.getIngotByName("aluminum", 4), ItemIngots.getIngotByName("magnalium", 3), 200, 16)); + RecipeHandler.addRecipe(new AlloySmelterRecipe(ItemDusts.getDustByName("magnesium", 1), ItemDusts.getDustByName("aluminum", 4), ItemIngots.getIngotByName("magnalium", 3), 200, 16)); + + //Battery Alloy + RecipeHandler.addRecipe(new AlloySmelterRecipe(ItemIngots.getIngotByName("lead", 4), ItemIngots.getIngotByName("antimony", 1), ItemIngots.getIngotByName("batteryAlloy", 5), 200, 16)); + RecipeHandler.addRecipe(new AlloySmelterRecipe(ItemIngots.getIngotByName("lead", 4), ItemDusts.getDustByName("antimony", 1), ItemIngots.getIngotByName("batteryAlloy", 5), 200, 16)); + RecipeHandler.addRecipe(new AlloySmelterRecipe(ItemDusts.getDustByName("lead", 4), ItemIngots.getIngotByName("antimony", 1), ItemIngots.getIngotByName("batteryAlloy", 5), 200, 16)); + RecipeHandler.addRecipe(new AlloySmelterRecipe(ItemDusts.getDustByName("lead", 4), ItemDusts.getDustByName("antimony", 1), ItemIngots.getIngotByName("batteryAlloy", 5), 200, 16)); + + //Brass + if (OreUtil.doesOreExistAndValid("ingotBrass")) { + ItemStack brassStack = OreDictionary.getOres("ingotBrass").get(0); + brassStack.stackSize = 4; + RecipeHandler.addRecipe(new AlloySmelterRecipe(ItemIngots.getIngotByName("copper", 3), ItemIngots.getIngotByName("zinc", 1), brassStack, 200, 16)); + RecipeHandler.addRecipe(new AlloySmelterRecipe(ItemIngots.getIngotByName("copper", 3), ItemDusts.getDustByName("zinc", 1), brassStack, 200, 16)); + RecipeHandler.addRecipe(new AlloySmelterRecipe(ItemDusts.getDustByName("copper", 3), ItemIngots.getIngotByName("zinc", 1), brassStack, 200, 16)); + RecipeHandler.addRecipe(new AlloySmelterRecipe(ItemDusts.getDustByName("copper", 3), ItemDusts.getDustByName("zinc", 1), brassStack, 200, 16)); + } + + //Red Alloy + if (OreUtil.doesOreExistAndValid("ingotRedAlloy")) { + ItemStack redAlloyStack = OreDictionary.getOres("ingotRedAlloy").get(0); + redAlloyStack.stackSize = 1; + RecipeHandler.addRecipe(new AlloySmelterRecipe(new ItemStack(Items.redstone, 4), ItemIngots.getIngotByName("copper", 1), redAlloyStack, 200, 16)); + RecipeHandler.addRecipe(new AlloySmelterRecipe(new ItemStack(Items.redstone, 4), new ItemStack(Items.iron_ingot, 1), redAlloyStack, 200, 16)); + } + + //Blue Alloy + if (OreUtil.doesOreExistAndValid("ingotBlueAlloy")) { + ItemStack blueAlloyStack = OreDictionary.getOres("ingotBlueAlloy").get(0); + blueAlloyStack.stackSize = 1; + RecipeHandler.addRecipe(new AlloySmelterRecipe(ItemDusts.getDustByName("teslatite", 4), ItemIngots.getIngotByName("silver", 1), blueAlloyStack, 200, 16)); + } + + //Blue Alloy + if (OreUtil.doesOreExistAndValid("ingotPurpleAlloy") && OreUtil.doesOreExistAndValid("dustInfusedTeslatite")) { + ItemStack purpleAlloyStack = OreDictionary.getOres("ingotPurpleAlloy").get(0); + purpleAlloyStack.stackSize = 1; + ItemStack infusedTeslatiteStack = OreDictionary.getOres("ingotPurpleAlloy").get(0); + infusedTeslatiteStack.stackSize = 8; + RecipeHandler.addRecipe(new AlloySmelterRecipe(ItemIngots.getIngotByName("redAlloy", 1), ItemIngots.getIngotByName("blueAlloy", 1), purpleAlloyStack, 200, 16)); + RecipeHandler.addRecipe(new AlloySmelterRecipe(new ItemStack(Items.gold_ingot, 1), infusedTeslatiteStack, purpleAlloyStack, 200, 16)); + } + + //Aluminum Brass + if (OreUtil.doesOreExistAndValid("ingotAluminumBrass")) { + ItemStack aluminumBrassStack = OreDictionary.getOres("ingotAluminumBrass").get(0); + aluminumBrassStack.stackSize = 4; + RecipeHandler.addRecipe(new AlloySmelterRecipe(ItemIngots.getIngotByName("copper", 3), ItemIngots.getIngotByName("aluminum", 1), aluminumBrassStack, 200, 16)); + RecipeHandler.addRecipe(new AlloySmelterRecipe(ItemIngots.getIngotByName("copper", 3), ItemDusts.getDustByName("aluminum", 1), aluminumBrassStack, 200, 16)); + RecipeHandler.addRecipe(new AlloySmelterRecipe(ItemDusts.getDustByName("copper", 3), ItemIngots.getIngotByName("aluminum", 1), aluminumBrassStack, 200, 16)); + RecipeHandler.addRecipe(new AlloySmelterRecipe(ItemDusts.getDustByName("copper", 3), ItemDusts.getDustByName("aluminum", 1), aluminumBrassStack, 200, 16)); + } + + //Manyullyn + if (OreUtil.doesOreExistAndValid("ingotManyullyn") && OreUtil.doesOreExistAndValid("ingotCobalt") && OreUtil.doesOreExistAndValid("ingotArdite")) { + ItemStack manyullynStack = OreDictionary.getOres("ingotManyullyn").get(0); + manyullynStack.stackSize = 1; + ItemStack cobaltStack = OreDictionary.getOres("ingotCobalt").get(0); + cobaltStack.stackSize = 1; + ItemStack arditeStack = OreDictionary.getOres("ingotArdite").get(0); + arditeStack.stackSize = 1; + RecipeHandler.addRecipe(new AlloySmelterRecipe(cobaltStack, arditeStack, manyullynStack, 200, 16)); + RecipeHandler.addRecipe(new AlloySmelterRecipe(cobaltStack, ItemDusts.getDustByName("ardite", 1), manyullynStack, 200, 16)); + RecipeHandler.addRecipe(new AlloySmelterRecipe(ItemDusts.getDustByName("cobalt", 1), arditeStack, manyullynStack, 200, 16)); + RecipeHandler.addRecipe(new AlloySmelterRecipe(ItemDusts.getDustByName("cobalt", 1), ItemDusts.getDustByName("ardite", 1), manyullynStack, 200, 16)); + } + + //Conductive Iron + if (OreUtil.doesOreExistAndValid("ingotConductiveIron")) { + ItemStack conductiveIronStack = OreDictionary.getOres("ingotConductiveIron").get(0); + conductiveIronStack.stackSize = 1; + RecipeHandler.addRecipe(new AlloySmelterRecipe(new ItemStack(Items.redstone, 1), new ItemStack(Items.iron_ingot, 1), conductiveIronStack, 200, 16)); + } + + //Redstone Alloy + if (OreUtil.doesOreExistAndValid("ingotRedstoneAlloy") && OreUtil.doesOreExistAndValid("itemSilicon")) { + ItemStack redstoneAlloyStack = OreDictionary.getOres("ingotRedstoneAlloy").get(0); + redstoneAlloyStack.stackSize = 1; + ItemStack siliconStack = OreDictionary.getOres("itemSilicon").get(0); + siliconStack.stackSize = 1; + RecipeHandler.addRecipe(new AlloySmelterRecipe(new ItemStack(Items.redstone, 1), siliconStack, redstoneAlloyStack, 200, 16)); + } + + //Pulsating Iron + if (OreUtil.doesOreExistAndValid("ingotPhasedIron")) { + ItemStack pulsatingIronStack = OreDictionary.getOres("ingotPhasedIron").get(0); + pulsatingIronStack.stackSize = 1; + RecipeHandler.addRecipe(new AlloySmelterRecipe(new ItemStack(Items.iron_ingot, 1), new ItemStack(Items.ender_pearl, 1), pulsatingIronStack, 200, 16)); + RecipeHandler.addRecipe(new AlloySmelterRecipe(new ItemStack(Items.iron_ingot, 1), ItemDusts.getDustByName("enderPearl", 1), pulsatingIronStack, 200, 16)); + } + + //Vibrant Alloy + if (OreUtil.doesOreExistAndValid("ingotEnergeticAlloy") && OreUtil.doesOreExistAndValid("ingotPhasedGold")) { + ItemStack energeticAlloyStack = OreDictionary.getOres("ingotEnergeticAlloy").get(0); + energeticAlloyStack.stackSize = 1; + ItemStack vibrantAlloyStack = OreDictionary.getOres("ingotPhasedGold").get(0); + vibrantAlloyStack.stackSize = 1; + RecipeHandler.addRecipe(new AlloySmelterRecipe(energeticAlloyStack, new ItemStack(Items.ender_pearl, 1), vibrantAlloyStack, 200, 16)); + RecipeHandler.addRecipe(new AlloySmelterRecipe(energeticAlloyStack, ItemDusts.getDustByName("enderPearl", 1), vibrantAlloyStack, 200, 16)); + } + + //Soularium + if (OreUtil.doesOreExistAndValid("ingotSoularium")) { + ItemStack soulariumStack = OreDictionary.getOres("ingotSoularium").get(0); + soulariumStack.stackSize = 1; + RecipeHandler.addRecipe(new AlloySmelterRecipe(new ItemStack(Blocks.soul_sand, 1), new ItemStack(Items.gold_ingot, 1), soulariumStack, 200, 16)); + } + + } + + static void addPlateCuttingMachineRecipes() { + //Storage Blocks + if (OreUtil.doesOreExistAndValid("blockAluminum")) { + ItemStack blockStack = OreDictionary.getOres("blockAluminum").get(0); + RecipeHandler.addRecipe(new PlateCuttingMachineRecipe(blockStack, ItemPlates.getPlateByName("aluminum", 9), 200, 16)); + } + if (OreUtil.doesOreExistAndValid("blockBrass")) { + ItemStack blockStack = OreDictionary.getOres("blockBrass").get(0); + RecipeHandler.addRecipe(new PlateCuttingMachineRecipe(blockStack, ItemPlates.getPlateByName("brass", 9), 200, 116)); + } + if (OreUtil.doesOreExistAndValid("blockBronze")) { + ItemStack blockStack = OreDictionary.getOres("blockBronze").get(0); + RecipeHandler.addRecipe(new PlateCuttingMachineRecipe(blockStack, ItemPlates.getPlateByName("bronze", 9), 200, 16)); + } + if (OreUtil.doesOreExistAndValid("blockCoal")) { + ItemStack blockStack = OreDictionary.getOres("blockCoal").get(0); + RecipeHandler.addRecipe(new PlateCuttingMachineRecipe(blockStack, ItemPlates.getPlateByName("carbon", 9), 200, 16)); + } + if (OreUtil.doesOreExistAndValid("blockChrome")) { + ItemStack blockStack = OreDictionary.getOres("blockChrome").get(0); + RecipeHandler.addRecipe(new PlateCuttingMachineRecipe(blockStack, ItemPlates.getPlateByName("chrome", 9), 200, 16)); + } + if (OreUtil.doesOreExistAndValid("blockCopper")) { + ItemStack blockStack = OreDictionary.getOres("blockCopper").get(0); + RecipeHandler.addRecipe(new PlateCuttingMachineRecipe(blockStack, ItemPlates.getPlateByName("copper", 9), 200, 16)); + } + if (OreUtil.doesOreExistAndValid("blockDiamond")) { + ItemStack blockStack = OreDictionary.getOres("blockDiamond").get(0); + RecipeHandler.addRecipe(new PlateCuttingMachineRecipe(blockStack, ItemPlates.getPlateByName("diamond", 9), 200, 16)); + } + if (OreUtil.doesOreExistAndValid("blockElectrum")) { + ItemStack blockStack = OreDictionary.getOres("blockElectrum").get(0); + RecipeHandler.addRecipe(new PlateCuttingMachineRecipe(blockStack, ItemPlates.getPlateByName("electrum", 9), 200, 16)); + } + if (OreUtil.doesOreExistAndValid("blockEmerald")) { + ItemStack blockStack = OreDictionary.getOres("blockEmerald").get(0); + RecipeHandler.addRecipe(new PlateCuttingMachineRecipe(blockStack, ItemPlates.getPlateByName("emerald", 9), 200, 16)); + } + if (OreUtil.doesOreExistAndValid("blockGold")) { + ItemStack blockStack = OreDictionary.getOres("blockGold").get(0); + RecipeHandler.addRecipe(new PlateCuttingMachineRecipe(blockStack, ItemPlates.getPlateByName("gold", 9), 200, 16)); + } + if (OreUtil.doesOreExistAndValid("blockInvar")) { + ItemStack blockStack = OreDictionary.getOres("blockInvar").get(0); + RecipeHandler.addRecipe(new PlateCuttingMachineRecipe(blockStack, ItemPlates.getPlateByName("invar", 9), 200, 16)); + } + if (OreUtil.doesOreExistAndValid("blockIridium")) { + ItemStack blockStack = OreDictionary.getOres("blockIridium").get(0); + RecipeHandler.addRecipe(new PlateCuttingMachineRecipe(blockStack, ItemPlates.getPlateByName("iridium", 9), 200, 16)); + } + if (OreUtil.doesOreExistAndValid("blockIron")) { + ItemStack blockStack = OreDictionary.getOres("blockIron").get(0); + RecipeHandler.addRecipe(new PlateCuttingMachineRecipe(blockStack, ItemPlates.getPlateByName("iron", 9), 200, 16)); + } + if (OreUtil.doesOreExistAndValid("blockLapis")) { + ItemStack blockStack = OreDictionary.getOres("blockLapis").get(0); + RecipeHandler.addRecipe(new PlateCuttingMachineRecipe(blockStack, ItemPlates.getPlateByName("lapis", 9), 200, 16)); + } + if (OreUtil.doesOreExistAndValid("blockLead")) { + ItemStack blockStack = OreDictionary.getOres("blockLead").get(0); + RecipeHandler.addRecipe(new PlateCuttingMachineRecipe(blockStack, ItemPlates.getPlateByName("lead", 9), 200, 16)); + } + if (OreUtil.doesOreExistAndValid("blockNickel")) { + ItemStack blockStack = OreDictionary.getOres("blockNickel").get(0); + RecipeHandler.addRecipe(new PlateCuttingMachineRecipe(blockStack, ItemPlates.getPlateByName("nickel", 9), 200, 16)); + } + if (OreUtil.doesOreExistAndValid("blockOsmium")) { + ItemStack blockStack = OreDictionary.getOres("blockOsmium").get(0); + RecipeHandler.addRecipe(new PlateCuttingMachineRecipe(blockStack, ItemPlates.getPlateByName("osmium", 9), 200, 16)); + } + if (OreUtil.doesOreExistAndValid("blockPeridot")) { + ItemStack blockStack = OreDictionary.getOres("blockPeridot").get(0); + RecipeHandler.addRecipe(new PlateCuttingMachineRecipe(blockStack, ItemPlates.getPlateByName("peridot", 9), 200, 16)); + } + if (OreUtil.doesOreExistAndValid("blockPlatinum")) { + ItemStack blockStack = OreDictionary.getOres("blockPlatinum").get(0); + RecipeHandler.addRecipe(new PlateCuttingMachineRecipe(blockStack, ItemPlates.getPlateByName("platinum", 9), 200, 16)); + } + if (OreUtil.doesOreExistAndValid("blockRedGarnet")) { + ItemStack blockStack = OreDictionary.getOres("blockRedGarnet").get(0); + RecipeHandler.addRecipe(new PlateCuttingMachineRecipe(blockStack, ItemPlates.getPlateByName("redGarnet", 9), 200, 16)); + } + if (OreUtil.doesOreExistAndValid("BlockRedstone")) { + ItemStack blockStack = OreDictionary.getOres("blockRedstone").get(0); + RecipeHandler.addRecipe(new PlateCuttingMachineRecipe(blockStack, ItemPlates.getPlateByName("redstone", 9), 200, 16)); + } + if (OreUtil.doesOreExistAndValid("blockRuby")) { + ItemStack blockStack = OreDictionary.getOres("blockRuby").get(0); + RecipeHandler.addRecipe(new PlateCuttingMachineRecipe(blockStack, ItemPlates.getPlateByName("ruby", 9), 200, 16)); + } + if (OreUtil.doesOreExistAndValid("blockSapphire")) { + ItemStack blockStack = OreDictionary.getOres("blockSapphire").get(0); + RecipeHandler.addRecipe(new PlateCuttingMachineRecipe(blockStack, ItemPlates.getPlateByName("sapphire", 9), 200, 16)); + } + if (OreUtil.doesOreExistAndValid("blockSilver")) { + ItemStack blockStack = OreDictionary.getOres("blockSilver").get(0); + RecipeHandler.addRecipe(new PlateCuttingMachineRecipe(blockStack, ItemPlates.getPlateByName("silver", 9), 200, 16)); + } + if (OreUtil.doesOreExistAndValid("blockSteel")) { + ItemStack blockStack = OreDictionary.getOres("blockSteel").get(0); + RecipeHandler.addRecipe(new PlateCuttingMachineRecipe(blockStack, ItemPlates.getPlateByName("steel", 9), 200, 16)); + } + if (OreUtil.doesOreExistAndValid("blockTeslatite")) { + ItemStack blockStack = OreDictionary.getOres("blockTeslatite").get(0); + RecipeHandler.addRecipe(new PlateCuttingMachineRecipe(blockStack, ItemPlates.getPlateByName("teslatite", 9), 200, 16)); + } + if (OreUtil.doesOreExistAndValid("blockTin")) { + ItemStack blockStack = OreDictionary.getOres("blockTin").get(0); + RecipeHandler.addRecipe(new PlateCuttingMachineRecipe(blockStack, ItemPlates.getPlateByName("tin", 9), 200, 16)); + } + if (OreUtil.doesOreExistAndValid("blockTitanium")) { + ItemStack blockStack = OreDictionary.getOres("blockTitanium").get(0); + RecipeHandler.addRecipe(new PlateCuttingMachineRecipe(blockStack, ItemPlates.getPlateByName("titanium", 9), 200, 16)); + } + if (OreUtil.doesOreExistAndValid("blockTungsten")) { + ItemStack blockStack = OreDictionary.getOres("blockTungsten").get(0); + RecipeHandler.addRecipe(new PlateCuttingMachineRecipe(blockStack, ItemPlates.getPlateByName("tungsten", 9), 200, 16)); + } + if (OreUtil.doesOreExistAndValid("blockTungstensteel")) { + ItemStack blockStack = OreDictionary.getOres("blockTungstensteel").get(0); + RecipeHandler.addRecipe(new PlateCuttingMachineRecipe(blockStack, ItemPlates.getPlateByName("tungstensteel", 9), 200, 16)); + } + if (OreUtil.doesOreExistAndValid("blockYellowGarnet")) { + ItemStack blockStack = OreDictionary.getOres("blockYellowGarnet").get(0); + RecipeHandler.addRecipe(new PlateCuttingMachineRecipe(blockStack, ItemPlates.getPlateByName("yellowGarnet", 9), 200, 16)); + } + if (OreUtil.doesOreExistAndValid("blockZinc")) { + ItemStack blockStack = OreDictionary.getOres("blockZinc").get(0); + RecipeHandler.addRecipe(new PlateCuttingMachineRecipe(blockStack, ItemPlates.getPlateByName("zinc", 9), 200, 16)); + } + + //Obsidian + RecipeHandler.addRecipe(new PlateCuttingMachineRecipe(new ItemStack(Blocks.obsidian), ItemPlates.getPlateByName("obsidian", 9), 100, 4)); + } + + static void addIndustrialSawmillRecipes() { + ItemStack pulpStack = OreDictionary.getOres("pulpWood").get(0); + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(Blocks.log, 1, 0), null, new FluidStack(FluidRegistry.WATER, 1000), new ItemStack(Blocks.planks, 6, 0), pulpStack, null, 200, 30, false)); + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(Blocks.log, 1, 0), new ItemStack(Items.water_bucket), null, new ItemStack(Blocks.planks, 6, 0), pulpStack, new ItemStack(Items.bucket), 200, 30, false)); + + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(Blocks.log, 1, 1), null, new FluidStack(FluidRegistry.WATER, 1000), new ItemStack(Blocks.planks, 6, 1), pulpStack, null, 200, 30, false)); + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(Blocks.log, 1, 1), new ItemStack(Items.water_bucket), null, new ItemStack(Blocks.planks, 6, 1), pulpStack, new ItemStack(Items.bucket), 200, 30, false)); + + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(Blocks.log, 1, 2), null, new FluidStack(FluidRegistry.WATER, 1000), new ItemStack(Blocks.planks, 6, 2), pulpStack, null, 200, 30, false)); + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(Blocks.log, 1, 2), new ItemStack(Items.water_bucket), null, new ItemStack(Blocks.planks, 6, 2), pulpStack, new ItemStack(Items.bucket), 200, 30, false)); + + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(Blocks.log, 1, 3), null, new FluidStack(FluidRegistry.WATER, 1000), new ItemStack(Blocks.planks, 6, 3), pulpStack, null, 200, 30, false)); + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(Blocks.log, 1, 3), new ItemStack(Items.water_bucket), null, new ItemStack(Blocks.planks, 6, 3), pulpStack, new ItemStack(Items.bucket), 200, 30, false)); + + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(Blocks.log2, 1, 0), null, new FluidStack(FluidRegistry.WATER, 1000), new ItemStack(Blocks.planks, 6, 4), pulpStack, null, 200, 30, false)); + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(Blocks.log2, 1, 0), new ItemStack(Items.water_bucket), null, new ItemStack(Blocks.planks, 6, 4), pulpStack, new ItemStack(Items.bucket), 200, 30, false)); + + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(Blocks.log2, 1, 1), null, new FluidStack(FluidRegistry.WATER, 1000), new ItemStack(Blocks.planks, 6, 5), pulpStack, null, 200, 30, false)); + RecipeHandler.addRecipe(new IndustrialSawmillRecipe(new ItemStack(Blocks.log2, 1, 1), new ItemStack(Items.water_bucket), null, new ItemStack(Blocks.planks, 6, 5), pulpStack, new ItemStack(Items.bucket), 200, 30, false)); + } + + static void addBlastFurnaceRecipes() { + RecipeHandler.addRecipe(new BlastFurnaceRecipe(ItemDusts.getDustByName("titanium"), null, ItemIngots.getIngotByName("titanium"), null, 3600, 120, 1500)); + RecipeHandler.addRecipe(new BlastFurnaceRecipe(ItemDustsSmall.getSmallDustByName("titanium", 4), null, ItemIngots.getIngotByName("titanium"), null, 3600, 120, 1500)); // RecipeHandler.addRecipe(new BlastFurnaceRecipe(ItemDustsTiny.getTinyDustByName("titanium", 9), null, ItemIngots.getIngotByName("titanium"), null, 3600, 120, 1500)); - RecipeHandler.addRecipe(new BlastFurnaceRecipe(ItemDusts.getDustByName("aluminum"), null, ItemIngots.getIngotByName("aluminum"), null, 2200, 120, 1700)); - RecipeHandler.addRecipe(new BlastFurnaceRecipe(ItemDustsSmall.getSmallDustByName("aluminum", 4), null, ItemIngots.getIngotByName("aluminum"), null, 2200, 120, 1700)); + RecipeHandler.addRecipe(new BlastFurnaceRecipe(ItemDusts.getDustByName("aluminum"), null, ItemIngots.getIngotByName("aluminum"), null, 2200, 120, 1700)); + RecipeHandler.addRecipe(new BlastFurnaceRecipe(ItemDustsSmall.getSmallDustByName("aluminum", 4), null, ItemIngots.getIngotByName("aluminum"), null, 2200, 120, 1700)); // RecipeHandler.addRecipe(new BlastFurnaceRecipe(ItemDustsTiny.getTinyDustByName("aluminum", 9), null, ItemIngots.getIngotByName("aluminum"), null, 2200, 120, 1700)); - RecipeHandler.addRecipe(new BlastFurnaceRecipe(ItemDusts.getDustByName("kanthal"), null, ItemIngots.getIngotByName("kanthal"), null, 5500, 120, 2500)); - RecipeHandler.addRecipe(new BlastFurnaceRecipe(ItemDustsSmall.getSmallDustByName("kanthal", 4), null, ItemIngots.getIngotByName("kanthal"), null, 5500, 120, 2500)); + RecipeHandler.addRecipe(new BlastFurnaceRecipe(ItemDusts.getDustByName("kanthal"), null, ItemIngots.getIngotByName("kanthal"), null, 5500, 120, 2500)); + RecipeHandler.addRecipe(new BlastFurnaceRecipe(ItemDustsSmall.getSmallDustByName("kanthal", 4), null, ItemIngots.getIngotByName("kanthal"), null, 5500, 120, 2500)); // RecipeHandler.addRecipe(new BlastFurnaceRecipe(ItemDustsTiny.getTinyDustByName("kanthal", 9), null, ItemIngots.getIngotByName("kanthal"), null, 5500, 120, 2500)); - RecipeHandler.addRecipe(new BlastFurnaceRecipe(ItemDusts.getDustByName("tungsten"), null, ItemIngots.getIngotByName("tungsten"), null, 18000, 120, 2500)); - RecipeHandler.addRecipe(new BlastFurnaceRecipe(ItemDustsSmall.getSmallDustByName("tungsten", 4), null, ItemIngots.getIngotByName("tungsten"), null, 18000, 120, 2500)); + RecipeHandler.addRecipe(new BlastFurnaceRecipe(ItemDusts.getDustByName("tungsten"), null, ItemIngots.getIngotByName("tungsten"), null, 18000, 120, 2500)); + RecipeHandler.addRecipe(new BlastFurnaceRecipe(ItemDustsSmall.getSmallDustByName("tungsten", 4), null, ItemIngots.getIngotByName("tungsten"), null, 18000, 120, 2500)); // RecipeHandler.addRecipe(new BlastFurnaceRecipe(ItemDustsTiny.getTinyDustByName("tungsten", 9), null, ItemIngots.getIngotByName("tungsten"), null, 18000, 120, 2500)); - RecipeHandler.addRecipe(new BlastFurnaceRecipe(ItemDusts.getDustByName("chrome"), null, ItemIngots.getIngotByName("chrome"), null, 4420, 120, 1700)); - RecipeHandler.addRecipe(new BlastFurnaceRecipe(ItemDustsSmall.getSmallDustByName("chrome", 4), null, ItemIngots.getIngotByName("chrome"), null, 4420, 120, 1700)); + RecipeHandler.addRecipe(new BlastFurnaceRecipe(ItemDusts.getDustByName("chrome"), null, ItemIngots.getIngotByName("chrome"), null, 4420, 120, 1700)); + RecipeHandler.addRecipe(new BlastFurnaceRecipe(ItemDustsSmall.getSmallDustByName("chrome", 4), null, ItemIngots.getIngotByName("chrome"), null, 4420, 120, 1700)); // RecipeHandler.addRecipe(new BlastFurnaceRecipe(ItemDustsTiny.getTinyDustByName("chrome", 9), null, ItemIngots.getIngotByName("chrome"), null, 4420, 120, 1700)); - RecipeHandler.addRecipe(new BlastFurnaceRecipe(ItemDusts.getDustByName("steel"), null, ItemIngots.getIngotByName("steel"), null, 2800, 120, 1000)); - RecipeHandler.addRecipe(new BlastFurnaceRecipe(ItemDustsSmall.getSmallDustByName("steel", 4), null, ItemIngots.getIngotByName("steel"), null, 2800, 120, 1000)); + RecipeHandler.addRecipe(new BlastFurnaceRecipe(ItemDusts.getDustByName("steel"), null, ItemIngots.getIngotByName("steel"), null, 2800, 120, 1000)); + RecipeHandler.addRecipe(new BlastFurnaceRecipe(ItemDustsSmall.getSmallDustByName("steel", 4), null, ItemIngots.getIngotByName("steel"), null, 2800, 120, 1000)); // RecipeHandler.addRecipe(new BlastFurnaceRecipe(ItemDustsTiny.getTinyDustByName("steel", 9), null, ItemIngots.getIngotByName("steel"), null, 2800, 120, 1000)); - RecipeHandler.addRecipe(new BlastFurnaceRecipe(ItemDusts.getDustByName("galena", 2), null, ItemIngots.getIngotByName("silver"), ItemIngots.getIngotByName("lead"), 80, 120, 1500)); + RecipeHandler.addRecipe(new BlastFurnaceRecipe(ItemDusts.getDustByName("galena", 2), null, ItemIngots.getIngotByName("silver"), ItemIngots.getIngotByName("lead"), 80, 120, 1500)); - RecipeHandler.addRecipe(new BlastFurnaceRecipe(new ItemStack(Items.iron_ingot), ItemDusts.getDustByName("coal", 2), ItemIngots.getIngotByName("steel"), ItemDusts.getDustByName("darkAshes", 2), 500, 120, 1000)); + RecipeHandler.addRecipe(new BlastFurnaceRecipe(new ItemStack(Items.iron_ingot), ItemDusts.getDustByName("coal", 2), ItemIngots.getIngotByName("steel"), ItemDusts.getDustByName("darkAshes", 2), 500, 120, 1000)); - RecipeHandler.addRecipe(new BlastFurnaceRecipe(ItemIngots.getIngotByName("tungsten"), ItemIngots.getIngotByName("steel"), ItemIngots.getIngotByName("hotTungstensteel"), ItemDusts.getDustByName("darkAshes", 4), 500, 500, 3000)); + RecipeHandler.addRecipe(new BlastFurnaceRecipe(ItemIngots.getIngotByName("tungsten"), ItemIngots.getIngotByName("steel"), ItemIngots.getIngotByName("hotTungstensteel"), ItemDusts.getDustByName("darkAshes", 4), 500, 500, 3000)); - RecipeHandler.addRecipe(new BlastFurnaceRecipe(new ItemStack(Blocks.iron_ore), ItemDusts.getDustByName("calcite"), new ItemStack(Items.iron_ingot, 3), ItemDusts.getDustByName("darkAshes"), 140, 120, 1000)); + RecipeHandler.addRecipe(new BlastFurnaceRecipe(new ItemStack(Blocks.iron_ore), ItemDusts.getDustByName("calcite"), new ItemStack(Items.iron_ingot, 3), ItemDusts.getDustByName("darkAshes"), 140, 120, 1000)); - RecipeHandler.addRecipe(new BlastFurnaceRecipe(BlockOre.getOreByName("Pyrite"), ItemDusts.getDustByName("calcite"), new ItemStack(Items.iron_ingot, 2), ItemDusts.getDustByName("darkAshes"), 140, 120, 1000)); - } + RecipeHandler.addRecipe(new BlastFurnaceRecipe(BlockOre.getOreByName("Pyrite"), ItemDusts.getDustByName("calcite"), new ItemStack(Items.iron_ingot, 2), ItemDusts.getDustByName("darkAshes"), 140, 120, 1000)); + } - static void addUUrecipes() { + static void addUUrecipes() { - if (ConfigTechReborn.UUrecipesWood) - CraftingHelper.addShapedOreRecipe(new ItemStack(Blocks.log, 8), - " U ", - " ", - " ", - 'U', ModItems.uuMatter); + if (ConfigTechReborn.UUrecipesWood) + CraftingHelper.addShapedOreRecipe(new ItemStack(Blocks.log, 8), + " U ", + " ", + " ", + 'U', ModItems.uuMatter); - if (ConfigTechReborn.UUrecipesStone) - CraftingHelper.addShapedOreRecipe(new ItemStack(Blocks.stone, 16), - " ", - " U ", - " ", - 'U', ModItems.uuMatter); + if (ConfigTechReborn.UUrecipesStone) + CraftingHelper.addShapedOreRecipe(new ItemStack(Blocks.stone, 16), + " ", + " U ", + " ", + 'U', ModItems.uuMatter); - if (ConfigTechReborn.UUrecipesSnowBlock) - CraftingHelper.addShapedOreRecipe(new ItemStack(Blocks.snow, 16), - "U U", - " ", - " ", - 'U', ModItems.uuMatter); + if (ConfigTechReborn.UUrecipesSnowBlock) + CraftingHelper.addShapedOreRecipe(new ItemStack(Blocks.snow, 16), + "U U", + " ", + " ", + 'U', ModItems.uuMatter); - if (ConfigTechReborn.UUrecipesGrass) - CraftingHelper.addShapedOreRecipe(new ItemStack(Blocks.grass, 16), - " ", - "U ", - "U ", - 'U', ModItems.uuMatter); + if (ConfigTechReborn.UUrecipesGrass) + CraftingHelper.addShapedOreRecipe(new ItemStack(Blocks.grass, 16), + " ", + "U ", + "U ", + 'U', ModItems.uuMatter); - if (ConfigTechReborn.UUrecipesObsidian) - CraftingHelper.addShapedOreRecipe(new ItemStack(Blocks.obsidian, 12), - "U U", - "U U", - " ", - 'U', ModItems.uuMatter); + if (ConfigTechReborn.UUrecipesObsidian) + CraftingHelper.addShapedOreRecipe(new ItemStack(Blocks.obsidian, 12), + "U U", + "U U", + " ", + 'U', ModItems.uuMatter); - if (ConfigTechReborn.UUrecipesGlass) - CraftingHelper.addShapedOreRecipe(new ItemStack(Blocks.glass, 32), - " U ", - "U U", - " U ", - 'U', ModItems.uuMatter); + if (ConfigTechReborn.UUrecipesGlass) + CraftingHelper.addShapedOreRecipe(new ItemStack(Blocks.glass, 32), + " U ", + "U U", + " U ", + 'U', ModItems.uuMatter); - if (ConfigTechReborn.UUrecipesWater) - CraftingHelper.addShapedOreRecipe(new ItemStack(Blocks.water, 1), - " ", - " U ", - " U ", - 'U', ModItems.uuMatter); + if (ConfigTechReborn.UUrecipesWater) + CraftingHelper.addShapedOreRecipe(new ItemStack(Blocks.water, 1), + " ", + " U ", + " U ", + 'U', ModItems.uuMatter); - if (ConfigTechReborn.UUrecipesLava) - CraftingHelper.addShapedOreRecipe(new ItemStack(Blocks.lava, 1), - " U ", - " U ", - " U ", - 'U', ModItems.uuMatter); + if (ConfigTechReborn.UUrecipesLava) + CraftingHelper.addShapedOreRecipe(new ItemStack(Blocks.lava, 1), + " U ", + " U ", + " U ", + 'U', ModItems.uuMatter); - if (ConfigTechReborn.UUrecipesCocoa) - CraftingHelper.addShapedOreRecipe(new ItemStack(Items.dye, 32, 3), - "UU ", - " U", - "UU ", - 'U', ModItems.uuMatter); + if (ConfigTechReborn.UUrecipesCocoa) + CraftingHelper.addShapedOreRecipe(new ItemStack(Items.dye, 32, 3), + "UU ", + " U", + "UU ", + 'U', ModItems.uuMatter); - if (ConfigTechReborn.UUrecipesGlowstoneBlock) - CraftingHelper.addShapedOreRecipe(new ItemStack(Blocks.glowstone, 8), - " U ", - "U U", - "UUU", - 'U', ModItems.uuMatter); + if (ConfigTechReborn.UUrecipesGlowstoneBlock) + CraftingHelper.addShapedOreRecipe(new ItemStack(Blocks.glowstone, 8), + " U ", + "U U", + "UUU", + 'U', ModItems.uuMatter); - if (ConfigTechReborn.UUrecipesCactus) - CraftingHelper.addShapedOreRecipe(new ItemStack(Blocks.cactus, 48), - " U ", - "UUU", - "U U", - 'U', ModItems.uuMatter); + if (ConfigTechReborn.UUrecipesCactus) + CraftingHelper.addShapedOreRecipe(new ItemStack(Blocks.cactus, 48), + " U ", + "UUU", + "U U", + 'U', ModItems.uuMatter); - if (ConfigTechReborn.UUrecipesSugarCane) - CraftingHelper.addShapedOreRecipe(new ItemStack(Items.reeds, 48), - "U U", - "U U", - "U U", - 'U', ModItems.uuMatter); + if (ConfigTechReborn.UUrecipesSugarCane) + CraftingHelper.addShapedOreRecipe(new ItemStack(Items.reeds, 48), + "U U", + "U U", + "U U", + 'U', ModItems.uuMatter); - if (ConfigTechReborn.UUrecipesVine) - CraftingHelper.addShapedOreRecipe(new ItemStack(Blocks.vine, 24), - "U ", - "U ", - "U ", - 'U', ModItems.uuMatter); + if (ConfigTechReborn.UUrecipesVine) + CraftingHelper.addShapedOreRecipe(new ItemStack(Blocks.vine, 24), + "U ", + "U ", + "U ", + 'U', ModItems.uuMatter); - if (ConfigTechReborn.UUrecipesSnowBall) - CraftingHelper.addShapedOreRecipe(new ItemStack(Items.snowball, 16), - " ", - " ", - "UUU", - 'U', ModItems.uuMatter); + if (ConfigTechReborn.UUrecipesSnowBall) + CraftingHelper.addShapedOreRecipe(new ItemStack(Items.snowball, 16), + " ", + " ", + "UUU", + 'U', ModItems.uuMatter); - CraftingHelper.addShapedOreRecipe(new ItemStack(Items.clay_ball, 48), - "UU ", - "U ", - "UU ", - 'U', ModItems.uuMatter); + CraftingHelper.addShapedOreRecipe(new ItemStack(Items.clay_ball, 48), + "UU ", + "U ", + "UU ", + 'U', ModItems.uuMatter); - if (ConfigTechReborn.UUrecipeslilypad) - CraftingHelper.addShapedOreRecipe(new ItemStack(Blocks.waterlily, 64), - "U U", - " U ", - " U ", - 'U', ModItems.uuMatter); + if (ConfigTechReborn.UUrecipeslilypad) + CraftingHelper.addShapedOreRecipe(new ItemStack(Blocks.waterlily, 64), + "U U", + " U ", + " U ", + 'U', ModItems.uuMatter); - if (ConfigTechReborn.UUrecipesGunpowder) - CraftingHelper.addShapedOreRecipe(new ItemStack(Items.gunpowder, 15), - "UUU", - "U ", - "UUU", - 'U', ModItems.uuMatter); + if (ConfigTechReborn.UUrecipesGunpowder) + CraftingHelper.addShapedOreRecipe(new ItemStack(Items.gunpowder, 15), + "UUU", + "U ", + "UUU", + 'U', ModItems.uuMatter); - if (ConfigTechReborn.UUrecipesBone) - CraftingHelper.addShapedOreRecipe(new ItemStack(Items.bone, 32), - "U ", - "UU ", - "U ", - 'U', ModItems.uuMatter); + if (ConfigTechReborn.UUrecipesBone) + CraftingHelper.addShapedOreRecipe(new ItemStack(Items.bone, 32), + "U ", + "UU ", + "U ", + 'U', ModItems.uuMatter); - if (ConfigTechReborn.UUrecipesFeather) - CraftingHelper.addShapedOreRecipe(new ItemStack(Items.feather, 32), - " U ", - " U ", - "U U", - 'U', ModItems.uuMatter); + if (ConfigTechReborn.UUrecipesFeather) + CraftingHelper.addShapedOreRecipe(new ItemStack(Items.feather, 32), + " U ", + " U ", + "U U", + 'U', ModItems.uuMatter); - if (ConfigTechReborn.UUrecipesInk) - CraftingHelper.addShapedOreRecipe(new ItemStack(Items.dye, 48), - " UU", - " UU", - " U ", - 'U', ModItems.uuMatter); + if (ConfigTechReborn.UUrecipesInk) + CraftingHelper.addShapedOreRecipe(new ItemStack(Items.dye, 48), + " UU", + " UU", + " U ", + 'U', ModItems.uuMatter); - if (ConfigTechReborn.UUrecipesEnderPearl) - CraftingHelper.addShapedOreRecipe(new ItemStack(Items.ender_pearl, 1), - "UUU", - "U U", - " U ", - 'U', ModItems.uuMatter); + if (ConfigTechReborn.UUrecipesEnderPearl) + CraftingHelper.addShapedOreRecipe(new ItemStack(Items.ender_pearl, 1), + "UUU", + "U U", + " U ", + 'U', ModItems.uuMatter); - if (ConfigTechReborn.UUrecipesCoal) - CraftingHelper.addShapedOreRecipe(new ItemStack(Items.coal, 5), - " U", - "U ", - " U", - 'U', ModItems.uuMatter); + if (ConfigTechReborn.UUrecipesCoal) + CraftingHelper.addShapedOreRecipe(new ItemStack(Items.coal, 5), + " U", + "U ", + " U", + 'U', ModItems.uuMatter); - if (ConfigTechReborn.UUrecipesIronOre) - CraftingHelper.addShapedOreRecipe(new ItemStack(Blocks.iron_ore, 2), - "U U", - " U ", - "U U", - 'U', ModItems.uuMatter); + if (ConfigTechReborn.UUrecipesIronOre) + CraftingHelper.addShapedOreRecipe(new ItemStack(Blocks.iron_ore, 2), + "U U", + " U ", + "U U", + 'U', ModItems.uuMatter); - if (ConfigTechReborn.UUrecipesGoldOre) - CraftingHelper.addShapedOreRecipe(new ItemStack(Blocks.gold_ore, 2), - " U ", - "UUU", - " U ", - 'U', ModItems.uuMatter); + if (ConfigTechReborn.UUrecipesGoldOre) + CraftingHelper.addShapedOreRecipe(new ItemStack(Blocks.gold_ore, 2), + " U ", + "UUU", + " U ", + 'U', ModItems.uuMatter); - if (ConfigTechReborn.UUrecipesRedStone) - CraftingHelper.addShapedOreRecipe(new ItemStack(Items.redstone, 24), - " ", - " U ", - "UUU", - 'U', ModItems.uuMatter); + if (ConfigTechReborn.UUrecipesRedStone) + CraftingHelper.addShapedOreRecipe(new ItemStack(Items.redstone, 24), + " ", + " U ", + "UUU", + 'U', ModItems.uuMatter); - if (ConfigTechReborn.UUrecipesLapis) - CraftingHelper.addShapedOreRecipe(new ItemStack(Items.dye, 9, 4), - " U ", - " U ", - " UU", - 'U', ModItems.uuMatter); + if (ConfigTechReborn.UUrecipesLapis) + CraftingHelper.addShapedOreRecipe(new ItemStack(Items.dye, 9, 4), + " U ", + " U ", + " UU", + 'U', ModItems.uuMatter); - if (ConfigTechReborn.UUrecipesEmeraldOre) - CraftingHelper.addShapedOreRecipe(new ItemStack(Blocks.emerald_ore, 1), - "UU ", - "U U", - " UU", - 'U', ModItems.uuMatter); + if (ConfigTechReborn.UUrecipesEmeraldOre) + CraftingHelper.addShapedOreRecipe(new ItemStack(Blocks.emerald_ore, 1), + "UU ", + "U U", + " UU", + 'U', ModItems.uuMatter); - if (ConfigTechReborn.UUrecipesEmerald) - CraftingHelper.addShapedOreRecipe(new ItemStack(Items.emerald, 2), - "UUU", - "UUU", - " U ", - 'U', ModItems.uuMatter); + if (ConfigTechReborn.UUrecipesEmerald) + CraftingHelper.addShapedOreRecipe(new ItemStack(Items.emerald, 2), + "UUU", + "UUU", + " U ", + 'U', ModItems.uuMatter); - if (ConfigTechReborn.UUrecipesDiamond) - CraftingHelper.addShapedOreRecipe(new ItemStack(Items.diamond, 1), - "UUU", - "UUU", - "UUU", - 'U', ModItems.uuMatter); + if (ConfigTechReborn.UUrecipesDiamond) + CraftingHelper.addShapedOreRecipe(new ItemStack(Items.diamond, 1), + "UUU", + "UUU", + "UUU", + 'U', ModItems.uuMatter); - if (ConfigTechReborn.UUrecipesTinDust) - CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.dusts, 10, 77), - " ", - "U U", - " U", - 'U', ModItems.uuMatter); + if (ConfigTechReborn.UUrecipesTinDust) + CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.dusts, 10, 77), + " ", + "U U", + " U", + 'U', ModItems.uuMatter); - if (ConfigTechReborn.UUrecipesCopperDust) - CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.dusts, 10, 21), - " U", - "U U", - " ", - 'U', ModItems.uuMatter); + if (ConfigTechReborn.UUrecipesCopperDust) + CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.dusts, 10, 21), + " U", + "U U", + " ", + 'U', ModItems.uuMatter); - if (ConfigTechReborn.UUrecipesLeadDust) - CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.dusts, 14, 42), - "UUU", - "UUU", - "U ", - 'U', ModItems.uuMatter); + if (ConfigTechReborn.UUrecipesLeadDust) + CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.dusts, 14, 42), + "UUU", + "UUU", + "U ", + 'U', ModItems.uuMatter); - if (ConfigTechReborn.UUrecipesPlatinumDust) - CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.dusts, 1, 58), - " U", - "UUU", - "UUU", - 'U', ModItems.uuMatter); + if (ConfigTechReborn.UUrecipesPlatinumDust) + CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.dusts, 1, 58), + " U", + "UUU", + "UUU", + 'U', ModItems.uuMatter); - if (ConfigTechReborn.UUrecipesTungstenDust) - CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.dusts, 1, 79), - "U ", - "UUU", - "UUU", - 'U', ModItems.uuMatter); + if (ConfigTechReborn.UUrecipesTungstenDust) + CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.dusts, 1, 79), + "U ", + "UUU", + "UUU", + 'U', ModItems.uuMatter); - if (ConfigTechReborn.UUrecipesTitaniumDust) - CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.dusts, 2, 78), - "UUU", - " U ", - " U ", - 'U', ModItems.uuMatter); + if (ConfigTechReborn.UUrecipesTitaniumDust) + CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.dusts, 2, 78), + "UUU", + " U ", + " U ", + 'U', ModItems.uuMatter); - if (ConfigTechReborn.UUrecipesAluminumDust) - CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.dusts, 16, 2), - " U ", - " U ", - "UUU", - 'U', ModItems.uuMatter); + if (ConfigTechReborn.UUrecipesAluminumDust) + CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.dusts, 16, 2), + " U ", + " U ", + "UUU", + 'U', ModItems.uuMatter); - if (ConfigTechReborn.HideUuRecipes) - hideUUrecipes(); + if (ConfigTechReborn.HideUuRecipes) + hideUUrecipes(); - } + } - static void hideUUrecipes() { - //TODO - } + static void hideUUrecipes() { + //TODO + } - static void addIndustrialCentrifugeRecipes() { + static void addIndustrialCentrifugeRecipes() { - //Mycelium Byproducts - RecipeHandler.addRecipe(new CentrifugeRecipe(new ItemStack(Blocks.mycelium, 8), null, new ItemStack(Blocks.brown_mushroom, 2), new ItemStack(Blocks.red_mushroom, 2), new ItemStack(Items.clay_ball, 1), new ItemStack(Blocks.sand, 4), 1640, 5)); + //Mycelium Byproducts + RecipeHandler.addRecipe(new CentrifugeRecipe(new ItemStack(Blocks.mycelium, 8), null, new ItemStack(Blocks.brown_mushroom, 2), new ItemStack(Blocks.red_mushroom, 2), new ItemStack(Items.clay_ball, 1), new ItemStack(Blocks.sand, 4), 1640, 5)); - //Blaze Powder Byproducts - RecipeHandler.addRecipe(new CentrifugeRecipe(new ItemStack(Items.blaze_powder), null, ItemDusts.getDustByName("darkAshes", 1), ItemDusts.getDustByName("sulfur", 1), null, null, 1240, 5)); + //Blaze Powder Byproducts + RecipeHandler.addRecipe(new CentrifugeRecipe(new ItemStack(Items.blaze_powder), null, ItemDusts.getDustByName("darkAshes", 1), ItemDusts.getDustByName("sulfur", 1), null, null, 1240, 5)); - //Magma Cream Products - RecipeHandler.addRecipe(new CentrifugeRecipe(new ItemStack(Items.magma_cream, 1), null, new ItemStack(Items.blaze_powder, 1), new ItemStack(Items.slime_ball, 1), null, null, 2500, 5)); + //Magma Cream Products + RecipeHandler.addRecipe(new CentrifugeRecipe(new ItemStack(Items.magma_cream, 1), null, new ItemStack(Items.blaze_powder, 1), new ItemStack(Items.slime_ball, 1), null, null, 2500, 5)); - //Dust Byproducts + //Dust Byproducts // RecipeHandler.addRecipe(new CentrifugeRecipe(ItemDusts.getDustByName("platinum", 1), null, ItemDustsTiny.getTinyDustByName("Iridium", 1), ItemDustsSmall.getSmallDustByName("Nickel", 1), null, null, 3000, 5)); - RecipeHandler.addRecipe(new CentrifugeRecipe(ItemDusts.getDustByName("electrum", 2), null, ItemDusts.getDustByName("silver", 1), ItemDusts.getDustByName("gold", 1), null, null, 2400, 5)); - RecipeHandler.addRecipe(new CentrifugeRecipe(ItemDusts.getDustByName("invar", 3), null, ItemDusts.getDustByName("iron", 2), ItemDusts.getDustByName("nickel", 1), null, null, 1340, 5)); - RecipeHandler.addRecipe(new CentrifugeRecipe(ItemDusts.getDustByName("marble", 8), null, ItemDusts.getDustByName("magnesium", 1), ItemDusts.getDustByName("calcite", 7), null, null, 1280, 5)); - RecipeHandler.addRecipe(new CentrifugeRecipe(ItemDusts.getDustByName("redrock", 4), null, ItemDusts.getDustByName("calcite", 2), ItemDusts.getDustByName("flint", 1), ItemDusts.getDustByName("clay", 1), null, 640, 5)); - RecipeHandler.addRecipe(new CentrifugeRecipe(ItemDusts.getDustByName("basalt", 16), null, ItemDusts.getDustByName("peridot", 1), ItemDusts.getDustByName("calcite", 3), ItemDusts.getDustByName("magnesium", 8), ItemDusts.getDustByName("darkAshes", 4), 2680, 5)); - RecipeHandler.addRecipe(new CentrifugeRecipe(ItemDusts.getDustByName("yellowGarnet", 16), null, ItemDusts.getDustByName("andradite", 5), ItemDusts.getDustByName("grossular", 8), ItemDusts.getDustByName("uvarovite", 3), null, 2940, 5)); - RecipeHandler.addRecipe(new CentrifugeRecipe(ItemDusts.getDustByName("redGarnet", 16), null, ItemDusts.getDustByName("pyrope", 3), ItemDusts.getDustByName("almandine", 5), ItemDusts.getDustByName("spessartine", 8), null, 2940, 5)); - RecipeHandler.addRecipe(new CentrifugeRecipe(ItemDusts.getDustByName("darkAshes", 2), null, ItemDusts.getDustByName("ashes", 2), null, null, null, 240, 5)); - RecipeHandler.addRecipe(new CentrifugeRecipe(ItemDusts.getDustByName("manyullyn", 2), null, ItemDusts.getDustByName("cobalt", 1), ItemDusts.getDustByName("ardite", 1), null, null, 1240, 5)); - RecipeHandler.addRecipe(new CentrifugeRecipe(ItemDusts.getDustByName("nichrome", 5), null, ItemDusts.getDustByName("nickel", 4), ItemDusts.getDustByName("chrome", 1), null, null, 2240, 5)); - RecipeHandler.addRecipe(new CentrifugeRecipe(ItemDusts.getDustByName("cupronickel", 2), null, ItemDusts.getDustByName("copper", 1), ItemDusts.getDustByName("nickel", 1), null, null, 960, 5)); - RecipeHandler.addRecipe(new CentrifugeRecipe(ItemDusts.getDustByName("kanthal", 3), null, ItemDusts.getDustByName("iron", 1), ItemDusts.getDustByName("aluminum", 1), ItemDusts.getDustByName("chrome", 1), null, 1040, 5)); - RecipeHandler.addRecipe(new CentrifugeRecipe(ItemDusts.getDustByName("brass", 4), null, ItemDusts.getDustByName("zinc", 1), ItemDusts.getDustByName("copper", 3), null, null, 2000, 5)); - RecipeHandler.addRecipe(new CentrifugeRecipe(ItemDusts.getDustByName("aluminumBrass", 4), null, ItemDusts.getDustByName("aluminum", 1), ItemDusts.getDustByName("copper", 3), null, null, 2000, 5)); - RecipeHandler.addRecipe(new CentrifugeRecipe(ItemDusts.getDustByName("bronze", 4), null, ItemDusts.getDustByName("tin", 1), ItemDusts.getDustByName("copper", 3), null, null, 2420, 5)); - RecipeHandler.addRecipe(new CentrifugeRecipe(ItemDusts.getDustByName("netherrack", 16), null, new ItemStack(Items.redstone, 1), ItemDusts.getDustByName("sulfur", 4), ItemDusts.getDustByName("basalt", 1), new ItemStack(Items.gold_nugget, 1), 2400, 5)); - RecipeHandler.addRecipe(new CentrifugeRecipe(ItemDusts.getDustByName("enderEye", 1), null, ItemDusts.getDustByName("enderPearl", 1), new ItemStack(Items.blaze_powder, 1), null, null, 1280, 5)); - RecipeHandler.addRecipe(new CentrifugeRecipe(ItemDusts.getDustByName("tetrahedrite", 8), null, ItemDusts.getDustByName("copper", 3), ItemDusts.getDustByName("antimony", 1), ItemDusts.getDustByName("sulfur", 3), ItemDusts.getDustByName("iron", 1), 3640, 5)); - RecipeHandler.addRecipe(new CentrifugeRecipe(ItemDusts.getDustByName("lapis", 16), null, ItemDusts.getDustByName("lazurite", 12), ItemDusts.getDustByName("sodalite", 2), ItemDusts.getDustByName("pyrite", 7), ItemDusts.getDustByName("calcite", 1), 3580, 5)); + RecipeHandler.addRecipe(new CentrifugeRecipe(ItemDusts.getDustByName("electrum", 2), null, ItemDusts.getDustByName("silver", 1), ItemDusts.getDustByName("gold", 1), null, null, 2400, 5)); + RecipeHandler.addRecipe(new CentrifugeRecipe(ItemDusts.getDustByName("invar", 3), null, ItemDusts.getDustByName("iron", 2), ItemDusts.getDustByName("nickel", 1), null, null, 1340, 5)); + RecipeHandler.addRecipe(new CentrifugeRecipe(ItemDusts.getDustByName("marble", 8), null, ItemDusts.getDustByName("magnesium", 1), ItemDusts.getDustByName("calcite", 7), null, null, 1280, 5)); + RecipeHandler.addRecipe(new CentrifugeRecipe(ItemDusts.getDustByName("redrock", 4), null, ItemDusts.getDustByName("calcite", 2), ItemDusts.getDustByName("flint", 1), ItemDusts.getDustByName("clay", 1), null, 640, 5)); + RecipeHandler.addRecipe(new CentrifugeRecipe(ItemDusts.getDustByName("basalt", 16), null, ItemDusts.getDustByName("peridot", 1), ItemDusts.getDustByName("calcite", 3), ItemDusts.getDustByName("magnesium", 8), ItemDusts.getDustByName("darkAshes", 4), 2680, 5)); + RecipeHandler.addRecipe(new CentrifugeRecipe(ItemDusts.getDustByName("yellowGarnet", 16), null, ItemDusts.getDustByName("andradite", 5), ItemDusts.getDustByName("grossular", 8), ItemDusts.getDustByName("uvarovite", 3), null, 2940, 5)); + RecipeHandler.addRecipe(new CentrifugeRecipe(ItemDusts.getDustByName("redGarnet", 16), null, ItemDusts.getDustByName("pyrope", 3), ItemDusts.getDustByName("almandine", 5), ItemDusts.getDustByName("spessartine", 8), null, 2940, 5)); + RecipeHandler.addRecipe(new CentrifugeRecipe(ItemDusts.getDustByName("darkAshes", 2), null, ItemDusts.getDustByName("ashes", 2), null, null, null, 240, 5)); + RecipeHandler.addRecipe(new CentrifugeRecipe(ItemDusts.getDustByName("manyullyn", 2), null, ItemDusts.getDustByName("cobalt", 1), ItemDusts.getDustByName("ardite", 1), null, null, 1240, 5)); + RecipeHandler.addRecipe(new CentrifugeRecipe(ItemDusts.getDustByName("nichrome", 5), null, ItemDusts.getDustByName("nickel", 4), ItemDusts.getDustByName("chrome", 1), null, null, 2240, 5)); + RecipeHandler.addRecipe(new CentrifugeRecipe(ItemDusts.getDustByName("cupronickel", 2), null, ItemDusts.getDustByName("copper", 1), ItemDusts.getDustByName("nickel", 1), null, null, 960, 5)); + RecipeHandler.addRecipe(new CentrifugeRecipe(ItemDusts.getDustByName("kanthal", 3), null, ItemDusts.getDustByName("iron", 1), ItemDusts.getDustByName("aluminum", 1), ItemDusts.getDustByName("chrome", 1), null, 1040, 5)); + RecipeHandler.addRecipe(new CentrifugeRecipe(ItemDusts.getDustByName("brass", 4), null, ItemDusts.getDustByName("zinc", 1), ItemDusts.getDustByName("copper", 3), null, null, 2000, 5)); + RecipeHandler.addRecipe(new CentrifugeRecipe(ItemDusts.getDustByName("aluminumBrass", 4), null, ItemDusts.getDustByName("aluminum", 1), ItemDusts.getDustByName("copper", 3), null, null, 2000, 5)); + RecipeHandler.addRecipe(new CentrifugeRecipe(ItemDusts.getDustByName("bronze", 4), null, ItemDusts.getDustByName("tin", 1), ItemDusts.getDustByName("copper", 3), null, null, 2420, 5)); + RecipeHandler.addRecipe(new CentrifugeRecipe(ItemDusts.getDustByName("netherrack", 16), null, new ItemStack(Items.redstone, 1), ItemDusts.getDustByName("sulfur", 4), ItemDusts.getDustByName("basalt", 1), new ItemStack(Items.gold_nugget, 1), 2400, 5)); + RecipeHandler.addRecipe(new CentrifugeRecipe(ItemDusts.getDustByName("enderEye", 1), null, ItemDusts.getDustByName("enderPearl", 1), new ItemStack(Items.blaze_powder, 1), null, null, 1280, 5)); + RecipeHandler.addRecipe(new CentrifugeRecipe(ItemDusts.getDustByName("tetrahedrite", 8), null, ItemDusts.getDustByName("copper", 3), ItemDusts.getDustByName("antimony", 1), ItemDusts.getDustByName("sulfur", 3), ItemDusts.getDustByName("iron", 1), 3640, 5)); + RecipeHandler.addRecipe(new CentrifugeRecipe(ItemDusts.getDustByName("lapis", 16), null, ItemDusts.getDustByName("lazurite", 12), ItemDusts.getDustByName("sodalite", 2), ItemDusts.getDustByName("pyrite", 7), ItemDusts.getDustByName("calcite", 1), 3580, 5)); - RecipeHandler.addRecipe(new CentrifugeRecipe(new ItemStack(Items.glowstone_dust, 16), RecipeUtils.getEmptyCell(1), ItemCells.getCellByName("helium", 1, false), ItemDusts.getDustByName("gold", 8), new ItemStack(Items.redstone), null, 25000, 20)); + RecipeHandler.addRecipe(new CentrifugeRecipe(new ItemStack(Items.glowstone_dust, 16), RecipeUtils.getEmptyCell(1), ItemCells.getCellByName("helium", 1, false), ItemDusts.getDustByName("gold", 8), new ItemStack(Items.redstone), null, 25000, 20)); // RecipeHandler.addRecipe(new CentrifugeRecipe(ItemDusts.getDustByName("endstone", 16), RecipeUtils.getEmptyCell(2), ItemCells.getCellByName("helium3", 1, false), ItemCells.getCellByName("helium", 1, false), ItemDustsTiny.getTinyDustByName("Tungsten"), new ItemStack(Blocks.sand, 12), 4800, 5)); - } - - static void addIndustrialGrinderRecipes() { - //Coal Ore - RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(Blocks.coal_ore, 1), null, new FluidStack(FluidRegistry.WATER, 1000), new ItemStack(Items.coal, 1), ItemDustsSmall.getSmallDustByName("Coal", 6), ItemDustsSmall.getSmallDustByName("Coal", 2), null, 100, 120)); - RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(Blocks.coal_ore, 1), new ItemStack(Items.water_bucket), null, new ItemStack(Items.coal, 1), ItemDustsSmall.getSmallDustByName("Coal", 6), ItemDustsSmall.getSmallDustByName("Coal", 2), new ItemStack(Items.bucket), 100, 120)); - - //Iron Ore - RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(Blocks.iron_ore, 1), null, new FluidStack(FluidRegistry.WATER, 1000), ItemDusts.getDustByName("iron", 2), ItemDustsSmall.getSmallDustByName("Nickel", 1), ItemDustsSmall.getSmallDustByName("Tin", 1), null, 100, 120)); - RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(Blocks.iron_ore, 1), new ItemStack(Items.water_bucket), null, ItemDusts.getDustByName("iron", 2), ItemDustsSmall.getSmallDustByName("Nickel", 1), ItemDustsSmall.getSmallDustByName("Tin", 1), new ItemStack(Items.bucket), 100, 120)); - - RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(Blocks.iron_ore, 1), null, new FluidStack(ModFluids.fluidSodiumpersulfate, 1000), ItemDusts.getDustByName("iron", 2), ItemDusts.getDustByName("nickel", 1), ItemDustsSmall.getSmallDustByName("Tin", 1), null, 100, 120)); - RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(Blocks.iron_ore, 1), new ItemStack(ModItems.bucketSodiumpersulfate), null, ItemDusts.getDustByName("iron", 2), ItemDusts.getDustByName("nickel", 1), ItemDustsSmall.getSmallDustByName("Tin", 1), new ItemStack(Items.bucket), 100, 120)); - - //Gold Ore - RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(Blocks.gold_ore, 1), null, new FluidStack(FluidRegistry.WATER, 1000), ItemDusts.getDustByName("gold", 2), ItemDustsSmall.getSmallDustByName("Copper", 1), ItemDustsSmall.getSmallDustByName("Nickel", 1), null, 100, 120)); - RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(Blocks.gold_ore, 1), new ItemStack(Items.water_bucket), null, ItemDusts.getDustByName("gold", 2), ItemDustsSmall.getSmallDustByName("Copper", 1), ItemDustsSmall.getSmallDustByName("Nickel", 1), new ItemStack(Items.bucket), 100, 120)); - - RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(Blocks.gold_ore, 1), null, new FluidStack(ModFluids.fluidSodiumpersulfate, 1000), ItemDusts.getDustByName("gold", 2), ItemDusts.getDustByName("copper", 1), ItemDustsSmall.getSmallDustByName("Nickel", 1), null, 100, 120)); - RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(Blocks.gold_ore, 1), new ItemStack(ModItems.bucketSodiumpersulfate), null, ItemDusts.getDustByName("gold", 2), ItemDusts.getDustByName("copper", 1), ItemDustsSmall.getSmallDustByName("Nickel", 1), new ItemStack(Items.bucket), 100, 120)); - - RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(Blocks.gold_ore, 1), null, new FluidStack(ModFluids.fluidMercury, 1000), ItemDusts.getDustByName("gold", 3), ItemDustsSmall.getSmallDustByName("Copper", 1), ItemDustsSmall.getSmallDustByName("Nickel", 1), null, 100, 120)); - RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(Blocks.gold_ore, 1), new ItemStack(ModItems.bucketMercury), null, ItemDusts.getDustByName("gold", 3), ItemDustsSmall.getSmallDustByName("Copper", 1), ItemDustsSmall.getSmallDustByName("Nickel", 1), new ItemStack(Items.bucket), 100, 120)); - - //Diamond Ore - RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(Blocks.diamond_ore, 1), null, new FluidStack(FluidRegistry.WATER, 1000), new ItemStack(Items.diamond, 1), ItemDustsSmall.getSmallDustByName("Diamond", 6), ItemDustsSmall.getSmallDustByName("Coal", 2), null, 100, 120)); - RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(Blocks.diamond_ore, 1), new ItemStack(Items.water_bucket), null, new ItemStack(Items.diamond, 1), ItemDustsSmall.getSmallDustByName("Diamond", 6), ItemDustsSmall.getSmallDustByName("Coal", 2), new ItemStack(Items.bucket), 100, 120)); - - //Emerald Ore - RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(Blocks.emerald_ore, 1), null, new FluidStack(FluidRegistry.WATER, 1000), new ItemStack(Items.emerald, 1), ItemDustsSmall.getSmallDustByName("Emerald", 6), ItemDustsSmall.getSmallDustByName("Aluminum", 2), null, 100, 120)); - RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(Blocks.emerald_ore, 1), new ItemStack(Items.water_bucket), null, new ItemStack(Items.emerald, 1), ItemDustsSmall.getSmallDustByName("Emerald", 6), ItemDustsSmall.getSmallDustByName("Aluminum", 2), new ItemStack(Items.bucket), 100, 120)); - - //Redstone - RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(Blocks.redstone_ore, 1), null, new FluidStack(FluidRegistry.WATER, 1000), new ItemStack(Items.redstone, 10), ItemDustsSmall.getSmallDustByName("Cinnabar", 1), ItemDustsSmall.getSmallDustByName("Glowstone", 1), null, 100, 120)); - RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(Blocks.redstone_ore, 1), new ItemStack(Items.water_bucket), null, new ItemStack(Items.redstone, 10), ItemDustsSmall.getSmallDustByName("Cinnabar", 1), ItemDustsSmall.getSmallDustByName("Glowstone", 1), new ItemStack(Items.bucket), 100, 120)); - - //Lapis Lazuli Ore - RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(Blocks.lapis_ore, 1), null, new FluidStack(FluidRegistry.WATER, 1000), new ItemStack(Items.dye, 6, 4), ItemDustsSmall.getSmallDustByName("Lapis", 36), ItemDustsSmall.getSmallDustByName("Lazurite", 8), null, 100, 120)); - RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(Blocks.lapis_ore, 1), new ItemStack(Items.water_bucket), null, new ItemStack(Items.dye, 6, 4), ItemDustsSmall.getSmallDustByName("Lapis", 36), ItemDustsSmall.getSmallDustByName("Lazurite", 8), new ItemStack(Items.bucket), 100, 120)); - - //Copper Ore - if (OreUtil.doesOreExistAndValid("oreCopper")) { - try { - ItemStack oreStack = OreDictionary.getOres("oreCopper").get(0); - RecipeHandler.addRecipe(new GrinderRecipe(oreStack, null, new FluidStack(FluidRegistry.WATER, 1000), ItemDusts.getDustByName("copper", 2), ItemDustsSmall.getSmallDustByName("Gold", 1), ItemDustsSmall.getSmallDustByName("Nickel", 1), null, 100, 120)); - RecipeHandler.addRecipe(new GrinderRecipe(oreStack, new ItemStack(Items.water_bucket), null, ItemDusts.getDustByName("copper", 2), ItemDustsSmall.getSmallDustByName("Gold", 1), ItemDustsSmall.getSmallDustByName("Nickel", 1), new ItemStack(Items.bucket), 100, 120)); - - RecipeHandler.addRecipe(new GrinderRecipe(oreStack, null, new FluidStack(ModFluids.fluidSodiumpersulfate, 1000), ItemDusts.getDustByName("copper", 2), ItemDusts.getDustByName("gold", 1), ItemDustsSmall.getSmallDustByName("Nickel", 1), null, 100, 120)); - RecipeHandler.addRecipe(new GrinderRecipe(oreStack, new ItemStack(ModItems.bucketSodiumpersulfate), null, ItemDusts.getDustByName("copper", 2), ItemDusts.getDustByName("gold", 1), ItemDustsSmall.getSmallDustByName("Nickel", 1), new ItemStack(Items.bucket), 100, 120)); - - RecipeHandler.addRecipe(new GrinderRecipe(oreStack, null, new FluidStack(ModFluids.fluidMercury, 1000), ItemDusts.getDustByName("copper", 2), ItemDustsSmall.getSmallDustByName("Gold", 1), ItemDusts.getDustByName("nickel", 1), null, 100, 120)); - RecipeHandler.addRecipe(new GrinderRecipe(oreStack, ItemCells.getCellByName("mercury", 1), null, ItemDusts.getDustByName("copper", 2), ItemDustsSmall.getSmallDustByName("Gold", 1), ItemDusts.getDustByName("nickel", 1), new ItemStack(Items.bucket), 100, 120)); - } catch (Exception e) { - LogHelper.info("Failed to Load Grinder Recipe for Copper Ore"); - } - } - - //Tin Ore - if (OreUtil.doesOreExistAndValid("oreTin")) { - try { - ItemStack oreStack = OreDictionary.getOres("oreTin").get(0); - RecipeHandler.addRecipe(new GrinderRecipe(oreStack, null, new FluidStack(FluidRegistry.WATER, 1000), ItemDusts.getDustByName("tin", 2), ItemDustsSmall.getSmallDustByName("Iron", 1), ItemDustsSmall.getSmallDustByName("Zinc", 1), null, 100, 120)); - RecipeHandler.addRecipe(new GrinderRecipe(oreStack, new ItemStack(Items.water_bucket), null, ItemDusts.getDustByName("tin", 2), ItemDustsSmall.getSmallDustByName("Iron", 1), ItemDustsSmall.getSmallDustByName("Zinc", 1), new ItemStack(Items.bucket), 100, 120)); - - RecipeHandler.addRecipe(new GrinderRecipe(oreStack, null, new FluidStack(ModFluids.fluidSodiumpersulfate, 1000), ItemDusts.getDustByName("tin", 2), ItemDustsSmall.getSmallDustByName("Iron", 1), ItemDusts.getDustByName("zinc", 1), null, 100, 120)); - RecipeHandler.addRecipe(new GrinderRecipe(oreStack, new ItemStack(ModItems.bucketSodiumpersulfate), null, ItemDusts.getDustByName("tin", 2), ItemDustsSmall.getSmallDustByName("Iron", 1), ItemDusts.getDustByName("zinc", 1), new ItemStack(Items.bucket), 100, 120)); - } catch (Exception e) { - LogHelper.info("Failed to Load Grinder Recipe for Tin Ore"); - } - } - - //Nickel Ore - if (OreUtil.doesOreExistAndValid("oreNickel")) { - try { - ItemStack oreStack = OreDictionary.getOres("oreNickel").get(0); - RecipeHandler.addRecipe(new GrinderRecipe(oreStack, null, new FluidStack(FluidRegistry.WATER, 1000), ItemDusts.getDustByName("nickel", 2), ItemDustsSmall.getSmallDustByName("Iron", 1), ItemDustsSmall.getSmallDustByName("Platinum", 1), null, 100, 120)); - RecipeHandler.addRecipe(new GrinderRecipe(oreStack, new ItemStack(Items.water_bucket), null, ItemDusts.getDustByName("nickel", 2), ItemDustsSmall.getSmallDustByName("Iron", 1), ItemDustsSmall.getSmallDustByName("Platinum", 1), new ItemStack(Items.bucket), 100, 120)); - - RecipeHandler.addRecipe(new GrinderRecipe(oreStack, null, new FluidStack(ModFluids.fluidSodiumpersulfate, 1000), ItemDusts.getDustByName("nickel", 3), ItemDustsSmall.getSmallDustByName("Iron", 1), ItemDustsSmall.getSmallDustByName("Platinum", 1), null, 100, 120)); - RecipeHandler.addRecipe(new GrinderRecipe(oreStack, new ItemStack(ModItems.bucketSodiumpersulfate), null, ItemDusts.getDustByName("nickel", 3), ItemDustsSmall.getSmallDustByName("Iron", 1), ItemDustsSmall.getSmallDustByName("Platinum", 1), new ItemStack(Items.bucket), 100, 120)); - - RecipeHandler.addRecipe(new GrinderRecipe(oreStack, null, new FluidStack(ModFluids.fluidMercury, 1000), ItemDusts.getDustByName("nickel", 2), ItemDustsSmall.getSmallDustByName("Iron", 1), ItemDusts.getDustByName("platinum", 1), null, 100, 120)); - RecipeHandler.addRecipe(new GrinderRecipe(oreStack, new ItemStack(ModItems.bucketMercury), null, ItemDusts.getDustByName("nickel", 2), ItemDustsSmall.getSmallDustByName("Iron", 1), ItemDusts.getDustByName("platinum", 1), new ItemStack(Items.bucket), 100, 120)); - } catch (Exception e) { - LogHelper.info("Failed to Load Grinder Recipe for Nickel Ore"); - } - } - - //Zinc Ore - if (OreUtil.doesOreExistAndValid("oreZinc")) { - try { - ItemStack oreStack = OreDictionary.getOres("oreZinc").get(0); - RecipeHandler.addRecipe(new GrinderRecipe(oreStack, null, new FluidStack(FluidRegistry.WATER, 1000), ItemDusts.getDustByName("zinc", 2), ItemDustsSmall.getSmallDustByName("Iron", 1), ItemDustsSmall.getSmallDustByName("Tin", 1), null, 100, 120)); - RecipeHandler.addRecipe(new GrinderRecipe(oreStack, new ItemStack(Items.water_bucket), null, ItemDusts.getDustByName("zinc", 2), ItemDustsSmall.getSmallDustByName("Iron", 1), ItemDustsSmall.getSmallDustByName("Tin", 1), new ItemStack(Items.bucket), 100, 120)); - - RecipeHandler.addRecipe(new GrinderRecipe(oreStack, null, new FluidStack(ModFluids.fluidSodiumpersulfate, 1000), ItemDusts.getDustByName("zinc", 2), ItemDustsSmall.getSmallDustByName("Iron", 1), ItemDusts.getDustByName("iron", 1), null, 100, 120)); - RecipeHandler.addRecipe(new GrinderRecipe(oreStack, new ItemStack(ModItems.bucketSodiumpersulfate), null, ItemDusts.getDustByName("zinc", 2), ItemDustsSmall.getSmallDustByName("Iron", 1), ItemDusts.getDustByName("iron", 1), new ItemStack(Items.bucket), 100, 120)); - } catch (Exception e) { - LogHelper.info("Failed to Load Grinder Recipe for Zinc Ore"); - } - } - - //Silver Ore - if (OreUtil.doesOreExistAndValid("oreSilver")) { - try { - ItemStack oreStack = OreDictionary.getOres("oreSilver").get(0); - RecipeHandler.addRecipe(new GrinderRecipe(oreStack, null, new FluidStack(FluidRegistry.WATER, 1000), ItemDusts.getDustByName("silver", 2), ItemDustsSmall.getSmallDustByName("Lead", 1), ItemDustsSmall.getSmallDustByName("Sulfur", 1), null, 100, 120)); - RecipeHandler.addRecipe(new GrinderRecipe(oreStack, new ItemStack(Items.water_bucket), null, ItemDusts.getDustByName("silver", 2), ItemDustsSmall.getSmallDustByName("Lead", 1), ItemDustsSmall.getSmallDustByName("Sulfur", 1), new ItemStack(Items.bucket), 100, 120)); - - RecipeHandler.addRecipe(new GrinderRecipe(oreStack, null, new FluidStack(ModFluids.fluidMercury, 1000), ItemDusts.getDustByName("silver", 3), ItemDustsSmall.getSmallDustByName("Lead", 1), ItemDustsSmall.getSmallDustByName("Sulfur", 1), null, 100, 120)); - RecipeHandler.addRecipe(new GrinderRecipe(oreStack, new ItemStack(ModItems.bucketMercury), null, ItemDusts.getDustByName("silver", 3), ItemDustsSmall.getSmallDustByName("Lead", 1), ItemDustsSmall.getSmallDustByName("Sulfur", 1), new ItemStack(Items.bucket), 100, 120)); - } catch (Exception e) { - LogHelper.info("Failed to Load Grinder Recipe for Silver Ore"); - } - } - - //Lead Ore - if (OreUtil.doesOreExistAndValid("oreLead")) { - try { - ItemStack oreStack = OreDictionary.getOres("oreLead").get(0); - RecipeHandler.addRecipe(new GrinderRecipe(oreStack, null, new FluidStack(FluidRegistry.WATER, 1000), ItemDusts.getDustByName("lead", 2), ItemDustsSmall.getSmallDustByName("Silver", 1), ItemDustsSmall.getSmallDustByName("Sulfur", 1), null, 100, 120)); - RecipeHandler.addRecipe(new GrinderRecipe(oreStack, new ItemStack(Items.water_bucket), null, ItemDusts.getDustByName("lead", 2), ItemDustsSmall.getSmallDustByName("Silver", 1), ItemDustsSmall.getSmallDustByName("Sulfur", 1), new ItemStack(Items.bucket), 100, 120)); - - RecipeHandler.addRecipe(new GrinderRecipe(oreStack, null, new FluidStack(ModFluids.fluidMercury, 1000), ItemDusts.getDustByName("lead", 2), ItemDusts.getDustByName("silver", 1), ItemDustsSmall.getSmallDustByName("Sulfur", 1), null, 100, 120)); - RecipeHandler.addRecipe(new GrinderRecipe(oreStack, new ItemStack(ModItems.bucketMercury), null, ItemDusts.getDustByName("lead", 2), ItemDusts.getDustByName("silver", 1), ItemDustsSmall.getSmallDustByName("Sulfur", 1), new ItemStack(Items.bucket), 100, 120)); - } catch (Exception e) { - LogHelper.info("Failed to Load Grinder Recipe for Lead Ore"); - } - } - - - //Aluminum Ore - if (OreUtil.doesOreExistAndValid("oreAluminum")) { - try { - ItemStack oreStack = OreDictionary.getOres("oreAluminum").get(0); - RecipeHandler.addRecipe(new GrinderRecipe(oreStack, null, new FluidStack(FluidRegistry.WATER, 1000), ItemDusts.getDustByName("aluminum", 2), ItemDustsSmall.getSmallDustByName("Bauxite", 1), ItemDustsSmall.getSmallDustByName("Bauxite", 1), null, 100, 120)); - RecipeHandler.addRecipe(new GrinderRecipe(oreStack, new ItemStack(Items.water_bucket), null, ItemDusts.getDustByName("aluminum", 2), ItemDustsSmall.getSmallDustByName("Bauxite", 1), ItemDustsSmall.getSmallDustByName("Bauxite", 1), new ItemStack(Items.bucket), 100, 120)); - } catch (Exception e) { - LogHelper.info("Failed to Load Grinder Recipe for Lead Ore"); - } - } - - //Ardite Ore - if (OreUtil.doesOreExistAndValid("oreArdite")) { - try { - ItemStack oreStack = OreDictionary.getOres("oreArdite").get(0); - RecipeHandler.addRecipe(new GrinderRecipe(oreStack, null, new FluidStack(FluidRegistry.WATER, 1000), ItemDusts.getDustByName("ardite", 2), ItemDustsSmall.getSmallDustByName("Ardite", 1), ItemDustsSmall.getSmallDustByName("Ardite", 1), null, 100, 120)); - RecipeHandler.addRecipe(new GrinderRecipe(oreStack, new ItemStack(Items.water_bucket), null, ItemDusts.getDustByName("ardite", 2), ItemDustsSmall.getSmallDustByName("Ardite", 1), ItemDustsSmall.getSmallDustByName("Ardite", 1), new ItemStack(Items.bucket), 100, 120)); - } catch (Exception e) { - LogHelper.info("Failed to Load Grinder Recipe for Ardite Ore"); - } - } - - //Cobalt Ore - if (OreUtil.doesOreExistAndValid("oreCobalt")) { - try { - ItemStack oreStack = OreDictionary.getOres("oreCobalt").get(0); - RecipeHandler.addRecipe(new GrinderRecipe(oreStack, null, new FluidStack(FluidRegistry.WATER, 1000), ItemDusts.getDustByName("cobalt", 2), ItemDustsSmall.getSmallDustByName("Cobalt", 1), ItemDustsSmall.getSmallDustByName("Cobalt", 1), null, 100, 120)); - RecipeHandler.addRecipe(new GrinderRecipe(oreStack, new ItemStack(Items.water_bucket), null, ItemDusts.getDustByName("cobalt", 2), ItemDustsSmall.getSmallDustByName("Cobalt", 1), ItemDustsSmall.getSmallDustByName("Cobalt", 1), new ItemStack(Items.bucket), 100, 120)); - } catch (Exception e) { - LogHelper.info("Failed to Load Grinder Recipe for Cobalt Ore"); - } - } - - //Dark Iron Ore - if (OreUtil.doesOreExistAndValid("oreDarkIron")) { - try { - ItemStack oreStack = OreDictionary.getOres("oreDarkIron").get(0); - RecipeHandler.addRecipe(new GrinderRecipe(oreStack, null, new FluidStack(FluidRegistry.WATER, 1000), ItemDusts.getDustByName("darkIron", 2), ItemDustsSmall.getSmallDustByName("DarkIron", 1), ItemDustsSmall.getSmallDustByName("Iron", 1), null, 100, 120)); - RecipeHandler.addRecipe(new GrinderRecipe(oreStack, new ItemStack(Items.water_bucket), null, ItemDusts.getDustByName("darkIron", 2), ItemDustsSmall.getSmallDustByName("DarkIron", 1), ItemDustsSmall.getSmallDustByName("Iron", 1), new ItemStack(Items.bucket), 100, 120)); - } catch (Exception e) { - LogHelper.info("Failed to Load Grinder Recipe for Dark Iron Ore"); - } - } - - //Cadmium Ore - if (OreUtil.doesOreExistAndValid("oreCadmium")) { - try { - ItemStack oreStack = OreDictionary.getOres("oreCadmium").get(0); - RecipeHandler.addRecipe(new GrinderRecipe(oreStack, null, new FluidStack(FluidRegistry.WATER, 1000), ItemDusts.getDustByName("cadmium", 2), ItemDustsSmall.getSmallDustByName("Cadmium", 1), ItemDustsSmall.getSmallDustByName("Cadmium", 1), null, 100, 120)); - RecipeHandler.addRecipe(new GrinderRecipe(oreStack, new ItemStack(Items.water_bucket), null, ItemDusts.getDustByName("cadmium", 2), ItemDustsSmall.getSmallDustByName("Cadmium", 1), ItemDustsSmall.getSmallDustByName("Cadmium", 1), new ItemStack(Items.bucket), 100, 120)); - } catch (Exception e) { - LogHelper.info("Failed to Load Grinder Recipe for Cadmium Ore"); - } - } - - //Indium Ore - if (OreUtil.doesOreExistAndValid("oreIndium")) { - try { - ItemStack oreStack = OreDictionary.getOres("oreIndium").get(0); - RecipeHandler.addRecipe(new GrinderRecipe(oreStack, null, new FluidStack(FluidRegistry.WATER, 1000), ItemDusts.getDustByName("indium", 2), ItemDustsSmall.getSmallDustByName("Indium", 1), ItemDustsSmall.getSmallDustByName("Indium", 1), null, 100, 120)); - RecipeHandler.addRecipe(new GrinderRecipe(oreStack, new ItemStack(Items.water_bucket), null, ItemDusts.getDustByName("indium", 2), ItemDustsSmall.getSmallDustByName("Indium", 1), ItemDustsSmall.getSmallDustByName("Indium", 1), new ItemStack(Items.bucket), 100, 120)); - } catch (Exception e) { - LogHelper.info("Failed to Load Grinder Recipe for Indium Ore"); - } - } - - //Calcite Ore - if (OreUtil.doesOreExistAndValid("oreCalcite") && OreUtil.doesOreExistAndValid("gemCalcite")) { - try { - ItemStack oreStack = OreDictionary.getOres("oreCalcite").get(0); - ItemStack gemStack = OreDictionary.getOres("gemCalcite").get(0); - RecipeHandler.addRecipe(new GrinderRecipe(oreStack, null, new FluidStack(FluidRegistry.WATER, 1000), gemStack, ItemDustsSmall.getSmallDustByName("Calcite", 6), null, null, 100, 120)); - RecipeHandler.addRecipe(new GrinderRecipe(oreStack, new ItemStack(Items.water_bucket), null, gemStack, ItemDustsSmall.getSmallDustByName("Calcite", 6), null, new ItemStack(Items.bucket), 100, 120)); - } catch (Exception e) { - LogHelper.info("Failed to Load Grinder Recipe for Calcite Ore"); - } - } - - //Magnetite Ore - if (OreUtil.doesOreExistAndValid("oreMagnetite") && OreUtil.doesOreExistAndValid("chunkMagnetite")) { - try { - ItemStack oreStack = OreDictionary.getOres("oreMagnetite").get(0); - ItemStack chunkStack = OreDictionary.getOres("chunkMagnetite").get(0); - RecipeHandler.addRecipe(new GrinderRecipe(oreStack, null, new FluidStack(FluidRegistry.WATER, 1000), chunkStack, ItemDustsSmall.getSmallDustByName("Magnetite", 6), null, null, 100, 120)); - RecipeHandler.addRecipe(new GrinderRecipe(oreStack, new ItemStack(Items.water_bucket), null, chunkStack, ItemDustsSmall.getSmallDustByName("Magnetite", 6), null, new ItemStack(Items.bucket), 100, 120)); - } catch (Exception e) { - LogHelper.info("Failed to Load Grinder Recipe for Magnetite Ore"); - } - } - - //Graphite Ore - if (OreUtil.doesOreExistAndValid("oreGraphite") && OreUtil.doesOreExistAndValid("chunkGraphite")) { - try { - ItemStack oreStack = OreDictionary.getOres("oreGraphite").get(0); - ItemStack chunkStack = OreDictionary.getOres("chunkGraphite").get(0); - RecipeHandler.addRecipe(new GrinderRecipe(oreStack, null, new FluidStack(FluidRegistry.WATER, 1000), chunkStack, ItemDustsSmall.getSmallDustByName("Graphite", 6), null, null, 100, 120)); - RecipeHandler.addRecipe(new GrinderRecipe(oreStack, new ItemStack(Items.water_bucket), null, chunkStack, ItemDustsSmall.getSmallDustByName("Graphite", 6), null, new ItemStack(Items.bucket), 100, 120)); - } catch (Exception e) { - LogHelper.info("Failed to Load Grinder Recipe for Graphite Ore"); - } - } - - //Osmium Ore - if (OreUtil.doesOreExistAndValid("oreOsmium")) { - try { - ItemStack oreStack = OreDictionary.getOres("oreOsmium").get(0); - RecipeHandler.addRecipe(new GrinderRecipe(oreStack, null, new FluidStack(FluidRegistry.WATER, 1000), ItemDusts.getDustByName("osmium", 2), ItemDustsSmall.getSmallDustByName("Osmium", 1), ItemDustsSmall.getSmallDustByName("Osmium", 1), null, 100, 120)); - RecipeHandler.addRecipe(new GrinderRecipe(oreStack, new ItemStack(Items.water_bucket), null, ItemDusts.getDustByName("osmium", 2), ItemDustsSmall.getSmallDustByName("Osmium", 1), ItemDustsSmall.getSmallDustByName("Osmium", 1), new ItemStack(Items.bucket), 100, 120)); - } catch (Exception e) { - LogHelper.info("Failed to Load Grinder Recipe for Osmium Ore"); - } - } - - //Teslatite Ore - if (OreUtil.doesOreExistAndValid("oreTeslatite") && OreUtil.doesOreExistAndValid("dustTeslatite")) { - try { - ItemStack oreStack = OreDictionary.getOres("oreTeslatite").get(0); - ItemStack dustStack = OreDictionary.getOres("dustTeslatite").get(0); - dustStack.stackSize = 10; - RecipeHandler.addRecipe(new GrinderRecipe(oreStack, null, new FluidStack(FluidRegistry.WATER, 1000), dustStack, ItemDustsSmall.getSmallDustByName("Sodalite", 1), ItemDustsSmall.getSmallDustByName("Glowstone", 1), null, 100, 120)); - RecipeHandler.addRecipe(new GrinderRecipe(oreStack, new ItemStack(Items.water_bucket), null, dustStack, ItemDustsSmall.getSmallDustByName("Sodalite", 1), ItemDustsSmall.getSmallDustByName("Glowstone", 1), new ItemStack(Items.bucket), 100, 120)); - } catch (Exception e) { - LogHelper.info("Failed to Load Grinder Recipe for Teslatite Ore"); - } - } - - //Sulfur Ore - if (OreUtil.doesOreExistAndValid("oreSulfur")) { - try { - ItemStack oreStack = OreDictionary.getOres("oreSulfur").get(0); - RecipeHandler.addRecipe(new GrinderRecipe(oreStack, null, new FluidStack(FluidRegistry.WATER, 1000), ItemDusts.getDustByName("sulfur", 2), ItemDustsSmall.getSmallDustByName("Sulfur", 1), ItemDustsSmall.getSmallDustByName("Sulfur", 1), null, 100, 120)); - } catch (Exception e) { - LogHelper.info("Failed to Load Grinder Recipe for Sulfur Ore"); - } - } - - //Saltpeter Ore - if (OreUtil.doesOreExistAndValid("oreSaltpeter")) { - try { - ItemStack oreStack = OreDictionary.getOres("oreSaltpeter").get(0); - RecipeHandler.addRecipe(new GrinderRecipe(oreStack, null, new FluidStack(FluidRegistry.WATER, 1000), ItemDusts.getDustByName("saltpeter", 2), ItemDustsSmall.getSmallDustByName("Saltpeter", 1), ItemDustsSmall.getSmallDustByName("Saltpeter", 1), null, 100, 120)); - RecipeHandler.addRecipe(new GrinderRecipe(oreStack, new ItemStack(Items.water_bucket), null, ItemDusts.getDustByName("saltpeter", 2), ItemDustsSmall.getSmallDustByName("Saltpeter", 1), ItemDustsSmall.getSmallDustByName("Saltpeter", 1), new ItemStack(Items.bucket), 100, 120)); - } catch (Exception e) { - LogHelper.info("Failed to Load Grinder Recipe for Saltpeter Ore"); - } - } - - //Apatite Ore - if (OreUtil.doesOreExistAndValid("oreApatite") & OreUtil.doesOreExistAndValid("gemApatite")) { - try { - ItemStack oreStack = OreDictionary.getOres("oreApatite").get(0); - ItemStack gemStack = OreDictionary.getOres("gemApatite").get(0); - gemStack.stackSize = 6; - RecipeHandler.addRecipe(new GrinderRecipe(oreStack, null, new FluidStack(FluidRegistry.WATER, 1000), gemStack, gemStack, ItemDustsSmall.getSmallDustByName("Phosphorous", 4), null, 100, 120)); - RecipeHandler.addRecipe(new GrinderRecipe(oreStack, new ItemStack(Items.water_bucket), null, gemStack, gemStack, ItemDustsSmall.getSmallDustByName("Phosphorous", 4), new ItemStack(Items.bucket), 100, 120)); - } catch (Exception e) { - LogHelper.info("Failed to Load Grinder Recipe for Apatite Ore"); - } - } - - //Nether Quartz Ore - if (OreUtil.doesOreExistAndValid("dustNetherQuartz")) { - try { - ItemStack dustStack = OreDictionary.getOres("dustNetherQuartz").get(0); - dustStack.stackSize = 4; - RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(Blocks.quartz_ore, 1), null, new FluidStack(FluidRegistry.WATER, 1000), new ItemStack(Items.quartz, 2), dustStack, ItemDustsSmall.getSmallDustByName("Netherrack", 2), null, 100, 120)); - RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(Blocks.quartz_ore, 1), new ItemStack(Items.water_bucket), null, new ItemStack(Items.quartz, 2), dustStack, ItemDustsSmall.getSmallDustByName("Netherrack", 2), new ItemStack(Items.bucket), 100, 120)); - } catch (Exception e) { - LogHelper.info("Failed to Load Grinder Recipe for Nether Quartz Ore"); - } - } - - //Certus Quartz Ore - if (OreUtil.doesOreExistAndValid("oreCertusQuartz")) { - try { - ItemStack oreStack = OreDictionary.getOres("oreCertusQuartz").get(0); - ItemStack gemStack = OreDictionary.getOres("crystalCertusQuartz").get(0); - ItemStack dustStack = OreDictionary.getOres("dustCertusQuartz").get(0); - dustStack.stackSize = 2; - RecipeHandler.addRecipe(new GrinderRecipe(oreStack, null, new FluidStack(FluidRegistry.WATER, 1000), gemStack, dustStack, null, null, 100, 120)); - RecipeHandler.addRecipe(new GrinderRecipe(oreStack, new ItemStack(Items.water_bucket), null, gemStack, dustStack, null, new ItemStack(Items.bucket), 100, 120)); - } catch (Exception e) { - LogHelper.info("Failed to Load Grinder Recipe for Certus Quartz Ore"); - } - } - - //Charged Certus Quartz Ore - if (OreUtil.doesOreExistAndValid("oreChargedCertusQuartz")) { - try { - ItemStack oreStack = OreDictionary.getOres("oreChargedCertusQuartz").get(0); - ItemStack gemStack = OreDictionary.getOres("crystalChargedCertusQuartz").get(0); - ItemStack dustStack = OreDictionary.getOres("dustCertusQuartz").get(0); - dustStack.stackSize = 2; - RecipeHandler.addRecipe(new GrinderRecipe(oreStack, null, new FluidStack(FluidRegistry.WATER, 1000), gemStack, dustStack, null, null, 100, 120)); - RecipeHandler.addRecipe(new GrinderRecipe(oreStack, new ItemStack(Items.water_bucket), null, gemStack, dustStack, null, new ItemStack(Items.bucket), 100, 120)); - } catch (Exception e) { - LogHelper.info("Failed to Load Grinder Recipe for Charged Certus Quartz Ore"); - } - } - - //Amethyst Ore - if (OreUtil.doesOreExistAndValid("oreAmethyst") && OreUtil.doesOreExistAndValid("gemAmethyst")) { - try { - ItemStack oreStack = OreDictionary.getOres("oreAmethyst").get(0); - ItemStack gemStack = OreDictionary.getOres("gemAmethyst").get(0); - gemStack.stackSize = 2; - ItemStack dustStack = OreDictionary.getOres("gemAmethyst").get(0); - dustStack.stackSize = 1; - RecipeHandler.addRecipe(new GrinderRecipe(oreStack, null, new FluidStack(FluidRegistry.WATER, 1000), gemStack, dustStack, null, null, 100, 120)); - RecipeHandler.addRecipe(new GrinderRecipe(oreStack, new ItemStack(Items.water_bucket), null, gemStack, dustStack, null, new ItemStack(Items.bucket), 100, 120)); - } catch (Exception e) { - LogHelper.info("Failed to Load Grinder Recipe for Certus Quartz Ore"); - } - } - - //Topaz Ore - if (OreUtil.doesOreExistAndValid("oreTopaz") && OreUtil.doesOreExistAndValid("gemTopaz")) { - try { - ItemStack oreStack = OreDictionary.getOres("oreTopaz").get(0); - ItemStack gemStack = OreDictionary.getOres("gemTopaz").get(0); - gemStack.stackSize = 2; - ItemStack dustStack = OreDictionary.getOres("gemTopaz").get(0); - dustStack.stackSize = 1; - RecipeHandler.addRecipe(new GrinderRecipe(oreStack, null, new FluidStack(FluidRegistry.WATER, 1000), gemStack, dustStack, null, null, 100, 120)); - RecipeHandler.addRecipe(new GrinderRecipe(oreStack, new ItemStack(Items.water_bucket), null, gemStack, dustStack, null, new ItemStack(Items.bucket), 100, 120)); - } catch (Exception e) { - LogHelper.info("Failed to Load Grinder Recipe for Topaz Ore"); - } - } - - //Tanzanite Ore - if (OreUtil.doesOreExistAndValid("oreTanzanite") && OreUtil.doesOreExistAndValid("gemTanzanite")) { - try { - ItemStack oreStack = OreDictionary.getOres("oreTanzanite").get(0); - ItemStack gemStack = OreDictionary.getOres("gemTanzanite").get(0); - gemStack.stackSize = 2; - ItemStack dustStack = OreDictionary.getOres("gemTanzanite").get(0); - dustStack.stackSize = 1; - RecipeHandler.addRecipe(new GrinderRecipe(oreStack, null, new FluidStack(FluidRegistry.WATER, 1000), gemStack, dustStack, null, null, 100, 120)); - RecipeHandler.addRecipe(new GrinderRecipe(oreStack, new ItemStack(Items.water_bucket), null, gemStack, dustStack, null, new ItemStack(Items.bucket), 100, 120)); - } catch (Exception e) { - LogHelper.info("Failed to Load Grinder Recipe for Tanzanite Ore"); - } - } - - //Malachite Ore - if (OreUtil.doesOreExistAndValid("oreMalachite") && OreUtil.doesOreExistAndValid("gemMalachite")) { - try { - ItemStack oreStack = OreDictionary.getOres("oreMalachite").get(0); - ItemStack gemStack = OreDictionary.getOres("gemMalachite").get(0); - gemStack.stackSize = 2; - ItemStack dustStack = OreDictionary.getOres("gemMalachite").get(0); - dustStack.stackSize = 1; - RecipeHandler.addRecipe(new GrinderRecipe(oreStack, null, new FluidStack(FluidRegistry.WATER, 1000), gemStack, dustStack, null, null, 100, 120)); - RecipeHandler.addRecipe(new GrinderRecipe(oreStack, new ItemStack(Items.water_bucket), null, gemStack, dustStack, null, new ItemStack(Items.bucket), 100, 120)); - } catch (Exception e) { - LogHelper.info("Failed to Load Grinder Recipe for Malachite Ore"); - } - } - - //Galena Ore - RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(ModBlocks.ore, 1, 0), null, new FluidStack(FluidRegistry.WATER, 1000), ItemDusts.getDustByName("galena", 2), ItemDustsSmall.getSmallDustByName("Sulfur", 1), ItemDustsSmall.getSmallDustByName("Silver", 1), null, 100, 120)); - RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(ModBlocks.ore, 1, 0), new ItemStack(Items.water_bucket), null, ItemDusts.getDustByName("galena", 2), ItemDustsSmall.getSmallDustByName("Sulfur", 1), ItemDustsSmall.getSmallDustByName("Silver", 1), new ItemStack(Items.bucket), 100, 120)); - - RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(ModBlocks.ore, 1, 0), null, new FluidStack(ModFluids.fluidMercury, 1000), ItemDusts.getDustByName("galena", 2), ItemDustsSmall.getSmallDustByName("Sulfur", 1), ItemDusts.getDustByName("silver", 1), null, 100, 120)); - RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(ModBlocks.ore, 1, 0), new ItemStack(ModItems.bucketMercury), null, ItemDusts.getDustByName("galena", 2), ItemDustsSmall.getSmallDustByName("Sulfur", 1), ItemDusts.getDustByName("silver", 1), new ItemStack(Items.bucket), 100, 120)); - - - //Ruby Ore - RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(ModBlocks.ore, 1, 2), null, new FluidStack(FluidRegistry.WATER, 1000), ItemGems.getGemByName("ruby", 1), ItemDustsSmall.getSmallDustByName("Ruby", 6), ItemDustsSmall.getSmallDustByName("Chrome", 2), null, 100, 120)); - RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(ModBlocks.ore, 1, 2), new ItemStack(Items.water_bucket), null, ItemGems.getGemByName("ruby", 1), ItemDustsSmall.getSmallDustByName("Ruby", 6), ItemDustsSmall.getSmallDustByName("Chrome", 2), new ItemStack(Items.bucket), 100, 120)); - - //Sapphire Ore - RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(ModBlocks.ore, 1, 3), null, new FluidStack(FluidRegistry.WATER, 1000), ItemGems.getGemByName("sapphire", 1), ItemDustsSmall.getSmallDustByName("Sapphire", 6), ItemDustsSmall.getSmallDustByName("Aluminum", 2), null, 100, 120)); - RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(ModBlocks.ore, 1, 3), new ItemStack(Items.water_bucket), null, ItemGems.getGemByName("sapphire", 1), ItemDustsSmall.getSmallDustByName("Sapphire", 6), ItemDustsSmall.getSmallDustByName("Aluminum", 2), new ItemStack(Items.bucket), 100, 120)); - - //Bauxite Ore - RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(ModBlocks.ore, 1, 4), null, new FluidStack(FluidRegistry.WATER, 1000), ItemDusts.getDustByName("bauxite", 2), ItemDustsSmall.getSmallDustByName("Grossular", 4), ItemDustsSmall.getSmallDustByName("Titanium", 4), null, 100, 120)); - RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(ModBlocks.ore, 1, 4), new ItemStack(Items.water_bucket), null, ItemDusts.getDustByName("bauxite", 2), ItemDustsSmall.getSmallDustByName("Grossular", 4), ItemDustsSmall.getSmallDustByName("Titanium", 4), new ItemStack(Items.bucket), 100, 120)); - - //Pyrite Ore - RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(ModBlocks.ore, 1, 5), null, new FluidStack(FluidRegistry.WATER, 1000), ItemDusts.getDustByName("pyrite", 2), ItemDustsSmall.getSmallDustByName("Sulfur", 1), ItemDustsSmall.getSmallDustByName("Phosphorous", 1), null, 100, 120)); - RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(ModBlocks.ore, 1, 5), new ItemStack(Items.water_bucket), null, ItemDusts.getDustByName("pyrite", 2), ItemDustsSmall.getSmallDustByName("Sulfur", 1), ItemDustsSmall.getSmallDustByName("Phosphorous", 1), new ItemStack(Items.bucket), 100, 120)); - - //Cinnabar Ore - RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(ModBlocks.ore, 1, 6), null, new FluidStack(FluidRegistry.WATER, 1000), ItemDusts.getDustByName("cinnabar", 2), ItemDustsSmall.getSmallDustByName("Redstone", 1), ItemDustsSmall.getSmallDustByName("Glowstone", 1), null, 100, 120)); - RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(ModBlocks.ore, 1, 6), new ItemStack(Items.water_bucket), null, ItemDusts.getDustByName("cinnabar", 2), ItemDustsSmall.getSmallDustByName("Redstone", 1), ItemDustsSmall.getSmallDustByName("Glowstone", 1), new ItemStack(Items.bucket), 100, 120)); - - //Sphalerite Ore - RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(ModBlocks.ore, 1, 7), null, new FluidStack(FluidRegistry.WATER, 1000), ItemDusts.getDustByName("sphalerite", 2), ItemDustsSmall.getSmallDustByName("Zinc", 1), ItemDustsSmall.getSmallDustByName("YellowGarnet", 1), null, 100, 120)); - RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(ModBlocks.ore, 1, 7), new ItemStack(Items.water_bucket), null, ItemDusts.getDustByName("sphalerite", 2), ItemDustsSmall.getSmallDustByName("Zinc", 1), ItemDustsSmall.getSmallDustByName("YellowGarnet", 1), new ItemStack(Items.bucket), 100, 120)); - - RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(ModBlocks.ore, 1, 7), null, new FluidStack(ModFluids.fluidSodiumpersulfate, 1000), ItemDusts.getDustByName("sphalerite", 2), ItemDusts.getDustByName("zinc", 1), ItemDustsSmall.getSmallDustByName("YellowGarnet", 1), null, 100, 120)); - RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(ModBlocks.ore, 1, 7), new ItemStack(ModItems.bucketSodiumpersulfate), null, ItemDusts.getDustByName("sphalerite", 2), ItemDusts.getDustByName("zinc", 1), ItemDustsSmall.getSmallDustByName("YellowGarnet", 1), new ItemStack(Items.bucket), 100, 120)); - - //Tungsten Ore - RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(ModBlocks.ore, 1, 8), null, new FluidStack(FluidRegistry.WATER, 1000), ItemDusts.getDustByName("tungsten", 2), ItemDustsSmall.getSmallDustByName("Manganese", 1), ItemDustsSmall.getSmallDustByName("Silver", 1), null, 100, 120)); - RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(ModBlocks.ore, 1, 8), new ItemStack(Items.water_bucket), null, ItemDusts.getDustByName("tungsten", 2), ItemDustsSmall.getSmallDustByName("Manganese", 1), ItemDustsSmall.getSmallDustByName("Silver", 1), new ItemStack(Items.bucket), 100, 120)); - - RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(ModBlocks.ore, 1, 8), null, new FluidStack(ModFluids.fluidMercury, 1000), ItemDusts.getDustByName("tungsten", 2), ItemDustsSmall.getSmallDustByName("Manganese", 1), ItemDusts.getDustByName("silver", 2), null, 100, 120)); - RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(ModBlocks.ore, 1, 8), new ItemStack(ModItems.bucketMercury), null, ItemDusts.getDustByName("tungsten", 2), ItemDustsSmall.getSmallDustByName("Manganese", 1), ItemDusts.getDustByName("silver", 2), new ItemStack(Items.bucket), 100, 120)); - - //Sheldonite Ore - RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(ModBlocks.ore, 1, 9), null, new FluidStack(FluidRegistry.WATER, 1000), ItemDusts.getDustByName("platinum", 2), ItemDustsSmall.getSmallDustByName("Iridium", 1), ItemDustsSmall.getSmallDustByName("Iridium", 1), null, 100, 120)); - RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(ModBlocks.ore, 1, 9), new ItemStack(Items.water_bucket), null, ItemDusts.getDustByName("platinum", 2), ItemDustsSmall.getSmallDustByName("Iridium", 1), ItemDustsSmall.getSmallDustByName("Iridium", 1), new ItemStack(Items.bucket), 100, 120)); - - RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(ModBlocks.ore, 1, 9), null, new FluidStack(ModFluids.fluidMercury, 1000), ItemDusts.getDustByName("platinum", 3), ItemDustsSmall.getSmallDustByName("Iridium", 1), ItemDustsSmall.getSmallDustByName("Iridium", 1), null, 100, 120)); - RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(ModBlocks.ore, 1, 9), new ItemStack(ModItems.bucketMercury), null, ItemDusts.getDustByName("platinum", 3), ItemDustsSmall.getSmallDustByName("Iridium", 1), ItemDustsSmall.getSmallDustByName("Iridium", 1), new ItemStack(Items.bucket), 100, 120)); - - //Peridot Ore - RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(ModBlocks.ore, 1, 10), null, new FluidStack(FluidRegistry.WATER, 1000), ItemGems.getGemByName("peridot", 1), ItemDustsSmall.getSmallDustByName("Peridot", 6), ItemDustsSmall.getSmallDustByName("Pyrope", 2), null, 100, 120)); - RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(ModBlocks.ore, 1, 10), new ItemStack(Items.water_bucket), null, ItemGems.getGemByName("peridot", 1), ItemDustsSmall.getSmallDustByName("Peridot", 6), ItemDustsSmall.getSmallDustByName("Pyrope", 2), new ItemStack(Items.bucket), 100, 120)); - - //Sodalite Ore - RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(ModBlocks.ore, 1, 11), null, new FluidStack(FluidRegistry.WATER, 1000), ItemDusts.getDustByName("sodalite", 12), ItemDustsSmall.getSmallDustByName("Lazurite", 4), ItemDustsSmall.getSmallDustByName("Lapis", 4), null, 100, 120)); - RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(ModBlocks.ore, 1, 11), new ItemStack(Items.water_bucket), null, ItemDusts.getDustByName("sodalite", 12), ItemDustsSmall.getSmallDustByName("Lazurite", 4), ItemDustsSmall.getSmallDustByName("Lapis", 4), new ItemStack(Items.bucket), 100, 120)); - - //Tetrahedrite Ore - RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(ModBlocks.ore, 1, 12), null, new FluidStack(FluidRegistry.WATER, 1000), ItemDusts.getDustByName("tetrahedrite", 2), ItemDustsSmall.getSmallDustByName("Antimony", 1), ItemDustsSmall.getSmallDustByName("Zinc", 1), null, 100, 120)); - RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(ModBlocks.ore, 1, 12), new ItemStack(Items.water_bucket), null, ItemDusts.getDustByName("tetrahedrite", 2), ItemDustsSmall.getSmallDustByName("Antimony", 1), ItemDustsSmall.getSmallDustByName("Zinc", 1), new ItemStack(Items.bucket), 100, 120)); - - RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(ModBlocks.ore, 1, 12), null, new FluidStack(ModFluids.fluidSodiumpersulfate, 1000), ItemDusts.getDustByName("tetrahedrite", 3), ItemDustsSmall.getSmallDustByName("Antimony", 1), ItemDustsSmall.getSmallDustByName("Zinc", 1), null, 100, 120)); - RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(ModBlocks.ore, 1, 12), new ItemStack(ModItems.bucketSodiumpersulfate), null, ItemDusts.getDustByName("tetrahedrite", 3), ItemDustsSmall.getSmallDustByName("Antimony", 1), ItemDustsSmall.getSmallDustByName("Zinc", 1), new ItemStack(Items.bucket), 100, 120)); - } - - static void addImplosionCompressorRecipes() { - } - - static void addChemicalReactorRecipes() { - RecipeHandler.addRecipe(new ChemicalReactorRecipe(ItemCells.getCellByName("calcium", 1), ItemCells.getCellByName("carbon", 1), ItemCells.getCellByName("calciumCarbonate", 2), 240, 30)); - RecipeHandler.addRecipe(new ChemicalReactorRecipe(new ItemStack(Items.gold_nugget, 8), new ItemStack(Items.melon, 1), new ItemStack(Items.speckled_melon, 1), 40, 30)); - RecipeHandler.addRecipe(new ChemicalReactorRecipe(ItemCells.getCellByName("nitrogen", 1), ItemCells.getCellByName("carbon", 1), ItemCells.getCellByName("nitrocarbon", 2), 1500, 30)); - RecipeHandler.addRecipe(new ChemicalReactorRecipe(ItemCells.getCellByName("carbon", 1), ItemCells.getCellByName("hydrogen", 4), ItemCells.getCellByName("methane", 5), 3500, 30)); - RecipeHandler.addRecipe(new ChemicalReactorRecipe(ItemCells.getCellByName("sulfur", 1), ItemCells.getCellByName("sodium", 1), ItemCells.getCellByName("sodiumSulfide", 2), 100, 30)); - RecipeHandler.addRecipe(new ChemicalReactorRecipe(new ItemStack(Items.blaze_powder, 1), new ItemStack(Items.ender_pearl, 1), new ItemStack(Items.ender_eye, 1), 40, 30)); - RecipeHandler.addRecipe(new ChemicalReactorRecipe(new ItemStack(Items.gold_nugget, 8), new ItemStack(Items.carrot, 1), new ItemStack(Items.golden_carrot, 1), 40, 30)); - RecipeHandler.addRecipe(new ChemicalReactorRecipe(ItemCells.getCellByName("glyceryl", 1), ItemCells.getCellByName("diesel", 4), ItemCells.getCellByName("nitroDiesel", 5), 1000, 30)); - RecipeHandler.addRecipe(new ChemicalReactorRecipe(new ItemStack(Items.gold_ingot, 8), new ItemStack(Items.apple, 1), new ItemStack(Items.golden_apple, 1), 40, 30)); - RecipeHandler.addRecipe(new ChemicalReactorRecipe(new ItemStack(Blocks.gold_block, 8), new ItemStack(Items.apple, 1), new ItemStack(Items.golden_apple, 1, 1), 40, 30)); - RecipeHandler.addRecipe(new ChemicalReactorRecipe(new ItemStack(Items.blaze_powder, 1), new ItemStack(Items.slime_ball, 1), new ItemStack(Items.magma_cream, 1), 40, 30)); - } - - static void addIndustrialElectrolyzerRecipes() { - - - RecipeHandler.addRecipe(new IndustrialElectrolyzerRecipe( - ItemCells.getCellByName("nitrocarbon", 2), - null, - ItemCells.getCellByName("nitrogen"), - ItemCells.getCellByName("carbon"), - null, - null, - 80, 60 - )); - - RecipeHandler.addRecipe(new IndustrialElectrolyzerRecipe( - ItemDusts.getDustByName("pyrite", 3), - null, - ItemDusts.getDustByName("iron"), - ItemDusts.getDustByName("sulfur"), - null, - null, - 120, 128 - )); - - RecipeHandler.addRecipe(new IndustrialElectrolyzerRecipe( - ItemDusts.getDustByName("sphalerite", 2), - null, - ItemDusts.getDustByName("zinc"), - ItemDusts.getDustByName("sulfur"), - null, - null, - 150, 100 - )); - - - } + } + + static void addIndustrialGrinderRecipes() { + //Coal Ore + RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(Blocks.coal_ore, 1), null, new FluidStack(FluidRegistry.WATER, 1000), new ItemStack(Items.coal, 1), ItemDustsSmall.getSmallDustByName("Coal", 6), ItemDustsSmall.getSmallDustByName("Coal", 2), null, 100, 120)); + RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(Blocks.coal_ore, 1), new ItemStack(Items.water_bucket), null, new ItemStack(Items.coal, 1), ItemDustsSmall.getSmallDustByName("Coal", 6), ItemDustsSmall.getSmallDustByName("Coal", 2), new ItemStack(Items.bucket), 100, 120)); + + //Iron Ore + RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(Blocks.iron_ore, 1), null, new FluidStack(FluidRegistry.WATER, 1000), ItemDusts.getDustByName("iron", 2), ItemDustsSmall.getSmallDustByName("Nickel", 1), ItemDustsSmall.getSmallDustByName("Tin", 1), null, 100, 120)); + RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(Blocks.iron_ore, 1), new ItemStack(Items.water_bucket), null, ItemDusts.getDustByName("iron", 2), ItemDustsSmall.getSmallDustByName("Nickel", 1), ItemDustsSmall.getSmallDustByName("Tin", 1), new ItemStack(Items.bucket), 100, 120)); + + RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(Blocks.iron_ore, 1), null, new FluidStack(ModFluids.fluidSodiumpersulfate, 1000), ItemDusts.getDustByName("iron", 2), ItemDusts.getDustByName("nickel", 1), ItemDustsSmall.getSmallDustByName("Tin", 1), null, 100, 120)); + RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(Blocks.iron_ore, 1), new ItemStack(ModItems.bucketSodiumpersulfate), null, ItemDusts.getDustByName("iron", 2), ItemDusts.getDustByName("nickel", 1), ItemDustsSmall.getSmallDustByName("Tin", 1), new ItemStack(Items.bucket), 100, 120)); + + //Gold Ore + RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(Blocks.gold_ore, 1), null, new FluidStack(FluidRegistry.WATER, 1000), ItemDusts.getDustByName("gold", 2), ItemDustsSmall.getSmallDustByName("Copper", 1), ItemDustsSmall.getSmallDustByName("Nickel", 1), null, 100, 120)); + RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(Blocks.gold_ore, 1), new ItemStack(Items.water_bucket), null, ItemDusts.getDustByName("gold", 2), ItemDustsSmall.getSmallDustByName("Copper", 1), ItemDustsSmall.getSmallDustByName("Nickel", 1), new ItemStack(Items.bucket), 100, 120)); + + RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(Blocks.gold_ore, 1), null, new FluidStack(ModFluids.fluidSodiumpersulfate, 1000), ItemDusts.getDustByName("gold", 2), ItemDusts.getDustByName("copper", 1), ItemDustsSmall.getSmallDustByName("Nickel", 1), null, 100, 120)); + RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(Blocks.gold_ore, 1), new ItemStack(ModItems.bucketSodiumpersulfate), null, ItemDusts.getDustByName("gold", 2), ItemDusts.getDustByName("copper", 1), ItemDustsSmall.getSmallDustByName("Nickel", 1), new ItemStack(Items.bucket), 100, 120)); + + RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(Blocks.gold_ore, 1), null, new FluidStack(ModFluids.fluidMercury, 1000), ItemDusts.getDustByName("gold", 3), ItemDustsSmall.getSmallDustByName("Copper", 1), ItemDustsSmall.getSmallDustByName("Nickel", 1), null, 100, 120)); + RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(Blocks.gold_ore, 1), new ItemStack(ModItems.bucketMercury), null, ItemDusts.getDustByName("gold", 3), ItemDustsSmall.getSmallDustByName("Copper", 1), ItemDustsSmall.getSmallDustByName("Nickel", 1), new ItemStack(Items.bucket), 100, 120)); + + //Diamond Ore + RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(Blocks.diamond_ore, 1), null, new FluidStack(FluidRegistry.WATER, 1000), new ItemStack(Items.diamond, 1), ItemDustsSmall.getSmallDustByName("Diamond", 6), ItemDustsSmall.getSmallDustByName("Coal", 2), null, 100, 120)); + RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(Blocks.diamond_ore, 1), new ItemStack(Items.water_bucket), null, new ItemStack(Items.diamond, 1), ItemDustsSmall.getSmallDustByName("Diamond", 6), ItemDustsSmall.getSmallDustByName("Coal", 2), new ItemStack(Items.bucket), 100, 120)); + + //Emerald Ore + RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(Blocks.emerald_ore, 1), null, new FluidStack(FluidRegistry.WATER, 1000), new ItemStack(Items.emerald, 1), ItemDustsSmall.getSmallDustByName("Emerald", 6), ItemDustsSmall.getSmallDustByName("Aluminum", 2), null, 100, 120)); + RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(Blocks.emerald_ore, 1), new ItemStack(Items.water_bucket), null, new ItemStack(Items.emerald, 1), ItemDustsSmall.getSmallDustByName("Emerald", 6), ItemDustsSmall.getSmallDustByName("Aluminum", 2), new ItemStack(Items.bucket), 100, 120)); + + //Redstone + RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(Blocks.redstone_ore, 1), null, new FluidStack(FluidRegistry.WATER, 1000), new ItemStack(Items.redstone, 10), ItemDustsSmall.getSmallDustByName("Cinnabar", 1), ItemDustsSmall.getSmallDustByName("Glowstone", 1), null, 100, 120)); + RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(Blocks.redstone_ore, 1), new ItemStack(Items.water_bucket), null, new ItemStack(Items.redstone, 10), ItemDustsSmall.getSmallDustByName("Cinnabar", 1), ItemDustsSmall.getSmallDustByName("Glowstone", 1), new ItemStack(Items.bucket), 100, 120)); + + //Lapis Lazuli Ore + RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(Blocks.lapis_ore, 1), null, new FluidStack(FluidRegistry.WATER, 1000), new ItemStack(Items.dye, 6, 4), ItemDustsSmall.getSmallDustByName("Lapis", 36), ItemDustsSmall.getSmallDustByName("Lazurite", 8), null, 100, 120)); + RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(Blocks.lapis_ore, 1), new ItemStack(Items.water_bucket), null, new ItemStack(Items.dye, 6, 4), ItemDustsSmall.getSmallDustByName("Lapis", 36), ItemDustsSmall.getSmallDustByName("Lazurite", 8), new ItemStack(Items.bucket), 100, 120)); + + //Copper Ore + if (OreUtil.doesOreExistAndValid("oreCopper")) { + try { + ItemStack oreStack = OreDictionary.getOres("oreCopper").get(0); + RecipeHandler.addRecipe(new GrinderRecipe(oreStack, null, new FluidStack(FluidRegistry.WATER, 1000), ItemDusts.getDustByName("copper", 2), ItemDustsSmall.getSmallDustByName("Gold", 1), ItemDustsSmall.getSmallDustByName("Nickel", 1), null, 100, 120)); + RecipeHandler.addRecipe(new GrinderRecipe(oreStack, new ItemStack(Items.water_bucket), null, ItemDusts.getDustByName("copper", 2), ItemDustsSmall.getSmallDustByName("Gold", 1), ItemDustsSmall.getSmallDustByName("Nickel", 1), new ItemStack(Items.bucket), 100, 120)); + + RecipeHandler.addRecipe(new GrinderRecipe(oreStack, null, new FluidStack(ModFluids.fluidSodiumpersulfate, 1000), ItemDusts.getDustByName("copper", 2), ItemDusts.getDustByName("gold", 1), ItemDustsSmall.getSmallDustByName("Nickel", 1), null, 100, 120)); + RecipeHandler.addRecipe(new GrinderRecipe(oreStack, new ItemStack(ModItems.bucketSodiumpersulfate), null, ItemDusts.getDustByName("copper", 2), ItemDusts.getDustByName("gold", 1), ItemDustsSmall.getSmallDustByName("Nickel", 1), new ItemStack(Items.bucket), 100, 120)); + + RecipeHandler.addRecipe(new GrinderRecipe(oreStack, null, new FluidStack(ModFluids.fluidMercury, 1000), ItemDusts.getDustByName("copper", 2), ItemDustsSmall.getSmallDustByName("Gold", 1), ItemDusts.getDustByName("nickel", 1), null, 100, 120)); + RecipeHandler.addRecipe(new GrinderRecipe(oreStack, ItemCells.getCellByName("mercury", 1), null, ItemDusts.getDustByName("copper", 2), ItemDustsSmall.getSmallDustByName("Gold", 1), ItemDusts.getDustByName("nickel", 1), new ItemStack(Items.bucket), 100, 120)); + } catch (Exception e) { + Core.logHelper.info("Failed to Load Grinder Recipe for Copper Ore"); + } + } + + //Tin Ore + if (OreUtil.doesOreExistAndValid("oreTin")) { + try { + ItemStack oreStack = OreDictionary.getOres("oreTin").get(0); + RecipeHandler.addRecipe(new GrinderRecipe(oreStack, null, new FluidStack(FluidRegistry.WATER, 1000), ItemDusts.getDustByName("tin", 2), ItemDustsSmall.getSmallDustByName("Iron", 1), ItemDustsSmall.getSmallDustByName("Zinc", 1), null, 100, 120)); + RecipeHandler.addRecipe(new GrinderRecipe(oreStack, new ItemStack(Items.water_bucket), null, ItemDusts.getDustByName("tin", 2), ItemDustsSmall.getSmallDustByName("Iron", 1), ItemDustsSmall.getSmallDustByName("Zinc", 1), new ItemStack(Items.bucket), 100, 120)); + + RecipeHandler.addRecipe(new GrinderRecipe(oreStack, null, new FluidStack(ModFluids.fluidSodiumpersulfate, 1000), ItemDusts.getDustByName("tin", 2), ItemDustsSmall.getSmallDustByName("Iron", 1), ItemDusts.getDustByName("zinc", 1), null, 100, 120)); + RecipeHandler.addRecipe(new GrinderRecipe(oreStack, new ItemStack(ModItems.bucketSodiumpersulfate), null, ItemDusts.getDustByName("tin", 2), ItemDustsSmall.getSmallDustByName("Iron", 1), ItemDusts.getDustByName("zinc", 1), new ItemStack(Items.bucket), 100, 120)); + } catch (Exception e) { + Core.logHelper.info("Failed to Load Grinder Recipe for Tin Ore"); + } + } + + //Nickel Ore + if (OreUtil.doesOreExistAndValid("oreNickel")) { + try { + ItemStack oreStack = OreDictionary.getOres("oreNickel").get(0); + RecipeHandler.addRecipe(new GrinderRecipe(oreStack, null, new FluidStack(FluidRegistry.WATER, 1000), ItemDusts.getDustByName("nickel", 2), ItemDustsSmall.getSmallDustByName("Iron", 1), ItemDustsSmall.getSmallDustByName("Platinum", 1), null, 100, 120)); + RecipeHandler.addRecipe(new GrinderRecipe(oreStack, new ItemStack(Items.water_bucket), null, ItemDusts.getDustByName("nickel", 2), ItemDustsSmall.getSmallDustByName("Iron", 1), ItemDustsSmall.getSmallDustByName("Platinum", 1), new ItemStack(Items.bucket), 100, 120)); + + RecipeHandler.addRecipe(new GrinderRecipe(oreStack, null, new FluidStack(ModFluids.fluidSodiumpersulfate, 1000), ItemDusts.getDustByName("nickel", 3), ItemDustsSmall.getSmallDustByName("Iron", 1), ItemDustsSmall.getSmallDustByName("Platinum", 1), null, 100, 120)); + RecipeHandler.addRecipe(new GrinderRecipe(oreStack, new ItemStack(ModItems.bucketSodiumpersulfate), null, ItemDusts.getDustByName("nickel", 3), ItemDustsSmall.getSmallDustByName("Iron", 1), ItemDustsSmall.getSmallDustByName("Platinum", 1), new ItemStack(Items.bucket), 100, 120)); + + RecipeHandler.addRecipe(new GrinderRecipe(oreStack, null, new FluidStack(ModFluids.fluidMercury, 1000), ItemDusts.getDustByName("nickel", 2), ItemDustsSmall.getSmallDustByName("Iron", 1), ItemDusts.getDustByName("platinum", 1), null, 100, 120)); + RecipeHandler.addRecipe(new GrinderRecipe(oreStack, new ItemStack(ModItems.bucketMercury), null, ItemDusts.getDustByName("nickel", 2), ItemDustsSmall.getSmallDustByName("Iron", 1), ItemDusts.getDustByName("platinum", 1), new ItemStack(Items.bucket), 100, 120)); + } catch (Exception e) { + Core.logHelper.info("Failed to Load Grinder Recipe for Nickel Ore"); + } + } + + //Zinc Ore + if (OreUtil.doesOreExistAndValid("oreZinc")) { + try { + ItemStack oreStack = OreDictionary.getOres("oreZinc").get(0); + RecipeHandler.addRecipe(new GrinderRecipe(oreStack, null, new FluidStack(FluidRegistry.WATER, 1000), ItemDusts.getDustByName("zinc", 2), ItemDustsSmall.getSmallDustByName("Iron", 1), ItemDustsSmall.getSmallDustByName("Tin", 1), null, 100, 120)); + RecipeHandler.addRecipe(new GrinderRecipe(oreStack, new ItemStack(Items.water_bucket), null, ItemDusts.getDustByName("zinc", 2), ItemDustsSmall.getSmallDustByName("Iron", 1), ItemDustsSmall.getSmallDustByName("Tin", 1), new ItemStack(Items.bucket), 100, 120)); + + RecipeHandler.addRecipe(new GrinderRecipe(oreStack, null, new FluidStack(ModFluids.fluidSodiumpersulfate, 1000), ItemDusts.getDustByName("zinc", 2), ItemDustsSmall.getSmallDustByName("Iron", 1), ItemDusts.getDustByName("iron", 1), null, 100, 120)); + RecipeHandler.addRecipe(new GrinderRecipe(oreStack, new ItemStack(ModItems.bucketSodiumpersulfate), null, ItemDusts.getDustByName("zinc", 2), ItemDustsSmall.getSmallDustByName("Iron", 1), ItemDusts.getDustByName("iron", 1), new ItemStack(Items.bucket), 100, 120)); + } catch (Exception e) { + Core.logHelper.info("Failed to Load Grinder Recipe for Zinc Ore"); + } + } + + //Silver Ore + if (OreUtil.doesOreExistAndValid("oreSilver")) { + try { + ItemStack oreStack = OreDictionary.getOres("oreSilver").get(0); + RecipeHandler.addRecipe(new GrinderRecipe(oreStack, null, new FluidStack(FluidRegistry.WATER, 1000), ItemDusts.getDustByName("silver", 2), ItemDustsSmall.getSmallDustByName("Lead", 1), ItemDustsSmall.getSmallDustByName("Sulfur", 1), null, 100, 120)); + RecipeHandler.addRecipe(new GrinderRecipe(oreStack, new ItemStack(Items.water_bucket), null, ItemDusts.getDustByName("silver", 2), ItemDustsSmall.getSmallDustByName("Lead", 1), ItemDustsSmall.getSmallDustByName("Sulfur", 1), new ItemStack(Items.bucket), 100, 120)); + + RecipeHandler.addRecipe(new GrinderRecipe(oreStack, null, new FluidStack(ModFluids.fluidMercury, 1000), ItemDusts.getDustByName("silver", 3), ItemDustsSmall.getSmallDustByName("Lead", 1), ItemDustsSmall.getSmallDustByName("Sulfur", 1), null, 100, 120)); + RecipeHandler.addRecipe(new GrinderRecipe(oreStack, new ItemStack(ModItems.bucketMercury), null, ItemDusts.getDustByName("silver", 3), ItemDustsSmall.getSmallDustByName("Lead", 1), ItemDustsSmall.getSmallDustByName("Sulfur", 1), new ItemStack(Items.bucket), 100, 120)); + } catch (Exception e) { + Core.logHelper.info("Failed to Load Grinder Recipe for Silver Ore"); + } + } + + //Lead Ore + if (OreUtil.doesOreExistAndValid("oreLead")) { + try { + ItemStack oreStack = OreDictionary.getOres("oreLead").get(0); + RecipeHandler.addRecipe(new GrinderRecipe(oreStack, null, new FluidStack(FluidRegistry.WATER, 1000), ItemDusts.getDustByName("lead", 2), ItemDustsSmall.getSmallDustByName("Silver", 1), ItemDustsSmall.getSmallDustByName("Sulfur", 1), null, 100, 120)); + RecipeHandler.addRecipe(new GrinderRecipe(oreStack, new ItemStack(Items.water_bucket), null, ItemDusts.getDustByName("lead", 2), ItemDustsSmall.getSmallDustByName("Silver", 1), ItemDustsSmall.getSmallDustByName("Sulfur", 1), new ItemStack(Items.bucket), 100, 120)); + + RecipeHandler.addRecipe(new GrinderRecipe(oreStack, null, new FluidStack(ModFluids.fluidMercury, 1000), ItemDusts.getDustByName("lead", 2), ItemDusts.getDustByName("silver", 1), ItemDustsSmall.getSmallDustByName("Sulfur", 1), null, 100, 120)); + RecipeHandler.addRecipe(new GrinderRecipe(oreStack, new ItemStack(ModItems.bucketMercury), null, ItemDusts.getDustByName("lead", 2), ItemDusts.getDustByName("silver", 1), ItemDustsSmall.getSmallDustByName("Sulfur", 1), new ItemStack(Items.bucket), 100, 120)); + } catch (Exception e) { + Core.logHelper.info("Failed to Load Grinder Recipe for Lead Ore"); + } + } + + + //Aluminum Ore + if (OreUtil.doesOreExistAndValid("oreAluminum")) { + try { + ItemStack oreStack = OreDictionary.getOres("oreAluminum").get(0); + RecipeHandler.addRecipe(new GrinderRecipe(oreStack, null, new FluidStack(FluidRegistry.WATER, 1000), ItemDusts.getDustByName("aluminum", 2), ItemDustsSmall.getSmallDustByName("Bauxite", 1), ItemDustsSmall.getSmallDustByName("Bauxite", 1), null, 100, 120)); + RecipeHandler.addRecipe(new GrinderRecipe(oreStack, new ItemStack(Items.water_bucket), null, ItemDusts.getDustByName("aluminum", 2), ItemDustsSmall.getSmallDustByName("Bauxite", 1), ItemDustsSmall.getSmallDustByName("Bauxite", 1), new ItemStack(Items.bucket), 100, 120)); + } catch (Exception e) { + Core.logHelper.info("Failed to Load Grinder Recipe for Lead Ore"); + } + } + + //Ardite Ore + if (OreUtil.doesOreExistAndValid("oreArdite")) { + try { + ItemStack oreStack = OreDictionary.getOres("oreArdite").get(0); + RecipeHandler.addRecipe(new GrinderRecipe(oreStack, null, new FluidStack(FluidRegistry.WATER, 1000), ItemDusts.getDustByName("ardite", 2), ItemDustsSmall.getSmallDustByName("Ardite", 1), ItemDustsSmall.getSmallDustByName("Ardite", 1), null, 100, 120)); + RecipeHandler.addRecipe(new GrinderRecipe(oreStack, new ItemStack(Items.water_bucket), null, ItemDusts.getDustByName("ardite", 2), ItemDustsSmall.getSmallDustByName("Ardite", 1), ItemDustsSmall.getSmallDustByName("Ardite", 1), new ItemStack(Items.bucket), 100, 120)); + } catch (Exception e) { + Core.logHelper.info("Failed to Load Grinder Recipe for Ardite Ore"); + } + } + + //Cobalt Ore + if (OreUtil.doesOreExistAndValid("oreCobalt")) { + try { + ItemStack oreStack = OreDictionary.getOres("oreCobalt").get(0); + RecipeHandler.addRecipe(new GrinderRecipe(oreStack, null, new FluidStack(FluidRegistry.WATER, 1000), ItemDusts.getDustByName("cobalt", 2), ItemDustsSmall.getSmallDustByName("Cobalt", 1), ItemDustsSmall.getSmallDustByName("Cobalt", 1), null, 100, 120)); + RecipeHandler.addRecipe(new GrinderRecipe(oreStack, new ItemStack(Items.water_bucket), null, ItemDusts.getDustByName("cobalt", 2), ItemDustsSmall.getSmallDustByName("Cobalt", 1), ItemDustsSmall.getSmallDustByName("Cobalt", 1), new ItemStack(Items.bucket), 100, 120)); + } catch (Exception e) { + Core.logHelper.info("Failed to Load Grinder Recipe for Cobalt Ore"); + } + } + + //Dark Iron Ore + if (OreUtil.doesOreExistAndValid("oreDarkIron")) { + try { + ItemStack oreStack = OreDictionary.getOres("oreDarkIron").get(0); + RecipeHandler.addRecipe(new GrinderRecipe(oreStack, null, new FluidStack(FluidRegistry.WATER, 1000), ItemDusts.getDustByName("darkIron", 2), ItemDustsSmall.getSmallDustByName("DarkIron", 1), ItemDustsSmall.getSmallDustByName("Iron", 1), null, 100, 120)); + RecipeHandler.addRecipe(new GrinderRecipe(oreStack, new ItemStack(Items.water_bucket), null, ItemDusts.getDustByName("darkIron", 2), ItemDustsSmall.getSmallDustByName("DarkIron", 1), ItemDustsSmall.getSmallDustByName("Iron", 1), new ItemStack(Items.bucket), 100, 120)); + } catch (Exception e) { + Core.logHelper.info("Failed to Load Grinder Recipe for Dark Iron Ore"); + } + } + + //Cadmium Ore + if (OreUtil.doesOreExistAndValid("oreCadmium")) { + try { + ItemStack oreStack = OreDictionary.getOres("oreCadmium").get(0); + RecipeHandler.addRecipe(new GrinderRecipe(oreStack, null, new FluidStack(FluidRegistry.WATER, 1000), ItemDusts.getDustByName("cadmium", 2), ItemDustsSmall.getSmallDustByName("Cadmium", 1), ItemDustsSmall.getSmallDustByName("Cadmium", 1), null, 100, 120)); + RecipeHandler.addRecipe(new GrinderRecipe(oreStack, new ItemStack(Items.water_bucket), null, ItemDusts.getDustByName("cadmium", 2), ItemDustsSmall.getSmallDustByName("Cadmium", 1), ItemDustsSmall.getSmallDustByName("Cadmium", 1), new ItemStack(Items.bucket), 100, 120)); + } catch (Exception e) { + Core.logHelper.info("Failed to Load Grinder Recipe for Cadmium Ore"); + } + } + + //Indium Ore + if (OreUtil.doesOreExistAndValid("oreIndium")) { + try { + ItemStack oreStack = OreDictionary.getOres("oreIndium").get(0); + RecipeHandler.addRecipe(new GrinderRecipe(oreStack, null, new FluidStack(FluidRegistry.WATER, 1000), ItemDusts.getDustByName("indium", 2), ItemDustsSmall.getSmallDustByName("Indium", 1), ItemDustsSmall.getSmallDustByName("Indium", 1), null, 100, 120)); + RecipeHandler.addRecipe(new GrinderRecipe(oreStack, new ItemStack(Items.water_bucket), null, ItemDusts.getDustByName("indium", 2), ItemDustsSmall.getSmallDustByName("Indium", 1), ItemDustsSmall.getSmallDustByName("Indium", 1), new ItemStack(Items.bucket), 100, 120)); + } catch (Exception e) { + Core.logHelper.info("Failed to Load Grinder Recipe for Indium Ore"); + } + } + + //Calcite Ore + if (OreUtil.doesOreExistAndValid("oreCalcite") && OreUtil.doesOreExistAndValid("gemCalcite")) { + try { + ItemStack oreStack = OreDictionary.getOres("oreCalcite").get(0); + ItemStack gemStack = OreDictionary.getOres("gemCalcite").get(0); + RecipeHandler.addRecipe(new GrinderRecipe(oreStack, null, new FluidStack(FluidRegistry.WATER, 1000), gemStack, ItemDustsSmall.getSmallDustByName("Calcite", 6), null, null, 100, 120)); + RecipeHandler.addRecipe(new GrinderRecipe(oreStack, new ItemStack(Items.water_bucket), null, gemStack, ItemDustsSmall.getSmallDustByName("Calcite", 6), null, new ItemStack(Items.bucket), 100, 120)); + } catch (Exception e) { + Core.logHelper.info("Failed to Load Grinder Recipe for Calcite Ore"); + } + } + + //Magnetite Ore + if (OreUtil.doesOreExistAndValid("oreMagnetite") && OreUtil.doesOreExistAndValid("chunkMagnetite")) { + try { + ItemStack oreStack = OreDictionary.getOres("oreMagnetite").get(0); + ItemStack chunkStack = OreDictionary.getOres("chunkMagnetite").get(0); + RecipeHandler.addRecipe(new GrinderRecipe(oreStack, null, new FluidStack(FluidRegistry.WATER, 1000), chunkStack, ItemDustsSmall.getSmallDustByName("Magnetite", 6), null, null, 100, 120)); + RecipeHandler.addRecipe(new GrinderRecipe(oreStack, new ItemStack(Items.water_bucket), null, chunkStack, ItemDustsSmall.getSmallDustByName("Magnetite", 6), null, new ItemStack(Items.bucket), 100, 120)); + } catch (Exception e) { + Core.logHelper.info("Failed to Load Grinder Recipe for Magnetite Ore"); + } + } + + //Graphite Ore + if (OreUtil.doesOreExistAndValid("oreGraphite") && OreUtil.doesOreExistAndValid("chunkGraphite")) { + try { + ItemStack oreStack = OreDictionary.getOres("oreGraphite").get(0); + ItemStack chunkStack = OreDictionary.getOres("chunkGraphite").get(0); + RecipeHandler.addRecipe(new GrinderRecipe(oreStack, null, new FluidStack(FluidRegistry.WATER, 1000), chunkStack, ItemDustsSmall.getSmallDustByName("Graphite", 6), null, null, 100, 120)); + RecipeHandler.addRecipe(new GrinderRecipe(oreStack, new ItemStack(Items.water_bucket), null, chunkStack, ItemDustsSmall.getSmallDustByName("Graphite", 6), null, new ItemStack(Items.bucket), 100, 120)); + } catch (Exception e) { + Core.logHelper.info("Failed to Load Grinder Recipe for Graphite Ore"); + } + } + + //Osmium Ore + if (OreUtil.doesOreExistAndValid("oreOsmium")) { + try { + ItemStack oreStack = OreDictionary.getOres("oreOsmium").get(0); + RecipeHandler.addRecipe(new GrinderRecipe(oreStack, null, new FluidStack(FluidRegistry.WATER, 1000), ItemDusts.getDustByName("osmium", 2), ItemDustsSmall.getSmallDustByName("Osmium", 1), ItemDustsSmall.getSmallDustByName("Osmium", 1), null, 100, 120)); + RecipeHandler.addRecipe(new GrinderRecipe(oreStack, new ItemStack(Items.water_bucket), null, ItemDusts.getDustByName("osmium", 2), ItemDustsSmall.getSmallDustByName("Osmium", 1), ItemDustsSmall.getSmallDustByName("Osmium", 1), new ItemStack(Items.bucket), 100, 120)); + } catch (Exception e) { + Core.logHelper.info("Failed to Load Grinder Recipe for Osmium Ore"); + } + } + + //Teslatite Ore + if (OreUtil.doesOreExistAndValid("oreTeslatite") && OreUtil.doesOreExistAndValid("dustTeslatite")) { + try { + ItemStack oreStack = OreDictionary.getOres("oreTeslatite").get(0); + ItemStack dustStack = OreDictionary.getOres("dustTeslatite").get(0); + dustStack.stackSize = 10; + RecipeHandler.addRecipe(new GrinderRecipe(oreStack, null, new FluidStack(FluidRegistry.WATER, 1000), dustStack, ItemDustsSmall.getSmallDustByName("Sodalite", 1), ItemDustsSmall.getSmallDustByName("Glowstone", 1), null, 100, 120)); + RecipeHandler.addRecipe(new GrinderRecipe(oreStack, new ItemStack(Items.water_bucket), null, dustStack, ItemDustsSmall.getSmallDustByName("Sodalite", 1), ItemDustsSmall.getSmallDustByName("Glowstone", 1), new ItemStack(Items.bucket), 100, 120)); + } catch (Exception e) { + Core.logHelper.info("Failed to Load Grinder Recipe for Teslatite Ore"); + } + } + + //Sulfur Ore + if (OreUtil.doesOreExistAndValid("oreSulfur")) { + try { + ItemStack oreStack = OreDictionary.getOres("oreSulfur").get(0); + RecipeHandler.addRecipe(new GrinderRecipe(oreStack, null, new FluidStack(FluidRegistry.WATER, 1000), ItemDusts.getDustByName("sulfur", 2), ItemDustsSmall.getSmallDustByName("Sulfur", 1), ItemDustsSmall.getSmallDustByName("Sulfur", 1), null, 100, 120)); + } catch (Exception e) { + Core.logHelper.info("Failed to Load Grinder Recipe for Sulfur Ore"); + } + } + + //Saltpeter Ore + if (OreUtil.doesOreExistAndValid("oreSaltpeter")) { + try { + ItemStack oreStack = OreDictionary.getOres("oreSaltpeter").get(0); + RecipeHandler.addRecipe(new GrinderRecipe(oreStack, null, new FluidStack(FluidRegistry.WATER, 1000), ItemDusts.getDustByName("saltpeter", 2), ItemDustsSmall.getSmallDustByName("Saltpeter", 1), ItemDustsSmall.getSmallDustByName("Saltpeter", 1), null, 100, 120)); + RecipeHandler.addRecipe(new GrinderRecipe(oreStack, new ItemStack(Items.water_bucket), null, ItemDusts.getDustByName("saltpeter", 2), ItemDustsSmall.getSmallDustByName("Saltpeter", 1), ItemDustsSmall.getSmallDustByName("Saltpeter", 1), new ItemStack(Items.bucket), 100, 120)); + } catch (Exception e) { + Core.logHelper.info("Failed to Load Grinder Recipe for Saltpeter Ore"); + } + } + + //Apatite Ore + if (OreUtil.doesOreExistAndValid("oreApatite") & OreUtil.doesOreExistAndValid("gemApatite")) { + try { + ItemStack oreStack = OreDictionary.getOres("oreApatite").get(0); + ItemStack gemStack = OreDictionary.getOres("gemApatite").get(0); + gemStack.stackSize = 6; + RecipeHandler.addRecipe(new GrinderRecipe(oreStack, null, new FluidStack(FluidRegistry.WATER, 1000), gemStack, gemStack, ItemDustsSmall.getSmallDustByName("Phosphorous", 4), null, 100, 120)); + RecipeHandler.addRecipe(new GrinderRecipe(oreStack, new ItemStack(Items.water_bucket), null, gemStack, gemStack, ItemDustsSmall.getSmallDustByName("Phosphorous", 4), new ItemStack(Items.bucket), 100, 120)); + } catch (Exception e) { + Core.logHelper.info("Failed to Load Grinder Recipe for Apatite Ore"); + } + } + + //Nether Quartz Ore + if (OreUtil.doesOreExistAndValid("dustNetherQuartz")) { + try { + ItemStack dustStack = OreDictionary.getOres("dustNetherQuartz").get(0); + dustStack.stackSize = 4; + RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(Blocks.quartz_ore, 1), null, new FluidStack(FluidRegistry.WATER, 1000), new ItemStack(Items.quartz, 2), dustStack, ItemDustsSmall.getSmallDustByName("Netherrack", 2), null, 100, 120)); + RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(Blocks.quartz_ore, 1), new ItemStack(Items.water_bucket), null, new ItemStack(Items.quartz, 2), dustStack, ItemDustsSmall.getSmallDustByName("Netherrack", 2), new ItemStack(Items.bucket), 100, 120)); + } catch (Exception e) { + Core.logHelper.info("Failed to Load Grinder Recipe for Nether Quartz Ore"); + } + } + + //Certus Quartz Ore + if (OreUtil.doesOreExistAndValid("oreCertusQuartz")) { + try { + ItemStack oreStack = OreDictionary.getOres("oreCertusQuartz").get(0); + ItemStack gemStack = OreDictionary.getOres("crystalCertusQuartz").get(0); + ItemStack dustStack = OreDictionary.getOres("dustCertusQuartz").get(0); + dustStack.stackSize = 2; + RecipeHandler.addRecipe(new GrinderRecipe(oreStack, null, new FluidStack(FluidRegistry.WATER, 1000), gemStack, dustStack, null, null, 100, 120)); + RecipeHandler.addRecipe(new GrinderRecipe(oreStack, new ItemStack(Items.water_bucket), null, gemStack, dustStack, null, new ItemStack(Items.bucket), 100, 120)); + } catch (Exception e) { + Core.logHelper.info("Failed to Load Grinder Recipe for Certus Quartz Ore"); + } + } + + //Charged Certus Quartz Ore + if (OreUtil.doesOreExistAndValid("oreChargedCertusQuartz")) { + try { + ItemStack oreStack = OreDictionary.getOres("oreChargedCertusQuartz").get(0); + ItemStack gemStack = OreDictionary.getOres("crystalChargedCertusQuartz").get(0); + ItemStack dustStack = OreDictionary.getOres("dustCertusQuartz").get(0); + dustStack.stackSize = 2; + RecipeHandler.addRecipe(new GrinderRecipe(oreStack, null, new FluidStack(FluidRegistry.WATER, 1000), gemStack, dustStack, null, null, 100, 120)); + RecipeHandler.addRecipe(new GrinderRecipe(oreStack, new ItemStack(Items.water_bucket), null, gemStack, dustStack, null, new ItemStack(Items.bucket), 100, 120)); + } catch (Exception e) { + Core.logHelper.info("Failed to Load Grinder Recipe for Charged Certus Quartz Ore"); + } + } + + //Amethyst Ore + if (OreUtil.doesOreExistAndValid("oreAmethyst") && OreUtil.doesOreExistAndValid("gemAmethyst")) { + try { + ItemStack oreStack = OreDictionary.getOres("oreAmethyst").get(0); + ItemStack gemStack = OreDictionary.getOres("gemAmethyst").get(0); + gemStack.stackSize = 2; + ItemStack dustStack = OreDictionary.getOres("gemAmethyst").get(0); + dustStack.stackSize = 1; + RecipeHandler.addRecipe(new GrinderRecipe(oreStack, null, new FluidStack(FluidRegistry.WATER, 1000), gemStack, dustStack, null, null, 100, 120)); + RecipeHandler.addRecipe(new GrinderRecipe(oreStack, new ItemStack(Items.water_bucket), null, gemStack, dustStack, null, new ItemStack(Items.bucket), 100, 120)); + } catch (Exception e) { + Core.logHelper.info("Failed to Load Grinder Recipe for Certus Quartz Ore"); + } + } + + //Topaz Ore + if (OreUtil.doesOreExistAndValid("oreTopaz") && OreUtil.doesOreExistAndValid("gemTopaz")) { + try { + ItemStack oreStack = OreDictionary.getOres("oreTopaz").get(0); + ItemStack gemStack = OreDictionary.getOres("gemTopaz").get(0); + gemStack.stackSize = 2; + ItemStack dustStack = OreDictionary.getOres("gemTopaz").get(0); + dustStack.stackSize = 1; + RecipeHandler.addRecipe(new GrinderRecipe(oreStack, null, new FluidStack(FluidRegistry.WATER, 1000), gemStack, dustStack, null, null, 100, 120)); + RecipeHandler.addRecipe(new GrinderRecipe(oreStack, new ItemStack(Items.water_bucket), null, gemStack, dustStack, null, new ItemStack(Items.bucket), 100, 120)); + } catch (Exception e) { + Core.logHelper.info("Failed to Load Grinder Recipe for Topaz Ore"); + } + } + + //Tanzanite Ore + if (OreUtil.doesOreExistAndValid("oreTanzanite") && OreUtil.doesOreExistAndValid("gemTanzanite")) { + try { + ItemStack oreStack = OreDictionary.getOres("oreTanzanite").get(0); + ItemStack gemStack = OreDictionary.getOres("gemTanzanite").get(0); + gemStack.stackSize = 2; + ItemStack dustStack = OreDictionary.getOres("gemTanzanite").get(0); + dustStack.stackSize = 1; + RecipeHandler.addRecipe(new GrinderRecipe(oreStack, null, new FluidStack(FluidRegistry.WATER, 1000), gemStack, dustStack, null, null, 100, 120)); + RecipeHandler.addRecipe(new GrinderRecipe(oreStack, new ItemStack(Items.water_bucket), null, gemStack, dustStack, null, new ItemStack(Items.bucket), 100, 120)); + } catch (Exception e) { + Core.logHelper.info("Failed to Load Grinder Recipe for Tanzanite Ore"); + } + } + + //Malachite Ore + if (OreUtil.doesOreExistAndValid("oreMalachite") && OreUtil.doesOreExistAndValid("gemMalachite")) { + try { + ItemStack oreStack = OreDictionary.getOres("oreMalachite").get(0); + ItemStack gemStack = OreDictionary.getOres("gemMalachite").get(0); + gemStack.stackSize = 2; + ItemStack dustStack = OreDictionary.getOres("gemMalachite").get(0); + dustStack.stackSize = 1; + RecipeHandler.addRecipe(new GrinderRecipe(oreStack, null, new FluidStack(FluidRegistry.WATER, 1000), gemStack, dustStack, null, null, 100, 120)); + RecipeHandler.addRecipe(new GrinderRecipe(oreStack, new ItemStack(Items.water_bucket), null, gemStack, dustStack, null, new ItemStack(Items.bucket), 100, 120)); + } catch (Exception e) { + Core.logHelper.info("Failed to Load Grinder Recipe for Malachite Ore"); + } + } + + //Galena Ore + RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(ModBlocks.ore, 1, 0), null, new FluidStack(FluidRegistry.WATER, 1000), ItemDusts.getDustByName("galena", 2), ItemDustsSmall.getSmallDustByName("Sulfur", 1), ItemDustsSmall.getSmallDustByName("Silver", 1), null, 100, 120)); + RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(ModBlocks.ore, 1, 0), new ItemStack(Items.water_bucket), null, ItemDusts.getDustByName("galena", 2), ItemDustsSmall.getSmallDustByName("Sulfur", 1), ItemDustsSmall.getSmallDustByName("Silver", 1), new ItemStack(Items.bucket), 100, 120)); + + RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(ModBlocks.ore, 1, 0), null, new FluidStack(ModFluids.fluidMercury, 1000), ItemDusts.getDustByName("galena", 2), ItemDustsSmall.getSmallDustByName("Sulfur", 1), ItemDusts.getDustByName("silver", 1), null, 100, 120)); + RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(ModBlocks.ore, 1, 0), new ItemStack(ModItems.bucketMercury), null, ItemDusts.getDustByName("galena", 2), ItemDustsSmall.getSmallDustByName("Sulfur", 1), ItemDusts.getDustByName("silver", 1), new ItemStack(Items.bucket), 100, 120)); + + + //Ruby Ore + RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(ModBlocks.ore, 1, 2), null, new FluidStack(FluidRegistry.WATER, 1000), ItemGems.getGemByName("ruby", 1), ItemDustsSmall.getSmallDustByName("Ruby", 6), ItemDustsSmall.getSmallDustByName("Chrome", 2), null, 100, 120)); + RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(ModBlocks.ore, 1, 2), new ItemStack(Items.water_bucket), null, ItemGems.getGemByName("ruby", 1), ItemDustsSmall.getSmallDustByName("Ruby", 6), ItemDustsSmall.getSmallDustByName("Chrome", 2), new ItemStack(Items.bucket), 100, 120)); + + //Sapphire Ore + RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(ModBlocks.ore, 1, 3), null, new FluidStack(FluidRegistry.WATER, 1000), ItemGems.getGemByName("sapphire", 1), ItemDustsSmall.getSmallDustByName("Sapphire", 6), ItemDustsSmall.getSmallDustByName("Aluminum", 2), null, 100, 120)); + RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(ModBlocks.ore, 1, 3), new ItemStack(Items.water_bucket), null, ItemGems.getGemByName("sapphire", 1), ItemDustsSmall.getSmallDustByName("Sapphire", 6), ItemDustsSmall.getSmallDustByName("Aluminum", 2), new ItemStack(Items.bucket), 100, 120)); + + //Bauxite Ore + RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(ModBlocks.ore, 1, 4), null, new FluidStack(FluidRegistry.WATER, 1000), ItemDusts.getDustByName("bauxite", 2), ItemDustsSmall.getSmallDustByName("Grossular", 4), ItemDustsSmall.getSmallDustByName("Titanium", 4), null, 100, 120)); + RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(ModBlocks.ore, 1, 4), new ItemStack(Items.water_bucket), null, ItemDusts.getDustByName("bauxite", 2), ItemDustsSmall.getSmallDustByName("Grossular", 4), ItemDustsSmall.getSmallDustByName("Titanium", 4), new ItemStack(Items.bucket), 100, 120)); + + //Pyrite Ore + RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(ModBlocks.ore, 1, 5), null, new FluidStack(FluidRegistry.WATER, 1000), ItemDusts.getDustByName("pyrite", 2), ItemDustsSmall.getSmallDustByName("Sulfur", 1), ItemDustsSmall.getSmallDustByName("Phosphorous", 1), null, 100, 120)); + RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(ModBlocks.ore, 1, 5), new ItemStack(Items.water_bucket), null, ItemDusts.getDustByName("pyrite", 2), ItemDustsSmall.getSmallDustByName("Sulfur", 1), ItemDustsSmall.getSmallDustByName("Phosphorous", 1), new ItemStack(Items.bucket), 100, 120)); + + //Cinnabar Ore + RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(ModBlocks.ore, 1, 6), null, new FluidStack(FluidRegistry.WATER, 1000), ItemDusts.getDustByName("cinnabar", 2), ItemDustsSmall.getSmallDustByName("Redstone", 1), ItemDustsSmall.getSmallDustByName("Glowstone", 1), null, 100, 120)); + RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(ModBlocks.ore, 1, 6), new ItemStack(Items.water_bucket), null, ItemDusts.getDustByName("cinnabar", 2), ItemDustsSmall.getSmallDustByName("Redstone", 1), ItemDustsSmall.getSmallDustByName("Glowstone", 1), new ItemStack(Items.bucket), 100, 120)); + + //Sphalerite Ore + RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(ModBlocks.ore, 1, 7), null, new FluidStack(FluidRegistry.WATER, 1000), ItemDusts.getDustByName("sphalerite", 2), ItemDustsSmall.getSmallDustByName("Zinc", 1), ItemDustsSmall.getSmallDustByName("YellowGarnet", 1), null, 100, 120)); + RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(ModBlocks.ore, 1, 7), new ItemStack(Items.water_bucket), null, ItemDusts.getDustByName("sphalerite", 2), ItemDustsSmall.getSmallDustByName("Zinc", 1), ItemDustsSmall.getSmallDustByName("YellowGarnet", 1), new ItemStack(Items.bucket), 100, 120)); + + RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(ModBlocks.ore, 1, 7), null, new FluidStack(ModFluids.fluidSodiumpersulfate, 1000), ItemDusts.getDustByName("sphalerite", 2), ItemDusts.getDustByName("zinc", 1), ItemDustsSmall.getSmallDustByName("YellowGarnet", 1), null, 100, 120)); + RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(ModBlocks.ore, 1, 7), new ItemStack(ModItems.bucketSodiumpersulfate), null, ItemDusts.getDustByName("sphalerite", 2), ItemDusts.getDustByName("zinc", 1), ItemDustsSmall.getSmallDustByName("YellowGarnet", 1), new ItemStack(Items.bucket), 100, 120)); + + //Tungsten Ore + RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(ModBlocks.ore, 1, 8), null, new FluidStack(FluidRegistry.WATER, 1000), ItemDusts.getDustByName("tungsten", 2), ItemDustsSmall.getSmallDustByName("Manganese", 1), ItemDustsSmall.getSmallDustByName("Silver", 1), null, 100, 120)); + RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(ModBlocks.ore, 1, 8), new ItemStack(Items.water_bucket), null, ItemDusts.getDustByName("tungsten", 2), ItemDustsSmall.getSmallDustByName("Manganese", 1), ItemDustsSmall.getSmallDustByName("Silver", 1), new ItemStack(Items.bucket), 100, 120)); + + RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(ModBlocks.ore, 1, 8), null, new FluidStack(ModFluids.fluidMercury, 1000), ItemDusts.getDustByName("tungsten", 2), ItemDustsSmall.getSmallDustByName("Manganese", 1), ItemDusts.getDustByName("silver", 2), null, 100, 120)); + RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(ModBlocks.ore, 1, 8), new ItemStack(ModItems.bucketMercury), null, ItemDusts.getDustByName("tungsten", 2), ItemDustsSmall.getSmallDustByName("Manganese", 1), ItemDusts.getDustByName("silver", 2), new ItemStack(Items.bucket), 100, 120)); + + //Sheldonite Ore + RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(ModBlocks.ore, 1, 9), null, new FluidStack(FluidRegistry.WATER, 1000), ItemDusts.getDustByName("platinum", 2), ItemDustsSmall.getSmallDustByName("Iridium", 1), ItemDustsSmall.getSmallDustByName("Iridium", 1), null, 100, 120)); + RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(ModBlocks.ore, 1, 9), new ItemStack(Items.water_bucket), null, ItemDusts.getDustByName("platinum", 2), ItemDustsSmall.getSmallDustByName("Iridium", 1), ItemDustsSmall.getSmallDustByName("Iridium", 1), new ItemStack(Items.bucket), 100, 120)); + + RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(ModBlocks.ore, 1, 9), null, new FluidStack(ModFluids.fluidMercury, 1000), ItemDusts.getDustByName("platinum", 3), ItemDustsSmall.getSmallDustByName("Iridium", 1), ItemDustsSmall.getSmallDustByName("Iridium", 1), null, 100, 120)); + RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(ModBlocks.ore, 1, 9), new ItemStack(ModItems.bucketMercury), null, ItemDusts.getDustByName("platinum", 3), ItemDustsSmall.getSmallDustByName("Iridium", 1), ItemDustsSmall.getSmallDustByName("Iridium", 1), new ItemStack(Items.bucket), 100, 120)); + + //Peridot Ore + RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(ModBlocks.ore, 1, 10), null, new FluidStack(FluidRegistry.WATER, 1000), ItemGems.getGemByName("peridot", 1), ItemDustsSmall.getSmallDustByName("Peridot", 6), ItemDustsSmall.getSmallDustByName("Pyrope", 2), null, 100, 120)); + RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(ModBlocks.ore, 1, 10), new ItemStack(Items.water_bucket), null, ItemGems.getGemByName("peridot", 1), ItemDustsSmall.getSmallDustByName("Peridot", 6), ItemDustsSmall.getSmallDustByName("Pyrope", 2), new ItemStack(Items.bucket), 100, 120)); + + //Sodalite Ore + RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(ModBlocks.ore, 1, 11), null, new FluidStack(FluidRegistry.WATER, 1000), ItemDusts.getDustByName("sodalite", 12), ItemDustsSmall.getSmallDustByName("Lazurite", 4), ItemDustsSmall.getSmallDustByName("Lapis", 4), null, 100, 120)); + RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(ModBlocks.ore, 1, 11), new ItemStack(Items.water_bucket), null, ItemDusts.getDustByName("sodalite", 12), ItemDustsSmall.getSmallDustByName("Lazurite", 4), ItemDustsSmall.getSmallDustByName("Lapis", 4), new ItemStack(Items.bucket), 100, 120)); + + //Tetrahedrite Ore + RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(ModBlocks.ore, 1, 12), null, new FluidStack(FluidRegistry.WATER, 1000), ItemDusts.getDustByName("tetrahedrite", 2), ItemDustsSmall.getSmallDustByName("Antimony", 1), ItemDustsSmall.getSmallDustByName("Zinc", 1), null, 100, 120)); + RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(ModBlocks.ore, 1, 12), new ItemStack(Items.water_bucket), null, ItemDusts.getDustByName("tetrahedrite", 2), ItemDustsSmall.getSmallDustByName("Antimony", 1), ItemDustsSmall.getSmallDustByName("Zinc", 1), new ItemStack(Items.bucket), 100, 120)); + + RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(ModBlocks.ore, 1, 12), null, new FluidStack(ModFluids.fluidSodiumpersulfate, 1000), ItemDusts.getDustByName("tetrahedrite", 3), ItemDustsSmall.getSmallDustByName("Antimony", 1), ItemDustsSmall.getSmallDustByName("Zinc", 1), null, 100, 120)); + RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(ModBlocks.ore, 1, 12), new ItemStack(ModItems.bucketSodiumpersulfate), null, ItemDusts.getDustByName("tetrahedrite", 3), ItemDustsSmall.getSmallDustByName("Antimony", 1), ItemDustsSmall.getSmallDustByName("Zinc", 1), new ItemStack(Items.bucket), 100, 120)); + } + + static void addImplosionCompressorRecipes() { + } + + static void addChemicalReactorRecipes() { + RecipeHandler.addRecipe(new ChemicalReactorRecipe(ItemCells.getCellByName("calcium", 1), ItemCells.getCellByName("carbon", 1), ItemCells.getCellByName("calciumCarbonate", 2), 240, 30)); + RecipeHandler.addRecipe(new ChemicalReactorRecipe(new ItemStack(Items.gold_nugget, 8), new ItemStack(Items.melon, 1), new ItemStack(Items.speckled_melon, 1), 40, 30)); + RecipeHandler.addRecipe(new ChemicalReactorRecipe(ItemCells.getCellByName("nitrogen", 1), ItemCells.getCellByName("carbon", 1), ItemCells.getCellByName("nitrocarbon", 2), 1500, 30)); + RecipeHandler.addRecipe(new ChemicalReactorRecipe(ItemCells.getCellByName("carbon", 1), ItemCells.getCellByName("hydrogen", 4), ItemCells.getCellByName("methane", 5), 3500, 30)); + RecipeHandler.addRecipe(new ChemicalReactorRecipe(ItemCells.getCellByName("sulfur", 1), ItemCells.getCellByName("sodium", 1), ItemCells.getCellByName("sodiumSulfide", 2), 100, 30)); + RecipeHandler.addRecipe(new ChemicalReactorRecipe(new ItemStack(Items.blaze_powder, 1), new ItemStack(Items.ender_pearl, 1), new ItemStack(Items.ender_eye, 1), 40, 30)); + RecipeHandler.addRecipe(new ChemicalReactorRecipe(new ItemStack(Items.gold_nugget, 8), new ItemStack(Items.carrot, 1), new ItemStack(Items.golden_carrot, 1), 40, 30)); + RecipeHandler.addRecipe(new ChemicalReactorRecipe(ItemCells.getCellByName("glyceryl", 1), ItemCells.getCellByName("diesel", 4), ItemCells.getCellByName("nitroDiesel", 5), 1000, 30)); + RecipeHandler.addRecipe(new ChemicalReactorRecipe(new ItemStack(Items.gold_ingot, 8), new ItemStack(Items.apple, 1), new ItemStack(Items.golden_apple, 1), 40, 30)); + RecipeHandler.addRecipe(new ChemicalReactorRecipe(new ItemStack(Blocks.gold_block, 8), new ItemStack(Items.apple, 1), new ItemStack(Items.golden_apple, 1, 1), 40, 30)); + RecipeHandler.addRecipe(new ChemicalReactorRecipe(new ItemStack(Items.blaze_powder, 1), new ItemStack(Items.slime_ball, 1), new ItemStack(Items.magma_cream, 1), 40, 30)); + } + + static void addIndustrialElectrolyzerRecipes() { + + + RecipeHandler.addRecipe(new IndustrialElectrolyzerRecipe( + ItemCells.getCellByName("nitrocarbon", 2), + null, + ItemCells.getCellByName("nitrogen"), + ItemCells.getCellByName("carbon"), + null, + null, + 80, 60 + )); + + RecipeHandler.addRecipe(new IndustrialElectrolyzerRecipe( + ItemDusts.getDustByName("pyrite", 3), + null, + ItemDusts.getDustByName("iron"), + ItemDusts.getDustByName("sulfur"), + null, + null, + 120, 128 + )); + + RecipeHandler.addRecipe(new IndustrialElectrolyzerRecipe( + ItemDusts.getDustByName("sphalerite", 2), + null, + ItemDusts.getDustByName("zinc"), + ItemDusts.getDustByName("sulfur"), + null, + null, + 150, 100 + )); + + + } } diff --git a/src/main/java/techreborn/itemblocks/ItemBlockBase.java b/src/main/java/techreborn/itemblocks/ItemBlockBase.java deleted file mode 100644 index 687321adb..000000000 --- a/src/main/java/techreborn/itemblocks/ItemBlockBase.java +++ /dev/null @@ -1,33 +0,0 @@ -package techreborn.itemblocks; - -import net.minecraft.block.Block; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemMultiTexture; -import net.minecraft.item.ItemStack; -import net.minecraft.stats.Achievement; -import techreborn.achievement.ICraftAchievement; -import techreborn.achievement.IPickupAchievement; - -public class ItemBlockBase extends ItemMultiTexture implements IPickupAchievement, ICraftAchievement { - public ItemBlockBase(Block p_i45346_1_, Block p_i45346_2_, - String[] p_i45346_3_) { - super(p_i45346_1_, p_i45346_2_, p_i45346_3_); - } - - @Override - public Achievement getAchievementOnCraft(ItemStack stack, - EntityPlayer player, IInventory matrix) { - return field_150939_a instanceof ICraftAchievement ? ((ICraftAchievement) field_150939_a) - .getAchievementOnCraft(stack, player, matrix) : null; - } - - @Override - public Achievement getAchievementOnPickup(ItemStack stack, - EntityPlayer player, EntityItem item) { - return field_150939_a instanceof IPickupAchievement ? ((IPickupAchievement) field_150939_a) - .getAchievementOnPickup(stack, player, item) : null; - } - -} diff --git a/src/main/java/techreborn/itemblocks/ItemBlockMachineFrame.java b/src/main/java/techreborn/itemblocks/ItemBlockMachineFrame.java index a8a2ab740..c654c7fdf 100644 --- a/src/main/java/techreborn/itemblocks/ItemBlockMachineFrame.java +++ b/src/main/java/techreborn/itemblocks/ItemBlockMachineFrame.java @@ -1,6 +1,7 @@ package techreborn.itemblocks; import net.minecraft.block.Block; +import reborncore.common.itemblock.ItemBlockBase; import techreborn.blocks.BlockMachineFrame; import techreborn.init.ModBlocks; diff --git a/src/main/java/techreborn/itemblocks/ItemBlockOre.java b/src/main/java/techreborn/itemblocks/ItemBlockOre.java index 30c4eb62d..a979c98d7 100644 --- a/src/main/java/techreborn/itemblocks/ItemBlockOre.java +++ b/src/main/java/techreborn/itemblocks/ItemBlockOre.java @@ -1,6 +1,7 @@ package techreborn.itemblocks; import net.minecraft.block.Block; +import reborncore.common.itemblock.ItemBlockBase; import techreborn.blocks.BlockOre; import techreborn.init.ModBlocks; diff --git a/src/main/java/techreborn/itemblocks/ItemBlockStorage.java b/src/main/java/techreborn/itemblocks/ItemBlockStorage.java index 80025ed8e..f52577465 100644 --- a/src/main/java/techreborn/itemblocks/ItemBlockStorage.java +++ b/src/main/java/techreborn/itemblocks/ItemBlockStorage.java @@ -1,6 +1,7 @@ package techreborn.itemblocks; import net.minecraft.block.Block; +import reborncore.common.itemblock.ItemBlockBase; import techreborn.blocks.BlockStorage; import techreborn.init.ModBlocks; diff --git a/src/main/java/techreborn/itemblocks/ItemBlockStorage2.java b/src/main/java/techreborn/itemblocks/ItemBlockStorage2.java index 34dda2afb..ee67ca4a1 100644 --- a/src/main/java/techreborn/itemblocks/ItemBlockStorage2.java +++ b/src/main/java/techreborn/itemblocks/ItemBlockStorage2.java @@ -1,6 +1,7 @@ package techreborn.itemblocks; import net.minecraft.block.Block; +import reborncore.common.itemblock.ItemBlockBase; import techreborn.blocks.BlockStorage2; import techreborn.init.ModBlocks; diff --git a/src/main/java/techreborn/items/ItemCells.java b/src/main/java/techreborn/items/ItemCells.java index 48c2b92f8..a6619a894 100644 --- a/src/main/java/techreborn/items/ItemCells.java +++ b/src/main/java/techreborn/items/ItemCells.java @@ -10,9 +10,9 @@ import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.IFluidContainerItem; +import techreborn.Core; import techreborn.client.TechRebornCreativeTab; import techreborn.init.ModItems; -import techreborn.util.LogHelper; import java.util.List; @@ -35,7 +35,7 @@ public class ItemCells extends ItemTR { return stack; } } else { - LogHelper.debug("Could not find " + "fluid" + name + " in the fluid registry!"); + Core.logHelper.debug("Could not find " + "fluid" + name + " in the fluid registry!"); } } int index = -1; diff --git a/src/main/java/techreborn/items/ItemParts.java b/src/main/java/techreborn/items/ItemParts.java index a186db5cf..379ba4822 100644 --- a/src/main/java/techreborn/items/ItemParts.java +++ b/src/main/java/techreborn/items/ItemParts.java @@ -41,7 +41,7 @@ public class ItemParts extends Item implements IReactorComponent { "laserFocus", "ductTape", "lazuriteChunk", "iridiumAlloyIngot", "rockCutterBlade", "superConductor", "thoriumCell", "doubleThoriumCell", "quadThoriumCell", "plutoniumCell", "doublePlutoniumCell", "quadPlutoniumCell", "destructoPack", "iridiumNeutronReflector", "massHoleDevice", "computerMonitor" - ,"machineParts"}; + , "machineParts"}; private IIcon[] textures; diff --git a/src/main/java/techreborn/items/armor/ItemLapotronPack.java b/src/main/java/techreborn/items/armor/ItemLapotronPack.java index ff132e004..28575f04c 100644 --- a/src/main/java/techreborn/items/armor/ItemLapotronPack.java +++ b/src/main/java/techreborn/items/armor/ItemLapotronPack.java @@ -2,20 +2,13 @@ package techreborn.items.armor; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import ic2.api.item.ElectricItem; -import ic2.api.item.IElectricItem; import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; -import net.minecraft.item.Item; -import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemStack; import techreborn.client.TechRebornCreativeTab; import techreborn.config.ConfigTechReborn; import techreborn.powerSystem.PoweredArmor; -import java.util.List; - public class ItemLapotronPack extends PoweredArmor { public static final int maxCharge = ConfigTechReborn.LapotronPackCharge; diff --git a/src/main/java/techreborn/items/armor/ItemLithiumBatpack.java b/src/main/java/techreborn/items/armor/ItemLithiumBatpack.java index a6ea2a1a5..7a97c0455 100644 --- a/src/main/java/techreborn/items/armor/ItemLithiumBatpack.java +++ b/src/main/java/techreborn/items/armor/ItemLithiumBatpack.java @@ -2,20 +2,13 @@ package techreborn.items.armor; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import ic2.api.item.ElectricItem; -import ic2.api.item.IElectricItem; import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; -import net.minecraft.item.Item; -import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemStack; import techreborn.client.TechRebornCreativeTab; import techreborn.config.ConfigTechReborn; import techreborn.powerSystem.PoweredArmor; -import java.util.List; - public class ItemLithiumBatpack extends PoweredArmor { public static final int maxCharge = ConfigTechReborn.LithiumBatpackCharge; diff --git a/src/main/java/techreborn/items/tools/ItemAdvancedDrill.java b/src/main/java/techreborn/items/tools/ItemAdvancedDrill.java index 4fc34cf7e..6ff9d6ced 100644 --- a/src/main/java/techreborn/items/tools/ItemAdvancedDrill.java +++ b/src/main/java/techreborn/items/tools/ItemAdvancedDrill.java @@ -3,23 +3,17 @@ package techreborn.items.tools; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import ic2.api.item.ElectricItem; -import ic2.api.item.IElectricItem; import net.minecraft.block.Block; 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.init.Items; -import net.minecraft.item.Item; -import net.minecraft.item.ItemPickaxe; import net.minecraft.item.ItemStack; import net.minecraft.world.World; +import reborncore.common.util.TorchHelper; import techreborn.client.TechRebornCreativeTab; import techreborn.config.ConfigTechReborn; import techreborn.powerSystem.PoweredPickaxe; -import techreborn.util.TorchHelper; - -import java.util.List; public class ItemAdvancedDrill extends PoweredPickaxe { diff --git a/src/main/java/techreborn/items/tools/ItemCloakingDevice.java b/src/main/java/techreborn/items/tools/ItemCloakingDevice.java index 78533d74a..17a52a945 100644 --- a/src/main/java/techreborn/items/tools/ItemCloakingDevice.java +++ b/src/main/java/techreborn/items/tools/ItemCloakingDevice.java @@ -3,10 +3,8 @@ package techreborn.items.tools; 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.Entity; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.potion.Potion; import net.minecraft.world.World; @@ -14,8 +12,6 @@ import techreborn.client.TechRebornCreativeTab; import techreborn.config.ConfigTechReborn; import techreborn.powerSystem.PoweredItem; -import java.util.List; - public class ItemCloakingDevice extends PoweredItem { public static int Teir = ConfigTechReborn.CloakingDeviceTier; public static int MaxCharge = ConfigTechReborn.CloakingDeviceCharge; @@ -31,7 +27,7 @@ public class ItemCloakingDevice extends PoweredItem { @Override public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) { - if(canUseEnergy(ConfigTechReborn.CloakingDeviceEUTick, itemStack)){ + if (canUseEnergy(ConfigTechReborn.CloakingDeviceEUTick, itemStack)) { useEnergy(ConfigTechReborn.CloakingDeviceEUTick, itemStack); player.setInvisible(true); } else { diff --git a/src/main/java/techreborn/items/tools/ItemOmniTool.java b/src/main/java/techreborn/items/tools/ItemOmniTool.java index 94b9ae00c..8e4d13b5e 100644 --- a/src/main/java/techreborn/items/tools/ItemOmniTool.java +++ b/src/main/java/techreborn/items/tools/ItemOmniTool.java @@ -4,23 +4,18 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; 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.init.Items; -import net.minecraft.item.Item; -import net.minecraft.item.ItemPickaxe; import net.minecraft.item.ItemStack; import net.minecraft.util.DamageSource; import net.minecraft.world.World; +import reborncore.common.util.TorchHelper; import techreborn.client.TechRebornCreativeTab; import techreborn.config.ConfigTechReborn; import techreborn.powerSystem.PoweredPickaxe; -import techreborn.util.TorchHelper; -import java.util.List; - -public class ItemOmniTool extends PoweredPickaxe{ +public class ItemOmniTool extends PoweredPickaxe { public static final int maxCharge = ConfigTechReborn.OmniToolCharge; public static final int tier = ConfigTechReborn.OmniToolTier; @@ -98,7 +93,6 @@ public class ItemOmniTool extends PoweredPickaxe{ } - @Override public double getMaxPower(ItemStack stack) { return maxCharge; diff --git a/src/main/java/techreborn/items/tools/ItemRockCutter.java b/src/main/java/techreborn/items/tools/ItemRockCutter.java index 80b1189bb..03a5b2af3 100644 --- a/src/main/java/techreborn/items/tools/ItemRockCutter.java +++ b/src/main/java/techreborn/items/tools/ItemRockCutter.java @@ -4,17 +4,15 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; import net.minecraft.enchantment.Enchantment; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; +import reborncore.common.util.Color; import techreborn.client.TechRebornCreativeTab; import techreborn.config.ConfigTechReborn; import techreborn.powerSystem.PoweredPickaxe; -import techreborn.util.Color; import java.util.List; @@ -53,7 +51,7 @@ public class ItemRockCutter extends PoweredPickaxe { @Override public boolean canHarvestBlock(Block block, ItemStack stack) { - if(Items.diamond_pickaxe.canHarvestBlock(block, stack)) { + if (Items.diamond_pickaxe.canHarvestBlock(block, stack)) { if (canUseEnergy(cost, stack)) { useEnergy(cost, stack); return true; diff --git a/src/main/java/techreborn/lib/Functions.java b/src/main/java/techreborn/lib/Functions.java deleted file mode 100644 index a025d3576..000000000 --- a/src/main/java/techreborn/lib/Functions.java +++ /dev/null @@ -1,45 +0,0 @@ -package techreborn.lib; - -import net.minecraftforge.common.util.ForgeDirection; - -public class Functions { - public static int getIntDirFromDirection(ForgeDirection dir) { - switch (dir) { - case DOWN: - return 0; - case EAST: - return 5; - case NORTH: - return 2; - case SOUTH: - return 3; - case UNKNOWN: - return 0; - case UP: - return 1; - case WEST: - return 4; - default: - return 0; - } - } - - public static ForgeDirection getDirectionFromInt(int dir) { - int metaDataToSet = 0; - switch (dir) { - case 0: - metaDataToSet = 2; - break; - case 1: - metaDataToSet = 4; - break; - case 2: - metaDataToSet = 3; - break; - case 3: - metaDataToSet = 5; - break; - } - return ForgeDirection.getOrientation(metaDataToSet); - } -} diff --git a/src/main/java/techreborn/lib/Location.java b/src/main/java/techreborn/lib/Location.java deleted file mode 100644 index b026708e9..000000000 --- a/src/main/java/techreborn/lib/Location.java +++ /dev/null @@ -1,256 +0,0 @@ -package techreborn.lib; - -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.world.ChunkPosition; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; - -public class Location implements Comparable { - public int x; - public int y; - public int z; - public int depth; - - public Location(int x, int y, int z) { - this.x = x; - this.y = y; - this.z = z; - } - - public Location(int x, int y, int z, int depth) { - this.x = x; - this.y = y; - this.z = z; - this.depth = depth; - } - - public Location(int xCoord, int yCoord, int zCoord, ForgeDirection dir) { - this.x = xCoord + dir.offsetX; - this.y = yCoord + dir.offsetY; - this.z = zCoord + dir.offsetZ; - } - - public Location(int[] coords) { - if (coords.length >= 2) { - this.x = coords[0]; - this.y = coords[1]; - this.z = coords[2]; - } - } - - public Location(ChunkPosition pos) { - if (pos != null) { - this.x = pos.chunkPosX; - this.y = pos.chunkPosY; - this.z = pos.chunkPosZ; - } - } - - public Location(MovingObjectPosition blockLookedAt) { - if (blockLookedAt != null) { - this.x = blockLookedAt.blockX; - this.y = blockLookedAt.blockY; - this.z = blockLookedAt.blockZ; - } - } - - public Location(TileEntity par1) { - this.x = par1.xCoord; - this.y = par1.yCoord; - this.z = par1.zCoord; - } - - public boolean equals(Location toTest) { - if (this.x == toTest.x && this.y == toTest.y && this.z == toTest.z) { - return true; - } - return false; - } - - public void setLocation(int x, int y, int z) { - this.x = x; - this.y = y; - this.z = z; - } - - public int getX() { - return this.x; - } - - public void setX(int newX) { - this.x = newX; - } - - public int getY() { - return this.y; - } - - public void setY(int newY) { - this.y = newY; - } - - public int getZ() { - return this.z; - } - - public void setZ(int newZ) { - this.z = newZ; - } - - public int[] getLocation() { - int[] ret = new int[3]; - ret[0] = this.x; - ret[1] = this.y; - ret[2] = this.z; - return ret; - } - - public void setLocation(int[] coords) { - this.x = coords[0]; - this.y = coords[1]; - this.z = coords[2]; - } - - public int getDifference(Location otherLoc) { - return (int) Math.sqrt(Math.pow(this.x - otherLoc.x, 2) - + Math.pow(this.y - otherLoc.y, 2) - + Math.pow(this.z - otherLoc.z, 2)); - } - - public String printLocation() { - return "X: " + this.x + " Y: " + this.y + " Z: " + this.z; - } - - public String printCoords() { - return this.x + ", " + this.y + ", " + this.z; - } - - public boolean compare(int x, int y, int z) { - return (this.x == x && this.y == y && this.z == z); - } - - public Location getLocation(ForgeDirection dir) { - return new Location(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ); - } - - public Location modifyPositionFromSide(ForgeDirection side, int amount) { - switch (side.ordinal()) { - case 0: - this.y -= amount; - break; - case 1: - this.y += amount; - break; - case 2: - this.z -= amount; - break; - case 3: - this.z += amount; - break; - case 4: - this.x -= amount; - break; - case 5: - this.x += amount; - break; - } - return this; - } - - public Location modifyPositionFromSide(ForgeDirection side) { - return this.modifyPositionFromSide(side, 1); - } - - /** - * This will load the chunk. - */ - public TileEntity getTileEntity(IBlockAccess world) { - return world.getTileEntity(this.x, this.y, this.z); - } - - public final Location clone() { - return new Location(this.x, this.y, this.z); - } - - /** - * No chunk load: returns null if chunk to side is unloaded - */ - public TileEntity getTileEntityOnSide(World world, ForgeDirection side) { - int x = this.x; - int y = this.y; - int z = this.z; - switch (side.ordinal()) { - case 0: - y--; - break; - case 1: - y++; - break; - case 2: - z--; - break; - case 3: - z++; - break; - case 4: - x--; - break; - case 5: - x++; - break; - default: - return null; - } - if (world.blockExists(x, y, z)) { - return world.getTileEntity(x, y, z); - } else { - return null; - } - } - - /** - * No chunk load: returns null if chunk to side is unloaded - */ - public TileEntity getTileEntityOnSide(World world, int side) { - int x = this.x; - int y = this.y; - int z = this.z; - switch (side) { - case 0: - y--; - break; - case 1: - y++; - break; - case 2: - z--; - break; - case 3: - z++; - break; - case 4: - x--; - break; - case 5: - x++; - break; - default: - return null; - } - if (world.blockExists(x, y, z)) { - return world.getTileEntity(x, y, z); - } else { - return null; - } - } - - public int getDepth() { - return depth; - } - - public int compareTo(Location o) { - return ((Integer) depth).compareTo(o.depth); - } -} diff --git a/src/main/java/techreborn/lib/ModInfo.java b/src/main/java/techreborn/lib/ModInfo.java index 79886889d..09ca856c5 100644 --- a/src/main/java/techreborn/lib/ModInfo.java +++ b/src/main/java/techreborn/lib/ModInfo.java @@ -1,19 +1,40 @@ package techreborn.lib; import net.minecraft.util.StatCollector; +import reborncore.common.IModInfo; -public class ModInfo { +public class ModInfo implements IModInfo { public static final String MOD_NAME = "TechReborn"; public static final String MOD_ID = "techreborn"; public static final String MOD_VERSION = "@MODVERSION@"; public static final String MOD_DEPENDENCUIES = - "required-after:Forge@[10.13.3.1374,)"; + "required-after:Forge@[10.13.3.1374,);required-after:reborncore"; public static final String SERVER_PROXY_CLASS = "techreborn.proxies.CommonProxy"; public static final String CLIENT_PROXY_CLASS = "techreborn.proxies.ClientProxy"; public static final String GUI_FACTORY_CLASS = "techreborn.config.TechRebornGUIFactory"; public static final String MISSING_MULTIBLOCK = StatCollector.translateToLocal("techreborn.message.missingmultiblock"); + @Override + public String MOD_NAME() { + return MOD_NAME; + } + + @Override + public String MOD_ID() { + return MOD_ID; + } + + @Override + public String MOD_VERSION() { + return MOD_VERSION; + } + + @Override + public String MOD_DEPENDENCUIES() { + return MOD_DEPENDENCUIES; + } + public static final class Keys { public static final String CATEGORY = "keys.techreborn.category"; public static final String CONFIG = "keys.techreborn.config"; diff --git a/src/main/java/techreborn/lib/vecmath/Vecs3d.java b/src/main/java/techreborn/lib/vecmath/Vecs3d.java deleted file mode 100644 index 2a89bdeb5..000000000 --- a/src/main/java/techreborn/lib/vecmath/Vecs3d.java +++ /dev/null @@ -1,435 +0,0 @@ -package techreborn.lib.vecmath; - -import cpw.mods.fml.common.FMLCommonHandler; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.block.Block; -import net.minecraft.block.material.Material; -import net.minecraft.client.Minecraft; -import net.minecraft.init.Blocks; -import net.minecraft.server.MinecraftServer; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.Vec3; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; - -import java.util.StringTokenizer; - -public class Vecs3d { - protected double x, y, z; - protected World w = null; - - public Vecs3d(double x, double y, double z) { - - this.x = x; - this.y = y; - this.z = z; - } - - public Vecs3d(double x, double y, double z, World w) { - - this(x, y, z); - this.w = w; - } - - public Vecs3d(TileEntity te) { - - this(te.xCoord, te.yCoord, te.zCoord, te.getWorldObj()); - } - - public Vecs3d(Vec3 vec) { - - this(vec.xCoord, vec.yCoord, vec.zCoord); - } - - public Vecs3d(Vec3 vec, World w) { - - this(vec.xCoord, vec.yCoord, vec.zCoord); - this.w = w; - } - - public boolean hasWorld() { - - return w != null; - } - - public Vecs3d add(double x, double y, double z) { - - this.x += x; - this.y += y; - this.z += z; - return this; - } - - public Vecs3d add(ForgeDirection dir) { - - return add(dir.offsetX, dir.offsetY, dir.offsetZ); - } - - public Vecs3d add(Vecs3d vec) { - - return add(vec.x, vec.y, vec.z); - } - - public Vecs3d sub(double x, double y, double z) { - - this.x -= x; - this.y -= y; - this.z -= z; - return this; - } - - public Vecs3d sub(ForgeDirection dir) { - - return sub(dir.offsetX, dir.offsetY, dir.offsetZ); - } - - public Vecs3d sub(Vecs3d vec) { - - return sub(vec.x, vec.y, vec.z); - } - - public Vecs3d mul(double x, double y, double z) { - - this.x *= x; - this.y *= y; - this.z *= z; - return this; - } - - public Vecs3d mul(double multiplier) { - - return mul(multiplier, multiplier, multiplier); - } - - public Vecs3d mul(ForgeDirection direction) { - - return mul(direction.offsetX, direction.offsetY, direction.offsetZ); - } - - public Vecs3d multiply(Vecs3d v) { - - return mul(v.getX(), v.getY(), v.getZ()); - } - - public Vecs3d div(double x, double y, double z) { - - this.x /= x; - this.y /= y; - this.z /= z; - return this; - } - - public Vecs3d div(double multiplier) { - - return div(multiplier, multiplier, multiplier); - } - - public Vecs3d div(ForgeDirection direction) { - - return div(direction.offsetX, direction.offsetY, direction.offsetZ); - } - - public double length() { - - return Math.sqrt(x * x + y * y + z * z); - } - - public Vecs3d normalize() { - - Vecs3d v = clone(); - - double len = length(); - - if (len == 0) - return v; - - v.x /= len; - v.y /= len; - v.z /= len; - - return v; - } - - public Vecs3d abs() { - - return new Vecs3d(Math.abs(x), Math.abs(y), Math.abs(z)); - } - - public double dot(Vecs3d v) { - - return x * v.getX() + y * v.getY() + z * v.getZ(); - } - - public Vecs3d cross(Vecs3d v) { - - return new Vecs3d(y * v.getZ() - z * v.getY(), x * v.getZ() - z - * v.getX(), x * v.getY() - y * v.getX()); - } - - public Vecs3d getRelative(double x, double y, double z) { - - return clone().add(x, y, z); - } - - public Vecs3d getRelative(ForgeDirection dir) { - - return getRelative(dir.offsetX, dir.offsetY, dir.offsetZ); - } - - public ForgeDirection getDirectionTo(Vecs3d vec) { - - for (ForgeDirection d : ForgeDirection.VALID_DIRECTIONS) - if (getBlockX() + d.offsetX == vec.getBlockX() - && getBlockY() + d.offsetY == vec.getBlockY() - && getBlockZ() + d.offsetZ == vec.getBlockZ()) - return d; - return null; - } - - public boolean isZero() { - - return x == 0 && y == 0 && z == 0; - } - - @Override - public Vecs3d clone() { - - return new Vecs3d(x, y, z, w); - } - - public boolean hasTileEntity() { - - if (hasWorld()) { - return w.getTileEntity((int) x, (int) y, (int) z) != null; - } - return false; - } - - public TileEntity getTileEntity() { - - if (hasTileEntity()) { - return w.getTileEntity((int) x, (int) y, (int) z); - } - return null; - } - - public boolean isBlock(Block b) { - - return isBlock(b, false); - } - - public boolean isBlock(Block b, boolean checkAir) { - - if (hasWorld()) { - Block bl = w.getBlock((int) x, (int) y, (int) z); - - if (b == null && bl == Blocks.air) - return true; - if (b == null && checkAir && bl.getMaterial() == Material.air) - return true; - if (b == null && checkAir && bl.isAir(w, (int) x, (int) y, (int) z)) - return true; - - return bl.getClass().isInstance(b); - } - return false; - } - - public int getBlockMeta() { - - if (hasWorld()) { - return w.getBlockMetadata((int) x, (int) y, (int) z); - } - return -1; - } - - public Block getBlock() { - - return getBlock(false); - } - - public Block getBlock(boolean airIsNull) { - - if (hasWorld()) { - if (airIsNull && isBlock(null, true)) - return null; - return w.getBlock((int) x, (int) y, (int) z); - - } - return null; - } - - public World getWorld() { - - return w; - } - - public Vecs3d setWorld(World world) { - - w = world; - - return this; - } - - public double getX() { - - return x; - } - - public double getY() { - - return y; - } - - public double getZ() { - - return z; - } - - public int getBlockX() { - - return (int) Math.floor(x); - } - - public int getBlockY() { - - return (int) Math.floor(y); - } - - public int getBlockZ() { - - return (int) Math.floor(z); - } - - public double distanceTo(Vecs3d vec) { - - return distanceTo(vec.x, vec.y, vec.z); - } - - public double distanceTo(double x, double y, double z) { - - double dx = x - this.x; - double dy = y - this.y; - double dz = z - this.z; - return dx * dx + dy * dy + dz * dz; - } - - public void setX(double x) { - - this.x = x; - } - - public void setY(double y) { - - this.y = y; - } - - public void setZ(double z) { - - this.z = z; - } - - @Override - public boolean equals(Object obj) { - - if (obj instanceof Vecs3d) { - Vecs3d vec = (Vecs3d) obj; - return vec.w == w && vec.x == x && vec.y == y && vec.z == z; - } - return false; - } - - @Override - public int hashCode() { - - return new Double(x).hashCode() + new Double(y).hashCode() << 8 + new Double( - z).hashCode() << 16; - } - - public Vec3 toVec3() { - - return Vec3.createVectorHelper(x, y, z); - } - - @Override - public String toString() { - - String s = "Vector3{"; - if (hasWorld()) - s += "w=" + w.provider.dimensionId + ";"; - s += "x=" + x + ";y=" + y + ";z=" + z + "}"; - return s; - } - - public ForgeDirection toForgeDirection() { - - if (z == 1) - return ForgeDirection.SOUTH; - if (z == -1) - return ForgeDirection.NORTH; - - if (x == 1) - return ForgeDirection.EAST; - if (x == -1) - return ForgeDirection.WEST; - - if (y == 1) - return ForgeDirection.UP; - if (y == -1) - return ForgeDirection.DOWN; - - return ForgeDirection.UNKNOWN; - } - - public static Vecs3d fromString(String s) { - - if (s.startsWith("Vector3{") && s.endsWith("}")) { - World w = null; - double x = 0, y = 0, z = 0; - String s2 = s.substring(s.indexOf("{") + 1, s.lastIndexOf("}")); - StringTokenizer st = new StringTokenizer(s2, ";"); - while (st.hasMoreTokens()) { - String t = st.nextToken(); - - if (t.toLowerCase().startsWith("w")) { - int world = Integer.parseInt(t.split("=")[1]); - if (FMLCommonHandler.instance().getEffectiveSide() - .isServer()) { - for (World wo : MinecraftServer.getServer().worldServers) { - if (wo.provider.dimensionId == world) { - w = wo; - break; - } - } - } else { - w = getClientWorld(world); - } - } - - if (t.toLowerCase().startsWith("x")) - x = Double.parseDouble(t.split("=")[1]); - if (t.toLowerCase().startsWith("y")) - y = Double.parseDouble(t.split("=")[1]); - if (t.toLowerCase().startsWith("z")) - z = Double.parseDouble(t.split("=")[1]); - } - - if (w != null) { - return new Vecs3d(x, y, z, w); - } else { - return new Vecs3d(x, y, z); - } - } - return null; - } - - @SideOnly(Side.CLIENT) - private static World getClientWorld(int world) { - - if (Minecraft.getMinecraft().theWorld.provider.dimensionId != world) - return null; - return Minecraft.getMinecraft().theWorld; - } - -} \ No newline at end of file diff --git a/src/main/java/techreborn/lib/vecmath/Vecs3dCube.java b/src/main/java/techreborn/lib/vecmath/Vecs3dCube.java deleted file mode 100644 index dd270d905..000000000 --- a/src/main/java/techreborn/lib/vecmath/Vecs3dCube.java +++ /dev/null @@ -1,165 +0,0 @@ -package techreborn.lib.vecmath; - -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.world.World; - -import java.util.List; - -public class Vecs3dCube { - - private Vecs3d min, max; - - public Vecs3dCube(double minX, double minY, double minZ, double maxX, - double maxY, double maxZ) { - - this(minX, minY, minZ, maxX, maxY, maxZ, (World) null); - } - - public Vecs3dCube(double minX, double minY, double minZ, double maxX, - double maxY, double maxZ, World world) { - - this(new Vecs3d(minX, minY, minZ, world), new Vecs3d(maxX, maxY, maxZ, - world)); - } - - public Vecs3dCube(Vecs3d a, Vecs3d b) { - - World w = a.getWorld(); - if (w == null) - w = b.getWorld(); - - min = a; - max = b; - - fix(); - } - - public Vecs3dCube(AxisAlignedBB aabb) { - - this(aabb.minX, aabb.minY, aabb.minZ, aabb.maxX, aabb.maxY, aabb.maxZ); - } - - public Vecs3d getMin() { - - return min; - } - - public Vecs3d getMax() { - - return max; - } - - public Vecs3d getCenter() { - - return new Vecs3d((getMinX() + getMaxX()) / 2D, - (getMinY() + getMaxY()) / 2D, (getMinZ() + getMaxZ()) / 2D, - getMin().getWorld()); - } - - public double getMinX() { - - return min.getX(); - } - - public double getMinY() { - - return min.getY(); - } - - public double getMinZ() { - - return min.getZ(); - } - - public double getMaxX() { - - return max.getX(); - } - - public double getMaxY() { - - return max.getY(); - } - - public double getMaxZ() { - - return max.getZ(); - } - - public AxisAlignedBB toAABB() { - - return AxisAlignedBB.getBoundingBox(getMinX(), getMinY(), getMinZ(), - getMaxX(), getMaxY(), getMaxZ()); - } - - @Override - public Vecs3dCube clone() { - - return new Vecs3dCube(min.clone(), max.clone()); - } - - public Vecs3dCube expand(double size) { - - min.sub(size, size, size); - max.add(size, size, size); - - return this; - } - - public Vecs3dCube fix() { - - Vecs3d a = min.clone(); - Vecs3d b = max.clone(); - - double minX = Math.min(a.getX(), b.getX()); - double minY = Math.min(a.getY(), b.getY()); - double minZ = Math.min(a.getZ(), b.getZ()); - - double maxX = Math.max(a.getX(), b.getX()); - double maxY = Math.max(a.getY(), b.getY()); - double maxZ = Math.max(a.getZ(), b.getZ()); - - min = new Vecs3d(minX, minY, minZ, a.w); - max = new Vecs3d(maxX, maxY, maxZ, b.w); - - return this; - } - - public Vecs3dCube add(double x, double y, double z) { - - min.add(x, y, z); - max.add(x, y, z); - - return this; - } - - public static final Vecs3dCube merge(List cubes) { - - double minx = Double.MAX_VALUE; - double miny = Double.MAX_VALUE; - double minz = Double.MAX_VALUE; - double maxx = Double.MIN_VALUE; - double maxy = Double.MIN_VALUE; - double maxz = Double.MIN_VALUE; - - for (Vecs3dCube c : cubes) { - minx = Math.min(minx, c.getMinX()); - miny = Math.min(miny, c.getMinY()); - minz = Math.min(minz, c.getMinZ()); - maxx = Math.max(maxx, c.getMaxX()); - maxy = Math.max(maxy, c.getMaxY()); - maxz = Math.max(maxz, c.getMaxZ()); - } - - if (cubes.size() == 0) - return new Vecs3dCube(0, 0, 0, 0, 0, 0); - - return new Vecs3dCube(minx, miny, minz, maxx, maxy, maxz); - } - - @Override - public int hashCode() { - - return min.hashCode() << 8 + max.hashCode(); - } -} diff --git a/src/main/java/techreborn/multiblocks/MultiBlockCasing.java b/src/main/java/techreborn/multiblocks/MultiBlockCasing.java index 367ef9125..dafef3437 100644 --- a/src/main/java/techreborn/multiblocks/MultiBlockCasing.java +++ b/src/main/java/techreborn/multiblocks/MultiBlockCasing.java @@ -1,17 +1,15 @@ package techreborn.multiblocks; -import erogenousbeef.coreTR.common.CoordTriplet; -import erogenousbeef.coreTR.multiblock.IMultiblockPart; -import erogenousbeef.coreTR.multiblock.MultiblockControllerBase; -import erogenousbeef.coreTR.multiblock.MultiblockValidationException; -import erogenousbeef.coreTR.multiblock.rectangular.RectangularMultiblockControllerBase; -import erogenousbeef.coreTR.multiblock.rectangular.RectangularMultiblockTileEntityBase; import net.minecraft.block.Block; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; -import techreborn.blocks.BlockMachineCasing; -import techreborn.util.LogHelper; +import reborncore.common.multiblock.CoordTriplet; +import reborncore.common.multiblock.IMultiblockPart; +import reborncore.common.multiblock.MultiblockControllerBase; +import reborncore.common.multiblock.MultiblockValidationException; +import reborncore.common.multiblock.rectangular.RectangularMultiblockControllerBase; +import reborncore.common.multiblock.rectangular.RectangularMultiblockTileEntityBase; public class MultiBlockCasing extends RectangularMultiblockControllerBase { @@ -23,7 +21,6 @@ public class MultiBlockCasing extends RectangularMultiblockControllerBase { } - /** * @return True if the machine is "whole" and should be assembled. False * otherwise. @@ -211,7 +208,7 @@ public class MultiBlockCasing extends RectangularMultiblockControllerBase { @Override protected void onMachineAssembled() { - LogHelper.warn("New multiblock created!"); + } @Override diff --git a/src/main/java/techreborn/packets/AbstractPacket.java b/src/main/java/techreborn/packets/AbstractPacket.java deleted file mode 100644 index 87f0624e2..000000000 --- a/src/main/java/techreborn/packets/AbstractPacket.java +++ /dev/null @@ -1,50 +0,0 @@ -package techreborn.packets; - -import io.netty.buffer.ByteBuf; -import io.netty.channel.ChannelHandlerContext; -import net.minecraft.entity.player.EntityPlayer; - -/** - * AbstractPacket class. Should be the parent of all packets wishing to use the - * PacketPipeline. - * - * @author sirgingalot - */ -public abstract class AbstractPacket { - - /** - * Encode the packet data into the ByteBuf stream. Complex data sets may - * need specific data handlers (See - * - * @param ctx channel context - * @param buffer the buffer to encode into - * @link{cpw.mods.fml.common.network.ByteBuffUtils ) - */ - public abstract void encodeInto(ChannelHandlerContext ctx, ByteBuf buffer); - - /** - * Decode the packet data from the ByteBuf stream. Complex data sets may - * need specific data handlers (See - * - * @param ctx channel context - * @param buffer the buffer to decode from - * @link{cpw.mods.fml.common.network.ByteBuffUtils ) - */ - public abstract void decodeInto(ChannelHandlerContext ctx, ByteBuf buffer); - - /** - * Handle a packet on the client side. Note this occurs after decoding has - * completed. - * - * @param player the player reference - */ - public abstract void handleClientSide(EntityPlayer player); - - /** - * Handle a packet on the powerSink side. Note this occurs after decoding has - * completed. - * - * @param player the player reference - */ - public abstract void handleServerSide(EntityPlayer player); -} \ No newline at end of file diff --git a/src/main/java/techreborn/packets/PacketAesu.java b/src/main/java/techreborn/packets/PacketAesu.java index cddee1497..1633b5ff2 100644 --- a/src/main/java/techreborn/packets/PacketAesu.java +++ b/src/main/java/techreborn/packets/PacketAesu.java @@ -1,6 +1,7 @@ package techreborn.packets; import io.netty.buffer.ByteBuf; +import reborncore.common.packets.SimplePacket; import techreborn.tiles.TileAesu; import java.io.IOException; diff --git a/src/main/java/techreborn/packets/PacketHandler.java b/src/main/java/techreborn/packets/PacketHandler.java deleted file mode 100644 index d98075d53..000000000 --- a/src/main/java/techreborn/packets/PacketHandler.java +++ /dev/null @@ -1,84 +0,0 @@ -package techreborn.packets; - -import cpw.mods.fml.common.network.FMLEmbeddedChannel; -import cpw.mods.fml.common.network.FMLIndexedMessageToMessageCodec; -import cpw.mods.fml.common.network.FMLOutboundHandler; -import cpw.mods.fml.relauncher.Side; -import io.netty.buffer.ByteBuf; -import io.netty.channel.ChannelHandlerContext; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.network.Packet; -import net.minecraft.world.World; - -import java.io.IOException; -import java.util.EnumMap; -import java.util.logging.Logger; - -public class PacketHandler extends - FMLIndexedMessageToMessageCodec { - private static EnumMap channels; - - public PacketHandler() { - addDiscriminator(0, PacketAesu.class); - } - - public static EnumMap getChannels() { - return channels; - } - - public static void setChannels(EnumMap _channels) { - channels = _channels; - } - - public static void sendPacketToServer(SimplePacket packet) { - PacketHandler.getChannels().get(Side.CLIENT) - .attr(FMLOutboundHandler.FML_MESSAGETARGET) - .set(FMLOutboundHandler.OutboundTarget.TOSERVER); - PacketHandler.getChannels().get(Side.CLIENT).writeOutbound(packet); - } - - public static void sendPacketToPlayer(SimplePacket packet, - EntityPlayer player) { - PacketHandler.getChannels().get(Side.SERVER) - .attr(FMLOutboundHandler.FML_MESSAGETARGET) - .set(FMLOutboundHandler.OutboundTarget.PLAYER); - PacketHandler.getChannels().get(Side.SERVER) - .attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(player); - PacketHandler.getChannels().get(Side.SERVER).writeOutbound(packet); - } - - public static void sendPacketToAllPlayers(SimplePacket packet) { - PacketHandler.getChannels().get(Side.SERVER) - .attr(FMLOutboundHandler.FML_MESSAGETARGET) - .set(FMLOutboundHandler.OutboundTarget.ALL); - PacketHandler.getChannels().get(Side.SERVER).writeOutbound(packet); - } - - public static void sendPacketToAllPlayers(Packet packet, World world) { - for (Object player : world.playerEntities) { - if (player instanceof EntityPlayerMP) - if (player != null) - ((EntityPlayerMP) player).playerNetServerHandler - .sendPacket(packet); - } - } - - @Override - public void encodeInto(ChannelHandlerContext ctx, SimplePacket msg, - ByteBuf target) throws Exception { - msg.writePacketData(target); - } - - @Override - public void decodeInto(ChannelHandlerContext ctx, ByteBuf source, - SimplePacket msg) { - try { - msg.readPacketData(source); - msg.execute(); - } catch (IOException e) { - Logger.getLogger("Network").warning( - "Something caused a Protocol Exception!"); - } - } -} \ No newline at end of file diff --git a/src/main/java/techreborn/packets/PacketIdsu.java b/src/main/java/techreborn/packets/PacketIdsu.java index 6caee96ad..02aeddb53 100644 --- a/src/main/java/techreborn/packets/PacketIdsu.java +++ b/src/main/java/techreborn/packets/PacketIdsu.java @@ -1,71 +1,42 @@ package techreborn.packets; import io.netty.buffer.ByteBuf; -import io.netty.channel.ChannelHandlerContext; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.network.PacketBuffer; +import reborncore.common.packets.SimplePacket; import techreborn.tiles.idsu.TileIDSU; import java.io.IOException; -public class PacketIdsu extends AbstractPacket { +public class PacketIdsu extends SimplePacket { + + public PacketIdsu() { } - int buttonID, channel; - - String newName; + int buttonID; TileIDSU idsu; - int x, y, z; - - public PacketIdsu(int buttonID, TileIDSU idsu, int channel, String newName) { - this.idsu = idsu; + public PacketIdsu(int buttonID, TileIDSU aesu) { + this.idsu = aesu; this.buttonID = buttonID; - this.channel = channel; - this.newName = newName; } - @Override - public void encodeInto(ChannelHandlerContext ctx, ByteBuf out) { - out.writeInt(idsu.xCoord); - out.writeInt(idsu.yCoord); - out.writeInt(idsu.zCoord); + public void writeData(ByteBuf out) throws IOException { + SimplePacket.writeTileEntity(idsu, out); out.writeInt(buttonID); - out.writeInt(channel); - PacketBuffer buffer = new PacketBuffer(out); - try { - buffer.writeStringToBuffer(newName); - } catch (IOException e) { - e.printStackTrace(); - } } @Override - public void decodeInto(ChannelHandlerContext ctx, ByteBuf in) { - this.x = in.readInt(); - this.y = in.readInt(); - this.z = in.readInt(); + public void readData(ByteBuf in) throws IOException { + this.idsu = (TileIDSU) SimplePacket.readTileEntity(in); buttonID = in.readInt(); - channel = in.readInt(); - PacketBuffer buffer = new PacketBuffer(in); - try { - newName = buffer.readStringFromBuffer(9999999); - } catch (IOException e) { - e.printStackTrace(); + } + + @Override + public void execute() { + if (!idsu.getWorldObj().isRemote) { + idsu.handleGuiInputFromClient(buttonID); } } - - @Override - public void handleClientSide(EntityPlayer player) { - - } - - @Override - public void handleServerSide(EntityPlayer player) { - idsu = (TileIDSU) player.getEntityWorld().getTileEntity(x, y, z); - idsu.handleGuiInputFromClient(buttonID); - } } diff --git a/src/main/java/techreborn/packets/PacketPipeline.java b/src/main/java/techreborn/packets/PacketPipeline.java deleted file mode 100644 index 0f01e88d8..000000000 --- a/src/main/java/techreborn/packets/PacketPipeline.java +++ /dev/null @@ -1,224 +0,0 @@ -package techreborn.packets; - -import cpw.mods.fml.common.FMLCommonHandler; -import cpw.mods.fml.common.network.FMLEmbeddedChannel; -import cpw.mods.fml.common.network.FMLOutboundHandler; -import cpw.mods.fml.common.network.NetworkRegistry; -import cpw.mods.fml.common.network.internal.FMLProxyPacket; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; -import io.netty.channel.ChannelHandler; -import io.netty.channel.ChannelHandlerContext; -import io.netty.handler.codec.MessageToMessageCodec; -import net.minecraft.client.Minecraft; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.network.INetHandler; -import net.minecraft.network.NetHandlerPlayServer; - -import java.util.*; - -/** - * Packet pipeline class. Directs all registered packet data to be handled by - * the packets themselves. - * - * @author sirgingalot some code from: cpw - */ -@ChannelHandler.Sharable -public class PacketPipeline extends MessageToMessageCodec { - - private EnumMap channels; - private LinkedList> packets = new LinkedList>(); - private boolean isPostInitialised = false; - - /** - * Register your packet with the pipeline. Discriminators are automatically - * set. - * - * @param clazz the class to register - * @return whether registration was successful. Failure may occur if 256 - * packets have been registered or if the registry already contains - * this packet - */ - public boolean registerPacket(Class clazz) { - if (this.packets.size() > 256) { - // You should log here!! - return false; - } - - if (this.packets.contains(clazz)) { - // You should log here!! - return false; - } - - if (this.isPostInitialised) { - // You should log here!! - return false; - } - - this.packets.add(clazz); - return true; - } - - // In line encoding of the packet, including discriminator setting - @Override - protected void encode(ChannelHandlerContext ctx, AbstractPacket msg, List out) throws Exception { - ByteBuf buffer = Unpooled.buffer(); - Class clazz = msg.getClass(); - if (!this.packets.contains(msg.getClass())) { - throw new NullPointerException("No Packet Registered for: " + msg.getClass().getCanonicalName()); - } - - byte discriminator = (byte) this.packets.indexOf(clazz); - buffer.writeByte(discriminator); - msg.encodeInto(ctx, buffer); - FMLProxyPacket proxyPacket = new FMLProxyPacket(buffer.copy(), ctx.channel().attr(NetworkRegistry.FML_CHANNEL).get()); - out.add(proxyPacket); - } - - // In line decoding and handling of the packet - @Override - protected void decode(ChannelHandlerContext ctx, FMLProxyPacket msg, List out) throws Exception { - ByteBuf payload = msg.payload(); - byte discriminator = payload.readByte(); - Class clazz = this.packets.get(discriminator); - if (clazz == null) { - throw new NullPointerException("No packet registered for discriminator: " + discriminator); - } - - AbstractPacket pkt = clazz.newInstance(); - pkt.decodeInto(ctx, payload.slice()); - - EntityPlayer player; - switch (FMLCommonHandler.instance().getEffectiveSide()) { - case CLIENT: - player = this.getClientPlayer(); - pkt.handleClientSide(player); - break; - - case SERVER: - INetHandler netHandler = ctx.channel().attr(NetworkRegistry.NET_HANDLER).get(); - player = ((NetHandlerPlayServer) netHandler).playerEntity; - pkt.handleServerSide(player); - break; - - default: - } - - out.add(pkt); - } - - // Method to call from FMLInitializationEvent - public void initalise() { - this.channels = NetworkRegistry.INSTANCE.newChannel("TechRebornPackPipeLine", this); - registerPackets(); - } - - private void registerPackets() { - registerPacket(PacketIdsu.class); - } - - // Method to call from FMLPostInitializationEvent - // Ensures that packet discriminators are common between powerSink and client - // by using logical sorting - public void postInitialise() { - if (this.isPostInitialised) { - return; - } - - this.isPostInitialised = true; - Collections.sort(this.packets, new Comparator>() { - - @Override - public int compare(Class clazz1, Class clazz2) { - int com = String.CASE_INSENSITIVE_ORDER.compare(clazz1.getCanonicalName(), clazz2.getCanonicalName()); - if (com == 0) { - com = clazz1.getCanonicalName().compareTo(clazz2.getCanonicalName()); - } - - return com; - } - }); - } - - @SideOnly(Side.CLIENT) - private EntityPlayer getClientPlayer() { - return Minecraft.getMinecraft().thePlayer; - } - - /** - * Send this message to everyone. - *

- * Adapted from CPW's code in - * cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper - * - * @param message The message to send - */ - public void sendToAll(AbstractPacket message) { - this.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.ALL); - this.channels.get(Side.SERVER).writeAndFlush(message); - } - - /** - * Send this message to the specified player. - *

- * Adapted from CPW's code in - * cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper - * - * @param message The message to send - * @param player The player to send it to - */ - public void sendTo(AbstractPacket message, EntityPlayerMP player) { - this.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.PLAYER); - this.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(player); - this.channels.get(Side.SERVER).writeAndFlush(message); - } - - /** - * Send this message to everyone within a certain range of a point. - *

- * Adapted from CPW's code in - * cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper - * - * @param message The message to send - * @param point The - * {@link cpw.mods.fml.common.network.NetworkRegistry.TargetPoint} - * around which to send - */ - public void sendToAllAround(AbstractPacket message, NetworkRegistry.TargetPoint point) { - this.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.ALLAROUNDPOINT); - this.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(point); - this.channels.get(Side.SERVER).writeAndFlush(message); - } - - /** - * Send this message to everyone within the supplied dimension. - *

- * Adapted from CPW's code in - * cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper - * - * @param message The message to send - * @param dimensionId The dimension id to target - */ - public void sendToDimension(AbstractPacket message, int dimensionId) { - this.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.DIMENSION); - this.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(dimensionId); - this.channels.get(Side.SERVER).writeAndFlush(message); - } - - /** - * Send this message to the powerSink. - *

- * Adapted from CPW's code in - * cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper - * - * @param message The message to send - */ - public void sendToServer(AbstractPacket message) { - this.channels.get(Side.CLIENT).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.TOSERVER); - this.channels.get(Side.CLIENT).writeAndFlush(message); - } - -} \ No newline at end of file diff --git a/src/main/java/techreborn/packets/SimplePacket.java b/src/main/java/techreborn/packets/SimplePacket.java deleted file mode 100644 index 23a582380..000000000 --- a/src/main/java/techreborn/packets/SimplePacket.java +++ /dev/null @@ -1,122 +0,0 @@ -package techreborn.packets; - -import com.google.common.base.Charsets; -import io.netty.buffer.ByteBuf; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; -import net.minecraftforge.common.DimensionManager; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidRegistry; - -import java.io.IOException; - -public abstract class SimplePacket { - protected EntityPlayer player; - protected byte mode; - - public SimplePacket(EntityPlayer _player) { - player = _player; - } - - @SuppressWarnings("unused") - public SimplePacket() { - player = null; - } - - public static String readString(ByteBuf in) throws IOException { - byte[] stringBytes = new byte[in.readInt()]; - in.readBytes(stringBytes); - return new String(stringBytes, Charsets.UTF_8); - } - - public static void writeString(String string, ByteBuf out) - throws IOException { - byte[] stringBytes; - stringBytes = string.getBytes(Charsets.UTF_8); - out.writeInt(stringBytes.length); - out.writeBytes(stringBytes); - } - - public static World readWorld(ByteBuf in) throws IOException { - return DimensionManager.getWorld(in.readInt()); - } - - public static void writeWorld(World world, ByteBuf out) throws IOException { - out.writeInt(world.provider.dimensionId); - } - - public static EntityPlayer readPlayer(ByteBuf in) throws IOException { - if (!in.readBoolean()) - return null; - World playerWorld = readWorld(in); - return playerWorld.getPlayerEntityByName(readString(in)); - } - - public static void writePlayer(EntityPlayer player, ByteBuf out) - throws IOException { - if (player == null) { - out.writeBoolean(false); - return; - } - out.writeBoolean(true); - writeWorld(player.worldObj, out); - writeString(player.getCommandSenderName(), out); - } - - public static TileEntity readTileEntity(ByteBuf in) throws IOException { - return readWorld(in).getTileEntity(in.readInt(), in.readInt(), - in.readInt()); - } - - public static void writeTileEntity(TileEntity tileEntity, ByteBuf out) - throws IOException { - writeWorld(tileEntity.getWorldObj(), out); - out.writeInt(tileEntity.xCoord); - out.writeInt(tileEntity.yCoord); - out.writeInt(tileEntity.zCoord); - } - - public static Fluid readFluid(ByteBuf in) throws IOException { - return FluidRegistry.getFluid(readString(in)); - } - - public static void writeFluid(Fluid fluid, ByteBuf out) throws IOException { - if (fluid == null) { - writeString("", out); - return; - } - writeString(fluid.getName(), out); - } - - public void writePacketData(ByteBuf out) throws IOException { - out.writeByte(mode); - writePlayer(player, out); - writeData(out); - } - - public abstract void writeData(ByteBuf out) throws IOException; - - public void readPacketData(ByteBuf in) throws IOException { - mode = in.readByte(); - player = readPlayer(in); - readData(in); - } - - public abstract void readData(ByteBuf in) throws IOException; - - public abstract void execute(); - - public void sendPacketToServer() { - PacketHandler.sendPacketToServer(this); - } - - public void sendPacketToPlayer(EntityPlayer player) { - PacketHandler.sendPacketToPlayer(this, player); - } - - public void sendPacketToAllPlayers() { - PacketHandler.sendPacketToAllPlayers(this); - } - -} diff --git a/src/main/java/techreborn/partSystem/IModPart.java b/src/main/java/techreborn/partSystem/IModPart.java index 087c11de2..d4f6fb0f3 100644 --- a/src/main/java/techreborn/partSystem/IModPart.java +++ b/src/main/java/techreborn/partSystem/IModPart.java @@ -10,8 +10,8 @@ import net.minecraft.entity.Entity; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; -import techreborn.lib.vecmath.Vecs3d; -import techreborn.lib.vecmath.Vecs3dCube; +import reborncore.common.misc.vecmath.Vecs3d; +import reborncore.common.misc.vecmath.Vecs3dCube; import java.util.List; diff --git a/src/main/java/techreborn/partSystem/IPartProvider.java b/src/main/java/techreborn/partSystem/IPartProvider.java index bd0bcf986..be03603ce 100644 --- a/src/main/java/techreborn/partSystem/IPartProvider.java +++ b/src/main/java/techreborn/partSystem/IPartProvider.java @@ -8,8 +8,8 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; -import techreborn.lib.Location; -import techreborn.lib.vecmath.Vecs3dCube; +import reborncore.common.misc.Location; +import reborncore.common.misc.vecmath.Vecs3dCube; public interface IPartProvider { diff --git a/src/main/java/techreborn/partSystem/ModPart.java b/src/main/java/techreborn/partSystem/ModPart.java index 59735b1a7..23723ca62 100644 --- a/src/main/java/techreborn/partSystem/ModPart.java +++ b/src/main/java/techreborn/partSystem/ModPart.java @@ -6,7 +6,7 @@ package techreborn.partSystem; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; -import techreborn.lib.Location; +import reborncore.common.misc.Location; /** * Extend this class to make your multipart diff --git a/src/main/java/techreborn/partSystem/ModPartRegistry.java b/src/main/java/techreborn/partSystem/ModPartRegistry.java index 049a27bf5..85dd34adb 100644 --- a/src/main/java/techreborn/partSystem/ModPartRegistry.java +++ b/src/main/java/techreborn/partSystem/ModPartRegistry.java @@ -9,10 +9,10 @@ import cpw.mods.fml.common.registry.GameRegistry; import ic2.api.item.IC2Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import techreborn.Core; import techreborn.client.TechRebornCreativeTab; import techreborn.init.ModParts; import techreborn.partSystem.parts.CablePart; -import techreborn.util.LogHelper; import java.util.ArrayList; import java.util.HashMap; @@ -37,10 +37,10 @@ public class ModPartRegistry { iPartProvider.init(); } - LogHelper.info("Started to load all parts"); + Core.logHelper.info("Started to load all parts"); for (ModPart modPart : ModPartRegistry.parts) { - if(modPart.needsItem()){ + if (modPart.needsItem()) { Item part = new ModPartItem(modPart) .setUnlocalizedName(modPart.getName()) .setCreativeTab(TechRebornCreativeTab.instance) @@ -82,15 +82,15 @@ public class ModPartRegistry { } } catch (ClassNotFoundException e) { e.printStackTrace(); - LogHelper.error("Failed to load " + className + Core.logHelper.error("Failed to load " + className + " to the part system!"); } catch (InstantiationException e) { e.printStackTrace(); - LogHelper.error("Failed to load " + className + Core.logHelper.error("Failed to load " + className + " to the part system!"); } catch (IllegalAccessException e) { e.printStackTrace(); - LogHelper.error("Failed to load " + className + Core.logHelper.error("Failed to load " + className + " to the part system!"); } } diff --git a/src/main/java/techreborn/partSystem/ModPartUtils.java b/src/main/java/techreborn/partSystem/ModPartUtils.java index cce85486f..d12fdd0ad 100644 --- a/src/main/java/techreborn/partSystem/ModPartUtils.java +++ b/src/main/java/techreborn/partSystem/ModPartUtils.java @@ -6,8 +6,8 @@ package techreborn.partSystem; import net.minecraft.item.Item; import net.minecraft.world.World; -import techreborn.lib.Location; -import techreborn.lib.vecmath.Vecs3dCube; +import reborncore.common.misc.Location; +import reborncore.common.misc.vecmath.Vecs3dCube; import java.util.Map; diff --git a/src/main/java/techreborn/partSystem/QLib/ModLib2QLib.java b/src/main/java/techreborn/partSystem/QLib/ModLib2QLib.java index a3ad2f612..98308fc98 100644 --- a/src/main/java/techreborn/partSystem/QLib/ModLib2QLib.java +++ b/src/main/java/techreborn/partSystem/QLib/ModLib2QLib.java @@ -4,8 +4,8 @@ package techreborn.partSystem.QLib; -import techreborn.lib.vecmath.Vecs3d; -import techreborn.lib.vecmath.Vecs3dCube; +import reborncore.common.misc.vecmath.Vecs3d; +import reborncore.common.misc.vecmath.Vecs3dCube; import uk.co.qmunity.lib.vec.Vec3d; import uk.co.qmunity.lib.vec.Vec3dCube; diff --git a/src/main/java/techreborn/partSystem/QLib/QModPart.java b/src/main/java/techreborn/partSystem/QLib/QModPart.java index e754a42c0..87d1b1d74 100644 --- a/src/main/java/techreborn/partSystem/QLib/QModPart.java +++ b/src/main/java/techreborn/partSystem/QLib/QModPart.java @@ -8,9 +8,9 @@ import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.entity.Entity; import net.minecraft.item.ItemStack; import net.minecraft.world.World; -import techreborn.lib.Location; -import techreborn.lib.vecmath.Vecs3d; -import techreborn.lib.vecmath.Vecs3dCube; +import reborncore.common.misc.Location; +import reborncore.common.misc.vecmath.Vecs3d; +import reborncore.common.misc.vecmath.Vecs3dCube; import techreborn.partSystem.ModPart; import uk.co.qmunity.lib.client.render.RenderHelper; import uk.co.qmunity.lib.part.*; diff --git a/src/main/java/techreborn/partSystem/QLib/QModPartFactory.java b/src/main/java/techreborn/partSystem/QLib/QModPartFactory.java index 266fd6d30..77d99869d 100644 --- a/src/main/java/techreborn/partSystem/QLib/QModPartFactory.java +++ b/src/main/java/techreborn/partSystem/QLib/QModPartFactory.java @@ -11,8 +11,8 @@ import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.Vec3; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -import techreborn.lib.Location; -import techreborn.lib.vecmath.Vecs3dCube; +import reborncore.common.misc.Location; +import reborncore.common.misc.vecmath.Vecs3dCube; import techreborn.partSystem.IModPart; import techreborn.partSystem.IPartProvider; import techreborn.partSystem.ModPart; diff --git a/src/main/java/techreborn/partSystem/client/PartPlacementRenderer.java b/src/main/java/techreborn/partSystem/client/PartPlacementRenderer.java index 8379d354d..f54f28365 100644 --- a/src/main/java/techreborn/partSystem/client/PartPlacementRenderer.java +++ b/src/main/java/techreborn/partSystem/client/PartPlacementRenderer.java @@ -14,8 +14,8 @@ import net.minecraft.util.Vec3; import net.minecraftforge.client.event.RenderWorldLastEvent; import net.minecraftforge.common.util.ForgeDirection; import org.lwjgl.opengl.GL11; -import techreborn.lib.Location; -import techreborn.lib.vecmath.Vecs3d; +import reborncore.common.misc.Location; +import reborncore.common.misc.vecmath.Vecs3d; import techreborn.partSystem.IModPart; import techreborn.partSystem.ModPartItem; diff --git a/src/main/java/techreborn/partSystem/fmp/FMPFactory.java b/src/main/java/techreborn/partSystem/fmp/FMPFactory.java index f32fd5a9e..a9620fa23 100644 --- a/src/main/java/techreborn/partSystem/fmp/FMPFactory.java +++ b/src/main/java/techreborn/partSystem/fmp/FMPFactory.java @@ -12,15 +12,14 @@ import codechicken.multipart.NormallyOccludedPart; import codechicken.multipart.TMultiPart; import codechicken.multipart.TileMultipart; import cpw.mods.fml.common.Loader; -import ic2.api.info.IC2Classic; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; -import techreborn.lib.Location; -import techreborn.lib.vecmath.Vecs3dCube; +import reborncore.common.misc.Location; +import reborncore.common.misc.vecmath.Vecs3dCube; import techreborn.partSystem.IModPart; import techreborn.partSystem.IPartProvider; import techreborn.partSystem.ModPart; @@ -65,7 +64,7 @@ public class FMPFactory implements MultiPartRegistry.IPartFactory2, for (TMultiPart p : t) { if (ret == false) { if (p.getType().equals(name)) { - if(p instanceof FMPModPart){ + if (p instanceof FMPModPart) { return ((FMPModPart) p).iModPart; } ret = true; @@ -79,7 +78,7 @@ public class FMPFactory implements MultiPartRegistry.IPartFactory2, @Override public void init() { - if(Loader.isModLoaded("IC2")){ + if (Loader.isModLoaded("IC2")) { MultiPartRegistry.registerConverter(new CableConverter()); MinecraftForge.EVENT_BUS.register(new CableConverter()); } diff --git a/src/main/java/techreborn/partSystem/fmp/FMPModPart.java b/src/main/java/techreborn/partSystem/fmp/FMPModPart.java index f773dd8a5..972b71258 100644 --- a/src/main/java/techreborn/partSystem/fmp/FMPModPart.java +++ b/src/main/java/techreborn/partSystem/fmp/FMPModPart.java @@ -16,17 +16,14 @@ import codechicken.multipart.TMultiPart; import codechicken.multipart.TSlottedPart; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.entity.Entity; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.World; -import techreborn.lib.Location; -import techreborn.lib.vecmath.Vecs3d; -import techreborn.lib.vecmath.Vecs3dCube; +import reborncore.common.misc.Location; +import reborncore.common.misc.vecmath.Vecs3d; +import reborncore.common.misc.vecmath.Vecs3dCube; import techreborn.partSystem.IPartDesc; import techreborn.partSystem.ModPart; -import techreborn.util.LogHelper; import java.util.ArrayList; import java.util.List; @@ -50,7 +47,7 @@ public class FMPModPart extends TMultiPart implements TSlottedPart, public Iterable getOcclusionBoxes() { List cubes = new ArrayList(); for (Vecs3dCube c : iModPart.getOcclusionBoxes()) - if(c != null) + if (c != null) cubes.add(new Cuboid6(c.toAABB())); return cubes; } @@ -176,8 +173,6 @@ public class FMPModPart extends TMultiPart implements TSlottedPart, List stackArrayList = new ArrayList(); if (iModPart.getItem() != null) { stackArrayList.add(iModPart.getItem().copy()); - } else { - LogHelper.error("Part " + iModPart.getName() + " has a null drop"); } return stackArrayList; } diff --git a/src/main/java/techreborn/partSystem/parts/CableConverter.java b/src/main/java/techreborn/partSystem/parts/CableConverter.java index 130b7c042..95f189813 100644 --- a/src/main/java/techreborn/partSystem/parts/CableConverter.java +++ b/src/main/java/techreborn/partSystem/parts/CableConverter.java @@ -7,8 +7,6 @@ import codechicken.lib.vec.Vector3; import codechicken.multipart.MultiPartRegistry; import codechicken.multipart.TMultiPart; import codechicken.multipart.TileMultipart; -import codechicken.multipart.minecraft.McBlockPart; -import codechicken.multipart.minecraft.McMultipartSPH; import cpw.mods.fml.common.eventhandler.EventPriority; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import ic2.api.item.IC2Items; @@ -57,46 +55,42 @@ public class CableConverter implements MultiPartRegistry.IPartConverter { private ThreadLocal placing = new ThreadLocal(); @SubscribeEvent(priority = EventPriority.LOW) - public void playerInteract(PlayerInteractEvent event) - { - if(event.action == PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK && event.entityPlayer.worldObj.isRemote) - { - if(placing.get() != null) + public void playerInteract(PlayerInteractEvent event) { + if (event.action == PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK && event.entityPlayer.worldObj.isRemote) { + if (placing.get() != null) return; placing.set(event); - if(place(event.entityPlayer, event.entityPlayer.worldObj)) + if (place(event.entityPlayer, event.entityPlayer.worldObj)) event.setCanceled(true); placing.set(null); } } - public static boolean place(EntityPlayer player, World world) - { + public static boolean place(EntityPlayer player, World world) { MovingObjectPosition hit = RayTracer.reTrace(world, player); - if(hit == null) + if (hit == null) return false; BlockCoord pos = new BlockCoord(hit.blockX, hit.blockY, hit.blockZ).offset(hit.sideHit); ItemStack held = player.getHeldItem(); FMPModPart part = null; - if(held == null) + if (held == null) return false; Item heldItem = held.getItem(); - if(heldItem == IC2Items.getItem("copperCableItem").getItem()) + if (heldItem == IC2Items.getItem("copperCableItem").getItem()) part = placeCable(world, pos, hit.sideHit, held); - if(part == null) + if (part == null) return false; - if(world.isRemote && !player.isSneaking())//attempt to use block activated like normal and tell the server the right stuff + if (world.isRemote && !player.isSneaking())//attempt to use block activated like normal and tell the server the right stuff { Vector3 f = new Vector3(hit.hitVec).add(-hit.blockX, -hit.blockY, -hit.blockZ); Block block = world.getBlock(hit.blockX, hit.blockY, hit.blockZ); - if(!ignoreActivate(block) && block.onBlockActivated(world, hit.blockX, hit.blockY, hit.blockZ, player, hit.sideHit, (float)f.x, (float)f.y, (float)f.z)) - { + if (!ignoreActivate(block) && block.onBlockActivated(world, hit.blockX, hit.blockY, hit.blockZ, player, hit.sideHit, (float) f.x, (float) f.y, (float) f.z)) { player.swingItem(); PacketCustom.sendToServer(new C08PacketPlayerBlockPlacement( hit.blockX, hit.blockY, hit.blockZ, hit.sideHit, @@ -107,48 +101,41 @@ public class CableConverter implements MultiPartRegistry.IPartConverter { } TileMultipart tile = TileMultipart.getOrConvertTile(world, pos); - if(tile == null || !tile.canAddPart(part)) + if (tile == null || !tile.canAddPart(part)) return false; - if(!world.isRemote) - { + if (!world.isRemote) { TileMultipart.addPart(world, pos, part); world.playSoundEffect(pos.x + 0.5, pos.y + 0.5, pos.z + 0.5, Blocks.wool.stepSound.func_150496_b(), (Blocks.wool.stepSound.getVolume() + 1.0F) / 2.0F, Blocks.wool.stepSound.getPitch() * 0.8F); - if(!player.capabilities.isCreativeMode) - { + if (!player.capabilities.isCreativeMode) { held.stackSize--; - if (held.stackSize == 0) - { + if (held.stackSize == 0) { player.inventory.mainInventory[player.inventory.currentItem] = null; MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(player, held)); } } - } - else - { + } else { player.swingItem(); - // new PacketCustom(McMultipartSPH.channel, 1).sendToServer(); + // new PacketCustom(McMultipartSPH.channel, 1).sendToServer(); } return true; } - private static boolean ignoreActivate(Block block) - { - if(block instanceof BlockFence) + private static boolean ignoreActivate(Block block) { + if (block instanceof BlockFence) return true; return false; } - public static FMPModPart placeCable(World world, BlockCoord pos, int side, ItemStack held) - { - if(side == 0) + public static FMPModPart placeCable(World world, BlockCoord pos, int side, ItemStack held) { + if (side == 0) return null; - pos = pos.copy().offset(side^1); + pos = pos.copy().offset(side ^ 1); Block block = world.getBlock(pos.x, pos.y, pos.z); - if(!block.isSideSolid(world, pos.x, pos.y, pos.z, ForgeDirection.getOrientation(side)) && (side != 1 || block.canPlaceTorchOnTop(world, pos.x, pos.y, pos.z))) + if (!block.isSideSolid(world, pos.x, pos.y, pos.z, ForgeDirection.getOrientation(side)) && (side != 1 || block.canPlaceTorchOnTop(world, pos.x, pos.y, pos.z))) return null; CablePart part = new CablePart(); diff --git a/src/main/java/techreborn/partSystem/parts/CablePart.java b/src/main/java/techreborn/partSystem/parts/CablePart.java index 13dcbfe5c..344d43f9c 100644 --- a/src/main/java/techreborn/partSystem/parts/CablePart.java +++ b/src/main/java/techreborn/partSystem/parts/CablePart.java @@ -17,11 +17,11 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.util.ForgeDirection; +import reborncore.common.misc.Functions; +import reborncore.common.misc.Location; +import reborncore.common.misc.vecmath.Vecs3d; +import reborncore.common.misc.vecmath.Vecs3dCube; import techreborn.client.render.RenderCablePart; -import techreborn.lib.Functions; -import techreborn.lib.Location; -import techreborn.lib.vecmath.Vecs3d; -import techreborn.lib.vecmath.Vecs3dCube; import techreborn.partSystem.IModPart; import techreborn.partSystem.IPartDesc; import techreborn.partSystem.ModPart; diff --git a/src/main/java/techreborn/partSystem/parts/NullPart.java b/src/main/java/techreborn/partSystem/parts/NullPart.java index e9d9f048d..8b04ee5c0 100644 --- a/src/main/java/techreborn/partSystem/parts/NullPart.java +++ b/src/main/java/techreborn/partSystem/parts/NullPart.java @@ -7,8 +7,8 @@ package techreborn.partSystem.parts; import net.minecraft.entity.Entity; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import techreborn.lib.vecmath.Vecs3d; -import techreborn.lib.vecmath.Vecs3dCube; +import reborncore.common.misc.vecmath.Vecs3d; +import reborncore.common.misc.vecmath.Vecs3dCube; import techreborn.partSystem.IModPart; import techreborn.partSystem.ModPart; diff --git a/src/main/java/techreborn/pda/GuiManual.java b/src/main/java/techreborn/pda/GuiManual.java index 685505389..cf35614d9 100644 --- a/src/main/java/techreborn/pda/GuiManual.java +++ b/src/main/java/techreborn/pda/GuiManual.java @@ -1,8 +1,5 @@ package techreborn.pda; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL12; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.Minecraft; @@ -11,175 +8,170 @@ import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.renderer.RenderHelper; import net.minecraft.inventory.Container; import net.minecraft.item.ItemStack; -import net.minecraft.util.StatCollector; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; import techreborn.init.ModBlocks; import techreborn.init.ModItems; -import techreborn.pda.pages.ContentsPage; -import techreborn.pda.pages.CraftingInfoPage; -import techreborn.pda.pages.IndexPage; -import techreborn.pda.pages.ItemsPage; -import techreborn.pda.pages.MultiBlockPage; -import techreborn.pda.pages.TitledPage; -import techreborn.pda.pages.VersionPage; +import techreborn.pda.pages.*; @SideOnly(Side.CLIENT) -public class GuiManual extends GuiScreen{ - - protected final PageCollection root; - protected int pageIndex = 0; - protected int xSize = 0; - protected int ySize = 0; - public Container inventorySlots; - protected int guiLeft; - protected int guiTop; +public class GuiManual extends GuiScreen { - public GuiManual() { - this.xSize = 256; - this.ySize = 202; - root = createRoot(); - } + protected final PageCollection root; + protected int pageIndex = 0; + protected int xSize = 0; + protected int ySize = 0; + public Container inventorySlots; + protected int guiLeft; + protected int guiTop; - protected PageCollection createRoot() { - pageIndex = 0; - final PageCollection pageCollection = new PageCollection(); - pageCollection.addPage(new IndexPage("INDEX", pageCollection)); - pageCollection.addPage(new ContentsPage("CONTENTS", pageCollection)); - pageCollection.addPage(new ItemsPage("ITEMS", pageCollection, "ITEM_PAGE")); - pageCollection.addPage(new ItemsPage("TOOLS", pageCollection, "TOOLS_PAGE")); - pageCollection.addPage(new ItemsPage("UPGRADES", pageCollection, "UPGRADES_PAGE")); + public GuiManual() { + this.xSize = 256; + this.ySize = 202; + root = createRoot(); + } - pageCollection.addPage(new ItemsPage("MACHINES", pageCollection, "MACHINES_PAGE")); - pageCollection.addPage(new ItemsPage("POWER_GENERATION", pageCollection, "POWER_GENERATION_PAGE")); - pageCollection.addPage(new ItemsPage("POWER_STORAGE", pageCollection, "POWER_STORAGE_PAGE")); - pageCollection.addPage(new VersionPage("VERSION", pageCollection, "VERSION PAGE", 777777)); - pageCollection.addPage(new MultiBlockPage("MULTIBLOCKS", pageCollection, "MULTIBLOCK_PAGE")); + protected PageCollection createRoot() { + pageIndex = 0; + final PageCollection pageCollection = new PageCollection(); + pageCollection.addPage(new IndexPage("INDEX", pageCollection)); + pageCollection.addPage(new ContentsPage("CONTENTS", pageCollection)); + pageCollection.addPage(new ItemsPage("ITEMS", pageCollection, "ITEM_PAGE")); + pageCollection.addPage(new ItemsPage("TOOLS", pageCollection, "TOOLS_PAGE")); + pageCollection.addPage(new ItemsPage("UPGRADES", pageCollection, "UPGRADES_PAGE")); - pageCollection.addPage(new CraftingInfoPage("POWER_STORAGE_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.Aesu), "")); - pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.AlloyFurnace), "")); - pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.AlloySmelter), "")); - pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.BlastFurnace), "")); - pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.centrifuge), "")); - pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.chargeBench), "")); - pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.ChemicalReactor), "")); - pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.ChunkLoader), "")); - pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.ComputerCube), "")); - pageCollection.addPage(new CraftingInfoPage("POWER_GENERATION_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.DieselGenerator), "")); - pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.digitalChest), "")); - pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.Distillationtower), "")); - pageCollection.addPage(new CraftingInfoPage("POWER_GENERATION_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.Dragoneggenergysiphoner), "")); - pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.ElectricCraftingTable), "")); - pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.FusionCoil), "")); - pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.FusionControlComputer), "")); - pageCollection.addPage(new CraftingInfoPage("BLOCK_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.Gasturbine), "")); - pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.Grinder), "")); - pageCollection.addPage(new CraftingInfoPage("POWER_GENERATION_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.heatGenerator), "")); - pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.HighAdvancedMachineBlock), "")); - pageCollection.addPage(new CraftingInfoPage("POWER_STORAGE_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.Idsu), "")); - pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.ImplosionCompressor), "")); - pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.IndustrialElectrolyzer), "")); - pageCollection.addPage(new CraftingInfoPage("POWER_STORAGE_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.Lesu), "")); - pageCollection.addPage(new CraftingInfoPage("POWER_STORAGE_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.LesuStorage), "")); - pageCollection.addPage(new CraftingInfoPage("POWER_GENERATION_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.LightningRod), "")); - pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.machineframe), "")); - pageCollection.addPage(new CraftingInfoPage("POWER_GENERATION_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.MagicalAbsorber), "")); - pageCollection.addPage(new CraftingInfoPage("POWER_GENERATION_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.Magicenergeyconverter), "")); - pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.MatterFabricator), "")); - pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.PlasmaGenerator), "")); - pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.quantumChest), "")); - pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.quantumTank), "")); - pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.RollingMachine), "")); - pageCollection.addPage(new CraftingInfoPage("POWER_GENERATION_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.Semifluidgenerator), "")); - pageCollection.addPage(new CraftingInfoPage("POWER_GENERATION_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.thermalGenerator), "")); - pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.VacuumFreezer), "")); + pageCollection.addPage(new ItemsPage("MACHINES", pageCollection, "MACHINES_PAGE")); + pageCollection.addPage(new ItemsPage("POWER_GENERATION", pageCollection, "POWER_GENERATION_PAGE")); + pageCollection.addPage(new ItemsPage("POWER_STORAGE", pageCollection, "POWER_STORAGE_PAGE")); + pageCollection.addPage(new VersionPage("VERSION", pageCollection, "VERSION PAGE", 777777)); + pageCollection.addPage(new MultiBlockPage("MULTIBLOCKS", pageCollection, "MULTIBLOCK_PAGE")); - pageCollection.addPage(new CraftingInfoPage("TOOLS_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModItems.advancedDrill), "")); - pageCollection.addPage(new CraftingInfoPage("TOOLS_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModItems.cloakingDevice), "")); - pageCollection.addPage(new CraftingInfoPage("TOOLS_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModItems.lapotronicOrb), "")); - pageCollection.addPage(new CraftingInfoPage("TOOLS_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModItems.lapotronpack), "")); - pageCollection.addPage(new CraftingInfoPage("TOOLS_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModItems.lithiumBatpack), "")); - pageCollection.addPage(new CraftingInfoPage("TOOLS_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModItems.omniTool), "")); - pageCollection.addPage(new CraftingInfoPage("TOOLS_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModItems.rockCutter), "")); - pageCollection.addPage(new CraftingInfoPage("ITEM_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModItems.uuMatter), "")); - - return pageCollection; - } + pageCollection.addPage(new CraftingInfoPage("POWER_STORAGE_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.Aesu), "")); + pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.AlloyFurnace), "")); + pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.AlloySmelter), "")); + pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.BlastFurnace), "")); + pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.centrifuge), "")); + pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.chargeBench), "")); + pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.ChemicalReactor), "")); + pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.ChunkLoader), "")); + pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.ComputerCube), "")); + pageCollection.addPage(new CraftingInfoPage("POWER_GENERATION_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.DieselGenerator), "")); + pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.digitalChest), "")); + pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.Distillationtower), "")); + pageCollection.addPage(new CraftingInfoPage("POWER_GENERATION_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.Dragoneggenergysiphoner), "")); + pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.ElectricCraftingTable), "")); + pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.FusionCoil), "")); + pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.FusionControlComputer), "")); + pageCollection.addPage(new CraftingInfoPage("BLOCK_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.Gasturbine), "")); + pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.Grinder), "")); + pageCollection.addPage(new CraftingInfoPage("POWER_GENERATION_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.heatGenerator), "")); + pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.HighAdvancedMachineBlock), "")); + pageCollection.addPage(new CraftingInfoPage("POWER_STORAGE_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.Idsu), "")); + pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.ImplosionCompressor), "")); + pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.IndustrialElectrolyzer), "")); + pageCollection.addPage(new CraftingInfoPage("POWER_STORAGE_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.Lesu), "")); + pageCollection.addPage(new CraftingInfoPage("POWER_STORAGE_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.LesuStorage), "")); + pageCollection.addPage(new CraftingInfoPage("POWER_GENERATION_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.LightningRod), "")); + pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.machineframe), "")); + pageCollection.addPage(new CraftingInfoPage("POWER_GENERATION_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.MagicalAbsorber), "")); + pageCollection.addPage(new CraftingInfoPage("POWER_GENERATION_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.Magicenergeyconverter), "")); + pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.MatterFabricator), "")); + pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.PlasmaGenerator), "")); + pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.quantumChest), "")); + pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.quantumTank), "")); + pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.RollingMachine), "")); + pageCollection.addPage(new CraftingInfoPage("POWER_GENERATION_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.Semifluidgenerator), "")); + pageCollection.addPage(new CraftingInfoPage("POWER_GENERATION_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.thermalGenerator), "")); + pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.VacuumFreezer), "")); - private int getNextPageIndex(){ - int i = pageIndex; - pageIndex++; - return i; - } + pageCollection.addPage(new CraftingInfoPage("TOOLS_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModItems.advancedDrill), "")); + pageCollection.addPage(new CraftingInfoPage("TOOLS_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModItems.cloakingDevice), "")); + pageCollection.addPage(new CraftingInfoPage("TOOLS_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModItems.lapotronicOrb), "")); + pageCollection.addPage(new CraftingInfoPage("TOOLS_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModItems.lapotronpack), "")); + pageCollection.addPage(new CraftingInfoPage("TOOLS_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModItems.lithiumBatpack), "")); + pageCollection.addPage(new CraftingInfoPage("TOOLS_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModItems.omniTool), "")); + pageCollection.addPage(new CraftingInfoPage("TOOLS_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModItems.rockCutter), "")); + pageCollection.addPage(new CraftingInfoPage("ITEM_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModItems.uuMatter), "")); - @Override - public void drawScreen(int mouseX, int mouseY, float par3) { - drawGuiBackgroundLayer(par3, mouseX, mouseY); - super.drawScreen(mouseX, mouseY, par3); + return pageCollection; + } - prepareRenderState(); - GL11.glPushMatrix(); + private int getNextPageIndex() { + int i = pageIndex; + pageIndex++; + return i; + } - root.drawScreen(this.mc, this.guiLeft, this.guiTop, mouseX - this.guiLeft, mouseY - this.guiTop); + @Override + public void drawScreen(int mouseX, int mouseY, float par3) { + drawGuiBackgroundLayer(par3, mouseX, mouseY); + super.drawScreen(mouseX, mouseY, par3); - GL11.glPopMatrix(); - restoreRenderState(); - } + prepareRenderState(); + GL11.glPushMatrix(); - protected void prepareRenderState() { - GL11.glDisable(GL12.GL_RESCALE_NORMAL); - RenderHelper.disableStandardItemLighting(); - GL11.glDisable(GL11.GL_LIGHTING); - GL11.glDisable(GL11.GL_DEPTH_TEST); - } + root.drawScreen(this.mc, this.guiLeft, this.guiTop, mouseX - this.guiLeft, mouseY - this.guiTop); - protected void restoreRenderState() { - GL11.glEnable(GL12.GL_RESCALE_NORMAL); - GL11.glEnable(GL11.GL_LIGHTING); - GL11.glEnable(GL11.GL_DEPTH_TEST); - RenderHelper.enableStandardItemLighting(); - } + GL11.glPopMatrix(); + restoreRenderState(); + } - protected void drawGuiBackgroundLayer(float p_146976_1_, int mouseX, int mouseY) { - GL11.glPushMatrix(); - GL11.glTranslated(this.guiLeft, this.guiTop, 0); - root.renderBackgroundLayer(this.mc, 0, 0, mouseX - this.guiLeft, mouseY - this.guiTop); - GL11.glPopMatrix(); - } + protected void prepareRenderState() { + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + RenderHelper.disableStandardItemLighting(); + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glDisable(GL11.GL_DEPTH_TEST); + } - @Override - public void setWorldAndResolution(Minecraft minecraft, int x, int y) { - super.setWorldAndResolution(minecraft, x, y); - root.setWorldAndResolution(minecraft, x, y); - } + protected void restoreRenderState() { + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glEnable(GL11.GL_DEPTH_TEST); + RenderHelper.enableStandardItemLighting(); + } - @Override - public void actionPerformed(GuiButton button) { - root.actionPerformed(button); - } + protected void drawGuiBackgroundLayer(float p_146976_1_, int mouseX, int mouseY) { + GL11.glPushMatrix(); + GL11.glTranslated(this.guiLeft, this.guiTop, 0); + root.renderBackgroundLayer(this.mc, 0, 0, mouseX - this.guiLeft, mouseY - this.guiTop); + GL11.glPopMatrix(); + } - @Override - public void mouseMovedOrUp(int par1, int par2, int par3){ - root.mouseMovedOrUp(par1, par2, par3); - } + @Override + public void setWorldAndResolution(Minecraft minecraft, int x, int y) { + super.setWorldAndResolution(minecraft, x, y); + root.setWorldAndResolution(minecraft, x, y); + } - @Override - public void mouseClicked(int par1, int par2, int par3){ - root.mouseClicked(par1, par2, par3); - } + @Override + public void actionPerformed(GuiButton button) { + root.actionPerformed(button); + } - @Override - public void handleInput() { - super.handleInput(); - } + @Override + public void mouseMovedOrUp(int par1, int par2, int par3) { + root.mouseMovedOrUp(par1, par2, par3); + } - @Override - public void initGui() { - super.initGui(); - this.guiLeft = (this.width - this.xSize) / 2; - this.guiTop = (this.height - this.ySize) / 2; - } - - @Override - public boolean doesGuiPauseGame() { - return false; - } + @Override + public void mouseClicked(int par1, int par2, int par3) { + root.mouseClicked(par1, par2, par3); + } + + @Override + public void handleInput() { + super.handleInput(); + } + + @Override + public void initGui() { + super.initGui(); + this.guiLeft = (this.width - this.xSize) / 2; + this.guiTop = (this.height - this.ySize) / 2; + } + + @Override + public boolean doesGuiPauseGame() { + return false; + } } diff --git a/src/main/java/techreborn/pda/PageCollection.java b/src/main/java/techreborn/pda/PageCollection.java index 2d6078726..1fca9e80c 100644 --- a/src/main/java/techreborn/pda/PageCollection.java +++ b/src/main/java/techreborn/pda/PageCollection.java @@ -1,85 +1,84 @@ package techreborn.pda; -import java.util.List; - import com.google.common.collect.Lists; - import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.GuiButton; import techreborn.pda.pages.BasePage; -public class PageCollection extends Gui{ - - public final List pages = Lists.newArrayList(); - private String ACTIVE_PAGE = "CONTENTS"; - protected int x; - protected int y; +import java.util.List; - public PageCollection() { - this.x = 0; - this.y = 0; - } +public class PageCollection extends Gui { - public void addPage(BasePage page) { - pages.add(page); - } + public final List pages = Lists.newArrayList(); + private String ACTIVE_PAGE = "CONTENTS"; + protected int x; + protected int y; - public BasePage getPageByName(String name){ - for (BasePage component : pages) { - if (component.getReferenceName().equals(ACTIVE_PAGE)) { - return component; - } - } - return null; - } + public PageCollection() { + this.x = 0; + this.y = 0; + } - public BasePage getActivePage(){ - for (BasePage component : pages) { - if (component.getReferenceName().equals(ACTIVE_PAGE)) { - return component; - } - } - return null; - } + public void addPage(BasePage page) { + pages.add(page); + } - public final void drawScreen(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) { - if (getActivePage() == null) return; - getActivePage().drawScreen(minecraft, offsetX, offsetY, mouseX, mouseY); - } + public BasePage getPageByName(String name) { + for (BasePage component : pages) { + if (component.getReferenceName().equals(ACTIVE_PAGE)) { + return component; + } + } + return null; + } + + public BasePage getActivePage() { + for (BasePage component : pages) { + if (component.getReferenceName().equals(ACTIVE_PAGE)) { + return component; + } + } + return null; + } + + public final void drawScreen(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) { + if (getActivePage() == null) return; + getActivePage().drawScreen(minecraft, offsetX, offsetY, mouseX, mouseY); + } - public final void renderBackgroundLayer(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) { - if (getActivePage() == null) return; - getActivePage().renderBackgroundLayer(minecraft, offsetX, offsetY, mouseX, mouseY); - } + public final void renderBackgroundLayer(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) { + if (getActivePage() == null) return; + getActivePage().renderBackgroundLayer(minecraft, offsetX, offsetY, mouseX, mouseY); + } - public void changeActivePage(String newPage){ - ACTIVE_PAGE = newPage; - if (getActivePage() == null) return; - getActivePage().setWorldAndResolution(Minecraft.getMinecraft(), x, y); - } + public void changeActivePage(String newPage) { + ACTIVE_PAGE = newPage; + if (getActivePage() == null) return; + getActivePage().setWorldAndResolution(Minecraft.getMinecraft(), x, y); + } - public void setWorldAndResolution(Minecraft minecraft, int x, int y) { - if (getActivePage() == null) return; - getActivePage().setWorldAndResolution(minecraft, x, y); - this.x = x; - this.y = y; - } + public void setWorldAndResolution(Minecraft minecraft, int x, int y) { + if (getActivePage() == null) return; + getActivePage().setWorldAndResolution(minecraft, x, y); + this.x = x; + this.y = y; + } - protected void actionPerformed(GuiButton button) { - if (getActivePage() == null) return; - getActivePage().actionPerformed(button); - } + protected void actionPerformed(GuiButton button) { + if (getActivePage() == null) return; + getActivePage().actionPerformed(button); + } - protected void mouseMovedOrUp(int par1, int par2, int par3){ - if (getActivePage() == null) return; - getActivePage().mouseMovedOrUp(par1, par2, par3); - } + protected void mouseMovedOrUp(int par1, int par2, int par3) { + if (getActivePage() == null) return; + getActivePage().mouseMovedOrUp(par1, par2, par3); + } - protected void mouseClicked(int par1, int par2, int par3){ - if (getActivePage() == null) return; - getActivePage().mouseClicked(par1, par2, par3); - } + protected void mouseClicked(int par1, int par2, int par3) { + if (getActivePage() == null) return; + getActivePage().mouseClicked(par1, par2, par3); + } } diff --git a/src/main/java/techreborn/pda/pages/BasePage.java b/src/main/java/techreborn/pda/pages/BasePage.java index cb52eb599..19586d1f8 100644 --- a/src/main/java/techreborn/pda/pages/BasePage.java +++ b/src/main/java/techreborn/pda/pages/BasePage.java @@ -1,103 +1,106 @@ package techreborn.pda.pages; -import java.awt.Button; - -import org.lwjgl.opengl.GL11; - import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; -import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ResourceLocation; import net.minecraft.util.StatCollector; -import techreborn.client.container.ContainerPda; -import techreborn.cofhLib.gui.GuiBase; -import techreborn.cofhLib.gui.GuiColor; -import techreborn.cofhLib.gui.element.ElementSlider; import techreborn.pda.PageCollection; public class BasePage extends GuiScreen { - //Name used to reference the page - private String REFERENCE_NAME; - //Name Displayed in the index page - public String INDEX_NAME; - public boolean hasIndexButton = false; - public static final ResourceLocation PAGE_TEXTURE = new ResourceLocation("techreborn:textures/pda/gui/pda.png"); - private final int xSize = 256; - private final int ySize = 202; - protected PageCollection collection; + //Name used to reference the page + private String REFERENCE_NAME; + //Name Displayed in the index page + public String INDEX_NAME; + public boolean hasIndexButton = false; + public static final ResourceLocation PAGE_TEXTURE = new ResourceLocation("techreborn:textures/pda/gui/pda.png"); + private final int xSize = 256; + private final int ySize = 202; + protected PageCollection collection; - public BasePage(){} + public BasePage() { + } - public BasePage(String referenceName, PageCollection collection) { - this.REFERENCE_NAME = referenceName; - this.mc = Minecraft.getMinecraft(); - this.collection = collection; - initGui(); - } + public BasePage(String referenceName, PageCollection collection) { + this.REFERENCE_NAME = referenceName; + this.mc = Minecraft.getMinecraft(); + this.collection = collection; + initGui(); + } - public BasePage(String referenceName, boolean showInMenue, PageCollection collection) { - this(referenceName, collection); - this.hasIndexButton = showInMenue; - } + public BasePage(String referenceName, boolean showInMenue, PageCollection collection) { + this(referenceName, collection); + this.hasIndexButton = showInMenue; + } - public int getXMin(){ - return (this.width - xSize) / 2; - } + public int getXMin() { + return (this.width - xSize) / 2; + } - public int getYMin(){ - return (this.height - ySize) / 2; - } + public int getYMin() { + return (this.height - ySize) / 2; + } - public void setXMin(int x){ - this.width = x; - } + public void setXMin(int x) { + this.width = x; + } - public void setYMin(int y){ - this.height = y; - } + public void setYMin(int y) { + this.height = y; + } - //Unlocalized Index Page Name - public BasePage setIndexName(String unlocalizedName){ - this.INDEX_NAME = ttl(unlocalizedName); - return this; - } + //Unlocalized Index Page Name + public BasePage setIndexName(String unlocalizedName) { + this.INDEX_NAME = ttl(unlocalizedName); + return this; + } - @SuppressWarnings("unchecked") - @Override - public void initGui() { - buttonList.clear(); - buttonList.add(new GuiButton(0, getXMin()+88, getYMin()+181, 80, 16, ttl("techreborn.pda.backbutton"))); - } + @SuppressWarnings("unchecked") + @Override + public void initGui() { + buttonList.clear(); + buttonList.add(new GuiButton(0, getXMin() + 88, getYMin() + 181, 80, 16, ttl("techreborn.pda.backbutton"))); + } - public void setReferenceName(String name){ - REFERENCE_NAME = name;} + public void setReferenceName(String name) { + REFERENCE_NAME = name; + } - public String getReferenceName(){ return REFERENCE_NAME;} + public String getReferenceName() { + return REFERENCE_NAME; + } - public void renderBackgroundLayer(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY){ - minecraft.renderEngine.bindTexture(PAGE_TEXTURE); - drawTexturedModalRect(offsetX, offsetY, 0, 0, xSize, ySize); - } + public void renderBackgroundLayer(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) { + minecraft.renderEngine.bindTexture(PAGE_TEXTURE); + drawTexturedModalRect(offsetX, offsetY, 0, 0, xSize, ySize); + } - public void renderOverlayComponents(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY){ - } + public void renderOverlayComponents(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) { + } - public void drawScreen(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) { - super.drawScreen(mouseX+offsetX, mouseY+offsetY, 0); - renderOverlayComponents(minecraft, offsetX, offsetY, mouseX, mouseY); - } + public void drawScreen(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) { + super.drawScreen(mouseX + offsetX, mouseY + offsetY, 0); + renderOverlayComponents(minecraft, offsetX, offsetY, mouseX, mouseY); + } - @Override - public void actionPerformed(GuiButton button) { - if (button.id == 0)collection.changeActivePage("CONTENTS"); - } - @Override - public void mouseMovedOrUp(int par1, int par2, int par3){super.mouseMovedOrUp(par1, par2, par3);} - @Override - public void mouseClicked(int par1, int par2, int par3){super.mouseClicked(par1, par2, par3);} + @Override + public void actionPerformed(GuiButton button) { + if (button.id == 0) collection.changeActivePage("CONTENTS"); + } - //Translate To Local - public String ttl(String unlocalizedName){return StatCollector.translateToLocal(unlocalizedName);} + @Override + public void mouseMovedOrUp(int par1, int par2, int par3) { + super.mouseMovedOrUp(par1, par2, par3); + } + + @Override + public void mouseClicked(int par1, int par2, int par3) { + super.mouseClicked(par1, par2, par3); + } + + //Translate To Local + public String ttl(String unlocalizedName) { + return StatCollector.translateToLocal(unlocalizedName); + } } diff --git a/src/main/java/techreborn/pda/pages/ContentsPage.java b/src/main/java/techreborn/pda/pages/ContentsPage.java index 574a7d171..7fcbc31cc 100644 --- a/src/main/java/techreborn/pda/pages/ContentsPage.java +++ b/src/main/java/techreborn/pda/pages/ContentsPage.java @@ -1,58 +1,56 @@ package techreborn.pda.pages; -import java.awt.Color; - import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; import net.minecraft.item.ItemStack; import techreborn.config.TechRebornConfigGui; import techreborn.init.ModBlocks; import techreborn.init.ModItems; -import techreborn.lib.ModInfo; import techreborn.pda.PageCollection; import techreborn.pda.util.GuiButtonCustomTexture; -import techreborn.pda.util.GuiButtonTextOnly; + +import java.awt.*; public class ContentsPage extends TitledPage { - public ContentsPage(String name, PageCollection collection) { - super(name, false, collection, "techreborn.pda.contents", Color.white.getRGB()); - } + public ContentsPage(String name, PageCollection collection) { + super(name, false, collection, "techreborn.pda.contents", Color.white.getRGB()); + } - @SuppressWarnings("unchecked") - @Override - public void initGui() { - buttonList.clear(); - buttonList.add(new GuiButtonCustomTexture(0, getXMin() + 25, getYMin() + 20, 0, 46, 80, 20, new ItemStack(ModBlocks.AlloySmelter), "INDEX", "MACHINES")); - buttonList.add(new GuiButtonCustomTexture(1, getXMin() + 160, getYMin() + 20, 0, 46, 80, 20, new ItemStack(ModItems.uuMatter), "INDEX", "ITEMS")); - buttonList.add(new GuiButtonCustomTexture(2, getXMin() + 25, getYMin() + 40, 0, 46, 80, 20, new ItemStack(ModBlocks.DieselGenerator), "INDEX", "POWER GENERATION")); - buttonList.add(new GuiButtonCustomTexture(3, getXMin() + 160, getYMin() + 40, 0, 46, 80, 20, new ItemStack(ModItems.advancedDrill), "INDEX", "TOOLS")); - buttonList.add(new GuiButtonCustomTexture(4, getXMin() + 25, getYMin() + 60, 0, 46, 80, 20, new ItemStack(ModBlocks.Aesu), "INDEX", "POWER STORAGE")); - buttonList.add(new GuiButtonCustomTexture(5, getXMin() + 25, getYMin() + 80, 0, 46, 80, 20, new ItemStack(ModBlocks.MachineCasing), "INDEX", "MULTIBLOCKS")); - buttonList.add(new GuiButtonCustomTexture(6, getXMin() + 160, getYMin() + 60, 0, 46, 80, 20, new ItemStack(ModItems.upgrades), "INDEX", "UPGRADES")); - - buttonList.add(new GuiButtonCustomTexture(7, getXMin() + 160, getYMin() + 180, 0, 46, 80, 20, new ItemStack(ModItems.lapotronicOrb), "INDEX", "Changelog")); - buttonList.add(new GuiButtonCustomTexture(8, getXMin() + 25, getYMin() + 180, 0, 46, 80, 20, new ItemStack(ModItems.lapotronicOrb), "INDEX", "Configs")); - } - - @Override - public void renderBackgroundLayer(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) { - super.renderBackgroundLayer(minecraft, offsetX, offsetY, mouseX, mouseY); - } + @SuppressWarnings("unchecked") + @Override + public void initGui() { + buttonList.clear(); + buttonList.add(new GuiButtonCustomTexture(0, getXMin() + 25, getYMin() + 20, 0, 46, 80, 20, new ItemStack(ModBlocks.AlloySmelter), "INDEX", "MACHINES")); + buttonList.add(new GuiButtonCustomTexture(1, getXMin() + 160, getYMin() + 20, 0, 46, 80, 20, new ItemStack(ModItems.uuMatter), "INDEX", "ITEMS")); + buttonList.add(new GuiButtonCustomTexture(2, getXMin() + 25, getYMin() + 40, 0, 46, 80, 20, new ItemStack(ModBlocks.DieselGenerator), "INDEX", "POWER GENERATION")); + buttonList.add(new GuiButtonCustomTexture(3, getXMin() + 160, getYMin() + 40, 0, 46, 80, 20, new ItemStack(ModItems.advancedDrill), "INDEX", "TOOLS")); + buttonList.add(new GuiButtonCustomTexture(4, getXMin() + 25, getYMin() + 60, 0, 46, 80, 20, new ItemStack(ModBlocks.Aesu), "INDEX", "POWER STORAGE")); + buttonList.add(new GuiButtonCustomTexture(5, getXMin() + 25, getYMin() + 80, 0, 46, 80, 20, new ItemStack(ModBlocks.MachineCasing), "INDEX", "MULTIBLOCKS")); + buttonList.add(new GuiButtonCustomTexture(6, getXMin() + 160, getYMin() + 60, 0, 46, 80, 20, new ItemStack(ModItems.upgrades), "INDEX", "UPGRADES")); - @Override - public void actionPerformed(GuiButton button) { - if (button.id == 0)collection.changeActivePage("MACHINES"); - if (button.id == 1)collection.changeActivePage("ITEMS"); - if (button.id == 2)collection.changeActivePage("POWER_GENERATION"); - if (button.id == 3)collection.changeActivePage("TOOLS"); - if (button.id == 4)collection.changeActivePage("POWER_STORAGE"); - if (button.id == 5)collection.changeActivePage("MULTIBLOCKS"); - if (button.id == 6)collection.changeActivePage("UPGRADES"); - if (button.id == 7)collection.changeActivePage("VERSION"); - if (button.id == 8)mc.displayGuiScreen(new TechRebornConfigGui(this)); - - if (button.id == 9)collection.changeActivePage("CONFIG"); + buttonList.add(new GuiButtonCustomTexture(7, getXMin() + 160, getYMin() + 180, 0, 46, 80, 20, new ItemStack(ModItems.lapotronicOrb), "INDEX", "Changelog")); + buttonList.add(new GuiButtonCustomTexture(8, getXMin() + 25, getYMin() + 180, 0, 46, 80, 20, new ItemStack(ModItems.lapotronicOrb), "INDEX", "Configs")); + } - } + @Override + public void renderBackgroundLayer(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) { + super.renderBackgroundLayer(minecraft, offsetX, offsetY, mouseX, mouseY); + } + + @Override + public void actionPerformed(GuiButton button) { + if (button.id == 0) collection.changeActivePage("MACHINES"); + if (button.id == 1) collection.changeActivePage("ITEMS"); + if (button.id == 2) collection.changeActivePage("POWER_GENERATION"); + if (button.id == 3) collection.changeActivePage("TOOLS"); + if (button.id == 4) collection.changeActivePage("POWER_STORAGE"); + if (button.id == 5) collection.changeActivePage("MULTIBLOCKS"); + if (button.id == 6) collection.changeActivePage("UPGRADES"); + if (button.id == 7) collection.changeActivePage("VERSION"); + if (button.id == 8) mc.displayGuiScreen(new TechRebornConfigGui(this)); + + if (button.id == 9) collection.changeActivePage("CONFIG"); + + } } diff --git a/src/main/java/techreborn/pda/pages/CraftingInfoPage.java b/src/main/java/techreborn/pda/pages/CraftingInfoPage.java index cbc8916f6..57fe63ee0 100644 --- a/src/main/java/techreborn/pda/pages/CraftingInfoPage.java +++ b/src/main/java/techreborn/pda/pages/CraftingInfoPage.java @@ -1,285 +1,277 @@ package techreborn.pda.pages; -import java.awt.Color; +import com.google.common.base.Objects; +import com.google.common.base.Strings; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.renderer.entity.RenderItem; +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.*; +import net.minecraft.util.EnumChatFormatting; +import net.minecraftforge.oredict.OreDictionary; +import net.minecraftforge.oredict.ShapedOreRecipe; +import net.minecraftforge.oredict.ShapelessOreRecipe; +import org.lwjgl.opengl.GL11; +import techreborn.pda.PageCollection; + +import java.awt.*; import java.lang.reflect.Field; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Map; -import org.lwjgl.opengl.GL11; +public class CraftingInfoPage extends TitledPage { + protected static RenderItem itemRenderer = new RenderItem(); + public ItemStack result; + private boolean isSmelting = false; + private ItemStack[] recipe = new ItemStack[9]; + private boolean hasRecipe = false; + private String rawDescription; + private List formattedDescription; + private float descriptionScale = 0.66f; -import com.google.common.base.Objects; -import com.google.common.base.Strings; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.Lists; + public CraftingInfoPage(String name, PageCollection collection, ItemStack itemStack, String unlocalizedDescription) { + super(name, true, collection, itemStack.getUnlocalizedName() + ".name", Color.white.getRGB()); + this.result = itemStack; + this.recipe = getFirstRecipeForItem(itemStack); + for (ItemStack stack : recipe) if (stack != null) hasRecipe = true; + if (unlocalizedDescription == "") rawDescription = ttl(itemStack.getUnlocalizedName() + ".description"); + else rawDescription = ttl(unlocalizedDescription); + } -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.renderer.RenderHelper; -import net.minecraft.client.renderer.entity.RenderItem; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.CraftingManager; -import net.minecraft.item.crafting.FurnaceRecipes; -import net.minecraft.item.crafting.IRecipe; -import net.minecraft.item.crafting.ShapedRecipes; -import net.minecraft.item.crafting.ShapelessRecipes; -import net.minecraft.util.EnumChatFormatting; -import net.minecraftforge.oredict.OreDictionary; -import net.minecraftforge.oredict.ShapedOreRecipe; -import net.minecraftforge.oredict.ShapelessOreRecipe; -import techreborn.client.GuiUtil; -import techreborn.pda.PageCollection; -import techreborn.util.LogHelper; + @Override + public void renderBackgroundLayer(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) { + super.renderBackgroundLayer(minecraft, offsetX, offsetY, mouseX, mouseY); + GL11.glPushMatrix(); + if (isSmelting) { + drawTexturedModalRect(offsetX + 87, offsetY + 15, 116, 202, 82, 54); + } else { + if (hasRecipe) { + drawTexturedModalRect(offsetX + 70, offsetY + 15, 0, 202, 116, 54); + } else { + drawTexturedModalRect(offsetX + 119, offsetY + 17, 0, 202, 18, 18); + drawString(fontRendererObj, "No Crafting Recipe", offsetX + 145, offsetY + 17, Color.white.getRGB()); + } + } + GL11.glPopMatrix(); -public class CraftingInfoPage extends TitledPage{ - protected static RenderItem itemRenderer = new RenderItem(); - public ItemStack result; - private boolean isSmelting = false; - private ItemStack[] recipe = new ItemStack[9]; - private boolean hasRecipe = false; - private String rawDescription; - private List formattedDescription; - private float descriptionScale = 0.66f; + } - public CraftingInfoPage(String name, PageCollection collection, ItemStack itemStack, String unlocalizedDescription) { - super(name, true, collection, itemStack.getUnlocalizedName()+".name", Color.white.getRGB()); - this.result = itemStack; - this.recipe = getFirstRecipeForItem(itemStack); - for (ItemStack stack : recipe) if (stack != null) hasRecipe = true; - if (unlocalizedDescription == "") rawDescription = ttl(itemStack.getUnlocalizedName()+".description"); - else rawDescription = ttl(unlocalizedDescription); - } + public void drawScreen(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) { + super.drawScreen(minecraft, offsetX, offsetY, mouseX, mouseY); + int relativeMouseX = mouseX + offsetX; + int relativeMouseY = mouseY + offsetY; + int gridOffsetX = isSmelting ? 88 : 71; + int gridOffsetY = 16; + int itemBoxSize = 18; + addDescription(minecraft, offsetX, offsetY); - @Override - public void renderBackgroundLayer(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) { - super.renderBackgroundLayer(minecraft, offsetX, offsetY, mouseX, mouseY); - GL11.glPushMatrix(); - if (isSmelting){ - drawTexturedModalRect(offsetX + 87, offsetY + 15, 116, 202, 82, 54); - }else { - if (hasRecipe) { - drawTexturedModalRect(offsetX + 70, offsetY + 15, 0, 202, 116, 54); - } - else { - drawTexturedModalRect(offsetX + 119, offsetY + 17, 0, 202, 18, 18); - drawString(fontRendererObj, "No Crafting Recipe", offsetX + 145, offsetY + 17, Color.white.getRGB()); - } - } - GL11.glPopMatrix(); + ItemStack tooltip = null; + int i = 0; + for (ItemStack input : recipe) { + if (input != null) { + int row = (i % 3); + int column = i / 3; + int itemX = offsetX + gridOffsetX + (row * itemBoxSize); + int itemY = offsetY + gridOffsetY + (column * itemBoxSize); + drawItemStack(input, itemX, itemY, ""); + if (relativeMouseX > itemX - 2 && relativeMouseX < itemX - 2 + itemBoxSize && + relativeMouseY > itemY - 2 && relativeMouseY < itemY - 2 + itemBoxSize) { + tooltip = input; + } + } + i++; + } + int itemX = offsetX + (isSmelting ? 148 : 165); + int itemY = offsetY + 34; + if (!hasRecipe) { + itemX = offsetX + 120; + itemY = offsetY + 18; + } - } + drawItemStack(result, itemX, itemY, ""); + if (relativeMouseX > itemX - 2 && relativeMouseX < itemX - 2 + itemBoxSize && + relativeMouseY > itemY - 2 && relativeMouseY < itemY - 2 + itemBoxSize) { + tooltip = result; + } + if (tooltip != null) { + drawItemStackTooltip(tooltip, relativeMouseX, relativeMouseY); + } + } - public void drawScreen(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) { - super.drawScreen(minecraft, offsetX, offsetY, mouseX, mouseY); - int relativeMouseX = mouseX + offsetX; - int relativeMouseY = mouseY + offsetY; - int gridOffsetX = isSmelting ? 88 : 71; - int gridOffsetY = 16; - int itemBoxSize = 18; - addDescription(minecraft, offsetX, offsetY); - - ItemStack tooltip = null; - int i = 0; - for (ItemStack input : recipe) { - if (input != null) { - int row = (i % 3); - int column = i / 3; - int itemX = offsetX + gridOffsetX + (row * itemBoxSize); - int itemY = offsetY + gridOffsetY + (column * itemBoxSize); - drawItemStack(input, itemX, itemY, ""); - if (relativeMouseX > itemX - 2 && relativeMouseX < itemX - 2 + itemBoxSize && - relativeMouseY > itemY - 2 && relativeMouseY < itemY - 2 + itemBoxSize) { - tooltip = input; - } - } - i++; - } - int itemX = offsetX + (isSmelting ? 148 : 165); - int itemY = offsetY + 34; - if (!hasRecipe){ - itemX = offsetX+120; - itemY = offsetY+18; - } - - drawItemStack(result, itemX, itemY, ""); - if (relativeMouseX > itemX - 2 && relativeMouseX < itemX - 2 + itemBoxSize && - relativeMouseY > itemY - 2 && relativeMouseY < itemY - 2 + itemBoxSize) { - tooltip = result; - } - if (tooltip != null) { - drawItemStackTooltip(tooltip, relativeMouseX, relativeMouseY); - } - } - - public void addDescription(Minecraft minecraft, int offsetX, int offsetY){ - GL11.glPushMatrix(); - if (hasRecipe) GL11.glTranslated(offsetX+5, offsetY+75, 1); - else GL11.glTranslated(offsetX+5, offsetY+40, 1); - GL11.glScalef(descriptionScale, descriptionScale, descriptionScale); - int offset = 0; - for (String s : getFormattedText(fontRendererObj)) { - if (s == null) break; - if (s.contains("\\%") && s.substring(0,2).equals("\\%")){ - s = s.substring(2); - offset += fontRendererObj.FONT_HEIGHT/2; - } - fontRendererObj.drawString(s, 0, offset, Color.white.getRGB()); - offset += fontRendererObj.FONT_HEIGHT; - } - GL11.glPopMatrix(); - } + public void addDescription(Minecraft minecraft, int offsetX, int offsetY) { + GL11.glPushMatrix(); + if (hasRecipe) GL11.glTranslated(offsetX + 5, offsetY + 75, 1); + else GL11.glTranslated(offsetX + 5, offsetY + 40, 1); + GL11.glScalef(descriptionScale, descriptionScale, descriptionScale); + int offset = 0; + for (String s : getFormattedText(fontRendererObj)) { + if (s == null) break; + if (s.contains("\\%") && s.substring(0, 2).equals("\\%")) { + s = s.substring(2); + offset += fontRendererObj.FONT_HEIGHT / 2; + } + fontRendererObj.drawString(s, 0, offset, Color.white.getRGB()); + offset += fontRendererObj.FONT_HEIGHT; + } + GL11.glPopMatrix(); + } - @SuppressWarnings("unchecked") - public List getFormattedText(FontRenderer fr) { - if (formattedDescription == null) { - formattedDescription = new ArrayList(); + @SuppressWarnings("unchecked") + public List getFormattedText(FontRenderer fr) { + if (formattedDescription == null) { + formattedDescription = new ArrayList(); - if (Strings.isNullOrEmpty(rawDescription)) { - formattedDescription = ImmutableList.of(); - return formattedDescription; - } - if (!rawDescription.contains("\\n")) { - formattedDescription = ImmutableList.copyOf(fr.listFormattedStringToWidth(rawDescription, 370)); - return formattedDescription; - } + if (Strings.isNullOrEmpty(rawDescription)) { + formattedDescription = ImmutableList.of(); + return formattedDescription; + } + if (!rawDescription.contains("\\n")) { + formattedDescription = ImmutableList.copyOf(fr.listFormattedStringToWidth(rawDescription, 370)); + return formattedDescription; + } - List segments = new ArrayList(); //Each separate string that is separated by a \n - String raw = rawDescription; + List segments = new ArrayList(); //Each separate string that is separated by a \n + String raw = rawDescription; - int escape = 0; - while (raw.contains("\\n")) { - segments.add(raw.substring(0, raw.indexOf("\\n"))); - raw = raw.substring(raw.indexOf("\\n") + 2); - if (!raw.contains("\\n")) segments.add(raw); + int escape = 0; + while (raw.contains("\\n")) { + segments.add(raw.substring(0, raw.indexOf("\\n"))); + raw = raw.substring(raw.indexOf("\\n") + 2); + if (!raw.contains("\\n")) segments.add(raw); - escape++; - if (escape > 100) { - break; - } - } + escape++; + if (escape > 100) { + break; + } + } - for (String s : segments) - formattedDescription.addAll(ImmutableList.copyOf(fr.listFormattedStringToWidth(s, 370))); - } - return formattedDescription; -} + for (String s : segments) + formattedDescription.addAll(ImmutableList.copyOf(fr.listFormattedStringToWidth(s, 370))); + } + return formattedDescription; + } - protected void drawItemStackTooltip(ItemStack stack, int x, int y) { - final Minecraft mc = Minecraft.getMinecraft(); - FontRenderer font = Objects.firstNonNull(stack.getItem().getFontRenderer(stack), mc.fontRenderer); + protected void drawItemStackTooltip(ItemStack stack, int x, int y) { + final Minecraft mc = Minecraft.getMinecraft(); + FontRenderer font = Objects.firstNonNull(stack.getItem().getFontRenderer(stack), mc.fontRenderer); - @SuppressWarnings("unchecked") - List list = stack.getTooltip(mc.thePlayer, mc.gameSettings.advancedItemTooltips); + @SuppressWarnings("unchecked") + List list = stack.getTooltip(mc.thePlayer, mc.gameSettings.advancedItemTooltips); - List colored = Lists.newArrayListWithCapacity(list.size()); - colored.add(stack.getRarity().rarityColor + list.get(0)); - for (String line : list) - colored.add(EnumChatFormatting.GRAY + line); + List colored = Lists.newArrayListWithCapacity(list.size()); + colored.add(stack.getRarity().rarityColor + list.get(0)); + for (String line : list) + colored.add(EnumChatFormatting.GRAY + line); - if (colored.size() >= 2) colored.remove(1); - drawHoveringText(colored, x, y, font); - } + if (colored.size() >= 2) colored.remove(1); + drawHoveringText(colored, x, y, font); + } - private void drawItemStack(ItemStack par1ItemStack, int par2, int par3, String par4Str) { - GL11.glTranslatef(0.0F, 0.0F, 32.0F); - this.zLevel = 200.0F; - itemRenderer.zLevel = 200.0F; - RenderHelper.enableGUIStandardItemLighting(); - GL11.glColor3f(1f, 1f, 1f); - GL11.glEnable(GL11.GL_NORMALIZE); - FontRenderer font = null; - if (par1ItemStack != null) font = par1ItemStack.getItem().getFontRenderer(par1ItemStack); - if (font == null) font = Minecraft.getMinecraft().fontRenderer; - itemRenderer.renderItemAndEffectIntoGUI(font, Minecraft.getMinecraft().getTextureManager(), par1ItemStack, par2, par3); - itemRenderer.renderItemOverlayIntoGUI(font, Minecraft.getMinecraft().getTextureManager(), par1ItemStack, par2, par3, par4Str); - this.zLevel = 0.0F; - itemRenderer.zLevel = 0.0F; - } + private void drawItemStack(ItemStack par1ItemStack, int par2, int par3, String par4Str) { + GL11.glTranslatef(0.0F, 0.0F, 32.0F); + this.zLevel = 200.0F; + itemRenderer.zLevel = 200.0F; + RenderHelper.enableGUIStandardItemLighting(); + GL11.glColor3f(1f, 1f, 1f); + GL11.glEnable(GL11.GL_NORMALIZE); + FontRenderer font = null; + if (par1ItemStack != null) font = par1ItemStack.getItem().getFontRenderer(par1ItemStack); + if (font == null) font = Minecraft.getMinecraft().fontRenderer; + itemRenderer.renderItemAndEffectIntoGUI(font, Minecraft.getMinecraft().getTextureManager(), par1ItemStack, par2, par3); + itemRenderer.renderItemOverlayIntoGUI(font, Minecraft.getMinecraft().getTextureManager(), par1ItemStack, par2, par3, par4Str); + this.zLevel = 0.0F; + itemRenderer.zLevel = 0.0F; + } - @SuppressWarnings("unchecked") - private ItemStack[] getFirstRecipeForItem(ItemStack resultingItem) { - ItemStack[] recipeItems = new ItemStack[9]; - for (IRecipe recipe : (List) CraftingManager.getInstance().getRecipeList()) { - if (recipe == null) continue; + @SuppressWarnings("unchecked") + private ItemStack[] getFirstRecipeForItem(ItemStack resultingItem) { + ItemStack[] recipeItems = new ItemStack[9]; + for (IRecipe recipe : (List) CraftingManager.getInstance().getRecipeList()) { + if (recipe == null) continue; - ItemStack result = recipe.getRecipeOutput(); - if (result == null || !result.isItemEqual(resultingItem)) continue; + ItemStack result = recipe.getRecipeOutput(); + if (result == null || !result.isItemEqual(resultingItem)) continue; - Object[] input = getRecipeInput(recipe); - if (input == null) continue; + Object[] input = getRecipeInput(recipe); + if (input == null) continue; - for (int i = 0; i < input.length; i++) - recipeItems[i] = convertToStack(input[i]); - break; + for (int i = 0; i < input.length; i++) + recipeItems[i] = convertToStack(input[i]); + break; - } + } - Iterator iterator = FurnaceRecipes.smelting().getSmeltingList().entrySet().iterator(); - Map.Entry entry; + Iterator iterator = FurnaceRecipes.smelting().getSmeltingList().entrySet().iterator(); + Map.Entry entry; - while (iterator.hasNext()){ - entry = (Map.Entry)iterator.next(); - if (entry.getKey() instanceof ItemStack && ((ItemStack)entry.getValue()).isItemEqual(result)){ - isSmelting = true; - recipeItems[0] = (ItemStack)entry.getKey(); - } - } + while (iterator.hasNext()) { + entry = (Map.Entry) iterator.next(); + if (entry.getKey() instanceof ItemStack && ((ItemStack) entry.getValue()).isItemEqual(result)) { + isSmelting = true; + recipeItems[0] = (ItemStack) entry.getKey(); + } + } - return recipeItems; - } + return recipeItems; + } - protected ItemStack convertToStack(Object obj) { - ItemStack entry = null; - if (obj instanceof ItemStack) { - entry = (ItemStack)obj; - } else if (obj instanceof List) { - @SuppressWarnings("unchecked") - List list = (List)obj; - if (list.size() > 0) entry = list.get(0); - } + protected ItemStack convertToStack(Object obj) { + ItemStack entry = null; + if (obj instanceof ItemStack) { + entry = (ItemStack) obj; + } else if (obj instanceof List) { + @SuppressWarnings("unchecked") + List list = (List) obj; + if (list.size() > 0) entry = list.get(0); + } - if (entry == null) return null; - entry = entry.copy(); - if (entry.getItemDamage() == OreDictionary.WILDCARD_VALUE) entry.setItemDamage(0); - return entry; - } + if (entry == null) return null; + entry = entry.copy(); + if (entry.getItemDamage() == OreDictionary.WILDCARD_VALUE) entry.setItemDamage(0); + return entry; + } - @SuppressWarnings("unchecked") - private Object[] getRecipeInput(IRecipe recipe) { - if (recipe instanceof ShapelessOreRecipe) return ((ShapelessOreRecipe)recipe).getInput().toArray(); - else if (recipe instanceof ShapedOreRecipe) return getShapedOreRecipe((ShapedOreRecipe)recipe); - else if (recipe instanceof ShapedRecipes) return ((ShapedRecipes)recipe).recipeItems; - else if (recipe instanceof ShapelessRecipes) return ((ShapelessRecipes)recipe).recipeItems.toArray(new ItemStack[0]); - return null; - } + @SuppressWarnings("unchecked") + private Object[] getRecipeInput(IRecipe recipe) { + if (recipe instanceof ShapelessOreRecipe) return ((ShapelessOreRecipe) recipe).getInput().toArray(); + else if (recipe instanceof ShapedOreRecipe) return getShapedOreRecipe((ShapedOreRecipe) recipe); + else if (recipe instanceof ShapedRecipes) return ((ShapedRecipes) recipe).recipeItems; + else if (recipe instanceof ShapelessRecipes) + return ((ShapelessRecipes) recipe).recipeItems.toArray(new ItemStack[0]); + return null; + } - private Object[] getShapedOreRecipe(ShapedOreRecipe recipe) { - try { - Field field = ShapedOreRecipe.class.getDeclaredField("width"); - if (field != null) { - field.setAccessible(true); - int width = field.getInt(recipe); - Object[] input = recipe.getInput(); - Object[] grid = new Object[9]; - for (int i = 0, offset = 0, y = 0; y < 3; y++) { - for (int x = 0; x < 3; x++, i++) { - if (x < width && offset < input.length) { - grid[i] = input[offset]; - offset++; - } else { - grid[i] = null; - } - } - } - return grid; - } - } catch (Exception e) { - e.printStackTrace(); - } - return null; - } + private Object[] getShapedOreRecipe(ShapedOreRecipe recipe) { + try { + Field field = ShapedOreRecipe.class.getDeclaredField("width"); + if (field != null) { + field.setAccessible(true); + int width = field.getInt(recipe); + Object[] input = recipe.getInput(); + Object[] grid = new Object[9]; + for (int i = 0, offset = 0, y = 0; y < 3; y++) { + for (int x = 0; x < 3; x++, i++) { + if (x < width && offset < input.length) { + grid[i] = input[offset]; + offset++; + } else { + grid[i] = null; + } + } + } + return grid; + } + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } } diff --git a/src/main/java/techreborn/pda/pages/IndexPage.java b/src/main/java/techreborn/pda/pages/IndexPage.java index 441baf98d..0bef5e4c4 100644 --- a/src/main/java/techreborn/pda/pages/IndexPage.java +++ b/src/main/java/techreborn/pda/pages/IndexPage.java @@ -3,58 +3,58 @@ package techreborn.pda.pages; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; import techreborn.pda.PageCollection; -import techreborn.pda.util.GuiButtonAHeight; import techreborn.pda.util.GuiButtonTextOnly; -public class IndexPage extends TitledPage{ - - public IndexPage(String name, PageCollection collection) { - super(name, false, collection, "techreborn.pda.index", 518915); - } +public class IndexPage extends TitledPage { - @SuppressWarnings("unchecked") - @Override - public void initGui() { - buttonList.clear(); - int row = 0; - int collum = 0; - for (BasePage page : collection.pages){ - if (page.hasIndexButton){ - String indexName = page.INDEX_NAME; - if (indexName==null && page instanceof CraftingInfoPage) indexName = ttl(((CraftingInfoPage)page).result.getUnlocalizedName()+".name"); - else if (indexName==null) indexName = page.getReferenceName(); - int colour = 0000000; + public IndexPage(String name, PageCollection collection) { + super(name, false, collection, "techreborn.pda.index", 518915); + } - buttonList.add(new GuiButtonTextOnly(999, getXMin()+5+collum*81, getYMin()+20+(row*7), 82, 7, indexName, page.getReferenceName(), 6666666)); - row++; - if (row > 21){ - row = 0; - collum++; - } - } - } - } + @SuppressWarnings("unchecked") + @Override + public void initGui() { + buttonList.clear(); + int row = 0; + int collum = 0; + for (BasePage page : collection.pages) { + if (page.hasIndexButton) { + String indexName = page.INDEX_NAME; + if (indexName == null && page instanceof CraftingInfoPage) + indexName = ttl(((CraftingInfoPage) page).result.getUnlocalizedName() + ".name"); + else if (indexName == null) indexName = page.getReferenceName(); + int colour = 0000000; - @Override - public void actionPerformed(GuiButton button) { - if (button instanceof GuiButtonTextOnly) - collection.changeActivePage(((GuiButtonTextOnly)button).LINKED_PAGE); - if (button.id == 0) collection.changeActivePage("CONTENTS"); - } + buttonList.add(new GuiButtonTextOnly(999, getXMin() + 5 + collum * 81, getYMin() + 20 + (row * 7), 82, 7, indexName, page.getReferenceName(), 6666666)); + row++; + if (row > 21) { + row = 0; + collum++; + } + } + } + } - @Override - public void renderBackgroundLayer(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) { - super.renderBackgroundLayer(minecraft, offsetX, offsetY, mouseX, mouseY); - } + @Override + public void actionPerformed(GuiButton button) { + if (button instanceof GuiButtonTextOnly) + collection.changeActivePage(((GuiButtonTextOnly) button).LINKED_PAGE); + if (button.id == 0) collection.changeActivePage("CONTENTS"); + } - @Override - public void drawScreen(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) { - super.drawScreen(minecraft, offsetX, offsetY, mouseX, mouseY); - for (int k = 0; k < this.buttonList.size(); ++k){ - if (buttonList.get(k) instanceof GuiButtonTextOnly && ((GuiButtonTextOnly) buttonList.get(k)).getIsHovering()) { - ((GuiButtonTextOnly) this.buttonList.get(k)).drawButton(this.mc, mouseX + offsetX, mouseY + offsetY); - } - } - buttonList.add(new GuiButton(0, offsetX + 20, offsetY + 180, ttl("techreborn.pda.backbutton"))); - } + @Override + public void renderBackgroundLayer(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) { + super.renderBackgroundLayer(minecraft, offsetX, offsetY, mouseX, mouseY); + } + + @Override + public void drawScreen(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) { + super.drawScreen(minecraft, offsetX, offsetY, mouseX, mouseY); + for (int k = 0; k < this.buttonList.size(); ++k) { + if (buttonList.get(k) instanceof GuiButtonTextOnly && ((GuiButtonTextOnly) buttonList.get(k)).getIsHovering()) { + ((GuiButtonTextOnly) this.buttonList.get(k)).drawButton(this.mc, mouseX + offsetX, mouseY + offsetY); + } + } + buttonList.add(new GuiButton(0, offsetX + 20, offsetY + 180, ttl("techreborn.pda.backbutton"))); + } } diff --git a/src/main/java/techreborn/pda/pages/ItemsPage.java b/src/main/java/techreborn/pda/pages/ItemsPage.java index 84e3c1fb5..a58dee986 100644 --- a/src/main/java/techreborn/pda/pages/ItemsPage.java +++ b/src/main/java/techreborn/pda/pages/ItemsPage.java @@ -1,72 +1,65 @@ package techreborn.pda.pages; -import java.awt.Color; - -import org.lwjgl.opengl.GL11; - import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; -import net.minecraft.client.renderer.entity.RenderItem; -import net.minecraft.client.renderer.texture.TextureManager; -import net.minecraft.item.ItemStack; -import techreborn.init.ModItems; import techreborn.pda.PageCollection; -import techreborn.pda.util.GuiButtonAHeight; -import techreborn.pda.util.GuiButtonCustomTexture; import techreborn.pda.util.GuiButtonTextOnly; -public class ItemsPage extends TitledPage{ - public String PAGE; - - public ItemsPage(String name, PageCollection collection, String page) { - super(name, false, collection, page, Color.white.getRGB()); - PAGE = page; - } +import java.awt.*; - @SuppressWarnings("unchecked") - @Override - public void initGui() { - buttonList.clear(); - int row = 0; - int collum = 0; - for (BasePage page : collection.pages){ - if (page.hasIndexButton){ - String indexName = page.INDEX_NAME; - if (page.getReferenceName() != null && page.getReferenceName().contains(PAGE)){ - if (indexName==null && page instanceof CraftingInfoPage) indexName = ttl(((CraftingInfoPage)page).result.getUnlocalizedName()+".name"); - else if (indexName==null) indexName = page.getReferenceName(); - int colour = 77777777; - buttonList.add(new GuiButtonTextOnly(999, getXMin()+20+collum*120, getYMin()+20+(row*7), 82, 7, indexName, page.getReferenceName(), 6666666)); - row++; - if (row > 21){ - row = 0; - collum++; - } - } - } - } - buttonList.add(new GuiButton(1, getXMin() + 20, getYMin() + 180, ttl("techreborn.pda.backbutton"))); - } +public class ItemsPage extends TitledPage { + public String PAGE; - @Override - public void actionPerformed(GuiButton button) { - if (button instanceof GuiButtonTextOnly) - collection.changeActivePage(((GuiButtonTextOnly)button).LINKED_PAGE); - if (button.id == 1) collection.changeActivePage("CONTENTS"); - } + public ItemsPage(String name, PageCollection collection, String page) { + super(name, false, collection, page, Color.white.getRGB()); + PAGE = page; + } - @Override - public void renderBackgroundLayer(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) { - super.renderBackgroundLayer(minecraft, offsetX, offsetY, mouseX, mouseY); - } + @SuppressWarnings("unchecked") + @Override + public void initGui() { + buttonList.clear(); + int row = 0; + int collum = 0; + for (BasePage page : collection.pages) { + if (page.hasIndexButton) { + String indexName = page.INDEX_NAME; + if (page.getReferenceName() != null && page.getReferenceName().contains(PAGE)) { + if (indexName == null && page instanceof CraftingInfoPage) + indexName = ttl(((CraftingInfoPage) page).result.getUnlocalizedName() + ".name"); + else if (indexName == null) indexName = page.getReferenceName(); + int colour = 77777777; + buttonList.add(new GuiButtonTextOnly(999, getXMin() + 20 + collum * 120, getYMin() + 20 + (row * 7), 82, 7, indexName, page.getReferenceName(), 6666666)); + row++; + if (row > 21) { + row = 0; + collum++; + } + } + } + } + buttonList.add(new GuiButton(1, getXMin() + 20, getYMin() + 180, ttl("techreborn.pda.backbutton"))); + } - @Override - public void drawScreen(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) { - super.drawScreen(minecraft, offsetX, offsetY, mouseX, mouseY); - for (int k = 0; k < this.buttonList.size(); ++k){ - if (buttonList.get(k) instanceof GuiButtonTextOnly && ((GuiButtonTextOnly) buttonList.get(k)).getIsHovering()) { - ((GuiButtonTextOnly) this.buttonList.get(k)).drawButton(this.mc, mouseX + offsetX, mouseY + offsetY); - } - } - } + @Override + public void actionPerformed(GuiButton button) { + if (button instanceof GuiButtonTextOnly) + collection.changeActivePage(((GuiButtonTextOnly) button).LINKED_PAGE); + if (button.id == 1) collection.changeActivePage("CONTENTS"); + } + + @Override + public void renderBackgroundLayer(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) { + super.renderBackgroundLayer(minecraft, offsetX, offsetY, mouseX, mouseY); + } + + @Override + public void drawScreen(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) { + super.drawScreen(minecraft, offsetX, offsetY, mouseX, mouseY); + for (int k = 0; k < this.buttonList.size(); ++k) { + if (buttonList.get(k) instanceof GuiButtonTextOnly && ((GuiButtonTextOnly) buttonList.get(k)).getIsHovering()) { + ((GuiButtonTextOnly) this.buttonList.get(k)).drawButton(this.mc, mouseX + offsetX, mouseY + offsetY); + } + } + } } diff --git a/src/main/java/techreborn/pda/pages/MultiBlockPage.java b/src/main/java/techreborn/pda/pages/MultiBlockPage.java index 0b27e6155..f3ff26656 100644 --- a/src/main/java/techreborn/pda/pages/MultiBlockPage.java +++ b/src/main/java/techreborn/pda/pages/MultiBlockPage.java @@ -1,103 +1,97 @@ package techreborn.pda.pages; -import net.minecraft.client.gui.GuiButton; -import net.minecraft.init.Blocks; - -import java.awt.Color; - -import org.lwjgl.opengl.GL11; - import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.entity.RenderItem; -import net.minecraft.item.ItemStack; +import net.minecraft.client.gui.GuiButton; import net.minecraft.util.ResourceLocation; -import techreborn.client.multiblock.Multiblock; -import techreborn.client.multiblock.MultiblockSet; +import reborncore.client.multiblock.Multiblock; +import reborncore.client.multiblock.MultiblockSet; import techreborn.init.ModBlocks; import techreborn.pda.PageCollection; import techreborn.proxies.ClientProxy; -public class MultiBlockPage extends TitledPage{ - - public static ResourceLocation test = new ResourceLocation("techreborn:textures/pda/multiblocks/base.png"); +import java.awt.*; - public MultiBlockPage(String name, PageCollection collection, String unlocalizedTitle) { - super(name, false, collection, unlocalizedTitle, Color.white.getRGB()); - } - - @Override - public void initGui() { - super.initGui(); - GuiButton button = new GuiButton(212, getXMin() + 30, getYMin() + 140, "Show multiblock in world"); - buttonList.add(button); - if(ClientProxy.multiblockRenderEvent.currentMultiblock != null){ - button.displayString = "Hide multiblock in world"; - } - } - - @Override - public void drawBackground(int p_146278_1_) { - super.drawBackground(p_146278_1_); - } - - @Override - public void renderOverlayComponents(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) { - super.renderOverlayComponents(minecraft, offsetX, offsetY, mouseX, mouseY); - drawCenteredString(fontRendererObj, ttl("techreborn.pda.multiblock.decripion"), offsetX + 128, offsetY + 20, Color.white.getRGB()); - } +public class MultiBlockPage extends TitledPage { - @Override - public void actionPerformed(GuiButton button) { - super.actionPerformed(button); - if(button.id == 212){ - if(ClientProxy.multiblockRenderEvent.currentMultiblock == null){ - {//This code here makes a basic multiblock and then sets to the selected one. - Multiblock multiblock = new Multiblock(); - multiblock.addComponent(0, 0, 0, ModBlocks.MachineCasing, 0); - multiblock.addComponent(1, 0, 0, ModBlocks.MachineCasing, 0); - multiblock.addComponent(0, 0, 1, ModBlocks.MachineCasing, 0); - multiblock.addComponent(-1, 0, 0, ModBlocks.MachineCasing, 0); - multiblock.addComponent(0, 0, -1, ModBlocks.MachineCasing, 0); - multiblock.addComponent(-1, 0, -1, ModBlocks.MachineCasing, 0); - multiblock.addComponent(-1, 0, 1, ModBlocks.MachineCasing, 0); - multiblock.addComponent(1, 0, -1, ModBlocks.MachineCasing, 0); - multiblock.addComponent(1, 0, 1, ModBlocks.MachineCasing, 0); - - multiblock.addComponent(1, 1, 0, ModBlocks.MachineCasing, 0); - multiblock.addComponent(0, 1, 1, ModBlocks.MachineCasing, 0); - multiblock.addComponent(-1, 1, 0, ModBlocks.MachineCasing, 0); - multiblock.addComponent(0, 1, -1, ModBlocks.MachineCasing, 0); - multiblock.addComponent(-1, 1, -1, ModBlocks.MachineCasing, 0); - multiblock.addComponent(-1, 1, 1, ModBlocks.MachineCasing, 0); - multiblock.addComponent(1, 1, -1, ModBlocks.MachineCasing, 0); - multiblock.addComponent(1, 1, 1, ModBlocks.MachineCasing, 0); - - multiblock.addComponent(1, 2, 0, ModBlocks.MachineCasing, 0); - multiblock.addComponent(0, 2, 1, ModBlocks.MachineCasing, 0); - multiblock.addComponent(-1, 2, 0, ModBlocks.MachineCasing, 0); - multiblock.addComponent(0, 2, -1, ModBlocks.MachineCasing, 0); - multiblock.addComponent(-1, 2, -1, ModBlocks.MachineCasing, 0); - multiblock.addComponent(-1, 2, 1, ModBlocks.MachineCasing, 0); - multiblock.addComponent(1, 2, -1, ModBlocks.MachineCasing, 0); - multiblock.addComponent(1, 2, 1, ModBlocks.MachineCasing, 0); - - multiblock.addComponent(1, 3, 0, ModBlocks.MachineCasing, 0); - multiblock.addComponent(0, 3, 1, ModBlocks.MachineCasing, 0); - multiblock.addComponent(-1, 3, 0, ModBlocks.MachineCasing, 0); - multiblock.addComponent(0, 3, -1, ModBlocks.MachineCasing, 0); - multiblock.addComponent(-1, 3, -1, ModBlocks.MachineCasing, 0); - multiblock.addComponent(-1, 3, 1, ModBlocks.MachineCasing, 0); - multiblock.addComponent(1, 3, -1, ModBlocks.MachineCasing, 0); - multiblock.addComponent(1, 3, 1, ModBlocks.MachineCasing, 0); - - MultiblockSet set = new MultiblockSet(multiblock); - ClientProxy.multiblockRenderEvent.setMultiblock(set); - } - button.displayString = "Hide multiblock in world"; - } else { - ClientProxy.multiblockRenderEvent.setMultiblock(null); - button.displayString = "Show multiblock in world"; - } - } - } + public static ResourceLocation test = new ResourceLocation("techreborn:textures/pda/multiblocks/base.png"); + + public MultiBlockPage(String name, PageCollection collection, String unlocalizedTitle) { + super(name, false, collection, unlocalizedTitle, Color.white.getRGB()); + } + + @Override + public void initGui() { + super.initGui(); + GuiButton button = new GuiButton(212, getXMin() + 30, getYMin() + 140, "Show multiblock in world"); + buttonList.add(button); + if (ClientProxy.multiblockRenderEvent.currentMultiblock != null) { + button.displayString = "Hide multiblock in world"; + } + } + + @Override + public void drawBackground(int p_146278_1_) { + super.drawBackground(p_146278_1_); + } + + @Override + public void renderOverlayComponents(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) { + super.renderOverlayComponents(minecraft, offsetX, offsetY, mouseX, mouseY); + drawCenteredString(fontRendererObj, ttl("techreborn.pda.multiblock.decripion"), offsetX + 128, offsetY + 20, Color.white.getRGB()); + } + + @Override + public void actionPerformed(GuiButton button) { + super.actionPerformed(button); + if (button.id == 212) { + if (ClientProxy.multiblockRenderEvent.currentMultiblock == null) { + {//This code here makes a basic multiblock and then sets to the selected one. + Multiblock multiblock = new Multiblock(); + multiblock.addComponent(0, 0, 0, ModBlocks.MachineCasing, 0); + multiblock.addComponent(1, 0, 0, ModBlocks.MachineCasing, 0); + multiblock.addComponent(0, 0, 1, ModBlocks.MachineCasing, 0); + multiblock.addComponent(-1, 0, 0, ModBlocks.MachineCasing, 0); + multiblock.addComponent(0, 0, -1, ModBlocks.MachineCasing, 0); + multiblock.addComponent(-1, 0, -1, ModBlocks.MachineCasing, 0); + multiblock.addComponent(-1, 0, 1, ModBlocks.MachineCasing, 0); + multiblock.addComponent(1, 0, -1, ModBlocks.MachineCasing, 0); + multiblock.addComponent(1, 0, 1, ModBlocks.MachineCasing, 0); + + multiblock.addComponent(1, 1, 0, ModBlocks.MachineCasing, 0); + multiblock.addComponent(0, 1, 1, ModBlocks.MachineCasing, 0); + multiblock.addComponent(-1, 1, 0, ModBlocks.MachineCasing, 0); + multiblock.addComponent(0, 1, -1, ModBlocks.MachineCasing, 0); + multiblock.addComponent(-1, 1, -1, ModBlocks.MachineCasing, 0); + multiblock.addComponent(-1, 1, 1, ModBlocks.MachineCasing, 0); + multiblock.addComponent(1, 1, -1, ModBlocks.MachineCasing, 0); + multiblock.addComponent(1, 1, 1, ModBlocks.MachineCasing, 0); + + multiblock.addComponent(1, 2, 0, ModBlocks.MachineCasing, 0); + multiblock.addComponent(0, 2, 1, ModBlocks.MachineCasing, 0); + multiblock.addComponent(-1, 2, 0, ModBlocks.MachineCasing, 0); + multiblock.addComponent(0, 2, -1, ModBlocks.MachineCasing, 0); + multiblock.addComponent(-1, 2, -1, ModBlocks.MachineCasing, 0); + multiblock.addComponent(-1, 2, 1, ModBlocks.MachineCasing, 0); + multiblock.addComponent(1, 2, -1, ModBlocks.MachineCasing, 0); + multiblock.addComponent(1, 2, 1, ModBlocks.MachineCasing, 0); + + multiblock.addComponent(1, 3, 0, ModBlocks.MachineCasing, 0); + multiblock.addComponent(0, 3, 1, ModBlocks.MachineCasing, 0); + multiblock.addComponent(-1, 3, 0, ModBlocks.MachineCasing, 0); + multiblock.addComponent(0, 3, -1, ModBlocks.MachineCasing, 0); + multiblock.addComponent(-1, 3, -1, ModBlocks.MachineCasing, 0); + multiblock.addComponent(-1, 3, 1, ModBlocks.MachineCasing, 0); + multiblock.addComponent(1, 3, -1, ModBlocks.MachineCasing, 0); + multiblock.addComponent(1, 3, 1, ModBlocks.MachineCasing, 0); + + MultiblockSet set = new MultiblockSet(multiblock); + ClientProxy.multiblockRenderEvent.setMultiblock(set); + } + button.displayString = "Hide multiblock in world"; + } else { + ClientProxy.multiblockRenderEvent.setMultiblock(null); + button.displayString = "Show multiblock in world"; + } + } + } } diff --git a/src/main/java/techreborn/pda/pages/TitledPage.java b/src/main/java/techreborn/pda/pages/TitledPage.java index 43ed73edd..f3f3c6c40 100644 --- a/src/main/java/techreborn/pda/pages/TitledPage.java +++ b/src/main/java/techreborn/pda/pages/TitledPage.java @@ -3,20 +3,20 @@ package techreborn.pda.pages; import net.minecraft.client.Minecraft; import techreborn.pda.PageCollection; -public class TitledPage extends BasePage{ - private String title; - public boolean drawTitle = true; - private int colour; +public class TitledPage extends BasePage { + private String title; + public boolean drawTitle = true; + private int colour; - public TitledPage(String name, boolean showInMenue, PageCollection collection, String unlocalizedTitle, int colour) { - super(name, showInMenue, collection); - this.title = unlocalizedTitle; - this.colour = colour; - } + public TitledPage(String name, boolean showInMenue, PageCollection collection, String unlocalizedTitle, int colour) { + super(name, showInMenue, collection); + this.title = unlocalizedTitle; + this.colour = colour; + } - @Override - public void renderOverlayComponents(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) { - if (title == null) title = INDEX_NAME; - if (drawTitle)drawCenteredString(minecraft.fontRenderer, ttl(title), offsetX + 128, offsetY + 5, colour); - } + @Override + public void renderOverlayComponents(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) { + if (title == null) title = INDEX_NAME; + if (drawTitle) drawCenteredString(minecraft.fontRenderer, ttl(title), offsetX + 128, offsetY + 5, colour); + } } diff --git a/src/main/java/techreborn/pda/pages/VersionPage.java b/src/main/java/techreborn/pda/pages/VersionPage.java index 72b47d997..9f28a17ab 100644 --- a/src/main/java/techreborn/pda/pages/VersionPage.java +++ b/src/main/java/techreborn/pda/pages/VersionPage.java @@ -1,73 +1,62 @@ package techreborn.pda.pages; -import java.awt.Color; -import java.util.ArrayList; -import java.util.List; - -import org.lwjgl.opengl.Drawable; -import org.lwjgl.opengl.GL11; - -import com.google.common.base.Strings; -import com.google.common.collect.ImmutableList; - -import cpw.mods.fml.client.GuiModList; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraftforge.client.event.GuiScreenEvent; +import org.lwjgl.opengl.GL11; import techreborn.Core; -import techreborn.client.GuiUtil; import techreborn.lib.ModInfo; import techreborn.pda.PageCollection; -public class VersionPage extends TitledPage{ +import java.awt.*; +import java.util.ArrayList; - public VersionPage(String name, PageCollection collection, String unlocalizedTitle, int colour) { - super(name, false, collection, unlocalizedTitle, Color.white.getRGB()); - } - - @Override - public void initGui() { - super.initGui(); - } - - @Override - public void renderOverlayComponents(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) { - super.renderOverlayComponents(minecraft, offsetX, offsetY, mouseX, mouseY); - addDescription(mc, offsetX, offsetY); - addChangelog(mc, offsetX, offsetY); - addChangelog2(mc, offsetX, offsetY); - } - - @Override - public void renderBackgroundLayer(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) { - super.renderBackgroundLayer(minecraft, offsetX, offsetY, mouseX, mouseY); - } - - public void addDescription(Minecraft minecraft, int offsetX, int offsetY){ - GL11.glPushMatrix(); - this.drawCenteredString(minecraft.fontRenderer, "INSTALLED VERSION " + ModInfo.MOD_VERSION, offsetX + 120, offsetY + 20, 7777777); - this.drawCenteredString(minecraft.fontRenderer, "LATEST VERSION " + "TODO", offsetX + 120, offsetY + 40, 7777777); - GL11.glPopMatrix(); - } - - public void addChangelog(Minecraft minecraft, int offsetX, int offsetY){ - GL11.glPushMatrix(); - this.drawCenteredString(minecraft.fontRenderer, "CHANGELOG", offsetX + 120, getYMin() + 50, 7777777); - GL11.glPopMatrix(); - } - - public void addChangelog2(Minecraft minecraft, int offsetX, int offsetY){ +public class VersionPage extends TitledPage { + + public VersionPage(String name, PageCollection collection, String unlocalizedTitle, int colour) { + super(name, false, collection, unlocalizedTitle, Color.white.getRGB()); + } + + @Override + public void initGui() { + super.initGui(); + } + + @Override + public void renderOverlayComponents(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) { + super.renderOverlayComponents(minecraft, offsetX, offsetY, mouseX, mouseY); + addDescription(mc, offsetX, offsetY); + addChangelog(mc, offsetX, offsetY); + addChangelog2(mc, offsetX, offsetY); + } + + @Override + public void renderBackgroundLayer(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) { + super.renderBackgroundLayer(minecraft, offsetX, offsetY, mouseX, mouseY); + } + + public void addDescription(Minecraft minecraft, int offsetX, int offsetY) { + GL11.glPushMatrix(); + this.drawCenteredString(minecraft.fontRenderer, "INSTALLED VERSION " + ModInfo.MOD_VERSION, offsetX + 120, offsetY + 20, 7777777); + this.drawCenteredString(minecraft.fontRenderer, "LATEST VERSION " + "TODO", offsetX + 120, offsetY + 40, 7777777); + GL11.glPopMatrix(); + } + + public void addChangelog(Minecraft minecraft, int offsetX, int offsetY) { + GL11.glPushMatrix(); + this.drawCenteredString(minecraft.fontRenderer, "CHANGELOG", offsetX + 120, getYMin() + 50, 7777777); + GL11.glPopMatrix(); + } + + public void addChangelog2(Minecraft minecraft, int offsetX, int offsetY) { ArrayList changeLog = Core.INSTANCE.versionChecker.getChangeLogSinceCurrentVersion(); - GL11.glPushMatrix(); - GL11.glScalef(0.7F, 0.7F, 0.7F); + GL11.glPushMatrix(); + GL11.glScalef(0.7F, 0.7F, 0.7F); int y = offsetY + 105; for (String change : changeLog) { - drawCenteredString(minecraft.fontRenderer, change, offsetX + 230, y, Color.white.getRGB()); + drawCenteredString(minecraft.fontRenderer, change, offsetX + 230, y, Color.white.getRGB()); y += 10; } - GL11.glPopMatrix(); - } + GL11.glPopMatrix(); + } } diff --git a/src/main/java/techreborn/pda/util/GuiButtonAHeight.java b/src/main/java/techreborn/pda/util/GuiButtonAHeight.java index b7fa5adf8..57c0b23bc 100644 --- a/src/main/java/techreborn/pda/util/GuiButtonAHeight.java +++ b/src/main/java/techreborn/pda/util/GuiButtonAHeight.java @@ -1,51 +1,48 @@ package techreborn.pda.util; -import org.lwjgl.opengl.GL11; - import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.renderer.OpenGlHelper; +import org.lwjgl.opengl.GL11; -public class GuiButtonAHeight extends GuiButton{ - - public GuiButtonAHeight(int id, int xPos, int yPos, int width, int hight, String displayString) { - super(id, xPos, yPos, width, hight, displayString); - } +public class GuiButtonAHeight extends GuiButton { - @Override - public void drawButton(Minecraft minecraft, int mouseX, int mouseY) { - if (this.visible){ - FontRenderer fontrenderer = minecraft.fontRenderer; - minecraft.getTextureManager().bindTexture(buttonTextures); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - this.field_146123_n = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height; - int k = this.getHoverState(this.field_146123_n); - GL11.glEnable(GL11.GL_BLEND); - OpenGlHelper.glBlendFunc(770, 771, 1, 0); - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - this.drawTexturedModalRect(this.xPosition, this.yPosition, 0, 46 + k * 20, this.width / 2, this.height); - this.drawTexturedModalRect(this.xPosition + this.width / 2, this.yPosition, 200 - this.width / 2, 46 + k * 20, this.width / 2, this.height); - - if (this.height < 20){ - this.drawTexturedModalRect(xPosition, yPosition+3, 0, (46 + k * 20)+20-height+3, width / 2, height-3); - this.drawTexturedModalRect(xPosition + width / 2, yPosition+3, 200 - width / 2, (46 + k * 20)+20-height+3, width / 2, height-3); - } - - this.mouseDragged(minecraft, mouseX, mouseY); - int l = 14737632; + public GuiButtonAHeight(int id, int xPos, int yPos, int width, int hight, String displayString) { + super(id, xPos, yPos, width, hight, displayString); + } - if (packedFGColour != 0){ - l = packedFGColour; - } - else if (!this.enabled){ - l = 10526880; - } - else if (this.field_146123_n){ - l = 16777120; - } - this.drawCenteredString(fontrenderer, this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height - 8) / 2, l); - } - } + @Override + public void drawButton(Minecraft minecraft, int mouseX, int mouseY) { + if (this.visible) { + FontRenderer fontrenderer = minecraft.fontRenderer; + minecraft.getTextureManager().bindTexture(buttonTextures); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.field_146123_n = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height; + int k = this.getHoverState(this.field_146123_n); + GL11.glEnable(GL11.GL_BLEND); + OpenGlHelper.glBlendFunc(770, 771, 1, 0); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + this.drawTexturedModalRect(this.xPosition, this.yPosition, 0, 46 + k * 20, this.width / 2, this.height); + this.drawTexturedModalRect(this.xPosition + this.width / 2, this.yPosition, 200 - this.width / 2, 46 + k * 20, this.width / 2, this.height); + + if (this.height < 20) { + this.drawTexturedModalRect(xPosition, yPosition + 3, 0, (46 + k * 20) + 20 - height + 3, width / 2, height - 3); + this.drawTexturedModalRect(xPosition + width / 2, yPosition + 3, 200 - width / 2, (46 + k * 20) + 20 - height + 3, width / 2, height - 3); + } + + this.mouseDragged(minecraft, mouseX, mouseY); + int l = 14737632; + + if (packedFGColour != 0) { + l = packedFGColour; + } else if (!this.enabled) { + l = 10526880; + } else if (this.field_146123_n) { + l = 16777120; + } + this.drawCenteredString(fontrenderer, this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height - 8) / 2, l); + } + } } diff --git a/src/main/java/techreborn/pda/util/GuiButtonCustomTexture.java b/src/main/java/techreborn/pda/util/GuiButtonCustomTexture.java index ad514b7c0..22960cd0d 100644 --- a/src/main/java/techreborn/pda/util/GuiButtonCustomTexture.java +++ b/src/main/java/techreborn/pda/util/GuiButtonCustomTexture.java @@ -1,32 +1,29 @@ package techreborn.pda.util; -import java.awt.Color; - -import org.lwjgl.opengl.GL11; - import cpw.mods.fml.client.config.GuiButtonExt; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.ResourceLocation; +import org.lwjgl.opengl.GL11; + +import java.awt.*; public class GuiButtonCustomTexture extends GuiButtonExt { public int textureU; public int textureV; public ItemStack itemstack; - public String LINKED_PAGE; - public String NAME; - + public String LINKED_PAGE; + public String NAME; + public GuiButtonCustomTexture(int id, int xPos, int yPos, int u, int v, int width, int height, ItemStack stack, String linkedPage, String name) { super(id, xPos, yPos, width, height, "_"); textureU = u; textureV = v; itemstack = stack; NAME = name; - this.LINKED_PAGE = linkedPage; + this.LINKED_PAGE = linkedPage; } public void drawButton(Minecraft mc, int mouseX, int mouseY) { @@ -34,16 +31,16 @@ public class GuiButtonCustomTexture extends GuiButtonExt { boolean flag = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height; - mc.getTextureManager().bindTexture(buttonTextures); + mc.getTextureManager().bindTexture(buttonTextures); int u = textureU; int v = textureV; if (flag) { u += width; - GL11.glPushMatrix(); - GL11.glColor4f(0f, 0f, 0f, 1f); + GL11.glPushMatrix(); + GL11.glColor4f(0f, 0f, 0f, 1f); this.drawTexturedModalRect(this.xPosition, this.yPosition, u, v, width, height); - GL11.glPopMatrix(); + GL11.glPopMatrix(); } GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glEnable(32826); @@ -53,6 +50,9 @@ public class GuiButtonCustomTexture extends GuiButtonExt { this.drawString(mc.fontRenderer, this.NAME, this.xPosition + 20, this.yPosition + 3, Color.white.getRGB()); } } - public boolean getIsHovering(){return field_146123_n;} + + public boolean getIsHovering() { + return field_146123_n; + } } diff --git a/src/main/java/techreborn/pda/util/GuiButtonTextOnly.java b/src/main/java/techreborn/pda/util/GuiButtonTextOnly.java index 19bf814d4..8da9ae7ab 100644 --- a/src/main/java/techreborn/pda/util/GuiButtonTextOnly.java +++ b/src/main/java/techreborn/pda/util/GuiButtonTextOnly.java @@ -1,62 +1,63 @@ package techreborn.pda.util; -import java.awt.Color; - -import org.lwjgl.opengl.GL11; - import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.util.EnumChatFormatting; +import org.lwjgl.opengl.GL11; -public class GuiButtonTextOnly extends GuiButton{ - public String LINKED_PAGE; - public int textColour; +import java.awt.*; - public GuiButtonTextOnly(int id, int xPos, int yPos, int width, int hight, String displayString, String linkedPage, int colour) { - super(id, xPos, yPos, width, hight, displayString); - this.LINKED_PAGE = linkedPage; - this.textColour = colour; - } +public class GuiButtonTextOnly extends GuiButton { + public String LINKED_PAGE; + public int textColour; - @Override - public void drawButton(Minecraft minecraft, int mouseX, int mouseY) { - if (this.visible){ - FontRenderer fontrenderer = minecraft.fontRenderer; - minecraft.getTextureManager().bindTexture(buttonTextures); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - this.field_146123_n = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height; - GL11.glEnable(GL11.GL_BLEND); - OpenGlHelper.glBlendFunc(770, 771, 1, 0); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + public GuiButtonTextOnly(int id, int xPos, int yPos, int width, int hight, String displayString, String linkedPage, int colour) { + super(id, xPos, yPos, width, hight, displayString); + this.LINKED_PAGE = linkedPage; + this.textColour = colour; + } - this.mouseDragged(minecraft, mouseX, mouseY); + @Override + public void drawButton(Minecraft minecraft, int mouseX, int mouseY) { + if (this.visible) { + FontRenderer fontrenderer = minecraft.fontRenderer; + minecraft.getTextureManager().bindTexture(buttonTextures); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.field_146123_n = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height; + GL11.glEnable(GL11.GL_BLEND); + OpenGlHelper.glBlendFunc(770, 771, 1, 0); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - String trimmedDisplayString = displayString; - if (fontrenderer.getStringWidth(displayString) > width+30 && !this.field_146123_n){ - int energencyBreak = 0; - while (fontrenderer.getStringWidth(trimmedDisplayString)*0.7 > width-5){ - trimmedDisplayString = trimmedDisplayString.substring(0, trimmedDisplayString.length()-1); - energencyBreak++; - if (energencyBreak > 100) break; - } - trimmedDisplayString+="..."; - } + this.mouseDragged(minecraft, mouseX, mouseY); - if (this.field_146123_n){ - trimmedDisplayString = EnumChatFormatting.BOLD+""+EnumChatFormatting.ITALIC+trimmedDisplayString; - GL11.glPushMatrix(); - GL11.glColor4f(0f, 0f, 0f, 1f); - drawTexturedModalRect(xPosition+(int)(xPosition*0.01), yPosition+(int)(yPosition*0.01), 0, 46, (int)(fontrenderer.getStringWidth(trimmedDisplayString)*0.72)+2, 8); - GL11.glPopMatrix(); - } - GL11.glPushMatrix(); - GL11.glScalef(0.7F, 0.7F, 1); - fontrenderer.drawString(trimmedDisplayString, (int)(xPosition*1.45), (int)((yPosition + (height - 8) / 2)*1.45), Color.WHITE.getRGB()); - GL11.glPopMatrix(); - } - } + String trimmedDisplayString = displayString; + if (fontrenderer.getStringWidth(displayString) > width + 30 && !this.field_146123_n) { + int energencyBreak = 0; + while (fontrenderer.getStringWidth(trimmedDisplayString) * 0.7 > width - 5) { + trimmedDisplayString = trimmedDisplayString.substring(0, trimmedDisplayString.length() - 1); + energencyBreak++; + if (energencyBreak > 100) break; + } + trimmedDisplayString += "..."; + } - public boolean getIsHovering(){return field_146123_n;} + if (this.field_146123_n) { + trimmedDisplayString = EnumChatFormatting.BOLD + "" + EnumChatFormatting.ITALIC + trimmedDisplayString; + GL11.glPushMatrix(); + GL11.glColor4f(0f, 0f, 0f, 1f); + drawTexturedModalRect(xPosition + (int) (xPosition * 0.01), yPosition + (int) (yPosition * 0.01), 0, 46, (int) (fontrenderer.getStringWidth(trimmedDisplayString) * 0.72) + 2, 8); + GL11.glPopMatrix(); + } + GL11.glPushMatrix(); + GL11.glScalef(0.7F, 0.7F, 1); + fontrenderer.drawString(trimmedDisplayString, (int) (xPosition * 1.45), (int) ((yPosition + (height - 8) / 2) * 1.45), Color.WHITE.getRGB()); + GL11.glPopMatrix(); + } + } + + public boolean getIsHovering() { + return field_146123_n; + } } diff --git a/src/main/java/techreborn/powerSystem/PoweredArmor.java b/src/main/java/techreborn/powerSystem/PoweredArmor.java index 8454d1e7e..c8fe4fe19 100644 --- a/src/main/java/techreborn/powerSystem/PoweredArmor.java +++ b/src/main/java/techreborn/powerSystem/PoweredArmor.java @@ -10,7 +10,6 @@ import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import techreborn.api.power.IEnergyInterfaceItem; -import techreborn.asm.Strippable; import techreborn.config.ConfigTechReborn; import java.util.List; @@ -124,31 +123,26 @@ public abstract class PoweredArmor extends ItemArmor implements IEnergyInterface //IC2 - @Strippable("mod:IC2") @Override public Item getChargedItem(ItemStack itemStack) { return this; } - @Strippable("mod:IC2") @Override public Item getEmptyItem(ItemStack itemStack) { return this; } - @Strippable("mod:IC2") @Override public double getMaxCharge(ItemStack itemStack) { return getMaxPower(itemStack); } - @Strippable("mod:IC2") @Override public int getTier(ItemStack itemStack) { return getStackTeir(itemStack); } - @Strippable("mod:IC2") @Override public double getTransferLimit(ItemStack itemStack) { return getMaxTransfer(itemStack); diff --git a/src/main/java/techreborn/powerSystem/PoweredItem.java b/src/main/java/techreborn/powerSystem/PoweredItem.java index 537d16ff1..53094ddf8 100644 --- a/src/main/java/techreborn/powerSystem/PoweredItem.java +++ b/src/main/java/techreborn/powerSystem/PoweredItem.java @@ -10,7 +10,6 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import techreborn.api.power.IEnergyInterfaceItem; -import techreborn.asm.Strippable; import techreborn.config.ConfigTechReborn; import java.util.List; @@ -123,31 +122,26 @@ public abstract class PoweredItem extends Item implements IEnergyInterfaceItem, //IC2 - @Strippable("mod:IC2") @Override public Item getChargedItem(ItemStack itemStack) { return this; } - @Strippable("mod:IC2") @Override public Item getEmptyItem(ItemStack itemStack) { return this; } - @Strippable("mod:IC2") @Override public double getMaxCharge(ItemStack itemStack) { return getMaxPower(itemStack); } - @Strippable("mod:IC2") @Override public int getTier(ItemStack itemStack) { return getStackTeir(itemStack); } - @Strippable("mod:IC2") @Override public double getTransferLimit(ItemStack itemStack) { return getMaxTransfer(itemStack); diff --git a/src/main/java/techreborn/powerSystem/PoweredPickaxe.java b/src/main/java/techreborn/powerSystem/PoweredPickaxe.java index a1b77d540..09d1bb7c0 100644 --- a/src/main/java/techreborn/powerSystem/PoweredPickaxe.java +++ b/src/main/java/techreborn/powerSystem/PoweredPickaxe.java @@ -10,7 +10,6 @@ import net.minecraft.item.ItemPickaxe; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import techreborn.api.power.IEnergyInterfaceItem; -import techreborn.asm.Strippable; import techreborn.config.ConfigTechReborn; import java.util.List; @@ -125,31 +124,26 @@ public abstract class PoweredPickaxe extends ItemPickaxe implements IEnergyInter //IC2 - @Strippable("mod:IC2") @Override public Item getChargedItem(ItemStack itemStack) { return this; } - @Strippable("mod:IC2") @Override public Item getEmptyItem(ItemStack itemStack) { return this; } - @Strippable("mod:IC2") @Override public double getMaxCharge(ItemStack itemStack) { return getMaxPower(itemStack); } - @Strippable("mod:IC2") @Override public int getTier(ItemStack itemStack) { return getStackTeir(itemStack); } - @Strippable("mod:IC2") @Override public double getTransferLimit(ItemStack itemStack) { return getMaxTransfer(itemStack); diff --git a/src/main/java/techreborn/powerSystem/RFProviderTile.java b/src/main/java/techreborn/powerSystem/RFProviderTile.java index fa102874c..e25e8641b 100644 --- a/src/main/java/techreborn/powerSystem/RFProviderTile.java +++ b/src/main/java/techreborn/powerSystem/RFProviderTile.java @@ -4,7 +4,6 @@ import cofh.api.energy.IEnergyConnection; import cofh.api.energy.IEnergyHandler; import cofh.api.energy.IEnergyProvider; import cofh.api.energy.IEnergyReceiver; -import net.minecraft.client.particle.EntityHugeExplodeFX; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.Explosion; import net.minecraftforge.common.util.ForgeDirection; @@ -28,9 +27,9 @@ public abstract class RFProviderTile extends TileMachineBase implements IEnergyR if (worldObj.isRemote) { return; } - if(ConfigTechReborn.rainExplosions && worldObj.canBlockSeeTheSky(xCoord, yCoord + 1, zCoord) && worldObj.isRaining() || worldObj.isThundering()) + if (ConfigTechReborn.rainExplosions && worldObj.canBlockSeeTheSky(xCoord, yCoord + 1, zCoord) && worldObj.isRaining() || worldObj.isThundering()) if (getEnergy() >= 1 && random.nextInt(160) == 0) { - Explosion explosion = new Explosion(this.worldObj, null, xCoord, yCoord, zCoord, getEnergy() < 100000? 2F : 4F); + Explosion explosion = new Explosion(this.worldObj, null, xCoord, yCoord, zCoord, getEnergy() < 100000 ? 2F : 4F); explosion.isFlaming = true; explosion.isSmoking = getEnergy() > 100000; explosion.doExplosionA(); diff --git a/src/main/java/techreborn/powerSystem/TilePowerAcceptor.java b/src/main/java/techreborn/powerSystem/TilePowerAcceptor.java index f6025235e..80f2aff17 100644 --- a/src/main/java/techreborn/powerSystem/TilePowerAcceptor.java +++ b/src/main/java/techreborn/powerSystem/TilePowerAcceptor.java @@ -16,9 +16,8 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.util.ForgeDirection; -import techreborn.api.IListInfoProvider; +import reborncore.api.IListInfoProvider; import techreborn.api.power.IEnergyInterfaceTile; -import techreborn.asm.Strippable; import techreborn.config.ConfigTechReborn; import java.util.List; @@ -44,17 +43,14 @@ public abstract class TilePowerAcceptor extends RFProviderTile implements //IC2 - @Strippable("mod:IC2") protected boolean addedToEnet; - @Strippable("mod:IC2") @Override public void updateEntity() { super.updateEntity(); onLoaded(); } - @Strippable("mod:IC2") public void onLoaded() { if (PowerSystem.EUPOWENET && !addedToEnet && !FMLCommonHandler.instance().getEffectiveSide().isClient() && @@ -65,14 +61,12 @@ public abstract class TilePowerAcceptor extends RFProviderTile implements } } - @Strippable("mod:IC2") @Override public void invalidate() { super.invalidate(); onChunkUnload(); } - @Strippable("mod:IC2") @Override public void onChunkUnload() { super.onChunkUnload(); @@ -86,7 +80,6 @@ public abstract class TilePowerAcceptor extends RFProviderTile implements } } - @Strippable("mod:IC2") @Override public double getDemandedEnergy() { if (!PowerSystem.EUPOWENET) @@ -94,20 +87,17 @@ public abstract class TilePowerAcceptor extends RFProviderTile implements return getMaxPower() - getEnergy(); } - @Strippable("mod:IC2") @Override public int getSinkTier() { return tier; } - @Strippable("mod:IC2") @Override public double injectEnergy(ForgeDirection directionFrom, double amount, double voltage) { setEnergy(getEnergy() + amount); return 0; } - @Strippable("mod:IC2") @Override public boolean acceptsEnergyFrom(TileEntity emitter, ForgeDirection direction) { if (!PowerSystem.EUPOWENET) @@ -115,7 +105,6 @@ public abstract class TilePowerAcceptor extends RFProviderTile implements return canAcceptEnergy(direction); } - @Strippable("mod:IC2") @Override public boolean emitsEnergyTo(TileEntity receiver, ForgeDirection direction) { if (!PowerSystem.EUPOWENET) @@ -123,7 +112,6 @@ public abstract class TilePowerAcceptor extends RFProviderTile implements return canProvideEnergy(direction); } - @Strippable("mod:IC2") @Override public double getOfferedEnergy() { if (!PowerSystem.EUPOWENET) @@ -131,13 +119,11 @@ public abstract class TilePowerAcceptor extends RFProviderTile implements return getEnergy(); } - @Strippable("mod:IC2") @Override public void drawEnergy(double amount) { useEnergy((int) amount); } - @Strippable("mod:IC2") @Override public int getSourceTier() { return tier; @@ -291,11 +277,11 @@ public abstract class TilePowerAcceptor extends RFProviderTile implements @Override public void addInfo(List info, boolean isRealTile) { info.add(ChatFormatting.LIGHT_PURPLE + "Energy buffer Size " + ChatFormatting.GREEN + getEUString(getMaxPower())); - if(getMaxInput() != 0){ - info.add(ChatFormatting.LIGHT_PURPLE +"Max Input " + ChatFormatting.GREEN + getEUString(getMaxInput())); + if (getMaxInput() != 0) { + info.add(ChatFormatting.LIGHT_PURPLE + "Max Input " + ChatFormatting.GREEN + getEUString(getMaxInput())); } - if(getMaxOutput() != 0){ - info.add(ChatFormatting.LIGHT_PURPLE +"Max Output " + ChatFormatting.GREEN + getEUString(getMaxOutput())); + if (getMaxOutput() != 0) { + info.add(ChatFormatting.LIGHT_PURPLE + "Max Output " + ChatFormatting.GREEN + getEUString(getMaxOutput())); } } @@ -311,9 +297,9 @@ public abstract class TilePowerAcceptor extends RFProviderTile implements } } - public double getFreeSpace(){ - return getMaxPower() - energy; - } + public double getFreeSpace() { + return getMaxPower() - energy; + } //IC2 Classic diff --git a/src/main/java/techreborn/proxies/ClientProxy.java b/src/main/java/techreborn/proxies/ClientProxy.java index cb0620e5b..5432fd837 100644 --- a/src/main/java/techreborn/proxies/ClientProxy.java +++ b/src/main/java/techreborn/proxies/ClientProxy.java @@ -1,20 +1,17 @@ package techreborn.proxies; import cpw.mods.fml.client.registry.ClientRegistry; -import net.minecraft.init.Blocks; import net.minecraftforge.common.MinecraftForge; import techreborn.client.IconSupplier; import techreborn.client.StackToolTipEvent; import techreborn.client.VersionCheckerClient; import techreborn.client.hud.ChargeHud; import techreborn.client.keybindings.KeyBindings; -import techreborn.client.multiblock.Multiblock; -import techreborn.client.multiblock.MultiblockSet; import techreborn.client.render.MultiblockRenderEvent; public class ClientProxy extends CommonProxy { - public static MultiblockRenderEvent multiblockRenderEvent; + public static MultiblockRenderEvent multiblockRenderEvent; @Override public void init() { @@ -23,8 +20,8 @@ public class ClientProxy extends CommonProxy { MinecraftForge.EVENT_BUS.register(new ChargeHud()); MinecraftForge.EVENT_BUS.register(new VersionCheckerClient()); MinecraftForge.EVENT_BUS.register(new StackToolTipEvent()); - multiblockRenderEvent = new MultiblockRenderEvent(); - MinecraftForge.EVENT_BUS.register(multiblockRenderEvent); + multiblockRenderEvent = new MultiblockRenderEvent(); + MinecraftForge.EVENT_BUS.register(multiblockRenderEvent); ClientRegistry.registerKeyBinding(KeyBindings.config); } } diff --git a/src/main/java/techreborn/tiles/TileAesu.java b/src/main/java/techreborn/tiles/TileAesu.java index 987d67cfb..0ffed7910 100644 --- a/src/main/java/techreborn/tiles/TileAesu.java +++ b/src/main/java/techreborn/tiles/TileAesu.java @@ -5,11 +5,11 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.common.util.ForgeDirection; +import reborncore.common.misc.Functions; +import reborncore.common.util.Inventory; import techreborn.config.ConfigTechReborn; import techreborn.init.ModBlocks; -import techreborn.lib.Functions; import techreborn.powerSystem.TilePowerAcceptor; -import techreborn.util.Inventory; public class TileAesu extends TilePowerAcceptor implements IWrenchable { diff --git a/src/main/java/techreborn/tiles/TileAlloyFurnace.java b/src/main/java/techreborn/tiles/TileAlloyFurnace.java index 8e9bc45e0..321afe4f9 100644 --- a/src/main/java/techreborn/tiles/TileAlloyFurnace.java +++ b/src/main/java/techreborn/tiles/TileAlloyFurnace.java @@ -9,14 +9,13 @@ import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.inventory.IInventory; import net.minecraft.item.*; -import net.minecraft.item.crafting.FurnaceRecipes; import net.minecraft.nbt.NBTTagCompound; +import reborncore.common.util.Inventory; +import reborncore.common.util.ItemUtils; import techreborn.api.recipe.IBaseRecipeType; import techreborn.api.recipe.RecipeHandler; import techreborn.init.ModBlocks; import techreborn.lib.Reference; -import techreborn.util.Inventory; -import techreborn.util.ItemUtils; public class TileAlloyFurnace extends TileMachineBase implements IWrenchable, IInventory { @@ -47,56 +46,44 @@ public class TileAlloyFurnace extends TileMachineBase implements IWrenchable, II boolean flag = this.burnTime > 0; boolean flag1 = false; - if (this.burnTime > 0) - { + if (this.burnTime > 0) { --this.burnTime; } - if (!this.worldObj.isRemote) - { - if (this.burnTime != 0 || getStackInSlot(input1) != null && getStackInSlot(fuel) != null) - { - if (this.burnTime == 0 && this.canSmelt()) - { + if (!this.worldObj.isRemote) { + if (this.burnTime != 0 || getStackInSlot(input1) != null && getStackInSlot(fuel) != null) { + if (this.burnTime == 0 && this.canSmelt()) { this.currentItemBurnTime = this.burnTime = getItemBurnTime(getStackInSlot(fuel)); - if (this.burnTime > 0) - { + if (this.burnTime > 0) { flag1 = true; - if (this.getStackInSlot(fuel) != null) - { + if (this.getStackInSlot(fuel) != null) { decrStackSize(fuel, 1); } } } - if (this.isBurning() && this.canSmelt()) - { + if (this.isBurning() && this.canSmelt()) { ++this.cookTime; - if (this.cookTime == 200) - { + if (this.cookTime == 200) { this.cookTime = 0; this.smeltItem(); flag1 = true; } - } - else - { + } else { this.cookTime = 0; } } - if (flag != this.burnTime > 0) - { + if (flag != this.burnTime > 0) { flag1 = true; //TODO sync on/off } } - if (flag1) - { + if (flag1) { this.markDirty(); } @@ -119,17 +106,13 @@ public class TileAlloyFurnace extends TileMachineBase implements IWrenchable, II return true; } - private boolean canSmelt() - { - if (this.getStackInSlot(input1) == null || this.getStackInSlot(input2) == null) - { + private boolean canSmelt() { + if (this.getStackInSlot(input1) == null || this.getStackInSlot(input2) == null) { return false; - } - else - { + } else { ItemStack itemstack = null; - for(IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(Reference.alloySmelteRecipe)){ - if(hasAllInputs(recipeType)){ + for (IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(Reference.alloySmelteRecipe)) { + if (hasAllInputs(recipeType)) { itemstack = recipeType.getOutput(0); break; } @@ -146,37 +129,32 @@ public class TileAlloyFurnace extends TileMachineBase implements IWrenchable, II /** * Turn one item from the furnace source stack into the appropriate smelted item in the furnace result stack */ - public void smeltItem() - { - if (this.canSmelt()) - { + public void smeltItem() { + if (this.canSmelt()) { ItemStack itemstack = null; - for(IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(Reference.alloySmelteRecipe)){ - for(ItemStack input : recipeType.getInputs()){ - if(ItemUtils.isItemEqual(input, getStackInSlot(input1), true, true, true) || ItemUtils.isItemEqual(input, getStackInSlot(input2), true, true, true)){ + for (IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(Reference.alloySmelteRecipe)) { + for (ItemStack input : recipeType.getInputs()) { + if (ItemUtils.isItemEqual(input, getStackInSlot(input1), true, true, true) || ItemUtils.isItemEqual(input, getStackInSlot(input2), true, true, true)) { itemstack = recipeType.getOutput(0); break; } } - if(itemstack != null){ + if (itemstack != null) { break; } } - if (this.getStackInSlot(output) == null) - { + if (this.getStackInSlot(output) == null) { setInventorySlotContents(output, itemstack.copy()); - } - else if (this.getStackInSlot(output).getItem() == itemstack.getItem()) - { + } else if (this.getStackInSlot(output).getItem() == itemstack.getItem()) { decrStackSize(output, -itemstack.stackSize); } - for(IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(Reference.alloySmelteRecipe)){ - for(ItemStack input : recipeType.getInputs()){ - if(ItemUtils.isItemEqual(input, getStackInSlot(input1), true, true, true)){ + for (IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(Reference.alloySmelteRecipe)) { + for (ItemStack input : recipeType.getInputs()) { + if (ItemUtils.isItemEqual(input, getStackInSlot(input1), true, true, true)) { this.decrStackSize(input1, input.stackSize); - } else if(ItemUtils.isItemEqual(input, getStackInSlot(input2), true, true, true)){ + } else if (ItemUtils.isItemEqual(input, getStackInSlot(input2), true, true, true)) { this.decrStackSize(input2, input.stackSize); } } @@ -191,65 +169,52 @@ public class TileAlloyFurnace extends TileMachineBase implements IWrenchable, II /** * Furnace isBurning */ - public boolean isBurning() - { + public boolean isBurning() { return this.burnTime > 0; } - public int getBurnTimeRemainingScaled(int scale) - { - if (this.currentItemBurnTime == 0) - { + public int getBurnTimeRemainingScaled(int scale) { + if (this.currentItemBurnTime == 0) { this.currentItemBurnTime = 200; } return this.burnTime * scale / this.currentItemBurnTime; } - public int getCookProgressScaled(int scale) - { + public int getCookProgressScaled(int scale) { return this.cookTime * scale / 200; } - /** * Returns the number of ticks that the supplied fuel item will keep the furnace burning, or 0 if the item isn't * fuel */ - public static int getItemBurnTime(ItemStack stack) - { - if (stack == null) - { + public static int getItemBurnTime(ItemStack stack) { + if (stack == null) { return 0; - } - else - { + } else { Item item = stack.getItem(); - if (item instanceof ItemBlock && Block.getBlockFromItem(item) != Blocks.air) - { + if (item instanceof ItemBlock && Block.getBlockFromItem(item) != Blocks.air) { Block block = Block.getBlockFromItem(item); - if (block == Blocks.wooden_slab) - { + if (block == Blocks.wooden_slab) { return 150; } - if (block.getMaterial() == Material.wood) - { + if (block.getMaterial() == Material.wood) { return 300; } - if (block == Blocks.coal_block) - { + if (block == Blocks.coal_block) { return 16000; } } - if (item instanceof ItemTool && ((ItemTool)item).getToolMaterialName().equals("WOOD")) return 200; - if (item instanceof ItemSword && ((ItemSword)item).getToolMaterialName().equals("WOOD")) return 200; - if (item instanceof ItemHoe && ((ItemHoe)item).getToolMaterialName().equals("WOOD")) return 200; + if (item instanceof ItemTool && ((ItemTool) item).getToolMaterialName().equals("WOOD")) return 200; + if (item instanceof ItemSword && ((ItemSword) item).getToolMaterialName().equals("WOOD")) return 200; + if (item instanceof ItemHoe && ((ItemHoe) item).getToolMaterialName().equals("WOOD")) return 200; if (item == Items.stick) return 100; if (item == Items.coal) return 1600; if (item == Items.lava_bucket) return 20000; diff --git a/src/main/java/techreborn/tiles/TileAlloySmelter.java b/src/main/java/techreborn/tiles/TileAlloySmelter.java index 2f0e5e864..46ee245fb 100644 --- a/src/main/java/techreborn/tiles/TileAlloySmelter.java +++ b/src/main/java/techreborn/tiles/TileAlloySmelter.java @@ -8,12 +8,12 @@ import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.common.util.ForgeDirection; +import reborncore.common.util.Inventory; import techreborn.api.recipe.RecipeCrafter; import techreborn.api.upgrade.UpgradeHandler; import techreborn.init.ModBlocks; import techreborn.lib.Reference; import techreborn.powerSystem.TilePowerAcceptor; -import techreborn.util.Inventory; public class TileAlloySmelter extends TilePowerAcceptor implements IWrenchable, IEnergyTile, IInventory, ISidedInventory { diff --git a/src/main/java/techreborn/tiles/TileAssemblingMachine.java b/src/main/java/techreborn/tiles/TileAssemblingMachine.java index 7a40766ff..812b41d3d 100644 --- a/src/main/java/techreborn/tiles/TileAssemblingMachine.java +++ b/src/main/java/techreborn/tiles/TileAssemblingMachine.java @@ -8,11 +8,11 @@ import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.common.util.ForgeDirection; +import reborncore.common.util.Inventory; import techreborn.api.recipe.RecipeCrafter; import techreborn.init.ModBlocks; import techreborn.lib.Reference; import techreborn.powerSystem.TilePowerAcceptor; -import techreborn.util.Inventory; public class TileAssemblingMachine extends TilePowerAcceptor implements IWrenchable, IEnergyTile, IInventory, ISidedInventory { diff --git a/src/main/java/techreborn/tiles/TileBlastFurnace.java b/src/main/java/techreborn/tiles/TileBlastFurnace.java index 4aa781db7..57caca212 100644 --- a/src/main/java/techreborn/tiles/TileBlastFurnace.java +++ b/src/main/java/techreborn/tiles/TileBlastFurnace.java @@ -1,6 +1,5 @@ package techreborn.tiles; -import erogenousbeef.coreTR.multiblock.IMultiblockPart; import ic2.api.energy.tile.IEnergyTile; import ic2.api.tile.IWrenchable; import net.minecraft.entity.player.EntityPlayer; @@ -13,15 +12,16 @@ import net.minecraft.network.Packet; import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.util.ForgeDirection; +import reborncore.common.misc.Location; +import reborncore.common.multiblock.IMultiblockPart; +import reborncore.common.util.Inventory; import techreborn.api.recipe.RecipeCrafter; import techreborn.blocks.BlockMachineCasing; import techreborn.config.ConfigTechReborn; import techreborn.init.ModBlocks; -import techreborn.lib.Location; import techreborn.lib.Reference; import techreborn.multiblocks.MultiBlockCasing; import techreborn.powerSystem.TilePowerAcceptor; -import techreborn.util.Inventory; public class TileBlastFurnace extends TilePowerAcceptor implements IWrenchable, IInventory, IEnergyTile, ISidedInventory { @@ -90,12 +90,12 @@ public class TileBlastFurnace extends TilePowerAcceptor implements IWrenchable, Location location = new Location(xCoord, yCoord, zCoord, direction); location.modifyPositionFromSide(direction, 1); int heat = 0; - if(worldObj.getBlock(location.getX(), location.getY() - 1, location.getZ()) == tileEntity.getBlockType()){ + if (worldObj.getBlock(location.getX(), location.getY() - 1, location.getZ()) == tileEntity.getBlockType()) { return 0; } for (IMultiblockPart part : casing.connectedParts) { - heat += BlockMachineCasing.getHeatFromMeta(part.getWorldObj().getBlockMetadata(part.getWorldLocation().x, part.getWorldLocation().y, part.getWorldLocation().z)); + heat += BlockMachineCasing.getHeatFromMeta(part.getWorldObj().getBlockMetadata(part.getWorldLocation().x, part.getWorldLocation().y, part.getWorldLocation().z)); } if (worldObj.getBlock(location.getX(), location.getY(), location.getZ()).getUnlocalizedName().equals("tile.lava") && worldObj.getBlock(location.getX(), location.getY() + 1, location.getZ()).getUnlocalizedName().equals("tile.lava")) { diff --git a/src/main/java/techreborn/tiles/TileCentrifuge.java b/src/main/java/techreborn/tiles/TileCentrifuge.java index 6d9f0a046..619014925 100644 --- a/src/main/java/techreborn/tiles/TileCentrifuge.java +++ b/src/main/java/techreborn/tiles/TileCentrifuge.java @@ -8,13 +8,13 @@ import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.common.util.ForgeDirection; -import techreborn.api.IListInfoProvider; +import reborncore.api.IListInfoProvider; +import reborncore.common.util.Inventory; import techreborn.api.recipe.RecipeCrafter; import techreborn.config.ConfigTechReborn; import techreborn.init.ModBlocks; import techreborn.lib.Reference; import techreborn.powerSystem.TilePowerAcceptor; -import techreborn.util.Inventory; import java.util.List; diff --git a/src/main/java/techreborn/tiles/TileChargeBench.java b/src/main/java/techreborn/tiles/TileChargeBench.java index 301a74a48..2b8cc58ba 100644 --- a/src/main/java/techreborn/tiles/TileChargeBench.java +++ b/src/main/java/techreborn/tiles/TileChargeBench.java @@ -9,10 +9,10 @@ import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.common.util.ForgeDirection; +import reborncore.common.util.Inventory; import techreborn.api.power.IEnergyInterfaceItem; import techreborn.init.ModBlocks; import techreborn.powerSystem.TilePowerAcceptor; -import techreborn.util.Inventory; public class TileChargeBench extends TilePowerAcceptor implements IWrenchable, IInventory, ISidedInventory { @@ -29,7 +29,7 @@ public class TileChargeBench extends TilePowerAcceptor implements IWrenchable, I for (int i = 0; i < 6; i++) if (inventory.getStackInSlot(i) != null) { - if(inventory.getStackInSlot(i).getItem() instanceof IEnergyInterfaceItem){ + if (inventory.getStackInSlot(i).getItem() instanceof IEnergyInterfaceItem) { ItemStack stack = inventory.getStackInSlot(i); double MaxCharge = ((IEnergyInterfaceItem) stack.getItem()).getMaxPower(stack); double amount = ((IEnergyInterfaceItem) stack.getItem()).getMaxTransfer(stack); diff --git a/src/main/java/techreborn/tiles/TileChemicalReactor.java b/src/main/java/techreborn/tiles/TileChemicalReactor.java index 30beffc9d..30ea19fc7 100644 --- a/src/main/java/techreborn/tiles/TileChemicalReactor.java +++ b/src/main/java/techreborn/tiles/TileChemicalReactor.java @@ -8,11 +8,11 @@ import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.common.util.ForgeDirection; +import reborncore.common.util.Inventory; import techreborn.api.recipe.RecipeCrafter; import techreborn.init.ModBlocks; import techreborn.lib.Reference; import techreborn.powerSystem.TilePowerAcceptor; -import techreborn.util.Inventory; public class TileChemicalReactor extends TilePowerAcceptor implements IWrenchable, IEnergyTile, IInventory, ISidedInventory { diff --git a/src/main/java/techreborn/tiles/TileChunkLoader.java b/src/main/java/techreborn/tiles/TileChunkLoader.java index 5f30a0d8c..24558983b 100644 --- a/src/main/java/techreborn/tiles/TileChunkLoader.java +++ b/src/main/java/techreborn/tiles/TileChunkLoader.java @@ -6,9 +6,9 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraftforge.common.util.ForgeDirection; +import reborncore.common.util.Inventory; import techreborn.init.ModBlocks; import techreborn.powerSystem.TilePowerAcceptor; -import techreborn.util.Inventory; public class TileChunkLoader extends TilePowerAcceptor implements IWrenchable, IEnergyTile, IInventory { diff --git a/src/main/java/techreborn/tiles/TileDieselGenerator.java b/src/main/java/techreborn/tiles/TileDieselGenerator.java index 476e3ec95..1fe214ac6 100644 --- a/src/main/java/techreborn/tiles/TileDieselGenerator.java +++ b/src/main/java/techreborn/tiles/TileDieselGenerator.java @@ -11,13 +11,13 @@ import net.minecraft.network.Packet; import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.*; -import techreborn.api.fuel.FluidPowerManager; +import reborncore.api.fuel.FluidPowerManager; +import reborncore.common.util.FluidUtils; +import reborncore.common.util.Inventory; +import reborncore.common.util.Tank; import techreborn.config.ConfigTechReborn; import techreborn.init.ModBlocks; import techreborn.powerSystem.TilePowerAcceptor; -import techreborn.util.FluidUtils; -import techreborn.util.Inventory; -import techreborn.util.Tank; public class TileDieselGenerator extends TilePowerAcceptor implements IWrenchable, IFluidHandler, IInventory, IEnergyTile { @@ -136,27 +136,27 @@ public class TileDieselGenerator extends TilePowerAcceptor implements IWrenchabl @Override public void updateEntity() { super.updateEntity(); - if (!worldObj.isRemote) { - FluidUtils.drainContainers(this, inventory, 0, 1); - FluidUtils.fillContainers(this, inventory, 0, 1, tank.getFluidType()); - if (tank.getFluidType() != null && getStackInSlot(2) == null) { - inventory.setInventorySlotContents(2, new ItemStack(tank - .getFluidType().getBlock())); - syncWithAll(); - } else if (tank.getFluidType() == null && getStackInSlot(2) != null) { - setInventorySlotContents(2, null); - syncWithAll(); - } + if (!worldObj.isRemote) { + FluidUtils.drainContainers(this, inventory, 0, 1); + FluidUtils.fillContainers(this, inventory, 0, 1, tank.getFluidType()); + if (tank.getFluidType() != null && getStackInSlot(2) == null) { + inventory.setInventorySlotContents(2, new ItemStack(tank + .getFluidType().getBlock())); + syncWithAll(); + } else if (tank.getFluidType() == null && getStackInSlot(2) != null) { + setInventorySlotContents(2, null); + syncWithAll(); + } - if (!tank.isEmpty()) { - double powerIn = FluidPowerManager.fluidPowerValues.get(tank.getFluidType()); - if(getFreeSpace() >= powerIn){ - addEnergy(powerIn, false); - tank.drain(1, true); + if (!tank.isEmpty()) { + double powerIn = FluidPowerManager.fluidPowerValues.get(tank.getFluidType()); + if (getFreeSpace() >= powerIn) { + addEnergy(powerIn, false); + tank.drain(1, true); System.out.println(getEnergy() + ":" + tank.getFluidAmount()); } - } - } + } + } } diff --git a/src/main/java/techreborn/tiles/TileDigitalChest.java b/src/main/java/techreborn/tiles/TileDigitalChest.java index 8a249e16f..26c6dae6f 100644 --- a/src/main/java/techreborn/tiles/TileDigitalChest.java +++ b/src/main/java/techreborn/tiles/TileDigitalChest.java @@ -8,10 +8,10 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.NetworkManager; import net.minecraft.network.Packet; import net.minecraft.network.play.server.S35PacketUpdateTileEntity; -import techreborn.api.IListInfoProvider; +import reborncore.api.IListInfoProvider; +import reborncore.common.util.Inventory; +import reborncore.common.util.ItemUtils; import techreborn.init.ModBlocks; -import techreborn.util.Inventory; -import techreborn.util.ItemUtils; import java.util.List; diff --git a/src/main/java/techreborn/tiles/TileDragonEggSiphoner.java b/src/main/java/techreborn/tiles/TileDragonEggSiphoner.java index e3afc8ced..eab091548 100644 --- a/src/main/java/techreborn/tiles/TileDragonEggSiphoner.java +++ b/src/main/java/techreborn/tiles/TileDragonEggSiphoner.java @@ -7,10 +7,10 @@ import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.common.util.ForgeDirection; +import reborncore.common.util.Inventory; import techreborn.config.ConfigTechReborn; import techreborn.init.ModBlocks; import techreborn.powerSystem.TilePowerAcceptor; -import techreborn.util.Inventory; public class TileDragonEggSiphoner extends TilePowerAcceptor implements IWrenchable, IInventory { diff --git a/src/main/java/techreborn/tiles/TileGasTurbine.java b/src/main/java/techreborn/tiles/TileGasTurbine.java index 5c93db99e..fe57a5a29 100644 --- a/src/main/java/techreborn/tiles/TileGasTurbine.java +++ b/src/main/java/techreborn/tiles/TileGasTurbine.java @@ -10,12 +10,12 @@ import net.minecraft.network.Packet; import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.*; +import reborncore.common.util.FluidUtils; +import reborncore.common.util.Inventory; +import reborncore.common.util.Tank; import techreborn.config.ConfigTechReborn; import techreborn.init.ModBlocks; import techreborn.powerSystem.TilePowerAcceptor; -import techreborn.util.FluidUtils; -import techreborn.util.Inventory; -import techreborn.util.Tank; import java.util.HashMap; import java.util.Map; diff --git a/src/main/java/techreborn/tiles/TileGrinder.java b/src/main/java/techreborn/tiles/TileGrinder.java index db17a83f6..5b48306da 100644 --- a/src/main/java/techreborn/tiles/TileGrinder.java +++ b/src/main/java/techreborn/tiles/TileGrinder.java @@ -10,16 +10,16 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.*; +import reborncore.common.misc.Location; +import reborncore.common.util.Inventory; +import reborncore.common.util.Tank; import techreborn.api.recipe.RecipeCrafter; import techreborn.blocks.BlockMachineCasing; import techreborn.config.ConfigTechReborn; import techreborn.init.ModBlocks; import techreborn.init.ModFluids; -import techreborn.lib.Location; import techreborn.lib.Reference; import techreborn.powerSystem.TilePowerAcceptor; -import techreborn.util.Inventory; -import techreborn.util.Tank; public class TileGrinder extends TilePowerAcceptor implements IWrenchable, IEnergyTile, IFluidHandler, IInventory, ISidedInventory { diff --git a/src/main/java/techreborn/tiles/TileImplosionCompressor.java b/src/main/java/techreborn/tiles/TileImplosionCompressor.java index 695c6b3e7..2c0ffbd46 100644 --- a/src/main/java/techreborn/tiles/TileImplosionCompressor.java +++ b/src/main/java/techreborn/tiles/TileImplosionCompressor.java @@ -9,13 +9,13 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.util.ForgeDirection; +import reborncore.common.misc.Location; +import reborncore.common.util.Inventory; import techreborn.api.recipe.RecipeCrafter; import techreborn.blocks.BlockMachineCasing; import techreborn.init.ModBlocks; -import techreborn.lib.Location; import techreborn.lib.Reference; import techreborn.powerSystem.TilePowerAcceptor; -import techreborn.util.Inventory; public class TileImplosionCompressor extends TilePowerAcceptor implements IWrenchable, IEnergyTile, IInventory, ISidedInventory { diff --git a/src/main/java/techreborn/tiles/TileIndustrialElectrolyzer.java b/src/main/java/techreborn/tiles/TileIndustrialElectrolyzer.java index 9ab5ace45..ab9f1236e 100644 --- a/src/main/java/techreborn/tiles/TileIndustrialElectrolyzer.java +++ b/src/main/java/techreborn/tiles/TileIndustrialElectrolyzer.java @@ -8,11 +8,11 @@ import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.common.util.ForgeDirection; +import reborncore.common.util.Inventory; import techreborn.api.recipe.RecipeCrafter; import techreborn.init.ModBlocks; import techreborn.lib.Reference; import techreborn.powerSystem.TilePowerAcceptor; -import techreborn.util.Inventory; public class TileIndustrialElectrolyzer extends TilePowerAcceptor implements IWrenchable, IEnergyTile, IInventory, ISidedInventory { diff --git a/src/main/java/techreborn/tiles/TileIndustrialSawmill.java b/src/main/java/techreborn/tiles/TileIndustrialSawmill.java index c425b287f..e3df7acca 100644 --- a/src/main/java/techreborn/tiles/TileIndustrialSawmill.java +++ b/src/main/java/techreborn/tiles/TileIndustrialSawmill.java @@ -10,16 +10,16 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.*; -import techreborn.api.IListInfoProvider; +import reborncore.api.IListInfoProvider; +import reborncore.common.misc.Location; +import reborncore.common.util.Inventory; +import reborncore.common.util.Tank; import techreborn.api.recipe.RecipeCrafter; import techreborn.blocks.BlockMachineCasing; import techreborn.init.ModBlocks; import techreborn.init.ModFluids; -import techreborn.lib.Location; import techreborn.lib.Reference; import techreborn.powerSystem.TilePowerAcceptor; -import techreborn.util.Inventory; -import techreborn.util.Tank; import java.util.List; @@ -127,7 +127,7 @@ public class TileIndustrialSawmill extends TilePowerAcceptor implements IWrencha @Override public void addInfo(List info, boolean isRealTile) { super.addInfo(info, isRealTile); - if(isRealTile){ + if (isRealTile) { info.add("Power Stored " + getEnergy() + " EU"); if (crafter.currentRecipe != null) { info.add("Power Usage " + crafter.currentRecipe.euPerTick() + " EU/t"); diff --git a/src/main/java/techreborn/tiles/TileMachineBase.java b/src/main/java/techreborn/tiles/TileMachineBase.java index 2af614bb6..4b040c6cf 100644 --- a/src/main/java/techreborn/tiles/TileMachineBase.java +++ b/src/main/java/techreborn/tiles/TileMachineBase.java @@ -5,7 +5,7 @@ import net.minecraft.network.NetworkManager; import net.minecraft.network.Packet; import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; -import techreborn.packets.PacketHandler; +import reborncore.common.packets.PacketHandler; public abstract class TileMachineBase extends TileEntity { @@ -47,11 +47,11 @@ public abstract class TileMachineBase extends TileEntity { @Override public void readFromNBT(NBTTagCompound tagCompound) { super.readFromNBT(tagCompound); - if(tagCompound.hasKey("meta") && !tagCompound.hasKey("rotation")){ - rotation = tagCompound.getInteger("meta"); - } else { - rotation = tagCompound.getInteger("rotation"); - } + if (tagCompound.hasKey("meta") && !tagCompound.hasKey("rotation")) { + rotation = tagCompound.getInteger("meta"); + } else { + rotation = tagCompound.getInteger("rotation"); + } } @Override diff --git a/src/main/java/techreborn/tiles/TileMachineCasing.java b/src/main/java/techreborn/tiles/TileMachineCasing.java index e84a5bf5a..76c8541a2 100644 --- a/src/main/java/techreborn/tiles/TileMachineCasing.java +++ b/src/main/java/techreborn/tiles/TileMachineCasing.java @@ -1,8 +1,8 @@ package techreborn.tiles; -import erogenousbeef.coreTR.multiblock.MultiblockControllerBase; -import erogenousbeef.coreTR.multiblock.MultiblockValidationException; -import erogenousbeef.coreTR.multiblock.rectangular.RectangularMultiblockTileEntityBase; +import reborncore.common.multiblock.MultiblockControllerBase; +import reborncore.common.multiblock.MultiblockValidationException; +import reborncore.common.multiblock.rectangular.RectangularMultiblockTileEntityBase; import techreborn.multiblocks.MultiBlockCasing; public class TileMachineCasing extends RectangularMultiblockTileEntityBase { diff --git a/src/main/java/techreborn/tiles/TileMatterFabricator.java b/src/main/java/techreborn/tiles/TileMatterFabricator.java index 8c5c755cf..2c9e9934d 100644 --- a/src/main/java/techreborn/tiles/TileMatterFabricator.java +++ b/src/main/java/techreborn/tiles/TileMatterFabricator.java @@ -10,11 +10,11 @@ import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.common.util.ForgeDirection; +import reborncore.common.util.Inventory; +import reborncore.common.util.ItemUtils; import techreborn.init.ModBlocks; import techreborn.init.ModItems; import techreborn.powerSystem.TilePowerAcceptor; -import techreborn.util.Inventory; -import techreborn.util.ItemUtils; public class TileMatterFabricator extends TilePowerAcceptor implements IWrenchable, IEnergyTile, IInventory, ISidedInventory { diff --git a/src/main/java/techreborn/tiles/TileQuantumChest.java b/src/main/java/techreborn/tiles/TileQuantumChest.java index ff5723521..461a5e83a 100644 --- a/src/main/java/techreborn/tiles/TileQuantumChest.java +++ b/src/main/java/techreborn/tiles/TileQuantumChest.java @@ -9,10 +9,10 @@ import net.minecraft.network.NetworkManager; import net.minecraft.network.Packet; import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import powercrystals.minefactoryreloaded.api.IDeepStorageUnit; -import techreborn.api.IListInfoProvider; +import reborncore.api.IListInfoProvider; +import reborncore.common.util.Inventory; +import reborncore.common.util.ItemUtils; import techreborn.init.ModBlocks; -import techreborn.util.Inventory; -import techreborn.util.ItemUtils; import java.util.List; @@ -232,34 +232,33 @@ public class TileQuantumChest extends TileMachineBase implements IInventory, } - - @Override - public ItemStack getStoredItemType() { - return this.storedItem; - } + @Override + public ItemStack getStoredItemType() { + return this.storedItem; + } - @Override - public void setStoredItemCount(int amount) { - this.storedItem.stackSize = 0; - this.storedItem.stackSize += (amount); - this.markDirty(); - } + @Override + public void setStoredItemCount(int amount) { + this.storedItem.stackSize = 0; + this.storedItem.stackSize += (amount); + this.markDirty(); + } - @Override - public void setStoredItemType(ItemStack type, int amount) { - this.storedItem = type; - this.storedItem.stackSize = amount; - this.markDirty(); - } + @Override + public void setStoredItemType(ItemStack type, int amount) { + this.storedItem = type; + this.storedItem.stackSize = amount; + this.markDirty(); + } - @Override - public int getMaxStoredCount() { - return this.storage; - } + @Override + public int getMaxStoredCount() { + return this.storage; + } @Override public void addInfo(List info, boolean isRealTile) { - if(isRealTile){ + if (isRealTile) { int size = 0; String name = "of nothing"; if (storedItem != null) { diff --git a/src/main/java/techreborn/tiles/TileQuantumTank.java b/src/main/java/techreborn/tiles/TileQuantumTank.java index 7695b7e4c..b928b01b9 100644 --- a/src/main/java/techreborn/tiles/TileQuantumTank.java +++ b/src/main/java/techreborn/tiles/TileQuantumTank.java @@ -13,11 +13,11 @@ import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidTankInfo; import net.minecraftforge.fluids.IFluidHandler; -import techreborn.api.IListInfoProvider; +import reborncore.api.IListInfoProvider; +import reborncore.common.util.FluidUtils; +import reborncore.common.util.Inventory; +import reborncore.common.util.Tank; import techreborn.init.ModBlocks; -import techreborn.util.FluidUtils; -import techreborn.util.Inventory; -import techreborn.util.Tank; import java.util.List; @@ -219,7 +219,7 @@ public class TileQuantumTank extends TileMachineBase implements IFluidHandler, @Override public void addInfo(List info, boolean isRealTile) { - if(isRealTile){ + if (isRealTile) { if (tank.getFluid() != null) { info.add(tank.getFluidAmount() + " of " + tank.getFluidType().getName()); diff --git a/src/main/java/techreborn/tiles/TileRollingMachine.java b/src/main/java/techreborn/tiles/TileRollingMachine.java index 9df295fd6..953b19ed1 100644 --- a/src/main/java/techreborn/tiles/TileRollingMachine.java +++ b/src/main/java/techreborn/tiles/TileRollingMachine.java @@ -9,11 +9,11 @@ import net.minecraft.inventory.InventoryCrafting; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.common.util.ForgeDirection; +import reborncore.common.util.Inventory; +import reborncore.common.util.ItemUtils; import techreborn.api.RollingMachineRecipe; import techreborn.init.ModBlocks; import techreborn.powerSystem.TilePowerAcceptor; -import techreborn.util.Inventory; -import techreborn.util.ItemUtils; //TODO add tick and power bars. public class TileRollingMachine extends TilePowerAcceptor implements IWrenchable, IEnergyTile, IInventory { diff --git a/src/main/java/techreborn/tiles/TileSemifluidGenerator.java b/src/main/java/techreborn/tiles/TileSemifluidGenerator.java index 436d9274f..fc9be92e8 100644 --- a/src/main/java/techreborn/tiles/TileSemifluidGenerator.java +++ b/src/main/java/techreborn/tiles/TileSemifluidGenerator.java @@ -10,18 +10,18 @@ import net.minecraft.network.Packet; import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.*; +import reborncore.common.util.FluidUtils; +import reborncore.common.util.Inventory; +import reborncore.common.util.Tank; import techreborn.config.ConfigTechReborn; import techreborn.init.ModBlocks; import techreborn.powerSystem.TilePowerAcceptor; -import techreborn.util.FluidUtils; -import techreborn.util.Inventory; -import techreborn.util.Tank; import java.util.HashMap; import java.util.Map; public class TileSemifluidGenerator extends TilePowerAcceptor implements IWrenchable, - IFluidHandler, IInventory{ + IFluidHandler, IInventory { public Tank tank = new Tank("TileSemifluidGenerator", FluidContainerRegistry.BUCKET_VOLUME * 10, this); diff --git a/src/main/java/techreborn/tiles/TileThermalGenerator.java b/src/main/java/techreborn/tiles/TileThermalGenerator.java index 5afe452c7..d2d63b279 100644 --- a/src/main/java/techreborn/tiles/TileThermalGenerator.java +++ b/src/main/java/techreborn/tiles/TileThermalGenerator.java @@ -12,12 +12,12 @@ import net.minecraft.network.Packet; import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.*; +import reborncore.common.util.FluidUtils; +import reborncore.common.util.Inventory; +import reborncore.common.util.Tank; import techreborn.config.ConfigTechReborn; import techreborn.init.ModBlocks; import techreborn.powerSystem.TilePowerAcceptor; -import techreborn.util.FluidUtils; -import techreborn.util.Inventory; -import techreborn.util.Tank; public class TileThermalGenerator extends TilePowerAcceptor implements IWrenchable, IFluidHandler, IInventory, IEnergyTile { @@ -137,9 +137,9 @@ public class TileThermalGenerator extends TilePowerAcceptor implements IWrenchab @Override public void updateEntity() { super.updateEntity(); - if (!worldObj.isRemote){ + if (!worldObj.isRemote) { FluidUtils.drainContainers(this, inventory, 0, 1); - for(ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS){ + for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) { if (worldObj.getBlock(xCoord + direction.offsetX, yCoord + direction.offsetY, zCoord + direction.offsetZ) == Blocks.lava) { addEnergy(1); } diff --git a/src/main/java/techreborn/tiles/idsu/IDSUManager.java b/src/main/java/techreborn/tiles/idsu/IDSUManager.java index e74765b43..1c276c48b 100644 --- a/src/main/java/techreborn/tiles/idsu/IDSUManager.java +++ b/src/main/java/techreborn/tiles/idsu/IDSUManager.java @@ -119,7 +119,7 @@ public class IDSUManager { } public IDSUValueSaveData getSaves(String udid) { - if(udid == null){ + if (udid == null) { return null; } if (idsuValues.containsKey(udid)) { diff --git a/src/main/java/techreborn/tiles/idsu/TileIDSU.java b/src/main/java/techreborn/tiles/idsu/TileIDSU.java index 666da4585..c310515b6 100644 --- a/src/main/java/techreborn/tiles/idsu/TileIDSU.java +++ b/src/main/java/techreborn/tiles/idsu/TileIDSU.java @@ -5,9 +5,9 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.common.util.ForgeDirection; import org.apache.commons.lang3.StringUtils; +import reborncore.common.misc.Functions; import techreborn.config.ConfigTechReborn; import techreborn.init.ModBlocks; -import techreborn.lib.Functions; import techreborn.powerSystem.TilePowerAcceptor; public class TileIDSU extends TilePowerAcceptor { @@ -16,7 +16,7 @@ public class TileIDSU extends TilePowerAcceptor { @Override public double getEnergy() { - if(ownerUdid == null && StringUtils.isBlank(ownerUdid) || StringUtils.isEmpty(ownerUdid)) { + if (ownerUdid == null && StringUtils.isBlank(ownerUdid) || StringUtils.isEmpty(ownerUdid)) { return 0.0; } return IDSUManager.INSTANCE.getSaveDataForWorld(worldObj, ownerUdid).storedPower; @@ -24,7 +24,7 @@ public class TileIDSU extends TilePowerAcceptor { @Override public void setEnergy(double energy) { - if(ownerUdid == null && StringUtils.isBlank(ownerUdid) || StringUtils.isEmpty(ownerUdid)) { + if (ownerUdid == null && StringUtils.isBlank(ownerUdid) || StringUtils.isEmpty(ownerUdid)) { return; } IDSUManager.INSTANCE.getSaveDataForWorld(worldObj, ownerUdid).storedPower = energy; @@ -99,7 +99,7 @@ public class TileIDSU extends TilePowerAcceptor { public void writeToNBT(NBTTagCompound nbttagcompound) { super.writeToNBT(nbttagcompound); - if(ownerUdid == null && StringUtils.isBlank(ownerUdid) || StringUtils.isEmpty(ownerUdid)) { + if (ownerUdid == null && StringUtils.isBlank(ownerUdid) || StringUtils.isEmpty(ownerUdid)) { return; } nbttagcompound.setString("ownerUdid", this.ownerUdid); diff --git a/src/main/java/techreborn/tiles/lesu/TileLesu.java b/src/main/java/techreborn/tiles/lesu/TileLesu.java index 7401fe738..1c75f3d10 100644 --- a/src/main/java/techreborn/tiles/lesu/TileLesu.java +++ b/src/main/java/techreborn/tiles/lesu/TileLesu.java @@ -2,10 +2,10 @@ package techreborn.tiles.lesu; import net.minecraftforge.common.util.ForgeDirection; +import reborncore.common.misc.Functions; +import reborncore.common.util.Inventory; import techreborn.config.ConfigTechReborn; -import techreborn.lib.Functions; import techreborn.powerSystem.TilePowerAcceptor; -import techreborn.util.Inventory; import java.util.ArrayList; diff --git a/src/main/java/techreborn/util/BucketHandler.java b/src/main/java/techreborn/util/BucketHandler.java deleted file mode 100644 index c6dc4ec8c..000000000 --- a/src/main/java/techreborn/util/BucketHandler.java +++ /dev/null @@ -1,49 +0,0 @@ -package techreborn.util; - -import cpw.mods.fml.common.eventhandler.Event.Result; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.world.World; -import net.minecraftforge.event.entity.player.FillBucketEvent; - -import java.util.HashMap; -import java.util.Map; - -public class BucketHandler { - - public static BucketHandler INSTANCE = new BucketHandler(); - public Map buckets = new HashMap(); - - private BucketHandler() { - - } - - @SubscribeEvent - public void onBucketFill(FillBucketEvent event) { - ItemStack result = fillCustomBucket(event.world, event.target); - - if (result == null) - return; - - event.result = result; - event.setResult(Result.ALLOW); - } - - private ItemStack fillCustomBucket(World world, MovingObjectPosition pos) { - - Block block = world.getBlock(pos.blockX, pos.blockY, pos.blockZ); - - Item bucket = buckets.get(block); - if (bucket != null - && world.getBlockMetadata(pos.blockX, pos.blockY, pos.blockZ) == 0) { - world.setBlockToAir(pos.blockX, pos.blockY, pos.blockZ); - return new ItemStack(bucket); - } else - return null; - - } - -} diff --git a/src/main/java/techreborn/util/Color.java b/src/main/java/techreborn/util/Color.java deleted file mode 100644 index 8eadbaa06..000000000 --- a/src/main/java/techreborn/util/Color.java +++ /dev/null @@ -1,44 +0,0 @@ -package techreborn.util; - -/** - * @author TeamC4 - */ - -public enum Color { - BLACK("\u00A70"), // - DARK_BLUE("\u00A71"), // - DARK_GREEN("\u00A72"), // - DARK_AQUA("\u00A73"), // - DARK_RED("\u00A74"), // - DARK_PURPLE("\u00A75"), // - GOLD("\u00A76"), // - GRAY("\u00A77"), // - DARK_GRAY("\u00A78"), // - BLUE("\u00A79"), // - GREEN("\u00A7a"), // - AQUA("\u00A7b"), // - RED("\u00A7c"), // - LIGHT_PURPLE("\u00A7d"), // - YELLOW("\u00A7e"), // - WHITE("\u00A7f"), // - - STRIKE_THROUGH("\u00A7m"), // - UNDERLINE("\u00A7n"), // - BOLD("\u00A7l"), // - RANDOM("\u00A7k"), // - ITALIC("\u00A7o"), // - RESET("\u00A7r"); // - - public String code = ""; - - private Color(String code) { - - this.code = code; - } - - @Override - public String toString() { - - return code; - } -} diff --git a/src/main/java/techreborn/util/CraftingHelper.java b/src/main/java/techreborn/util/CraftingHelper.java deleted file mode 100644 index 79a44efbe..000000000 --- a/src/main/java/techreborn/util/CraftingHelper.java +++ /dev/null @@ -1,22 +0,0 @@ -package techreborn.util; - -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.CraftingManager; -import net.minecraftforge.oredict.ShapedOreRecipe; -import net.minecraftforge.oredict.ShapelessOreRecipe; - -public class CraftingHelper { - - public static void addShapedOreRecipe(ItemStack outputItemStack, - Object... objectInputs) { - CraftingManager.getInstance().getRecipeList() - .add(new ShapedOreRecipe(outputItemStack, objectInputs)); - } - - public static void addShapelessOreRecipe(ItemStack outputItemStack, - Object... objectInputs) { - CraftingManager.getInstance().getRecipeList() - .add(new ShapelessOreRecipe(outputItemStack, objectInputs)); - } - -} diff --git a/src/main/java/techreborn/util/FluidUtils.java b/src/main/java/techreborn/util/FluidUtils.java deleted file mode 100644 index a54ec5985..000000000 --- a/src/main/java/techreborn/util/FluidUtils.java +++ /dev/null @@ -1,73 +0,0 @@ -package techreborn.util; - -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidContainerRegistry; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.IFluidHandler; - -public class FluidUtils { - - public static boolean drainContainers(IFluidHandler fluidHandler, - IInventory inv, int inputSlot, int outputSlot) { - ItemStack input = inv.getStackInSlot(inputSlot); - ItemStack output = inv.getStackInSlot(outputSlot); - - if (input != null) { - FluidStack fluidInContainer = getFluidStackInContainer(input); - ItemStack emptyItem = input.getItem().getContainerItem(input); - if (fluidInContainer != null && (emptyItem == null || output == null || (output.stackSize < output.getMaxStackSize() && ItemUtils.isItemEqual(output, emptyItem, true, true)))) { - int used = fluidHandler.fill(ForgeDirection.UNKNOWN, fluidInContainer, false); - if (used >= fluidInContainer.amount && fluidHandler.canFill(ForgeDirection.UP, fluidInContainer.getFluid())) { - fluidHandler.fill(ForgeDirection.UNKNOWN, fluidInContainer, - true); - if (emptyItem != null) - if (output == null) - inv.setInventorySlotContents(outputSlot, emptyItem); - else - output.stackSize++; - inv.decrStackSize(inputSlot, 1); - return true; - } - } - } - return false; - } - - public static boolean fillContainers(IFluidHandler fluidHandler, - IInventory inv, int inputSlot, int outputSlot, Fluid fluidToFill) { - ItemStack input = inv.getStackInSlot(inputSlot); - ItemStack output = inv.getStackInSlot(outputSlot); - ItemStack filled = getFilledContainer(fluidToFill, input); - if (filled != null && (output == null || (output.stackSize < output.getMaxStackSize() && ItemUtils.isItemEqual(filled, output, true, true)))) { - FluidStack fluidInContainer = getFluidStackInContainer(filled); - FluidStack drain = fluidHandler.drain(ForgeDirection.UNKNOWN, - fluidInContainer, false); - if (drain != null && drain.amount == fluidInContainer.amount) { - fluidHandler.drain(ForgeDirection.UNKNOWN, fluidInContainer, - true); - if (output == null) - inv.setInventorySlotContents(outputSlot, filled); - else - output.stackSize++; - inv.decrStackSize(inputSlot, 1); - return true; - } - } - return false; - } - - public static FluidStack getFluidStackInContainer(ItemStack stack) { - return FluidContainerRegistry.getFluidForFilledItem(stack); - } - - public static ItemStack getFilledContainer(Fluid fluid, ItemStack empty) { - if (fluid == null || empty == null) - return null; - return FluidContainerRegistry.fillFluidContainer(new FluidStack(fluid, - Integer.MAX_VALUE), empty); - } - -} diff --git a/src/main/java/techreborn/util/Inventory.java b/src/main/java/techreborn/util/Inventory.java deleted file mode 100644 index 85b26e7a4..000000000 --- a/src/main/java/techreborn/util/Inventory.java +++ /dev/null @@ -1,164 +0,0 @@ -package techreborn.util; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.util.Constants; - -public class Inventory implements IInventory { - - private final ItemStack[] contents; - private final String name; - private final int stackLimit; - private TileEntity tile = new TileEntity(); - public boolean hasChanged = false; - - public Inventory(int size, String invName, int invStackLimit) { - contents = new ItemStack[size]; - name = invName; - stackLimit = invStackLimit; - } - - @Override - public int getSizeInventory() { - return contents.length; - } - - @Override - public ItemStack getStackInSlot(int slotId) { - return contents[slotId]; - } - - @Override - public ItemStack decrStackSize(int slotId, int count) { - if (slotId < contents.length && contents[slotId] != null) { - if (contents[slotId].stackSize > count) { - ItemStack result = contents[slotId].splitStack(count); - markDirty(); - hasChanged = true; - return result; - } - ItemStack stack = contents[slotId]; - setInventorySlotContents(slotId, null); - hasChanged = true; - return stack; - } - return null; - } - - @Override - public void setInventorySlotContents(int slotId, ItemStack itemstack) { - if (slotId >= contents.length) { - return; - } - contents[slotId] = itemstack; - - if (itemstack != null - && itemstack.stackSize > this.getInventoryStackLimit()) { - itemstack.stackSize = this.getInventoryStackLimit(); - } - markDirty(); - hasChanged = true; - } - - @Override - public String getInventoryName() { - return name; - } - - @Override - public int getInventoryStackLimit() { - return stackLimit; - } - - @Override - public boolean isUseableByPlayer(EntityPlayer entityplayer) { - return true; - } - - @Override - public void openInventory() { - } - - @Override - public void closeInventory() { - } - - public void readFromNBT(NBTTagCompound data) { - readFromNBT(data, "Items"); - } - - public void readFromNBT(NBTTagCompound data, String tag) { - NBTTagList nbttaglist = data - .getTagList(tag, Constants.NBT.TAG_COMPOUND); - - for (int j = 0; j < nbttaglist.tagCount(); ++j) { - NBTTagCompound slot = nbttaglist.getCompoundTagAt(j); - int index; - if (slot.hasKey("index")) { - index = slot.getInteger("index"); - } else { - index = slot.getByte("Slot"); - } - if (index >= 0 && index < contents.length) { - setInventorySlotContents(index, - ItemStack.loadItemStackFromNBT(slot)); - } - } - hasChanged = true; - } - - public void writeToNBT(NBTTagCompound data) { - writeToNBT(data, "Items"); - } - - public void writeToNBT(NBTTagCompound data, String tag) { - NBTTagList slots = new NBTTagList(); - for (byte index = 0; index < contents.length; ++index) { - if (contents[index] != null && contents[index].stackSize > 0) { - NBTTagCompound slot = new NBTTagCompound(); - slots.appendTag(slot); - slot.setByte("Slot", index); - contents[index].writeToNBT(slot); - } - } - data.setTag(tag, slots); - } - - public void setTile(TileEntity tileEntity) { - tile = tileEntity; - } - - @Override - public ItemStack getStackInSlotOnClosing(int slotId) { - if (this.contents[slotId] == null) { - return null; - } - - ItemStack stackToTake = this.contents[slotId]; - setInventorySlotContents(slotId, null); - return stackToTake; - } - - public ItemStack[] getStacks() { - return contents; - } - - @Override - public boolean isItemValidForSlot(int i, ItemStack itemstack) { - return true; - } - - @Override - public boolean hasCustomInventoryName() { - return false; - } - - @Override - public void markDirty() { - tile.markDirty(); - } -} diff --git a/src/main/java/techreborn/util/ItemUtils.java b/src/main/java/techreborn/util/ItemUtils.java deleted file mode 100644 index c81f9d4b0..000000000 --- a/src/main/java/techreborn/util/ItemUtils.java +++ /dev/null @@ -1,119 +0,0 @@ -package techreborn.util; - -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraftforge.oredict.OreDictionary; - -import java.util.ArrayList; -import java.util.List; - -/** - * Created by mark on 12/04/15. - */ -public class ItemUtils { - - public static boolean isItemEqual(final ItemStack a, final ItemStack b, - final boolean matchDamage, final boolean matchNBT) { - if (a == null || b == null) - return false; - if (a.getItem() != b.getItem()) - return false; - if (matchNBT && !ItemStack.areItemStackTagsEqual(a, b)) - return false; - if (matchDamage && a.getHasSubtypes()) { - if (isWildcard(a) || isWildcard(b)) - return true; - if (a.getItemDamage() != b.getItemDamage()) - return false; - } - return true; - } - - public static boolean isItemEqual(ItemStack a, ItemStack b, - boolean matchDamage, boolean matchNBT, boolean useOreDic) { - if (isItemEqual(a, b, matchDamage, matchNBT)) { - return true; - } - if (a == null || b == null) - return false; - if (useOreDic) { - for (int inta : OreDictionary.getOreIDs(a)) { - for (int intb : OreDictionary.getOreIDs(b)) { - if (inta == intb) { - return true; - } - } - } - } - return false; - } - - - public static boolean isWildcard(ItemStack stack) { - return isWildcard(stack.getItemDamage()); - } - - public static boolean isWildcard(int damage) { - return damage == -1 || damage == OreDictionary.WILDCARD_VALUE; - } - - public static void writeInvToNBT(IInventory inv, String tag, - NBTTagCompound data) { - NBTTagList list = new NBTTagList(); - for (byte slot = 0; slot < inv.getSizeInventory(); slot++) { - ItemStack stack = inv.getStackInSlot(slot); - if (stack != null) { - NBTTagCompound itemTag = new NBTTagCompound(); - itemTag.setByte("Slot", slot); - writeItemToNBT(stack, itemTag); - list.appendTag(itemTag); - } - } - data.setTag(tag, list); - } - - public static void readInvFromNBT(IInventory inv, String tag, - NBTTagCompound data) { - NBTTagList list = data.getTagList(tag, 10); - for (byte entry = 0; entry < list.tagCount(); entry++) { - NBTTagCompound itemTag = list.getCompoundTagAt(entry); - int slot = itemTag.getByte("Slot"); - if (slot >= 0 && slot < inv.getSizeInventory()) { - ItemStack stack = readItemFromNBT(itemTag); - inv.setInventorySlotContents(slot, stack); - } - } - } - - public static void writeItemToNBT(ItemStack stack, NBTTagCompound data) { - if (stack == null || stack.stackSize <= 0) - return; - if (stack.stackSize > 127) - stack.stackSize = 127; - stack.writeToNBT(data); - } - - public static ItemStack readItemFromNBT(NBTTagCompound data) { - return ItemStack.loadItemStackFromNBT(data); - } - - public static List getStackWithAllOre(ItemStack stack) { - if (stack == null) { - return new ArrayList(); - } - ArrayList list = new ArrayList(); - for (int oreID : OreDictionary.getOreIDs(stack)) { - for (ItemStack ore : OreDictionary.getOres(OreDictionary.getOreName(oreID))) { - ItemStack newOre = ore.copy(); - newOre.stackSize = stack.stackSize; - list.add(newOre); - } - } - if (list.isEmpty()) { - list.add(stack); - } - return list; - } -} diff --git a/src/main/java/techreborn/util/LogHelper.java b/src/main/java/techreborn/util/LogHelper.java deleted file mode 100644 index 81fec58e9..000000000 --- a/src/main/java/techreborn/util/LogHelper.java +++ /dev/null @@ -1,45 +0,0 @@ -package techreborn.util; - -import cpw.mods.fml.common.FMLLog; -import org.apache.logging.log4j.Level; -import techreborn.lib.ModInfo; - -public class LogHelper { - - public static void log(Level logLevel, Object object) { - FMLLog.log(ModInfo.MOD_NAME, logLevel, String.valueOf(object)); - } - - public static void all(Object object) { - log(Level.ALL, object); - } - - public static void debug(Object object) { - log(Level.DEBUG, object); - } - - public static void error(Object object) { - log(Level.ERROR, object); - } - - public static void fatal(Object object) { - log(Level.FATAL, object); - } - - public static void info(Object object) { - log(Level.INFO, object); - } - - public static void off(Object object) { - log(Level.OFF, object); - } - - public static void trace(Object object) { - log(Level.TRACE, object); - } - - public static void warn(Object object) { - log(Level.WARN, object); - } - -} diff --git a/src/main/java/techreborn/util/OreDrop.java b/src/main/java/techreborn/util/OreDrop.java deleted file mode 100644 index 6192aed3a..000000000 --- a/src/main/java/techreborn/util/OreDrop.java +++ /dev/null @@ -1,61 +0,0 @@ -package techreborn.util; - - -import net.minecraft.item.ItemStack; -import techreborn.config.ConfigTechReborn; - -import java.util.Random; - -public class OreDrop { - public OreDrop(ItemStack drop) { - this.drop = drop; - this.count = drop.stackSize; - this.baseChance = 100; - } - - public OreDrop(ItemStack drop, double baseChance) { - this.drop = drop; - this.count = drop.stackSize; - this.baseChance = (int) (baseChance * 100); - } - - public ItemStack getDrops(int fortuneLevel, Random random) { - int count; - if (baseChance == 100) //This always drops. Use vanilla fortune rules. - { - count = calculateFortuneMulti(fortuneLevel, random); - } else if (calculateFortuneSingle(fortuneLevel, random)) //This has a chance to drop. Increase that chance with fortune. - { - count = this.count; - } else { - count = 0; - } - return new ItemStack(drop.getItem(), count, drop.getItemDamage()); - } - - //Refer to http://minecraft.gamepedia.com/Enchanting#Fortune - private int calculateFortuneMulti(int level, Random random) { - int chanceOfEachBonus = 100 / (level + 2); - int roll = random.nextInt(100); - - if (roll < chanceOfEachBonus * level) //If level = 0, this is always false - { - return count * ((roll / chanceOfEachBonus) + 2); - } else { - return count; - } - } - - //Each fortune level increases probability by 50% (configurable) of base, up to a limit of 100%, obviously. - //So, if base is 5% and we have Fortune III, chance is 5% + (3 * 2.5%) = 12.5% - private boolean calculateFortuneSingle(int level, Random random) { - double modifier = ConfigTechReborn.FortuneSecondaryOreMultiplierPerLevel * level; - double total = baseChance + (baseChance * modifier); - int roll = random.nextInt(100); - return roll <= total; - } - - public ItemStack drop; - public Integer baseChance; - public Integer count; -} \ No newline at end of file diff --git a/src/main/java/techreborn/util/OreDropSet.java b/src/main/java/techreborn/util/OreDropSet.java deleted file mode 100644 index e1833c42a..000000000 --- a/src/main/java/techreborn/util/OreDropSet.java +++ /dev/null @@ -1,24 +0,0 @@ -package techreborn.util; - -import net.minecraft.item.ItemStack; - -import java.util.ArrayList; -import java.util.Random; - -public class OreDropSet { - public OreDropSet(OreDrop... oreDrops) { - this.dropSet = oreDrops; - } - - public ArrayList drop(int fortune, Random random) { - ArrayList drops = new ArrayList(); - - for (OreDrop drop : dropSet) { - drops.add(drop.getDrops(fortune, random)); - } - - return drops; - } - - public OreDrop[] dropSet; -} \ No newline at end of file diff --git a/src/main/java/techreborn/util/OreUtil.java b/src/main/java/techreborn/util/OreUtil.java deleted file mode 100644 index 7d25eeb50..000000000 --- a/src/main/java/techreborn/util/OreUtil.java +++ /dev/null @@ -1,13 +0,0 @@ -package techreborn.util; - -import net.minecraftforge.oredict.OreDictionary; - -public class OreUtil { - - public static boolean doesOreExistAndValid(String name){ - if(!OreDictionary.doesOreNameExist(name)){ - return false; - } - return OreDictionary.getOres(name).size() >= 1; - } -} diff --git a/src/main/java/techreborn/util/RecipeRemover.java b/src/main/java/techreborn/util/RecipeRemover.java deleted file mode 100644 index 527344d8e..000000000 --- a/src/main/java/techreborn/util/RecipeRemover.java +++ /dev/null @@ -1,41 +0,0 @@ -package techreborn.util; - -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.CraftingManager; -import net.minecraft.item.crafting.IRecipe; -import net.minecraft.item.crafting.ShapedRecipes; - -import java.util.List; - -public class RecipeRemover { - public static void removeShapedRecipes(List removelist) { - for (ItemStack stack : removelist) - removeShapedRecipe(stack); - } - - public static void removeAnyRecipe(ItemStack resultItem) { - List recipes = CraftingManager.getInstance().getRecipeList(); - for (int i = 0; i < recipes.size(); i++) { - IRecipe tmpRecipe = recipes.get(i); - ItemStack recipeResult = tmpRecipe.getRecipeOutput(); - if (ItemStack.areItemStacksEqual(resultItem, recipeResult)) { - recipes.remove(i--); - } - } - } - - public static void removeShapedRecipe(ItemStack resultItem) { - List recipes = CraftingManager.getInstance().getRecipeList(); - for (int i = 0; i < recipes.size(); i++) { - IRecipe tmpRecipe = recipes.get(i); - if (tmpRecipe instanceof ShapedRecipes) { - ShapedRecipes recipe = (ShapedRecipes) tmpRecipe; - ItemStack recipeResult = recipe.getRecipeOutput(); - - if (ItemStack.areItemStacksEqual(resultItem, recipeResult)) { - recipes.remove(i++); - } - } - } - } -} diff --git a/src/main/java/techreborn/util/Tank.java b/src/main/java/techreborn/util/Tank.java deleted file mode 100644 index 60b452fdb..000000000 --- a/src/main/java/techreborn/util/Tank.java +++ /dev/null @@ -1,78 +0,0 @@ -package techreborn.util; - -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.FluidTank; -import techreborn.packets.PacketHandler; - -public class Tank extends FluidTank { - - private final String name; - - private FluidStack lastBeforeUpdate = null; - - public Tank(String name, int capacity, TileEntity tile) { - super(capacity); - this.name = name; - this.tile = tile; - } - - public boolean isEmpty() { - return getFluid() == null || getFluid().amount <= 0; - } - - public boolean isFull() { - return getFluid() != null && getFluid().amount >= getCapacity(); - } - - public Fluid getFluidType() { - return getFluid() != null ? getFluid().getFluid() : null; - } - - @Override - public final NBTTagCompound writeToNBT(NBTTagCompound nbt) { - NBTTagCompound tankData = new NBTTagCompound(); - super.writeToNBT(tankData); - nbt.setTag(name, tankData); - return nbt; - } - - @Override - public final FluidTank readFromNBT(NBTTagCompound nbt) { - if (nbt.hasKey(name)) { - // allow to read empty tanks - setFluid(null); - - NBTTagCompound tankData = nbt.getCompoundTag(name); - super.readFromNBT(tankData); - } - return this; - } - - public void compareAndUpdate() { - if (tile.getWorldObj().isRemote) { - return; - } - FluidStack current = this.getFluid(); - if (current != null) { - if (lastBeforeUpdate != null) { - if (Math.abs(current.amount - lastBeforeUpdate.amount) >= 500) { - PacketHandler.sendPacketToAllPlayers(tile.getDescriptionPacket(), tile.getWorldObj()); - lastBeforeUpdate = current.copy(); - } else if (lastBeforeUpdate.amount < this.getCapacity() && current.amount == this.getCapacity() || lastBeforeUpdate.amount == this.getCapacity() && current.amount < this.getCapacity()) { - PacketHandler.sendPacketToAllPlayers(tile.getDescriptionPacket(), tile.getWorldObj()); - lastBeforeUpdate = current.copy(); - } - } else { - PacketHandler.sendPacketToAllPlayers(tile.getDescriptionPacket(), tile.getWorldObj()); - lastBeforeUpdate = current.copy(); - } - } else if (lastBeforeUpdate != null) { - PacketHandler.sendPacketToAllPlayers(tile.getDescriptionPacket(), tile.getWorldObj()); - lastBeforeUpdate = null; - } - } - -} diff --git a/src/main/java/techreborn/util/TorchHelper.java b/src/main/java/techreborn/util/TorchHelper.java deleted file mode 100644 index c68b4a0cd..000000000 --- a/src/main/java/techreborn/util/TorchHelper.java +++ /dev/null @@ -1,40 +0,0 @@ -package techreborn.util; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; -import net.minecraftforge.event.ForgeEventFactory; - -public class TorchHelper { - - public static boolean placeTorch(ItemStack stack, EntityPlayer player, - World world, int x, int y, int z, int side, float xOffset, - float yOffset, float zOffset) { - for (int i = 0; i < player.inventory.mainInventory.length; i++) { - ItemStack torchStack = player.inventory.mainInventory[i]; - if (torchStack == null - || !torchStack.getUnlocalizedName().toLowerCase() - .contains("torch")) - continue; - Item item = torchStack.getItem(); - if (!(item instanceof ItemBlock)) - continue; - int oldMeta = torchStack.getItemDamage(); - int oldSize = torchStack.stackSize; - boolean result = torchStack.tryPlaceItemIntoWorld(player, world, x, - y, z, side, xOffset, yOffset, zOffset); - if (player.capabilities.isCreativeMode) { - torchStack.setItemDamage(oldMeta); - torchStack.stackSize = oldSize; - } else if (torchStack.stackSize <= 0) { - ForgeEventFactory.onPlayerDestroyItem(player, torchStack); - player.inventory.mainInventory[i] = null; - } - if (result) - return true; - } - return false; - } -} diff --git a/src/main/java/techreborn/util/VersionChecker.java b/src/main/java/techreborn/util/VersionChecker.java deleted file mode 100644 index ff59187ea..000000000 --- a/src/main/java/techreborn/util/VersionChecker.java +++ /dev/null @@ -1,132 +0,0 @@ -package techreborn.util; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.reflect.TypeToken; -import org.apache.commons.io.IOUtils; -import techreborn.lib.ModInfo; - -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; -import java.net.URLConnection; -import java.util.ArrayList; - -public class VersionChecker { - - public static final String apiAddress = "http://modmuss50.me/api/v1/version.php"; - - public String projectName; - - ArrayList versions; - - public boolean isChecking; - - public VersionChecker(String projectName) { - this.projectName = projectName; - } - - public void checkVersion() throws IOException { - isChecking = true; - URL url = new URL(apiAddress + "?project=" + projectName); - URLConnection con = url.openConnection(); - InputStream in = con.getInputStream(); - String encoding = con.getContentEncoding(); - encoding = encoding == null ? "UTF-8" : encoding; - String body = IOUtils.toString(in, encoding).replaceAll("
", ""); - - Gson gson = new Gson(); - versions = gson.fromJson(body, new TypeToken>() { - }.getType()); - isChecking = false; - } - - public void checkVersionThreaded() { - class VersionCheckerThread extends Thread { - public void run() { - try { - checkVersion(); - } catch (IOException e) { - e.printStackTrace(); - } - } - } - VersionCheckerThread thread = new VersionCheckerThread(); - thread.start(); - } - - public boolean isLatestVersion() { - if (versions == null || versions.isEmpty()) { - return true; - } - return versions.get(0).version.equals(ModInfo.MOD_VERSION); - } - - public ModifacationVersionInfo getLatestVersion() { - if (versions == null || versions.isEmpty()) { - return null; - } - return versions.get(0); - } - - public ArrayList getChangeLogSinceCurrentVersion() { - ArrayList log = new ArrayList(); - if (!isLatestVersion()) { - for (ModifacationVersionInfo version : versions) { - if (version.version.equals(ModInfo.MOD_VERSION)) { - break; - } - log.addAll(version.changeLog); - } - } - return log; - } - - static class ModifacationVersionInfo { - public String version; - - public String minecraftVersion; - - public ArrayList changeLog; - - public String releaseDate; - - public boolean recommended; - - public ModifacationVersionInfo(String version, String minecraftVersion, ArrayList changeLog, String releaseDate, boolean recommended) { - this.version = version; - this.minecraftVersion = minecraftVersion; - this.changeLog = changeLog; - this.releaseDate = releaseDate; - this.recommended = recommended; - } - - public ModifacationVersionInfo() { - } - } - - //use this to make an example json file - public static void main(String[] args) throws IOException { - System.out.println("Generating example json file"); - ArrayList infos = new ArrayList(); - ArrayList changelog = new ArrayList(); - changelog.add("A change"); - changelog.add("Another change"); - - - infos.add(new ModifacationVersionInfo("1.1.1", "1.7.10", changelog, "12th July", true)); - infos.add(new ModifacationVersionInfo("1.2.0", "1.7.10", changelog, "28th July", true)); - - Gson gson = new GsonBuilder().setPrettyPrinting().create(); - String json = gson.toJson(infos); - try { - FileWriter writer = new FileWriter(new File("master.json")); - writer.write(json); - writer.close(); - } catch (IOException e) { - e.printStackTrace(); - } - } -} diff --git a/src/main/java/techreborn/util/RecipeUtils.java b/src/main/java/techreborn/utils/RecipeUtils.java similarity index 75% rename from src/main/java/techreborn/util/RecipeUtils.java rename to src/main/java/techreborn/utils/RecipeUtils.java index bc863c7d4..b9c560295 100644 --- a/src/main/java/techreborn/util/RecipeUtils.java +++ b/src/main/java/techreborn/utils/RecipeUtils.java @@ -1,4 +1,4 @@ -package techreborn.util; +package techreborn.utils; import cpw.mods.fml.common.Loader; import ic2.api.item.IC2Items; @@ -7,8 +7,8 @@ import techreborn.items.ItemCells; public class RecipeUtils { - public static ItemStack getEmptyCell(int stackSize){ - if(Loader.isModLoaded("IC2")){ + public static ItemStack getEmptyCell(int stackSize) { + if (Loader.isModLoaded("IC2")) { ItemStack cell = IC2Items.getItem("cell").copy(); cell.stackSize = stackSize; return cell; diff --git a/src/main/java/techreborn/world/TROreGen.java b/src/main/java/techreborn/world/TROreGen.java index d41818af9..bfa61349d 100644 --- a/src/main/java/techreborn/world/TROreGen.java +++ b/src/main/java/techreborn/world/TROreGen.java @@ -5,9 +5,9 @@ import net.minecraft.init.Blocks; import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkProvider; import net.minecraft.world.gen.feature.WorldGenMinable; +import techreborn.Core; import techreborn.config.ConfigTechReborn; import techreborn.init.ModBlocks; -import techreborn.util.LogHelper; import java.util.Random; @@ -54,7 +54,7 @@ public class TROreGen implements IWorldGenerator { orePeridot = new WorldGenMinable(ModBlocks.ore, 10, ConfigTechReborn.PeridotOreRare, Blocks.end_stone); oreSodalite = new WorldGenMinable(ModBlocks.ore, 11, ConfigTechReborn.SodaliteOreRare, Blocks.end_stone); - LogHelper.info("WorldGen Loaded"); + Core.logHelper.info("WorldGen Loaded"); } public void retroGen(Random random, int chunkX, int chunkZ, World world) { diff --git a/src/test/java/techreborn/TechRebornTests.java b/src/test/java/techreborn/TechRebornTests.java index 248b947b2..a6f47b126 100644 --- a/src/test/java/techreborn/TechRebornTests.java +++ b/src/test/java/techreborn/TechRebornTests.java @@ -1,7 +1,8 @@ package techreborn; import org.junit.Test; -import techreborn.util.VersionChecker; +import reborncore.common.util.VersionChecker; +import techreborn.lib.ModInfo; import java.io.IOException; @@ -9,7 +10,7 @@ public class TechRebornTests { @Test public void versionChecker() throws IOException { - VersionChecker versionChecker = new VersionChecker("TechReborn"); + VersionChecker versionChecker = new VersionChecker("TechReborn", new ModInfo()); versionChecker.checkVersion(); versionChecker.getChangeLogSinceCurrentVersion(); }