aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gtPlusPlus/xmod/gregtech/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/gtPlusPlus/xmod/gregtech/common')
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java631
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/StaticFields59.java303
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GTPP_Block_Machines.java534
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GTPP_Item_Machines.java229
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks.java78
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks2.java89
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks3.java366
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks4.java115
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks5.java83
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocksAbstract.java150
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingItems.java10
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaItemCasings1.java36
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaItemCasingsAbstract.java61
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaSpecialMachineCasings.java81
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaSpecialMultiCasings.java103
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaTieredCasingBlocks1.java110
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/fluid/GregtechFluidHandler.java111
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler.java82
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler2.java57
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler3.java68
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesCentrifugeMultiblock.java166
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGregtech58.java443
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGregtech59.java444
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGrinderMultiblock.java150
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java652
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtCutomCovers.java32
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtTools.java61
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/turbine/LargeTurbineTextureHandler.java318
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/blueprint/Blueprint_Generic_3x3.java87
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/blueprint/Blueprint_LFTR.java137
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/covers/CoverManager.java102
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/covers/GTPP_Cover_Overflow.java247
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/covers/GTPP_Cover_Overflow_Item.java182
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/covers/GTPP_Cover_ToggleVisual.java186
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/ChargingHelper.java429
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/CraftingHelper.java42
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/FlotationRecipeHandler.java79
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/GT_MethodHelper.java80
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/MachineUpdateHandler.java42
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/TreeFarmHelper.java1033
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/VolumetricFlaskHelper.java188
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/autocrafter/AC_Helper_Container.java118
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/autocrafter/AC_Helper_Utils.java80
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/tesseract/TesseractHelper.java263
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/treefarm/TreeGenerator.java386
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/items/MetaCustomCoverItem.java225
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechItems.java453
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechTools.java101
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Choocher.java88
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Electric_Lighter.java220
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Grinder.java94
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Prospecting_Ex.java123
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/items/covers/MetaItemCoverCasings.java40
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/render/GTPP_CapeRenderer.java517
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/render/GTPP_FlaskRenderer.java94
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/render/GTPP_Render_MachineBlock.java659
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/requirements/RequirementsBasicCubic.java11
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_TesseractGenerator.java730
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_TesseractTerminal.java581
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_Boiler_Base.java296
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_Boiler_HV.java56
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_Boiler_LV.java52
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_Boiler_MV.java52
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_Boiler_Solar.java194
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_RfConvertor.java348
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_SemiFluidGenerator.java171
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityDoubleFuelGeneratorBase.java153
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityGeothermalGenerator.java151
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityRocketFuelGenerator.java142
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntitySolarGenerator.java187
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntity_RTG.java390
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/ULV/GT_MetaTileEntity_ULV_CombustionGenerator.java50
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/ULV/GT_MetaTileEntity_ULV_GasTurbine.java59
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/ULV/GT_MetaTileEntity_ULV_SteamTurbine.java58
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/creative/GregtechMetaCreativeEnergyBuffer.java229
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_WorldAccelerator.java328
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaAtmosphericReconditioner.java789
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaCondensor.java174
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaGarbageCollector.java323
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaPollutionCreator.java386
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaPollutionDetector.java439
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntityChunkLoader.java394
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntityThaumcraftResearcher.java204
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_BasicWasher.java71
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_ChemicalReactor.java666
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_CompactFusionReactor.java702
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_PocketFusion.java704
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_ReactorColdTrap.java67
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_ReactorProcessingUnit.java67
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaWirelessCharger.java560
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/misc/GMTE_AmazonPackager.java323
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/misc/GregtechMTE_TeslaTower.java479
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialAlloySmelter.java403
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialArcFurnace.java320
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCentrifuge.java263
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCokeOven.java230
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCuttingMachine.java234
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialDehydrator.java415
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialElectrolyzer.java193
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialExtruder.java260
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMacerator.java259
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMixer.java257
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMultiMachine.java541
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialPlatePress.java242
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialSifter.java225
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialSinter.java268
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialThermalCentrifuge.java224
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialVacuumFreezer.java261
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWashPlant.java335
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWireMill.java206
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IronBlastFurnace.java403
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IsaMill.java666
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_SpargeTower.java414
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_AssemblyLine.java629
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_DistillationTower.java481
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_EBF.java484
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_Fusion_MK4.java153
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_Implosion.java207
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/steam/GregtechMetaTileEntity_SteamMacerator.java165
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_AutoCrafter.java656
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_ThermalBoiler.java354
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_ElementalDuplicator.java744
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_FastNeutronReactor.java231
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_FrothFlotationCell.java449
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_LargeNaqReactor.java501
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_MiniFusionPlant.java386
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_NuclearReactor.java523
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityGeneratorArray.java521
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityTreeFarm.java332
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_AlloyBlastSmelter.java336
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java481
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_IndustrialFishingPond.java623
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeRocketEngine.java629
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeSemifluidGenerator.java341
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_MassFabricator.java425
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Refinery.java238
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_SolarTower.java702
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/algae/GregtechMTE_AlgaePondBase.java486
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/bedrock/GregtechMetaTileEntity_BedrockMiningPlatform1.java46
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/bedrock/GregtechMetaTileEntity_BedrockMiningPlatform2.java46
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/bedrock/GregtechMetaTileEntity_BedrockMiningPlatformBase.java683
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/GregtechMTE_ChemicalPlant.java1046
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_SHSteam.java179
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_Steam.java189
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GregtechMetaTileEntity_LargerTurbineBase.java663
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_MultiTank.java621
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java657
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/misc/TileEntitySolarHeater.java348
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_ConnectableCrate.java574
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_TieredChest.java199
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_TieredTank.java160
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GregtechMetaEnergyBuffer.java421
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GregtechMetaSafeBlock.java62
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/creative/GT_MetaTileEntity_InfiniteItemHolder.java105
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/shelving/GT4Entity_Shelf.java359
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/shelving/GT4Entity_Shelf_Compartment.java39
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/shelving/GT4Entity_Shelf_Desk.java45
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/shelving/GT4Entity_Shelf_FileCabinet.java55
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/shelving/GT4Entity_Shelf_Iron.java41
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/shelving/GT4Entity_Shelf_Large.java266
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_AngleGrinder.java199
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_Base.java180
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_Choocher.java196
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_ElectricButcherKnife.java192
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_ElectricLighter.java166
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_ElectricSnips.java97
166 files changed, 47974 insertions, 0 deletions
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java
new file mode 100644
index 0000000000..091ee734e6
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java
@@ -0,0 +1,631 @@
+package gtPlusPlus.xmod.gregtech.common;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+import java.util.*;
+
+import org.apache.commons.lang3.ArrayUtils;
+
+import cpw.mods.fml.common.registry.GameRegistry;
+import cpw.mods.fml.common.registry.LanguageRegistry;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.*;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.BaseMetaTileEntity;
+import gregtech.api.util.*;
+import gregtech.common.GT_Proxy;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.api.objects.data.AutoMap;
+import gtPlusPlus.api.objects.minecraft.FormattedTooltipString;
+import gtPlusPlus.core.handler.AchievementHandler;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.material.ELEMENT;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.minecraft.*;
+import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils;
+import gtPlusPlus.core.util.reflect.ReflectionUtils;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.BaseCustomTileEntity;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.custom.power.BaseCustomPower_MTE;
+import gtPlusPlus.xmod.gregtech.common.covers.CoverManager;
+import gtPlusPlus.xmod.gregtech.common.helpers.MachineUpdateHandler;
+import gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic.GT_MetaTileEntity_WorldAccelerator;
+import ic2.core.init.BlocksItems;
+import ic2.core.init.InternalName;
+import net.minecraft.block.Block;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidRegistry;
+import net.minecraftforge.fluids.FluidStack;
+
+public class Meta_GT_Proxy {
+
+ static {
+ Logger.INFO("GT_PROXY - initialized.");
+ sDoesVolumetricFlaskExist = ReflectionUtils.doesClassExist("gregtech.common.items.GT_VolumetricFlask");
+ }
+
+ public static List<Runnable> GT_BlockIconload = new ArrayList<>();
+ public static List<Runnable> GT_ItemIconload = new ArrayList<>();
+
+ public static AutoMap<Integer> GT_ValidHeatingCoilMetas = new AutoMap<Integer>();
+
+ private static Class<BaseCustomTileEntity> sBaseMetaTileEntityClass;
+ private static Class<BaseCustomPower_MTE> sBaseMetaTileEntityClass2;
+
+ public static AchievementHandler mAssemblyAchievements;
+
+ public static final Map<String, FormattedTooltipString> mCustomGregtechMetaTooltips = new LinkedHashMap<String, FormattedTooltipString>();
+
+ /**
+ * Does this feature exist within GT? Saves loading useless content if not.
+ */
+ public static final boolean sDoesVolumetricFlaskExist;
+
+ @SideOnly(Side.CLIENT)
+ public static IIconRegister sBlockIcons, sItemIcons;
+
+ public Meta_GT_Proxy() {
+
+ }
+
+ public static Block sBlockMachines;
+
+ public static void preInit() {
+
+ //New GT++ Block, yay! (Progress)
+ //sBlockMachines = new GTPP_Block_Machines();
+ fixIC2FluidNames();
+
+ GT_Log.out.println("GT++ Mod: Register TileEntities.");
+ BaseMetaTileEntity tBaseMetaTileEntity = constructBaseMetaTileEntity();
+ BaseMetaTileEntity tBaseMetaTileEntity2 = constructBaseMetaTileEntityCustomPower();
+
+ GT_Log.out.println("GT++ Mod: Testing BaseMetaTileEntity.");
+ if (tBaseMetaTileEntity == null || tBaseMetaTileEntity2 == null) {
+ GT_Log.out.println("GT++ Mod: Fatal Error ocurred while initializing TileEntities, crashing Minecraft.");
+ throw new RuntimeException("");
+ }
+
+ //Gotta set it here so that we don't try call gregtech too early.
+ //Must set on the correct side
+
+ if (ReflectionUtils.doesFieldExist(GT_Proxy.class, "gt6Pipe")) {
+ StaticFields59.mGT6StylePipes = (boolean) StaticFields59.getFieldFromGregtechProxy("gt6Pipe");
+ }
+ else {
+ StaticFields59.mGT6StylePipes = false;
+ }
+
+ GT_Log.out.println("GT++ Mod: Registering the BaseMetaTileEntity.");
+ GameRegistry.registerTileEntity(tBaseMetaTileEntity.getClass(), "BaseMetaTileEntity_GTPP");
+ GameRegistry.registerTileEntity(tBaseMetaTileEntity2.getClass(), "BaseMetaTileEntity_GTPP2");
+ CoverManager.generateCustomCovers();
+ }
+
+ public static void init() {
+ setValidHeatingCoilMetas();
+ PollutionUtils.setPollutionFluids();
+ fixIC2FluidNames();
+ Utils.registerEvent(new MachineUpdateHandler());
+ }
+
+ public static void postInit() {
+ mAssemblyAchievements = new AchievementHandler();
+ fixIC2FluidNames();
+
+ // Finalise TAE
+ TAE.finalizeTAE();
+ }
+
+ @SuppressWarnings("deprecation")
+ public static void fixIC2FluidNames() {
+ //Fix IC2 Hot Water name
+ try {
+ String aNewHeatedWaterName = "Heated Water";
+ Logger.INFO("Renaming [IC2 Hotspring Water] --> ["+aNewHeatedWaterName+"].");LanguageRegistry.instance().addStringLocalization("fluidHotWater", "Heated Water");
+ LanguageRegistry.instance().addStringLocalization("fluidHotWater", aNewHeatedWaterName);
+ LanguageRegistry.instance().addStringLocalization("ic2.fluidHotWater", aNewHeatedWaterName);
+ GT_LanguageManager.addStringLocalization("fluidHotWater", aNewHeatedWaterName);
+ GT_LanguageManager.addStringLocalization("ic2.fluidHotWater", aNewHeatedWaterName);
+
+ Block b = BlocksItems.getFluidBlock(InternalName.fluidHotWater);
+ if (b != null) {
+ LanguageRegistry.addName(ItemUtils.getSimpleStack(b), aNewHeatedWaterName);
+ LanguageRegistry.instance().addStringLocalization(b.getUnlocalizedName(), aNewHeatedWaterName);
+ GT_LanguageManager.addStringLocalization(b.getUnlocalizedName(), aNewHeatedWaterName);
+ }
+ Fluid f = BlocksItems.getFluid(InternalName.fluidHotWater);
+ if (f != null) {
+ LanguageRegistry.instance().addStringLocalization(f.getUnlocalizedName(), aNewHeatedWaterName);
+ GT_LanguageManager.addStringLocalization(f.getUnlocalizedName(), aNewHeatedWaterName);
+ int aDam = FluidRegistry.getFluidID(f);
+ ItemStack s = ItemList.Display_Fluid.getWithDamage(1, aDam);
+ if (s != null) {
+ LanguageRegistry.addName(s, aNewHeatedWaterName);
+ }
+ }
+
+ String[] aLangs = new String[] {
+ "de_DE",
+ "en_US",
+ "en_GB",
+ "en_IC",
+ "es_AR",
+ "es_ES",
+ "es_MX",
+ "es_UY",
+ "es_VE",
+ "fr_CA",
+ "fr_FR",
+ "it_IT",
+ "ko_KR",
+ "pt_BR",
+ "pt_PT",
+ "ru_RU",
+ "sv_SE",
+ "tr_TR",
+ "zh_CN",
+ "zh_TW",
+ };
+ String[] aLangValues = new String[] {
+ "Erhitztes Wasser",
+ "Heated Water",
+ "Heated Water",
+ "Heated Water",
+ "Agua caliente",
+ "Agua caliente",
+ "Agua caliente",
+ "Agua caliente",
+ "Agua caliente",
+ "Eau chauffée",
+ "Eau chauffée",
+ "Acqua riscaldata",
+ "온수",
+ "Água aquecida",
+ "Água aquecida",
+ "Вода с подогревом",
+ "Uppvärmt vatten",
+ "Isıtılmış Su",
+ "热水",
+ "热水",
+
+ };
+ for (int i=0;i<aLangs.length;i++) {
+ Logger.REFLECTION("Trying to inject new lang data for "+aLangs[i]+", using value: "+aLangValues[i]);
+ LangUtils.rewriteEntryForLanguageRegistry(aLangs[i], "fluidHotWater", aLangValues[i]);
+ LangUtils.rewriteEntryForLanguageRegistry(aLangs[i], "ic2.fluidHotWater", aLangValues[i]);
+ }
+ }
+
+ catch (Throwable t) {
+
+ }
+ }
+
+ public static boolean generatePlasmaRecipesForAdvVacFreezer() {
+
+ AutoMap<GT_Recipe> aFreezerMapRebaked = new AutoMap<GT_Recipe>();
+ AutoMap<GT_Recipe> aRemovedRecipes = new AutoMap<GT_Recipe>();
+
+ //Find recipes containing Plasma and map them
+ for (GT_Recipe y : GTPP_Recipe.GTPP_Recipe_Map.sAdvFreezerRecipes_GT.mRecipeList) {
+ if (y.mFluidInputs.length > 0) {
+ for (FluidStack r : y.mFluidInputs) {
+ if (r.getUnlocalizedName().toLowerCase().contains("plasma")) {
+ aRemovedRecipes.put(y);
+ continue;
+ }
+ }
+ aFreezerMapRebaked.put(y);
+ }
+ }
+
+ AutoMap<GTPP_Recipe> aNewRecipes = new AutoMap<GTPP_Recipe>();
+ int aAtomicMass = 0;
+ int aAtomicTier = 0;
+
+ final FluidStack NULL_PLASMA = Materials._NULL.getPlasma(1);
+
+ for (String s : ELEMENT.NAMES) {
+
+ aAtomicMass++;
+ aAtomicTier = (aAtomicMass/30)+1;
+ FluidStack aMoltenFluid = null;
+ FluidStack aPlasma = null;
+
+ //Try Get Material via Gregtech
+ Materials aGregMaterial = MaterialUtils.getMaterial(s);
+ if (aGregMaterial != null) {
+ aMoltenFluid = aGregMaterial.getMolten(1);
+ if (aMoltenFluid == null) {
+ aMoltenFluid = aGregMaterial.getFluid(1);
+ if (aMoltenFluid == null) {
+ aMoltenFluid = aGregMaterial.getGas(1);
+ if (aMoltenFluid == null) {
+ aMoltenFluid = aGregMaterial.getSolid(1);
+ }
+ }
+ }
+ aPlasma = aGregMaterial.getPlasma(100);
+ }
+
+ //Just wildcard values
+ if (aMoltenFluid == null || aPlasma == null) {
+ if (aMoltenFluid == null) {
+ aMoltenFluid = FluidUtils.getWildcardFluidStack(s, 1);
+ }
+ if (aPlasma == null) {
+ aPlasma = FluidUtils.getFluidStack("plasma."+s.toLowerCase(), 1);
+ }
+ }
+
+ //Skip this material
+ if (aMoltenFluid == null || aPlasma == null || aPlasma.isFluidEqual(NULL_PLASMA)) {
+ Logger.INFO("Could not generate Advanced Vacuum Freezer recipe. Cooling "+s+" plasma. Molten Form Exists? "+(aMoltenFluid != null)+" | Plasma Exists? "+(aPlasma != null));
+ continue;
+ }
+ else {
+ //Build a new plasma recipe
+ int aTotalTickTime = (20 * 1 + (aAtomicMass));
+ GTPP_Recipe aTempRecipe = new GTPP_Recipe(true,
+ new ItemStack[] {},
+ new ItemStack[] {},
+ null,
+ new int[] {10000},
+ new FluidStack[] {
+ aPlasma,
+ FluidUtils.getFluidStack("cryotheum", aTotalTickTime)
+ },
+ new FluidStack[] {
+ aMoltenFluid
+ },
+ aTotalTickTime,
+ (int) GT_Values.V[4+aAtomicTier],
+ aAtomicMass);
+
+ //Add it to the map if it's valid
+ if (aTempRecipe != null) {
+ aNewRecipes.put(aTempRecipe);
+ }
+ }
+
+ }
+
+
+ //Add the new recipes to the map we will rebake over the original
+ for (GTPP_Recipe w : aNewRecipes) {
+ aFreezerMapRebaked.put(w);
+ }
+
+ //Best not touch the original map if we don't have a valid map to override it with.
+ if (aFreezerMapRebaked.size() > 0) {
+
+ int aOriginalCount = GTPP_Recipe.GTPP_Recipe_Map.sAdvFreezerRecipes_GT.mRecipeList.size();
+
+ //Empty the original map
+ GTPP_Recipe.GTPP_Recipe_Map.sAdvFreezerRecipes_GT.mRecipeList.clear();
+
+ //Rebake the real map
+ for (GT_Recipe w : aFreezerMapRebaked) {
+ GTPP_Recipe.GTPP_Recipe_Map.sAdvFreezerRecipes_GT.mRecipeList.add(w);
+ }
+
+ return GTPP_Recipe.GTPP_Recipe_Map.sAdvFreezerRecipes_GT.mRecipeList.size() >= aOriginalCount;
+ }
+
+ return false;
+ }
+
+ public static TileEntity constructCustomGregtechMetaTileEntityByMeta(int aMeta) {
+ if (aMeta == 12) {
+ return Meta_GT_Proxy.constructBaseMetaTileEntityCustomPower();
+ }
+ else {
+ return Meta_GT_Proxy.constructBaseMetaTileEntity();
+ }
+ }
+
+ public static BaseCustomTileEntity constructBaseMetaTileEntity() {
+ if (sBaseMetaTileEntityClass == null) {
+ try {
+ sBaseMetaTileEntityClass = BaseCustomTileEntity.class;
+ return (BaseCustomTileEntity) BaseCustomTileEntity.class.newInstance();
+ } catch (Throwable arg1) {
+ try {
+ Constructor<?> g = BaseCustomTileEntity.class.getConstructors()[0];
+ g.setAccessible(true);
+ return (BaseCustomTileEntity) g.newInstance();
+ } catch (InstantiationException | IllegalAccessException | IllegalArgumentException
+ | InvocationTargetException | SecurityException e) {
+ }
+ }
+ }
+ try {
+ return (BaseCustomTileEntity) ((BaseCustomTileEntity) sBaseMetaTileEntityClass.newInstance());
+ } catch (Throwable arg0) {
+ arg0.printStackTrace(GT_Log.err);
+ try {
+ Constructor<?> g = BaseCustomTileEntity.class.getConstructors()[0];
+ g.setAccessible(true);
+ return (BaseCustomTileEntity) g.newInstance();
+ } catch (InstantiationException | IllegalAccessException | IllegalArgumentException
+ | InvocationTargetException | SecurityException e) {
+ GT_Log.err
+ .println("GT++ Mod: Fatal Error ocurred while initializing TileEntities, crashing Minecraft.");
+ e.printStackTrace(GT_Log.err);
+ throw new RuntimeException(e);
+ }
+ }
+ }
+
+ public static BaseCustomPower_MTE constructBaseMetaTileEntityCustomPower() {
+ if (sBaseMetaTileEntityClass2 == null) {
+ try {
+ sBaseMetaTileEntityClass2 = BaseCustomPower_MTE.class;
+ return (BaseCustomPower_MTE) BaseCustomPower_MTE.class.newInstance();
+ } catch (Throwable arg1) {
+ try {
+ Constructor<?> g = BaseCustomPower_MTE.class.getConstructors()[0];
+ g.setAccessible(true);
+ return (BaseCustomPower_MTE) g.newInstance();
+ } catch (InstantiationException | IllegalAccessException | IllegalArgumentException
+ | InvocationTargetException | SecurityException e) {
+ // e.printStackTrace();
+ }
+ }
+ }
+
+ try {
+ return (BaseCustomPower_MTE) ((BaseCustomPower_MTE) sBaseMetaTileEntityClass2.newInstance());
+ } catch (Throwable arg0) {
+ arg0.printStackTrace(GT_Log.err);
+ try {
+ Constructor<?> g = BaseCustomPower_MTE.class.getConstructors()[0];
+ g.setAccessible(true);
+ return (BaseCustomPower_MTE) g.newInstance();
+ } catch (InstantiationException | IllegalAccessException | IllegalArgumentException
+ | InvocationTargetException | SecurityException e) {
+ GT_Log.err
+ .println("GT++ Mod: Fatal Error ocurred while initializing TileEntities, crashing Minecraft.");
+ e.printStackTrace(GT_Log.err);
+ throw new RuntimeException(e);
+ }
+ }
+ }
+
+
+
+
+
+ public static boolean setTileEntityClassAsBlacklistedInWorldAccelerator(String aClassName) {
+ if (CORE.GTNH) {
+ Class aMainModClass = ReflectionUtils.getClass("com.dreammaster.main.MainRegistry");
+ Class aCoreModConfig = ReflectionUtils.getClass("com.dreammaster.config");
+ if (aMainModClass != null && aCoreModConfig != null) {
+ Field aCoreConfig = ReflectionUtils.getField(aMainModClass, "CoreConfig");
+ if (aCoreConfig != null) {
+ Field aBlackList = ReflectionUtils.getField(aCoreModConfig, "BlacklistedTileEntiyClassNames");
+ Object aInstance = ReflectionUtils.getFieldValue(aCoreConfig);
+ if (aBlackList != null && aInstance != null) {
+ String[] aBlackListValue = (String[]) ReflectionUtils.getFieldValue(aBlackList, aInstance);
+ if (aBlackListValue != null) {
+ aBlackListValue = ArrayUtils.add(aBlackListValue, aClassName);
+ ReflectionUtils.setField(aInstance, aBlackList, aBlackListValue);
+ return true;
+ }
+ }
+ }
+ }
+ }
+ else {
+ GT_MetaTileEntity_WorldAccelerator.BlacklistedTileEntiyClassNames = ArrayUtils.add(GT_MetaTileEntity_WorldAccelerator.BlacklistedTileEntiyClassNames, aClassName);
+ return true;
+ }
+ return false;
+ }
+
+
+
+ public static void setValidHeatingCoilMetas() {
+ for (int i = 0; i <= 6; i++ ) {
+ GT_ValidHeatingCoilMetas.put(i);
+ }
+ if (CORE.GTNH) {
+ for (int i = 7; i <= 8; i++ ) {
+ GT_ValidHeatingCoilMetas.put(i);
+ }
+ }
+ }
+
+ public static boolean areWeUsingGregtech5uExperimental(){
+ final int version = GregTech_API.VERSION;
+ if ((version == 508) || (version == 507)){
+ return false;
+ }
+ else if (version == 509){
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+
+ static GT_Proxy[] mProxies = new GT_Proxy[2];
+
+ /**
+ * @deprecated Use {@link StaticFields59#getFieldFromGregtechProxy(boolean,String)} instead
+ */
+ public static Object getFieldFromGregtechProxy(boolean client, String fieldName) {
+ return StaticFields59.getFieldFromGregtechProxy(client, fieldName);
+ }
+
+ public static void setCustomGregtechTooltip(String aNbtTagName, FormattedTooltipString aData) {
+ mCustomGregtechMetaTooltips.put(aNbtTagName, aData);
+ }
+
+ public static void conStructGtTileBlockTooltip(ItemStack aStack, EntityPlayer aPlayer, List<Object> aList, boolean par4) {
+ try {
+ int tDamage = aStack.getItemDamage();
+ if ((tDamage <= 0) || (tDamage >= GregTech_API.METATILEENTITIES.length)) {
+ return;
+ }
+
+ if (GregTech_API.METATILEENTITIES[tDamage] != null) {
+ IGregTechTileEntity tTileEntity = GregTech_API.METATILEENTITIES[tDamage].getBaseMetaTileEntity();
+ if (tTileEntity.getDescription() != null) {
+ int i = 0;
+ for (String tDescription : tTileEntity.getDescription()) {
+ if (GT_Utility.isStringValid(tDescription)) {
+ if(tDescription.contains("%%%")){
+ String[] tString = tDescription.split("%%%");
+ if(tString.length>=2){
+ StringBuffer tBuffer = new StringBuffer();
+ Object tRep[] = new String[tString.length / 2];
+ for (int j = 0; j < tString.length; j++)
+ if (j % 2 == 0) tBuffer.append(tString[j]);
+ else {tBuffer.append(" %s"); tRep[j / 2] = tString[j];}
+ aList.add(String.format(GT_LanguageManager.addStringLocalization("TileEntity_DESCRIPTION_" + tDamage + "_Index_" + i++, tBuffer.toString(), !GregTech_API.sPostloadFinished), tRep));
+ }
+ }else{String tTranslated = GT_LanguageManager.addStringLocalization("TileEntity_DESCRIPTION_" + tDamage + "_Index_" + i++, tDescription, !GregTech_API.sPostloadFinished );
+ aList.add(tTranslated.equals("") ? tDescription : tTranslated);}
+ }else i++;
+ }
+ }
+
+
+
+ if (tTileEntity.getEUCapacity() > 0L) {
+
+ final long tVoltage = tTileEntity.getInputVoltage();
+ byte tTier = (byte) ((byte) Math.max(1, GT_Utility.getTier(tVoltage)));
+
+ //Custom handling
+ if (tDamage < 30500 && tDamage >= 30400) {
+ int aOffset = tDamage - 30400;
+ if ((aOffset) <= 10) {
+ tTier -= 2;
+ aList.add(EnumChatFormatting.BOLD+"16"+" Fuse Slots"+EnumChatFormatting.GRAY);
+ aList.add("Per each fuse, you may insert "+EnumChatFormatting.YELLOW+(GT_Values.V[tTier])+EnumChatFormatting.GRAY+" EU/t");
+ aList.add("However this "+EnumChatFormatting.ITALIC+EnumChatFormatting.RED+"MUST"+EnumChatFormatting.GRAY+" be in a single Amp");
+ aList.add("This machine can accept upto a single amp of "+GT_Values.VN[Math.min(tTier+2, 12)]+" as a result");
+ aList.add(GT_LanguageManager.addStringLocalization("TileEntity_Breaker_Loss", "Breaker Loss: "+EnumChatFormatting.RED+""+(GT_Values.V[Math.max(tTier-1, 0)]/10)+EnumChatFormatting.GRAY+" EU/t", !GregTech_API.sPostloadFinished) + EnumChatFormatting.GRAY);
+ }
+
+
+ aList.add(GT_LanguageManager.addStringLocalization("TileEntity_Special_Power_1", EnumChatFormatting.RED+"Special Power Handling, please read manual", !GregTech_API.sPostloadFinished) + EnumChatFormatting.GRAY);
+ //aList.add(GT_LanguageManager.addStringLocalization("TileEntity_BreakerBox_2", EnumChatFormatting.RED+"Special Power Handling, please read manual", !GregTech_API.sPostloadFinished) + EnumChatFormatting.GRAY);
+ //aList.add(GT_LanguageManager.addStringLocalization("TileEntity_BreakerBox_3", EnumChatFormatting.RED+"Special Power Handling, please read manual", !GregTech_API.sPostloadFinished) + EnumChatFormatting.GRAY);
+ }
+
+
+ if (tTileEntity.getInputVoltage() > 0L) {
+ String inA = "0";
+ if (tTileEntity.getInputAmperage() >= 1L) {
+ inA = " at " + EnumChatFormatting.YELLOW + tTileEntity.getInputAmperage() + EnumChatFormatting.GRAY +" Amps";
+ }
+ else {
+ inA = " at " + EnumChatFormatting.WHITE + tTileEntity.getInputAmperage() + EnumChatFormatting.GRAY +" Amps";
+ }
+ String a1 = "Voltage IN: "+EnumChatFormatting.GREEN + tTileEntity.getInputVoltage()
+ + " (" + GT_Values.VN[GT_Utility.getTier(tTileEntity.getInputVoltage())] + ")"
+ + EnumChatFormatting.GRAY + inA;
+ aList.add(a1);
+ }
+
+ if (tTileEntity.getOutputVoltage() > 0L) {
+ String outA = "0";
+ if (tTileEntity.getOutputAmperage() >= 1L) {
+ outA = " at " + EnumChatFormatting.YELLOW + tTileEntity.getOutputAmperage() + EnumChatFormatting.GRAY +" Amps";
+ }
+ else {
+ outA = " at " + EnumChatFormatting.WHITE + tTileEntity.getOutputAmperage() + EnumChatFormatting.GRAY +" Amps";
+ }
+ String a1 = "Voltage OUT: "+EnumChatFormatting.GREEN + tTileEntity.getOutputVoltage()
+ + " (" + GT_Values.VN[GT_Utility.getTier(tTileEntity.getOutputVoltage())] + ")"
+ + EnumChatFormatting.GRAY + outA;
+ aList.add(a1);
+ }
+
+
+ if (tTileEntity.getOutputVoltage() > 0L) {
+ aList.add(GT_LanguageManager.addStringLocalization("TileEntity_Lossess_EU", "Transmission Loss: "+EnumChatFormatting.DARK_BLUE+""+(tDamage < 30500 && tDamage >= 30400 ? 0 : 1), !GregTech_API.sPostloadFinished) + EnumChatFormatting.GRAY);
+ }
+
+ if (tTileEntity.getEUCapacity() > 0) {
+ aList.add(GT_LanguageManager.addStringLocalization("TileEntity_EUp_STORE2",
+ "Internal Capacity: ", !GregTech_API.sPostloadFinished) + EnumChatFormatting.BLUE
+ + tTileEntity.getEUCapacity() + EnumChatFormatting.GRAY + " EU");
+ }
+ }
+
+ /*if (tTileEntity.getEUCapacity() > 0L) {
+ if (tTileEntity.getInputVoltage() > 0L) {
+ aList.add(GT_LanguageManager.addStringLocalization("TileEntity_EUp_IN", "Voltage IN: ", !GregTech_API.sPostloadFinished ) + EnumChatFormatting.GREEN + tTileEntity.getInputVoltage() + " (" + GT_Values.VN[GT_Utility.getTier(tTileEntity.getInputVoltage())] + ")" + EnumChatFormatting.GRAY);
+ }
+ if (tTileEntity.getOutputVoltage() > 0L) {
+ aList.add(GT_LanguageManager.addStringLocalization("TileEntity_EUp_OUT", "Voltage OUT: ", !GregTech_API.sPostloadFinished ) + EnumChatFormatting.GREEN + tTileEntity.getOutputVoltage() + " (" + GT_Values.VN[GT_Utility.getTier(tTileEntity.getOutputVoltage())] + ")" + EnumChatFormatting.GRAY);
+ }
+ if (tTileEntity.getOutputAmperage() > 1L) {
+ aList.add(GT_LanguageManager.addStringLocalization("TileEntity_EUp_AMOUNT", "Amperage: ", !GregTech_API.sPostloadFinished ) + EnumChatFormatting.YELLOW + tTileEntity.getOutputAmperage() + EnumChatFormatting.GRAY);
+ }
+ aList.add(GT_LanguageManager.addStringLocalization("TileEntity_EUp_STORE", "Capacity: ", !GregTech_API.sPostloadFinished ) + EnumChatFormatting.BLUE + tTileEntity.getEUCapacity() + EnumChatFormatting.GRAY);
+ }*/
+
+ }
+ NBTTagCompound aNBT = aStack.getTagCompound();
+ if (aNBT != null) {
+ if (aNBT.getBoolean("mMuffler")) {
+ aList.add(GT_LanguageManager.addStringLocalization("GT_TileEntity_MUFFLER", "has Muffler Upgrade", !GregTech_API.sPostloadFinished ));
+ }
+ if (aNBT.getBoolean("mSteamConverter")) {
+ aList.add(GT_LanguageManager.addStringLocalization("GT_TileEntity_STEAMCONVERTER", "has Steam Upgrade", !GregTech_API.sPostloadFinished ));
+ }
+ int tAmount = 0;
+ if ((tAmount = aNBT.getByte("mSteamTanks")) > 0) {
+ aList.add(tAmount + " " + GT_LanguageManager.addStringLocalization("GT_TileEntity_STEAMTANKS", "Steam Tank Upgrades", !GregTech_API.sPostloadFinished ));
+ }
+
+ FluidStack afluid = net.minecraftforge.fluids.FluidStack.loadFluidStackFromNBT(aNBT.getCompoundTag("mFluid"));
+ if (afluid != null) {
+ int tFluidAmount = afluid.amount;
+ if (tFluidAmount > 0) {
+ aList.add(GT_LanguageManager.addStringLocalization("GT_TileEntity_FLUIDTANK", "Tank Fluid: "+tFluidAmount+"L "+afluid.getLocalizedName()+"", !GregTech_API.sPostloadFinished ));
+ }
+ }
+
+ }
+
+ //Add Custom Here
+
+ //Add Custom Tooltips
+ for (String s : mCustomGregtechMetaTooltips.keySet()) {
+ if (aNBT.hasKey(s)) {
+ String aTip = mCustomGregtechMetaTooltips.get(s).getTooltip(aNBT.getString(s));
+ aList.add(aTip);
+ }
+ }
+
+ //Add GT++ Stuff
+
+ if (tDamage >= 30400 && tDamage < 30500) {
+ aList.add(EnumChatFormatting.UNDERLINE+"Special GT++ Machine");
+ }
+ if ((tDamage >= 750 && tDamage < 1000) || (tDamage >= 30000 && tDamage < 31000)) {
+ aList.add(CORE.GT_Tooltip);
+ }
+
+
+ } catch (Throwable e) {
+ e.printStackTrace(GT_Log.err);
+ }
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/StaticFields59.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/StaticFields59.java
new file mode 100644
index 0000000000..44c580fe4f
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/StaticFields59.java
@@ -0,0 +1,303 @@
+package gtPlusPlus.xmod.gregtech.common;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import gregtech.GT_Mod;
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.Materials;
+import gregtech.api.enums.OrePrefixes;
+import gregtech.api.enums.Textures.BlockIcons;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_TieredMachineBlock;
+import gregtech.api.util.GT_ModHandler;
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
+import gregtech.common.GT_Proxy;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.reflect.ProxyFinder;
+import gtPlusPlus.core.util.reflect.ReflectionUtils;
+import net.minecraft.block.Block;
+import net.minecraft.item.ItemStack;
+
+public class StaticFields59 {
+
+
+ public static boolean mGT6StylePipes;
+
+ public static final Field mGtBlockCasings5;
+ public static final Field mPreventableComponents;
+ public static final Field mDisabledItems;
+ public static final Field mMultiblockChemicalRecipes;
+ public static final Field mPyrolyseRecipes;
+ public static final Field mDescriptionArray;
+ public static final Field mCasingTexturePages;
+ public static final Field mAssLineVisualMapNEI;
+ public static final GT_Recipe_Map sAssemblylineVisualRecipes;
+
+ public static final Method mCalculatePollutionReduction;
+ public static final Method mAddFurnaceRecipe;
+
+ private static final Map<String, Materials> mMaterialCache = new LinkedHashMap<String, Materials>();
+
+
+ //OrePrefixes
+
+ static {
+ Logger.INFO("[SH] Creating Static Helper for various fields which require reflective access.");
+
+ mGtBlockCasings5 = getField(GregTech_API.class, "sBlockCasings5");
+ Logger.INFO("[SH] Got Field: sBlockCasings5");
+ mPreventableComponents = getField(OrePrefixes.class, "mPreventableComponents");
+ Logger.INFO("[SH] Got Field: mPreventableComponents");
+ mDisabledItems = getField(OrePrefixes.class, "mDisabledItems");
+ Logger.INFO("[SH] Got Field: mDisabledItems");
+ mDescriptionArray = getField(GT_MetaTileEntity_TieredMachineBlock.class, "mDescriptionArray");
+ Logger.INFO("[SH] Got Field: mDescriptionArray");
+ mCasingTexturePages = getField(BlockIcons.class, "casingTexturePages");
+ Logger.INFO("[SH] Got Field: casingTexturePages");
+
+ mAssLineVisualMapNEI = getField(GT_Recipe_Map.class, "sAssemblylineVisualRecipes");
+ Logger.INFO("[SH] Got Field: mAssLineVisualMapNEI");
+ GT_Recipe_Map aTemp;
+ if (mAssLineVisualMapNEI != null) {
+ try {
+ aTemp = (GT_Recipe_Map) mAssLineVisualMapNEI.get(null);
+ Logger.INFO("[SH] Got Field: sAssemblylineVisualRecipes");
+ } catch (IllegalArgumentException | IllegalAccessException e) {
+ aTemp = null;
+ }
+ } else {
+ aTemp = null;
+ }
+
+ sAssemblylineVisualRecipes = aTemp;
+
+ mMultiblockChemicalRecipes = getField(GT_Recipe_Map.class, "sMultiblockChemicalRecipes");
+ Logger.INFO("[SH] Got Field: sMultiblockChemicalRecipes");
+ if (ReflectionUtils.doesFieldExist(GT_Recipe.GT_Recipe_Map.class, "sPyrolyseRecipes")) {
+ mPyrolyseRecipes = getField(GT_Recipe_Map.class, "sPyrolyseRecipes");
+ Logger.INFO("[SH] Got Field: sPyrolyseRecipes");
+ }
+ else {
+ mPyrolyseRecipes = null;
+ }
+
+ mCalculatePollutionReduction = getMethod(GT_MetaTileEntity_Hatch_Muffler.class, "calculatePollutionReduction",
+ int.class);
+ Logger.INFO("[SH] Got Method: calculatePollutionReduction");
+
+ // Yep...
+ if (!CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK) {
+ mAddFurnaceRecipe = getMethod(GT_ModHandler.class, "addSmeltingAndAlloySmeltingRecipe", ItemStack.class,
+ ItemStack.class);
+ Logger.INFO("[SH] Got Method: addSmeltingAndAlloySmeltingRecipe");
+ } else {
+ mAddFurnaceRecipe = getMethod(GT_ModHandler.class, "addSmeltingAndAlloySmeltingRecipe", ItemStack.class,
+ ItemStack.class, boolean.class);
+ Logger.INFO("[SH] Got Method: addSmeltingAndAlloySmeltingRecipe");
+ }
+
+ }
+
+ public static synchronized final Block getBlockCasings5() {
+ try {
+ return (Block) mGtBlockCasings5.get(GregTech_API.class);
+ } catch (IllegalArgumentException | IllegalAccessException e) {
+ return null;
+ }
+ }
+
+ public static int calculatePollutionReducation(GT_MetaTileEntity_Hatch_Muffler h, int i) {
+ try {
+ return (int) mCalculatePollutionReduction.invoke(h, i);
+ } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
+ return 0;
+ }
+ }
+
+ public static Field getField(Class a, String b) {
+ return ReflectionUtils.getField(a, b);
+ }
+
+ public static Method getMethod(Class a, String b, Class... params) {
+ return ReflectionUtils.getMethod(a, b, params);
+ }
+
+ public static synchronized final Collection<Materials> getOrePrefixesBooleanDisabledItems() {
+ try {
+ return (Collection<Materials>) mDisabledItems.get(OrePrefixes.class);
+ } catch (IllegalArgumentException | IllegalAccessException e) {
+ return new ArrayList<Materials>();
+ }
+ }
+
+
+ public static synchronized final List<OrePrefixes> geOrePrefixesBooleanPreventableComponents() {
+ try {
+ return (List<OrePrefixes>) mPreventableComponents.get(OrePrefixes.class);
+ } catch (IllegalArgumentException | IllegalAccessException e) {
+ return new ArrayList<OrePrefixes>();
+ }
+ }
+
+ public static synchronized final GT_Recipe_Map getLargeChemicalReactorRecipeMap() {
+ try {
+ return (GT_Recipe_Map) mMultiblockChemicalRecipes.get(null);
+ } catch (IllegalArgumentException | IllegalAccessException e) {
+ return null;
+ }
+ }
+
+ public static synchronized final GT_Recipe_Map getPyrolyseRecipeMap() {
+ try {
+ return mPyrolyseRecipes != null ? (GT_Recipe_Map) mPyrolyseRecipes.get(null) : null;
+ } catch (IllegalArgumentException | IllegalAccessException e) {
+ return null;
+ }
+ }
+
+ public static Materials getMaterial(String aMaterialName) {
+ Materials m = mMaterialCache.get(aMaterialName);
+ if (m != null) {
+ return m;
+ }
+ else {
+ m = Materials.get(aMaterialName);
+ if (m != null) {
+ mMaterialCache.put(aMaterialName, m);
+ return m;
+ }
+ return null;
+ }
+ }
+
+ public static String[] getDescriptionArray(GT_MetaTileEntity_TieredMachineBlock aTile) {
+ try {
+ return (String[]) mDescriptionArray.get(aTile);
+ } catch (IllegalArgumentException | IllegalAccessException e) {
+ return new String[] {aTile.mDescription};
+ }
+ }
+
+ public static ITexture getCasingTexturePages(int a, int b) {
+ try {
+ ITexture[][] g = (ITexture[][]) mCasingTexturePages.get(null);
+ if (g != null) {
+ return g[a][b];
+ }
+ }
+ catch (Throwable t) {
+
+ }
+ return null;
+ }
+
+
+ public static Object getFieldFromGregtechProxy(String fieldName) {
+ return getFieldFromGregtechProxy(Utils.isServer() ? false : true, fieldName);
+ }
+
+ public static Object getFieldFromGregtechProxy(boolean client, String fieldName) {
+ Object proxyGT;
+
+ if (Meta_GT_Proxy.mProxies[0] != null && client) {
+ proxyGT = Meta_GT_Proxy.mProxies[0];
+ } else if (Meta_GT_Proxy.mProxies[1] != null && !client) {
+ proxyGT = Meta_GT_Proxy.mProxies[1];
+ } else {
+ try {
+ proxyGT = (client ? ProxyFinder.getClientProxy(GT_Mod.instance)
+ : ProxyFinder.getServerProxy(GT_Mod.instance));
+ } catch (final ReflectiveOperationException e1) {
+ proxyGT = null;
+ Logger.INFO("Failed to obtain instance of GT " + (client ? "Client" : "Server") + " proxy.");
+ }
+ if (Meta_GT_Proxy.mProxies[0] == null && client) {
+ Meta_GT_Proxy.mProxies[0] = (GT_Proxy) proxyGT;
+ } else if (Meta_GT_Proxy.mProxies[1] == null && !client) {
+ Meta_GT_Proxy.mProxies[1] = (GT_Proxy) proxyGT;
+ }
+ }
+
+ if (proxyGT != null && proxyGT instanceof GT_Proxy) {
+ try {
+ return ReflectionUtils.getField(proxyGT.getClass(), fieldName).get(proxyGT);
+ } catch (IllegalArgumentException | IllegalAccessException e) {
+ }
+ }
+ return null;
+ }
+
+
+
+ public static int getTierForCoil(Block aBlock, int aMeta) {
+ if (aBlock == GregTech_API.sBlockCasings1 && (aMeta >= 12 && aMeta <= 14)) {
+ return aMeta == 12 ? 1 : aMeta == 13 ? 2 : 3;
+ }
+ else if (aBlock == getBlockCasings5() && (aMeta >= 0 && aMeta <= 10)) {
+ return aMeta;
+ }
+ return 0;
+ }
+
+ public static int getHeatingCapacityForCoil(Block aBlock, int aMeta) {
+ int aTier = getTierForCoil(aBlock, aMeta);
+ return aTier > 0 ? getHeatingCapacityForCoilTier(aTier) : 0;
+ }
+
+ public static int getHeatingCapacityForCoilTier(int aCoilTier) {
+ int mHeatingCapacity = 0;
+ switch (aCoilTier) {
+ case 0:
+ mHeatingCapacity = 1800;
+ break;
+ case 1:
+ mHeatingCapacity = 2700;
+ break;
+ case 2:
+ mHeatingCapacity = 3600;
+ break;
+ case 3:
+ mHeatingCapacity = 4500;
+ break;
+ case 4:
+ mHeatingCapacity = 5400;
+ break;
+ case 5:
+ mHeatingCapacity = 7200;
+ break;
+ case 6:
+ mHeatingCapacity = 9000;
+ break;
+ case 7:
+ mHeatingCapacity = 9900;
+ break;
+ case 8:
+ mHeatingCapacity = 10800;
+ break;
+ case 9:
+ mHeatingCapacity = 6300;
+ break;
+ case 10:
+ mHeatingCapacity = 9000;
+ break;
+ default:
+ Logger.INFO("Heating Coils are bad.");
+ mHeatingCapacity = 0;
+ }
+ if (CORE.GTNH && aCoilTier <= 10) {
+ mHeatingCapacity += 1;
+ }
+ return mHeatingCapacity;
+ }
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GTPP_Block_Machines.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GTPP_Block_Machines.java
new file mode 100644
index 0000000000..01f655c355
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GTPP_Block_Machines.java
@@ -0,0 +1,534 @@
+package gtPlusPlus.xmod.gregtech.common.blocks;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.Textures.BlockIcons;
+import gregtech.api.interfaces.IDebugableBlock;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.ICoverable;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.items.GT_Generic_Block;
+import gregtech.api.metatileentity.BaseMetaPipeEntity;
+import gregtech.api.metatileentity.BaseMetaTileEntity;
+import gregtech.api.metatileentity.BaseTileEntity;
+import gregtech.api.util.GT_Log;
+import gregtech.api.util.GT_Utility;
+import gregtech.common.blocks.GT_Item_Machines;
+import gregtech.common.blocks.GT_Material_Machines;
+import gregtech.common.render.GT_Renderer_Block;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.api.objects.random.XSTR;
+import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy;
+import gtPlusPlus.xmod.gregtech.common.render.GTPP_Render_MachineBlock;
+import net.minecraft.block.Block;
+import net.minecraft.block.ITileEntityProvider;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.EnumCreatureType;
+import net.minecraft.entity.item.EntityItem;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.AxisAlignedBB;
+import net.minecraft.util.IIcon;
+import net.minecraft.util.MathHelper;
+import net.minecraft.util.StatCollector;
+import net.minecraft.world.Explosion;
+import net.minecraft.world.IBlockAccess;
+import net.minecraft.world.World;
+import net.minecraftforge.common.util.ForgeDirection;
+
+public class GTPP_Block_Machines extends GT_Generic_Block implements IDebugableBlock, ITileEntityProvider {
+ public static ThreadLocal<IGregTechTileEntity> mTemporaryTileEntity = new ThreadLocal<IGregTechTileEntity>();
+
+ public GTPP_Block_Machines() {
+ super(GTPP_Item_Machines.class, "gtpp.blockmachines", new GT_Material_Machines());
+ GregTech_API.registerMachineBlock(this, -1);
+ this.setHardness(1.0F);
+ this.setResistance(10.0F);
+ this.setStepSound(soundTypeMetal);
+ this.setCreativeTab(GregTech_API.TAB_GREGTECH);
+ this.isBlockContainer = true;
+ }
+
+ public String getHarvestTool(int aMeta) {
+ switch (aMeta / 4) {
+ case 0 :
+ return "wrench";
+ case 1 :
+ return "wrench";
+ case 2 :
+ return "cutter";
+ case 3 :
+ return "axe";
+ default :
+ return "wrench";
+ }
+ }
+
+ public int getHarvestLevel(int aMeta) {
+ return aMeta % 4;
+ }
+
+ protected boolean canSilkHarvest() {
+ return false;
+ }
+
+ public void onNeighborChange(IBlockAccess aWorld, int aX, int aY, int aZ, int aTileX, int aTileY, int aTileZ) {
+ TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ if (tTileEntity instanceof BaseTileEntity) {
+ ((BaseTileEntity) tTileEntity).onAdjacentBlockChange(aTileX, aTileY, aTileZ);
+ }
+
+ }
+
+ public void onBlockAdded(World aWorld, int aX, int aY, int aZ) {
+ super.onBlockAdded(aWorld, aX, aY, aZ);
+ if (GregTech_API.isMachineBlock(this, aWorld.getBlockMetadata(aX, aY, aZ))) {
+ GregTech_API.causeMachineUpdate(aWorld, aX, aY, aZ);
+ }
+
+ }
+
+ public String getUnlocalizedName() {
+ int tDamage = 0;
+ String aUnlocalName = (tDamage >= 0 && tDamage < GregTech_API.METATILEENTITIES.length)
+ ? (GregTech_API.METATILEENTITIES[tDamage] != null
+ ? ("gtpp.blockmachines.name" + "." + GregTech_API.METATILEENTITIES[tDamage].getMetaName())
+ : ("gtpp.blockmachines.name")) : "";
+
+ Logger.INFO("Unlocal Name: "+aUnlocalName);
+ return aUnlocalName;
+ }
+
+ public String getLocalizedName() {
+ String aName = StatCollector.translateToLocal(this.getUnlocalizedName() + ".name");;
+ if (aName.toLowerCase().contains(".name")) {
+ aName = StatCollector.translateToLocal(getUnlocalizedName() + ".name");
+ }
+ if (aName.toLowerCase().contains(".name")) {
+ aName = StatCollector.translateToLocal("gt.blockmachines" + ".name");
+ }
+ if (aName.toLowerCase().contains(".name")) {
+ aName = "BAD";
+ }
+ Logger.INFO("Name: "+aName);
+ return aName;
+ }
+
+ public int getFlammability(IBlockAccess aWorld, int aX, int aY, int aZ, ForgeDirection face) {
+ return 0;
+ }
+
+ public int getFireSpreadSpeed(IBlockAccess aWorld, int aX, int aY, int aZ, ForgeDirection face) {
+ return GregTech_API.sMachineFlammable && aWorld.getBlockMetadata(aX, aY, aZ) == 0 ? 100 : 0;
+ }
+
+ public int getRenderType() {
+ return GTPP_Render_MachineBlock.INSTANCE == null ? super.getRenderType() : GTPP_Render_MachineBlock.INSTANCE.mRenderID;
+ }
+
+ public boolean isFireSource(World aWorld, int aX, int aY, int aZ, ForgeDirection side) {
+ return GregTech_API.sMachineFlammable && aWorld.getBlockMetadata(aX, aY, aZ) == 0;
+ }
+
+ public boolean isFlammable(IBlockAccess aWorld, int aX, int aY, int aZ, ForgeDirection face) {
+ return GregTech_API.sMachineFlammable && aWorld.getBlockMetadata(aX, aY, aZ) == 0;
+ }
+
+ public boolean canCreatureSpawn(EnumCreatureType type, IBlockAccess aWorld, int aX, int aY, int aZ) {
+ return false;
+ }
+
+ public boolean canConnectRedstone(IBlockAccess var1, int var2, int var3, int var4, int var5) {
+ return true;
+ }
+
+ public boolean canBeReplacedByLeaves(IBlockAccess aWorld, int aX, int aY, int aZ) {
+ return false;
+ }
+
+ public boolean isNormalCube(IBlockAccess aWorld, int aX, int aY, int aZ) {
+ return false;
+ }
+
+ public boolean hasTileEntity(int aMeta) {
+ return true;
+ }
+
+ public boolean hasComparatorInputOverride() {
+ return true;
+ }
+
+ public boolean renderAsNormalBlock() {
+ return false;
+ }
+
+ public boolean canProvidePower() {
+ return true;
+ }
+
+ public boolean isOpaqueCube() {
+ return false;
+ }
+
+ public TileEntity createNewTileEntity(World aWorld, int aMeta) {
+ return this.createTileEntity(aWorld, aMeta);
+ }
+
+ public IIcon getIcon(IBlockAccess aIBlockAccess, int aX, int aY, int aZ, int aSide) {
+ return BlockIcons.MACHINE_LV_SIDE.getIcon();
+ }
+
+ public IIcon getIcon(int aSide, int aMeta) {
+ return BlockIcons.MACHINE_LV_SIDE.getIcon();
+ }
+
+ public boolean onBlockEventReceived(World aWorld, int aX, int aY, int aZ, int aData1, int aData2) {
+ super.onBlockEventReceived(aWorld, aX, aY, aZ, aData1, aData2);
+ TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ return tTileEntity != null ? tTileEntity.receiveClientEvent(aData1, aData2) : false;
+ }
+
+ public void addCollisionBoxesToList(World aWorld, int aX, int aY, int aZ, AxisAlignedBB inputAABB, List outputAABB,
+ Entity collider) {
+ TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ if (tTileEntity instanceof IGregTechTileEntity
+ && ((IGregTechTileEntity) tTileEntity).getMetaTileEntity() != null) {
+ ((IGregTechTileEntity) tTileEntity).addCollisionBoxesToList(aWorld, aX, aY, aZ, inputAABB, outputAABB,
+ collider);
+ } else {
+ super.addCollisionBoxesToList(aWorld, aX, aY, aZ, inputAABB, outputAABB, collider);
+ }
+ }
+
+ public AxisAlignedBB getCollisionBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ) {
+ TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ return tTileEntity instanceof IGregTechTileEntity
+ && ((IGregTechTileEntity) tTileEntity).getMetaTileEntity() != null
+ ? ((IGregTechTileEntity) tTileEntity).getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ)
+ : super.getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ);
+ }
+
+ @SideOnly(Side.CLIENT)
+ public AxisAlignedBB getSelectedBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ) {
+ TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ return tTileEntity instanceof IGregTechTileEntity
+ && ((IGregTechTileEntity) tTileEntity).getMetaTileEntity() != null
+ ? ((IGregTechTileEntity) tTileEntity).getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ)
+ : super.getSelectedBoundingBoxFromPool(aWorld, aX, aY, aZ);
+ }
+
+ public void setBlockBoundsBasedOnState(IBlockAccess blockAccess, int aX, int aY, int aZ) {
+ TileEntity tTileEntity = blockAccess.getTileEntity(aX, aY, aZ);
+ if (tTileEntity instanceof IGregTechTileEntity
+ && ((IGregTechTileEntity) tTileEntity).getMetaTileEntity() != null) {
+ AxisAlignedBB bbb = ((IGregTechTileEntity) tTileEntity)
+ .getCollisionBoundingBoxFromPool(((IGregTechTileEntity) tTileEntity).getWorld(), 0, 0, 0);
+ this.minX = bbb.minX;
+ this.minY = bbb.minY;
+ this.minZ = bbb.minZ;
+ this.maxX = bbb.maxX;
+ this.maxY = bbb.maxY;
+ this.maxZ = bbb.maxZ;
+ } else {
+ super.setBlockBoundsBasedOnState(blockAccess, aX, aY, aZ);
+ }
+ }
+
+ public void setBlockBoundsForItemRender() {
+ super.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
+ }
+
+ public void onEntityCollidedWithBlock(World aWorld, int aX, int aY, int aZ, Entity collider) {
+ TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ if (tTileEntity instanceof IGregTechTileEntity
+ && ((IGregTechTileEntity) tTileEntity).getMetaTileEntity() != null) {
+ ((IGregTechTileEntity) tTileEntity).onEntityCollidedWithBlock(aWorld, aX, aY, aZ, collider);
+ } else {
+ super.onEntityCollidedWithBlock(aWorld, aX, aY, aZ, collider);
+ }
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void registerBlockIcons(IIconRegister aIconRegister) {
+
+ }
+
+ public float getBlockHardness(World aWorld, int aX, int aY, int aZ) {
+ return super.getBlockHardness(aWorld, aX, aY, aZ);
+ }
+
+ public float getPlayerRelativeBlockHardness(EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ) {
+ TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ return tTileEntity instanceof BaseMetaTileEntity && ((BaseMetaTileEntity) tTileEntity).privateAccess()
+ && !((BaseMetaTileEntity) tTileEntity).playerOwnsThis(aPlayer, true)
+ ? -1.0F
+ : super.getPlayerRelativeBlockHardness(aPlayer, aWorld, aX, aY, aZ);
+ }
+
+ public boolean onBlockActivated(World aWorld, int aX, int aY, int aZ, EntityPlayer aPlayer, int aSide, float par1,
+ float par2, float par3) {
+ TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ if (tTileEntity == null) {
+ return false;
+ } else {
+ if (aPlayer.isSneaking()) {
+ ItemStack tCurrentItem = aPlayer.inventory.getCurrentItem();
+ if (tCurrentItem == null) {
+ return false;
+ }
+
+ if (!GT_Utility.isStackInList(tCurrentItem, GregTech_API.sScrewdriverList)
+ && !GT_Utility.isStackInList(tCurrentItem, GregTech_API.sWrenchList)) {
+ return false;
+ }
+ }
+
+ return tTileEntity instanceof IGregTechTileEntity
+ ? (((IGregTechTileEntity) tTileEntity).getTimer() < 50L
+ ? false
+ : (!aWorld.isRemote && !((IGregTechTileEntity) tTileEntity).isUseableByPlayer(aPlayer)
+ ? true
+ : ((IGregTechTileEntity) tTileEntity).onRightclick(aPlayer, (byte) aSide, par1,
+ par2, par3)))
+ : false;
+ }
+ }
+
+ public void onBlockClicked(World aWorld, int aX, int aY, int aZ, EntityPlayer aPlayer) {
+ TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ if (tTileEntity instanceof IGregTechTileEntity) {
+ ((IGregTechTileEntity) tTileEntity).onLeftclick(aPlayer);
+ }
+
+ }
+
+ public int getDamageValue(World aWorld, int aX, int aY, int aZ) {
+ TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ return tTileEntity instanceof IGregTechTileEntity ? ((IGregTechTileEntity) tTileEntity).getMetaTileID() : 0;
+ }
+
+ public void onBlockExploded(World aWorld, int aX, int aY, int aZ, Explosion aExplosion) {
+ TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ if (tTileEntity instanceof BaseMetaTileEntity) {
+ ((BaseMetaTileEntity) tTileEntity).doEnergyExplosion();
+ }
+
+ super.onBlockExploded(aWorld, aX, aY, aZ, aExplosion);
+ }
+
+ public void breakBlock(World aWorld, int aX, int aY, int aZ, Block par5, int par6) {
+ GregTech_API.causeMachineUpdate(aWorld, aX, aY, aZ);
+ TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ if (tTileEntity instanceof IGregTechTileEntity) {
+ IGregTechTileEntity tGregTechTileEntity = (IGregTechTileEntity) tTileEntity;
+ XSTR tRandom = new XSTR();
+ mTemporaryTileEntity.set(tGregTechTileEntity);
+
+ for (int i = 0; i < tGregTechTileEntity.getSizeInventory(); ++i) {
+ ItemStack tItem = tGregTechTileEntity.getStackInSlot(i);
+ if (tItem != null && tItem.stackSize > 0 && tGregTechTileEntity.isValidSlot(i)) {
+ EntityItem tItemEntity = new EntityItem(aWorld,
+ (double) ((float) aX + tRandom.nextFloat() * 0.8F + 0.1F),
+ (double) ((float) aY + tRandom.nextFloat() * 0.8F + 0.1F),
+ (double) ((float) aZ + tRandom.nextFloat() * 0.8F + 0.1F),
+ new ItemStack(tItem.getItem(), tItem.stackSize, tItem.getItemDamage()));
+ if (tItem.hasTagCompound()) {
+ tItemEntity.getEntityItem().setTagCompound((NBTTagCompound) tItem.getTagCompound().copy());
+ }
+
+ tItemEntity.motionX = tRandom.nextGaussian() * 0.0500000007450581D;
+ tItemEntity.motionY = tRandom.nextGaussian() * 0.0500000007450581D + 0.2000000029802322D;
+ tItemEntity.motionZ = tRandom.nextGaussian() * 0.0500000007450581D;
+ aWorld.spawnEntityInWorld(tItemEntity);
+ tItem.stackSize = 0;
+ tGregTechTileEntity.setInventorySlotContents(i, (ItemStack) null);
+ }
+ }
+ }
+
+ super.breakBlock(aWorld, aX, aY, aZ, par5, par6);
+ aWorld.removeTileEntity(aX, aY, aZ);
+ }
+
+ public ArrayList<ItemStack> getDrops(World aWorld, int aX, int aY, int aZ, int aMeta, int aFortune) {
+ TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ return tTileEntity instanceof IGregTechTileEntity
+ ? ((IGregTechTileEntity) tTileEntity).getDrops()
+ : (mTemporaryTileEntity.get() == null
+ ? new ArrayList()
+ : ((IGregTechTileEntity) mTemporaryTileEntity.get()).getDrops());
+ }
+
+ public int getComparatorInputOverride(World aWorld, int aX, int aY, int aZ, int aSide) {
+ TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ return tTileEntity instanceof IGregTechTileEntity
+ ? ((IGregTechTileEntity) tTileEntity).getComparatorValue((byte) aSide)
+ : 0;
+ }
+
+ public int isProvidingWeakPower(IBlockAccess aWorld, int aX, int aY, int aZ, int aSide) {
+ if (aSide >= 0 && aSide <= 5) {
+ TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ return tTileEntity instanceof IGregTechTileEntity
+ ? ((IGregTechTileEntity) tTileEntity).getOutputRedstoneSignal(GT_Utility.getOppositeSide(aSide))
+ : 0;
+ } else {
+ return 0;
+ }
+ }
+
+ public int isProvidingStrongPower(IBlockAccess aWorld, int aX, int aY, int aZ, int aSide) {
+ if (aSide >= 0 && aSide <= 5) {
+ TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ return tTileEntity instanceof IGregTechTileEntity
+ ? ((IGregTechTileEntity) tTileEntity)
+ .getStrongOutputRedstoneSignal(GT_Utility.getOppositeSide(aSide))
+ : 0;
+ } else {
+ return 0;
+ }
+ }
+
+ public void dropBlockAsItemWithChance(World aWorld, int aX, int aY, int aZ, int par5, float chance, int par7) {
+ if (!aWorld.isRemote) {
+ TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ if (tTileEntity != null && chance < 1.0F) {
+ if (tTileEntity instanceof BaseMetaTileEntity && GregTech_API.sMachineNonWrenchExplosions) {
+ ((BaseMetaTileEntity) tTileEntity).doEnergyExplosion();
+ }
+ } else {
+ super.dropBlockAsItemWithChance(aWorld, aX, aY, aZ, par5, chance, par7);
+ }
+ }
+
+ }
+
+ public boolean isSideSolid(IBlockAccess aWorld, int aX, int aY, int aZ, ForgeDirection aSide) {
+ if (aWorld.getBlockMetadata(aX, aY, aZ) == 0) {
+ return true;
+ } else {
+ TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ if (tTileEntity != null) {
+ if (tTileEntity instanceof BaseMetaTileEntity) {
+ return true;
+ }
+
+ if (tTileEntity instanceof BaseMetaPipeEntity
+ && (((BaseMetaPipeEntity) tTileEntity).mConnections & -64) != 0) {
+ return true;
+ }
+
+ if (tTileEntity instanceof ICoverable
+ && ((ICoverable) tTileEntity).getCoverIDAtSide((byte) aSide.ordinal()) != 0) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+ }
+
+ public int getLightOpacity(IBlockAccess aWorld, int aX, int aY, int aZ) {
+ TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ return tTileEntity == null
+ ? 0
+ : (tTileEntity instanceof IGregTechTileEntity
+ ? ((IGregTechTileEntity) tTileEntity).getLightOpacity()
+ : (aWorld.getBlockMetadata(aX, aY, aZ) == 0 ? 255 : 0));
+ }
+
+ public int getLightValue(IBlockAccess aWorld, int aX, int aY, int aZ) {
+ TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ return tTileEntity instanceof BaseMetaTileEntity ? ((BaseMetaTileEntity) tTileEntity).getLightValue() : 0;
+ }
+
+ public TileEntity createTileEntity(World aWorld, int aMeta) {
+ return (TileEntity) (aMeta >= 4 ? Meta_GT_Proxy.constructBaseMetaTileEntity() : Meta_GT_Proxy.constructBaseMetaTileEntityCustomPower());
+ }
+
+ public float getExplosionResistance(Entity par1Entity, World aWorld, int aX, int aY, int aZ, double explosionX,
+ double explosionY, double explosionZ) {
+ TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ return tTileEntity instanceof IGregTechTileEntity
+ ? ((IGregTechTileEntity) tTileEntity).getBlastResistance((byte) 6)
+ : 10.0F;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) {
+ for (int i = 0; i < 100; ++i) {
+ if (GregTech_API.METATILEENTITIES[(30400 + i)] != null) {
+ par3List.add(new ItemStack(par1, 1, i));
+ }
+ }
+
+ }
+
+ public void onBlockPlacedBy(World aWorld, int aX, int aY, int aZ, EntityLivingBase aPlayer, ItemStack aStack) {
+ TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ if (tTileEntity != null) {
+ if (tTileEntity instanceof IGregTechTileEntity) {
+ IGregTechTileEntity var6 = (IGregTechTileEntity) tTileEntity;
+ if (aPlayer == null) {
+ var6.setFrontFacing((byte) 1);
+ } else {
+ int var7 = MathHelper.floor_double((double) (aPlayer.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
+ int var8 = Math.round(aPlayer.rotationPitch);
+ if (var8 >= 65 && var6.isValidFacing((byte) 1)) {
+ var6.setFrontFacing((byte) 1);
+ } else if (var8 <= -65 && var6.isValidFacing((byte) 0)) {
+ var6.setFrontFacing((byte) 0);
+ } else {
+ switch (var7) {
+ case 0 :
+ var6.setFrontFacing((byte) 2);
+ break;
+ case 1 :
+ var6.setFrontFacing((byte) 5);
+ break;
+ case 2 :
+ var6.setFrontFacing((byte) 3);
+ break;
+ case 3 :
+ var6.setFrontFacing((byte) 4);
+ }
+ }
+ }
+ }
+
+ }
+ }
+
+ public ArrayList<String> getDebugInfo(EntityPlayer aPlayer, int aX, int aY, int aZ, int aLogLevel) {
+ TileEntity tTileEntity = aPlayer.worldObj.getTileEntity(aX, aY, aZ);
+ return tTileEntity instanceof BaseMetaTileEntity
+ ? ((BaseMetaTileEntity) tTileEntity).getDebugInfo(aPlayer, aLogLevel)
+ : (tTileEntity instanceof BaseMetaPipeEntity
+ ? ((BaseMetaPipeEntity) tTileEntity).getDebugInfo(aPlayer, aLogLevel)
+ : null);
+ }
+
+ public boolean recolourBlock(World aWorld, int aX, int aY, int aZ, ForgeDirection aSide, int aColor) {
+ TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ if (tTileEntity instanceof IGregTechTileEntity) {
+ if (((IGregTechTileEntity) tTileEntity).getColorization() == (byte) (~aColor & 15)) {
+ return false;
+ } else {
+ ((IGregTechTileEntity) tTileEntity).setColorization((byte) (~aColor & 15));
+ return true;
+ }
+ } else {
+ return false;
+ }
+ }
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GTPP_Item_Machines.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GTPP_Item_Machines.java
new file mode 100644
index 0000000000..ba3b05ff8e
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GTPP_Item_Machines.java
@@ -0,0 +1,229 @@
+package gtPlusPlus.xmod.gregtech.common.blocks;
+
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.GT_Values;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.util.GT_ItsNotMyFaultException;
+import gregtech.api.util.GT_LanguageManager;
+import gregtech.api.util.GT_Log;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.lib.CORE;
+
+import java.util.List;
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemBlock;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.world.World;
+
+public class GTPP_Item_Machines extends ItemBlock {
+ public GTPP_Item_Machines(Block par1) {
+ super(par1);
+ this.setMaxDamage(0);
+ this.setHasSubtypes(true);
+ this.setCreativeTab(GregTech_API.TAB_GREGTECH);
+ }
+
+ @SuppressWarnings("unchecked")
+ public void addInformation(ItemStack aStack, EntityPlayer aPlayer, List aList, boolean par4) {
+ try {
+ int e = this.getDamage(aStack) + 30400; //Add Offset
+ if (e <= 0 || e >= GregTech_API.METATILEENTITIES.length) {
+ return;
+ }
+
+ if (GregTech_API.METATILEENTITIES[e] != null) {
+
+ IGregTechTileEntity aNBT = GregTech_API.METATILEENTITIES[e].getBaseMetaTileEntity();
+
+ final long tVoltage = aNBT.getInputVoltage();
+ byte tTier = (byte) ((byte) Math.max(1, GT_Utility.getTier(tVoltage)));
+
+ /*if (aNBT.getDescription() != null) {
+ int tAmount = 0;
+ String[] arg7 = aNBT.getDescription();
+ int arg8 = arg7.length-1;
+
+ if (arg7 != null && arg7.length > 0) {
+ for (String t : arg7) {
+ aList.add(t);
+ }
+
+ }
+ else {
+ aList.add("ERROR");
+ }
+
+ for (int y = 0; y < arg8; y++) {
+ String tDescription = arg7[y];
+
+ if (tDescription != null) {
+ aList.add(tDescription+"|"+arg8);
+ continue;
+ }
+ else {
+ continue;
+ }
+ }
+ }*/
+
+ if (aNBT.getEUCapacity() > 0L) {
+
+ //Custom handling
+ if ((e - 30400) <= 100) {
+
+
+ if ((e - 30400) <= 10) {
+ tTier -= 2;
+ aList.add(EnumChatFormatting.BOLD+"16"+" Fuse Slots"+EnumChatFormatting.GRAY);
+ aList.add("Per each fuse, you may insert "+EnumChatFormatting.YELLOW+(GT_Values.V[tTier])+EnumChatFormatting.GRAY+" EU/t");
+ aList.add("However this "+EnumChatFormatting.ITALIC+EnumChatFormatting.RED+"MUST"+EnumChatFormatting.GRAY+" be in a single Amp");
+ aList.add("This machine can accept upto a single amp of "+GT_Values.VN[Math.min(tTier+2, 12)]+" as a result");
+ aList.add(GT_LanguageManager.addStringLocalization("TileEntity_Breaker_Loss", "Breaker Loss: "+EnumChatFormatting.RED+""+(GT_Values.V[Math.max(tTier-1, 0)]/10)+EnumChatFormatting.GRAY+" EU/t", !GregTech_API.sPostloadFinished) + EnumChatFormatting.GRAY);
+ }
+
+
+ aList.add(GT_LanguageManager.addStringLocalization("TileEntity_Special_Power_1", EnumChatFormatting.RED+"Special Power Handling, please read manual", !GregTech_API.sPostloadFinished) + EnumChatFormatting.GRAY);
+ //aList.add(GT_LanguageManager.addStringLocalization("TileEntity_BreakerBox_2", EnumChatFormatting.RED+"Special Power Handling, please read manual", !GregTech_API.sPostloadFinished) + EnumChatFormatting.GRAY);
+ //aList.add(GT_LanguageManager.addStringLocalization("TileEntity_BreakerBox_3", EnumChatFormatting.RED+"Special Power Handling, please read manual", !GregTech_API.sPostloadFinished) + EnumChatFormatting.GRAY);
+ }
+
+
+ if (aNBT.getInputVoltage() > 0L) {
+ String inA = "0";
+ if (aNBT.getInputAmperage() >= 1L) {
+ inA = " at " + EnumChatFormatting.YELLOW + aNBT.getInputAmperage() + EnumChatFormatting.GRAY +" Amps";
+ }
+ else {
+ inA = " at " + EnumChatFormatting.WHITE + aNBT.getInputAmperage() + EnumChatFormatting.GRAY +" Amps";
+ }
+ String a1 = "Voltage IN: "+EnumChatFormatting.GREEN + aNBT.getInputVoltage()
+ + " (" + GT_Values.VN[GT_Utility.getTier(aNBT.getInputVoltage())] + ")"
+ + EnumChatFormatting.GRAY + inA;
+ aList.add(a1);
+ }
+
+ if (aNBT.getOutputVoltage() > 0L) {
+ String outA = "0";
+ if (aNBT.getOutputAmperage() >= 1L) {
+ outA = " at " + EnumChatFormatting.YELLOW + aNBT.getOutputAmperage() + EnumChatFormatting.GRAY +" Amps";
+ }
+ else {
+ outA = " at " + EnumChatFormatting.WHITE + aNBT.getOutputAmperage() + EnumChatFormatting.GRAY +" Amps";
+ }
+ String a1 = "Voltage OUT: "+EnumChatFormatting.GREEN + aNBT.getOutputVoltage()
+ + " (" + GT_Values.VN[GT_Utility.getTier(aNBT.getOutputVoltage())] + ")"
+ + EnumChatFormatting.GRAY + outA;
+ aList.add(a1);
+ }
+
+ aList.add(GT_LanguageManager.addStringLocalization("TileEntity_Lossess_EU", "Transmission Loss: "+EnumChatFormatting.DARK_BLUE+"0", !GregTech_API.sPostloadFinished) + EnumChatFormatting.GRAY);
+
+ aList.add(GT_LanguageManager.addStringLocalization("TileEntity_EUp_STORE2", "Internal Capacity: ",
+ !GregTech_API.sPostloadFinished) + EnumChatFormatting.BLUE + aNBT.getEUCapacity()
+ + EnumChatFormatting.GRAY + " EU");
+ }
+ }
+
+ NBTTagCompound arg16 = aStack.getTagCompound();
+ if (arg16 != null) {
+ if (arg16.getBoolean("mMuffler")) {
+ aList.add(GT_LanguageManager.addStringLocalization("GT_TileEntity_MUFFLER", "has Muffler Upgrade",
+ !GregTech_API.sPostloadFinished));
+ }
+
+ if (arg16.getBoolean("mSteamConverter")) {
+ aList.add(GT_LanguageManager.addStringLocalization("GT_TileEntity_STEAMCONVERTER",
+ "has Steam Upgrade", !GregTech_API.sPostloadFinished));
+ }
+
+ boolean arg17 = false;
+ byte arg18;
+ if ((arg18 = arg16.getByte("mSteamTanks")) > 0) {
+ aList.add(arg18 + " " + GT_LanguageManager.addStringLocalization("GT_TileEntity_STEAMTANKS",
+ "Steam Tank Upgrades", !GregTech_API.sPostloadFinished));
+ }
+ }
+
+
+ aList.add(EnumChatFormatting.UNDERLINE+"Special GT++ Machine");
+
+ } catch (Throwable arg15) {
+ arg15.printStackTrace(GT_Log.err);
+ }
+
+ }
+
+ public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side,
+ float hitX, float hitY, float hitZ) {
+ return false;
+ }
+
+ public String getUnlocalizedName(ItemStack aStack) {
+ short tDamage = (short) (this.getDamage(aStack) + 30400); //Add Offset;
+ return tDamage >= 0 && tDamage < GregTech_API.METATILEENTITIES.length
+ ? (GregTech_API.METATILEENTITIES[tDamage] != null
+ ? "gtpp.blockmachines" + "." + GregTech_API.METATILEENTITIES[tDamage].getMetaName()
+ : "")
+ : "";
+ }
+
+ public void onCreated(ItemStack aStack, World aWorld, EntityPlayer aPlayer) {
+ super.onCreated(aStack, aWorld, aPlayer);
+ short tDamage = (short) ((short) this.getDamage(aStack) + 30400); //Add Offset;
+ if (tDamage < 0
+ || tDamage >= GregTech_API.METATILEENTITIES.length && GregTech_API.METATILEENTITIES[tDamage] != null) {
+ GregTech_API.METATILEENTITIES[tDamage].onCreated(aStack, aWorld, aPlayer);
+ }
+
+ }
+
+ public boolean placeBlockAt(ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int side,
+ float hitX, float hitY, float hitZ, int aMeta) {
+ short tDamage = (short) ((short) this.getDamage(aStack) + 30400); //Add Offset;
+ if (tDamage > 0) {
+ if (GregTech_API.METATILEENTITIES[tDamage] == null) {
+ return false;
+ }
+
+ byte tMetaData = 32;
+ //byte tMetaData = GregTech_API.METATILEENTITIES[tDamage].getTileEntityBaseType();
+ Logger.INFO("Using Meta: "+tMetaData+" for ID "+tDamage+" | "+GregTech_API.METATILEENTITIES[tDamage].getInventoryName());
+ if (!aWorld.setBlock(aX, aY, aZ, this.field_150939_a, tMetaData, 3)) {
+ return false;
+ }
+
+ if (aWorld.getBlock(aX, aY, aZ) != this.field_150939_a) {
+ throw new GT_ItsNotMyFaultException(
+ "Failed to place Block even though World.setBlock returned true. It COULD be MCPC/Bukkit causing that. In case you really have that installed, don\'t report this Bug to me, I don\'t know how to fix it.");
+ }
+
+ if (aWorld.getBlockMetadata(aX, aY, aZ) != tMetaData) {
+ throw new GT_ItsNotMyFaultException(
+ "Failed to set the MetaValue of the Block even though World.setBlock returned true. It COULD be MCPC/Bukkit causing that. In case you really have that installed, don\'t report this Bug to me, I don\'t know how to fix it.");
+ }
+
+ IGregTechTileEntity tTileEntity = (IGregTechTileEntity) aWorld.getTileEntity(aX, aY, aZ);
+ if (tTileEntity != null) {
+ tTileEntity.setInitialValuesAsNBT(tTileEntity.isServerSide() ? aStack.getTagCompound() : null, tDamage);
+ if (aPlayer != null) {
+ tTileEntity.setOwnerName(aPlayer.getDisplayName());
+ }
+
+ tTileEntity.getMetaTileEntity().initDefaultModes(aStack.getTagCompound());
+ }
+ } else if (!aWorld.setBlock(aX, aY, aZ, this.field_150939_a, tDamage, 3)) {
+ return false;
+ }
+
+ if (aWorld.getBlock(aX, aY, aZ) == this.field_150939_a) {
+ this.field_150939_a.onBlockPlacedBy(aWorld, aX, aY, aZ, aPlayer, aStack);
+ this.field_150939_a.onPostBlockPlaced(aWorld, aX, aY, aZ, tDamage);
+ }
+
+ return true;
+ }
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks.java
new file mode 100644
index 0000000000..c4b2e4f738
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks.java
@@ -0,0 +1,78 @@
+package gtPlusPlus.xmod.gregtech.common.blocks;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.IIcon;
+import net.minecraft.world.IBlockAccess;
+
+import gregtech.api.enums.TAE;
+import gregtech.api.objects.GT_CopiedBlockTexture;
+import gregtech.api.util.GT_LanguageManager;
+import gregtech.common.blocks.GT_Material_Casings;
+
+import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.CasingTextureHandler;
+
+public class GregtechMetaCasingBlocks
+extends GregtechMetaCasingBlocksAbstract {
+
+ CasingTextureHandler TextureHandler = new CasingTextureHandler();
+
+ public GregtechMetaCasingBlocks() {
+ super(GregtechMetaCasingItems.class, "miscutils.blockcasings", GT_Material_Casings.INSTANCE);
+ for (byte i = 0; i < 16; i = (byte) (i + 1)) {
+ if (i == 2 || i == 3 || i == 4) {
+ continue;
+ }
+ TAE.registerTexture(0, i, new GT_CopiedBlockTexture(this, 6, i));
+ }
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".0.name", "Centrifuge Casing");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".1.name", "Structural Coke Oven Casing");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".2.name", "Heat Resistant Coke Oven Casing");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".3.name", "Heat Proof Coke Oven Casing"); //60
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".4.name", "Material Press Machine Casing");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".5.name", "Electrolyzer Casing");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".6.name", "Wire Factory Casing");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".7.name", "Maceration Stack Casing");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".8.name", "Matter Generation Coil"); //65
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".9.name", "Matter Fabricator Casing");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".10.name", "Iron Plated Bricks");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".11.name", "Multitank Exterior Casing");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".12.name", "Hastelloy-N Reactor Casing");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".13.name", "Zeron-100 Reactor Shielding");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".14.name", "Blast Smelter Heat Containment Coil ");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".15.name", "Blast Smelter Casing Block");
+ GregtechItemList.Casing_Centrifuge1.set(new ItemStack(this, 1, 0));
+ GregtechItemList.Casing_CokeOven.set(new ItemStack(this, 1, 1));
+ GregtechItemList.Casing_CokeOven_Coil1.set(new ItemStack(this, 1, 2));
+ GregtechItemList.Casing_CokeOven_Coil2.set(new ItemStack(this, 1, 3));
+ GregtechItemList.Casing_MaterialPress.set(new ItemStack(this, 1, 4));
+ GregtechItemList.Casing_Electrolyzer.set(new ItemStack(this, 1, 5));
+ GregtechItemList.Casing_WireFactory.set(new ItemStack(this, 1, 6));
+ GregtechItemList.Casing_MacerationStack.set(new ItemStack(this, 1, 7));
+ GregtechItemList.Casing_MatterGen.set(new ItemStack(this, 1, 8));
+ GregtechItemList.Casing_MatterFab.set(new ItemStack(this, 1, 9));
+ GregtechItemList.Casing_IronPlatedBricks.set(new ItemStack(this, 1, 10));
+ GregtechItemList.Casing_MultitankExterior.set(new ItemStack(this, 1, 11));
+ GregtechItemList.Casing_Reactor_I.set(new ItemStack(this, 1, 12));
+ GregtechItemList.Casing_Reactor_II.set(new ItemStack(this, 1, 13));
+ GregtechItemList.Casing_Coil_BlastSmelter.set(new ItemStack(this, 1, 14));
+ GregtechItemList.Casing_BlastSmelter.set(new ItemStack(this, 1, 15));
+ }
+
+ @Override
+ public IIcon getIcon(final int aSide, final int aMeta) { //Texture ID's. case 0 == ID[57]
+ return CasingTextureHandler.getIcon(aSide, aMeta);
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public IIcon getIcon(final IBlockAccess aWorld, final int xCoord, final int yCoord, final int zCoord, final int aSide) {
+ final GregtechMetaCasingBlocks i = this;
+ return CasingTextureHandler.handleCasingsGT(aWorld, xCoord, yCoord, zCoord, aSide, i);
+ }
+
+
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks2.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks2.java
new file mode 100644
index 0000000000..596643e06c
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks2.java
@@ -0,0 +1,89 @@
+package gtPlusPlus.xmod.gregtech.common.blocks;
+
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.storage.GregtechMetaTileEntity_PowerSubStationController;
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.IIcon;
+
+import gregtech.api.enums.TAE;
+import gregtech.api.objects.GT_CopiedBlockTexture;
+import gregtech.api.util.GT_LanguageManager;
+import gregtech.common.blocks.GT_Material_Casings;
+
+import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.CasingTextureHandler2;
+
+import java.util.List;
+
+public class GregtechMetaCasingBlocks2
+extends GregtechMetaCasingBlocksAbstract {
+
+ CasingTextureHandler2 TextureHandler = new CasingTextureHandler2();
+
+ public static class GregtechMetaCasingItemBlocks2 extends GregtechMetaCasingItems {
+
+ public GregtechMetaCasingItemBlocks2(Block par1) {
+ super(par1);
+ }
+
+ @Override
+ public void addInformation(ItemStack aStack, EntityPlayer aPlayer, List aList, boolean aF3_H) {
+ int meta = aStack.getItemDamage();
+ int tier = GregtechMetaTileEntity_PowerSubStationController.getCellTier(field_150939_a, meta);
+ if (meta == 7 && tier > 0) {
+ long capacity = GregtechMetaTileEntity_PowerSubStationController.getCapacityFromCellTier(tier);
+ aList.add("Energy Storage: " + GT_Utility.formatNumbers(capacity));
+ }
+ super.addInformation(aStack, aPlayer, aList, aF3_H);
+ }
+ }
+
+ public GregtechMetaCasingBlocks2() {
+ super(GregtechMetaCasingItemBlocks2.class, "gtplusplus.blockcasings.2", GT_Material_Casings.INSTANCE);
+ for (byte i = 0; i < 16; i = (byte) (i + 1)) {
+ if (i == 4 || i == 10 || i == 11 || i == 12 || i == 14) {
+ continue;
+ }
+ TAE.registerTexture(1, i, new GT_CopiedBlockTexture(this, 6, i));
+ }
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".0.name", "Thermal Processing Casing");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".1.name", "Hastelloy-N Sealant Block");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".2.name", "Hastelloy-X Structural Block");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".3.name", "Incoloy-DS Fluid Containment Block");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".4.name", "Wash Plant Casing");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".5.name", "Industrial Sieve Casing");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".6.name", "Large Sieve Grate");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".7.name", "Vanadium Redox Power Cell (EV)");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".8.name", "Sub-Station External Casing");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".9.name", "Cyclotron Coil");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".10.name", "Cyclotron Outer Casing");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".11.name", "Thermal Containment Casing");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".12.name", "Autocrafter Frame");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".13.name", "Cutting Factory Frame");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".14.name", ""); // Unused
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".15.name", "Sterile Farm Casing"); //Tree Farmer Textures
+ GregtechItemList.Casing_ThermalCentrifuge.set(new ItemStack(this, 1, 0));
+ GregtechItemList.Casing_Refinery_External.set(new ItemStack(this, 1, 1));
+ GregtechItemList.Casing_Refinery_Structural.set(new ItemStack(this, 1, 2));
+ GregtechItemList.Casing_Refinery_Internal.set(new ItemStack(this, 1, 3));
+ GregtechItemList.Casing_WashPlant.set(new ItemStack(this, 1, 4));
+ GregtechItemList.Casing_Sifter.set(new ItemStack(this, 1, 5));
+ GregtechItemList.Casing_SifterGrate.set(new ItemStack(this, 1, 6));
+ GregtechItemList.Casing_Vanadium_Redox.set(new ItemStack(this, 1, 7));
+ GregtechItemList.Casing_Power_SubStation.set(new ItemStack(this, 1, 8));
+ GregtechItemList.Casing_Cyclotron_Coil.set(new ItemStack(this, 1, 9));
+ GregtechItemList.Casing_Cyclotron_External.set(new ItemStack(this, 1, 10));
+ GregtechItemList.Casing_ThermalContainment.set(new ItemStack(this, 1, 11));
+ GregtechItemList.Casing_Autocrafter.set(new ItemStack(this, 1, 12));
+ GregtechItemList.Casing_CuttingFactoryFrame.set(new ItemStack(this, 1, 13));
+ //GregtechItemList.Casing_TeslaTower.set(new ItemStack(this, 1, 14));
+ GregtechItemList.Casing_PLACEHOLDER_TreeFarmer.set(new ItemStack(this, 1, 15)); //Tree Farmer Textures
+ }
+
+ @Override
+ public IIcon getIcon(final int aSide, final int aMeta) {
+ return CasingTextureHandler2.getIcon(aSide, aMeta);
+ }
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks3.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks3.java
new file mode 100644
index 0000000000..8cd6dd0ca8
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks3.java
@@ -0,0 +1,366 @@
+package gtPlusPlus.xmod.gregtech.common.blocks;
+
+import java.util.List;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import gregtech.api.enums.TAE;
+import gregtech.api.objects.GT_CopiedBlockTexture;
+import gregtech.api.util.GT_LanguageManager;
+import gregtech.api.util.GT_Utility;
+import gregtech.common.blocks.GT_Material_Casings;
+import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.CasingTextureHandler3;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.storage.GregtechMetaTileEntity_PowerSubStationController;
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.IIcon;
+import net.minecraft.world.IBlockAccess;
+
+public class GregtechMetaCasingBlocks3
+extends GregtechMetaCasingBlocksAbstract {
+
+ public static boolean mConnectedMachineTextures = false;
+ CasingTextureHandler3 TextureHandler = new CasingTextureHandler3();
+
+ public static class GregtechMetaCasingItemBlocks3 extends GregtechMetaCasingItems {
+
+ public GregtechMetaCasingItemBlocks3(Block par1) {
+ super(par1);
+ }
+
+ @Override
+ public void addInformation(ItemStack aStack, EntityPlayer aPlayer, List aList, boolean aF3_H) {
+ int meta = aStack.getItemDamage();
+ int tier = GregtechMetaTileEntity_PowerSubStationController.getCellTier(field_150939_a, meta);
+ if (tier > 0) {
+ long capacity = GregtechMetaTileEntity_PowerSubStationController.getCapacityFromCellTier(tier);
+ aList.add("Energy Storage: " + GT_Utility.formatNumbers(capacity));
+ }
+ super.addInformation(aStack, aPlayer, aList, aF3_H);
+ }
+ }
+
+ public GregtechMetaCasingBlocks3() {
+ super(GregtechMetaCasingItemBlocks3.class, "gtplusplus.blockcasings.3", GT_Material_Casings.INSTANCE);
+ for (byte i = 0; i < 16; i = (byte) (i + 1)) {
+ TAE.registerTexture(2, i, new GT_CopiedBlockTexture(this, 6, i));
+ }
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".0.name", "Aquatic Casing");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".1.name", "Inconel Reinforced Casing");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".2.name", "Multi-Use Casing");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".3.name", "Trinium Plated Casing");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".4.name", "Vanadium Redox Power Cell (IV)");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".5.name", "Vanadium Redox Power Cell (LuV)");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".6.name", "Vanadium Redox Power Cell (ZPM)");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".7.name", "Vanadium Redox Power Cell (UV)");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".8.name", "Vanadium Redox Power Cell (MAX)");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".9.name", "Supply Depot Casing");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".10.name", "Advanced Cryogenic Casing");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".11.name", "Volcanus Casing");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".12.name", "Fusion Machine Casing MK III");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".13.name", "Advanced Fusion Coil");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".14.name", "Unnamed"); // Can Use, don't change texture (Used for Fusion MK4)
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".15.name", "Containment Casing");
+ GregtechItemList.Casing_FishPond.set(new ItemStack(this, 1, 0));
+ GregtechItemList.Casing_Extruder.set(new ItemStack(this, 1, 1));
+ GregtechItemList.Casing_Multi_Use.set(new ItemStack(this, 1, 2));
+ GregtechItemList.Casing_BedrockMiner.set(new ItemStack(this, 1, 3));
+ GregtechItemList.Casing_Vanadium_Redox_IV.set(new ItemStack(this, 1, 4));
+ GregtechItemList.Casing_Vanadium_Redox_LuV.set(new ItemStack(this, 1, 5));
+ GregtechItemList.Casing_Vanadium_Redox_ZPM.set(new ItemStack(this, 1, 6));
+ GregtechItemList.Casing_Vanadium_Redox_UV.set(new ItemStack(this, 1, 7));
+ GregtechItemList.Casing_Vanadium_Redox_MAX.set(new ItemStack(this, 1, 8));
+ GregtechItemList.Casing_AmazonWarehouse.set(new ItemStack(this, 1, 9));
+ GregtechItemList.Casing_AdvancedVacuum.set(new ItemStack(this, 1, 10));
+ GregtechItemList.Casing_Adv_BlastFurnace.set(new ItemStack(this, 1, 11));
+ GregtechItemList.Casing_Fusion_External.set(new ItemStack(this, 1, 12));
+ GregtechItemList.Casing_Fusion_Internal.set(new ItemStack(this, 1, 13));
+ GregtechItemList.Casing_Containment.set(new ItemStack(this, 1, 15));
+ }
+
+ @Override
+ public IIcon getIcon(final int aSide, final int aMeta) {
+ return CasingTextureHandler3.getIcon(aSide, aMeta);
+ }
+
+ @SideOnly(Side.CLIENT)
+ @Override
+ public IIcon getIcon(final IBlockAccess aWorld, final int xCoord, final int yCoord, final int zCoord,
+ final int aSide) {
+ final Block thisBlock = aWorld.getBlock(xCoord, yCoord, zCoord);
+ final int tMeta = aWorld.getBlockMetadata(xCoord, yCoord, zCoord);
+ if ((tMeta != 12)|| !GregtechMetaCasingBlocks3.mConnectedMachineTextures) {
+ return getIcon(aSide, tMeta);
+ }
+ final int tStartIndex = 0;
+ if (tMeta == 12) {
+ final boolean[] tConnectedSides = {
+ aWorld.getBlock(xCoord, yCoord - 1, zCoord) == thisBlock
+ && aWorld.getBlockMetadata(xCoord, yCoord - 1, zCoord) == tMeta,
+ aWorld.getBlock(xCoord, yCoord + 1, zCoord) == thisBlock
+ && aWorld.getBlockMetadata(xCoord, yCoord + 1, zCoord) == tMeta,
+ aWorld.getBlock(xCoord + 1, yCoord, zCoord) == thisBlock
+ && aWorld.getBlockMetadata(xCoord + 1, yCoord, zCoord) == tMeta,
+ aWorld.getBlock(xCoord, yCoord, zCoord + 1) == thisBlock
+ && aWorld.getBlockMetadata(xCoord, yCoord, zCoord + 1) == tMeta,
+ aWorld.getBlock(xCoord - 1, yCoord, zCoord) == thisBlock
+ && aWorld.getBlockMetadata(xCoord - 1, yCoord, zCoord) == tMeta,
+ aWorld.getBlock(xCoord, yCoord, zCoord - 1) == thisBlock
+ && aWorld.getBlockMetadata(xCoord, yCoord, zCoord - 1) == tMeta};
+ switch (aSide) {
+ case 0 : {
+ if (tConnectedSides[0]) {
+ return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 7].getIcon();
+ }
+ if (tConnectedSides[4] && tConnectedSides[5] && tConnectedSides[2] && tConnectedSides[3]) {
+ return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 6].getIcon();
+ }
+ if (!tConnectedSides[4] && tConnectedSides[5] && tConnectedSides[2] && tConnectedSides[3]) {
+ return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 2].getIcon();
+ }
+ if (tConnectedSides[4] && !tConnectedSides[5] && tConnectedSides[2] && tConnectedSides[3]) {
+ return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 3].getIcon();
+ }
+ if (tConnectedSides[4] && tConnectedSides[5] && !tConnectedSides[2] && tConnectedSides[3]) {
+ return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 4].getIcon();
+ }
+ if (tConnectedSides[4] && tConnectedSides[5] && tConnectedSides[2] && !tConnectedSides[3]) {
+ return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 5].getIcon();
+ }
+ if (!tConnectedSides[4] && !tConnectedSides[5] && tConnectedSides[2] && tConnectedSides[3]) {
+ return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 8].getIcon();
+ }
+ if (tConnectedSides[4] && !tConnectedSides[5] && !tConnectedSides[2] && tConnectedSides[3]) {
+ return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 9].getIcon();
+ }
+ if (tConnectedSides[4] && tConnectedSides[5] && !tConnectedSides[2] && !tConnectedSides[3]) {
+ return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 10].getIcon();
+ }
+ if (!tConnectedSides[4] && tConnectedSides[5] && tConnectedSides[2] && !tConnectedSides[3]) {
+ return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 11].getIcon();
+ }
+ if (!tConnectedSides[4] && !tConnectedSides[5] && !tConnectedSides[2] && !tConnectedSides[3]) {
+ return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 7].getIcon();
+ }
+ if (!tConnectedSides[4] && !tConnectedSides[2]) {
+ return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 1].getIcon();
+ }
+ if (!tConnectedSides[5] && !tConnectedSides[3]) {
+ return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 0].getIcon();
+ }
+ }
+ case 1 : {
+ if (tConnectedSides[1]) {
+ return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 7].getIcon();
+ }
+ if (tConnectedSides[4] && tConnectedSides[5] && tConnectedSides[2] && tConnectedSides[3]) {
+ return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 6].getIcon();
+ }
+ if (!tConnectedSides[4] && tConnectedSides[5] && tConnectedSides[2] && tConnectedSides[3]) {
+ return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 2].getIcon();
+ }
+ if (tConnectedSides[4] && !tConnectedSides[5] && tConnectedSides[2] && tConnectedSides[3]) {
+ return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 3].getIcon();
+ }
+ if (tConnectedSides[4] && tConnectedSides[5] && !tConnectedSides[2] && tConnectedSides[3]) {
+ return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 4].getIcon();
+ }
+ if (tConnectedSides[4] && tConnectedSides[5] && tConnectedSides[2] && !tConnectedSides[3]) {
+ return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 5].getIcon();
+ }
+ if (!tConnectedSides[4] && !tConnectedSides[5] && tConnectedSides[2] && tConnectedSides[3]) {
+ return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 8].getIcon();
+ }
+ if (tConnectedSides[4] && !tConnectedSides[5] && !tConnectedSides[2] && tConnectedSides[3]) {
+ return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 9].getIcon();
+ }
+ if (tConnectedSides[4] && tConnectedSides[5] && !tConnectedSides[2] && !tConnectedSides[3]) {
+ return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 10].getIcon();
+ }
+ if (!tConnectedSides[4] && tConnectedSides[5] && tConnectedSides[2] && !tConnectedSides[3]) {
+ return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 11].getIcon();
+ }
+ if (!tConnectedSides[4] && !tConnectedSides[5] && !tConnectedSides[2] && !tConnectedSides[3]) {
+ return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 7].getIcon();
+ }
+ if (!tConnectedSides[2] && !tConnectedSides[4]) {
+ return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 1].getIcon();
+ }
+ if (!tConnectedSides[3] && !tConnectedSides[5]) {
+ return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 0].getIcon();
+ }
+ }
+ case 2 : {
+ if (tConnectedSides[5]) {
+ return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 7].getIcon();
+ }
+ if (tConnectedSides[2] && tConnectedSides[0] && tConnectedSides[4] && tConnectedSides[1]) {
+ return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 6].getIcon();
+ }
+ if (!tConnectedSides[2] && tConnectedSides[0] && tConnectedSides[4] && tConnectedSides[1]) {
+ return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 2].getIcon();
+ }
+ if (tConnectedSides[2] && !tConnectedSides[0] && tConnectedSides[4] && tConnectedSides[1]) {
+ return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 5].getIcon();
+ }
+ if (tConnectedSides[2] && tConnectedSides[0] && !tConnectedSides[4] && tConnectedSides[1]) {
+ return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 4].getIcon();
+ }
+ if (tConnectedSides[2] && tConnectedSides[0] && tConnectedSides[4] && !tConnectedSides[1]) {
+ return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 3].getIcon();
+ }
+ if (!tConnectedSides[2] && !tConnectedSides[0] && tConnectedSides[4] && tConnectedSides[1]) {
+ return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 11].getIcon();
+ }
+ if (tConnectedSides[2] && !tConnectedSides[0] && !tConnectedSides[4] && tConnectedSides[1]) {
+ return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 10].getIcon();
+ }
+ if (tConnectedSides[2] && tConnectedSides[0] && !tConnectedSides[4] && !tConnectedSides[1]) {
+ return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 9].getIcon();
+ }
+ if (!tConnectedSides[2] && tConnectedSides[0] && tConnectedSides[4] && !tConnectedSides[1]) {
+ return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 8].getIcon();
+ }
+ if (!tConnectedSides[2] && !tConnectedSides[0] && !tConnectedSides[4] && !tConnectedSides[1]) {
+ return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 7].getIcon();
+ }
+ if (!tConnectedSides[2] && !tConnectedSides[4]) {
+ return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 1].getIcon();
+ }
+ if (!tConnectedSides[0] && !tConnectedSides[1]) {
+ return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 0].getIcon();
+ }
+ }
+ case 3 : {
+ if (tConnectedSides[3]) {
+ return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 7].getIcon();
+ }
+ if (tConnectedSides[2] && tConnectedSides[0] && tConnectedSides[4] && tConnectedSides[1]) {
+ return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 6].getIcon();
+ }
+ if (!tConnectedSides[2] && tConnectedSides[0] && tConnectedSides[4] && tConnectedSides[1]) {
+ return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 4].getIcon();
+ }
+ if (tConnectedSides[2] && !tConnectedSides[0] && tConnectedSides[4] && tConnectedSides[1]) {
+ return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 5].getIcon();
+ }
+ if (tConnectedSides[2] && tConnectedSides[0] && !tConnectedSides[4] && tConnectedSides[1]) {
+ return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 2].getIcon();
+ }
+ if (tConnectedSides[2] && tConnectedSides[0] && tConnectedSides[4] && !tConnectedSides[1]) {
+ return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 3].getIcon();
+ }
+ if (!tConnectedSides[2] && !tConnectedSides[0] && tConnectedSides[4] && tConnectedSides[1]) {
+ return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 10].getIcon();
+ }
+ if (tConnectedSides[2] && !tConnectedSides[0] && !tConnectedSides[4] && tConnectedSides[1]) {
+ return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 11].getIcon();
+ }
+ if (tConnectedSides[2] && tConnectedSides[0] && !tConnectedSides[4] && !tConnectedSides[1]) {
+ return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 8].getIcon();
+ }
+ if (!tConnectedSides[2] && tConnectedSides[0] && tConnectedSides[4] && !tConnectedSides[1]) {
+ return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 9].getIcon();
+ }
+ if (!tConnectedSides[2] && !tConnectedSides[0] && !tConnectedSides[4] && !tConnectedSides[1]) {
+ return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 7].getIcon();
+ }
+ if (!tConnectedSides[2] && !tConnectedSides[4]) {
+ return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 1].getIcon();
+ }
+ if (!tConnectedSides[0] && !tConnectedSides[1]) {
+ return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 0].getIcon();
+ }
+ }
+ case 4 : {
+ if (tConnectedSides[4]) {
+ return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 7].getIcon();
+ }
+ if (tConnectedSides[0] && tConnectedSides[3] && tConnectedSides[1] && tConnectedSides[5]) {
+ return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 6].getIcon();
+ }
+ if (!tConnectedSides[0] && tConnectedSides[3] && tConnectedSides[1] && tConnectedSides[5]) {
+ return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 5].getIcon();
+ }
+ if (tConnectedSides[0] && !tConnectedSides[3] && tConnectedSides[1] && tConnectedSides[5]) {
+ return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 4].getIcon();
+ }
+ if (tConnectedSides[0] && tConnectedSides[3] && !tConnectedSides[1] && tConnectedSides[5]) {
+ return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 3].getIcon();
+ }
+ if (tConnectedSides[0] && tConnectedSides[3] && tConnectedSides[1] && !tConnectedSides[5]) {
+ return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 2].getIcon();
+ }
+ if (!tConnectedSides[0] && !tConnectedSides[3] && tConnectedSides[1] && tConnectedSides[5]) {
+ return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 10].getIcon();
+ }
+ if (tConnectedSides[0] && !tConnectedSides[3] && !tConnectedSides[1] && tConnectedSides[5]) {
+ return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 9].getIcon();
+ }
+ if (tConnectedSides[0] && tConnectedSides[3] && !tConnectedSides[1] && !tConnectedSides[5]) {
+ return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 8].getIcon();
+ }
+ if (!tConnectedSides[0] && tConnectedSides[3] && tConnectedSides[1] && !tConnectedSides[5]) {
+ return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 11].getIcon();
+ }
+ if (!tConnectedSides[0] && !tConnectedSides[3] && !tConnectedSides[1] && !tConnectedSides[5]) {
+ return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 7].getIcon();
+ }
+ if (!tConnectedSides[0] && !tConnectedSides[1]) {
+ return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 0].getIcon();
+ }
+ if (!tConnectedSides[3] && !tConnectedSides[5]) {
+ return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 1].getIcon();
+ }
+ }
+ case 5 : {
+ if (tConnectedSides[2]) {
+ return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 7].getIcon();
+ }
+ if (tConnectedSides[0] && tConnectedSides[3] && tConnectedSides[1] && tConnectedSides[5]) {
+ return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 6].getIcon();
+ }
+ if (!tConnectedSides[0] && tConnectedSides[3] && tConnectedSides[1] && tConnectedSides[5]) {
+ return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 5].getIcon();
+ }
+ if (tConnectedSides[0] && !tConnectedSides[3] && tConnectedSides[1] && tConnectedSides[5]) {
+ return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 2].getIcon();
+ }
+ if (tConnectedSides[0] && tConnectedSides[3] && !tConnectedSides[1] && tConnectedSides[5]) {
+ return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 3].getIcon();
+ }
+ if (tConnectedSides[0] && tConnectedSides[3] && tConnectedSides[1] && !tConnectedSides[5]) {
+ return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 4].getIcon();
+ }
+ if (!tConnectedSides[0] && !tConnectedSides[3] && tConnectedSides[1] && tConnectedSides[5]) {
+ return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 11].getIcon();
+ }
+ if (tConnectedSides[0] && !tConnectedSides[3] && !tConnectedSides[1] && tConnectedSides[5]) {
+ return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 8].getIcon();
+ }
+ if (tConnectedSides[0] && tConnectedSides[3] && !tConnectedSides[1] && !tConnectedSides[5]) {
+ return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 9].getIcon();
+ }
+ if (!tConnectedSides[0] && tConnectedSides[3] && tConnectedSides[1] && !tConnectedSides[5]) {
+ return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 10].getIcon();
+ }
+ if (!tConnectedSides[0] && !tConnectedSides[3] && !tConnectedSides[1] && !tConnectedSides[5]) {
+ return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 7].getIcon();
+ }
+ if (!tConnectedSides[0] && !tConnectedSides[1]) {
+ return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 0].getIcon();
+ }
+ if (!tConnectedSides[3] && !tConnectedSides[5]) {
+ return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 1].getIcon();
+ }
+ break;
+ }
+ }
+ return TexturesGtBlock.CONNECTED_FUSION_HULLS[tStartIndex + 7].getIcon();
+ }
+ return CasingTextureHandler3.getIcon(aSide, tMeta);
+ }
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks4.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks4.java
new file mode 100644
index 0000000000..419b5f3d30
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks4.java
@@ -0,0 +1,115 @@
+package gtPlusPlus.xmod.gregtech.common.blocks;
+
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.IIcon;
+import net.minecraft.world.IBlockAccess;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import gregtech.api.enums.TAE;
+import gregtech.api.enums.Textures;
+import gregtech.api.objects.GT_CopiedBlockTexture;
+import gregtech.api.util.GT_LanguageManager;
+import gregtech.common.blocks.GT_Material_Casings;
+
+import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+
+
+public class GregtechMetaCasingBlocks4
+extends GregtechMetaCasingBlocksAbstract {
+
+ public GregtechMetaCasingBlocks4() {
+ super(GregtechMetaCasingItems.class, "gtplusplus.blockcasings.4", GT_Material_Casings.INSTANCE);
+ for (byte i = 0; i < 16; i = (byte) (i + 1)) {
+ if (i == 2 || i == 4 || i == 5 || i == 6 || i == 7 || i == 8 || i == 9 || i == 12 || i == 13 || i == 14 || i == 15) {
+ continue;
+ }
+ TAE.registerTexture(3, i, new GT_CopiedBlockTexture(this, 6, i));
+ }
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".0.name", "Naquadah Reactor Base"); //48
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".1.name", "Reactor Piping");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".2.name", "Naquadah Containment Chamber");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".3.name", "Tempered Arc Furnace Casing");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".4.name", ""); // Unused
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".5.name", ""); // Unused
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".6.name", ""); // Unused
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".7.name", ""); // Unused
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".8.name", ""); // Unused
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".9.name", ""); // Unused
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".10.name", "Vacuum Casing");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".11.name", "Turbodyne Casing");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".12.name", ""); // Unused
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".13.name", ""); // Unused
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".14.name", ""); // Unused
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".15.name", ""); // Unused
+ GregtechItemList.Casing_Naq_Reactor_A.set(new ItemStack(this, 1, 0));
+ GregtechItemList.Casing_Naq_Reactor_B.set(new ItemStack(this, 1, 1));
+ GregtechItemList.Casing_Naq_Reactor_C.set(new ItemStack(this, 1, 2));
+ GregtechItemList.Casing_Industrial_Arc_Furnace.set(new ItemStack(this, 1, 3));
+ GregtechItemList.Casing_Vacuum_Furnace.set(new ItemStack(this, 1, 10));
+ GregtechItemList.Casing_RocketEngine.set(new ItemStack(this, 1, 11));
+ }
+
+ //private static final LargeTurbineTextureHandler mTurbineTextures = new LargeTurbineTextureHandler();
+
+ /*@Override
+ @SideOnly(Side.CLIENT)
+ public IIcon getIcon(final IBlockAccess aWorld, final int xCoord, final int yCoord, final int zCoord, final int aSide) {
+ final GregtechMetaCasingBlocks4 i = this;
+ return mTurbineTextures.handleCasingsGT(aWorld, xCoord, yCoord, zCoord, aSide, i);
+ }*/
+
+ @Override
+ public IIcon getIcon(final int aSide, final int aMeta) {
+ return getStaticIcon((byte) aSide, (byte) aMeta);
+ }
+
+ public static IIcon getStaticIcon(final byte aSide, final byte aMeta) {
+ //Texture ID's. case 0 == ID[57]
+ if ((aMeta >= 0) && (aMeta < 16)) {
+ switch (aMeta) {
+ case 0:
+ return TexturesGtBlock.Casing_Trinium_Titanium.getIcon();
+ case 1:
+ return TexturesGtBlock.TEXTURE_TECH_C.getIcon();
+ case 2:
+ return TexturesGtBlock.TEXTURE_ORGANIC_PANEL_A_GLOWING.getIcon();
+ case 3:
+ return TexturesGtBlock.TEXTURE_METAL_PANEL_A.getIcon();
+ case 4:
+ return Textures.BlockIcons.RENDERING_ERROR.getIcon();
+ case 5:
+ return Textures.BlockIcons.RENDERING_ERROR.getIcon();
+ case 6:
+ return Textures.BlockIcons.RENDERING_ERROR.getIcon();
+ case 7:
+ return Textures.BlockIcons.RENDERING_ERROR.getIcon();
+ case 8:
+ return Textures.BlockIcons.RENDERING_ERROR.getIcon();
+ case 9:
+ return Textures.BlockIcons.RENDERING_ERROR.getIcon();
+ case 10:
+ if (aSide <2) {
+ return TexturesGtBlock.TEXTURE_STONE_RED_B.getIcon();
+ }
+ else {
+ return TexturesGtBlock.TEXTURE_STONE_RED_A.getIcon();
+ }
+ case 11:
+ return TexturesGtBlock.TEXTURE_CASING_ROCKETDYNE.getIcon();
+ case 12:
+ return Textures.BlockIcons.RENDERING_ERROR.getIcon();
+ case 13:
+ return Textures.BlockIcons.RENDERING_ERROR.getIcon();
+ case 14:
+ return Textures.BlockIcons.RENDERING_ERROR.getIcon();
+ case 15:
+ return Textures.BlockIcons.RENDERING_ERROR.getIcon();
+ default:
+ return TexturesGtBlock.Casing_Material_MaragingSteel.getIcon();
+
+ }
+ }
+ return TexturesGtBlock._PlaceHolder.getIcon();
+ }
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks5.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks5.java
new file mode 100644
index 0000000000..c594ee0e5d
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks5.java
@@ -0,0 +1,83 @@
+package gtPlusPlus.xmod.gregtech.common.blocks;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import gregtech.api.enums.TAE;
+import gregtech.api.enums.Textures;
+import gregtech.api.objects.GT_CopiedBlockTexture;
+import gregtech.api.util.GT_LanguageManager;
+import gregtech.common.blocks.GT_Material_Casings;
+import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGrinderMultiblock;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.IIcon;
+import net.minecraft.world.IBlockAccess;
+
+
+public class GregtechMetaCasingBlocks5
+extends GregtechMetaCasingBlocksAbstract {
+
+ //Free Indexes within TAE: 90, 91, 92, 94, 114, 116, 117, 118, 119, 120, 121, 124, 125, 126, 127
+ private static final TexturesGrinderMultiblock mGrinderOverlayHandler = new TexturesGrinderMultiblock();
+
+ public GregtechMetaCasingBlocks5() {
+ super(GregtechMetaCasingItems.class, "gtplusplus.blockcasings.5", GT_Material_Casings.INSTANCE);
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".0.name", "IsaMill Exterior Casing"); // IsaMill Casing
+ TAE.registerTexture(0, 2, new GT_CopiedBlockTexture(this, 6, 0));
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".1.name", "IsaMill Piping"); // IsaMill Pipe
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".2.name", "IsaMill Gearbox"); // IsaMill Gearbox
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".3.name", "Elemental Confinement Shell"); // Duplicator Casing
+ TAE.registerTexture(0, 3, new GT_CopiedBlockTexture(this, 6, 3));
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".4.name", "Sparge Tower Exterior Casing"); // Sparge Tower Casing
+ TAE.registerTexture(0, 4, new GT_CopiedBlockTexture(this, 6, 4));
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".5.name", ""); // Unused
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".6.name", ""); // Unused
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".7.name", ""); // Unused
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".8.name", ""); // Unused
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".9.name", ""); // Unused
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".10.name", ""); // Unused
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".11.name", ""); // Unused
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".12.name", ""); // Unused
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".13.name", ""); // Unused
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".14.name", ""); // Unused
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".15.name", ""); // Unused
+
+ GregtechItemList.Casing_IsaMill_Casing.set(new ItemStack(this, 1, 0));
+ GregtechItemList.Casing_IsaMill_Pipe.set(new ItemStack(this, 1, 1));
+ GregtechItemList.Casing_IsaMill_Gearbox.set(new ItemStack(this, 1, 2));
+ GregtechItemList.Casing_ElementalDuplicator.set(new ItemStack(this, 1, 3));
+ GregtechItemList.Casing_Sparge_Tower_Exterior.set(new ItemStack(this, 1, 4));
+ }
+
+ @Override
+ public IIcon getIcon(final int aSide, final int aMeta) {
+ return getStaticIcon(aSide, aMeta);
+ }
+
+
+ public static IIcon getStaticIcon(final int aSide, final int aMeta) {
+ if ((aMeta >= 0) && (aMeta < 16)) {
+ switch (aMeta) {
+ case 0:
+ return TexturesGtBlock.TEXTURE_CASING_GRINDING_MILL.getIcon();
+ case 1:
+ return TexturesGtBlock.TEXTURE_PIPE_GRINDING_MILL.getIcon();
+ case 2:
+ return TexturesGtBlock.TEXTURE_GEARBOX_GRINDING_MILL.getIcon();
+ case 3:
+ return TexturesGtBlock.TEXTURE_TECH_PANEL_D.getIcon();
+ case 4:
+ return TexturesGtBlock.Casing_Machine_Metal_Sheet_H.getIcon();
+ }
+ }
+ return Textures.BlockIcons.RENDERING_ERROR.getIcon();
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public IIcon getIcon(final IBlockAccess aWorld, final int xCoord, final int yCoord, final int zCoord, final int aSide) {
+ final GregtechMetaCasingBlocks5 i = this;
+ return mGrinderOverlayHandler.handleCasingsGT(aWorld, xCoord, yCoord, zCoord, aSide, i);
+ }
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocksAbstract.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocksAbstract.java
new file mode 100644
index 0000000000..ea59eb50ba
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocksAbstract.java
@@ -0,0 +1,150 @@
+package gtPlusPlus.xmod.gregtech.common.blocks;
+
+import java.util.List;
+import java.util.Random;
+
+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.renderer.texture.IIconRegister;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.EnumCreatureType;
+import net.minecraft.init.Blocks;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemBlock;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.StatCollector;
+import net.minecraft.world.IBlockAccess;
+import net.minecraft.world.World;
+
+import gregtech.api.GregTech_API;
+import gregtech.api.util.GT_LanguageManager;
+import gregtech.common.blocks.GT_Block_Casings_Abstract;
+
+import gtPlusPlus.core.creative.AddToCreativeTab;
+
+public abstract class GregtechMetaCasingBlocksAbstract
+extends GT_Block_Casings_Abstract {
+ public GregtechMetaCasingBlocksAbstract(final Class<? extends ItemBlock> aItemClass, final String aName, final Material aMaterial) {
+ super(aItemClass, aName, aMaterial);
+ this.setStepSound(soundTypeMetal);
+ this.setCreativeTab(AddToCreativeTab.tabMachines);
+ GregTech_API.registerMachineBlock(this, -1);
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + "." + 32767 + ".name", "Any Sub Block of this");
+ }
+
+ @Override
+ public String getHarvestTool(final int aMeta) {
+ return "wrench";
+ }
+
+ @Override
+ public int getHarvestLevel(final int aMeta) {
+ return 2;
+ }
+
+ @Override
+ public float getBlockHardness(final World aWorld, final int aX, final int aY, final int aZ) {
+ return Blocks.iron_block.getBlockHardness(aWorld, aX, aY, aZ);
+ }
+
+ @Override
+ public float getExplosionResistance(final Entity aTNT) {
+ return Blocks.iron_block.getExplosionResistance(aTNT);
+ }
+
+ @Override
+ protected boolean canSilkHarvest() {
+ return false;
+ }
+
+ @Override
+ public void onBlockAdded(final World aWorld, final int aX, final int aY, final int aZ) {
+ if (GregTech_API.isMachineBlock(this, aWorld.getBlockMetadata(aX, aY, aZ))) {
+ GregTech_API.causeMachineUpdate(aWorld, aX, aY, aZ);
+ }
+ }
+
+ @Override
+ public String getUnlocalizedName() {
+ return this.mUnlocalizedName;
+ }
+
+ @Override
+ public String getLocalizedName() {
+ return StatCollector.translateToLocal(this.mUnlocalizedName + ".name");
+ }
+
+ @Override
+ public boolean canBeReplacedByLeaves(final IBlockAccess aWorld, final int aX, final int aY, final int aZ) {
+ return false;
+ }
+
+ @Override
+ public boolean isNormalCube(final IBlockAccess aWorld, final int aX, final int aY, final int aZ) {
+ return true;
+ }
+
+ @Override
+ public boolean renderAsNormalBlock() {
+ return true;
+ }
+
+ @Override
+ public boolean isOpaqueCube() {
+ return false;
+ }
+
+ @Override
+ public int getRenderBlockPass() {
+ return 0;
+ }
+
+ @Override
+ public void breakBlock(final World aWorld, final int aX, final int aY, final int aZ, final Block aBlock, final int aMetaData) {
+ if (GregTech_API.isMachineBlock(this, aWorld.getBlockMetadata(aX, aY, aZ))) {
+ GregTech_API.causeMachineUpdate(aWorld, aX, aY, aZ);
+ }
+ }
+
+ @Override
+ public boolean canCreatureSpawn(final EnumCreatureType type, final IBlockAccess world, final int x, final int y, final int z) {
+ return false;
+ }
+
+ @Override
+ public int damageDropped(final int par1) {
+ return par1;
+ }
+
+ @Override
+ public int getDamageValue(final World par1World, final int par2, final int par3, final int par4) {
+ return par1World.getBlockMetadata(par2, par3, par4);
+ }
+
+ @Override
+ public int quantityDropped(final Random par1Random) {
+ return 1;
+ }
+
+ @Override
+ public Item getItemDropped(final int par1, final Random par2Random, final int par3) {
+ return Item.getItemFromBlock(this);
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void registerBlockIcons(final IIconRegister aIconRegister) {
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void getSubBlocks(final Item aItem, final CreativeTabs par2CreativeTabs, final List aList) {
+ for (int i = 0; i < 16; i++) {
+ aList.add(new ItemStack(aItem, 1, i));
+ }
+ }
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingItems.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingItems.java
new file mode 100644
index 0000000000..de51cb164b
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingItems.java
@@ -0,0 +1,10 @@
+package gtPlusPlus.xmod.gregtech.common.blocks;
+
+import net.minecraft.block.Block;
+
+public class GregtechMetaCasingItems
+extends GregtechMetaItemCasingsAbstract {
+ public GregtechMetaCasingItems(final Block par1) {
+ super(par1);
+ }
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaItemCasings1.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaItemCasings1.java
new file mode 100644
index 0000000000..7fb344a4ec
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaItemCasings1.java
@@ -0,0 +1,36 @@
+package gtPlusPlus.xmod.gregtech.common.blocks;
+
+import java.util.List;
+
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+
+public class GregtechMetaItemCasings1
+extends GregtechMetaItemCasingsAbstract {
+ public GregtechMetaItemCasings1(final Block par1) {
+ super(par1);
+ }
+
+ @Override
+ public void addInformation(final ItemStack aStack, final EntityPlayer aPlayer, final List aList, final boolean aF3_H) {
+ super.addInformation(aStack, aPlayer, aList, aF3_H);
+ switch (this.getDamage(aStack)) {
+ case 0:
+ aList.add(this.mCasing_Centrifuge);
+ break;
+ case 1:
+ aList.add(this.mCasing_CokeOven);
+ break;
+ case 2:
+ aList.add(this.mCasing_CokeCoil1);
+ break;
+ case 3:
+ aList.add(this.mCasing_CokeCoil2);
+ break;
+ default:
+ aList.add(this.mCasing_CokeCoil2);
+ break;
+ }
+ }
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaItemCasingsAbstract.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaItemCasingsAbstract.java
new file mode 100644
index 0000000000..62e0f0acdf
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaItemCasingsAbstract.java
@@ -0,0 +1,61 @@
+package gtPlusPlus.xmod.gregtech.common.blocks;
+
+import java.util.List;
+
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemBlock;
+import net.minecraft.item.ItemStack;
+
+import gregtech.api.util.GT_LanguageManager;
+
+public abstract class GregtechMetaItemCasingsAbstract
+extends ItemBlock {
+
+ protected final String mCasing_Centrifuge = GT_LanguageManager.addStringLocalization("mu.centrifugecasing", "Warning! Standing in the Centrifuge not recommended");
+ protected final String mCasing_CokeOven = GT_LanguageManager.addStringLocalization("mu.cokeoven", "Sturdy and Strong");
+ protected final String mCasing_CokeCoil1 = GT_LanguageManager.addStringLocalization("mu.coil01tooltip", "Base Heating Capacity = 1350 Kelvin");
+ protected final String mCasing_CokeCoil2 = GT_LanguageManager.addStringLocalization("mu.coil02tooltip", "Base Heating Capacity = 2275 Kelvin");
+ protected final String mNoMobsToolTip = GT_LanguageManager.addStringLocalization("gt.nomobspawnsonthisblock", "Mobs cannot Spawn on this Block");
+ protected final String mNoTileEntityToolTip = GT_LanguageManager.addStringLocalization("gt.notileentityinthisblock", "This is NOT a TileEntity!");
+
+ public GregtechMetaItemCasingsAbstract(final Block par1) {
+ super(par1);
+ this.setMaxDamage(0);
+ this.setHasSubtypes(true);
+ //setCreativeTab(AddToCreativeTab.tabMachines);
+ }
+
+ @Override
+ public int getMetadata(final int aMeta) {
+ return aMeta;
+ }
+
+ @Override
+ public String getUnlocalizedName(final ItemStack aStack) {
+ return this.field_150939_a.getUnlocalizedName() + "." + this.getDamage(aStack);
+ }
+
+ @Override
+ public void addInformation(final ItemStack aStack, final EntityPlayer aPlayer, final List aList, final boolean aF3_H) {
+ super.addInformation(aStack, aPlayer, aList, aF3_H);
+ switch (this.getDamage(aStack)) {
+ case 0:
+ //aList.add(this.mCasing_Centrifuge);
+ break;
+ case 1:
+ //aList.add(this.mCasing_CokeOven);
+ break;
+ case 2:
+ //aList.add(this.mCasing_CokeCoil1);
+ break;
+ case 3:
+ //aList.add(this.mCasing_CokeCoil2);
+ break;
+ default:
+ break;
+ }
+ aList.add(this.mNoMobsToolTip);
+ aList.add(this.mNoTileEntityToolTip);
+ }
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaSpecialMachineCasings.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaSpecialMachineCasings.java
new file mode 100644
index 0000000000..8f5dff592a
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaSpecialMachineCasings.java
@@ -0,0 +1,81 @@
+package gtPlusPlus.xmod.gregtech.common.blocks;
+
+import java.util.List;
+
+import gregtech.api.enums.TAE;
+import gregtech.api.enums.Textures;
+import gregtech.api.objects.GT_CopiedBlockTexture;
+import gregtech.api.util.GT_LanguageManager;
+import gregtech.common.blocks.GT_Material_Casings;
+import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.IIcon;
+
+
+public class GregtechMetaSpecialMachineCasings extends GregtechMetaCasingBlocksAbstract {
+
+
+ public static class SpecialCasingItemBlock extends GregtechMetaCasingItems {
+
+ public SpecialCasingItemBlock(Block par1) {
+ super(par1);
+ }
+
+ @Override
+ public void addInformation(ItemStack aStack, EntityPlayer aPlayer, List aList, boolean aF3_H) {
+ int aMeta = aStack.getItemDamage();
+ if (aMeta < 10) {
+ //aList.add("Tier: "+GT_Values.VN[aMeta]);
+ }
+ super.addInformation(aStack, aPlayer, aList, aF3_H);
+ }
+ }
+
+ public GregtechMetaSpecialMachineCasings() {
+ super(SpecialCasingItemBlock.class, "gtplusplus.blockspecialcasings.2", GT_Material_Casings.INSTANCE);
+ for (byte i = 0; i < 16; i = (byte) (i + 1)) {
+ //TAE.registerTextures(new GT_CopiedBlockTexture(this, 6, i));
+ // Don't register these Textures, They already exist within vanilla GT. (May not exist in 5.08)
+ }
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".0.name", "Strong Bronze Machine Casing");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".1.name", "Sturdy Aluminium Machine Casing");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".2.name", "Vigorous Laurenium Machine Casing");
+ TAE.registerTexture(84, new GT_CopiedBlockTexture(this, 6, 2));
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".3.name", "Rugged Botmium Machine Casing");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".4.name", "");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".5.name", "");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".6.name", "");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".7.name", "");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".8.name", "");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".9.name", "");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".10.name", "");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".11.name", ""); // Unused
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".12.name", ""); // Unused
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".13.name", ""); // Unused
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".14.name", ""); // Unused
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".15.name", ""); // Unused
+
+ GregtechItemList.Casing_Machine_Custom_1.set(new ItemStack(this, 1, 0));
+ GregtechItemList.Casing_Machine_Custom_2.set(new ItemStack(this, 1, 1));
+ GregtechItemList.Casing_Machine_Custom_3.set(new ItemStack(this, 1, 2));
+ GregtechItemList.Casing_Machine_Custom_4.set(new ItemStack(this, 1, 3));
+ }
+
+ public IIcon getIcon(int aSide, int aMeta) {
+ switch (aMeta) {
+ case 0:
+ return Textures.BlockIcons.MACHINE_BRONZEPLATEDBRICKS.getIcon();
+ case 1:
+ return Textures.BlockIcons.MACHINE_CASING_FROST_PROOF.getIcon();
+ case 2:
+ return TexturesGtBlock.Casing_Material_Laurenium.getIcon();
+ case 3:
+ return Textures.BlockIcons.MACHINE_HEATPROOFCASING.getIcon();
+ }
+ return Textures.BlockIcons.RENDERING_ERROR.getIcon();
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaSpecialMultiCasings.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaSpecialMultiCasings.java
new file mode 100644
index 0000000000..5a5c923d10
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaSpecialMultiCasings.java
@@ -0,0 +1,103 @@
+package gtPlusPlus.xmod.gregtech.common.blocks;
+
+import java.util.List;
+
+import gregtech.api.enums.Textures;
+import gregtech.api.util.GT_LanguageManager;
+import gregtech.common.blocks.GT_Material_Casings;
+import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.IIcon;
+
+
+public class GregtechMetaSpecialMultiCasings extends GregtechMetaCasingBlocksAbstract {
+
+
+ public static class SpecialCasingItemBlock extends GregtechMetaCasingItems {
+
+ public SpecialCasingItemBlock(Block par1) {
+ super(par1);
+ }
+
+ @Override
+ public void addInformation(ItemStack aStack, EntityPlayer aPlayer, List aList, boolean aF3_H) {
+ int aMeta = aStack.getItemDamage();
+ if (aMeta < 10) {
+ //aList.add("Tier: "+GT_Values.VN[aMeta]);
+ }
+ super.addInformation(aStack, aPlayer, aList, aF3_H);
+ }
+ }
+
+ public GregtechMetaSpecialMultiCasings() {
+ super(SpecialCasingItemBlock.class, "gtplusplus.blockspecialcasings.1", GT_Material_Casings.INSTANCE);
+ for (byte i = 0; i < 16; i = (byte) (i + 1)) {
+ //TAE.registerTextures(new GT_CopiedBlockTexture(this, 6, i));
+ // Don't register these Textures, They already exist within vanilla GT. (May not exist in 5.08)
+ }
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".0.name", "Turbine Shaft");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".1.name", "Reinforced Steam Turbine Casing");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".2.name", "Reinforced HP Steam Turbine Casing");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".3.name", "Reinforced Gas Turbine Casing");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".4.name", "Reinforced Plasma Turbine Casing");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".5.name", "Tesla Containment Casing");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".6.name", "Structural Solar Casing");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".7.name", "Salt Containment Casing");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".8.name", "Thermally Insulated Casing");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".9.name", "Flotation Cell Casings");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".10.name", "Reinforced Engine Casing");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".11.name", ""); // Unused
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".12.name", ""); // Unused
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".13.name", ""); // Unused
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".14.name", ""); // Unused
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".15.name", ""); // Unused
+
+ GregtechItemList.Casing_Turbine_Shaft.set(new ItemStack(this, 1, 0));
+ GregtechItemList.Casing_Turbine_LP.set(new ItemStack(this, 1, 1));
+ GregtechItemList.Casing_Turbine_HP.set(new ItemStack(this, 1, 2));
+ GregtechItemList.Casing_Turbine_Gas.set(new ItemStack(this, 1, 3));
+ GregtechItemList.Casing_Turbine_Plasma.set(new ItemStack(this, 1, 4));
+ GregtechItemList.Casing_TeslaTower.set(new ItemStack(this, 1, 5));
+ GregtechItemList.Casing_SolarTower_Structural.set(new ItemStack(this, 1, 6));
+ GregtechItemList.Casing_SolarTower_SaltContainment.set(new ItemStack(this, 1, 7));
+ GregtechItemList.Casing_SolarTower_HeatContainment.set(new ItemStack(this, 1, 8));
+ GregtechItemList.Casing_Flotation_Cell.set(new ItemStack(this, 1, 9));
+ GregtechItemList.Casing_Reinforced_Engine_Casing.set(new ItemStack(this, 1, 10));
+ }
+
+ public IIcon getIcon(int aSide, int aMeta) {
+
+ switch (aMeta) {
+
+ case 0:
+ return TexturesGtBlock.Casing_Redox_1.getIcon();
+ case 1:
+ return Textures.BlockIcons.MACHINE_CASING_TURBINE.getIcon();
+ case 2:
+ return Textures.BlockIcons.MACHINE_CASING_CLEAN_STAINLESSSTEEL.getIcon();
+ case 3:
+ return Textures.BlockIcons.MACHINE_CASING_STABLE_TITANIUM.getIcon();
+ case 4:
+ return Textures.BlockIcons.MACHINE_CASING_ROBUST_TUNGSTENSTEEL.getIcon();
+ case 5:
+ return TexturesGtBlock.Casing_Material_RedSteel.getIcon();
+ case 6:
+ return TexturesGtBlock.Casing_Material_MaragingSteel.getIcon();
+ case 7:
+ return TexturesGtBlock.Casing_Material_Stellite.getIcon();
+ case 8:
+ return TexturesGtBlock.Casing_Machine_Simple_Top.getIcon();
+ case 9:
+ return TexturesGtBlock.TEXTURE_CASING_FLOTATION.getIcon();
+ case 10:
+ return TexturesGtBlock.Casing_Material_Talonite.getIcon();
+
+ }
+
+ return Textures.BlockIcons.RENDERING_ERROR.getIcon();
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaTieredCasingBlocks1.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaTieredCasingBlocks1.java
new file mode 100644
index 0000000000..cbd585e50d
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaTieredCasingBlocks1.java
@@ -0,0 +1,110 @@
+package gtPlusPlus.xmod.gregtech.common.blocks;
+
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.IIcon;
+import net.minecraft.world.IBlockAccess;
+
+import java.util.List;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import gregtech.api.enums.GT_Values;
+import gregtech.api.enums.TAE;
+import gregtech.api.enums.Textures;
+import gregtech.api.objects.GT_CopiedBlockTexture;
+import gregtech.api.util.GT_LanguageManager;
+import gregtech.api.util.GT_Utility;
+import gregtech.common.blocks.GT_Material_Casings;
+
+import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.CasingTextureHandler;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.storage.GregtechMetaTileEntity_PowerSubStationController;
+
+
+public class GregtechMetaTieredCasingBlocks1 extends GregtechMetaCasingBlocksAbstract {
+
+
+ public static class TieredCasingItemBlock extends GregtechMetaCasingItems {
+
+ public TieredCasingItemBlock(Block par1) {
+ super(par1);
+ }
+
+ @Override
+ public void addInformation(ItemStack aStack, EntityPlayer aPlayer, List aList, boolean aF3_H) {
+ int aMeta = aStack.getItemDamage();
+ if (aMeta < 10) {
+ aList.add("Tier: "+GT_Values.VN[aMeta]);
+ }
+ super.addInformation(aStack, aPlayer, aList, aF3_H);
+ }
+ }
+
+ public GregtechMetaTieredCasingBlocks1() {
+ super(TieredCasingItemBlock.class, "gtplusplus.blocktieredcasings.1", GT_Material_Casings.INSTANCE);
+ for (byte i = 0; i < 16; i = (byte) (i + 1)) {
+ //TAE.registerTextures(new GT_CopiedBlockTexture(this, 6, i));
+ // Don't register these Textures, Hatches should never need to use their Textures.
+ }
+ int aIndex = 0;
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".0.name", "Integral Encasement I");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".1.name", "Integral Encasement II");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".2.name", "Integral Encasement III");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".3.name", "Integral Encasement IV");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".4.name", "Integral Encasement V");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".5.name", "Integral Framework I");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".6.name", "Integral Framework II");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".7.name", "Integral Framework III");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".8.name", "Integral Framework IV");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".9.name", "Integral Framework V");
+ //GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".10.name", "Vacuum Casing");
+ //GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".11.name", "Turbodyne Casing");
+ //GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".12.name", "");
+ //GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".13.name", "");
+ //GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".14.name", "");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".15.name", "Placeholder Block");
+
+ GregtechItemList.GTPP_Casing_ULV.set(new ItemStack(this, 1, 0));
+ GregtechItemList.GTPP_Casing_LV.set(new ItemStack(this, 1, 1));
+ GregtechItemList.GTPP_Casing_MV.set(new ItemStack(this, 1, 2));
+ GregtechItemList.GTPP_Casing_HV.set(new ItemStack(this, 1, 3));
+ GregtechItemList.GTPP_Casing_EV.set(new ItemStack(this, 1, 4));
+ GregtechItemList.GTPP_Casing_IV.set(new ItemStack(this, 1, 5));
+ GregtechItemList.GTPP_Casing_LuV.set(new ItemStack(this, 1, 6));
+ GregtechItemList.GTPP_Casing_ZPM.set(new ItemStack(this, 1, 7));
+ GregtechItemList.GTPP_Casing_UV.set(new ItemStack(this, 1, 8));
+ GregtechItemList.GTPP_Casing_MAX.set(new ItemStack(this, 1, 9));
+
+ //GregtechItemList.Casing_LV.set(new ItemStack(this, 1, 10));
+ //GregtechItemList.Casing_LV.set(new ItemStack(this, 1, 11));
+ //GregtechItemList.Casing_LV.set(new ItemStack(this, 1, 12));
+ //GregtechItemList.Casing_LV.set(new ItemStack(this, 1, 13));
+ //GregtechItemList.Casing_LV.set(new ItemStack(this, 1, 14));
+ //GregtechItemList.Casing_LV.set(new ItemStack(this, 1, 15));
+ }
+
+ public IIcon getIcon(int aSide, int aMeta) {
+ if (aMeta < 10) {
+ return TexturesGtBlock.TIERED_MACHINE_HULLS[aMeta].getIcon();
+ }
+ switch (aMeta) {
+ case 10:
+ return Textures.BlockIcons.RENDERING_ERROR.getIcon();
+ case 11:
+ return Textures.BlockIcons.RENDERING_ERROR.getIcon();
+ case 12:
+ return Textures.BlockIcons.RENDERING_ERROR.getIcon();
+ case 13:
+ return Textures.BlockIcons.RENDERING_ERROR.getIcon();
+ case 14:
+ return Textures.BlockIcons.RENDERING_ERROR.getIcon();
+ case 15:
+ return Textures.BlockIcons.RENDERING_ERROR.getIcon();
+ }
+ return Textures.BlockIcons.RENDERING_ERROR.getIcon();
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/fluid/GregtechFluidHandler.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/fluid/GregtechFluidHandler.java
new file mode 100644
index 0000000000..3e4b9a3fee
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/fluid/GregtechFluidHandler.java
@@ -0,0 +1,111 @@
+package gtPlusPlus.xmod.gregtech.common.blocks.fluid;
+
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.fluids.FluidRegistry;
+import gregtech.api.enums.OrePrefixes;
+import gregtech.api.util.GT_OreDictUnificator;
+
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.lib.LoadedMods;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.minecraft.FluidUtils;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials;
+
+public class GregtechFluidHandler {
+
+ protected static int cellID = 0;
+
+ public static void run(){
+ start();
+ }
+
+ private static void start(){
+
+ /* Meta_GT_Proxy.addFluid("lubricant", "Lubricant", Materials.Lubricant, 1, 295, GT_OreDictUnificator.get(OrePrefixes.cell, Materials.Lubricant, 1L), ItemUtils.getEmptyCell(), 1000);
+ Meta_GT_Proxy.addFluid("creosote", "Creosote Oil", Materials.Creosote, 1, 295, GT_OreDictUnificator.get(OrePrefixes.cell, Materials.Creosote, 1L), ItemUtils.getEmptyCell(), 1000);
+ Meta_GT_Proxy.addFluid("seedoil", "Seed Oil", Materials.SeedOil, 1, 295, GT_OreDictUnificator.get(OrePrefixes.cell, Materials.SeedOil, 1L), ItemUtils.getEmptyCell(), 1000);
+ Meta_GT_Proxy.addFluid("fishoil", "Fish Oil", Materials.FishOil, 1, 295, GT_OreDictUnificator.get(OrePrefixes.cell, Materials.FishOil, 1L), ItemUtils.getEmptyCell(), 1000);
+ Meta_GT_Proxy.addFluid("oil", "Oil", Materials.Oil, 1, 295, GT_OreDictUnificator.get(OrePrefixes.cell, Materials.Oil, 1L), ItemUtils.getEmptyCell(), 1000);
+ Meta_GT_Proxy.addFluid("fuel", "Diesel", Materials.Fuel, 1, 295, GT_OreDictUnificator.get(OrePrefixes.cell, Materials.Fuel, 1L), ItemUtils.getEmptyCell(), 1000);
+ Meta_GT_Proxy.addFluid("for.honey", "Honey", Materials.Honey, 1, 295, GT_OreDictUnificator.get(OrePrefixes.cell, Materials.Honey, 1L), ItemUtils.getEmptyCell(), 1000);
+ Meta_GT_Proxy.addFluid("biomass", "Biomass", Materials.Biomass, 1, 295, GT_OreDictUnificator.get(OrePrefixes.cell, Materials.Biomass, 1L), ItemUtils.getEmptyCell(), 1000);
+ Meta_GT_Proxy.addFluid("bioethanol", "Bio Ethanol", Materials.Ethanol, 1, 295, GT_OreDictUnificator.get(OrePrefixes.cell, Materials.Ethanol, 1L), ItemUtils.getEmptyCell(), 1000);
+ Meta_GT_Proxy.addFluid("sulfuricacid", "Sulfuric Acid", Materials.SulfuricAcid, 1, 295, GT_OreDictUnificator.get(OrePrefixes.cell, Materials.SulfuricAcid, 1L), ItemUtils.getEmptyCell(), 1000);
+ Meta_GT_Proxy.addFluid("milk", "Milk", Materials.Milk, 1, 290, GT_OreDictUnificator.get(OrePrefixes.cell, Materials.Milk, 1L), ItemUtils.getEmptyCell(), 1000);
+ Meta_GT_Proxy.addFluid("mcguffium", "Mc Guffium 239", Materials.McGuffium239, 1, 295, GT_OreDictUnificator.get(OrePrefixes.cell, Materials.McGuffium239, 1L), ItemUtils.getEmptyCell(), 1000);
+ Meta_GT_Proxy.addFluid("glue", "Glue", Materials.Glue, 1, 295, GT_OreDictUnificator.get(OrePrefixes.cell, Materials.Glue, 1L), ItemUtils.getEmptyCell(), 1000);
+ */
+
+ if (!LoadedMods.ThermalFoundation){
+
+ Logger.INFO("Adding in our own GT versions of Thermal Foundation Fluids if they do not already exist.");
+ if (!FluidRegistry.isFluidRegistered("cryotheum")) {
+ FluidUtils.addGtFluid("cryotheum", "Gelid Cryotheum", GT_Materials.Cryotheum, 4, -1200, GT_OreDictUnificator.get(OrePrefixes.cell, GT_Materials.Cryotheum, 1L), ItemUtils.getEmptyCell(), 1000);
+ }
+ if (!FluidRegistry.isFluidRegistered("pyrotheum")) {
+ FluidUtils.addGtFluid("pyrotheum", "Blazing Pyrotheum", GT_Materials.Pyrotheum, 4, 4000, GT_OreDictUnificator.get(OrePrefixes.cell, GT_Materials.Pyrotheum, 1L), ItemUtils.getEmptyCell(), 1000);
+ }
+ if (!FluidRegistry.isFluidRegistered("ender")) {
+ FluidUtils.addGtFluid("ender", "Resonant Ender", GT_Materials.Ender, 4, 4000, GT_OreDictUnificator.get(OrePrefixes.cell, GT_Materials.Ender, 1L), ItemUtils.getEmptyCell(), 1000);
+ }
+
+ }
+
+ if (LoadedMods.IndustrialCraft2){
+ Logger.INFO("Adding in GT Fluids for various nuclear related content.");
+
+ FluidUtils.addGtFluid("hydrofluoricAcid", "Industrial Strength Hydrofluoric Acid", GT_Materials.HydrofluoricAcid, 1, 120, GT_OreDictUnificator.get(OrePrefixes.cell, GT_Materials.HydrofluoricAcid, 1L), ItemUtils.getEmptyCell(), 1000, false);
+ generateIC2FluidCell("HydrofluoricAcid");
+
+ FluidUtils.generateFluidNoPrefix("SulfurDioxide", "High Quality Sulfur Dioxide", 263, GT_Materials.SulfurDioxide.mRGBa);
+
+ FluidUtils.addGtFluid("sulfurousAcid", "Sulfurous Acid", GT_Materials.SulfurousAcid, 4, 75, GT_OreDictUnificator.get(OrePrefixes.cell, GT_Materials.SulfurousAcid, 1L), ItemUtils.getEmptyCell(), 1000, false);
+ generateIC2FluidCell("SulfurousAcid");
+
+ FluidUtils.addGtFluid("sulfuricApatite", "Sulfuric Apatite Mix", GT_Materials.SulfuricApatite, 4, 500, GT_OreDictUnificator.get(OrePrefixes.cell, GT_Materials.SulfuricApatite, 1L), ItemUtils.getEmptyCell(), 1000, false);
+ generateIC2FluidCell("SulfuricApatite");
+
+
+ //Check for IHL Hydrogen Chloride
+ if (!LoadedMods.IHL || (ItemUtils.getItemStackOfAmountFromOreDict("cellHydrogenChloride", 1) == null)){
+ if (FluidUtils.getFluidStack("hydrogenchloride", 1) == null){
+ if (LoadedMods.IHL){
+ Logger.INFO("IHL Loaded but hydrogen chloride could not be found for some reason. How about we add our own.");
+ }
+ else {
+ Logger.INFO("No Suitable versions of Hydrogen Chloride available, adding our own.");
+ }
+ FluidUtils.addGtFluid("hydrogenChloride", "Industrial Strength Hydrogen Chloride", GT_Materials.HydrogenChloride, 4, 75, GT_OreDictUnificator.get(OrePrefixes.cell, GT_Materials.HydrogenChloride, 1L), ItemUtils.getEmptyCell(), 1000, false);
+ generateIC2FluidCell("HydrogenChloride");
+ }
+ }
+
+
+ FluidUtils.addGtFluid("sulfuricLithium", "Sulfuric Lithium Mix", GT_Materials.SulfuricLithium, 4, 280, GT_OreDictUnificator.get(OrePrefixes.cell, GT_Materials.SulfuricLithium, 1L), ItemUtils.getEmptyCell(), 1000, false);
+ generateIC2FluidCell("SulfuricLithium");
+
+ FluidUtils.addGtFluid("lithiumHydroxide", "Lithium Hydroxide", GT_Materials.LithiumHydroxide, 4, 500, GT_OreDictUnificator.get(OrePrefixes.cell, GT_Materials.LithiumHydroxide, 1L), ItemUtils.getEmptyCell(), 1000, false);
+ generateIC2FluidCell("LithiumHydroxide");
+
+
+ }
+ }
+
+ private static ItemStack generateIC2FluidCell(final String fluidNameWithCaps){
+ Logger.INFO("Adding a Cell for "+fluidNameWithCaps);
+ if (LoadedMods.IndustrialCraft2 && !LoadedMods.IndustrialCraft2Classic){
+ return Utils.createInternalNameAndFluidCell(fluidNameWithCaps);
+ }
+ return null;
+ }
+
+ private static ItemStack generateIC2FluidCellNoOreDict(final String fluidNameWithCaps){
+ Logger.INFO("Adding a Cell for "+fluidNameWithCaps);
+ if (LoadedMods.IndustrialCraft2 && !LoadedMods.IndustrialCraft2Classic){
+ return Utils.createInternalNameAndFluidCellNoOreDict(fluidNameWithCaps);
+ }
+ return null;
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler.java
new file mode 100644
index 0000000000..123df8fe0f
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler.java
@@ -0,0 +1,82 @@
+package gtPlusPlus.xmod.gregtech.common.blocks.textures;
+
+import net.minecraft.util.IIcon;
+import net.minecraft.world.IBlockAccess;
+
+import gregtech.api.enums.Textures;
+
+import gtPlusPlus.xmod.gregtech.common.blocks.GregtechMetaCasingBlocks;
+
+public class CasingTextureHandler {
+
+ //private static final TexturesGregtech59 gregtech59 = new TexturesGregtech59();
+ //private static final TexturesGregtech58 gregtech58 = new TexturesGregtech58();
+ private static final TexturesCentrifugeMultiblock gregtechX = new TexturesCentrifugeMultiblock();
+
+ public static IIcon getIcon(final int aSide, final int aMeta) { //Texture ID's. case 0 == ID[57]
+ if ((aMeta >= 0) && (aMeta < 16)) {
+ switch (aMeta) {
+ //Centrifuge
+ case 0:
+ return TexturesGtBlock.Casing_Material_Centrifuge.getIcon();
+ //Coke Oven Frame
+ case 1:
+ return TexturesGtBlock.Casing_Material_Tantalloy61.getIcon();
+ //Coke Oven Casing Tier 1
+ case 2:
+ return Textures.BlockIcons.MACHINE_CASING_FIREBOX_BRONZE.getIcon();
+ //Coke Oven Casing Tier 2
+ case 3:
+ return Textures.BlockIcons.MACHINE_CASING_FIREBOX_STEEL.getIcon();
+ //Material Press Casings
+ case 4:
+ return Textures.BlockIcons.MACHINE_CASING_STABLE_TITANIUM.getIcon();
+ //Electrolyzer Casings
+ case 5:
+ return TexturesGtBlock.Casing_Material_Potin.getIcon();
+ //Broken Blue Fusion Casings
+ case 6:
+ return TexturesGtBlock.Casing_Material_MaragingSteel.getIcon();
+ //Maceration Stack Casings
+ case 7:
+ return TexturesGtBlock.Casing_Material_Tumbaga.getIcon();
+ //Broken Pink Fusion Casings
+ case 8:
+ return TexturesGtBlock.TEXTURE_ORGANIC_PANEL_A_GLOWING.getIcon();
+ //Matter Fabricator Casings
+ case 9:
+ return TexturesGtBlock.TEXTURE_METAL_PANEL_F.getIcon();
+ //Iron Blast Fuance Textures
+ case 10:
+ return TexturesGtBlock.Casing_Machine_Simple_Top.getIcon();
+ //Multitank Exterior Casing
+ case 11:
+ return TexturesGtBlock.Casing_Material_Grisium.getIcon();
+ //Reactor Casing I
+ case 12:
+ return TexturesGtBlock.Casing_Material_Stellite.getIcon();
+ //Reactor Casing II
+ case 13:
+ return TexturesGtBlock.Casing_Material_Zeron100.getIcon();
+ case 14:
+ return TexturesGtBlock.Casing_Staballoy_Firebox.getIcon();
+ case 15:
+ return TexturesGtBlock.Casing_Material_ZirconiumCarbide.getIcon();
+
+ default:
+ return Textures.BlockIcons.MACHINE_CASING_RADIOACTIVEHAZARD.getIcon();
+
+ }
+ }
+ return Textures.BlockIcons.MACHINE_CASING_GEARBOX_TUNGSTENSTEEL.getIcon();
+ }
+
+
+ public static IIcon handleCasingsGT(final IBlockAccess aWorld, final int xCoord, final int yCoord, final int zCoord, final int aSide, final GregtechMetaCasingBlocks thisBlock) {
+ /*if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK){
+ return gregtech59.handleCasingsGT59(aWorld, xCoord, yCoord, zCoord, aSide, thisBlock);
+ }
+ return gregtech58.handleCasingsGT58(aWorld, xCoord, yCoord, zCoord, aSide, thisBlock);*/
+ return gregtechX.handleCasingsGT(aWorld, xCoord, yCoord, zCoord, aSide, thisBlock);
+ }
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler2.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler2.java
new file mode 100644
index 0000000000..c980997c64
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler2.java
@@ -0,0 +1,57 @@
+package gtPlusPlus.xmod.gregtech.common.blocks.textures;
+
+import net.minecraft.util.IIcon;
+
+import gregtech.api.enums.Textures;
+
+public class CasingTextureHandler2 {
+
+ public static IIcon getIcon(final int aSide, final int aMeta) { //Texture ID's. case 0 == ID[57]
+ if ((aMeta >= 0) && (aMeta < 16)) {
+ switch (aMeta) {
+ case 0:
+ return TexturesGtBlock.Casing_Material_RedSteel.getIcon();
+ case 1:
+ return TexturesGtBlock.Casing_Material_HastelloyX.getIcon();
+ case 2:
+ return TexturesGtBlock.Casing_Material_HastelloyN.getIcon();
+ case 3:
+ return TexturesGtBlock.Casing_Material_Fluid_IncoloyDS.getIcon();
+ case 4:
+ return TexturesGtBlock.Casing_Material_Grisium.getIcon();
+ case 5:
+ return TexturesGtBlock.Casing_Machine_Metal_Panel_A.getIcon();
+ case 6:
+ return TexturesGtBlock.Casing_Machine_Metal_Grate_A.getIcon();
+ case 7:
+ return TexturesGtBlock.Casing_Redox_1.getIcon();
+ case 8:
+ return TexturesGtBlock.Casing_Machine_Metal_Sheet_A.getIcon();
+ case 9:
+ return TexturesGtBlock.Overlay_Machine_Cyber_A.getIcon();
+ case 10:
+ return Textures.BlockIcons.MACHINE_CASING_RADIATIONPROOF.getIcon();
+ case 11:
+ return TexturesGtBlock.Casing_Material_Tantalloy61.getIcon();
+ case 12:
+ return TexturesGtBlock.Casing_Machine_Simple_Top.getIcon();
+ case 13:
+ if (aSide <2) {
+ return TexturesGtBlock.TEXTURE_TECH_A.getIcon();
+ }
+ else {
+ return TexturesGtBlock.TEXTURE_TECH_B.getIcon();
+ }
+ case 14:
+ return Textures.BlockIcons.RENDERING_ERROR.getIcon();
+ case 15:
+ return TexturesGtBlock.Casing_Machine_Acacia_Log.getIcon();
+ default:
+ return TexturesGtBlock.Overlay_UU_Matter.getIcon();
+
+ }
+ }
+ return TexturesGtBlock._PlaceHolder.getIcon();
+ }
+
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler3.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler3.java
new file mode 100644
index 0000000000..019a432013
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler3.java
@@ -0,0 +1,68 @@
+package gtPlusPlus.xmod.gregtech.common.blocks.textures;
+
+import net.minecraft.util.IIcon;
+import gtPlusPlus.xmod.gregtech.common.blocks.GregtechMetaCasingBlocks3;
+
+public class CasingTextureHandler3 {
+
+ public static IIcon getIcon(final int aSide, final int aMeta) { //Texture ID's. case 0 == ID[57]
+ if ((aMeta >= 0) && (aMeta < 16)) {
+ switch (aMeta) {
+ case 0:
+ //Aquatic Casing
+ return TexturesGtBlock.TEXTURE_METAL_PANEL_B.getIcon();
+ case 1:
+ //Inconel Reinforced Casing
+ return TexturesGtBlock.TEXTURE_METAL_PANEL_D.getIcon();
+ case 2:
+ //Multi-Use Casing
+ return TexturesGtBlock.TEXTURE_METAL_PANEL_C.getIcon();
+ case 3:
+ //Trinium Plated Mining Platform Casing
+ return TexturesGtBlock.Casing_Trinium_Naquadah_Vent.getIcon();
+ case 4:
+ //Vanadium Redox IV
+ return TexturesGtBlock.Casing_Redox_2.getIcon();
+ case 5:
+ //Vanadium Redox LuV
+ return TexturesGtBlock.Casing_Redox_3.getIcon();
+ case 6:
+ //Vanadium Redox ZPM
+ return TexturesGtBlock.Casing_Redox_4.getIcon();
+ case 7:
+ //Vanadium Redox UV
+ return TexturesGtBlock.Casing_Redox_5.getIcon();
+ case 8:
+ //Vanadium Redox MAX
+ return TexturesGtBlock.Casing_Redox_6.getIcon();
+ case 9:
+ //Amazon Warehouse Casing
+ return TexturesGtBlock.TEXTURE_CASING_AMAZON.getIcon();
+ case 10:
+ //Adv. Vac. Freezer
+ return TexturesGtBlock.TEXTURE_CASING_ADVANCED_CRYOGENIC.getIcon();
+ case 11:
+ //Adv. EBF
+ return TexturesGtBlock.TEXTURE_CASING_ADVANCED_VOLCNUS.getIcon();
+ case 12:
+ return TexturesGtBlock.TEXTURE_CASING_FUSION_COIL_II.getIcon();
+ case 13:
+ return TexturesGtBlock.TEXTURE_CASING_FUSION_COIL_II_INNER.getIcon();
+ case 14:
+ return TexturesGtBlock.TEXTURE_CASING_FUSION_CASING_ULTRA.getIcon();
+ case 15:
+ return TexturesGtBlock.TEXTURE_MAGIC_PANEL_A.getIcon();
+
+ default:
+ return TexturesGtBlock._PlaceHolder.getIcon();
+
+ }
+ }
+ return TexturesGtBlock._PlaceHolder.getIcon();
+ }
+
+ static {
+ GregtechMetaCasingBlocks3.mConnectedMachineTextures = true;
+ }
+
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesCentrifugeMultiblock.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesCentrifugeMultiblock.java
new file mode 100644
index 0000000000..6326dd2c29
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesCentrifugeMultiblock.java
@@ -0,0 +1,166 @@
+package gtPlusPlus.xmod.gregtech.common.blocks.textures;
+
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gtPlusPlus.xmod.gregtech.common.blocks.GregtechMetaCasingBlocks;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.CustomIcon;
+import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.GregtechMetaTileEntity_IndustrialCentrifuge;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.IIcon;
+import net.minecraft.world.IBlockAccess;
+
+public class TexturesCentrifugeMultiblock {
+
+ private static CustomIcon GT8_1_Active = new CustomIcon("iconsets/LARGECENTRIFUGE_ACTIVE1");
+ private static CustomIcon GT8_1 = new CustomIcon("iconsets/LARGECENTRIFUGE1");
+ private static CustomIcon GT8_2_Active = new CustomIcon("iconsets/LARGECENTRIFUGE_ACTIVE2");
+ private static CustomIcon GT8_2 = new CustomIcon("iconsets/LARGECENTRIFUGE2");
+ private static CustomIcon GT8_3_Active = new CustomIcon("iconsets/LARGECENTRIFUGE_ACTIVE3");
+ private static CustomIcon GT8_3 = new CustomIcon("iconsets/LARGECENTRIFUGE3");
+ private static CustomIcon GT8_4_Active = new CustomIcon("iconsets/LARGECENTRIFUGE_ACTIVE4");
+ private static CustomIcon GT8_4 = new CustomIcon("iconsets/LARGECENTRIFUGE4");
+ private static CustomIcon GT8_5_Active = new CustomIcon("iconsets/LARGECENTRIFUGE_ACTIVE5");
+ private static CustomIcon GT8_5 = new CustomIcon("iconsets/LARGECENTRIFUGE5");
+ private static CustomIcon GT8_6_Active = new CustomIcon("iconsets/LARGECENTRIFUGE_ACTIVE6");
+ private static CustomIcon GT8_6 = new CustomIcon("iconsets/LARGECENTRIFUGE6");
+ private static CustomIcon GT8_7_Active = new CustomIcon("iconsets/LARGECENTRIFUGE_ACTIVE7");
+ private static CustomIcon GT8_7 = new CustomIcon("iconsets/LARGECENTRIFUGE7");
+ private static CustomIcon GT8_8_Active = new CustomIcon("iconsets/LARGECENTRIFUGE_ACTIVE8");
+ private static CustomIcon GT8_8 = new CustomIcon("iconsets/LARGECENTRIFUGE8");
+ private static CustomIcon GT8_9_Active = new CustomIcon("iconsets/LARGECENTRIFUGE_ACTIVE9");
+ private static CustomIcon GT8_9 = new CustomIcon("iconsets/LARGECENTRIFUGE9");
+
+ private static CustomIcon frontFace_0 = (GT8_1);
+ private static CustomIcon frontFaceActive_0 = (GT8_1_Active);
+ private static CustomIcon frontFace_1 = (GT8_2);
+ private static CustomIcon frontFaceActive_1 = (GT8_2_Active);
+ private static CustomIcon frontFace_2 = (GT8_3);
+ private static CustomIcon frontFaceActive_2 = (GT8_3_Active);
+ private static CustomIcon frontFace_3 = (GT8_4);
+ private static CustomIcon frontFaceActive_3 = (GT8_4_Active);
+ private static CustomIcon frontFace_4 = (GT8_5);
+ private static CustomIcon frontFaceActive_4 = (GT8_5_Active);
+ private static CustomIcon frontFace_5 = (GT8_6);
+ private static CustomIcon frontFaceActive_5 = (GT8_6_Active);
+ private static CustomIcon frontFace_6 = (GT8_7);
+ private static CustomIcon frontFaceActive_6 = (GT8_7_Active);
+ private static CustomIcon frontFace_7 = (GT8_8);
+ private static CustomIcon frontFaceActive_7 = (GT8_8_Active);
+ private static CustomIcon frontFace_8 = (GT8_9);
+ private static CustomIcon frontFaceActive_8 = (GT8_9_Active);
+
+ CustomIcon[] CENTRIFUGE = new CustomIcon[]{
+ frontFace_0,
+ frontFace_1,
+ frontFace_2,
+ frontFace_3,
+ frontFace_4,
+ frontFace_5,
+ frontFace_6,
+ frontFace_7,
+ frontFace_8
+ };
+
+ CustomIcon[] CENTRIFUGE_ACTIVE = new CustomIcon[]{
+ frontFaceActive_0,
+ frontFaceActive_1,
+ frontFaceActive_2,
+ frontFaceActive_3,
+ frontFaceActive_4,
+ frontFaceActive_5,
+ frontFaceActive_6,
+ frontFaceActive_7,
+ frontFaceActive_8
+ };
+
+ public IIcon handleCasingsGT(final IBlockAccess aWorld, final int xCoord, final int yCoord, final int zCoord, final int aSide, final GregtechMetaCasingBlocks thisBlock) {
+ return this.handleCasingsGT58(aWorld, xCoord, yCoord, zCoord, aSide, thisBlock);
+ }
+
+ private static int isCentrifugeControllerWithSide(IBlockAccess aWorld, int aX, int aY, int aZ, int aSide) {
+ TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ if (!(tTileEntity instanceof IGregTechTileEntity)) return 0;
+ IGregTechTileEntity tTile = (IGregTechTileEntity) tTileEntity;
+ if (tTile.getMetaTileEntity() instanceof GregtechMetaTileEntity_IndustrialCentrifuge && tTile.getFrontFacing() == aSide)
+ return tTile.isActive() ? 1 : 2;
+ return 0;
+ }
+
+ public IIcon handleCasingsGT58(final IBlockAccess aWorld, final int xCoord, final int yCoord, final int zCoord, final int aSide, final GregtechMetaCasingBlocks thisBlock) {
+ final int tMeta = aWorld.getBlockMetadata(xCoord, yCoord, zCoord);
+ if (tMeta != 0) {
+ return CasingTextureHandler.getIcon(aSide, tMeta);
+ }
+ int tInvertLeftRightMod = aSide % 2 * 2 - 1;
+ switch (aSide / 2) {
+ case 0:
+ for (int i = -1; i < 2; i++) {
+ for (int j = -1; j < 2; j++) {
+ if (i == 0 && j == 0)
+ continue;
+ if (isCentrifugeControllerWithSide(aWorld, xCoord + j, yCoord, zCoord + i, aSide) != 0) {
+ IMetaTileEntity tMetaTileEntity = ((IGregTechTileEntity) aWorld.getTileEntity(xCoord + j, yCoord, zCoord + i)).getMetaTileEntity();
+ return getIconByIndex(tMetaTileEntity, 4 - i * 3 - j);
+ }
+ }
+ }
+ break;
+ case 1:
+ for (int i = -1; i < 2; i++) {
+ for (int j = -1; j < 2; j++) {
+ if (i == 0 && j == 0)
+ continue;
+ if (isCentrifugeControllerWithSide(aWorld, xCoord + j, yCoord + i, zCoord, aSide) != 0) {
+ IMetaTileEntity tMetaTileEntity = ((IGregTechTileEntity) aWorld.getTileEntity(xCoord + j, yCoord + i, zCoord)).getMetaTileEntity();
+ return getIconByIndex(tMetaTileEntity, 4 + i * 3 - j * tInvertLeftRightMod);
+ }
+ }
+ }
+ break;
+ case 2:
+ for (int i = -1; i < 2; i++) {
+ for (int j = -1; j < 2; j++) {
+ if (i == 0 && j == 0)
+ continue;
+ if (isCentrifugeControllerWithSide(aWorld, xCoord, yCoord + i, zCoord + j, aSide) != 0) {
+ IMetaTileEntity tMetaTileEntity = ((IGregTechTileEntity) aWorld.getTileEntity(xCoord, yCoord + i, zCoord + j)).getMetaTileEntity();
+ return getIconByIndex(tMetaTileEntity, 4 + i * 3 + j * tInvertLeftRightMod);
+ }
+ }
+ }
+ break;
+ }
+ return TexturesGtBlock.Casing_Material_Centrifuge.getIcon();
+ }
+
+ public boolean isCentrifugeRunning(IMetaTileEntity aTile) {
+ if (aTile == null) {
+ return false;
+ }
+ else {
+ return aTile.getBaseMetaTileEntity().isActive();
+ }
+
+
+ }
+
+ public boolean isUsingAnimatedTexture(IMetaTileEntity aMetaTileEntity) {
+ if (aMetaTileEntity != null) {
+ if (aMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge) {
+ return ((GregtechMetaTileEntity_IndustrialCentrifuge) aMetaTileEntity).usingAnimations();
+ }
+ }
+ return false;
+ }
+
+ public IIcon getIconByIndex(IMetaTileEntity aMetaTileEntity, int aIndex) {
+ if (isUsingAnimatedTexture(aMetaTileEntity)) {
+ if (isCentrifugeRunning(aMetaTileEntity)) {
+ return this.CENTRIFUGE_ACTIVE[aIndex].getIcon();
+ }
+ }
+ return this.CENTRIFUGE[aIndex].getIcon();
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGregtech58.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGregtech58.java
new file mode 100644
index 0000000000..e772f0f48c
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGregtech58.java
@@ -0,0 +1,443 @@
+package gtPlusPlus.xmod.gregtech.common.blocks.textures;
+
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.IIcon;
+import net.minecraft.world.IBlockAccess;
+
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+
+import gtPlusPlus.xmod.gregtech.common.blocks.GregtechMetaCasingBlocks;
+import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.GregtechMetaTileEntity_IndustrialCentrifuge;
+
+public class TexturesGregtech58 {
+
+ private static Textures.BlockIcons.CustomIcon GT8_1_Active = new Textures.BlockIcons.CustomIcon("iconsets/LARGETURBINE_ACTIVE1");
+ private static Textures.BlockIcons.CustomIcon GT8_1 = new Textures.BlockIcons.CustomIcon("iconsets/LARGETURBINE1");
+ private static Textures.BlockIcons.CustomIcon GT8_2_Active = new Textures.BlockIcons.CustomIcon("iconsets/LARGETURBINE_ACTIVE2");
+ private static Textures.BlockIcons.CustomIcon GT8_2 = new Textures.BlockIcons.CustomIcon("iconsets/LARGETURBINE2");
+ private static Textures.BlockIcons.CustomIcon GT8_3_Active = new Textures.BlockIcons.CustomIcon("iconsets/LARGETURBINE_ACTIVE3");
+ private static Textures.BlockIcons.CustomIcon GT8_3 = new Textures.BlockIcons.CustomIcon("iconsets/LARGETURBINE3");
+ private static Textures.BlockIcons.CustomIcon GT8_4_Active = new Textures.BlockIcons.CustomIcon("iconsets/LARGETURBINE_ACTIVE4");
+ private static Textures.BlockIcons.CustomIcon GT8_4 = new Textures.BlockIcons.CustomIcon("iconsets/LARGETURBINE4");
+ private static Textures.BlockIcons.CustomIcon GT8_5_Active = new Textures.BlockIcons.CustomIcon("iconsets/LARGETURBINE_ACTIVE5");
+ private static Textures.BlockIcons.CustomIcon GT8_5 = new Textures.BlockIcons.CustomIcon("iconsets/LARGETURBINE5");
+ private static Textures.BlockIcons.CustomIcon GT8_6_Active = new Textures.BlockIcons.CustomIcon("iconsets/LARGETURBINE_ACTIVE6");
+ private static Textures.BlockIcons.CustomIcon GT8_6 = new Textures.BlockIcons.CustomIcon("iconsets/LARGETURBINE6");
+ private static Textures.BlockIcons.CustomIcon GT8_7_Active = new Textures.BlockIcons.CustomIcon("iconsets/LARGETURBINE_ACTIVE7");
+ private static Textures.BlockIcons.CustomIcon GT8_7 = new Textures.BlockIcons.CustomIcon("iconsets/LARGETURBINE7");
+ private static Textures.BlockIcons.CustomIcon GT8_8_Active = new Textures.BlockIcons.CustomIcon("iconsets/LARGETURBINE_ACTIVE8");
+ private static Textures.BlockIcons.CustomIcon GT8_8 = new Textures.BlockIcons.CustomIcon("iconsets/LARGETURBINE8");
+ private static Textures.BlockIcons.CustomIcon GT8_9_Active = new Textures.BlockIcons.CustomIcon("iconsets/LARGETURBINE_ACTIVE9");
+ private static Textures.BlockIcons.CustomIcon GT8_9 = new Textures.BlockIcons.CustomIcon("iconsets/LARGETURBINE9");
+
+ private static Textures.BlockIcons.CustomIcon frontFace_0 = (GT8_1);
+ private static Textures.BlockIcons.CustomIcon frontFaceActive_0 = (GT8_1_Active);
+ private static Textures.BlockIcons.CustomIcon frontFace_1 = (GT8_2);
+ private static Textures.BlockIcons.CustomIcon frontFaceActive_1 = (GT8_2_Active);
+ private static Textures.BlockIcons.CustomIcon frontFace_2 = (GT8_3);
+ private static Textures.BlockIcons.CustomIcon frontFaceActive_2 = (GT8_3_Active);
+ private static Textures.BlockIcons.CustomIcon frontFace_3 = (GT8_4);
+ private static Textures.BlockIcons.CustomIcon frontFaceActive_3 = (GT8_4_Active);
+ private static Textures.BlockIcons.CustomIcon frontFace_4 = (GT8_5);
+ private static Textures.BlockIcons.CustomIcon frontFaceActive_4 = (GT8_5_Active);
+ private static Textures.BlockIcons.CustomIcon frontFace_5 = (GT8_6);
+ private static Textures.BlockIcons.CustomIcon frontFaceActive_5 = (GT8_6_Active);
+ private static Textures.BlockIcons.CustomIcon frontFace_6 = (GT8_7);
+ private static Textures.BlockIcons.CustomIcon frontFaceActive_6 = (GT8_7_Active);
+ private static Textures.BlockIcons.CustomIcon frontFace_7 = (GT8_8);
+ private static Textures.BlockIcons.CustomIcon frontFaceActive_7 = (GT8_8_Active);
+ private static Textures.BlockIcons.CustomIcon frontFace_8 = (GT8_9);
+ private static Textures.BlockIcons.CustomIcon frontFaceActive_8 = (GT8_9_Active);
+
+ Textures.BlockIcons.CustomIcon[] TURBINE = new Textures.BlockIcons.CustomIcon[]{
+ frontFace_0,
+ frontFace_1,
+ frontFace_2,
+ frontFace_3,
+ frontFace_4,
+ frontFace_5,
+ frontFace_6,
+ frontFace_7,
+ frontFace_8
+ };
+
+ Textures.BlockIcons.CustomIcon[] TURBINE_ACTIVE = new Textures.BlockIcons.CustomIcon[]{
+ frontFaceActive_0,
+ frontFaceActive_1,
+ frontFaceActive_2,
+ frontFaceActive_3,
+ frontFaceActive_4,
+ frontFaceActive_5,
+ frontFaceActive_6,
+ frontFaceActive_7,
+ frontFaceActive_8
+ };
+
+
+ public IIcon handleCasingsGT(final IBlockAccess aWorld, final int xCoord, final int yCoord, final int zCoord, final int aSide, final GregtechMetaCasingBlocks thisBlock) {
+ return this.handleCasingsGT58(aWorld, xCoord, yCoord, zCoord, aSide, thisBlock);
+ }
+
+
+ public IIcon handleCasingsGT58(final IBlockAccess aWorld, final int xCoord, final int yCoord, final int zCoord, final int aSide, final GregtechMetaCasingBlocks thisBlock) {
+ final int tMeta = aWorld.getBlockMetadata(xCoord, yCoord, zCoord);
+ if (((tMeta != 6) && (tMeta != 8) && (tMeta != 0))) {
+ return CasingTextureHandler.getIcon(aSide, tMeta);
+ }
+ final int tStartIndex = tMeta == 6 ? 1 : 13;
+ if (tMeta == 0) {
+ if ((aSide == 2) || (aSide == 3)) {
+ TileEntity tTileEntity;
+ IMetaTileEntity tMetaTileEntity;
+ if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 3 ? 1 : -1), yCoord - 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) {
+ if (((IGregTechTileEntity) tTileEntity).isActive()) {
+ return this.TURBINE_ACTIVE[0].getIcon();
+ }
+ return this.TURBINE[0].getIcon();
+ }
+ if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 3 ? 1 : -1), yCoord, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) {
+ if (((IGregTechTileEntity) tTileEntity).isActive()) {
+ return this.TURBINE_ACTIVE[3].getIcon();
+ }
+ return this.TURBINE[3].getIcon();
+ }
+ if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 3 ? 1 : -1), yCoord + 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) {
+ if (((IGregTechTileEntity) tTileEntity).isActive()) {
+ return this.TURBINE_ACTIVE[6].getIcon();
+ }
+ return this.TURBINE[6].getIcon();
+ }
+ if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord - 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) {
+ if (((IGregTechTileEntity) tTileEntity).isActive()) {
+ return this.TURBINE_ACTIVE[1].getIcon();
+ }
+ return this.TURBINE[1].getIcon();
+ }
+ if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord + 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) {
+ if (((IGregTechTileEntity) tTileEntity).isActive()) {
+ return this.TURBINE_ACTIVE[7].getIcon();
+ }
+ return this.TURBINE[7].getIcon();
+ }
+ if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 2 ? 1 : -1), yCoord + 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) {
+ if (((IGregTechTileEntity) tTileEntity).isActive()) {
+ return this.TURBINE_ACTIVE[8].getIcon();
+ }
+ return this.TURBINE[8].getIcon();
+ }
+ if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 2 ? 1 : -1), yCoord, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) {
+ if (((IGregTechTileEntity) tTileEntity).isActive()) {
+ return this.TURBINE_ACTIVE[5].getIcon();
+ }
+ return this.TURBINE[5].getIcon();
+ }
+ if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 2 ? 1 : -1), yCoord - 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) {
+ if (((IGregTechTileEntity) tTileEntity).isActive()) {
+ return this.TURBINE_ACTIVE[2].getIcon();
+ }
+ return this.TURBINE[2].getIcon();
+ }
+ } else if ((aSide == 4) || (aSide == 5)) {
+ TileEntity tTileEntity;
+ Object tMetaTileEntity;
+ if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord - 1, zCoord + (aSide == 4 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) {
+ if (((IGregTechTileEntity) tTileEntity).isActive()) {
+ return this.TURBINE_ACTIVE[0].getIcon();
+ }
+ return this.TURBINE[0].getIcon();
+ }
+ if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord, zCoord + (aSide == 4 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) {
+ if (((IGregTechTileEntity) tTileEntity).isActive()) {
+ return this.TURBINE_ACTIVE[3].getIcon();
+ }
+ return this.TURBINE[3].getIcon();
+ }
+ if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord + 1, zCoord + (aSide == 4 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) {
+ if (((IGregTechTileEntity) tTileEntity).isActive()) {
+ return this.TURBINE_ACTIVE[6].getIcon();
+ }
+ return this.TURBINE[6].getIcon();
+ }
+ if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord - 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) {
+ if (((IGregTechTileEntity) tTileEntity).isActive()) {
+ return this.TURBINE_ACTIVE[1].getIcon();
+ }
+ return this.TURBINE[1].getIcon();
+ }
+ if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord + 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) {
+ if (((IGregTechTileEntity) tTileEntity).isActive()) {
+ return this.TURBINE_ACTIVE[7].getIcon();
+ }
+ return this.TURBINE[7].getIcon();
+ }
+ if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord + 1, zCoord + (aSide == 5 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) {
+ if (((IGregTechTileEntity) tTileEntity).isActive()) {
+ return this.TURBINE_ACTIVE[8].getIcon();
+ }
+ return this.TURBINE[8].getIcon();
+ }
+ if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord, zCoord + (aSide == 5 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) {
+ if (((IGregTechTileEntity) tTileEntity).isActive()) {
+ return this.TURBINE_ACTIVE[5].getIcon();
+ }
+ return this.TURBINE[5].getIcon();
+ }
+ if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord - 1, zCoord + (aSide == 5 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) {
+ if (((IGregTechTileEntity) tTileEntity).isActive()) {
+ return this.TURBINE_ACTIVE[2].getIcon();
+ }
+ return this.TURBINE[2].getIcon();
+ }
+ }
+ return Textures.BlockIcons.MACHINE_CASING_SOLID_STEEL.getIcon();
+ }
+ final boolean[] tConnectedSides = {(aWorld.getBlock(xCoord, yCoord - 1, zCoord) == thisBlock) && (aWorld.getBlockMetadata(xCoord, yCoord - 1, zCoord) == tMeta), (aWorld.getBlock(xCoord, yCoord + 1, zCoord) == thisBlock) && (aWorld.getBlockMetadata(xCoord, yCoord + 1, zCoord) == tMeta), (aWorld.getBlock(xCoord + 1, yCoord, zCoord) == thisBlock) && (aWorld.getBlockMetadata(xCoord + 1, yCoord, zCoord) == tMeta), (aWorld.getBlock(xCoord, yCoord, zCoord + 1) == thisBlock) && (aWorld.getBlockMetadata(xCoord, yCoord, zCoord + 1) == tMeta), (aWorld.getBlock(xCoord - 1, yCoord, zCoord) == thisBlock) && (aWorld.getBlockMetadata(xCoord - 1, yCoord, zCoord) == tMeta), (aWorld.getBlock(xCoord, yCoord, zCoord - 1) == thisBlock) && (aWorld.getBlockMetadata(xCoord, yCoord, zCoord - 1) == tMeta)};
+ switch (aSide) {
+ case 0:
+ if (tConnectedSides[0]) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon();
+ }
+ if ((tConnectedSides[4]) && (tConnectedSides[5]) && (tConnectedSides[2]) && (tConnectedSides[3])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 6)].getIcon();
+ }
+ if ((!tConnectedSides[4]) && (tConnectedSides[5]) && (tConnectedSides[2]) && (tConnectedSides[3])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 2)].getIcon();
+ }
+ if ((tConnectedSides[4]) && (!tConnectedSides[5]) && (tConnectedSides[2]) && (tConnectedSides[3])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 3)].getIcon();
+ }
+ if ((tConnectedSides[4]) && (tConnectedSides[5]) && (!tConnectedSides[2]) && (tConnectedSides[3])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 4)].getIcon();
+ }
+ if ((tConnectedSides[4]) && (tConnectedSides[5]) && (tConnectedSides[2]) && (!tConnectedSides[3])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 5)].getIcon();
+ }
+ if ((!tConnectedSides[4]) && (!tConnectedSides[5]) && (tConnectedSides[2]) && (tConnectedSides[3])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 8)].getIcon();
+ }
+ if ((tConnectedSides[4]) && (!tConnectedSides[5]) && (!tConnectedSides[2]) && (tConnectedSides[3])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 9)].getIcon();
+ }
+ if ((tConnectedSides[4]) && (tConnectedSides[5]) && (!tConnectedSides[2]) && (!tConnectedSides[3])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 10)].getIcon();
+ }
+ if ((!tConnectedSides[4]) && (tConnectedSides[5]) && (tConnectedSides[2]) && (!tConnectedSides[3])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 11)].getIcon();
+ }
+ if ((!tConnectedSides[4]) && (!tConnectedSides[5]) && (!tConnectedSides[2]) && (!tConnectedSides[3])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon();
+ }
+ if ((!tConnectedSides[4]) && (!tConnectedSides[2])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 1)].getIcon();
+ }
+ if ((!tConnectedSides[5]) && (!tConnectedSides[3])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 0)].getIcon();
+ }
+ case 1:
+ if (tConnectedSides[1]) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon();
+ }
+ if ((tConnectedSides[4]) && (tConnectedSides[5]) && (tConnectedSides[2]) && (tConnectedSides[3])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 6)].getIcon();
+ }
+ if ((!tConnectedSides[4]) && (tConnectedSides[5]) && (tConnectedSides[2]) && (tConnectedSides[3])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 2)].getIcon();
+ }
+ if ((tConnectedSides[4]) && (!tConnectedSides[5]) && (tConnectedSides[2]) && (tConnectedSides[3])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 3)].getIcon();
+ }
+ if ((tConnectedSides[4]) && (tConnectedSides[5]) && (!tConnectedSides[2]) && (tConnectedSides[3])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 4)].getIcon();
+ }
+ if ((tConnectedSides[4]) && (tConnectedSides[5]) && (tConnectedSides[2]) && (!tConnectedSides[3])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 5)].getIcon();
+ }
+ if ((!tConnectedSides[4]) && (!tConnectedSides[5]) && (tConnectedSides[2]) && (tConnectedSides[3])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 8)].getIcon();
+ }
+ if ((tConnectedSides[4]) && (!tConnectedSides[5]) && (!tConnectedSides[2]) && (tConnectedSides[3])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 9)].getIcon();
+ }
+ if ((tConnectedSides[4]) && (tConnectedSides[5]) && (!tConnectedSides[2]) && (!tConnectedSides[3])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 10)].getIcon();
+ }
+ if ((!tConnectedSides[4]) && (tConnectedSides[5]) && (tConnectedSides[2]) && (!tConnectedSides[3])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 11)].getIcon();
+ }
+ if ((!tConnectedSides[4]) && (!tConnectedSides[5]) && (!tConnectedSides[2]) && (!tConnectedSides[3])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon();
+ }
+ if ((!tConnectedSides[2]) && (!tConnectedSides[4])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 1)].getIcon();
+ }
+ if ((!tConnectedSides[3]) && (!tConnectedSides[5])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 0)].getIcon();
+ }
+ case 2:
+ if (tConnectedSides[5]) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon();
+ }
+ if ((tConnectedSides[2]) && (tConnectedSides[0]) && (tConnectedSides[4]) && (tConnectedSides[1])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 6)].getIcon();
+ }
+ if ((!tConnectedSides[2]) && (tConnectedSides[0]) && (tConnectedSides[4]) && (tConnectedSides[1])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 2)].getIcon();
+ }
+ if ((tConnectedSides[2]) && (!tConnectedSides[0]) && (tConnectedSides[4]) && (tConnectedSides[1])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 5)].getIcon();
+ }
+ if ((tConnectedSides[2]) && (tConnectedSides[0]) && (!tConnectedSides[4]) && (tConnectedSides[1])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 4)].getIcon();
+ }
+ if ((tConnectedSides[2]) && (tConnectedSides[0]) && (tConnectedSides[4]) && (!tConnectedSides[1])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 3)].getIcon();
+ }
+ if ((!tConnectedSides[2]) && (!tConnectedSides[0]) && (tConnectedSides[4]) && (tConnectedSides[1])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 11)].getIcon();
+ }
+ if ((tConnectedSides[2]) && (!tConnectedSides[0]) && (!tConnectedSides[4]) && (tConnectedSides[1])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 10)].getIcon();
+ }
+ if ((tConnectedSides[2]) && (tConnectedSides[0]) && (!tConnectedSides[4]) && (!tConnectedSides[1])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 9)].getIcon();
+ }
+ if ((!tConnectedSides[2]) && (tConnectedSides[0]) && (tConnectedSides[4]) && (!tConnectedSides[1])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 8)].getIcon();
+ }
+ if ((!tConnectedSides[2]) && (!tConnectedSides[0]) && (!tConnectedSides[4]) && (!tConnectedSides[1])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon();
+ }
+ if ((!tConnectedSides[2]) && (!tConnectedSides[4])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 1)].getIcon();
+ }
+ if ((!tConnectedSides[0]) && (!tConnectedSides[1])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 0)].getIcon();
+ }
+ case 3:
+ if (tConnectedSides[3]) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon();
+ }
+ if ((tConnectedSides[2]) && (tConnectedSides[0]) && (tConnectedSides[4]) && (tConnectedSides[1])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 6)].getIcon();
+ }
+ if ((!tConnectedSides[2]) && (tConnectedSides[0]) && (tConnectedSides[4]) && (tConnectedSides[1])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 4)].getIcon();
+ }
+ if ((tConnectedSides[2]) && (!tConnectedSides[0]) && (tConnectedSides[4]) && (tConnectedSides[1])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 5)].getIcon();
+ }
+ if ((tConnectedSides[2]) && (tConnectedSides[0]) && (!tConnectedSides[4]) && (tConnectedSides[1])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 2)].getIcon();
+ }
+ if ((tConnectedSides[2]) && (tConnectedSides[0]) && (tConnectedSides[4]) && (!tConnectedSides[1])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 3)].getIcon();
+ }
+ if ((!tConnectedSides[2]) && (!tConnectedSides[0]) && (tConnectedSides[4]) && (tConnectedSides[1])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 10)].getIcon();
+ }
+ if ((tConnectedSides[2]) && (!tConnectedSides[0]) && (!tConnectedSides[4]) && (tConnectedSides[1])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 11)].getIcon();
+ }
+ if ((tConnectedSides[2]) && (tConnectedSides[0]) && (!tConnectedSides[4]) && (!tConnectedSides[1])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 8)].getIcon();
+ }
+ if ((!tConnectedSides[2]) && (tConnectedSides[0]) && (tConnectedSides[4]) && (!tConnectedSides[1])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 9)].getIcon();
+ }
+ if ((!tConnectedSides[2]) && (!tConnectedSides[0]) && (!tConnectedSides[4]) && (!tConnectedSides[1])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon();
+ }
+ if ((!tConnectedSides[2]) && (!tConnectedSides[4])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 1)].getIcon();
+ }
+ if ((!tConnectedSides[0]) && (!tConnectedSides[1])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 0)].getIcon();
+ }
+ case 4:
+ if (tConnectedSides[4]) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon();
+ }
+ if ((tConnectedSides[0]) && (tConnectedSides[3]) && (tConnectedSides[1]) && (tConnectedSides[5])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 6)].getIcon();
+ }
+ if ((!tConnectedSides[0]) && (tConnectedSides[3]) && (tConnectedSides[1]) && (tConnectedSides[5])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 5)].getIcon();
+ }
+ if ((tConnectedSides[0]) && (!tConnectedSides[3]) && (tConnectedSides[1]) && (tConnectedSides[5])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 4)].getIcon();
+ }
+ if ((tConnectedSides[0]) && (tConnectedSides[3]) && (!tConnectedSides[1]) && (tConnectedSides[5])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 3)].getIcon();
+ }
+ if ((tConnectedSides[0]) && (tConnectedSides[3]) && (tConnectedSides[1]) && (!tConnectedSides[5])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 2)].getIcon();
+ }
+ if ((!tConnectedSides[0]) && (!tConnectedSides[3]) && (tConnectedSides[1]) && (tConnectedSides[5])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 10)].getIcon();
+ }
+ if ((tConnectedSides[0]) && (!tConnectedSides[3]) && (!tConnectedSides[1]) && (tConnectedSides[5])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 9)].getIcon();
+ }
+ if ((tConnectedSides[0]) && (tConnectedSides[3]) && (!tConnectedSides[1]) && (!tConnectedSides[5])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 8)].getIcon();
+ }
+ if ((!tConnectedSides[0]) && (tConnectedSides[3]) && (tConnectedSides[1]) && (!tConnectedSides[5])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 11)].getIcon();
+ }
+ if ((!tConnectedSides[0]) && (!tConnectedSides[3]) && (!tConnectedSides[1]) && (!tConnectedSides[5])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon();
+ }
+ if ((!tConnectedSides[0]) && (!tConnectedSides[1])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 0)].getIcon();
+ }
+ if ((!tConnectedSides[3]) && (!tConnectedSides[5])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 1)].getIcon();
+ }
+ case 5:
+ if (tConnectedSides[2]) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon();
+ }
+ if ((tConnectedSides[0]) && (tConnectedSides[3]) && (tConnectedSides[1]) && (tConnectedSides[5])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 6)].getIcon();
+ }
+ if ((!tConnectedSides[0]) && (tConnectedSides[3]) && (tConnectedSides[1]) && (tConnectedSides[5])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 5)].getIcon();
+ }
+ if ((tConnectedSides[0]) && (!tConnectedSides[3]) && (tConnectedSides[1]) && (tConnectedSides[5])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 2)].getIcon();
+ }
+ if ((tConnectedSides[0]) && (tConnectedSides[3]) && (!tConnectedSides[1]) && (tConnectedSides[5])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 3)].getIcon();
+ }
+ if ((tConnectedSides[0]) && (tConnectedSides[3]) && (tConnectedSides[1]) && (!tConnectedSides[5])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 4)].getIcon();
+ }
+ if ((!tConnectedSides[0]) && (!tConnectedSides[3]) && (tConnectedSides[1]) && (tConnectedSides[5])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 11)].getIcon();
+ }
+ if ((tConnectedSides[0]) && (!tConnectedSides[3]) && (!tConnectedSides[1]) && (tConnectedSides[5])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 8)].getIcon();
+ }
+ if ((tConnectedSides[0]) && (tConnectedSides[3]) && (!tConnectedSides[1]) && (!tConnectedSides[5])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 9)].getIcon();
+ }
+ if ((!tConnectedSides[0]) && (tConnectedSides[3]) && (tConnectedSides[1]) && (!tConnectedSides[5])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 10)].getIcon();
+ }
+ if ((!tConnectedSides[0]) && (!tConnectedSides[3]) && (!tConnectedSides[1]) && (!tConnectedSides[5])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon();
+ }
+ if ((!tConnectedSides[0]) && (!tConnectedSides[1])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 0)].getIcon();
+ }
+ if ((!tConnectedSides[3]) && (!tConnectedSides[5])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 1)].getIcon();
+ }
+ break;
+ }
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon();
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGregtech59.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGregtech59.java
new file mode 100644
index 0000000000..ac721d81c3
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGregtech59.java
@@ -0,0 +1,444 @@
+package gtPlusPlus.xmod.gregtech.common.blocks.textures;
+
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.IIcon;
+import net.minecraft.world.IBlockAccess;
+
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+
+import gtPlusPlus.xmod.gregtech.common.blocks.GregtechMetaCasingBlocks;
+import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.GregtechMetaTileEntity_IndustrialCentrifuge;
+
+public class TexturesGregtech59 {
+
+ private static Textures.BlockIcons.CustomIcon GT8_1_Active = new Textures.BlockIcons.CustomIcon("iconsets/LARGETURBINE_ST_ACTIVE1");
+ private static Textures.BlockIcons.CustomIcon GT8_1 = new Textures.BlockIcons.CustomIcon("iconsets/LARGETURBINE_ST1");
+ private static Textures.BlockIcons.CustomIcon GT8_2_Active = new Textures.BlockIcons.CustomIcon("iconsets/LARGETURBINE_ST_ACTIVE2");
+ private static Textures.BlockIcons.CustomIcon GT8_2 = new Textures.BlockIcons.CustomIcon("iconsets/LARGETURBINE_ST2");
+ private static Textures.BlockIcons.CustomIcon GT8_3_Active = new Textures.BlockIcons.CustomIcon("iconsets/LARGETURBINE_ST_ACTIVE3");
+ private static Textures.BlockIcons.CustomIcon GT8_3 = new Textures.BlockIcons.CustomIcon("iconsets/LARGETURBINE_ST3");
+ private static Textures.BlockIcons.CustomIcon GT8_4_Active = new Textures.BlockIcons.CustomIcon("iconsets/LARGETURBINE_ST_ACTIVE4");
+ private static Textures.BlockIcons.CustomIcon GT8_4 = new Textures.BlockIcons.CustomIcon("iconsets/LARGETURBINE_ST4");
+ private static Textures.BlockIcons.CustomIcon GT8_5_Active = new Textures.BlockIcons.CustomIcon("iconsets/LARGETURBINE_ST_ACTIVE5");
+ private static Textures.BlockIcons.CustomIcon GT8_5 = new Textures.BlockIcons.CustomIcon("iconsets/LARGETURBINE_ST5");
+ private static Textures.BlockIcons.CustomIcon GT8_6_Active = new Textures.BlockIcons.CustomIcon("iconsets/LARGETURBINE_ST_ACTIVE6");
+ private static Textures.BlockIcons.CustomIcon GT8_6 = new Textures.BlockIcons.CustomIcon("iconsets/LARGETURBINE_ST6");
+ private static Textures.BlockIcons.CustomIcon GT8_7_Active = new Textures.BlockIcons.CustomIcon("iconsets/LARGETURBINE_ST_ACTIVE7");
+ private static Textures.BlockIcons.CustomIcon GT8_7 = new Textures.BlockIcons.CustomIcon("iconsets/LARGETURBINE_ST7");
+ private static Textures.BlockIcons.CustomIcon GT8_8_Active = new Textures.BlockIcons.CustomIcon("iconsets/LARGETURBINE_ST_ACTIVE8");
+ private static Textures.BlockIcons.CustomIcon GT8_8 = new Textures.BlockIcons.CustomIcon("iconsets/LARGETURBINE_ST8");
+ private static Textures.BlockIcons.CustomIcon GT8_9_Active = new Textures.BlockIcons.CustomIcon("iconsets/LARGETURBINE_ST_ACTIVE9");
+ private static Textures.BlockIcons.CustomIcon GT8_9 = new Textures.BlockIcons.CustomIcon("iconsets/LARGETURBINE_ST9");
+
+ private static Textures.BlockIcons.CustomIcon frontFace_0 = (GT8_1);
+ private static Textures.BlockIcons.CustomIcon frontFaceActive_0 = (GT8_1_Active);
+ private static Textures.BlockIcons.CustomIcon frontFace_1 = (GT8_2);
+ private static Textures.BlockIcons.CustomIcon frontFaceActive_1 = (GT8_2_Active);
+ private static Textures.BlockIcons.CustomIcon frontFace_2 = (GT8_3);
+ private static Textures.BlockIcons.CustomIcon frontFaceActive_2 = (GT8_3_Active);
+ private static Textures.BlockIcons.CustomIcon frontFace_3 = (GT8_4);
+ private static Textures.BlockIcons.CustomIcon frontFaceActive_3 = (GT8_4_Active);
+ private static Textures.BlockIcons.CustomIcon frontFace_4 = (GT8_5);
+ private static Textures.BlockIcons.CustomIcon frontFaceActive_4 = (GT8_5_Active);
+ private static Textures.BlockIcons.CustomIcon frontFace_5 = (GT8_6);
+ private static Textures.BlockIcons.CustomIcon frontFaceActive_5 = (GT8_6_Active);
+ private static Textures.BlockIcons.CustomIcon frontFace_6 = (GT8_7);
+ private static Textures.BlockIcons.CustomIcon frontFaceActive_6 = (GT8_7_Active);
+ private static Textures.BlockIcons.CustomIcon frontFace_7 = (GT8_8);
+ private static Textures.BlockIcons.CustomIcon frontFaceActive_7 = (GT8_8_Active);
+ private static Textures.BlockIcons.CustomIcon frontFace_8 = (GT8_9);
+ private static Textures.BlockIcons.CustomIcon frontFaceActive_8 = (GT8_9_Active);
+
+ Textures.BlockIcons.CustomIcon[] TURBINE = new Textures.BlockIcons.CustomIcon[]{
+ frontFace_0,
+ frontFace_1,
+ frontFace_2,
+ frontFace_3,
+ frontFace_4,
+ frontFace_5,
+ frontFace_6,
+ frontFace_7,
+ frontFace_8
+ };
+
+ Textures.BlockIcons.CustomIcon[] TURBINE_ACTIVE = new Textures.BlockIcons.CustomIcon[]{
+ frontFaceActive_0,
+ frontFaceActive_1,
+ frontFaceActive_2,
+ frontFaceActive_3,
+ frontFaceActive_4,
+ frontFaceActive_5,
+ frontFaceActive_6,
+ frontFaceActive_7,
+ frontFaceActive_8
+ };
+
+
+ public IIcon handleCasingsGT(final IBlockAccess aWorld, final int xCoord, final int yCoord, final int zCoord, final int aSide, final GregtechMetaCasingBlocks thisBlock) {
+ return this.handleCasingsGT59(aWorld, xCoord, yCoord, zCoord, aSide, thisBlock);
+ }
+
+
+ public IIcon handleCasingsGT59(final IBlockAccess aWorld, final int xCoord, final int yCoord, final int zCoord, final int aSide, final GregtechMetaCasingBlocks thisBlock) {
+ final int tMeta = aWorld.getBlockMetadata(xCoord, yCoord, zCoord);
+ if (((tMeta != 6) && (tMeta != 8) && (tMeta != 0))) {
+ return CasingTextureHandler.getIcon(aSide, tMeta);
+ }
+ final int tStartIndex = tMeta == 6 ? 1 : 13;
+ if (tMeta == 0) {
+ if ((aSide == 2) || (aSide == 3)) {
+ TileEntity tTileEntity;
+ IMetaTileEntity tMetaTileEntity;
+ if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 3 ? 1 : -1), yCoord - 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) {
+ if (((IGregTechTileEntity) tTileEntity).isActive()) {
+ return this.TURBINE_ACTIVE[0].getIcon();
+ }
+ return this.TURBINE[0].getIcon();
+ }
+ if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 3 ? 1 : -1), yCoord, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) {
+ if (((IGregTechTileEntity) tTileEntity).isActive()) {
+ return this.TURBINE_ACTIVE[3].getIcon();
+ }
+ return this.TURBINE[3].getIcon();
+ }
+ if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 3 ? 1 : -1), yCoord + 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) {
+ if (((IGregTechTileEntity) tTileEntity).isActive()) {
+ return this.TURBINE_ACTIVE[6].getIcon();
+ }
+ return this.TURBINE[6].getIcon();
+ }
+ if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord - 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) {
+ if (((IGregTechTileEntity) tTileEntity).isActive()) {
+ return this.TURBINE_ACTIVE[1].getIcon();
+ }
+ return this.TURBINE[1].getIcon();
+ }
+ if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord + 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) {
+ if (((IGregTechTileEntity) tTileEntity).isActive()) {
+ return this.TURBINE_ACTIVE[7].getIcon();
+ }
+ return this.TURBINE[7].getIcon();
+ }
+ if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 2 ? 1 : -1), yCoord + 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) {
+ if (((IGregTechTileEntity) tTileEntity).isActive()) {
+ return this.TURBINE_ACTIVE[8].getIcon();
+ }
+ return this.TURBINE[8].getIcon();
+ }
+ if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 2 ? 1 : -1), yCoord, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) {
+ if (((IGregTechTileEntity) tTileEntity).isActive()) {
+ return this.TURBINE_ACTIVE[5].getIcon();
+ }
+ return this.TURBINE[5].getIcon();
+ }
+ if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 2 ? 1 : -1), yCoord - 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) {
+ if (((IGregTechTileEntity) tTileEntity).isActive()) {
+ return this.TURBINE_ACTIVE[2].getIcon();
+ }
+ return this.TURBINE[2].getIcon();
+ }
+ } else if ((aSide == 4) || (aSide == 5)) {
+ TileEntity tTileEntity;
+ Object tMetaTileEntity;
+ if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord - 1, zCoord + (aSide == 4 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) {
+ if (((IGregTechTileEntity) tTileEntity).isActive()) {
+ return this.TURBINE_ACTIVE[0].getIcon();
+ }
+ return this.TURBINE[0].getIcon();
+ }
+ if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord, zCoord + (aSide == 4 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) {
+ if (((IGregTechTileEntity) tTileEntity).isActive()) {
+ return this.TURBINE_ACTIVE[3].getIcon();
+ }
+ return this.TURBINE[3].getIcon();
+ }
+ if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord + 1, zCoord + (aSide == 4 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) {
+ if (((IGregTechTileEntity) tTileEntity).isActive()) {
+ return this.TURBINE_ACTIVE[6].getIcon();
+ }
+ return this.TURBINE[6].getIcon();
+ }
+ if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord - 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) {
+ if (((IGregTechTileEntity) tTileEntity).isActive()) {
+ return this.TURBINE_ACTIVE[1].getIcon();
+ }
+ return this.TURBINE[1].getIcon();
+ }
+ if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord + 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) {
+ if (((IGregTechTileEntity) tTileEntity).isActive()) {
+ return this.TURBINE_ACTIVE[7].getIcon();
+ }
+ return this.TURBINE[7].getIcon();
+ }
+ if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord + 1, zCoord + (aSide == 5 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) {
+ if (((IGregTechTileEntity) tTileEntity).isActive()) {
+ return this.TURBINE_ACTIVE[8].getIcon();
+ }
+ return this.TURBINE[8].getIcon();
+ }
+ if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord, zCoord + (aSide == 5 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) {
+ if (((IGregTechTileEntity) tTileEntity).isActive()) {
+ return this.TURBINE_ACTIVE[5].getIcon();
+ }
+ return this.TURBINE[5].getIcon();
+ }
+ if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord - 1, zCoord + (aSide == 5 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) {
+ if (((IGregTechTileEntity) tTileEntity).isActive()) {
+ return this.TURBINE_ACTIVE[2].getIcon();
+ }
+ return this.TURBINE[2].getIcon();
+ }
+ }
+ return Textures.BlockIcons.MACHINE_CASING_SOLID_STEEL.getIcon();
+ }
+ final boolean[] tConnectedSides = {(aWorld.getBlock(xCoord, yCoord - 1, zCoord) == thisBlock) && (aWorld.getBlockMetadata(xCoord, yCoord - 1, zCoord) == tMeta), (aWorld.getBlock(xCoord, yCoord + 1, zCoord) == thisBlock) && (aWorld.getBlockMetadata(xCoord, yCoord + 1, zCoord) == tMeta), (aWorld.getBlock(xCoord + 1, yCoord, zCoord) == thisBlock) && (aWorld.getBlockMetadata(xCoord + 1, yCoord, zCoord) == tMeta), (aWorld.getBlock(xCoord, yCoord, zCoord + 1) == thisBlock) && (aWorld.getBlockMetadata(xCoord, yCoord, zCoord + 1) == tMeta), (aWorld.getBlock(xCoord - 1, yCoord, zCoord) == thisBlock) && (aWorld.getBlockMetadata(xCoord - 1, yCoord, zCoord) == tMeta), (aWorld.getBlock(xCoord, yCoord, zCoord - 1) == thisBlock) && (aWorld.getBlockMetadata(xCoord, yCoord, zCoord - 1) == tMeta)};
+ switch (aSide) {
+ case 0:
+ if (tConnectedSides[0]) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon();
+ }
+ if ((tConnectedSides[4]) && (tConnectedSides[5]) && (tConnectedSides[2]) && (tConnectedSides[3])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 6)].getIcon();
+ }
+ if ((!tConnectedSides[4]) && (tConnectedSides[5]) && (tConnectedSides[2]) && (tConnectedSides[3])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 2)].getIcon();
+ }
+ if ((tConnectedSides[4]) && (!tConnectedSides[5]) && (tConnectedSides[2]) && (tConnectedSides[3])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 3)].getIcon();
+ }
+ if ((tConnectedSides[4]) && (tConnectedSides[5]) && (!tConnectedSides[2]) && (tConnectedSides[3])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 4)].getIcon();
+ }
+ if ((tConnectedSides[4]) && (tConnectedSides[5]) && (tConnectedSides[2]) && (!tConnectedSides[3])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 5)].getIcon();
+ }
+ if ((!tConnectedSides[4]) && (!tConnectedSides[5]) && (tConnectedSides[2]) && (tConnectedSides[3])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 8)].getIcon();
+ }
+ if ((tConnectedSides[4]) && (!tConnectedSides[5]) && (!tConnectedSides[2]) && (tConnectedSides[3])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 9)].getIcon();
+ }
+ if ((tConnectedSides[4]) && (tConnectedSides[5]) && (!tConnectedSides[2]) && (!tConnectedSides[3])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 10)].getIcon();
+ }
+ if ((!tConnectedSides[4]) && (tConnectedSides[5]) && (tConnectedSides[2]) && (!tConnectedSides[3])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 11)].getIcon();
+ }
+ if ((!tConnectedSides[4]) && (!tConnectedSides[5]) && (!tConnectedSides[2]) && (!tConnectedSides[3])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon();
+ }
+ if ((!tConnectedSides[4]) && (!tConnectedSides[2])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 1)].getIcon();
+ }
+ if ((!tConnectedSides[5]) && (!tConnectedSides[3])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 0)].getIcon();
+ }
+ case 1:
+ if (tConnectedSides[1]) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon();
+ }
+ if ((tConnectedSides[4]) && (tConnectedSides[5]) && (tConnectedSides[2]) && (tConnectedSides[3])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 6)].getIcon();
+ }
+ if ((!tConnectedSides[4]) && (tConnectedSides[5]) && (tConnectedSides[2]) && (tConnectedSides[3])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 2)].getIcon();
+ }
+ if ((tConnectedSides[4]) && (!tConnectedSides[5]) && (tConnectedSides[2]) && (tConnectedSides[3])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 3)].getIcon();
+ }
+ if ((tConnectedSides[4]) && (tConnectedSides[5]) && (!tConnectedSides[2]) && (tConnectedSides[3])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 4)].getIcon();
+ }
+ if ((tConnectedSides[4]) && (tConnectedSides[5]) && (tConnectedSides[2]) && (!tConnectedSides[3])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 5)].getIcon();
+ }
+ if ((!tConnectedSides[4]) && (!tConnectedSides[5]) && (tConnectedSides[2]) && (tConnectedSides[3])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 8)].getIcon();
+ }
+ if ((tConnectedSides[4]) && (!tConnectedSides[5]) && (!tConnectedSides[2]) && (tConnectedSides[3])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 9)].getIcon();
+ }
+ if ((tConnectedSides[4]) && (tConnectedSides[5]) && (!tConnectedSides[2]) && (!tConnectedSides[3])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 10)].getIcon();
+ }
+ if ((!tConnectedSides[4]) && (tConnectedSides[5]) && (tConnectedSides[2]) && (!tConnectedSides[3])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 11)].getIcon();
+ }
+ if ((!tConnectedSides[4]) && (!tConnectedSides[5]) && (!tConnectedSides[2]) && (!tConnectedSides[3])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon();
+ }
+ if ((!tConnectedSides[2]) && (!tConnectedSides[4])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 1)].getIcon();
+ }
+ if ((!tConnectedSides[3]) && (!tConnectedSides[5])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 0)].getIcon();
+ }
+ case 2:
+ if (tConnectedSides[5]) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon();
+ }
+ if ((tConnectedSides[2]) && (tConnectedSides[0]) && (tConnectedSides[4]) && (tConnectedSides[1])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 6)].getIcon();
+ }
+ if ((!tConnectedSides[2]) && (tConnectedSides[0]) && (tConnectedSides[4]) && (tConnectedSides[1])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 2)].getIcon();
+ }
+ if ((tConnectedSides[2]) && (!tConnectedSides[0]) && (tConnectedSides[4]) && (tConnectedSides[1])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 5)].getIcon();
+ }
+ if ((tConnectedSides[2]) && (tConnectedSides[0]) && (!tConnectedSides[4]) && (tConnectedSides[1])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 4)].getIcon();
+ }
+ if ((tConnectedSides[2]) && (tConnectedSides[0]) && (tConnectedSides[4]) && (!tConnectedSides[1])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 3)].getIcon();
+ }
+ if ((!tConnectedSides[2]) && (!tConnectedSides[0]) && (tConnectedSides[4]) && (tConnectedSides[1])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 11)].getIcon();
+ }
+ if ((tConnectedSides[2]) && (!tConnectedSides[0]) && (!tConnectedSides[4]) && (tConnectedSides[1])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 10)].getIcon();
+ }
+ if ((tConnectedSides[2]) && (tConnectedSides[0]) && (!tConnectedSides[4]) && (!tConnectedSides[1])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 9)].getIcon();
+ }
+ if ((!tConnectedSides[2]) && (tConnectedSides[0]) && (tConnectedSides[4]) && (!tConnectedSides[1])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 8)].getIcon();
+ }
+ if ((!tConnectedSides[2]) && (!tConnectedSides[0]) && (!tConnectedSides[4]) && (!tConnectedSides[1])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon();
+ }
+ if ((!tConnectedSides[2]) && (!tConnectedSides[4])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 1)].getIcon();
+ }
+ if ((!tConnectedSides[0]) && (!tConnectedSides[1])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 0)].getIcon();
+ }
+ case 3:
+ if (tConnectedSides[3]) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon();
+ }
+ if ((tConnectedSides[2]) && (tConnectedSides[0]) && (tConnectedSides[4]) && (tConnectedSides[1])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 6)].getIcon();
+ }
+ if ((!tConnectedSides[2]) && (tConnectedSides[0]) && (tConnectedSides[4]) && (tConnectedSides[1])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 4)].getIcon();
+ }
+ if ((tConnectedSides[2]) && (!tConnectedSides[0]) && (tConnectedSides[4]) && (tConnectedSides[1])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 5)].getIcon();
+ }
+ if ((tConnectedSides[2]) && (tConnectedSides[0]) && (!tConnectedSides[4]) && (tConnectedSides[1])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 2)].getIcon();
+ }
+ if ((tConnectedSides[2]) && (tConnectedSides[0]) && (tConnectedSides[4]) && (!tConnectedSides[1])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 3)].getIcon();
+ }
+ if ((!tConnectedSides[2]) && (!tConnectedSides[0]) && (tConnectedSides[4]) && (tConnectedSides[1])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 10)].getIcon();
+ }
+ if ((tConnectedSides[2]) && (!tConnectedSides[0]) && (!tConnectedSides[4]) && (tConnectedSides[1])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 11)].getIcon();
+ }
+ if ((tConnectedSides[2]) && (tConnectedSides[0]) && (!tConnectedSides[4]) && (!tConnectedSides[1])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 8)].getIcon();
+ }
+ if ((!tConnectedSides[2]) && (tConnectedSides[0]) && (tConnectedSides[4]) && (!tConnectedSides[1])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 9)].getIcon();
+ }
+ if ((!tConnectedSides[2]) && (!tConnectedSides[0]) && (!tConnectedSides[4]) && (!tConnectedSides[1])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon();
+ }
+ if ((!tConnectedSides[2]) && (!tConnectedSides[4])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 1)].getIcon();
+ }
+ if ((!tConnectedSides[0]) && (!tConnectedSides[1])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 0)].getIcon();
+ }
+ case 4:
+ if (tConnectedSides[4]) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon();
+ }
+ if ((tConnectedSides[0]) && (tConnectedSides[3]) && (tConnectedSides[1]) && (tConnectedSides[5])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 6)].getIcon();
+ }
+ if ((!tConnectedSides[0]) && (tConnectedSides[3]) && (tConnectedSides[1]) && (tConnectedSides[5])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 5)].getIcon();
+ }
+ if ((tConnectedSides[0]) && (!tConnectedSides[3]) && (tConnectedSides[1]) && (tConnectedSides[5])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 4)].getIcon();
+ }
+ if ((tConnectedSides[0]) && (tConnectedSides[3]) && (!tConnectedSides[1]) && (tConnectedSides[5])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 3)].getIcon();
+ }
+ if ((tConnectedSides[0]) && (tConnectedSides[3]) && (tConnectedSides[1]) && (!tConnectedSides[5])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 2)].getIcon();
+ }
+ if ((!tConnectedSides[0]) && (!tConnectedSides[3]) && (tConnectedSides[1]) && (tConnectedSides[5])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 10)].getIcon();
+ }
+ if ((tConnectedSides[0]) && (!tConnectedSides[3]) && (!tConnectedSides[1]) && (tConnectedSides[5])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 9)].getIcon();
+ }
+ if ((tConnectedSides[0]) && (tConnectedSides[3]) && (!tConnectedSides[1]) && (!tConnectedSides[5])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 8)].getIcon();
+ }
+ if ((!tConnectedSides[0]) && (tConnectedSides[3]) && (tConnectedSides[1]) && (!tConnectedSides[5])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 11)].getIcon();
+ }
+ if ((!tConnectedSides[0]) && (!tConnectedSides[3]) && (!tConnectedSides[1]) && (!tConnectedSides[5])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon();
+ }
+ if ((!tConnectedSides[0]) && (!tConnectedSides[1])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 0)].getIcon();
+ }
+ if ((!tConnectedSides[3]) && (!tConnectedSides[5])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 1)].getIcon();
+ }
+ case 5:
+ if (tConnectedSides[2]) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon();
+ }
+ if ((tConnectedSides[0]) && (tConnectedSides[3]) && (tConnectedSides[1]) && (tConnectedSides[5])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 6)].getIcon();
+ }
+ if ((!tConnectedSides[0]) && (tConnectedSides[3]) && (tConnectedSides[1]) && (tConnectedSides[5])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 5)].getIcon();
+ }
+ if ((tConnectedSides[0]) && (!tConnectedSides[3]) && (tConnectedSides[1]) && (tConnectedSides[5])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 2)].getIcon();
+ }
+ if ((tConnectedSides[0]) && (tConnectedSides[3]) && (!tConnectedSides[1]) && (tConnectedSides[5])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 3)].getIcon();
+ }
+ if ((tConnectedSides[0]) && (tConnectedSides[3]) && (tConnectedSides[1]) && (!tConnectedSides[5])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 4)].getIcon();
+ }
+ if ((!tConnectedSides[0]) && (!tConnectedSides[3]) && (tConnectedSides[1]) && (tConnectedSides[5])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 11)].getIcon();
+ }
+ if ((tConnectedSides[0]) && (!tConnectedSides[3]) && (!tConnectedSides[1]) && (tConnectedSides[5])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 8)].getIcon();
+ }
+ if ((tConnectedSides[0]) && (tConnectedSides[3]) && (!tConnectedSides[1]) && (!tConnectedSides[5])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 9)].getIcon();
+ }
+ if ((!tConnectedSides[0]) && (tConnectedSides[3]) && (tConnectedSides[1]) && (!tConnectedSides[5])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 10)].getIcon();
+ }
+ if ((!tConnectedSides[0]) && (!tConnectedSides[3]) && (!tConnectedSides[1]) && (!tConnectedSides[5])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon();
+ }
+ if ((!tConnectedSides[0]) && (!tConnectedSides[1])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 0)].getIcon();
+ }
+ if ((!tConnectedSides[3]) && (!tConnectedSides[5])) {
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 1)].getIcon();
+ }
+ break;
+ }
+ return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon();
+ }
+
+
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGrinderMultiblock.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGrinderMultiblock.java
new file mode 100644
index 0000000000..962f981d3b
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGrinderMultiblock.java
@@ -0,0 +1,150 @@
+package gtPlusPlus.xmod.gregtech.common.blocks.textures;
+
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gtPlusPlus.xmod.gregtech.common.blocks.GregtechMetaCasingBlocks5;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.CustomIcon;
+import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.GregtechMetaTileEntity_IsaMill;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.IIcon;
+import net.minecraft.world.IBlockAccess;
+
+public class TexturesGrinderMultiblock {
+
+ private static CustomIcon GT8_1_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE1");
+ private static CustomIcon GT8_1 = new CustomIcon("iconsets/Grinder/GRINDER1");
+ private static CustomIcon GT8_2_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE2");
+ private static CustomIcon GT8_2 = new CustomIcon("iconsets/Grinder/GRINDER2");
+ private static CustomIcon GT8_3_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE3");
+ private static CustomIcon GT8_3 = new CustomIcon("iconsets/Grinder/GRINDER3");
+ private static CustomIcon GT8_4_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE4");
+ private static CustomIcon GT8_4 = new CustomIcon("iconsets/Grinder/GRINDER4");
+ private static CustomIcon GT8_5_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE5");
+ private static CustomIcon GT8_5 = new CustomIcon("iconsets/Grinder/GRINDER5");
+ private static CustomIcon GT8_6_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE6");
+ private static CustomIcon GT8_6 = new CustomIcon("iconsets/Grinder/GRINDER6");
+ private static CustomIcon GT8_7_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE7");
+ private static CustomIcon GT8_7 = new CustomIcon("iconsets/Grinder/GRINDER7");
+ private static CustomIcon GT8_8_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE8");
+ private static CustomIcon GT8_8 = new CustomIcon("iconsets/Grinder/GRINDER8");
+ private static CustomIcon GT8_9_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE9");
+ private static CustomIcon GT8_9 = new CustomIcon("iconsets/Grinder/GRINDER9");
+
+ private static CustomIcon frontFace_0 = (GT8_1);
+ private static CustomIcon frontFaceActive_0 = (GT8_1_Active);
+ private static CustomIcon frontFace_1 = (GT8_2);
+ private static CustomIcon frontFaceActive_1 = (GT8_2_Active);
+ private static CustomIcon frontFace_2 = (GT8_3);
+ private static CustomIcon frontFaceActive_2 = (GT8_3_Active);
+ private static CustomIcon frontFace_3 = (GT8_4);
+ private static CustomIcon frontFaceActive_3 = (GT8_4_Active);
+ private static CustomIcon frontFace_4 = (GT8_5);
+ private static CustomIcon frontFaceActive_4 = (GT8_5_Active);
+ private static CustomIcon frontFace_5 = (GT8_6);
+ private static CustomIcon frontFaceActive_5 = (GT8_6_Active);
+ private static CustomIcon frontFace_6 = (GT8_7);
+ private static CustomIcon frontFaceActive_6 = (GT8_7_Active);
+ private static CustomIcon frontFace_7 = (GT8_8);
+ private static CustomIcon frontFaceActive_7 = (GT8_8_Active);
+ private static CustomIcon frontFace_8 = (GT8_9);
+ private static CustomIcon frontFaceActive_8 = (GT8_9_Active);
+
+ CustomIcon[] GRINDER = new CustomIcon[]{
+ frontFace_0,
+ frontFace_1,
+ frontFace_2,
+ frontFace_3,
+ frontFace_4,
+ frontFace_5,
+ frontFace_6,
+ frontFace_7,
+ frontFace_8
+ };
+
+ CustomIcon[] GRINDER_ACTIVE = new CustomIcon[]{
+ frontFaceActive_0,
+ frontFaceActive_1,
+ frontFaceActive_2,
+ frontFaceActive_3,
+ frontFaceActive_4,
+ frontFaceActive_5,
+ frontFaceActive_6,
+ frontFaceActive_7,
+ frontFaceActive_8
+ };
+
+ private static int isIsaControllerWithSide(IBlockAccess aWorld, int aX, int aY, int aZ, int aSide) {
+ TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ if (!(tTileEntity instanceof IGregTechTileEntity)) return 0;
+ IGregTechTileEntity tTile = (IGregTechTileEntity) tTileEntity;
+ if (tTile.getMetaTileEntity() instanceof GregtechMetaTileEntity_IsaMill && tTile.getFrontFacing() == aSide)
+ return tTile.isActive() ? 1 : 2;
+ return 0;
+ }
+
+ public IIcon handleCasingsGT(final IBlockAccess aWorld, final int xCoord, final int yCoord, final int zCoord, final int aSide, final GregtechMetaCasingBlocks5 ii) {
+ final int tMeta = aWorld.getBlockMetadata(xCoord, yCoord, zCoord);
+ if (tMeta != 0) {
+ return GregtechMetaCasingBlocks5.getStaticIcon(aSide, tMeta);
+ }
+ int tInvertLeftRightMod = aSide % 2 * 2 - 1;
+ switch (aSide / 2) {
+ case 0:
+ for (int i = -1; i < 2; i++) {
+ for (int j = -1; j < 2; j++) {
+ if (i == 0 && j == 0)
+ continue;
+ if (isIsaControllerWithSide(aWorld, xCoord + j, yCoord, zCoord + i, aSide) != 0) {
+ IMetaTileEntity tMetaTileEntity = ((IGregTechTileEntity) aWorld.getTileEntity(xCoord + j, yCoord, zCoord + i)).getMetaTileEntity();
+ return getIconByIndex(tMetaTileEntity, 4 - i * 3 - j);
+ }
+ }
+ }
+ break;
+ case 1:
+ for (int i = -1; i < 2; i++) {
+ for (int j = -1; j < 2; j++) {
+ if (i == 0 && j == 0)
+ continue;
+ if (isIsaControllerWithSide(aWorld, xCoord + j, yCoord + i, zCoord, aSide) != 0) {
+ IMetaTileEntity tMetaTileEntity = ((IGregTechTileEntity) aWorld.getTileEntity(xCoord + j, yCoord + i, zCoord)).getMetaTileEntity();
+ return getIconByIndex(tMetaTileEntity, 4 + i * 3 - j * tInvertLeftRightMod);
+ }
+ }
+ }
+ break;
+ case 2:
+ for (int i = -1; i < 2; i++) {
+ for (int j = -1; j < 2; j++) {
+ if (i == 0 && j == 0)
+ continue;
+ if (isIsaControllerWithSide(aWorld, xCoord, yCoord + i, zCoord + j, aSide) != 0) {
+ IMetaTileEntity tMetaTileEntity = ((IGregTechTileEntity) aWorld.getTileEntity(xCoord, yCoord + i, zCoord + j)).getMetaTileEntity();
+ return getIconByIndex(tMetaTileEntity, 4 + i * 3 + j * tInvertLeftRightMod);
+ }
+ }
+ }
+ break;
+ }
+ return TexturesGtBlock.TEXTURE_CASING_GRINDING_MILL.getIcon();
+ }
+
+ public boolean isCentrifugeRunning(IMetaTileEntity aTile) {
+ if (aTile == null) {
+ return false;
+ }
+ else {
+ return aTile.getBaseMetaTileEntity().isActive();
+ }
+ }
+
+ public IIcon getIconByIndex(IMetaTileEntity aMetaTileEntity, int aIndex) {
+ if (isCentrifugeRunning(aMetaTileEntity)) {
+ return this.GRINDER_ACTIVE[aIndex].getIcon();
+ }
+
+ return this.GRINDER[aIndex].getIcon();
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java
new file mode 100644
index 0000000000..518ffe0eae
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java
@@ -0,0 +1,652 @@
+package gtPlusPlus.xmod.gregtech.common.blocks.textures;
+
+import net.minecraft.client.renderer.texture.TextureMap;
+import net.minecraft.util.IIcon;
+import net.minecraft.util.ResourceLocation;
+
+import gregtech.api.GregTech_API;
+import gregtech.api.interfaces.IIconContainer;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.objects.GT_RenderedTexture;
+
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.api.objects.data.AutoMap;
+import gtPlusPlus.core.lib.CORE;
+
+public class TexturesGtBlock {
+
+ private static AutoMap<Runnable> mCustomiconMap = new AutoMap<Runnable>();
+
+ static {
+
+ }
+
+ //public static ITexture[] CASING_BLOCKS_GTPP = new ITexture[256];
+
+ /*
+ * Handles Custom Textures.
+ */
+
+ public static class CustomIcon implements IIconContainer, Runnable {
+ protected IIcon mIcon;
+ protected String mIconName;
+ protected String mModID;
+
+ public CustomIcon(final String aIconName) {
+ this(CORE.MODID, aIconName);
+ }
+
+ public CustomIcon(final String aModID, final String aIconName) {
+ this.mIconName = aIconName;
+ this.mModID = aModID;
+ mCustomiconMap.put(this);
+ Logger.WARNING("Constructing a Custom Texture. " + this.mIconName);
+ GregTech_API.sGTBlockIconload.add(this);
+ }
+
+ @Override
+ public IIcon getIcon() {
+ return this.mIcon;
+ }
+
+ @Override
+ public IIcon getOverlayIcon() {
+ return null;
+ }
+
+ @Override
+ public void run() {
+ this.mIcon = GregTech_API.sBlockIcons.registerIcon(this.mModID + ":" + this.mIconName);
+ Logger.WARNING("FIND ME _ Processing texture: "+this.getTextureFile().getResourcePath());
+ }
+
+ @Override
+ public ResourceLocation getTextureFile() {
+ return TextureMap.locationBlocksTexture;
+ }
+ }
+
+
+ public static class VanillaIcon implements IIconContainer, Runnable {
+ protected IIcon mIcon;
+ protected String mIconName;
+
+ public VanillaIcon(final String aIconName) {
+ this.mIconName = aIconName;
+ mCustomiconMap.put(this);
+ Logger.WARNING("Constructing a Custom Texture. " + this.mIconName);
+ GregTech_API.sGTBlockIconload.add(this);
+ }
+
+ @Override
+ public IIcon getIcon() {
+ return this.mIcon;
+ }
+
+ @Override
+ public IIcon getOverlayIcon() {
+ return null;
+ }
+
+ @Override
+ public void run() {
+ this.mIcon = GregTech_API.sBlockIcons.registerIcon("minecraft" + ":" + this.mIconName);
+ }
+
+ @Override
+ public ResourceLocation getTextureFile() {
+ return TextureMap.locationBlocksTexture;
+ }
+ }
+
+ public static GT_RenderedTexture getTextureFromIcon(CustomIcon aIcon, short[] aRGB) {
+ return new GT_RenderedTexture(aIcon, aRGB);
+ }
+
+ /*
+ * Add Some Custom Textures below.
+ * I am not sure whether or not I need to declare them as such, but better to be safe than sorry.
+ * Right?
+ */
+
+ //Vanilla Textures
+ public static final VanillaIcon VanillaIcon_OakPlanks = new VanillaIcon("planks_oak");
+
+
+
+ //PlaceHolder Texture
+ private static final CustomIcon Internal_PlaceHolder = new CustomIcon("TileEntities/_PlaceHolder");
+ public static final CustomIcon _PlaceHolder = Internal_PlaceHolder;
+
+ //Energy overlays
+ public static final CustomIcon OVERLAY_ENERGY_OUT_BUFFER = new CustomIcon("iconsets/OVERLAY_ENERGY_OUT_BUFFER");
+ public static final CustomIcon OVERLAY_ENERGY_OUT_MULTI_BUFFER = new CustomIcon("iconsets/OVERLAY_ENERGY_OUT_MULTI_BUFFER");
+
+ //Wooden Shelf and Compartment Overlays
+ public static final CustomIcon OVERLAY_WOODEN_SHELF_FRONT = new CustomIcon("TileEntities/Compartment/wood_shelf");
+ public static final CustomIcon OVERLAY_WOODEN_SHELF_CANS_FRONT = new CustomIcon("TileEntities/Compartment/wood_shelf_cans");
+ public static final CustomIcon OVERLAY_WOODEN_SHELF_PAPER_FRONT = new CustomIcon("TileEntities/Compartment/wood_shelf_paper");
+ public static final CustomIcon OVERLAY_CABINET_1 = new CustomIcon("TileEntities/Compartment/0");
+ public static final CustomIcon OVERLAY_CABINET_2 = new CustomIcon("TileEntities/Compartment/1");
+ public static final CustomIcon OVERLAY_CABINET_3 = new CustomIcon("TileEntities/Compartment/2");
+ public static final CustomIcon OVERLAY_CABINET_4 = new CustomIcon("TileEntities/Compartment/3");
+ public static final CustomIcon OVERLAY_CABINET_5 = new CustomIcon("TileEntities/Compartment/4");
+ public static final CustomIcon OVERLAY_CABINET_6 = new CustomIcon("TileEntities/Compartment/5");
+ public static final CustomIcon OVERLAY_CABINET_7 = new CustomIcon("TileEntities/Compartment/6");
+ public static final CustomIcon OVERLAY_CABINET_8 = new CustomIcon("TileEntities/Compartment/7");
+ public static final CustomIcon OVERLAY_CABINET_9 = new CustomIcon("TileEntities/Compartment/8");
+ public static final CustomIcon OVERLAY_CABINET_10 = new CustomIcon("TileEntities/Compartment/9");
+ public static final CustomIcon OVERLAY_CABINET_11 = new CustomIcon("TileEntities/Compartment/10");
+ public static final CustomIcon OVERLAY_CABINET_12 = new CustomIcon("TileEntities/Compartment/11");
+ public static final CustomIcon OVERLAY_CABINET_13 = new CustomIcon("TileEntities/Compartment/12");
+ public static final CustomIcon OVERLAY_CABINET_14 = new CustomIcon("TileEntities/Compartment/13");
+ public static final CustomIcon OVERLAY_CABINET_15 = new CustomIcon("TileEntities/Compartment/14");
+ public static final CustomIcon OVERLAY_CABINET_16 = new CustomIcon("TileEntities/Compartment/15");
+ public static final CustomIcon OVERLAY_COMPARTMENT_1 = new CustomIcon("TileEntities/Compartment/16");
+ public static final CustomIcon OVERLAY_COMPARTMENT_2 = new CustomIcon("TileEntities/Compartment/17");
+ public static final CustomIcon OVERLAY_COMPARTMENT_3 = new CustomIcon("TileEntities/Compartment/18");
+ public static final CustomIcon OVERLAY_COMPARTMENT_4 = new CustomIcon("TileEntities/Compartment/19");
+ public static final CustomIcon OVERLAY_COMPARTMENT_5 = new CustomIcon("TileEntities/Compartment/20");
+ public static final CustomIcon OVERLAY_COMPARTMENT_6 = new CustomIcon("TileEntities/Compartment/21");
+ public static final CustomIcon OVERLAY_COMPARTMENT_7 = new CustomIcon("TileEntities/Compartment/22");
+ public static final CustomIcon OVERLAY_COMPARTMENT_8 = new CustomIcon("TileEntities/Compartment/23");
+ public static final CustomIcon OVERLAY_COMPARTMENT_9 = new CustomIcon("TileEntities/Compartment/24");
+ public static final CustomIcon OVERLAY_COMPARTMENT_10 = new CustomIcon("TileEntities/Compartment/25");
+ public static final CustomIcon OVERLAY_COMPARTMENT_11 = new CustomIcon("TileEntities/Compartment/26");
+ public static final CustomIcon OVERLAY_COMPARTMENT_12 = new CustomIcon("TileEntities/Compartment/27");
+ public static final CustomIcon OVERLAY_COMPARTMENT_13 = new CustomIcon("TileEntities/Compartment/28");
+ public static final CustomIcon OVERLAY_COMPARTMENT_14 = new CustomIcon("TileEntities/Compartment/29");
+ public static final CustomIcon OVERLAY_COMPARTMENT_15 = new CustomIcon("TileEntities/Compartment/30");
+ public static final CustomIcon OVERLAY_COMPARTMENT_16 = new CustomIcon("TileEntities/Compartment/31");
+
+ //Controllers
+ private static final CustomIcon Internal_Casing_Fusion_Simple_Front = new CustomIcon("TileEntities/MACHINE_CASING_FUSION_FRONT");
+ public static final CustomIcon Casing_Fusion_Simple_Front = Internal_Casing_Fusion_Simple_Front;
+ private static final CustomIcon Internal_Casing_Fusion_Simple_Front_Active = new CustomIcon("TileEntities/MACHINE_CASING_FUSION_FRONT_ACTIVE");
+ public static final CustomIcon Casing_Fusion_Simple_Front_Active = Internal_Casing_Fusion_Simple_Front_Active;
+
+ //Machine Casings
+ //Simple
+ private static final CustomIcon Internal_Casing_Machine_Simple_Top = new CustomIcon("TileEntities/machine_top");
+ public static final CustomIcon Casing_Machine_Simple_Top = Internal_Casing_Machine_Simple_Top;
+ private static final CustomIcon Internal_Casing_Machine_Simple_Bottom = new CustomIcon("TileEntities/machine_bottom");
+ public static final CustomIcon Casing_Machine_Simple_Bottom = Internal_Casing_Machine_Simple_Bottom;
+ //Advanced and Ultra
+ private static final CustomIcon Internal_Casing_Machine_Advanced = new CustomIcon("TileEntities/high_adv_machine");
+ public static final CustomIcon Casing_Machine_Advanced = Internal_Casing_Machine_Advanced;
+ private static final CustomIcon Internal_Casing_Machine_Ultra = new CustomIcon("TileEntities/adv_machine_lesu");
+ public static final CustomIcon Casing_Machine_Ultra = Internal_Casing_Machine_Ultra;
+ //Dimensional - Non Overlay
+ private static final CustomIcon Internal_Casing_Machine_Dimensional = new CustomIcon("TileEntities/adv_machine_dimensional");
+ public static final CustomIcon Casing_Machine_Dimensional = Internal_Casing_Machine_Dimensional;
+ private static final CustomIcon Internal_Casing_Machine_Dimensional_Adv = new CustomIcon("TileEntities/high_adv_machine_dimensional");
+ public static final CustomIcon Casing_Machine_Dimensional_Adv = Internal_Casing_Machine_Dimensional_Adv;
+
+ //Material Casings
+ private static final CustomIcon Internal_Casing_Tantalloy61 = new CustomIcon("TileEntities/MACHINE_CASING_STABLE_TANTALLOY61");
+ public static final CustomIcon Casing_Material_Tantalloy61 = Internal_Casing_Tantalloy61;
+ private static final CustomIcon Internal_Casing_MaragingSteel = new CustomIcon("TileEntities/MACHINE_CASING_STABLE_MARAGINGSTEEL");
+ public static final CustomIcon Casing_Material_MaragingSteel = Internal_Casing_MaragingSteel;
+ private static final CustomIcon Internal_Casing_Stellite = new CustomIcon("TileEntities/MACHINE_CASING_STABLE_STELLITE");
+ public static final CustomIcon Casing_Material_Stellite = Internal_Casing_Stellite;
+ private static final CustomIcon Internal_Casing_Talonite = new CustomIcon("TileEntities/MACHINE_CASING_STABLE_TALONITE");
+ public static final CustomIcon Casing_Material_Talonite = Internal_Casing_Talonite;
+ private static final CustomIcon Internal_Casing_Tumbaga = new CustomIcon("TileEntities/MACHINE_CASING_STABLE_TUMBAGA");
+ public static final CustomIcon Casing_Material_Tumbaga = Internal_Casing_Tumbaga;
+ private static final CustomIcon Internal_Casing_Zeron100 = new CustomIcon("TileEntities/MACHINE_CASING_STABLE_ZERON100");
+ public static final CustomIcon Casing_Material_Zeron100 = Internal_Casing_Zeron100;
+ private static final CustomIcon Internal_Casing_Potin = new CustomIcon("TileEntities/MACHINE_CASING_STABLE_POTIN");
+ public static final CustomIcon Casing_Material_Potin = Internal_Casing_Potin;
+
+ private static final CustomIcon Internal_Casing_Grisium = new CustomIcon("TileEntities/MACHINE_CASING_STABLE_GRISIUM");
+ public static final CustomIcon Casing_Material_Grisium = Internal_Casing_Grisium;
+ private static final CustomIcon Internal_Casing_RedSteel = new CustomIcon("TileEntities/MACHINE_CASING_STABLE_RED_STEEL");
+ public static final CustomIcon Casing_Material_RedSteel = Internal_Casing_RedSteel;
+ private static final CustomIcon Internal_Casing_Incoloy020 = new CustomIcon("TileEntities/MACHINE_CASING_STABLE_INCOLOY_020");
+ public static final CustomIcon Casing_Material_Incoloy020 = Internal_Casing_Incoloy020;
+ private static final CustomIcon Internal_Casing_IncoloyDS = new CustomIcon("TileEntities/MACHINE_CASING_STABLE_INCOLOY_DS");
+ public static final CustomIcon Casing_Material_IncoloyDS = Internal_Casing_IncoloyDS;
+ private static final CustomIcon Internal_Casing_IncoloyMA956 = new CustomIcon("TileEntities/MACHINE_CASING_STABLE_INCOLOY_MA956");
+ public static final CustomIcon Casing_Material_IncoloyMA956 = Internal_Casing_IncoloyMA956;
+ private static final CustomIcon Internal_Casing_ZirconiumCarbide = new CustomIcon("TileEntities/MACHINE_CASING_STABLE_ZIRCONIUM_CARBIDE");
+ public static final CustomIcon Casing_Material_ZirconiumCarbide = Internal_Casing_ZirconiumCarbide;
+
+
+ private static final CustomIcon Internal_Casing_HastelloyX = new CustomIcon("TileEntities/MACHINE_CASING_STABLE_HASTELLOY_X");
+ public static final CustomIcon Casing_Material_HastelloyX = Internal_Casing_HastelloyX;
+ private static final CustomIcon Internal_Casing_HastelloyN = new CustomIcon("TileEntities/MACHINE_CASING_STABLE_HASTELLOY_N");
+ public static final CustomIcon Casing_Material_HastelloyN = Internal_Casing_HastelloyN;
+ private static final CustomIcon Internal_Casing_Fluid_IncoloyDS = new CustomIcon("TileEntities/MACHINE_CASING_FLUID_INCOLOY_DS");
+ public static final CustomIcon Casing_Material_Fluid_IncoloyDS = Internal_Casing_Fluid_IncoloyDS;
+
+ private static final CustomIcon Internal_Casing_Laurenium = new CustomIcon("TileEntities/MACHINE_CASING_LAURENIUM");
+ public static final CustomIcon Casing_Material_Laurenium = Internal_Casing_Laurenium;
+
+ //Trinium Alloys
+ public static final CustomIcon Casing_Trinium_Titanium = new CustomIcon("TileEntities/MACHINE_CASING_STABLE_TRINIUM_TITANIUM");
+ public static final CustomIcon Casing_Trinium_Naquadah = new CustomIcon("TileEntities/MACHINE_CASING_STABLE_TRINIUM_NAQUADAH");
+ public static final CustomIcon Casing_Trinium_Naquadah_Vent = new CustomIcon("TileEntities/MACHINE_CASING_STABLE_TRINIUM_NAQUADAH_VENT");
+ public static final CustomIcon Casing_Trinium_Naquadah_Carbon = new CustomIcon("TileEntities/MACHINE_CASING_STABLE_TRINIUM_NAQUADAH_CARBON");
+
+ //Material Machine/Firebox Casings
+ private static final CustomIcon Internal_Casing_Staballoy_Firebox = new CustomIcon("TileEntities/MACHINE_CASING_FIREBOX_STABALLOY");
+ public static final CustomIcon Casing_Staballoy_Firebox = Internal_Casing_Staballoy_Firebox;
+
+ //Misc Casings
+ private static final CustomIcon Internal_Casing_Machine_Redstone_Off = new CustomIcon("TileEntities/cover_redstone_conductor");
+ public static final CustomIcon Casing_Machine_Redstone_Off = Internal_Casing_Machine_Redstone_Off;
+ private static final CustomIcon Internal_Casing_Machine_Redstone_On = new CustomIcon("TileEntities/cover_redstone_emitter");
+ public static final CustomIcon Casing_Machine_Redstone_On = Internal_Casing_Machine_Redstone_On;
+
+ //Redox Cells
+ public static final CustomIcon Casing_Redox_1 = new CustomIcon("redox/redox1");
+ public static final CustomIcon Casing_Redox_2 = new CustomIcon("redox/redox2");
+ public static final CustomIcon Casing_Redox_3 = new CustomIcon("redox/redox3");
+ public static final CustomIcon Casing_Redox_4 = new CustomIcon("redox/redox4");
+ public static final CustomIcon Casing_Redox_5 = new CustomIcon("redox/redox5");
+ public static final CustomIcon Casing_Redox_6 = new CustomIcon("redox/redox6");
+ //public static final CustomIcon Casing_Redox_7 = new CustomIcon("redox/redox7");
+ //public static final CustomIcon Casing_Redox_8 = new CustomIcon("redox/redox8");
+
+ //Centrifuge Casing
+ private static final CustomIcon Internal_Casing_Centrifuge = new CustomIcon("TileEntities/MACHINE_CASING_CENTRIFUGE");
+ public static final CustomIcon Casing_Material_Centrifuge = Internal_Casing_Centrifuge;
+
+ //MACHINE_CASING_FARM_MANAGER_STRUCTURAL
+ //Farm Manager Casings
+ private static final CustomIcon Internal_Casing_Machine_Farm_Manager = new CustomIcon("TileEntities/MACHINE_CASING_FARM_MANAGER_STRUCTURAL");
+ public static final CustomIcon Casing_Machine_Farm_Manager = Internal_Casing_Machine_Farm_Manager;
+ //Acacia_Log
+ private static final CustomIcon Internal_Casing_Machine_Acacia_Log = new CustomIcon("TileEntities/log_acacia_top");
+ public static final CustomIcon Casing_Machine_Acacia_Log = Internal_Casing_Machine_Acacia_Log;
+ //Podzol Top
+ private static final CustomIcon Internal_Casing_Machine_Podzol = new CustomIcon("TileEntities/dirt_podzol_top");
+ public static final CustomIcon Casing_Machine_Podzol = Internal_Casing_Machine_Podzol;
+
+ //Structural Blocks
+ private static final CustomIcon Internal_Casing_Machine_Metal_Grate_A = new CustomIcon("chrono/MetalGrate");
+ public static final CustomIcon Casing_Machine_Metal_Grate_A = Internal_Casing_Machine_Metal_Grate_A;
+ private static final CustomIcon Internal_Casing_Machine_Metal_Grate_A_Solid = new CustomIcon("chrono/MetalGrateA_Solid");
+ public static final CustomIcon Casing_Machine_Metal_Grate_A_Solid = Internal_Casing_Machine_Metal_Grate_A_Solid;
+ private static final CustomIcon Internal_Casing_Machine_Metal_Grate_B = new CustomIcon("chrono/MetalGrate2");
+ public static final CustomIcon Casing_Machine_Metal_Grate_B = Internal_Casing_Machine_Metal_Grate_B;
+ private static final CustomIcon Internal_Casing_Machine_Metal_Panel_A = new CustomIcon("chrono/MetalPanel");
+ public static final CustomIcon Casing_Machine_Metal_Panel_A = Internal_Casing_Machine_Metal_Panel_A;
+ private static final CustomIcon Internal_Casing_Machine_Metal_Sheet_A = new CustomIcon("chrono/MetalSheet");
+ public static final CustomIcon Casing_Machine_Metal_Sheet_A = Internal_Casing_Machine_Metal_Sheet_A;
+ private static final CustomIcon Internal_Casing_Machine_Metal_Sheet_B = new CustomIcon("chrono/MetalSheet2");
+ public static final CustomIcon Casing_Machine_Metal_Sheet_B = Internal_Casing_Machine_Metal_Sheet_B;
+ private static final CustomIcon Internal_Casing_Machine_Metal_Sheet_C = new CustomIcon("chrono/MetalSheet3");
+ public static final CustomIcon Casing_Machine_Metal_Sheet_C = Internal_Casing_Machine_Metal_Sheet_C;
+ private static final CustomIcon Internal_Casing_Machine_Metal_Sheet_D = new CustomIcon("chrono/MetalSheet4");
+ public static final CustomIcon Casing_Machine_Metal_Sheet_D = Internal_Casing_Machine_Metal_Sheet_D;
+ private static final CustomIcon Internal_Casing_Machine_Metal_Sheet_E = new CustomIcon("chrono/MetalSheet5");
+ public static final CustomIcon Casing_Machine_Metal_Sheet_E = Internal_Casing_Machine_Metal_Sheet_E;
+ private static final CustomIcon Internal_Casing_Machine_Metal_Sheet_F = new CustomIcon("chrono/MetalSheet6");
+ public static final CustomIcon Casing_Machine_Metal_Sheet_F = Internal_Casing_Machine_Metal_Sheet_F;
+ private static final CustomIcon Internal_Casing_Machine_Metal_Sheet_G = new CustomIcon("chrono/MetalSheet7");
+ public static final CustomIcon Casing_Machine_Metal_Sheet_G = Internal_Casing_Machine_Metal_Sheet_G;
+ private static final CustomIcon Internal_Casing_Machine_Metal_Sheet_H = new CustomIcon("chrono/MetalSheet8");
+ public static final CustomIcon Casing_Machine_Metal_Sheet_H = Internal_Casing_Machine_Metal_Sheet_H;
+ private static final CustomIcon Internal_Casing_Machine_Metal_Sheet_I = new CustomIcon("chrono/MetalSheet9");
+ public static final CustomIcon Casing_Machine_Metal_Sheet_I = Internal_Casing_Machine_Metal_Sheet_I;
+ private static final CustomIcon Internal_Casing_Machine_Metal_Sheet_J = new CustomIcon("chrono/MetalSheet10");
+ public static final CustomIcon Casing_Machine_Metal_Sheet_J = Internal_Casing_Machine_Metal_Sheet_J;
+ private static final CustomIcon Internal_Casing_Machine_Metal_Sheet_K = new CustomIcon("chrono/MetalSheet11");
+ public static final CustomIcon Casing_Machine_Metal_Sheet_K = Internal_Casing_Machine_Metal_Sheet_K;
+ private static final CustomIcon Internal_Casing_Machine_Metal_Sheet_L = new CustomIcon("chrono/MetalSheet12");
+ public static final CustomIcon Casing_Machine_Metal_Sheet_L = Internal_Casing_Machine_Metal_Sheet_L;
+ private static final CustomIcon Internal_Overlay_Machine_Cyber_A = new CustomIcon("chrono/CyberPanel");
+ public static final CustomIcon Overlay_Machine_Cyber_A = Internal_Overlay_Machine_Cyber_A;
+ private static final CustomIcon Internal_Overlay_Machine_Cyber_B = new CustomIcon("chrono/CyberPanel2");
+ public static final CustomIcon Overlay_Machine_Cyber_B = Internal_Overlay_Machine_Cyber_B;
+
+
+ public static final CustomIcon TEXTURE_CASING_AMAZON = new CustomIcon("TileEntities/CASING_AMAZON");
+ public static final CustomIcon TEXTURE_CASING_ADVANCED_CRYOGENIC = new CustomIcon("TileEntities/MACHINE_CASING_ADVANCED_CRYOGENIC");
+ public static final CustomIcon TEXTURE_CASING_ADVANCED_VOLCNUS = new CustomIcon("TileEntities/MACHINE_CASING_ADVANCED_VOLCANUS");
+ public static final CustomIcon TEXTURE_CASING_ROCKETDYNE = new CustomIcon("TileEntities/MACHINE_CASING_ROCKETDYNE");
+ public static final CustomIcon TEXTURE_CASING_GRINDING_MILL = new CustomIcon("TileEntities/MACHINE_CASING_GRINDING_FACTORY");
+ public static final CustomIcon TEXTURE_CASING_FLOTATION = new CustomIcon("TileEntities/MACHINE_CASING_FLOTATION");
+
+ // Custom Pipes
+ public static final CustomIcon TEXTURE_PIPE_GRINDING_MILL = new CustomIcon("TileEntities/MACHINE_CASING_PIPE_T1");
+
+ // Custom Gearboxes
+ public static final CustomIcon TEXTURE_GEARBOX_GRINDING_MILL = new CustomIcon("TileEntities/MACHINE_CASING_GEARBOX_T1");
+
+ public static final CustomIcon TEXTURE_CASING_FUSION_COIL_II = new CustomIcon("iconsets/MACHINE_CASING_FUSION_3");
+ public static final CustomIcon TEXTURE_CASING_FUSION_COIL_II_INNER = new CustomIcon("iconsets/MACHINE_CASING_FUSION_COIL_II");
+ public static final CustomIcon TEXTURE_CASING_FUSION_CASING_ULTRA = new CustomIcon("iconsets/MACHINE_CASING_FUSION_GLASS_ULTRA");
+ //
+ public static final CustomIcon TEXTURE_CASING_FUSION_COIL_II_1 = new CustomIcon("iconsets/FUSIONIII_1");
+ public static final CustomIcon TEXTURE_CASING_FUSION_COIL_II_2 = new CustomIcon("iconsets/FUSIONIII_2");
+ public static final CustomIcon TEXTURE_CASING_FUSION_COIL_II_3 = new CustomIcon("iconsets/FUSIONIII_3");
+ public static final CustomIcon TEXTURE_CASING_FUSION_COIL_II_4 = new CustomIcon("iconsets/FUSIONIII_4");
+ public static final CustomIcon TEXTURE_CASING_FUSION_COIL_II_5 = new CustomIcon("iconsets/FUSIONIII_5");
+ public static final CustomIcon TEXTURE_CASING_FUSION_COIL_II_6 = new CustomIcon("iconsets/FUSIONIII_6");
+ public static final CustomIcon TEXTURE_CASING_FUSION_COIL_II_7 = new CustomIcon("iconsets/FUSIONIII_7");
+ public static final CustomIcon TEXTURE_CASING_FUSION_COIL_II_8 = new CustomIcon("iconsets/FUSIONIII_8");
+ public static final CustomIcon TEXTURE_CASING_FUSION_COIL_II_9 = new CustomIcon("iconsets/FUSIONIII_9");
+ public static final CustomIcon TEXTURE_CASING_FUSION_COIL_II_10 = new CustomIcon("iconsets/FUSIONIII_10");
+ public static final CustomIcon TEXTURE_CASING_FUSION_COIL_II_11 = new CustomIcon("iconsets/FUSIONIII_11");
+ public static final CustomIcon TEXTURE_CASING_FUSION_COIL_II_12 = new CustomIcon("iconsets/FUSIONIII_12");
+
+ //Overlays
+ //Fan Textures
+ private static final CustomIcon Internal_Overlay_Machine_Vent = new CustomIcon("TileEntities/machine_top_vent_rotating");
+ public static final CustomIcon Overlay_Machine_Vent = Internal_Overlay_Machine_Vent;
+ private static final CustomIcon Internal_Overlay_Machine_Vent_Fast = new CustomIcon("TileEntities/machine_top_vent_rotating_fast");
+ public static final CustomIcon Overlay_Machine_Vent_Fast = Internal_Overlay_Machine_Vent_Fast;
+ private static final CustomIcon Internal_Overlay_Machine_Vent_Adv = new CustomIcon("TileEntities/adv_machine_vent_rotating");
+ public static final CustomIcon Overlay_Machine_Vent_Adv = Internal_Overlay_Machine_Vent_Adv;
+ private static final CustomIcon Internal_Overlay_Machine_Turbine_Active = new CustomIcon("TileEntities/STEAM_TURBINE_SIDE_ACTIVE");
+ public static final CustomIcon Overlay_Machine_Turbine_Active = Internal_Overlay_Machine_Turbine_Active;
+ //Grate Texture
+ public static final CustomIcon OVERLAY_GRATE_A = new CustomIcon("metro/OVERLAY_GRATE_A");
+ //Speaker Texture
+ private static final CustomIcon Internal_Overlay_Machine_Sound = new CustomIcon("TileEntities/audio_out");
+ public static final CustomIcon Overlay_Machine_Sound = Internal_Overlay_Machine_Sound;
+ private static final CustomIcon Internal_Overlay_Machine_Sound_Active = new CustomIcon("TileEntities/audio_out_active");
+ public static final CustomIcon Overlay_Machine_Sound_Active = Internal_Overlay_Machine_Sound_Active;
+ //Diesel Engines
+ private static final CustomIcon Internal_Overlay_Machine_Diesel_Vertical = new CustomIcon("TileEntities/machine_top_dieselmotor");
+ public static final CustomIcon Overlay_Machine_Diesel_Vertical = Internal_Overlay_Machine_Diesel_Vertical;
+ private static final CustomIcon Internal_Overlay_Machine_Diesel_Horizontal = new CustomIcon("TileEntities/machine_top_dieselmotor2");
+ public static final CustomIcon Overlay_Machine_Diesel_Horizontal = Internal_Overlay_Machine_Diesel_Horizontal;
+ private static final CustomIcon Internal_Overlay_Machine_Diesel_Vertical_Active = new CustomIcon("TileEntities/machine_top_dieselmotor_active");
+ public static final CustomIcon Overlay_Machine_Diesel_Vertical_Active = Internal_Overlay_Machine_Diesel_Vertical_Active;
+ private static final CustomIcon Internal_Overlay_Machine_Diesel_Horizontal_Active = new CustomIcon("TileEntities/machine_top_dieselmotor2_active");
+ public static final CustomIcon Overlay_Machine_Diesel_Horizontal_Active = Internal_Overlay_Machine_Diesel_Horizontal_Active;
+ //Computer Screens
+ private static final CustomIcon Internal_Casing_Machine_Screen_1 = new CustomIcon("TileEntities/adv_machine_screen_random1");
+ public static final CustomIcon Casing_Machine_Screen_1 = Internal_Casing_Machine_Screen_1;
+ private static final CustomIcon Internal_Casing_Machine_Screen_2 = new CustomIcon("TileEntities/adv_machine_screen_random2");
+ public static final CustomIcon Casing_Machine_Screen_2 = Internal_Casing_Machine_Screen_2;
+ private static final CustomIcon Internal_Casing_Machine_Screen_3 = new CustomIcon("TileEntities/adv_machine_screen_random3");
+ public static final CustomIcon Casing_Machine_Screen_3 = Internal_Casing_Machine_Screen_3;
+ private static final CustomIcon Internal_Casing_Machine_Screen_Frequency = new CustomIcon("TileEntities/adv_machine_screen_frequency");
+ public static final CustomIcon Casing_Machine_Screen_Frequency = Internal_Casing_Machine_Screen_Frequency;
+ private static final CustomIcon Internal_Overlay_Machine_Screen_Logo = new CustomIcon("TileEntities/adv_machine_screen_logo");
+ public static final CustomIcon Overlay_Machine_Screen_Logo = Internal_Overlay_Machine_Screen_Logo;
+ private static final CustomIcon Internal_Overlay_Machine_Cyber_Interface = new CustomIcon("chrono/Overlay_Cyber");
+ public static final CustomIcon Overlay_Machine_Cyber_Interface = Internal_Overlay_Machine_Cyber_Interface;
+
+ //Machine Controller Overlays
+ private static final CustomIcon Internal_Overlay_Machine_Controller_Default = new CustomIcon("iconsets/OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE_ANIMATED");
+ public static final CustomIcon Overlay_Machine_Controller_Default = Internal_Overlay_Machine_Controller_Default;
+ private static final CustomIcon Internal_Overlay_Machine_Controller_Default_Active = new CustomIcon("iconsets/OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE_ANIMATED_ACTIVE");
+ public static final CustomIcon Overlay_Machine_Controller_Default_Active = Internal_Overlay_Machine_Controller_Default_Active;
+
+ private static final CustomIcon Internal_Overlay_Machine_Controller_Advanced = new CustomIcon("iconsets/OVERLAY_FRONT_ADVANCED_MULTIBLOCK_ANIMATED");
+ public static final CustomIcon Overlay_Machine_Controller_Advanced = Internal_Overlay_Machine_Controller_Advanced;
+ private static final CustomIcon Internal_Overlay_Machine_Controller_Advanced_Active = new CustomIcon("iconsets/OVERLAY_FRONT_ADVANCED_MULTIBLOCK_ANIMATED_ACTIVE");
+ public static final CustomIcon Overlay_Machine_Controller_Advanced_Active = Internal_Overlay_Machine_Controller_Advanced_Active;
+
+ //Fluid Reactor Overlays
+ public static final CustomIcon Overlay_FluidReactor_Front = new CustomIcon("TileEntities/FluidReactor/OVERLAY_FRONT");
+ public static final CustomIcon Overlay_FluidReactor_Side = new CustomIcon("TileEntities/FluidReactor/OVERLAY_SIDE");
+ public static final CustomIcon Overlay_FluidReactor_Top = new CustomIcon("TileEntities/FluidReactor/OVERLAY_TOP");
+ public static final CustomIcon Overlay_FluidReactor_Front_Active = new CustomIcon("TileEntities/FluidReactor/OVERLAY_FRONT_ACTIVE");
+ public static final CustomIcon Overlay_FluidReactor_Side_Active = new CustomIcon("TileEntities/FluidReactor/OVERLAY_SIDE_ACTIVE");
+ public static final CustomIcon Overlay_FluidReactor_Top_Active = new CustomIcon("TileEntities/FluidReactor/OVERLAY_TOP_ACTIVE");
+
+ //Crafting Overlays
+ private static final CustomIcon Internal_Overlay_Crafting_Bronze = new CustomIcon("TileEntities/bronze_top_crafting");
+ public static final CustomIcon Overlay_Crafting_Bronze = Internal_Overlay_Crafting_Bronze;
+ private static final CustomIcon Internal_Overlay_Crafting_Steel = new CustomIcon("TileEntities/cover_crafting");
+ public static final CustomIcon Overlay_Crafting_Steel = Internal_Overlay_Crafting_Steel;
+
+ //Covers
+ private static final CustomIcon Internal_Overlay_Overflow_Valve = new CustomIcon("iconsets/OVERLAY_OVERFLOW_VALVE");
+ public static final CustomIcon Overlay_Overflow_Valve = Internal_Overlay_Overflow_Valve;
+
+
+ //Hatch Overlays
+ //Charger Texture
+ private static final CustomIcon Internal_Overlay_Hatch_Charger = new CustomIcon("TileEntities/cover_charger");
+ public static final CustomIcon Overlay_Hatch_Charger = Internal_Overlay_Hatch_Charger;
+ //Discharger Texture
+ private static final CustomIcon Internal_Overlay_Hatch_Discharger = new CustomIcon("TileEntities/cover_discharge");
+ public static final CustomIcon Overlay_Hatch_Discharger = Internal_Overlay_Hatch_Discharger;
+ //Advanced Muffler
+ private static final CustomIcon Internal_Overlay_Hatch_Muffler_Adv = new CustomIcon("iconsets/OVERLAY_MUFFLER_ADV");
+ public static final CustomIcon Overlay_Hatch_Muffler_Adv = Internal_Overlay_Hatch_Muffler_Adv;
+ //Control Core Bus
+ private static final CustomIcon Internal_Overlay_Hatch_Control_Core = new CustomIcon("iconsets/OVERLAY_CONTROL_CORE_BUS");
+ public static final CustomIcon Overlay_Hatch_Control_Core = Internal_Overlay_Hatch_Control_Core;
+ // Milling Ball Bus
+ private static final CustomIcon Internal_Overlay_Bus_Milling_Balls = new CustomIcon("iconsets/OVERLAY_MILLING_BALL_BUS");
+ public static final CustomIcon Overlay_Bus_Milling_Balls = Internal_Overlay_Bus_Milling_Balls;
+ // Catalyst Bus
+ private static final CustomIcon Internal_Overlay_Bus_Catalyst = new CustomIcon("iconsets/OVERLAY_CATALYSTS");
+ public static final CustomIcon Overlay_Bus_Catalyst = Internal_Overlay_Bus_Catalyst;
+ // RTG Hatch
+ private static final CustomIcon Internal_Overlay_Hatch_RTG_Off = new CustomIcon("iconsets/OVERLAY_ENERGY_RTG_OFF");
+ public static final CustomIcon Overlay_Hatch_RTG_Off = Internal_Overlay_Hatch_RTG_Off;
+ private static final CustomIcon Internal_Overlay_Hatch_RTG_On = new CustomIcon("iconsets/OVERLAY_ENERGY_RTG_ON");
+ public static final CustomIcon Overlay_Hatch_RTG_On = Internal_Overlay_Hatch_RTG_On;
+
+ //Dimensional
+ private static final CustomIcon Internal_Overlay_Machine_Dimensional_Blue = new CustomIcon("TileEntities/adv_machine_dimensional_cover_blue");
+ public static final CustomIcon Overlay_Machine_Dimensional_Blue = Internal_Overlay_Machine_Dimensional_Blue;
+ private static final CustomIcon Internal_Overlay_Machine_Dimensional_Orange = new CustomIcon("TileEntities/adv_machine_dimensional_cover_orange");
+ public static final CustomIcon Overlay_Machine_Dimensional_Orange = Internal_Overlay_Machine_Dimensional_Orange;
+ //Icons
+ private static final CustomIcon Internal_Overlay_MatterFab = new CustomIcon("TileEntities/adv_machine_matterfab");
+ public static final CustomIcon Overlay_MatterFab = Internal_Overlay_MatterFab;
+ private static final CustomIcon Internal_Overlay_MatterFab_Active = new CustomIcon("TileEntities/adv_machine_matterfab_active");
+ public static final CustomIcon Overlay_MatterFab_Active = Internal_Overlay_MatterFab_Active;
+
+ private static final CustomIcon Internal_Overlay_MatterFab_Animated = new CustomIcon("TileEntities/adv_machine_matterfab_animated");
+ public static final CustomIcon Overlay_MatterFab_Animated = Internal_Overlay_MatterFab_Animated;
+ private static final CustomIcon Internal_Overlay_MatterFab_Active_Animated = new CustomIcon("TileEntities/adv_machine_matterfab_active_animated");
+ public static final CustomIcon Overlay_MatterFab_Active_Animated = Internal_Overlay_MatterFab_Active_Animated;
+
+ private static final CustomIcon Internal_Overlay_Oil = new CustomIcon("TileEntities/adv_machine_oil");
+ public static final CustomIcon Overlay_Oil = Internal_Overlay_Oil;
+ private static final CustomIcon Internal_Overlay_UU_Matter = new CustomIcon("TileEntities/adv_machine_uum");
+ public static final CustomIcon Overlay_UU_Matter = Internal_Overlay_UU_Matter;
+
+ // GT++ Tiered Hulls
+ public static final CustomIcon TEXTURE_CASING_TIERED_ULV = new CustomIcon("iconsets/TieredHulls/CASING_ULV");
+ public static final CustomIcon TEXTURE_CASING_TIERED_LV = new CustomIcon("iconsets/TieredHulls/CASING_LV");
+ public static final CustomIcon TEXTURE_CASING_TIERED_MV = new CustomIcon("iconsets/TieredHulls/CASING_MV");
+ public static final CustomIcon TEXTURE_CASING_TIERED_HV = new CustomIcon("iconsets/TieredHulls/CASING_HV");
+ public static final CustomIcon TEXTURE_CASING_TIERED_EV = new CustomIcon("iconsets/TieredHulls/CASING_EV");
+ public static final CustomIcon TEXTURE_CASING_TIERED_IV = new CustomIcon("iconsets/TieredHulls/CASING_IV");
+ public static final CustomIcon TEXTURE_CASING_TIERED_LuV = new CustomIcon("iconsets/TieredHulls/CASING_LuV");
+ public static final CustomIcon TEXTURE_CASING_TIERED_ZPM = new CustomIcon("iconsets/TieredHulls/CASING_ZPM");
+ public static final CustomIcon TEXTURE_CASING_TIERED_UV = new CustomIcon("iconsets/TieredHulls/CASING_UV");
+ public static final CustomIcon TEXTURE_CASING_TIERED_MAX = new CustomIcon("iconsets/TieredHulls/CASING_MAX");
+
+ //Metroid related
+ public static final CustomIcon TEXTURE_METAL_PANEL_A = new CustomIcon("metro/TEXTURE_METAL_PANEL_A");
+ public static final CustomIcon TEXTURE_METAL_PANEL_B = new CustomIcon("metro/TEXTURE_METAL_PANEL_B");
+ public static final CustomIcon TEXTURE_METAL_PANEL_C = new CustomIcon("metro/TEXTURE_METAL_PANEL_C");
+ public static final CustomIcon TEXTURE_METAL_PANEL_D = new CustomIcon("metro/TEXTURE_METAL_PANEL_D");
+ public static final CustomIcon TEXTURE_METAL_PANEL_E = new CustomIcon("metro/TEXTURE_METAL_PANEL_E");
+ public static final CustomIcon TEXTURE_METAL_PANEL_F = new CustomIcon("metro/TEXTURE_METAL_PANEL_F");
+ public static final CustomIcon TEXTURE_METAL_PANEL_G = new CustomIcon("metro/TEXTURE_METAL_PANEL_G");
+ public static final CustomIcon TEXTURE_METAL_PANEL_H = new CustomIcon("metro/TEXTURE_METAL_PANEL_H");
+ public static final CustomIcon TEXTURE_METAL_PANEL_I = new CustomIcon("metro/TEXTURE_METAL_PANEL_I");
+
+ public static final CustomIcon TEXTURE_MAGIC_PANEL_A = new CustomIcon("metro/TEXTURE_MAGIC_A");
+
+ public static final CustomIcon TEXTURE_ORGANIC_PANEL_A = new CustomIcon("metro/TEXTURE_ORGANIC_PANEL_A");
+ public static final CustomIcon TEXTURE_ORGANIC_PANEL_A_GLOWING = new CustomIcon("metro/TEXTURE_ORGANIC_PANEL_A_GLOWING");
+
+ public static final CustomIcon TEXTURE_STONE_BIRD_A = new CustomIcon("metro/TEXTURE_STONE_BIRD_A");
+ public static final CustomIcon TEXTURE_STONE_BIRD_A_LEFT = new CustomIcon("metro/TEXTURE_STONE_BIRD_A_LEFT");
+ public static final CustomIcon TEXTURE_STONE_BIRD_A_RIGHT = new CustomIcon("metro/TEXTURE_STONE_BIRD_A_RIGHT");
+ public static final CustomIcon TEXTURE_STONE_RED_A = new CustomIcon("metro/TEXTURE_STONE_RED_A");
+ public static final CustomIcon TEXTURE_STONE_RED_B = new CustomIcon("metro/TEXTURE_STONE_RED_B");
+ public static final CustomIcon TEXTURE_STONE_BLUE_A = new CustomIcon("metro/TEXTURE_STONE_BLUE_A");
+ public static final CustomIcon TEXTURE_STONE_GREEN_A = new CustomIcon("metro/TEXTURE_STONE_GREEN_A");
+ public static final CustomIcon TEXTURE_STONE_TABLET_A = new CustomIcon("metro/TEXTURE_STONE_TABLET_A");
+ public static final CustomIcon TEXTURE_STONE_TABLET_B = new CustomIcon("metro/TEXTURE_STONE_TABLET_B");
+
+ public static final CustomIcon TEXTURE_TECH_A = new CustomIcon("metro/TEXTURE_TECH_A");
+ public static final CustomIcon TEXTURE_TECH_B = new CustomIcon("metro/TEXTURE_TECH_B");
+ public static final CustomIcon TEXTURE_TECH_C = new CustomIcon("metro/TEXTURE_TECH_C");
+
+ public static final CustomIcon TEXTURE_TECH_PANEL_A = new CustomIcon("metro/TEXTURE_TECH_PANEL_A");
+ public static final CustomIcon TEXTURE_TECH_PANEL_B = new CustomIcon("metro/TEXTURE_TECH_PANEL_B");
+ public static final CustomIcon TEXTURE_TECH_PANEL_C = new CustomIcon("metro/TEXTURE_TECH_PANEL_C");
+ public static final CustomIcon TEXTURE_TECH_PANEL_D = new CustomIcon("metro/TEXTURE_TECH_PANEL_D");
+
+ public static final CustomIcon TEXTURE_TECH_PANEL_RADIOACTIVE = new CustomIcon("TileEntities/DecayablesChest_bottom");
+ public static final CustomIcon TEXTURE_TECH_PANEL_RADIOACTIVE_ALT = new CustomIcon("TileEntities/DecayablesChest_top");
+
+ // LFTR Single blocks
+ public static final CustomIcon OVERLAY_REACTOR_COLDTRAP_FRONT = new CustomIcon("TileEntities/ReactorColdTrap/OVERLAY_FRONT");
+ public static final CustomIcon OVERLAY_REACTOR_COLDTRAP_FRONT_ACTIVE = new CustomIcon("TileEntities/ReactorColdTrap/OVERLAY_FRONT_ACTIVE");
+ public static final CustomIcon OVERLAY_REACTOR_COLDTRAP_SIDE = new CustomIcon("TileEntities/ReactorColdTrap/OVERLAY_SIDE");
+ public static final CustomIcon OVERLAY_REACTOR_COLDTRAP_SIDE_ACTIVE = new CustomIcon("TileEntities/ReactorColdTrap/OVERLAY_SIDE_ACTIVE");
+ public static final CustomIcon OVERLAY_REACTOR_COLDTRAP_TOP = new CustomIcon("TileEntities/ReactorColdTrap/OVERLAY_TOP");
+ public static final CustomIcon OVERLAY_REACTOR_COLDTRAP_TOP_ACTIVE = new CustomIcon("TileEntities/ReactorColdTrap/OVERLAY_TOP_ACTIVE");
+
+ public static final CustomIcon OVERLAY_REACTOR_PROCESSINGUNIT_FRONT = new CustomIcon("TileEntities/ReactorProcessingUnit/OVERLAY_FRONT");
+ public static final CustomIcon OVERLAY_REACTOR_PROCESSINGUNIT_FRONT_ACTIVE = new CustomIcon("TileEntities/ReactorProcessingUnit/OVERLAY_FRONT_ACTIVE");
+ public static final CustomIcon OVERLAY_REACTOR_PROCESSINGUNIT_SIDE = new CustomIcon("TileEntities/ReactorProcessingUnit/OVERLAY_SIDE");
+ public static final CustomIcon OVERLAY_REACTOR_PROCESSINGUNIT_SIDE_ACTIVE = new CustomIcon("TileEntities/ReactorProcessingUnit/OVERLAY_SIDE_ACTIVE");
+ public static final CustomIcon OVERLAY_REACTOR_PROCESSINGUNIT_TOP = new CustomIcon("TileEntities/ReactorProcessingUnit/OVERLAY_TOP");
+ public static final CustomIcon OVERLAY_REACTOR_PROCESSINGUNIT_TOP_ACTIVE = new CustomIcon("TileEntities/ReactorProcessingUnit/OVERLAY_TOP_ACTIVE");
+
+
+ //Overlay Arrays
+ public static ITexture[] OVERLAYS_ENERGY_OUT_BUFFER = new ITexture[]{
+ new GT_RenderedTexture((IIconContainer) OVERLAY_ENERGY_OUT_BUFFER,
+ new short[]{220, 220, 220, 0}),
+ new GT_RenderedTexture((IIconContainer) OVERLAY_ENERGY_OUT_BUFFER,
+ new short[]{220, 220, 220, 0}),
+ new GT_RenderedTexture((IIconContainer) OVERLAY_ENERGY_OUT_BUFFER,
+ new short[]{255, 100, 0, 0}),
+ new GT_RenderedTexture((IIconContainer) OVERLAY_ENERGY_OUT_BUFFER,
+ new short[]{255, 255, 30, 0}),
+ new GT_RenderedTexture((IIconContainer) OVERLAY_ENERGY_OUT_BUFFER,
+ new short[]{128, 128, 128, 0}),
+ new GT_RenderedTexture((IIconContainer) OVERLAY_ENERGY_OUT_BUFFER,
+ new short[]{240, 240, 245, 0}),
+ new GT_RenderedTexture((IIconContainer) OVERLAY_ENERGY_OUT_BUFFER,
+ new short[]{240, 240, 245, 0}),
+ new GT_RenderedTexture((IIconContainer) OVERLAY_ENERGY_OUT_BUFFER,
+ new short[]{240, 240, 245, 0}),
+ new GT_RenderedTexture((IIconContainer) OVERLAY_ENERGY_OUT_BUFFER,
+ new short[]{240, 240, 245, 0}),
+ new GT_RenderedTexture((IIconContainer) OVERLAY_ENERGY_OUT_BUFFER,
+ new short[]{240, 240, 245, 0})};
+
+ public static ITexture[] OVERLAYS_ENERGY_OUT_MULTI_BUFFER = new ITexture[]{
+ new GT_RenderedTexture((IIconContainer) OVERLAY_ENERGY_OUT_MULTI_BUFFER,
+ new short[]{220, 220, 220, 0}),
+ new GT_RenderedTexture((IIconContainer) OVERLAY_ENERGY_OUT_MULTI_BUFFER,
+ new short[]{220, 220, 220, 0}),
+ new GT_RenderedTexture((IIconContainer) OVERLAY_ENERGY_OUT_MULTI_BUFFER,
+ new short[]{255, 100, 0, 0}),
+ new GT_RenderedTexture((IIconContainer) OVERLAY_ENERGY_OUT_MULTI_BUFFER,
+ new short[]{255, 255, 30, 0}),
+ new GT_RenderedTexture((IIconContainer) OVERLAY_ENERGY_OUT_MULTI_BUFFER,
+ new short[]{128, 128, 128, 0}),
+ new GT_RenderedTexture((IIconContainer) OVERLAY_ENERGY_OUT_MULTI_BUFFER,
+ new short[]{240, 240, 245, 0}),
+ new GT_RenderedTexture((IIconContainer) OVERLAY_ENERGY_OUT_MULTI_BUFFER,
+ new short[]{240, 240, 245, 0}),
+ new GT_RenderedTexture((IIconContainer) OVERLAY_ENERGY_OUT_MULTI_BUFFER,
+ new short[]{240, 240, 245, 0}),
+ new GT_RenderedTexture((IIconContainer) OVERLAY_ENERGY_OUT_MULTI_BUFFER,
+ new short[]{240, 240, 245, 0}),
+ new GT_RenderedTexture((IIconContainer) OVERLAY_ENERGY_OUT_MULTI_BUFFER,
+ new short[]{240, 240, 245, 0})};
+
+ public static ITexture[] OVERLAYS_CABINET_FRONT = new ITexture[]{
+ new GT_RenderedTexture((IIconContainer) OVERLAY_CABINET_1,
+ new short[]{255, 255, 255, 0}),
+ new GT_RenderedTexture((IIconContainer) OVERLAY_CABINET_2,
+ new short[]{255, 255, 255, 0}),
+ new GT_RenderedTexture((IIconContainer) OVERLAY_CABINET_3,
+ new short[]{255, 255, 255, 0}),
+ new GT_RenderedTexture((IIconContainer) OVERLAY_CABINET_4,
+ new short[]{255, 255, 255, 0}),
+ new GT_RenderedTexture((IIconContainer) OVERLAY_CABINET_5,
+ new short[]{255, 255, 255, 0}),
+ new GT_RenderedTexture((IIconContainer) OVERLAY_CABINET_6,
+ new short[]{255, 255, 255, 0}),
+ new GT_RenderedTexture((IIconContainer) OVERLAY_CABINET_7,
+ new short[]{255, 255, 255, 0}),
+ new GT_RenderedTexture((IIconContainer) OVERLAY_CABINET_8,
+ new short[]{255, 255, 255, 0}),
+ new GT_RenderedTexture((IIconContainer) OVERLAY_CABINET_9,
+ new short[]{255, 255, 255, 0}),
+ new GT_RenderedTexture((IIconContainer) OVERLAY_CABINET_10,
+ new short[]{255, 255, 255, 0}),
+ new GT_RenderedTexture((IIconContainer) OVERLAY_CABINET_11,
+ new short[]{255, 255, 255, 0}),
+ new GT_RenderedTexture((IIconContainer) OVERLAY_CABINET_12,
+ new short[]{255, 255, 255, 0}),
+ new GT_RenderedTexture((IIconContainer) OVERLAY_CABINET_13,
+ new short[]{255, 255, 255, 0}),
+ new GT_RenderedTexture((IIconContainer) OVERLAY_CABINET_14,
+ new short[]{255, 255, 255, 0}),
+ new GT_RenderedTexture((IIconContainer) OVERLAY_CABINET_15,
+ new short[]{255, 255, 255, 0}),
+ new GT_RenderedTexture((IIconContainer) OVERLAY_CABINET_16,
+ new short[]{255, 255, 255, 0}),};
+
+ public static ITexture[] OVERLAYS_COMPARTMENT_FRONT = new ITexture[]{
+ new GT_RenderedTexture((IIconContainer) OVERLAY_COMPARTMENT_1,
+ new short[]{255, 255, 255, 0}),
+ new GT_RenderedTexture((IIconContainer) OVERLAY_COMPARTMENT_2,
+ new short[]{255, 255, 255, 0}),
+ new GT_RenderedTexture((IIconContainer) OVERLAY_COMPARTMENT_3,
+ new short[]{255, 255, 255, 0}),
+ new GT_RenderedTexture((IIconContainer) OVERLAY_COMPARTMENT_4,
+ new short[]{255, 255, 255, 0}),
+ new GT_RenderedTexture((IIconContainer) OVERLAY_COMPARTMENT_5,
+ new short[]{255, 255, 255, 0}),
+ new GT_RenderedTexture((IIconContainer) OVERLAY_COMPARTMENT_6,
+ new short[]{255, 255, 255, 0}),
+ new GT_RenderedTexture((IIconContainer) OVERLAY_COMPARTMENT_7,
+ new short[]{255, 255, 255, 0}),
+ new GT_RenderedTexture((IIconContainer) OVERLAY_COMPARTMENT_8,
+ new short[]{255, 255, 255, 0}),
+ new GT_RenderedTexture((IIconContainer) OVERLAY_COMPARTMENT_9,
+ new short[]{255, 255, 255, 0}),
+ new GT_RenderedTexture((IIconContainer) OVERLAY_COMPARTMENT_10,
+ new short[]{255, 255, 255, 0}),
+ new GT_RenderedTexture((IIconContainer) OVERLAY_COMPARTMENT_11,
+ new short[]{255, 255, 255, 0}),
+ new GT_RenderedTexture((IIconContainer) OVERLAY_COMPARTMENT_12,
+ new short[]{255, 255, 255, 0}),
+ new GT_RenderedTexture((IIconContainer) OVERLAY_COMPARTMENT_13,
+ new short[]{255, 255, 255, 0}),
+ new GT_RenderedTexture((IIconContainer) OVERLAY_COMPARTMENT_14,
+ new short[]{255, 255, 255, 0}),
+ new GT_RenderedTexture((IIconContainer) OVERLAY_COMPARTMENT_15,
+ new short[]{255, 255, 255, 0}),
+ new GT_RenderedTexture((IIconContainer) OVERLAY_COMPARTMENT_16,
+ new short[]{255, 255, 255, 0}),};
+
+ public static IIconContainer[] CONNECTED_FUSION_HULLS = new IIconContainer[]{
+ TEXTURE_CASING_FUSION_COIL_II_1, TEXTURE_CASING_FUSION_COIL_II_2, TEXTURE_CASING_FUSION_COIL_II_3,
+ TEXTURE_CASING_FUSION_COIL_II_4, TEXTURE_CASING_FUSION_COIL_II_5, TEXTURE_CASING_FUSION_COIL_II_6,
+ TEXTURE_CASING_FUSION_COIL_II_7, TEXTURE_CASING_FUSION_COIL_II_8, TEXTURE_CASING_FUSION_COIL_II_9,
+ TEXTURE_CASING_FUSION_COIL_II_10, TEXTURE_CASING_FUSION_COIL_II_11, TEXTURE_CASING_FUSION_COIL_II_12};
+
+ public static IIconContainer[] TIERED_MACHINE_HULLS = new IIconContainer[]{
+ TEXTURE_CASING_TIERED_ULV,
+ TEXTURE_CASING_TIERED_LV,
+ TEXTURE_CASING_TIERED_MV,
+ TEXTURE_CASING_TIERED_HV,
+ TEXTURE_CASING_TIERED_EV,
+ TEXTURE_CASING_TIERED_IV,
+ TEXTURE_CASING_TIERED_LuV,
+ TEXTURE_CASING_TIERED_ZPM,
+ TEXTURE_CASING_TIERED_UV,
+ TEXTURE_CASING_TIERED_MAX};
+
+
+ public static Object Casing_Material_Turbine;
+
+
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtCutomCovers.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtCutomCovers.java
new file mode 100644
index 0000000000..cc5cf3d55e
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtCutomCovers.java
@@ -0,0 +1,32 @@
+package gtPlusPlus.xmod.gregtech.common.blocks.textures;
+
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.CustomIcon;
+
+public class TexturesGtCutomCovers {
+
+ public static final CustomIcon[] TEXTURE_ZTONES_AGON = new CustomIcon[16];
+ public static final CustomIcon[] TEXTURE_ZTONES_ISZM = new CustomIcon[16];
+ public static final CustomIcon[] TEXTURE_ZTONES_KORP = new CustomIcon[16];
+ public static final CustomIcon[] TEXTURE_ZTONES_JELT = new CustomIcon[16];
+ public static final CustomIcon[] TEXTURE_ZTONES_BITT = new CustomIcon[16];
+
+ public static void init() {
+ generateZTones();
+ }
+
+ private static void generateZTones() {
+ // ZTONES
+ String[] aZtoneCoverTextureNames = new String[] { "agon", "iszm", "korp", "jelt", "bitt" };
+ int aArrayIndex = 0;
+ CustomIcon[][] aArrays = new CustomIcon[][] { TEXTURE_ZTONES_AGON, TEXTURE_ZTONES_ISZM, TEXTURE_ZTONES_KORP,
+ TEXTURE_ZTONES_JELT, TEXTURE_ZTONES_BITT };
+
+ for (CustomIcon[] t : aArrays) {
+ for (int s = 0; s < 16; s++) {
+ t[s] = new CustomIcon("Ztones", "sets/" + aZtoneCoverTextureNames[aArrayIndex] + "/"+aZtoneCoverTextureNames[aArrayIndex]+"_ (" + s + ")");
+ }
+ aArrayIndex++;
+ }
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtTools.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtTools.java
new file mode 100644
index 0000000000..ee104eaca3
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtTools.java
@@ -0,0 +1,61 @@
+package gtPlusPlus.xmod.gregtech.common.blocks.textures;
+
+import net.minecraft.client.renderer.texture.TextureMap;
+import net.minecraft.util.IIcon;
+import net.minecraft.util.ResourceLocation;
+
+import gregtech.api.GregTech_API;
+import gregtech.api.interfaces.IIconContainer;
+
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.lib.CORE;
+
+public final class TexturesGtTools {
+
+ public final static CustomIcon SKOOKUM_CHOOCHER = new CustomIcon("iconsets/SKOOKUMCHOOCHER");
+ public final static CustomIcon ANGLE_GRINDER = new CustomIcon("iconsets/ANGLE_GRINDER");
+ public final static CustomIcon ELECTRIC_SNIPS = new CustomIcon("iconsets/ELECTRIC_SNIPS");
+ public final static CustomIcon ELECTRIC_LIGHTER = new CustomIcon("iconsets/ELECTRIC_LIGHTER");
+ public final static CustomIcon ELECTRIC_BUTCHER_KNIFE = new CustomIcon("iconsets/ELECTRIC_BUTCHER_KNIFE");
+
+
+
+
+
+
+
+
+ public final static class CustomIcon implements IIconContainer, Runnable {
+ protected IIcon mIcon, mOverlay;
+ protected final String mIconName;
+
+ public CustomIcon(final String aIconName) {
+ this.mIconName = aIconName;
+ Logger.INFO("Constructing a Custom Texture. " + this.mIconName);
+ GregTech_API.sGTItemIconload.add(this);
+ }
+
+ @Override
+ public IIcon getIcon() {
+ return this.mIcon;
+ }
+
+ @Override
+ public IIcon getOverlayIcon() {
+ return this.mOverlay;
+ }
+
+ @Override
+ public void run() {
+ this.mIcon = GregTech_API.sItemIcons.registerIcon(CORE.MODID + ":" + this.mIconName);
+ //Utils.LOG_INFO("Registering a Custom Texture. "+mIcon.g);
+ this.mOverlay = GregTech_API.sItemIcons.registerIcon(CORE.MODID + ":" + this.mIconName + "_OVERLAY");
+ }
+
+ @Override
+ public ResourceLocation getTextureFile() {
+ return TextureMap.locationItemsTexture;
+ }
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/turbine/LargeTurbineTextureHandler.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/turbine/LargeTurbineTextureHandler.java
new file mode 100644
index 0000000000..c3d6a655c3
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/turbine/LargeTurbineTextureHandler.java
@@ -0,0 +1,318 @@
+/*
+package gtPlusPlus.xmod.gregtech.common.blocks.textures.turbine;
+
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.IIcon;
+import net.minecraft.world.IBlockAccess;
+
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Turbine;
+import gtPlusPlus.xmod.gregtech.common.blocks.GregtechMetaCasingBlocks4;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.CustomIcon;
+
+public class LargeTurbineTextureHandler {
+
+ */
+/**
+ * LP Turbines
+ *//*
+
+ private static CustomIcon aTex1_Active = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_LP_ACTIVE_1");
+ private static CustomIcon aTex1 = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_LP_1");
+ private static CustomIcon aTex2_Active = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_LP_ACTIVE_2");
+ private static CustomIcon aTex2 = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_LP_2");
+ private static CustomIcon aTex3_Active = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_LP_ACTIVE_3");
+ private static CustomIcon aTex3 = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_LP_3");
+ private static CustomIcon aTex4_Active = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_LP_ACTIVE_4");
+ private static CustomIcon aTex4 = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_LP_4");
+ private static CustomIcon aTex5_Active = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_LP_ACTIVE_5");
+ private static CustomIcon aTex5 = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_LP_5");
+ private static CustomIcon aTex6_Active = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_LP_ACTIVE_6");
+ private static CustomIcon aTex6 = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_LP_6");
+ private static CustomIcon aTex7_Active = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_LP_ACTIVE_7");
+ private static CustomIcon aTex7 = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_LP_7");
+ private static CustomIcon aTex8_Active = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_LP_ACTIVE_8");
+ private static CustomIcon aTex8 = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_LP_8");
+ private static CustomIcon aTex9_Active = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_LP_ACTIVE_9");
+ private static CustomIcon aTex9 = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_LP_9");
+
+ private static CustomIcon frontFace_0 = (aTex1);
+ private static CustomIcon frontFaceActive_0 = (aTex1_Active);
+ private static CustomIcon frontFace_1 = (aTex2);
+ private static CustomIcon frontFaceActive_1 = (aTex2_Active);
+ private static CustomIcon frontFace_2 = (aTex3);
+ private static CustomIcon frontFaceActive_2 = (aTex3_Active);
+ private static CustomIcon frontFace_3 = (aTex4);
+ private static CustomIcon frontFaceActive_3 = (aTex4_Active);
+ public static CustomIcon frontFace_4 = (aTex5);
+ public static CustomIcon frontFaceActive_4 = (aTex5_Active);
+ private static CustomIcon frontFace_5 = (aTex6);
+ private static CustomIcon frontFaceActive_5 = (aTex6_Active);
+ private static CustomIcon frontFace_6 = (aTex7);
+ private static CustomIcon frontFaceActive_6 = (aTex7_Active);
+ private static CustomIcon frontFace_7 = (aTex8);
+ private static CustomIcon frontFaceActive_7 = (aTex8_Active);
+ private static CustomIcon frontFace_8 = (aTex9);
+ private static CustomIcon frontFaceActive_8 = (aTex9_Active);
+
+ CustomIcon[] OVERLAY_LP_TURBINE = new CustomIcon[]{
+ frontFace_0,
+ frontFace_1,
+ frontFace_2,
+ frontFace_3,
+ frontFace_4,
+ frontFace_5,
+ frontFace_6,
+ frontFace_7,
+ frontFace_8
+ };
+
+ CustomIcon[] OVERLAY_LP_TURBINE_ACTIVE = new CustomIcon[]{
+ frontFaceActive_0,
+ frontFaceActive_1,
+ frontFaceActive_2,
+ frontFaceActive_3,
+ frontFaceActive_4,
+ frontFaceActive_5,
+ frontFaceActive_6,
+ frontFaceActive_7,
+ frontFaceActive_8
+ };
+
+
+ */
+/**
+ * HP Turbines
+ *//*
+
+ private static CustomIcon aTexHP1_Active = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_HP_ACTIVE_1");
+ private static CustomIcon aTexHP1 = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_HP_1");
+ private static CustomIcon aTexHP2_Active = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_HP_ACTIVE_2");
+ private static CustomIcon aTexHP2 = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_HP_2");
+ private static CustomIcon aTexHP3_Active = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_HP_ACTIVE_3");
+ private static CustomIcon aTexHP3 = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_HP_3");
+ private static CustomIcon aTexHP4_Active = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_HP_ACTIVE_4");
+ private static CustomIcon aTexHP4 = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_HP_4");
+ private static CustomIcon aTexHP5_Active = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_HP_ACTIVE_5");
+ private static CustomIcon aTexHP5 = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_HP_5");
+ private static CustomIcon aTexHP6_Active = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_HP_ACTIVE_6");
+ private static CustomIcon aTexHP6 = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_HP_6");
+ private static CustomIcon aTexHP7_Active = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_HP_ACTIVE_7");
+ private static CustomIcon aTexHP7 = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_HP_7");
+ private static CustomIcon aTexHP8_Active = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_HP_ACTIVE_8");
+ private static CustomIcon aTexHP8 = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_HP_8");
+ private static CustomIcon aTexHP9_Active = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_HP_ACTIVE_9");
+ private static CustomIcon aTexHP9 = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_HP_9");
+
+ private static CustomIcon frontFaceHP_0 = (aTexHP1);
+ private static CustomIcon frontFaceHPActive_0 = (aTexHP1_Active);
+ private static CustomIcon frontFaceHP_1 = (aTexHP2);
+ private static CustomIcon frontFaceHPActive_1 = (aTexHP2_Active);
+ private static CustomIcon frontFaceHP_2 = (aTexHP3);
+ private static CustomIcon frontFaceHPActive_2 = (aTexHP3_Active);
+ private static CustomIcon frontFaceHP_3 = (aTexHP4);
+ private static CustomIcon frontFaceHPActive_3 = (aTexHP4_Active);
+ public static CustomIcon frontFaceHP_4 = (aTexHP5);
+ public static CustomIcon frontFaceHPActive_4 = (aTexHP5_Active);
+ private static CustomIcon frontFaceHP_5 = (aTexHP6);
+ private static CustomIcon frontFaceHPActive_5 = (aTexHP6_Active);
+ private static CustomIcon frontFaceHP_6 = (aTexHP7);
+ private static CustomIcon frontFaceHPActive_6 = (aTexHP7_Active);
+ private static CustomIcon frontFaceHP_7 = (aTexHP8);
+ private static CustomIcon frontFaceHPActive_7 = (aTexHP8_Active);
+ private static CustomIcon frontFaceHP_8 = (aTexHP9);
+ private static CustomIcon frontFaceHPActive_8 = (aTexHP9_Active);
+
+ CustomIcon[] OVERLAY_HP_TURBINE = new CustomIcon[]{
+ frontFaceHP_0,
+ frontFaceHP_1,
+ frontFaceHP_2,
+ frontFaceHP_3,
+ frontFaceHP_4,
+ frontFaceHP_5,
+ frontFaceHP_6,
+ frontFaceHP_7,
+ frontFaceHP_8
+ };
+
+ CustomIcon[] OVERLAY_HP_TURBINE_ACTIVE = new CustomIcon[]{
+ frontFaceHPActive_0,
+ frontFaceHPActive_1,
+ frontFaceHPActive_2,
+ frontFaceHPActive_3,
+ frontFaceHPActive_4,
+ frontFaceHPActive_5,
+ frontFaceHPActive_6,
+ frontFaceHPActive_7,
+ frontFaceHPActive_8
+ };
+
+
+
+ public IIcon handleCasingsGT(final IBlockAccess aWorld, final int xCoord, final int yCoord, final int zCoord, final int aSide, final GregtechMetaCasingBlocks4 thisBlock) {
+ final int tMeta = aWorld.getBlockMetadata(xCoord, yCoord, zCoord);
+
+ //7 - shaft
+ //8 LP
+ //9 HP
+
+ CustomIcon[] mGetCurrentTextureSet = null, mGetCurrentTextureSet_ACTIVE = null;
+
+
+ if (tMeta <= 6 || tMeta >= 10) {
+ return GregtechMetaCasingBlocks4.getStaticIcon((byte) aSide, (byte) tMeta);
+ }
+ else {
+ if (tMeta == 8) {
+ mGetCurrentTextureSet = OVERLAY_LP_TURBINE;
+ mGetCurrentTextureSet_ACTIVE = OVERLAY_LP_TURBINE_ACTIVE;
+ }
+ else if (tMeta == 9) {
+ mGetCurrentTextureSet = OVERLAY_HP_TURBINE;
+ mGetCurrentTextureSet_ACTIVE = OVERLAY_HP_TURBINE_ACTIVE;
+ }
+ if (mGetCurrentTextureSet == null || mGetCurrentTextureSet_ACTIVE == null) {
+ return GregtechMetaCasingBlocks4.getStaticIcon((byte) aSide, (byte) tMeta);
+ }
+
+
+
+ if ((aSide == 2) || (aSide == 3)) {
+ TileEntity tTileEntity;
+ IMetaTileEntity tMetaTileEntity;
+ if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 3 ? 1 : -1), yCoord - 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Turbine))) {
+ if (isUsingAnimatedTexture(tTileEntity)) {
+ return mGetCurrentTextureSet_ACTIVE[0].getIcon();
+ }
+ return mGetCurrentTextureSet[0].getIcon();
+ }
+ if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 3 ? 1 : -1), yCoord, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Turbine))) {
+ if (isUsingAnimatedTexture(tTileEntity)) {
+ return mGetCurrentTextureSet_ACTIVE[3].getIcon();
+ }
+ return mGetCurrentTextureSet[3].getIcon();
+ }
+ if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 3 ? 1 : -1), yCoord + 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Turbine))) {
+ if (isUsingAnimatedTexture(tTileEntity)) {
+ return mGetCurrentTextureSet_ACTIVE[6].getIcon();
+ }
+ return mGetCurrentTextureSet[6].getIcon();
+ }
+ if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord - 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Turbine))) {
+ if (isUsingAnimatedTexture(tTileEntity)) {
+ return mGetCurrentTextureSet_ACTIVE[1].getIcon();
+ }
+ return mGetCurrentTextureSet[1].getIcon();
+ }
+ if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord + 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Turbine))) {
+ if (isUsingAnimatedTexture(tTileEntity)) {
+ return mGetCurrentTextureSet_ACTIVE[7].getIcon();
+ }
+ return mGetCurrentTextureSet[7].getIcon();
+ }
+ if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 2 ? 1 : -1), yCoord + 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Turbine))) {
+ if (isUsingAnimatedTexture(tTileEntity)) {
+ return mGetCurrentTextureSet_ACTIVE[8].getIcon();
+ }
+ return mGetCurrentTextureSet[8].getIcon();
+ }
+ if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 2 ? 1 : -1), yCoord, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Turbine))) {
+ if (isUsingAnimatedTexture(tTileEntity)) {
+ return mGetCurrentTextureSet_ACTIVE[5].getIcon();
+ }
+ return mGetCurrentTextureSet[5].getIcon();
+ }
+ if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 2 ? 1 : -1), yCoord - 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Turbine))) {
+ if (isUsingAnimatedTexture(tTileEntity)) {
+ return mGetCurrentTextureSet_ACTIVE[2].getIcon();
+ }
+ return mGetCurrentTextureSet[2].getIcon();
+ }
+ } else if ((aSide == 4) || (aSide == 5)) {
+ TileEntity tTileEntity;
+ Object tMetaTileEntity;
+ if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord - 1, zCoord + (aSide == 4 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Turbine))) {
+ if (isUsingAnimatedTexture(tTileEntity)) {
+ return mGetCurrentTextureSet_ACTIVE[0].getIcon();
+ }
+ return mGetCurrentTextureSet[0].getIcon();
+ }
+ if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord, zCoord + (aSide == 4 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Turbine))) {
+ if (isUsingAnimatedTexture(tTileEntity)) {
+ return mGetCurrentTextureSet_ACTIVE[3].getIcon();
+ }
+ return mGetCurrentTextureSet[3].getIcon();
+ }
+ if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord + 1, zCoord + (aSide == 4 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Turbine))) {
+ if (isUsingAnimatedTexture(tTileEntity)) {
+ return mGetCurrentTextureSet_ACTIVE[6].getIcon();
+ }
+ return mGetCurrentTextureSet[6].getIcon();
+ }
+ if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord - 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Turbine))) {
+ if (isUsingAnimatedTexture(tTileEntity)) {
+ return mGetCurrentTextureSet_ACTIVE[1].getIcon();
+ }
+ return mGetCurrentTextureSet[1].getIcon();
+ }
+ if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord + 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Turbine))) {
+ if (isUsingAnimatedTexture(tTileEntity)) {
+ return mGetCurrentTextureSet_ACTIVE[7].getIcon();
+ }
+ return mGetCurrentTextureSet[7].getIcon();
+ }
+ if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord + 1, zCoord + (aSide == 5 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Turbine))) {
+ if (isUsingAnimatedTexture(tTileEntity)) {
+ return mGetCurrentTextureSet_ACTIVE[8].getIcon();
+ }
+ return mGetCurrentTextureSet[8].getIcon();
+ }
+ if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord, zCoord + (aSide == 5 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Turbine))) {
+ if (isUsingAnimatedTexture(tTileEntity)) {
+ return mGetCurrentTextureSet_ACTIVE[5].getIcon();
+ }
+ return mGetCurrentTextureSet[5].getIcon();
+ }
+ if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord - 1, zCoord + (aSide == 5 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Turbine))) {
+ if (isUsingAnimatedTexture(tTileEntity)) {
+ return mGetCurrentTextureSet_ACTIVE[2].getIcon();
+ }
+ return mGetCurrentTextureSet[2].getIcon();
+ }
+ }
+ }
+ return GregtechMetaCasingBlocks4.getStaticIcon((byte) aSide, (byte) tMeta);
+ }
+
+ public boolean isUsingAnimatedTexture(TileEntity tTileEntity) {
+ boolean aVal = true;
+ */
+/*IGregTechTileEntity aTile;
+ if (tTileEntity instanceof IGregTechTileEntity) {
+ aTile = (IGregTechTileEntity) tTileEntity;
+ if (aTile != null) {
+ final IMetaTileEntity aMetaTileEntity = aTile.getMetaTileEntity();
+ if (aMetaTileEntity != null && aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Turbine) {
+ aVal = ((GT_MetaTileEntity_Hatch_Turbine) aMetaTileEntity).isControllerActive();
+ Logger.INFO("Returning "+aVal+" as Rotor Assembly controller status");
+ }
+ }
+ } *//*
+
+ return aVal;
+ }
+
+ public GT_MetaTileEntity_Hatch_Turbine isTurbineHatch(final IGregTechTileEntity aTileEntity) {
+ if (aTileEntity != null) {
+ final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity != null && aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Turbine) {
+ return (GT_MetaTileEntity_Hatch_Turbine) aMetaTileEntity;
+ }
+ }
+ return null;
+ }
+
+}
+*/
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/blueprint/Blueprint_Generic_3x3.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/blueprint/Blueprint_Generic_3x3.java
new file mode 100644
index 0000000000..ca7cbca5f8
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/blueprint/Blueprint_Generic_3x3.java
@@ -0,0 +1,87 @@
+package gtPlusPlus.xmod.gregtech.common.blueprint;
+
+import gtPlusPlus.api.objects.data.Pair;
+import gtPlusPlus.xmod.gregtech.api.objects.MultiblockBlueprint;
+import gtPlusPlus.xmod.gregtech.api.objects.MultiblockLayer;
+import net.minecraft.block.Block;
+import net.minecraft.init.Blocks;
+
+public class Blueprint_Generic_3x3 extends MultiblockBlueprint {
+
+ public Blueprint_Generic_3x3(Pair<Block, Integer> aCasing, int aTextureID) {
+ super(3, 3, 3, 10, aTextureID);
+
+ // Top/Bottom
+ MultiblockLayer a0 = new MultiblockLayer(3, 3);
+ Block aCasingBlock_1 = aCasing.getKey();
+ int aMeta = aCasing.getValue();
+ a0.addBlockForPos(aCasingBlock_1, aMeta, 0, 0, true);
+ a0.addBlockForPos(aCasingBlock_1, aMeta, 0, 1, true);
+ a0.addBlockForPos(aCasingBlock_1, aMeta, 0, 2, true);
+ a0.addBlockForPos(aCasingBlock_1, aMeta, 1, 0, true);
+ a0.addBlockForPos(aCasingBlock_1, aMeta, 1, 1, true);
+ a0.addBlockForPos(aCasingBlock_1, aMeta, 1, 2, true);
+ a0.addBlockForPos(aCasingBlock_1, aMeta, 2, 0, true);
+ a0.addBlockForPos(aCasingBlock_1, aMeta, 2, 1, true);
+ a0.addBlockForPos(aCasingBlock_1, aMeta, 2, 2, true);
+ a0.lock(true);
+
+ //Layer one
+ MultiblockLayer a1 = new MultiblockLayer(3, 3);
+ a1.addBlockForPos(aCasingBlock_1, aMeta, 0, 0, true);
+ a1.addBlockForPos(aCasingBlock_1, aMeta, 0, 1, true);
+ a1.addBlockForPos(aCasingBlock_1, aMeta, 0, 2, true);
+ a1.addBlockForPos(aCasingBlock_1, aMeta, 1, 0, true);
+ a1.addBlockForPos(Blocks.air, 0, 1, 1, true);
+ a1.addController(1, 2);
+ a1.addBlockForPos(aCasingBlock_1, aMeta, 2, 0, true);
+ a1.addBlockForPos(aCasingBlock_1, aMeta, 2, 1, true);
+ a1.addBlockForPos(aCasingBlock_1, aMeta, 2, 2, true);
+ a1.lock(true);
+
+ this.setLayer(a0, 0);
+ this.setLayer(a1, 1);
+ this.setLayer(a0, 2);
+ }
+
+ @Override
+ public int getMinimumInputBus() {
+ return 0;
+ }
+
+ @Override
+ public int getMinimumInputHatch() {
+ return 0;
+ }
+
+ @Override
+ public int getMinimumOutputBus() {
+ return 0;
+ }
+
+ @Override
+ public int getMinimumOutputHatch() {
+ return 0;
+ }
+
+ @Override
+ public int getMinimumInputEnergy() {
+ return 1;
+ }
+
+ @Override
+ public int getMinimumOutputEnergy() {
+ return 0;
+ }
+
+ @Override
+ public int getMinimumMaintHatch() {
+ return 1;
+ }
+
+ @Override
+ public int getMinimumMufflers() {
+ return 1;
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/blueprint/Blueprint_LFTR.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/blueprint/Blueprint_LFTR.java
new file mode 100644
index 0000000000..3551172904
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/blueprint/Blueprint_LFTR.java
@@ -0,0 +1,137 @@
+package gtPlusPlus.xmod.gregtech.common.blueprint;
+
+import gregtech.api.enums.TAE;
+import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.xmod.gregtech.api.objects.MultiblockBlueprint;
+import gtPlusPlus.xmod.gregtech.api.objects.MultiblockLayer;
+import net.minecraft.block.Block;
+
+public class Blueprint_LFTR extends MultiblockBlueprint {
+
+ public Blueprint_LFTR() {
+ super(7, 4, 7, 10, TAE.GTPP_INDEX(12));
+
+
+ Block aCasingMain = ModBlocks.blockCasingsMisc;
+ int aMetaCasingMain = 12;
+ int aMetaCasingSecondary = 13;
+
+
+
+ /**
+ * First Layer (All edges can be Hatches, controller is centered in the front)
+ */
+
+ MultiblockLayer a0 = new MultiblockLayer(7, 7);
+ for (int i = 0; i < 7; i++) {
+ a0.addBlockForPos(aCasingMain, aMetaCasingMain, i, 0, true);
+ }
+ for (int i = 0; i < 7; i++) {
+ for (int u = 1; u < 6; u++) {
+ a0.addBlockForPos(aCasingMain, aMetaCasingMain, i, u, i == 0 ? true : i == 6 ? true : false);
+ }
+ }
+ for (int i = 0; i < 7; i++) {
+ if (i != 3) {
+ a0.addBlockForPos(aCasingMain, aMetaCasingMain, i, 6, true);
+ }
+ else {
+ a0.addController(i, 6);
+ }
+ }
+ a0.lock(true);
+
+
+
+
+ /**
+ * Middle Layer(s)
+ */
+
+ MultiblockLayer a1 = new MultiblockLayer(7, 7);
+ for (int i = 0; i < 7; i++) {
+ a1.addBlockForPos(aCasingMain, aMetaCasingSecondary, i, 0, false);
+ }
+ for (int i = 0; i < 7; i++) {
+ for (int u = 1; u < 6; u++) {
+ if (i == 0 || i == 6)
+ a1.addBlockForPos(aCasingMain, aMetaCasingSecondary, i, u, false);
+ }
+ }
+ for (int i = 0; i < 7; i++) {
+ a1.addBlockForPos(aCasingMain, aMetaCasingSecondary, i, 6, false);
+
+ }
+ a1.lock(true);
+
+
+ /**
+ * Top Layer (All edges can be Hatches, Mufflers required in inner 3x3)
+ */
+
+ MultiblockLayer a2 = new MultiblockLayer(7, 7);
+ for (int i = 0; i < 7; i++) {
+ a2.addBlockForPos(aCasingMain, aMetaCasingMain, i, 0, true);
+ }
+ for (int i = 0; i < 7; i++) {
+ for (int u = 1; u < 6; u++) {
+ if ((i == 2 || i == 3 || i == 4) && (u == 2 || u ==3 || u == 4)) {
+ a2.addMuffler(aCasingMain, aMetaCasingMain, i, u);
+ }
+ else {
+ a2.addBlockForPos(aCasingMain, aMetaCasingMain, i, u, true);
+ }
+ }
+ }
+ for (int i = 0; i < 7; i++) {
+ a2.addBlockForPos(aCasingMain, aMetaCasingMain, i, 6, true);
+ }
+ a2.lock(true);
+
+ this.setLayer(a0, 0);
+ this.setLayer(a1, 1);
+ this.setLayer(a1, 2);
+ this.setLayer(a2, 3);
+ }
+
+ @Override
+ public int getMinimumInputBus() {
+ return 0;
+ }
+
+ @Override
+ public int getMinimumInputHatch() {
+ return 4;
+ }
+
+ @Override
+ public int getMinimumOutputBus() {
+ return 0;
+ }
+
+ @Override
+ public int getMinimumOutputHatch() {
+ return 4;
+ }
+
+ @Override
+ public int getMinimumInputEnergy() {
+ return 0;
+ }
+
+ @Override
+ public int getMinimumOutputEnergy() {
+ return 4;
+ }
+
+ @Override
+ public int getMinimumMaintHatch() {
+ return 1;
+ }
+
+ @Override
+ public int getMinimumMufflers() {
+ return 4;
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/covers/CoverManager.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/covers/CoverManager.java
new file mode 100644
index 0000000000..2fba1b0448
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/covers/CoverManager.java
@@ -0,0 +1,102 @@
+package gtPlusPlus.xmod.gregtech.common.covers;
+
+import static gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtCutomCovers.TEXTURE_ZTONES_AGON;
+import static gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtCutomCovers.TEXTURE_ZTONES_BITT;
+import static gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtCutomCovers.TEXTURE_ZTONES_ISZM;
+import static gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtCutomCovers.TEXTURE_ZTONES_JELT;
+import static gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtCutomCovers.TEXTURE_ZTONES_KORP;
+
+import cpw.mods.fml.common.Loader;
+import gtPlusPlus.core.lib.VanillaColours;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.CustomIcon;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtCutomCovers;
+import gtPlusPlus.xmod.gregtech.common.items.MetaCustomCoverItem;
+import gtPlusPlus.xmod.gregtech.common.items.covers.MetaItemCoverCasings;
+
+public class CoverManager {
+
+ // ZTones
+ public static MetaCustomCoverItem Cover_Agon;
+ public static MetaCustomCoverItem Cover_Iszm;
+ public static MetaCustomCoverItem Cover_Korp;
+ public static MetaCustomCoverItem Cover_Jelt;
+ public static MetaCustomCoverItem Cover_Bitt;
+
+ // GT
+ public static MetaItemCoverCasings Cover_Gt_Machine_Casing;
+
+ public static void generateCustomCovers() {
+
+ // init textures
+ TexturesGtCutomCovers.init();
+
+ // GT Machine Casings
+ Cover_Gt_Machine_Casing = new MetaItemCoverCasings();
+
+ if (Loader.isModLoaded("Ztones")) {
+ String[] aZtoneCoverTextureNames = new String[] { "agon", "iszm", "korp", "jelt", "bitt" };
+ MetaCustomCoverItem[] aZtoneCoverItems = new MetaCustomCoverItem[] { Cover_Agon, Cover_Iszm, Cover_Korp,
+ Cover_Jelt, Cover_Bitt };
+ CustomIcon[][] aArrays = new CustomIcon[][] { TEXTURE_ZTONES_AGON, TEXTURE_ZTONES_ISZM, TEXTURE_ZTONES_KORP,
+ TEXTURE_ZTONES_JELT, TEXTURE_ZTONES_BITT };
+ short[][][] aRGB = new short[][][] { ZTONES.RGB_AGON, ZTONES.RGB_ISZM, ZTONES.RGB_KORP, ZTONES.RGB_JELT,
+ ZTONES.RGB_BITT };
+ for (int y = 0; y < aZtoneCoverTextureNames.length; y++) {
+ aZtoneCoverItems[y] = new MetaCustomCoverItem("Ztones", 16, aZtoneCoverTextureNames[y], aArrays[y],
+ aRGB[y]);
+ }
+ }
+
+ }
+
+ final static class ZTONES {
+
+ private static final short[][] RGB_AGON = new short[][] { VanillaColours.DYE_WHITE.getAsShort(),
+ VanillaColours.DYE_YELLOW.getAsShort(), VanillaColours.DYE_LIME.getAsShort(),
+ VanillaColours.DYE_GREEN.getAsShort(), VanillaColours.DYE_CYAN.getAsShort(),
+ VanillaColours.DYE_LIGHT_BLUE.getAsShort(), VanillaColours.DYE_DARK_BLUE.getAsShort(),
+ VanillaColours.DYE_DARK_PURPLE.getAsShort(), VanillaColours.DYE_LIGHT_PURPLE.getAsShort(),
+ VanillaColours.DYE_PINK.getAsShort(), VanillaColours.DYE_RED.getAsShort(),
+ VanillaColours.DYE_ORANGE.getAsShort(), VanillaColours.DYE_BROWN.getAsShort(),
+ VanillaColours.DYE_BLACK.getAsShort(), VanillaColours.DYE_DARK_GRAY.getAsShort(),
+ VanillaColours.DYE_LIGHT_GRAY.getAsShort(), };
+ private static final short[][] RGB_ISZM = new short[][] { VanillaColours.DYE_LIGHT_GRAY.getAsShort(),
+ VanillaColours.DYE_WHITE.getAsShort(), VanillaColours.DYE_DARK_GRAY.getAsShort(),
+ VanillaColours.DYE_DARK_BLUE.getAsShort(), VanillaColours.DYE_YELLOW.getAsShort(),
+ VanillaColours.DYE_DARK_BLUE.getAsShort(), VanillaColours.DYE_RED.getAsShort(),
+ VanillaColours.DYE_ORANGE.getAsShort(), VanillaColours.DYE_CYAN.getAsShort(),
+ VanillaColours.DYE_YELLOW.getAsShort(), VanillaColours.DYE_RED.getAsShort(),
+ VanillaColours.DYE_CYAN.getAsShort(), VanillaColours.DYE_GREEN.getAsShort(),
+ VanillaColours.DYE_ORANGE.getAsShort(), VanillaColours.DYE_LIGHT_BLUE.getAsShort(),
+ VanillaColours.DYE_DARK_PURPLE.getAsShort(),
+ };
+ private static final short[][] RGB_KORP = new short[][] { new short[] { 125, 125, 125 },
+ VanillaColours.DYE_DARK_GRAY.getAsShort(), VanillaColours.DYE_DARK_GRAY.getAsShort(),
+ VanillaColours.DYE_DARK_GRAY.getAsShort(), VanillaColours.DYE_DARK_GRAY.getAsShort(),
+ VanillaColours.DYE_DARK_GRAY.getAsShort(), VanillaColours.DYE_DARK_GRAY.getAsShort(),
+ VanillaColours.DYE_DARK_GRAY.getAsShort(), VanillaColours.DYE_DARK_GRAY.getAsShort(),
+ VanillaColours.DYE_DARK_GRAY.getAsShort(), VanillaColours.DYE_DARK_GRAY.getAsShort(),
+ VanillaColours.DYE_DARK_GRAY.getAsShort(), new short[] { 22, 156, 156 }, new short[] { 22, 156, 156 },
+ VanillaColours.DYE_DARK_GRAY.getAsShort(), VanillaColours.DYE_DARK_GRAY.getAsShort(), };
+ private static final short[][] RGB_JELT = new short[][] { VanillaColours.DYE_ORANGE.getAsShort(),
+ VanillaColours.DYE_ORANGE.getAsShort(), VanillaColours.DYE_ORANGE.getAsShort(),
+ VanillaColours.DYE_ORANGE.getAsShort(), VanillaColours.DYE_ORANGE.getAsShort(),
+ VanillaColours.DYE_ORANGE.getAsShort(), VanillaColours.DYE_ORANGE.getAsShort(),
+ VanillaColours.DYE_ORANGE.getAsShort(), VanillaColours.DYE_ORANGE.getAsShort(),
+ VanillaColours.DYE_ORANGE.getAsShort(), VanillaColours.DYE_ORANGE.getAsShort(),
+ VanillaColours.DYE_ORANGE.getAsShort(), VanillaColours.DYE_ORANGE.getAsShort(),
+ VanillaColours.DYE_ORANGE.getAsShort(), VanillaColours.DYE_ORANGE.getAsShort(),
+ VanillaColours.DYE_ORANGE.getAsShort(), };
+ private static final short[][] RGB_BITT = new short[][] { VanillaColours.DYE_BLACK.getAsShort(),
+ VanillaColours.DYE_WHITE.getAsShort(), VanillaColours.DYE_YELLOW.getAsShort(),
+ VanillaColours.DYE_LIME.getAsShort(), VanillaColours.DYE_GREEN.getAsShort(),
+ VanillaColours.DYE_CYAN.getAsShort(), VanillaColours.DYE_LIGHT_BLUE.getAsShort(),
+ VanillaColours.DYE_LIGHT_BLUE.getAsShort(), VanillaColours.DYE_DARK_BLUE.getAsShort(),
+ VanillaColours.DYE_DARK_PURPLE.getAsShort(), VanillaColours.DYE_LIGHT_PURPLE.getAsShort(),
+ VanillaColours.DYE_PINK.getAsShort(), VanillaColours.DYE_RED.getAsShort(),
+ VanillaColours.DYE_RED.getAsShort(), VanillaColours.DYE_ORANGE.getAsShort(),
+ VanillaColours.DYE_BROWN.getAsShort(), };
+
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/covers/GTPP_Cover_Overflow.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/covers/GTPP_Cover_Overflow.java
new file mode 100644
index 0000000000..a88fbc0d66
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/covers/GTPP_Cover_Overflow.java
@@ -0,0 +1,247 @@
+package gtPlusPlus.xmod.gregtech.common.covers;
+
+import gregtech.api.gui.GT_GUICover;
+import gregtech.api.interfaces.tileentity.ICoverable;
+import gregtech.api.util.GT_CoverBehavior;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.core.util.minecraft.LangUtils;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidStack;
+import net.minecraftforge.fluids.IFluidHandler;
+import gregtech.api.gui.widgets.GT_GuiIntegerTextBox;
+import gregtech.api.enums.GT_Values;
+import gregtech.api.net.GT_Packet_TileEntityCover;
+
+
+public class GTPP_Cover_Overflow extends GT_CoverBehavior {
+
+ public final int mTransferRate;
+ public final int mInitialTransferRate;
+ public final int mMaxTransferRate;
+
+ public GTPP_Cover_Overflow(int aTransferRate) {
+ this.mTransferRate = aTransferRate * 1000 / 10;
+ this.mInitialTransferRate = aTransferRate;
+ this.mMaxTransferRate = aTransferRate * 1000;
+ }
+
+ public int doCoverThings(byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity,
+ long aTimer) {
+ if (aCoverVariable == 0) {
+ return aCoverVariable;
+ }
+ if ((aTileEntity instanceof IFluidHandler)) {
+ //Logger.INFO("Trying to Void via Overflow.");
+ IFluidHandler tTank1;
+ ForgeDirection directionFrom;
+ directionFrom = ForgeDirection.UNKNOWN;
+ tTank1 = (IFluidHandler) aTileEntity;
+ if (tTank1 != null) {
+ //Logger.INFO("Found Self. "+aSide);
+ //FluidStack aTankStack = tTank1.drain(ForgeDirection.UNKNOWN, 1, false);
+ FluidStack aTankStack = tTank1.getTankInfo(directionFrom)[0].fluid;
+ if (aTankStack != null) {
+ //Logger.INFO("Found Fluid inside self - "+aTankStack.getLocalizedName()+", overflow point set at "+aCoverVariable+"L and we have "+aTankStack.amount+"L inside.");
+ if (aTankStack.amount > aCoverVariable) {
+ int aAmountToDrain = aTankStack.amount - aCoverVariable;
+ //Logger.INFO("There is "+aAmountToDrain+" more fluid in the tank than we would like.");
+ if (aAmountToDrain > 0) {
+ FluidStack tLiquid = tTank1.drain(directionFrom, Math.abs(aAmountToDrain), true);
+ if (tLiquid != null) {
+ //Logger.INFO("Drained "+aAmountToDrain+"L.");
+ }
+ }
+ }
+ }
+ else {
+ //Logger.INFO("Could not simulate drain on self.");
+ }
+ }
+ }
+ return aCoverVariable;
+ }
+
+ public int onCoverScrewdriverclick(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity,
+ EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ if (GT_Utility.getClickedFacingCoords(aSide, aX, aY, aZ)[0] >= 0.5F) {
+ aCoverVariable += (mMaxTransferRate * (aPlayer.isSneaking() ? 0.1f : 0.01f));
+ } else {
+ aCoverVariable -= (mMaxTransferRate * (aPlayer.isSneaking() ? 0.1f : 0.01f));
+ }
+ if (aCoverVariable > mMaxTransferRate) {
+ aCoverVariable = mInitialTransferRate;
+ }
+ if (aCoverVariable <= 0) {
+ aCoverVariable = mMaxTransferRate;
+ }
+ GT_Utility.sendChatToPlayer(aPlayer, LangUtils.trans("009", "Overflow point: ") + aCoverVariable + trans("010", "L"));
+ return aCoverVariable;
+ }
+
+ public boolean onCoverRightclick(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity,
+ EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ boolean aShift = aPlayer.isSneaking();
+ int aAmount = aShift ? 128 : 8;
+ if (GT_Utility.getClickedFacingCoords(aSide, aX, aY, aZ)[0] >= 0.5F) {
+ aCoverVariable += aAmount;
+ } else {
+ aCoverVariable -= aAmount;
+ }
+ if (aCoverVariable > mMaxTransferRate) {
+ aCoverVariable = mInitialTransferRate;
+ }
+ if (aCoverVariable <= 0) {
+ aCoverVariable = mMaxTransferRate;
+ }
+ GT_Utility.sendChatToPlayer(aPlayer, LangUtils.trans("009", "Overflow point: ") + aCoverVariable + trans("010", "L"));
+ aTileEntity.setCoverDataAtSide(aSide, aCoverVariable);
+ return true;
+ }
+
+ public boolean letsRedstoneGoIn(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
+ return true;
+ }
+
+ public boolean letsRedstoneGoOut(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
+ return true;
+ }
+
+ public boolean letsEnergyIn(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
+ return true;
+ }
+
+ public boolean letsEnergyOut(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
+ return true;
+ }
+
+ public boolean letsItemsIn(byte aSide, int aCoverID, int aCoverVariable, int aSlot, ICoverable aTileEntity) {
+ return true;
+ }
+
+ public boolean letsItemsOut(byte aSide, int aCoverID, int aCoverVariable, int aSlot, ICoverable aTileEntity) {
+ return true;
+ }
+
+ public boolean letsFluidIn(byte aSide, int aCoverID, int aCoverVariable, Fluid aFluid, ICoverable aTileEntity) {
+ return false;
+ }
+
+ public boolean letsFluidOut(byte aSide, int aCoverID, int aCoverVariable, Fluid aFluid, ICoverable aTileEntity) {
+ return true;
+ }
+
+ public boolean alwaysLookConnected(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
+ return true;
+ }
+
+ public int getTickRate(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
+ return 5;
+ }
+
+ //GUI
+ @Override
+ public boolean hasCoverGUI() {
+ return true;
+ }
+
+ @Override
+ public Object getClientGUI(byte aSide, int aCoverID, int coverData, ICoverable aTileEntity) {
+ return new GTPP_Cover_Overflow.GUI(aSide, aCoverID, coverData, aTileEntity);
+ }
+
+ private class GUI extends GT_GUICover {
+ private final byte side;
+ private final int coverID;
+ private GT_GuiIntegerTextBox tBox;
+ private int coverVariable;
+
+ private static final int startX = 10;
+ private static final int startY = 25;
+ private static final int spaceX = 18;
+ private static final int spaceY = 18;
+
+ private boolean warn = false;
+
+ public GUI(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
+ super(aTileEntity, 176, 107, GT_Utility.intToStack(aCoverID));
+ this.side = aSide;
+ this.coverID = aCoverID;
+ this.coverVariable = aCoverVariable;
+
+ tBox = new GT_GuiIntegerTextBox(this, 2, startX + spaceX * 0, startY + spaceY * 0 + 8, spaceX * 4 - 3, 12);
+ tBox.setText(String.valueOf(this.coverVariable));
+ tBox.setMaxStringLength(10);
+ }
+
+ @Override
+ protected void onInitGui(int guiLeft, int guiTop, int gui_width, int gui_height) {
+ tBox.setFocused(true);
+ }
+
+ @Override
+ public void drawExtras(int mouseX, int mouseY, float parTicks) {
+ super.drawExtras(mouseX, mouseY, parTicks);
+ this.getFontRenderer().drawString(trans("010", "L"), startX + spaceX * 4, 4 + startY + spaceY * 0 + 8, 0xFF555555);
+ if (warn)
+ this.getFontRenderer().drawString(trans("011","Max")+": "+coverVariable+"/"+mMaxTransferRate+" "+trans("010", "L"), startX + spaceX * 0, 4 + startY + spaceY * 1 + 6, 0xffff0000);
+ else
+ this.getFontRenderer().drawString(trans("011","Now")+": "+coverVariable+"/"+mMaxTransferRate+" "+trans("010", "L"), startX + spaceX * 0, 4 + startY + spaceY * 1 + 6, 0xFF555555);
+ }
+ @Override
+ public void onMouseWheel(int x, int y, int delta) {
+ for (GT_GuiIntegerTextBox box : textBoxes){
+ if (box.isFocused()) {
+ int step = Math.max(1, Math.abs(delta / 120));
+ step = (isShiftKeyDown() ? 50 : isCtrlKeyDown() ? 5 : 1) * (delta > 0 ? step : -step);
+ long i;
+ try {
+ i = Long.parseLong(box.getText());
+ } catch (NumberFormatException e) {
+ return;
+ }
+ if (i > (Long.MAX_VALUE-1000))
+ break;
+
+ i = i + step;
+ if (i <= 0)
+ i = 0;
+ box.setText(String.valueOf(i));
+ break;
+ }
+ }
+ }
+
+ @Override
+ public void applyTextBox(GT_GuiIntegerTextBox box) {
+ long i;
+ String s = box.getText().trim();
+ try {
+ i = Long.parseLong(s);
+ } catch (NumberFormatException e) {
+ resetTextBox(box);
+ return;
+ }
+
+ warn = false;
+ if (box.id == 2) {
+ if (i > (long) mMaxTransferRate) {
+ i = mMaxTransferRate;
+ warn = true;
+ } else if (i < 0) {
+ i = 0;
+ }
+ coverVariable = (int) i;
+ }
+ box.setText(String.valueOf(i));
+ GT_Values.NW.sendToServer(new GT_Packet_TileEntityCover(side, coverID, coverVariable, tile));
+ }
+
+ @Override
+ public void resetTextBox(GT_GuiIntegerTextBox box) {
+ if (box.id == 2)
+ box.setText(String.valueOf(coverVariable));
+ }
+ }
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/covers/GTPP_Cover_Overflow_Item.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/covers/GTPP_Cover_Overflow_Item.java
new file mode 100644
index 0000000000..0299447694
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/covers/GTPP_Cover_Overflow_Item.java
@@ -0,0 +1,182 @@
+package gtPlusPlus.xmod.gregtech.common.covers;
+
+import java.lang.reflect.Field;
+import java.util.HashMap;
+
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.ICoverable;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.util.GT_CoverBehavior;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.minecraft.LangUtils;
+import gtPlusPlus.core.util.reflect.ReflectionUtils;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.fluids.Fluid;
+
+public class GTPP_Cover_Overflow_Item extends GT_CoverBehavior {
+
+ public final int mInitialCapacity;
+ public final int mMaxItemCapacity;
+
+ public static final Class sQuantumChest;
+ public static final Class sSuperChestGTPP;
+ public static final Class sSuperChestGTNH;
+ public static HashMap<Integer, Field> mItemAmountFields = new HashMap<Integer, Field>();
+ public static HashMap<Integer, Field> mItemTypeFields = new HashMap<Integer, Field>();
+
+ static {
+ sQuantumChest = ReflectionUtils.getClass("gregtech.common.tileentities.storage.GT_MetaTileEntity_QuantumChest");
+ sSuperChestGTPP = ReflectionUtils.getClass("gtPlusPlus.xmod.gregtech.common.tileentities.storage.GT_MetaTileEntity_TieredChest");
+ if (CORE.GTNH) {
+ sSuperChestGTNH = ReflectionUtils.getClass("gregtech.common.tileentities.storage.GT_MetaTileEntity_SuperChest");
+ }
+ else {
+ sSuperChestGTNH = null;
+ }
+ if (sQuantumChest != null) {
+ mItemAmountFields.put(0, ReflectionUtils.getField(sQuantumChest, "mItemCount"));
+ mItemTypeFields.put(0, ReflectionUtils.getField(sQuantumChest, "mItemStack"));
+ }
+ if (sSuperChestGTPP != null) {
+ mItemAmountFields.put(1, ReflectionUtils.getField(sSuperChestGTPP, "mItemCount"));
+ mItemTypeFields.put(1, ReflectionUtils.getField(sSuperChestGTPP, "mItemStack"));
+ }
+ if (sSuperChestGTNH != null) {
+ mItemAmountFields.put(2, ReflectionUtils.getField(sSuperChestGTNH, "mItemCount"));
+ mItemTypeFields.put(2, ReflectionUtils.getField(sSuperChestGTNH, "mItemStack"));
+ }
+ }
+
+ public GTPP_Cover_Overflow_Item(int aCapacity) {
+ this.mInitialCapacity = aCapacity;
+ this.mMaxItemCapacity = aCapacity * 1000;
+ }
+
+ public int doCoverThings(byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity,
+ long aTimer) {
+ if (aCoverVariable == 0) {
+ return aCoverVariable;
+ }
+
+ // Get the IGTTile
+ IGregTechTileEntity aGtTileEntity = aTileEntity.getIGregTechTileEntity(aTileEntity.getXCoord(), aTileEntity.getYCoord(), aTileEntity.getZCoord());
+ if (aGtTileEntity == null) {
+ return aCoverVariable;
+ }
+
+ // Get the MetaTile
+ final IMetaTileEntity aMetaTileEntity = aGtTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity == null) {
+ return aCoverVariable;
+ }
+ boolean didHandle = false;
+ // Special Case for everything I want to support. /facepalm
+ if (sQuantumChest != null && sQuantumChest.isInstance(aMetaTileEntity)) {
+ didHandle = handleDigitalChest(aMetaTileEntity, 0);
+ }
+ else if (sSuperChestGTPP.isInstance(aMetaTileEntity)) {
+ didHandle = handleDigitalChest(aMetaTileEntity, 1);
+
+ }
+ else if (CORE.GTNH && sSuperChestGTNH != null && sSuperChestGTNH.isInstance(aMetaTileEntity)) {
+ didHandle = handleDigitalChest(aMetaTileEntity, 2);
+ }
+
+ return aCoverVariable;
+ }
+
+ private boolean handleDigitalChest(IMetaTileEntity aTile, int aType) {
+ int aItemAmount = (int) ReflectionUtils.getFieldValue(mItemAmountFields.get(aType), aTile);
+ ItemStack aItemType = (ItemStack) ReflectionUtils.getFieldValue(mItemTypeFields.get(aType), aTile);
+
+ if (aItemType == null || aItemAmount <= 0) {
+ return false;
+ }
+ else {
+ if (aItemAmount > mInitialCapacity) {
+ int aNewItemAmount = mInitialCapacity;
+ ReflectionUtils.setField(aTile, mItemAmountFields.get(aType), aNewItemAmount);
+ }
+ }
+ return true;
+ }
+
+ public int onCoverScrewdriverclick(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity,
+ EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ if (GT_Utility.getClickedFacingCoords(aSide, aX, aY, aZ)[0] >= 0.5F) {
+ aCoverVariable += (mMaxItemCapacity * (aPlayer.isSneaking() ? 0.1f : 0.01f));
+ } else {
+ aCoverVariable -= (mMaxItemCapacity * (aPlayer.isSneaking() ? 0.1f : 0.01f));
+ }
+ if (aCoverVariable > mMaxItemCapacity) {
+ aCoverVariable = mInitialCapacity;
+ }
+ if (aCoverVariable <= 0) {
+ aCoverVariable = mMaxItemCapacity;
+ }
+ GT_Utility.sendChatToPlayer(aPlayer, LangUtils.trans("009", "Overflow point: ") + aCoverVariable + trans("010", "L"));
+ return aCoverVariable;
+ }
+
+ public boolean onCoverRightclick(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity,
+ EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ boolean aShift = aPlayer.isSneaking();
+ int aAmount = aShift ? 128 : 8;
+ if (GT_Utility.getClickedFacingCoords(aSide, aX, aY, aZ)[0] >= 0.5F) {
+ aCoverVariable += aAmount;
+ } else {
+ aCoverVariable -= aAmount;
+ }
+ if (aCoverVariable > mMaxItemCapacity) {
+ aCoverVariable = mInitialCapacity;
+ }
+ if (aCoverVariable <= 0) {
+ aCoverVariable = mMaxItemCapacity;
+ }
+ GT_Utility.sendChatToPlayer(aPlayer, LangUtils.trans("009", "Overflow point: ") + aCoverVariable + trans("010", "L"));
+ aTileEntity.setCoverDataAtSide(aSide, aCoverVariable);
+ return true;
+ }
+
+ public boolean letsRedstoneGoIn(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
+ return true;
+ }
+
+ public boolean letsRedstoneGoOut(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
+ return true;
+ }
+
+ public boolean letsEnergyIn(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
+ return true;
+ }
+
+ public boolean letsEnergyOut(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
+ return true;
+ }
+
+ public boolean letsItemsIn(byte aSide, int aCoverID, int aCoverVariable, int aSlot, ICoverable aTileEntity) {
+ return true;
+ }
+
+ public boolean letsItemsOut(byte aSide, int aCoverID, int aCoverVariable, int aSlot, ICoverable aTileEntity) {
+ return true;
+ }
+
+ public boolean letsFluidIn(byte aSide, int aCoverID, int aCoverVariable, Fluid aFluid, ICoverable aTileEntity) {
+ return false;
+ }
+
+ public boolean letsFluidOut(byte aSide, int aCoverID, int aCoverVariable, Fluid aFluid, ICoverable aTileEntity) {
+ return true;
+ }
+
+ public boolean alwaysLookConnected(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
+ return true;
+ }
+
+ public int getTickRate(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
+ return 5;
+ }
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/covers/GTPP_Cover_ToggleVisual.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/covers/GTPP_Cover_ToggleVisual.java
new file mode 100644
index 0000000000..65b59ce151
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/covers/GTPP_Cover_ToggleVisual.java
@@ -0,0 +1,186 @@
+package gtPlusPlus.xmod.gregtech.common.covers;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import gregtech.api.interfaces.tileentity.ICoverable;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.util.GT_CoverBehavior;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.api.objects.minecraft.BlockPos;
+import gtPlusPlus.api.objects.random.XSTR;
+import gtPlusPlus.core.util.minecraft.LangUtils;
+import gtPlusPlus.core.util.minecraft.PlayerUtils;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.Fluid;
+
+public class GTPP_Cover_ToggleVisual extends GT_CoverBehavior {
+
+ private static final Map<String, Integer> sConnectionStateForEntityMap = new ConcurrentHashMap<String, Integer>();
+ private static final Map<String, String> sPrefixMap = new ConcurrentHashMap<String, String>();
+ private static final int VALUE_OFF = 0;
+ private static final int VALUE_ON = 1;
+
+ public static String generateUniqueKey(byte aSide, ICoverable aEntity) {
+ try {
+ BlockPos aPos = new BlockPos(aEntity.getIGregTechTileEntity(aEntity.getXCoord(), aEntity.getYCoord(), aEntity.getZCoord()));
+ ForgeDirection aDir = ForgeDirection.getOrientation(aSide);
+ String s = aEntity.getInventoryName()+"."+aPos.getUniqueIdentifier()+aDir.name();
+ return s;
+ }
+ catch (Throwable t) {}
+ XSTR x = new XSTR();
+ return "ERROR."+x.getSeed()+x.hashCode()+x.nextDouble()+".ID";
+ }
+
+ public boolean onCoverRightclick(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity,
+ EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ PlayerUtils.messagePlayer(aPlayer, LangUtils.trans("756", "Connectable: ") + getConnectionState(aCoverVariable));
+ return super.onCoverRightclick(aSide, aCoverID, aCoverVariable, aTileEntity, aPlayer, aX, aY, aZ);
+ }
+
+ public int onCoverScrewdriverclick(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity,
+ EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ return super.onCoverScrewdriverclick(aSide, aCoverID, aCoverVariable, aTileEntity, aPlayer, aX, aY, aZ);
+ }
+
+ public boolean letsEnergyIn(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
+ return getConnectionState(aCoverVariable);
+ }
+
+ public boolean letsEnergyOut(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
+ return getConnectionState(aCoverVariable);
+ }
+
+ public boolean letsFluidIn(byte aSide, int aCoverID, int aCoverVariable, Fluid aFluid, ICoverable aTileEntity) {
+ return getConnectionState(aCoverVariable);
+ }
+
+ public boolean letsFluidOut(byte aSide, int aCoverID, int aCoverVariable, Fluid aFluid, ICoverable aTileEntity) {
+ return getConnectionState(aCoverVariable);
+ }
+
+ public boolean letsItemsIn(byte aSide, int aCoverID, int aCoverVariable, int aSlot, ICoverable aTileEntity) {
+ return getConnectionState(aCoverVariable);
+ }
+
+ public boolean letsItemsOut(byte aSide, int aCoverID, int aCoverVariable, int aSlot, ICoverable aTileEntity) {
+ return getConnectionState(aCoverVariable);
+ }
+
+ public String getDescription(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
+ return LangUtils.trans("756", "Connectable: ") + getConnectionState(aCoverVariable);
+ }
+
+ public int getTickRate(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
+ return 1;
+ }
+
+ @Override
+ public int doCoverThings(byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity,
+ long aTimer) {
+ try {
+ String aKey = generateUniqueKey(aSide, aTileEntity);
+ Integer b = sConnectionStateForEntityMap.get(aKey);
+ //Logger.INFO("Val: "+aCoverVariable);
+ if (b != null && aCoverVariable != b) {
+ aCoverVariable = b;
+ }
+ if (b == null) {
+ b = aCoverVariable;
+ sConnectionStateForEntityMap.put(aKey, b);
+ trySetState(aSide, b == VALUE_ON ? VALUE_ON : VALUE_OFF, aTileEntity);
+ }
+ }
+ catch (Throwable t) {
+
+ }
+ return aCoverVariable;
+ }
+
+ @Override
+ public boolean letsRedstoneGoIn(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
+ return getConnectionState(aCoverVariable);
+ }
+
+ @Override
+ public boolean letsRedstoneGoOut(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
+ return getConnectionState(aCoverVariable);
+ }
+
+ @Override
+ public boolean alwaysLookConnected(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
+ return super.alwaysLookConnected(aSide, aCoverID, aCoverVariable, aTileEntity);
+ }
+
+ @Override
+ public byte getRedstoneInput(byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable,
+ ICoverable aTileEntity) {
+ if (!getConnectionState(aCoverVariable)) {
+ return 0;
+ }
+ return super.getRedstoneInput(aSide, aInputRedstone, aCoverID, aCoverVariable, aTileEntity);
+ }
+
+ @Override
+ public void placeCover(byte aSide, ItemStack aCover, ICoverable aTileEntity) {
+ String aKey = generateUniqueKey(aSide, aTileEntity);
+ boolean state = getCoverConnections(aCover);
+ sPrefixMap.put(aKey, aCover.getUnlocalizedName());
+ Logger.INFO("Mapping key "+aKey+" to "+state);
+ sConnectionStateForEntityMap.put(aKey, state ? VALUE_ON : VALUE_OFF);
+ Logger.INFO("Key Value: "+(state ? VALUE_ON : VALUE_OFF));
+ //Try set cover state directly
+ //trySetState(aSide, state ? VALUE_ON : VALUE_OFF, aTileEntity);
+ super.placeCover(aSide, aCover, aTileEntity);
+ }
+
+ @Override
+ public boolean onCoverRemoval(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity,
+ boolean aForced) {
+ String aKey = generateUniqueKey(aSide, aTileEntity);
+ sConnectionStateForEntityMap.remove(aKey);
+ //Logger.INFO("Unmapping key "+aKey+".");
+ return true;
+ }
+
+ public static boolean getConnectionState(int aCoverVar) {
+ return aCoverVar == VALUE_ON;
+ }
+
+ private static final void trySetState(byte aSide, int aState, ICoverable aTile) {
+ //Try set cover state directly
+ if (aTile instanceof IGregTechTileEntity) {
+ IGregTechTileEntity gTileEntity = (IGregTechTileEntity) aTile;
+ if (gTileEntity != null) {
+ gTileEntity.setCoverDataAtSide(aSide, aState);
+ }
+ }
+ }
+
+
+ public static boolean getConnectionState(byte aSide, ICoverable aTile) {
+ String aKey = generateUniqueKey(aSide, aTile);
+ return getConnectionState(aKey);
+ }
+
+ public static boolean getConnectionState(String aKey) {
+ Integer b = sConnectionStateForEntityMap.get(aKey);
+ //Logger.INFO("Get State: "+b+" | "+aKey);
+ return b != null ? b == VALUE_ON : false;
+ }
+
+ public static final boolean getCoverConnections(final ItemStack aStack) {
+ NBTTagCompound aNBT = aStack.getTagCompound();
+ if (aNBT != null) {
+ aNBT = aNBT.getCompoundTag("CustomCoverMeta");
+ if (aNBT != null) {
+ return aNBT.getBoolean("AllowConnections");
+ }
+ }
+ return false;
+ }
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/ChargingHelper.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/ChargingHelper.java
new file mode 100644
index 0000000000..70c7b2da23
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/ChargingHelper.java
@@ -0,0 +1,429 @@
+package gtPlusPlus.xmod.gregtech.common.helpers;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+import cpw.mods.fml.common.eventhandler.EventPriority;
+import cpw.mods.fml.common.eventhandler.SubscribeEvent;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.ItemStack;
+
+import gregtech.api.enums.GT_Values;
+import gregtech.api.util.GT_ModHandler;
+import gregtech.common.items.GT_MetaGenerated_Item_01;
+import gregtech.common.items.GT_MetaGenerated_Item_02;
+import gregtech.common.items.GT_MetaGenerated_Tool_01;
+
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.api.objects.data.Pair;
+import gtPlusPlus.api.objects.minecraft.BlockPos;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.math.MathUtils;
+import gtPlusPlus.core.util.minecraft.NBTUtils;
+import gtPlusPlus.core.util.reflect.ReflectionUtils;
+import gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic.GregtechMetaWirelessCharger;
+import ic2.api.info.Info;
+import ic2.api.item.ElectricItem;
+import ic2.api.item.IElectricItem;
+import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
+
+public class ChargingHelper {
+
+ private static Map<EntityPlayer, Pair<GregtechMetaWirelessCharger, Byte>> mValidPlayers = new HashMap<EntityPlayer, Pair<GregtechMetaWirelessCharger, Byte>>();
+ protected static Map<BlockPos, GregtechMetaWirelessCharger> mChargerMap = new HashMap<BlockPos, GregtechMetaWirelessCharger>();
+ private int mTickTimer = 0;
+ private final int mTickMultiplier = 20;
+
+ //Called whenever the player is updated or ticked.
+ @SubscribeEvent(priority = EventPriority.HIGHEST)
+ public void onPlayerTick(LivingUpdateEvent event) {
+ try {
+ if (event.entity != null && event.entityLiving != null){
+ if (event.entityLiving instanceof EntityPlayer){
+ EntityPlayer mPlayerMan = (EntityPlayer) event.entityLiving;
+
+
+ if (mPlayerMan != null){
+ //Utils.LOG_WARNING("Found Player.");
+
+ if (Utils.isServer()){
+ //Utils.LOG_WARNING("Found Server-Side.");
+
+ mTickTimer++;
+ if (mTickTimer % mTickMultiplier == 0){
+
+ long mVoltage = 0;
+ long mEuStored = 0;
+
+ if (!mChargerMap.isEmpty() && mValidPlayers.containsKey(mPlayerMan)){
+ InventoryPlayer mPlayerInventory = mPlayerMan.inventory;
+ ItemStack[] mArmourContents = mPlayerInventory.armorInventory.clone();
+ ItemStack[] mInventoryContents = mPlayerInventory.mainInventory.clone();
+
+ for (GregtechMetaWirelessCharger mEntityTemp : mChargerMap.values()){
+ if (mEntityTemp != null){
+ if (mPlayerMan.getEntityWorld().provider.dimensionId == mEntityTemp.getDimensionID()){
+ mVoltage = mEntityTemp.maxEUInput();
+ mEuStored = mEntityTemp.getEUVar();
+ if (mVoltage > 0 && mEuStored >= mVoltage){
+
+ Map<EntityPlayer, UUID> LR = mEntityTemp.getLongRangeMap();
+ Map<UUID, EntityPlayer> LO = mEntityTemp.getLocalMap();
+
+ long mStartingEu = mEntityTemp.getEUVar();
+ long mCurrentEu = mEntityTemp.getEUVar();
+ long mEuUsed = 0;
+ if (mEntityTemp.getMode() == 0){
+ if (!LR.isEmpty() && LR.containsKey(mPlayerMan)){
+ mCurrentEu = chargeItems(mEntityTemp, mArmourContents, mPlayerMan);
+ mCurrentEu = chargeItems(mEntityTemp, mInventoryContents, mPlayerMan);
+ }
+ }
+ else if (mEntityTemp.getMode() == 1){
+ if (!LO.isEmpty() && LO.containsValue(mPlayerMan)){
+ mCurrentEu = chargeItems(mEntityTemp, mArmourContents, mPlayerMan);
+ mCurrentEu = chargeItems(mEntityTemp, mInventoryContents, mPlayerMan);
+ }
+ }
+ else {
+ if (!LR.isEmpty() && LR.containsKey(mPlayerMan)){
+ mCurrentEu = chargeItems(mEntityTemp, mArmourContents, mPlayerMan);
+ mCurrentEu = chargeItems(mEntityTemp, mInventoryContents, mPlayerMan);
+ }
+ if (!LO.isEmpty() && LO.containsValue(mPlayerMan)){
+ mCurrentEu = chargeItems(mEntityTemp, mArmourContents, mPlayerMan);
+ mCurrentEu = chargeItems(mEntityTemp, mInventoryContents, mPlayerMan);
+ }
+ }
+
+ if ((mEuUsed = (mStartingEu - mCurrentEu)) <= 0 && mEntityTemp != null){
+ long mMaxDistance;
+ if (mEntityTemp.getMode() == 0){
+ mMaxDistance = (4*GT_Values.V[mEntityTemp.getTier()]);
+ }
+ else if (mEntityTemp.getMode() == 1){
+ mMaxDistance = (mEntityTemp.getTier()*10);
+ }
+ else {
+ mMaxDistance = (4*GT_Values.V[mEntityTemp.getTier()]/2);
+ }
+ double mDistance = calculateDistance(mEntityTemp, mPlayerMan);
+ long mVoltageCost = MathUtils.findPercentageOfInt(mMaxDistance, (float) mDistance);
+
+ if (mVoltageCost > 0){
+ if (mVoltageCost > mEntityTemp.maxEUInput()){
+ mEntityTemp.setEUVar((mEntityTemp.getEUVar()-mEntityTemp.maxEUInput()));
+ }
+ else {
+ mEntityTemp.setEUVar((mEntityTemp.getEUVar()-mVoltageCost));
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ catch (Throwable t){
+ //Utils.LOG_WARNING("State of Wireless Charger changed in an invalid way, this prevented a crash.");
+
+ if (!mChargerMap.isEmpty()){
+ for (GregtechMetaWirelessCharger r : mChargerMap.values()){
+ if (r == null){
+ mChargerMap.remove(r);
+ }
+ }
+ }
+ //t.printStackTrace();
+ }
+
+
+ }
+
+ public static boolean addEntry(BlockPos mPos, GregtechMetaWirelessCharger mEntity){
+ if (mEntity == null){
+ return false;
+ }
+ if (!mChargerMap.containsKey(mPos)){
+ if (mChargerMap.put(mPos, mEntity) == null){
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+ else {
+ return false;
+ }
+ }
+
+ public static boolean removeEntry(BlockPos mPos, GregtechMetaWirelessCharger mEntity){
+ if (mEntity == null){
+ return false;
+ }
+ if (mChargerMap.containsKey(mPos)){
+ if (mChargerMap.remove(mPos, mEntity)){
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+ else {
+ return false;
+ }
+ }
+
+ public static boolean addValidPlayer(EntityPlayer mPlayer, GregtechMetaWirelessCharger mEntity){
+ if (mEntity == null){
+ return false;
+ }
+ Logger.WARNING("trying to map new player");
+ if (mValidPlayers.containsKey(mPlayer)){
+ Logger.WARNING("Key contains player already?");
+ return false;
+ }
+ else {
+ Logger.WARNING("key not found, adding");
+ Pair<GregtechMetaWirelessCharger, Byte> mEntry = new Pair<GregtechMetaWirelessCharger, Byte>(mEntity, (byte) mEntity.getMode());
+ if (mValidPlayers.put(mPlayer, mEntry) == null){
+ Logger.WARNING("Added a Player to the Tick Map.");
+ return true;
+ }
+ else {
+ Logger.WARNING("Tried to add player but it was already there?");
+ return false;
+ }
+ }
+ }
+
+ public static boolean removeValidPlayer(EntityPlayer mPlayer, GregtechMetaWirelessCharger mEntity){
+ if (mEntity == null){
+ return false;
+ }
+ Logger.WARNING("trying to remove player from map");
+ if (mValidPlayers.containsKey(mPlayer)){
+ Logger.WARNING("key found, removing");
+ Pair<GregtechMetaWirelessCharger, Byte> mEntry = new Pair<GregtechMetaWirelessCharger, Byte>(mEntity, (byte) mEntity.getMode());
+ if (mValidPlayers.remove(mPlayer, mEntry)){
+ Logger.WARNING("Removed a Player to the Tick Map.");
+ return true;
+ }
+ else {
+ Logger.WARNING("Tried to remove player but it was not there?");
+ return false;
+ }
+ }
+ else {
+ Logger.WARNING("Key does not contain player?");
+ return false;
+ }
+ }
+
+ public double calculateDistance(GregtechMetaWirelessCharger mEntityTemp, EntityPlayer mPlayerMan){
+ if (mEntityTemp == null || mPlayerMan == null){
+ return 0;
+ }
+ return mEntityTemp.getDistanceBetweenTwoPositions(mEntityTemp.getTileEntityPosition(), mEntityTemp.getPositionOfEntity(mPlayerMan));
+ }
+
+ public long chargeItems(GregtechMetaWirelessCharger mEntity, ItemStack[] mItems, EntityPlayer mPlayer){
+ if (mEntity == null){
+ return -100;
+ }
+ if (mItems == null || mItems.length == 0){
+ return mEntity.getEUVar();
+ }
+ long mInitialValue = mEntity.getEUVar();
+ long mReturnValue = chargeItemsEx(mEntity, mItems, mPlayer);
+ return ((mReturnValue < mInitialValue) ? mReturnValue : mInitialValue);
+ }
+
+ public long chargeItemsEx(GregtechMetaWirelessCharger mEntity, ItemStack[] mItems, EntityPlayer mPlayer){
+
+ //Bad Entity
+ if (mEntity == null){
+ return -100;
+ }
+ //Bad Inventory
+ if (mItems == null || mItems.length == 0){
+ return mEntity.getEUVar();
+ }
+ //Set Variables to Charge
+ int mChargedItems = 0;
+ final int mTier = mEntity.getTier();
+ final long mVoltage = mEntity.maxEUInput();
+ long mEuStored = mEntity.getEUVar();
+ final long mEuStoredOriginal = mEntity.getEUVar();
+ //For Inventory Contents
+
+ int mItemSlot = 0;
+
+ for (ItemStack mTemp : mItems){
+ mItemSlot++;
+ if (mTemp != null){
+ Logger.WARNING("Slot "+mItemSlot+" contains "+mTemp.getDisplayName());
+ }
+ //Is item Electrical
+ if (isItemValid(mTemp)){
+ Logger.WARNING("1");
+
+ //Transfer Limit
+ double mItemEuTLimit = ((IElectricItem) mTemp.getItem()).getTransferLimit(mTemp);
+ //Check if Tile has more or equal EU to what can be transferred into the item.
+ if (mEuStored >= mItemEuTLimit){
+ Logger.WARNING("2");
+
+ double mItemMaxCharge = ((IElectricItem) mTemp.getItem()).getMaxCharge(mTemp);
+ double mitemCurrentCharge = ElectricItem.manager.getCharge(mTemp);
+
+ if (mitemCurrentCharge >= mItemMaxCharge){
+ continue;
+ }
+
+ //Try get charge direct from NBT for GT and IC2 stacks
+ Logger.WARNING("3");
+ if (mTemp.getItem() instanceof GT_MetaGenerated_Tool_01
+ || mTemp.getItem() instanceof GT_MetaGenerated_Item_01
+ || mTemp.getItem() instanceof GT_MetaGenerated_Item_02
+ || ReflectionUtils.getClass("gregtech.common.items.GT_MetaGenerated_Item_03").isInstance(mTemp.getItem())
+ || mTemp.getItem().getClass().getName().toLowerCase().equals(("gregtech.common.items.GT_MetaGenerated_Tool_01").toLowerCase())){
+ if (!NBTUtils.hasKey(mTemp, "GT.ItemCharge")){
+ if (!mTemp.getDisplayName().toLowerCase().contains("battery")){
+ if (!GT_ModHandler.isElectricItem(mTemp)){
+ continue;
+ }
+ }
+ else {
+ mitemCurrentCharge = 0;
+ }
+ }
+ else {
+ mitemCurrentCharge = NBTUtils.getLong(mTemp, "GT.ItemCharge");
+ }
+ }
+ else if (mTemp.getItem() instanceof IElectricItem){
+ mitemCurrentCharge = NBTUtils.getLong(mTemp, "charge");
+ }
+
+ double mVoltageIncrease;
+ if (mItemEuTLimit >= mVoltage){
+ mVoltageIncrease = mVoltage;
+ }
+ else if (mItemEuTLimit < mVoltage){
+ mVoltageIncrease = mItemEuTLimit;
+ }
+ else {
+ mVoltageIncrease = mItemEuTLimit;
+ }
+
+ Logger.WARNING("4");
+
+ int mMulti;
+ if ((mitemCurrentCharge + (mVoltageIncrease*20)) <= (mItemMaxCharge - (mVoltageIncrease*20))){
+ mMulti = 20;
+ }
+ else if ((mitemCurrentCharge + (mVoltageIncrease*10)) <= (mItemMaxCharge - (mVoltageIncrease*10))){
+ mMulti = 10;
+ }
+ else if ((mitemCurrentCharge + (mVoltageIncrease*5)) <= (mItemMaxCharge - (mVoltageIncrease*5))){
+ mMulti = 5;
+ }
+ else {
+ mMulti = 1;
+ }
+ Logger.WARNING("5");
+
+
+ int mMultiVoltage = (int) (mMulti*mVoltageIncrease);
+
+ if ((mitemCurrentCharge + mMultiVoltage) <= mItemMaxCharge){
+ Logger.WARNING("6");
+ int g = 0;
+ if ((g = GT_ModHandler.chargeElectricItem(mTemp, mMultiVoltage, Integer.MAX_VALUE, true, false)) > 0){
+ Logger.WARNING("6.5 - "+g+" - "+mMulti);
+ for (int i=0; i<mMulti;i++){
+ if (ElectricItem.manager.charge(mTemp, mVoltageIncrease, Integer.MAX_VALUE, false, false) > 0){
+ continue;
+ }
+ }
+ }
+ if (ElectricItem.manager.getCharge(mTemp) > mitemCurrentCharge){
+ Logger.WARNING("7");
+ mEntity.setEUVar(mEuStored-(mVoltage*mMulti));
+ mEuStored = mEntity.getEUVar();
+ Logger.WARNING("Charged "+mTemp.getDisplayName()+" | Slot: "+mItemSlot+" | EU Multiplier: "+mMulti+" | EU/t input: "+mVoltageIncrease+" | EU/t consumed by Tile: "+mVoltage+" | Item Max Charge: "+mItemMaxCharge+" | Item Start Charge: "+mitemCurrentCharge+" | Item New Charge"+ElectricItem.manager.getCharge(mTemp));
+ mChargedItems++;
+ }
+ }
+
+ //Try top up Item Chrage
+ mitemCurrentCharge = ElectricItem.manager.getCharge(mTemp);
+ if (mitemCurrentCharge < mItemMaxCharge && mitemCurrentCharge >= (mItemMaxCharge-mVoltage)){
+ int xDif = (int) (mItemMaxCharge - mitemCurrentCharge);
+ Logger.WARNING("8 - "+xDif);
+ int g = 0;
+ if ((g = GT_ModHandler.chargeElectricItem(mTemp, xDif, Integer.MAX_VALUE, true, false)) >= 0){
+ Logger.WARNING("8.5 - "+g);
+ if (ElectricItem.manager.getCharge(mTemp) >= mItemMaxCharge){
+ Logger.WARNING("9");
+ mEntity.setEUVar(mEntity.getEUVar()-(xDif));
+ mEuStored = mEntity.getEUVar();
+ Logger.WARNING("Charged "+mTemp.getDisplayName()+" | Slot: "+mItemSlot+" | EU Multiplier: "+mMulti+" | EU/t input: "+mVoltageIncrease+" | EU/t consumed by Tile: "+mVoltage+" | Item Max Charge: "+mItemMaxCharge+" | Item Start Charge: "+mitemCurrentCharge+" | Item New Charge"+ElectricItem.manager.getCharge(mTemp));
+ mChargedItems++;
+ }
+ }
+ }
+
+
+ }
+ }
+ else {
+ if (mTemp != null){
+ Logger.WARNING("Found Non-Valid item. "+mTemp.getDisplayName());
+ }
+ }
+ }
+
+ //Return Values
+ if (mChargedItems < 1){
+ return mEuStoredOriginal;
+ }
+
+ return mEntity.getEUVar();
+ }
+
+ public static boolean isItemValid(final ItemStack itemstack) {
+ if (itemstack == null){
+ return false;
+ }
+ if (GT_ModHandler.isElectricItem(itemstack)){
+ return true;
+ }
+ if ((accepts(itemstack)) || (itemstack.getItem() instanceof IElectricItem)) {
+ return true;
+ }
+ return false;
+ }
+
+ public static boolean accepts(final ItemStack stack) {
+ if (stack == null) {
+ return false;
+ }
+ else {
+ return false;
+ }
+ //return (Info.itemEnergy.getEnergyValue(stack) > 0.0D) || (ElectricItem.manager.discharge(stack, (1.0D / 0.0D), 4, true, true, true) > 0.0D);
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/CraftingHelper.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/CraftingHelper.java
new file mode 100644
index 0000000000..e06636e168
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/CraftingHelper.java
@@ -0,0 +1,42 @@
+package gtPlusPlus.xmod.gregtech.common.helpers;
+
+import net.minecraft.entity.player.EntityPlayerMP;
+import net.minecraft.world.World;
+import net.minecraft.world.WorldServer;
+
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.xmod.gregtech.common.helpers.autocrafter.AC_Helper_Container;
+import gtPlusPlus.xmod.gregtech.common.helpers.autocrafter.AC_Helper_Utils;
+import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.GT4Entity_AutoCrafter;
+import net.minecraftforge.common.util.FakePlayerFactory;
+
+public class CraftingHelper{
+
+ public final String mInventoryName;
+ public final int mPosX;
+ public final int mPosY;
+ public final int mPosZ;
+ public final GT4Entity_AutoCrafter crafter;
+ public final World world;
+ public final EntityPlayerMP player;
+ public final AC_Helper_Container inventory;
+
+ public CraftingHelper(GT4Entity_AutoCrafter AC){
+ Logger.INFO("[A-C] Created a crafting helper.");
+ crafter = AC;
+ AC_Helper_Utils.addCrafter(AC);
+ //Get some variables.
+ world = AC.getBaseMetaTileEntity().getWorld();
+ mPosX = AC.getBaseMetaTileEntity().getXCoord();
+ mPosY = AC.getBaseMetaTileEntity().getYCoord();
+ mPosZ = AC.getBaseMetaTileEntity().getZCoord();
+ //Create Fake player to handle crating.
+
+ player = CORE.getFakePlayer(world);
+ //Set storage container
+ inventory = new AC_Helper_Container(player.inventory, world, mPosX, mPosY, mPosZ);
+ mInventoryName = inventory.getMatrix().getInventoryName();
+
+ }
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/FlotationRecipeHandler.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/FlotationRecipeHandler.java
new file mode 100644
index 0000000000..333939d800
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/FlotationRecipeHandler.java
@@ -0,0 +1,79 @@
+package gtPlusPlus.xmod.gregtech.common.helpers;
+
+import java.util.HashMap;
+
+import gregtech.api.enums.OrePrefixes;
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.material.Material;
+import gtPlusPlus.core.util.data.AES;
+import gtPlusPlus.xmod.gregtech.api.enums.CustomOrePrefix;
+import net.minecraft.item.ItemStack;
+
+public class FlotationRecipeHandler {
+
+ private static HashMap<String, Material> sMaterialMap = new HashMap<String, Material>();
+ private static HashMap<String, ItemStack> sMilledMap = new HashMap<String, ItemStack>();
+ private static final AES sEncodingHandler = new AES();
+
+ public static boolean registerOreType(Material aMaterial) {
+ String aMaterialKey = sEncodingHandler.encode(aMaterial.getUnlocalizedName());
+ if (sMaterialMap.containsKey(aMaterialKey)) {
+ CORE.crash("Tried to register a Flotation material to an ID already in use. ID: "+aMaterialKey);
+ return false;
+ }
+ else {
+ sMaterialMap.put(aMaterialKey, aMaterial);
+ sMilledMap.put(aMaterialKey, aMaterial.getMilled(1));
+ }
+ return true;
+ }
+
+ public static int getHashForMaterial(Material aMaterial) {
+ return getMaterialsID(aMaterial).hashCode();
+ }
+
+ public static String getMaterialsID(Material aMaterial) {
+ for (String aKey : sMaterialMap.keySet()) {
+ if (sMaterialMap.get(aKey).equals(aMaterial)) {
+ return aKey;
+ }
+ }
+ return "BAD_MATERIAL_ID";
+ }
+
+ public static Material getMaterialOfMilledProduct(ItemStack aMilled) {
+ for (String aKey : sMilledMap.keySet()) {
+ ItemStack aTempMilledStack = sMilledMap.get(aKey);
+ if (GT_Utility.areStacksEqual(aTempMilledStack, aMilled, true)) {
+ return sMaterialMap.get(aKey);
+ }
+ }
+ return null;
+ }
+
+ public static ItemStack findMilledStack(GT_Recipe aRecipe) {
+ if (aRecipe == null || aRecipe.mInputs == null || aRecipe.mInputs.length <= 0) {
+ return null;
+ }
+ return findMilledStack(aRecipe.mInputs);
+ }
+
+ public static ItemStack findMilledStack(ItemStack[] aInputs) {
+ if (aInputs == null || aInputs.length <= 0) {
+ return null;
+ }
+ for (ItemStack aStack : aInputs) {
+ if (CustomOrePrefix.milled.get().contains(aStack)) {
+ return aStack;
+ }
+ }
+ return null;
+ }
+
+ public static AES getEncoder() {
+ return sEncodingHandler;
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/GT_MethodHelper.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/GT_MethodHelper.java
new file mode 100644
index 0000000000..d51107bbf0
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/GT_MethodHelper.java
@@ -0,0 +1,80 @@
+package gtPlusPlus.xmod.gregtech.common.helpers;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import gregtech.api.enums.Textures.BlockIcons;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.metatileentity.BaseMetaTileEntity;
+import gregtech.api.metatileentity.MetaTileEntity;
+import gtPlusPlus.core.util.reflect.ReflectionUtils;
+import net.minecraft.block.Block;
+import net.minecraft.tileentity.TileEntity;
+
+public class GT_MethodHelper {
+
+ private static final Method mGetTexture;
+ private static final Class mITexturedTileEntity;
+
+ static {
+ Class clazz = null;
+ Method aMeth = null;
+ if (ReflectionUtils.doesClassExist("gregtech.api.interfaces.tileentity.ITexturedTileEntity")) {
+ clazz = ReflectionUtils.getClass("gregtech.api.interfaces.tileentity.ITexturedTileEntity");
+ aMeth = ReflectionUtils.getMethod(clazz, "getTexture", Block.class, byte.class);
+ }
+ mITexturedTileEntity = clazz;
+ mGetTexture = aMeth;
+ }
+
+
+ public static ITexture[] getTexture(TileEntity tTileEntity, Block aBlock, byte aSide) {
+
+ if (mITexturedTileEntity.isInstance(tTileEntity)) {
+
+ if (mGetTexture != null) {
+ try {
+ mGetTexture.invoke(tTileEntity, aBlock, aSide);
+ }
+ catch (IllegalAccessException | IllegalArgumentException
+ | InvocationTargetException e) {
+ e.printStackTrace();
+ }
+ }
+ else {
+ if (tTileEntity instanceof BaseMetaTileEntity) {
+ try {
+ BaseMetaTileEntity aTile = (BaseMetaTileEntity) tTileEntity;
+ ITexture rIcon = aTile.getCoverTexture(aSide);
+ Field aFacing = ReflectionUtils.getField(BaseMetaTileEntity.class, "mFacing");
+ Field aColor = ReflectionUtils.getField(BaseMetaTileEntity.class, "mColor");
+ Field aActive = ReflectionUtils.getField(BaseMetaTileEntity.class, "mActive");
+ Field aMetaTile = ReflectionUtils.getField(BaseMetaTileEntity.class, "mMetaTileEntity");
+ Method aHasValidTile = ReflectionUtils.getMethod(BaseMetaTileEntity.class, "hasValidMetaTileEntity", new Class[] {});
+
+ boolean hasValidTileObj = (boolean) aHasValidTile.invoke(aTile, new Object[] {});
+ boolean aActiveObj = aActive.getBoolean(aTile);
+ byte aFacingObj = aFacing.getByte(aTile);
+ byte aColorObj = aColor.getByte(aTile);;
+ MetaTileEntity aMetaTileObj = (MetaTileEntity) aMetaTile.get(aTile);
+
+ if (rIcon != null) {
+ return new ITexture[]{rIcon};
+ } else {
+ return hasValidTileObj
+ ? aMetaTileObj.getTexture(aTile, aSide, aFacingObj, (byte) (aColorObj - 1), aActiveObj,
+ aTile.getOutputRedstoneSignal(aSide) > 0)
+ : BlockIcons.ERROR_RENDERING;
+ }
+ }
+ catch (Throwable t) {
+ t.printStackTrace();
+ }
+ }
+ }
+ }
+ return BlockIcons.ERROR_RENDERING;
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/MachineUpdateHandler.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/MachineUpdateHandler.java
new file mode 100644
index 0000000000..0b52560e0d
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/MachineUpdateHandler.java
@@ -0,0 +1,42 @@
+package gtPlusPlus.xmod.gregtech.common.helpers;
+
+import java.util.HashMap;
+
+import cpw.mods.fml.common.eventhandler.SubscribeEvent;
+import gregtech.api.GregTech_API;
+import net.minecraft.block.Block;
+import net.minecraftforge.event.world.BlockEvent;
+
+public class MachineUpdateHandler {
+
+ private static final HashMap<String, Block> mBlockCache = new HashMap<String, Block>();
+
+ public static void registerBlockToCauseMachineUpdate(String aUnlocalName, Block aBlock) {
+ mBlockCache.put(aUnlocalName, aBlock);
+ }
+
+ @SubscribeEvent
+ public void onBlockEvent(BlockEvent event) {
+ Block aBlock = event.block;
+ String aUnlocalName = aBlock != null ? aBlock.getUnlocalizedName() : "NULL";
+ boolean aDoUpdate = false;
+ if (aBlock != null && aUnlocalName != null && !aUnlocalName.equals("NULL")) {
+ for (String aCachedName : mBlockCache.keySet()) {
+ if (aCachedName.equals(aUnlocalName)) {
+ aDoUpdate = true;
+ break;
+ }
+ else {
+ if (aBlock == mBlockCache.get(aCachedName)) {
+ aDoUpdate = true;
+ break;
+ }
+ }
+ }
+ if (aDoUpdate) {
+ GregTech_API.causeMachineUpdate(event.world, event.x, event.y, event.z);
+ }
+ }
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/TreeFarmHelper.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/TreeFarmHelper.java
new file mode 100644
index 0000000000..2ff2712952
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/TreeFarmHelper.java
@@ -0,0 +1,1033 @@
+package gtPlusPlus.xmod.gregtech.common.helpers;
+
+import static gtPlusPlus.core.lib.CORE.ConfigSwitches.enableTreeFarmerParticles;
+
+import java.util.*;
+import java.util.concurrent.ConcurrentHashMap;
+
+import com.google.common.collect.Lists;
+
+import gnu.trove.set.hash.THashSet;
+
+import cpw.mods.fml.common.FMLCommonHandler;
+import cpw.mods.fml.common.Optional;
+import cpw.mods.fml.common.eventhandler.Event.Result;
+import cpw.mods.fml.common.eventhandler.SubscribeEvent;
+import cpw.mods.fml.common.gameevent.TickEvent;
+
+import gregtech.api.enums.*;
+import net.minecraft.block.Block;
+import net.minecraft.block.BlockAir;
+import net.minecraft.block.IGrowable;
+import net.minecraft.block.material.Material;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.EntityPlayerMP;
+import net.minecraft.init.Blocks;
+import net.minecraft.item.ItemStack;
+import net.minecraft.network.play.server.S23PacketBlockChange;
+import net.minecraft.server.MinecraftServer;
+import net.minecraft.world.ChunkPosition;
+import net.minecraft.world.World;
+
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.items.GT_MetaGenerated_Tool;
+import gregtech.common.items.GT_MetaGenerated_Item_02;
+
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.api.objects.data.AutoMap;
+import gtPlusPlus.api.objects.minecraft.BlockPos;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.lib.LoadedMods;
+import gtPlusPlus.core.players.FakeFarmer;
+import gtPlusPlus.core.slots.SlotBuzzSaw.SAWTOOL;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.math.MathUtils;
+import gtPlusPlus.core.util.minecraft.FluidUtils;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import gtPlusPlus.core.util.minecraft.particles.BlockBreakParticles;
+import gtPlusPlus.core.util.reflect.ReflectionUtils;
+import gtPlusPlus.xmod.gregtech.common.items.MetaGeneratedGregtechItems;
+import net.minecraftforge.common.ForgeHooks;
+import net.minecraftforge.common.MinecraftForge;
+import net.minecraftforge.event.entity.player.BonemealEvent;
+import net.minecraftforge.event.world.BlockEvent;
+import net.minecraftforge.fluids.FluidStack;
+import net.minecraftforge.oredict.OreDictionary;
+
+public class TreeFarmHelper {
+
+ public static final FluidStack fertT1 = FluidUtils.getFluidStack("fluid.fertiliser", 3);
+ public static final FluidStack fertT2 = FluidUtils.getFluidStack("fluid.un18fertiliser", 2);
+ public static final FluidStack fertT3 = FluidUtils.getFluidStack("fluid.un32fertiliser", 1);
+ private static final int sawOreId = OreDictionary.getOreID(ToolDictNames.craftingToolSaw.name());
+
+ public static ITexture[][][] getTextureSet() {
+ final ITexture[][][] rTextures = new ITexture[10][17][];
+ for (byte i = -1; i < 16; i++) {
+ rTextures[0][i + 1] = TreeFarmHelper.getFront(i);
+ rTextures[1][i + 1] = TreeFarmHelper.getBack(i);
+ rTextures[2][i + 1] = TreeFarmHelper.getBottom(i);
+ rTextures[3][i + 1] = TreeFarmHelper.getTop(i);
+ rTextures[4][i + 1] = TreeFarmHelper.getSides(i);
+ rTextures[5][i + 1] = TreeFarmHelper.getFrontActive(i);
+ rTextures[6][i + 1] = TreeFarmHelper.getBackActive(i);
+ rTextures[7][i + 1] = TreeFarmHelper.getBottomActive(i);
+ rTextures[8][i + 1] = TreeFarmHelper.getTopActive(i);
+ rTextures[9][i + 1] = TreeFarmHelper.getSidesActive(i);
+ }
+ return rTextures;
+ }
+
+ public static ITexture[] getFront(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[2][aColor + 1]};
+ }
+
+ public static ITexture[] getBack(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[2][aColor + 1]};
+ }
+
+ public static ITexture[] getBottom(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[2][aColor + 1]};
+ }
+
+ public static ITexture[] getTop(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[2][aColor + 1]};
+ }
+
+ public static ITexture[] getSides(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[2][aColor + 1]};
+ }
+
+ public static ITexture[] getFrontActive(final byte aColor) {
+ return getFront(aColor);
+ }
+
+ public static ITexture[] getBackActive(final byte aColor) {
+ return getBack(aColor);
+ }
+
+ public static ITexture[] getBottomActive(final byte aColor) {
+ return getBottom(aColor);
+ }
+
+ public static ITexture[] getTopActive(final byte aColor) {
+ return getTop(aColor);
+ }
+
+ public static ITexture[] getSidesActive(final byte aColor) {
+ return getSides(aColor);
+ }
+
+ public static boolean applyBonemeal(final EntityPlayer player, final World world, final int intX, final int intY, final int intZ, final short multiplier){
+ final Block block = world.getBlock(intX, intY, intZ);
+
+
+ int roll;
+ int rollNeeded;
+
+ if (multiplier==1){
+ roll = MathUtils.randInt(1, 15);
+ rollNeeded = 15;
+ }
+ else if (multiplier==2){
+ roll = MathUtils.randInt(1, 10);
+ rollNeeded = 10;
+ }
+ else {
+ roll = MathUtils.randInt(1, 5);
+ rollNeeded = 5;
+ }
+
+ if (roll != rollNeeded){
+ return false;
+ }
+
+ //EntityPlayer player = FakePlayerFactory.getMinecraft((WorldServer)world);
+ if (!world.isRemote){
+ if (enableTreeFarmerParticles){
+ world.playAuxSFX(2005, intX, intY, intZ, 0);
+ }
+ }
+ final BonemealEvent event = new BonemealEvent(player, world, block, intX, intY, intZ);
+ if (MinecraftForge.EVENT_BUS.post(event)){
+ Logger.MACHINE_INFO("Not sure why this returned false");
+ return false;
+ }
+ if (event.getResult() == Result.ALLOW){
+ if (!world.isRemote){
+ world.playAuxSFX(2005, intX, intY, intZ, 0);
+ }
+ return true;
+ }
+ if (block instanceof IGrowable){
+ final IGrowable igrowable = (IGrowable)block;
+ if (igrowable.func_149851_a(world, intX, intY, intZ, world.isRemote)){
+ if (!world.isRemote){
+ if (igrowable.func_149852_a(world, CORE.RANDOM, intX, intY, intZ)){
+ igrowable.func_149853_b(world, CORE.RANDOM, intX, intY, intZ);
+ }
+ }
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public static boolean cleanUp(final IGregTechTileEntity aBaseMetaTileEntity){
+ Logger.MACHINE_INFO("called cleanUp()");
+ int cleanedUp = 0;
+ final int xDir = net.minecraftforge.common.util.ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 11;
+ final int zDir = net.minecraftforge.common.util.ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * 11;
+
+ for (int h=1;h<175;h++){
+ for (int i = -11; i <= 11; i++) {
+ for (int j = -11; j <= 11; j++) {
+
+ final Block testBlock = aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j);
+
+
+ if
+ ((
+ ((i == -8) || (i == 8)) ||
+ ((i == -9) || (i == 9)) ||
+ ((i == -10) || (i == 10)) ||
+ ((i == -11) || (i == 11))
+ )
+ &&
+ (
+ ((j == -8) || (j == 8)) ||
+ ((j == -9) || (j == 9)) ||
+ ((j == -10) || (j == 10)) ||
+ ((j == -11) || (j == 11))
+ )){
+
+ if (!testBlock.getUnlocalizedName().toLowerCase().contains("air") || !testBlock.getUnlocalizedName().toLowerCase().contains("pumpkin")) {
+ //Logger.WARNING("5:"+testBlock.getUnlocalizedName());
+ } else {
+ aBaseMetaTileEntity.getWorld().setBlock(aBaseMetaTileEntity.getXCoord()+xDir+i, aBaseMetaTileEntity.getYCoord()+h, aBaseMetaTileEntity.getZCoord()+zDir+j, Blocks.bookshelf);
+ }
+ }
+
+
+ //If not in the middle - don't know how else to check this one without lots of !=
+ if (
+ (i != 7) && (i != -7) && (j != 7) && (j != -7) &&
+ (i != 6) && (i != -6) && (j != 6) && (j != -6) &&
+ (i != 5) && (i != -5) && (j != 5) && (j != -5) &&
+ (i != 4) && (i != -4) && (j != 4) && (j != -4) &&
+ (i != 3) && (i != -3) && (j != 3) && (j != -3) &&
+ (i != 2) && (i != -2) && (j != 2) && (j != -2) &&
+ (i != 1) && (i != -1) && (j != 1) && (j != -1) &&
+ (i != 0) && (j != 0)
+ ){
+
+ if (!testBlock.getUnlocalizedName().toLowerCase().contains("air") || !testBlock.getUnlocalizedName().toLowerCase().contains("pumpkin")) {
+ //Logger.WARNING("0:"+testBlock.getUnlocalizedName());
+ } else {
+ aBaseMetaTileEntity.getWorld().setBlock(aBaseMetaTileEntity.getXCoord()+xDir+i, aBaseMetaTileEntity.getYCoord()+h, aBaseMetaTileEntity.getZCoord()+zDir+j, Blocks.melon_block);
+ }
+
+
+ if (isLeaves(testBlock) || isWoodLog(testBlock)){
+ //Logger.WARNING("1:"+testBlock.getUnlocalizedName());
+ int posiX, posiY, posiZ;
+ posiX = aBaseMetaTileEntity.getXCoord()+xDir+i;
+ posiY = aBaseMetaTileEntity.getYCoord()+h;
+ posiZ = aBaseMetaTileEntity.getZCoord()+zDir+j;
+ //Utils.LOG_MACHINE_INFO("Cleaning Up some leftovers.");
+ cleanedUp++;
+ aBaseMetaTileEntity.getWorld().setBlockToAir(posiX, posiY, posiZ);
+ new BlockBreakParticles(aBaseMetaTileEntity.getWorld(), posiX, posiY, posiZ, Blocks.dirt);
+ }
+ else {
+ //Utils.LOG_WARNING("2:"+testBlock.getUnlocalizedName());
+ }
+ }
+ else {
+ //Utils.LOG_WARNING("1");
+ }
+
+
+ }
+
+ }
+ }
+ Logger.MACHINE_INFO("cleaning up | "+cleanedUp );
+ return true;
+ }
+
+ public static SAWTOOL isCorrectMachinePart(final ItemStack aStack) {
+ if (aStack != null){
+ //Utils.LOG_WARNING("Found "+aStack.getDisplayName()+" in the GUI slot.");
+ if ((aStack.getItem() instanceof GT_MetaGenerated_Item_02) || (aStack.getItem() instanceof GT_MetaGenerated_Tool)){
+ if (OrePrefixes.craftingTool.contains(aStack)){
+ if (aStack.getDisplayName().toLowerCase().contains("saw") || aStack.getDisplayName().toLowerCase().contains("gt.metatool.01")){
+ if (aStack.getItemDamage() == 10){
+ return SAWTOOL.SAW;
+ }
+ else if (aStack.getItemDamage() == 140 || aStack.getDisplayName().toLowerCase().contains("gt.metatool.01.140")){
+ return SAWTOOL.BUZZSAW;
+ }
+ else if (aStack.getItemDamage() == 110 || aStack.getDisplayName().toLowerCase().contains("gt.metatool.01.110")){
+ return SAWTOOL.CHAINSAW;
+ }
+ else if (aStack.getItemDamage() == 112 || aStack.getDisplayName().toLowerCase().contains("gt.metatool.01.112")){
+ return SAWTOOL.CHAINSAW;
+ }
+ else if (aStack.getItemDamage() == 114 || aStack.getDisplayName().toLowerCase().contains("gt.metatool.01.114")){
+ return SAWTOOL.CHAINSAW;
+ }
+ else {
+ return SAWTOOL.NONE;
+ }
+ }
+ }
+ }
+ }
+ return SAWTOOL.NONE;
+ }
+
+ public static ToolType getPartType(final ItemStack aStack) {
+ if (aStack != null){
+ //Utils.LOG_WARNING("Found "+aStack.getDisplayName()+" in the GUI slot.");
+
+ if (aStack.getItem() == MetaGeneratedGregtechItems.INSTANCE) {
+ int aDmg = aStack.getItemDamage();
+ if (aDmg >= 32120 && aDmg <= 32128) {
+ return ToolType.Unbreakable;
+ }
+ Logger.INFO("bad Tool in Slot 2 | "+aStack.getUnlocalizedName().toLowerCase() + " | "+aDmg);
+ return null;
+ }
+
+ if (aStack.getItem() instanceof GT_MetaGenerated_Tool) {
+ if (Arrays.stream(OreDictionary.getOreIDs(aStack)).anyMatch(i -> i == sawOreId))
+ return ToolType.Breakable;
+ }
+ }
+ Logger.INFO("bad Tool in Slot 4");
+ return null;
+ }
+
+ public static boolean isHumusLoaded = false;
+ public static boolean isForestryLogsLoaded = false;
+ public static boolean isForestryFenceLoaded = false;
+ public static boolean isForestrySaplingsLoaded = false;
+ public static boolean isForestryLeavesLoaded = false;
+ public static Block blockHumus;
+
+ public static boolean isForestryValid(){
+ if (!LoadedMods.Forestry){
+ return false;
+ }
+ if (ReflectionUtils.doesClassExist("forestry.core.blocks.BlockSoil")){
+ isHumusLoaded = true;
+ }
+ if (ReflectionUtils.doesClassExist("forestry.arboriculture.blocks.BlockLog")){
+ isForestryLogsLoaded = true;
+ }
+ if (ReflectionUtils.doesClassExist("forestry.arboriculture.blocks.BlockArbFence")){
+ isForestryFenceLoaded = true;
+ }
+ if (ReflectionUtils.doesClassExist("forestry.arboriculture.blocks.BlockSapling")){
+ isForestrySaplingsLoaded = true;
+ }
+ if (ReflectionUtils.doesClassExist("forestry.arboriculture.blocks.BlockForestryLeaves")){
+ isForestryLeavesLoaded = true;
+ }
+ return true;
+ }
+
+ @Optional.Method(modid = "Forestry")
+ public static Block getHumus(){
+ if(blockHumus != null){
+ return blockHumus;
+ }
+ else if (isHumusLoaded){
+ final Class<?> humusClass = ReflectionUtils.getClass("forestry.core.blocks.BlockSoil");
+ final ItemStack humusStack = ItemUtils.getCorrectStacktype("Forestry:soil", 1);
+ if (humusClass != null){
+ blockHumus = Block.getBlockFromItem(humusStack.getItem());
+ return Block.getBlockFromItem(humusStack.getItem());
+ }
+ }
+ return null;
+ }
+
+ public static boolean isWoodLog(final Block log){
+ final String tTool = log.getHarvestTool(0);
+
+ if ((log == Blocks.log) || (log == Blocks.log2)){
+ return true;
+ }
+
+ //Forestry/General Compat
+ if (log.getClass().getName().toLowerCase().contains("blocklog")){
+ return true;
+ }
+
+ //IC2 Rubber Tree Compat
+ if (log.getClass().getName().toLowerCase().contains("rubwood") || log.getClass().getName().toLowerCase().contains("rubleaves")){
+ return true;
+ }
+
+ return (OrePrefixes.log.contains(new ItemStack(log, 1))&& ((tTool != null) && (tTool.equals("axe")))) || (log.getMaterial() != Material.wood) ? false : (OrePrefixes.fence.contains(new ItemStack(log, 1)) ? false : true);
+ }
+
+ public static boolean isLeaves(final Block log){
+ if (log.getUnlocalizedName().toLowerCase().contains("leaf")){
+ return true;
+ }
+ if (log.getUnlocalizedName().toLowerCase().contains("leaves")){
+ return true;
+ }
+ if (log.getLocalizedName().toLowerCase().contains("leaf")){
+ return true;
+ }
+ if (log.getLocalizedName().toLowerCase().contains("leaves")){
+ return true;
+ }
+ return OrePrefixes.leaves.contains(new ItemStack(log, 1)) || log.getMaterial() == Material.leaves || OrePrefixes.treeLeaves.contains(new ItemStack(log, 1)) || log.getMaterial() == Material.vine || OrePrefixes.mushroom.contains(new ItemStack(log, 1)) || log.getMaterial() == Material.cactus;
+ }
+
+ public static boolean isSapling(final Block log){
+ if (log != null){
+ if (OrePrefixes.sapling.contains(new ItemStack(log, 1))){
+ //Logger.WARNING(""+log.getLocalizedName());
+ }
+ if (log.getLocalizedName().toLowerCase().contains("sapling")){
+ //Logger.WARNING(""+log.getLocalizedName());
+ return true;
+ }
+ }
+ return OrePrefixes.sapling.contains(new ItemStack(log, 1));
+ }
+
+ public static boolean isDirtBlock(final Block dirt){
+ return (dirt == Blocks.dirt ? true : (dirt == Blocks.grass ? true : (getHumus() == null ? false : (dirt == blockHumus ? true : false))));
+ }
+
+ public static boolean isFenceBlock(final Block fence){
+ return (fence == Blocks.fence ? true : (fence == Blocks.fence_gate ? true : (fence == Blocks.nether_brick_fence ? true : (OrePrefixes.fence.contains(new ItemStack(fence, 1)) ? true : false))));
+ }
+
+ public static boolean isAirBlock(final Block air){
+ if (air.getLocalizedName().toLowerCase().contains("air")){
+ return true;
+ }
+ if (air.getClass().getName().toLowerCase().contains("residual") || air.getClass().getName().toLowerCase().contains("heat")){
+ return true;
+ }
+ return (air == Blocks.air ? true : (air instanceof BlockAir ? true : false));
+ }
+
+ /*public static boolean isSaplingBlock(Block sapling){
+ return (sapling == Blocks.sapling ? true : (sapling == Blocks.))
+ }*/
+
+ public static BlockPos checkForLogsInGrowArea(final IGregTechTileEntity aBaseMetaTileEntity) {
+ final int xDir = net.minecraftforge.common.util.ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 7;
+ final int zDir = net.minecraftforge.common.util.ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * 7;
+ for (int i = -7; i <= 7; i++) {
+ for (int j = -7; j <= 7; j++) {
+ for (int h = 0; h <= 1; h++) {
+ //Farm Floor inner 14x14
+ if (((i != -7) && (i != 7)) && ((j != -7) && (j != 7))) {
+ if (h == 1) {
+ if (TreeFarmHelper.isWoodLog(aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j))) {
+ Logger.INFO("Found a Log");
+ return new BlockPos(aBaseMetaTileEntity.getXCoord()+xDir + i, aBaseMetaTileEntity.getYCoord()+h, aBaseMetaTileEntity.getZCoord()+zDir + j, aBaseMetaTileEntity.getWorld());
+ }
+ }
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ public static ItemStack[] findTreeFromBase(World world, BlockPos h) {
+ int HARD_LIMIT = 10000;
+ int mCount = 0;
+ Logger.INFO("Finding Rest of Tree.");
+ BlockPos mFirstSpot = h;
+ Set<BlockPos> mSearchedSpaces = new HashSet<BlockPos>();
+ Set<BlockPos> mTreeSet = getConnectedBlocks(world, mFirstSpot, mSearchedSpaces);
+ Set<Set<BlockPos>> mTreeSet2 = new HashSet<Set<BlockPos>>();
+ Set<BlockPos> mFinalTree = new HashSet<BlockPos>();
+ Iterator<BlockPos> it = mTreeSet.iterator();
+
+
+ Logger.INFO("Running first iteration.");
+ while(it.hasNext()){
+ BlockPos G = it.next();
+ mSearchedSpaces.add(G);
+ mTreeSet2.add(getConnectedBlocks(world, G, mSearchedSpaces));
+ mCount++;
+ Logger.INFO("First Search: "+G.getLocationString());
+ if (mCount > HARD_LIMIT) {
+ break;
+ }
+ }
+
+ mCount = 0;
+ Iterator<Set<BlockPos>> it2 = mTreeSet2.iterator();
+ Iterator<BlockPos> it3;
+ Logger.INFO("Running second iteration.");
+ while(it2.hasNext()){
+ Set<BlockPos> G = it2.next();
+ it3 = G.iterator();
+ while(it3.hasNext()){
+ BlockPos G2 = it3.next();
+ mSearchedSpaces.add(G2);
+ mFinalTree.add(G2);
+ mCount++;
+ Logger.INFO("Second Search: "+G2.getLocationString());
+ if (mCount > HARD_LIMIT) {
+ break;
+ }
+ }
+ if (mCount > HARD_LIMIT) {
+ break;
+ }
+ }
+
+
+ if (mFinalTree.size() > 0) {
+ Logger.INFO("Queuing "+mFinalTree.size()+" to Harvest Manager.");
+ TreeCutter harvestManager = new TreeCutter(world);
+
+ Iterator<BlockPos> ith = mFinalTree.iterator();
+ while(ith.hasNext()){
+ BlockPos G = ith.next();
+ harvestManager.queue(G);
+ mCount++;
+ Logger.INFO("Queued: "+G.getLocationString());
+ if (mCount > HARD_LIMIT) {
+ break;
+ }
+ }
+
+ if (harvestManager.isValid) {
+ ItemStack[] loot = harvestManager.getDrops();
+ if (loot.length > 0) {
+ //Logger.INFO("Returning Drops from harvestManager Queue.");
+ return loot;
+ }
+ }
+ }
+ return new ItemStack[] {};
+ }
+
+
+ public static Set<BlockPos> getConnectedBlocks(World W, BlockPos P, Set<BlockPos> checkedSpaces) {
+ int HARD_LIMIT = 1000;
+ int mCount = 0;
+ Logger.INFO("Finding blocks connected to "+P.getLocationString()+".");
+ Set<BlockPos> mCheckedSpaces = checkedSpaces;
+ Set<BlockPos> mStartSearch = searchSixFaces(W, P, mCheckedSpaces, false);
+ Set<BlockPos> mSecondSearch = new HashSet<BlockPos>();
+ Set<BlockPos> mThirdSearch = new HashSet<BlockPos>();
+ Iterator<BlockPos> it = mStartSearch.iterator();
+ while(it.hasNext()){
+ Logger.INFO("Running first iteration. [II]");
+ BlockPos G = it.next();
+ mCheckedSpaces.add(G);
+ Set<BlockPos> mBranchSearch = searchSixFaces(W, G, mCheckedSpaces, true);
+ Iterator<BlockPos> it2 = mBranchSearch.iterator();
+ while(it2.hasNext()){
+ Logger.INFO("Running second iteration. [II]");
+ BlockPos G2 = it2.next();
+ mCheckedSpaces.add(G2);
+ mSecondSearch.add(G2);
+ mCount++;
+ if (mCount > HARD_LIMIT) {
+ break;
+ }
+ }
+ if (mCount > HARD_LIMIT) {
+ break;
+ }
+ }
+ mCount = 0;
+ Iterator<BlockPos> itx = mSecondSearch.iterator();
+ while(itx.hasNext()){
+ BlockPos G = itx.next();
+ mCheckedSpaces.add(G);
+ Set<BlockPos> mBranchSearch = searchSixFaces(W, G, mCheckedSpaces, true);
+ Iterator<BlockPos> it2 = mBranchSearch.iterator();
+ while(it2.hasNext()){
+ BlockPos G2 = it2.next();
+ mCheckedSpaces.add(G2);
+ mThirdSearch.add(G2);
+ mCount++;
+ if (mCount > HARD_LIMIT) {
+ break;
+ }
+ }
+ if (mCount > HARD_LIMIT) {
+ break;
+ }
+ }
+ return mThirdSearch;
+ }
+
+ public static Set<BlockPos> searchSixFaces(World W, BlockPos P, Set<BlockPos> checkedSpaces, boolean checkLeaves) {
+ Set<BlockPos> mConnected = new HashSet<BlockPos>();
+ int x = P.xPos;
+ int y = P.yPos;
+ int z = P.zPos;
+ if (checkLeaves) {
+ if (isWoodLog(W.getBlock(x-1, y, z)) || isLeaves(W.getBlock(x-1, y, z))) {
+ BlockPos L = new BlockPos(x-1, y, z, W);
+ if (!checkedSpaces.contains(L)) {
+ mConnected.add(L);
+ Logger.INFO("Found Connected. [III]");
+ }
+ }
+ if (isWoodLog(W.getBlock(x+1, y, z)) || isLeaves(W.getBlock(x+1, y, z))) {
+ BlockPos L = new BlockPos(x+1, y, z, W);
+ if (!checkedSpaces.contains(L)) {
+ mConnected.add(L);
+ Logger.INFO("Found Connected. [III]");
+ }
+ }
+ if (isWoodLog(W.getBlock(x, y-1, z)) || isLeaves(W.getBlock(x, y-1, z))) {
+ BlockPos L = new BlockPos(x, y-1, z, W);
+ if (!checkedSpaces.contains(L)) {
+ mConnected.add(L);
+ Logger.INFO("Found Connected. [III]");
+ }
+ }
+ if (isWoodLog(W.getBlock(x, y+1, z)) || isLeaves(W.getBlock(x, y+1, z))) {
+ BlockPos L = new BlockPos(x, y+1, z, W);
+ if (!checkedSpaces.contains(L)) {
+ mConnected.add(L);
+ Logger.INFO("Found Connected. [III]");
+ }
+ }
+ if (isWoodLog(W.getBlock(x, y, z-1)) || isLeaves(W.getBlock(x, y, z-1))) {
+ BlockPos L = new BlockPos(x, y, z-1, W);
+ if (!checkedSpaces.contains(L)) {
+ mConnected.add(L);
+ Logger.INFO("Found Connected. [III]");
+ }
+ }
+ if (isWoodLog(W.getBlock(x, y, z+1)) || isLeaves(W.getBlock(x, y, z+1))) {
+ BlockPos L = new BlockPos(x, y, z+1, W);
+ if (!checkedSpaces.contains(L)) {
+ mConnected.add(L);
+ Logger.INFO("Found Connected. [III]");
+ }
+ }
+ }
+ else {
+ if (isWoodLog(W.getBlock(x-1, y, z))) {
+ BlockPos L = new BlockPos(x-1, y, z, W);
+ //if (!checkedSpaces.contains(L)) {
+ mConnected.add(L);
+ Logger.INFO("Found Connected. [III]");
+ //}
+ }
+ if (isWoodLog(W.getBlock(x+1, y, z))) {
+ BlockPos L = new BlockPos(x+1, y, z, W);
+ //if (!checkedSpaces.contains(L)) {
+ mConnected.add(L);
+ Logger.INFO("Found Connected. [III]");
+ //}
+ }
+ if (isWoodLog(W.getBlock(x, y-1, z))) {
+ BlockPos L = new BlockPos(x, y-1, z, W);
+ //if (!checkedSpaces.contains(L)) {
+ mConnected.add(L);
+ Logger.INFO("Found Connected. [III]");
+ //}
+ }
+ if (isWoodLog(W.getBlock(x, y+1, z))) {
+ BlockPos L = new BlockPos(x, y+1, z, W);
+ //if (!checkedSpaces.contains(L)) {
+ mConnected.add(L);
+ Logger.INFO("Found Connected. [III]");
+ //}
+ }
+ if (isWoodLog(W.getBlock(x, y, z-1))) {
+ BlockPos L = new BlockPos(x, y, z-1, W);
+ //if (!checkedSpaces.contains(L)) {
+ mConnected.add(L);
+ Logger.INFO("Found Connected. [III]");
+ //}
+ }
+ if (isWoodLog(W.getBlock(x, y, z+1))) {
+ BlockPos L = new BlockPos(x, y, z+1, W);
+ //if (!checkedSpaces.contains(L)) {
+ mConnected.add(L);
+ Logger.INFO("Found Connected. [III]");
+ //}
+ }
+ }
+ return mConnected;
+ }
+
+
+ public enum ToolType {
+ Unbreakable,
+ Breakable
+ }
+
+
+ /**
+ * Tree Cutting
+ */
+
+ public static class TreeCutter {
+
+ private final World mWorld;
+ private Map<String, BlockPos> mQueue = new ConcurrentHashMap<String, BlockPos>();
+ private AutoMap<ItemStack[]> mDrops = new AutoMap<ItemStack[]>();
+ private boolean isValid = true;
+
+ public TreeCutter(World world) {
+ this.mWorld = world;
+ }
+
+ public boolean queue(BlockPos pos) {
+ if (isValid && pos != null) {
+ //Logger.INFO("Queued: "+pos.getLocationString());
+ String hash = Utils.calculateChecksumMD5(pos);
+ if (hash != null && !mQueue.containsKey(hash)) {
+ mQueue.put(hash, pos);
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private boolean emptyQueue() {
+ if (isValid) {
+ Logger.INFO("Emptying Queue.");
+ if (this.mQueue.size() > 0) {
+ int totalRemoved = 0;
+ for (BlockPos h : mQueue.values()) {
+ final Block block = mWorld.getBlock(h.xPos, h.yPos, h.zPos);
+ if (block != null) {
+ final int dropMeta = mWorld.getBlockMetadata(h.xPos, h.yPos, h.zPos);
+ final ArrayList<ItemStack> blockDrops = block.getDrops(mWorld, h.xPos, h.yPos, h.zPos, dropMeta, 0);
+ final ItemStack[] drops = ItemUtils.getBlockDrops(blockDrops);
+ mDrops.put(drops);
+ //Remove drop that was added to the bus.
+ mWorld.setBlockToAir(h.xPos, h.yPos, h.zPos);
+ //new BlockBreakParticles(mWorld, h.xPos, h.yPos, h.zPos, block);
+ totalRemoved++;
+ }
+ }
+ if (totalRemoved > 0 && mDrops.size() > 0) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ public ItemStack[] getDrops() {
+ //If Queue is successfully cleared and drops are created, let us continue.
+ if (isValid && emptyQueue()) {
+ AutoMap<ItemStack> mCollective = new AutoMap<ItemStack>();
+ //Iterate ALL of the arrays, add output to a collective.
+ for (ItemStack[] i : this.mDrops) {
+ //Array is not null.
+ if (i != null) {
+ //Iterate this array.
+ for (int d=0;d<i.length;d++) {
+ //Put Output into collective if valid
+ if (i[d] != null && i[d].stackSize > 0) {
+ mCollective.put(i[d]);
+ }
+ }
+ }
+ }
+ //Build an ItemStack array.
+ ItemStack[] drops = new ItemStack[mCollective.size()];
+ for (int m=0;m<drops.length;m++) {
+ drops[m] = mCollective.get(m);
+ }
+ //Return drops array if it's valid.
+ if (drops.length > 0) {
+ isValid = false;
+ return drops;
+ }
+ }
+ //Invalid or no drops, return empty array.
+ isValid = false;
+ return new ItemStack[] {};
+ }
+
+ }
+
+
+ /**
+ * Farm AI
+ */
+ private static EntityPlayerMP farmerAI;
+ public EntityPlayerMP getFakePlayer(World world) {
+ return farmerAI = checkFakePlayer(world);
+ }
+
+ public static EntityPlayerMP checkFakePlayer(World world) {
+ if (farmerAI == null) {
+ return new FakeFarmer(MinecraftServer.getServer().worldServerForDimension(world.provider.dimensionId));
+ }
+ return farmerAI;
+ }
+
+ public static boolean onBlockStartBreak (int x, int y, int z, World world){
+ final Block wood = world.getBlock(x, y, z);
+ if (wood == null){
+ return false;
+ }
+ if (wood.isWood(world, x, y, z) || wood.getMaterial() == Material.sponge)
+ if(detectTree(world, x,y,z)) {
+ TreeChopTask chopper = new TreeChopTask(new ChunkPosition(x, y, z), checkFakePlayer(world), 128);
+ FMLCommonHandler.instance().bus().register(chopper);
+ // custom block breaking code, don't call vanilla code
+ return true;
+ }
+ //return onBlockStartBreak(stack, x, y, z, player);
+ return false;
+ }
+
+ public static boolean detectTree(World world, int pX, int pY, int pZ) {
+ ChunkPosition pos = null;
+ Stack<ChunkPosition> candidates = new Stack<>();
+ candidates.add(new ChunkPosition(pX, pY, pZ));
+
+ while (!candidates.isEmpty()) {
+ ChunkPosition candidate = candidates.pop();
+ int curX = candidate.chunkPosX, curY = candidate.chunkPosY, curZ = candidate.chunkPosZ;
+
+ Block block = world.getBlock(curX, curY, curZ);
+ if ((pos == null || candidate.chunkPosY > pos.chunkPosY) && block.isWood(world, curX, curY, curZ)) {
+ pos = new ChunkPosition(curX, candidate.chunkPosY + 1, curZ);
+ // go up
+ while (world.getBlock(curX, pos.chunkPosY, curZ).isWood(world, curX, pos.chunkPosY, curZ)) {
+ pos = new ChunkPosition(curX, pos.chunkPosY + 1, curZ);
+ }
+ // check if we still have a way diagonally up
+ candidates.add(new ChunkPosition(curX + 1, pos.chunkPosY + 1, curZ ));
+ candidates.add(new ChunkPosition(curX , pos.chunkPosY + 1, curZ + 1));
+ candidates.add(new ChunkPosition(curX - 1, pos.chunkPosY + 1, curZ ));
+ candidates.add(new ChunkPosition(curX , pos.chunkPosY + 1, curZ - 1));
+ }
+ }
+
+ // not even one match, so there were no logs.
+ if (pos == null) {
+ return false;
+ }
+
+ // check if there were enough leaves around the last position
+ // pos now contains the block above the topmost log
+ // we want at least 5 leaves in the surrounding 26 blocks
+ int d = 3;
+ int leaves = 0;
+ for (int offX = 0; offX < d; offX++) {
+ for (int offY = 0; offY < d; offY++) {
+ for (int offZ = 0; offZ < d; offZ++) {
+ int xPos = pos.chunkPosX -1 + offX, yPos = pos.chunkPosY - 1 + offY, zPos = pos.chunkPosZ - 1 + offZ;
+ Block leaf = world.getBlock(xPos, yPos, zPos);
+ if (leaf != null && leaf.isLeaves(world, xPos, yPos, zPos)) {
+ if (++leaves >= 5) {
+ return true;
+ }
+ }
+ }
+ }
+ }
+
+ // not enough leaves. sorreh
+ return false;
+ }
+
+ public static class TreeChopTask {
+
+ public final World world;
+ public final EntityPlayer player;
+ public final int blocksPerTick;
+
+ public Queue<ChunkPosition> blocks = Lists.newLinkedList();
+ public Set<ChunkPosition> visited = new THashSet<>();
+
+ public TreeChopTask(ChunkPosition start, EntityPlayer player, int blocksPerTick) {
+ this.world = player.getEntityWorld();
+ this.player = player;
+ this.blocksPerTick = blocksPerTick;
+
+ this.blocks.add(start);
+ }
+
+ private void queueCoordinate(int x, int y, int z) {
+ ChunkPosition pos = new ChunkPosition(x, y, z);
+ if (!visited.contains(pos)) {
+ blocks.add(pos);
+ }
+ }
+
+ @SubscribeEvent
+ public void onWorldTick(TickEvent.WorldTickEvent event) {
+ if (event.side.isClient()) {
+ finish();
+ return;
+ }
+ // only if same dimension
+ if (event.world.provider.dimensionId != world.provider.dimensionId) {
+ return;
+ }
+
+ // setup
+ int left = blocksPerTick;
+ //NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
+
+ // continue running
+ ChunkPosition pos;
+ while (left > 0) {
+ // completely done or can't do our job anymore?!
+ if (blocks.isEmpty()/* || tags.getBoolean("Broken")*/) {
+ finish();
+ return;
+ }
+
+ pos = blocks.remove();
+ if (!visited.add(pos)) {
+ continue;
+ }
+ int x = pos.chunkPosX, y = pos.chunkPosY, z = pos.chunkPosZ;
+
+ Block block = world.getBlock(x, y, z);
+ int meta = world.getBlockMetadata(x, y, z);
+
+ // can we harvest the block and is effective?
+ if (!block.isWood(world, x, y, z) || !isWoodLog(block)) {
+ continue;
+ }
+
+ // save its neighbors
+ queueCoordinate(x + 1, y, z );
+ queueCoordinate(x, y, z + 1);
+ queueCoordinate(x - 1, y, z );
+ queueCoordinate(x, y, z - 1);
+
+ // also add the layer above.. stupid acacia trees
+ for (int offX = 0; offX < 3; offX++) {
+ for (int offZ = 0; offZ < 3; offZ++) {
+ queueCoordinate(x - 1 + offX, y + 1, z - 1 + offZ);
+ }
+ }
+
+ // break it, wooo!
+ breakExtraBlock(player.worldObj, x, y, z, 0, player, x, y, z);
+ left--;
+ }
+ }
+
+ private void finish() {
+ // goodbye cruel world
+ FMLCommonHandler.instance().bus().unregister(this);
+ }
+ }
+
+
+ public static void breakExtraBlock(World world, int x, int y, int z, int sidehit, EntityPlayer playerEntity, int refX, int refY, int refZ) {
+ // prevent calling that stuff for air blocks, could lead to unexpected behaviour since it fires events
+ if (world.isAirBlock(x, y, z))
+ return;
+
+ // what?
+ if(!(playerEntity instanceof EntityPlayerMP))
+ return;
+ EntityPlayerMP player = (EntityPlayerMP) playerEntity;
+
+ // check if the block can be broken, since extra block breaks shouldn't instantly break stuff like obsidian
+ // or precious ores you can't harvest while mining stone
+ Block block = world.getBlock(x, y, z);
+ int meta = world.getBlockMetadata(x, y, z);
+
+ // only effective materials
+ if (!isWoodLog(block))
+ return;
+
+ Block refBlock = world.getBlock(refX, refY, refZ);
+ float refStrength = ForgeHooks.blockStrength(refBlock, player, world, refX, refY, refZ);
+ float strength = ForgeHooks.blockStrength(block, player, world, x,y,z);
+
+ // only harvestable blocks that aren't impossibly slow to harvest
+ if (!ForgeHooks.canHarvestBlock(block, player, meta) || refStrength/strength > 10f)
+ return;
+
+ // send the blockbreak event
+ BlockEvent.BreakEvent event = ForgeHooks.onBlockBreakEvent(world, player.theItemInWorldManager.getGameType(), player, x,y,z);
+ if(event.isCanceled())
+ return;
+
+ if (player.capabilities.isCreativeMode) {
+ block.onBlockHarvested(world, x, y, z, meta, player);
+ if (block.removedByPlayer(world, player, x, y, z, false))
+ block.onBlockDestroyedByPlayer(world, x, y, z, meta);
+
+ // send update to client
+ if (!world.isRemote) {
+ player.playerNetServerHandler.sendPacket(new S23PacketBlockChange(x, y, z, world));
+ }
+ return;
+ }
+
+ // callback to the tool the player uses. Called on both sides. This damages the tool n stuff.
+ player.getCurrentEquippedItem().func_150999_a(world, block, x, y, z, player);
+
+ // server sided handling
+ if (!world.isRemote) {
+ // serverside we reproduce ItemInWorldManager.tryHarvestBlock
+
+ // ItemInWorldManager.removeBlock
+ block.onBlockHarvested(world, x,y,z, meta, player);
+
+ if(block.removedByPlayer(world, player, x,y,z, true)) // boolean is if block can be harvested, checked above
+ {
+ block.onBlockDestroyedByPlayer( world, x,y,z, meta);
+ block.harvestBlock(world, player, x,y,z, meta);
+ block.dropXpOnBlockBreak(world, x,y,z, event.getExpToDrop());
+ }
+
+ // always send block update to client
+ player.playerNetServerHandler.sendPacket(new S23PacketBlockChange(x, y, z, world));
+ }
+ // client sided handling
+ else {
+ //PlayerControllerMP pcmp = Minecraft.getMinecraft().playerController;
+ // clientside we do a "this clock has been clicked on long enough to be broken" call. This should not send any new packets
+ // the code above, executed on the server, sends a block-updates that give us the correct state of the block we destroy.
+
+ // following code can be found in PlayerControllerMP.onPlayerDestroyBlock
+ world.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(block) + (meta << 12));
+ if(block.removedByPlayer(world, player, x,y,z, true))
+ {
+ block.onBlockDestroyedByPlayer(world, x,y,z, meta);
+ }
+ // callback to the tool
+ ItemStack itemstack = player.getCurrentEquippedItem();
+ if (itemstack != null)
+ {
+ itemstack.func_150999_a(world, block, x, y, z, player);
+
+ if (itemstack.stackSize == 0)
+ {
+ player.destroyCurrentEquippedItem();
+ }
+ }
+
+ // send an update to the server, so we get an update back
+ //if(PHConstruct.extraBlockUpdates)
+ //Minecraft.getMinecraft().getNetHandler().addToSendQueue(new C07PacketPlayerDigging(2, x,y,z, Minecraft.getMinecraft().objectMouseOver.sideHit));
+ }
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/VolumetricFlaskHelper.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/VolumetricFlaskHelper.java
new file mode 100644
index 0000000000..575e094696
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/VolumetricFlaskHelper.java
@@ -0,0 +1,188 @@
+package gtPlusPlus.xmod.gregtech.common.helpers;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import gtPlusPlus.core.util.reflect.ReflectionUtils;
+import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList;
+import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraftforge.fluids.FluidStack;
+
+public class VolumetricFlaskHelper {
+
+ private static final Class sClassVolumetricFlask;
+ private static final Method sMethodGetFlaskMaxCapacity;
+ private static Item mFlask;
+
+ static {
+ if (Meta_GT_Proxy.sDoesVolumetricFlaskExist) {
+ sClassVolumetricFlask = ReflectionUtils.getClass("gregtech.common.items.GT_VolumetricFlask");
+ Method aMaxCapacity = null;
+ try {
+ aMaxCapacity = sClassVolumetricFlask.getDeclaredMethod("getMaxCapacity", new Class[] {});
+ }
+ catch (NoSuchMethodException e) {
+ e.printStackTrace();
+ CORE.crash("Secondary Error Obtaining instance of 'getMaxCapacity' from 'GT_VolumetricFlask'. Crashing.");
+ }
+ sMethodGetFlaskMaxCapacity = aMaxCapacity;
+ }
+ else {
+ sClassVolumetricFlask = null;
+ sMethodGetFlaskMaxCapacity = null;
+ }
+ }
+
+ public static ItemStack getVolumetricFlask(int aAmount) {
+ ItemStack aFlask = ItemUtils.getValueOfItemList("VOLUMETRIC_FLASK", aAmount, (ItemStack) null);
+ return aFlask;
+ }
+
+ public static ItemStack getLargeVolumetricFlask(int aAmount) {
+ ItemStack aFlask = GregtechItemList.VOLUMETRIC_FLASK_8k.get(aAmount);
+ return aFlask;
+ }
+
+ public static ItemStack getGiganticVolumetricFlask(int aAmount) {
+ ItemStack aFlask = GregtechItemList.VOLUMETRIC_FLASK_32k.get(aAmount);
+ return aFlask;
+ }
+
+ public static boolean isVolumetricFlask(ItemStack aStack) {
+ if (isNormalVolumetricFlask(aStack) || isLargeVolumetricFlask(aStack) || isGiganticVolumetricFlask(aStack)) {
+ return true;
+ }
+ return false;
+ }
+
+ public static boolean isNormalVolumetricFlask(ItemStack aStack) {
+ if (mFlask == null) {
+ ItemStack aFlask = ItemUtils.getValueOfItemList("VOLUMETRIC_FLASK", 1, (ItemStack) null);
+ if (aFlask != null) {
+ mFlask = aFlask.getItem();
+ }
+ }
+ if (aStack.getItem() == mFlask) {
+ return true;
+ }
+ return false;
+ }
+
+ public static boolean isLargeVolumetricFlask(ItemStack aStack) {
+ if (GregtechItemList.VOLUMETRIC_FLASK_8k.getItem() == aStack.getItem()) {
+ return true;
+ }
+ return false;
+ }
+
+ public static boolean isGiganticVolumetricFlask(ItemStack aStack) {
+ if (GregtechItemList.VOLUMETRIC_FLASK_32k.getItem() == aStack.getItem()) {
+ return true;
+ }
+ return false;
+ }
+
+ public static int getMaxFlaskCapacity(ItemStack aStack) {
+ if (aStack != null && sMethodGetFlaskMaxCapacity != null) {
+ Item aItem = aStack.getItem();
+ if (sClassVolumetricFlask.isInstance(aItem)) {
+ int aMaxCapacity = (int) ReflectionUtils.invokeNonBool(aItem, sMethodGetFlaskMaxCapacity, new Object[] {});
+ return aMaxCapacity;
+ }
+ }
+ return 0;
+ }
+
+ public static boolean isFlaskEmpty(ItemStack aStack) {
+ return getFlaskFluid(aStack) == null;
+ }
+
+ public static FluidStack getFlaskFluid(ItemStack aStack) {
+ if (aStack.hasTagCompound()) {
+ NBTTagCompound nbt = aStack.getTagCompound();
+ if (nbt.hasKey("Fluid", 10))
+ return FluidStack.loadFluidStackFromNBT(nbt.getCompoundTag("Fluid"));
+ }
+ return null;
+ }
+
+ public static void setFluid(ItemStack stack, FluidStack fluidStack) {
+ boolean removeFluid = (fluidStack == null) || (fluidStack.amount <= 0);
+ NBTTagCompound nbt = stack.getTagCompound();
+ if (nbt == null) {
+ if (removeFluid)
+ return;
+ stack.setTagCompound(nbt = new NBTTagCompound());
+ }
+ if (removeFluid) {
+ nbt.removeTag("Fluid");
+ if (nbt.hasNoTags()) {
+ stack.setTagCompound(null);
+ }
+ } else {
+ nbt.setTag("Fluid", fluidStack.writeToNBT(new NBTTagCompound()));
+ }
+ }
+
+ public static int getFlaskCapacity(ItemStack aStack) {
+ int capacity = 1000;
+ if (aStack.hasTagCompound()) {
+ NBTTagCompound nbt = aStack.getTagCompound();
+ if (nbt.hasKey("Capacity", 3))
+ capacity = nbt.getInteger("Capacity");
+ }
+ return Math.min(getMaxFlaskCapacity(aStack), capacity);
+ }
+
+ public static boolean setNewFlaskCapacity(ItemStack aStack, int aCapacity) {
+ if (aStack == null || aCapacity <= 0) {
+ return false;
+ }
+ aCapacity = Math.min(aCapacity, getMaxFlaskCapacity(aStack));
+ NBTTagCompound nbt = aStack.getTagCompound();
+ if (nbt == null) {
+ aStack.setTagCompound(nbt = new NBTTagCompound());
+ }
+ nbt.setInteger("Capacity", aCapacity);
+ return true;
+ }
+
+ public static int fillFlask(ItemStack stack, FluidStack resource, boolean doFill) {
+ if (stack.stackSize != 1)
+ return 0;
+ if ((resource == null) || (resource.amount <= 0)) {
+ return 0;
+ }
+ FluidStack fluidStack = getFlaskFluid(stack);
+ if (fluidStack == null) {
+ fluidStack = new FluidStack(resource, 0);
+ } else if (!fluidStack.isFluidEqual(resource)) {
+ return 0;
+ }
+ int amount = Math.min(getMaxFlaskCapacity(stack) - fluidStack.amount, resource.amount);
+ if ((doFill) && (amount > 0)) {
+ fluidStack.amount += amount;
+ setFluid(stack, fluidStack);
+ }
+ return amount;
+ }
+
+ public static Item generateNewFlask(String unlocalized, String english, int maxCapacity) {
+ Constructor aFlask = ReflectionUtils.getConstructor(sClassVolumetricFlask, new Class[] {String.class, String.class, int.class});
+ if (aFlask != null) {
+ Object aInstance = ReflectionUtils.createNewInstanceFromConstructor(aFlask, new Object[] {unlocalized, english, maxCapacity});
+ if (aInstance != null && aInstance instanceof Item) {
+ Item aNewFlaskItem = (Item) aInstance;
+ return aNewFlaskItem;
+ }
+ }
+ return null;
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/autocrafter/AC_Helper_Container.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/autocrafter/AC_Helper_Container.java
new file mode 100644
index 0000000000..29dabaf084
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/autocrafter/AC_Helper_Container.java
@@ -0,0 +1,118 @@
+package gtPlusPlus.xmod.gregtech.common.helpers.autocrafter;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.inventory.*;
+import net.minecraft.item.ItemStack;
+import net.minecraft.item.crafting.CraftingManager;
+import net.minecraft.world.World;
+
+import gtPlusPlus.api.objects.Logger;
+
+public class AC_Helper_Container extends Container
+{
+ /** The crafting matrix inventory (3x3). */
+ public InventoryCrafting craftMatrix = new InventoryCrafting(this, 3, 3);
+ public IInventory craftResult = new InventoryCraftResult();
+ private World worldObj;
+
+ public InventoryCrafting getMatrix(){
+ return this.craftMatrix;
+ }
+
+ public boolean putItemsIntoGrid(ItemStack[] inputs){
+ if (inputs.length < 9){
+ return false;
+ }
+ for (int i=0;i<9;i++){
+ this.putStackInSlot(i, inputs[i]);
+ }
+ this.onCraftMatrixChanged(this.craftMatrix);
+ return true;
+ }
+
+ public AC_Helper_Container(InventoryPlayer playerInventory, World world, int x, int y, int z)
+ {
+ this.worldObj = world;
+ this.addSlotToContainer(new SlotCrafting(playerInventory.player, this.craftMatrix, this.craftResult, 0, 124, 35));
+ int l;
+ int i1;
+
+ for (l = 0; l < 3; ++l)
+ {
+ for (i1 = 0; i1 < 3; ++i1)
+ {
+ this.addSlotToContainer(new Slot(this.craftMatrix, i1 + l * 3, 30 + i1 * 18, 17 + l * 18));
+ }
+ }
+
+ for (l = 0; l < 3; ++l)
+ {
+ for (i1 = 0; i1 < 9; ++i1)
+ {
+ this.addSlotToContainer(new Slot(playerInventory, i1 + l * 9 + 9, 8 + i1 * 18, 84 + l * 18));
+ }
+ }
+
+ for (l = 0; l < 9; ++l)
+ {
+ this.addSlotToContainer(new Slot(playerInventory, l, 8 + l * 18, 142));
+ }
+
+ this.onCraftMatrixChanged(this.craftMatrix);
+ }
+
+ /**
+ * Callback for when the crafting matrix is changed.
+ */
+ @Override
+ public void onCraftMatrixChanged(IInventory p_75130_1_)
+ {
+ this.craftResult.setInventorySlotContents(0, CraftingManager.getInstance().findMatchingRecipe(this.craftMatrix, this.worldObj));
+ Logger.INFO("Crafted "+this.craftResult.getStackInSlot(0));
+
+ }
+
+ /**
+ * Called when the container is closed.
+ */
+ @Override
+ public void onContainerClosed(EntityPlayer p_75134_1_)
+ {
+ super.onContainerClosed(p_75134_1_);
+
+ if (!this.worldObj.isRemote)
+ {
+ for (int i = 0; i < 9; ++i)
+ {
+ ItemStack itemstack = this.craftMatrix.getStackInSlotOnClosing(i);
+
+ if (itemstack != null)
+ {
+ p_75134_1_.dropPlayerItemWithRandomChoice(itemstack, false);
+ }
+ }
+ }
+ }
+
+ @Override
+ public boolean canInteractWith(EntityPlayer p_75145_1_)
+ {
+ return true;
+ }
+
+ /**
+ * Called when a player shift-clicks on a slot. You must override this or you will crash when someone does that.
+ */
+ @Override
+ public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int p_82846_2_){
+ ItemStack itemstack = null;
+ return itemstack;
+ }
+
+ @Override
+ public boolean func_94530_a(ItemStack p_94530_1_, Slot p_94530_2_)
+ {
+ return p_94530_2_.inventory != this.craftResult && super.func_94530_a(p_94530_1_, p_94530_2_);
+ }
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/autocrafter/AC_Helper_Utils.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/autocrafter/AC_Helper_Utils.java
new file mode 100644
index 0000000000..772ece96aa
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/autocrafter/AC_Helper_Utils.java
@@ -0,0 +1,80 @@
+package gtPlusPlus.xmod.gregtech.common.helpers.autocrafter;
+
+import java.util.*;
+import java.util.Map.Entry;
+
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.GT4Entity_AutoCrafter;
+
+public class AC_Helper_Utils {
+
+ //AC maps
+ public static final Map<Integer, GT4Entity_AutoCrafter> sAutocrafterMap = new HashMap<Integer, GT4Entity_AutoCrafter>();
+
+ //Add Crafter
+ public final static int addCrafter(GT4Entity_AutoCrafter AC) {
+ if (!sAutocrafterMap.containsValue(AC)){
+ int increase = sAutocrafterMap.size()+1;
+ sAutocrafterMap.put(increase, AC);
+ Logger.INFO("[A-C] "+"Added Auto-Crafter to index on position "+increase+".");
+ return increase;
+ }
+ else {
+ Logger.INFO("[A-C] Tried adding an Auto-Crafter to Index, but found one already there.");
+ }
+ return 0;
+ }
+
+ //Remove Crafter
+ public final static boolean removeCrafter(int frequency) {
+ if (!sAutocrafterMap.isEmpty()){
+ if (sAutocrafterMap.containsKey(frequency)){
+ sAutocrafterMap.remove(frequency);
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public final static boolean removeCrafter(GT4Entity_AutoCrafter AC) {
+ if (!sAutocrafterMap.isEmpty()){
+ if (sAutocrafterMap.containsValue(AC)){
+ sAutocrafterMap.remove(getIDByCrafter(AC));
+ return true;
+ }
+ }
+ return false;
+ }
+
+ //Get Crafter
+ public final static GT4Entity_AutoCrafter getCrafterByID(int ID) {
+ if (!sAutocrafterMap.isEmpty()) {
+ Set<Entry<Integer, GT4Entity_AutoCrafter>> players = sAutocrafterMap.entrySet();
+ Iterator<Entry<Integer, GT4Entity_AutoCrafter>> i = players.iterator();
+ while (i.hasNext()) {
+ Entry<Integer, GT4Entity_AutoCrafter> current = i.next();
+ if (current.getKey().equals(ID)) {
+ return current.getValue();
+ }
+ }
+ }
+ Logger.WARNING("Failed. [getCrafterByID]");
+ return null;
+ }
+
+ public final static int getIDByCrafter(GT4Entity_AutoCrafter AC) {
+ if (!sAutocrafterMap.isEmpty()) {
+ Set<Entry<Integer, GT4Entity_AutoCrafter>> players = sAutocrafterMap.entrySet();
+ Iterator<Entry<Integer, GT4Entity_AutoCrafter>> i = players.iterator();
+ while (i.hasNext()) {
+ Entry<Integer, GT4Entity_AutoCrafter> current = i.next();
+ if (current.getValue().equals(AC)) {
+ return current.getKey();
+ }
+ }
+ }
+ Logger.WARNING("Failed. [getIDByCrafter]");
+ return 0;
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/tesseract/TesseractHelper.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/tesseract/TesseractHelper.java
new file mode 100644
index 0000000000..a3a116fea6
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/tesseract/TesseractHelper.java
@@ -0,0 +1,263 @@
+package gtPlusPlus.xmod.gregtech.common.helpers.tesseract;
+
+import static gtPlusPlus.core.lib.CORE.*;
+
+import java.util.*;
+import java.util.Map.Entry;
+
+import net.minecraft.entity.player.EntityPlayer;
+
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.xmod.gregtech.common.tileentities.automation.GT_MetaTileEntity_TesseractGenerator;
+import gtPlusPlus.xmod.gregtech.common.tileentities.automation.GT_MetaTileEntity_TesseractTerminal;
+
+public class TesseractHelper {
+
+ /**
+ * Tesseract Generator Helpers
+ *
+ * @param player
+ * @return
+ */
+
+ //Checks if a Generator is owned by a player.
+ public final static boolean isGeneratorOwnedByPlayer(EntityPlayer player,
+ GT_MetaTileEntity_TesseractGenerator generator) {
+ if (player == null){
+ Logger.WARNING("Failed. [isGeneratorOwnedByPlayer]");
+ return false;
+ }
+ //Utils.LOG_WARNING("Success. [isGeneratorOwnedByPlayer] 1");
+ UUID playerIdentifier = player.getUniqueID();
+ if (!sTesseractGeneratorOwnershipMap.isEmpty() && playerIdentifier != null) {
+ //Utils.LOG_WARNING("Success. [isGeneratorOwnedByPlayer] 2");
+ Map<Integer, GT_MetaTileEntity_TesseractGenerator> generators = getGeneratorOwnershipByPlayer(player);
+ Set<Entry<Integer, GT_MetaTileEntity_TesseractGenerator>> players = generators.entrySet();
+ Iterator<Entry<Integer, GT_MetaTileEntity_TesseractGenerator>> i = players.iterator();
+ while (i.hasNext()) {
+ //Utils.LOG_WARNING("Success. [isGeneratorOwnedByPlayer] 3");
+ Entry<Integer, GT_MetaTileEntity_TesseractGenerator> current = i.next();
+ if (current.getValue().equals(generator)) {
+ //Utils.LOG_WARNING("Success. [isGeneratorOwnedByPlayer] 4");
+ return true;
+ }
+ }
+ }
+ Logger.WARNING("Failed. [isGeneratorOwnedByPlayer]");
+ return false;
+ }
+
+ //Saves A Generator to the Players UUID map along with the Freq.
+ public final static boolean setGeneratorOwnershipByPlayer(EntityPlayer player, int freq,
+ GT_MetaTileEntity_TesseractGenerator generator) {
+ if (player == null){
+ return false;
+ }
+ UUID playerIdentifier = player.getUniqueID();
+ Logger.WARNING("Setting Generator on "+freq+" for "+player.getDisplayName()+".");
+ if (playerIdentifier != null) {
+ Map<Integer, GT_MetaTileEntity_TesseractGenerator> playerOwned = sTesseractGeneratorOwnershipMap
+ .get(playerIdentifier);
+ if (playerOwned == null || playerOwned.isEmpty()) {
+ Map<Integer, GT_MetaTileEntity_TesseractGenerator> newOwnershipMap = new HashMap<Integer, GT_MetaTileEntity_TesseractGenerator>();
+ newOwnershipMap.put(freq, generator);
+ sTesseractGeneratorOwnershipMap.put(playerIdentifier, newOwnershipMap);
+ Logger.WARNING("Success! [Empty Map]");
+ return true;
+ } else if (sTesseractGeneratorOwnershipMap.containsKey(playerIdentifier)) {
+ Map<Integer, GT_MetaTileEntity_TesseractGenerator> ownershipMap = sTesseractGeneratorOwnershipMap
+ .get(playerIdentifier);
+ if (!ownershipMap.containsKey(freq)){
+ ownershipMap.put(freq, generator);
+ }
+ ownershipMap.put(freq, generator);
+ sTesseractGeneratorOwnershipMap.put(playerIdentifier, ownershipMap);
+ Logger.WARNING("Success!");
+ return true;
+ }
+ }
+ Logger.WARNING("Failed. [setGeneratorOwnershipByPlayer]");
+ return false;
+ }
+
+ //Gets Generator based on Frequency.
+ public final static GT_MetaTileEntity_TesseractGenerator getGeneratorByFrequency(EntityPlayer player,
+ int freq) {
+ if (player == null){
+ return null;
+ }
+ UUID playerIdentifier = player.getUniqueID();
+ Logger.WARNING("Getting Generator on "+freq+" for "+player.getDisplayName()+".");
+ if (!sTesseractGeneratorOwnershipMap.isEmpty() && playerIdentifier != null) {
+ //Utils.LOG_WARNING("Success. [getGeneratorByFrequency] 1");
+ Map<Integer, GT_MetaTileEntity_TesseractGenerator> generators = getGeneratorOwnershipByPlayer(player);
+ Set<Entry<Integer, GT_MetaTileEntity_TesseractGenerator>> players = generators.entrySet();
+ Iterator<Entry<Integer, GT_MetaTileEntity_TesseractGenerator>> i = players.iterator();
+ while (i.hasNext()) {
+ //Utils.LOG_WARNING("Success. [getGeneratorByFrequency] 2");
+ Entry<Integer, GT_MetaTileEntity_TesseractGenerator> current = i.next();
+ if (current.getKey().equals(freq)) {
+ //Utils.LOG_WARNING("Success. [getGeneratorByFrequency] 3");
+ Logger.WARNING("Success!");
+ return current.getValue();
+ }
+ }
+ }
+ Logger.WARNING("Failed. [getGeneratorByFrequency]");
+ return null;
+ }
+
+ //Remove Tesseract Generator
+ public final static boolean removeGenerator(EntityPlayer player, int frequency) {
+ if (player == null){
+ return false;
+ }
+ UUID playerIdentifier = player.getUniqueID();
+ if (!sTesseractGeneratorOwnershipMap.isEmpty() && playerIdentifier != null) {
+ sTesseractGeneratorOwnershipMap.get(playerIdentifier).remove(frequency);
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ *
+ * Tesseract Terminal Helpers
+ *
+ * @param player
+ * @return
+ */
+
+ //Checks if a Terminal is owned by a player.
+ public final static boolean isTerminalOwnedByPlayer(EntityPlayer player,
+ GT_MetaTileEntity_TesseractTerminal generator) {
+ if (player == null){
+ return false;
+ }
+ UUID playerIdentifier = player.getUniqueID();
+ if (!sTesseractTerminalOwnershipMap.isEmpty() && playerIdentifier != null) {
+ Map<Integer, GT_MetaTileEntity_TesseractTerminal> generators = getTerminalOwnershipByPlayer(player);
+ Set<Entry<Integer, GT_MetaTileEntity_TesseractTerminal>> players = generators.entrySet();
+ Iterator<Entry<Integer, GT_MetaTileEntity_TesseractTerminal>> i = players.iterator();
+ while (i.hasNext()) {
+ Entry<Integer, GT_MetaTileEntity_TesseractTerminal> current = i.next();
+ if (current.getValue().equals(generator)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ //Saves A Terminal to the Players UUID map along with the Freq.
+ public final static boolean setTerminalOwnershipByPlayer(EntityPlayer player, int freq,
+ GT_MetaTileEntity_TesseractTerminal generator) {
+ if (player == null){
+ return false;
+ }
+ UUID playerIdentifier = player.getUniqueID();
+ if (playerIdentifier != null) {
+ Logger.WARNING("Setting Terminal on "+freq+" for "+player.getDisplayName()+".");
+ Map<Integer, GT_MetaTileEntity_TesseractTerminal> playerOwned = sTesseractTerminalOwnershipMap
+ .get(playerIdentifier);
+ if (playerOwned == null || playerOwned.isEmpty()) {
+ Map<Integer, GT_MetaTileEntity_TesseractTerminal> newOwnershipMap = new HashMap<Integer, GT_MetaTileEntity_TesseractTerminal>();
+ newOwnershipMap.put(freq, generator);
+ sTesseractTerminalOwnershipMap.put(playerIdentifier, newOwnershipMap);
+ Logger.WARNING("Success! [Empty Map]");
+ return true;
+ } else if (sTesseractTerminalOwnershipMap.containsKey(playerIdentifier)) {
+ Map<Integer, GT_MetaTileEntity_TesseractTerminal> ownershipMap = sTesseractTerminalOwnershipMap
+ .get(playerIdentifier);
+ if (!ownershipMap.containsKey(freq)){
+ ownershipMap.put(freq, generator);
+ }
+ sTesseractTerminalOwnershipMap.put(playerIdentifier, ownershipMap);
+ Logger.WARNING("Success!");
+ return true;
+ }
+ }
+ Logger.WARNING("Failed. [setTerminalOwnershipByPlayer]");
+ return false;
+ }
+
+ //Gets Terminal based on Frequency.
+ public final static GT_MetaTileEntity_TesseractTerminal getTerminalByFrequency(EntityPlayer player,
+ int freq) {
+ if (player == null){
+ return null;
+ }
+ UUID playerIdentifier = player.getUniqueID();
+ Logger.WARNING("Getting Terminal on "+freq+" for "+player.getDisplayName()+".");
+ if (!sTesseractTerminalOwnershipMap.isEmpty() && playerIdentifier != null) {
+ Map<Integer, GT_MetaTileEntity_TesseractTerminal> generators = getTerminalOwnershipByPlayer(player);
+ Set<Entry<Integer, GT_MetaTileEntity_TesseractTerminal>> players = generators.entrySet();
+ Iterator<Entry<Integer, GT_MetaTileEntity_TesseractTerminal>> i = players.iterator();
+ while (i.hasNext()) {
+ Entry<Integer, GT_MetaTileEntity_TesseractTerminal> current = i.next();
+ if (current.getKey().equals(freq)) {
+ Logger.WARNING("Success!");
+ return current.getValue();
+ }
+ }
+ }
+ Logger.WARNING("Failed. [getTerminalByFrequency]");
+ return null;
+ }
+
+ //Remove Tesseract Terminal
+ public final static boolean removeTerminal(EntityPlayer player, int frequency) {
+ if (player == null){
+ return false;
+ }
+ UUID playerIdentifier = player.getUniqueID();
+ if (!sTesseractTerminalOwnershipMap.isEmpty() && playerIdentifier != null) {
+ sTesseractTerminalOwnershipMap.get(playerIdentifier).remove(frequency);
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ *
+ * Internal Methods
+ *
+ */
+
+ private final static Map<Integer, GT_MetaTileEntity_TesseractGenerator> getGeneratorOwnershipByPlayer(
+ EntityPlayer player) {
+ UUID playerIdentifier = player.getUniqueID();
+ if (!sTesseractGeneratorOwnershipMap.isEmpty() && playerIdentifier != null) {
+ Set<Entry<UUID, Map<Integer, GT_MetaTileEntity_TesseractGenerator>>> players = sTesseractGeneratorOwnershipMap
+ .entrySet();
+ Iterator<Entry<UUID, Map<Integer, GT_MetaTileEntity_TesseractGenerator>>> i = players.iterator();
+ while (i.hasNext()) {
+ Entry<UUID, Map<Integer, GT_MetaTileEntity_TesseractGenerator>> current = i.next();
+ if (current.getKey().compareTo(playerIdentifier) == 0) {
+ return current.getValue();
+ }
+
+ }
+ }
+ return null;
+ }
+
+ private final static Map<Integer, GT_MetaTileEntity_TesseractTerminal> getTerminalOwnershipByPlayer(
+ EntityPlayer player) {
+ UUID playerIdentifier = player.getUniqueID();
+ if (!sTesseractTerminalOwnershipMap.isEmpty() && playerIdentifier != null) {
+ Set<Entry<UUID, Map<Integer, GT_MetaTileEntity_TesseractTerminal>>> players = sTesseractTerminalOwnershipMap
+ .entrySet();
+ Iterator<Entry<UUID, Map<Integer, GT_MetaTileEntity_TesseractTerminal>>> i = players.iterator();
+ while (i.hasNext()) {
+ Entry<UUID, Map<Integer, GT_MetaTileEntity_TesseractTerminal>> current = i.next();
+ if (current.getKey().compareTo(playerIdentifier) == 0) {
+ return current.getValue();
+ }
+
+ }
+ }
+ return null;
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/treefarm/TreeGenerator.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/treefarm/TreeGenerator.java
new file mode 100644
index 0000000000..bb40c9b379
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/treefarm/TreeGenerator.java
@@ -0,0 +1,386 @@
+package gtPlusPlus.xmod.gregtech.common.helpers.treefarm;
+
+import java.util.Random;
+
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.api.objects.data.AutoMap;
+import gtPlusPlus.api.objects.minecraft.FakeBlockPos;
+import gtPlusPlus.api.objects.minecraft.FakeWorld;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.math.MathUtils;
+import net.minecraft.block.Block;
+import net.minecraft.block.BlockSapling;
+import net.minecraft.block.material.Material;
+import net.minecraft.init.Blocks;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.Direction;
+import net.minecraft.world.World;
+import net.minecraft.world.gen.feature.WorldGenAbstractTree;
+import net.minecraftforge.common.util.ForgeDirection;
+
+public class TreeGenerator {
+
+ private static final FakeTreeInFakeWorldGenerator mTreeData;
+
+ static {
+ Logger.WARNING("Created Fake Tree Generator.");
+ mTreeData = new FakeTreeInFakeWorldGenerator();
+ }
+
+
+ public TreeGenerator() {
+ if (!mTreeData.hasGenerated) {
+ mTreeData.generate(null, CORE.RANDOM, 0, 0, 0);
+ }
+ }
+
+ public AutoMap<ItemStack> generateOutput(int aTreeSize){
+ AutoMap<ItemStack> aOutputMap = mTreeData.getOutputFromTree();
+ if (aOutputMap != null && aOutputMap.size() > 0) {
+ Logger.WARNING("Valid tree data output");
+ return aOutputMap;
+ }
+ Logger.WARNING("Invalid tree data output");
+ return new AutoMap<ItemStack>();
+ }
+
+ public static class FakeTreeInFakeWorldGenerator extends WorldGenAbstractTree
+ {
+ /** The minimum height of a generated tree. */
+ private final int minTreeHeight;
+ /** True if this tree should grow Vines. */
+ private final boolean vinesGrow;
+ /** The metadata value of the wood to use in tree generation. */
+ private final int metaWood;
+ /** The metadata value of the leaves to use in tree generation. */
+ private final int metaLeaves;
+
+ private final AutoMap<FakeWorld> mFakeWorld;
+ private final int mTreesToGenerate;
+
+ private int mCurrentGeneratorIteration = 0;
+
+ private boolean hasGenerated = false;
+ private AutoMap<ItemStack> aOutputsFromGenerator = new AutoMap<ItemStack>();
+
+ public FakeTreeInFakeWorldGenerator()
+ {
+ this(4, 0, 0, false, 5000);
+ }
+
+ public FakeTreeInFakeWorldGenerator(int aMinHeight, int aWoodMeta, int aLeafMeta, boolean aVines, int aTreeCount)
+ {
+ super(false);
+ this.minTreeHeight = aMinHeight;
+ this.metaWood = aWoodMeta;
+ this.metaLeaves = aLeafMeta;
+ this.vinesGrow = aVines;
+ this.mFakeWorld = new AutoMap<FakeWorld>();
+ this.mTreesToGenerate = aTreeCount;
+ Logger.WARNING("Created Fake Tree In Fake World Instance.");
+ }
+
+
+ public AutoMap<ItemStack> getOutputFromTree(){
+ if (!hasGenerated) {
+ Logger.WARNING("Generating Tree sample data");
+ generate(null, CORE.RANDOM, 0, 0, 0);
+ }
+ AutoMap<ItemStack> aOutputMap = new AutoMap<ItemStack>();
+ int aRandomTreeID = MathUtils.randInt(0, this.mFakeWorld.size()-1);
+ FakeWorld aWorld = this.mFakeWorld.get(aRandomTreeID);
+ if (aWorld != null) {
+ //Logger.WARNING("Getting all block data from fake world");
+ aOutputMap = aWorld.getAllBlocksStoredInFakeWorld();
+ }
+ return aOutputMap;
+
+ }
+
+ @Override
+ protected boolean func_150523_a(Block p_150523_1_)
+ {
+ return p_150523_1_.getMaterial() == Material.air || p_150523_1_.getMaterial() == Material.leaves || p_150523_1_ == Blocks.grass || p_150523_1_ == Blocks.dirt || p_150523_1_ == Blocks.log || p_150523_1_ == Blocks.log2 || p_150523_1_ == Blocks.sapling || p_150523_1_ == Blocks.vine;
+ }
+
+ @Override
+ protected boolean isReplaceable(World world, int x, int y, int z)
+ {
+ FakeWorld aWorld = getWorld();
+ Block block = aWorld.getBlock(x, y, z);
+ return block.isAir(null, x, y, z) || block.isLeaves(null, x, y, z) || block.isWood(null, x, y, z) || func_150523_a(block);
+ }
+
+ @Override
+ public boolean generate(World world, Random aRand, int aWorldX, int aWorldRealY, int aWorldZ){
+ //Only Generate Once - This object is Cached
+ if (hasGenerated) {
+ return hasGenerated;
+ }
+ else {
+ for (int yy=0;yy<mTreesToGenerate;yy++) {
+ generateTree(0, 0, 0);
+ mCurrentGeneratorIteration++;
+ }
+ hasGenerated = true;
+ if (this.mFakeWorld.size() > 0) {
+ for (FakeWorld aWorld : this.mFakeWorld) {
+ for (ItemStack aBlockInFakeWorld : aWorld.getAllBlocksStoredInFakeWorld()) {
+ aOutputsFromGenerator.add(aBlockInFakeWorld);
+ }
+ }
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+ }
+
+ private FakeWorld aFakeWorld;
+
+ public FakeWorld getWorld() {
+ FakeWorld aWorld = this.mFakeWorld.get(mCurrentGeneratorIteration);
+ if (aWorld == null) {
+ this.mFakeWorld.set(mCurrentGeneratorIteration, new FakeWorld(200));
+ aWorld = this.mFakeWorld.get(mCurrentGeneratorIteration);
+ }
+ return aWorld;
+ }
+
+ public boolean generateTree(int aWorldX, int aWorldRealY, int aWorldZ) {
+ FakeWorld aWorld = getWorld();
+
+ //Set some static values
+
+ Logger.WARNING("Stepping through generateTree [0]");
+ //Dummy Value
+ int aWorldY = 10;
+
+ int l = CORE.RANDOM.nextInt(3) + this.minTreeHeight;
+ boolean flag = true;
+
+ if (aWorldY >= 1 && aWorldY + l + 1 <= 256)
+ {
+ Logger.WARNING("Stepping through generateTree [1]");
+ byte b0;
+ int k1;
+ Block block;
+
+ for (int i1 = aWorldY; i1 <= aWorldY + 1 + l; ++i1)
+ {
+ b0 = 1;
+
+ if (i1 == aWorldY)
+ {
+ b0 = 0;
+ }
+
+ if (i1 >= aWorldY + 1 + l - 2)
+ {
+ b0 = 2;
+ }
+
+ for (int j1 = aWorldX - b0; j1 <= aWorldX + b0 && flag; ++j1)
+ {
+ for (k1 = aWorldZ - b0; k1 <= aWorldZ + b0 && flag; ++k1)
+ {
+ if (i1 >= 0 && i1 < 256)
+ {
+ block = aWorld.getBlock(j1, i1, k1);
+
+ if (!this.isReplaceable(null, j1, i1, k1))
+ {
+ flag = false;
+ }
+ }
+ else
+ {
+ flag = false;
+ }
+ }
+ }
+ }
+
+ if (!flag)
+ {
+ Logger.WARNING("Stepping through generateTree [2]");
+ return false;
+ }
+ else
+ {
+ Logger.WARNING("Stepping through generateTree [3]");
+ Block block2 = aWorld.getBlock(aWorldX, aWorldY - 1, aWorldZ);
+ FakeBlockPos aBlockToGrowPlantOn = aWorld.getBlockAtCoords(aWorldX, aWorldY-1, aWorldZ);
+
+ boolean isSoil = block2.canSustainPlant(aWorld, aWorldX, aWorldY - 1, aWorldZ, ForgeDirection.UP, (BlockSapling)Blocks.sapling);
+ if (/*isSoil &&*/ aWorldY < 256 - l - 1)
+ {
+ Logger.WARNING("Stepping through generateTree [4]");
+ aBlockToGrowPlantOn.onPlantGrow(aWorld, aWorldX, aWorldY - 1, aWorldZ, aWorldX, aWorldY, aWorldZ);
+ b0 = 3;
+ byte b1 = 0;
+ int l1;
+ int i2;
+ int j2;
+ int i3;
+
+ for (k1 = aWorldY - b0 + l; k1 <= aWorldY + l; ++k1)
+ {
+ i3 = k1 - (aWorldY + l);
+ l1 = b1 + 1 - i3 / 2;
+
+ for (i2 = aWorldX - l1; i2 <= aWorldX + l1; ++i2)
+ {
+ j2 = i2 - aWorldX;
+
+ for (int k2 = aWorldZ - l1; k2 <= aWorldZ + l1; ++k2)
+ {
+ int l2 = k2 - aWorldZ;
+
+ if (Math.abs(j2) != l1 || Math.abs(l2) != l1 || CORE.RANDOM.nextInt(2) != 0 && i3 != 0)
+ {
+ Block block1 = aWorld.getBlock(i2, k1, k2);
+
+ if (block1.isAir(null, i2, k1, k2) || block1.isLeaves(null, i2, k1, k2))
+ {
+ this.setBlockAndNotifyAdequately(aWorld, i2, k1, k2, Blocks.leaves, this.metaLeaves);
+ }
+ }
+ }
+ }
+ }
+ Logger.WARNING("Stepping through generateTree [5]");
+
+ for (k1 = 0; k1 < l; ++k1)
+ {
+ block = aWorld.getBlock(aWorldX, aWorldY + k1, aWorldZ);
+
+ if (block.isAir(null, aWorldX, aWorldY + k1, aWorldZ) || block.isLeaves(null, aWorldX, aWorldY + k1, aWorldZ))
+ {
+ this.setBlockAndNotifyAdequately(aWorld, aWorldX, aWorldY + k1, aWorldZ, Blocks.log, this.metaWood);
+
+ if (this.vinesGrow && k1 > 0)
+ {
+ if (CORE.RANDOM.nextInt(3) > 0 && aWorld.isAirBlock(aWorldX - 1, aWorldY + k1, aWorldZ))
+ {
+ this.setBlockAndNotifyAdequately(aWorld, aWorldX - 1, aWorldY + k1, aWorldZ, Blocks.vine, 8);
+ }
+
+ if (CORE.RANDOM.nextInt(3) > 0 && aWorld.isAirBlock(aWorldX + 1, aWorldY + k1, aWorldZ))
+ {
+ this.setBlockAndNotifyAdequately(aWorld, aWorldX + 1, aWorldY + k1, aWorldZ, Blocks.vine, 2);
+ }
+
+ if (CORE.RANDOM.nextInt(3) > 0 && aWorld.isAirBlock(aWorldX, aWorldY + k1, aWorldZ - 1))
+ {
+ this.setBlockAndNotifyAdequately(aWorld, aWorldX, aWorldY + k1, aWorldZ - 1, Blocks.vine, 1);
+ }
+
+ if (CORE.RANDOM.nextInt(3) > 0 && aWorld.isAirBlock(aWorldX, aWorldY + k1, aWorldZ + 1))
+ {
+ this.setBlockAndNotifyAdequately(aWorld, aWorldX, aWorldY + k1, aWorldZ + 1, Blocks.vine, 4);
+ }
+ }
+ }
+ }
+ Logger.WARNING("Stepping through generateTree [6]");
+
+ if (this.vinesGrow)
+ {
+ Logger.WARNING("Stepping through generateTree [7]");
+ for (k1 = aWorldY - 3 + l; k1 <= aWorldY + l; ++k1)
+ {
+ i3 = k1 - (aWorldY + l);
+ l1 = 2 - i3 / 2;
+
+ for (i2 = aWorldX - l1; i2 <= aWorldX + l1; ++i2)
+ {
+ for (j2 = aWorldZ - l1; j2 <= aWorldZ + l1; ++j2)
+ {
+ if (aWorld.getBlock(i2, k1, j2).isLeaves(null, i2, k1, j2))
+ {
+ if (CORE.RANDOM.nextInt(4) == 0 && aWorld.getBlock(i2 - 1, k1, j2).isAir(null, i2 - 1, k1, j2))
+ {
+ this.growVines(aWorld, i2 - 1, k1, j2, 8);
+ }
+
+ if (CORE.RANDOM.nextInt(4) == 0 && aWorld.getBlock(i2 + 1, k1, j2).isAir(null, i2 + 1, k1, j2))
+ {
+ this.growVines(aWorld, i2 + 1, k1, j2, 2);
+ }
+
+ if (CORE.RANDOM.nextInt(4) == 0 && aWorld.getBlock(i2, k1, j2 - 1).isAir(null, i2, k1, j2 - 1))
+ {
+ this.growVines(aWorld, i2, k1, j2 - 1, 1);
+ }
+
+ if (CORE.RANDOM.nextInt(4) == 0 && aWorld.getBlock(i2, k1, j2 + 1).isAir(null, i2, k1, j2 + 1))
+ {
+ this.growVines(aWorld, i2, k1, j2 + 1, 4);
+ }
+ }
+ }
+ }
+ }
+ Logger.WARNING("Stepping through generateTree [8]");
+
+ if (CORE.RANDOM.nextInt(5) == 0 && l > 5)
+ {
+ for (k1 = 0; k1 < 2; ++k1)
+ {
+ for (i3 = 0; i3 < 4; ++i3)
+ {
+ if (CORE.RANDOM.nextInt(4 - k1) == 0)
+ {
+ l1 = CORE.RANDOM.nextInt(3);
+ this.setBlockAndNotifyAdequately(aWorld, aWorldX + Direction.offsetX[Direction.rotateOpposite[i3]], aWorldY + l - 5 + k1, aWorldZ + Direction.offsetZ[Direction.rotateOpposite[i3]], Blocks.cocoa, l1 << 2 | i3);
+ }
+ }
+ }
+ }
+ }
+ Logger.WARNING("Stepping through generateTree [9]");
+ return true;
+ }
+ else
+ {
+ Logger.WARNING("Stepping through generateTree [10]");
+ return false;
+ }
+ }
+ }
+ else
+ {
+ Logger.WARNING("Stepping through generateTree [11]");
+ return false;
+ }
+ }
+
+ /**
+ * Grows vines downward from the given block for a given length. Args: World, x, starty, z, vine-length
+ */
+ private void growVines(FakeWorld aWorld, int aX, int aY, int aZ, int aMeta)
+ {
+ int aLoopSize = vinesGrow ? MathUtils.randInt(0, 4) : 0;
+ for (int i=0;i<aLoopSize;i++) {
+ this.setBlockAndNotifyAdequately(aWorld, aX, aY, aZ, Blocks.vine, aMeta);
+ }
+ }
+
+ @Override
+ protected void setBlockAndNotifyAdequately(World aWorld, int aX, int aY, int aZ, Block aBlock, int aMeta) {
+ setBlockAndNotifyAdequately(getWorld(), aX, aY, aZ, aBlock, aMeta);
+ }
+
+ protected void setBlockAndNotifyAdequately(FakeWorld aWorld, int aX, int aY, int aZ, Block aBlock, int aMeta) {
+ if (aBlock != null && (aMeta >= 0 && aMeta <= Short.MAX_VALUE)) {
+ Logger.WARNING("Setting block "+aX+", "+aY+", "+aZ+" | "+aBlock.getLocalizedName()+" | "+aMeta);
+ aWorld.setBlockAtCoords(aX, aY, aZ, aBlock, aMeta);
+ //aOutputsFromGenerator.put(ItemUtils.simpleMetaStack(aBlock, aMeta, 1));
+ }
+ }
+ }
+
+
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/items/MetaCustomCoverItem.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/items/MetaCustomCoverItem.java
new file mode 100644
index 0000000000..7c3f764794
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/items/MetaCustomCoverItem.java
@@ -0,0 +1,225 @@
+package gtPlusPlus.xmod.gregtech.common.items;
+
+import java.util.List;
+
+import org.apache.commons.lang3.StringUtils;
+
+import cofh.core.render.IconRegistry;
+import cpw.mods.fml.common.registry.GameRegistry;
+import gregtech.api.GregTech_API;
+import gregtech.api.interfaces.IIconContainer;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.objects.GT_MultiTexture;
+import gregtech.api.objects.GT_RenderedTexture;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.client.renderer.CustomItemBlockRenderer;
+import gtPlusPlus.core.common.CommonProxy;
+import gtPlusPlus.core.creative.AddToCreativeTab;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.math.MathUtils;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import gtPlusPlus.core.util.sys.KeyboardUtils;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.CustomIcon;
+import gtPlusPlus.xmod.gregtech.common.covers.GTPP_Cover_ToggleVisual;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.IIcon;
+import net.minecraft.world.World;
+
+public class MetaCustomCoverItem extends Item {
+
+ protected final IIcon[] icons;
+ private final String mModID;
+ private final String mTextureSetName;
+ protected final IIconContainer[] mTextures;
+ private final short[][] mRGB;
+
+ public MetaCustomCoverItem(String aModId, int aTextureCount, String aTextureSetName, IIconContainer[] aTextures, short[][] aRGB) {
+ super();
+ icons = new IIcon[aTextureCount];
+ mModID = aModId;
+ mTextureSetName = Utils.sanitizeString(aTextureSetName);
+ mTextures = aTextures;
+ mRGB = aRGB;
+ this.setTextureName(CORE.MODID + ":" + "itemPlate");
+ this.setHasSubtypes(true);
+ String unlocalizedName = "itemCustomMetaCover." + mModID + "." + mTextureSetName;
+ this.setUnlocalizedName(unlocalizedName);
+ this.setCreativeTab(AddToCreativeTab.tabMisc);
+ this.setMaxStackSize(1);
+ GameRegistry.registerItem(this, unlocalizedName);
+ registerCover();
+ Logger.INFO("[Covers] Generated Custom covers for "+mModID+" using "+aTextureCount+" textures from "+mTextureSetName+".");
+ }
+
+ public boolean hide() {
+ return true;
+ }
+
+ private final void registerCover() {
+ //CommonProxy.registerItemRendererGlobal(this, new CustomItemBlockRenderer());
+ for (int i=0;i<icons.length;i++) {
+ ItemStack thisStack = ItemUtils.simpleMetaStack(this, i, 1);
+ if (i > 0 && hide()) {
+ ItemUtils.hideItemFromNEI(thisStack);
+ }
+ GregTech_API.registerCover(
+ thisStack,
+ new GT_MultiTexture(
+ new ITexture[]{
+ new GT_RenderedTexture(mTextures[i])
+ }),
+ new GTPP_Cover_ToggleVisual());
+ }
+ }
+
+ /*
+ * @Override public void registerIcons(IIconRegister reg) { for (int i = 0; i <
+ * icons.length; i++) { this.icons[i] = mTextures[i].getIcon(); } }
+ *
+ * @Override public IIcon getIconFromDamage(int meta) { return this.icons[meta];
+ * }
+ */
+
+ @Override
+ public void getSubItems(Item item, CreativeTabs tab, List list) {
+ for (int i = 0; i < icons.length; i++) {
+ list.add(new ItemStack(item, 1, i));
+ }
+ }
+
+ @Override
+ public String getUnlocalizedName(ItemStack stack) {
+ return this.getUnlocalizedName() + "_" + stack.getItemDamage();
+ }
+
+ @Override
+ public String getItemStackDisplayName(final ItemStack tItem) {
+ return StringUtils.capitalize(mTextureSetName) + " (" + tItem.getItemDamage() + ")"; //super.getItemStackDisplayName(tItem);
+ }
+
+ private static boolean createNBT(ItemStack rStack) {
+ final NBTTagCompound tagMain = new NBTTagCompound();
+ final NBTTagCompound tagNBT = new NBTTagCompound();
+ tagNBT.setLong("Damage", 0);
+ tagNBT.setBoolean("AllowConnections", false);
+ tagMain.setTag("CustomCoverMeta", tagNBT);
+ rStack.setTagCompound(tagMain);
+ return true;
+ }
+
+ public static final long getCoverDamage(final ItemStack aStack) {
+ NBTTagCompound aNBT = aStack.getTagCompound();
+ if (aNBT != null) {
+ aNBT = aNBT.getCompoundTag("CustomCoverMeta");
+ if (aNBT != null) {
+ return aNBT.getLong("Damage");
+ }
+ } else {
+ createNBT(aStack);
+ }
+ return 0L;
+ }
+
+ public static final boolean setCoverDamage(final ItemStack aStack, final long aDamage) {
+ NBTTagCompound aNBT = aStack.getTagCompound();
+ if (aNBT != null) {
+ aNBT = aNBT.getCompoundTag("CustomCoverMeta");
+ if (aNBT != null) {
+ aNBT.setLong("Damage", aDamage);
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public static final boolean getCoverConnections(final ItemStack aStack) {
+ NBTTagCompound aNBT = aStack.getTagCompound();
+ if (aNBT != null) {
+ aNBT = aNBT.getCompoundTag("CustomCoverMeta");
+ if (aNBT != null) {
+ return aNBT.getBoolean("AllowConnections");
+ }
+ } else {
+ createNBT(aStack);
+ }
+ return false;
+ }
+
+ public static final boolean setCoverConnections(final ItemStack aStack, final boolean aConnections) {
+ NBTTagCompound aNBT = aStack.getTagCompound();
+ if (aNBT != null) {
+ aNBT = aNBT.getCompoundTag("CustomCoverMeta");
+ if (aNBT != null) {
+ aNBT.setBoolean("AllowConnections", aConnections);
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public double getDurabilityForDisplay(ItemStack stack) {
+ if (stack.getTagCompound() == null) {
+ createNBT(stack);
+ }
+ double currentDamage = getCoverDamage(stack);
+ double meta = stack.getItemDamage() == 0 ? 50 : 2500;
+ double durabilitypercent = currentDamage / meta;
+ return durabilitypercent;
+ }
+
+ @Override
+ public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
+ if (KeyboardUtils.isShiftKeyDown()) {
+ boolean con = getCoverConnections(stack);
+ if (con) {
+ setCoverConnections(stack, false);
+ } else {
+ setCoverConnections(stack, true);
+ }
+ }
+ return stack;
+ }
+
+ @Override
+ public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool) {
+ boolean cons = getCoverConnections(stack);
+ list.add(EnumChatFormatting.GRAY + "Allows Connections: "+cons);
+ list.add(EnumChatFormatting.GRAY + "Shift Rmb to change state before applying");
+ super.addInformation(stack, player, list, bool);
+ }
+
+ @Override
+ public boolean showDurabilityBar(ItemStack stack) {
+ return false;
+ }
+
+ @Override
+ public Item setFull3D() {
+ // TODO Auto-generated method stub
+ return super.setFull3D();
+ }
+
+ @Override
+ public boolean isFull3D() {
+ // TODO Auto-generated method stub
+ return super.isFull3D();
+ }
+
+ @Override
+ public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) {
+ if (this.mRGB == null){
+ return super.getColorFromItemStack(stack, HEX_OxFFFFFF);
+ }
+ int aMeta = stack.getItemDamage();
+ return Utils.rgbtoHexValue(mRGB[aMeta][0], mRGB[aMeta][1], mRGB[aMeta][2]);
+ }
+
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechItems.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechItems.java
new file mode 100644
index 0000000000..ce8b6eaf62
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechItems.java
@@ -0,0 +1,453 @@
+package gtPlusPlus.xmod.gregtech.common.items;
+
+import static gtPlusPlus.core.util.Utils.getTcAspectStack;
+
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.GT_Values;
+import gregtech.api.enums.Materials;
+import gregtech.api.enums.OrePrefixes;
+import gregtech.api.enums.SubTag;
+import gregtech.api.enums.TC_Aspects;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.objects.GT_MultiTexture;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.objects.ItemData;
+import gregtech.api.objects.MaterialStack;
+import gregtech.api.util.GT_FoodStat;
+import gregtech.api.util.GT_ModHandler;
+import gregtech.api.util.GTPP_Recipe;
+import gregtech.common.covers.GT_Cover_Arm;
+import gregtech.common.covers.GT_Cover_Conveyor;
+import gregtech.common.covers.GT_Cover_Pump;
+import gregtech.common.items.behaviors.Behaviour_DataOrb;
+import gregtech.common.items.behaviors.Behaviour_DataStick;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.handler.OldCircuitHandler;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.data.StringUtils;
+import gtPlusPlus.core.util.math.MathUtils;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList;
+import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes;
+import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials;
+import gtPlusPlus.xmod.gregtech.api.items.Gregtech_MetaItem_X32;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import gtPlusPlus.xmod.gregtech.common.covers.GTPP_Cover_Overflow;
+import gtPlusPlus.xmod.gregtech.common.covers.GTPP_Cover_Overflow_Item;
+import gtPlusPlus.xmod.gregtech.common.covers.GTPP_Cover_ToggleVisual;
+import net.minecraft.item.EnumAction;
+import net.minecraft.item.ItemStack;
+
+public class MetaGeneratedGregtechItems extends Gregtech_MetaItem_X32 {
+
+ public final static MetaGeneratedGregtechItems INSTANCE;
+
+ static {
+ INSTANCE = new MetaGeneratedGregtechItems();
+ }
+
+ public MetaGeneratedGregtechItems() {
+ super("MU-metaitem.01", new OrePrefixes[]{null});
+ }
+
+ public void generateMetaItems() {
+ int tLastID = 0;
+
+ registerCustomCircuits();
+ OldCircuitHandler.addCircuitItems();
+
+ if (!CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK){
+ Logger.INFO("Gregtech 5.09 not found, using fallback components. (I like how I have to add compat to something I added first and had stolen.)");
+ GregtechItemList.Electric_Pump_LuV.set(this.addItem(tLastID = 0, "Electric Pump (LuV)", "163920 L/sec (as Cover)", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 1L), getTcAspectStack(TC_Aspects.MACHINA, 1L), getTcAspectStack(TC_Aspects.ITER, 1L), getTcAspectStack(TC_Aspects.AQUA, 1L)}));
+ GregtechItemList.Electric_Pump_ZPM.set(this.addItem(tLastID = 1, "Electric Pump (ZPM)", "655680 L/sec (as Cover)", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 2L), getTcAspectStack(TC_Aspects.MACHINA, 2L), getTcAspectStack(TC_Aspects.ITER, 2L), getTcAspectStack(TC_Aspects.AQUA, 2L)}));
+ GregtechItemList.Electric_Pump_UV.set(this.addItem(tLastID = 2, "Electric Pump (UV)", "2622720 L/sec (as Cover)", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 4L), getTcAspectStack(TC_Aspects.MACHINA, 4L), getTcAspectStack(TC_Aspects.ITER, 4L), getTcAspectStack(TC_Aspects.AQUA, 4L)}));
+ GregtechItemList.Electric_Pump_MAX.set(this.addItem(tLastID = 3, "Electric Pump (MAX)", "10490880 L/sec (as Cover)", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 8L), getTcAspectStack(TC_Aspects.MACHINA, 8L), getTcAspectStack(TC_Aspects.ITER, 8L), getTcAspectStack(TC_Aspects.AQUA, 8L)}));
+ GregTech_API.registerCover(GregtechItemList.Electric_Pump_LuV.get(1L), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[5][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PUMP)}), new GT_Cover_Pump(8196));
+ GregTech_API.registerCover(GregtechItemList.Electric_Pump_ZPM.get(1L), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[6][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PUMP)}), new GT_Cover_Pump(32768));
+ GregTech_API.registerCover(GregtechItemList.Electric_Pump_UV.get(1L), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[7][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PUMP)}), new GT_Cover_Pump(131072));
+ GregTech_API.registerCover(GregtechItemList.Electric_Pump_MAX.get(1L), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[8][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PUMP)}), new GT_Cover_Pump(524288));
+ //GT_ModHandler.addCraftingRecipe(GregtechItemList.Electric_Pump_LuV.get(1L), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"SXO", "dPw", "OMW", Character.valueOf('M'), GregtechItemList.Electric_Motor_LuV, Character.valueOf('O'), OrePrefixes.ring.get(Materials.Rubber), Character.valueOf('X'), OrePrefixes.rotor.get(Materials.Tin), Character.valueOf('S'), OrePrefixes.screw.get(Materials.Tin), Character.valueOf('W'), OrePrefixes.cableGt01.get(Materials.Tin), Character.valueOf('P'), OrePrefixes.pipeMedium.get(Materials.Bronze)});
+ //GT_ModHandler.addCraftingRecipe(GregtechItemList.Electric_Pump_ZPM.get(1L), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"SXO", "dPw", "OMW", Character.valueOf('M'), GregtechItemList.Electric_Motor_ZPM, Character.valueOf('O'), OrePrefixes.ring.get(Materials.Rubber), Character.valueOf('X'), OrePrefixes.rotor.get(Materials.Bronze), Character.valueOf('S'), OrePrefixes.screw.get(Materials.Bronze), Character.valueOf('W'), OrePrefixes.cableGt01.get(Materials.AnyCopper), Character.valueOf('P'), OrePrefixes.pipeMedium.get(Materials.Steel)});
+ //GT_ModHandler.addCraftingRecipe(GregtechItemList.Electric_Pump_UV.get(1L), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"SXO", "dPw", "OMW", Character.valueOf('M'), GregtechItemList.Electric_Motor_UV, Character.valueOf('O'), OrePrefixes.ring.get(Materials.Rubber), Character.valueOf('X'), OrePrefixes.rotor.get(Materials.Steel), Character.valueOf('S'), OrePrefixes.screw.get(Materials.Steel), Character.valueOf('W'), OrePrefixes.cableGt01.get(Materials.Gold), Character.valueOf('P'), OrePrefixes.pipeMedium.get(Materials.StainlessSteel)});
+ //GT_ModHandler.addCraftingRecipe(GregtechItemList.Electric_Pump_MAX.get(1L), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"SXO", "dPw", "OMW", Character.valueOf('M'), GregtechItemList.Electric_Motor_MAX, Character.valueOf('O'), OrePrefixes.ring.get(Materials.Rubber), Character.valueOf('X'), OrePrefixes.rotor.get(Materials.StainlessSteel), Character.valueOf('S'), OrePrefixes.screw.get(Materials.StainlessSteel), Character.valueOf('W'), OrePrefixes.cableGt01.get(Materials.Aluminium), Character.valueOf('P'), OrePrefixes.pipeMedium.get(Materials.Titanium)});
+ tLastID = 4;
+ GregtechItemList.Electric_Motor_LuV.set(this.addItem(tLastID = 4, "Electric Motor (LuV)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 1L), getTcAspectStack(TC_Aspects.MACHINA, 1L), getTcAspectStack(TC_Aspects.MOTUS, 1L)}));
+ GregtechItemList.Electric_Motor_ZPM.set(this.addItem(tLastID = 5, "Electric Motor (ZPM)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 2L), getTcAspectStack(TC_Aspects.MACHINA, 2L), getTcAspectStack(TC_Aspects.MOTUS, 2L)}));
+ GregtechItemList.Electric_Motor_UV.set(this.addItem(tLastID = 6, "Electric Motor (UV)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 4L), getTcAspectStack(TC_Aspects.MACHINA, 4L), getTcAspectStack(TC_Aspects.MOTUS, 4L)}));
+ GregtechItemList.Electric_Motor_MAX.set(this.addItem(tLastID = 7, "Electric Motor (MAX)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 8L), getTcAspectStack(TC_Aspects.MACHINA, 8L), getTcAspectStack(TC_Aspects.MOTUS, 8L)}));
+ //GT_ModHandler.addCraftingRecipe(GregtechItemList.Electric_Motor_LuV.get(1L), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"CWR", "WIW", "RWC", Character.valueOf('I'), OrePrefixes.stick.get(Materials.IronMagnetic), Character.valueOf('R'), OrePrefixes.stick.get(Materials.AnyIron), Character.valueOf('W'), OrePrefixes.wireGt01.get(Materials.AnyCopper), Character.valueOf('C'), OrePrefixes.cableGt01.get(Materials.Tin)});
+ //GT_ModHandler.addCraftingRecipe(GregtechItemList.Electric_Motor_ZPM.get(1L), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"CWR", "WIW", "RWC", Character.valueOf('I'), OrePrefixes.stick.get(Materials.SteelMagnetic), Character.valueOf('R'), OrePrefixes.stick.get(Materials.Aluminium), Character.valueOf('W'), OrePrefixes.wireGt01.get(Materials.Electrum), Character.valueOf('C'), OrePrefixes.cableGt01.get(Materials.Silver)});
+ //GT_ModHandler.addCraftingRecipe(GregtechItemList.Electric_Motor_UV.get(1L), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"CWR", "WIW", "RWC", Character.valueOf('I'), OrePrefixes.stick.get(Materials.SteelMagnetic), Character.valueOf('R'), OrePrefixes.stick.get(Materials.StainlessSteel), Character.valueOf('W'), OrePrefixes.wireGt02.get(Materials.Cupronickel), Character.valueOf('C'), OrePrefixes.cableGt01.get(Materials.Gold)});
+ //GT_ModHandler.addCraftingRecipe(GregtechItemList.Electric_Motor_MAX.get(1L), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"CWR", "WIW", "RWC", Character.valueOf('I'), OrePrefixes.stick.get(Materials.NeodymiumMagnetic), Character.valueOf('R'), OrePrefixes.stick.get(Materials.Titanium), Character.valueOf('W'), OrePrefixes.wireGt02.get(Materials.TungstenSteel), Character.valueOf('C'), OrePrefixes.cableGt01.get(Materials.Nichrome)});
+
+ tLastID = 8;
+ GregtechItemList.Conveyor_Module_LuV.set(this.addItem(tLastID = 8, "Conveyor Module (LuV)", "1 Stack every 20 secs (as Cover)", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 1L), getTcAspectStack(TC_Aspects.MACHINA, 1L), getTcAspectStack(TC_Aspects.ITER, 1L)}));
+ GregtechItemList.Conveyor_Module_ZPM.set(this.addItem(tLastID = 9, "Conveyor Module (ZPM)", "1 Stack every 5 secs (as Cover)", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 2L), getTcAspectStack(TC_Aspects.MACHINA, 2L), getTcAspectStack(TC_Aspects.ITER, 2L)}));
+ GregtechItemList.Conveyor_Module_UV.set(this.addItem(tLastID = 10, "Conveyor Module (UV)", "1 Stack every 1 sec (as Cover)", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 4L), getTcAspectStack(TC_Aspects.MACHINA, 4L), getTcAspectStack(TC_Aspects.ITER, 4L)}));
+ GregtechItemList.Conveyor_Module_MAX.set(this.addItem(tLastID = 11, "Conveyor Module (MAX)", "1 Stack every 1/5 sec (as Cover)", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 8L), getTcAspectStack(TC_Aspects.MACHINA, 8L), getTcAspectStack(TC_Aspects.ITER, 8L)}));
+ //GT_ModHandler.addCraftingRecipe(GregtechItemList.Conveyor_Module_LuV.get(1L), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"RRR", "MCM", "RRR", Character.valueOf('M'), GregtechItemList.Electric_Motor_LuV, Character.valueOf('C'), OrePrefixes.cableGt01.get(Materials.Tin), Character.valueOf('R'), OrePrefixes.plate.get(Materials.Rubber)});
+ //GT_ModHandler.addCraftingRecipe(GregtechItemList.Conveyor_Module_ZPM.get(1L), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"RRR", "MCM", "RRR", Character.valueOf('M'), GregtechItemList.Electric_Motor_ZPM, Character.valueOf('C'), OrePrefixes.cableGt01.get(Materials.AnyCopper), Character.valueOf('R'), OrePrefixes.plate.get(Materials.Rubber)});
+ //GT_ModHandler.addCraftingRecipe(GregtechItemList.Conveyor_Module_UV.get(1L), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"RRR", "MCM", "RRR", Character.valueOf('M'), GregtechItemList.Electric_Motor_UV, Character.valueOf('C'), OrePrefixes.cableGt01.get(Materials.Gold), Character.valueOf('R'), OrePrefixes.plate.get(Materials.Rubber)});
+ //GT_ModHandler.addCraftingRecipe(GregtechItemList.Conveyor_Module_MAX.get(1L), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"RRR", "MCM", "RRR", Character.valueOf('M'), GregtechItemList.Electric_Motor_MAX, Character.valueOf('C'), OrePrefixes.cableGt01.get(Materials.Aluminium), Character.valueOf('R'), OrePrefixes.plate.get(Materials.Rubber)});
+ GregTech_API.registerCover(GregtechItemList.Conveyor_Module_LuV.get(1L), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[1][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_CONVEYOR)}), new GT_Cover_Conveyor(400));
+ GregTech_API.registerCover(GregtechItemList.Conveyor_Module_ZPM.get(1L), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[2][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_CONVEYOR)}), new GT_Cover_Conveyor(100));
+ GregTech_API.registerCover(GregtechItemList.Conveyor_Module_UV.get(1L), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[3][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_CONVEYOR)}), new GT_Cover_Conveyor(20));
+ GregTech_API.registerCover(GregtechItemList.Conveyor_Module_MAX.get(1L), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[4][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_CONVEYOR)}), new GT_Cover_Conveyor(4));
+ tLastID = 12;
+ GregtechItemList.Electric_Piston_LuV.set(this.addItem(tLastID = 12, "Electric Piston (LuV)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 1L), getTcAspectStack(TC_Aspects.MACHINA, 2L), getTcAspectStack(TC_Aspects.MOTUS, 1L)}));
+ GregtechItemList.Electric_Piston_ZPM.set(this.addItem(tLastID = 13, "Electric Piston (ZPM)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 2L), getTcAspectStack(TC_Aspects.MACHINA, 4L), getTcAspectStack(TC_Aspects.MOTUS, 2L)}));
+ GregtechItemList.Electric_Piston_UV.set(this.addItem(tLastID = 14, "Electric Piston (UV)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 4L), getTcAspectStack(TC_Aspects.MACHINA, 8L), getTcAspectStack(TC_Aspects.MOTUS, 4L)}));
+ GregtechItemList.Electric_Piston_MAX.set(this.addItem(tLastID = 15, "Electric Piston (MAX)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 8L), getTcAspectStack(TC_Aspects.MACHINA, 16L), getTcAspectStack(TC_Aspects.MOTUS, 8L)}));
+ //GT_ModHandler.addCraftingRecipe(GregtechItemList.Electric_Piston_LuV.get(1L), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"PPP", "CSS", "CMG", Character.valueOf('P'), OrePrefixes.plate.get(Materials.Steel), Character.valueOf('S'), OrePrefixes.stick.get(Materials.Steel), Character.valueOf('G'), OrePrefixes.gearGtSmall.get(Materials.Steel), Character.valueOf('M'), GregtechItemList.Electric_Motor_LuV, Character.valueOf('C'), OrePrefixes.cableGt01.get(Materials.Tin)});
+ //GT_ModHandler.addCraftingRecipe(GregtechItemList.Electric_Piston_ZPM.get(1L), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"PPP", "CSS", "CMG", Character.valueOf('P'), OrePrefixes.plate.get(Materials.Aluminium), Character.valueOf('S'), OrePrefixes.stick.get(Materials.Aluminium), Character.valueOf('G'), OrePrefixes.gearGtSmall.get(Materials.Aluminium), Character.valueOf('M'), GregtechItemList.Electric_Motor_ZPM, Character.valueOf('C'), OrePrefixes.cableGt01.get(Materials.AnyCopper)});
+ //GT_ModHandler.addCraftingRecipe(GregtechItemList.Electric_Piston_UV.get(1L), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"PPP", "CSS", "CMG", Character.valueOf('P'), OrePrefixes.plate.get(Materials.StainlessSteel), Character.valueOf('S'), OrePrefixes.stick.get(Materials.StainlessSteel), Character.valueOf('G'), OrePrefixes.gearGtSmall.get(Materials.StainlessSteel), Character.valueOf('M'), GregtechItemList.Electric_Motor_UV, Character.valueOf('C'), OrePrefixes.cableGt01.get(Materials.Gold)});
+ //GT_ModHandler.addCraftingRecipe(GregtechItemList.Electric_Piston_MAX.get(1L), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"PPP", "CSS", "CMG", Character.valueOf('P'), OrePrefixes.plate.get(Materials.Titanium), Character.valueOf('S'), OrePrefixes.stick.get(Materials.Titanium), Character.valueOf('G'), OrePrefixes.gearGtSmall.get(Materials.Titanium), Character.valueOf('M'), GregtechItemList.Electric_Motor_MAX, Character.valueOf('C'), OrePrefixes.cableGt01.get(Materials.Aluminium)});
+ tLastID = 16;
+ GregtechItemList.Robot_Arm_LuV.set(this.addItem(tLastID = 16, "Robot Arm (LuV)", "Inserts into specific Slots (as Cover)", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 1L), getTcAspectStack(TC_Aspects.MACHINA, 2L), getTcAspectStack(TC_Aspects.MOTUS, 1L), Utils.getTcAspectStack("COGNITIO", 1L)}));
+ GregtechItemList.Robot_Arm_ZPM.set(this.addItem(tLastID = 17, "Robot Arm (ZPM)", "Inserts into specific Slots (as Cover)", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 2L), getTcAspectStack(TC_Aspects.MACHINA, 4L), getTcAspectStack(TC_Aspects.MOTUS, 2L), getTcAspectStack("COGNITIO", 2L)}));
+ GregtechItemList.Robot_Arm_UV.set(this.addItem(tLastID = 18, "Robot Arm (UV)", "Inserts into specific Slots (as Cover)", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 4L), getTcAspectStack(TC_Aspects.MACHINA, 8L), getTcAspectStack(TC_Aspects.MOTUS, 4L), getTcAspectStack("COGNITIO", 4L)}));
+ GregtechItemList.Robot_Arm_MAX.set(this.addItem(tLastID = 19, "Robot Arm (MAX)", "Inserts into specific Slots (as Cover)", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 8L), getTcAspectStack(TC_Aspects.MACHINA, 16L), getTcAspectStack(TC_Aspects.MOTUS, 8L), getTcAspectStack("COGNITIO", 8L)}));
+ //GT_ModHandler.addCraftingRecipe(GregtechItemList.Robot_Arm_LuV.get(1L), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"CCC", "MSM", "PES", Character.valueOf('S'), OrePrefixes.stick.get(Materials.Steel), Character.valueOf('M'), GregtechItemList.Electric_Motor_LuV, Character.valueOf('P'), GregtechItemList.Electric_Piston_LuV, Character.valueOf('E'), OrePrefixes.circuit.get(Materials.Basic), Character.valueOf('C'), OrePrefixes.cableGt01.get(Materials.Tin)});
+ //GT_ModHandler.addCraftingRecipe(GregtechItemList.Robot_Arm_ZPM.get(1L), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"CCC", "MSM", "PES", Character.valueOf('S'), OrePrefixes.stick.get(Materials.Aluminium), Character.valueOf('M'), GregtechItemList.Electric_Motor_ZPM, Character.valueOf('P'), GregtechItemList.Electric_Piston_ZPM, Character.valueOf('E'), OrePrefixes.circuit.get(Materials.Good), Character.valueOf('C'), OrePrefixes.cableGt01.get(Materials.AnyCopper)});
+ //GT_ModHandler.addCraftingRecipe(GregtechItemList.Robot_Arm_UV.get(1L), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"CCC", "MSM", "PES", Character.valueOf('S'), OrePrefixes.stick.get(Materials.StainlessSteel), Character.valueOf('M'), GregtechItemList.Electric_Motor_UV, Character.valueOf('P'), GregtechItemList.Electric_Piston_UV, Character.valueOf('E'), OrePrefixes.circuit.get(Materials.Advanced), Character.valueOf('C'), OrePrefixes.cableGt01.get(Materials.Gold)});
+ //GT_ModHandler.addCraftingRecipe(GregtechItemList.Robot_Arm_MAX.get(1L), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"CCC", "MSM", "PES", Character.valueOf('S'), OrePrefixes.stick.get(Materials.Titanium), Character.valueOf('M'), GregtechItemList.Electric_Motor_MAX, Character.valueOf('P'), GregtechItemList.Electric_Piston_MAX, Character.valueOf('E'), OrePrefixes.circuit.get(Materials.Elite), Character.valueOf('C'), OrePrefixes.cableGt01.get(Materials.Aluminium)});
+ GregTech_API.registerCover(GregtechItemList.Robot_Arm_LuV.get(1L), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[1][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_ARM)}), new GT_Cover_Arm(400));
+ GregTech_API.registerCover(GregtechItemList.Robot_Arm_ZPM.get(1L), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[2][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_ARM)}), new GT_Cover_Arm(100));
+ GregTech_API.registerCover(GregtechItemList.Robot_Arm_UV.get(1L), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[3][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_ARM)}), new GT_Cover_Arm(20));
+ GregTech_API.registerCover(GregtechItemList.Robot_Arm_MAX.get(1L), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[4][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_ARM)}), new GT_Cover_Arm(4));
+ tLastID = 20;
+ GregtechItemList.Field_Generator_LuV.set(this.addItem(tLastID = 20, "Field Generator (LuV)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 2L), getTcAspectStack(TC_Aspects.MACHINA, 1L), getTcAspectStack(TC_Aspects.TUTAMEN, 1L)}));
+ GregtechItemList.Field_Generator_ZPM.set(this.addItem(tLastID = 21, "Field Generator (ZPM)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 4L), getTcAspectStack(TC_Aspects.MACHINA, 2L), getTcAspectStack(TC_Aspects.TUTAMEN, 2L)}));
+ GregtechItemList.Field_Generator_UV.set(this.addItem(tLastID = 22, "Field Generator (UV)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 8L), getTcAspectStack(TC_Aspects.MACHINA, 4L), getTcAspectStack(TC_Aspects.TUTAMEN, 4L)}));
+ GregtechItemList.Field_Generator_MAX.set(this.addItem(tLastID = 23, "Field Generator (MAX)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 16L), getTcAspectStack(TC_Aspects.MACHINA, 8L), getTcAspectStack(TC_Aspects.TUTAMEN, 8L)}));
+ //GT_ModHandler.addCraftingRecipe(GregtechItemList.Field_Generator_LuV.get(1L), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"WCW", "CGC", "WCW", Character.valueOf('G'), OrePrefixes.gem.get(Materials.EnderPearl), Character.valueOf('C'), OrePrefixes.circuit.get(Materials.Basic), Character.valueOf('W'), OrePrefixes.wireGt01.get(Materials.Osmium)});
+ //GT_ModHandler.addCraftingRecipe(GregtechItemList.Field_Generator_ZPM.get(1L), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"WCW", "CGC", "WCW", Character.valueOf('G'), OrePrefixes.gem.get(Materials.EnderEye), Character.valueOf('C'), OrePrefixes.circuit.get(Materials.Good), Character.valueOf('W'), OrePrefixes.wireGt02.get(Materials.Osmium)});
+ //GT_ModHandler.addCraftingRecipe(GregtechItemList.Field_Generator_UV.get(1L), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"WCW", "CGC", "WCW", Character.valueOf('G'), OrePrefixes.gem.get(Materials.NetherStar), Character.valueOf('C'), OrePrefixes.circuit.get(Materials.Advanced), Character.valueOf('W'), OrePrefixes.wireGt04.get(Materials.Osmium)});
+ //GT_ModHandler.addCraftingRecipe(GregtechItemList.Field_Generator_MAX.get(1L), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"WCW", "CGC", "WCW", Character.valueOf('G'), OrePrefixes.gem.get(Materials.NetherStar), Character.valueOf('C'), OrePrefixes.circuit.get(Materials.Elite), Character.valueOf('W'), OrePrefixes.wireGt08.get(Materials.Osmium)});
+ tLastID = 24;
+ GregtechItemList.Emitter_LuV.set(this.addItem(tLastID = 24, "Emitter (LuV)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 1L), getTcAspectStack(TC_Aspects.MACHINA, 1L), getTcAspectStack(TC_Aspects.LUX, 1L)}));
+ GregtechItemList.Emitter_ZPM.set(this.addItem(tLastID = 25, "Emitter (ZPM)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 2L), getTcAspectStack(TC_Aspects.MACHINA, 2L), getTcAspectStack(TC_Aspects.LUX, 2L)}));
+ GregtechItemList.Emitter_UV.set(this.addItem(tLastID = 26, "Emitter (UV)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 4L), getTcAspectStack(TC_Aspects.MACHINA, 4L), getTcAspectStack(TC_Aspects.LUX, 4L)}));
+ GregtechItemList.Emitter_MAX.set(this.addItem(tLastID = 27, "Emitter (MAX)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 8L), getTcAspectStack(TC_Aspects.MACHINA, 8L), getTcAspectStack(TC_Aspects.LUX, 8L)}));
+ //GT_ModHandler.addCraftingRecipe(GregtechItemList.Emitter_LuV.get(1L), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"SSC", "WQS", "CWS", Character.valueOf('Q'), OrePrefixes.gem.get(Materials.Quartzite), Character.valueOf('S'), OrePrefixes.stick.get(Materials.Brass), Character.valueOf('C'), OrePrefixes.circuit.get(Materials.Basic), Character.valueOf('W'), OrePrefixes.cableGt01.get(Materials.Tin)});
+ //GT_ModHandler.addCraftingRecipe(GregtechItemList.Emitter_ZPM.get(1L), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"SSC", "WQS", "CWS", Character.valueOf('Q'), OrePrefixes.gem.get(Materials.NetherQuartz), Character.valueOf('S'), OrePrefixes.stick.get(Materials.Electrum), Character.valueOf('C'), OrePrefixes.circuit.get(Materials.Good), Character.valueOf('W'), OrePrefixes.cableGt01.get(Materials.AnyCopper)});
+ //GT_ModHandler.addCraftingRecipe(GregtechItemList.Emitter_UV.get(1L), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"SSC", "WQS", "CWS", Character.valueOf('Q'), OrePrefixes.gem.get(Materials.Emerald), Character.valueOf('S'), OrePrefixes.stick.get(Materials.Chrome), Character.valueOf('C'), OrePrefixes.circuit.get(Materials.Advanced), Character.valueOf('W'), OrePrefixes.cableGt01.get(Materials.Gold)});
+ //GT_ModHandler.addCraftingRecipe(GregtechItemList.Emitter_MAX.get(1L), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"SSC", "WQS", "CWS", Character.valueOf('Q'), OrePrefixes.gem.get(Materials.EnderPearl), Character.valueOf('S'), OrePrefixes.stick.get(Materials.Platinum), Character.valueOf('C'), OrePrefixes.circuit.get(Materials.Elite), Character.valueOf('W'), OrePrefixes.cableGt01.get(Materials.Aluminium)});
+ tLastID = 28;
+ GregtechItemList.Sensor_LuV.set(this.addItem(tLastID = 28, "Sensor (LuV)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 1L), getTcAspectStack(TC_Aspects.MACHINA, 1L), getTcAspectStack(TC_Aspects.SENSUS, 1L)}));
+ GregtechItemList.Sensor_ZPM.set(this.addItem(tLastID = 29, "Sensor (ZPM)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 2L), getTcAspectStack(TC_Aspects.MACHINA, 2L), getTcAspectStack(TC_Aspects.SENSUS, 2L)}));
+ GregtechItemList.Sensor_UV.set(this.addItem(tLastID = 30, "Sensor (UV)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 4L), getTcAspectStack(TC_Aspects.MACHINA, 4L), getTcAspectStack(TC_Aspects.SENSUS, 4L)}));
+ GregtechItemList.Sensor_MAX.set(this.addItem(tLastID = 31, "Sensor (MAX)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 8L), getTcAspectStack(TC_Aspects.MACHINA, 8L), getTcAspectStack(TC_Aspects.SENSUS, 8L)}));
+ //GT_ModHandler.addCraftingRecipe(GregtechItemList.Sensor_LuV.get(1L), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"P Q", "PS ", "CPP", Character.valueOf('Q'), OrePrefixes.gem.get(Materials.Quartzite), Character.valueOf('S'), OrePrefixes.stick.get(Materials.Brass), Character.valueOf('P'), OrePrefixes.plate.get(Materials.Steel), Character.valueOf('C'), OrePrefixes.circuit.get(Materials.Basic)});
+ //GT_ModHandler.addCraftingRecipe(GregtechItemList.Sensor_ZPM.get(1L), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"P Q", "PS ", "CPP", Character.valueOf('Q'), OrePrefixes.gem.get(Materials.NetherQuartz), Character.valueOf('S'), OrePrefixes.stick.get(Materials.Electrum), Character.valueOf('P'), OrePrefixes.plate.get(Materials.Aluminium), Character.valueOf('C'), OrePrefixes.circuit.get(Materials.Good)});
+ //GT_ModHandler.addCraftingRecipe(GregtechItemList.Sensor_UV.get(1L), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"P Q", "PS ", "CPP", Character.valueOf('Q'), OrePrefixes.gem.get(Materials.Emerald), Character.valueOf('S'), OrePrefixes.stick.get(Materials.Chrome), Character.valueOf('P'), OrePrefixes.plate.get(Materials.StainlessSteel), Character.valueOf('C'), OrePrefixes.circuit.get(Materials.Advanced)});
+ //GT_ModHandler.addCraftingRecipe(GregtechItemList.Sensor_MAX.get(1L), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"P Q", "PS ", "CPP", Character.valueOf('Q'), OrePrefixes.gem.get(Materials.EnderPearl), Character.valueOf('S'), OrePrefixes.stick.get(Materials.Platinum), Character.valueOf('P'), OrePrefixes.plate.get(Materials.Titanium), Character.valueOf('C'), OrePrefixes.circuit.get(Materials.Elite)});
+
+ //Handler for ULV Components
+ registerComponents_ULV();
+
+
+ }
+
+ else {
+ //Simplify life.
+ registerComponents_ULV();
+ registerComponents_MAX();
+ }
+
+ //Extruder Shape
+ GregtechItemList.Shape_Extruder_WindmillShaft.set(this.addItem(tLastID = 40, "Extruder Shape (Shaft)", "Extruder Shape for making Windmill Shafts"));
+
+ //GTNH Already adds this.
+ if (!CORE.GTNH) {
+ GregtechItemList.Shape_Extruder_SmallGear.set(this.addItem(221, "Extruder Shape (Small Gear)", "Extruder Shape for making small gears"));
+ }
+
+ //Batteries
+ GregtechItemList.Battery_RE_EV_Sodium.set(this.addItem(tLastID = 50, "Quad Cell Sodium Battery", "Reusable", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 2L), getTcAspectStack(TC_Aspects.METALLUM, 2L), getTcAspectStack(TC_Aspects.POTENTIA, 2L)}));
+ this.setElectricStats(32000 + tLastID, 3200000L, GT_Values.V[4], 4L, -3L, true);
+
+ GregtechItemList.Battery_RE_EV_Cadmium.set(this.addItem(tLastID = 52, "Quad Cell Cadmium Battery", "Reusable", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 1L), getTcAspectStack(TC_Aspects.METALLUM, 1L), getTcAspectStack(TC_Aspects.POTENTIA, 1L)}));
+ this.setElectricStats(32000 + tLastID, 4800000L, GT_Values.V[4], 4L, -3L, true);
+
+ GregtechItemList.Battery_RE_EV_Lithium.set(this.addItem(tLastID = 54, "Quad Cell Lithium Battery", "Reusable", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 3L), getTcAspectStack(TC_Aspects.METALLUM, 3L), getTcAspectStack(TC_Aspects.POTENTIA, 3L)}));
+ this.setElectricStats(32000 + tLastID, 6400000L, GT_Values.V[4], 4L, -3L, true);
+
+ /**
+ * Power Gems
+ */
+
+ GregtechItemList.Battery_Gem_1.set(this.addItem(tLastID = 66, "Proton Cell", "Reusable", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 8L), getTcAspectStack(TC_Aspects.METALLUM, 24L), getTcAspectStack(TC_Aspects.POTENTIA, 16L)}));
+ this.setElectricStats(32000 + tLastID, GT_Values.V[6] * 20 * 300 / 4, GT_Values.V[6], 6L, -3L, false);
+ GregtechItemList.Battery_Gem_2.set(this.addItem(tLastID = 68, "Electron Cell", "Reusable", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 16L), getTcAspectStack(TC_Aspects.METALLUM, 32L), getTcAspectStack(TC_Aspects.POTENTIA, 32L)}));
+ this.setElectricStats(32000 + tLastID, GT_Values.V[7] * 20 * 300 / 4, GT_Values.V[7], 7L, -3L, false);
+ GregtechItemList.Battery_Gem_3.set(this.addItem(tLastID = 70, "Quark Entanglement", "Reusable", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 32L), getTcAspectStack(TC_Aspects.METALLUM, 48L), getTcAspectStack(TC_Aspects.POTENTIA, 64L)}));
+ this.setElectricStats(32000 + tLastID, GT_Values.V[8] * 20 * 300 / 4, GT_Values.V[8], 8L, -3L, false);
+ //ItemUtils.addItemToOreDictionary(GregtechItemList.Battery_Gem_1.get(1), "batteryFutureBasic");
+ //ItemUtils.addItemToOreDictionary(GregtechItemList.Battery_Gem_2.get(1), "batteryFutureGood");
+ //ItemUtils.addItemToOreDictionary(GregtechItemList.Battery_Gem_3.get(1), "batteryFutureAdvanced");
+
+
+ /*GregtechItemList.Battery_RE_EV_Sodium.set(addItem(tLastID = 50, "Quad Cell Acid Battery", "Reusable", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 1L), getTcAspectStack(TC_Aspects.METALLUM, 1L), getTcAspectStack(TC_Aspects.POTENTIA, 1L)}));
+ setElectricStats(32000 + tLastID, 5000000L, GT_Values.V[2], 4L, -3L, true);
+
+ GregtechItemList.Battery_RE_EV_Sodium.set(addItem(tLastID = 50, "Quad Cell Mercury Battery", "Reusable", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 1L), getTcAspectStack(TC_Aspects.METALLUM, 1L), getTcAspectStack(TC_Aspects.POTENTIA, 1L)}));
+ setElectricStats(32000 + tLastID, 5000000L, GT_Values.V[2], 4L, -3L, true);*/
+
+ //RTG Pellet
+ GregtechItemList.Pellet_RTG_PU238.set(this.addItem(41, StringUtils.superscript("238")+"Pu Pellet", "", new Object[]{getTcAspectStack(TC_Aspects.RADIO, 4L), getTcAspectStack(TC_Aspects.POTENTIA, 2L), getTcAspectStack(TC_Aspects.METALLUM, 2L)}));
+ GregtechItemList.Pellet_RTG_SR90.set(this.addItem(42, StringUtils.superscript("90")+"Sr Pellet", "", new Object[]{getTcAspectStack(TC_Aspects.RADIO, 4L), getTcAspectStack(TC_Aspects.POTENTIA, 2L), getTcAspectStack(TC_Aspects.METALLUM, 2L)}));
+ GregtechItemList.Pellet_RTG_PO210.set(this.addItem(43, StringUtils.superscript("210")+"Po Pellet", "", new Object[]{getTcAspectStack(TC_Aspects.RADIO, 4L), getTcAspectStack(TC_Aspects.POTENTIA, 2L), getTcAspectStack(TC_Aspects.METALLUM, 2L)}));
+ GregtechItemList.Pellet_RTG_AM241.set(this.addItem(44, StringUtils.superscript("241")+"Am Pellet", "", new Object[]{getTcAspectStack(TC_Aspects.RADIO, 4L), getTcAspectStack(TC_Aspects.POTENTIA, 2L), getTcAspectStack(TC_Aspects.METALLUM, 2L)}));
+
+ CORE.RA.addFuelForRTG(GregtechItemList.Pellet_RTG_PU238.get(1), MathUtils.roundToClosestInt(87.7f), 64);
+ CORE.RA.addFuelForRTG(GregtechItemList.Pellet_RTG_SR90.get(1), MathUtils.roundToClosestInt(28.8f), 32);
+ CORE.RA.addFuelForRTG(GregtechItemList.Pellet_RTG_PO210.get(1), 1, 512);
+ CORE.RA.addFuelForRTG(GregtechItemList.Pellet_RTG_AM241.get(1), MathUtils.roundToClosestInt(432/2), 16);
+ CORE.RA.addFuelForRTG(GT_ModHandler.getIC2Item("RTGPellets", 1), MathUtils.roundToClosestInt(2.6f), 8);
+
+ //Computer Cube
+ GregtechItemList.Gregtech_Computer_Cube.set(this.addItem(tLastID = 55, "Gregtech Computer Cube", "Reusable", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 8L), getTcAspectStack(TC_Aspects.METALLUM, 8L), getTcAspectStack(TC_Aspects.POTENTIA, 8L)}));
+ this.setElectricStats(32000 + tLastID, GT_Values.V[6]* 10 * 60 * 20, GT_Values.V[5], 5L, -3L, true);
+
+ //FOOOOOOOOOOOOOOD
+ GregtechItemList.Food_Baked_Raisin_Bread.set(this.addItem(tLastID = 60, "Raisin Bread", "Extra Raisins, Just for ImQ009", new Object[]{new GT_FoodStat(5, 0.5F, EnumAction.eat, null, false, true, false, new int[0]), getTcAspectStack(TC_Aspects.CORPUS, 1L), getTcAspectStack(TC_Aspects.FAMES, 1L), getTcAspectStack(TC_Aspects.IGNIS, 1L)}));
+
+ if (!CORE.GTNH) {
+ GregtechItemList.Fluid_Cell_144L.set(this.addItem(tLastID = 61, "144L Invar Fluid Cell", "Holds exactly one dust worth of liquid.", new Object[]{new ItemData(Materials.Invar, (OrePrefixes.plate.mMaterialAmount * 8L) + (4L * OrePrefixes.ring.mMaterialAmount), new MaterialStack[0]), getTcAspectStack(TC_Aspects.VACUOS, 2L), getTcAspectStack(TC_Aspects.AQUA, 1L)}));
+ this.setFluidContainerStats(32000 + tLastID, 144L, 64L);
+
+ GregtechItemList.Fluid_Cell_36L.set(this.addItem(tLastID = 62, "36L Brass Fluid Cell", "Holds exactly one small dust worth of liquid.", new Object[]{new ItemData(Materials.Brass, (OrePrefixes.plate.mMaterialAmount * 8L) + (4L * OrePrefixes.ring.mMaterialAmount), new MaterialStack[0]), getTcAspectStack(TC_Aspects.VACUOS, 2L), getTcAspectStack(TC_Aspects.AQUA, 1L)}));
+ this.setFluidContainerStats(32000 + tLastID, 36L, 64L);
+
+ GregtechItemList.Fluid_Cell_16L.set(this.addItem(tLastID = 63, "16L Bronze Fluid Cell", "Holds exactly one tiny dust / nugget worth of liquid.", new Object[]{new ItemData(Materials.Bronze, (OrePrefixes.plate.mMaterialAmount * 8L) + (4L * OrePrefixes.ring.mMaterialAmount), new MaterialStack[0]), getTcAspectStack(TC_Aspects.VACUOS, 2L), getTcAspectStack(TC_Aspects.AQUA, 1L)}));
+ this.setFluidContainerStats(32000 + tLastID, 16L, 64L);
+
+ GregtechItemList.Fluid_Cell_1L.set(this.addItem(tLastID = 64, "1L Wrought Iron Fluid Cell", "Holds exactly one litre worth of liquid.", new Object[]{new ItemData(Materials.WroughtIron, (OrePrefixes.plate.mMaterialAmount * 8L) + (4L * OrePrefixes.ring.mMaterialAmount), new MaterialStack[0]), getTcAspectStack(TC_Aspects.VACUOS, 2L), getTcAspectStack(TC_Aspects.AQUA, 1L)}));
+ this.setFluidContainerStats(32000 + tLastID, 1L, 64L);
+ }
+
+
+
+ GregtechItemList.Cover_Overflow_ULV.set(this.addItem(71, "Overflow Valve (ULV)", "Maximum void amount: 8000", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 1L), getTcAspectStack(TC_Aspects.MACHINA, 1L), getTcAspectStack(TC_Aspects.ITER, 1L), getTcAspectStack(TC_Aspects.AQUA, 1L)}));
+ GregtechItemList.Cover_Overflow_LV.set(this.addItem(72, "Overflow Valve (LV)", "Maximum void amount: 64000", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 1L), getTcAspectStack(TC_Aspects.MACHINA, 1L), getTcAspectStack(TC_Aspects.ITER, 1L), getTcAspectStack(TC_Aspects.AQUA, 1L)}));
+ GregtechItemList.Cover_Overflow_MV.set(this.addItem(73, "Overflow Valve (MV)", "Maximum void amount: 512000", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 1L), getTcAspectStack(TC_Aspects.MACHINA, 1L), getTcAspectStack(TC_Aspects.ITER, 1L), getTcAspectStack(TC_Aspects.AQUA, 1L)}));
+ GregtechItemList.Cover_Overflow_HV.set(this.addItem(74, "Overflow Valve (HV)", "Maximum void amount: 4096000", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 1L), getTcAspectStack(TC_Aspects.MACHINA, 1L), getTcAspectStack(TC_Aspects.ITER, 1L), getTcAspectStack(TC_Aspects.AQUA, 1L)}));
+ GregtechItemList.Cover_Overflow_EV.set(this.addItem(75, "Overflow Valve (EV)", "Maximum void amount: 32768000", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 1L), getTcAspectStack(TC_Aspects.MACHINA, 1L), getTcAspectStack(TC_Aspects.ITER, 1L), getTcAspectStack(TC_Aspects.AQUA, 1L)}));
+ GregtechItemList.Cover_Overflow_IV.set(this.addItem(76, "Overflow Valve (IV)", "Maximum void amount: 262144000", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 1L), getTcAspectStack(TC_Aspects.MACHINA, 1L), getTcAspectStack(TC_Aspects.ITER, 1L), getTcAspectStack(TC_Aspects.AQUA, 1L)}));
+
+ GregTech_API.registerCover(GregtechItemList.Cover_Overflow_ULV.get(1L), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[4][0], new GT_RenderedTexture(TexturesGtBlock.Overlay_Overflow_Valve)}), new GTPP_Cover_Overflow(8));
+ GregTech_API.registerCover(GregtechItemList.Cover_Overflow_LV.get(1L), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[4][0], new GT_RenderedTexture(TexturesGtBlock.Overlay_Overflow_Valve)}), new GTPP_Cover_Overflow(64));
+ GregTech_API.registerCover(GregtechItemList.Cover_Overflow_MV.get(1L), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[5][0], new GT_RenderedTexture(TexturesGtBlock.Overlay_Overflow_Valve)}), new GTPP_Cover_Overflow(512));
+ GregTech_API.registerCover(GregtechItemList.Cover_Overflow_HV.get(1L), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[5][0], new GT_RenderedTexture(TexturesGtBlock.Overlay_Overflow_Valve)}), new GTPP_Cover_Overflow(4096));
+ GregTech_API.registerCover(GregtechItemList.Cover_Overflow_EV.get(1L), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[8][0], new GT_RenderedTexture(TexturesGtBlock.Overlay_Overflow_Valve)}), new GTPP_Cover_Overflow(32768));
+ GregTech_API.registerCover(GregtechItemList.Cover_Overflow_IV.get(1L), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[8][0], new GT_RenderedTexture(TexturesGtBlock.Overlay_Overflow_Valve)}), new GTPP_Cover_Overflow(262144));
+
+ //Fusion Reactor MK4 Singularity
+ GregtechItemList.Compressed_Fusion_Reactor.set(this.addItem(100, "Hypervisor Matrix (Fusion)", "A memory unit containing an RI (Restricted Intelligence)"));
+
+
+ //NanoTubes
+ GregtechItemList.NanoTube_Base_Substrate.set(this.addItem(101, "Silicon Base Substrate", "Used in the production of Carbon Nanotubes"));
+ GregtechItemList.NanoTube_Finished.set(this.addItem(102, "Carbon Nanotubes", "Multi-walled Zigzag nanotubes, possibly Carbon's final form"));
+ GregtechItemList.Carbyne_Tube_Finished.set(this.addItem(103, "Linear Acetylenic Carbon (LAC/Carbyne)", "LAC chains grown inside Multi-walled Carbon Nanotubes, highly stable"));
+ GregtechItemList.Carbyne_Sheet_Finished.set(this.addItem(104, "Carbyne Composite Panel", "Nanotubes which contain LAC, arranged side by side and compressed further"));
+ GregtechItemList.Laser_Lens_Special.set(this.addItem(105, "Quantum Anomaly", "Probably should shoot it with lasers"));
+
+ GregtechItemList.Battery_Casing_Gem_1.set(this.addItem(106, "Containment Unit I", "Used in crafting"));
+ GregtechItemList.Battery_Casing_Gem_2.set(this.addItem(107, "Containment Unit II", "Used in crafting"));
+ GregtechItemList.Battery_Casing_Gem_3.set(this.addItem(108, "Advanced Containment Unit", "Used in crafting"));
+ GregtechItemList.Battery_Casing_Gem_4.set(this.addItem(109, "Exotic Containment Unit", "Used in crafting"));
+
+ GregtechItemList.Battery_Gem_4.set(this.addItem(tLastID = 110, "Graviton Anomaly", "Reusable", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 64L), getTcAspectStack(TC_Aspects.METALLUM, 64L), getTcAspectStack(TC_Aspects.POTENTIA, 64L)}));
+ this.setElectricStats(32000 + tLastID, (64000000000L*16), GT_Values.V[9], 9L, -3L, false);
+
+
+
+ /*
+ * Bombs
+ */
+ GregtechItemList.Bomb_Cast.set(this.addItem(111, "Bomb Cast", "Used in the production of Bombs"));
+ GregtechItemList.Bomb_Cast_Molten.set(this.addItem(112, "Bomb Cast (Hot)", "Consider cooling this off"));
+ GregtechItemList.Bomb_Cast_Set.set(this.addItem(113, "Bomb Cast (Set)", "Break it open for the goodies inside!"));
+ GregtechItemList.Bomb_Cast_Broken.set(this.addItem(114, "Bomb Cast (Broken)", "This is probably just junk"));
+ GregtechItemList.Bomb_Cast_Mold.set(this.addItem(115, "Mold (Bomb Cast)", "Used in the production of Bombs"));
+
+ /*
+ * High Tier 'Saws' for the tree Farm
+ */
+ GregtechItemList.Farm_Processor_EV.set(this.addItem(tLastID = 120, "Farm Processor [EV]", "Reusable", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 8L), getTcAspectStack(TC_Aspects.METALLUM, 8L), getTcAspectStack(TC_Aspects.POTENTIA, 8L)}));
+ this.setElectricStats(32000 + tLastID, GT_Values.V[5]* 10 * 60 * 20, GT_Values.V[4], 4L, -3L, false);
+ GregtechItemList.Farm_Processor_IV.set(this.addItem(tLastID = 122, "Farm Processor [IV]", "Reusable", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 8L), getTcAspectStack(TC_Aspects.METALLUM, 8L), getTcAspectStack(TC_Aspects.POTENTIA, 8L)}));
+ this.setElectricStats(32000 + tLastID, GT_Values.V[6]* 10 * 60 * 20, GT_Values.V[5], 5L, -3L, false);
+ GregtechItemList.Farm_Processor_LuV.set(this.addItem(tLastID = 124, "Farm Processor [LuV]", "Reusable", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 8L), getTcAspectStack(TC_Aspects.METALLUM, 8L), getTcAspectStack(TC_Aspects.POTENTIA, 8L)}));
+ this.setElectricStats(32000 + tLastID, GT_Values.V[7]* 10 * 60 * 20, GT_Values.V[6], 6L, -3L, false);
+ GregtechItemList.Farm_Processor_ZPM.set(this.addItem(tLastID = 126, "Farm Processor [ZPM]", "Reusable", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 8L), getTcAspectStack(TC_Aspects.METALLUM, 8L), getTcAspectStack(TC_Aspects.POTENTIA, 8L)}));
+ this.setElectricStats(32000 + tLastID, GT_Values.V[8]* 10 * 60 * 20, GT_Values.V[7], 7L, -3L, false);
+ GregtechItemList.Farm_Processor_UV.set(this.addItem(tLastID = 128, "Farm Processor [UV]", "Reusable", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 8L), getTcAspectStack(TC_Aspects.METALLUM, 8L), getTcAspectStack(TC_Aspects.POTENTIA, 8L)}));
+ this.setElectricStats(32000 + tLastID, GT_Values.V[9]* 10 * 60 * 20, GT_Values.V[8], 8L, -3L, false);
+
+ String aTierName;
+ int aFirstMachineCasingID = 130;
+ GregtechItemList[] mMachineCasingCovers = new GregtechItemList[] {
+ GregtechItemList.FakeMachineCasingPlate_ULV,
+ GregtechItemList.FakeMachineCasingPlate_LV,
+ GregtechItemList.FakeMachineCasingPlate_MV,
+ GregtechItemList.FakeMachineCasingPlate_HV,
+ GregtechItemList.FakeMachineCasingPlate_EV,
+ GregtechItemList.FakeMachineCasingPlate_IV,
+ GregtechItemList.FakeMachineCasingPlate_LuV,
+ GregtechItemList.FakeMachineCasingPlate_ZPM,
+ GregtechItemList.FakeMachineCasingPlate_UV,
+ GregtechItemList.FakeMachineCasingPlate_MAX,
+ };
+ for (int i=0;i<10;i++) {
+ if (i==10) {
+ break;
+ }
+ else {
+ aTierName = GT_Values.VN[i];
+ mMachineCasingCovers[i].set(this.addItem(aFirstMachineCasingID++, aTierName+" Machine Plate Cover", "Deprecated - Shapeless Craft to new version", new Object[]{}));
+ GregTech_API.registerCover(mMachineCasingCovers[i].get(1L), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[i][0]}), new GTPP_Cover_ToggleVisual());
+ }
+ }
+ GregtechItemList.Laser_Lens_WoodsGlass.set(this.addItem(140, "Wood's Glass Lens", "Allows UV & IF to pass through, blocks visible light spectrums"));
+
+ int aStartID = 141;
+ GregtechItemList[] aTransParts = new GregtechItemList[] {
+ GregtechItemList.TransmissionComponent_ULV,
+ GregtechItemList.TransmissionComponent_LV,
+ GregtechItemList.TransmissionComponent_MV,
+ GregtechItemList.TransmissionComponent_HV,
+ GregtechItemList.TransmissionComponent_EV,
+ GregtechItemList.TransmissionComponent_IV,
+ GregtechItemList.TransmissionComponent_LuV,
+ GregtechItemList.TransmissionComponent_ZPM,
+ GregtechItemList.TransmissionComponent_UV,
+ GregtechItemList.TransmissionComponent_MAX,
+ };
+ for (int aIndex=0;aIndex<10;aIndex++){
+ aTransParts[aIndex].set(this.addItem(aStartID++, "Transmission Component ("+GT_Values.VN[aIndex]+")", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, aIndex), getTcAspectStack(TC_Aspects.MACHINA, aIndex), getTcAspectStack(TC_Aspects.MAGNETO, aIndex)}));
+ }
+
+ // Distillus Chip
+ GregtechItemList.Distillus_Upgrade_Chip.set(this.addItem(151, "Upgrade Chip", "Used to upgrade Distillus to Tier 2"));
+
+
+ GregtechItemList.Chip_MultiNerf_NoOutputBonus.set(this.addItem(160, "No-Bonus Chip", "You won't like using this"));
+ GregtechItemList.Chip_MultiNerf_NoSpeedBonus.set(this.addItem(161, "No-Bonus Chip", "You won't like using this"));
+ GregtechItemList.Chip_MultiNerf_NoEuBonus.set(this.addItem(162, "No-Bonus Chip", "You won't like using this"));
+
+
+ /*
+ GregtechItemList.Cover_Overflow_Item_ULV.set(this.addItem(165, "Item Overflow Valve (ULV)", "Maximum void amount: 8000", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 1L), getTcAspectStack(TC_Aspects.MACHINA, 1L), getTcAspectStack(TC_Aspects.ITER, 1L), getTcAspectStack(TC_Aspects.AQUA, 1L)}));
+ GregtechItemList.Cover_Overflow_Item_LV.set(this.addItem(166, "Item Overflow Valve (LV)", "Maximum void amount: 64000", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 1L), getTcAspectStack(TC_Aspects.MACHINA, 1L), getTcAspectStack(TC_Aspects.ITER, 1L), getTcAspectStack(TC_Aspects.AQUA, 1L)}));
+ GregtechItemList.Cover_Overflow_Item_MV.set(this.addItem(167, "Item Overflow Valve (MV)", "Maximum void amount: 512000", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 1L), getTcAspectStack(TC_Aspects.MACHINA, 1L), getTcAspectStack(TC_Aspects.ITER, 1L), getTcAspectStack(TC_Aspects.AQUA, 1L)}));
+ GregtechItemList.Cover_Overflow_Item_HV.set(this.addItem(168, "Item Overflow Valve (HV)", "Maximum void amount: 4096000", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 1L), getTcAspectStack(TC_Aspects.MACHINA, 1L), getTcAspectStack(TC_Aspects.ITER, 1L), getTcAspectStack(TC_Aspects.AQUA, 1L)}));
+ GregtechItemList.Cover_Overflow_Item_EV.set(this.addItem(169, "Item Overflow Valve (EV)", "Maximum void amount: 32768000", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 1L), getTcAspectStack(TC_Aspects.MACHINA, 1L), getTcAspectStack(TC_Aspects.ITER, 1L), getTcAspectStack(TC_Aspects.AQUA, 1L)}));
+ GregtechItemList.Cover_Overflow_Item_IV.set(this.addItem(170, "Item Overflow Valve (IV)", "Maximum void amount: 262144000", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 1L), getTcAspectStack(TC_Aspects.MACHINA, 1L), getTcAspectStack(TC_Aspects.ITER, 1L), getTcAspectStack(TC_Aspects.AQUA, 1L)}));
+
+ GregTech_API.registerCover(GregtechItemList.Cover_Overflow_Item_ULV.get(1L), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[4][0], new GT_RenderedTexture(TexturesGtBlock.Overlay_Overflow_Valve)}), new GTPP_Cover_Overflow_Item(8));
+ GregTech_API.registerCover(GregtechItemList.Cover_Overflow_Item_LV.get(1L), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[4][0], new GT_RenderedTexture(TexturesGtBlock.Overlay_Overflow_Valve)}), new GTPP_Cover_Overflow_Item(64));
+ GregTech_API.registerCover(GregtechItemList.Cover_Overflow_Item_MV.get(1L), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[5][0], new GT_RenderedTexture(TexturesGtBlock.Overlay_Overflow_Valve)}), new GTPP_Cover_Overflow_Item(512));
+ GregTech_API.registerCover(GregtechItemList.Cover_Overflow_Item_HV.get(1L), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[5][0], new GT_RenderedTexture(TexturesGtBlock.Overlay_Overflow_Valve)}), new GTPP_Cover_Overflow_Item(4096));
+ GregTech_API.registerCover(GregtechItemList.Cover_Overflow_Item_EV.get(1L), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[8][0], new GT_RenderedTexture(TexturesGtBlock.Overlay_Overflow_Valve)}), new GTPP_Cover_Overflow_Item(32768));
+ GregTech_API.registerCover(GregtechItemList.Cover_Overflow_Item_IV.get(1L), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[8][0], new GT_RenderedTexture(TexturesGtBlock.Overlay_Overflow_Valve)}), new GTPP_Cover_Overflow_Item(262144));
+ */
+ }
+
+ private boolean registerComponents_ULV(){
+ GregtechItemList.Electric_Pump_ULV.set(this.addItem(32, "Electric Pump (ULV)", "160 L/sec (as Cover)", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 1L), getTcAspectStack(TC_Aspects.MACHINA, 1L), getTcAspectStack(TC_Aspects.ITER, 1L), getTcAspectStack(TC_Aspects.AQUA, 1L)}));
+ GregtechItemList.Electric_Motor_ULV.set(this.addItem(33, "Electric Motor (ULV)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 1L), getTcAspectStack(TC_Aspects.MACHINA, 1L), getTcAspectStack(TC_Aspects.MOTUS, 1L)}));
+ GregtechItemList.Conveyor_Module_ULV.set(this.addItem(34, "Conveyor Module (ULV)", "1 Stack every 80 secs (as Cover)", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 1L), getTcAspectStack(TC_Aspects.MACHINA, 1L), getTcAspectStack(TC_Aspects.ITER, 1L)}));
+ GregtechItemList.Electric_Piston_ULV.set(this.addItem(35, "Electric Piston (ULV)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 1L), getTcAspectStack(TC_Aspects.MACHINA, 2L), getTcAspectStack(TC_Aspects.MOTUS, 1L)}));
+ GregtechItemList.Robot_Arm_ULV.set(this.addItem(36, "Robot Arm (ULV)", "Inserts into specific Slots (as Cover)", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 1L), getTcAspectStack(TC_Aspects.MACHINA, 2L), getTcAspectStack(TC_Aspects.MOTUS, 1L), Utils.getTcAspectStack("COGNITIO", 1L)}));
+ GregtechItemList.Field_Generator_ULV.set(this.addItem(37, "Field Generator (ULV)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 2L), getTcAspectStack(TC_Aspects.MACHINA, 1L), getTcAspectStack(TC_Aspects.TUTAMEN, 1L)}));
+ GregtechItemList.Emitter_ULV.set(this.addItem(38, "Emitter (ULV)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 1L), getTcAspectStack(TC_Aspects.MACHINA, 1L), getTcAspectStack(TC_Aspects.LUX, 1L)}));
+ GregtechItemList.Sensor_ULV.set(this.addItem(39, "Sensor (ULV)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 1L), getTcAspectStack(TC_Aspects.MACHINA, 1L), getTcAspectStack(TC_Aspects.SENSUS, 1L)}));
+
+ GregTech_API.registerCover(GregtechItemList.Electric_Pump_ULV.get(1L), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[5][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PUMP)}), new GT_Cover_Pump(8));
+ GregTech_API.registerCover(GregtechItemList.Conveyor_Module_ULV.get(1L), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[1][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_CONVEYOR)}), new GT_Cover_Conveyor(1600));
+ GregTech_API.registerCover(GregtechItemList.Robot_Arm_ULV.get(1L), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[1][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_ARM)}), new GT_Cover_Arm(1600));
+
+ return true;
+ }
+
+ private boolean registerComponents_MAX(){
+ GregtechItemList.Electric_Pump_MAX.set(this.addItem(3, "Electric Pump (MAX)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 8L), getTcAspectStack(TC_Aspects.MACHINA, 8L), getTcAspectStack(TC_Aspects.ITER, 8L), getTcAspectStack(TC_Aspects.AQUA, 8L)}));
+ GregtechItemList.Electric_Motor_MAX.set(this.addItem(7, "Electric Motor (MAX)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 8L), getTcAspectStack(TC_Aspects.MACHINA, 8L), getTcAspectStack(TC_Aspects.MOTUS, 8L)}));
+ GregtechItemList.Conveyor_Module_MAX.set(this.addItem(11, "Conveyor Module (MAX)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 8L), getTcAspectStack(TC_Aspects.MACHINA, 8L), getTcAspectStack(TC_Aspects.ITER, 8L)}));
+ GregtechItemList.Electric_Piston_MAX.set(this.addItem(15, "Electric Piston (MAX)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 8L), getTcAspectStack(TC_Aspects.MACHINA, 16L), getTcAspectStack(TC_Aspects.MOTUS, 8L)}));
+ GregtechItemList.Robot_Arm_MAX.set(this.addItem(19, "Robot Arm (MAX)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 8L), getTcAspectStack(TC_Aspects.MACHINA, 16L), getTcAspectStack(TC_Aspects.MOTUS, 8L), getTcAspectStack("COGNITIO", 8L)}));
+ GregtechItemList.Field_Generator_MAX.set(this.addItem(23, "Field Generator (MAX)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 16L), getTcAspectStack(TC_Aspects.MACHINA, 8L), getTcAspectStack(TC_Aspects.TUTAMEN, 8L)}));
+ GregtechItemList.Emitter_MAX.set(this.addItem(27, "Emitter (MAX)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 8L), getTcAspectStack(TC_Aspects.MACHINA, 8L), getTcAspectStack(TC_Aspects.LUX, 8L)}));
+ GregtechItemList.Sensor_MAX.set(this.addItem(31, "Sensor (MAX)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 8L), getTcAspectStack(TC_Aspects.MACHINA, 8L), getTcAspectStack(TC_Aspects.SENSUS, 8L)}));
+
+ GregTech_API.registerCover(GregtechItemList.Electric_Pump_MAX.get(1L), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[8][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PUMP)}), new GT_Cover_Pump(524288));
+ GregTech_API.registerCover(GregtechItemList.Conveyor_Module_MAX.get(1L), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[4][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_CONVEYOR)}), new GT_Cover_Conveyor(4));
+ GregTech_API.registerCover(GregtechItemList.Robot_Arm_MAX.get(1L), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[4][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_ARM)}), new GT_Cover_Arm(4));
+
+
+ return true;
+ }
+
+ public boolean registerOldCircuits(){
+ //Enable Old Circuits
+ Logger.INFO("[Old Feature - Circuits] Enabling Pre-5.09.28 Circuits and Data Storage.");
+
+ GregtechItemList.Old_Circuit_Primitive.set(this.addItem(200, "NAND Chip", "A very simple Circuit", new Object[]{OrePrefixes.circuit.get(Materials.Primitive)}));
+ GregtechItemList.Old_Circuit_Basic.set(this.addItem(201, "Basic Electronic Circuit", "A basic Circuit", new Object[]{OrePrefixes.circuit.get(Materials.Basic)}));
+ GregtechItemList.Old_Circuit_Good.set(this.addItem(202, "Good Electronic Circuit", "A good Circuit", new Object[]{OrePrefixes.circuit.get(Materials.Good)}));
+ GregtechItemList.Old_Circuit_Advanced.set(this.addItem(203, "Advanced Circuit", "An advanced Circuit", new Object[]{OrePrefixes.circuit.get(Materials.Advanced)}));
+ GregtechItemList.Old_Circuit_Data.set(this.addItem(204, "Data Storage Circuit", "A Data Storage Chip", new Object[]{OrePrefixes.circuit.get(Materials.Data)}));
+ GregtechItemList.Old_Circuit_Elite.set(this.addItem(205, "Data Control Circuit", "A Processor", new Object[]{OrePrefixes.circuit.get(Materials.Elite)}));
+ GregtechItemList.Old_Circuit_Master.set(this.addItem(206, "Energy Flow Circuit", "A High Voltage Processor", new Object[]{OrePrefixes.circuit.get(Materials.Master)}));
+
+ GregtechItemList.Old_Tool_DataOrb.set(this.addItem(207, "Data Orb [GT++]", "A High Capacity Data Storage", new Object[]{OrePrefixes.circuit.get(Materials.Ultimate), SubTag.NO_UNIFICATION, new Behaviour_DataOrb()}));
+ GregtechItemList.Old_Circuit_Ultimate.set(GregtechItemList.Old_Tool_DataOrb.get(1L));
+ GT_ModHandler.addShapelessCraftingRecipe(GregtechItemList.Old_Tool_DataOrb.get(1L), GT_ModHandler.RecipeBits.NOT_REMOVABLE, new Object[]{GregtechItemList.Old_Tool_DataOrb.get(1L)});
+
+ GregtechItemList.Old_Tool_DataStick.set(this.addItem(208, "Data Stick [GT++]", "A Low Capacity Data Storage", new Object[]{OrePrefixes.circuit.get(Materials.Data), SubTag.NO_UNIFICATION, new Behaviour_DataStick()}));
+ GT_ModHandler.addShapelessCraftingRecipe(GregtechItemList.Old_Tool_DataStick.get(1L), GT_ModHandler.RecipeBits.NOT_REMOVABLE, new Object[]{GregtechItemList.Old_Tool_DataStick.get(1L)});
+
+ GregtechItemList.Old_Circuit_Board_Basic.set(this.addItem(210, "Basic Circuit Board", "A basic Board"));
+ GregtechItemList.Old_Circuit_Board_Advanced.set(this.addItem(211, "Advanced Circuit Board", "An advanced Board"));
+ GregtechItemList.Old_Circuit_Board_Elite.set(this.addItem(212, "Processor Board", "A Processor Board"));
+ GregtechItemList.Old_Circuit_Parts_Crystal_Chip_Elite.set(this.addItem(213, "Engraved Crystal Chip", "Needed for Circuits"));
+ GregtechItemList.Old_Circuit_Parts_Crystal_Chip_Master.set(this.addItem(214, "Engraved Lapotron Chip", "Needed for Circuits"));
+ GregtechItemList.Old_Circuit_Parts_Advanced.set(this.addItem(215, "Advanced Circuit Parts", "Advanced Circuit Parts"));
+ GregtechItemList.Old_Circuit_Parts_Wiring_Basic.set(this.addItem(216, "Etched Medium Voltage Wiring", "Part of Circuit Boards"));
+ GregtechItemList.Old_Circuit_Parts_Wiring_Advanced.set(this.addItem(217, "Etched High Voltage Wiring", "Part of Circuit Boards"));
+ GregtechItemList.Old_Circuit_Parts_Wiring_Elite.set(this.addItem(218, "Etched Extreme Voltage Wiring", "Part of Circuit Boards"));
+ GregtechItemList.Old_Empty_Board_Basic.set(this.addItem(219, "Empty Circuit Board", "A Board Part"));
+ GregtechItemList.Old_Empty_Board_Elite.set(this.addItem(220, "Empty Processor Board", "A Processor Board Part"));
+
+ return true;
+ }
+
+ public boolean registerCustomCircuits() {
+ if (CORE.ConfigSwitches.enableCustomCircuits){
+ GregtechItemList.Circuit_IV.set(this.addItem(704, "Symbiotic Circuit (IV)", "A Symbiotic Data Processor", new Object[]{GregtechOrePrefixes.circuit.get(GT_Materials.Symbiotic)}));
+ GregtechItemList.Circuit_LuV.set(this.addItem(705, "Neutronic Circuit (LuV)", "A Neutron Particle Processor", new Object[]{GregtechOrePrefixes.circuit.get(GT_Materials.Neutronic)}));
+ GregtechItemList.Circuit_ZPM.set(this.addItem(706, "Quantum Circuit (ZPM)", "A Singlularity Processor", new Object[]{GregtechOrePrefixes.circuit.get(GT_Materials.Quantum)}));
+ GregtechItemList.Circuit_Board_IV.set(this.addItem(710, "IV Circuit Board", "An IV Voltage Rated Circuit Board"));
+ GregtechItemList.Circuit_Board_LuV.set(this.addItem(711, "LuV Circuit Board", "An LuV Voltage Rated Circuit Board"));
+ GregtechItemList.Circuit_Board_ZPM.set(this.addItem(712, "ZPM Processor Board", "A ZPM Voltage Rated Processor Board"));
+ GregtechItemList.Circuit_Parts_Crystal_Chip_IV.set(this.addItem(713, "(IV) Energized Crystal Chip", "Needed for Circuits"));
+ GregtechItemList.Circuit_Parts_Crystal_Chip_LuV.set(this.addItem(714, "(LuV) Neutron based Microchip", "Needed for Circuits"));
+ GregtechItemList.Circuit_Parts_Crystal_Chip_ZPM.set(this.addItem(715, "(ZPM) Quantum Chip", "Needed for Circuits"));
+ GregtechItemList.Circuit_Parts_IV.set(this.addItem(716, "(IV) Energized Circuit Parts", "Circuit Parts"));
+ GregtechItemList.Circuit_Parts_LuV.set(this.addItem(717, "(LuV) Neutron-based Circuit Parts", "Circuit Parts"));
+ GregtechItemList.Circuit_Parts_ZPM.set(this.addItem(718, "(ZPM) Quantum Circuit Parts", "Circuit Parts"));
+ GregtechItemList.Circuit_Parts_Wiring_IV.set(this.addItem(719, "Etched IV Voltage Wiring", "Part of Circuit Boards"));
+ GregtechItemList.Circuit_Parts_Wiring_LuV.set(this.addItem(720, "Etched LuV Voltage Wiring", "Part of Circuit Boards"));
+ GregtechItemList.Circuit_Parts_Wiring_ZPM.set(this.addItem(721, "Etched ZPM Voltage Wiring", "Part of Circuit Boards"));
+ ItemUtils.addItemToOreDictionary(GregtechItemList.Circuit_IV.get(1), "circuitSuperconductor");
+ ItemUtils.addItemToOreDictionary(GregtechItemList.Circuit_LuV.get(1), "circuitInfinite");
+ return true;
+ }
+ return false;
+ }
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechTools.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechTools.java
new file mode 100644
index 0000000000..14100d1599
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechTools.java
@@ -0,0 +1,101 @@
+package gtPlusPlus.xmod.gregtech.common.items;
+
+import java.lang.reflect.Field;
+
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.TC_Aspects;
+import gregtech.api.enums.ToolDictNames;
+import gregtech.api.items.GT_MetaGenerated_Tool;
+import gregtech.api.objects.GT_HashSet;
+import gregtech.api.objects.GT_ItemStack;
+import gtPlusPlus.core.util.reflect.ReflectionUtils;
+import gtPlusPlus.xmod.gregtech.api.enums.GregtechToolDictNames;
+import gtPlusPlus.xmod.gregtech.common.tools.TOOL_Gregtech_AngleGrinder;
+import gtPlusPlus.xmod.gregtech.common.tools.TOOL_Gregtech_Choocher;
+import gtPlusPlus.xmod.gregtech.common.tools.TOOL_Gregtech_ElectricButcherKnife;
+import gtPlusPlus.xmod.gregtech.common.tools.TOOL_Gregtech_ElectricLighter;
+import gtPlusPlus.xmod.gregtech.common.tools.TOOL_Gregtech_ElectricSnips;
+
+public class MetaGeneratedGregtechTools extends GT_MetaGenerated_Tool {
+
+ public static final short ELECTRIC_LIGHTER = 7534;
+ public static final short ELECTRIC_BUTCHER_KNIFE = 7634;
+ public static final short SKOOKUM_CHOOCHER = 7734;
+ public static final short ANGLE_GRINDER = 7834;
+ public static final short ELECTRIC_SNIPS = 7934;
+ public static GT_MetaGenerated_Tool INSTANCE;
+
+ static {
+ INSTANCE = new MetaGeneratedGregtechTools();
+ }
+
+ public static GT_MetaGenerated_Tool getInstance() {
+ return INSTANCE;
+ }
+
+
+ private MetaGeneratedGregtechTools() {
+ super("plusplus.metatool.01");
+ // Skookum Choocher
+ GregTech_API.registerTool(this.addTool(SKOOKUM_CHOOCHER, "Skookum Choocher",
+ "Can Really Chooch. Does a Skookum job at Hammering and Wrenching stuff.", new TOOL_Gregtech_Choocher(),
+ new Object[] { GregtechToolDictNames.craftingToolSkookumChoocher, ToolDictNames.craftingToolHardHammer,
+ ToolDictNames.craftingToolWrench, new TC_Aspects.TC_AspectStack(TC_Aspects.INSTRUMENTUM, 2L),
+ new TC_Aspects.TC_AspectStack(TC_Aspects.FABRICO, 2L),
+ new TC_Aspects.TC_AspectStack(TC_Aspects.ORDO, 2L) }),
+ GregTech_API.sWrenchList);
+
+ // Electric File
+ this.addTool(ANGLE_GRINDER, "Angle Grinder", "Hand-held electric filing device",
+ new TOOL_Gregtech_AngleGrinder(),
+ new Object[] { GregtechToolDictNames.craftingToolAngleGrinder, ToolDictNames.craftingToolFile,
+ new TC_Aspects.TC_AspectStack(TC_Aspects.INSTRUMENTUM, 2L),
+ new TC_Aspects.TC_AspectStack(TC_Aspects.FABRICO, 2L),
+ new TC_Aspects.TC_AspectStack(TC_Aspects.ORDO, 2L) });
+
+ GT_HashSet<GT_ItemStack> aWireCutterList = new GT_HashSet<GT_ItemStack>();
+ //Does not exist prior to 5.09.32, use an empty field if we can't find the existing one.
+ if (ReflectionUtils.doesFieldExist(GregTech_API.class, "sWireCutterList")) {
+ Field sWireCutterList = ReflectionUtils.getField(GregTech_API.class, "sWireCutterList");
+ try {
+ if (sWireCutterList != null) {
+ Object val = sWireCutterList.get(null);
+ if (val != null && val instanceof GT_HashSet) {
+ aWireCutterList = (GT_HashSet<GT_ItemStack>) val;
+ }
+ }
+
+ }
+ catch (IllegalArgumentException | IllegalAccessException e) {
+ // Not found, so it's GT 5.09.31 or earlier.
+ }
+ }
+
+ // Electric Wire Cutter
+ GregTech_API.registerTool(
+ this.addTool(ELECTRIC_SNIPS, "Automatic Snips", "Hand-held electric wire cutter",
+ new TOOL_Gregtech_ElectricSnips(),
+ new Object[] { GregtechToolDictNames.craftingToolElectricSnips, ToolDictNames.craftingToolWireCutter,
+ new TC_Aspects.TC_AspectStack(TC_Aspects.INSTRUMENTUM, 4L),
+ new TC_Aspects.TC_AspectStack(TC_Aspects.FABRICO, 4L),
+ new TC_Aspects.TC_AspectStack(TC_Aspects.ORDO, 4L) }), aWireCutterList);
+
+
+ // Electric Lighter
+ this.addTool(ELECTRIC_LIGHTER, "Pyromatic 9k", "Electric Fire!",
+ new TOOL_Gregtech_ElectricLighter(),
+ new Object[] { GregtechToolDictNames.craftingToolElectricLighter,
+ new TC_Aspects.TC_AspectStack(TC_Aspects.INSTRUMENTUM, 2L),
+ new TC_Aspects.TC_AspectStack(TC_Aspects.FABRICO, 2L),
+ new TC_Aspects.TC_AspectStack(TC_Aspects.ORDO, 2L) });
+
+ // Electric Butcher Knife
+ this.addTool(ELECTRIC_BUTCHER_KNIFE, "Meat-o-matic", "Electric butcher knife",
+ new TOOL_Gregtech_ElectricButcherKnife(),
+ new Object[] { GregtechToolDictNames.craftingToolElectricButcherKnife, ToolDictNames.craftingToolKnife,
+ new TC_Aspects.TC_AspectStack(TC_Aspects.INSTRUMENTUM, 1L),
+ new TC_Aspects.TC_AspectStack(TC_Aspects.FABRICO, 2L),
+ new TC_Aspects.TC_AspectStack(TC_Aspects.ORDO, 2L) });
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Choocher.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Choocher.java
new file mode 100644
index 0000000000..f82e0e5cb0
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Choocher.java
@@ -0,0 +1,88 @@
+package gtPlusPlus.xmod.gregtech.common.items.behaviours;
+
+import java.util.List;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.world.World;
+
+import gregtech.api.items.GT_MetaBase_Item;
+import gregtech.api.util.GT_LanguageManager;
+import gregtech.common.items.behaviors.Behaviour_None;
+import gregtech.common.items.behaviors.Behaviour_Wrench;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.minecraft.NBTUtils;
+import gtPlusPlus.core.util.minecraft.PlayerUtils;
+
+public class Behaviour_Choocher
+extends Behaviour_None {
+ private boolean isWrench = true;
+ private final Behaviour_Wrench wrench = new Behaviour_Wrench(150);
+ private final Behaviour_Prospecting_Ex prospecting = new Behaviour_Prospecting_Ex(10, 1250);
+ private final String mTooltip1 = GT_LanguageManager.addStringLocalization("gt.behaviour.choochering1", "Current tool mode: ");
+ private final String mTooltip2 = GT_LanguageManager.addStringLocalization("gt.behaviour.choochering2", "Change tool mode using Shift+Rightclick.");
+ private final String mTooltipH = GT_LanguageManager.addStringLocalization("gt.behaviour.prospectingEx", "Usable for Prospecting large areas.");
+ private final String mTooltipW = GT_LanguageManager.addStringLocalization("gt.behaviour.wrench", "Rotates Blocks on Rightclick.");
+
+ public Behaviour_Choocher() {
+
+ }
+
+ @Override
+ public boolean onItemUseFirst(final GT_MetaBase_Item aItem, final ItemStack aStack, final EntityPlayer aPlayer, final World aWorld, final int aX, final int aY, final int aZ, final int aSide, final float hitX, final float hitY, final float hitZ) {
+ if (aWorld.isRemote) {
+ return false;
+ }
+
+ boolean inWrenchMode;
+ if (NBTUtils.hasKey(aStack, "aMode")) {
+ inWrenchMode = NBTUtils.getBoolean(aStack, "aMode");
+ }
+ else {
+ aStack.getTagCompound().setBoolean("aMode", true);
+ inWrenchMode = true;
+ }
+
+ if (aPlayer.isSneaking()){
+ boolean aModeNew = Utils.invertBoolean(inWrenchMode);
+ aStack.getTagCompound().setBoolean("aMode", aModeNew);
+ PlayerUtils.messagePlayer(aPlayer, "Mode: "+(aModeNew ? "Wrench" : "Hammer"));
+ return true;
+ }
+ else {
+ if (inWrenchMode){
+ return this.wrench.onItemUseFirst(aItem, aStack, aPlayer, aWorld, aSide, aSide, aSide, aSide, hitZ, hitZ, hitZ);
+ }
+ else {
+ return this.prospecting.onItemUseFirst(aItem, aStack, aPlayer, aWorld, aX, aY, aZ, aSide, hitX, hitY, hitZ);
+ }
+ }
+ }
+
+ @Override
+ public List<String> getAdditionalToolTips(final GT_MetaBase_Item aItem, final List<String> aList, final ItemStack aStack) {
+
+ boolean inWrenchMode;
+ if (NBTUtils.hasKey(aStack, "aMode")) {
+ inWrenchMode = NBTUtils.getBoolean(aStack, "aMode");
+ }
+ else {
+ NBTUtils.setBoolean(aStack, "aMode", true);
+ aStack.getTagCompound().setBoolean("aMode", true);
+ inWrenchMode = true;
+ }
+
+
+ if (inWrenchMode){
+ aList.add(this.mTooltip1+"Wrench");
+ aList.add(this.mTooltipW);
+ }
+ else {
+ aList.add(this.mTooltip1+"Prospecting");
+ aList.add(this.mTooltipH);
+ }
+ aList.add(this.mTooltip2);
+
+ return aList;
+ }
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Electric_Lighter.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Electric_Lighter.java
new file mode 100644
index 0000000000..422a29c34e
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Electric_Lighter.java
@@ -0,0 +1,220 @@
+package gtPlusPlus.xmod.gregtech.common.items.behaviours;
+
+import java.util.List;
+
+import codechicken.lib.math.MathHelper;
+import gregtech.api.GregTech_API;
+import gregtech.api.items.GT_MetaBase_Item;
+import gregtech.api.util.GT_LanguageManager;
+import gregtech.api.util.GT_Utility;
+import gregtech.common.items.behaviors.Behaviour_None;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.entity.projectile.EntityLightningAttack;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.minecraft.NBTUtils;
+import gtPlusPlus.core.util.minecraft.PlayerUtils;
+import gtPlusPlus.xmod.gregtech.common.helpers.ChargingHelper;
+import gtPlusPlus.xmod.gregtech.common.items.MetaGeneratedGregtechTools;
+import ic2.api.item.IElectricItemManager;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.monster.EntityCreeper;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.init.Blocks;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.world.World;
+import net.minecraftforge.common.util.ForgeDirection;
+
+public class Behaviour_Electric_Lighter extends Behaviour_None {
+
+ private final String mTooltip = GT_LanguageManager.addStringLocalization("gt.behaviour.lighter.tooltip",
+ "Can light things on Fire");
+ private final String mTooltipUses = GT_LanguageManager.addStringLocalization("gt.behaviour.lighter.uses",
+ "Remaining Uses:");
+ private final String mTooltipUnstackable = GT_LanguageManager.addStringLocalization("gt.behaviour.unstackable",
+ "Not usable when stacked!");
+
+ public Behaviour_Electric_Lighter() {
+
+ }
+
+ public boolean onLeftClickEntity(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, Entity aEntity) {
+ if (!aPlayer.worldObj.isRemote && aStack != null && aStack.stackSize == 1) {
+ boolean rOutput = false;
+ if (aEntity instanceof EntityCreeper) {
+ if (this.prepare(aStack) || aPlayer.capabilities.isCreativeMode) {
+ GT_Utility.sendSoundToPlayers(aPlayer.worldObj, (String) GregTech_API.sSoundList.get(6), 1.0F, 1.0F,
+ MathHelper.floor_double(aEntity.posX), MathHelper.floor_double(aEntity.posY),
+ MathHelper.floor_double(aEntity.posZ));
+ ((EntityCreeper) aEntity).func_146079_cb();
+ rOutput = true;
+ }
+ }
+ return rOutput;
+ } else {
+ return false;
+ }
+ }
+
+ public boolean onItemUse(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX,
+ int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) {
+ if (!aWorld.isRemote && aStack != null && aStack.stackSize == 1) {
+ if (aPlayer.isSneaking()) {
+ Logger.INFO("Changing Mode");
+ boolean aCurrentMode = NBTUtils.getBoolean(aStack, "aFireballMode");
+ Logger.INFO("Is currently in Fireball mode? "+aCurrentMode);
+ boolean aNewMode = Utils.invertBoolean(aCurrentMode);
+ Logger.INFO("Is now set to Fireball mode? "+aNewMode);
+ aStack.getTagCompound().setBoolean("aFireballMod", aNewMode);
+ //NBTUtils.setBoolean(aStack, "aFireballMode", aNewMode);
+ PlayerUtils.messagePlayer(aPlayer, "Current Mode: "+EnumChatFormatting.RED+(aNewMode ? "Projectile" : "Fire Starter"));
+ }
+ else {
+ boolean aCurrentMode = NBTUtils.getBoolean(aStack, "aFireballMode");
+ if (aCurrentMode) {
+ //Shoot Lightning Attack
+ aWorld.playSoundAtEntity(aPlayer, "random.bow", 0.5F, 0.4F / (CORE.RANDOM.nextFloat() * 0.4F + 0.8F));
+ if (!aWorld.isRemote) {
+ aWorld.spawnEntityInWorld(new EntityLightningAttack(aWorld, aPlayer, hitX, hitY, hitZ));
+ }
+ }
+ else {
+ //Lights Fires Mode
+ Logger.WARNING("Preparing Lighter a");
+ boolean rOutput = false;
+ ForgeDirection tDirection = ForgeDirection.getOrientation(aSide);
+ aX += tDirection.offsetX;
+ aY += tDirection.offsetY;
+ aZ += tDirection.offsetZ;
+ if (GT_Utility.isBlockAir(aWorld, aX, aY, aZ) && aPlayer.canPlayerEdit(aX, aY, aZ, aSide, aStack)) {
+ Logger.WARNING("Preparing Lighter b");
+ if (this.prepare(aStack) || aPlayer.capabilities.isCreativeMode) {
+ Logger.WARNING("Preparing Lighter c");
+ GT_Utility.sendSoundToPlayers(aWorld, (String) GregTech_API.sSoundList.get(6), 1.0F, 1.0F, aX, aY,
+ aZ);
+ aWorld.setBlock(aX, aY, aZ, Blocks.fire);
+ rOutput = true;
+ // ItemNBT.setLighterFuel(aStack, tFuelAmount);
+ return rOutput;
+ }
+ }
+ }
+ }
+ }
+ Logger.WARNING("Preparing Lighter z");
+ return false;
+ }
+
+ public boolean onItemUseFirst(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX,
+ int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) {
+ if (!aWorld.isRemote && aStack != null && aStack.stackSize == 1) {
+ if (aPlayer.isSneaking()) {
+ Logger.INFO("Changing Mode");
+ boolean aCurrentMode = NBTUtils.getBoolean(aStack, "aFireballMode");
+ Logger.INFO("Is currently in Fireball mode? "+aCurrentMode);
+ boolean aNewMode = Utils.invertBoolean(aCurrentMode);
+ Logger.INFO("Is now set to Fireball mode? "+aNewMode);
+ aStack.getTagCompound().setBoolean("aFireballMode", aNewMode);
+ //NBTUtils.setBoolean(aStack, "aFireballMode", aNewMode);
+ PlayerUtils.messagePlayer(aPlayer, "Current Mode: "+EnumChatFormatting.RED+(aNewMode ? "Projectile" : "Fire Starter"));
+ }
+ else {
+ boolean aCurrentMode = NBTUtils.getBoolean(aStack, "aFireballMode");
+ if (aCurrentMode) {
+ //Shoot Lightning Attack
+ aWorld.playSoundAtEntity(aPlayer, "random.bow", 0.5F, 0.4F / (CORE.RANDOM.nextFloat() * 0.4F + 0.8F));
+ if (!aWorld.isRemote) {
+ aWorld.spawnEntityInWorld(new EntityLightningAttack(aWorld, aPlayer, hitX, hitY, hitZ));
+ }
+ }
+ else {
+ //Lights Fires Mode
+ Logger.WARNING("Preparing Lighter a");
+ boolean rOutput = false;
+ ForgeDirection tDirection = ForgeDirection.getOrientation(aSide);
+ aX += tDirection.offsetX;
+ aY += tDirection.offsetY;
+ aZ += tDirection.offsetZ;
+ if (GT_Utility.isBlockAir(aWorld, aX, aY, aZ) && aPlayer.canPlayerEdit(aX, aY, aZ, aSide, aStack)) {
+ Logger.WARNING("Preparing Lighter b");
+ if (this.prepare(aStack) || aPlayer.capabilities.isCreativeMode) {
+ Logger.WARNING("Preparing Lighter c");
+ GT_Utility.sendSoundToPlayers(aWorld, (String) GregTech_API.sSoundList.get(6), 1.0F, 1.0F, aX, aY,
+ aZ);
+ aWorld.setBlock(aX, aY, aZ, Blocks.fire);
+ rOutput = true;
+ // ItemNBT.setLighterFuel(aStack, tFuelAmount);
+ return rOutput;
+ }
+ }
+ }
+ }
+ }
+ Logger.WARNING("Preparing Lighter z");
+ return false;
+ }
+
+ private boolean prepare(ItemStack aStack) {
+ if (aStack != null) {
+ Logger.WARNING("Preparing Lighter 1");
+ if (aStack.getItem() instanceof MetaGeneratedGregtechTools) {
+ Logger.WARNING("Preparing Lighter 2");
+ if (ChargingHelper.isItemValid(aStack)) {
+ Logger.WARNING("Preparing Lighter 3");
+ if (aStack.getItem() instanceof IElectricItemManager) {
+ Logger.WARNING("Preparing Lighter 4");
+ IElectricItemManager aItemElec = (IElectricItemManager) aStack.getItem();
+ double aCharge = aItemElec.getCharge(aStack);
+ long aEuCost = 4096 * 2;
+ if (aCharge >= aEuCost) {
+ Logger.WARNING("Preparing Lighter 5");
+ aItemElec.discharge(aStack, aEuCost, 3, true, true, false);
+ return true;
+ }
+ }
+ }
+ }
+ }
+ Logger.WARNING("Preparing Lighter 0");
+ return false;
+ }
+
+ private void useUp(ItemStack aStack) {
+
+ }
+
+ public List<String> getAdditionalToolTips(GT_MetaBase_Item aItem, List<String> aList, ItemStack aStack) {
+ aList.add(this.mTooltip);
+ int aUses = 0;
+ if (aStack != null) {
+ if (aStack.getItem() instanceof MetaGeneratedGregtechTools) {
+ if (ChargingHelper.isItemValid(aStack)) {
+ if (aStack.getItem() instanceof IElectricItemManager) {
+ IElectricItemManager aItemElec = (IElectricItemManager) aStack.getItem();
+ double aCharge = aItemElec.getCharge(aStack);
+ long aEuCost = 4096 * 2;
+ aUses = (int) (aCharge / aEuCost);
+ }
+ }
+ boolean aCurrentMode;
+ if (!NBTUtils.hasTagCompound(aStack)) {
+ NBTUtils.createEmptyTagCompound(aStack);
+ }
+ if (NBTUtils.hasKey(aStack, "aFireballMode")) {
+ aCurrentMode = NBTUtils.getBoolean(aStack, "aFireballMode");
+ }
+ else {
+ aStack.getTagCompound().setBoolean("aFireballMode", false);
+ aCurrentMode = false;
+ }
+ aList.add("Current Mode: "+EnumChatFormatting.RED+(aCurrentMode ? "Projectile" : "Fire Starter"));
+ }
+
+ }
+
+ aList.add(this.mTooltipUses + " " + aUses);
+ aList.add(this.mTooltipUnstackable);
+ return aList;
+ }
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Grinder.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Grinder.java
new file mode 100644
index 0000000000..9012bb8cd8
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Grinder.java
@@ -0,0 +1,94 @@
+package gtPlusPlus.xmod.gregtech.common.items.behaviours;
+
+import java.util.List;
+
+import gregtech.api.enums.SubTag;
+import gregtech.api.interfaces.IItemBehaviour;
+import gregtech.api.items.GT_MetaBase_Item;
+import net.minecraft.dispenser.IBlockSource;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.projectile.EntityArrow;
+import net.minecraft.item.ItemStack;
+import net.minecraft.world.World;
+
+public class Behaviour_Grinder implements IItemBehaviour<GT_MetaBase_Item> {
+
+ @Override
+ public boolean onLeftClickEntity(GT_MetaBase_Item var1, ItemStack var2, EntityPlayer var3, Entity var4) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean onItemUse(GT_MetaBase_Item var1, ItemStack var2, EntityPlayer var3, World var4, int var5, int var6,
+ int var7, int var8, float var9, float var10, float var11) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean onItemUseFirst(GT_MetaBase_Item var1, ItemStack var2, EntityPlayer var3, World var4, int var5,
+ int var6, int var7, int var8, float var9, float var10, float var11) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public ItemStack onItemRightClick(GT_MetaBase_Item var1, ItemStack var2, World var3, EntityPlayer var4) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public List<String> getAdditionalToolTips(GT_MetaBase_Item var1, List<String> var2, ItemStack var3) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void onUpdate(GT_MetaBase_Item var1, ItemStack var2, World var3, Entity var4, int var5, boolean var6) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public boolean isItemStackUsable(GT_MetaBase_Item var1, ItemStack var2) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean canDispense(GT_MetaBase_Item var1, IBlockSource var2, ItemStack var3) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public ItemStack onDispense(GT_MetaBase_Item var1, IBlockSource var2, ItemStack var3) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public boolean hasProjectile(GT_MetaBase_Item var1, SubTag var2, ItemStack var3) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public EntityArrow getProjectile(GT_MetaBase_Item var1, SubTag var2, ItemStack var3, World var4, double var5,
+ double var7, double var9) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public EntityArrow getProjectile(GT_MetaBase_Item var1, SubTag var2, ItemStack var3, World var4,
+ EntityLivingBase var5, float var6) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Prospecting_Ex.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Prospecting_Ex.java
new file mode 100644
index 0000000000..f320bfc77d
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Prospecting_Ex.java
@@ -0,0 +1,123 @@
+package gtPlusPlus.xmod.gregtech.common.items.behaviours;
+
+import java.util.Random;
+
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.init.Blocks;
+import net.minecraft.item.ItemStack;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.world.World;
+
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.Materials;
+import gregtech.api.items.GT_MetaBase_Item;
+import gregtech.api.items.GT_MetaGenerated_Tool;
+import gregtech.api.objects.ItemData;
+import gregtech.api.util.GT_ModHandler;
+import gregtech.api.util.GT_OreDictUnificator;
+import gregtech.api.util.GT_Utility;
+import gregtech.common.blocks.GT_Block_Ores;
+import gregtech.common.blocks.GT_TileEntity_Ores;
+import gregtech.common.items.behaviors.Behaviour_Prospecting;
+
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.IFluidBlock;
+
+public class Behaviour_Prospecting_Ex
+extends Behaviour_Prospecting {
+ private final int mVanillaCosts;
+ private final int mEUCosts;
+
+ public Behaviour_Prospecting_Ex(final int aVanillaCosts, final int aEUCosts) {
+ super(aVanillaCosts, aEUCosts);
+ this.mVanillaCosts = aVanillaCosts;
+ this.mEUCosts = aEUCosts;
+ }
+
+ @Override
+ public boolean onItemUseFirst(final GT_MetaBase_Item aItem, final ItemStack aStack, final EntityPlayer aPlayer, final World aWorld, final int aX, final int aY, final int aZ, final int aSide, final float hitX, final float hitY, final float hitZ) {
+ if (aWorld.isRemote) {
+ return false;
+ }
+ final Block aBlock = aWorld.getBlock(aX, aY, aZ);
+ if (aBlock == null) {
+ return false;
+ }
+ final byte aMeta = (byte) aWorld.getBlockMetadata(aX, aY, aZ);
+
+
+ ItemData tAssotiation = GT_OreDictUnificator.getAssociation(new ItemStack(aBlock, 1, aMeta));
+ if ((tAssotiation != null) && (tAssotiation.mPrefix.toString().startsWith("ore"))) {
+ GT_Utility.sendChatToPlayer(aPlayer, "This is " + tAssotiation.mMaterial.mMaterial.mDefaultLocalName + " Ore.");
+ GT_Utility.sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(Integer.valueOf(1)), 1.0F, -1.0F, aX, aY, aZ);
+ return true;
+ }
+ if ((aBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.stone)) || (aBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, GregTech_API.sBlockGranites)) || (aBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.netherrack)) || (aBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.end_stone)) || (aBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.dirt)) ||(aBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.grass)) ) {
+ if (GT_ModHandler.damageOrDechargeItem(aStack, this.mVanillaCosts, this.mEUCosts, aPlayer)) {
+ GT_Utility.sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(Integer.valueOf(1)), 1.0F, -1.0F, aX, aY, aZ);
+ int tX = aX;
+ int tY = aY;
+ int tZ = aZ;
+ int tMetaID = 0;
+ final int tQuality = ((aItem instanceof GT_MetaGenerated_Tool) ? ((GT_MetaGenerated_Tool) aItem).getHarvestLevel(aStack, "") : 0)*3;
+
+ int i = 0;
+ for (final int j = 6 + tQuality; i < j; i++) {
+ tX -= ForgeDirection.getOrientation(aSide).offsetX;
+ tY -= ForgeDirection.getOrientation(aSide).offsetY;
+ tZ -= ForgeDirection.getOrientation(aSide).offsetZ;
+
+ final Block tBlock = aWorld.getBlock(tX, tY, tZ);
+ if ((tBlock == Blocks.lava) || (tBlock == Blocks.flowing_lava)) {
+ GT_Utility.sendChatToPlayer(aPlayer, "There is Lava behind this Block.");
+ break;
+ }
+ if ((tBlock == Blocks.water) || (tBlock == Blocks.flowing_water) || ((tBlock instanceof IFluidBlock))) {
+ GT_Utility.sendChatToPlayer(aPlayer, "There is a Liquid behind this Block.");
+ break;
+ }
+ if ((tBlock == Blocks.monster_egg) || (!GT_Utility.hasBlockHitBox(aWorld, tX, tY, tZ))) {
+ GT_Utility.sendChatToPlayer(aPlayer, "There is an Air Pocket behind this Block.");
+ break;
+ }
+ if (tBlock != aBlock) {
+ if (i >= 4) {
+ break;
+ }
+ GT_Utility.sendChatToPlayer(aPlayer, "Material is changing behind this Block.");
+ break;
+ }
+ }
+ final Random tRandom = new Random(aX ^ aY ^ aZ ^ aSide);
+ i = 0;
+ for (final int j = 9 + (2 * tQuality); i < j; i++) {
+ tX = (aX - 4 - tQuality) + tRandom.nextInt(j);
+ tY = (aY - 4 - tQuality) + tRandom.nextInt(j);
+ tZ = (aZ - 4 - tQuality) + tRandom.nextInt(j);
+ final Block tBlock = aWorld.getBlock(tX, tY, tZ);
+ if ((tBlock instanceof GT_Block_Ores)) {
+ final TileEntity tTileEntity = aWorld.getTileEntity(tX, tY, tZ);
+ if ((tTileEntity instanceof GT_TileEntity_Ores)) {
+ final Materials tMaterial = GregTech_API.sGeneratedMaterials[(((GT_TileEntity_Ores) tTileEntity).mMetaData % 1000)];
+ if ((tMaterial != null) && (tMaterial != Materials._NULL)) {
+ GT_Utility.sendChatToPlayer(aPlayer, "Found traces of " + tMaterial.mDefaultLocalName + " Ore.");
+ return true;
+ }
+ }
+ } else {
+ tMetaID = aWorld.getBlockMetadata(tX, tY, tZ);
+ tAssotiation = GT_OreDictUnificator.getAssociation(new ItemStack(tBlock, 1, tMetaID));
+ if ((tAssotiation != null) && (tAssotiation.mPrefix.toString().startsWith("ore"))) {
+ GT_Utility.sendChatToPlayer(aPlayer, "Found traces of " + tAssotiation.mMaterial.mMaterial.mDefaultLocalName + " Ore.");
+ return true;
+ }
+ }
+ }
+ GT_Utility.sendChatToPlayer(aPlayer, "No Ores found.");
+ }
+ return true;
+ }
+ return false;
+ }
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/items/covers/MetaItemCoverCasings.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/items/covers/MetaItemCoverCasings.java
new file mode 100644
index 0000000000..7af057bc59
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/items/covers/MetaItemCoverCasings.java
@@ -0,0 +1,40 @@
+package gtPlusPlus.xmod.gregtech.common.items.covers;
+
+import gregtech.api.enums.GT_Values;
+import gregtech.api.enums.Textures;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.math.MathUtils;
+import gtPlusPlus.xmod.gregtech.common.items.MetaCustomCoverItem;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.IIcon;
+
+public class MetaItemCoverCasings extends MetaCustomCoverItem {
+
+ public MetaItemCoverCasings() {
+ super(CORE.MODID, Textures.BlockIcons.MACHINECASINGS_SIDE.length, "Gt Machine Casings", Textures.BlockIcons.MACHINECASINGS_SIDE, null);
+ }
+
+ @Override
+ public void registerIcons(IIconRegister reg) {
+ for (int i = 0; i < icons.length; i++) {
+ this.icons[i] = reg.registerIcon(CORE.MODID+":"+"covers/"+i);
+ }
+ }
+
+ public boolean hide() {
+ return false;
+ }
+
+ @Override
+ public IIcon getIconFromDamage(int meta) {
+ return this.icons[MathUtils.balance(meta, 0, 15)];
+ }
+
+ @Override
+ public String getItemStackDisplayName(final ItemStack tItem) {
+ return EnumChatFormatting.LIGHT_PURPLE + GT_Values.VOLTAGE_NAMES[MathUtils.balance(tItem.getItemDamage(), 0, GT_Values.VOLTAGE_NAMES.length-1)]+" Machine Plate Cover"; //super.getItemStackDisplayName(tItem);
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/render/GTPP_CapeRenderer.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/render/GTPP_CapeRenderer.java
new file mode 100644
index 0000000000..49537ab559
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/render/GTPP_CapeRenderer.java
@@ -0,0 +1,517 @@
+package gtPlusPlus.xmod.gregtech.common.render;
+
+import java.io.*;
+import java.net.URL;
+import java.util.Date;
+import java.util.List;
+import java.util.UUID;
+
+import org.apache.commons.io.IOUtils;
+import org.lwjgl.opengl.GL11;
+
+import com.mojang.authlib.GameProfile;
+
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.api.objects.data.AutoMap;
+import gtPlusPlus.api.objects.data.Pair;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.lib.CORE.ConfigSwitches;
+import gtPlusPlus.core.proxy.ClientProxy;
+import gtPlusPlus.core.util.data.AES;
+import gtPlusPlus.core.util.data.FileUtils;
+import gtPlusPlus.core.util.math.MathUtils;
+import net.minecraft.client.entity.AbstractClientPlayer;
+import net.minecraft.client.model.ModelBiped;
+import net.minecraft.client.renderer.entity.RenderManager;
+import net.minecraft.client.renderer.entity.RenderPlayer;
+import net.minecraft.potion.Potion;
+import net.minecraft.server.MinecraftServer;
+import net.minecraft.util.MathHelper;
+import net.minecraft.util.ResourceLocation;
+import net.minecraftforge.client.event.RenderPlayerEvent;
+
+public class GTPP_CapeRenderer extends RenderPlayer {
+
+ private static final ResourceLocation[] mCapes = {
+ new ResourceLocation("miscutils:textures/OrangeHD.png"),
+ new ResourceLocation("miscutils:textures/FancyCapeHD.png"),
+ new ResourceLocation("miscutils:textures/TesterCapeHD.png"),
+ new ResourceLocation("miscutils:textures/PatreonCapeHD.png"),
+ new ResourceLocation("miscutils:textures/DevCapeHD.png"),
+ };
+
+ private final boolean mInit;
+
+ public GTPP_CapeRenderer() {
+ mInit = init();
+ }
+
+ private final boolean init() {
+ if (mInit) {
+ return false;
+ }
+ return CapeUtils.init();
+ }
+
+ private static boolean hasResourceChecked = false;
+ private static boolean hasSetRenderer = false;
+ private boolean hasCape = false;
+ private ResourceLocation tResource = null;
+
+ public synchronized void receiveRenderSpecialsEvent(RenderPlayerEvent.Specials.Pre aEvent) {
+
+ // Check we have set Render Manager
+ if (this.renderManager == null) {
+ hasSetRenderer = false;
+ }
+
+ // Set Render Manager
+ if (!hasSetRenderer) {
+ if (RenderManager.instance != null) {
+ setRenderManager(RenderManager.instance);
+ hasSetRenderer = true;
+ }
+ }
+
+ // Actually Render
+ if (hasSetRenderer) {
+
+ // We have capes turned off, so let's not render.
+ if (!ConfigSwitches.enableCustomCapes) {
+ return;
+ }
+
+ // We have already checked if this player has a cape, but since they do not, we best not render.
+ if (hasResourceChecked) {
+ if (!hasCape && !CORE.DEVENV) {
+ return;
+ }
+ }
+
+ // Allocate client player object
+ AbstractClientPlayer aPlayer = (AbstractClientPlayer) aEvent.entityPlayer;
+
+ // Make sure we don't keep checking on clients who dont have capes.
+ if (!hasResourceChecked) {
+
+ // Get players UUID
+ String aPlayerUUID = aPlayer != null ? aPlayer.getGameProfile().getId().toString() : "BAD";
+
+ // If for whatever reason this fails, we just exit early.
+ if (aPlayerUUID.equals("BAD")) {
+ return;
+ }
+
+ // Automatically allocate a Dev cape while in Dev mode.
+ if (tResource == null && CORE.DEVENV) {
+ tResource = mCapes[4];
+ hasCape = true;
+ }
+
+ String aPlayerName = ClientProxy.playerName;
+
+ // Check cape lists for the cape this player owns.
+ if (!hasCape) {
+ for (Pair<String, String> aData : CapeUtils.mOrangeCapes) {
+ if (aData.getKey().equals(aPlayerUUID) || aPlayerName .equals(aData.getValue())) {
+ tResource = mCapes[0];
+ hasCape = true;
+ break;
+ }
+ }
+ }
+ if (!hasCape) {
+ for (Pair<String, String> aData : CapeUtils.mMiscCapes) {
+ if (aData.getKey().equals(aPlayerUUID) || aPlayerName .equals(aData.getValue())) {
+ tResource = mCapes[1];
+ hasCape = true;
+ break;
+ }
+ }
+ }
+ if (!hasCape) {
+ for (Pair<String, String> aData : CapeUtils.mBetaTestCapes) {
+ if (aData.getKey().equals(aPlayerUUID) || aPlayerName .equals(aData.getValue())) {
+ tResource = mCapes[2];
+ hasCape = true;
+ break;
+ }
+ }
+ }
+ if (!hasCape) {
+ for (Pair<String, String> aData : CapeUtils.mPatreonCapes) {
+ if (aData.getKey().equals(aPlayerUUID) || aPlayerName .equals(aData.getValue())) {
+ tResource = mCapes[3];
+ hasCape = true;
+ break;
+ }
+ }
+ }
+ if (!hasCape) {
+ for (Pair<String, String> aData : CapeUtils.mDevCapes) {
+ if (aData.getKey().equals(aPlayerUUID) || aPlayerName .equals(aData.getValue())) {
+ tResource = mCapes[4];
+ hasCape = true;
+ break;
+ }
+ }
+ }
+ hasResourceChecked = true;
+ }
+
+ if (hasResourceChecked) {
+ // We have met all the conditions, let's render that cape.
+ renderCapeOnPlayer(aEvent, aPlayer);
+ }
+ }
+
+ }
+
+ private final boolean renderCapeOnPlayer(RenderPlayerEvent.Specials.Pre aEvent, AbstractClientPlayer aPlayer) {
+ float aPartialTicks = aEvent.partialRenderTick;
+ try {
+ if (tResource == null && CORE.DEVENV) {
+ tResource = mCapes[3];
+ }
+
+ // If player is invisible, don't render.
+ if (GT_Utility.getFullInvisibility(aPlayer) || aPlayer.isInvisible()
+ || GT_Utility.getPotion(aPlayer, Integer.valueOf(Potion.invisibility.id).intValue())) {
+ aEvent.setCanceled(true);
+ return false;
+ }
+
+ if ((tResource != null) && (!aPlayer.getHideCape())) {
+ bindTexture(tResource);
+ GL11.glPushMatrix();
+ GL11.glTranslatef(0.0F, 0.0F, 0.125F);
+ double d0 = aPlayer.field_71091_bM + (aPlayer.field_71094_bP - aPlayer.field_71091_bM) * aPartialTicks
+ - (aPlayer.prevPosX + (aPlayer.posX - aPlayer.prevPosX) * aPartialTicks);
+ double d1 = aPlayer.field_71096_bN + (aPlayer.field_71095_bQ - aPlayer.field_71096_bN) * aPartialTicks
+ - (aPlayer.prevPosY + (aPlayer.posY - aPlayer.prevPosY) * aPartialTicks);
+ double d2 = aPlayer.field_71097_bO + (aPlayer.field_71085_bR - aPlayer.field_71097_bO) * aPartialTicks
+ - (aPlayer.prevPosZ + (aPlayer.posZ - aPlayer.prevPosZ) * aPartialTicks);
+ float f6 = aPlayer.prevRenderYawOffset
+ + (aPlayer.renderYawOffset - aPlayer.prevRenderYawOffset) * aPartialTicks;
+ double d3 = MathHelper.sin(f6 * CORE.PI / 180.0F);
+ double d4 = -MathHelper.cos(f6 * CORE.PI / 180.0F);
+ float f7 = (float) d1 * 10.0F;
+ float f8 = (float) (d0 * d3 + d2 * d4) * 100.0F;
+ float f9 = (float) (d0 * d4 - d2 * d3) * 100.0F;
+ if (f7 < -6.0F) {
+ f7 = -6.0F;
+ }
+ if (f7 > 32.0F) {
+ f7 = 32.0F;
+ }
+ if (f8 < 0.0F) {
+ f8 = 0.0F;
+ }
+ float f10 = aPlayer.prevCameraYaw + (aPlayer.cameraYaw - aPlayer.prevCameraYaw) * aPartialTicks;
+ f7 += MathHelper.sin((aPlayer.prevDistanceWalkedModified
+ + (aPlayer.distanceWalkedModified - aPlayer.prevDistanceWalkedModified) * aPartialTicks) * 6.0F)
+ * 32.0F * f10;
+ if (aPlayer.isSneaking()) {
+ f7 += 25.0F;
+ }
+ GL11.glRotatef(6.0F + f8 / 2.0F + f7, 1.0F, 0.0F, 0.0F);
+ GL11.glRotatef(f9 / 2.0F, 0.0F, 0.0F, 1.0F);
+ GL11.glRotatef(-f9 / 2.0F, 0.0F, 1.0F, 0.0F);
+ GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
+ ((ModelBiped) this.mainModel).renderCloak(0.0625F);
+ GL11.glPopMatrix();
+ return true;
+ }
+ } catch (Throwable e) {
+
+ }
+ return false;
+ }
+
+ @SuppressWarnings("unused")
+ @Deprecated
+ /**
+ * Should be able to get the username from a UUID
+ * @param name - Players Name
+ * @param uuid - Players known UUID
+ * @return - The newest Player name
+ */
+ private String getPlayerName(String name, String uuid) {
+ try {
+ Logger.WORLD("[Capes++] Trying to UUID check " + name + ".");
+ if (uuid != null) {
+ if (uuid.length() > 0) {
+ UUID g = UUID.fromString(uuid);
+ if (g != null) {
+ Logger.WORLD("[Capes++] Mojang/Cache checking for " + name + ".");
+ GameProfile profile = MinecraftServer.getServer().func_152358_ax().func_152652_a(g);
+ if (profile != null) {
+ Logger.WARNING("[Capes++] Found for UUID check: " + profile.getName() + ".");
+ return profile.getName();
+ }
+ } else {
+ g = UUID.fromString(uuid.replace("-", ""));
+ if (g != null) {
+ Logger.WORLD("[Capes++] Mojang/Cache checking for " + name + ".");
+ GameProfile profile = MinecraftServer.getServer().func_152358_ax().func_152652_a(g);
+ if (profile != null) {
+ Logger.WARNING("[Capes++] Found for UUID check 2: " + profile.getName() + ".");
+ return profile.getName();
+ }
+ }
+ }
+ }
+ }
+ if (name != null) {
+ if (name.length() > 0) {
+ Logger.WORLD("[Capes++] Mojang/Cache checking for " + name + ".");
+ GameProfile profile = MinecraftServer.getServer().func_152358_ax().func_152655_a(name);
+ if (profile != null) {
+ Logger.WARNING("[Capes++] Found for name check: " + profile.getName() + ".");
+ return profile.getName();
+ }
+ }
+ }
+ Logger.WORLD("[Capes++] Failed UUID check for " + name + ".");
+ } catch (Throwable t) {
+ }
+ return name;
+ }
+
+
+
+ private static class CapeUtils {
+
+ private static char SPLIT_CHARACTER = '§';
+ private static AES sAES;
+
+ // UUID - Username
+ private static final AutoMap<Pair<String, String>> mOrangeCapes = new AutoMap<Pair<String, String>>();
+ private static final AutoMap<Pair<String, String>> mMiscCapes = new AutoMap<Pair<String, String>>();
+ private static final AutoMap<Pair<String, String>> mBetaTestCapes = new AutoMap<Pair<String, String>>();
+ private static final AutoMap<Pair<String, String>> mPatreonCapes = new AutoMap<Pair<String, String>>();
+ private static final AutoMap<Pair<String, String>> mDevCapes = new AutoMap<Pair<String, String>>();
+
+ private static final boolean init() {
+ CapeUtils.handleOldCapeCache();
+ if (CORE.DEVENV) {
+ return true;
+ }
+ try {
+ if (shouldDownloadCapeList()) {
+ downloadCapeList();
+ }
+ }
+ catch (Exception e) {
+ return false;
+ }
+ writeCacheToMaps();
+ return true;
+ }
+
+
+ private static boolean shouldDownloadCapeList() {
+ if (!doesCapeCacheExistLocally()) {
+ return true;
+ }
+ if (isCapeCacheWeekOld()) {
+ return true;
+ }
+ return false;
+ }
+
+ private static final boolean isCapeCacheWeekOld() {
+ if (!doesCapeCacheExistLocally()) {
+ return true;
+ }
+ else {
+ File dat = CapeUtils.getCapeCache();
+ Date dateLastMod = new Date(dat.lastModified());
+ Date dateNow = new Date(System.currentTimeMillis() - (7l * 24 * 60 * 60 * 1000));
+ if (dateLastMod.before(dateNow)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private static final void downloadCapeList() {
+ try {
+ File dat = getCapeCache();
+ File temp = allocateTempFile();
+ InputStream inputStream = new URL("https://alkcorp.overminddl1.com/CapeCache.dat").openStream();
+ FileOutputStream fileOS = new FileOutputStream(temp);
+ IOUtils.copy(inputStream, fileOS);
+ if (isDownloadedCapeListBigger(temp)) {
+ fileOS = new FileOutputStream(dat);
+ IOUtils.copy(inputStream, fileOS);
+ }
+ } catch (Throwable t) {
+ Logger.INFO("Unable to download GT++ cape list.");
+ }
+ }
+
+ private static final boolean isDownloadedCapeListBigger(File aFile) {
+ double aExistingFileSize = (doesCapeCacheExistLocally() ? getCapeCache().length() : 0);
+ double aNewFileSize = aFile.length();
+ if (aNewFileSize > aExistingFileSize) {
+ return true;
+ }
+ return false;
+ }
+
+ private static void handleOldCapeCache() {
+ File aCacheFile = FileUtils.getFile("GTPP", "dat");
+ if (FileUtils.doesFileExist(aCacheFile)) {
+ aCacheFile.delete();
+ }
+ }
+
+ private static final boolean doesCapeCacheExistLocally() {
+ File aCacheFile = FileUtils.getFile("CapeCache", "dat");
+ if (FileUtils.doesFileExist(aCacheFile)) {
+ return true;
+ }
+ return false;
+ }
+
+ private static final File getCapeCache() {
+ File aCacheFile = FileUtils.getFile("CapeCache", "dat");
+ if (FileUtils.doesFileExist(aCacheFile)) {
+ FileUtils.createFile(aCacheFile);
+ }
+ return aCacheFile;
+ }
+
+ public static final List<String> getDataFromCache(){
+ File aCacheFile = getCapeCache();
+ List<String> aCache = FileUtils.readLines(aCacheFile);
+ if (aCache != null && !aCache.isEmpty()) {
+ return aCache;
+ }
+ return new AutoMap<String>();
+ }
+
+ private static final File allocateTempFile() {
+ File tempFile = null;
+ try {
+ tempFile = File.createTempFile("gtpp-", null);
+ }
+ catch (IOException e) {
+ e.printStackTrace();
+ }
+ if (tempFile == null) {
+ tempFile = FileUtils.createFile("", "gtpp-"+MathUtils.randInt(Short.MAX_VALUE, (Integer.MAX_VALUE/2)), "tmp");
+ }
+ tempFile.deleteOnExit();
+ return tempFile;
+ }
+
+
+ public static final void writeCacheToMaps() {
+ List<String> aCacheData = getDataFromCache();
+ if (aCacheData != null && !aCacheData.isEmpty()) {
+ if (sAES == null) {
+ sAES = new AES();
+ }
+ AutoMap<String> aDecodedData = new AutoMap<String>();
+ for (String aToDecode : aCacheData) {
+ aDecodedData.put(sAES.decode(aToDecode));
+ }
+ if (!aDecodedData.isEmpty()) {
+ AutoMap<Pair<String, String>> aCapeType1 = new AutoMap<Pair<String, String>>();
+ AutoMap<Pair<String, String>> aCapeType2 = new AutoMap<Pair<String, String>>();
+ AutoMap<Pair<String, String>> aCapeType3 = new AutoMap<Pair<String, String>>();
+ AutoMap<Pair<String, String>> aCapeType4 = new AutoMap<Pair<String, String>>();
+ AutoMap<Pair<String, String>> aCapeType5 = new AutoMap<Pair<String, String>>();
+ boolean didProcessStringData = false;
+ Logger.INFO("Decoded String Count: "+aDecodedData.size());
+ for (String aToSplit : aDecodedData) {
+ String[] aSplitData = aToSplit.split(""+SPLIT_CHARACTER);
+ if (aSplitData != null && aSplitData.length >= 2) {
+ if (aSplitData[0] != null) {
+ Integer aCapeTypeID2 = Integer.parseInt(aSplitData[0]);
+ if (aCapeTypeID2 != null) {
+ int aCapeTypeID = aCapeTypeID2;
+ Pair<String, String> aFinalString = new Pair<String, String>("UUID: "+aSplitData[1], "Username: "+(aSplitData[2] != null && aSplitData[0].length() > 0 ? aSplitData[2] : "Not Specified"));
+ Logger.INFO("Cape Type: "+aCapeTypeID);
+ switch (aCapeTypeID) {
+ case 0:
+ aCapeType1.add(aFinalString);
+ Logger.INFO("Added user to map "+aCapeTypeID+", map now holds "+aCapeType1.size()+" users.");
+ break;
+ case 1:
+ aCapeType2.add(aFinalString);
+ Logger.INFO("Added user to map "+aCapeTypeID+", map now holds "+aCapeType2.size()+" users.");
+ break;
+ case 2:
+ aCapeType3.add(aFinalString);
+ Logger.INFO("Added user to map "+aCapeTypeID+", map now holds "+aCapeType3.size()+" users.");
+ break;
+ case 3:
+ aCapeType4.add(aFinalString);
+ Logger.INFO("Added user to map "+aCapeTypeID+", map now holds "+aCapeType4.size()+" users.");
+ break;
+ case 4:
+ aCapeType5.add(aFinalString);
+ Logger.INFO("Added user to map "+aCapeTypeID+", map now holds "+aCapeType5.size()+" users.");
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ }
+ }
+ if (!aCapeType1.isEmpty() || !aCapeType2.isEmpty() || !aCapeType3.isEmpty() || !aCapeType4.isEmpty() || !aCapeType5.isEmpty()) {
+ didProcessStringData = true;
+ }
+ else {
+ // did not process any data
+ }
+ if (didProcessStringData) {
+ if (!aCapeType1.isEmpty()) {
+ for (Pair<String, String> aUser : aCapeType1) {
+ Logger.INFO("Adding Generic cape for "+aUser.getKey());
+ mOrangeCapes.add(aUser);
+ }
+ }
+ if (!aCapeType2.isEmpty()) {
+ for (Pair<String, String> aUser : aCapeType2) {
+ Logger.INFO("Adding Blue cape for "+aUser.getKey());
+ mMiscCapes.add(aUser);
+ }
+ }
+ if (!aCapeType3.isEmpty()) {
+ for (Pair<String, String> aUser : aCapeType3) {
+ Logger.INFO("Adding Beta cape for "+aUser.getKey());
+ mBetaTestCapes.add(aUser);
+ }
+ }
+ if (!aCapeType4.isEmpty()) {
+ for (Pair<String, String> aUser : aCapeType4) {
+ Logger.INFO("Adding Patreon cape for "+aUser.getKey());
+ mPatreonCapes.add(aUser);
+ }
+ }
+ if (!aCapeType5.isEmpty()) {
+ for (Pair<String, String> aUser : aCapeType5) {
+ Logger.INFO("Adding Dev cape for "+aUser.getKey());
+ mDevCapes.add(aUser);
+ }
+ }
+ }
+ }
+ else {
+ // No data decoded
+ }
+ }
+ else {
+ // Nothing was cached?
+ }
+ }
+ }
+
+
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/render/GTPP_FlaskRenderer.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/render/GTPP_FlaskRenderer.java
new file mode 100644
index 0000000000..1561ba9f73
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/render/GTPP_FlaskRenderer.java
@@ -0,0 +1,94 @@
+package gtPlusPlus.xmod.gregtech.common.render;
+
+import cpw.mods.fml.relauncher.SideOnly;
+import gregtech.api.enums.ItemList;
+import gregtech.common.items.GT_VolumetricFlask;
+import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList;
+import ic2.core.util.DrawUtil;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.renderer.ItemRenderer;
+import net.minecraft.client.renderer.Tessellator;
+import net.minecraft.client.renderer.texture.TextureMap;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.IIcon;
+import net.minecraftforge.client.IItemRenderer;
+import net.minecraftforge.client.MinecraftForgeClient;
+import net.minecraftforge.fluids.FluidStack;
+import org.lwjgl.opengl.GL11;
+
+@SideOnly(cpw.mods.fml.relauncher.Side.CLIENT)
+public final class GTPP_FlaskRenderer implements net.minecraftforge.client.IItemRenderer {
+
+ public GTPP_FlaskRenderer() {
+ MinecraftForgeClient.registerItemRenderer(GregtechItemList.VOLUMETRIC_FLASK_8k.getItem(), this);
+ MinecraftForgeClient.registerItemRenderer(GregtechItemList.VOLUMETRIC_FLASK_32k.getItem(), this);
+ }
+
+ public boolean handleRenderType(ItemStack item, ItemRenderType type) {
+ return type != ItemRenderType.FIRST_PERSON_MAP;
+ }
+
+
+ public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, IItemRenderer.ItemRendererHelper helper) {
+ return type == ItemRenderType.ENTITY;
+ }
+
+ public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
+ GT_VolumetricFlask cell = (GT_VolumetricFlask) item.getItem();
+
+ int aType = cell.getMaxCapacity() == 8000 ? 0 : 1;
+ IIcon icon = item.getIconIndex();
+ GL11.glEnable(3042);
+ GL11.glEnable(3008);
+ if (type.equals(ItemRenderType.ENTITY)) {
+ GL11.glRotated(180.0D, 0.0D, 0.0D, 1.0D);
+ GL11.glRotated(90.0D, 0.0D, 1.0D, 0.0D);
+ GL11.glTranslated(-0.5D, -0.6D, 0.0D);
+ } else if (type.equals(ItemRenderType.EQUIPPED_FIRST_PERSON)) {
+ GL11.glTranslated(1.0D, 1.0D, 0.0D);
+ GL11.glRotated(180.0D, 0.0D, 0.0D, 1.0D);
+ } else if (type.equals(ItemRenderType.EQUIPPED)) {
+ GL11.glRotated(180.0D, 0.0D, 0.0D, 1.0D);
+ GL11.glTranslated(-1.0D, -1.0D, 0.0D);
+ }
+
+ FluidStack fs = cell.getFluid(item);
+ if (fs != null) {
+ IIcon iconWindow = cell.iconWindow;
+ IIcon fluidicon = fs.getFluid().getIcon(fs);
+ int fluidColor = fs.getFluid().getColor(fs);
+ Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture);
+ GL11.glBlendFunc(0, 1);
+ if (type.equals(ItemRenderType.INVENTORY)) {
+ DrawUtil.renderIcon(iconWindow, 16.0D, 0.0D, 0.0F, 0.0F, -1.0F);
+ } else {
+ DrawUtil.renderIcon(iconWindow, 1.0D, -0.001D, 0.0F, 0.0F, 1.0F);
+ DrawUtil.renderIcon(iconWindow, 1.0D, -0.0615D, 0.0F, 0.0F, -1.0F);
+ }
+
+ Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
+ GL11.glBlendFunc(770, 771);
+ GL11.glDepthFunc(514);
+ GL11.glColor3ub((byte) (fluidColor >> 16), (byte) (fluidColor >> 8), (byte) fluidColor);
+ if (type.equals(ItemRenderType.INVENTORY)) {
+ DrawUtil.renderIcon(fluidicon, 16.0D, 0.0D, 0.0F, 0.0F, -1.0F);
+ } else {
+ DrawUtil.renderIcon(fluidicon, 1.0D, -0.001D, 0.0F, 0.0F, 1.0F);
+ DrawUtil.renderIcon(fluidicon, 1.0D, -0.0615D, 0.0F, 0.0F, -1.0F);
+ }
+
+ GL11.glColor3ub((byte) -1, (byte) -1, (byte) -1);
+ GL11.glDepthFunc(515);
+ }
+
+ Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture);
+ GL11.glBlendFunc(770, 771);
+ if (type.equals(ItemRenderType.INVENTORY)) {
+ DrawUtil.renderIcon(icon, 16.0D, 0.001D, 0.0F, 0.0F, -1.0F);
+ } else {
+ ItemRenderer.renderItemIn2D(Tessellator.instance, icon.getMaxU(), icon.getMinV(), icon.getMinU(), icon.getMaxV(), icon.getIconWidth(), icon.getIconHeight(), 0.0625F);
+ }
+ GL11.glDisable(3008);
+ GL11.glDisable(3042);
+ }
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/render/GTPP_Render_MachineBlock.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/render/GTPP_Render_MachineBlock.java
new file mode 100644
index 0000000000..35d78008c5
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/render/GTPP_Render_MachineBlock.java
@@ -0,0 +1,659 @@
+package gtPlusPlus.xmod.gregtech.common.render;
+
+import org.lwjgl.opengl.GL11;
+
+import cpw.mods.fml.client.registry.RenderingRegistry;
+import gregtech.api.GregTech_API;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.interfaces.tileentity.IPipeRenderedTileEntity;
+import gregtech.api.interfaces.tileentity.ITexturedTileEntity;
+import gregtech.common.blocks.GT_Block_Machines;
+import gregtech.common.render.GT_Renderer_Block;
+import gtPlusPlus.xmod.gregtech.common.blocks.GTPP_Block_Machines;
+import gtPlusPlus.xmod.gregtech.common.helpers.GT_MethodHelper;
+import net.minecraft.block.Block;
+import net.minecraft.client.renderer.RenderBlocks;
+import net.minecraft.client.renderer.Tessellator;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.world.IBlockAccess;
+
+public class GTPP_Render_MachineBlock extends GT_Renderer_Block {
+
+ public static GTPP_Render_MachineBlock INSTANCE;
+ public final int mRenderID = RenderingRegistry.getNextAvailableRenderId();
+
+ public GTPP_Render_MachineBlock() {
+ INSTANCE = this;
+ RenderingRegistry.registerBlockHandler(this);
+ }
+
+ private static ITexture[] getTexture(IMetaTileEntity arg0, int arg1, int arg2, int arg3, boolean arg4, boolean arg5) {
+ IGregTechTileEntity arg0b = arg0.getBaseMetaTileEntity();
+ return arg0.getTexture(arg0b, (byte) arg1, (byte) arg2, (byte) arg3, arg4, arg5);
+ }
+
+ private static void renderNormalInventoryMetaTileEntity(Block aBlock, int aMeta, RenderBlocks aRenderer) {
+ if (aMeta > 0 && aMeta < GregTech_API.METATILEENTITIES.length) {
+ IMetaTileEntity tMetaTileEntity = GregTech_API.METATILEENTITIES[aMeta];
+ if (tMetaTileEntity != null) {
+ aBlock.setBlockBoundsForItemRender();
+ aRenderer.setRenderBoundsFromBlock(aBlock);
+ GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
+ GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
+ if (tMetaTileEntity.getBaseMetaTileEntity() instanceof IPipeRenderedTileEntity) {
+ float tThickness = ((IPipeRenderedTileEntity) tMetaTileEntity.getBaseMetaTileEntity())
+ .getThickNess();
+ float sp = (1.0F - tThickness) / 2.0F;
+ aBlock.setBlockBounds(0.0F, sp, sp, 1.0F, sp + tThickness, sp + tThickness);
+ aRenderer.setRenderBoundsFromBlock(aBlock);
+ Tessellator.instance.startDrawingQuads();
+ Tessellator.instance.setNormal(0.0F, -1.0F, 0.0F);
+ renderNegativeYFacing((IBlockAccess) null, aRenderer, aBlock, 0, 0, 0,
+ getTexture(tMetaTileEntity, 0, 9, -1, false, false),
+ true);
+ Tessellator.instance.draw();
+ Tessellator.instance.startDrawingQuads();
+ Tessellator.instance.setNormal(0.0F, 1.0F, 0.0F);
+ renderPositiveYFacing((IBlockAccess) null, aRenderer, aBlock, 0, 0, 0,
+ getTexture(tMetaTileEntity, 1, 9, -1, false, false),
+ true);
+ Tessellator.instance.draw();
+ Tessellator.instance.startDrawingQuads();
+ Tessellator.instance.setNormal(0.0F, 0.0F, -1.0F);
+ renderNegativeZFacing((IBlockAccess) null, aRenderer, aBlock, 0, 0, 0,
+ getTexture(tMetaTileEntity, 2, 9, -1, false, false),
+ true);
+ Tessellator.instance.draw();
+ Tessellator.instance.startDrawingQuads();
+ Tessellator.instance.setNormal(0.0F, 0.0F, 1.0F);
+ renderPositiveZFacing((IBlockAccess) null, aRenderer, aBlock, 0, 0, 0,
+ getTexture(tMetaTileEntity, 3, 9, -1, false, false),
+ true);
+ Tessellator.instance.draw();
+ Tessellator.instance.startDrawingQuads();
+ Tessellator.instance.setNormal(-1.0F, 0.0F, 0.0F);
+ renderNegativeXFacing((IBlockAccess) null, aRenderer, aBlock, 0, 0, 0,
+ getTexture(tMetaTileEntity, 4, 9, -1, true, false),
+ true);
+ Tessellator.instance.draw();
+ Tessellator.instance.startDrawingQuads();
+ Tessellator.instance.setNormal(1.0F, 0.0F, 0.0F);
+ renderPositiveXFacing((IBlockAccess) null, aRenderer, aBlock, 0, 0, 0,
+ getTexture(tMetaTileEntity, 5, 9, -1, true, false),
+ true);
+ Tessellator.instance.draw();
+ } else {
+ Tessellator.instance.startDrawingQuads();
+ Tessellator.instance.setNormal(0.0F, -1.0F, 0.0F);
+ renderNegativeYFacing((IBlockAccess) null, aRenderer, aBlock, 0, 0, 0,
+ getTexture(tMetaTileEntity, 0, 4, -1, true, false),
+ true);
+ Tessellator.instance.draw();
+ Tessellator.instance.startDrawingQuads();
+ Tessellator.instance.setNormal(0.0F, 1.0F, 0.0F);
+ renderPositiveYFacing((IBlockAccess) null, aRenderer, aBlock, 0, 0, 0,
+ getTexture(tMetaTileEntity, 1, 4, -1, true, false),
+ true);
+ Tessellator.instance.draw();
+ Tessellator.instance.startDrawingQuads();
+ Tessellator.instance.setNormal(0.0F, 0.0F, -1.0F);
+ renderNegativeZFacing((IBlockAccess) null, aRenderer, aBlock, 0, 0, 0,
+ getTexture(tMetaTileEntity, 2, 4, -1, true, false),
+ true);
+ Tessellator.instance.draw();
+ Tessellator.instance.startDrawingQuads();
+ Tessellator.instance.setNormal(0.0F, 0.0F, 1.0F);
+ renderPositiveZFacing((IBlockAccess) null, aRenderer, aBlock, 0, 0, 0,
+ getTexture(tMetaTileEntity, 3, 4, -1, true, false),
+ true);
+ Tessellator.instance.draw();
+ Tessellator.instance.startDrawingQuads();
+ Tessellator.instance.setNormal(-1.0F, 0.0F, 0.0F);
+ renderNegativeXFacing((IBlockAccess) null, aRenderer, aBlock, 0, 0, 0,
+ getTexture(tMetaTileEntity, 4, 4, -1, true, false),
+ true);
+ Tessellator.instance.draw();
+ Tessellator.instance.startDrawingQuads();
+ Tessellator.instance.setNormal(1.0F, 0.0F, 0.0F);
+ renderPositiveXFacing((IBlockAccess) null, aRenderer, aBlock, 0, 0, 0,
+ getTexture(tMetaTileEntity, 5, 4, -1, true, false),
+ true);
+ Tessellator.instance.draw();
+ }
+
+ aBlock.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
+ aRenderer.setRenderBoundsFromBlock(aBlock);
+ GL11.glTranslatef(0.5F, 0.5F, 0.5F);
+ }
+ }
+ }
+
+ public static boolean renderStandardBlock(IBlockAccess aWorld, int aX, int aY, int aZ, Block aBlock,
+ RenderBlocks aRenderer) {
+ TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+
+ return tTileEntity instanceof ITexturedTileEntity
+ ? renderStandardBlock(aWorld, aX, aY, aZ, aBlock, aRenderer,
+ new ITexture[][]{GT_MethodHelper.getTexture(tTileEntity, aBlock, (byte) 0),
+ GT_MethodHelper.getTexture(tTileEntity, aBlock, (byte) 1),
+ GT_MethodHelper.getTexture(tTileEntity, aBlock, (byte) 2),
+ GT_MethodHelper.getTexture(tTileEntity, aBlock, (byte) 3),
+ GT_MethodHelper.getTexture(tTileEntity, aBlock, (byte) 4),
+ GT_MethodHelper.getTexture(tTileEntity, aBlock, (byte) 5)})
+ : false;
+ }
+
+ public static boolean renderStandardBlock(IBlockAccess aWorld, int aX, int aY, int aZ, Block aBlock,
+ RenderBlocks aRenderer, ITexture[][] aTextures) {
+ aBlock.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
+ aRenderer.setRenderBoundsFromBlock(aBlock);
+ renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[0], true);
+ renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[1], true);
+ renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[2], true);
+ renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[3], true);
+ renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[4], true);
+ renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[5], true);
+ return true;
+ }
+
+ public static boolean renderPipeBlock(IBlockAccess aWorld, int aX, int aY, int aZ, Block aBlock,
+ IPipeRenderedTileEntity aTileEntity, RenderBlocks aRenderer) {
+ byte aConnections = aTileEntity.getConnections();
+ if ((aConnections & 192) != 0) {
+ return renderStandardBlock(aWorld, aX, aY, aZ, aBlock, aRenderer);
+ } else {
+ float tThickness = aTileEntity.getThickNess();
+ if (tThickness >= 0.99F) {
+ return renderStandardBlock(aWorld, aX, aY, aZ, aBlock, aRenderer);
+ } else {
+ float sp = (1.0F - tThickness) / 2.0F;
+ byte tConnections = 0;
+
+ for (byte tIsCovered = 0; tIsCovered < 6; ++tIsCovered) {
+ if ((aConnections & 1 << tIsCovered) != 0) {
+ tConnections = (byte) (tConnections | 1 << (tIsCovered + 2) % 6);
+ }
+ }
+
+ boolean[] arg14 = new boolean[6];
+
+ for (byte tIcons = 0; tIcons < 6; ++tIcons) {
+ arg14[tIcons] = aTileEntity.getCoverIDAtSide(tIcons) != 0;
+ }
+
+ if (arg14[0] && arg14[1] && arg14[2] && arg14[3] && arg14[4] && arg14[5]) {
+ return renderStandardBlock(aWorld, aX, aY, aZ, aBlock, aRenderer);
+ } else {
+ ITexture[][] arg15 = new ITexture[6][];
+ ITexture[][] tCovers = new ITexture[6][];
+
+ for (byte i = 0; i < 6; ++i) {
+ tCovers[i] = GT_MethodHelper.getTexture((TileEntity) aTileEntity, aBlock, i);
+ arg15[i] = aTileEntity.getTextureUncovered(i);
+ }
+
+ if (tConnections == 0) {
+ aBlock.setBlockBounds(sp, sp, sp, sp + tThickness, sp + tThickness, sp + tThickness);
+ aRenderer.setRenderBoundsFromBlock(aBlock);
+ renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[0], false);
+ renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[1], false);
+ renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[2], false);
+ renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[3], false);
+ renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[4], false);
+ renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[5], false);
+ } else if (tConnections == 3) {
+ aBlock.setBlockBounds(0.0F, sp, sp, 1.0F, sp + tThickness, sp + tThickness);
+ aRenderer.setRenderBoundsFromBlock(aBlock);
+ renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[0], false);
+ renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[1], false);
+ renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[2], false);
+ renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[3], false);
+ if (!arg14[4]) {
+ renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[4], false);
+ }
+
+ if (!arg14[5]) {
+ renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[5], false);
+ }
+ } else if (tConnections == 12) {
+ aBlock.setBlockBounds(sp, 0.0F, sp, sp + tThickness, 1.0F, sp + tThickness);
+ aRenderer.setRenderBoundsFromBlock(aBlock);
+ renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[2], false);
+ renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[3], false);
+ renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[4], false);
+ renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[5], false);
+ if (!arg14[0]) {
+ renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[0], false);
+ }
+
+ if (!arg14[1]) {
+ renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[1], false);
+ }
+ } else if (tConnections == 48) {
+ aBlock.setBlockBounds(sp, sp, 0.0F, sp + tThickness, sp + tThickness, 1.0F);
+ aRenderer.setRenderBoundsFromBlock(aBlock);
+ renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[0], false);
+ renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[1], false);
+ renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[4], false);
+ renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[5], false);
+ if (!arg14[2]) {
+ renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[2], false);
+ }
+
+ if (!arg14[3]) {
+ renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[3], false);
+ }
+ } else {
+ if ((tConnections & 1) == 0) {
+ aBlock.setBlockBounds(sp, sp, sp, sp + tThickness, sp + tThickness, sp + tThickness);
+ aRenderer.setRenderBoundsFromBlock(aBlock);
+ renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[4], false);
+ } else {
+ aBlock.setBlockBounds(0.0F, sp, sp, sp, sp + tThickness, sp + tThickness);
+ aRenderer.setRenderBoundsFromBlock(aBlock);
+ renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[0], false);
+ renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[1], false);
+ renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[2], false);
+ renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[3], false);
+ if (!arg14[4]) {
+ renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[4], false);
+ }
+ }
+
+ if ((tConnections & 2) == 0) {
+ aBlock.setBlockBounds(sp, sp, sp, sp + tThickness, sp + tThickness, sp + tThickness);
+ aRenderer.setRenderBoundsFromBlock(aBlock);
+ renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[5], false);
+ } else {
+ aBlock.setBlockBounds(sp + tThickness, sp, sp, 1.0F, sp + tThickness, sp + tThickness);
+ aRenderer.setRenderBoundsFromBlock(aBlock);
+ renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[0], false);
+ renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[1], false);
+ renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[2], false);
+ renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[3], false);
+ if (!arg14[5]) {
+ renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[5], false);
+ }
+ }
+
+ if ((tConnections & 4) == 0) {
+ aBlock.setBlockBounds(sp, sp, sp, sp + tThickness, sp + tThickness, sp + tThickness);
+ aRenderer.setRenderBoundsFromBlock(aBlock);
+ renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[0], false);
+ } else {
+ aBlock.setBlockBounds(sp, 0.0F, sp, sp + tThickness, sp, sp + tThickness);
+ aRenderer.setRenderBoundsFromBlock(aBlock);
+ renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[2], false);
+ renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[3], false);
+ renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[4], false);
+ renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[5], false);
+ if (!arg14[0]) {
+ renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[0], false);
+ }
+ }
+
+ if ((tConnections & 8) == 0) {
+ aBlock.setBlockBounds(sp, sp, sp, sp + tThickness, sp + tThickness, sp + tThickness);
+ aRenderer.setRenderBoundsFromBlock(aBlock);
+ renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[1], false);
+ } else {
+ aBlock.setBlockBounds(sp, sp + tThickness, sp, sp + tThickness, 1.0F, sp + tThickness);
+ aRenderer.setRenderBoundsFromBlock(aBlock);
+ renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[2], false);
+ renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[3], false);
+ renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[4], false);
+ renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[5], false);
+ if (!arg14[1]) {
+ renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[1], false);
+ }
+ }
+
+ if ((tConnections & 16) == 0) {
+ aBlock.setBlockBounds(sp, sp, sp, sp + tThickness, sp + tThickness, sp + tThickness);
+ aRenderer.setRenderBoundsFromBlock(aBlock);
+ renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[2], false);
+ } else {
+ aBlock.setBlockBounds(sp, sp, 0.0F, sp + tThickness, sp + tThickness, sp);
+ aRenderer.setRenderBoundsFromBlock(aBlock);
+ renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[0], false);
+ renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[1], false);
+ renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[4], false);
+ renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[5], false);
+ if (!arg14[2]) {
+ renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[2], false);
+ }
+ }
+
+ if ((tConnections & 32) == 0) {
+ aBlock.setBlockBounds(sp, sp, sp, sp + tThickness, sp + tThickness, sp + tThickness);
+ aRenderer.setRenderBoundsFromBlock(aBlock);
+ renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[3], false);
+ } else {
+ aBlock.setBlockBounds(sp, sp, sp + tThickness, sp + tThickness, sp + tThickness, 1.0F);
+ aRenderer.setRenderBoundsFromBlock(aBlock);
+ renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[0], false);
+ renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[1], false);
+ renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[4], false);
+ renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[5], false);
+ if (!arg14[3]) {
+ renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[3], false);
+ }
+ }
+ }
+
+ if (arg14[0]) {
+ aBlock.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.125F, 1.0F);
+ aRenderer.setRenderBoundsFromBlock(aBlock);
+ renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[0], false);
+ renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[0], false);
+ if (!arg14[2]) {
+ renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[0], false);
+ }
+
+ if (!arg14[3]) {
+ renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[0], false);
+ }
+
+ if (!arg14[4]) {
+ renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[0], false);
+ }
+
+ if (!arg14[5]) {
+ renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[0], false);
+ }
+ }
+
+ if (arg14[1]) {
+ aBlock.setBlockBounds(0.0F, 0.875F, 0.0F, 1.0F, 1.0F, 1.0F);
+ aRenderer.setRenderBoundsFromBlock(aBlock);
+ renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[1], false);
+ renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[1], false);
+ if (!arg14[2]) {
+ renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[1], false);
+ }
+
+ if (!arg14[3]) {
+ renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[1], false);
+ }
+
+ if (!arg14[4]) {
+ renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[1], false);
+ }
+
+ if (!arg14[5]) {
+ renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[1], false);
+ }
+ }
+
+ if (arg14[2]) {
+ aBlock.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 0.125F);
+ aRenderer.setRenderBoundsFromBlock(aBlock);
+ if (!arg14[0]) {
+ renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[2], false);
+ }
+
+ if (!arg14[1]) {
+ renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[2], false);
+ }
+
+ renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[2], false);
+ renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[2], false);
+ if (!arg14[4]) {
+ renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[2], false);
+ }
+
+ if (!arg14[5]) {
+ renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[2], false);
+ }
+ }
+
+ if (arg14[3]) {
+ aBlock.setBlockBounds(0.0F, 0.0F, 0.875F, 1.0F, 1.0F, 1.0F);
+ aRenderer.setRenderBoundsFromBlock(aBlock);
+ if (!arg14[0]) {
+ renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[3], false);
+ }
+
+ if (!arg14[1]) {
+ renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[3], false);
+ }
+
+ renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[3], false);
+ renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[3], false);
+ if (!arg14[4]) {
+ renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[3], false);
+ }
+
+ if (!arg14[5]) {
+ renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[3], false);
+ }
+ }
+
+ if (arg14[4]) {
+ aBlock.setBlockBounds(0.0F, 0.0F, 0.0F, 0.125F, 1.0F, 1.0F);
+ aRenderer.setRenderBoundsFromBlock(aBlock);
+ if (!arg14[0]) {
+ renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[4], false);
+ }
+
+ if (!arg14[1]) {
+ renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[4], false);
+ }
+
+ if (!arg14[2]) {
+ renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[4], false);
+ }
+
+ if (!arg14[3]) {
+ renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[4], false);
+ }
+
+ renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[4], false);
+ renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[4], false);
+ }
+
+ if (arg14[5]) {
+ aBlock.setBlockBounds(0.875F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
+ aRenderer.setRenderBoundsFromBlock(aBlock);
+ if (!arg14[0]) {
+ renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[5], false);
+ }
+
+ if (!arg14[1]) {
+ renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[5], false);
+ }
+
+ if (!arg14[2]) {
+ renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[5], false);
+ }
+
+ if (!arg14[3]) {
+ renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[5], false);
+ }
+
+ renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[5], false);
+ renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[5], false);
+ }
+
+ aBlock.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
+ aRenderer.setRenderBoundsFromBlock(aBlock);
+ return true;
+ }
+ }
+ }
+ }
+
+ public static void renderNegativeYFacing(IBlockAccess aWorld, RenderBlocks aRenderer, Block aBlock, int aX, int aY,
+ int aZ, ITexture[] aIcon, boolean aFullBlock) {
+ if (aWorld != null) {
+ if (aFullBlock && !aBlock.shouldSideBeRendered(aWorld, aX, aY - 1, aZ, 0)) {
+ return;
+ }
+
+ Tessellator.instance
+ .setBrightness(aBlock.getMixedBrightnessForBlock(aWorld, aX, aFullBlock ? aY - 1 : aY, aZ));
+ }
+
+ if (aIcon != null) {
+ for (int i = 0; i < aIcon.length; ++i) {
+ if (aIcon[i] != null) {
+ aIcon[i].renderYNeg(aRenderer, aBlock, aX, aY, aZ);
+ }
+ }
+ }
+
+ aRenderer.flipTexture = false;
+ }
+
+ public static void renderPositiveYFacing(IBlockAccess aWorld, RenderBlocks aRenderer, Block aBlock, int aX, int aY,
+ int aZ, ITexture[] aIcon, boolean aFullBlock) {
+ if (aWorld != null) {
+ if (aFullBlock && !aBlock.shouldSideBeRendered(aWorld, aX, aY + 1, aZ, 1)) {
+ return;
+ }
+
+ Tessellator.instance
+ .setBrightness(aBlock.getMixedBrightnessForBlock(aWorld, aX, aFullBlock ? aY + 1 : aY, aZ));
+ }
+
+ if (aIcon != null) {
+ for (int i = 0; i < aIcon.length; ++i) {
+ if (aIcon[i] != null) {
+ aIcon[i].renderYPos(aRenderer, aBlock, aX, aY, aZ);
+ }
+ }
+ }
+
+ aRenderer.flipTexture = false;
+ }
+
+ public static void renderNegativeZFacing(IBlockAccess aWorld, RenderBlocks aRenderer, Block aBlock, int aX, int aY,
+ int aZ, ITexture[] aIcon, boolean aFullBlock) {
+ if (aWorld != null) {
+ if (aFullBlock && !aBlock.shouldSideBeRendered(aWorld, aX, aY, aZ - 1, 2)) {
+ return;
+ }
+
+ Tessellator.instance
+ .setBrightness(aBlock.getMixedBrightnessForBlock(aWorld, aX, aY, aFullBlock ? aZ - 1 : aZ));
+ }
+
+ aRenderer.flipTexture = !aFullBlock;
+ if (aIcon != null) {
+ for (int i = 0; i < aIcon.length; ++i) {
+ if (aIcon[i] != null) {
+ aIcon[i].renderZNeg(aRenderer, aBlock, aX, aY, aZ);
+ }
+ }
+ }
+
+ aRenderer.flipTexture = false;
+ }
+
+ public static void renderPositiveZFacing(IBlockAccess aWorld, RenderBlocks aRenderer, Block aBlock, int aX, int aY,
+ int aZ, ITexture[] aIcon, boolean aFullBlock) {
+ if (aWorld != null) {
+ if (aFullBlock && !aBlock.shouldSideBeRendered(aWorld, aX, aY, aZ + 1, 3)) {
+ return;
+ }
+
+ Tessellator.instance
+ .setBrightness(aBlock.getMixedBrightnessForBlock(aWorld, aX, aY, aFullBlock ? aZ + 1 : aZ));
+ }
+
+ if (aIcon != null) {
+ for (int i = 0; i < aIcon.length; ++i) {
+ if (aIcon[i] != null) {
+ aIcon[i].renderZPos(aRenderer, aBlock, aX, aY, aZ);
+ }
+ }
+ }
+
+ aRenderer.flipTexture = false;
+ }
+
+ public static void renderNegativeXFacing(IBlockAccess aWorld, RenderBlocks aRenderer, Block aBlock, int aX, int aY,
+ int aZ, ITexture[] aIcon, boolean aFullBlock) {
+ if (aWorld != null) {
+ if (aFullBlock && !aBlock.shouldSideBeRendered(aWorld, aX - 1, aY, aZ, 4)) {
+ return;
+ }
+
+ Tessellator.instance
+ .setBrightness(aBlock.getMixedBrightnessForBlock(aWorld, aFullBlock ? aX - 1 : aX, aY, aZ));
+ }
+
+ if (aIcon != null) {
+ for (int i = 0; i < aIcon.length; ++i) {
+ if (aIcon[i] != null) {
+ aIcon[i].renderXNeg(aRenderer, aBlock, aX, aY, aZ);
+ }
+ }
+ }
+
+ aRenderer.flipTexture = false;
+ }
+
+ public static void renderPositiveXFacing(IBlockAccess aWorld, RenderBlocks aRenderer, Block aBlock, int aX, int aY,
+ int aZ, ITexture[] aIcon, boolean aFullBlock) {
+ if (aWorld != null) {
+ if (aFullBlock && !aBlock.shouldSideBeRendered(aWorld, aX + 1, aY, aZ, 5)) {
+ return;
+ }
+
+ Tessellator.instance
+ .setBrightness(aBlock.getMixedBrightnessForBlock(aWorld, aFullBlock ? aX + 1 : aX, aY, aZ));
+ }
+
+ aRenderer.flipTexture = !aFullBlock;
+ if (aIcon != null) {
+ for (int i = 0; i < aIcon.length; ++i) {
+ if (aIcon[i] != null) {
+ aIcon[i].renderXPos(aRenderer, aBlock, aX, aY, aZ);
+ }
+ }
+ }
+
+ aRenderer.flipTexture = false;
+ }
+
+ public void renderInventoryBlock(Block aBlock, int aMeta, int aModelID, RenderBlocks aRenderer) {
+ aMeta += 30400;
+ if (aBlock instanceof GT_Block_Machines || aBlock instanceof GTPP_Block_Machines) {
+ if (aMeta > 0 && aMeta < GregTech_API.METATILEENTITIES.length
+ && GregTech_API.METATILEENTITIES[aMeta] != null
+ && !GregTech_API.METATILEENTITIES[aMeta].renderInInventory(aBlock, aMeta, aRenderer)) {
+ renderNormalInventoryMetaTileEntity(aBlock, aMeta, aRenderer);
+ }
+ }
+ aBlock.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
+ aRenderer.setRenderBoundsFromBlock(aBlock);
+ GL11.glTranslatef(0.5F, 0.5F, 0.5F);
+ }
+
+ public boolean renderWorldBlock(IBlockAccess aWorld, int aX, int aY, int aZ, Block aBlock, int aModelID,
+ RenderBlocks aRenderer) {
+ TileEntity aTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ return aTileEntity == null
+ ? false
+ : (aTileEntity instanceof IGregTechTileEntity
+ && ((IGregTechTileEntity) aTileEntity).getMetaTileEntity() != null
+ && ((IGregTechTileEntity) aTileEntity).getMetaTileEntity().renderInWorld(aWorld, aX, aY, aZ,
+ aBlock, aRenderer)
+ ? true
+ : (aTileEntity instanceof IPipeRenderedTileEntity
+ ? renderPipeBlock(aWorld, aX, aY, aZ, aBlock,
+ (IPipeRenderedTileEntity) aTileEntity, aRenderer)
+ : renderStandardBlock(aWorld, aX, aY, aZ, aBlock, aRenderer)));
+ }
+
+ public boolean shouldRender3DInInventory(int aModel) {
+ return true;
+ }
+
+ public int getRenderId() {
+ return this.mRenderID;
+ }
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/requirements/RequirementsBasicCubic.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/requirements/RequirementsBasicCubic.java
new file mode 100644
index 0000000000..e53a7e4738
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/requirements/RequirementsBasicCubic.java
@@ -0,0 +1,11 @@
+package gtPlusPlus.xmod.gregtech.common.requirements;
+
+import gtPlusPlus.xmod.gregtech.api.objects.MultiblockRequirements;
+
+public class RequirementsBasicCubic extends MultiblockRequirements {
+
+ public RequirementsBasicCubic( ) {
+ super(0, null);
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_TesseractGenerator.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_TesseractGenerator.java
new file mode 100644
index 0000000000..9c856840b0
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_TesseractGenerator.java
@@ -0,0 +1,730 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.automation;
+
+import static gtPlusPlus.core.lib.CORE.*;
+
+import java.util.UUID;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.inventory.ISidedInventory;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.world.World;
+
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.tileentity.IDigitalChest;
+import gregtech.api.interfaces.tileentity.IGregTechDeviceInformation;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.MetaTileEntity;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicTank;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Config;
+import gregtech.api.util.GT_Utility;
+
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.minecraft.PlayerUtils;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import gtPlusPlus.xmod.gregtech.common.helpers.tesseract.TesseractHelper;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.*;
+
+public class GT_MetaTileEntity_TesseractGenerator extends GT_MetaTileEntity_BasicTank {
+
+ public static int TESSERACT_ENERGY_COST_DIMENSIONAL = 512;
+ public static int TESSERACT_ENERGY_COST = 128;
+ public byte isWorking = 0;
+ public int oFrequency = 0;
+ public int mNeededEnergy = 0;
+ public int mFrequency = 0;
+ public UUID mOwner;
+
+ public GT_MetaTileEntity_TesseractGenerator(final int aID, final String aName, final String aNameRegional,
+ final int aTier) {
+ super(aID, aName, aNameRegional, aTier, 3, "");
+ }
+
+ public GT_MetaTileEntity_TesseractGenerator(final String aName, final int aTier, final String aDescription,
+ final ITexture[][][] aTextures) {
+ super(aName, aTier, 3, aDescription, aTextures);
+ }
+
+ @Override
+ public MetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
+ return new GT_MetaTileEntity_TesseractGenerator(this.mName, this.mTier, this.mDescription, this.mTextures);
+ }
+
+ @Override
+ public boolean isTransformerUpgradable() {
+ return true;
+ }
+
+ @Override
+ public boolean isOverclockerUpgradable() {
+ return false;
+ }
+
+ @Override
+ public boolean isSimpleMachine() {
+ return false;
+ }
+
+ @Override
+ public boolean isFacingValid(final byte aFacing) {
+ return true;
+ }
+
+ @Override
+ public boolean isEnetInput() {
+ return true;
+ }
+
+ @Override
+ public boolean isEnetOutput() {
+ return false;
+ }
+
+ @Override
+ public boolean isInputFacing(final byte aSide) {
+ return true;
+ }
+
+ @Override
+ public boolean isOutputFacing(final byte aSide) {
+ return aSide == this.getBaseMetaTileEntity().getBackFacing();
+ }
+
+ @Override
+ public boolean isValidSlot(final int aIndex) {
+ return false;
+ }
+
+ @Override
+ public long getMinimumStoredEU() {
+ return this.getBaseMetaTileEntity().getEUCapacity() / 2;
+ }
+
+ @Override
+ public long maxEUInput() {
+ return 512;
+ }
+
+ @Override
+ public long maxEUOutput() {
+ return 0;
+ }
+
+ @Override
+ public long maxEUStore() {
+ return 512 * 32;
+ }
+
+ @Override
+ public long maxSteamStore() {
+ return this.maxEUStore();
+ }
+
+ @Override
+ public boolean isAccessAllowed(final EntityPlayer aPlayer) {
+ return true;
+ }
+
+ @Override
+ public boolean ownerControl() {
+ return true;
+ }
+
+ @Override
+ public int getProgresstime() {
+ return (TesseractHelper.getGeneratorByFrequency(PlayerUtils.getPlayerOnServerFromUUID(mOwner),
+ this.mFrequency) == this) && (this.isWorking >= 20) ? 999 : 0;
+ }
+
+ @Override
+ public int maxProgresstime() {
+ return 1000;
+ }
+
+ @Override
+ public void saveNBTData(final NBTTagCompound aNBT) {
+ aNBT.setInteger("mFrequency", this.mFrequency);
+ if (mOwner != null)
+ aNBT.setString("mOwner", mOwner.toString());
+ }
+
+ @Override
+ public void loadNBTData(final NBTTagCompound aNBT) {
+ this.mFrequency = aNBT.getInteger("mFrequency");
+ try {
+ this.mOwner = UUID.fromString(aNBT.getString("mOnwer"));
+ }
+ catch (IllegalArgumentException i){
+
+ }
+ }
+
+ @Override
+ public void onConfigLoad(final GT_Config aConfig) {
+ int J = 1;
+ if (CORE.GTNH) {
+ J = 4;
+ }
+ TESSERACT_ENERGY_COST = 128*J;
+ TESSERACT_ENERGY_COST_DIMENSIONAL = 512*J;
+ }
+
+ @Override
+ public void onServerStart() {
+ sTesseractGeneratorOwnershipMap.clear();
+ sTesseractTerminalOwnershipMap.clear();
+ }
+
+ public void onServerStop() {
+ sTesseractGeneratorOwnershipMap.clear();
+ sTesseractTerminalOwnershipMap.clear();
+ }
+
+ @Override
+ public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer,
+ final byte aSide, final float aX, final float aY, final float aZ) {
+
+ if (this.mOwner == null) {
+ if (this.getBaseMetaTileEntity().getOwnerName() != null
+ && !this.getBaseMetaTileEntity().getOwnerName().equals("")) {
+ if (this.getBaseMetaTileEntity().getOwnerName().toLowerCase()
+ .equals(aPlayer.getDisplayName().toLowerCase())) {
+ this.mOwner = PlayerUtils.getPlayersUUIDByName(this.getBaseMetaTileEntity().getOwnerName());
+ }
+ }
+ }
+
+ if (aSide == this.getBaseMetaTileEntity().getFrontFacing()) {
+ if (aPlayer.getUniqueID().compareTo(this.mOwner) == 0) {
+ final float[] tCoords = GT_Utility.getClickedFacingCoords(aSide, aX, aY, aZ);
+ switch ((byte) ((byte) (int) (tCoords[0] * 2.0F) + (2 * (byte) (int) (tCoords[1] * 2.0F)))) {
+ case 0:
+ Logger.WARNING("Freq. -1 | " + this.mFrequency);
+ try {
+ CORE.sTesseractGeneratorOwnershipMap.get(mOwner).remove(this.mFrequency);
+ } catch (Throwable t) {
+ }
+ this.mFrequency -= 1;
+
+ break;
+ case 1:
+ Logger.WARNING("Freq. +1 | " + this.mFrequency);
+ try {
+ CORE.sTesseractGeneratorOwnershipMap.get(mOwner).remove(this.mFrequency);
+ } catch (Throwable t) {
+ }
+ this.mFrequency += 1;
+ default:
+ // Utils.LOG_WARNING("Did not click the correct place.");
+ break;
+ }
+ if (getGeneratorEntity(this.mFrequency) != null && getGeneratorEntity(this.mFrequency) != this){
+ GT_Utility.sendChatToPlayer(aPlayer, "Frequency: " + this.mFrequency + EnumChatFormatting.RED + " (Occupied)");
+ }
+ else {
+ GT_Utility.sendChatToPlayer(aPlayer, "Frequency: " + this.mFrequency);
+ }
+ } else if (aPlayer.getUniqueID().compareTo(this.mOwner) != 0){
+ GT_Utility.sendChatToPlayer(aPlayer, "This is not your Tesseract Generator to configure.");
+ }
+ }
+
+ return true;
+ }
+
+ @Override
+ public void onScrewdriverRightClick(final byte aSide, final EntityPlayer aPlayer, final float aX, final float aY,
+ final float aZ) {
+ if (aPlayer.getUniqueID().compareTo(this.mOwner) == 0) {
+ if (aSide == this.getBaseMetaTileEntity().getFrontFacing()) {
+ final float[] tCoords = GT_Utility.getClickedFacingCoords(aSide, aX, aY, aZ);
+ switch ((byte) ((byte) (int) (tCoords[0] * 2.0F) + (2 * (byte) (int) (tCoords[1] * 2.0F)))) {
+ case 0:
+ try {
+ CORE.sTesseractGeneratorOwnershipMap.get(mOwner).remove(this.mFrequency);
+ } catch (Throwable t) {
+ }
+ this.mFrequency -= 64;
+ break;
+ case 1:
+ try {
+ CORE.sTesseractGeneratorOwnershipMap.get(mOwner).remove(this.mFrequency);
+ } catch (Throwable t) {
+ }
+ this.mFrequency += 64;
+ break;
+ case 2:
+ try {
+ CORE.sTesseractGeneratorOwnershipMap.get(mOwner).remove(this.mFrequency);
+ } catch (Throwable t) {
+ }
+ this.mFrequency -= 512;
+ break;
+ case 3:
+ try {
+ CORE.sTesseractGeneratorOwnershipMap.get(mOwner).remove(this.mFrequency);
+ } catch (Throwable t) {
+ }
+ this.mFrequency += 512;
+ }
+ if (getGeneratorEntity(this.mFrequency) != null && getGeneratorEntity(this.mFrequency) != this){
+ GT_Utility.sendChatToPlayer(aPlayer, "Frequency: " + this.mFrequency + EnumChatFormatting.RED + " (Occupied)");
+ }
+ else {
+ GT_Utility.sendChatToPlayer(aPlayer, "Frequency: " + this.mFrequency);
+ }
+ }
+ } else {
+ GT_Utility.sendChatToPlayer(aPlayer, "This is not your Tesseract Generator to configure.");
+ }
+ }
+
+ public boolean allowCoverOnSide(final byte aSide, final int aCoverID) {
+ return aSide != this.getBaseMetaTileEntity().getFrontFacing();
+ }
+
+ @Override
+ public String[] getInfoData() {
+ final TileEntity tTileEntity = this.getBaseMetaTileEntity()
+ .getTileEntityAtSide(this.getBaseMetaTileEntity().getBackFacing());
+ if ((tTileEntity != null) && (this.getBaseMetaTileEntity().isAllowedToWork())
+ && ((tTileEntity instanceof IGregTechDeviceInformation))
+ && (((IGregTechDeviceInformation) tTileEntity).isGivingInformation())) {
+ return ((IGregTechDeviceInformation) tTileEntity).getInfoData();
+ }
+ return new String[] { "Tesseract Generator", "Freqency:", "" + this.mFrequency,
+ (getGeneratorEntity() == this) && (this.isWorking >= 20) ? "Active" : "Inactive" };
+ }
+
+ @Override
+ public boolean isGivingInformation() {
+ return true;
+ }
+
+ public boolean isSendingInformation() {
+ final TileEntity tTileEntity = this.getBaseMetaTileEntity()
+ .getTileEntityAtSide(this.getBaseMetaTileEntity().getBackFacing());
+ if ((tTileEntity != null) && (this.getBaseMetaTileEntity().isAllowedToWork())
+ && ((tTileEntity instanceof IGregTechDeviceInformation))) {
+ return ((IGregTechDeviceInformation) tTileEntity).isGivingInformation();
+ }
+ return false;
+ }
+
+ @Override
+ public boolean isDigitalChest() {
+ final TileEntity tTileEntity = this.getBaseMetaTileEntity()
+ .getTileEntityAtSide(this.getBaseMetaTileEntity().getBackFacing());
+ if ((tTileEntity != null) && (this.getBaseMetaTileEntity().isAllowedToWork())
+ && ((tTileEntity instanceof IDigitalChest))) {
+ return ((IDigitalChest) tTileEntity).isDigitalChest();
+ }
+ return false;
+ }
+
+ @Override
+ public ItemStack[] getStoredItemData() {
+ final TileEntity tTileEntity = this.getBaseMetaTileEntity()
+ .getTileEntityAtSide(this.getBaseMetaTileEntity().getBackFacing());
+ if ((tTileEntity != null) && (this.getBaseMetaTileEntity().isAllowedToWork())
+ && ((tTileEntity instanceof IDigitalChest))) {
+ return ((IDigitalChest) tTileEntity).getStoredItemData();
+ }
+ return new ItemStack[] {};
+ }
+
+ @Override
+ public void setItemCount(final int aCount) {
+ final TileEntity tTileEntity = this.getBaseMetaTileEntity()
+ .getTileEntityAtSide(this.getBaseMetaTileEntity().getBackFacing());
+ if ((tTileEntity != null) && (this.getBaseMetaTileEntity().isAllowedToWork())
+ && ((tTileEntity instanceof IDigitalChest))) {
+ ((IDigitalChest) tTileEntity).setItemCount(aCount);
+ }
+ }
+
+ @Override
+ public int getMaxItemCount() {
+ final TileEntity tTileEntity = this.getBaseMetaTileEntity()
+ .getTileEntityAtSide(this.getBaseMetaTileEntity().getBackFacing());
+ if ((tTileEntity != null) && (this.getBaseMetaTileEntity().isAllowedToWork())
+ && ((tTileEntity instanceof IDigitalChest))) {
+ return ((IDigitalChest) tTileEntity).getMaxItemCount();
+ }
+ return 0;
+ }
+
+ @Override
+ public boolean isItemValidForSlot(final int aIndex, final ItemStack aStack) {
+ final IInventory tTileEntity = this.getBaseMetaTileEntity()
+ .getIInventoryAtSide(this.getBaseMetaTileEntity().getBackFacing());
+ if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) {
+ return false;
+ }
+ return tTileEntity.isItemValidForSlot(aIndex, aStack);
+ }
+
+ @Override
+ public int[] getAccessibleSlotsFromSide(final int aSide) {
+ final IInventory tTileEntity = this.getBaseMetaTileEntity()
+ .getIInventoryAtSide(this.getBaseMetaTileEntity().getBackFacing());
+ if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) {
+ return new int[0];
+ }
+ if ((tTileEntity instanceof ISidedInventory)) {
+ return ((ISidedInventory) tTileEntity).getAccessibleSlotsFromSide(aSide);
+ }
+ final int[] rArray = new int[this.getSizeInventory()];
+ for (int i = 0; i < this.getSizeInventory(); i++) {
+ rArray[i] = i;
+ }
+ return rArray;
+ }
+
+ @Override
+ public boolean canInsertItem(final int aIndex, final ItemStack aStack, final int aSide) {
+ final IInventory tTileEntity = this.getBaseMetaTileEntity()
+ .getIInventoryAtSide(this.getBaseMetaTileEntity().getBackFacing());
+ if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) {
+ return false;
+ }
+ if ((tTileEntity instanceof ISidedInventory)) {
+ return ((ISidedInventory) tTileEntity).canInsertItem(aIndex, aStack, aSide);
+ }
+ return true;
+ }
+
+ @Override
+ public boolean canExtractItem(final int aIndex, final ItemStack aStack, final int aSide) {
+ final IInventory tTileEntity = this.getBaseMetaTileEntity()
+ .getIInventoryAtSide(this.getBaseMetaTileEntity().getBackFacing());
+ if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) {
+ return false;
+ }
+ if ((tTileEntity instanceof ISidedInventory)) {
+ return ((ISidedInventory) tTileEntity).canExtractItem(aIndex, aStack, aSide);
+ }
+ return true;
+ }
+
+ @Override
+ public int getSizeInventory() {
+ final IInventory tTileEntity = this.getBaseMetaTileEntity()
+ .getIInventoryAtSide(this.getBaseMetaTileEntity().getBackFacing());
+ if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) {
+ return 0;
+ }
+ return tTileEntity.getSizeInventory();
+ }
+
+ @Override
+ public ItemStack getStackInSlot(final int aIndex) {
+ final IInventory tTileEntity = this.getBaseMetaTileEntity()
+ .getIInventoryAtSide(this.getBaseMetaTileEntity().getBackFacing());
+ if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) {
+ return null;
+ }
+ return tTileEntity.getStackInSlot(aIndex);
+ }
+
+ @Override
+ public void setInventorySlotContents(final int aIndex, final ItemStack aStack) {
+ final IInventory tTileEntity = this.getBaseMetaTileEntity()
+ .getIInventoryAtSide(this.getBaseMetaTileEntity().getBackFacing());
+ if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) {
+ return;
+ }
+ tTileEntity.setInventorySlotContents(aIndex, aStack);
+ }
+
+ @Override
+ public ItemStack decrStackSize(final int aIndex, final int aAmount) {
+ final IInventory tTileEntity = this.getBaseMetaTileEntity()
+ .getIInventoryAtSide(this.getBaseMetaTileEntity().getBackFacing());
+ if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) {
+ return null;
+ }
+ return tTileEntity.decrStackSize(aIndex, aAmount);
+ }
+
+ @Override
+ public String getInventoryName() {
+ final IInventory tTileEntity = this.getBaseMetaTileEntity()
+ .getIInventoryAtSide(this.getBaseMetaTileEntity().getBackFacing());
+ if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) {
+ return "";
+ }
+ return tTileEntity.getInventoryName();
+ }
+
+ @Override
+ public int getInventoryStackLimit() {
+ final IInventory tTileEntity = this.getBaseMetaTileEntity()
+ .getIInventoryAtSide(this.getBaseMetaTileEntity().getBackFacing());
+ if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) {
+ return 0;
+ }
+ return tTileEntity.getInventoryStackLimit();
+ }
+
+ @Override
+ public boolean canFill(final ForgeDirection aSide, final Fluid aFluid) {
+ final IFluidHandler tTileEntity = this.getBaseMetaTileEntity()
+ .getITankContainerAtSide(this.getBaseMetaTileEntity().getBackFacing());
+ if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) {
+ return false;
+ }
+ return tTileEntity.canFill(aSide, aFluid);
+ }
+
+ @Override
+ public boolean canDrain(final ForgeDirection aSide, final Fluid aFluid) {
+ final IFluidHandler tTileEntity = this.getBaseMetaTileEntity()
+ .getITankContainerAtSide(this.getBaseMetaTileEntity().getBackFacing());
+ if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) {
+ return false;
+ }
+ return tTileEntity.canDrain(aSide, aFluid);
+ }
+
+ @Override
+ public FluidTankInfo[] getTankInfo(final ForgeDirection aSide) {
+ final IFluidHandler tTileEntity = this.getBaseMetaTileEntity()
+ .getITankContainerAtSide(this.getBaseMetaTileEntity().getBackFacing());
+ if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) {
+ return new FluidTankInfo[0];
+ }
+ return tTileEntity.getTankInfo(aSide);
+ }
+
+ @Override
+ public int fill_default(final ForgeDirection aDirection, final FluidStack aFluid, final boolean doFill) {
+ final IFluidHandler tTileEntity = this.getBaseMetaTileEntity()
+ .getITankContainerAtSide(this.getBaseMetaTileEntity().getBackFacing());
+ if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) {
+ return 0;
+ }
+ return tTileEntity.fill(aDirection, aFluid, doFill);
+ }
+
+ @Override
+ public FluidStack drain(final ForgeDirection aDirection, final int maxDrain, final boolean doDrain) {
+ final IFluidHandler tTileEntity = this.getBaseMetaTileEntity()
+ .getITankContainerAtSide(this.getBaseMetaTileEntity().getBackFacing());
+ if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) {
+ return null;
+ }
+ return tTileEntity.drain(aDirection, maxDrain, doDrain);
+ }
+
+ @Override
+ public FluidStack drain(final ForgeDirection aSide, final FluidStack aFluid, final boolean doDrain) {
+ final IFluidHandler tTileEntity = this.getBaseMetaTileEntity()
+ .getITankContainerAtSide(this.getBaseMetaTileEntity().getBackFacing());
+ if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) {
+ return null;
+ }
+ return tTileEntity.drain(aSide, aFluid, doDrain);
+ }
+
+ public boolean addEnergyConsumption(final GT_MetaTileEntity_TesseractTerminal aTerminal) {
+ if (!this.getBaseMetaTileEntity().isAllowedToWork()) {
+ return false;
+ }
+ int J = (aTerminal.getBaseMetaTileEntity().getWorld() == this.getBaseMetaTileEntity().getWorld()
+ ? TESSERACT_ENERGY_COST : TESSERACT_ENERGY_COST_DIMENSIONAL);
+
+ if (CORE.GTNH) {
+ J *= 4;
+ }
+
+ this.mNeededEnergy += J;
+
+ return true;
+ }
+
+ public boolean isValidTesseractGenerator(final String aOwnerName, final boolean aWorkIrrelevant) {
+ return (this.getBaseMetaTileEntity() != null) && (!this.getBaseMetaTileEntity().isInvalidTileEntity())
+ && (this.getBaseMetaTileEntity().isAllowedToWork())
+ && ((aOwnerName == null) || (this.getBaseMetaTileEntity().getOwnerName().equals(aOwnerName)))
+ && ((aWorkIrrelevant) || (this.isWorking >= 20));
+ }
+
+ @Override
+ public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ // TODO Auto-generated method stub
+ super.onPreTick(aBaseMetaTileEntity, aTick);
+ }
+
+ @Override
+ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ //Utils.LOG_WARNING("Ticking Generator. 0");
+ if (this.getBaseMetaTileEntity().isServerSide()) {
+ //Utils.LOG_WARNING("Ticking Generator.");
+ // Set owner
+ if (PlayerUtils.getPlayersUUIDByName(this.getBaseMetaTileEntity().getOwnerName()) != null) {
+ if (this.mOwner == null) {
+ Logger.WARNING("Setting Generators Owner. 1");
+ this.mOwner = PlayerUtils.getPlayersUUIDByName(this.getBaseMetaTileEntity().getOwnerName());
+ }
+ }
+
+ if (this.mFrequency != this.oFrequency) {
+
+ Logger.WARNING("mFreq != oFreq");
+
+ if (getGeneratorEntity() == this) {
+ getGeneratorEntity(this.oFrequency);
+ this.getBaseMetaTileEntity().issueBlockUpdate();
+ Logger.WARNING("this Gen == oFreq on map - do block update");
+ }
+ Logger.WARNING("mFreq will be set to oFreq");
+ this.oFrequency = this.mFrequency;
+ }
+ if ((this.getBaseMetaTileEntity().isAllowedToWork())
+ && (this.getBaseMetaTileEntity().decreaseStoredEnergyUnits(this.mNeededEnergy, false))) {
+ //Utils.LOG_WARNING("Can Work & Has Energy");
+ if ((getGeneratorEntity(Integer.valueOf(this.mFrequency)) == null)
+ || (!getGeneratorEntity(Integer.valueOf(this.mFrequency)).isValidTesseractGenerator(null,
+ true))) {
+ //Utils.LOG_WARNING("storing TE I think to mFreq map?");
+ TesseractHelper.setGeneratorOwnershipByPlayer(PlayerUtils.getPlayerOnServerFromUUID(mOwner),
+ this.mFrequency, this);
+ }
+ } else {
+ if (getGeneratorEntity(Integer.valueOf(this.mFrequency)) == this) {
+ Logger.WARNING("this gen == mFreq on map - do block update");
+ TesseractHelper.removeGenerator(PlayerUtils.getPlayerOnServerFromUUID(mOwner), this.mFrequency);
+ this.getBaseMetaTileEntity().issueBlockUpdate();
+ }
+ this.isWorking = 0;
+ }
+ if (getGeneratorEntity(Integer.valueOf(this.mFrequency)) == this) {
+ //Utils.LOG_WARNING("mFreq == this - do work related things");
+ if (this.isWorking < 20) {
+ this.isWorking = ((byte) (this.isWorking + 1));
+ }
+ if (this.isWorking == 20) {
+ this.getBaseMetaTileEntity().issueBlockUpdate();
+ this.isWorking = ((byte) (this.isWorking + 1));
+ }
+ } else {
+ this.isWorking = 0;
+ }
+ this.mNeededEnergy = 0;
+ }
+ super.onPostTick(aBaseMetaTileEntity, aTick);
+ }
+
+ @Override
+ public String[] getDescription() {
+ return new String[] { this.mDescription,
+ "Generates a Tesseract for the attached Inventory",
+ "Connect with pipes to insert items",
+ "Consumes "+TESSERACT_ENERGY_COST+"EU/t for same dimension transfers",
+ "Consumes "+TESSERACT_ENERGY_COST_DIMENSIONAL+"EU/t for cross dimensional transfers",
+ CORE.GT_Tooltip};
+ }
+
+ @Override
+ public boolean allowPullStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide,
+ final ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide,
+ final ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public ITexture[][][] getTextureSet(final ITexture[] aTextures) {
+ return new ITexture[0][0][0];
+ }
+
+ @Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing,
+ final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+ return aSide == aFacing
+ ? new ITexture[] { new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Dimensional),
+ new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Screen_Frequency) }
+ : new ITexture[] { new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Dimensional),
+ new GT_RenderedTexture(Textures.BlockIcons.VOID) };
+ }
+
+ // To-Do?
+ @Override
+ public boolean doesFillContainers() {
+ return false;
+ }
+
+ @Override
+ public boolean doesEmptyContainers() {
+ return false;
+ }
+
+ @Override
+ public boolean canTankBeFilled() {
+ return false;
+ }
+
+ @Override
+ public boolean canTankBeEmptied() {
+ return false;
+ }
+
+ @Override
+ public boolean displaysItemStack() {
+ return false;
+ }
+
+ @Override
+ public boolean displaysStackSize() {
+ return false;
+ }
+
+ private GT_MetaTileEntity_TesseractGenerator getGeneratorEntity() {
+ GT_MetaTileEntity_TesseractGenerator thisGenerator = TesseractHelper
+ .getGeneratorByFrequency(PlayerUtils.getPlayerOnServerFromUUID(mOwner), this.mFrequency);
+ if (thisGenerator != null) {
+ return thisGenerator;
+ }
+ return null;
+ }
+
+ private GT_MetaTileEntity_TesseractGenerator getGeneratorEntity(int frequency) {
+ GT_MetaTileEntity_TesseractGenerator thisGenerator = TesseractHelper
+ .getGeneratorByFrequency(PlayerUtils.getPlayerOnServerFromUUID(mOwner), frequency);
+ if (thisGenerator != null) {
+ return thisGenerator;
+ }
+ return null;
+ }
+
+ @Override
+ public void onCreated(ItemStack aStack, World aWorld, EntityPlayer aPlayer) {
+ if (this.getBaseMetaTileEntity().getOwnerName() != null
+ && !this.getBaseMetaTileEntity().getOwnerName().equals("")) {
+ this.mOwner = PlayerUtils.getPlayersUUIDByName(this.getBaseMetaTileEntity().getOwnerName());
+ Logger.WARNING("Setting Generators Owner. 2");
+ }
+ super.onCreated(aStack, aWorld, aPlayer);
+ }
+
+ @Override
+ public void onRemoval() {
+ try {
+ CORE.sTesseractGeneratorOwnershipMap.get(mOwner).remove(this.mFrequency);
+ } catch (Throwable t) {
+ }
+ super.onRemoval();
+ }
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_TesseractTerminal.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_TesseractTerminal.java
new file mode 100644
index 0000000000..088a596410
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_TesseractTerminal.java
@@ -0,0 +1,581 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.automation;
+
+import java.util.UUID;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.world.World;
+
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.MetaTileEntity;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicTank;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Config;
+import gregtech.api.util.GT_Utility;
+
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.minecraft.PlayerUtils;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import gtPlusPlus.xmod.gregtech.common.helpers.tesseract.TesseractHelper;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidStack;
+import net.minecraftforge.fluids.FluidTankInfo;
+
+public class GT_MetaTileEntity_TesseractTerminal extends GT_MetaTileEntity_BasicTank {
+ public int mFrequency = 0;
+ public UUID mOwner;
+ public boolean mDidWork = false;
+ public static boolean sInterDimensionalTesseractAllowed = true;
+ private static int TESSERACT_ENERGY_COST = 128;
+ private static int TESSERACT_ENERGY_COST_DIMENSIONAL = 512;
+
+ public GT_MetaTileEntity_TesseractTerminal(final int aID, final String aName, final String aNameRegional,
+ final int aTier) {
+ super(aID, aName, aNameRegional, aTier, 3, "");
+ }
+
+ public GT_MetaTileEntity_TesseractTerminal(final String aName, final int aTier, final String aDescription,
+ final ITexture[][][] aTextures) {
+ super(aName, aTier, 3, aDescription, aTextures);
+ }
+
+ @Override
+ public MetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
+ return new GT_MetaTileEntity_TesseractTerminal(this.mName, this.mTier, this.mDescription, this.mTextures);
+ }
+
+ @Override
+ public boolean isTransformerUpgradable() {
+ return false;
+ }
+
+ @Override
+ public boolean isOverclockerUpgradable() {
+ return false;
+ }
+
+ @Override
+ public boolean isSimpleMachine() {
+ return false;
+ }
+
+ @Override
+ public boolean isFacingValid(final byte aFacing) {
+ return true;
+ }
+
+ @Override
+ public boolean isOutputFacing(final byte aSide) {
+ return aSide == this.getBaseMetaTileEntity().getBackFacing();
+ }
+
+ @Override
+ public boolean isValidSlot(final int aIndex) {
+ return false;
+ }
+
+ @Override
+ public long getMinimumStoredEU() {
+ return (this.getBaseMetaTileEntity().getEUCapacity() / 100);
+ }
+
+ @Override
+ public long maxEUInput() {
+ return TESSERACT_ENERGY_COST_DIMENSIONAL;
+ }
+
+ @Override
+ public boolean isAccessAllowed(final EntityPlayer aPlayer) {
+ return true;
+ }
+
+ @Override
+ public long maxEUStore() {
+ return TESSERACT_ENERGY_COST_DIMENSIONAL * 8 * 32;
+ }
+
+ @Override
+ public long maxSteamStore() {
+ return this.maxEUStore();
+ }
+
+ @Override
+ public boolean ownerControl() {
+ return true;
+ }
+
+ @Override
+ public int getProgresstime() {
+ return this.getTesseract(this.mFrequency, false) != null ? 999 : 0;
+ }
+
+ @Override
+ public int maxProgresstime() {
+ return 1000;
+ }
+
+ @Override
+ public void saveNBTData(final NBTTagCompound aNBT) {
+ aNBT.setInteger("mFrequency", this.mFrequency);
+ aNBT.setString("mOwner", mOwner.toString());
+ }
+
+ @Override
+ public void loadNBTData(final NBTTagCompound aNBT) {
+ this.mFrequency = aNBT.getInteger("mFrequency");
+ this.mOwner = UUID.fromString(aNBT.getString("mOnwer"));
+ }
+
+ @Override
+ public void onConfigLoad(final GT_Config aConfig) {
+ sInterDimensionalTesseractAllowed = true;
+ if (CORE.GTNH) {
+ TESSERACT_ENERGY_COST = 512;
+ TESSERACT_ENERGY_COST_DIMENSIONAL = 2048;
+ }
+ else {
+ TESSERACT_ENERGY_COST = 128;
+ TESSERACT_ENERGY_COST_DIMENSIONAL = 512;
+ }
+ }
+
+ @Override
+ public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer,
+ final byte aSide, final float aX, final float aY, final float aZ) {
+
+ if (this.mOwner == null) {
+ if (this.getBaseMetaTileEntity().getOwnerName() != null
+ && !this.getBaseMetaTileEntity().getOwnerName().equals("")) {
+ if (this.getBaseMetaTileEntity().getOwnerName().toLowerCase()
+ .equals(aPlayer.getDisplayName().toLowerCase())) {
+ this.mOwner = PlayerUtils.getPlayersUUIDByName(this.getBaseMetaTileEntity().getOwnerName());
+ }
+ }
+ }
+
+ if (aPlayer.getUniqueID().compareTo(this.mOwner) == 0) {
+ if (aSide == this.getBaseMetaTileEntity().getFrontFacing()) {
+ final float[] tCoords = GT_Utility.getClickedFacingCoords(aSide, aX, aY, aZ);
+ switch ((byte) ((byte) (int) (tCoords[0] * 2.0F) + (2 * (byte) (int) (tCoords[1] * 2.0F)))) {
+ case 0:
+ //Utils.LOG_WARNING("Freq. -1 | " + this.mFrequency);
+ try {
+ CORE.sTesseractTerminalOwnershipMap.get(mOwner).remove(this.mFrequency);
+ } catch (Throwable t) {
+ }
+ this.mFrequency -= 1;
+ break;
+ case 1:
+ //Utils.LOG_WARNING("Freq. +1 | " + this.mFrequency);
+ try {
+ CORE.sTesseractTerminalOwnershipMap.get(mOwner).remove(this.mFrequency);
+ } catch (Throwable t) {
+ }
+ this.mFrequency += 1;
+ default:
+ // Utils.LOG_WARNING("Did not click the correct place.");
+ try {
+ CORE.sTesseractTerminalOwnershipMap.get(mOwner).remove(this.mFrequency);
+ } catch (Throwable t) {
+ }
+ break;
+ }
+ PlayerUtils.messagePlayer(aPlayer, "Frequency: " + this.mFrequency);
+ if (this.getTesseract(this.mFrequency, false) != null) {
+ PlayerUtils.messagePlayer(aPlayer,
+ new StringBuilder().append(EnumChatFormatting.GREEN).append(" (Connected)").toString());
+ }
+ }
+ } else if (aPlayer.getUniqueID().compareTo(this.mOwner) != 0){
+ GT_Utility.sendChatToPlayer(aPlayer, "This is not your Tesseract Terminal to configure.");
+ }
+ return true;
+ }
+
+ @Override
+ public void onScrewdriverRightClick(final byte aSide, final EntityPlayer aPlayer, final float aX, final float aY,
+ final float aZ) {
+ if (aPlayer.getUniqueID().compareTo(this.mOwner) == 0) {
+ if (aSide == this.getBaseMetaTileEntity().getFrontFacing()) {
+ final float[] tCoords = GT_Utility.getClickedFacingCoords(aSide, aX, aY, aZ);
+ switch ((byte) ((byte) (int) (tCoords[0] * 2.0F) + (2 * (byte) (int) (tCoords[1] * 2.0F)))) {
+ case 0:
+ try {
+ CORE.sTesseractTerminalOwnershipMap.get(mOwner).remove(this.mFrequency);
+ } catch (Throwable t) {
+ }
+ this.mFrequency -= 64;
+ break;
+ case 1:
+ try {
+ CORE.sTesseractTerminalOwnershipMap.get(mOwner).remove(this.mFrequency);
+ } catch (Throwable t) {
+ }
+ this.mFrequency += 64;
+ break;
+ case 2:
+ try {
+ CORE.sTesseractTerminalOwnershipMap.get(mOwner).remove(this.mFrequency);
+ } catch (Throwable t) {
+ }
+ this.mFrequency -= 512;
+ break;
+ case 3:
+ try {
+ CORE.sTesseractTerminalOwnershipMap.get(mOwner).remove(this.mFrequency);
+ } catch (Throwable t) {
+ }
+ this.mFrequency += 512;
+ }
+ GT_Utility.sendChatToPlayer(aPlayer,
+ "Frequency: " + this.mFrequency
+ + (this.getTesseract(this.mFrequency, false) == null ? ""
+ : new StringBuilder().append(EnumChatFormatting.GREEN).append(" (Connected)")
+ .toString()));
+ }
+ } else if (aPlayer.getUniqueID().compareTo(this.mOwner) != 0){
+ GT_Utility.sendChatToPlayer(aPlayer, "This is not your Tesseract Terminal to configure.");
+ }
+ }
+
+ public boolean allowCoverOnSide(final byte aSide, final int aCoverID) {
+ return aSide != this.getBaseMetaTileEntity().getFrontFacing();
+ }
+
+ public GT_MetaTileEntity_TesseractGenerator getTesseract(final int aFrequency, final boolean aWorkIrrelevant) {
+ final GT_MetaTileEntity_TesseractGenerator rTesseract = TesseractHelper
+ .getGeneratorByFrequency(PlayerUtils.getPlayerOnServerFromUUID(mOwner), aFrequency);
+ if (rTesseract == null) {
+ return null;
+ }
+ if (!TesseractHelper.isGeneratorOwnedByPlayer(PlayerUtils.getPlayerOnServerFromUUID(mOwner), rTesseract)) {
+ return null;
+ }
+ if (rTesseract.mFrequency != aFrequency) {
+ TesseractHelper.setTerminalOwnershipByPlayer(PlayerUtils.getPlayerOnServerFromUUID(mOwner),
+ Integer.valueOf(aFrequency), null);
+ return null;
+ }
+ if (!rTesseract.isValidTesseractGenerator(this.getBaseMetaTileEntity().getOwnerName(), aWorkIrrelevant)) {
+ return null;
+ }
+ if ((!sInterDimensionalTesseractAllowed)
+ && (rTesseract.getBaseMetaTileEntity().getWorld() != this.getBaseMetaTileEntity().getWorld())) {
+ return null;
+ }
+ return rTesseract;
+ }
+
+ @Override
+ public String[] getInfoData() {
+ final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false);
+ if ((tTileEntity != null) && (this.getBaseMetaTileEntity().isAllowedToWork())
+ && (tTileEntity.isSendingInformation())) {
+ return tTileEntity.getInfoData();
+ }
+ return new String[] { "Tesseract Generator", "Freqency:", "" + this.mFrequency,
+ this.getTesseract(this.mFrequency, false) != null ? "Active" : "Inactive" };
+ }
+
+ @Override
+ public boolean isGivingInformation() {
+ return true;
+ }
+
+ @Override
+ public boolean isDigitalChest() {
+ final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false);
+ if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) {
+ return false;
+ }
+ return tTileEntity.isDigitalChest();
+ }
+
+ @Override
+ public ItemStack[] getStoredItemData() {
+ final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false);
+ if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) {
+ return null;
+ }
+ return tTileEntity.getStoredItemData();
+ }
+
+ @Override
+ public void setItemCount(final int aCount) {
+ final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false);
+ if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) {
+ return;
+ }
+ tTileEntity.setItemCount(aCount);
+ }
+
+ @Override
+ public int getMaxItemCount() {
+ final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false);
+ if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) {
+ return 0;
+ }
+ return tTileEntity.getMaxItemCount();
+ }
+
+ @Override
+ public boolean isItemValidForSlot(final int aIndex, final ItemStack aStack) {
+ final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false);
+ if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) {
+ return false;
+ }
+ return tTileEntity.isItemValidForSlot(aIndex, aStack);
+ }
+
+ @Override
+ public int[] getAccessibleSlotsFromSide(final int aSide) {
+ final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false);
+ if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) {
+ return new int[0];
+ }
+ return tTileEntity.getAccessibleSlotsFromSide(aSide);
+ }
+
+ @Override
+ public boolean canInsertItem(final int aIndex, final ItemStack aStack, final int aSide) {
+ final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false);
+ if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) {
+ return false;
+ }
+ return tTileEntity.canInsertItem(aIndex, aStack, aSide);
+ }
+
+ @Override
+ public boolean canExtractItem(final int aIndex, final ItemStack aStack, final int aSide) {
+ final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false);
+ if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) {
+ return false;
+ }
+ return tTileEntity.canExtractItem(aIndex, aStack, aSide);
+ }
+
+ @Override
+ public int getSizeInventory() {
+ final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false);
+ if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) {
+ return 0;
+ }
+ return tTileEntity.getSizeInventory();
+ }
+
+ @Override
+ public ItemStack getStackInSlot(final int aIndex) {
+ final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false);
+ if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) {
+ return null;
+ }
+ return tTileEntity.getStackInSlot(aIndex);
+ }
+
+ @Override
+ public void setInventorySlotContents(final int aIndex, final ItemStack aStack) {
+ final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false);
+ if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) {
+ return;
+ }
+ tTileEntity.setInventorySlotContents(aIndex, aStack);
+ }
+
+ @Override
+ public ItemStack decrStackSize(final int aIndex, final int aAmount) {
+ final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false);
+ if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) {
+ return null;
+ }
+ return tTileEntity.decrStackSize(aIndex, aAmount);
+ }
+
+ @Override
+ public String getInventoryName() {
+ final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false);
+ if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) {
+ return "";
+ }
+ return tTileEntity.getInventoryName();
+ }
+
+ @Override
+ public int getInventoryStackLimit() {
+ final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false);
+ if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) {
+ return 0;
+ }
+ return tTileEntity.getInventoryStackLimit();
+ }
+
+ @Override
+ public boolean canFill(final ForgeDirection aSide, final Fluid aFluid) {
+ final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false);
+ if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) {
+ return false;
+ }
+ return tTileEntity.canFill(aSide, aFluid);
+ }
+
+ @Override
+ public boolean canDrain(final ForgeDirection aSide, final Fluid aFluid) {
+ final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false);
+ if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) {
+ return false;
+ }
+ return tTileEntity.canDrain(aSide, aFluid);
+ }
+
+ @Override
+ public FluidTankInfo[] getTankInfo(final ForgeDirection aSide) {
+ final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false);
+ if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) {
+ return new FluidTankInfo[0];
+ }
+ return tTileEntity.getTankInfo(aSide);
+ }
+
+ @Override
+ public int fill_default(final ForgeDirection aDirection, final FluidStack aFluid, final boolean doFill) {
+ final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false);
+ if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) {
+ return 0;
+ }
+ return tTileEntity.fill(aDirection, aFluid, doFill);
+ }
+
+ @Override
+ public FluidStack drain(final ForgeDirection aDirection, final int maxDrain, final boolean doDrain) {
+ final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false);
+ if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) {
+ return null;
+ }
+ return tTileEntity.drain(aDirection, maxDrain, doDrain);
+ }
+
+ @Override
+ public FluidStack drain(final ForgeDirection aSide, final FluidStack aFluid, final boolean doDrain) {
+ final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false);
+ if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) {
+ return null;
+ }
+ return tTileEntity.drain(aSide, aFluid, doDrain);
+ }
+
+ @Override
+ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ if ((this.getBaseMetaTileEntity().isServerSide()) && (this.getBaseMetaTileEntity().isAllowedToWork())) {
+ // Set owner
+ if (PlayerUtils.getPlayersUUIDByName(this.getBaseMetaTileEntity().getOwnerName()) != null) {
+ if (this.mOwner == null) {
+ this.mOwner = PlayerUtils.getPlayersUUIDByName(this.getBaseMetaTileEntity().getOwnerName());
+ }
+ }
+ final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, true);
+ if (tTileEntity != null) {
+ tTileEntity.addEnergyConsumption(this);
+ if ((!this.mDidWork) && (this.getTesseract(this.mFrequency, false) != null)) {
+ this.mDidWork = true;
+ this.getBaseMetaTileEntity().issueBlockUpdate();
+ this.getBaseMetaTileEntity().decreaseStoredEnergyUnits(128, false);
+ }
+ } else if (this.mDidWork == true) {
+ this.mDidWork = false;
+ this.getBaseMetaTileEntity().issueBlockUpdate();
+ }
+ }
+ }
+
+ @Override
+ public String[] getDescription() {
+ return new String[] { this.mDescription,
+ "Accesses Tesseract Generators remotely",
+ "Connect with pipes to extract items or fluids",
+ "Outputs from the back face",
+ "Consumes "+TESSERACT_ENERGY_COST+"EU/t for same dimension transfers",
+ "Consumes "+TESSERACT_ENERGY_COST_DIMENSIONAL+"EU/t for cross dimensional transfers",
+ CORE.GT_Tooltip};
+ }
+
+ @Override
+ public boolean allowPullStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide,
+ final ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide,
+ final ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public ITexture[][][] getTextureSet(final ITexture[] aTextures) {
+ return new ITexture[0][0][0];
+ }
+
+ @Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing,
+ final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+ return aSide == aFacing
+ ? new ITexture[] { new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Dimensional),
+ new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Screen_Frequency) }
+ : new ITexture[] { new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Dimensional),
+ new GT_RenderedTexture(Textures.BlockIcons.VOID) };
+ }
+
+ // To-Do?
+ @Override
+ public boolean doesFillContainers() {
+ return false;
+ }
+
+ @Override
+ public boolean doesEmptyContainers() {
+ return false;
+ }
+
+ @Override
+ public boolean canTankBeFilled() {
+ return false;
+ }
+
+ @Override
+ public boolean canTankBeEmptied() {
+ return false;
+ }
+
+ @Override
+ public boolean displaysItemStack() {
+ return false;
+ }
+
+ @Override
+ public boolean displaysStackSize() {
+ return false;
+ }
+
+ @Override
+ public void onCreated(ItemStack aStack, World aWorld, EntityPlayer aPlayer) {
+ if (this.getBaseMetaTileEntity().getOwnerName() != null
+ && !this.getBaseMetaTileEntity().getOwnerName().equals("")) {
+ this.mOwner = PlayerUtils.getPlayersUUIDByName(this.getBaseMetaTileEntity().getOwnerName());
+ }
+ super.onCreated(aStack, aWorld, aPlayer);
+ }
+
+ @Override
+ public void onRemoval() {
+ try {
+ CORE.sTesseractTerminalOwnershipMap.get(mOwner).remove(this.mFrequency);
+ } catch (Throwable t) {
+ }
+ super.onRemoval();
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_Boiler_Base.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_Boiler_Base.java
new file mode 100644
index 0000000000..4173489be6
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_Boiler_Base.java
@@ -0,0 +1,296 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.generators;
+
+import cpw.mods.fml.common.registry.GameRegistry;
+import gregtech.api.enums.Materials;
+import gregtech.api.enums.OrePrefixes;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.MetaTileEntity;
+import gregtech.api.objects.GT_ItemStack;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_OreDictUnificator;
+import gregtech.api.util.GT_Utility;
+import gregtech.common.tileentities.boilers.GT_MetaTileEntity_Boiler;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.xmod.gregtech.api.gui.CONTAINER_AdvancedBoiler;
+import gtPlusPlus.xmod.gregtech.api.gui.GUI_AdvancedBoiler;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.tileentity.TileEntityFurnace;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.FluidTankInfo;
+
+public class GT_MetaTileEntity_Boiler_Base extends GT_MetaTileEntity_Boiler {
+
+ private final int steamPerSecond;
+ private final int tier;
+
+ public GT_MetaTileEntity_Boiler_Base(int aID, String aNameRegional, int tier) {
+ super(aID, "electricboiler." + tier + ".tier.single", aNameRegional,
+ "Produces " + (CORE.ConfigSwitches.boilerSteamPerSecond * tier) + "L of Steam per second");
+ this.steamPerSecond = (CORE.ConfigSwitches.boilerSteamPerSecond * tier);
+ this.tier = tier;
+ }
+
+ public GT_MetaTileEntity_Boiler_Base(String aName, int aTier, String aDescription, ITexture[][][] aTextures) {
+ super(aName, aTier, aDescription, aTextures);
+ this.steamPerSecond = (CORE.ConfigSwitches.boilerSteamPerSecond * aTier);
+ this.tier = aTier;
+ }
+
+ @Override
+ public String[] getDescription() {
+ return new String[]{
+ this.mDescription,
+ "Produces " + getPollution() + " pollution/sec",
+ "Consumes fuel only when temperature is less than 100C",
+ "Fuel with burn time greater than 500 is more efficient.",
+ "Doesn't explode if there's no water",
+ CORE.GT_Tooltip
+ };
+ }
+
+ public ITexture getOverlayIcon() {
+ return new GT_RenderedTexture(Textures.BlockIcons.BOILER_FRONT);
+ }
+
+ @Override
+ public ITexture[][][] getTextureSet(final ITexture[] aTextures) {
+ final ITexture[][][] rTextures = new ITexture[10][17][];
+ for (byte i = -1; i < 16; i++) {
+ rTextures[0][i + 1] = this.getFront(i);
+ rTextures[1][i + 1] = this.getBack(i);
+ rTextures[2][i + 1] = this.getBottom(i);
+ rTextures[3][i + 1] = this.getTop(i);
+ rTextures[4][i + 1] = this.getSides(i);
+ rTextures[5][i + 1] = this.getFrontActive(i);
+ rTextures[6][i + 1] = this.getBackActive(i);
+ rTextures[7][i + 1] = this.getBottomActive(i);
+ rTextures[8][i + 1] = this.getTopActive(i);
+ rTextures[9][i + 1] = this.getSidesActive(i);
+ }
+ return rTextures;
+ }
+
+ protected GT_RenderedTexture getCasingTexture() {
+ if (this.tier == 1) {
+ return new GT_RenderedTexture(Textures.BlockIcons.MACHINE_LV_SIDE);
+ } else if (this.tier == 2) {
+ return new GT_RenderedTexture(Textures.BlockIcons.MACHINE_MV_SIDE);
+ } else {
+ return new GT_RenderedTexture(Textures.BlockIcons.MACHINE_HV_SIDE);
+ }
+ // return new
+ // GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Top);
+ }
+
+ @Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+ return this.mTextures[(aActive ? 5 : 0) + (aSide == aFacing ? 0
+ : aSide == GT_Utility.getOppositeSide(aFacing) ? 1 : aSide == 0 ? 2 : aSide == 1 ? 3 : 4)][aColorIndex
+ + 1];
+ }
+
+ public ITexture[] getFront(final byte aColor) {
+ return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.tier][aColor + 1],
+ this.getCasingTexture() };
+ }
+
+ public ITexture[] getBack(final byte aColor) {
+ return this.getSides(aColor);
+ }
+
+ public ITexture[] getBottom(final byte aColor) {
+ return this.getSides(aColor);
+ }
+
+ public ITexture[] getTop(final byte aColor) {
+ return this.getSides(aColor);
+ }
+
+ public ITexture[] getSides(final byte aColor) {
+ return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.tier][aColor + 1],
+ this.getCasingTexture() };
+ }
+
+ public ITexture[] getFrontActive(final byte aColor) {
+ return this.getFront(aColor);
+ }
+
+ public ITexture[] getBackActive(final byte aColor) {
+ return this.getSides(aColor);
+ }
+
+ public ITexture[] getBottomActive(final byte aColor) {
+ return this.getBottom(aColor);
+ }
+
+ public ITexture[] getTopActive(final byte aColor) {
+ return this.getTop(aColor);
+ }
+
+ public ITexture[] getSidesActive(final byte aColor) {
+ return this.getSides(aColor);
+ }
+
+ @Override
+ public boolean isOutputFacing(final byte aSide) {
+ return aSide != this.getBaseMetaTileEntity().getFrontFacing();
+ }
+
+ @Override
+ public boolean isFacingValid(final byte aSide) {
+ return aSide > 1;
+ }
+
+ // Please find out what I do.
+ // I do stuff within the GUI.
+ // this.mTemperature = Math.min(54, Math.max(0, this.mTemperature * 54 / (((GT_MetaTileEntity_Boiler) this.mTileEntity.getMetaTileEntity()).maxProgresstime() - 10)));
+ @Override
+ public int maxProgresstime() {
+ return 1000 + (250 * tier);
+ }
+
+ @Override
+ public boolean isElectric() {
+ return false;
+ }
+
+ @Override
+ public int getCapacity() {
+ return (16000 + (16000 * tier));
+ }
+
+ // This type of machine can have different water and steam capacities.
+ public int getSteamCapacity() {
+ return 2 * getCapacity();
+ }
+
+ @Override
+ protected int getProductionPerSecond() {
+ return steamPerSecond;
+ }
+
+ @Override
+ protected int getMaxTemperature() {
+ return maxProgresstime();
+ }
+
+ @Override
+ protected int getEnergyConsumption() {
+ return 2;
+ }
+
+ @Override
+ protected int getCooldownInterval() {
+ return 40;
+ }
+
+ @Override
+ protected int getHeatUpRate() {
+ return 10;
+ }
+
+ @Override
+ protected void updateFuel(IGregTechTileEntity tile, long ticks) {
+ ItemStack fuelStack = this.mInventory[2];
+ if(fuelStack == null) return;
+
+ int burnTime = getBurnTime(fuelStack);
+ if (burnTime > 0 && this.mTemperature <= 101) {
+ consumeFuel(tile, fuelStack, burnTime);
+ }
+ }
+
+ @Override
+ protected void produceSteam(int aAmount) {
+ super.produceSteam(aAmount);
+
+ if(mSteam.amount > getSteamCapacity()) {
+ sendSound(SOUND_EVENT_LET_OFF_EXCESS_STEAM);
+
+ mSteam.amount = getSteamCapacity();
+ }
+ }
+
+ @Override
+ // Since this type of machine can have different water and steam capacities, we need to override getTankInfo() to
+ // support returning those different capacities.
+ public FluidTankInfo[] getTankInfo(ForgeDirection aSide) {
+ return new FluidTankInfo[]{
+ new FluidTankInfo(this.mFluid, getCapacity()),
+ new FluidTankInfo(this.mSteam, getSteamCapacity())
+ };
+ }
+
+ @Override
+ public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ return aIndex == 1 || aIndex == 3;
+ }
+
+ @Override
+ public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ return aIndex == 2;
+ }
+
+ @Override
+ protected int getPollution() {
+ return (int) (CORE.ConfigSwitches.basePollutionPerSecondBoiler*CORE.ConfigSwitches.pollutionReleasedByTierBoiler[this.tier]);
+ }
+
+ @Override
+ public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ return new CONTAINER_AdvancedBoiler(aPlayerInventory, aBaseMetaTileEntity);
+ }
+
+ @Override
+ public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GUI_AdvancedBoiler(aPlayerInventory, aBaseMetaTileEntity, "AdvancedBoiler.png");
+ }
+
+ @Override
+ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT_MetaTileEntity_Boiler_Base(this.mName, tier, this.mDescription, this.mTextures);
+ }
+
+ @Override
+ protected void onDangerousWaterLack(IGregTechTileEntity tile, long ticks) {
+ // Smart boilers don't explode!
+ }
+
+ /**
+ * Returns burn time if the stack is a valid fuel, otherwise return 0.
+ */
+ private static int getBurnTime(ItemStack stack) {
+ int burnTime = GameRegistry.getFuelValue(stack);
+ if (burnTime <= 0) {
+ burnTime = TileEntityFurnace.getItemBurnTime(stack);
+ }
+
+ return burnTime;
+ }
+
+ public void consumeFuel(IGregTechTileEntity tile, ItemStack fuel, int burnTime) {
+ this.mProcessingEnergy += burnTime / 10;
+ this.mTemperature += burnTime / 500; // will add bonus temperature points if the burn time is pretty high
+
+ tile.decrStackSize(2, 1);
+ if (tile.getRandomNumber(3) == 0) {
+ if (fuel.getDisplayName().toLowerCase().contains("charcoal")
+ || fuel.getDisplayName().toLowerCase().contains("coke")) {
+ tile.addStackToSlot(3, GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.Ash, 1L));
+ } else {
+ tile.addStackToSlot(3, GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.DarkAsh, 1L));
+ }
+ }
+ }
+
+ @Override
+ public boolean allowCoverOnSide(byte aSide, GT_ItemStack aCover) {
+ if (aSide != this.getBaseMetaTileEntity().getFrontFacing()) {
+ return true;
+ }
+ return super.allowCoverOnSide(aSide, aCover);
+ }
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_Boiler_HV.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_Boiler_HV.java
new file mode 100644
index 0000000000..dfbd254897
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_Boiler_HV.java
@@ -0,0 +1,56 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.generators;
+
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.MetaTileEntity;
+import gregtech.api.objects.GT_RenderedTexture;
+
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+
+public class GT_MetaTileEntity_Boiler_HV
+ extends GT_MetaTileEntity_Boiler_Base {
+
+ public GT_MetaTileEntity_Boiler_HV(int aID, String aNameRegional, int aBoilerTier) {
+ super(aID, aNameRegional, aBoilerTier);
+ }
+
+ public GT_MetaTileEntity_Boiler_HV(String aName, int aTier, String aDescription, ITexture[][][] aTextures) {
+ super(aName, aTier, aDescription, aTextures);
+ }
+
+ @Override
+ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT_MetaTileEntity_Boiler_HV(this.mName, 3, this.mDescription, this.mTextures);
+ }
+
+
+ @Override
+ protected GT_RenderedTexture getCasingTexture(){
+ return new GT_RenderedTexture(Textures.BlockIcons.MACHINE_HV_SIDE);
+ }
+
+
+ @Override
+ public ITexture[] getFront(final byte aColor) {
+ return new ITexture[]{super.getFront(aColor)[0], this.getCasingTexture(), new GT_RenderedTexture(Textures.BlockIcons.BOILER_FRONT)};
+ }
+
+ @Override
+ public ITexture[] getTop(final byte aColor) {
+ return new ITexture[]{super.getTop(aColor)[0], this.getCasingTexture(), new GT_RenderedTexture(TexturesGtBlock.Casing_Material_Talonite)};
+ }
+
+ @Override
+ public ITexture[] getFrontActive(final byte aColor) {
+ return new ITexture[]{super.getFrontActive(aColor)[0], this.getCasingTexture(), new GT_RenderedTexture(Textures.BlockIcons.BOILER_FRONT_ACTIVE)};
+ }
+
+ @Override
+ public ITexture[] getTopActive(final byte aColor) {
+ return getTop(aColor);
+ }
+
+
+
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_Boiler_LV.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_Boiler_LV.java
new file mode 100644
index 0000000000..e2b9046c68
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_Boiler_LV.java
@@ -0,0 +1,52 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.generators;
+
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.MetaTileEntity;
+import gregtech.api.objects.GT_RenderedTexture;
+
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+
+public class GT_MetaTileEntity_Boiler_LV
+extends GT_MetaTileEntity_Boiler_Base {
+
+ public GT_MetaTileEntity_Boiler_LV(int aID, String aNameRegional, int aBoilerTier) {
+ super(aID, aNameRegional, aBoilerTier);
+ }
+
+ public GT_MetaTileEntity_Boiler_LV(String aName, int aTier, String aDescription, ITexture[][][] aTextures) {
+ super(aName, aTier, aDescription, aTextures);
+ }
+
+ @Override
+ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT_MetaTileEntity_Boiler_LV(this.mName, 1, this.mDescription, this.mTextures);
+ }
+
+
+ @Override
+ protected GT_RenderedTexture getCasingTexture(){
+ return new GT_RenderedTexture(Textures.BlockIcons.MACHINE_LV_SIDE);
+ }
+
+ @Override
+ public ITexture[] getFront(final byte aColor) {
+ return new ITexture[]{super.getFront(aColor)[0], this.getCasingTexture(), new GT_RenderedTexture(Textures.BlockIcons.BOILER_FRONT)};
+ }
+
+ @Override
+ public ITexture[] getTop(final byte aColor) {
+ return new ITexture[]{super.getTop(aColor)[0], this.getCasingTexture(), new GT_RenderedTexture(TexturesGtBlock.Casing_Material_Potin)};
+ }
+
+ @Override
+ public ITexture[] getFrontActive(final byte aColor) {
+ return new ITexture[]{super.getFrontActive(aColor)[0], this.getCasingTexture(), new GT_RenderedTexture(Textures.BlockIcons.BOILER_FRONT_ACTIVE)};
+ }
+
+ @Override
+ public ITexture[] getTopActive(final byte aColor) {
+ return getTop(aColor);
+ }
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_Boiler_MV.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_Boiler_MV.java
new file mode 100644
index 0000000000..7ef781da17
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_Boiler_MV.java
@@ -0,0 +1,52 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.generators;
+
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.MetaTileEntity;
+import gregtech.api.objects.GT_RenderedTexture;
+
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+
+public class GT_MetaTileEntity_Boiler_MV
+extends GT_MetaTileEntity_Boiler_Base {
+
+ public GT_MetaTileEntity_Boiler_MV(int aID, String aNameRegional, int aBoilerTier) {
+ super(aID, aNameRegional, aBoilerTier);
+ }
+
+ public GT_MetaTileEntity_Boiler_MV(String aName, int aTier, String aDescription, ITexture[][][] aTextures) {
+ super(aName, aTier, aDescription, aTextures);
+ }
+
+ @Override
+ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT_MetaTileEntity_Boiler_MV(this.mName, 2, this.mDescription, this.mTextures);
+ }
+
+ @Override
+ protected GT_RenderedTexture getCasingTexture(){
+ return new GT_RenderedTexture(Textures.BlockIcons.MACHINE_MV_SIDE);
+ }
+
+ @Override
+ public ITexture[] getFront(final byte aColor) {
+ return new ITexture[]{super.getFront(aColor)[0], this.getCasingTexture(), new GT_RenderedTexture(Textures.BlockIcons.BOILER_FRONT)};
+ }
+
+ @Override
+ public ITexture[] getTop(final byte aColor) {
+ return new ITexture[]{super.getTop(aColor)[0], this.getCasingTexture(), new GT_RenderedTexture(TexturesGtBlock.Casing_Material_Tumbaga)};
+ }
+
+ @Override
+ public ITexture[] getFrontActive(final byte aColor) {
+ return new ITexture[]{super.getFrontActive(aColor)[0], this.getCasingTexture(), new GT_RenderedTexture(Textures.BlockIcons.BOILER_FRONT_ACTIVE)};
+ }
+
+ @Override
+ public ITexture[] getTopActive(final byte aColor) {
+ return getTop(aColor);
+ }
+
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_Boiler_Solar.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_Boiler_Solar.java
new file mode 100644
index 0000000000..f9cf904cc2
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_Boiler_Solar.java
@@ -0,0 +1,194 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.generators;
+
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.xmod.gregtech.api.gui.CONTAINER_AdvancedBoiler;
+import gtPlusPlus.xmod.gregtech.api.gui.GUI_AdvancedBoiler;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.nbt.NBTTagCompound;
+
+import gregtech.api.enums.Dyes;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.MetaTileEntity;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_ModHandler;
+import gregtech.common.gui.GT_Container_Boiler;
+import gregtech.common.gui.GT_GUIContainer_Boiler;
+import gregtech.common.tileentities.boilers.GT_MetaTileEntity_Boiler;
+
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.FluidStack;
+import net.minecraftforge.fluids.IFluidHandler;
+
+public class GT_MetaTileEntity_Boiler_Solar
+extends GT_MetaTileEntity_Boiler {
+ public GT_MetaTileEntity_Boiler_Solar(final int aID, final String aName, final String aNameRegional) {
+ super(aID, aName, aNameRegional, "Steam Power by the Sun");
+ }
+
+ public GT_MetaTileEntity_Boiler_Solar(final String aName, final int aTier, final String aDescription, final ITexture[][][] aTextures) {
+ super(aName, aTier, aDescription, aTextures);
+ }
+
+ @Override
+ public String[] getDescription() {
+ return new String[]{
+ this.mDescription,
+ "Produces "+(this.getPollution()*20)+" pollution/sec",
+ CORE.GT_Tooltip};
+ }
+
+ @Override
+ public ITexture[][][] getTextureSet(final ITexture[] aTextures) {
+ final ITexture[][][] rTextures = new ITexture[4][17][];
+ for (byte i = -1; i < 16; i = (byte) (i + 1)) {
+ final ITexture[] tmp0 = {new GT_RenderedTexture(Textures.BlockIcons.MACHINE_BRONZEBRICKS_BOTTOM, Dyes.getModulation(i, Dyes._NULL.mRGBa))};
+ rTextures[0][(i + 1)] = tmp0;
+ final ITexture[] tmp1 = {new GT_RenderedTexture(Textures.BlockIcons.MACHINE_BRONZEBRICKS_TOP, Dyes.getModulation(i, Dyes._NULL.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.BOILER_SOLAR)};
+ rTextures[1][(i + 1)] = tmp1;
+ final ITexture[] tmp2 = {new GT_RenderedTexture(Textures.BlockIcons.MACHINE_BRONZEBRICKS_SIDE, Dyes.getModulation(i, Dyes._NULL.mRGBa))};
+ rTextures[2][(i + 1)] = tmp2;
+ final ITexture[] tmp3 = {new GT_RenderedTexture(Textures.BlockIcons.MACHINE_BRONZEBRICKS_SIDE, Dyes.getModulation(i, Dyes._NULL.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE)};
+ rTextures[3][(i + 1)] = tmp3;
+ }
+ return rTextures;
+ }
+
+ @Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+ return this.mTextures[aSide >= 2 ? ((byte) (aSide != aFacing ? 2 : 3)) : aSide][aColorIndex + 1];
+ }
+
+ @Override
+ public int maxProgresstime() {
+ return 500;
+ }
+
+ @Override
+ public Object getServerGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) {
+ return new CONTAINER_AdvancedBoiler(aPlayerInventory, aBaseMetaTileEntity);
+ }
+
+ @Override
+ public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GUI_AdvancedBoiler(aPlayerInventory, aBaseMetaTileEntity, "SolarBoiler.png");
+ }
+
+ @Override
+ public MetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
+ return new GT_MetaTileEntity_Boiler_Solar(this.mName, this.mTier, this.mDescription, this.mTextures);
+ }
+
+ private int mRunTime = 0;
+
+ @Override
+ public void saveNBTData(final NBTTagCompound aNBT) {
+ super.saveNBTData(aNBT);
+ aNBT.setInteger("mRunTime", this.mRunTime);
+ }
+
+ @Override
+ public void loadNBTData(final NBTTagCompound aNBT) {
+ super.loadNBTData(aNBT);
+ this.mRunTime = aNBT.getInteger("mRunTime");
+ }
+
+ @Override
+ public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) {
+ if ((aBaseMetaTileEntity.isServerSide()) && (aTick > 20L)) {
+ if (this.mTemperature <= 20) {
+ this.mTemperature = 20;
+ this.mLossTimer = 0;
+ }
+ if (++this.mLossTimer > 45) {
+ this.mTemperature -= 1;
+ this.mLossTimer = 0;
+ }
+ if (this.mSteam != null) {
+ final byte i = aBaseMetaTileEntity.getFrontFacing();
+ final IFluidHandler tTileEntity = aBaseMetaTileEntity.getITankContainerAtSide(i);
+ if (tTileEntity != null) {
+ final FluidStack tDrained = aBaseMetaTileEntity.drain(ForgeDirection.getOrientation(i), Math.max(1, this.mSteam.amount / 2), false);
+ if (tDrained != null) {
+ final int tFilledAmount = tTileEntity.fill(ForgeDirection.getOrientation(i).getOpposite(), tDrained, false);
+ if (tFilledAmount > 0) {
+ tTileEntity.fill(ForgeDirection.getOrientation(i).getOpposite(), aBaseMetaTileEntity.drain(ForgeDirection.getOrientation(i), tFilledAmount, true), true);
+ }
+ }
+ }
+ }
+ if ((aTick % 25L) == 0L) {
+ if (this.mTemperature > 100) {
+ if ((this.mFluid == null) || (!GT_ModHandler.isWater(this.mFluid)) || (this.mFluid.amount <= 0)) {
+ this.mHadNoWater = true;
+ } else {
+ if (this.mHadNoWater) {
+ aBaseMetaTileEntity.doExplosion(2048L);
+ return;
+ }
+ this.mFluid.amount -= 1;
+ this.mRunTime += 1;
+ int tOutput = 150;
+ if(this.mRunTime > 10000){
+ tOutput = Math.max(50, 150 - ((this.mRunTime-10000)/100));
+ }
+ if (this.mSteam == null) {
+ this.mSteam = GT_ModHandler.getSteam(tOutput);
+ } else if (GT_ModHandler.isSteam(this.mSteam)) {
+ this.mSteam.amount += tOutput;
+ } else {
+ this.mSteam = GT_ModHandler.getSteam(tOutput);
+ }
+ }
+ } else {
+ this.mHadNoWater = false;
+ }
+ }
+ if ((this.mSteam != null) &&
+ (this.mSteam.amount > 16000)) {
+ this.sendSound((byte) 1);
+ this.mSteam.amount = 12000;
+ }
+ if ((this.mProcessingEnergy <= 0) && (aBaseMetaTileEntity.isAllowedToWork()) && ((aTick % 256L) == 0L) && (!aBaseMetaTileEntity.getWorld().isThundering())) {
+ final boolean bRain = aBaseMetaTileEntity.getWorld().isRaining() && (aBaseMetaTileEntity.getBiome().rainfall > 0.0F);
+ this.mProcessingEnergy += (bRain && (aBaseMetaTileEntity.getWorld().skylightSubtracted >= 4)) || !aBaseMetaTileEntity.getSkyAtSide((byte) 1) ? 0 : !bRain && aBaseMetaTileEntity.getWorld().isDaytime() ? 8 : 1;
+ }
+ if ((this.mTemperature < 500) && (this.mProcessingEnergy > 0) && ((aTick % 12L) == 0L)) {
+ this.mProcessingEnergy -= 1;
+ this.mTemperature += 1;
+ }
+ aBaseMetaTileEntity.setActive(this.mProcessingEnergy > 0);
+ }
+ }
+
+ @Override
+ protected int getPollution() {
+ return 0;
+ }
+
+ @Override
+ protected int getProductionPerSecond() {
+ return 0;
+ }
+
+ @Override
+ protected int getMaxTemperature() {
+ return 0;
+ }
+
+ @Override
+ protected int getEnergyConsumption() {
+ return 0;
+ }
+
+ @Override
+ protected int getCooldownInterval() {
+ return 0;
+ }
+
+ @Override
+ protected void updateFuel(IGregTechTileEntity iGregTechTileEntity, long l) {
+
+ }
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_RfConvertor.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_RfConvertor.java
new file mode 100644
index 0000000000..c6f368f0c0
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_RfConvertor.java
@@ -0,0 +1,348 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.generators;
+
+import static gregtech.api.enums.GT_Values.V;
+
+import cofh.api.energy.IEnergyConnection;
+import cofh.api.energy.IEnergyHandler;
+import cofh.api.energy.IEnergyProvider;
+import cofh.api.energy.IEnergyReceiver;
+import cofh.api.energy.IEnergyStorage;
+import crazypants.enderio.machine.capbank.TileCapBank;
+import crazypants.enderio.machine.capbank.network.ICapBankNetwork;
+import crazypants.enderio.power.IPowerContainer;
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.GT_Values;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.lib.LoadedMods;
+import gtPlusPlus.core.util.math.MathUtils;
+import gtPlusPlus.core.util.minecraft.PlayerUtils;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import gtPlusPlus.xmod.gregtech.common.tileentities.storage.GregtechMetaEnergyBuffer;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraftforge.common.util.ForgeDirection;
+
+/**
+ * NEVER INCLUDE THIS FILE IN YOUR MOD!!!
+ *
+ * This is the main construct for my Basic Machines such as the Automatic Extractor
+ * Extend this class to make a simple Machine
+ */
+public class GT_MetaTileEntity_RfConvertor extends GregtechMetaEnergyBuffer implements IEnergyReceiver {
+
+
+ public GT_MetaTileEntity_RfConvertor(final String aName, final int aTier,
+ final String aDescription, final ITexture[][][] aTextures, final int aSlotCount) {
+ super(aName, aTier, aDescription, aTextures, aSlotCount);
+ }
+
+ public GT_MetaTileEntity_RfConvertor(final int aID, final String aName,
+ final String aNameRegional, final int aTier, final String aDescription, final int aSlotCount) {
+ super(aID, aName, aNameRegional, aTier, aDescription, aSlotCount);
+ }
+
+ @Override
+ public String[] getDescription() {
+ return new String[] {
+ "Use Screwdriver to change voltage",
+ "Hold Shift while using Screwdriver to change amperage",
+ EnumChatFormatting.DARK_AQUA+"Variable Output Voltage",
+ CORE.GT_Tooltip};
+ }
+
+ @Override
+ public ITexture[][][] getTextureSet(ITexture[] aTextures) {
+ ITexture[][][] rTextures = new ITexture[12][17][];
+ GT_RenderedTexture aTex = new GT_RenderedTexture(TexturesGtBlock.Casing_Material_ZirconiumCarbide);
+ for (byte i = -1; i < 16; i++) {
+ rTextures[0][i + 1] = new ITexture[]{aTex, Textures.BlockIcons.OVERLAYS_ENERGY_OUT[mTier]};
+ rTextures[1][i + 1] = new ITexture[]{aTex, Textures.BlockIcons.OVERLAYS_ENERGY_OUT[mTier]};
+ rTextures[2][i + 1] = new ITexture[]{aTex, Textures.BlockIcons.OVERLAYS_ENERGY_OUT[mTier]};
+ rTextures[3][i + 1] = new ITexture[]{aTex, Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI[mTier]};
+ rTextures[4][i + 1] = new ITexture[]{aTex, Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI[mTier]};
+ rTextures[5][i + 1] = new ITexture[]{aTex, Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI[mTier]};
+ rTextures[6][i + 1] = new ITexture[]{aTex, Textures.BlockIcons.OVERLAYS_ENERGY_IN[mTier]};
+ rTextures[7][i + 1] = new ITexture[]{aTex, Textures.BlockIcons.OVERLAYS_ENERGY_IN[mTier]};
+ rTextures[8][i + 1] = new ITexture[]{aTex, Textures.BlockIcons.OVERLAYS_ENERGY_IN[mTier]};
+ rTextures[9][i + 1] = new ITexture[]{aTex, Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[mTier]};
+ rTextures[10][i + 1] = new ITexture[]{aTex, Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[mTier]};
+ rTextures[11][i + 1] = new ITexture[]{aTex, Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[mTier]};
+ }
+ return rTextures;
+ }
+
+ @Override
+ public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
+ return mTextures[Math.min(2, aSide) + (aSide == aFacing ? 3 : 0) + (aActive ? 0 : 6)][aColorIndex + 1];
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
+ return new GT_MetaTileEntity_RfConvertor(this.mName, this.mTier, this.mDescription,
+ this.mTextures, this.mInventory.length);
+ }
+
+ @Override
+ public long getMinimumStoredEU() {
+ return 0;
+ }
+
+ @Override
+ public long maxEUStore() {
+ return Integer.MAX_VALUE;
+ }
+
+ @Override
+ public long maxEUInput() {
+ return 0;
+ }
+
+ @Override
+ public long maxEUOutput() {
+ return V[this.mTier];
+ }
+
+ @Override
+ public long maxAmperesIn() {
+ return 0;
+ }
+
+ @Override
+ public boolean isEnetInput() {
+ return false;
+ }
+
+ @Override
+ public boolean isEnetOutput() {
+ return true;
+ }
+
+ @Override
+ public boolean isInputFacing(byte aSide) {
+ return !isOutputFacing(aSide);
+ }
+
+ @Override
+ public boolean isOutputFacing(byte aSide) {
+ return aSide == getBaseMetaTileEntity().getFrontFacing();
+ }
+
+ @Override public boolean isAccessAllowed(final EntityPlayer aPlayer) {return true;}
+
+ @Override
+ public Object getServerGUI(final int aID, final InventoryPlayer aPlayerInventory,
+ final IGregTechTileEntity aBaseMetaTileEntity) {
+ return null;
+ }
+
+ @Override
+ public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory,
+ final IGregTechTileEntity aBaseMetaTileEntity) {
+ return null;
+ }
+
+ @Override
+ public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) {
+ if (aBaseMetaTileEntity.isServerSide()) {
+ if (!aBaseMetaTileEntity.isActive()) {
+ aBaseMetaTileEntity.setActive(true);
+ }
+ if (this.getEUVar() < this.maxEUStore()) {
+ for (byte i = 0; i < 6 && aBaseMetaTileEntity.getStoredEU() < aBaseMetaTileEntity.getEUCapacity(); i++) {
+ if (isInputFacing(i)) {
+ receiveEnergy(ForgeDirection.getOrientation(i), Integer.MAX_VALUE, false);
+ }
+ }
+ }
+ return;
+ }
+ }
+
+ @Override
+ public boolean allowPullStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public String[] getInfoData() {
+ String[] infoData = super.getInfoData();
+ return new String[] {
+ infoData[0],
+ "Converts RF -> GTEU | Tier: "+this.mTier,
+ infoData[1],
+ infoData[2]
+ };
+ }
+
+ @Override
+ public boolean isGivingInformation() {
+ return true;
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ aNBT.setByte("mTier", this.mTier);
+ super.saveNBTData(aNBT);
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ super.loadNBTData(aNBT);
+ this.mTier = aNBT.getByte("mTier");
+ }
+
+ @Override
+ public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ if (aPlayer.isSneaking()) {
+ byte aTest = (byte) (aCurrentOutputAmperage + 1);
+ if (aTest > 16 || aTest <= 0 ) {
+ aTest = 1;
+ }
+ aCurrentOutputAmperage = aTest;
+ PlayerUtils.messagePlayer(aPlayer, "Now handling "+maxAmperesOut()+" Amps.");
+ }
+ else {
+ if (this.mTier < (CORE.GTNH ? GT_Values.V.length : 9)) {
+ this.mTier++;
+ }
+ else {
+ this.mTier = 0;
+ }
+ PlayerUtils.messagePlayer(aPlayer, "Now running at "+GT_Values.VOLTAGE_NAMES[this.mTier]+".");
+ }
+
+ }
+
+ @Override
+ public boolean canConnectEnergy(ForgeDirection from) {
+ if (isOutputFacing((byte) from.ordinal())) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate) {
+
+ // Cannot accept power on the output face.
+ if (!canConnectEnergy(from) || isOutputFacing((byte) from.ordinal())) {
+ return 0;
+ }
+
+ TileEntity tTileEntity = this.getBaseMetaTileEntity().getTileEntityAtSide((byte) from.ordinal());
+ if (tTileEntity == null) {
+ return 0;
+ }
+
+ Logger.WARNING("Someone is trying to inject RF from "+from+". Type:"+tTileEntity.getClass().getName());
+
+ // Calculate maximum RF we need to consume
+ int aInputRF = MathUtils.safeInt(this.maxEUOutput() * GregTech_API.mEUtoRF / 100);
+
+ // Make sure we only consume the correct amount of RF that is pushed into this Tile.
+ if (aInputRF > maxReceive) {
+ aInputRF = maxReceive;
+ }
+
+ int aInjectedRF = 0;
+ boolean aVal = false;
+
+ long aStoredEU = this.getEUVar();
+ long aMaxEU = this.maxEUStore();
+ Logger.WARNING("Stored: "+aStoredEU+", Capacity: "+aMaxEU+"");
+ if (aStoredEU < aMaxEU) {
+ Logger.WARNING("StoredEU < MaxEU");
+ long aRemainingSpace = aMaxEU - aStoredEU;
+ if (aRemainingSpace > 0) {
+ long tEU = 0;
+ byte aSide = (byte) from.ordinal();
+ Logger.WARNING("Free: "+aRemainingSpace+"EU");
+ if (tTileEntity instanceof IEnergyProvider && ((IEnergyProvider) tTileEntity).extractEnergy(ForgeDirection.getOrientation(GT_Utility.getOppositeSide(aSide)), 1, true) == 1) {
+ tEU = (long) ((IEnergyProvider) tTileEntity).extractEnergy(ForgeDirection.getOrientation(GT_Utility.getOppositeSide(aSide)), (int) maxEUOutput() * 100 / GregTech_API.mRFtoEU, false);
+ Logger.WARNING("Drained from IEnergyProvider Tile: "+(tEU * 100 / GregTech_API.mRFtoEU)+"");
+ tEU = tEU * GregTech_API.mRFtoEU / 100;
+ }
+ else if (tTileEntity instanceof IEnergyStorage && ((IEnergyStorage) tTileEntity).extractEnergy(1, true) == 1) {
+ tEU = (long) ((IEnergyStorage) tTileEntity).extractEnergy((int) maxEUOutput() * 100 / GregTech_API.mRFtoEU, false);
+ Logger.WARNING("Drained from IEnergyStorage Tile: "+(tEU * 100 / GregTech_API.mRFtoEU)+"");
+ tEU = tEU * GregTech_API.mRFtoEU / 100;
+ }
+ else if (GregTech_API.meIOLoaded && tTileEntity instanceof IPowerContainer && ((IPowerContainer) tTileEntity).getEnergyStored() > 0) {
+ int storedRF = ((IPowerContainer) tTileEntity).getEnergyStored();
+ int extractRF = (int) maxEUOutput() * 100 / GregTech_API.mRFtoEU;
+ tEU = 0;
+ if (tTileEntity instanceof TileCapBank) {
+ ICapBankNetwork network = ((TileCapBank) tTileEntity).getNetwork();
+ if (network != null && network.getEnergyStoredL() > 0) {
+ tEU = Math.min((Math.min(Math.min(network.getEnergyStoredL(), storedRF - extractRF), network.getMaxOutput())) * GregTech_API.mRFtoEU / 100, maxEUOutput());
+ Logger.WARNING("Drained from EIO CapBank Tile: "+(tEU * 100 / GregTech_API.mRFtoEU)+"");
+ network.addEnergy((int) -(tEU * 100 / GregTech_API.mRFtoEU));
+ }
+ } else {
+ if (storedRF > extractRF) {
+ ((IPowerContainer) tTileEntity).setEnergyStored(storedRF - extractRF);
+ tEU = maxEUOutput();
+ Logger.WARNING("Drained from EIO Tile: "+(tEU * 100 / GregTech_API.mRFtoEU)+"");
+ } else {
+ ((IPowerContainer) tTileEntity).setEnergyStored(0);
+ tEU = storedRF * GregTech_API.mRFtoEU / 100;
+ Logger.WARNING("Drained from EIO Tile: "+(tEU * 100 / GregTech_API.mRFtoEU)+"");
+ }
+ }
+ }
+ Logger.WARNING("EU to inject: "+tEU+"EU");
+ if (!simulate) {
+ aVal = this.getBaseMetaTileEntity().increaseStoredEnergyUnits(tEU, true);
+ }
+ if (tEU > 0) {
+ Logger.WARNING("Tried injecting "+tEU+" eu into self. Success? "+aVal);
+ }
+ }
+ }
+ return aInjectedRF;
+ }
+
+ @Override
+ public int getEnergyStored(ForgeDirection from) {
+ long aStoredEU = this.getEUVar();
+ long aMaxEU = this.maxEUStore();
+ if (aStoredEU == 0) {
+ return 0;
+ }
+ if (aStoredEU < aMaxEU) {
+ long aRemainingSpace = aMaxEU - aStoredEU;
+ if (aRemainingSpace > 0) {
+ if (aRemainingSpace > (this.maxEUOutput() / (GregTech_API.mEUtoRF / 100))) {
+ int aCalculatedFreeSpace = 0;
+ int aRfPer10Eu = GregTech_API.mEUtoRF / 10;
+ // Calculate how many lots of '10
+ aCalculatedFreeSpace = (int) Math.floor(aRemainingSpace / 10);
+ // Return value equal to how many lots of '10eu' packets we can fit in.
+ return Integer.MAX_VALUE - MathUtils.balance(aCalculatedFreeSpace * aRfPer10Eu, 0, Integer.MAX_VALUE);
+ }
+ }
+ }
+ return Integer.MAX_VALUE;
+ }
+
+ @Override
+ public int getMaxEnergyStored(ForgeDirection from) {
+ return Integer.MAX_VALUE;
+ }
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_SemiFluidGenerator.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_SemiFluidGenerator.java
new file mode 100644
index 0000000000..d1628bdb59
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_SemiFluidGenerator.java
@@ -0,0 +1,171 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.generators;
+
+import cpw.mods.fml.common.registry.GameRegistry;
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.ConfigCategories;
+import gregtech.api.enums.ItemList;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.MetaTileEntity;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicGenerator;
+import gregtech.api.objects.GT_ItemStack;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_ModHandler;
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_Utility;
+import gregtech.api.util.GTPP_Recipe.GTPP_Recipe_Map;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.lib.CORE;
+import net.minecraft.item.ItemStack;
+
+public class GT_MetaTileEntity_SemiFluidGenerator extends GT_MetaTileEntity_BasicGenerator {
+
+ public int mEfficiency;
+
+ /*public GT_MetaTileEntity_SemiFluidGenerator(int aID, String aName, String aNameRegional, int aTier) {
+ super(aID, aName, aNameRegional, aTier);
+ onConfigLoad();
+ }*/
+
+ public GT_MetaTileEntity_SemiFluidGenerator(int aID, String aName, String aNameRegional, int aTier) {
+ super(aID, aName, aNameRegional, aTier,
+ "Requires semi-fluid Fuel",
+ new ITexture[0]);
+ onConfigLoad();
+ }
+
+ public GT_MetaTileEntity_SemiFluidGenerator(String aName, int aTier, String aDescription, ITexture[][][] aTextures) {
+ super(aName, aTier, aDescription, aTextures);
+ onConfigLoad();
+ }
+
+ public int getPollution() {
+ return (int) (CORE.ConfigSwitches.basePollutionPerSecondSemiFluidGenerator * CORE.ConfigSwitches.pollutionReleasedByTierSemiFluidGenerator[this.mTier]);
+ }
+
+ @Override
+ public int getCapacity() {
+ return 4000 * this.mTier;
+ }
+
+ public void onConfigLoad() {
+ this.mEfficiency = GregTech_API.sMachineFile.get(ConfigCategories.machineconfig,
+ "SemiFluidGenerator.efficiency.tier." + this.mTier, 100 - (this.mTier * 5));
+ }
+
+ @Override
+ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT_MetaTileEntity_SemiFluidGenerator(this.mName, this.mTier, this.mDescription, this.mTextures);
+ }
+
+ @Override
+ public GT_Recipe.GT_Recipe_Map getRecipes() {
+ //Logger.WARNING("Fuel Count: "+Gregtech_Recipe_Map.sSemiFluidLiquidFuels.mRecipeList.size());
+ return GTPP_Recipe_Map.sSemiFluidLiquidFuels;
+ }
+
+ @Override
+ public String[] getDescription() {
+ return new String[]{
+ this.mDescription,
+ "Produces "+(this.getPollution())+" pollution/sec",
+ "Fuel Efficiency: "+this.getEfficiency() + "%",
+ CORE.GT_Tooltip};
+ }
+
+ @Override
+ public int getEfficiency() {
+ return this.mEfficiency;
+ }
+
+ @Override
+ public boolean isOutputFacing(byte aSide) {
+ return (aSide == getBaseMetaTileEntity().getFrontFacing());
+ }
+
+ @Override
+ public boolean allowCoverOnSide(byte aSide, GT_ItemStack aCover) {
+ if (aSide != this.getBaseMetaTileEntity().getFrontFacing()) {
+ return true;
+ }
+ return super.allowCoverOnSide(aSide, aCover);
+ }
+
+ @Override
+ public int getFuelValue(ItemStack aStack) {
+ if ((GT_Utility.isStackInvalid(aStack)) || (getRecipes() == null)) {
+ Logger.WARNING("Bad Fuel?");
+ return 0;
+ }
+ int rValue = Math.max(GT_ModHandler.getFuelCanValue(aStack) * 6 / 5, super.getFuelValue(aStack));
+ if (ItemList.Fuel_Can_Plastic_Filled.isStackEqual(aStack, false, true)) {
+ rValue = Math.max(rValue, GameRegistry.getFuelValue(aStack) * 3);
+ }
+ Logger.WARNING("Good Fuel: "+rValue);
+ return rValue;
+ }
+
+ @Override
+ public ITexture[] getFront(byte aColor) {
+ return new ITexture[] { super.getFront(aColor)[0],
+ new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_FRONT),
+ Textures.BlockIcons.OVERLAYS_ENERGY_OUT[this.mTier] };
+ }
+
+ @Override
+ public ITexture[] getBack(byte aColor) {
+ return new ITexture[] { super.getBack(aColor)[0],
+ new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_TOP) };
+ }
+
+ @Override
+ public ITexture[] getBottom(byte aColor) {
+ return new ITexture[] { super.getBottom(aColor)[0],
+ new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_BOTTOM) };
+ }
+
+ @Override
+ public ITexture[] getTop(byte aColor) {
+ return new ITexture[] { super.getTop(aColor)[0],
+ new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_SIDE) };
+ }
+
+ @Override
+ public ITexture[] getSides(byte aColor) {
+ return new ITexture[] { super.getSides(aColor)[0],
+ new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_TOP) };
+ }
+
+ @Override
+ public ITexture[] getFrontActive(byte aColor) {
+ return new ITexture[] { super.getFrontActive(aColor)[0],
+ new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_FRONT_ACTIVE),
+ Textures.BlockIcons.OVERLAYS_ENERGY_OUT[this.mTier] };
+ }
+
+ @Override
+ public ITexture[] getBackActive(byte aColor) {
+ return new ITexture[] { super.getBackActive(aColor)[0],
+ new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_TOP_ACTIVE) };
+ }
+
+ @Override
+ public ITexture[] getBottomActive(byte aColor) {
+ return new ITexture[] { super.getBottomActive(aColor)[0],
+ new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_BOTTOM_ACTIVE) };
+ }
+
+ @Override
+ public ITexture[] getTopActive(byte aColor) {
+ return new ITexture[] { super.getTopActive(aColor)[0],
+ new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_SIDE_ACTIVE) };
+ }
+
+ @Override
+ public ITexture[] getSidesActive(byte aColor) {
+ return new ITexture[] { super.getSidesActive(aColor)[0],
+ new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_TOP_ACTIVE) };
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityDoubleFuelGeneratorBase.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityDoubleFuelGeneratorBase.java
new file mode 100644
index 0000000000..2a0133245e
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityDoubleFuelGeneratorBase.java
@@ -0,0 +1,153 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.generators;
+
+import cpw.mods.fml.common.registry.GameRegistry;
+
+import net.minecraft.item.ItemStack;
+
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.ConfigCategories;
+import gregtech.api.enums.ItemList;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.MetaTileEntity;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_ModHandler;
+import gregtech.api.util.GT_Recipe;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.generators.GregtechRocketFuelGeneratorBase;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+
+public class GregtechMetaTileEntityDoubleFuelGeneratorBase
+extends GregtechRocketFuelGeneratorBase {
+
+ public int mEfficiency;
+
+ public GregtechMetaTileEntityDoubleFuelGeneratorBase(final int aID, final String aName, final String aNameRegional, final int aTier) {
+ super(aID, aName, aNameRegional, aTier, "Requires two liquid Fuels. Fuel A is Fastburn, Fuel B is slowburn.", new ITexture[0]);
+ this.onConfigLoad();
+ }
+
+ public GregtechMetaTileEntityDoubleFuelGeneratorBase(final String aName, final int aTier, final String aDescription, final ITexture[][][] aTextures) {
+ super(aName, aTier, aDescription, aTextures);
+ this.onConfigLoad();
+ }
+
+ @Override
+ public String[] getDescription() {
+ return new String[]{this.mDescription,
+ "Generates power at " + this.getEfficiency() + "% Efficiency per tick",
+ "Output Voltage: "+this.getOutputTier()+" EU/t",
+ CORE.GT_Tooltip
+ };
+ }
+
+ @Override
+ public boolean isOutputFacing(final byte aSide) {
+ return aSide == this.getBaseMetaTileEntity().getFrontFacing();
+ }
+
+ @Override
+ public MetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaTileEntityDoubleFuelGeneratorBase(this.mName, this.mTier, this.mDescription, this.mTextures);
+ }
+
+ @Override
+ public GT_Recipe.GT_Recipe_Map getRecipes() {
+ return GT_Recipe.GT_Recipe_Map.sDieselFuels;
+ }
+
+ @Override
+ public int getCapacity() {
+ return 32000;
+ }
+
+ public void onConfigLoad() {
+ this.mEfficiency = GregTech_API.sMachineFile.get(ConfigCategories.machineconfig, "RocketEngine.efficiency.tier." + this.mTier, (100 - (this.mTier * 8)));
+ }
+
+ @Override
+ public int getEfficiency() {
+ return this.mEfficiency;
+ }
+
+ @Override
+ public int getFuelValue(final ItemStack aStack) {
+ int rValue = Math.max((GT_ModHandler.getFuelCanValue(aStack) * 6) / 5, super.getFuelValue(aStack));
+ if (ItemList.Fuel_Can_Plastic_Filled.isStackEqual(aStack, false, true)) {
+ rValue = Math.max(rValue, GameRegistry.getFuelValue(aStack) * 3);
+ }
+ return rValue;
+ }
+
+ private GT_RenderedTexture getCasingTexture(){
+ if (this.mTier <= 4){
+ return new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Top);
+ }
+ else if (this.mTier == 5){
+
+ return new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Advanced);
+ }
+ else {
+
+ return new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Ultra);
+ }
+ //return new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Top);
+ }
+
+
+ @Override
+ public ITexture[] getFront(final byte aColor) {
+ return new ITexture[]{super.getFront(aColor)[0], this.getCasingTexture(), Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier]};
+ }
+
+ @Override
+ public ITexture[] getBack(final byte aColor) {
+ return new ITexture[]{super.getBack(aColor)[0], this.getCasingTexture(), new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Vent)};
+ }
+
+ @Override
+ public ITexture[] getBottom(final byte aColor) {
+ return new ITexture[]{super.getBottom(aColor)[0], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom)};
+ }
+
+ @Override
+ public ITexture[] getTop(final byte aColor) {
+ return new ITexture[]{super.getTop(aColor)[0], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Redstone_Off)};
+ }
+
+ @Override
+ public ITexture[] getSides(final byte aColor) {
+ return new ITexture[]{super.getSides(aColor)[0], this.getCasingTexture(), new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Diesel_Horizontal)};
+ }
+
+ @Override
+ public ITexture[] getFrontActive(final byte aColor) {
+ return new ITexture[]{super.getFrontActive(aColor)[0], this.getCasingTexture(), Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier]};
+ }
+
+ @Override
+ public ITexture[] getBackActive(final byte aColor) {
+ return new ITexture[]{super.getBackActive(aColor)[0], this.getCasingTexture(), new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Vent_Fast)};
+ }
+
+ @Override
+ public ITexture[] getBottomActive(final byte aColor) {
+ return new ITexture[]{super.getBottomActive(aColor)[0], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom)};
+ }
+
+ @Override
+ public ITexture[] getTopActive(final byte aColor) {
+ return new ITexture[]{super.getTopActive(aColor)[0], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Redstone_On)};
+ }
+
+ @Override
+ public ITexture[] getSidesActive(final byte aColor) {
+ return new ITexture[]{super.getSidesActive(aColor)[0], this.getCasingTexture(), new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Diesel_Horizontal_Active)};
+ }
+
+ @Override
+ public int getPollution() {
+ return 250;
+ }
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityGeothermalGenerator.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityGeothermalGenerator.java
new file mode 100644
index 0000000000..a392ae5a58
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityGeothermalGenerator.java
@@ -0,0 +1,151 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.generators;
+
+import cpw.mods.fml.common.registry.GameRegistry;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.ConfigCategories;
+import gregtech.api.enums.ItemList;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.MetaTileEntity;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicGenerator;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_ModHandler;
+import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
+
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+
+public class GregtechMetaTileEntityGeothermalGenerator
+extends GT_MetaTileEntity_BasicGenerator
+{
+
+ public int mEfficiency;
+
+ public GregtechMetaTileEntityGeothermalGenerator(final int aID, final String aName, final String aNameRegional, final int aTier) {
+ super(aID, aName, aNameRegional, aTier, "Requires Pahoehoe Lava or Normal Lava as Fuel", new ITexture[0]);
+ this.onConfigLoad();
+ }
+
+ public GregtechMetaTileEntityGeothermalGenerator(final String aName, final int aTier, final String aDescription, final ITexture[][][] aTextures) {
+ super(aName, aTier, aDescription, aTextures);
+ this.onConfigLoad();
+ }
+
+ @Override
+ public String[] getDescription() {
+ String aPollution = "Causes "+this.getPollution()+ " Pollution per second";
+ return new String[]{
+ this.mDescription,
+ "Generates power at " + this.getEfficiency() + "% Efficiency per tick",
+ aPollution,
+ CORE.GT_Tooltip};
+ }
+
+ @Override
+ public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) {
+ if (aBaseMetaTileEntity.isClientSide()){
+ return true;
+ }
+ aBaseMetaTileEntity.openGUI(aPlayer);
+ return true;
+ }
+
+ @Override
+ public int getCapacity() {
+ //return MathUtils.roundToClosestMultiple(32000*(this.mTier/2), 25000);
+ return 5000*this.mTier;
+ }
+
+ public void onConfigLoad() {
+ this.mEfficiency = GregTech_API.sMachineFile.get(ConfigCategories.machineconfig, "ThermalGenerator.efficiency.tier." + this.mTier, (100 - (this.mTier * 7)));
+ }
+
+ @Override
+ public int getEfficiency() {
+ return this.mEfficiency;
+ }
+
+ @Override
+ public int getFuelValue(final ItemStack aStack) {
+ int rValue = Math.max((GT_ModHandler.getFuelCanValue(aStack) * 6) / 5, super.getFuelValue(aStack));
+ if (ItemList.Fuel_Can_Plastic_Filled.isStackEqual(aStack, false, true)) {
+ rValue = Math.max(rValue, GameRegistry.getFuelValue(aStack) * 3);
+ }
+ return rValue;
+ }
+
+ @Override
+ public boolean isOutputFacing(final byte aSide) {
+ return aSide == this.getBaseMetaTileEntity().getFrontFacing();
+ }
+
+ @Override
+ public MetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaTileEntityGeothermalGenerator(this.mName, this.mTier, this.mDescription, this.mTextures);
+ }
+
+ @Override
+ public ITexture[] getFront(final byte aColor) {
+ return new ITexture[]{super.getFront(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_SIDE), Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier]};
+ }
+
+ @Override
+ public ITexture[] getBack(final byte aColor) {
+ return new ITexture[]{super.getBack(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_BACK), new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Diesel_Vertical)};
+ }
+
+ @Override
+ public ITexture[] getBottom(final byte aColor) {
+ return new ITexture[]{super.getBottom(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_BOTTOM)};
+ }
+
+ @Override
+ public ITexture[] getTop(final byte aColor) {
+ return new ITexture[]{super.getTop(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_SIDE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_ROCK_BREAKER)};
+ }
+
+ @Override
+ public ITexture[] getSides(final byte aColor) {
+ return new ITexture[]{super.getSides(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.BOILER_LAVA_FRONT)};
+ }
+
+ @Override
+ public ITexture[] getFrontActive(final byte aColor) {
+ return new ITexture[]{super.getFrontActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_SIDE_ACTIVE), Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier]};
+ }
+
+ @Override
+ public ITexture[] getBackActive(final byte aColor) {
+ return new ITexture[]{super.getBackActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_BACK_ACTIVE), new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Diesel_Vertical_Active)};
+ }
+
+ @Override
+ public ITexture[] getBottomActive(final byte aColor) {
+ return new ITexture[]{super.getBottomActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_BOTTOM_ACTIVE)};
+ }
+
+ @Override
+ public ITexture[] getTopActive(final byte aColor) {
+ return new ITexture[]{super.getTopActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_SIDE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_ROCK_BREAKER_ACTIVE)};
+ }
+
+ @Override
+ public ITexture[] getSidesActive(final byte aColor) {
+ return new ITexture[]{super.getSidesActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.BOILER_LAVA_FRONT_ACTIVE)};
+ }
+
+ @Override
+ public GT_Recipe_Map getRecipes()
+ {
+ return GT_Recipe_Map.sHotFuels;
+ }
+
+ public int getPollution() {
+ return (int) (CORE.ConfigSwitches.basePollutionPerSecondGeothermalGenerator * CORE.ConfigSwitches.pollutionReleasedByTierGeothermalGenerator[mTier]);
+ }
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityRocketFuelGenerator.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityRocketFuelGenerator.java
new file mode 100644
index 0000000000..c05c7ae3ff
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityRocketFuelGenerator.java
@@ -0,0 +1,142 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.generators;
+
+import cpw.mods.fml.common.registry.GameRegistry;
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.ConfigCategories;
+import gregtech.api.enums.ItemList;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.MetaTileEntity;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_ModHandler;
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GTPP_Recipe;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.math.MathUtils;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.generators.GregtechRocketFuelGeneratorBase;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import net.minecraft.item.ItemStack;
+
+public class GregtechMetaTileEntityRocketFuelGenerator
+extends GregtechRocketFuelGeneratorBase {
+
+ public int mEfficiency;
+
+ public GregtechMetaTileEntityRocketFuelGenerator(final int aID, final String aName, final String aNameRegional, final int aTier) {
+ super(aID, aName, aNameRegional, aTier, "Requires GT++ Rocket Fuels", new ITexture[0]);
+ this.onConfigLoad();
+ }
+
+ public GregtechMetaTileEntityRocketFuelGenerator(final String aName, final int aTier, final String aDescription, final ITexture[][][] aTextures) {
+ super(aName, aTier, aDescription, aTextures);
+ this.onConfigLoad();
+ }
+
+ @Override
+ public boolean isOutputFacing(final byte aSide) {
+ return aSide == this.getBaseMetaTileEntity().getFrontFacing();
+ }
+
+ @Override
+ public MetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
+ //Logger.INFO("Valid Fuels: "+Recipe_GT.Gregtech_Recipe_Map.sRocketFuels.mRecipeList.size());
+ return new GregtechMetaTileEntityRocketFuelGenerator(this.mName, this.mTier, this.mDescription, this.mTextures);
+ }
+
+ @Override
+ public GT_Recipe.GT_Recipe_Map getRecipes() {
+ return GTPP_Recipe.GTPP_Recipe_Map.sRocketFuels;
+ }
+
+ @Override
+ public int getCapacity() {
+ return 32000;
+ }
+
+ public void onConfigLoad() {
+ this.mEfficiency = GregTech_API.sMachineFile.get(ConfigCategories.machineconfig, "RocketEngine.efficiency.tier." + this.mTier, 80 - (10 * (this.mTier - 4)));
+ }
+
+ @Override
+ public int getEfficiency() {
+ int eff = 80 - (10 * (this.mTier - 4));
+ return eff;
+
+ }
+
+ @Override
+ public int getFuelValue(final ItemStack aStack) {
+ int rValue = Math.max((GT_ModHandler.getFuelCanValue(aStack) * 6) / 5, super.getFuelValue(aStack));
+ if (ItemList.Fuel_Can_Plastic_Filled.isStackEqual(aStack, false, true)) {
+ rValue = Math.max(rValue, GameRegistry.getFuelValue(aStack) * 3);
+ }
+ return rValue;
+ }
+
+ private GT_RenderedTexture getCasingTexture(){
+ if (this.mTier <= 4){
+ return new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Top);
+ }
+ else if (this.mTier == 5){
+
+ return new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Advanced);
+ }
+ else{
+
+ return new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Ultra);
+ }
+ //return new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Top);
+ }
+
+
+ @Override
+ public ITexture[] getFront(final byte aColor) {
+ return new ITexture[]{super.getFront(aColor)[0], this.getCasingTexture(), Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier]};
+ }
+
+ @Override
+ public ITexture[] getBack(final byte aColor) {
+ return new ITexture[]{super.getBack(aColor)[0], this.getCasingTexture(), new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Vent)};
+ }
+
+ @Override
+ public ITexture[] getBottom(final byte aColor) {
+ return new ITexture[]{super.getBottom(aColor)[0], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom)};
+ }
+
+ @Override
+ public ITexture[] getTop(final byte aColor) {
+ return new ITexture[]{super.getTop(aColor)[0], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Redstone_Off)};
+ }
+
+ @Override
+ public ITexture[] getSides(final byte aColor) {
+ return new ITexture[]{super.getSides(aColor)[0], this.getCasingTexture(), new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Diesel_Horizontal)};
+ }
+
+ @Override
+ public ITexture[] getFrontActive(final byte aColor) {
+ return new ITexture[]{super.getFrontActive(aColor)[0], this.getCasingTexture(), Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier]};
+ }
+
+ @Override
+ public ITexture[] getBackActive(final byte aColor) {
+ return new ITexture[]{super.getBackActive(aColor)[0], this.getCasingTexture(), new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Vent_Fast)};
+ }
+
+ @Override
+ public ITexture[] getBottomActive(final byte aColor) {
+ return new ITexture[]{super.getBottomActive(aColor)[0], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom)};
+ }
+
+ @Override
+ public ITexture[] getTopActive(final byte aColor) {
+ return new ITexture[]{super.getTopActive(aColor)[0], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Redstone_On)};
+ }
+
+ @Override
+ public ITexture[] getSidesActive(final byte aColor) {
+ return new ITexture[]{super.getSidesActive(aColor)[0], this.getCasingTexture(), new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Diesel_Horizontal_Active)};
+ }
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntitySolarGenerator.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntitySolarGenerator.java
new file mode 100644
index 0000000000..68dbc4fb61
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntitySolarGenerator.java
@@ -0,0 +1,187 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.generators;
+
+import static gregtech.api.enums.GT_Values.V;
+
+import net.minecraft.entity.player.InventoryPlayer;
+
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.ConfigCategories;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.MetaTileEntity;
+import gregtech.api.objects.GT_RenderedTexture;
+
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.xmod.gregtech.api.gui.CONTAINER_SolarGenerator;
+import gtPlusPlus.xmod.gregtech.api.gui.GUI_SolarGenerator;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.generators.GregtechMetaSolarGenerator;
+
+public class GregtechMetaTileEntitySolarGenerator extends GregtechMetaSolarGenerator {
+
+ public GregtechMetaTileEntitySolarGenerator(final int aID, final String aName, final String aNameRegional, final int aTier) {
+ super(aID, aName, aNameRegional, aTier, "Feasts on the power of the Sun!", new ITexture[0]);
+ this.onConfigLoad();
+ }
+
+ public GregtechMetaTileEntitySolarGenerator(final String aName, final int aTier, final String aDescription, final ITexture[][][] aTextures) {
+ super(aName, aTier, aDescription, aTextures);
+ this.onConfigLoad();
+ }
+
+ @Override
+ public String[] getDescription() {
+ return new String[]{this.mDescription,
+ "Generates power at " + this.getEfficiency() + "% Efficiency per tick",
+ "Output Voltage: "+this.getOutputTier()+" EU/t",
+ CORE.GT_Tooltip
+ };
+ }
+
+ @Override
+ public boolean isOutputFacing(final byte aSide) {
+ return aSide == this.getBaseMetaTileEntity().getFrontFacing();
+ }
+
+ @Override
+ public Object getServerGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) {
+ return new CONTAINER_SolarGenerator(aPlayerInventory, aBaseMetaTileEntity);
+ }
+
+ @Override
+ public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GUI_SolarGenerator(aPlayerInventory, aBaseMetaTileEntity, "SolarBoiler.png");
+ }
+
+ @Override
+ public MetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaTileEntitySolarGenerator(this.mName, this.mTier, this.mDescription, this.mTextures);
+ }
+
+ public void onConfigLoad() {
+ this.mEfficiency = GregTech_API.sMachineFile.get(ConfigCategories.machineconfig, "SunAbsorber.efficiency.tier." + this.mTier, 100 - (this.mTier * 10));
+
+ }
+
+ @Override
+ public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) {
+ if (aBaseMetaTileEntity.isServerSide() && aBaseMetaTileEntity.isAllowedToWork()
+ && (aBaseMetaTileEntity.getUniversalEnergyStored() < (this.maxEUOutput() + aBaseMetaTileEntity.getEUCapacity()))) {
+
+ if (this.mSolarCharge <= 20) {
+ //Utils.LOG_WARNING("1.");
+ this.mSolarCharge = 20;
+ this.mLossTimer = 0;
+ }
+ if (++this.mLossTimer > 45) {
+ //Utils.LOG_WARNING("2.");
+ this.mSolarCharge -= 1;
+ this.mLossTimer = 0;
+ }
+
+ if ((aTick % 10L) == 0L) {
+
+ Logger.WARNING("getUniversalEnergyStored: "+aBaseMetaTileEntity.getUniversalEnergyStored() + " maxEUOutput * 20 + getMinimumStoredEU: " + ((this.maxEUOutput() * 20) + this.getMinimumStoredEU()));
+
+ if ((this.mSolarCharge > 100) && (aBaseMetaTileEntity.isAllowedToWork()) &&
+ (!aBaseMetaTileEntity.getWorld().isThundering()) &&
+ (aBaseMetaTileEntity.getUniversalEnergyStored() < (this.maxEUStore() - this.getMinimumStoredEU()))) {
+ this.getBaseMetaTileEntity().increaseStoredEnergyUnits(sEnergyPerTick * this.getEfficiency(), true);
+ }
+ }
+
+ if ((this.mSolarCharge < 500) && (this.mProcessingEnergy != 0) && ((aTick % 32L) == 0L)) {
+ Logger.WARNING("Adding Solar Charge. Currently "+this.mSolarCharge);
+ this.mProcessingEnergy -= 1;
+ this.mSolarCharge += 1;
+ }
+
+ if ((this.mProcessingEnergy <= 0) && (aBaseMetaTileEntity.isAllowedToWork()) && ((aTick % 64L) == 0L) && (!aBaseMetaTileEntity.getWorld().isThundering())) {
+ Logger.WARNING("Adding Processing Energy. Currently "+this.mProcessingEnergy);
+ final boolean bRain = aBaseMetaTileEntity.getWorld().isRaining() && (aBaseMetaTileEntity.getBiome().rainfall > 0.0F);
+ this.mProcessingEnergy += (bRain && (aBaseMetaTileEntity.getWorld().skylightSubtracted >= 4)) || !aBaseMetaTileEntity.getSkyAtSide((byte) 1) ? 0 : !bRain && aBaseMetaTileEntity.getWorld().isDaytime() ? 8 : 1;
+ }
+
+ if (aBaseMetaTileEntity.isServerSide()){
+ //Utils.LOG_WARNING("6.");
+ aBaseMetaTileEntity.setActive(aBaseMetaTileEntity.isAllowedToWork() && (aBaseMetaTileEntity.getUniversalEnergyStored() >= (this.maxEUOutput() + this.getMinimumStoredEU())));
+ }
+ }
+ }
+
+ @Override
+ public void inValidate() {
+
+ }
+
+ @Override
+ public int getEfficiency() {
+ return this.mEfficiency;
+ }
+
+ @Override
+ public long maxEUStore() {
+ return Math.max(this.getEUVar(), (V[this.mTier] * 16000) + this.getMinimumStoredEU());
+ }
+
+
+ ITexture SolarArray[] = {new GT_RenderedTexture(Textures.BlockIcons.SOLARPANEL_8V),
+ new GT_RenderedTexture(Textures.BlockIcons.SOLARPANEL_LV), new GT_RenderedTexture(Textures.BlockIcons.SOLARPANEL_MV), new GT_RenderedTexture(Textures.BlockIcons.SOLARPANEL_HV),
+ new GT_RenderedTexture(Textures.BlockIcons.SOLARPANEL_EV), new GT_RenderedTexture(Textures.BlockIcons.SOLARPANEL_IV), new GT_RenderedTexture(Textures.BlockIcons.SOLARPANEL_LuV),
+ new GT_RenderedTexture(Textures.BlockIcons.SOLARPANEL_ZPM), new GT_RenderedTexture(Textures.BlockIcons.SOLARPANEL_UV), new GT_RenderedTexture(Textures.BlockIcons.SOLARPANEL)};
+
+
+ @Override
+ public ITexture[] getFront(final byte aColor) {
+ return new ITexture[]{super.getFront(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_MAGIC_FRONT),
+ Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier]};
+ }
+
+ @Override
+ public ITexture[] getBack(final byte aColor) {
+ return new ITexture[]{super.getBack(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_MAGIC)};
+ }
+
+ @Override
+ public ITexture[] getBottom(final byte aColor) {
+ return new ITexture[]{super.getBottom(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_MAGIC)};
+ }
+
+ @Override
+ public ITexture[] getTop(final byte aColor) {
+ return new ITexture[]{super.getTop(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.SOLARPANEL)};
+ }
+
+ @Override
+ public ITexture[] getSides(final byte aColor) {
+ return new ITexture[]{super.getSides(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_MAGIC)};
+ }
+
+ @Override
+ public ITexture[] getFrontActive(final byte aColor) {
+ return new ITexture[]{super.getFrontActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_MAGIC_FRONT_ACTIVE),
+ Textures.BlockIcons.OVERLAYS_ENERGY_OUT[this.mTier]};
+ }
+
+ @Override
+ public ITexture[] getBackActive(final byte aColor) {
+ return new ITexture[]{super.getBackActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_MAGIC_ACTIVE)};
+ }
+
+ @Override
+ public ITexture[] getBottomActive(final byte aColor) {
+ return new ITexture[]{super.getBottomActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_MAGIC_ACTIVE)};
+ }
+
+ @Override
+ public ITexture[] getTopActive(final byte aColor) {
+ return new ITexture[]{super.getTopActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.SOLARPANEL)};
+ }
+
+ @Override
+ public ITexture[] getSidesActive(final byte aColor) {
+ return new ITexture[]{super.getSidesActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_MAGIC_ACTIVE)};
+ }
+
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntity_RTG.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntity_RTG.java
new file mode 100644
index 0000000000..ab000b98d4
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntity_RTG.java
@@ -0,0 +1,390 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.generators;
+
+import net.minecraft.init.Blocks;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.nbt.NBTTagList;
+
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.MetaTileEntity;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicGenerator;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_Utility;
+import gregtech.api.util.GTPP_Recipe;
+
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.math.MathUtils;
+import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils;
+import gtPlusPlus.core.util.reflect.ReflectionUtils;
+import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList;
+import net.minecraftforge.fluids.FluidStack;
+
+public class GregtechMetaTileEntity_RTG extends GT_MetaTileEntity_BasicGenerator {
+ public int mEfficiency;
+ private int mDays;
+ private long mTicksToBurnFor;
+ private int mVoltage = 0;
+ private GT_Recipe mCurrentRecipe;
+ private int mDaysRemaining = 0;
+ private int mDayTick = 0;
+ private byte mNewTier = 0;
+
+ public int removeDayOfTime(){
+ if (this.mDaysRemaining > 0){
+ return this.mDaysRemaining--;
+ }
+ return this.mDaysRemaining;
+ }
+
+ //Generates fuel value based on MC days
+ public static int convertDaysToTicks(float days){
+ int value = 0;
+ value = MathUtils.roundToClosestInt(20*86400*days);
+ return value;
+ }
+
+ public static long getTotalEUGenerated(int ticks, int voltage){
+ return ticks*voltage;
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ super.saveNBTData(aNBT);
+ aNBT.setLong("mTicksToBurnFor", this.mTicksToBurnFor);
+ aNBT.setInteger("mVoltage", this.mVoltage);
+ aNBT.setInteger("mDaysRemaining", this.mDaysRemaining);
+ aNBT.setInteger("mDayTick", this.mDayTick);
+ aNBT.setByte("mNewTier", this.mNewTier);
+
+
+ if (this.mCurrentRecipe != null){
+ final NBTTagList list = new NBTTagList();
+ final ItemStack stack = this.mCurrentRecipe.mInputs[0];
+ if(stack != null){
+ final NBTTagCompound data = new NBTTagCompound();
+ stack.writeToNBT(data);
+ data.setInteger("mSlot", 0);
+ list.appendTag(data);
+ }
+ aNBT.setTag("mRecipeItem", list);
+ }
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ super.loadNBTData(aNBT);
+ //this.mMachineBlock = aNBT.getByte("mMachineBlock");
+ this.mTicksToBurnFor = aNBT.getLong("mTicksToBurnFor");
+ this.mVoltage = aNBT.getInteger("mVoltage");
+ this.mDaysRemaining = aNBT.getInteger("mDaysRemaining");
+ this.mDayTick = aNBT.getInteger("mDayTick");
+ this.mNewTier = aNBT.getByte("mNewTier");
+
+ try {
+ ReflectionUtils.setByte(this, "mTier", this.mNewTier);
+ }
+ catch (Exception e) {
+ if (this.getBaseMetaTileEntity() != null){
+ IGregTechTileEntity thisTile = this.getBaseMetaTileEntity();
+ if (thisTile.isAllowedToWork() || thisTile.isActive()){
+ thisTile.setActive(false);
+ }
+ }
+ }
+
+
+ final NBTTagList list = aNBT.getTagList("mRecipeItem", 10);
+ final NBTTagCompound data = list.getCompoundTagAt(0);
+ ItemStack lastUsedFuel = ItemStack.loadItemStackFromNBT(data);
+ if (lastUsedFuel != null){
+ this.mCurrentRecipe = getRecipes().findRecipe(getBaseMetaTileEntity(), false, 9223372036854775807L, null, new ItemStack[] { lastUsedFuel });
+ }
+ }
+
+ @Override
+ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ if (aBaseMetaTileEntity.isServerSide()){
+ if (this.mDayTick < 24000){
+ this.mDayTick++;
+ }
+ else if (this.mDayTick >= 24000){
+ this.mDayTick = 0;
+ this.mDaysRemaining = this.removeDayOfTime();
+ }
+ }
+
+
+ if ((aBaseMetaTileEntity.isServerSide()) && (aBaseMetaTileEntity.isAllowedToWork()) && (aTick % 10L == 0L)) {
+ long tProducedEU = 0L;
+ if (this.mFluid == null) {
+ if (aBaseMetaTileEntity.getUniversalEnergyStored() < maxEUOutput() + getMinimumStoredEU()) {
+ this.mInventory[getStackDisplaySlot()] = null;
+ } else {
+ if (this.mInventory[getStackDisplaySlot()] == null)
+ this.mInventory[getStackDisplaySlot()] = new ItemStack(Blocks.fire, 1);
+ this.mInventory[getStackDisplaySlot()].setStackDisplayName("Generating: "
+ + (aBaseMetaTileEntity.getUniversalEnergyStored() - getMinimumStoredEU()) + " EU");
+ }
+ } else {
+ int tFuelValue = getFuelValue(this.mFluid);
+ int tConsumed = consumedFluidPerOperation(this.mFluid);
+ if ((tFuelValue > 0) && (tConsumed > 0) && (this.mFluid.amount > tConsumed)) {
+ long tFluidAmountToUse = Math.min(this.mFluid.amount / tConsumed,
+ (maxEUStore() - aBaseMetaTileEntity.getUniversalEnergyStored()) / tFuelValue);
+ if ((tFluidAmountToUse > 0L)
+ && (aBaseMetaTileEntity.increaseStoredEnergyUnits(tFluidAmountToUse * tFuelValue, true))) {
+ tProducedEU = tFluidAmountToUse * tFuelValue;
+ FluidStack tmp260_257 = this.mFluid;
+ tmp260_257.amount = (int) (tmp260_257.amount - (tFluidAmountToUse * tConsumed));
+ }
+ }
+ }
+ if ((this.mInventory[getInputSlot()] != null)
+ && (aBaseMetaTileEntity.getUniversalEnergyStored() < maxEUOutput() * 20L + getMinimumStoredEU())
+ && (GT_Utility.getFluidForFilledItem(this.mInventory[getInputSlot()], true) == null)) {
+ int tFuelValue = getFuelValue(this.mInventory[getInputSlot()]);
+ if (tFuelValue > 0) {
+ ItemStack tEmptyContainer = getEmptyContainer(this.mInventory[getInputSlot()]);
+ if (aBaseMetaTileEntity.addStackToSlot(getOutputSlot(), tEmptyContainer)) {
+ aBaseMetaTileEntity.increaseStoredEnergyUnits(tFuelValue, true);
+ aBaseMetaTileEntity.decrStackSize(getInputSlot(), 1);
+ tProducedEU = tFuelValue;
+ }
+ }
+ }
+ if ((tProducedEU > 0L) && (getPollution() > 0)) {
+ PollutionUtils.addPollution(aBaseMetaTileEntity, (int) (tProducedEU * getPollution() / 500 * this.mTier + 1L));
+ }
+ }
+
+ if (aBaseMetaTileEntity.isServerSide())
+ aBaseMetaTileEntity.setActive((aBaseMetaTileEntity.isAllowedToWork())
+ && (aBaseMetaTileEntity.getUniversalEnergyStored() >= maxEUOutput() + getMinimumStoredEU()));
+ }
+
+ @Override
+ public String[] getDescription() {
+ return new String[]{this.mDescription,
+ "Fuel is measured in minecraft days (Check with Scanner)",
+ "RTG changes output voltage depending on fuel",
+ "Generates power at " + this.getEfficiency() + "% Efficiency per tick",
+ "Output Voltage: "+this.getOutputTier()+" EU/t",
+ CORE.GT_Tooltip
+ };
+ }
+
+ public GregtechMetaTileEntity_RTG(int aID, String aName, String aNameRegional, int aTier) {
+ super(aID, aName, aNameRegional, aTier, "Requires RTG Pellets", new ITexture[0]);
+ }
+
+ private byte getTier(){
+ int voltage = this.mVoltage;
+ if (voltage >= 512){
+ return 4;
+ }
+ else if (voltage >= 128){
+ return 3;
+ }
+ else if (voltage >= 32){
+ return 2;
+ }
+ else if (voltage >= 8){
+ return 1;
+ }
+ return 0;
+ }
+
+ public GregtechMetaTileEntity_RTG(String aName, int aTier, String aDescription,
+ ITexture[][][] aTextures) {
+ super(aName, aTier, aDescription, aTextures);
+ }
+
+ @Override
+ public boolean isOutputFacing(byte aSide) {
+ return ((aSide > 1) && (aSide != getBaseMetaTileEntity().getFrontFacing())
+ && (aSide != getBaseMetaTileEntity().getBackFacing()));
+ }
+
+ @Override
+ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaTileEntity_RTG(this.mName, this.mTier, this.mDescription, this.mTextures);
+ }
+
+ @Override
+ public GT_Recipe.GT_Recipe_Map getRecipes() {
+ return GTPP_Recipe.GTPP_Recipe_Map.sRTGFuels;
+ }
+
+ @Override
+ public int getCapacity() {
+ return 0;
+ }
+
+ @Override
+ public int getEfficiency() {
+ return this.mEfficiency = 100;
+ }
+
+ @Override
+ public ITexture[] getFront(byte aColor) {
+ return new ITexture[] { super.getFront(aColor)[0],
+ new GT_RenderedTexture(Textures.BlockIcons.NAQUADAH_REACTOR_SOLID_TOP),
+ new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_MASSFAB) };
+ }
+
+ @Override
+ public ITexture[] getBack(byte aColor) {
+ return new ITexture[] { super.getBack(aColor)[0],
+ new GT_RenderedTexture(Textures.BlockIcons.NAQUADAH_REACTOR_SOLID_TOP) };
+ }
+
+ @Override
+ public ITexture[] getBottom(byte aColor) {
+ return new ITexture[] { super.getBottom(aColor)[0],
+ new GT_RenderedTexture(Textures.BlockIcons.NAQUADAH_REACTOR_SOLID_TOP) };
+ }
+
+ @Override
+ public ITexture[] getTop(byte aColor) {
+ return new ITexture[] { super.getTop(aColor)[0],
+ new GT_RenderedTexture(Textures.BlockIcons.NAQUADAH_REACTOR_SOLID_TOP),
+ new GT_RenderedTexture(Textures.BlockIcons.NAQUADAH_REACTOR_FLUID_SIDE) };
+ }
+
+ @Override
+ public ITexture[] getSides(byte aColor) {
+ return new ITexture[]{
+ gregtech.api.enums.Textures.BlockIcons.MACHINE_CASINGS[this.mTier][(0)],
+ new GT_RenderedTexture(Textures.BlockIcons.NAQUADAH_REACTOR_SOLID_TOP_ACTIVE),
+ gregtech.api.enums.Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[getTier()]};
+ }
+
+ @Override
+ public ITexture[] getFrontActive(byte aColor) {
+ return new ITexture[] { super.getFrontActive(aColor)[0],
+ new GT_RenderedTexture(Textures.BlockIcons.NAQUADAH_REACTOR_SOLID_TOP_ACTIVE),
+ new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_MASSFAB_ACTIVE) };
+ }
+
+ @Override
+ public ITexture[] getBackActive(byte aColor) {
+ return new ITexture[] { super.getBackActive(aColor)[0],
+ new GT_RenderedTexture(Textures.BlockIcons.NAQUADAH_REACTOR_SOLID_TOP_ACTIVE) };
+ }
+
+ @Override
+ public ITexture[] getBottomActive(byte aColor) {
+ return new ITexture[] { super.getBottomActive(aColor)[0],
+ new GT_RenderedTexture(Textures.BlockIcons.NAQUADAH_REACTOR_SOLID_TOP_ACTIVE) };
+ }
+
+ @Override
+ public ITexture[] getTopActive(byte aColor) {
+ return new ITexture[] { super.getTopActive(aColor)[0],
+ new GT_RenderedTexture(Textures.BlockIcons.NAQUADAH_REACTOR_SOLID_TOP_ACTIVE),
+ new GT_RenderedTexture(Textures.BlockIcons.NAQUADAH_REACTOR_FLUID_SIDE_ACTIVE) };
+ }
+
+ @Override
+ public ITexture[] getSidesActive(byte aColor) {
+ return new ITexture[]{
+ gregtech.api.enums.Textures.BlockIcons.MACHINE_CASINGS[this.mTier][(0)],
+ new GT_RenderedTexture(Textures.BlockIcons.NAQUADAH_REACTOR_SOLID_TOP_ACTIVE),
+ gregtech.api.enums.Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[getTier()]};
+ }
+
+
+ public int getPollution() {
+ return 0;
+ }
+
+ @Override
+ public int getFuelValue(ItemStack aStack) {
+ if ((GT_Utility.isStackInvalid(aStack)) || (getRecipes() == null))
+ return 0;
+ GT_Recipe tFuel = getRecipes().findRecipe(getBaseMetaTileEntity(), false, 9223372036854775807L, null,
+ new ItemStack[] { aStack });
+ if (tFuel != null){
+ this.mCurrentRecipe = tFuel;
+ int voltage = tFuel.mEUt;
+ this.mVoltage = voltage;
+ int sfsf = this.mTier;
+ //this.mDaysRemaining = tFuel.mSpecialValue*365;
+
+ //Do some voodoo.
+ byte mTier2;
+ //mTier2 = ReflectionUtils.getField(this.getClass(), "mTier");
+ try {
+ if (ItemStack.areItemStacksEqual(tFuel.mInputs[0], GregtechItemList.Pellet_RTG_AM241.get(1))){
+ mTier2 = 1;
+ }
+ else if (ItemStack.areItemStacksEqual(tFuel.mInputs[0], GregtechItemList.Pellet_RTG_PO210.get(1))){
+ mTier2 = 3;
+ }
+ else if (ItemStack.areItemStacksEqual(tFuel.mInputs[0], GregtechItemList.Pellet_RTG_PU238.get(1))){
+ mTier2 = 2;
+ }
+ else if (ItemStack.areItemStacksEqual(tFuel.mInputs[0], GregtechItemList.Pellet_RTG_SR90.get(1))){
+ mTier2 = 1;
+ }
+ else {
+ //Utils.LOG_INFO("test:"+tFuel.mInputs[0].getDisplayName() + " | " + (ItemStack.areItemStacksEqual(tFuel.mInputs[0], GregtechItemList.Pellet_RTG_PU238.get(1))));
+ mTier2 = 0;
+ }
+ ReflectionUtils.setByte(this, "mTier", mTier2);
+ this.mNewTier = mTier2;
+ //ReflectionUtils.setFinalStatic(mTier2, GT_Values.V[0]);
+ } catch (Exception e) {
+ Logger.WARNING("Failed setting mTier.");
+ e.printStackTrace();
+ }
+
+ this.mTicksToBurnFor = getTotalEUGenerated(convertDaysToTicks(tFuel.mSpecialValue), voltage);
+ if (mTicksToBurnFor >= Integer.MAX_VALUE){
+ mTicksToBurnFor = Integer.MAX_VALUE;
+ Logger.WARNING("Fuel went over Int limit, setting to MAX_VALUE.");
+ }
+ this.mDaysRemaining = MathUtils.roundToClosestInt(mTicksToBurnFor/20/60/3);
+ Logger.WARNING("step | "+(int) (mTicksToBurnFor * getEfficiency() / 100L));
+ return (int) (mTicksToBurnFor * getEfficiency() / 100L);
+ //return (int) (tFuel.mSpecialValue * 365L * getEfficiency() / 100L);
+ //return tFuel.mEUt;
+ }
+ Logger.WARNING("Not sure");
+ return 0;
+ }
+
+ @Override
+ public long maxEUOutput() {
+ return ((getBaseMetaTileEntity().isAllowedToWork()) ? this.mVoltage : 0L);
+ }
+
+ @Override
+ public long getOutputTier() {
+ if (this.mCurrentRecipe != null){
+ return this.mVoltage = this.mCurrentRecipe.mEUt;
+ }
+ return 0;
+ }
+
+ @Override
+ public boolean isGivingInformation() {
+ return true;
+ }
+
+ @Override
+ public String[] getInfoData() {
+ return new String[] { "RTG - Running at tier "+this.mTier,
+ "Active: "+this.getBaseMetaTileEntity().isActive(), "Current Output: " + this.mVoltage + " EU/t",
+ "Days of Fuel remaining: "+(mTicksToBurnFor/20/60/20),
+ "Hours of Fuel remaining: "+(mTicksToBurnFor/20/60/60),
+ "Ticks of "+this.mVoltage+"v remaining: "+(mTicksToBurnFor),
+ "Current Recipe input: "+ this.mCurrentRecipe != null ? this.mCurrentRecipe.mInputs[0].getDisplayName() + " x1" : "NUll"
+ };
+ }
+
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/ULV/GT_MetaTileEntity_ULV_CombustionGenerator.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/ULV/GT_MetaTileEntity_ULV_CombustionGenerator.java
new file mode 100644
index 0000000000..58919f0954
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/ULV/GT_MetaTileEntity_ULV_CombustionGenerator.java
@@ -0,0 +1,50 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.generators.ULV;
+
+import static gregtech.api.enums.GT_Values.V;
+
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.ConfigCategories;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.MetaTileEntity;
+import gregtech.common.tileentities.generators.GT_MetaTileEntity_DieselGenerator;
+import gtPlusPlus.core.lib.CORE;
+
+public class GT_MetaTileEntity_ULV_CombustionGenerator extends GT_MetaTileEntity_DieselGenerator {
+ public GT_MetaTileEntity_ULV_CombustionGenerator(int aID, String aName, String aNameRegional, int aTier) {
+ super(aID, aName, aNameRegional, aTier);
+ }
+
+ public GT_MetaTileEntity_ULV_CombustionGenerator(String aName, int aTier, String aDescription, ITexture[][][] aTextures) {
+ super(aName, aTier, aDescription, aTextures);
+ }
+
+ @Override
+ public String[] getDescription() {
+ return new String[]{
+ this.mDescription,
+ "Produces "+(this.getPollution()*20)+" pollution/sec",
+ "Fuel Efficiency: "+this.getEfficiency() + "%",
+ CORE.GT_Tooltip};
+ }
+
+ @Override
+ public long maxEUStore() {
+ return Math.max(getEUVar(), V[1] * 80L + getMinimumStoredEU());
+ }
+
+ @Override
+ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT_MetaTileEntity_ULV_CombustionGenerator(this.mName, this.mTier, this.mDescription, this.mTextures);
+ }
+
+ @Override
+ public int getCapacity() {
+ return 16000;
+ }
+
+ @Override
+ public void onConfigLoad() {
+ this.mEfficiency = GregTech_API.sMachineFile.get(ConfigCategories.machineconfig, "DieselGenerator.efficiency.tier." + this.mTier, 95);
+ }
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/ULV/GT_MetaTileEntity_ULV_GasTurbine.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/ULV/GT_MetaTileEntity_ULV_GasTurbine.java
new file mode 100644
index 0000000000..17bb4463c4
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/ULV/GT_MetaTileEntity_ULV_GasTurbine.java
@@ -0,0 +1,59 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.generators.ULV;
+
+import static gregtech.api.enums.GT_Values.V;
+
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.ConfigCategories;
+import gregtech.api.interfaces.IIconContainer;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.MetaTileEntity;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.common.tileentities.generators.GT_MetaTileEntity_GasTurbine;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+
+public class GT_MetaTileEntity_ULV_GasTurbine extends GT_MetaTileEntity_GasTurbine {
+ public GT_MetaTileEntity_ULV_GasTurbine(int aID, String aName, String aNameRegional, int aTier) {
+ super(aID, aName, aNameRegional, aTier);
+ }
+
+ public GT_MetaTileEntity_ULV_GasTurbine(String aName, int aTier, String aDescription, ITexture[][][] aTextures) {
+ super(aName, aTier, aDescription, aTextures);
+ }
+
+ @Override
+ public String[] getDescription() {
+ return new String[]{
+ this.mDescription,
+ "Produces "+(this.getPollution()*20)+" pollution/sec",
+ "Fuel Efficiency: "+this.getEfficiency() + "%",
+ CORE.GT_Tooltip};
+ }
+
+ @Override
+ public long maxEUStore() {
+ return Math.max(getEUVar(), V[1] * 80L + getMinimumStoredEU());
+ }
+
+ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT_MetaTileEntity_ULV_GasTurbine(this.mName, this.mTier, this.mDescription, this.mTextures);
+ }
+
+ @Override
+ public int getCapacity() {
+ return 16000;
+ }
+
+ @Override
+ public void onConfigLoad() {
+ this.mEfficiency = GregTech_API.sMachineFile.get(ConfigCategories.machineconfig, "GasTurbine.efficiency.tier." + this.mTier, 95);
+ }
+
+ @Override
+ public ITexture[] getSidesActive(final byte aColor) {
+ return new ITexture[]{super.getSidesActive(aColor)[0],
+ new GT_RenderedTexture((IIconContainer) TexturesGtBlock.Overlay_Machine_Turbine_Active)};
+ }
+
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/ULV/GT_MetaTileEntity_ULV_SteamTurbine.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/ULV/GT_MetaTileEntity_ULV_SteamTurbine.java
new file mode 100644
index 0000000000..ef3310c6fc
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/ULV/GT_MetaTileEntity_ULV_SteamTurbine.java
@@ -0,0 +1,58 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.generators.ULV;
+
+import static gregtech.api.enums.GT_Values.V;
+
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.ConfigCategories;
+import gregtech.api.interfaces.IIconContainer;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.MetaTileEntity;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.common.tileentities.generators.GT_MetaTileEntity_SteamTurbine;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+
+public class GT_MetaTileEntity_ULV_SteamTurbine extends GT_MetaTileEntity_SteamTurbine {
+ public GT_MetaTileEntity_ULV_SteamTurbine(int aID, String aName, String aNameRegional, int aTier) {
+ super(aID, aName, aNameRegional, aTier);
+ }
+
+ public GT_MetaTileEntity_ULV_SteamTurbine(String aName, int aTier, String aDescription, ITexture[][][] aTextures) {
+ super(aName, aTier, aDescription, aTextures);
+ }
+
+ @Override
+ public String[] getDescription() {
+ return new String[]{
+ this.mDescription,
+ "Produces "+(this.getPollution()*20)+" pollution/sec",
+ "Fuel Efficiency: "+this.getEfficiency() + "%",
+ CORE.GT_Tooltip};
+ }
+
+ @Override
+ public long maxEUStore() {
+ return Math.max(getEUVar(), V[1] * 80L + getMinimumStoredEU());
+ }
+
+ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT_MetaTileEntity_ULV_SteamTurbine(this.mName, this.mTier, this.mDescription, this.mTextures);
+ }
+
+ @Override
+ public int getCapacity() {
+ return 16000;
+ }
+
+ @Override
+ public void onConfigLoad() {
+ this.mEfficiency = GregTech_API.sMachineFile.get(ConfigCategories.machineconfig, "SteamTurbine.efficiency.tier." + this.mTier, 6 + 1);
+ }
+
+ @Override
+ public ITexture[] getSidesActive(final byte aColor) {
+ return new ITexture[]{super.getSidesActive(aColor)[0],
+ new GT_RenderedTexture((IIconContainer) TexturesGtBlock.Overlay_Machine_Turbine_Active)};
+ }
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/creative/GregtechMetaCreativeEnergyBuffer.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/creative/GregtechMetaCreativeEnergyBuffer.java
new file mode 100644
index 0000000000..a62a5d16c8
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/creative/GregtechMetaCreativeEnergyBuffer.java
@@ -0,0 +1,229 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.generators.creative;
+
+import static gregtech.api.enums.GT_Values.V;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.EnumChatFormatting;
+import gregtech.api.enums.GT_Values;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.objects.GT_RenderedTexture;
+
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.math.MathUtils;
+import gtPlusPlus.core.util.minecraft.PlayerUtils;
+import gtPlusPlus.core.util.reflect.ReflectionUtils;
+import gtPlusPlus.core.util.sys.KeyboardUtils;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.CustomIcon;
+import gtPlusPlus.xmod.gregtech.common.tileentities.storage.GregtechMetaEnergyBuffer;
+
+/**
+ * NEVER INCLUDE THIS FILE IN YOUR MOD!!!
+ *
+ * This is the main construct for my Basic Machines such as the Automatic Extractor
+ * Extend this class to make a simple Machine
+ */
+public class GregtechMetaCreativeEnergyBuffer extends GregtechMetaEnergyBuffer {
+
+
+ public GregtechMetaCreativeEnergyBuffer(final String aName, final int aTier,
+ final String aDescription, final ITexture[][][] aTextures, final int aSlotCount) {
+ super(aName, aTier, aDescription, aTextures, aSlotCount);
+ // TODO Auto-generated constructor stub
+ }
+
+ public GregtechMetaCreativeEnergyBuffer(final int aID, final String aName,
+ final String aNameRegional, final int aTier, final String aDescription, final int aSlotCount) {
+ super(aID, aName, aNameRegional, aTier, aDescription, aSlotCount);
+ }
+
+ @Override
+ public String[] getDescription() {
+ return new String[] {this.mDescription,
+ "Use Screwdriver to change voltage",
+ "Hold Shift while using Screwdriver to change amperage",
+ EnumChatFormatting.GREEN+"CREATIVE MACHINE",
+ CORE.GT_Tooltip};
+ }
+
+ /*
+ * MACHINE_STEEL_SIDE
+ */
+ @Override
+ public ITexture[][][] getTextureSet(final ITexture[] aTextures) {
+ CustomIcon h = TexturesGtBlock.Casing_Material_RedSteel;
+ CustomIcon g = TexturesGtBlock.Casing_Material_Grisium;
+ CustomIcon k;
+ boolean j = MathUtils.isNumberEven(this.mTier);
+ final ITexture[][][] rTextures = new ITexture[2][17][];
+ k = j ? g : h;
+ for (byte i = -1; i < 16; i++) {
+ rTextures[0][i + 1] = new ITexture[] { new GT_RenderedTexture(k) };
+ rTextures[1][i + 1] = new ITexture[] {
+ new GT_RenderedTexture(k), this.mInventory.length > 4 ? Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier]
+ : Textures.BlockIcons.OVERLAYS_ENERGY_OUT[this.mTier] };
+ }
+ return rTextures;
+ }
+
+ @Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity,
+ final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive,
+ final boolean aRedstone) {
+ return this.mTextures[aSide == aFacing ? 1 : 0][aColorIndex + 1];
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaCreativeEnergyBuffer(this.mName, this.mTier, this.mDescription,
+ this.mTextures, this.mInventory.length);
+ }
+
+ @Override
+ public long getMinimumStoredEU() {
+ return 0;
+ }
+
+ @Override
+ public long maxEUStore() {
+ return Long.MAX_VALUE;
+ }
+
+ @Override
+ public long maxEUInput() {
+ return V[this.mTier];
+ }
+
+ @Override
+ public long maxEUOutput() {
+ return V[this.mTier];
+ }
+
+ @Override
+ public long maxAmperesIn() {
+ return 16;
+ }
+
+ @Override
+ public long maxAmperesOut() {
+ return 16;
+ }
+
+ @Override public int getProgresstime() {return Integer.MAX_VALUE;}
+ @Override public int maxProgresstime() {return Integer.MAX_VALUE;}
+ @Override public boolean isAccessAllowed(final EntityPlayer aPlayer) {return true;}
+
+ @Override
+ public Object getServerGUI(final int aID, final InventoryPlayer aPlayerInventory,
+ final IGregTechTileEntity aBaseMetaTileEntity) {
+ return null;
+ }
+
+ @Override
+ public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory,
+ final IGregTechTileEntity aBaseMetaTileEntity) {
+ return null;
+ }
+
+ @Override
+ public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) {
+ this.getBaseMetaTileEntity().increaseStoredEnergyUnits(Integer.MAX_VALUE, true);
+ if (aBaseMetaTileEntity.isServerSide()) {
+ aBaseMetaTileEntity.increaseStoredEnergyUnits(Integer.MAX_VALUE, true);
+ }
+ }
+
+ @Override
+ public boolean allowPullStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public String[] getInfoData() {
+ String[] infoData = super.getInfoData();
+ return new String[] {
+ infoData[0],
+ "THIS IS A CREATIVE ITEM - FOR TESTING | Tier: "+this.mTier,
+ infoData[1],
+ infoData[2]
+ };
+ }
+
+ @Override
+ public boolean isGivingInformation() {
+ return true;
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ aNBT.setByte("mTier", this.mTier);
+ super.saveNBTData(aNBT);
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ super.loadNBTData(aNBT);
+ this.mTier = aNBT.getByte("mTier");
+ }
+
+ @Override
+ public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ if (KeyboardUtils.isShiftKeyDown()) {
+ super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ);
+ }
+ else {
+ if (this.mTier < (CORE.GTNH ? GT_Values.V.length-1 : 9)) {
+ this.mTier++;
+ }
+ else {
+ this.mTier = 0;
+ }
+ this.markDirty();
+ try {
+ Field field = ReflectionUtils.getField(this.getClass(), "mTextures");
+ field.setAccessible(true);
+ Field modifiersField = Field.class.getDeclaredField("modifiers");
+ modifiersField.setAccessible(true);
+ modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL);
+ ITexture[][][] V = getTextureSet(null);
+ if (V != null) {
+ Logger.REFLECTION("Got Valid Textures.");
+ if (this.getBaseMetaTileEntity().isClientSide()) {
+ Logger.REFLECTION("Clientside Call.");
+ Logger.REFLECTION("Refreshing Textures on buffer.");
+ field.set(this, V);
+ Logger.REFLECTION("Refreshed Textures on buffer.");
+ }
+ else {
+ Logger.REFLECTION("Serverside Call.");
+ }
+ }
+ else {
+ Logger.REFLECTION("Bad mTextures setter.");
+ }
+ }
+ catch (Throwable t) {
+ //Bad refresh.
+ t.printStackTrace();
+ Logger.REFLECTION("Bad mTextures setter.");
+ }
+ PlayerUtils.messagePlayer(aPlayer, "Now running at "+GT_Values.VOLTAGE_NAMES[this.mTier]+".");
+ }
+
+ }
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_WorldAccelerator.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_WorldAccelerator.java
new file mode 100644
index 0000000000..129446c40d
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_WorldAccelerator.java
@@ -0,0 +1,328 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic;
+
+import static gregtech.api.enums.GT_Values.V;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Random;
+
+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.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.world.World;
+
+import gregtech.api.enums.Textures;
+import gregtech.api.enums.Textures.BlockIcons.CustomIcon;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.MetaTileEntity;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_TieredMachineBlock;
+import gregtech.api.objects.GT_RenderedTexture;
+
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.minecraft.PlayerUtils;
+import net.minecraftforge.common.util.ForgeDirection;
+
+public class GT_MetaTileEntity_WorldAccelerator extends GT_MetaTileEntity_TieredMachineBlock {
+
+ public static String[] BlacklistedTileEntiyClassNames;
+
+ private byte mMode = 0; // 0: RandomTicks around 1: TileEntities with range
+ // 1
+ private static CustomIcon _mGTIco_Norm_Idle;
+ private static CustomIcon _mGTIco_Norm_Active;
+ private static CustomIcon _mGTIco_TE_Idle;
+ private static CustomIcon _mGTIco_TE_Active;
+ private static int[] mAccelerateStatic = { 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 512, 512, 512, 512, 512, 512 };
+
+ @Override
+ public void registerIcons(IIconRegister aBlockIconRegister) {
+ super.registerIcons(aBlockIconRegister);
+ _mGTIco_Norm_Idle = new CustomIcon("iconsets/OVERLAY_ACCELERATOR");
+ _mGTIco_Norm_Active = new CustomIcon("iconsets/OVERLAY_ACCELERATOR_ACTIVE");
+ _mGTIco_TE_Idle = new CustomIcon("iconsets/OVERLAY_ACCELERATOR_TE");
+ _mGTIco_TE_Active = new CustomIcon("iconsets/OVERLAY_ACCELERATOR_TE_ACTIVE");
+ }
+
+ @SideOnly(Side.CLIENT)
+ @Override
+ public void onValueUpdate(byte aValue) {
+ mMode = aValue;
+ }
+
+ @Override
+ public byte getUpdateData() {
+ return mMode;
+ }
+
+ public GT_MetaTileEntity_WorldAccelerator(int pID, String pName, String pNameRegional, int pTier) {
+ super(pID, pName, pNameRegional, pTier, 0, "");
+ }
+
+ @Override
+ public String[] getDescription() {
+ return new String[] {
+ String.format("Accelerating things (Radius: %d EU/t: %d Speed Bonus: x%d)", mTier,
+ getEnergyDemand(mTier, false), mAccelerateStatic[mTier]),
+ "Use a screwdriver to change mode", "To accelerate TileEntities, this machine has to be adjacent to it",
+ "This machine accepts up to 8 Amps", "Accelerating TileEntities doubles Energy-Demand"};
+
+ }
+
+ public GT_MetaTileEntity_WorldAccelerator(String pName, int pTier, int pInvSlotCount, String pDescription,
+ ITexture[][][] pTextures) {
+ super(pName, pTier, pInvSlotCount, pDescription, pTextures);
+ }
+
+ @Override
+ public MetaTileEntity newMetaEntity(IGregTechTileEntity pTileEntity) {
+ return new GT_MetaTileEntity_WorldAccelerator(mName, mTier, mInventory.length, mDescription, mTextures);
+ }
+
+ @Override
+ public ITexture[][][] getTextureSet(ITexture[] pTextures) {
+ return new ITexture[0][0][0];
+ }
+
+ @Override
+ public ITexture[] getTexture(IGregTechTileEntity pBaseMetaTileEntity, byte pSide, byte pFacing, byte pColorIndex,
+ boolean pActive, boolean pRedstone) {
+ if (mMode == 0)
+ return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][pColorIndex + 1],
+ (pSide < 2) ? null
+ : pActive ? new GT_RenderedTexture(_mGTIco_Norm_Active)
+ : new GT_RenderedTexture(_mGTIco_Norm_Idle) };
+ else
+ return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][pColorIndex + 1], (pSide < 2) ? null
+ : pActive ? new GT_RenderedTexture(_mGTIco_TE_Active) : new GT_RenderedTexture(_mGTIco_TE_Idle) };
+ }
+
+ @Override
+ public boolean allowPullStack(IGregTechTileEntity pBaseMetaTileEntity, int pIndex, byte pSide, ItemStack pStack) {
+ return false;
+ }
+
+ @Override
+ public boolean allowPutStack(IGregTechTileEntity pBaseMetaTileEntity, int pIndex, byte pSide, ItemStack pStack) {
+ return false;
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound pNBT) {
+ pNBT.setByte("mAccelMode", mMode);
+ }
+
+ public static long getEnergyDemand(int pTier, boolean pIsAcceleratingTEs) {
+ return V[pTier] * (pIsAcceleratingTEs ? 6 : 3);
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound pNBT) {
+ mMode = pNBT.getByte("mAccelMode");
+ }
+
+ @Override
+ public boolean isAccessAllowed(EntityPlayer pPlayer) {
+ return true;
+ }
+
+ @Override
+ public boolean isSimpleMachine() {
+ return false;
+ }
+
+ @Override
+ public boolean isFacingValid(byte aFacing) {
+ return true;
+ }
+
+ @Override
+ public boolean isEnetInput() {
+ return true;
+ }
+
+ @Override
+ public boolean isInputFacing(byte aSide) {
+ return true;
+ }
+
+ @Override
+ public boolean isTeleporterCompatible() {
+ return false;
+ }
+
+ @Override
+ public long getMinimumStoredEU() {
+ return 512;
+ }
+
+ @Override
+ public long maxEUStore() {
+ return 512 + V[mTier] * 50;
+ }
+
+ @Override
+ public long maxEUInput() {
+ return V[mTier];
+ }
+
+ @Override
+ public long maxAmperesIn() {
+ return 8;
+ }
+
+ private static String[] mModeStr = { "Blocks", "TileEntities" };
+
+ @Override
+ public void onScrewdriverRightClick(byte pSide, EntityPlayer pPlayer, float pX, float pY, float pZ) {
+ mMode = (byte) (mMode == 0x00 ? 0x01 : 0x00);
+ markDirty();
+ PlayerUtils.messagePlayer(pPlayer, String.format("Switched mode to: %s", mModeStr[mMode]));
+ }
+
+ @Override
+ public void onPostTick(IGregTechTileEntity pBaseMetaTileEntity, long pTick) {
+ try {
+ if (!pBaseMetaTileEntity.isServerSide())
+ return;
+
+ long tEnergyDemand = getEnergyDemand(mTier, (mMode == 1));
+
+ // Do we have enough energy to run? Or are we not allowed to run?
+ if (pBaseMetaTileEntity.getStoredEU() < tEnergyDemand || !pBaseMetaTileEntity.isAllowedToWork()) {
+ // Check if machine was active before
+ if (pBaseMetaTileEntity.isActive())
+ pBaseMetaTileEntity.setActive(false); // Then disable it now
+ } else {
+ // Continue to drain power
+ if (pBaseMetaTileEntity.decreaseStoredEnergyUnits(tEnergyDemand, false)) {
+ World tWorld = pBaseMetaTileEntity.getWorld();
+ // Limit the random ticks to once per second
+ if (mMode == 0) {
+ if (pTick % 20 == 0)
+ doAccelerateNormalBlocks(pBaseMetaTileEntity, tWorld);
+ } else
+ doAccelerateTileEntities(pBaseMetaTileEntity, tWorld);
+
+ } else {
+ // Energy drain failed. Disable machine
+ if (pBaseMetaTileEntity.isActive())
+ pBaseMetaTileEntity.setActive(false);
+ }
+ }
+ } catch (Exception e) {
+ Logger.ERROR("GT_MetaTileEntity_WorldAccelerator.onPostTick.crash");
+ Logger.ERROR(e.getMessage());
+ }
+ }
+
+ private void doAccelerateTileEntities(IGregTechTileEntity pBaseMetaTileEntity, World pWorld) {
+ try {
+ if (!pBaseMetaTileEntity.isActive())
+ getBaseMetaTileEntity().setActive(true);
+
+ for (ForgeDirection tDir : ForgeDirection.VALID_DIRECTIONS) {
+ TileEntity tTile = pBaseMetaTileEntity.getTileEntityAtSide((byte) tDir.ordinal());
+ if (isTEBlackListed(tTile))
+ continue;
+
+ long tMaxTime = System.nanoTime() + 1000000;
+ for (int j = 0; j < mAccelerateStatic[mTier]; j++) {
+ tTile.updateEntity();
+ if (System.nanoTime() > tMaxTime)
+ break;
+ }
+ }
+ } catch (Exception e) {
+ Logger.ERROR("GT_MetaTileEntity_WorldAccelerator.doAccelerateTileEntities.crash");
+ Logger.ERROR(e.getMessage());
+ }
+ }
+
+ private static List<String> _mBlacklistedTileEntities = new ArrayList<String>();
+
+ // Inspired by ChromatiCraft's TileAccelerator
+ private boolean isTEBlackListed(TileEntity pTile) {
+ if (pTile == null)
+ return true; // Obvious
+ if (!pTile.canUpdate())
+ return true; // Skip if TE can't update at all
+ if (pTile.isInvalid())
+ return true; // Obvious
+
+ String tSimpleClassName = pTile.getClass().getSimpleName().toLowerCase();
+ String tCanonicalName = pTile.getClass().getCanonicalName().toLowerCase();
+ if (tSimpleClassName.contains("conduit") || tSimpleClassName.contains("wire")
+ || tSimpleClassName.contains("cable"))
+ return true;
+ if (tCanonicalName.contains("appeng") || tCanonicalName.contains("gregtech"))
+ // Don't accelerate ANY Gregtech machines!
+ return true;
+ for (String tS : BlacklistedTileEntiyClassNames) {
+ if (tCanonicalName.equalsIgnoreCase(tS))
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * Accelerate normal blocks. Eats some power and adds randomTicks to every
+ * block within its working area (Tier-Number = radius) This does only
+ * affect blocks that implement the "RandomTick" method; Which is mostly
+ * used for grass growth and plants.
+ *
+ * @param pBaseMetaTileEntity
+ */
+ private void doAccelerateNormalBlocks(IGregTechTileEntity pBaseMetaTileEntity, World pWorld) {
+ if (!pBaseMetaTileEntity.isActive())
+ getBaseMetaTileEntity().setActive(true);
+
+ Random rnd = new Random();
+ int tX = pBaseMetaTileEntity.getXCoord();
+ int tY = pBaseMetaTileEntity.getYCoord();
+ int tZ = pBaseMetaTileEntity.getZCoord();
+
+ int tX1 = tX - mTier;
+ int tX2 = tX + mTier;
+ int tY1 = Math.max(tY - mTier, 0); // Limit to bedrock
+ int tY2 = Math.min(tY + mTier, 255); // Limit to build height
+ int tZ1 = tZ - mTier;
+ int tZ2 = tZ + mTier;
+
+ for (int xi = tX1; xi <= tX2; xi++)
+ for (int yi = tY1; yi <= tY2; yi++)
+ for (int zi = tZ1; zi <= tZ2; zi++)
+ tryTickBlock(pWorld, xi, yi, zi, rnd);
+
+ }
+
+ /**
+ * Send a tick to the target block
+ *
+ * @param pWorld
+ * @param pX
+ * @param pY
+ * @param pZ
+ * @param pRnd
+ */
+ private void tryTickBlock(World pWorld, int pX, int pY, int pZ, Random pRnd) {
+ try {
+ for (int j = 0; j < mTier; j++) {
+ Block tBlock = pWorld.getBlock(pX, pY, pZ);
+ if (tBlock.getTickRandomly())
+ tBlock.updateTick(pWorld, pX, pY, pZ, pRnd);
+ }
+ } catch (Exception e) {
+ Logger.ERROR("GT_MetaTileEntity_WorldAccelerator.tryTickBlock.crash");
+ Logger.ERROR(e.getMessage());
+ }
+ }
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaAtmosphericReconditioner.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaAtmosphericReconditioner.java
new file mode 100644
index 0000000000..eb01823151
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaAtmosphericReconditioner.java
@@ -0,0 +1,789 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic;
+
+import static gregtech.api.enums.GT_Values.V;
+import static gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils.mPollution;
+
+import org.apache.commons.lang3.ArrayUtils;
+
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.Materials;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.items.GT_MetaGenerated_Tool;
+import gregtech.api.metatileentity.MetaTileEntity;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine;
+import gregtech.api.objects.GT_ItemStack;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_ModHandler;
+import gregtech.api.util.GT_Utility;
+import gregtech.common.items.GT_MetaGenerated_Tool_01;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.api.objects.data.AutoMap;
+import gtPlusPlus.core.item.general.ItemAirFilter;
+import gtPlusPlus.core.item.general.ItemBasicScrubberTurbine;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.math.MathUtils;
+import gtPlusPlus.core.util.minecraft.PlayerUtils;
+import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils;
+import gtPlusPlus.xmod.gregtech.api.gui.basic.CONTAINER_PollutionCleaner;
+import gtPlusPlus.xmod.gregtech.api.gui.basic.GUI_PollutionCleaner;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.world.World;
+import net.minecraft.world.chunk.Chunk;
+
+public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_BasicMachine {
+
+ public int mPollutionReduction = 0;
+ protected int mBaseEff = 2500;
+ protected int mOptimalAirFlow = 0;
+ protected boolean mHasPollution = false;
+ protected int SLOT_ROTOR = 4;
+ protected int SLOT_FILTER = 5;
+ protected static boolean mPollutionEnabled = true;
+
+ protected boolean mSaveRotor = false;
+
+ public GregtechMetaAtmosphericReconditioner(int aID, String aName, String aNameRegional, int aTier) {
+ super(aID, aName, aNameRegional, aTier, 2, "Making sure you don't live in Gwalior - Uses 2A", 2, 0, "Recycler.png", "",
+ new ITexture[]{
+ new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_MASSFAB_ACTIVE),
+ new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_MASSFAB),
+ new GT_RenderedTexture(TexturesGtBlock.Overlay_MatterFab_Active),
+ new GT_RenderedTexture(TexturesGtBlock.Overlay_MatterFab),
+ new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Vent_Fast),
+ new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Vent),
+ new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_MASSFAB_ACTIVE),
+ new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_MASSFAB)
+ });
+ mPollutionEnabled = PollutionUtils.mPollution();
+ }
+
+ public GregtechMetaAtmosphericReconditioner(String aName, int aTier, String aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) {
+ super(aName, aTier, 2, aDescription, aTextures, 2, 0, aGUIName, aNEIName);
+ mPollutionEnabled = PollutionUtils.mPollution();
+ }
+
+ /*public GregtechMetaAtmosphericReconditioner(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) {
+ super(aName, aTier, 2, aDescription, aTextures, 2, 0, aGUIName, aNEIName);
+ }*/
+
+ @Override
+ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaAtmosphericReconditioner(this.mName, this.mTier, this.mDescription, this.mTextures, this.mGUIName, this.mNEIName);
+ }
+
+ @Override
+ public String[] getDescription() {
+
+ boolean highTier = this.mTier >= 7;
+
+ String[] A = new String[]{
+ this.mDescription,
+ highTier ? "Will attempt to remove 1/4 pollution from 8 surrounding chunks" : "",
+ highTier ? "If these chunks are not loaded, they will be ignored" : "",
+ "Requires a turbine rotor and an Air Filter [T1/T2] to run.",
+ "The turbine rotor must be manually inserted/replaced",
+ "Can be configured with a soldering iron to change modes",
+ "Low Efficiency: Removes half pollution, Turbine takes 50% dmg",
+ "High Efficiency: Removes full pollution, Turbine takes 100% dmg",
+ "Turbine Rotor will not break in LE mode",
+ "Insert an equal tier Conveyor Module to enable automation"
+ };
+ if (!mPollutionEnabled) {
+ String[] B = new String[] {
+ "===============================================",
+ "Pollution is disabled, scrubbers will now have a bonus use",
+ "They are now able to remove ALL lingering pollution as GT ignores it",
+ "and it will linger forever!",
+ "===============================================",
+ };
+ A = ArrayUtils.addAll(A, B);
+ }
+ return A;
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ super.saveNBTData(aNBT);
+ aNBT.setInteger("mOptimalAirFlow", this.mOptimalAirFlow);
+ aNBT.setBoolean("mSaveRotor", mSaveRotor);
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ super.loadNBTData(aNBT);
+ this.mOptimalAirFlow = aNBT.getInteger("mOptimalAirFlow");
+ this.mSaveRotor = aNBT.getBoolean("mSaveRotor");
+ }
+
+ @Override
+ public long maxAmperesIn() {
+ return 2;
+ }
+
+ @Override
+ public long getMinimumStoredEU() {
+ return V[mTier] * 2;
+ }
+
+ @Override
+ public long maxEUStore() {
+ return V[mTier] * 256;
+ }
+
+ @Override
+ public long maxEUInput() {
+ return V[mTier];
+ }
+
+ @Override
+ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ super.onPostTick(aBaseMetaTileEntity, aTick);
+ if (aBaseMetaTileEntity.isServerSide()) {
+
+ //Get Current Pollution Amount.
+ int mCurrentPollution = getCurrentChunkPollution();
+ boolean isIdle = true;
+
+ //Get Inventory Item
+ ItemStack stackRotor = this.mInventory[SLOT_ROTOR];
+ ItemStack stackFilter = this.mInventory[SLOT_FILTER];
+
+ //Power Drain
+ long drainEU = maxEUInput() * maxAmperesIn();
+ if (aBaseMetaTileEntity.isActive() && aBaseMetaTileEntity.getStoredEU() >= drainEU){
+ if(aBaseMetaTileEntity.decreaseStoredEnergyUnits(drainEU, false)){
+ isIdle = false;
+ }
+ else {
+ aBaseMetaTileEntity.setActive(false);
+ this.sendSound((byte) -122);
+ }
+ }
+ else if (!aBaseMetaTileEntity.isActive() && aBaseMetaTileEntity.getStoredEU() >= drainEU/4){
+ if(aBaseMetaTileEntity.decreaseStoredEnergyUnits((drainEU/4), false)){
+ isIdle = false;
+ }
+ else {
+ aBaseMetaTileEntity.setActive(false);
+ this.sendSound((byte) -122);
+ }
+ }
+ else {
+ aBaseMetaTileEntity.setActive(false);
+ this.sendSound((byte) -122);
+ }
+
+ //Only try once/sec.
+ if (!isIdle && aTick % 20L == 0L){
+
+ //Check if machine can work.
+ if ((aBaseMetaTileEntity.isAllowedToWork())){
+
+ //Enable machine animation/graphic
+ if (hasRotor(stackRotor) && hasAirFilter(stackFilter) && this.mHasPollution){
+ if (!this.getBaseMetaTileEntity().isActive()) {
+ aBaseMetaTileEntity.setActive(true);
+ }
+ }
+ else if (!this.mHasPollution || mCurrentPollution <= 0 || stackRotor == null || stackFilter == null || !hasRotor(stackRotor) || !hasAirFilter(stackFilter)){
+ if (!this.getBaseMetaTileEntity().isActive()) {
+ aBaseMetaTileEntity.setActive(false);
+ this.sendSound((byte) -122);
+ }
+ }
+
+ //If Active.
+ if (aBaseMetaTileEntity.isActive()){
+
+ //Do nothing if there is no pollution.
+ if(this.mHasPollution && mCurrentPollution > 0){
+
+ //Only check every 30s.
+ if (!isIdle && aTick % (20L * 30) == 0L){
+ mPollutionEnabled = PollutionUtils.mPollution();
+ //Clear out pollution if it's disabled, because I am a nice gal.
+ if (!mPollution()) {
+ PollutionUtils.nullifyPollution(this.getBaseMetaTileEntity());
+ }
+ }
+
+
+
+
+ //Use a Turbine
+ if(hasRotor(stackRotor) && hasAirFilter(stackFilter)){
+ Logger.WARNING("Found Turbine.");
+ mBaseEff = (int) ((50.0F + (10.0F * ((GT_MetaGenerated_Tool) stackRotor.getItem()).getToolCombatDamage(stackRotor))) * 100);
+ mOptimalAirFlow = (int) Math.max(Float.MIN_NORMAL, ((GT_MetaGenerated_Tool) stackRotor.getItem()).getToolStats(stackRotor).getSpeedMultiplier()
+ * GT_MetaGenerated_Tool.getPrimaryMaterial(stackRotor).mToolSpeed * 50);
+
+ //Make sure we have a valid Turbine and Eff/Airflow
+ if (this.mBaseEff > 0 && this.mOptimalAirFlow > 0){
+ //Utils.LOG_WARNING("Pollution Cleaner [5]");
+
+ //Log Debug information.
+ Logger.WARNING("mBaseEff[1]:"+mBaseEff);
+ Logger.WARNING("mOptimalAirFlow[1]:"+mOptimalAirFlow);
+
+ //Calculate The Voltage we are running
+ long tVoltage = drainEU;
+ byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage));
+
+ //Check Sides for Air,
+ //More air means more pollution processing.
+ int mAirSides = getFreeSpaces();
+
+ int reduction = 0;
+
+ //If no sides are free, how will you process the atmosphere?
+ if (mAirSides > 0){
+ reduction += (((Math.max((tTier-2), 1)*2)*50)*mAirSides); //Was originally *100
+ Logger.WARNING("mPollutionReduction[1]:"+reduction);
+
+ //I stole this code
+ reduction = (MathUtils.safeInt((long)reduction*this.mBaseEff)/100000)*mAirSides*Math.max((tTier-2), 1);
+ Logger.WARNING("reduction[2]:"+reduction);
+ reduction = MathUtils.safeInt(((long)reduction/100)*this.mOptimalAirFlow);
+ Logger.WARNING("reduction[3]:"+reduction);
+
+ mPollutionReduction = reduction;
+
+ //Set a temp to remove variable to aleviate duplicate code.
+ int toRemove = 0;
+
+ Logger.WARNING("mCurrentPollution[4]:"+mCurrentPollution);
+ if (reduction <= mCurrentPollution){
+ //Clean some Air.
+ toRemove = reduction;
+ }
+ else {
+ //Makes sure we don't get negative pollution.
+ toRemove = mCurrentPollution;
+ }
+
+ //We are good to clean
+ if (toRemove > 0){
+ if (damageTurbineRotor() && damageAirFilter()){
+ Logger.INFO("Removing "+toRemove+" pollution");
+ removePollution(mSaveRotor ? (toRemove/2) : toRemove);
+ Logger.WARNING("mNewPollution[4]:"+getCurrentChunkPollution());
+ }
+ else {
+ Logger.WARNING("Could not damage turbine rotor or Air Filter.");
+ aBaseMetaTileEntity.setActive(false);
+ }
+ } //End of pollution removal block.
+ } //End of valid air sides block.
+ } //End of valid toolstats block.
+ } //End of correct inventory item block.
+ else {
+ //Utils.LOG_WARNING("Wrong Tool metaitem Found.");
+ }
+ }
+ }
+ else if (!aBaseMetaTileEntity.isActive()) {
+ return;
+ }
+ } //End of can work block.
+ else { //Disable Machine.
+ //aBaseMetaTileEntity.setActive(false);
+ }
+ } //End of 1/sec action block.
+ else {
+
+ if (hasRotor(stackRotor) && hasAirFilter(stackFilter) && this.mHasPollution && !isIdle && aBaseMetaTileEntity.isAllowedToWork()){
+ aBaseMetaTileEntity.setActive(true);
+ }
+ else if (isIdle || !this.mHasPollution || mCurrentPollution <= 0 || stackRotor == null || stackFilter == null || !hasRotor(stackRotor) || !hasAirFilter(stackFilter)){
+ aBaseMetaTileEntity.setActive(false);
+ }
+
+ }
+ if (this.getBaseMetaTileEntity().isActive()) {
+ if (MathUtils.randInt(0, 5) <= 2) {
+ this.sendSound((byte) -120);
+ }
+ }
+
+ } //End of is serverside block.
+ }
+
+
+ public int getCurrentChunkPollution(){
+ int mCurrentChunkPollution = 0;
+ if (this.mTier < 7) {
+ mCurrentChunkPollution = PollutionUtils.getPollution(getBaseMetaTileEntity());
+ }
+ else {
+ AutoMap<Chunk> aSurrounding = new AutoMap<Chunk>();
+ World aWorld = this.getBaseMetaTileEntity().getWorld();
+ int xPos = this.getBaseMetaTileEntity().getXCoord();
+ int zPos = this.getBaseMetaTileEntity().getZCoord();
+ Chunk a1 = aWorld.getChunkFromBlockCoords(xPos-32, zPos-32);
+ Chunk a2 = aWorld.getChunkFromBlockCoords(xPos-32, zPos);
+ Chunk a3 = aWorld.getChunkFromBlockCoords(xPos-32, zPos+32);
+ Chunk b1 = aWorld.getChunkFromBlockCoords(xPos, zPos-32);
+ Chunk b2 = aWorld.getChunkFromBlockCoords(xPos, zPos);
+ Chunk b3 = aWorld.getChunkFromBlockCoords(xPos, zPos+32);
+ Chunk c1 = aWorld.getChunkFromBlockCoords(xPos+32, zPos-32);
+ Chunk c2 = aWorld.getChunkFromBlockCoords(xPos+32, zPos);
+ Chunk c3 = aWorld.getChunkFromBlockCoords(xPos+32, zPos+32);
+ aSurrounding.put(a1);
+ aSurrounding.put(a2);
+ aSurrounding.put(a3);
+ aSurrounding.put(b1);
+ aSurrounding.put(b2);
+ aSurrounding.put(b3);
+ aSurrounding.put(c1);
+ aSurrounding.put(c2);
+ aSurrounding.put(c3);
+ for (Chunk r : aSurrounding) {
+ mCurrentChunkPollution += getPollutionInChunk(r);
+ }
+ }
+ if (mCurrentChunkPollution > 0){
+ mHasPollution = true;
+ }
+ else {
+ mHasPollution = false;
+ }
+ return mCurrentChunkPollution;
+ }
+
+ public int getPollutionInChunk(Chunk aChunk){
+ int mCurrentChunkPollution = PollutionUtils.getPollution(aChunk);
+ if (mCurrentChunkPollution > 0){
+ mHasPollution = true;
+ }
+ else {
+ mHasPollution = false;
+ }
+ return mCurrentChunkPollution;
+ }
+
+ public boolean hasRotor(ItemStack rotorStack){
+ if(rotorStack != null){
+ if (rotorStack.getItem() instanceof ItemBasicScrubberTurbine) {
+ return true;
+ }
+ if (rotorStack.getItem() instanceof GT_MetaGenerated_Tool && rotorStack.getItemDamage() >= 170 && rotorStack.getItemDamage() <= 179){
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public boolean damageTurbineRotor(){
+ try{
+
+ boolean creativeRotor = false;
+ ItemStack rotorStack = this.mInventory[SLOT_ROTOR];
+ if (rotorStack == null) {
+ return false;
+ }
+ else {
+ if(rotorStack.getItem() instanceof GT_MetaGenerated_Tool_01) {
+ Materials t1 = GT_MetaGenerated_Tool.getPrimaryMaterial(rotorStack);
+ Materials t2 = GT_MetaGenerated_Tool.getSecondaryMaterial(rotorStack);
+ if (t1 == Materials._NULL && t2 == Materials._NULL){
+ creativeRotor = true;
+ }
+ }
+ }
+
+ if (rotorStack.getItem() instanceof ItemBasicScrubberTurbine) {
+ long currentUse = ItemBasicScrubberTurbine.getFilterDamage(rotorStack);
+ //Remove broken Filter
+ if (rotorStack.getItemDamage() == 0 && currentUse >= 2500-10){
+ this.mInventory[this.SLOT_FILTER] = null;
+ return false;
+ }
+ else if (rotorStack.getItemDamage() == 1 && currentUse >= 5000-10){
+ this.mInventory[this.SLOT_FILTER] = null;
+ return false;
+ }
+ else {
+ //Do Damage
+ ItemAirFilter.setFilterDamage(rotorStack, currentUse+10);
+ Logger.WARNING("Rotor Damage: "+currentUse);
+ return true;
+ }
+ }
+
+ if(mInventory[SLOT_ROTOR].getItem() instanceof GT_MetaGenerated_Tool_01 &&
+ ((GT_MetaGenerated_Tool) mInventory[SLOT_ROTOR].getItem()).getToolStats(mInventory[SLOT_ROTOR]).getSpeedMultiplier()>0 &&
+ GT_MetaGenerated_Tool.getPrimaryMaterial(mInventory[SLOT_ROTOR]).mToolSpeed>0 ) {
+
+ long damageValue = (long) Math.floor(Math.abs(MathUtils.randFloat(1, 2) - MathUtils.randFloat(1, 3)) * (1 + 3 - 1) + 1);
+ double fDam = Math.floor(Math.abs(MathUtils.randFloat(1f, 2f) - MathUtils.randFloat(1f, 2f)) * (1f + 2f - 1f) + 1f);
+ damageValue -= fDam;
+
+ //Logger.WARNING("Trying to do "+damageValue+" damage to the rotor. ["+fDam+"]");
+ /*Materials M1 = GT_MetaGenerated_Tool.getPrimaryMaterial(this.mInventory[this.SLOT_ROTOR]);
+ Materials M2 = GT_MetaGenerated_Tool.getSecondaryMaterial(this.mInventory[this.SLOT_ROTOR]);
+
+ Logger.WARNING("Trying to do "+damageValue+" damage to the rotor. [2]");*/
+
+ //Damage Rotor
+ //int rotorDurability = this.mInventory[this.SLOT_ROTOR].getItemDamage();
+ long rotorDamage = creativeRotor ? 0 : GT_MetaGenerated_Tool.getToolDamage(this.mInventory[this.SLOT_ROTOR]);
+ long rotorDurabilityMax = creativeRotor ? Integer.MAX_VALUE : GT_MetaGenerated_Tool.getToolMaxDamage(this.mInventory[this.SLOT_ROTOR]);
+ long rotorDurability = (rotorDurabilityMax - rotorDamage);
+ Logger.WARNING("Rotor Damage: "+rotorDamage + " | Max Durability: "+rotorDurabilityMax+" | "+" Remaining Durability: "+rotorDurability);
+ if (rotorDurability >= damageValue){
+
+
+ if (!mSaveRotor){
+ Logger.WARNING("Damaging Rotor.");
+
+ if (!creativeRotor)
+ GT_ModHandler.damageOrDechargeItem(this.mInventory[this.SLOT_ROTOR], (int) damageValue, 0, null);
+
+ long tempDur = GT_MetaGenerated_Tool.getToolDamage(this.mInventory[this.SLOT_ROTOR]);
+ if (tempDur < rotorDurabilityMax){
+ return true;
+ }
+ else {
+ rotorDurability = 0;
+ }
+ }
+ else {
+ Logger.WARNING("Damaging Rotor.");
+ if (rotorDurability > 1000){
+ if (!creativeRotor)
+ GT_ModHandler.damageOrDechargeItem(this.mInventory[this.SLOT_ROTOR], (int) damageValue/2, 0, null);
+ long tempDur = GT_MetaGenerated_Tool.getToolDamage(this.mInventory[this.SLOT_ROTOR]);
+ if (tempDur < rotorDurabilityMax){
+ return true;
+ }
+ else {
+ rotorDurability = 0;
+ }
+ }
+ }
+
+
+ }
+
+ if (rotorDurability <= 0 && !mSaveRotor && !creativeRotor) {
+ Logger.WARNING("Destroying Rotor.");
+ this.mInventory[this.SLOT_ROTOR] = null;
+ return false;
+ }
+ else if (rotorDurability <= 0 && mSaveRotor) {
+ Logger.WARNING("Saving Rotor.");
+ return false;
+ }
+
+
+ }else {
+ Logger.WARNING("Bad Rotor.");
+ return false;
+ }
+ }
+ catch (Throwable t){}
+ return false;
+ }
+
+ public int getFreeSpaces(){
+ int mAir = 0;
+ IGregTechTileEntity aBaseMetaTileEntity = this.getBaseMetaTileEntity();
+ int x = aBaseMetaTileEntity.getXCoord();
+ int y = aBaseMetaTileEntity.getYCoord();
+ int z = aBaseMetaTileEntity.getZCoord();
+ if(aBaseMetaTileEntity.getAirOffset(x+1, y, z)){
+ mAir++;
+ }
+ if(aBaseMetaTileEntity.getAirOffset(x-1, y, z)){
+ mAir++;
+ }
+ if(aBaseMetaTileEntity.getAirOffset(x, y, z+1)){
+ mAir++;
+ }
+ if(aBaseMetaTileEntity.getAirOffset(x, y, z-1)){
+ mAir++;
+ }
+ if(aBaseMetaTileEntity.getAirOffset(x, y+1, z)){
+ mAir++;
+ }
+ if(aBaseMetaTileEntity.getAirOffset(x, y-1, z)){
+ mAir++;
+ }
+ return mAir;
+ }
+
+ public boolean removePollution(int toRemove){
+
+ if (this == null || this.getBaseMetaTileEntity() == null || this.getBaseMetaTileEntity().getWorld() == null) {
+ return false;
+ }
+
+ if (this.mTier < 7) {
+ int startPollution = getCurrentChunkPollution();
+ PollutionUtils.removePollution(this.getBaseMetaTileEntity(), toRemove);
+ int after = getCurrentChunkPollution();
+ return (after<startPollution);
+ }
+ else {
+ int chunksWithRemoval = 0;
+ int totalRemoved = 0;
+ AutoMap<Chunk> aSurrounding = new AutoMap<Chunk>();
+ Chunk aThisChunk = this.getBaseMetaTileEntity().getWorld().getChunkFromBlockCoords(this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getZCoord());
+ int mainChunkX = aThisChunk.xPosition;
+ int mainChunkZ = aThisChunk.zPosition;
+
+ World aWorld = this.getBaseMetaTileEntity().getWorld();
+ int xPos = this.getBaseMetaTileEntity().getXCoord();
+ int zPos = this.getBaseMetaTileEntity().getZCoord();
+
+ Chunk a1 = aWorld.getChunkFromBlockCoords(xPos-32, zPos-32);
+ Chunk a2 = aWorld.getChunkFromBlockCoords(xPos-32, zPos);
+ Chunk a3 = aWorld.getChunkFromBlockCoords(xPos-32, zPos+32);
+ Chunk b1 = aWorld.getChunkFromBlockCoords(xPos, zPos-32);
+ Chunk b2 = aWorld.getChunkFromBlockCoords(xPos, zPos);
+ Chunk b3 = aWorld.getChunkFromBlockCoords(xPos, zPos+32);
+ Chunk c1 = aWorld.getChunkFromBlockCoords(xPos+32, zPos-32);
+ Chunk c2 = aWorld.getChunkFromBlockCoords(xPos+32, zPos);
+ Chunk c3 = aWorld.getChunkFromBlockCoords(xPos+32, zPos+32);
+
+ aSurrounding.put(a1);
+ aSurrounding.put(a2);
+ aSurrounding.put(a3);
+ aSurrounding.put(b1);
+ aSurrounding.put(b2);
+ aSurrounding.put(b3);
+ aSurrounding.put(c1);
+ aSurrounding.put(c2);
+ aSurrounding.put(c3);
+
+ for (Chunk r : aSurrounding) {
+ if (!r.isChunkLoaded) {
+ continue;
+ }
+
+ int startPollution = getPollutionInChunk(r);
+ if (startPollution == 0) {
+ continue;
+ }
+
+ Logger.WARNING("Trying to remove pollution from chunk "+r.xPosition+", "+r.zPosition+" | "+startPollution);
+ int after = 0;
+ boolean isMainChunk = r.isAtLocation(mainChunkX, mainChunkZ);
+
+ int removal = Math.max(0, !isMainChunk ? (toRemove/4) : toRemove);
+ if (removePollution(r, removal)) {
+ chunksWithRemoval++;
+ after = getPollutionInChunk(r);
+ }
+ else {
+ after = 0;
+ }
+ if (startPollution - after > 0) {
+ totalRemoved += (startPollution - after);
+ }
+ Logger.WARNING("Removed "+(startPollution - after)+" pollution from chunk "+r.xPosition+", "+r.zPosition+" | "+after);
+ }
+ return totalRemoved > 0 && chunksWithRemoval > 0;
+ }
+ }
+
+ public boolean removePollution(Chunk aChunk, int toRemove){
+ int before = getCurrentChunkPollution();
+ PollutionUtils.removePollution(aChunk, toRemove);
+ int after = getCurrentChunkPollution();
+ return (after<before);
+ }
+
+
+ public boolean hasAirFilter(ItemStack filter){
+ if (filter == null) {
+ return false;
+ }
+ if (filter.getItem() instanceof ItemAirFilter){
+ return true;
+ }
+ return false;
+ }
+
+ public boolean damageAirFilter(){
+ ItemStack filter = this.mInventory[this.SLOT_FILTER];
+ if (filter == null) {
+ return false;
+ }
+
+ boolean creativeRotor = false;
+ ItemStack rotorStack = this.mInventory[SLOT_ROTOR];
+ if (rotorStack != null) {
+ if(rotorStack.getItem() instanceof GT_MetaGenerated_Tool_01) {
+ Materials t1 = GT_MetaGenerated_Tool.getPrimaryMaterial(rotorStack);
+ Materials t2 = GT_MetaGenerated_Tool.getSecondaryMaterial(rotorStack);
+ if (t1 == Materials._NULL && t2 == Materials._NULL){
+ creativeRotor = true;
+ }
+ }
+ }
+
+ if (creativeRotor) {
+ return true;
+ }
+
+
+ if (filter.getItem() instanceof ItemAirFilter){
+
+ long currentUse = ItemAirFilter.getFilterDamage(filter);
+
+ //Remove broken Filter
+ if (filter.getItemDamage() == 0 && currentUse >= 50-1){
+ this.mInventory[this.SLOT_FILTER] = null;
+ return false;
+ }
+ else if (filter.getItemDamage() == 1 && currentUse >= 2500-1){
+ this.mInventory[this.SLOT_FILTER] = null;
+ return false;
+ }
+ else {
+ //Do Damage
+ ItemAirFilter.setFilterDamage(filter, currentUse+1);
+ Logger.WARNING("Filter Damage: "+currentUse);
+ return true;
+ }
+ }
+ return false;
+ }
+
+
+ @Override
+ public Object getServerGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) {
+ return new CONTAINER_PollutionCleaner(aPlayerInventory, aBaseMetaTileEntity);
+ }
+
+ @Override
+ public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GUI_PollutionCleaner(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), this.mGUIName);
+ }
+
+ @Override
+ public boolean canInsertItem(int aIndex, ItemStack aStack, int aSide) {
+ if (aIndex == 5) {
+ if (aStack.getItem() instanceof ItemAirFilter) {
+ Logger.INFO("Inserting Air Filter into "+aIndex);
+ return true;
+ }
+ }
+ if (aIndex == 4) {
+ if (this.mInventory[6] != null) {
+ Logger.INFO("Found conveyor, can automate turbines. Inserting into "+aIndex);
+ if (aStack.getItem() instanceof ItemBasicScrubberTurbine) {
+ return true;
+ }
+ if (aStack.getItem() instanceof GT_MetaGenerated_Tool && aStack.getItemDamage() >= 170 && aStack.getItemDamage() <= 179){
+ return true;
+ }
+ }
+ }
+ //return super.canInsertItem(aIndex, aStack, aSide);
+ return false;
+ }
+
+ @Override
+ public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ);
+ }
+
+ public boolean onSolderingToolRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY,
+ float aZ) {
+ this.mSaveRotor = Utils.invertBoolean(mSaveRotor);
+ if (mSaveRotor){
+ PlayerUtils.messagePlayer(aPlayer, "Running in low efficiency mode, rotors will not break.");
+ }
+ else {
+ PlayerUtils.messagePlayer(aPlayer, "Running in high efficiency mode, rotors will break.");
+ }
+ return true;
+ }
+
+ @Override
+ public void doSound(byte aIndex, double aX, double aY, double aZ) {
+ if (aIndex == -120) {
+ GT_Utility.doSoundAtClient((String) GregTech_API.sSoundList.get(Integer.valueOf(103)), MathUtils.randInt(5, 50), 0.05F, aX, aY, aZ);
+ } else if (aIndex == -121 || aIndex == -122) {
+ //GT_Utility.doSoundAtClient((String) GregTech_API.sSoundList.get(Integer.valueOf(108)), 0, 0.5F, aX, aY, aZ);
+ } /*else if (aIndex == -122) {
+ GT_Utility.doSoundAtClient((String) GregTech_API.sSoundList.get(Integer.valueOf(6)), 100, 1.0F, aX, aY, aZ);
+ }*/ else {
+ super.doSound((byte) 0, aX, aY, aZ);
+ }
+ }
+
+ @Override
+ public boolean canHaveInsufficientEnergy() {
+ // TODO Auto-generated method stub
+ return super.canHaveInsufficientEnergy();
+ }
+
+ @Override
+ public String[] getInfoData() {
+ AutoMap<String> aTooltipSuper = new AutoMap<String>();
+ for (String s : super.getInfoData()) {
+ aTooltipSuper.put(s);
+ }
+ int mAirSides = getFreeSpaces();
+ int reduction = 0;
+
+ try {
+ long tVoltage = maxEUInput();
+ byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage));
+ reduction += (((Math.max((tTier-2), 1)*2)*50)*mAirSides);
+ reduction = (MathUtils.safeInt((long)reduction*this.mBaseEff)/100000)*mAirSides*Math.max((tTier-2), 1);
+ reduction = MathUtils.safeInt(((long)reduction/100)*this.mOptimalAirFlow);
+
+ aTooltipSuper.put("Maximum pollution removed per second: "+reduction);
+ }
+ catch (Throwable t) {
+ aTooltipSuper.put("Maximum pollution removed per second: "+mPollutionReduction);
+ }
+ aTooltipSuper.put("Air Sides: "+mAirSides);
+
+ String[] mBuiltOutput = new String[aTooltipSuper.size()];
+ int aIndex = 0;
+ for (String i : aTooltipSuper) {
+ mBuiltOutput[aIndex++] = i;
+ }
+
+
+
+ return mBuiltOutput;
+ }
+
+ @Override
+ public boolean isGivingInformation() {
+ return true;
+ }
+
+ @Override
+ public boolean allowCoverOnSide(byte aSide, GT_ItemStack aCoverID) {
+ if (aSide <= 1) {
+ return false;
+ }
+ return super.allowCoverOnSide(aSide, aCoverID);
+ }
+
+ @Override
+ public ITexture[] getTopFacingInactive(byte aColor) {
+ return super.getTopFacingInactive(aColor);
+ }
+
+ @Override
+ public void setItemNBT(NBTTagCompound aNBT) {
+ aNBT.setInteger("mOptimalAirFlow", this.mOptimalAirFlow);
+ aNBT.setBoolean("mSaveRotor", mSaveRotor);
+ super.setItemNBT(aNBT);
+ }
+
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaCondensor.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaCondensor.java
new file mode 100644
index 0000000000..0f7edd062d
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaCondensor.java
@@ -0,0 +1,174 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic;
+
+import net.minecraft.entity.player.InventoryPlayer;
+
+import gregtech.api.enums.Dyes;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.MetaTileEntity;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_ModHandler;
+
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.math.MathUtils;
+import gtPlusPlus.xmod.gregtech.api.gui.CONTAINER_SteamCondenser;
+import gtPlusPlus.xmod.gregtech.api.gui.GUI_SteamCondenser;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.generators.GregtechMetaBoilerBase;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.FluidStack;
+import net.minecraftforge.fluids.IFluidHandler;
+
+public class GregtechMetaCondensor extends GregtechMetaBoilerBase{
+
+ public GregtechMetaCondensor(final int aID, final String aName, final String aNameRegional)
+ {
+ super(aID, aName, aNameRegional, "A Steam condenser - [IC2->Steam]", new ITexture[0]);
+ }
+
+ public GregtechMetaCondensor(final String aName, final int aTier, final String aDescription, final ITexture[][][] aTextures)
+ {
+ super(aName, aTier, aDescription, aTextures);
+ }
+
+ @Override
+ public String[] getDescription() {
+ return new String[]{this.mDescription, "IC2 Steam + Water = Normal Steam.", "Requires no power to run, although it's not very fast.", CORE.GT_Tooltip};
+ }
+
+ @Override
+ public ITexture[][][] getTextureSet(final ITexture[] aTextures)
+ {
+ final ITexture[][][] rTextures = new ITexture[5][17][];
+ for (byte i = -1; i < 16; i++){
+ rTextures[0][(i + 1)] = new ITexture [] { new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_VENT, Dyes.getModulation(i, Dyes.MACHINE_METAL.mRGBa))};
+ rTextures[1][(i + 1)] = new ITexture [] { new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_VENT, Dyes.getModulation(i, Dyes.MACHINE_METAL.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE) };
+ rTextures[2][(i + 1)] = new ITexture [] { new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_VENT, Dyes.getModulation(i, Dyes.MACHINE_METAL.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE) };
+ rTextures[3][(i + 1)] = new ITexture [] { new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_VENT, Dyes.getModulation(i, Dyes.MACHINE_METAL.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_POTIONBREWER) };
+ rTextures[4][(i + 1)] = new ITexture [] { new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_VENT, Dyes.getModulation(i, Dyes.MACHINE_METAL.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_POTIONBREWER_ACTIVE) };
+ }
+ return rTextures;
+ }
+
+ @Override
+ public int maxProgresstime()
+ {
+ return 1000;
+ }
+
+ @Override
+ public Object getServerGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity)
+ {
+ return new CONTAINER_SteamCondenser(aPlayerInventory, aBaseMetaTileEntity);
+ }
+
+ @Override
+ public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity)
+ {
+ return new GUI_SteamCondenser(aPlayerInventory, aBaseMetaTileEntity, "SteelBoiler.png");
+ }
+
+ @Override
+ public MetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity)
+ {
+ return new GregtechMetaCondensor(this.mName, this.mTier, this.mDescription, this.mTextures);
+ }
+
+ @Override
+ public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick)
+ {
+ this.RI = MathUtils.randLong(5L, 30L);
+ if ((aBaseMetaTileEntity.isServerSide()) && (aTick > 20L))
+ {
+ if (this.mTemperature <= 5)
+ {
+ this.mTemperature = 5;
+ this.mLossTimer = 0;
+ }
+ if (++this.mLossTimer > 10)
+ {
+ this.mTemperature -= 1;
+ this.mLossTimer = 0;
+ }
+ for (byte i = 1; (this.mSteam != null) && (i < 6); i = (byte)(i + 1)) {
+ if (i != aBaseMetaTileEntity.getFrontFacing())
+ {
+ final IFluidHandler tTileEntity = aBaseMetaTileEntity.getITankContainerAtSide(i);
+ if (tTileEntity != null)
+ {
+ final FluidStack tDrained = aBaseMetaTileEntity.drain(ForgeDirection.getOrientation(i), Math.max(1, this.mSteam.amount / 2), false);
+ if (tDrained != null)
+ {
+ final int tFilledAmount = tTileEntity.fill(ForgeDirection.getOrientation(i).getOpposite(), tDrained, false);
+ if (tFilledAmount > 0) {
+ tTileEntity.fill(ForgeDirection.getOrientation(i).getOpposite(), aBaseMetaTileEntity.drain(ForgeDirection.getOrientation(i), tFilledAmount, true), true);
+ }
+ }
+ }
+ }
+ }
+ if ((aTick % 10L) == 0L) {
+ if (this.mTemperature > 5)
+ {
+ if ((this.mFluid == null) || (!GT_ModHandler.isWater(this.mFluid)) || (this.mFluid.amount <= 0))
+ {
+ this.mHadNoWater = true;
+ }
+ else
+ {
+ if (this.mHadNoWater)
+ {
+ aBaseMetaTileEntity.doExplosion(2048L);
+ return;
+ }
+ this.mFluid.amount -= 1;
+ if (this.mSteam == null) {
+ this.mSteam = GT_ModHandler.getSteam(30L);
+ } else if (GT_ModHandler.isSteam(this.mSteam)) {
+ this.mSteam.amount += 30;
+ } else {
+ this.mSteam = GT_ModHandler.getSteam(30L);
+ }
+ }
+ }
+ else {
+ this.mHadNoWater = false;
+ }
+ }
+ if ((this.mSteam != null) &&
+ (this.mSteam.amount > getSteamCapacity()))
+ {
+ this.sendSound((byte)1);
+ this.mSteam.amount = getSteamCapacity() * 3 / 4;
+ }
+ /*if ((this.mProcessingEnergy <= 0) && (aBaseMetaTileEntity.isAllowedToWork()) &&
+ (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.bucket.get(IC2.getItemFromBlock(p_150898_0_)))))
+ {
+ this.mProcessingEnergy += 1000;
+ aBaseMetaTileEntity.decrStackSize(2, 1);
+ aBaseMetaTileEntity.addStackToSlot(3, GT_OreDictUnificator.get(OrePrefixes.bucket, Materials.Empty, 1L));
+ }*/
+ if ((this.mTemperature < 1000) && (this.mProcessingEnergy > 0) && ((aTick % this.RI) == 0L))
+ {
+ this.mProcessingEnergy -= 40;
+ this.mTemperature += 2;
+ }
+ aBaseMetaTileEntity.setActive(this.mProcessingEnergy > 0);
+ }
+ }
+
+ @Override
+ public final int fill(final FluidStack aFluid, final boolean doFill)
+ {
+ if ((Utils.isIC2Steam(aFluid)) && (this.mProcessingEnergy < 50))
+ {
+ final int tFilledAmount = Math.min(50, aFluid.amount);
+ if (doFill) {
+ this.mProcessingEnergy += tFilledAmount;
+ }
+ return tFilledAmount;
+ }
+ return super.fill(aFluid, doFill);
+ }
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaGarbageCollector.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaGarbageCollector.java
new file mode 100644
index 0000000000..88658c399d
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaGarbageCollector.java
@@ -0,0 +1,323 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic;
+
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.minecraft.PlayerUtils;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMetaTileEntity;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.world.World;
+
+public class GregtechMetaGarbageCollector extends GregtechMetaTileEntity {
+
+ long mLastCleanup = 0;
+ long mLocalTickVar = 0;
+ int mFrequency = 5;
+
+ public GregtechMetaGarbageCollector(final String aName, final String aNameRegional, final String aDescription) {
+ super(991, aName, aNameRegional, 5, 0, aDescription);
+ }
+
+ public GregtechMetaGarbageCollector(final String aName, final String aDescription, final ITexture[][][] aTextures) {
+ super(aName, 5, 0, aDescription, aTextures);
+ }
+
+ @Override
+ public String[] getDescription() {
+ return new String[] {this.mDescription,
+ "Can request the JVM to perform garbage collection",
+ "Configurable to run once every 5 minute interval (5-180)",
+ "This Machine has no recipe",
+ "Admin Tool, Limit one per world if possible",
+ CORE.GT_Tooltip};
+ }
+
+ @Override
+ public ITexture[][][] getTextureSet(final ITexture[] aTextures) {
+ final ITexture[][][] rTextures = new ITexture[10][17][];
+ for (byte i = -1; i < 16; i++) {
+ rTextures[0][i + 1] = this.getFront(i);
+ rTextures[1][i + 1] = this.getBack(i);
+ rTextures[2][i + 1] = this.getBottom(i);
+ rTextures[3][i + 1] = this.getTop(i);
+ rTextures[4][i + 1] = this.getSides(i);
+ rTextures[5][i + 1] = this.getFrontActive(i);
+ rTextures[6][i + 1] = this.getBackActive(i);
+ rTextures[7][i + 1] = this.getBottomActive(i);
+ rTextures[8][i + 1] = this.getTopActive(i);
+ rTextures[9][i + 1] = this.getSidesActive(i);
+ }
+ return rTextures;
+ }
+
+ @Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+ return this.mTextures[(aActive ? 5 : 0) + (aSide == aFacing ? 0 : aSide == GT_Utility.getOppositeSide(aFacing) ? 1 : aSide == 0 ? 2 : aSide == 1 ? 3 : 4)][aColorIndex + 1];
+ }
+
+
+ public ITexture[] getFront(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier+3][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Material_RedSteel)};
+ }
+
+
+ public ITexture[] getBack(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier+3][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Material_RedSteel)};
+ }
+
+
+ public ITexture[] getBottom(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier+3][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Material_Grisium)};
+ }
+
+
+ public ITexture[] getTop(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier+3][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Material_Grisium)};
+ }
+
+
+ public ITexture[] getSides(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier+3][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Redox_3)};
+ }
+
+
+ public ITexture[] getFrontActive(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier+3][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Material_RedSteel)};
+ }
+
+
+ public ITexture[] getBackActive(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier+3][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Material_RedSteel)};
+ }
+
+
+ public ITexture[] getBottomActive(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier+3][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Material_Grisium)};
+ }
+
+
+ public ITexture[] getTopActive(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier+3][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Material_Grisium)};
+ }
+
+
+ public ITexture[] getSidesActive(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier+3][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Redox_3)};
+ }
+
+ @Override
+ public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ if (mFrequency < 180){
+ mFrequency += 5;
+ }
+ else {
+ mFrequency = 5;
+ }
+ PlayerUtils.messagePlayer(aPlayer, "Running every "+mFrequency+" minutes.");
+ super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ);
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaGarbageCollector(this.mName, this.mDescription, this.mTextures);
+ }
+
+ @Override public boolean isSimpleMachine() {return true;}
+ @Override public boolean isElectric() {return false;}
+ @Override public boolean isValidSlot(final int aIndex) {return false;}
+ @Override public boolean isFacingValid(final byte aFacing) {return true;}
+ @Override public boolean isEnetInput() {return false;}
+ @Override public boolean isEnetOutput() {return false;}
+ @Override public boolean isInputFacing(final byte aSide) {return aSide!=this.getBaseMetaTileEntity().getFrontFacing();}
+ @Override public boolean isOutputFacing(final byte aSide) {return aSide==this.getBaseMetaTileEntity().getFrontFacing();}
+ @Override public boolean isTeleporterCompatible() {return false;}
+ @Override public long getMinimumStoredEU() {return 0;}
+ @Override public long maxEUStore() {return 0;}
+
+ @Override
+ public int getCapacity() {
+ return 0;
+ }
+
+ @Override
+ public long maxEUInput() {
+ return 0;
+ }
+
+ @Override
+ public long maxEUOutput() {
+ return 0;
+ }
+
+ @Override
+ public long maxAmperesIn() {
+ return 0;
+ }
+
+ @Override
+ public long maxAmperesOut() {
+ return 0;
+ }
+ @Override public int rechargerSlotStartIndex() {return 0;}
+ @Override public int dechargerSlotStartIndex() {return 0;}
+ @Override public int rechargerSlotCount() {return 0;}
+ @Override public int dechargerSlotCount() {return 0;}
+ @Override public int getProgresstime() {return (int)this.getBaseMetaTileEntity().getUniversalEnergyStored();}
+ @Override public int maxProgresstime() {return (int)this.getBaseMetaTileEntity().getUniversalEnergyCapacity();}
+ @Override public boolean isAccessAllowed(final EntityPlayer aPlayer) {return true;}
+
+ @Override
+ public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) {
+ if (aBaseMetaTileEntity.isClientSide())
+ {
+ return true;
+ }
+ this.showPollution(aPlayer.getEntityWorld(), aPlayer);
+ return true;
+ }
+
+ private void showPollution(final World worldIn, final EntityPlayer playerIn){
+ PlayerUtils.messagePlayer(playerIn, "Running every "+mFrequency+" minutes. Owner: "+this.getBaseMetaTileEntity().getOwnerName());
+ long aDiff = mLocalTickVar - this.mLastCleanup;
+ PlayerUtils.messagePlayer(playerIn, "Last run: "+Utils.getSecondsFromMillis(aDiff)+" seconds ago.");
+
+
+ }
+
+ @Override
+ public boolean allowPullStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) {
+ return false;
+ }
+
+
+ @Override
+ public String[] getInfoData() {
+ return new String[] {
+ this.getLocalName()
+ };
+ }
+
+ @Override
+ public boolean isGivingInformation() {
+ return true;
+ }
+
+ @Override
+ public int[] getAccessibleSlotsFromSide(final int p_94128_1_) {
+ return new int[] {};
+ }
+
+ @Override
+ public boolean canInsertItem(final int p_102007_1_, final ItemStack p_102007_2_, final int p_102007_3_) {
+ return false;
+ }
+
+ @Override
+ public boolean canExtractItem(final int p_102008_1_, final ItemStack p_102008_2_, final int p_102008_3_) {
+ return false;
+ }
+
+ @Override
+ public int getSizeInventory() {
+ return 0;
+ }
+
+ @Override
+ public ItemStack getStackInSlot(final int p_70301_1_) {
+ return null;
+ }
+
+ @Override
+ public ItemStack decrStackSize(final int p_70298_1_, final int p_70298_2_) {
+ return null;
+ }
+
+ @Override
+ public ItemStack getStackInSlotOnClosing(final int p_70304_1_) {
+ return null;
+ }
+
+ @Override
+ public void setInventorySlotContents(final int p_70299_1_, final ItemStack p_70299_2_) {
+ }
+
+ @Override
+ public String getInventoryName() {
+ return null;
+ }
+
+ @Override
+ public boolean hasCustomInventoryName() {
+ return false;
+ }
+
+ @Override
+ public int getInventoryStackLimit() {
+ return 0;
+ }
+
+ @Override
+ public boolean isUseableByPlayer(final EntityPlayer p_70300_1_) {
+ return true;
+ }
+
+ @Override
+ public void openInventory() {
+ }
+
+ @Override
+ public void closeInventory() {
+ }
+
+ @Override
+ public boolean isItemValidForSlot(final int p_94041_1_, final ItemStack p_94041_2_) {
+ return false;
+ }
+
+ @Override
+ public boolean isOverclockerUpgradable() {
+ return false;
+ }
+
+ @Override
+ public boolean isTransformerUpgradable() {
+ return false;
+ }
+
+ @Override
+ public void saveNBTData(final NBTTagCompound aNBT) {
+
+ }
+
+ @Override
+ public void loadNBTData(final NBTTagCompound aNBT) {
+
+ }
+
+ @Override
+ public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) {
+ super.onPostTick(aBaseMetaTileEntity, aTick);
+ if (this.getBaseMetaTileEntity().isServerSide()) {
+ mLocalTickVar = System.currentTimeMillis();
+ long aDiff = mLocalTickVar - this.mLastCleanup;
+ if (Utils.getSecondsFromMillis(aDiff) >= (this.mFrequency * 60)) {
+ CORE.gc();
+ this.mLastCleanup = mLocalTickVar;
+ }
+ }
+ }
+
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaPollutionCreator.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaPollutionCreator.java
new file mode 100644
index 0000000000..5f55e080ad
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaPollutionCreator.java
@@ -0,0 +1,386 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.world.World;
+
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Utility;
+
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.minecraft.PlayerUtils;
+import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMetaTileEntity;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+
+public class GregtechMetaPollutionCreator extends GregtechMetaTileEntity {
+
+ int mCurrentPollution;
+ int mAveragePollution;
+ int mAveragePollutionArray[] = new int[10];
+ private int mArrayPos = 0;
+ private int mTickTimer = 0;
+ private int mSecondTimer = 0;
+
+ public GregtechMetaPollutionCreator(final int aID, final String aName, final String aNameRegional, final int aTier, final String aDescription, final int aSlotCount) {
+ super(aID, aName, aNameRegional, aTier, aSlotCount, aDescription);
+ }
+
+ public GregtechMetaPollutionCreator(final String aName, final int aTier, final String aDescription, final ITexture[][][] aTextures, final int aSlotCount) {
+ super(aName, aTier, aSlotCount, aDescription, aTextures);
+ }
+
+ @Override
+ public String[] getDescription() {
+ return new String[] {this.mDescription, "A useful debug machine to create pollution.", CORE.GT_Tooltip};
+ }
+
+ @Override
+ public ITexture[][][] getTextureSet(final ITexture[] aTextures) {
+ final ITexture[][][] rTextures = new ITexture[10][17][];
+ for (byte i = -1; i < 16; i++) {
+ rTextures[0][i + 1] = this.getFront(i);
+ rTextures[1][i + 1] = this.getBack(i);
+ rTextures[2][i + 1] = this.getBottom(i);
+ rTextures[3][i + 1] = this.getTop(i);
+ rTextures[4][i + 1] = this.getSides(i);
+ rTextures[5][i + 1] = this.getFrontActive(i);
+ rTextures[6][i + 1] = this.getBackActive(i);
+ rTextures[7][i + 1] = this.getBottomActive(i);
+ rTextures[8][i + 1] = this.getTopActive(i);
+ rTextures[9][i + 1] = this.getSidesActive(i);
+ }
+ return rTextures;
+ }
+
+ @Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+ return this.mTextures[(aActive ? 5 : 0) + (aSide == aFacing ? 0 : aSide == GT_Utility.getOppositeSide(aFacing) ? 1 : aSide == 0 ? 2 : aSide == 1 ? 3 : 4)][aColorIndex + 1];
+ }
+
+
+ public ITexture[] getFront(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier+3][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Screen_2)};
+ }
+
+
+ public ITexture[] getBack(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier+3][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom)};
+ }
+
+
+ public ITexture[] getBottom(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier+3][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom)};
+ }
+
+
+ public ITexture[] getTop(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier+3][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom)};
+ }
+
+
+ public ITexture[] getSides(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier+3][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom)};
+ }
+
+
+ public ITexture[] getFrontActive(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier+3][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Screen_2)};
+ }
+
+
+ public ITexture[] getBackActive(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier+3][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom)};
+ }
+
+
+ public ITexture[] getBottomActive(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier+3][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom)};
+ }
+
+
+ public ITexture[] getTopActive(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier+3][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom)};
+ }
+
+
+ public ITexture[] getSidesActive(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier+3][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom)};
+ }
+
+ @Override
+ public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ if (pollutionMultiplier > 99){
+ pollutionMultiplier = 1;
+ }
+ else {
+ pollutionMultiplier++;
+ }
+ PlayerUtils.messagePlayer(aPlayer, "Pollution Mutliplier is now "+pollutionMultiplier+".");
+ super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ);
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaPollutionCreator(this.mName, this.mTier, this.mDescription, this.mTextures, this.mInventory.length);
+ }
+
+ @Override public boolean isSimpleMachine() {return false;}
+ @Override public boolean isElectric() {return true;}
+ @Override public boolean isValidSlot(final int aIndex) {return true;}
+ @Override public boolean isFacingValid(final byte aFacing) {return true;}
+ @Override public boolean isEnetInput() {return true;}
+ @Override public boolean isEnetOutput() {return false;}
+ @Override public boolean isInputFacing(final byte aSide) {return aSide!=this.getBaseMetaTileEntity().getFrontFacing();}
+ @Override public boolean isOutputFacing(final byte aSide) {return aSide==this.getBaseMetaTileEntity().getFrontFacing();}
+ @Override public boolean isTeleporterCompatible() {return false;}
+ @Override public long getMinimumStoredEU() {return 0;}
+ @Override public long maxEUStore() {return 0;}
+
+ @Override
+ public int getCapacity() {
+ return 0;
+ }
+
+ @Override
+ public long maxEUInput() {
+ return 0;
+ }
+
+ @Override
+ public long maxEUOutput() {
+ return 0;
+ }
+
+ @Override
+ public long maxAmperesIn() {
+ return 0;
+ }
+
+ @Override
+ public long maxAmperesOut() {
+ return 0;
+ }
+ @Override public int rechargerSlotStartIndex() {return 0;}
+ @Override public int dechargerSlotStartIndex() {return 0;}
+ @Override public int rechargerSlotCount() {return 0;}
+ @Override public int dechargerSlotCount() {return 0;}
+ @Override public int getProgresstime() {return (int)this.getBaseMetaTileEntity().getUniversalEnergyStored();}
+ @Override public int maxProgresstime() {return (int)this.getBaseMetaTileEntity().getUniversalEnergyCapacity();}
+ @Override public boolean isAccessAllowed(final EntityPlayer aPlayer) {return true;}
+
+ @Override
+ public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) {
+ if (aBaseMetaTileEntity.isClientSide())
+ {
+ return true;
+ }
+ this.showPollution(aPlayer.getEntityWorld(), aPlayer);
+ return true;
+ }
+
+ public int pollutionMultiplier = 1;
+
+ private void showPollution(final World worldIn, final EntityPlayer playerIn){
+ if(!PollutionUtils.mPollution()){
+ PlayerUtils.messagePlayer(playerIn, "This block is useless, Pollution is disabled.");
+ }
+ else {
+ addPollution();
+ PlayerUtils.messagePlayer(playerIn, "This chunk now contains "+getCurrentChunkPollution()+" pollution.");
+ //PlayerUtils.messagePlayer(playerIn, "Average over last ten minutes: "+getAveragePollutionOverLastTen()+" pollution.");
+ }
+ }
+
+ private boolean addPollution(){
+ PollutionUtils.addPollution(getBaseMetaTileEntity(), 100000*pollutionMultiplier);
+ return true;
+ }
+
+ @Override
+ public boolean allowPullStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) {
+ return false;
+ }
+
+ public int getCurrentChunkPollution(){
+ return getCurrentChunkPollution(this.getBaseMetaTileEntity());
+ }
+
+ public int getCurrentChunkPollution(IGregTechTileEntity aBaseMetaTileEntity){
+ return PollutionUtils.getPollution(aBaseMetaTileEntity);
+ }
+
+
+ @Override
+ public String[] getInfoData() {
+ return new String[] {
+ this.getLocalName(),
+ "Current Pollution: "+this.mCurrentPollution,
+ "Average/10 minutes:"+getAveragePollutionOverLastTen()};
+ }
+
+ @Override
+ public boolean isGivingInformation() {
+ return true;
+ }
+
+ @Override
+ public int[] getAccessibleSlotsFromSide(final int p_94128_1_) {
+ return new int[] {};
+ }
+
+ @Override
+ public boolean canInsertItem(final int p_102007_1_, final ItemStack p_102007_2_, final int p_102007_3_) {
+ return false;
+ }
+
+ @Override
+ public boolean canExtractItem(final int p_102008_1_, final ItemStack p_102008_2_, final int p_102008_3_) {
+ return false;
+ }
+
+ @Override
+ public int getSizeInventory() {
+ return 0;
+ }
+
+ @Override
+ public ItemStack getStackInSlot(final int p_70301_1_) {
+ return null;
+ }
+
+ @Override
+ public ItemStack decrStackSize(final int p_70298_1_, final int p_70298_2_) {
+ return null;
+ }
+
+ @Override
+ public ItemStack getStackInSlotOnClosing(final int p_70304_1_) {
+ return null;
+ }
+
+ @Override
+ public void setInventorySlotContents(final int p_70299_1_, final ItemStack p_70299_2_) {
+ }
+
+ @Override
+ public String getInventoryName() {
+ return null;
+ }
+
+ @Override
+ public boolean hasCustomInventoryName() {
+ return false;
+ }
+
+ @Override
+ public int getInventoryStackLimit() {
+ return 0;
+ }
+
+ @Override
+ public boolean isUseableByPlayer(final EntityPlayer p_70300_1_) {
+ return false;
+ }
+
+ @Override
+ public void openInventory() {
+ }
+
+ @Override
+ public void closeInventory() {
+ }
+
+ @Override
+ public boolean isItemValidForSlot(final int p_94041_1_, final ItemStack p_94041_2_) {
+ return false;
+ }
+
+ @Override
+ public boolean isOverclockerUpgradable() {
+ return false;
+ }
+
+ @Override
+ public boolean isTransformerUpgradable() {
+ return false;
+ }
+
+ //int mCurrentPollution;
+ //int mAveragePollution;
+ //int mAveragePollutionArray[] = new int[10];
+
+ @Override
+ public void saveNBTData(final NBTTagCompound aNBT) {
+ aNBT.setInteger("mCurrentPollution", this.mCurrentPollution);
+ aNBT.setInteger("mAveragePollution", this.mAveragePollution);
+ }
+
+ @Override
+ public void loadNBTData(final NBTTagCompound aNBT) {
+ this.mCurrentPollution = aNBT.getInteger("mCurrentPollution");
+ this.mAveragePollution = aNBT.getInteger("mAveragePollution");
+ }
+
+ @Override
+ public void onFirstTick(final IGregTechTileEntity aBaseMetaTileEntity) {
+ if (this.getBaseMetaTileEntity().isServerSide()) {
+ if (this.mCurrentPollution == 0) {
+ this.mCurrentPollution = getCurrentChunkPollution();
+ }
+ if (this.mArrayPos < 0 || this.mArrayPos > 9) {
+ this.mArrayPos = 0;
+ }
+ this.mTickTimer = 0;
+ }
+ }
+
+
+
+ @Override
+ public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) {
+ super.onPostTick(aBaseMetaTileEntity, aTick);
+ if (this.getBaseMetaTileEntity().isServerSide()) {
+ //TickTimer - 20 times a second
+ this.mTickTimer++;
+ if (mTickTimer % 20 == 0){
+ this.mCurrentPollution = getCurrentChunkPollution();
+ }
+ }
+ }
+
+ public int getAveragePollutionOverLastTen(){
+ int counter = 0;
+ int total = 0;
+
+ for (int i=0;i<this.mAveragePollutionArray.length;i++){
+ if (this.mAveragePollutionArray[i] != 0){
+ total += this.mAveragePollutionArray[i];
+ counter++;
+ }
+ }
+ int returnValue = 0;
+ if (total > 0 && counter > 0){
+ returnValue = (total/counter);
+ this.mAveragePollution = returnValue;
+ }
+ else {
+ returnValue = getCurrentChunkPollution();
+ }
+ //Logger.INFO("| DEBUG: "+returnValue +" | ArrayPos:"+this.mArrayPos+" | Counter:"+counter+" | Total:"+total+" |");
+ return returnValue;
+ }
+
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaPollutionDetector.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaPollutionDetector.java
new file mode 100644
index 0000000000..10319f2269
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaPollutionDetector.java
@@ -0,0 +1,439 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.world.World;
+
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Utility;
+
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.math.MathUtils;
+import gtPlusPlus.core.util.minecraft.PlayerUtils;
+import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMetaTileEntity;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+
+public class GregtechMetaPollutionDetector extends GregtechMetaTileEntity {
+
+ int mCurrentPollution;
+ int mAveragePollution;
+ int mAveragePollutionArray[] = new int[10];
+ private int mArrayPos = 0;
+ private int mTickTimer = 0;
+ private int mSecondTimer = 0;
+ private long mRedstoneLevel = 0;
+
+ public GregtechMetaPollutionDetector(final int aID, final String aName, final String aNameRegional, final int aTier, final String aDescription, final int aSlotCount) {
+ super(aID, aName, aNameRegional, aTier, aSlotCount, aDescription);
+ }
+
+ public GregtechMetaPollutionDetector(final String aName, final int aTier, final String aDescription, final ITexture[][][] aTextures, final int aSlotCount) {
+ super(aName, aTier, aSlotCount, aDescription, aTextures);
+ }
+
+ @Override
+ public String[] getDescription() {
+ return new String[] {this.mDescription, "Right click to check pollution levels.",
+ "Configure with screwdriver to set redstone output amount.",
+ "Does not use power.",
+ CORE.GT_Tooltip};
+ }
+
+ @Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing,
+ final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+ return aSide == aFacing
+ ? new ITexture[] { new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Dimensional),
+ new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Screen_Frequency) }
+ : new ITexture[] { new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Dimensional),
+ new GT_RenderedTexture(Textures.BlockIcons.VOID) };
+ }
+
+ @Override
+ public ITexture[][][] getTextureSet(final ITexture[] aTextures) {
+ final ITexture[][][] rTextures = new ITexture[10][17][];
+ for (byte i = -1; i < 16; i++) {
+ rTextures[0][i + 1] = this.getFront(i);
+ rTextures[1][i + 1] = this.getBack(i);
+ rTextures[2][i + 1] = this.getBottom(i);
+ rTextures[3][i + 1] = this.getTop(i);
+ rTextures[4][i + 1] = this.getSides(i);
+ rTextures[5][i + 1] = this.getFrontActive(i);
+ rTextures[6][i + 1] = this.getBackActive(i);
+ rTextures[7][i + 1] = this.getBottomActive(i);
+ rTextures[8][i + 1] = this.getTopActive(i);
+ rTextures[9][i + 1] = this.getSidesActive(i);
+ }
+ return rTextures;
+ }
+
+ /*@Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+ return this.mTextures[(aActive ? 5 : 0) + (aSide == aFacing ? 0 : aSide == GT_Utility.getOppositeSide(aFacing) ? 1 : aSide == 0 ? 2 : aSide == 1 ? 3 : 4)][aColorIndex + 1];
+ }*/
+
+
+ public ITexture[] getFront(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Screen_2)};
+ }
+
+
+ public ITexture[] getBack(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom)};
+ }
+
+
+ public ITexture[] getBottom(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom)};
+ }
+
+
+ public ITexture[] getTop(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom)};
+ }
+
+
+ public ITexture[] getSides(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom)};
+ }
+
+
+ public ITexture[] getFrontActive(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Screen_2)};
+ }
+
+
+ public ITexture[] getBackActive(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom)};
+ }
+
+
+ public ITexture[] getBottomActive(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom)};
+ }
+
+
+ public ITexture[] getTopActive(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom)};
+ }
+
+
+ public ITexture[] getSidesActive(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom)};
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaPollutionDetector(this.mName, this.mTier, this.mDescription, this.mTextures, this.mInventory.length);
+ }
+
+ @Override public boolean isSimpleMachine() {return false;}
+ @Override public boolean isElectric() {return true;}
+ @Override public boolean isValidSlot(final int aIndex) {return true;}
+ @Override public boolean isFacingValid(final byte aFacing) {return true;}
+ @Override public boolean isEnetInput() {return true;}
+ @Override public boolean isEnetOutput() {return false;}
+ @Override public boolean isInputFacing(final byte aSide) {return aSide!=this.getBaseMetaTileEntity().getFrontFacing();}
+ @Override public boolean isOutputFacing(final byte aSide) {return aSide==this.getBaseMetaTileEntity().getFrontFacing();}
+ @Override public boolean isTeleporterCompatible() {return false;}
+ @Override public long getMinimumStoredEU() {return 0;}
+ @Override public long maxEUStore() {return 0;}
+
+ @Override
+ public int getCapacity() {
+ return 0;
+ }
+
+ @Override
+ public long maxEUInput() {
+ return 0;
+ }
+
+ @Override
+ public long maxEUOutput() {
+ return 0;
+ }
+
+ @Override
+ public long maxAmperesIn() {
+ return 0;
+ }
+
+ @Override
+ public long maxAmperesOut() {
+ return 0;
+ }
+ @Override public int rechargerSlotStartIndex() {return 0;}
+ @Override public int dechargerSlotStartIndex() {return 0;}
+ @Override public int rechargerSlotCount() {return 0;}
+ @Override public int dechargerSlotCount() {return 0;}
+ @Override public int getProgresstime() {return (int)this.getBaseMetaTileEntity().getUniversalEnergyStored();}
+ @Override public int maxProgresstime() {return (int)this.getBaseMetaTileEntity().getUniversalEnergyCapacity();}
+ @Override public boolean isAccessAllowed(final EntityPlayer aPlayer) {return true;}
+
+ @Override
+ public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) {
+ if (aBaseMetaTileEntity.isClientSide())
+ {
+ return true;
+ }
+ this.showPollution(aPlayer.getEntityWorld(), aPlayer);
+ return true;
+ }
+
+ private void showPollution(final World worldIn, final EntityPlayer playerIn){
+ if(!PollutionUtils.mPollution()){
+ PlayerUtils.messagePlayer(playerIn, "This block is useless, Pollution is disabled.");
+ }
+ else {
+ PlayerUtils.messagePlayer(playerIn, "This chunk contains "+getCurrentChunkPollution()+" pollution.");
+ PlayerUtils.messagePlayer(playerIn, "Emit Redstone at pollution level: "+this.mRedstoneLevel);
+ }
+ }
+
+ @Override
+ public boolean allowPullStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) {
+ return false;
+ }
+
+ public int getCurrentChunkPollution(){
+ return getCurrentChunkPollution(this.getBaseMetaTileEntity());
+ }
+
+ public int getCurrentChunkPollution(IGregTechTileEntity aBaseMetaTileEntity){
+ return PollutionUtils.getPollution(aBaseMetaTileEntity);
+ }
+
+
+ @Override
+ public String[] getInfoData() {
+ return new String[] {
+ this.getLocalName(),
+ "Current Pollution: "+this.mCurrentPollution,
+ "Average/10 Sec: "+this.mAveragePollution,
+ "Emit Redstone at pollution level: "+this.mRedstoneLevel};
+ }
+
+ @Override
+ public boolean isGivingInformation() {
+ return true;
+ }
+
+ @Override
+ public int[] getAccessibleSlotsFromSide(final int p_94128_1_) {
+ return new int[] {};
+ }
+
+ @Override
+ public boolean canInsertItem(final int p_102007_1_, final ItemStack p_102007_2_, final int p_102007_3_) {
+ return false;
+ }
+
+ @Override
+ public boolean canExtractItem(final int p_102008_1_, final ItemStack p_102008_2_, final int p_102008_3_) {
+ return false;
+ }
+
+ @Override
+ public int getSizeInventory() {
+ return 0;
+ }
+
+ @Override
+ public ItemStack getStackInSlot(final int p_70301_1_) {
+ return null;
+ }
+
+ @Override
+ public ItemStack decrStackSize(final int p_70298_1_, final int p_70298_2_) {
+ return null;
+ }
+
+ @Override
+ public ItemStack getStackInSlotOnClosing(final int p_70304_1_) {
+ return null;
+ }
+
+ @Override
+ public void setInventorySlotContents(final int p_70299_1_, final ItemStack p_70299_2_) {
+ }
+
+ @Override
+ public String getInventoryName() {
+ return null;
+ }
+
+ @Override
+ public boolean hasCustomInventoryName() {
+ return false;
+ }
+
+ @Override
+ public int getInventoryStackLimit() {
+ return 0;
+ }
+
+ @Override
+ public boolean isUseableByPlayer(final EntityPlayer p_70300_1_) {
+ return false;
+ }
+
+ @Override
+ public void openInventory() {
+ }
+
+ @Override
+ public void closeInventory() {
+ }
+
+ @Override
+ public boolean isItemValidForSlot(final int p_94041_1_, final ItemStack p_94041_2_) {
+ return false;
+ }
+
+ @Override
+ public boolean isOverclockerUpgradable() {
+ return false;
+ }
+
+ @Override
+ public boolean isTransformerUpgradable() {
+ return false;
+ }
+
+ //int mCurrentPollution;
+ //int mAveragePollution;
+ //int mAveragePollutionArray[] = new int[10];
+
+ @Override
+ public void saveNBTData(final NBTTagCompound aNBT) {
+ aNBT.setInteger("mCurrentPollution", this.mCurrentPollution);
+ aNBT.setInteger("mAveragePollution", this.mAveragePollution);
+ aNBT.setLong("mRedstoneLevel", this.mRedstoneLevel);
+ }
+
+ @Override
+ public void loadNBTData(final NBTTagCompound aNBT) {
+ this.mCurrentPollution = aNBT.getInteger("mCurrentPollution");
+ this.mAveragePollution = aNBT.getInteger("mAveragePollution");
+ this.mRedstoneLevel = aNBT.getLong("mRedstoneLevel");
+ }
+
+ @Override
+ public void onFirstTick(final IGregTechTileEntity aBaseMetaTileEntity) {
+ super.onFirstTick(aBaseMetaTileEntity);
+ }
+
+ public boolean allowCoverOnSide(final byte aSide, final int aCoverID) {
+ return aSide != this.getBaseMetaTileEntity().getFrontFacing();
+ }
+
+ @Override
+ public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) {
+ super.onPostTick(aBaseMetaTileEntity, aTick);
+
+ //Only Calc server-side
+ if (!this.getBaseMetaTileEntity().isServerSide()) {
+ return;
+ }
+ //Emit Redstone
+ if (this.getCurrentChunkPollution() >= this.mRedstoneLevel){
+ for (int i=0;i<6;i++){
+ this.getBaseMetaTileEntity().setStrongOutputRedstoneSignal((byte) i, (byte) 16);
+ }
+ this.markDirty();
+ }
+ else {
+ for (int i=0;i<6;i++){
+ this.getBaseMetaTileEntity().setStrongOutputRedstoneSignal((byte) i, (byte) 0);
+ }
+ this.markDirty();
+ }
+
+ //Do Math for stats
+ if (this.mTickTimer % 20 == 0) {
+ mCurrentPollution = this.getCurrentChunkPollution();
+ if (mArrayPos > mAveragePollutionArray.length-1) {
+ mArrayPos = 0;
+ }
+ mAveragePollutionArray[mArrayPos] = mCurrentPollution;
+ mAveragePollution = getAveragePollutionOverLastTen();
+ mArrayPos++;
+ }
+ this.mTickTimer++;
+
+ }
+
+ public int getAveragePollutionOverLastTen(){
+ return MathUtils.getIntAverage(mAveragePollutionArray);
+
+ }
+
+ @Override
+ public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer,
+ float aX, float aY, float aZ) {
+
+ if (aSide == this.getBaseMetaTileEntity().getFrontFacing()) {
+ final float[] tCoords = GT_Utility.getClickedFacingCoords(aSide, aX, aY, aZ);
+ switch ((byte) ((byte) (int) (tCoords[0] * 2.0F) + (2 * (byte) (int) (tCoords[1] * 2.0F)))) {
+ case 0:
+ this.mRedstoneLevel -= 5000;
+ break;
+ case 1:
+ this.mRedstoneLevel += 5000;
+ break;
+ case 2:
+ this.mRedstoneLevel -= 50000;
+ break;
+ case 3:
+ this.mRedstoneLevel += 50000;
+ }
+ this.markDirty();
+ GT_Utility.sendChatToPlayer(aPlayer, "Emit Redstone at Pollution Level: " + this.mRedstoneLevel);
+ }
+
+ super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ);
+ }
+
+ public boolean allowGeneralRedstoneOutput() {
+ if (this.getCurrentChunkPollution() >= this.mRedstoneLevel){
+ this.markDirty();
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity,
+ EntityPlayer aPlayer, byte aSide, float aX, float aY, float aZ) {
+ return super.onRightclick(aBaseMetaTileEntity, aPlayer, aSide, aX, aY, aZ);
+ }
+
+ @Override
+ public void onMachineBlockUpdate() {
+ super.onMachineBlockUpdate();
+ }
+
+ @Override
+ public boolean hasSidedRedstoneOutputBehavior() {
+ if (this.getCurrentChunkPollution() >= this.mRedstoneLevel){
+ this.markDirty();
+ return true;
+ }
+ return false;
+ }
+
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntityChunkLoader.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntityChunkLoader.java
new file mode 100644
index 0000000000..140f1d9cd5
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntityChunkLoader.java
@@ -0,0 +1,394 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic;
+
+import static gregtech.api.enums.GT_Values.V;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.api.interfaces.IChunkLoader;
+import gtPlusPlus.core.chunkloading.GTPP_ChunkManager;
+import gtPlusPlus.core.chunkloading.StaticChunkFunctions;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+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.ChunkCoordIntPair;
+import net.minecraft.world.World;
+import net.minecraft.world.chunk.Chunk;
+
+public class GregtechMetaTileEntityChunkLoader extends GT_MetaTileEntity_BasicMachine implements IChunkLoader {
+
+ public GregtechMetaTileEntityChunkLoader(int aID, String aName, String aNameRegional, int aTier) {
+ super(aID, aName, aNameRegional, aTier, 2, "Loads " + getMaxChunksToLoadForTier(aTier) + " chunks when powered", 0, 0, "Recycler.png", "", new ITexture[]{});
+ }
+
+ public GregtechMetaTileEntityChunkLoader(String aName, int aTier, String aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) {
+ super(aName, aTier, 2, aDescription, aTextures, 0, 0, aGUIName, aNEIName);
+ }
+
+ public static int getMaxChunksToLoadForTier(int aTier) {
+ if (aTier < 4) {
+ return 3 * 3;
+ }
+ if (aTier < 6) {
+ return 7 * 7;
+ }
+ if (aTier < 8) {
+ return 15 * 15;
+ }
+ else {
+ return 0;
+ }
+ }
+
+ @Override
+ public String[] getDescription() {
+ return new String[] {
+ "Loads " + getMaxChunksToLoadForTier(this.mTier) + " chunks when powered",
+ "Consumes 2A",
+ "Behaves Identically to a Railcraft World Anchor",
+ CORE.GT_Tooltip
+ };
+ }
+
+ @Override
+ public ITexture[][][] getTextureSet(final ITexture[] aTextures) {
+ final ITexture[][][] rTextures = new ITexture[10][17][];
+ for (byte i = -1; i < 16; i++) {
+ rTextures[0][i + 1] = this.getFront(i);
+ rTextures[1][i + 1] = this.getBack(i);
+ rTextures[2][i + 1] = this.getBottom(i);
+ rTextures[3][i + 1] = this.getTop(i);
+ rTextures[4][i + 1] = this.getSides(i);
+ rTextures[5][i + 1] = this.getFrontActive(i);
+ rTextures[6][i + 1] = this.getBackActive(i);
+ rTextures[7][i + 1] = this.getBottomActive(i);
+ rTextures[8][i + 1] = this.getTopActive(i);
+ rTextures[9][i + 1] = this.getSidesActive(i);
+ }
+ return rTextures;
+ }
+
+ @Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+ return this.mTextures[(aActive ? 5 : 0) + (aSide == aFacing ? 0 : aSide == GT_Utility.getOppositeSide(aFacing) ? 1 : aSide == 0 ? 2 : aSide == 1 ? 3 : 4)][aColorIndex + 1];
+ }
+
+
+ public ITexture[] getFront(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Material_MaragingSteel), new GT_RenderedTexture(TexturesGtBlock.TIERED_MACHINE_HULLS[mTier])};
+ }
+
+
+ public ITexture[] getBack(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Material_MaragingSteel), new GT_RenderedTexture(TexturesGtBlock.TIERED_MACHINE_HULLS[mTier])};
+ }
+
+
+ public ITexture[] getBottom(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Material_MaragingSteel), new GT_RenderedTexture(TexturesGtBlock.TIERED_MACHINE_HULLS[mTier])};
+ }
+
+
+ public ITexture[] getTop(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Material_MaragingSteel), new GT_RenderedTexture(TexturesGtBlock.TIERED_MACHINE_HULLS[mTier])};
+ }
+
+
+ public ITexture[] getSides(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Material_MaragingSteel), new GT_RenderedTexture(TexturesGtBlock.TIERED_MACHINE_HULLS[mTier])};
+ }
+
+
+ public ITexture[] getFrontActive(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Material_MaragingSteel), new GT_RenderedTexture(TexturesGtBlock.TIERED_MACHINE_HULLS[mTier+1])};
+ }
+
+
+ public ITexture[] getBackActive(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Material_MaragingSteel), new GT_RenderedTexture(TexturesGtBlock.TIERED_MACHINE_HULLS[mTier+1])};
+ }
+
+
+ public ITexture[] getBottomActive(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Material_MaragingSteel), new GT_RenderedTexture(TexturesGtBlock.TIERED_MACHINE_HULLS[mTier+1])};
+ }
+
+
+ public ITexture[] getTopActive(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Material_MaragingSteel), new GT_RenderedTexture(TexturesGtBlock.TIERED_MACHINE_HULLS[mTier+1])};
+ }
+
+
+ public ITexture[] getSidesActive(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Material_MaragingSteel), new GT_RenderedTexture(TexturesGtBlock.TIERED_MACHINE_HULLS[mTier+1])};
+ }
+
+ @Override
+ public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ);
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaTileEntityChunkLoader(this.mName, this.mTier, this.mDescription, this.mTextures, this.mGUIName, this.mNEIName);
+ }
+
+ @Override
+ public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) {
+ if (aBaseMetaTileEntity.isClientSide()){
+ return true;
+ }
+ this.showPollution(aPlayer.getEntityWorld(), aPlayer);
+ return true;
+ }
+
+ private void showPollution(final World worldIn, final EntityPlayer playerIn){
+ //PlayerUtils.messagePlayer(playerIn, "Running every "+mFrequency+" minutes. Owner: "+this.getBaseMetaTileEntity().getOwnerName());
+ //PlayerUtils.messagePlayer(playerIn, "Last run: "+Utils.getSecondsFromMillis(aDiff)+" seconds ago.");
+ }
+
+ @Override
+ public boolean allowPullStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) {
+ return false;
+ }
+
+
+ @Override
+ public String[] getInfoData() {
+ return super.getInfoData();
+ }
+
+ @Override
+ public boolean isGivingInformation() {
+ return true;
+ }
+
+ @Override
+ public boolean canInsertItem(final int p_102007_1_, final ItemStack p_102007_2_, final int p_102007_3_) {
+ return false;
+ }
+
+ @Override
+ public boolean canExtractItem(final int p_102008_1_, final ItemStack p_102008_2_, final int p_102008_3_) {
+ return false;
+ }
+
+ @Override
+ public int getSizeInventory() {
+ return 0;
+ }
+
+ @Override
+ public boolean isUseableByPlayer(final EntityPlayer p_70300_1_) {
+ return true;
+ }
+
+ @Override
+ public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) {
+ super.onPostTick(aBaseMetaTileEntity, aTick);
+
+ // Have we set the Chunk this Tile resides in yet?
+ if (mCurrentChunk == null) {
+ int xTile = getBaseMetaTileEntity().getXCoord();
+ int zTile = getBaseMetaTileEntity().getZCoord();
+ createInitialWorkingChunk(aBaseMetaTileEntity, xTile, zTile);
+ }
+
+ // Try unload all chunks if fail to meet global chunkloading conditions.
+ if (StaticChunkFunctions.onPostTick(aBaseMetaTileEntity, aTick)) {
+ // Can this tile actively chunkload?
+ if (getChunkLoadingActive()) {
+ // Consume some power
+ this.setEUVar(this.getEUVar() - (maxEUInput() * maxAmperesIn()));
+
+ // Do we need to re-request tickets?
+ if (getDoesWorkChunkNeedReload()) {
+ // Request ticket for current chunk.
+ GTPP_ChunkManager.requestChunkLoad((TileEntity)getBaseMetaTileEntity(), mCurrentChunk);
+ // Request a ticket for each chunk we have mapped out in a spiral pattern.
+ if (!mLoadedChunks.isEmpty()) {
+ for (ChunkCoordIntPair Y : mLoadedChunks) {
+ GTPP_ChunkManager.requestChunkLoad((TileEntity)getBaseMetaTileEntity(), Y);
+ }
+ }
+ setDoesWorkChunkNeedReload(false);
+ }
+
+ }
+ }
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ super.saveNBTData(aNBT);
+ StaticChunkFunctions.saveNBTDataForTileEntity(this.getBaseMetaTileEntity(), aNBT);
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ super.loadNBTData(aNBT);
+ StaticChunkFunctions.loadNBTDataForTileEntity(this.getBaseMetaTileEntity(), aNBT);
+ }
+
+ @Override
+ public long maxAmperesIn() {
+ return 2;
+ }
+
+ @Override
+ public long getMinimumStoredEU() {
+ return V[mTier] * 2;
+ }
+
+ @Override
+ public long maxEUStore() {
+ return V[mTier] * 256;
+ }
+
+ @Override
+ public long maxEUInput() {
+ return V[mTier];
+ }
+
+
+ /*
+ * Chunkloading Vars
+ */
+
+ private long mTicksRemainingForChunkloading = -1;
+ private ChunkCoordIntPair mCurrentChunk;
+ private Set<ChunkCoordIntPair> mLoadedChunks = new HashSet<ChunkCoordIntPair>();
+ private boolean mRefreshChunkTickets = false;
+
+ @Override
+ public long getTicksRemaining() {
+ return -1;
+ }
+
+ @Override
+ public void setTicksRemaining(long aTicks) {
+ mTicksRemainingForChunkloading = aTicks;
+ }
+
+ @Override
+ public ChunkCoordIntPair getResidingChunk() {
+ return mCurrentChunk;
+ }
+
+ @Override
+ public void setResidingChunk(ChunkCoordIntPair aCurrentChunk) {
+ mCurrentChunk = aCurrentChunk;
+ }
+
+ @Override
+ public boolean getChunkLoadingActive() {
+ return this.getEUVar() >= maxEUInput() * maxAmperesIn();
+ }
+
+ @Override
+ public void setChunkLoadingActive(boolean aActive) {
+
+ }
+
+ @Override
+ public boolean getDoesWorkChunkNeedReload() {
+ return mRefreshChunkTickets;
+ }
+
+ @Override
+ public void setDoesWorkChunkNeedReload(boolean aActive) {
+ mRefreshChunkTickets = aActive;
+ }
+
+ @Override
+ public boolean addChunkToLoadedList(ChunkCoordIntPair aActiveChunk) {
+ return mLoadedChunks.add(aActiveChunk);
+ }
+
+ @Override
+ public boolean removeChunkFromLoadedList(ChunkCoordIntPair aActiveChunk) {
+ return mLoadedChunks.remove(aActiveChunk);
+ }
+
+ @Override
+ public Set<ChunkCoordIntPair> getManagedChunks() {
+ return mLoadedChunks;
+ }
+
+ @Override
+ public void onRemoval() {
+ StaticChunkFunctions.onRemoval(getBaseMetaTileEntity());
+ super.onRemoval();
+ }
+
+ public static Set<ChunkCoordIntPair> spiralChunks(final IGregTechTileEntity aBaseMetaTileEntity, int X, int Z) {
+ World w = aBaseMetaTileEntity.getWorld();
+ HashSet<ChunkCoordIntPair> aSet = new HashSet<ChunkCoordIntPair>();
+ if (w == null) {
+ return aSet;
+ }
+ Chunk thisChunk = w.getChunkFromBlockCoords(aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getZCoord());
+ ChunkCoordIntPair aChunkCo = new ChunkCoordIntPair(thisChunk.xPosition, thisChunk.zPosition);
+ int x,z,dx,dz;
+ x = z = dx =0;
+ dz = -1;
+ int t = Math.max(X,Z);
+ int maxI = t*t;
+ for(int i =0; i < maxI; i++){
+ if ((-X/2 <= x) && (x <= X/2) && (-Z/2 <= z) && (z <= Z/2)){
+ Chunk C = w.getChunkFromChunkCoords(aChunkCo.chunkXPos + x, aChunkCo.chunkZPos + z);
+ if (C != null) {
+ aSet.add(new ChunkCoordIntPair(C.xPosition, C.zPosition));
+ }
+ }
+ if( (x == z) || ((x < 0) && (x == -z)) || ((x > 0) && (x == 1-z))){
+ t = dx;
+ dx = -dz;
+ dz = t;
+ }
+ x += dx;
+ z += dz;
+ }
+ return aSet;
+ }
+
+ @Override
+ public int getChunkloaderTier() {
+ return mTier;
+ }
+
+ public void createInitialWorkingChunk(IGregTechTileEntity aBaseMetaTileEntity, int aTileX, int aTileZ) {
+ final int centerX = aTileX >> 4;
+ final int centerZ = aTileZ >> 4;
+ addChunkToLoadedList(new ChunkCoordIntPair(centerX, centerZ));
+ GTPP_ChunkManager.requestChunkLoad((TileEntity)aBaseMetaTileEntity.getMetaTileEntity(), getResidingChunk());
+ // If this surrounding chunk map for this tile is empty, we spiral out and map chunks to keep loaded.
+ if (getManagedChunks().isEmpty()) {
+ int aChunks = GregtechMetaTileEntityChunkLoader.getMaxChunksToLoadForTier(getChunkloaderTier());
+ mLoadedChunks.addAll(spiralChunks(aBaseMetaTileEntity, getChunkloaderTier(), getChunkloaderTier()));
+ }
+ if (!mLoadedChunks.isEmpty()) {
+ for (ChunkCoordIntPair Y : mLoadedChunks) {
+ GTPP_ChunkManager.requestChunkLoad((TileEntity)aBaseMetaTileEntity.getMetaTileEntity(), Y);
+ }
+ }
+ setDoesWorkChunkNeedReload(false);
+ }
+
+
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntityThaumcraftResearcher.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntityThaumcraftResearcher.java
new file mode 100644
index 0000000000..8456f40797
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntityThaumcraftResearcher.java
@@ -0,0 +1,204 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Utility;
+
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMetaTileEntity;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+
+public class GregtechMetaTileEntityThaumcraftResearcher extends GregtechMetaTileEntity {
+
+ public GregtechMetaTileEntityThaumcraftResearcher(final int aID, final String aName, final String aNameRegional, final int aTier, final String aDescription, final int aSlotCount) {
+ super(aID, aName, aNameRegional, aTier, aSlotCount, aDescription);
+ }
+
+ public GregtechMetaTileEntityThaumcraftResearcher(final String aName, final int aTier, final String aDescription, final ITexture[][][] aTextures, final int aSlotCount) {
+ super(aName, aTier, aSlotCount, aDescription, aTextures);
+ }
+
+ @Override
+ public String[] getDescription() {
+ return new String[] {this.mDescription, "Generates Thaumcraft research notes, because it's magic."};
+ }
+
+ @Override
+ public ITexture[][][] getTextureSet(final ITexture[] aTextures) {
+ final ITexture[][][] rTextures = new ITexture[10][17][];
+ for (byte i = -1; i < 16; i++) {
+ rTextures[0][i + 1] = this.getFront(i);
+ rTextures[1][i + 1] = this.getBack(i);
+ rTextures[2][i + 1] = this.getBottom(i);
+ rTextures[3][i + 1] = this.getTop(i);
+ rTextures[4][i + 1] = this.getSides(i);
+ rTextures[5][i + 1] = this.getFrontActive(i);
+ rTextures[6][i + 1] = this.getBackActive(i);
+ rTextures[7][i + 1] = this.getBottomActive(i);
+ rTextures[8][i + 1] = this.getTopActive(i);
+ rTextures[9][i + 1] = this.getSidesActive(i);
+ }
+ return rTextures;
+ }
+
+ @Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+ return this.mTextures[(aActive ? 5 : 0) + (aSide == aFacing ? 0 : aSide == GT_Utility.getOppositeSide(aFacing) ? 1 : aSide == 0 ? 2 : aSide == 1 ? 3 : 4)][aColorIndex + 1];
+ }
+
+
+ public ITexture[] getFront(final byte aColor) {
+ return new ITexture[]{getSides(aColor)[0], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Metal_Grate_A)};
+ }
+
+
+ public ITexture[] getBack(final byte aColor) {
+ return new ITexture[]{getSides(aColor)[0], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Metal_Grate_B)};
+ }
+
+
+ public ITexture[] getBottom(final byte aColor) {
+ return new ITexture[]{getSides(aColor)[0]};
+ }
+
+
+ public ITexture[] getTop(final byte aColor) {
+ return new ITexture[]{getSides(aColor)[0], new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Dimensional_Blue)};
+ }
+
+
+ public ITexture[] getSides(final byte aColor) {
+ return new ITexture[]{new GT_RenderedTexture(TexturesGtBlock.Casing_Material_RedSteel)};
+ }
+
+
+ public ITexture[] getFrontActive(final byte aColor) {
+ return getFront(aColor);
+ }
+
+
+ public ITexture[] getBackActive(final byte aColor) {
+ return getBack(aColor);
+ }
+
+
+ public ITexture[] getBottomActive(final byte aColor) {
+ return getBottom(aColor);
+ }
+
+
+ public ITexture[] getTopActive(final byte aColor) {
+ return new ITexture[]{getSides(aColor)[0], new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Dimensional_Orange)};
+ }
+
+
+ public ITexture[] getSidesActive(final byte aColor) {
+ return getSides(aColor);
+ }
+
+ @Override
+ public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ);
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaTileEntityThaumcraftResearcher(this.mName, this.mTier, this.mDescription, this.mTextures, this.mInventory.length);
+ }
+
+ @Override public boolean isSimpleMachine() {return false;}
+ @Override public boolean isElectric() {return true;}
+ @Override public boolean isValidSlot(final int aIndex) {return true;}
+ @Override public boolean isFacingValid(final byte aFacing) {return true;}
+ @Override public boolean isEnetInput() {return true;}
+ @Override public boolean isEnetOutput() {return false;}
+ @Override public boolean isInputFacing(final byte aSide) {return aSide!=this.getBaseMetaTileEntity().getFrontFacing();}
+ @Override public boolean isOutputFacing(final byte aSide) {return aSide==this.getBaseMetaTileEntity().getBackFacing();}
+ @Override public boolean isTeleporterCompatible() {return false;}
+ @Override public long getMinimumStoredEU() {return 0;}
+ @Override public long maxEUStore() {return 512000;}
+ @Override public int rechargerSlotStartIndex() {return 0;}
+ @Override public int dechargerSlotStartIndex() {return 0;}
+ @Override public int rechargerSlotCount() {return 0;}
+ @Override public int dechargerSlotCount() {return 0;}
+ @Override public boolean isAccessAllowed(final EntityPlayer aPlayer) {return true;}
+
+ @Override
+ public int getCapacity() {
+ return 128000;
+ }
+
+ @Override
+ public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) {
+ if (aBaseMetaTileEntity.isClientSide())
+ {
+ return true;
+ }
+ return true;
+ }
+
+ @Override
+ public boolean allowPullStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) {
+ return aSide==this.getBaseMetaTileEntity().getBackFacing();
+ }
+
+ @Override
+ public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) {
+ return true;
+ }
+
+ @Override
+ public String[] getInfoData() {
+ return new String[] {
+ this.getLocalName(),
+ };
+ }
+
+ @Override
+ public boolean isGivingInformation() {
+ return true;
+ }
+
+ @Override
+ public int getSizeInventory() {
+ return 2;
+ }
+
+ @Override
+ public boolean isOverclockerUpgradable() {
+ return false;
+ }
+
+ @Override
+ public boolean isTransformerUpgradable() {
+ return false;
+ }
+
+ @Override
+ public void saveNBTData(final NBTTagCompound aNBT) {
+ //aNBT.setInteger("mCurrentPollution", this.mCurrentPollution);
+ //aNBT.setInteger("mAveragePollution", this.mAveragePollution);
+ }
+
+ @Override
+ public void loadNBTData(final NBTTagCompound aNBT) {
+ //this.mCurrentPollution = aNBT.getInteger("mCurrentPollution");
+ //this.mAveragePollution = aNBT.getInteger("mAveragePollution");
+ }
+
+ @Override
+ public void onFirstTick(final IGregTechTileEntity aBaseMetaTileEntity) {
+ super.onFirstTick(aBaseMetaTileEntity);
+ }
+
+ @Override
+ public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) {
+ super.onPostTick(aBaseMetaTileEntity, aTick);
+ }
+
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_BasicWasher.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_BasicWasher.java
new file mode 100644
index 0000000000..99b3faa7d4
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_BasicWasher.java
@@ -0,0 +1,71 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic;
+
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.MetaTileEntity;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Recipe;
+import gtPlusPlus.core.lib.CORE;
+import gregtech.api.util.GTPP_Recipe;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.fluids.FluidStack;
+
+public class GregtechMetaTileEntity_BasicWasher extends GT_MetaTileEntity_BasicMachine {
+
+ public GregtechMetaTileEntity_BasicWasher(int aID, String aName, String aNameRegional, int aTier) {
+ super(aID, aName, aNameRegional, aTier, 1,
+ "It's like an automatic Cauldron for washing dusts.", 1, 1, "PotionBrewer.png", "",
+ new ITexture[]{
+ new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_POTIONBREWER_ACTIVE),
+ new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_POTIONBREWER),
+ new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_POTIONBREWER_ACTIVE),
+ new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_POTIONBREWER),
+ new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_ROCK_BREAKER_ACTIVE),
+ new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_ROCK_BREAKER),
+ new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_ROCK_BREAKER_ACTIVE),
+ new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_ROCK_BREAKER)
+ }
+ );
+ }
+
+ public GregtechMetaTileEntity_BasicWasher(String aName, int aTier, String aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) {
+ super(aName, aTier, 1, aDescription, aTextures, 1, 1, aGUIName, aNEIName);
+ }
+
+ /*public GregtechMetaTileEntity_BasicWasher(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) {
+ super(aName, aTier, 1, aDescription, aTextures, 1, 1, aGUIName, aNEIName);
+ }*/
+
+ @Override
+ public String[] getDescription() {
+ return new String[]{this.mDescription, "Grants no byproducts, but it is fast.", CORE.GT_Tooltip};
+ }
+
+ @Override
+ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaTileEntity_BasicWasher(this.mName, this.mTier, this.mDescription, this.mTextures, this.mGUIName, this.mNEIName);
+ }
+
+ @Override
+ public GT_Recipe.GT_Recipe_Map getRecipeList() {
+ return GTPP_Recipe.GTPP_Recipe_Map.sSimpleWasherRecipes;
+ }
+
+ @Override
+ public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ return (super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack)) && (getRecipeList().containsInput(aStack));
+ }
+
+ @Override
+ public boolean isFluidInputAllowed(FluidStack aFluid) {
+ return (aFluid.getFluid().getName().equals("water")) || (super.isFluidInputAllowed(aFluid));
+ }
+
+ @Override
+ public int getCapacity() {
+ return 8000 * Math.max(1, this.mTier);
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_ChemicalReactor.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_ChemicalReactor.java
new file mode 100644
index 0000000000..c872e5c912
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_ChemicalReactor.java
@@ -0,0 +1,666 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic;
+
+import static gregtech.api.enums.GT_Values.E;
+
+import java.util.HashSet;
+import java.util.List;
+
+import cpw.mods.fml.common.registry.LanguageRegistry;
+import gregtech.GT_Mod;
+import gregtech.api.GregTech_API;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.MetaTileEntity;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_OreDictUnificator;
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
+import gregtech.api.util.GT_Utility;
+import gregtech.api.util.GTPP_Recipe;
+import gtPlusPlus.api.objects.random.XSTR;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.slots.SlotChemicalPlantInput;
+import gtPlusPlus.xmod.gregtech.api.gui.fluidreactor.Container_FluidReactor;
+import gtPlusPlus.xmod.gregtech.api.gui.fluidreactor.GUI_FluidReactor;
+import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidStack;
+import net.minecraftforge.fluids.FluidTankInfo;
+import net.minecraftforge.fluids.IFluidHandler;
+
+public class GregtechMetaTileEntity_ChemicalReactor extends GT_MetaTileEntity_BasicMachine {
+
+ public boolean mFluidTransfer_1 = false;
+ public boolean mFluidTransfer_2 = false;
+
+ public FluidStack[] mInputFluids = new FluidStack[4];
+ public FluidStack[] mOutputFluids = new FluidStack[2];
+
+ public GregtechMetaTileEntity_ChemicalReactor(int aID, String aName, String aNameRegional, int aTier) {
+ super(aID, aName, aNameRegional, aTier, 1,
+ "For mixing fluids", 4, 4, "ChemicalReactor.png", "",
+ new ITexture[]{
+ new GT_RenderedTexture(TexturesGtBlock.Overlay_FluidReactor_Side_Active),
+ new GT_RenderedTexture(TexturesGtBlock.Overlay_FluidReactor_Side),
+ new GT_RenderedTexture(TexturesGtBlock.Overlay_FluidReactor_Front_Active),
+ new GT_RenderedTexture(TexturesGtBlock.Overlay_FluidReactor_Front),
+ new GT_RenderedTexture(TexturesGtBlock.Overlay_FluidReactor_Top_Active),
+ new GT_RenderedTexture(TexturesGtBlock.Overlay_FluidReactor_Top),
+ new GT_RenderedTexture(TexturesGtBlock.Overlay_FluidReactor_Top_Active),
+ new GT_RenderedTexture(TexturesGtBlock.Overlay_FluidReactor_Top)
+ }
+ );
+ }
+
+ public GregtechMetaTileEntity_ChemicalReactor(String aName, int aTier, String aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) {
+ super(aName, aTier, 1, aDescription, aTextures, 1, 1, aGUIName, aNEIName);
+ }
+
+ /*public GregtechMetaTileEntity_BasicWasher(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) {
+ super(aName, aTier, 1, aDescription, aTextures, 1, 1, aGUIName, aNEIName);
+ }*/
+
+ @Override
+ public String[] getDescription() {
+ return new String[]{this.mDescription, "Because why not?", CORE.GT_Tooltip};
+ }
+
+ @Override
+ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ try {
+ GregtechMetaTileEntity_ChemicalReactor y = new GregtechMetaTileEntity_ChemicalReactor(this.mName, this.mTier, this.mDescription, this.mTextures, this.mGUIName, this.mNEIName);
+ return y;
+ }
+ catch(Throwable t) {
+ t.printStackTrace();
+ }
+ return null;
+ }
+
+ @Override
+ public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ try {
+ Container_FluidReactor y = new Container_FluidReactor(aPlayerInventory, aBaseMetaTileEntity);
+ return y;
+ }
+ catch(Throwable t) {
+ t.printStackTrace();
+ }
+ return null;
+ }
+
+ @Override
+ public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GUI_FluidReactor(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(),
+ this.mGUIName,
+ GT_Utility.isStringValid(this.mNEIName)
+ ? this.mNEIName
+ : (this.getRecipeList() != null ? this.getRecipeList().mUnlocalizedName : ""));
+ }
+
+ @Override
+ public GT_Recipe.GT_Recipe_Map getRecipeList() {
+ return null;
+ }
+
+ @Override
+ public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ return (super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack)) && (getRecipeList().containsInput(aStack));
+ }
+
+ @Override
+ public boolean isFluidInputAllowed(FluidStack aFluid) {
+ return (super.isFluidInputAllowed(aFluid));
+ }
+
+ @Override
+ public int getCapacity() {
+ return 32000 * Math.max(1, this.mTier) / 4;
+ }
+
+ @Override
+ public int getInputSlot() {
+ return 3;
+ }
+
+ @Override
+ public boolean isLiquidInput(byte aSide) {
+ return aSide > 1;
+ }
+
+ @Override
+ public boolean isLiquidOutput(byte aSide) {
+ return aSide < 2;
+ }
+
+ @Override
+ public int getOutputSlot() {
+ return super.getOutputSlot();
+ }
+
+ @Override
+ public int getStackDisplaySlot() {
+ return super.getStackDisplaySlot();
+ }
+
+ @Override
+ public boolean doesEmptyContainers() {
+ return true;
+ }
+
+ @Override
+ public boolean canTankBeFilled() {
+ return super.canTankBeFilled();
+ }
+
+ @Override
+ public boolean canTankBeEmptied() {
+ return super.canTankBeEmptied();
+ }
+
+ @Override
+ public FluidStack getDisplayedFluid() {
+ return super.getDisplayedFluid();
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ super.saveNBTData(aNBT);
+ aNBT.setBoolean("mFluidTransfer_1", mFluidTransfer_1);
+ aNBT.setBoolean("mFluidTransfer_2", mFluidTransfer_2);
+ for (int i=0;i<4;i++) {
+ if (this.mInputFluids[i] != null) {
+ aNBT.setTag("mInputFluid"+i, this.mInputFluids[i].writeToNBT(new NBTTagCompound()));
+ }
+ }
+ for (int i=0;i<2;i++) {
+ if (this.mOutputFluids[i] != null) {
+ aNBT.setTag("mOutputFluid"+i, this.mOutputFluids[i].writeToNBT(new NBTTagCompound()));
+ }
+ }
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ super.loadNBTData(aNBT);
+ mFluidTransfer_1 = aNBT.getBoolean("mFluidTransfer_1");
+ mFluidTransfer_2 = aNBT.getBoolean("mFluidTransfer_2");
+ for (int i=0;i<4;i++) {
+ if (this.mInputFluids[i] == null) {
+ this.mInputFluids[i] = FluidStack.loadFluidStackFromNBT(aNBT.getCompoundTag("mInputFluid"+i));
+ }
+ }
+ for (int i=0;i<2;i++) {
+ if (this.mOutputFluids[i] == null) {
+ this.mOutputFluids[i] = FluidStack.loadFluidStackFromNBT(aNBT.getCompoundTag("mOutputFluid"+i));
+ }
+ }
+ }
+
+ /*
+ * Custom Fluid Handling - TODO
+ */
+
+ public FluidStack getFillableStack() {
+ return this.mFluid;
+ }
+
+ public FluidStack setFillableStack(FluidStack aFluid) {
+ this.mFluid = aFluid;
+ return this.mFluid;
+ }
+
+ public FluidStack getDrainableStack() {
+ return this.mFluid;
+ }
+
+ public FluidStack setDrainableStack(FluidStack aFluid) {
+ this.mFluid = aFluid;
+ return this.mFluid;
+ }
+
+
+
+
+
+
+
+
+ @Override
+ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ // Re-implement basic machine logic from the ground up.=
+
+ if (aBaseMetaTileEntity.isServerSide()) {
+ this.mCharge = aBaseMetaTileEntity.getStoredEU() / 2L > aBaseMetaTileEntity.getEUCapacity() / 3L;
+ this.mDecharge = aBaseMetaTileEntity.getStoredEU() < aBaseMetaTileEntity.getEUCapacity() / 3L;
+ this.doDisplayThings();
+ boolean tSucceeded = false;
+ int i;
+ if (this.mMaxProgresstime > 0 && (this.mProgresstime >= 0 || aBaseMetaTileEntity.isAllowedToWork())) {
+ aBaseMetaTileEntity.setActive(true);
+ if (this.mProgresstime >= 0 && !this.drainEnergyForProcess((long) this.mEUt)) {
+ if (!this.mStuttering) {
+ this.stutterProcess();
+ if (this.canHaveInsufficientEnergy()) {
+ this.mProgresstime = -100;
+ }
+
+ this.mStuttering = true;
+ }
+ } else {
+ if (++this.mProgresstime >= this.mMaxProgresstime) {
+ for (i = 0; i < this.mOutputItems.length; ++i) {
+ for (i = 0; i < this.mOutputItems.length && !aBaseMetaTileEntity.addStackToSlot(
+ this.getOutputSlot() + (i + i) % this.mOutputItems.length,
+ this.mOutputItems[i]); ++i) {
+ ;
+ }
+ }
+
+ if (this.mOutputFluid != null) {
+ if (this.getDrainableStack() == null) {
+ this.setDrainableStack(this.mOutputFluid.copy());
+ } else if (this.mOutputFluid.isFluidEqual(this.getDrainableStack())) {
+ FluidStack var10000 = this.getDrainableStack();
+ var10000.amount += this.mOutputFluid.amount;
+ }
+ }
+
+ for (i = 0; i < this.mOutputItems.length; ++i) {
+ this.mOutputItems[i] = null;
+ }
+
+ this.mOutputFluid = null;
+ this.mEUt = 0;
+ this.mProgresstime = 0;
+ this.mMaxProgresstime = 0;
+ this.mStuttering = false;
+ tSucceeded = true;
+ this.endProcess();
+ }
+
+ if (this.mProgresstime > 5) {
+ this.mStuttering = false;
+ }
+ }
+ } else {
+ aBaseMetaTileEntity.setActive(false);
+ }
+
+ boolean tRemovedOutputFluid = false;
+ if (this.doesAutoOutputFluids() && this.getDrainableStack() != null
+ && aBaseMetaTileEntity.getFrontFacing() != this.mMainFacing && (tSucceeded || aTick % 20L == 0L)) {
+ IFluidHandler tTank = aBaseMetaTileEntity.getITankContainerAtSide(aBaseMetaTileEntity.getFrontFacing());
+ if (tTank != null) {
+ FluidStack tDrained = this.drain(1000, false);
+ if (tDrained != null) {
+ int tFilledAmount = tTank.fill(
+ ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()), tDrained, false);
+ if (tFilledAmount > 0) {
+ tTank.fill(ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()),
+ this.drain(tFilledAmount, true), true);
+ }
+ }
+ }
+
+ if (this.getDrainableStack() == null) {
+ tRemovedOutputFluid = true;
+ }
+ }
+
+ int j;
+ if (this.doesAutoOutput() && !this.isOutputEmpty()
+ && aBaseMetaTileEntity.getFrontFacing() != this.mMainFacing
+ && (tSucceeded || this.mOutputBlocked % 300 == 1 || aBaseMetaTileEntity.hasInventoryBeenModified()
+ || aTick % 600L == 0L)) {
+ TileEntity tTileEntity2 = aBaseMetaTileEntity.getTileEntityAtSide(aBaseMetaTileEntity.getFrontFacing());
+ j = 0;
+
+ for (byte tCosts = 1; j < this.mOutputItems.length && tCosts > 0
+ && aBaseMetaTileEntity.isUniversalEnergyStored(128L); ++j) {
+ tCosts = GT_Utility.moveOneItemStack(aBaseMetaTileEntity, tTileEntity2,
+ aBaseMetaTileEntity.getFrontFacing(), aBaseMetaTileEntity.getBackFacing(), (List) null,
+ false, (byte) 64, (byte) 1, (byte) 64, (byte) 1);
+ if (tCosts > 0) {
+ aBaseMetaTileEntity.decreaseStoredEnergyUnits((long) tCosts, true);
+ }
+ }
+ }
+
+ if (this.mOutputBlocked != 0) {
+ if (this.isOutputEmpty()) {
+ this.mOutputBlocked = 0;
+ } else {
+ ++this.mOutputBlocked;
+ }
+ }
+
+ if (this.allowToCheckRecipe()) {
+ if (this.mMaxProgresstime <= 0 && aBaseMetaTileEntity.isAllowedToWork()
+ && (tRemovedOutputFluid || tSucceeded || aBaseMetaTileEntity.hasInventoryBeenModified()
+ || aTick % 600L == 0L || aBaseMetaTileEntity.hasWorkJustBeenEnabled())
+ && this.hasEnoughEnergyToCheckRecipe()) {
+ if (this.checkRecipe() == 2) {
+ if (this.mInventory[3] != null && this.mInventory[3].stackSize <= 0) {
+ this.mInventory[3] = null;
+ }
+
+ i = this.getInputSlot();
+
+ for (j = i + this.mInputSlotCount; i < j; ++i) {
+ if (this.mInventory[i] != null && this.mInventory[i].stackSize <= 0) {
+ this.mInventory[i] = null;
+ }
+ }
+
+ for (i = 0; i < this.mOutputItems.length; ++i) {
+ this.mOutputItems[i] = GT_Utility.copy(new Object[]{this.mOutputItems[i]});
+ if (this.mOutputItems[i] != null && this.mOutputItems[i].stackSize > 64) {
+ this.mOutputItems[i].stackSize = 64;
+ }
+
+ this.mOutputItems[i] = GT_OreDictUnificator.get(true, this.mOutputItems[i]);
+ }
+
+ if (this.mFluid != null && this.mFluid.amount <= 0) {
+ this.mFluid = null;
+ }
+
+ this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
+ if (GT_Utility.isDebugItem(this.mInventory[this.dechargerSlotStartIndex()])) {
+ this.mEUt = this.mMaxProgresstime = 1;
+ }
+
+ this.startProcess();
+ } else {
+ this.mMaxProgresstime = 0;
+
+ for (i = 0; i < this.mOutputItems.length; ++i) {
+ this.mOutputItems[i] = null;
+ }
+
+ this.mOutputFluid = null;
+ }
+ }
+ } else if (!this.mStuttering) {
+ this.stutterProcess();
+ this.mStuttering = true;
+ }
+ }
+
+
+
+ }
+
+ @Override
+ protected void doDisplayThings() {
+ // TODO Auto-generated method stub
+ super.doDisplayThings();
+ }
+
+ @Override
+ protected ItemStack getSpecialSlot() {
+ // TODO Auto-generated method stub
+ return super.getSpecialSlot();
+ }
+
+ @Override
+ protected ItemStack getOutputAt(int aIndex) {
+ // TODO Auto-generated method stub
+ return super.getOutputAt(aIndex);
+ }
+
+ @Override
+ protected ItemStack[] getAllOutputs() {
+ // TODO Auto-generated method stub
+ return super.getAllOutputs();
+ }
+
+ @Override
+ protected ItemStack getInputAt(int aIndex) {
+ // TODO Auto-generated method stub
+ return super.getInputAt(aIndex);
+ }
+
+ @Override
+ protected ItemStack[] getAllInputs() {
+ // TODO Auto-generated method stub
+ return super.getAllInputs();
+ }
+
+ @Override
+ protected boolean displaysInputFluid() {
+ return true;
+ }
+
+ @Override
+ protected boolean displaysOutputFluid() {
+ return true;
+ }
+
+ @Override
+ public boolean doesAutoOutput() {
+ return super.doesAutoOutput();
+ }
+
+ @Override
+ public boolean doesAutoOutputFluids() {
+ return this.mFluidTransfer_1 && this.mFluidTransfer_2;
+ }
+
+ @Override
+ public void startProcess() {
+ super.startProcess();
+ }
+
+ @Override
+ public void endProcess() {
+ super.endProcess();
+ }
+
+ @Override
+ public String[] getInfoData() {
+ return super.getInfoData();
+ }
+
+ @Override
+ public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ return super.allowPullStack(aBaseMetaTileEntity, aIndex, aSide, aStack);
+ }
+
+ @Override
+ public int checkRecipe() {
+ return super.checkRecipe();
+ }
+
+ @Override
+ public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ super.onPreTick(aBaseMetaTileEntity, aTick);
+
+ /* if (aBaseMetaTileEntity != null) {
+ if (!aBaseMetaTileEntity.getWorld().isRemote) {
+ itemslots : for (int i=3;i<7;i++) {
+ ItemStack aStack = aBaseMetaTileEntity.getStackInSlot(i);
+ if (aStack != null) {
+ if (FluidContainerRegistry.isContainer(aStack)) {
+ if (this.isItemValidForSlot(i, aStack)) {
+ // Add Fluid
+ FluidStack aContainerFluid = FluidContainerRegistry.getFluidForFilledItem(aStack);
+ if (aContainerFluid != null) {
+ fluidslots : for (FluidStack u : mInputFluids) {
+ if (u != null && u.isFluidEqual(aContainerFluid)) {
+ if (u.amount <= (this.getCapacity() - aContainerFluid.amount)) {
+
+ // Matching, not full, let's fill, then continue
+ u.amount += aContainerFluid.amount;
+
+ // Update stack size
+ if (aStack.stackSize > 1) {
+ aStack.stackSize--;
+ }
+ else {
+ aStack = null;
+ }
+
+ // Add Output container
+ // TODO
+
+ continue itemslots;
+ }
+ else {
+ // Too full
+ break fluidslots;
+ }
+ }
+ else {
+ if (u == null ) {
+
+ // Empty, let's fill, then continue
+ u = aContainerFluid.copy();
+
+ // Update stack size
+ if (aStack.stackSize > 1) {
+ aStack.stackSize--;
+ }
+ else {
+ aStack = null;
+ }
+
+ // Add Output container
+ // TODO
+
+ continue itemslots;
+
+ }
+ else {
+ // Not empty, doesn't match, check next slot.
+ continue fluidslots;
+ }
+ }
+ }
+
+
+
+ }
+ // Eat Input
+
+ // Add Container to Output
+ }
+ }
+ }
+ }
+ }
+ }*/
+
+ }
+
+ @Override
+ public FluidStack getFluid() {
+ return super.getFluid();
+ }
+
+ @Override
+ public int getFluidAmount() {
+ return super.getFluidAmount();
+ }
+
+ @Override
+ public int fill(FluidStack aFluid, boolean doFill) {
+ return super.fill(aFluid, doFill);
+ }
+
+ @Override
+ public FluidStack drain(int maxDrain, boolean doDrain) {
+ return super.drain(maxDrain, doDrain);
+ }
+
+ @Override
+ public void setItemNBT(NBTTagCompound aNBT) {
+ super.setItemNBT(aNBT);
+ }
+
+ @Override
+ public boolean isItemValidForSlot(int aIndex, ItemStack aStack) {
+ if (aIndex >= 3 && aIndex <= 6) {
+ return SlotChemicalPlantInput.isItemValidForChemicalPlantSlot(aStack);
+ }
+ return false;
+ }
+
+ @Override
+ public int[] getAccessibleSlotsFromSide(int aSide) {
+ return super.getAccessibleSlotsFromSide(aSide);
+ }
+
+ @Override
+ public boolean canInsertItem(int aIndex, ItemStack aStack, int aSide) {
+ if (aIndex >= 3 && aIndex <= 6) {
+ return super.canInsertItem(aIndex, aStack, aSide);
+ }
+ return false;
+ }
+
+ @Override
+ public boolean canExtractItem(int aIndex, ItemStack aStack, int aSide) {
+ if (aIndex >= 7 && aIndex <= 11) {
+ return super.canExtractItem(aIndex, aStack, aSide);
+ }
+ return false;
+ }
+
+ @Override
+ public boolean canFill(ForgeDirection aSide, Fluid aFluid) {
+ // TODO Auto-generated method stub
+ return super.canFill(aSide, aFluid);
+ }
+
+ @Override
+ public boolean canDrain(ForgeDirection aSide, Fluid aFluid) {
+ // TODO Auto-generated method stub
+ return super.canDrain(aSide, aFluid);
+ }
+
+ @Override
+ public FluidTankInfo[] getTankInfo(ForgeDirection aSide) {
+ // TODO Auto-generated method stub
+ return super.getTankInfo(aSide);
+ }
+
+ @Override
+ public int fill_default(
+ ForgeDirection aSide, FluidStack aFluid, boolean doFill
+ ) {
+ // TODO Auto-generated method stub
+ return super.fill_default(aSide, aFluid, doFill);
+ }
+
+ @Override
+ public int fill(ForgeDirection aSide, FluidStack aFluid, boolean doFill) {
+ // TODO Auto-generated method stub
+ return super.fill(aSide, aFluid, doFill);
+ }
+
+ @Override
+ public FluidStack drain(
+ ForgeDirection aSide, FluidStack aFluid, boolean doDrain
+ ) {
+ // TODO Auto-generated method stub
+ return super.drain(aSide, aFluid, doDrain);
+ }
+
+ @Override
+ public FluidStack drain(
+ ForgeDirection aSide, int maxDrain, boolean doDrain
+ ) {
+ // TODO Auto-generated method stub
+ return super.drain(aSide, maxDrain, doDrain);
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_CompactFusionReactor.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_CompactFusionReactor.java
new file mode 100644
index 0000000000..2197ce193d
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_CompactFusionReactor.java
@@ -0,0 +1,702 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic;
+
+import java.util.ArrayList;
+import java.util.Random;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.GT_Values;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.MetaTileEntity;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_Utility;
+import gregtech.api.util.GTPP_Recipe;
+
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.math.MathUtils;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_DeluxeMachine;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidStack;
+
+public class GregtechMetaTileEntity_CompactFusionReactor extends GT_MetaTileEntity_DeluxeMachine {
+
+ private boolean mCanProcessRecipe = false;
+ private boolean mCharging = false;
+ private long mChargeConsumed = 0;
+
+ private GT_Recipe mLastRecipe;
+ private long mEUStore;
+ private boolean mRunningOnLoad = false;
+ private boolean mMachine = false;
+ private int mEfficiency, mEfficiencyIncrease, mEfficiencyMax = 0;
+ private int mStartUpCheck = 100, mUpdate = 0;
+ private FluidStack[] mOutputFluids = null;
+
+ public GregtechMetaTileEntity_CompactFusionReactor(int aID, String aName, String aNameRegional, int aTier) {
+ super(aID, aName, aNameRegional, aTier, 1, "It's like a midget Ra.", 1, 1, "PotionBrewer.png", "");
+ }
+
+ public GregtechMetaTileEntity_CompactFusionReactor(String aName, int aTier, String aDescription,
+ ITexture[][][] aTextures, String aGUIName, String aNEIName) {
+ super(aName, aTier, 1, aDescription, aTextures, 1, 1, aGUIName, aNEIName);
+ }
+
+ @Override
+ public String[] getDescription() {
+ return new String[] { this.mDescription, "Not Very Fast, but not very big either.",
+ "Each side pair in/out puts to different slots.", "Top & Bottom Sides are Outputs.",
+ "Front & Back are Input Plasma 1.", "Sides are Input Plasma 2." };
+ }
+
+ @Override
+ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaTileEntity_CompactFusionReactor(this.mName, this.mTier, this.mDescription,
+ this.mTextures, this.mGUIName, this.mNEIName);
+ }
+
+ public int tier() {
+ return this.mTier;
+ }
+
+ public int tierOverclock() {
+ return this.mTier == 6 ? 0 : this.mTier == 7 ? 1 : 2;
+ }
+
+ private GT_RenderedTexture getCasingTexture() {
+ return new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Advanced);
+ }
+
+ @Override
+ public ITexture[][][] getTextureSet(final ITexture[] aTextures) {
+ final ITexture[][][] rTextures = new ITexture[10][17][];
+ for (byte i = -1; i < 16; i++) {
+ rTextures[0][i + 1] = this.getFront(i);
+ rTextures[1][i + 1] = this.getBack(i);
+ rTextures[2][i + 1] = this.getBottom(i);
+ rTextures[3][i + 1] = this.getTop(i);
+ rTextures[4][i + 1] = this.getSides(i);
+ rTextures[5][i + 1] = this.getFrontActive(i);
+ rTextures[6][i + 1] = this.getBackActive(i);
+ rTextures[7][i + 1] = this.getBottomActive(i);
+ rTextures[8][i + 1] = this.getTopActive(i);
+ rTextures[9][i + 1] = this.getSidesActive(i);
+ }
+ return rTextures;
+ }
+
+ @Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing,
+ final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+ return this.mTextures[(aActive ? 5 : 0) + (aSide == aFacing ? 0
+ : aSide == GT_Utility.getOppositeSide(aFacing) ? 1 : aSide == 0 ? 2 : aSide == 1 ? 3 : 4)][aColorIndex
+ + 1];
+ }
+
+ @Override
+ public GT_Recipe.GT_Recipe_Map getRecipeList() {
+ return GTPP_Recipe.GTPP_Recipe_Map.sSlowFusionRecipes;
+ }
+
+ @Override
+ public boolean isOutputFacing(final byte aSide) {
+ return aSide == this.getBaseMetaTileEntity().getBackFacing();
+ }
+
+ @Override
+ public boolean isFluidInputAllowed(FluidStack aFluid) {
+ return (aFluid.getFluid().getName().contains("plasma")) || (super.isFluidInputAllowed(aFluid));
+ }
+
+ @Override
+ public int getCapacity() {
+ return 32000;
+ }
+
+ @Override
+ public void abortProcess() {
+ super.abortProcess();
+ }
+
+ long mFusionPoint = 20000000L;
+
+ @Override
+ public int checkRecipe() {
+ Logger.MACHINE_INFO("Recipe Tick 1.");
+ if (!this.mCanProcessRecipe) {
+ Logger.MACHINE_INFO("Recipe Tick 1.1 - Cannot Process Recipe.");
+ if (this.mChargeConsumed < mFusionPoint) {
+ Logger.MACHINE_INFO("Recipe Tick 1.2 - Cannot Ignite Fusion, Charge too low.");
+ this.mCharging = true;
+ this.mCanProcessRecipe = false;
+ if (this.getBaseMetaTileEntity().decreaseStoredEnergyUnits((mFusionPoint / 100), false)) {
+ Logger.MACHINE_INFO("Recipe Tick 1.3 - Charging Internal storage. " + (mFusionPoint / 100) + "/"
+ + mFusionPoint);
+ mChargeConsumed += (mFusionPoint / 100);
+ }
+ }
+ else {
+ mChargeConsumed = 0;
+ this.mCharging = false;
+ this.mCanProcessRecipe = true;
+
+ }
+ }
+ else {
+ Logger.MACHINE_INFO("Recipe Tick 1.1 - Try to Process Recipe.");
+ if (checkRecipeMulti()) {
+ Logger.MACHINE_INFO("Recipe Tick 1.2 - Process Recipe was Successful.");
+ return 2;
+ }
+ }
+ Logger.MACHINE_INFO("Recipe Tick 2. - Process Recipe failed.");
+ return 0;
+ }
+
+ public ArrayList<FluidStack> getStoredFluids() {
+ ArrayList<FluidStack> mList = new ArrayList<FluidStack>();
+ mList.add(this.mFluid);
+ mList.add(this.mFluid2);
+ return mList;
+ }
+
+ public boolean checkRecipeMulti() {
+ ArrayList<FluidStack> tFluidList = getStoredFluids();
+ int tFluidList_sS = tFluidList.size();
+ for (int i = 0; i < tFluidList_sS - 1; i++) {
+ for (int j = i + 1; j < tFluidList_sS; j++) {
+ if (GT_Utility.areFluidsEqual(tFluidList.get(i), tFluidList.get(j))) {
+ if (tFluidList.get(i).amount >= tFluidList.get(j).amount) {
+ tFluidList.remove(j--);
+ tFluidList_sS = tFluidList.size();
+ }
+ else {
+ tFluidList.remove(i--);
+ tFluidList_sS = tFluidList.size();
+ break;
+ }
+ }
+ }
+ }
+ if (tFluidList.size() > 1) {
+ FluidStack[] tFluids = tFluidList.toArray(new FluidStack[tFluidList.size()]);
+ GT_Recipe tRecipe = getRecipeList().findRecipe(this.getBaseMetaTileEntity(), this.mLastRecipe, false,
+ GT_Values.V[8], tFluids, new ItemStack[] {});
+ if (tRecipe == null) {
+ return false;
+ }
+ if ((tRecipe == null && !mRunningOnLoad) || (tRecipe != null && maxEUStore() < tRecipe.mSpecialValue)) {
+ this.mLastRecipe = null;
+ Logger.MACHINE_INFO("Just plain bad.");
+ return false;
+ }
+ if (mRunningOnLoad || tRecipe.isRecipeInputEqual(true, tFluids, new ItemStack[] {})) {
+ this.mLastRecipe = tRecipe;
+ this.mEUt = (this.mLastRecipe.mEUt * overclock(this.mLastRecipe.mSpecialValue));
+ this.mMaxProgresstime = this.mLastRecipe.mDuration / overclock(this.mLastRecipe.mSpecialValue);
+
+ this.mEfficiencyIncrease = 10000;
+
+ this.mOutputFluids = this.mLastRecipe.mFluidOutputs;
+ mRunningOnLoad = false;
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public int overclock(int mStartEnergy) {
+ if (tierOverclock() == 1) {
+ return 1;
+ }
+ if (tierOverclock() == 2) {
+ return mStartEnergy < 160000000 ? 2 : 1;
+ }
+ return mStartEnergy < 160000000 ? 4 : mStartEnergy < 320000000 ? 2 : 1;
+ }
+
+ @Override
+ public boolean displaysItemStack() {
+ return false;
+ }
+
+ @Override
+ public boolean doesAutoOutputFluids() {
+ return true;
+ }
+
+ @Override
+ public boolean doesEmptyContainers() {
+ return true;
+ }
+
+ @Override
+ public boolean doesFillContainers() {
+ return true;
+ }
+
+ @Override
+ public long maxAmperesIn() {
+ return 16L;
+ }
+
+ @Override
+ public long maxEUStore() {
+ return Long.MAX_VALUE;
+ }
+
+ @Override
+ public void doExplosion(long aExplosionPower) {
+ super.doExplosion(aExplosionPower * 2);
+ }
+
+ @Override
+ public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ super.onPreTick(aBaseMetaTileEntity, aTick);
+ onRunningTickMulti();
+ if ((aBaseMetaTileEntity.isClientSide()) && (aBaseMetaTileEntity.isActive())
+ && (aBaseMetaTileEntity.getFrontFacing() != 1) && (aBaseMetaTileEntity.getCoverIDAtSide((byte) 1) == 0)
+ && (!aBaseMetaTileEntity.getOpacityAtSide((byte) 1))) {
+ if (MathUtils.randInt(0, 4) == 4) {
+ final Random tRandom = aBaseMetaTileEntity.getWorld().rand;
+ aBaseMetaTileEntity.getWorld().spawnParticle("magicCrit",
+ (aBaseMetaTileEntity.getXCoord() + 0.8F) - (tRandom.nextFloat() * 0.6F),
+ aBaseMetaTileEntity.getYCoord() + 0.3f + (tRandom.nextFloat() * 0.2F),
+ (aBaseMetaTileEntity.getZCoord() + 1.2F) - (tRandom.nextFloat() * 1.6F), 0.0D, 0.0D, 0.0D);
+ aBaseMetaTileEntity.getWorld().spawnParticle("magicCrit",
+ (aBaseMetaTileEntity.getXCoord() + 0.4F) - (tRandom.nextFloat() * 0.3F),
+ aBaseMetaTileEntity.getYCoord() + 0.2f + (tRandom.nextFloat() * 0.1F),
+ (aBaseMetaTileEntity.getZCoord() + 0.8F) - (tRandom.nextFloat() * 0.6F), 0.0D, 0.0D, 0.0D);
+ aBaseMetaTileEntity.getWorld().spawnParticle("magicCrit",
+ (aBaseMetaTileEntity.getXCoord() + 0.6F) - (tRandom.nextFloat() * 0.9F),
+ aBaseMetaTileEntity.getYCoord() + 0.4f + (tRandom.nextFloat() * 0.3F),
+ (aBaseMetaTileEntity.getZCoord() + 1.8F) - (tRandom.nextFloat() * 2.6F), 0.0D, 0.0D, 0.0D);
+ }
+ }
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ aNBT.setBoolean("mCanProcessRecipe", this.mCanProcessRecipe);
+ aNBT.setBoolean("mCharging", this.mCharging);
+ aNBT.setLong("mChargeConsumed", this.mChargeConsumed);
+ aNBT.setInteger("mEfficiency", this.mEfficiency);
+ aNBT.setInteger("mEfficiencyIncrease", this.mEfficiencyIncrease);
+ aNBT.setInteger("mEfficiencyMax", this.mEfficiencyMax);
+ aNBT.setInteger("mStartUpCheck", this.mStartUpCheck);
+ aNBT.setInteger("mUpdate", mUpdate);
+ aNBT.setInteger("mEfficiencyIncrease", mEfficiencyIncrease);
+ aNBT.setBoolean("mRunningOnLoad", this.mRunningOnLoad);
+ aNBT.setBoolean("mMachine", this.mMachine);
+ aNBT.setLong("mEUStore", this.mEUStore);
+ super.saveNBTData(aNBT);
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ if (mMaxProgresstime > 0)
+ mRunningOnLoad = true;
+ this.mCanProcessRecipe = aNBT.getBoolean("mCanProcessRecipe");
+ this.mCharging = aNBT.getBoolean("mCharging");
+ this.mChargeConsumed = aNBT.getLong("mChargeConsumed");
+ this.mEfficiency = aNBT.getInteger("mEfficiency");
+ this.mEfficiencyIncrease = aNBT.getInteger("mEfficiencyIncrease");
+ this.mEfficiencyMax = aNBT.getInteger("mEfficiencyMax");
+ this.mStartUpCheck = aNBT.getInteger("mStartUpCheck");
+ this.mUpdate = aNBT.getInteger("mUpdate");
+ this.mEfficiencyIncrease = aNBT.getInteger("mEfficiencyIncrease");
+ this.mEfficiencyIncrease = aNBT.getInteger("mEfficiencyIncrease");
+ this.mRunningOnLoad = aNBT.getBoolean("mRunningOnLoad");
+ this.mMachine = aNBT.getBoolean("mMachine");
+ this.mEUStore = aNBT.getLong("mEUStore");
+ super.loadNBTData(aNBT);
+ }
+
+ @Override
+ public String[] getInfoData() {
+ String tier = tier() == 6 ? "I" : tier() == 7 ? "II" : "III";
+ float plasmaOut = 0;
+ String fusionName = "";
+ int powerRequired = 0;
+ if (this.mLastRecipe != null) {
+ fusionName = this.mLastRecipe.mFluidOutputs[0].getLocalizedName() + " Fusion.";
+ powerRequired = this.mLastRecipe.mEUt;
+ if (this.mLastRecipe.getFluidOutput(0) != null) {
+ plasmaOut = (float) this.mLastRecipe.getFluidOutput(0).amount / (float) this.mLastRecipe.mDuration;
+ }
+ }
+
+ return new String[] { "Fusion Reactor MK " + tier, "EU Required: " + powerRequired + "EU/t",
+ "Stored EU: " + this.getEUVar() + " / " + maxEUStore(), "Plasma Output: " + plasmaOut + "L/t",
+ "Current Recipe: " + fusionName };
+ }
+
+ @Override
+ public boolean isGivingInformation() {
+ return true;
+ }
+
+ public ITexture[] getFront(final byte aColor) {
+ return new ITexture[] { this.getCasingTexture(), new GT_RenderedTexture(TexturesGtBlock.Overlay_MatterFab) };
+ }
+
+ public ITexture[] getBack(final byte aColor) {
+ return new ITexture[] { this.getCasingTexture(), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) };
+ }
+
+ public ITexture[] getBottom(final byte aColor) {
+ return new ITexture[] { new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS) };
+ }
+
+ public ITexture[] getTop(final byte aColor) {
+ return new ITexture[] { new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS) };
+ }
+
+ public ITexture[] getSides(final byte aColor) {
+ return new ITexture[] { this.getCasingTexture(),
+ new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Dimensional_Orange) };
+ }
+
+ public ITexture[] getFrontActive(final byte aColor) {
+ return new ITexture[] { this.getCasingTexture(),
+ new GT_RenderedTexture(TexturesGtBlock.Overlay_MatterFab_Active) };
+ }
+
+ public ITexture[] getBackActive(final byte aColor) {
+ return new ITexture[] { this.getCasingTexture(), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) };
+ }
+
+ public ITexture[] getBottomActive(final byte aColor) {
+ return new ITexture[] { new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS_YELLOW) };
+ }
+
+ public ITexture[] getTopActive(final byte aColor) {
+ return new ITexture[] { new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS_YELLOW) };
+ }
+
+ public ITexture[] getSidesActive(final byte aColor) {
+ return new ITexture[] { this.getCasingTexture(),
+ new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Dimensional_Blue) };
+ }
+
+ @Override
+ public void onMachineBlockUpdate() {
+ this.mUpdate = 50;
+ }
+
+ @Override
+ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ // super.onPostTick(aBaseMetaTileEntity, aTick);
+ if (aBaseMetaTileEntity.isServerSide()) {
+ // Logger.MACHINE_INFO("1");
+ if (mEfficiency < 0)
+ mEfficiency = 0;
+ if (mRunningOnLoad) {
+ Logger.MACHINE_INFO("2");
+ this.mEUStore = (int) aBaseMetaTileEntity.getStoredEU();
+ checkRecipeMulti();
+ }
+ if (--mUpdate == 0 || --mStartUpCheck == 0) {
+ Logger.MACHINE_INFO("3");
+ mMachine = true;
+ }
+ if (mStartUpCheck < 0) {
+ //Logger.MACHINE_INFO("4");
+ if (mMachine) {
+ //Logger.MACHINE_INFO("5");
+
+ if (aBaseMetaTileEntity.getStoredEU() + (2048 * tierOverclock()) < maxEUStore()) {
+ if (aBaseMetaTileEntity.increaseStoredEnergyUnits(2048 * tierOverclock(), true)) {
+ //Logger.MACHINE_INFO("5.5 A");
+ }
+ else {
+ //Logger.MACHINE_INFO("5.5 B");
+ }
+ }
+ if (this.mEUStore <= 0 && mMaxProgresstime > 0) {
+ Logger.MACHINE_INFO("6");
+ stopMachine();
+ this.mLastRecipe = null;
+ }
+ if (mMaxProgresstime > 0) {
+ Logger.MACHINE_INFO("7");
+ this.getBaseMetaTileEntity().decreaseStoredEnergyUnits(mEUt, true);
+ if (mMaxProgresstime > 0 && ++mProgresstime >= mMaxProgresstime) {
+ if (mOutputFluids != null)
+ for (FluidStack tStack : mOutputFluids)
+ if (tStack != null)
+ addOutput(tStack);
+ mEfficiency = Math.max(0, (mEfficiency + mEfficiencyIncrease));
+ mProgresstime = 0;
+ mMaxProgresstime = 0;
+ mEfficiencyIncrease = 0;
+ if (mOutputFluids != null && mOutputFluids.length > 0) {
+
+ }
+ this.mEUStore = (int) aBaseMetaTileEntity.getStoredEU();
+ if (aBaseMetaTileEntity.isAllowedToWork())
+ checkRecipeMulti();
+ }
+ }
+ else {
+ //Logger.MACHINE_INFO("8");
+ this.mEUStore = (int) aBaseMetaTileEntity.getStoredEU();
+ if (aTick % 100 == 0 || aBaseMetaTileEntity.hasWorkJustBeenEnabled()
+ || aBaseMetaTileEntity.hasInventoryBeenModified()) {
+ Logger.MACHINE_INFO("9");
+ // turnCasingActive(mMaxProgresstime > 0);
+ if (aBaseMetaTileEntity.isAllowedToWork()) {
+ Logger.MACHINE_INFO("10");
+ if (checkRecipeMulti()) {
+ Logger.MACHINE_INFO("11");
+ if (this.mEUStore < this.mLastRecipe.mSpecialValue) {
+ Logger.MACHINE_INFO("12");
+ mMaxProgresstime = 0;
+ // turnCasingActive(false);
+ }
+ aBaseMetaTileEntity.decreaseStoredEnergyUnits(this.mLastRecipe.mSpecialValue, true);
+ }
+ }
+ if (mMaxProgresstime <= 0)
+ mEfficiency = Math.max(0, mEfficiency - 1000);
+ }
+ }
+ }
+ else {
+ // turnCasingActive(false);
+ Logger.MACHINE_INFO("Bad");
+ this.mLastRecipe = null;
+ stopMachine();
+ }
+ }
+ Logger.MACHINE_INFO("Good | "+mMaxProgresstime);
+ aBaseMetaTileEntity.setActive(mMaxProgresstime > 0);
+ }
+ }
+
+ public boolean onRunningTickMulti() {
+ if (this.getBaseMetaTileEntity().isServerSide()) {
+ if (mEUt < 0) {
+ if (!drainEnergyInput(((long) -mEUt * 10000) / Math.max(1000, mEfficiency))) {
+ this.mLastRecipe = null;
+ stopMachine();
+ Logger.MACHINE_INFO("a1");
+ return false;
+ }
+ }
+ if (this.mEUStore <= 0) {
+ this.mLastRecipe = null;
+ stopMachine();
+ Logger.MACHINE_INFO("a2");
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public boolean drainEnergyInput(long aEU) {
+ return false;
+ }
+
+ public boolean addOutput(FluidStack aLiquid) {
+ if (aLiquid == null)
+ return false;
+ FluidStack copiedFluidStack = aLiquid.copy();
+ this.mOutputFluid = copiedFluidStack;
+ return false;
+ }
+
+ public void stopMachine() {
+ mEUt = 0;
+ mEfficiency = 0;
+ mProgresstime = 0;
+ mMaxProgresstime = 0;
+ mEfficiencyIncrease = 0;
+ getBaseMetaTileEntity().disableWorking();
+ }
+
+ @Override
+ public boolean isLiquidInput(byte aSide) {
+ switch (aSide) {
+ case 0:
+ return true;
+ case 1:
+ return true;
+ case 2:
+ return true;
+ case 3:
+ return false;
+ case 4:
+ return false;
+ case 5:
+ return false;
+ default:
+ return false;
+ }
+ }
+
+ @Override
+ public boolean isLiquidOutput(byte aSide) {
+ switch (aSide) {
+ case 0:
+ return false;
+ case 1:
+ return false;
+ case 2:
+ return false;
+ case 3:
+ return true;
+ case 4:
+ return true;
+ case 5:
+ return true;
+ default:
+ return true;
+ }
+ }
+
+ @Override
+ public int fill(FluidStack aFluid, boolean doFill) {
+ return super.fill(aFluid, doFill);
+ }
+
+ @Override
+ public FluidStack drain(int maxDrain, boolean doDrain) {
+ return super.drain(maxDrain, doDrain);
+ }
+
+ @Override
+ public int getTankPressure() {
+ return 500;
+ }
+
+ @Override
+ public boolean canFill(ForgeDirection aSide, Fluid aFluid) {
+ if (aSide == ForgeDirection.UP || aSide == ForgeDirection.DOWN) {
+ return false;
+ }
+ else {
+ return super.canFill(aSide, aFluid);
+ }
+ }
+
+ @Override
+ public boolean canDrain(ForgeDirection aSide, Fluid aFluid) {
+ if (aSide == ForgeDirection.UP || aSide == ForgeDirection.DOWN) {
+ return super.canDrain(aSide, aFluid);
+ }
+ else {
+ return false;
+ }
+ }
+
+ @Override
+ public int fill_default(ForgeDirection aSide, FluidStack aFluid, boolean doFill) {
+ if (aSide == ForgeDirection.UP || aSide == ForgeDirection.DOWN) {
+ return 0;
+ }
+ else {
+ return super.fill_default(aSide, aFluid, doFill);
+ }
+ }
+
+ @Override
+ public int fill(ForgeDirection aSide, FluidStack aFluid, boolean doFill) {
+ if (aSide == ForgeDirection.UP || aSide == ForgeDirection.DOWN) {
+ return super.fill(aSide, aFluid, doFill);
+ }
+ else {
+ return 0;
+ }
+ }
+
+ @Override
+ public FluidStack drain(ForgeDirection aSide, FluidStack aFluid, boolean doDrain) {
+ if (aSide == ForgeDirection.UP || aSide == ForgeDirection.DOWN) {
+ return super.drain(aSide, aFluid, doDrain);
+ }
+ else {
+ return null;
+ }
+ }
+
+ @Override
+ public FluidStack drain(ForgeDirection aSide, int maxDrain, boolean doDrain) {
+ if (aSide == ForgeDirection.UP || aSide == ForgeDirection.DOWN) {
+ return super.drain(aSide, maxDrain, doDrain);
+ }
+ else {
+ return null;
+ }
+ }
+
+ @Override
+ public boolean isOverclockerUpgradable() {
+ return true;
+ }
+
+ @Override
+ public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) {
+ // TODO Auto-generated method stub
+ return super.onRightclick(aBaseMetaTileEntity, aPlayer);
+ }
+
+ @Override
+ public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, byte aSide, float aX,
+ float aY, float aZ) {
+ // TODO Auto-generated method stub
+ return super.onRightclick(aBaseMetaTileEntity, aPlayer, aSide, aX, aY, aZ);
+ }
+
+ @Override
+ public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ // TODO Auto-generated method stub
+ return super.getServerGUI(aID, aPlayerInventory, aBaseMetaTileEntity);
+ }
+
+ @Override
+ public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ // TODO Auto-generated method stub
+ super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ);
+ }
+
+ @Override
+ public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public boolean canInsertItem(int aIndex, ItemStack aStack, int aSide) {
+ return false;
+ }
+
+ @Override
+ public void onExplosion() {
+ // TODO Auto-generated method stub
+ super.onExplosion();
+ }
+
+ @Override
+ public void startProcess() {
+ this.sendLoopStart((byte) 1);
+ }
+
+ @Override
+ public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) {
+ super.startSoundLoop(aIndex, aX, aY, aZ);
+ if (aIndex == 1) {
+ GT_Utility.doSoundAtClient((String) GregTech_API.sSoundList.get(Integer.valueOf(212)), 10, 1.0F, aX, aY,
+ aZ);
+ }
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_PocketFusion.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_PocketFusion.java
new file mode 100644
index 0000000000..6cae58ced2
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_PocketFusion.java
@@ -0,0 +1,704 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic;
+
+import java.util.ArrayList;
+import java.util.Random;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.GT_Values;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.MetaTileEntity;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_Utility;
+import gregtech.api.util.GTPP_Recipe;
+
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.math.MathUtils;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_DeluxeMachine;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidStack;
+
+public class GregtechMetaTileEntity_PocketFusion extends GT_MetaTileEntity_DeluxeMachine {
+
+ private boolean mCanProcessRecipe = false;
+ private boolean mCharging = false;
+ private long mChargeConsumed = 0;
+
+ private GT_Recipe mLastRecipe;
+ private long mEUStore;
+ private boolean mRunningOnLoad = false;
+ private boolean mMachine = false;
+ private int mEfficiency, mEfficiencyIncrease, mEfficiencyMax = 0;
+ private int mStartUpCheck = 100, mUpdate = 0;
+ private FluidStack[] mOutputFluids = null;
+
+ public GregtechMetaTileEntity_PocketFusion(int aID, String aName, String aNameRegional, int aTier) {
+ super(aID, aName, aNameRegional, aTier, 1, "It's like a midget Ra.", 1, 1, "PotionBrewer.png", "");
+ }
+
+ public GregtechMetaTileEntity_PocketFusion(String aName, int aTier, String aDescription,
+ ITexture[][][] aTextures, String aGUIName, String aNEIName) {
+ super(aName, aTier, 1, aDescription, aTextures, 1, 1, aGUIName, aNEIName);
+ }
+
+ @Override
+ public String[] getDescription() {
+ return new String[] { this.mDescription, "Not Very Fast, but not very big either.",
+ "Each side pair in/out puts to different slots.", "Top & Bottom Sides are Outputs.",
+ "Front & Back are Input Plasma 1.", "Sides are Input Plasma 2.", CORE.GT_Tooltip };
+ }
+
+ @Override
+ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaTileEntity_PocketFusion(this.mName, this.mTier, this.mDescription,
+ this.mTextures, this.mGUIName, this.mNEIName);
+ }
+
+ public int tier() {
+ return this.mTier;
+ }
+
+ public int tierOverclock() {
+ return this.mTier == 6 ? 0 : this.mTier == 7 ? 1 : 2;
+ }
+
+ private GT_RenderedTexture getCasingTexture() {
+ return new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Advanced);
+ }
+
+ @Override
+ public ITexture[][][] getTextureSet(final ITexture[] aTextures) {
+ final ITexture[][][] rTextures = new ITexture[10][17][];
+ for (byte i = -1; i < 16; i++) {
+ rTextures[0][i + 1] = this.getFront(i);
+ rTextures[1][i + 1] = this.getBack(i);
+ rTextures[2][i + 1] = this.getBottom(i);
+ rTextures[3][i + 1] = this.getTop(i);
+ rTextures[4][i + 1] = this.getSides(i);
+ rTextures[5][i + 1] = this.getFrontActive(i);
+ rTextures[6][i + 1] = this.getBackActive(i);
+ rTextures[7][i + 1] = this.getBottomActive(i);
+ rTextures[8][i + 1] = this.getTopActive(i);
+ rTextures[9][i + 1] = this.getSidesActive(i);
+ }
+ return rTextures;
+ }
+
+ @Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing,
+ final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+ return this.mTextures[(aActive ? 5 : 0) + (aSide == aFacing ? 0
+ : aSide == GT_Utility.getOppositeSide(aFacing) ? 1 : aSide == 0 ? 2 : aSide == 1 ? 3 : 4)][aColorIndex
+ + 1];
+ }
+
+ @Override
+ public GT_Recipe.GT_Recipe_Map getRecipeList() {
+ return GTPP_Recipe.GTPP_Recipe_Map.sSlowFusionRecipes;
+ }
+
+ @Override
+ public boolean isOutputFacing(final byte aSide) {
+ return aSide == this.getBaseMetaTileEntity().getBackFacing();
+ }
+
+ @Override
+ public boolean isFluidInputAllowed(FluidStack aFluid) {
+ return (aFluid.getFluid().getName().contains("plasma")) || (super.isFluidInputAllowed(aFluid));
+ }
+
+ @Override
+ public int getCapacity() {
+ return 32000;
+ }
+
+ @Override
+ public void abortProcess() {
+ super.abortProcess();
+ }
+
+ long mFusionPoint = 20000000L;
+
+ @Override
+ public int checkRecipe() {
+ Logger.MACHINE_INFO("Recipe Tick 1.");
+ if (!this.mCanProcessRecipe) {
+ Logger.MACHINE_INFO("Recipe Tick 1.1 - Cannot Process Recipe.");
+ if (this.mChargeConsumed < mFusionPoint) {
+ Logger.MACHINE_INFO("Recipe Tick 1.2 - Cannot Ignite Fusion, Charge too low.");
+ this.mCharging = true;
+ this.mCanProcessRecipe = false;
+ if (this.getBaseMetaTileEntity().decreaseStoredEnergyUnits((mFusionPoint / 100), false)) {
+ Logger.MACHINE_INFO("Recipe Tick 1.3 - Charging Internal storage. " + (mFusionPoint / 100) + "/"
+ + mFusionPoint);
+ mChargeConsumed += (mFusionPoint / 100);
+ }
+ }
+ else {
+ mChargeConsumed = 0;
+ this.mCharging = false;
+ this.mCanProcessRecipe = true;
+
+ }
+ }
+ else {
+ Logger.MACHINE_INFO("Recipe Tick 1.1 - Try to Process Recipe.");
+ if (checkRecipeMulti()) {
+ Logger.MACHINE_INFO("Recipe Tick 1.2 - Process Recipe was Successful.");
+ return 2;
+ }
+ }
+ Logger.MACHINE_INFO("Recipe Tick 2. - Process Recipe failed.");
+ return 0;
+ }
+
+ public ArrayList<FluidStack> getStoredFluids() {
+ ArrayList<FluidStack> mList = new ArrayList<FluidStack>();
+ mList.add(this.mFluid);
+ mList.add(this.mFluid2);
+ return mList;
+ }
+
+ public boolean checkRecipeMulti() {
+ ArrayList<FluidStack> tFluidList = getStoredFluids();
+ int tFluidList_sS = tFluidList.size();
+ for (int i = 0; i < tFluidList_sS - 1; i++) {
+ for (int j = i + 1; j < tFluidList_sS; j++) {
+ if (GT_Utility.areFluidsEqual(tFluidList.get(i), tFluidList.get(j))) {
+ if (tFluidList.get(i).amount >= tFluidList.get(j).amount) {
+ tFluidList.remove(j--);
+ tFluidList_sS = tFluidList.size();
+ }
+ else {
+ tFluidList.remove(i--);
+ tFluidList_sS = tFluidList.size();
+ break;
+ }
+ }
+ }
+ }
+ if (tFluidList.size() > 1) {
+ FluidStack[] tFluids = tFluidList.toArray(new FluidStack[tFluidList.size()]);
+ GT_Recipe tRecipe = getRecipeList().findRecipe(this.getBaseMetaTileEntity(), this.mLastRecipe, false,
+ GT_Values.V[8], tFluids, new ItemStack[] {});
+
+ if (tRecipe == null) {
+ return false;
+ }
+
+ if ((tRecipe == null && !mRunningOnLoad) || (tRecipe != null && maxEUStore() < tRecipe.mSpecialValue)) {
+ this.mLastRecipe = null;
+ Logger.MACHINE_INFO("Just plain bad.");
+ return false;
+ }
+ if (mRunningOnLoad || tRecipe.isRecipeInputEqual(true, tFluids, new ItemStack[] {})) {
+ this.mLastRecipe = tRecipe;
+ this.mEUt = (this.mLastRecipe.mEUt * overclock(this.mLastRecipe.mSpecialValue));
+ this.mMaxProgresstime = this.mLastRecipe.mDuration / overclock(this.mLastRecipe.mSpecialValue);
+
+ this.mEfficiencyIncrease = 10000;
+
+ this.mOutputFluids = this.mLastRecipe.mFluidOutputs;
+ mRunningOnLoad = false;
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public int overclock(int mStartEnergy) {
+ if (tierOverclock() == 1) {
+ return 1;
+ }
+ if (tierOverclock() == 2) {
+ return mStartEnergy < 160000000 ? 2 : 1;
+ }
+ return mStartEnergy < 160000000 ? 4 : mStartEnergy < 320000000 ? 2 : 1;
+ }
+
+ @Override
+ public boolean displaysItemStack() {
+ return false;
+ }
+
+ @Override
+ public boolean doesAutoOutputFluids() {
+ return true;
+ }
+
+ @Override
+ public boolean doesEmptyContainers() {
+ return true;
+ }
+
+ @Override
+ public boolean doesFillContainers() {
+ return true;
+ }
+
+ @Override
+ public long maxAmperesIn() {
+ return 16L;
+ }
+
+ @Override
+ public long maxEUStore() {
+ return Long.MAX_VALUE;
+ }
+
+ @Override
+ public void doExplosion(long aExplosionPower) {
+ super.doExplosion(aExplosionPower * 2);
+ }
+
+ @Override
+ public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ super.onPreTick(aBaseMetaTileEntity, aTick);
+ onRunningTickMulti();
+ if ((aBaseMetaTileEntity.isClientSide()) && (aBaseMetaTileEntity.isActive())
+ && (aBaseMetaTileEntity.getFrontFacing() != 1) && (aBaseMetaTileEntity.getCoverIDAtSide((byte) 1) == 0)
+ && (!aBaseMetaTileEntity.getOpacityAtSide((byte) 1))) {
+ if (MathUtils.randInt(0, 4) == 4) {
+ final Random tRandom = aBaseMetaTileEntity.getWorld().rand;
+ aBaseMetaTileEntity.getWorld().spawnParticle("magicCrit",
+ (aBaseMetaTileEntity.getXCoord() + 0.8F) - (tRandom.nextFloat() * 0.6F),
+ aBaseMetaTileEntity.getYCoord() + 0.3f + (tRandom.nextFloat() * 0.2F),
+ (aBaseMetaTileEntity.getZCoord() + 1.2F) - (tRandom.nextFloat() * 1.6F), 0.0D, 0.0D, 0.0D);
+ aBaseMetaTileEntity.getWorld().spawnParticle("magicCrit",
+ (aBaseMetaTileEntity.getXCoord() + 0.4F) - (tRandom.nextFloat() * 0.3F),
+ aBaseMetaTileEntity.getYCoord() + 0.2f + (tRandom.nextFloat() * 0.1F),
+ (aBaseMetaTileEntity.getZCoord() + 0.8F) - (tRandom.nextFloat() * 0.6F), 0.0D, 0.0D, 0.0D);
+ aBaseMetaTileEntity.getWorld().spawnParticle("magicCrit",
+ (aBaseMetaTileEntity.getXCoord() + 0.6F) - (tRandom.nextFloat() * 0.9F),
+ aBaseMetaTileEntity.getYCoord() + 0.4f + (tRandom.nextFloat() * 0.3F),
+ (aBaseMetaTileEntity.getZCoord() + 1.8F) - (tRandom.nextFloat() * 2.6F), 0.0D, 0.0D, 0.0D);
+ }
+ }
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ aNBT.setBoolean("mCanProcessRecipe", this.mCanProcessRecipe);
+ aNBT.setBoolean("mCharging", this.mCharging);
+ aNBT.setLong("mChargeConsumed", this.mChargeConsumed);
+ aNBT.setInteger("mEfficiency", this.mEfficiency);
+ aNBT.setInteger("mEfficiencyIncrease", this.mEfficiencyIncrease);
+ aNBT.setInteger("mEfficiencyMax", this.mEfficiencyMax);
+ aNBT.setInteger("mStartUpCheck", this.mStartUpCheck);
+ aNBT.setInteger("mUpdate", mUpdate);
+ aNBT.setInteger("mEfficiencyIncrease", mEfficiencyIncrease);
+ aNBT.setBoolean("mRunningOnLoad", this.mRunningOnLoad);
+ aNBT.setBoolean("mMachine", this.mMachine);
+ aNBT.setLong("mEUStore", this.mEUStore);
+ super.saveNBTData(aNBT);
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ if (mMaxProgresstime > 0)
+ mRunningOnLoad = true;
+ this.mCanProcessRecipe = aNBT.getBoolean("mCanProcessRecipe");
+ this.mCharging = aNBT.getBoolean("mCharging");
+ this.mChargeConsumed = aNBT.getLong("mChargeConsumed");
+ this.mEfficiency = aNBT.getInteger("mEfficiency");
+ this.mEfficiencyIncrease = aNBT.getInteger("mEfficiencyIncrease");
+ this.mEfficiencyMax = aNBT.getInteger("mEfficiencyMax");
+ this.mStartUpCheck = aNBT.getInteger("mStartUpCheck");
+ this.mUpdate = aNBT.getInteger("mUpdate");
+ this.mEfficiencyIncrease = aNBT.getInteger("mEfficiencyIncrease");
+ this.mEfficiencyIncrease = aNBT.getInteger("mEfficiencyIncrease");
+ this.mRunningOnLoad = aNBT.getBoolean("mRunningOnLoad");
+ this.mMachine = aNBT.getBoolean("mMachine");
+ this.mEUStore = aNBT.getLong("mEUStore");
+ super.loadNBTData(aNBT);
+ }
+
+ @Override
+ public String[] getInfoData() {
+ String tier = tier() == 6 ? "I" : tier() == 7 ? "II" : "III";
+ float plasmaOut = 0;
+ String fusionName = "";
+ int powerRequired = 0;
+ if (this.mLastRecipe != null) {
+ fusionName = this.mLastRecipe.mFluidOutputs[0].getLocalizedName() + " Fusion.";
+ powerRequired = this.mLastRecipe.mEUt;
+ if (this.mLastRecipe.getFluidOutput(0) != null) {
+ plasmaOut = (float) this.mLastRecipe.getFluidOutput(0).amount / (float) this.mLastRecipe.mDuration;
+ }
+ }
+
+ return new String[] { "Fusion Reactor MK " + tier, "EU Required: " + powerRequired + "EU/t",
+ "Stored EU: " + this.getEUVar() + " / " + maxEUStore(), "Plasma Output: " + plasmaOut + "L/t",
+ "Current Recipe: " + fusionName };
+ }
+
+ @Override
+ public boolean isGivingInformation() {
+ return true;
+ }
+
+ public ITexture[] getFront(final byte aColor) {
+ return new ITexture[] { this.getCasingTexture(), new GT_RenderedTexture(TexturesGtBlock.Overlay_MatterFab) };
+ }
+
+ public ITexture[] getBack(final byte aColor) {
+ return new ITexture[] { this.getCasingTexture(), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) };
+ }
+
+ public ITexture[] getBottom(final byte aColor) {
+ return new ITexture[] { new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS) };
+ }
+
+ public ITexture[] getTop(final byte aColor) {
+ return new ITexture[] { new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS) };
+ }
+
+ public ITexture[] getSides(final byte aColor) {
+ return new ITexture[] { this.getCasingTexture(),
+ new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Dimensional_Orange) };
+ }
+
+ public ITexture[] getFrontActive(final byte aColor) {
+ return new ITexture[] { this.getCasingTexture(),
+ new GT_RenderedTexture(TexturesGtBlock.Overlay_MatterFab_Active) };
+ }
+
+ public ITexture[] getBackActive(final byte aColor) {
+ return new ITexture[] { this.getCasingTexture(), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) };
+ }
+
+ public ITexture[] getBottomActive(final byte aColor) {
+ return new ITexture[] { new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS_YELLOW) };
+ }
+
+ public ITexture[] getTopActive(final byte aColor) {
+ return new ITexture[] { new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS_YELLOW) };
+ }
+
+ public ITexture[] getSidesActive(final byte aColor) {
+ return new ITexture[] { this.getCasingTexture(),
+ new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Dimensional_Blue) };
+ }
+
+ @Override
+ public void onMachineBlockUpdate() {
+ this.mUpdate = 50;
+ }
+
+ @Override
+ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ // super.onPostTick(aBaseMetaTileEntity, aTick);
+ if (aBaseMetaTileEntity.isServerSide()) {
+ // Logger.MACHINE_INFO("1");
+ if (mEfficiency < 0)
+ mEfficiency = 0;
+ if (mRunningOnLoad) {
+ Logger.MACHINE_INFO("2");
+ this.mEUStore = (int) aBaseMetaTileEntity.getStoredEU();
+ checkRecipeMulti();
+ }
+ if (--mUpdate == 0 || --mStartUpCheck == 0) {
+ Logger.MACHINE_INFO("3");
+ mMachine = true;
+ }
+ if (mStartUpCheck < 0) {
+ //Logger.MACHINE_INFO("4");
+ if (mMachine) {
+ //Logger.MACHINE_INFO("5");
+
+ if (aBaseMetaTileEntity.getStoredEU() + (2048 * tierOverclock()) < maxEUStore()) {
+ if (aBaseMetaTileEntity.increaseStoredEnergyUnits(2048 * tierOverclock(), true)) {
+ //Logger.MACHINE_INFO("5.5 A");
+ }
+ else {
+ //Logger.MACHINE_INFO("5.5 B");
+ }
+ }
+ if (this.mEUStore <= 0 && mMaxProgresstime > 0) {
+ Logger.MACHINE_INFO("6");
+ stopMachine();
+ this.mLastRecipe = null;
+ }
+ if (mMaxProgresstime > 0) {
+ Logger.MACHINE_INFO("7");
+ this.getBaseMetaTileEntity().decreaseStoredEnergyUnits(mEUt, true);
+ if (mMaxProgresstime > 0 && ++mProgresstime >= mMaxProgresstime) {
+ if (mOutputFluids != null)
+ for (FluidStack tStack : mOutputFluids)
+ if (tStack != null)
+ addOutput(tStack);
+ mEfficiency = Math.max(0, (mEfficiency + mEfficiencyIncrease));
+ mProgresstime = 0;
+ mMaxProgresstime = 0;
+ mEfficiencyIncrease = 0;
+ if (mOutputFluids != null && mOutputFluids.length > 0) {
+
+ }
+ this.mEUStore = (int) aBaseMetaTileEntity.getStoredEU();
+ if (aBaseMetaTileEntity.isAllowedToWork())
+ checkRecipeMulti();
+ }
+ }
+ else {
+ //Logger.MACHINE_INFO("8");
+ this.mEUStore = (int) aBaseMetaTileEntity.getStoredEU();
+ if (aTick % 100 == 0 || aBaseMetaTileEntity.hasWorkJustBeenEnabled()
+ || aBaseMetaTileEntity.hasInventoryBeenModified()) {
+ Logger.MACHINE_INFO("9");
+ // turnCasingActive(mMaxProgresstime > 0);
+ if (aBaseMetaTileEntity.isAllowedToWork()) {
+ Logger.MACHINE_INFO("10");
+ if (checkRecipeMulti()) {
+ Logger.MACHINE_INFO("11");
+ if (this.mEUStore < this.mLastRecipe.mSpecialValue) {
+ Logger.MACHINE_INFO("12");
+ mMaxProgresstime = 0;
+ // turnCasingActive(false);
+ }
+ aBaseMetaTileEntity.decreaseStoredEnergyUnits(this.mLastRecipe.mSpecialValue, true);
+ }
+ }
+ if (mMaxProgresstime <= 0)
+ mEfficiency = Math.max(0, mEfficiency - 1000);
+ }
+ }
+ }
+ else {
+ // turnCasingActive(false);
+ Logger.MACHINE_INFO("Bad");
+ this.mLastRecipe = null;
+ stopMachine();
+ }
+ }
+ Logger.MACHINE_INFO("Good | "+mMaxProgresstime);
+ aBaseMetaTileEntity.setActive(mMaxProgresstime > 0);
+ }
+ }
+
+ public boolean onRunningTickMulti() {
+ if (this.getBaseMetaTileEntity().isServerSide()) {
+ if (mEUt < 0) {
+ if (!drainEnergyInput(((long) -mEUt * 10000) / Math.max(1000, mEfficiency))) {
+ this.mLastRecipe = null;
+ stopMachine();
+ Logger.MACHINE_INFO("a1");
+ return false;
+ }
+ }
+ if (this.mEUStore <= 0) {
+ this.mLastRecipe = null;
+ stopMachine();
+ Logger.MACHINE_INFO("a2");
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public boolean drainEnergyInput(long aEU) {
+ return false;
+ }
+
+ public boolean addOutput(FluidStack aLiquid) {
+ if (aLiquid == null)
+ return false;
+ FluidStack copiedFluidStack = aLiquid.copy();
+ this.mOutputFluid = copiedFluidStack;
+ return false;
+ }
+
+ public void stopMachine() {
+ mEUt = 0;
+ mEfficiency = 0;
+ mProgresstime = 0;
+ mMaxProgresstime = 0;
+ mEfficiencyIncrease = 0;
+ getBaseMetaTileEntity().disableWorking();
+ }
+
+ @Override
+ public boolean isLiquidInput(byte aSide) {
+ switch (aSide) {
+ case 0:
+ return true;
+ case 1:
+ return true;
+ case 2:
+ return true;
+ case 3:
+ return false;
+ case 4:
+ return false;
+ case 5:
+ return false;
+ default:
+ return false;
+ }
+ }
+
+ @Override
+ public boolean isLiquidOutput(byte aSide) {
+ switch (aSide) {
+ case 0:
+ return false;
+ case 1:
+ return false;
+ case 2:
+ return false;
+ case 3:
+ return true;
+ case 4:
+ return true;
+ case 5:
+ return true;
+ default:
+ return true;
+ }
+ }
+
+ @Override
+ public int fill(FluidStack aFluid, boolean doFill) {
+ return super.fill(aFluid, doFill);
+ }
+
+ @Override
+ public FluidStack drain(int maxDrain, boolean doDrain) {
+ return super.drain(maxDrain, doDrain);
+ }
+
+ @Override
+ public int getTankPressure() {
+ return 500;
+ }
+
+ @Override
+ public boolean canFill(ForgeDirection aSide, Fluid aFluid) {
+ if (aSide == ForgeDirection.UP || aSide == ForgeDirection.DOWN) {
+ return false;
+ }
+ else {
+ return super.canFill(aSide, aFluid);
+ }
+ }
+
+ @Override
+ public boolean canDrain(ForgeDirection aSide, Fluid aFluid) {
+ if (aSide == ForgeDirection.UP || aSide == ForgeDirection.DOWN) {
+ return super.canDrain(aSide, aFluid);
+ }
+ else {
+ return false;
+ }
+ }
+
+ @Override
+ public int fill_default(ForgeDirection aSide, FluidStack aFluid, boolean doFill) {
+ if (aSide == ForgeDirection.UP || aSide == ForgeDirection.DOWN) {
+ return 0;
+ }
+ else {
+ return super.fill_default(aSide, aFluid, doFill);
+ }
+ }
+
+ @Override
+ public int fill(ForgeDirection aSide, FluidStack aFluid, boolean doFill) {
+ if (aSide == ForgeDirection.UP || aSide == ForgeDirection.DOWN) {
+ return super.fill(aSide, aFluid, doFill);
+ }
+ else {
+ return 0;
+ }
+ }
+
+ @Override
+ public FluidStack drain(ForgeDirection aSide, FluidStack aFluid, boolean doDrain) {
+ if (aSide == ForgeDirection.UP || aSide == ForgeDirection.DOWN) {
+ return super.drain(aSide, aFluid, doDrain);
+ }
+ else {
+ return null;
+ }
+ }
+
+ @Override
+ public FluidStack drain(ForgeDirection aSide, int maxDrain, boolean doDrain) {
+ if (aSide == ForgeDirection.UP || aSide == ForgeDirection.DOWN) {
+ return super.drain(aSide, maxDrain, doDrain);
+ }
+ else {
+ return null;
+ }
+ }
+
+ @Override
+ public boolean isOverclockerUpgradable() {
+ return true;
+ }
+
+ @Override
+ public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) {
+ // TODO Auto-generated method stub
+ return super.onRightclick(aBaseMetaTileEntity, aPlayer);
+ }
+
+ @Override
+ public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, byte aSide, float aX,
+ float aY, float aZ) {
+ // TODO Auto-generated method stub
+ return super.onRightclick(aBaseMetaTileEntity, aPlayer, aSide, aX, aY, aZ);
+ }
+
+ @Override
+ public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ // TODO Auto-generated method stub
+ return super.getServerGUI(aID, aPlayerInventory, aBaseMetaTileEntity);
+ }
+
+ @Override
+ public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ // TODO Auto-generated method stub
+ super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ);
+ }
+
+ @Override
+ public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public boolean canInsertItem(int aIndex, ItemStack aStack, int aSide) {
+ return false;
+ }
+
+ @Override
+ public void onExplosion() {
+ // TODO Auto-generated method stub
+ super.onExplosion();
+ }
+
+ @Override
+ public void startProcess() {
+ this.sendLoopStart((byte) 1);
+ }
+
+ @Override
+ public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) {
+ super.startSoundLoop(aIndex, aX, aY, aZ);
+ if (aIndex == 1) {
+ GT_Utility.doSoundAtClient((String) GregTech_API.sSoundList.get(Integer.valueOf(212)), 10, 1.0F, aX, aY,
+ aZ);
+ }
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_ReactorColdTrap.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_ReactorColdTrap.java
new file mode 100644
index 0000000000..85e2df42c9
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_ReactorColdTrap.java
@@ -0,0 +1,67 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic;
+
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.MetaTileEntity;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GTPP_Recipe;
+import gregtech.api.util.GT_Recipe;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.fluids.FluidStack;
+
+public class GregtechMetaTileEntity_ReactorColdTrap extends GT_MetaTileEntity_BasicMachine {
+
+ public GregtechMetaTileEntity_ReactorColdTrap(int aID, String aName, String aNameRegional, int aTier) {
+ super(aID, aName, aNameRegional, aTier, 1,
+ "Just like the Arctic", 2, 9, "Dehydrator.png", "",
+ new ITexture[]{
+ new GT_RenderedTexture(TexturesGtBlock.OVERLAY_REACTOR_COLDTRAP_SIDE_ACTIVE),
+ new GT_RenderedTexture(TexturesGtBlock.OVERLAY_REACTOR_COLDTRAP_SIDE),
+ new GT_RenderedTexture(TexturesGtBlock.OVERLAY_REACTOR_COLDTRAP_FRONT_ACTIVE),
+ new GT_RenderedTexture(TexturesGtBlock.OVERLAY_REACTOR_COLDTRAP_FRONT),
+ new GT_RenderedTexture(TexturesGtBlock.OVERLAY_REACTOR_COLDTRAP_TOP_ACTIVE),
+ new GT_RenderedTexture(TexturesGtBlock.OVERLAY_REACTOR_COLDTRAP_TOP),
+ new GT_RenderedTexture(TexturesGtBlock.OVERLAY_REACTOR_COLDTRAP_TOP_ACTIVE),
+ new GT_RenderedTexture(TexturesGtBlock.OVERLAY_REACTOR_COLDTRAP_TOP)
+ }
+ );
+ }
+
+ public GregtechMetaTileEntity_ReactorColdTrap(String aName, int aTier, String aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) {
+ super(aName, aTier, 1, aDescription, aTextures, 1, 1, aGUIName, aNEIName);
+ }
+
+ @Override
+ public String[] getDescription() {
+ return new String[]{this.mDescription, "Does not require ice cubes", CORE.GT_Tooltip};
+ }
+
+ @Override
+ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaTileEntity_ReactorColdTrap(this.mName, this.mTier, this.mDescription, this.mTextures, this.mGUIName, this.mNEIName);
+ }
+
+ @Override
+ public GT_Recipe.GT_Recipe_Map getRecipeList() {
+ return GTPP_Recipe.GTPP_Recipe_Map.sColdTrapRecipes;
+ }
+
+ @Override
+ public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ return (super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack)) && (getRecipeList().containsInput(aStack));
+ }
+
+ @Override
+ public boolean isFluidInputAllowed(FluidStack aFluid) {
+ return super.isFluidInputAllowed(aFluid);
+ }
+
+ @Override
+ public int getCapacity() {
+ return 16000 * Math.max(1, this.mTier);
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_ReactorProcessingUnit.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_ReactorProcessingUnit.java
new file mode 100644
index 0000000000..60e2ec8c0a
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_ReactorProcessingUnit.java
@@ -0,0 +1,67 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic;
+
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.MetaTileEntity;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GTPP_Recipe;
+import gregtech.api.util.GT_Recipe;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.fluids.FluidStack;
+
+public class GregtechMetaTileEntity_ReactorProcessingUnit extends GT_MetaTileEntity_BasicMachine {
+
+ public GregtechMetaTileEntity_ReactorProcessingUnit(int aID, String aName, String aNameRegional, int aTier) {
+ super(aID, aName, aNameRegional, aTier, 1,
+ "Processes Nuclear things", 2, 9, "Dehydrator.png", "",
+ new ITexture[]{
+ new GT_RenderedTexture(TexturesGtBlock.OVERLAY_REACTOR_PROCESSINGUNIT_SIDE_ACTIVE),
+ new GT_RenderedTexture(TexturesGtBlock.OVERLAY_REACTOR_PROCESSINGUNIT_SIDE),
+ new GT_RenderedTexture(TexturesGtBlock.OVERLAY_REACTOR_PROCESSINGUNIT_FRONT_ACTIVE),
+ new GT_RenderedTexture(TexturesGtBlock.OVERLAY_REACTOR_PROCESSINGUNIT_FRONT),
+ new GT_RenderedTexture(TexturesGtBlock.OVERLAY_REACTOR_PROCESSINGUNIT_TOP_ACTIVE),
+ new GT_RenderedTexture(TexturesGtBlock.OVERLAY_REACTOR_PROCESSINGUNIT_TOP),
+ new GT_RenderedTexture(TexturesGtBlock.OVERLAY_REACTOR_PROCESSINGUNIT_TOP_ACTIVE),
+ new GT_RenderedTexture(TexturesGtBlock.OVERLAY_REACTOR_PROCESSINGUNIT_TOP)
+ }
+ );
+ }
+
+ public GregtechMetaTileEntity_ReactorProcessingUnit(String aName, int aTier, String aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) {
+ super(aName, aTier, 1, aDescription, aTextures, 1, 1, aGUIName, aNEIName);
+ }
+
+ @Override
+ public String[] getDescription() {
+ return new String[]{this.mDescription, CORE.GT_Tooltip};
+ }
+
+ @Override
+ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaTileEntity_ReactorProcessingUnit(this.mName, this.mTier, this.mDescription, this.mTextures, this.mGUIName, this.mNEIName);
+ }
+
+ @Override
+ public GT_Recipe.GT_Recipe_Map getRecipeList() {
+ return GTPP_Recipe.GTPP_Recipe_Map.sReactorProcessingUnitRecipes;
+ }
+
+ @Override
+ public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ return (super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack)) && (getRecipeList().containsInput(aStack));
+ }
+
+ @Override
+ public boolean isFluidInputAllowed(FluidStack aFluid) {
+ return super.isFluidInputAllowed(aFluid);
+ }
+
+ @Override
+ public int getCapacity() {
+ return 8000 * Math.max(1, this.mTier);
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaWirelessCharger.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaWirelessCharger.java
new file mode 100644
index 0000000000..ffaa77a0be
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaWirelessCharger.java
@@ -0,0 +1,560 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.EntityPlayerMP;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+
+import gregtech.api.enums.GT_Values;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.api.objects.minecraft.BlockPos;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.minecraft.EntityUtils;
+import gtPlusPlus.core.util.minecraft.PlayerUtils;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMetaTileEntity;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import gtPlusPlus.xmod.gregtech.common.helpers.ChargingHelper;
+
+public class GregtechMetaWirelessCharger extends GregtechMetaTileEntity {
+
+ private boolean mHasBeenMapped = false;
+ private int mCurrentDimension = 0;
+ public int mMode = 0;
+
+ public GregtechMetaWirelessCharger(final int aID, final String aName, final String aNameRegional, final int aTier, final String aDescription, final int aSlotCount) {
+ super(aID, aName, aNameRegional, aTier, aSlotCount, aDescription);
+ }
+
+ public GregtechMetaWirelessCharger(final String aName, final int aTier, final String aDescription, final ITexture[][][] aTextures, final int aSlotCount) {
+ super(aName, aTier, aSlotCount, aDescription, aTextures);
+ }
+
+ @Override
+ public String[] getDescription() {
+ return new String[] {this.mDescription,
+ "3 Modes, Long-Range, Local and Mixed.",
+ "Long-Range: Can supply 2A of power to a single player up to "+(GT_Values.V[this.mTier]*4)+"m away.",
+ "Local: Can supply several Amps to each player within "+this.mTier*20+"m.",
+ "Mixed: Provides both 2A of long range and 1A per player locally.",
+ "Mixed mode is more conservative of power and as a result only",
+ "Gets half the distances each singular mode gets.",
+ CORE.GT_Tooltip
+ };
+ }
+
+ public int getTier(){
+ return this.mTier;
+ }
+
+ public int getMode(){
+ return this.mMode;
+ }
+
+ public int getDimensionID(){
+ return this.mCurrentDimension;
+ }
+
+ public Map<UUID, EntityPlayer> getLocalMap(){
+ return this.mLocalChargingMap;
+ }
+
+ public Map<EntityPlayer, UUID> getLongRangeMap(){
+ return this.mWirelessChargingMap;
+ }
+
+ @Override
+ public ITexture[][][] getTextureSet(final ITexture[] aTextures) {
+ final ITexture[][][] rTextures = new ITexture[10][17][];
+ for (byte i = -1; i < 16; i++) {
+ rTextures[0][i + 1] = this.getFront(i);
+ rTextures[1][i + 1] = this.getBack(i);
+ rTextures[2][i + 1] = this.getBottom(i);
+ rTextures[3][i + 1] = this.getTop(i);
+ rTextures[4][i + 1] = this.getSides(i);
+ rTextures[5][i + 1] = this.getFrontActive(i);
+ rTextures[6][i + 1] = this.getBackActive(i);
+ rTextures[7][i + 1] = this.getBottomActive(i);
+ rTextures[8][i + 1] = this.getTopActive(i);
+ rTextures[9][i + 1] = this.getSidesActive(i);
+ }
+ return rTextures;
+ }
+
+ @Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+ return this.mTextures[(aActive ? 5 : 0) + (aSide == aFacing ? 0 : aSide == GT_Utility.getOppositeSide(aFacing) ? 1 : aSide == 0 ? 2 : aSide == 1 ? 3 : 4)][aColorIndex + 1];
+ }
+
+
+ public ITexture[] getFront(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Screen_2)};
+ }
+
+
+ public ITexture[] getBack(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom)};
+ }
+
+
+ public ITexture[] getBottom(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom)};
+ }
+
+
+ public ITexture[] getTop(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom)};
+ }
+
+
+ public ITexture[] getSides(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom)};
+ }
+
+
+ public ITexture[] getFrontActive(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Screen_2)};
+ }
+
+
+ public ITexture[] getBackActive(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom)};
+ }
+
+
+ public ITexture[] getBottomActive(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom)};
+ }
+
+
+ public ITexture[] getTopActive(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom)};
+ }
+
+
+ public ITexture[] getSidesActive(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom)};
+ }
+
+ @Override
+ public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ mWirelessChargingMap.clear();
+ mLocalChargingMap.clear();
+
+ if (!this.getBaseMetaTileEntity().getWorld().playerEntities.isEmpty()){
+ for (Object mTempPlayer : this.getBaseMetaTileEntity().getWorld().playerEntities){
+ if (mTempPlayer instanceof EntityPlayer || mTempPlayer instanceof EntityPlayerMP){
+ EntityPlayer mTemp = (EntityPlayer) mTempPlayer;
+ ChargingHelper.removeValidPlayer(mTemp, this);
+ }
+ }
+ }
+
+ if (this.mMode >= 2){
+ this.mMode = 0;
+ }
+ else {
+ this.mMode++;
+ }
+ if (this.mMode == 0){
+ PlayerUtils.messagePlayer(aPlayer, "Now in Long-Range Charge Mode.");
+ }
+ else if (this.mMode == 1){
+ PlayerUtils.messagePlayer(aPlayer, "Now in Local Charge Mode.");
+ }
+ else {
+ PlayerUtils.messagePlayer(aPlayer, "Now in Mixed Charge Mode.");
+ }
+ super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ);
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaWirelessCharger(this.mName, this.mTier, this.mDescription, this.mTextures, this.mInventory.length);
+ }
+
+ @Override public boolean isSimpleMachine() {return false;}
+ @Override public boolean isElectric() {return true;}
+ @Override public boolean isValidSlot(final int aIndex) {return true;}
+ @Override public boolean isFacingValid(final byte aFacing) {return true;}
+ @Override public boolean isEnetInput() {return true;}
+ @Override public boolean isEnetOutput() {return false;}
+ @Override public boolean isInputFacing(final byte aSide) {return aSide!=this.getBaseMetaTileEntity().getFrontFacing();}
+ @Override public boolean isOutputFacing(final byte aSide) {return aSide==this.getBaseMetaTileEntity().getFrontFacing();}
+ @Override public boolean isTeleporterCompatible() {return false;}
+ @Override public long getMinimumStoredEU() {return 0;}
+ @Override public long maxEUStore() {return GT_Values.V[this.mTier]*128;}
+
+ @Override
+ public int getCapacity() {
+ return (int) (GT_Values.V[this.mTier]*32);
+ }
+
+ @Override
+ public long maxEUInput() {
+ return GT_Values.V[this.mTier];
+ }
+
+ @Override
+ public long maxEUOutput() {
+ return 0;
+ }
+
+ @Override
+ public long maxAmperesIn() {
+ if (this.mMode == 0){
+ return 2;
+ }
+ else if (this.mMode == 1){
+ return this.mLocalChargingMap.size()*8;
+ }
+ else {
+ return ((this.mLocalChargingMap.size()*4)+this.mWirelessChargingMap.size());
+ }
+ }
+
+ @Override
+ public long maxAmperesOut() {
+ return 0;
+ }
+ @Override public int rechargerSlotStartIndex() {return 0;}
+ @Override public int dechargerSlotStartIndex() {return 0;}
+ @Override public int rechargerSlotCount() {return 0;}
+ @Override public int dechargerSlotCount() {return 0;}
+ @Override public int getProgresstime() {return (int)this.getBaseMetaTileEntity().getUniversalEnergyStored();}
+ @Override public int maxProgresstime() {return (int)this.getBaseMetaTileEntity().getUniversalEnergyCapacity();}
+ @Override public boolean isAccessAllowed(final EntityPlayer aPlayer) {return true;}
+
+ @Override
+ public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) {
+ if (aBaseMetaTileEntity.isClientSide())
+ {
+ return true;
+ }
+ return true;
+ }
+
+ @Override
+ public boolean allowPullStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public String[] getInfoData() {
+ return new String[] {
+ this.getLocalName()};
+ }
+
+ @Override
+ public boolean isGivingInformation() {
+ return true;
+ }
+
+ @Override
+ public int[] getAccessibleSlotsFromSide(final int p_94128_1_) {
+ return new int[] {};
+ }
+
+ @Override
+ public boolean canInsertItem(final int p_102007_1_, final ItemStack p_102007_2_, final int p_102007_3_) {
+ return false;
+ }
+
+ @Override
+ public boolean canExtractItem(final int p_102008_1_, final ItemStack p_102008_2_, final int p_102008_3_) {
+ return false;
+ }
+
+ @Override
+ public int getSizeInventory() {
+ return 0;
+ }
+
+ @Override
+ public ItemStack getStackInSlot(final int p_70301_1_) {
+ return null;
+ }
+
+ @Override
+ public ItemStack decrStackSize(final int p_70298_1_, final int p_70298_2_) {
+ return null;
+ }
+
+ @Override
+ public ItemStack getStackInSlotOnClosing(final int p_70304_1_) {
+ return null;
+ }
+
+ @Override
+ public void setInventorySlotContents(final int p_70299_1_, final ItemStack p_70299_2_) {
+ }
+
+ @Override
+ public String getInventoryName() {
+ return null;
+ }
+
+ @Override
+ public boolean hasCustomInventoryName() {
+ return false;
+ }
+
+ @Override
+ public int getInventoryStackLimit() {
+ return 0;
+ }
+
+ @Override
+ public boolean isUseableByPlayer(final EntityPlayer p_70300_1_) {
+ return false;
+ }
+
+ @Override
+ public void openInventory() {
+ }
+
+ @Override
+ public void closeInventory() {
+ }
+
+ @Override
+ public boolean isItemValidForSlot(final int p_94041_1_, final ItemStack p_94041_2_) {
+ return false;
+ }
+
+ @Override
+ public boolean isOverclockerUpgradable() {
+ return false;
+ }
+
+ @Override
+ public boolean isTransformerUpgradable() {
+ return false;
+ }
+
+ @Override
+ public void saveNBTData(final NBTTagCompound aNBT) {
+ aNBT.setInteger("mMode", this.mMode);
+ aNBT.setInteger("mCurrentDimension", this.mCurrentDimension);
+ }
+
+ @Override
+ public void loadNBTData(final NBTTagCompound aNBT) {
+ this.mMode = aNBT.getInteger("mMode");
+ this.mCurrentDimension = aNBT.getInteger("mCurrentDimension");
+ }
+
+ @Override
+ public void onFirstTick(final IGregTechTileEntity aBaseMetaTileEntity) {
+ super.onFirstTick(aBaseMetaTileEntity);
+ }
+
+
+ private Map<EntityPlayer, UUID> mWirelessChargingMap = new HashMap<EntityPlayer, UUID>();
+ private Map<UUID, EntityPlayer> mLocalChargingMap = new HashMap<UUID, EntityPlayer>();
+
+ @Override
+ public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) {
+ super.onPostTick(aBaseMetaTileEntity, aTick);
+ if (this.getBaseMetaTileEntity().isServerSide()) {
+
+ if (this.mCurrentDimension != aBaseMetaTileEntity.getWorld().provider.dimensionId){
+ this.mCurrentDimension = aBaseMetaTileEntity.getWorld().provider.dimensionId;
+ }
+
+ if (!mHasBeenMapped && ChargingHelper.addEntry(getTileEntityPosition(), this)){
+ mHasBeenMapped = true;
+ }
+
+ if (aTick % 20 == 0 && mHasBeenMapped){
+ if (!aBaseMetaTileEntity.getWorld().playerEntities.isEmpty()){
+ for (Object mTempPlayer : aBaseMetaTileEntity.getWorld().playerEntities){
+ if (mTempPlayer instanceof EntityPlayer || mTempPlayer instanceof EntityPlayerMP){
+ EntityPlayer mTemp = (EntityPlayer) mTempPlayer;
+
+ if (this.mMode == 1 || this.mMode == 2){
+ int tempRange = (this.mMode == 1 ? this.mTier*20 : this.mTier*10);
+ if (getDistanceBetweenTwoPositions(getTileEntityPosition(), getPositionOfEntity(mTemp)) < tempRange){
+ if (!mLocalChargingMap.containsKey(mTemp.getPersistentID())){
+ mLocalChargingMap.put(mTemp.getPersistentID(), mTemp);
+ ChargingHelper.addValidPlayer(mTemp, this);
+ //PlayerUtils.messagePlayer(mTemp, "You have entered charging range. ["+tempRange+"m - Local].");
+ }
+ }
+ else {
+ if (mLocalChargingMap.containsKey(mTemp.getPersistentID())){
+ if (mLocalChargingMap.remove(mTemp.getPersistentID()) != null){
+ //PlayerUtils.messagePlayer(mTemp, "You have left charging range. ["+tempRange+"m - Local].");
+ ChargingHelper.removeValidPlayer(mTemp, this);
+ }
+ }
+ }
+ }
+ if (this.mMode == 0 || this.mMode == 2){
+ int tempRange = (int) (this.mMode == 0 ? 4*GT_Values.V[this.mTier] : 2*GT_Values.V[this.mTier]);
+ if (getDistanceBetweenTwoPositions(getTileEntityPosition(), getPositionOfEntity(mTemp)) <= tempRange){
+ if (!mWirelessChargingMap.containsKey(mTemp)){
+ if (mTemp.getDisplayName().equalsIgnoreCase(this.getBaseMetaTileEntity().getOwnerName())) {
+ mWirelessChargingMap.put(mTemp, mTemp.getPersistentID());
+ ChargingHelper.addValidPlayer(mTemp, this);
+ PlayerUtils.messagePlayer(mTemp, "You have entered charging range. ["+tempRange+"m - Long-Range].");
+ }
+ }
+ }
+ else {
+ if (mWirelessChargingMap.containsKey(mTemp)){
+ if (mWirelessChargingMap.remove(mTemp) != null){
+ PlayerUtils.messagePlayer(mTemp, "You have left charging range. ["+tempRange+"m - Long Range].");
+ ChargingHelper.removeValidPlayer(mTemp, this);
+ }
+ }
+ }
+ if (mWirelessChargingMap.containsKey(mTemp) && !mTemp.getDisplayName().equalsIgnoreCase(this.getBaseMetaTileEntity().getOwnerName())){
+ if (mWirelessChargingMap.remove(mTemp) != null){
+ ChargingHelper.removeValidPlayer(mTemp, this);
+ }
+ }
+ }
+ /*if (this.mMode == 0 || this.mMode == 2){
+ int tempRange = (int) (this.mMode == 0 ? 4*GT_Values.V[this.mTier] : 2*GT_Values.V[this.mTier]);
+ if (getDistanceBetweenTwoPositions(getTileEntityPosition(), getPositionOfEntity(mTemp)) < tempRange){
+ if (!mWirelessChargingMap.containsKey(mTemp)){
+ mWirelessChargingMap.put(mTemp, mTemp.getPersistentID());
+ PlayerUtils.messagePlayer(mTemp, "You have entered charging range. ["+tempRange+"m].");
+ ChargingHelper.addValidPlayer(mTemp, this);
+ }
+ }
+ else {
+ if (mWirelessChargingMap.containsKey(mTemp)){
+ if (mWirelessChargingMap.remove(mTemp) != null){
+ PlayerUtils.messagePlayer(mTemp, "You have left charging range. ["+tempRange+"m].");
+ ChargingHelper.removeValidPlayer(mTemp, this);
+ }
+ }
+ }
+ } */
+
+ }
+ }
+ }
+ }
+
+
+ }
+ }
+
+ public BlockPos getTileEntityPosition(){
+ return new BlockPos(this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord(), this.getBaseMetaTileEntity().getWorld());
+ }
+
+ public BlockPos getPositionOfEntity(Entity mEntity){
+ if (mEntity == null){
+ return null;
+ }
+ return EntityUtils.findBlockPosUnderEntity(mEntity);
+ }
+
+ public double getDistanceBetweenTwoPositions(BlockPos objectA, BlockPos objectB){
+ if (objectA == null || objectB == null){
+ return 0f;
+ }
+ int[] objectArray1 = new int[]{objectA.xPos, objectA.yPos, objectA.zPos};
+ int[] objectArray2 = new int[]{objectB.xPos, objectB.yPos, objectB.zPos};
+
+ final double distance = Math.sqrt(
+ (objectArray2[0]-objectArray1[0])*(objectArray2[0]-objectArray1[0])
+ +(objectArray2[1]-objectArray1[1])*(objectArray2[1]-objectArray1[1])
+ +(objectArray2[2]-objectArray1[2])*(objectArray2[2]-objectArray1[2]));
+ return distance;
+ }
+
+ @Override
+ public void onRemoval() {
+
+ ChargingHelper.removeEntry(getTileEntityPosition(), this);
+
+ mWirelessChargingMap.clear();
+ mLocalChargingMap.clear();
+ if (!this.getBaseMetaTileEntity().getWorld().playerEntities.isEmpty()){
+ for (Object mTempPlayer : this.getBaseMetaTileEntity().getWorld().playerEntities){
+ if (mTempPlayer instanceof EntityPlayer || mTempPlayer instanceof EntityPlayerMP){
+ EntityPlayer mTemp = (EntityPlayer) mTempPlayer;
+ ChargingHelper.removeValidPlayer(mTemp, this);
+ }
+ }
+ }
+
+
+ super.onRemoval();
+ }
+
+ @Override
+ public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity,
+ EntityPlayer aPlayer, byte aSide, float aX, float aY, float aZ) {
+
+ int tempRange;
+
+ if (this.mMode == 0 || this.mMode == 2){
+ tempRange = (int) (this.mMode == 0 ? 4*GT_Values.V[this.mTier] : 2*GT_Values.V[this.mTier]);
+ }
+ else {
+ tempRange = this.mMode == 1 ? this.mTier*20 : this.mTier*10;
+ }
+
+ if (this.mMode == 2){
+ PlayerUtils.messagePlayer(aPlayer, "Mixed Mode | Local: "+this.mTier*10+"m | Long: "+tempRange+"m");
+ }
+ else if (this.mMode == 1){
+ PlayerUtils.messagePlayer(aPlayer, "Local Mode: "+this.mTier*20+"m");
+
+ }
+ else {
+ PlayerUtils.messagePlayer(aPlayer, "Long-range Mode: "+tempRange+"m");
+
+ }
+
+ return super.onRightclick(aBaseMetaTileEntity, aPlayer, aSide, aX, aY, aZ);
+ }
+
+ @Override
+ public void onServerStart() {
+ mWirelessChargingMap.clear();
+ mLocalChargingMap.clear();
+ super.onServerStart();
+ }
+
+ @Override
+ public void onExplosion() {
+ ChargingHelper.removeEntry(getTileEntityPosition(), this);
+ super.onExplosion();
+ }
+
+ @Override
+ public void doExplosion(long aExplosionPower) {
+ ChargingHelper.removeEntry(getTileEntityPosition(), this);
+ super.doExplosion(aExplosionPower);
+ }
+
+ @Override
+ public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ if (!mHasBeenMapped && ChargingHelper.addEntry(getTileEntityPosition(), this)){
+ mHasBeenMapped = true;
+ }
+ super.onPreTick(aBaseMetaTileEntity, aTick);
+ }
+
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/misc/GMTE_AmazonPackager.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/misc/GMTE_AmazonPackager.java
new file mode 100644
index 0000000000..b8f24d6c5e
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/misc/GMTE_AmazonPackager.java
@@ -0,0 +1,323 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.misc;
+
+import java.util.ArrayList;
+
+import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
+import com.gtnewhorizon.structurelib.structure.StructureDefinition;
+import gregtech.api.enums.*;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.interfaces.tileentity.IHasWorldObjectAndCoords;
+import gregtech.api.metatileentity.implementations.*;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_ModHandler;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.api.objects.data.AutoMap;
+import gtPlusPlus.api.objects.minecraft.ItemStackData;
+import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.fluids.FluidStack;
+
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
+
+public class GMTE_AmazonPackager extends GregtechMeta_MultiBlockBase {
+
+ private long mVoltage;
+ private byte mTier;
+ private int mCasing;
+ private IStructureDefinition<GMTE_AmazonPackager> STRUCTURE_DEFINITION = null;
+
+ @Override
+ public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GMTE_AmazonPackager(mName);
+ }
+
+ public GMTE_AmazonPackager(int aID, String aName, String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ }
+
+ public GMTE_AmazonPackager(String aName) {
+ super(aName);
+ }
+
+ @Override
+ public String getMachineType() {
+ return "Packager";
+ }
+
+ @Override
+ public boolean hasSlotInGUI() {
+ return true;
+ }
+
+ @Override
+ public String getCustomGUIResourceName() {
+ return "Generic3By3";
+ }
+
+ @Override
+ public IStructureDefinition<GMTE_AmazonPackager> getStructureDefinition() {
+ if (STRUCTURE_DEFINITION == null) {
+ STRUCTURE_DEFINITION = StructureDefinition.<GMTE_AmazonPackager>builder()
+ .addShape(mName, transpose(new String[][]{
+ {"CCC", "CCC", "CCC"},
+ {"C~C", "C-C", "CCC"},
+ {"CCC", "CCC", "CCC"},
+ }))
+ .addElement(
+ 'C',
+ ofChain(
+ ofHatchAdder(
+ GMTE_AmazonPackager::addAmazonPackagerList, TAE.getIndexFromPage(2, 9), 1
+ ),
+ onElementPass(
+ x -> ++x.mCasing,
+ ofBlock(
+ ModBlocks.blockCasings3Misc, 9
+ )
+ )
+ )
+ )
+ .build();
+ }
+ return STRUCTURE_DEFINITION;
+ }
+
+
+
+ public final boolean addAmazonPackagerList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null) {
+ return false;
+ } else {
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ }
+ return false;
+ }
+
+ @Override
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
+ GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType(getMachineType())
+ .addInfo("Controller Block for the Amazon Warehouse")
+ .addInfo("This Multiblock is used for EXTREME packaging requirements")
+ .addInfo("Dust Schematics are inserted into the input busses")
+ .addInfo("If inserted into the controller, it is shared across all busses")
+ .addInfo("1x, 2x, 3x & Other Schematics are to be placed into the controller GUI slot")
+ .addInfo("Uncomparably fast compared to a single packager of the same tier")
+ .addInfo("Only uses 75% of the eu/t normally required")
+ .addInfo("Processes five items per voltage tier")
+ .addPollutionAmount(getPollutionPerSecond(null))
+ .addSeparator()
+ .beginStructureBlock(3, 3, 3, true)
+ .addController("Front center")
+ .addCasingInfo("Supply Depot Casings", 10)
+ .addInputBus("Any casing", 1)
+ .addOutputBus("Any casing", 1)
+ .addEnergyHatch("Any casing", 1)
+ .addMaintenanceHatch("Any casing", 1)
+ .addMufflerHatch("Any casing", 1)
+ .toolTipFinisher("GT++");
+ return tt;
+ }
+
+ private final void initFields() {
+ mVoltage = getMaxInputVoltage();
+ mTier = (byte) Math.max(1, GT_Utility.getTier(mVoltage));
+ }
+
+ @Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+ if (aSide == aFacing) {
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(TAE.getIndexFromPage(2, 1)), new GT_RenderedTexture(aActive ? TexturesGtBlock.Overlay_Machine_Controller_Default_Active : TexturesGtBlock.Overlay_Machine_Controller_Default)};
+ }
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(TAE.getIndexFromPage(2, 1))};
+ }
+
+
+
+ @Override
+ public GT_Recipe.GT_Recipe_Map getRecipeMap() {
+ return GT_Recipe.GT_Recipe_Map.sBoxinatorRecipes;
+ }
+
+ public void sortInputBusses() {
+ for (GT_MetaTileEntity_Hatch_InputBus h : this.mInputBusses) {
+ h.updateSlots();
+ }
+ }
+
+ @Override
+ public boolean checkRecipe(ItemStack aStack) {
+
+ //Just the best place to check this~
+ initFields();
+
+ ArrayList<ItemStack> tItems = getStoredInputs();
+ if (this.getGUIItemStack() != null) {
+ tItems.add(this.getGUIItemStack());
+ }
+ ArrayList<FluidStack> tFluids = getStoredFluids();
+ ItemStack[] tItemInputs = tItems.toArray(new ItemStack[tItems.size()]);
+ FluidStack[] tFluidInputs = tFluids.toArray(new FluidStack[tFluids.size()]);
+ boolean state = checkRecipeGeneric(tItemInputs, tFluidInputs, 5 * GT_Utility.getTier(this.getMaxInputVoltage()), 75, 500, 10000);
+
+
+ if (state) {
+ return true;
+ }
+ else {
+ tItems = getStoredInputs();
+ AutoMap<ItemStackData> mCompleted = new AutoMap<ItemStackData>();
+ AutoMap<ItemStackData> mSchematics = new AutoMap<ItemStackData>();
+ for (ItemStack tInputItem : tItems) {
+ if (tInputItem != null) {
+ if (ItemList.Schematic_1by1.isStackEqual((Object) tInputItem) || ItemList.Schematic_2by2.isStackEqual((Object) tInputItem) || ItemList.Schematic_3by3.isStackEqual((Object) tInputItem)) {
+ mSchematics.put(new ItemStackData(tInputItem));
+ }
+ }
+ }
+ if (mSchematics.size() > 0) {
+ for (ItemStackData g : mSchematics) {
+ for (ItemStack tInputItem : tItems) {
+ if (tInputItem != null) {
+ mCompleted.put(new ItemStackData(tInputItem));
+ checkRecipe(tInputItem, g.getStack());
+ }
+ }
+ }
+ }
+
+ return mCompleted != null && mCompleted.size() > 0;
+ }
+ }
+
+ public boolean checkRecipe(ItemStack inputStack, ItemStack schematicStack) {
+ if (GT_Utility.isStackValid((Object) inputStack) && GT_Utility.isStackValid((Object) schematicStack)
+ && GT_Utility.getContainerItem(inputStack, true) == null) {
+ ItemStack tOutputStack;
+ if (ItemList.Schematic_1by1.isStackEqual((Object) schematicStack)&& inputStack.stackSize >= 1) {
+ tOutputStack = GT_ModHandler.getRecipeOutput(new ItemStack[]{inputStack});
+ if (tOutputStack != null && this.allowPutStack(tOutputStack, schematicStack)) {
+ final ItemStack input = inputStack;
+ --input.stackSize;
+ this.mEUt = 32 * (1 << this.mTier - 1) * (1 << this.mTier - 1);
+ //this.mMaxProgresstime = 16 / (1 << this.mTier - 1);
+ this.mMaxProgresstime = 2;
+ this.addOutput(tOutputStack);
+ updateSlots();
+ return true;
+ }
+ return false;
+ } else if (ItemList.Schematic_2by2.isStackEqual((Object) schematicStack)
+ && inputStack.stackSize >= 4) {
+ tOutputStack = GT_ModHandler.getRecipeOutput(new ItemStack[]{inputStack,
+ inputStack, null, inputStack, inputStack});
+ if (tOutputStack != null && this.allowPutStack(tOutputStack, schematicStack)) {
+ final ItemStack input2 = inputStack;
+ input2.stackSize -= 4;
+ this.mEUt = 32 * (1 << this.mTier - 1) * (1 << this.mTier - 1);
+ //this.mMaxProgresstime = 32 / (1 << this.mTier - 1);
+ this.mMaxProgresstime = 4;
+ this.addOutput(tOutputStack);
+ updateSlots();
+ return true;
+ }
+ return false;
+ } else if (ItemList.Schematic_3by3.isStackEqual((Object) schematicStack)
+ && inputStack.stackSize >= 9) {
+ tOutputStack = GT_ModHandler.getRecipeOutput(new ItemStack[]{inputStack,
+ inputStack, inputStack, inputStack, inputStack,
+ inputStack, inputStack, inputStack, inputStack});
+ if (tOutputStack != null && this.allowPutStack(tOutputStack, schematicStack)) {
+ final ItemStack input3 = inputStack;
+ input3.stackSize -= 9;
+ this.mEUt = 32 * (1 << this.mTier - 1) * (1 << this.mTier - 1);
+ //this.mMaxProgresstime = 64 / (1 << this.mTier - 1);
+ this.mMaxProgresstime = 6;
+ this.addOutput(tOutputStack);
+ updateSlots();
+ return true;
+ }
+ return false;
+ }
+ }
+ return false;
+ }
+
+ public boolean allowPutStack(final ItemStack aStack, ItemStack schematicStack) {
+ //If Schematic Static is not 1x1, 2x2, 3x3
+ if (!ItemList.Schematic_1by1.isStackEqual((Object) schematicStack) && !ItemList.Schematic_2by2.isStackEqual((Object) schematicStack) && !ItemList.Schematic_3by3.isStackEqual((Object) schematicStack)) {
+ return GT_Recipe.GT_Recipe_Map.sBoxinatorRecipes.containsInput(aStack);
+ }
+ //Something
+ if (GT_Recipe.GT_Recipe_Map.sBoxinatorRecipes.findRecipe((IHasWorldObjectAndCoords) this.getBaseMetaTileEntity(), true, GT_Values.V[this.mTier],
+ (FluidStack[]) null, new ItemStack[]{GT_Utility.copyAmount(64L, new Object[]{aStack}), schematicStack}) != null) {
+ return true;
+ }
+ //1x1
+ if (ItemList.Schematic_1by1.isStackEqual((Object) schematicStack)
+ && GT_ModHandler.getRecipeOutput(new ItemStack[]{aStack}) != null) {
+ return true;
+ }
+ //2x2
+ if (ItemList.Schematic_2by2.isStackEqual((Object) schematicStack)
+ && GT_ModHandler.getRecipeOutput(new ItemStack[]{aStack, aStack, null, aStack, aStack}) != null) {
+ return true;
+ }
+ //3x3
+ if (ItemList.Schematic_3by3.isStackEqual((Object) schematicStack) && GT_ModHandler.getRecipeOutput(
+ new ItemStack[]{aStack, aStack, aStack, aStack, aStack, aStack, aStack, aStack, aStack}) != null) {
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ mCasing = 0;
+ return checkPiece(mName, 1, 1, 0) && mCasing >= 10 && checkHatch();
+ }
+
+ @Override
+ public int getMaxEfficiency(ItemStack p0) {
+ return 10000;
+ }
+
+ @Override
+ public int getPollutionPerSecond(ItemStack arg0){
+ return CORE.ConfigSwitches.pollutionPerSecondMultiPackager;
+ }
+
+ @Override
+ public int getMaxParallelRecipes() {
+ return 9;
+ }
+
+ @Override
+ public int getEuDiscountForParallelism() {
+ return 0;
+ }
+
+ @Override
+ public void construct(ItemStack stackSize, boolean hintsOnly) {
+ buildPiece(mName, stackSize, hintsOnly, 1, 1, 0);
+ }
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/misc/GregtechMTE_TeslaTower.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/misc/GregtechMTE_TeslaTower.java
new file mode 100644
index 0000000000..7ddf16b36f
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/misc/GregtechMTE_TeslaTower.java
@@ -0,0 +1,479 @@
+/*
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.misc;
+
+import static gregtech.api.enums.GT_Values.*;
+
+import java.util.*;
+
+import net.minecraft.block.Block;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityLiving;
+import net.minecraft.entity.item.EntityItem;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.world.World;
+
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.Materials;
+import gregtech.api.enums.TAE;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Utility;
+
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.api.objects.data.Pair;
+import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.entity.EntityTeslaTowerLightning;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.minecraft.MaterialUtils;
+import gtPlusPlus.core.util.minecraft.PlayerUtils;
+import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
+import net.minecraftforge.common.util.ForgeDirection;
+
+public class GregtechMTE_TeslaTower extends GregtechMeta_MultiBlockBase {
+
+ private Block casingBlock;
+ private int casingMeta;
+ private int frameMeta;
+ private int casingTextureIndex;
+
+ private ForgeDirection back;
+
+ private int xLoc, yLoc, zLoc;
+
+ protected int mRange;
+ */
+/**
+ * Machine Mode,
+ * {@value false} Attacks all entities,
+ * {@value true} Only attacks players.
+ *//*
+
+ protected volatile boolean mMode = false;
+
+ @Override
+ public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GregtechMTE_TeslaTower(mName);
+ }
+
+ public GregtechMTE_TeslaTower(int aID, String aName, String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ initFields();
+ }
+
+ public GregtechMTE_TeslaTower(String aName) {
+ super(aName);
+ initFields();
+ }
+
+ @Override
+ public String getMachineType() {
+ return "Weaponized Lighting Rod";
+ }
+
+ @Override
+ public boolean hasSlotInGUI() {
+ return false;
+ }
+
+ @Override
+ public String getCustomGUIResourceName() {
+ return null;
+ }
+
+ @Override
+ public String[] getTooltip() {
+ String casings = getCasingBlockItem().get(0).getDisplayName();
+ return new String[]{
+ "Controller Block for the Tesla Defence Tower Mk3200",
+ "Enemies within "+this.mRange+"m are blasted with a high energy plasma.",
+ "This uses 5,000,000EU per blast.",
+ "Can screwdriver to toggle mode between Players and all Entities.",
+ "Size(WxHxD): 3x7x3", "Controller (Front middle at bottom)",
+ "3x1x3 Base of " + casings,
+ "1x3x1 " + casings + " pillar (Center of base)",
+ "1x3x1 " + MaterialUtils.getMaterialName(getFrameMaterial()) + " Frame Boxes (Each pillar side and on top)",
+ "1x Maintenance Hatch (One of base casings)",
+ "1x " + VN[getMinTier()] + "+ Energy Hatch (Any bottom layer casing)"};
+ }
+
+ private final void initFields() {
+ casingBlock = ModBlocks.blockCasings2Misc;
+ casingMeta = getCasingBlockItem().get(0).getItemDamage();
+ int frameId = 4096 + getFrameMaterial().mMetaItemSubID;
+ frameMeta = GregTech_API.METATILEENTITIES[frameId] != null ? GregTech_API.METATILEENTITIES[frameId].getTileEntityBaseType() : W;
+ casingTextureIndex = getCasingTextureIndex();
+ mRange = 50;
+ }
+
+ @Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+ if (aSide == aFacing) {
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(getCasingTextureIndex()), new GT_RenderedTexture(aActive ? gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.Overlay_Machine_Controller_Advanced_Active : gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.Overlay_Machine_Controller_Advanced)};
+ }
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(getCasingTextureIndex())};
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ aNBT.setBoolean("mMode", this.mMode);
+ aNBT.setInteger("mRange", this.mRange);
+ super.saveNBTData(aNBT);
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ this.mMode = aNBT.getBoolean("mMode");
+ this.mRange = aNBT.getInteger("mRange");
+ super.loadNBTData(aNBT);
+ }
+
+ private boolean isEnergyEnough() {
+ if (this.getEUVar() >= 5000000){
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public boolean checkRecipe(ItemStack aStack) {
+ */
+/*if (!isEnergyEnough()) {
+ this.mProgresstime = 0;
+ this.mMaxProgresstime = 20;
+ this.getBaseMetaTileEntity().setActive(false);
+ stopMachine();
+ }
+ else {*//*
+*/
+/*
+ this.mProgresstime = 1;
+ this.mMaxProgresstime = 100;
+ this.getBaseMetaTileEntity().setActive(true);*//*
+
+ //}
+ return false;
+ }
+
+ @Override
+ public boolean checkMultiblock(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ updateCoordinates();
+ //check base layer
+ for (int xOff = -1 + back.offsetX; xOff <= 1 + back.offsetX; xOff++) {
+ for (int zOff = -1 + back.offsetZ; zOff <= 1 + back.offsetZ; zOff++) {
+ if (xOff == 0 && zOff == 0) continue;
+
+ IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xOff, 0, zOff);
+ if (!checkCasingBlock(xOff, 0, zOff)
+ && !addMaintenanceToMachineList(tTileEntity, casingTextureIndex)
+ && !addEnergyInputToMachineList(tTileEntity, casingTextureIndex)){
+ Logger.INFO("bad block");
+ return false;
+ }
+ }
+ }
+ if(!checkHatches()){
+ Logger.INFO("bad Hatches");
+ return false;
+ }
+ if (GT_Utility.getTier(getMaxInputVoltage()) < getMinTier()){
+ Logger.INFO("bad Voltage");
+ return false;
+ }
+ //check tower
+ for (int yOff = 1; yOff < 4; yOff++) {
+ if (!checkCasingBlock(back.offsetX, yOff, back.offsetZ)
+ || !checkFrameBlock(back.offsetX + 1, yOff, back.offsetZ)
+ || !checkFrameBlock(back.offsetX - 1, yOff, back.offsetZ)
+ || !checkFrameBlock(back.offsetX, yOff, back.offsetZ + 1)
+ || !checkFrameBlock(back.offsetX, yOff, back.offsetZ - 1)
+ || !checkFrameBlock(back.offsetX, yOff + 3, back.offsetZ)){
+ Logger.INFO("bad frame?");
+ return false;
+ }
+ }
+ Logger.INFO("good");
+ return true;
+ }
+
+ private void updateCoordinates() {
+ casingTextureIndex = getCasingTextureIndex();
+ mRange = 50;
+ xLoc = getBaseMetaTileEntity().getXCoord();
+ yLoc = getBaseMetaTileEntity().getYCoord();
+ zLoc = getBaseMetaTileEntity().getZCoord();
+ back = ForgeDirection.getOrientation(getBaseMetaTileEntity().getBackFacing());
+ }
+
+ protected boolean checkCasingBlock(int xOff, int yOff, int zOff) {
+ Logger.INFO("Looking For Casing.");
+ return checkBlockAndMetaOffset(xOff, yOff, zOff, casingBlock, casingMeta);
+ }
+ //meta of frame is getTileEntityBaseType; frame should be checked using its drops (possible a high weight operation)
+ protected boolean checkFrameBlock(int xOff, int yOff, int zOff) {
+ Logger.INFO("Looking For Frame.");
+ return checkBlockAndMetaOffset(xOff, yOff, zOff, GregTech_API.sBlockMachines, frameMeta);
+ }
+
+ protected boolean checkBlockAndMetaOffset(int xOff, int yOff, int zOff, Block block, int meta) {
+ return checkBlockAndMeta(xLoc + xOff, yLoc + yOff, zLoc + zOff, block, meta);
+ }
+
+ private boolean checkBlockAndMeta(int x, int y, int z, Block block, int meta) {
+ Logger.INFO("Found: "+getBaseMetaTileEntity().getBlock(x, y, z).getLocalizedName()+" | Meta: "+getBaseMetaTileEntity().getMetaID(x, y, z));
+ Logger.INFO("Expected: "+block.getLocalizedName()+" | Meta: "+meta);
+ return (meta == W || getBaseMetaTileEntity().getMetaID(x, y, z) == meta)
+ && getBaseMetaTileEntity().getBlock(x, y, z) == block;
+ }
+
+ @Override
+ public boolean isCorrectMachinePart(ItemStack aStack) {
+ return true;
+ }
+
+ @Override
+ public int getMaxEfficiency(ItemStack aStack) {
+ return 10000;
+ }
+
+ @Override
+ public int getPollutionPerTick(ItemStack aStack) {
+ return 0;
+ }
+
+ @Override
+ public int getDamageToComponent(ItemStack aStack) {
+ return 0;
+ }
+
+ @Override
+ public boolean explodesOnComponentBreak(ItemStack aStack) {
+ return false;
+ }
+
+ protected int getMinTier() {
+ return 7;
+ }
+
+ protected boolean checkHatches() {
+ return !mMaintenanceHatches.isEmpty() && !mEnergyHatches.isEmpty();
+ }
+
+ private Map<Pair<Long, Long>, Entity> mInRange = new HashMap<Pair<Long, Long>, Entity>();
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ try {
+ if (this.getBaseMetaTileEntity().isServerSide()){
+ if (this.mEnergyHatches.size() > 0) {
+ for (final GT_MetaTileEntity_Hatch_Energy tHatch : this.mEnergyHatches){
+ if (isValidMetaTileEntity(tHatch)) {
+ long mHT = tHatch.getBaseMetaTileEntity().getInputVoltage();
+ if (tHatch.getEUVar() >= mHT) {
+ for (int o=0;o<(tHatch.getEUVar()/mHT);o++){
+ //1A
+ if (this.getEUVar()<(this.maxEUStore()-mHT)){
+ tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(mHT, false);
+ this.setEUVar(this.getEUVar()+mHT);
+ }
+ //2A
+ if (this.getEUVar()<(this.maxEUStore()-mHT)){
+ tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(mHT, false);
+ this.setEUVar(this.getEUVar()+mHT);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (aTick % 10 == 0){
+ if (this.getEUVar() >= 5000000){
+ //Logger.INFO("Can Zap.");
+ this.getBaseMetaTileEntity().enableWorking();
+ this.getBaseMetaTileEntity().setActive(true);
+ if (this.mProgresstime <= 0){
+ this.mProgresstime++;
+ }
+ else if (this.mProgresstime >= 100){
+ this.mProgresstime = 0;
+ }
+ this.mMaxProgresstime = 10000;
+ }
+ //Logger.INFO("Allowed to be Working? "+this.getBaseMetaTileEntity().isAllowedToWork());
+ //Logger.INFO("Working? "+this.getBaseMetaTileEntity().isActive());
+ //Logger.INFO("Has Working just been enabled? "+this.getBaseMetaTileEntity().hasWorkJustBeenEnabled());
+ }
+
+
+ if (aTick % 20 == 0){
+ List<Object> o = aBaseMetaTileEntity.getWorld().loadedEntityList;
+ //Clean up old entities first
+ if (this.mInRange.size() > 0){
+ for (Entity j : this.mInRange.values()){
+ if (((Entity) j).getDistance(this.xLoc, this.yLoc, this.zLoc) > this.mRange){
+ mInRange.remove(new Pair<Long, Long>(((Entity) j).getUniqueID().getMostSignificantBits(), ((Entity) j).getUniqueID().getLeastSignificantBits()), (Entity) j);
+ }
+ }
+ }
+ //Add new entities
+ if (o.size() > 0){
+ for (Object r : o){
+ if (r instanceof Entity){
+ if (!((Entity) r).getUniqueID().equals(getOwner())){
+ if (((Entity) r).isEntityAlive() || r instanceof EntityLiving){
+ if (((Entity) r).getDistance(this.xLoc, this.yLoc, this.zLoc) <= this.mRange){
+ if (r instanceof EntityItem){
+ //Do nothing
+ }
+ else {
+ if (!this.mMode){
+ mInRange.put(new Pair<Long, Long>(((Entity) r).getUniqueID().getMostSignificantBits(), ((Entity) r).getUniqueID().getLeastSignificantBits()), (Entity) r);
+ }
+ else {
+ if (r instanceof EntityPlayer){
+ mInRange.put(new Pair<Long, Long>(((Entity) r).getUniqueID().getMostSignificantBits(), ((Entity) r).getUniqueID().getLeastSignificantBits()), (Entity) r);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ catch (Throwable r){
+
+ }
+ super.onPreTick(aBaseMetaTileEntity, aTick);
+ }
+
+ @Override
+ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ try {
+ if (this.getBaseMetaTileEntity().isServerSide()){
+ //Handle Progress Time
+ if (this.getEUVar() >= 0 && !this.getBaseMetaTileEntity().isAllowedToWork()){
+ this.mProgresstime = 20;
+ this.mMaxProgresstime = 40;
+ }
+ else if (this.getEUVar() >= 0 && this.getBaseMetaTileEntity().isAllowedToWork()){
+ this.mProgresstime = 20;
+ this.mMaxProgresstime = 40;
+ }
+
+ if (aTick % 10 == 0){
+ if (this.mInRange.size() > 0){
+ if (this.getEUVar() >= 5000000){
+
+ for (Entity f : mInRange.values()){
+ if (f instanceof EntityLiving){
+ int j1 = (int) f.posX;
+ int l1 = (int) f.posY;
+ int k1 = (int) f.posZ;
+ World world = aBaseMetaTileEntity.getWorld();
+
+ if (f.isEntityAlive() && !f.getUniqueID().equals(getOwner())){
+ //if (world.canLightningStrikeAt(j1, l1+1, k1)){
+ //if (isEnergyEnough() && world.addWeatherEffect(new EntityTeslaTowerLightning(world, (double)j1, (double)l1, (double)k1))){
+ if (isEnergyEnough() && world.addWeatherEffect(new EntityTeslaTowerLightning(world, (double)j1, (double)l1, (double)k1, f, getOwner()))){
+ if (f == null || f.isDead || !f.isEntityAlive()){
+ this.mInRange.remove(new Pair<Long, Long>(f.getUniqueID().getMostSignificantBits(), f.getUniqueID().getLeastSignificantBits()));
+ }
+ this.setEUVar(this.getEUVar()-5000000);
+ }
+ //}
+ }
+
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ catch (Throwable r){
+
+ }
+ super.onPostTick(aBaseMetaTileEntity, aTick);
+ }
+
+
+ protected GregtechItemList getCasingBlockItem() {
+ return GregtechItemList.Casing_TeslaTower;
+ }
+
+ protected Materials getFrameMaterial() {
+ */
+/*casingBlock = getCasingBlockItem().getBlock();
+ casingMeta = getCasingBlockItem().get(0).getItemDamage();
+ int frameId = 4096 + getFrameMaterial().mMetaItemSubID;
+ frameMeta = GregTech_API.METATILEENTITIES[frameId] != null ? GregTech_API.METATILEENTITIES[frameId].getTileEntityBaseType() : W;
+ *//*
+return Materials.get("TungstenCarbide");
+ }
+
+ protected int getCasingTextureIndex() {
+ return TAE.GTPP_INDEX(30);
+ }
+
+ public UUID getOwner(){
+ return PlayerUtils.getPlayersUUIDByName(this.getBaseMetaTileEntity().getOwnerName());
+ }
+
+ @Override
+ public boolean isEnetInput() {
+ return false;
+ }
+
+ @Override
+ public long maxAmperesIn() {
+ return 32;
+ }
+
+ @Override
+ public long maxEUInput() {
+ return 131072;
+ }
+
+ @Override
+ public long maxEUStore() {
+ return Integer.MAX_VALUE;
+ }
+
+ @Override
+ public void onModeChangeByScrewdriver(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ mMode = Utils.invertBoolean(mMode);
+ this.mInRange.clear();
+ if (mMode){
+ PlayerUtils.messagePlayer(aPlayer, "[Tesla Tower] Now only targetting players.");
+ }
+ else {
+ PlayerUtils.messagePlayer(aPlayer, "[Tesla Tower] Targetting all types of entities.");
+ }
+ }
+
+ @Override
+ public int getMaxParallelRecipes() {
+ return 0;
+ }
+
+ @Override
+ public int getEuDiscountForParallelism() {
+ return 0;
+ }
+
+
+}
+*/
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialAlloySmelter.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialAlloySmelter.java
new file mode 100644
index 0000000000..df01d01679
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialAlloySmelter.java
@@ -0,0 +1,403 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing;
+
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
+import static gregtech.api.util.GT_StructureUtility.ofCoil;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
+import static gtPlusPlus.core.util.data.ArrayUtils.removeNulls;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
+import com.gtnewhorizon.structurelib.structure.StructureDefinition;
+import gregtech.api.enums.HeatingCoilLevel;
+import gregtech.api.metatileentity.implementations.*;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
+import gtPlusPlus.core.lib.CORE;
+import org.apache.commons.lang3.ArrayUtils;
+
+import gregtech.api.enums.TAE;
+import gregtech.api.enums.Textures;
+import gregtech.api.gui.GT_GUIContainer_MultiMachine;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.fluids.FluidStack;
+
+public class GregtechMetaTileEntity_IndustrialAlloySmelter extends GregtechMeta_MultiBlockBase {
+
+ public static int CASING_TEXTURE_ID;
+ private HeatingCoilLevel mHeatingCapacity;
+ private int mLevel = 0;
+ private int mCasing;
+ private IStructureDefinition<GregtechMetaTileEntity_IndustrialAlloySmelter> STRUCTURE_DEFINITION = null;
+
+ public GregtechMetaTileEntity_IndustrialAlloySmelter(int aID, String aName, String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ CASING_TEXTURE_ID = TAE.getIndexFromPage(2, 1);
+ }
+
+ public GregtechMetaTileEntity_IndustrialAlloySmelter(String aName) {
+ super(aName);
+ CASING_TEXTURE_ID = TAE.getIndexFromPage(2, 1);
+ }
+
+ public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaTileEntity_IndustrialAlloySmelter(this.mName);
+ }
+
+ public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
+ if (aSide == aFacing) {
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(CASING_TEXTURE_ID), new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_MULTI_SMELTER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_MULTI_SMELTER)};
+ }
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(CASING_TEXTURE_ID)};
+ }
+
+ public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "MultiFurnace.png");
+ }
+
+ public GT_Recipe.GT_Recipe_Map getRecipeMap() {
+ return GT_Recipe.GT_Recipe_Map.sAlloySmelterRecipes;
+ }
+
+ public boolean isCorrectMachinePart(ItemStack aStack) {
+ return true;
+ }
+
+ public int getMaxEfficiency(ItemStack aStack) {
+ return 10000;
+ }
+
+ public int getPollutionPerSecond(ItemStack aStack) {
+ return CORE.ConfigSwitches.pollutionPerSecondMultiIndustrialAlloySmelter;
+ }
+
+ public int getDamageToComponent(ItemStack aStack) {
+ return 0;
+ }
+
+ public boolean explodesOnComponentBreak(ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public boolean hasSlotInGUI() {
+ return false;
+ }
+
+ @Override
+ public String getCustomGUIResourceName() {
+ return null;
+ }
+
+ @Override
+ public String getMachineType() {
+ return "Alloy Smelter";
+ }
+
+ @Override
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
+ GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType(getMachineType())
+ .addInfo("Controller Block for the Industrial Alloy Smelter")
+ .addInfo("Gains one parallel per voltage tier")
+ .addInfo("Gains one multiplier per coil tier")
+ .addInfo("parallel = tier * coil tier")
+ .addInfo("Gains 5% speed bonus per coil tier")
+ .addPollutionAmount(getPollutionPerSecond(null))
+ .addSeparator()
+ .beginStructureBlock(3, 5, 3, true)
+ .addController("Bottom center")
+ .addCasingInfo("Inconel Reinforced Casings", 10)
+ .addCasingInfo("Integral Encasement V", 8)
+ .addCasingInfo("Heating Coils", 16)
+ .addInputBus("Any Inconel Reinforced Casing", 1)
+ .addOutputBus("Any Inconel Reinforced Casing", 1)
+ .addEnergyHatch("Any Inconel Reinforced Casing", 1)
+ .addMaintenanceHatch("Any Inconel Reinforced Casing", 1)
+ .addMufflerHatch("Any Inconel Reinforced Casing", 1)
+ .toolTipFinisher(CORE.GT_Tooltip_Builder);
+ return tt;
+ }
+
+ @Override
+ public IStructureDefinition<GregtechMetaTileEntity_IndustrialAlloySmelter> getStructureDefinition() {
+ if (STRUCTURE_DEFINITION == null) {
+ STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_IndustrialAlloySmelter>builder()
+ .addShape(mName, transpose(new String[][]{
+ {"CCC", "CCC", "CCC"},
+ {"HHH", "H-H", "HHH"},
+ {"VVV", "V-V", "VVV"},
+ {"HHH", "H-H", "HHH"},
+ {"C~C", "CCC", "CCC"},
+ }))
+ .addElement(
+ 'C',
+ ofChain(
+ ofHatchAdder(
+ GregtechMetaTileEntity_IndustrialAlloySmelter::addIndustrialAlloySmelterList, CASING_TEXTURE_ID, 1
+ ),
+ onElementPass(
+ x -> ++x.mCasing,
+ ofBlock(
+ ModBlocks.blockCasings3Misc, 1
+ )
+ )
+ )
+ )
+ .addElement(
+ 'H',
+ ofCoil(
+ GregtechMetaTileEntity_IndustrialAlloySmelter::setCoilLevel, GregtechMetaTileEntity_IndustrialAlloySmelter::getCoilLevel
+ )
+ )
+ .addElement(
+ 'V',
+ ofBlock(
+ ModBlocks.blockCasingsTieredGTPP, 4
+ )
+ )
+ .build();
+ }
+ return STRUCTURE_DEFINITION;
+ }
+
+ public final boolean addIndustrialAlloySmelterList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null) {
+ return false;
+ } else {
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public void construct(ItemStack stackSize, boolean hintsOnly) {
+ buildPiece(mName, stackSize, hintsOnly, 1, 4, 0);
+ }
+
+ @Override
+ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ mCasing = 0;
+ mLevel = 0;
+ setCoilLevel(HeatingCoilLevel.None);
+ return checkPiece(mName, 1, 4, 0) && mCasing >= 10 && getCoilLevel() != HeatingCoilLevel.None && (mLevel = getCoilLevel().getTier() + 1) > 0 && checkHatch();
+ }
+
+ @Override
+ public int getMaxParallelRecipes() {
+ return (this.mLevel * GT_Utility.getTier(this.getMaxInputVoltage()));
+ }
+
+ @Override
+ public int getEuDiscountForParallelism() {
+ return 100;
+ }
+
+
+ @Override
+ public boolean checkRecipe(ItemStack aStack) {
+ FluidStack[] tFluids = getStoredFluids().toArray(new FluidStack[0]);
+ for (GT_MetaTileEntity_Hatch_InputBus tBus : mInputBusses) {
+ ArrayList<ItemStack> tInputs = new ArrayList<>();
+ if (isValidMetaTileEntity(tBus)) {
+ for (int i = tBus.getBaseMetaTileEntity().getSizeInventory() - 1; i >= 0; i--) {
+ if (tBus.getBaseMetaTileEntity().getStackInSlot(i) != null) {
+ tInputs.add(tBus.getBaseMetaTileEntity().getStackInSlot(i));
+ }
+ }
+ }
+ if (tInputs.size() > 1) {
+ ItemStack[] tItems = tInputs.toArray(new ItemStack[0]);
+ if (checkRecipeGeneric(tItems, tFluids, getMaxParallelRecipes(), 100, 5 * this.mLevel, 10000)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public boolean checkRecipeGeneric(ItemStack[] aItemInputs, FluidStack[] aFluidInputs, int aMaxParallelRecipes,
+ int aEUPercent, int aSpeedBonusPercent, int aOutputChanceRoll) {
+ // Based on the Processing Array. A bit overkill, but very flexible.
+
+ // Reset outputs and progress stats
+ this.mEUt = 0;
+ this.mMaxProgresstime = 0;
+ this.mOutputItems = new ItemStack[] {};
+ this.mOutputFluids = new FluidStack[] {};
+
+ long tVoltage = getMaxInputVoltage();
+ byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage));
+ long tEnergy = getMaxInputEnergy();
+ Logger.WARNING("Running checkRecipeGeneric(0)");
+
+ GT_Recipe tRecipe = this.getRecipeMap().findRecipe(getBaseMetaTileEntity(), mLastRecipe, false,
+ gregtech.api.enums.GT_Values.V[tTier], aFluidInputs, aItemInputs);
+
+ Logger.WARNING("Running checkRecipeGeneric(1)");
+ // Remember last recipe - an optimization for findRecipe()
+ this.mLastRecipe = tRecipe;
+
+ if (tRecipe == null) {
+ Logger.WARNING("BAD RETURN - 1");
+ return false;
+ }
+
+ aMaxParallelRecipes = this.canBufferOutputs(tRecipe, aMaxParallelRecipes);
+ if (aMaxParallelRecipes == 0) {
+ Logger.WARNING("BAD RETURN - 2");
+ return false;
+ }
+
+ // EU discount
+ float tRecipeEUt = (tRecipe.mEUt * aEUPercent) / 100.0f;
+ int tHeatCapacityDivTiers = (int) mHeatingCapacity.getHeat() / 900;
+ float tTotalEUt = 0.0f;
+
+ int parallelRecipes = 0;
+ // Count recipes to do in parallel, consuming input items and fluids and
+ // considering input voltage limits
+ for (; parallelRecipes < aMaxParallelRecipes && tTotalEUt < (tEnergy - tRecipeEUt); parallelRecipes++) {
+ if (!tRecipe.isRecipeInputEqual(true, aFluidInputs, aItemInputs)) {
+ Logger.WARNING("Broke at " + parallelRecipes + ".");
+ break;
+ }
+ Logger.WARNING("Bumped EU from " + tTotalEUt + " to " + (tTotalEUt + tRecipeEUt) + ".");
+ tTotalEUt += tRecipeEUt;
+ }
+
+ if (parallelRecipes == 0) {
+ Logger.WARNING("BAD RETURN - 3");
+ return false;
+ }
+
+ // -- Try not to fail after this point - inputs have already been consumed! --
+
+ // Convert speed bonus to duration multiplier
+ // e.g. 100% speed bonus = 200% speed = 100%/200% = 50% recipe duration.
+ aSpeedBonusPercent = mLevel * 5;
+ float tTimeFactor = 100.0f / (100.0f + aSpeedBonusPercent);
+ this.mMaxProgresstime = (int) (tRecipe.mDuration * tTimeFactor);
+ int rInt = 2;
+
+ this.mEUt = (int) Math.max(Math.ceil(tTotalEUt), 1);
+
+ this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
+ this.mEfficiencyIncrease = 10000;
+
+ // Overclock
+ if (this.mEUt <= 16) {
+ this.mEUt = (this.mEUt * (1 << tTier - 1) * (1 << tTier - 1));
+ this.mMaxProgresstime = (this.mMaxProgresstime / (1 << tTier - 1));
+ } else {
+ while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) {
+ this.mEUt *= 4;
+ this.mMaxProgresstime /= (tHeatCapacityDivTiers >= rInt ? 4 : 2);
+ }
+ }
+ if (this.mEUt > 0) {
+ this.mEUt = (-this.mEUt);
+ }
+
+ this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
+
+ // Collect fluid outputs
+ FluidStack[] tOutputFluids = new FluidStack[tRecipe.mFluidOutputs.length];
+ for (int h = 0; h < tRecipe.mFluidOutputs.length; h++) {
+ if (tRecipe.getFluidOutput(h) != null) {
+ tOutputFluids[h] = tRecipe.getFluidOutput(h).copy();
+ tOutputFluids[h].amount *= parallelRecipes;
+ }
+ }
+
+ // Collect output item types
+ ItemStack[] tOutputItems = new ItemStack[tRecipe.mOutputs.length];
+ for (int h = 0; h < tRecipe.mOutputs.length; h++) {
+ if (tRecipe.getOutput(h) != null) {
+ tOutputItems[h] = tRecipe.getOutput(h).copy();
+ tOutputItems[h].stackSize = 0;
+ }
+ }
+
+ // Set output item stack sizes (taking output chance into account)
+ for (int f = 0; f < tOutputItems.length; f++) {
+ if (tRecipe.mOutputs[f] != null && tOutputItems[f] != null) {
+ for (int g = 0; g < parallelRecipes; g++) {
+ if (getBaseMetaTileEntity().getRandomNumber(aOutputChanceRoll) < tRecipe.getOutputChance(f))
+ tOutputItems[f].stackSize += tRecipe.mOutputs[f].stackSize;
+ }
+ }
+ }
+
+ tOutputItems = removeNulls(tOutputItems);
+
+ // Sanitize item stack size, splitting any stacks greater than max stack size
+ List<ItemStack> splitStacks = new ArrayList<ItemStack>();
+ for (ItemStack tItem : tOutputItems) {
+ while (tItem.getMaxStackSize() < tItem.stackSize) {
+ ItemStack tmp = tItem.copy();
+ tmp.stackSize = tmp.getMaxStackSize();
+ tItem.stackSize = tItem.stackSize - tItem.getMaxStackSize();
+ splitStacks.add(tmp);
+ }
+ }
+
+ if (splitStacks.size() > 0) {
+ ItemStack[] tmp = new ItemStack[splitStacks.size()];
+ tmp = splitStacks.toArray(tmp);
+ tOutputItems = ArrayUtils.addAll(tOutputItems, tmp);
+ }
+
+ // Strip empty stacks
+ List<ItemStack> tSList = new ArrayList<ItemStack>();
+ for (ItemStack tS : tOutputItems) {
+ if (tS.stackSize > 0)
+ tSList.add(tS);
+ }
+ tOutputItems = tSList.toArray(new ItemStack[tSList.size()]);
+
+ // Commit outputs
+ this.mOutputItems = tOutputItems;
+ this.mOutputFluids = tOutputFluids;
+ updateSlots();
+
+ // Play sounds (GT++ addition - GT multiblocks play no sounds)
+ startProcess();
+
+ Logger.WARNING("GOOD RETURN - 1");
+ return true;
+
+ }
+
+ public HeatingCoilLevel getCoilLevel() {
+ return mHeatingCapacity;
+ }
+
+ public void setCoilLevel(HeatingCoilLevel aCoilLevel) {
+ mHeatingCapacity = aCoilLevel;
+ }
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialArcFurnace.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialArcFurnace.java
new file mode 100644
index 0000000000..35a92d5be3
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialArcFurnace.java
@@ -0,0 +1,320 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing;
+
+import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
+import com.gtnewhorizon.structurelib.structure.StructureDefinition;
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.TAE;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.implementations.*;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import gtPlusPlus.core.util.minecraft.PlayerUtils;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.EnumChatFormatting;
+
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
+
+public class GregtechMetaTileEntity_IndustrialArcFurnace
+extends GregtechMeta_MultiBlockBase {
+
+ //862
+ private static final int mCasingTextureID = TAE.getIndexFromPage(3, 3);
+ public static String mCasingName = "Tempered Arc Furnace Casing";
+ private boolean mPlasmaMode = false;
+ private int mSize = 0;
+ private int mCasing;
+ private IStructureDefinition<GregtechMetaTileEntity_IndustrialArcFurnace> STRUCTURE_DEFINITION = null;
+
+ public GregtechMetaTileEntity_IndustrialArcFurnace(final int aID, final String aName, final String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings4Misc, 3);
+ }
+
+ public GregtechMetaTileEntity_IndustrialArcFurnace(final String aName) {
+ super(aName);
+ mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings4Misc, 3);
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaTileEntity_IndustrialArcFurnace(this.mName);
+ }
+
+ @Override
+ public String getMachineType() {
+ return "(Plasma/Electric) Arc Furnace";
+ }
+
+ @Override
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
+ if (mCasingName.toLowerCase().contains(".name")) {
+ mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings4Misc, 3);
+ }
+ GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType(getMachineType())
+ .addInfo("Controller Block for Industrial Arc Furnace")
+ .addInfo("250% faster than using single block machines of the same voltage")
+ .addInfo("Processes 8 items per voltage tier")
+ .addInfo("Max Size required to process Plasma recipes")
+ .addPollutionAmount(getPollutionPerSecond(null))
+ .addSeparator()
+ .addController("Top center")
+ .addStructureInfo("Size: nx3xn [WxHxL] (Hollow)")
+ .addStructureInfo("n can be 3, 5 or 7")
+ .addCasingInfo(mCasingName, 10)
+ .addInputBus("Any Casing", 1)
+ .addOutputBus("Any Casing", 1)
+ .addInputHatch("Any Casing", 1)
+ .addOutputHatch("Any Casing", 1)
+ .addEnergyHatch("Any Casing", 1)
+ .addMaintenanceHatch("Any Casing", 1)
+ .addMufflerHatch("Any Casing", 1)
+ .toolTipFinisher(CORE.GT_Tooltip_Builder);
+ return tt;
+ }
+
+ @Override
+ public IStructureDefinition<GregtechMetaTileEntity_IndustrialArcFurnace> getStructureDefinition() {
+ if (STRUCTURE_DEFINITION == null) {
+ STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_IndustrialArcFurnace>builder()
+ .addShape(mName + "3", new String[][]{
+ {"CCC", "C~C", "CCC"},
+ {"CCC", "C-C", "CCC"},
+ {"CCC", "CCC", "CCC"},
+ })
+ .addShape(mName + "5", new String[][]{
+ {"CCCCC", "CCCCC", "CC~CC", "CCCCC", "CCCCC"},
+ {"CCCCC", "C---C", "C---C", "C---C", "CCCCC"},
+ {"CCCCC", "CCCCC", "CCCCC", "CCCCC", "CCCCC"},
+ })
+ .addShape(mName + "7", new String[][]{
+ {"CCCCCCC", "CCCCCCC", "CCCCCCC", "CCC~CCC", "CCCCCCC", "CCCCCCC", "CCCCCCC"},
+ {"CCCCCCC", "C-----C", "C-----C", "C-----C", "C-----C", "C-----C", "CCCCCCC"},
+ {"CCCCCCC", "CCCCCCC", "CCCCCCC", "CCCCCCC", "CCCCCCC", "CCCCCCC", "CCCCCCC"},
+ })
+ .addElement(
+ 'C',
+ ofChain(
+ ofHatchAdder(
+ GregtechMetaTileEntity_IndustrialArcFurnace::addIndustrialArcFurnaceList, mCasingTextureID, 1
+ ),
+ onElementPass(
+ x -> ++x.mCasing,
+ ofBlock(
+ ModBlocks.blockCasings4Misc, 3
+ )
+ )
+ )
+ )
+ .build();
+ }
+ return STRUCTURE_DEFINITION;
+ }
+
+ public void clearHatches() {
+ mOutputHatches.clear();
+ mInputHatches.clear();
+ mOutputBusses.clear();
+ mInputBusses.clear();
+ mEnergyHatches.clear();
+ mMaintenanceHatches.clear();
+ mMufflerHatches.clear();
+ }
+
+ public final boolean addIndustrialArcFurnaceList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null) {
+ return false;
+ } else {
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public void construct(ItemStack stackSize, boolean hintsOnly) {
+ int size;
+ switch (stackSize.stackSize) {
+ case 1: size = 3; break;
+ case 2: size = 5; break;
+ default: size = 7; break;
+ }
+ buildPiece(mName + size, stackSize, hintsOnly, (size - 1) / 2, (size - 1) / 2, 0);
+ }
+
+ @Override
+ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ mCasing = 0;
+ mSize = 0;
+ if (checkPiece(mName + "3", 1, 1, 0)) {
+ mSize = 3;
+ return mCasing >= 10 && checkHatch();
+ }
+ mCasing = 0;
+ clearHatches();
+ if (checkPiece(mName + "5", 2, 2, 0)) {
+ mSize = 5;
+ return mCasing >= 10 && checkHatch();
+ }
+ mCasing = 0;
+ clearHatches();
+ if (checkPiece(mName + "7", 3, 3, 0)) {
+ mSize = 3;
+ return mCasing >= 10 && checkHatch();
+ }
+ return false;
+ }
+
+ @Override
+ public String getSound() {
+ return GregTech_API.sSoundList.get(Integer.valueOf(207));
+ }
+
+ @Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+ if (aSide == aFacing) {
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(mCasingTextureID),
+ new GT_RenderedTexture(aActive ? TexturesGtBlock.Overlay_Machine_Controller_Default_Active : TexturesGtBlock.Overlay_Machine_Controller_Default)};
+ }
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(mCasingTextureID)};
+ }
+
+ @Override
+ public boolean hasSlotInGUI() {
+ return false;
+ }
+
+ @Override
+ public String getCustomGUIResourceName() {
+ return "IndustrialExtruder";
+ }
+
+ @Override
+ public GT_Recipe.GT_Recipe_Map getRecipeMap() {
+ return mPlasmaMode ? GT_Recipe.GT_Recipe_Map.sPlasmaArcFurnaceRecipes : GT_Recipe.GT_Recipe_Map.sArcFurnaceRecipes;
+ }
+
+ @Override
+ public boolean checkRecipe(final ItemStack aStack) {
+ return this.checkRecipeGeneric(this.mSize * 8 * GT_Utility.getTier(this.getMaxInputVoltage()), 100, 250);
+ }
+
+ @Override
+ public int getMaxParallelRecipes() {
+ return (this.mSize * 8 * GT_Utility.getTier(this.getMaxInputVoltage()));
+ }
+
+ @Override
+ public int getEuDiscountForParallelism() {
+ return 100;
+ }
+
+ @Override
+ public void startProcess() {
+ this.sendLoopStart((byte) 1);
+ }
+
+ @Override
+ public int getMaxEfficiency(final ItemStack aStack) {
+ return 10000;
+ }
+
+ @Override
+ public int getPollutionPerSecond(final ItemStack aStack) {
+ return CORE.ConfigSwitches.pollutionPerSecondMultiIndustrialArcFurnace;
+ }
+
+ @Override
+ public int getAmountOfOutputs() {
+ return 1;
+ }
+
+ @Override
+ public boolean explodesOnComponentBreak(final ItemStack aStack) {
+ return false;
+ }
+
+ public Block getCasingBlock() {
+ return ModBlocks.blockCasings4Misc;
+ }
+
+
+ public byte getCasingMeta() {
+ return 3;
+ }
+
+ public Block getCasingBlock2() {
+ return ModBlocks.blockCasings3Misc;
+ }
+
+
+ public byte getCasingMeta2() {
+ return 15;
+ }
+
+ public byte getCasingTextureIndex() {
+ return (byte) mCasingTextureID;
+ }
+
+ @Override
+ public void onModeChangeByScrewdriver(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ if (this.mSize > 3) {
+ this.mPlasmaMode = Utils.invertBoolean(mPlasmaMode);
+ if (mPlasmaMode) {
+ PlayerUtils.messagePlayer(aPlayer, "["+EnumChatFormatting.RED+"MODE"+EnumChatFormatting.RESET+"] "+EnumChatFormatting.LIGHT_PURPLE+"Plasma"+EnumChatFormatting.RESET);
+ }
+ else {
+ PlayerUtils.messagePlayer(aPlayer, "["+EnumChatFormatting.RED+"MODE"+EnumChatFormatting.RESET+"] "+EnumChatFormatting.YELLOW+"Electric"+EnumChatFormatting.RESET);
+ }
+ }
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ super.saveNBTData(aNBT);
+ aNBT.setBoolean("mPlasmaMode", mPlasmaMode);
+ aNBT.setInteger("mSize", mSize);
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ super.loadNBTData(aNBT);
+ mPlasmaMode = aNBT.getBoolean("mPlasmaMode");
+ mSize = aNBT.getInteger("mSize");
+ }
+
+ @Override
+ public void onMachineBlockUpdate() {
+ mUpdate = 100;
+ }
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCentrifuge.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCentrifuge.java
new file mode 100644
index 0000000000..8802a7148b
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCentrifuge.java
@@ -0,0 +1,263 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing;
+
+import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
+import com.gtnewhorizon.structurelib.structure.StructureDefinition;
+import gregtech.api.enums.TAE;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.implementations.*;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_Utility;
+import gregtech.api.util.GTPP_Recipe;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.minecraft.PlayerUtils;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.CustomIcon;
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
+
+public class GregtechMetaTileEntity_IndustrialCentrifuge
+extends GregtechMeta_MultiBlockBase {
+
+ private boolean mIsAnimated;
+ private static ITexture frontFace;
+ private static ITexture frontFaceActive;
+ private static CustomIcon GT9_5_Active = new CustomIcon("iconsets/LARGECENTRIFUGE_ACTIVE5");
+ private static CustomIcon GT9_5 = new CustomIcon("iconsets/LARGECENTRIFUGE5");
+ private int mCasing;
+ private IStructureDefinition<GregtechMetaTileEntity_IndustrialCentrifuge> STRUCTURE_DEFINITION = null;
+ //public static double recipesComplete = 0;
+
+ public GregtechMetaTileEntity_IndustrialCentrifuge(final int aID, final String aName, final String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ frontFaceActive = new GT_RenderedTexture(GT9_5_Active);
+ frontFace = new GT_RenderedTexture(GT9_5);
+ mIsAnimated = true;
+ }
+
+ public GregtechMetaTileEntity_IndustrialCentrifuge(final String aName) {
+ super(aName);
+ mIsAnimated = true;
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaTileEntity_IndustrialCentrifuge(this.mName);
+ }
+
+ @Override
+ public String getMachineType() {
+ return "Centrifuge";
+ }
+
+ @Override
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
+ GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType(getMachineType())
+ .addInfo("Controller Block for the Industrial Centrifuge")
+ .addInfo("125% faster than using single block machines of the same voltage")
+ .addInfo("Disable animations with a screwdriver")
+ .addInfo("Only uses 90% of the eu/t normally required")
+ .addInfo("Processes six items per voltage tier")
+ .addPollutionAmount(getPollutionPerSecond(null))
+ .addSeparator()
+ .beginStructureBlock(3, 3, 3, true)
+ .addController("Front Center")
+ .addCasingInfo("Centrifuge Casings", 10)
+ .addInputBus("Any Casing except front", 1)
+ .addOutputBus("Any Casing except front", 1)
+ .addInputHatch("Any Casing except front", 1)
+ .addOutputHatch("Any Casing except front", 1)
+ .addEnergyHatch("Any Casing except front", 1)
+ .addMaintenanceHatch("Any Casing except front", 1)
+ .addMufflerHatch("Any Casing except front", 1)
+ .toolTipFinisher(CORE.GT_Tooltip_Builder);
+ return tt;
+ }
+
+ @Override
+ public IStructureDefinition<GregtechMetaTileEntity_IndustrialCentrifuge> getStructureDefinition() {
+ if (STRUCTURE_DEFINITION == null) {
+ STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_IndustrialCentrifuge>builder()
+ .addShape(mName, transpose(new String[][]{
+ {"CCC", "CCC", "CCC"},
+ {"C~C", "C-C", "CCC"},
+ {"CCC", "CCC", "CCC"},
+ }))
+ .addElement(
+ 'C',
+ ofChain(
+ ofHatchAdder(
+ GregtechMetaTileEntity_IndustrialCentrifuge::addIndustrialCentrifugeList, getCasingTextureIndex(), 1
+ ),
+ onElementPass(
+ x -> ++x.mCasing,
+ ofBlock(
+ ModBlocks.blockCasingsMisc, 0
+ )
+ )
+ )
+ )
+ .build();
+ }
+ return STRUCTURE_DEFINITION;
+ }
+
+ @Override
+ public void construct(ItemStack stackSize, boolean hintsOnly) {
+ buildPiece(mName , stackSize, hintsOnly, 1, 1, 0);
+ }
+
+ @Override
+ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ mCasing = 0;
+ return checkPiece(mName, 1, 1, 0) && mCasing >= 10 && checkHatch();
+ }
+
+ public final boolean addIndustrialCentrifugeList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null) {
+ return false;
+ } else {
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(TAE.GTPP_INDEX(0)), aFacing == aSide ? aActive ? getFrontFacingTurbineTexture(aActive) : getFrontFacingTurbineTexture(aActive) : Textures.BlockIcons.getCasingTextureForId(TAE.GTPP_INDEX(0))};
+ }
+
+ @Override
+ public boolean hasSlotInGUI() {
+ return false;
+ }
+
+ @Override
+ public String getCustomGUIResourceName() {
+ return "IndustrialCentrifuge";
+ }
+
+ @Override
+ public GT_Recipe.GT_Recipe_Map getRecipeMap() {
+ return GTPP_Recipe.GTPP_Recipe_Map.sMultiblockCentrifugeRecipes_GT;
+ }
+
+ @Override
+ public boolean checkRecipe(final ItemStack aStack) {
+ return checkRecipeGeneric(6* GT_Utility.getTier(this.getMaxInputVoltage()), 90, 125);
+ }
+
+ @Override
+ public int getMaxParallelRecipes() {
+ return (6 * GT_Utility.getTier(this.getMaxInputVoltage()));
+ }
+
+ @Override
+ public int getEuDiscountForParallelism() {
+ return 90;
+ }
+
+ public Block getCasingBlock() {
+ return ModBlocks.blockCasingsMisc;
+ }
+
+ public byte getCasingMeta() {
+ return 0;
+ }
+
+ public byte getCasingTextureIndex() {
+ return (byte) TAE.GTPP_INDEX(0);
+ }
+
+ @Override
+ public int getMaxEfficiency(final ItemStack aStack) {
+ return 10000;
+ }
+
+ @Override
+ public int getPollutionPerSecond(final ItemStack aStack) {
+ return CORE.ConfigSwitches.pollutionPerSecondMultiIndustrialCentrifuge;
+ }
+
+ @Override
+ public int getAmountOfOutputs() {
+ return 1;
+ }
+
+ @Override
+ public boolean explodesOnComponentBreak(final ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public void onModeChangeByScrewdriver(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ this.mIsAnimated = !mIsAnimated;
+ Logger.INFO("Is Centrifuge animated "+this.mIsAnimated);
+ if (this.mIsAnimated) {
+ PlayerUtils.messagePlayer(aPlayer, "Using Animated Turbine Texture. ");
+ }
+ else {
+ PlayerUtils.messagePlayer(aPlayer, "Using Static Turbine Texture. ");
+ }
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ super.saveNBTData(aNBT);
+ aNBT.setBoolean("mIsAnimated", mIsAnimated);
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ super.loadNBTData(aNBT);
+ if (aNBT.hasKey("mIsAnimated")) {
+ mIsAnimated = aNBT.getBoolean("mIsAnimated");
+ }
+ else {
+ mIsAnimated = true;
+ }
+ }
+
+ public boolean usingAnimations() {
+ //Logger.INFO("Is animated? "+this.mIsAnimated);
+ return this.mIsAnimated;
+ }
+
+ private ITexture getFrontFacingTurbineTexture(boolean isActive) {
+ if (usingAnimations()) {
+ if (isActive) {
+ return frontFaceActive;
+ }
+ }
+ return frontFace;
+ }
+
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCokeOven.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCokeOven.java
new file mode 100644
index 0000000000..21caf135b1
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCokeOven.java
@@ -0,0 +1,230 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing;
+
+import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
+import com.gtnewhorizon.structurelib.structure.StructureDefinition;
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.TAE;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.implementations.*;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_Utility;
+import gregtech.api.util.GTPP_Recipe;
+import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import net.minecraft.item.ItemStack;
+
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
+
+public class GregtechMetaTileEntity_IndustrialCokeOven
+extends GregtechMeta_MultiBlockBase {
+ private int mLevel = 0;
+ private int mCasing;
+ private int mCasing1;
+ private int mCasing2;
+ private IStructureDefinition<GregtechMetaTileEntity_IndustrialCokeOven> STRUCTURE_DEFINITION = null;
+
+ public GregtechMetaTileEntity_IndustrialCokeOven(final int aID, final String aName, final String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ }
+
+ public GregtechMetaTileEntity_IndustrialCokeOven(final String aName) {
+ super(aName);
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaTileEntity_IndustrialCokeOven(this.mName);
+ }
+
+ @Override
+ public String getMachineType() {
+ return "Coke Oven";
+ }
+
+ @Override
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
+ GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType(getMachineType())
+ .addInfo("Processes Logs and Coal into Charcoal and Coal Coke.")
+ .addInfo("Controller Block for the Industrial Coke Oven")
+ .addInfo("Gain 4% speed bonus per voltage tier increased")
+ .addInfo("Process 12x materials with Heat Resistant Casings")
+ .addInfo("Or 24x materials with Heat Proof Casings")
+ .addPollutionAmount(getPollutionPerSecond(null))
+ .addSeparator()
+ .beginStructureBlock(3, 3, 3, true)
+ .addController("Front middle at bottom")
+ .addCasingInfo("Structural Coke Oven Casings", 8)
+ .addCasingInfo("Heat Resistant/Proof Coke Oven Casings", 8)
+ .addInputBus("Any Casing", 1)
+ .addOutputBus("Any Casing", 1)
+ .addInputHatch("Any Casing", 1)
+ .addOutputHatch("Any Casing", 1)
+ .addEnergyHatch("Any Casing", 1)
+ .addMaintenanceHatch("Any Casing", 1)
+ .addMufflerHatch("Any Casing", 1)
+ .toolTipFinisher(CORE.GT_Tooltip_Builder);
+ return tt;
+ }
+
+ @Override
+ public IStructureDefinition<GregtechMetaTileEntity_IndustrialCokeOven> getStructureDefinition() {
+ if (STRUCTURE_DEFINITION == null) {
+ STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_IndustrialCokeOven>builder()
+ .addShape(mName, transpose(new String[][]{
+ {"CCC", "C-C", "CCC"},
+ {"HHH", "H-H", "HHH"},
+ {"C~C", "CCC", "CCC"},
+ }))
+ .addElement(
+ 'C',
+ ofChain(
+ ofHatchAdder(
+ GregtechMetaTileEntity_IndustrialCokeOven::addIndustrialCokeOvenList, TAE.GTPP_INDEX(1), 1
+ ),
+ onElementPass(
+ x -> ++x.mCasing,
+ ofBlock(
+ ModBlocks.blockCasingsMisc, 1
+ )
+ )
+ )
+ )
+ .addElement(
+ 'H',
+ ofChain(
+ onElementPass(
+ x -> ++x.mCasing1,
+ ofBlock(
+ ModBlocks.blockCasingsMisc, 2
+ )
+ ),
+ onElementPass(
+ x -> ++x.mCasing2,
+ ofBlock(
+ ModBlocks.blockCasingsMisc, 3
+ )
+ )
+ )
+ )
+ .build();
+ }
+ return STRUCTURE_DEFINITION;
+ }
+
+ @Override
+ public void construct(ItemStack stackSize, boolean hintsOnly) {
+ buildPiece(mName , stackSize, hintsOnly, 1, 2, 0);
+ }
+
+ @Override
+ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ mCasing = 0;
+ mCasing1 = 0;
+ mCasing2 = 0;
+ mLevel = 0;
+ if (checkPiece(mName, 1, 2, 0)) {
+ if (mCasing1 == 8) mLevel = 1;
+ if (mCasing2 == 8) mLevel = 2;
+ return mLevel > 0 && mCasing >= 8 && checkHatch();
+ }
+ return false;
+ }
+
+ public final boolean addIndustrialCokeOvenList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null) {
+ return false;
+ } else {
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public String getSound() {
+ return GregTech_API.sSoundList.get(Integer.valueOf(207));
+ }
+
+ @Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+ if (aSide == aFacing) {
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(TAE.GTPP_INDEX(1)), new GT_RenderedTexture(aActive ? TexturesGtBlock.Overlay_Machine_Controller_Advanced_Active : TexturesGtBlock.Overlay_Machine_Controller_Advanced)};
+ }
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(TAE.GTPP_INDEX(1))};
+ }
+
+ @Override
+ public boolean hasSlotInGUI() {
+ return false;
+ }
+
+ @Override
+ public String getCustomGUIResourceName() {
+ return "CokeOven";
+ }
+
+ @Override
+ public GT_Recipe.GT_Recipe_Map getRecipeMap() {
+ return GTPP_Recipe.GTPP_Recipe_Map.sCokeOvenRecipes;
+
+ }
+
+ @Override
+ public boolean checkRecipe(final ItemStack aStack) {
+ return checkRecipeGeneric(getMaxParallelRecipes(), getEuDiscountForParallelism(), 0);
+ }
+
+ @Override
+ public int getMaxParallelRecipes() {
+ return this.mLevel * 12;
+ }
+
+ @Override
+ public int getEuDiscountForParallelism() {
+ return (100-(GT_Utility.getTier(this.getMaxInputVoltage())*4));
+ }
+
+ @Override
+ public int getMaxEfficiency(final ItemStack aStack) {
+ return 10000;
+ }
+
+ @Override
+ public int getPollutionPerSecond(final ItemStack aStack) {
+ return CORE.ConfigSwitches.pollutionPerSecondMultiIndustrialCokeOven;
+ }
+
+ @Override
+ public int getAmountOfOutputs() {
+ return 24;
+ }
+
+ @Override
+ public boolean explodesOnComponentBreak(final ItemStack aStack) {
+ return false;
+ }
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCuttingMachine.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCuttingMachine.java
new file mode 100644
index 0000000000..bf5f8aaeaf
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCuttingMachine.java
@@ -0,0 +1,234 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing;
+
+import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
+import com.gtnewhorizon.structurelib.structure.StructureDefinition;
+import gregtech.api.enums.TAE;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.implementations.*;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.minecraft.PlayerUtils;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
+
+public class GregtechMetaTileEntity_IndustrialCuttingMachine
+extends GregtechMeta_MultiBlockBase {
+
+ private boolean mCuttingMode = true;
+ private int mCasing;
+ private IStructureDefinition<GregtechMetaTileEntity_IndustrialCuttingMachine> STRUCTURE_DEFINITION = null;
+
+ public GregtechMetaTileEntity_IndustrialCuttingMachine(final int aID, final String aName, final String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ }
+
+ public GregtechMetaTileEntity_IndustrialCuttingMachine(final String aName) {
+ super(aName);
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaTileEntity_IndustrialCuttingMachine(this.mName);
+ }
+
+ @Override
+ public String getMachineType() {
+ return "Cutting Machine / Slicing Machine";
+ }
+
+ @Override
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
+ GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType(getMachineType())
+ .addInfo("Controller Block for the Industrial Cutting Factory")
+ .addInfo("200% faster than using single block machines of the same voltage")
+ .addInfo("Only uses 75% of the eu/t normally required")
+ .addInfo("Processes four items per voltage tier")
+ .addPollutionAmount(getPollutionPerSecond(null))
+ .addSeparator()
+ .beginStructureBlock(3, 3, 5, true)
+ .addController("Front Center")
+ .addCasingInfo("Cutting Factory Frames", 26)
+ .addInputBus("Any Casing", 1)
+ .addOutputBus("Any Casing", 1)
+ .addInputHatch("Any Casing", 1)
+ .addEnergyHatch("Any Casing", 1)
+ .addMaintenanceHatch("Any Casing", 1)
+ .addMufflerHatch("Any Casing", 1)
+ .toolTipFinisher(CORE.GT_Tooltip_Builder);
+ return tt;
+ }
+
+ @Override
+ public IStructureDefinition<GregtechMetaTileEntity_IndustrialCuttingMachine> getStructureDefinition() {
+ if (STRUCTURE_DEFINITION == null) {
+ STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_IndustrialCuttingMachine>builder()
+ .addShape(mName, transpose(new String[][]{
+ {"CCC", "CCC", "CCC", "CCC", "CCC"},
+ {"C~C", "C-C", "C-C", "C-C", "CCC"},
+ {"CCC", "CCC", "CCC", "CCC", "CCC"},
+ }))
+ .addElement(
+ 'C',
+ ofChain(
+ ofHatchAdder(
+ GregtechMetaTileEntity_IndustrialCuttingMachine::addIndustrialCuttingMachineList, getCasingTextureIndex(), 1
+ ),
+ onElementPass(
+ x -> ++x.mCasing,
+ ofBlock(
+ ModBlocks.blockCasings2Misc, 13
+ )
+ )
+ )
+ )
+ .build();
+ }
+ return STRUCTURE_DEFINITION;
+ }
+
+ @Override
+ public void construct(ItemStack stackSize, boolean hintsOnly) {
+ buildPiece(mName , stackSize, hintsOnly, 1, 1, 0);
+ }
+
+ @Override
+ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ mCasing = 0;
+ return checkPiece(mName, 1, 1, 0) && mCasing >= 26 && checkHatch();
+ }
+
+ public final boolean addIndustrialCuttingMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null) {
+ return false;
+ } else {
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+ if (aSide == aFacing) {
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(TAE.GTPP_INDEX(29)), new GT_RenderedTexture(aActive ? TexturesGtBlock.Overlay_Machine_Controller_Default_Active : TexturesGtBlock.Overlay_Machine_Controller_Default)};
+ }
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(TAE.GTPP_INDEX(29))};
+ }
+
+ @Override
+ public boolean hasSlotInGUI() {
+ return false;
+ }
+
+ @Override
+ public String getCustomGUIResourceName() {
+ return "IndustrialCuttingMachine";
+ }
+
+ @Override
+ public GT_Recipe.GT_Recipe_Map getRecipeMap() {
+ return mCuttingMode ? GT_Recipe.GT_Recipe_Map.sCutterRecipes : GT_Recipe.GT_Recipe_Map.sSlicerRecipes;
+ }
+
+ @Override
+ public boolean checkRecipe(final ItemStack aStack) {
+ return checkRecipeGeneric((4* GT_Utility.getTier(this.getMaxInputVoltage())), 75, 200);
+ }
+
+ @Override
+ public int getMaxParallelRecipes() {
+ return (4 * GT_Utility.getTier(this.getMaxInputVoltage()));
+ }
+
+ @Override
+ public int getEuDiscountForParallelism() {
+ return 75;
+ }
+
+ @Override
+ public int getMaxEfficiency(final ItemStack aStack) {
+ return 10000;
+ }
+
+ @Override
+ public int getPollutionPerSecond(final ItemStack aStack) {
+ return CORE.ConfigSwitches.pollutionPerSecondMultiIndustrialCuttingMachine;
+ }
+
+ @Override
+ public int getAmountOfOutputs() {
+ return 2;
+ }
+
+ @Override
+ public boolean explodesOnComponentBreak(final ItemStack aStack) {
+ return false;
+ }
+
+ public Block getCasingBlock() {
+ return ModBlocks.blockCasings2Misc;
+ }
+
+
+ public byte getCasingMeta() {
+ return 13;
+ }
+
+
+ public byte getCasingTextureIndex() {
+ return (byte) TAE.GTPP_INDEX(29);
+ }
+
+ @Override
+ public void onModeChangeByScrewdriver(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ mCuttingMode = Utils.invertBoolean(mCuttingMode);
+ String aMode = mCuttingMode ? "Cutting" : "Slicing";
+ PlayerUtils.messagePlayer(aPlayer, "Mode: "+aMode);
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ super.saveNBTData(aNBT);
+ aNBT.setBoolean("mCuttingMode", mCuttingMode);
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ super.loadNBTData(aNBT);
+ if (aNBT.hasKey("mCuttingMode")) {
+ mCuttingMode = aNBT.getBoolean("mCuttingMode");
+ }
+ else {
+ mCuttingMode = true;
+ }
+ }
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialDehydrator.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialDehydrator.java
new file mode 100644
index 0000000000..44552ea2f7
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialDehydrator.java
@@ -0,0 +1,415 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing;
+
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
+import static gregtech.api.util.GT_StructureUtility.ofCoil;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
+import static gtPlusPlus.core.util.data.ArrayUtils.removeNulls;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
+import com.gtnewhorizon.structurelib.structure.StructureDefinition;
+import gregtech.api.enums.HeatingCoilLevel;
+import gregtech.api.metatileentity.implementations.*;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
+import gtPlusPlus.core.lib.CORE;
+import org.apache.commons.lang3.ArrayUtils;
+
+import gregtech.api.enums.TAE;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_Utility;
+import gregtech.api.util.GTPP_Recipe;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import gtPlusPlus.core.util.minecraft.PlayerUtils;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraftforge.fluids.FluidStack;
+
+public class GregtechMetaTileEntity_IndustrialDehydrator extends GregtechMeta_MultiBlockBase {
+
+ private static int CASING_TEXTURE_ID;
+ private static String mCasingName = "Vacuum Casing";
+ private HeatingCoilLevel mHeatingCapacity;
+ private boolean mDehydratorMode = false;
+ private int mCasing;
+ private IStructureDefinition<GregtechMetaTileEntity_IndustrialDehydrator> STRUCTURE_DEFINITION = null;
+
+ public GregtechMetaTileEntity_IndustrialDehydrator(int aID, String aName, String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ CASING_TEXTURE_ID = TAE.getIndexFromPage(3, 10);
+ mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings4Misc, 10);
+ }
+
+ public GregtechMetaTileEntity_IndustrialDehydrator(String aName) {
+ super(aName);
+ CASING_TEXTURE_ID = TAE.getIndexFromPage(3, 10);
+ mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings4Misc, 10);
+ }
+
+ public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaTileEntity_IndustrialDehydrator(mName);
+ }
+
+ @Override
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
+ if (mCasingName.toLowerCase().contains(".name")) {
+ mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings4Misc, 10);
+ }
+ GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType(getMachineType())
+ .addInfo("Factory Grade Vacuum Furnace")
+ .addInfo("Can toggle the operation temperature with a Screwdriver")
+ .addInfo("All Dehydrator recipes are Low Temp recipes")
+ .addInfo("Speed: 120% | Eu Usage: 50% | Parallel: 4")
+ .addInfo("Each 900K over the min. Heat Capacity grants 5% speedup (multiplicatively)")
+ .addInfo("Each 1800K over the min. Heat Capacity allows for one upgraded overclock")
+ .addInfo("Upgraded overclocks reduce recipe time to 25% and increase EU/t to 400%")
+ .addPollutionAmount(getPollutionPerSecond(null))
+ .addSeparator()
+ .beginStructureBlock(3, 4, 3, true)
+ .addController("Bottom Center")
+ .addCasingInfo(mCasingName, 10)
+ .addInputBus("Any Casing", 1)
+ .addOutputBus("Any Casing", 1)
+ .addInputHatch("Any Casing", 1)
+ .addOutputHatch("Any Casing", 1)
+ .addEnergyHatch("Any Casing", 1)
+ .addMaintenanceHatch("Any Casing", 1)
+ .addMufflerHatch("Any Casing", 1)
+ .toolTipFinisher(CORE.GT_Tooltip_Builder);
+ return tt;
+ }
+
+ @Override
+ public IStructureDefinition<GregtechMetaTileEntity_IndustrialDehydrator> getStructureDefinition() {
+ if (STRUCTURE_DEFINITION == null) {
+ STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_IndustrialDehydrator>builder()
+ .addShape(mName, transpose(new String[][]{
+ {"CCC", "CCC", "CCC"},
+ {"HHH", "H-H", "HHH"},
+ {"HHH", "H-H", "HHH"},
+ {"HHH", "H-H", "HHH"},
+ {"C~C", "CCC", "CCC"},
+ }))
+ .addElement(
+ 'C',
+ ofChain(
+ ofHatchAdder(
+ GregtechMetaTileEntity_IndustrialDehydrator::addIndustrialDehydratorList, CASING_TEXTURE_ID, 1
+ ),
+ onElementPass(
+ x -> ++x.mCasing,
+ ofBlock(
+ ModBlocks.blockCasings4Misc, 10
+ )
+ )
+ )
+ )
+ .addElement(
+ 'H',
+ ofCoil(
+ GregtechMetaTileEntity_IndustrialDehydrator::setCoilLevel, GregtechMetaTileEntity_IndustrialDehydrator::getCoilLevel
+ )
+ )
+ .build();
+ }
+ return STRUCTURE_DEFINITION;
+ }
+
+ @Override
+ public void construct(ItemStack stackSize, boolean hintsOnly) {
+ buildPiece(mName , stackSize, hintsOnly, 1, 4, 0);
+ }
+
+ @Override
+ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ mCasing = 0;
+ setCoilLevel(HeatingCoilLevel.None);
+ return checkPiece(mName, 1, 4, 0) && mCasing >= 10 && getCoilLevel() != HeatingCoilLevel.None && checkHatch();
+ }
+
+ public final boolean addIndustrialDehydratorList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null) {
+ return false;
+ } else {
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ }
+ return false;
+ }
+
+ public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex,
+ boolean aActive, boolean aRedstone) {
+ if (aSide == aFacing) {
+ return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(CASING_TEXTURE_ID),
+ new GT_RenderedTexture(aActive ? TexturesGtBlock.Overlay_Machine_Controller_Advanced_Active
+ : TexturesGtBlock.Overlay_Machine_Controller_Advanced) };
+ }
+ return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(CASING_TEXTURE_ID) };
+ }
+
+ public GT_Recipe.GT_Recipe_Map getRecipeMap() {
+ return mDehydratorMode ? GTPP_Recipe.GTPP_Recipe_Map.sChemicalDehydratorRecipes : GTPP_Recipe.GTPP_Recipe_Map.sVacuumFurnaceRecipes;
+ }
+
+ public boolean isCorrectMachinePart(ItemStack aStack) {
+ return true;
+ }
+
+ public int getMaxEfficiency(ItemStack aStack) {
+ return 10000;
+ }
+
+ public int getPollutionPerSecond(ItemStack aStack) {
+ return CORE.ConfigSwitches.pollutionPerSecondMultiIndustrialDehydrator;
+ }
+
+ @Override
+ public boolean hasSlotInGUI() {
+ return true;
+ }
+
+ @Override
+ public String getMachineType() {
+ return "Vacuum Furnace / Dehydrator";
+ }
+
+ @Override
+ public int getMaxParallelRecipes() {
+ return 4;
+ }
+
+ @Override
+ public int getEuDiscountForParallelism() {
+ return 50;
+ }
+
+ @Override
+ public boolean requiresVanillaGtGUI() {
+ return true;
+ }
+
+ @Override
+ public String getCustomGUIResourceName() {
+ return "ElectricBlastFurnace";
+ }
+
+ public boolean checkRecipe(ItemStack aStack) {
+ return checkRecipeGeneric(getMaxParallelRecipes(), getEuDiscountForParallelism(), 120);
+ }
+
+ @Override
+ public boolean checkRecipeGeneric(ItemStack[] aItemInputs, FluidStack[] aFluidInputs, int aMaxParallelRecipes,
+ int aEUPercent, int aSpeedBonusPercent, int aOutputChanceRoll) {
+ // Based on the Processing Array. A bit overkill, but very flexible.
+
+ // Reset outputs and progress stats
+ this.mEUt = 0;
+ this.mMaxProgresstime = 0;
+ this.mOutputItems = new ItemStack[] {};
+ this.mOutputFluids = new FluidStack[] {};
+
+ long tVoltage = getMaxInputVoltage();
+ byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage));
+ long tEnergy = getMaxInputEnergy();
+ Logger.WARNING("Running checkRecipeGeneric(0)");
+
+ GT_Recipe tRecipe = this.getRecipeMap().findRecipe(getBaseMetaTileEntity(), mLastRecipe, false,
+ gregtech.api.enums.GT_Values.V[tTier], aFluidInputs, aItemInputs);
+
+ Logger.WARNING("Running checkRecipeGeneric(1)");
+ // Remember last recipe - an optimization for findRecipe()
+ this.mLastRecipe = tRecipe;
+
+ if (tRecipe == null || this.mHeatingCapacity.getHeat() < tRecipe.mSpecialValue) {
+ Logger.WARNING("BAD RETURN - 1");
+ return false;
+ }
+
+ aMaxParallelRecipes = this.canBufferOutputs(tRecipe, aMaxParallelRecipes);
+ if (aMaxParallelRecipes == 0) {
+ Logger.WARNING("BAD RETURN - 2");
+ return false;
+ }
+
+ // EU discount
+ float tRecipeEUt = (tRecipe.mEUt * aEUPercent) / 100.0f;
+ int tHeatCapacityDivTiers = (int) (mHeatingCapacity.getHeat() - tRecipe.mSpecialValue) / 900;
+ float tTotalEUt = 0.0f;
+
+ int parallelRecipes = 0;
+ // Count recipes to do in parallel, consuming input items and fluids and
+ // considering input voltage limits
+ for (; parallelRecipes < aMaxParallelRecipes && tTotalEUt < (tEnergy - tRecipeEUt); parallelRecipes++) {
+ if (!tRecipe.isRecipeInputEqual(true, aFluidInputs, aItemInputs)) {
+ Logger.WARNING("Broke at " + parallelRecipes + ".");
+ break;
+ }
+ Logger.WARNING("Bumped EU from " + tTotalEUt + " to " + (tTotalEUt + tRecipeEUt) + ".");
+ tTotalEUt += tRecipeEUt;
+ }
+
+ if (parallelRecipes == 0) {
+ Logger.WARNING("BAD RETURN - 3");
+ return false;
+ }
+
+ // -- Try not to fail after this point - inputs have already been consumed! --
+
+ // Convert speed bonus to duration multiplier
+ // e.g. 100% speed bonus = 200% speed = 100%/200% = 50% recipe duration.
+ aSpeedBonusPercent = Math.max(-99, aSpeedBonusPercent);
+ float tTimeFactor = 100.0f / (100.0f + aSpeedBonusPercent);
+ this.mMaxProgresstime = (int) (tRecipe.mDuration * tTimeFactor);
+ int rInt = 2;
+
+ this.mEUt = (int) Math.ceil(tTotalEUt);
+
+ this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
+ this.mEfficiencyIncrease = 10000;
+
+ // Overclock
+ if (this.mEUt <= 16) {
+ this.mEUt = (this.mEUt * (1 << tTier - 1) * (1 << tTier - 1));
+ this.mMaxProgresstime = (this.mMaxProgresstime / (1 << tTier - 1));
+ } else {
+ while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) {
+ this.mEUt *= 4;
+ this.mMaxProgresstime /= (tHeatCapacityDivTiers >= rInt ? 4 : 2);
+ }
+ }
+
+ if (tHeatCapacityDivTiers > 0) {
+ this.mEUt = (int) (this.mEUt * (Math.pow(0.95, tHeatCapacityDivTiers)));
+ }
+ if (this.mEUt > 0) {
+ this.mEUt = (-this.mEUt);
+ }
+
+ this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
+
+ // Collect fluid outputs
+ FluidStack[] tOutputFluids = new FluidStack[tRecipe.mFluidOutputs.length];
+ for (int h = 0; h < tRecipe.mFluidOutputs.length; h++) {
+ if (tRecipe.getFluidOutput(h) != null) {
+ tOutputFluids[h] = tRecipe.getFluidOutput(h).copy();
+ tOutputFluids[h].amount *= parallelRecipes;
+ }
+ }
+
+ // Collect output item types
+ ItemStack[] tOutputItems = new ItemStack[tRecipe.mOutputs.length];
+ for (int h = 0; h < tRecipe.mOutputs.length; h++) {
+ if (tRecipe.getOutput(h) != null) {
+ tOutputItems[h] = tRecipe.getOutput(h).copy();
+ tOutputItems[h].stackSize = 0;
+ }
+ }
+
+ // Set output item stack sizes (taking output chance into account)
+ for (int f = 0; f < tOutputItems.length; f++) {
+ if (tRecipe.mOutputs[f] != null && tOutputItems[f] != null) {
+ for (int g = 0; g < parallelRecipes; g++) {
+ if (getBaseMetaTileEntity().getRandomNumber(aOutputChanceRoll) < tRecipe.getOutputChance(f))
+ tOutputItems[f].stackSize += tRecipe.mOutputs[f].stackSize;
+ }
+ }
+ }
+
+ tOutputItems = removeNulls(tOutputItems);
+
+ // Sanitize item stack size, splitting any stacks greater than max stack size
+ List<ItemStack> splitStacks = new ArrayList<ItemStack>();
+ for (ItemStack tItem : tOutputItems) {
+ while (tItem.getMaxStackSize() < tItem.stackSize) {
+ ItemStack tmp = tItem.copy();
+ tmp.stackSize = tmp.getMaxStackSize();
+ tItem.stackSize = tItem.stackSize - tItem.getMaxStackSize();
+ splitStacks.add(tmp);
+ }
+ }
+
+ if (splitStacks.size() > 0) {
+ ItemStack[] tmp = new ItemStack[splitStacks.size()];
+ tmp = splitStacks.toArray(tmp);
+ tOutputItems = ArrayUtils.addAll(tOutputItems, tmp);
+ }
+
+ // Strip empty stacks
+ List<ItemStack> tSList = new ArrayList<ItemStack>();
+ for (ItemStack tS : tOutputItems) {
+ if (tS.stackSize > 0)
+ tSList.add(tS);
+ }
+ tOutputItems = tSList.toArray(new ItemStack[tSList.size()]);
+
+ // Commit outputs
+ this.mOutputItems = tOutputItems;
+ this.mOutputFluids = tOutputFluids;
+ updateSlots();
+
+ // Play sounds (GT++ addition - GT multiblocks play no sounds)
+ startProcess();
+
+ Logger.WARNING("GOOD RETURN - 1");
+ return true;
+
+ }
+
+ @Override
+ public void onModeChangeByScrewdriver(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ mDehydratorMode = Utils.invertBoolean(mDehydratorMode);
+ String aMode = mDehydratorMode ? "Dehydrator" : "Vacuum Furnace";
+ PlayerUtils.messagePlayer(aPlayer, "Mode: "+aMode);
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ super.saveNBTData(aNBT);
+ aNBT.setBoolean("mDehydratorMode", mDehydratorMode);
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ super.loadNBTData(aNBT);
+ mDehydratorMode = aNBT.getBoolean("mDehydratorMode");
+ }
+
+ public HeatingCoilLevel getCoilLevel() {
+ return mHeatingCapacity;
+ }
+
+ public void setCoilLevel(HeatingCoilLevel aCoilLevel) {
+ mHeatingCapacity = aCoilLevel;
+ }
+}
+
+
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialElectrolyzer.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialElectrolyzer.java
new file mode 100644
index 0000000000..f6613980ca
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialElectrolyzer.java
@@ -0,0 +1,193 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing;
+
+import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
+import com.gtnewhorizon.structurelib.structure.StructureDefinition;
+import gregtech.api.enums.TAE;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.implementations.*;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import net.minecraft.item.ItemStack;
+
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
+
+public class GregtechMetaTileEntity_IndustrialElectrolyzer
+extends GregtechMeta_MultiBlockBase {
+
+ private int mCasing;
+ private IStructureDefinition<GregtechMetaTileEntity_IndustrialElectrolyzer> STRUCTURE_DEFINITION = null;
+
+ public GregtechMetaTileEntity_IndustrialElectrolyzer(final int aID, final String aName, final String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ }
+
+ public GregtechMetaTileEntity_IndustrialElectrolyzer(final String aName) {
+ super(aName);
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaTileEntity_IndustrialElectrolyzer(this.mName);
+ }
+
+ @Override
+ public String getMachineType() {
+ return "Electrolyzer";
+ }
+
+ @Override
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
+ GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType(getMachineType())
+ .addInfo("Controller Block for the Industrial Electrolyzer")
+ .addInfo("180% faster than using single block machines of the same voltage")
+ .addInfo("Only uses 90% of the eu/t normally required")
+ .addInfo("Processes two items per voltage tier")
+ .addPollutionAmount(getPollutionPerSecond(null))
+ .addSeparator()
+ .beginStructureBlock(3, 3, 3, true)
+ .addController("Front Center")
+ .addCasingInfo("Electrolyzer Casings", 10)
+ .addInputBus("Any Casing", 1)
+ .addOutputBus("Any Casing", 1)
+ .addInputHatch("Any Casing", 1)
+ .addOutputHatch("Any Casing", 1)
+ .addEnergyHatch("Any Casing", 1)
+ .addMaintenanceHatch("Any Casing", 1)
+ .addMufflerHatch("Any Casing", 1)
+ .toolTipFinisher(CORE.GT_Tooltip_Builder);
+ return tt;
+ }
+
+ @Override
+ public IStructureDefinition<GregtechMetaTileEntity_IndustrialElectrolyzer> getStructureDefinition() {
+ if (STRUCTURE_DEFINITION == null) {
+ STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_IndustrialElectrolyzer>builder()
+ .addShape(mName, transpose(new String[][]{
+ {"CCC", "CCC", "CCC"},
+ {"C~C", "C-C", "CCC"},
+ {"CCC", "CCC", "CCC"},
+ }))
+ .addElement(
+ 'C',
+ ofChain(
+ ofHatchAdder(
+ GregtechMetaTileEntity_IndustrialElectrolyzer::addIndustrialElectrolyzerList, TAE.GTPP_INDEX(5), 1
+ ),
+ onElementPass(
+ x -> ++x.mCasing,
+ ofBlock(
+ ModBlocks.blockCasingsMisc, 5
+ )
+ )
+ )
+ )
+ .build();
+ }
+ return STRUCTURE_DEFINITION;
+ }
+
+ @Override
+ public void construct(ItemStack stackSize, boolean hintsOnly) {
+ buildPiece(mName , stackSize, hintsOnly, 1, 1, 0);
+ }
+
+ @Override
+ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ mCasing = 0;
+ return checkPiece(mName, 1, 1, 0) && mCasing >= 10 && checkHatch();
+ }
+
+ public final boolean addIndustrialElectrolyzerList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null) {
+ return false;
+ } else {
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+ if (aSide == aFacing) {
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(TAE.GTPP_INDEX(5)), new GT_RenderedTexture(aActive ? TexturesGtBlock.Overlay_Machine_Controller_Default_Active : TexturesGtBlock.Overlay_Machine_Controller_Default)};
+ }
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(TAE.GTPP_INDEX(5))};
+ }
+
+ @Override
+ public boolean hasSlotInGUI() {
+ return false;
+ }
+
+ @Override
+ public String getCustomGUIResourceName() {
+ return "IndustrialElectrolyzer";
+ }
+
+ @Override
+ public GT_Recipe.GT_Recipe_Map getRecipeMap() {
+ return gregtech.api.util.GTPP_Recipe.GTPP_Recipe_Map.sMultiblockElectrolyzerRecipes_GT;
+ }
+
+ @Override
+ public boolean checkRecipe(final ItemStack aStack) {
+ return checkRecipeGeneric(2* GT_Utility.getTier(this.getMaxInputVoltage()), 90, 180);
+ }
+
+ @Override
+ public int getMaxEfficiency(final ItemStack aStack) {
+ return 10000;
+ }
+
+ @Override
+ public int getPollutionPerSecond(final ItemStack aStack) {
+ return CORE.ConfigSwitches.pollutionPerSecondMultiIndustrialElectrolyzer;
+ }
+
+ @Override
+ public int getAmountOfOutputs() {
+ return 1;
+ }
+
+ @Override
+ public boolean explodesOnComponentBreak(final ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public int getMaxParallelRecipes() {
+ return 2* GT_Utility.getTier(this.getMaxInputVoltage());
+ }
+
+ @Override
+ public int getEuDiscountForParallelism() {
+ return 90;
+ }
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialExtruder.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialExtruder.java
new file mode 100644
index 0000000000..a5c7f62578
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialExtruder.java
@@ -0,0 +1,260 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing;
+
+import java.util.ArrayList;
+
+import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
+import com.gtnewhorizon.structurelib.structure.StructureDefinition;
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.TAE;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.implementations.*;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import net.minecraft.block.Block;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.fluids.FluidStack;
+
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
+
+public class GregtechMetaTileEntity_IndustrialExtruder
+extends GregtechMeta_MultiBlockBase {
+
+ private int mCasing;
+ private IStructureDefinition<GregtechMetaTileEntity_IndustrialExtruder> STRUCTURE_DEFINITION = null;
+
+
+ public GregtechMetaTileEntity_IndustrialExtruder(final int aID, final String aName, final String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ }
+
+ public GregtechMetaTileEntity_IndustrialExtruder(final String aName) {
+ super(aName);
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaTileEntity_IndustrialExtruder(this.mName);
+ }
+
+ @Override
+ public String getMachineType() {
+ return "Extruder";
+ }
+
+ @Override
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
+ GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType(getMachineType())
+ .addInfo("Controller Block for the Material Extruder")
+ .addInfo("250% faster than using single block machines of the same voltage")
+ .addInfo("Processes four items per voltage tier")
+ .addInfo("Extrusion Shape for recipe goes in the Input Bus")
+ .addInfo("Each Input Bus can have a different shape!")
+ .addInfo("You can use several input buses per multiblock")
+ .addPollutionAmount(getPollutionPerSecond(null))
+ .addSeparator()
+ .beginStructureBlock(3, 3, 5, true)
+ .addController("Front Center")
+ .addCasingInfo("Inconel Reinforced Casings", 28)
+ .addInputBus("Any Casing", 1)
+ .addOutputBus("Any Casing", 1)
+ .addEnergyHatch("Any Casing", 1)
+ .addMaintenanceHatch("Any Casing", 1)
+ .addMufflerHatch("Back Center", 2)
+ .toolTipFinisher(CORE.GT_Tooltip_Builder);
+ return tt;
+ }
+
+ @Override
+ public IStructureDefinition<GregtechMetaTileEntity_IndustrialExtruder> getStructureDefinition() {
+ if (STRUCTURE_DEFINITION == null) {
+ STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_IndustrialExtruder>builder()
+ .addShape(mName, transpose(new String[][]{
+ {"CCC", "CCC", "CCC", "CCC", "CCC"},
+ {"C~C", "C-C", "C-C", "C-C", "CMC"},
+ {"CCC", "CCC", "CCC", "CCC", "CCC"},
+ }))
+ .addElement(
+ 'C',
+ ofChain(
+ ofHatchAdder(
+ GregtechMetaTileEntity_IndustrialExtruder::addIndustrialExtruderList, getCasingTextureIndex(), 1
+ ),
+ onElementPass(
+ x -> ++x.mCasing,
+ ofBlock(
+ getCasingBlock(), getCasingMeta()
+ )
+ )
+ )
+ )
+ .addElement(
+ 'M',
+ ofHatchAdder(
+ GregtechMetaTileEntity_IndustrialExtruder::addIndustrialExtruderMufflerList, getCasingTextureIndex(), 2
+ )
+ )
+ .build();
+ }
+ return STRUCTURE_DEFINITION;
+ }
+
+ @Override
+ public void construct(ItemStack stackSize, boolean hintsOnly) {
+ buildPiece(mName , stackSize, hintsOnly, 1, 1, 0);
+ }
+
+ @Override
+ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ mCasing = 0;
+ return checkPiece(mName, 1, 1, 0) && mCasing >= 28 && checkHatch();
+ }
+
+ public final boolean addIndustrialExtruderList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null) {
+ return false;
+ } else {
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ }
+ return false;
+ }
+
+ public final boolean addIndustrialExtruderMufflerList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null) {
+ return false;
+ } else {
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) {
+ ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex);
+ return this.mMufflerHatches.add((GT_MetaTileEntity_Hatch_Muffler) aMetaTileEntity);
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public String getSound() {
+ return GregTech_API.sSoundList.get(Integer.valueOf(203));
+ }
+
+ @Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+ if (aSide == aFacing) {
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(TAE.GTPP_INDEX(33)), new GT_RenderedTexture(aActive ? TexturesGtBlock.Overlay_Machine_Controller_Default_Active : TexturesGtBlock.Overlay_Machine_Controller_Default)};
+ }
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(TAE.GTPP_INDEX(33))};
+ }
+
+ @Override
+ public boolean hasSlotInGUI() {
+ return false;
+ }
+
+ @Override
+ public String getCustomGUIResourceName() {
+ return "IndustrialExtruder";
+ }
+
+ @Override
+ public GT_Recipe.GT_Recipe_Map getRecipeMap() {
+ return GT_Recipe.GT_Recipe_Map.sExtruderRecipes;
+ }
+
+ @Override
+ public boolean checkRecipe(final ItemStack aStack) {
+ for (GT_MetaTileEntity_Hatch_InputBus tBus : mInputBusses) {
+ ArrayList<ItemStack> tBusItems = new ArrayList<ItemStack>();
+ tBus.mRecipeMap = getRecipeMap();
+ if (isValidMetaTileEntity(tBus)) {
+ for (int i = tBus.getBaseMetaTileEntity().getSizeInventory() - 1; i >= 0; i--) {
+ if (tBus.getBaseMetaTileEntity().getStackInSlot(i) != null)
+ tBusItems.add(tBus.getBaseMetaTileEntity().getStackInSlot(i));
+ }
+ }
+ ItemStack[] inputs = new ItemStack[tBusItems.size()];
+ int slot = 0;
+ for (ItemStack g : tBusItems) {
+ inputs[slot++] = g;
+ }
+ if (inputs.length > 0) {
+ int para = (4* GT_Utility.getTier(this.getMaxInputVoltage()));
+ log("Recipe. ["+inputs.length+"]["+para+"]");
+ if (checkRecipeGeneric(inputs, new FluidStack[]{}, para, 100, 250, 10000)) {
+ log("Recipe 2.");
+ return true;
+ }
+ }
+
+ }
+ return false;
+ }
+
+ @Override
+ public int getMaxParallelRecipes() {
+ return (4 * GT_Utility.getTier(this.getMaxInputVoltage()));
+ }
+
+ @Override
+ public int getEuDiscountForParallelism() {
+ return 100;
+ }
+
+ @Override
+ public void startProcess() {
+ this.sendLoopStart((byte) 1);
+ }
+
+ @Override
+ public int getMaxEfficiency(final ItemStack aStack) {
+ return 10000;
+ }
+
+ @Override
+ public int getPollutionPerSecond(final ItemStack aStack) {
+ return CORE.ConfigSwitches.pollutionPerSecondMultiIndustrialExtruder;
+ }
+
+ @Override
+ public int getAmountOfOutputs() {
+ return 1;
+ }
+
+ @Override
+ public boolean explodesOnComponentBreak(final ItemStack aStack) {
+ return false;
+ }
+
+ public Block getCasingBlock() {
+ return ModBlocks.blockCasings3Misc;
+ }
+
+ public byte getCasingMeta() {
+ return 1;
+ }
+
+ public byte getCasingTextureIndex() {
+ return (byte) TAE.GTPP_INDEX(33);
+ }
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMacerator.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMacerator.java
new file mode 100644
index 0000000000..b6e072b653
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMacerator.java
@@ -0,0 +1,259 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing;
+
+import java.util.Random;
+
+import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
+import com.gtnewhorizon.structurelib.structure.StructureDefinition;
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.TAE;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.implementations.*;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import net.minecraft.item.ItemStack;
+
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
+
+public class GregtechMetaTileEntity_IndustrialMacerator
+extends GregtechMeta_MultiBlockBase {
+ private int mCasing;
+ private int mPerLayer;
+ private IStructureDefinition<GregtechMetaTileEntity_IndustrialMacerator> STRUCTURE_DEFINITION = null;
+
+ public GregtechMetaTileEntity_IndustrialMacerator(final int aID, final String aName, final String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ }
+
+ public GregtechMetaTileEntity_IndustrialMacerator(final String aName) {
+ super(aName);
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaTileEntity_IndustrialMacerator(this.mName);
+ }
+
+ @Override
+ public String getMachineType() {
+ return "Macerator/Pulverizer";
+ }
+
+ @Override
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
+ GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType(getMachineType())
+ .addInfo("Controller Block for the Industrial Maceration Stack")
+ .addInfo("60% faster than using single block machines of the same voltage")
+ .addInfo("Processes 8*tier materials at a time")
+ .addInfo("ULV = Tier 0, LV = Tier 1, etc.")
+ .addPollutionAmount(getPollutionPerSecond(null))
+ .addSeparator()
+ .beginStructureBlock(3, 6, 3, true)
+ .addController("Bottom Center")
+ .addCasingInfo("Maceration Stack Casings", 26)
+ .addInputBus("Bottom Casing", 1)
+ .addEnergyHatch("Bottom Casing", 1)
+ .addMaintenanceHatch("Bottom Casing", 1)
+ .addOutputBus("One per layer except bottom layer", 2)
+ .addMufflerHatch("Any Casing", 2)
+ .toolTipFinisher(CORE.GT_Tooltip_Builder);
+ return tt;
+ }
+
+ @Override
+ public IStructureDefinition<GregtechMetaTileEntity_IndustrialMacerator> getStructureDefinition() {
+ if (STRUCTURE_DEFINITION == null) {
+ STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_IndustrialMacerator>builder()
+ .addShape(mName + "top", transpose(new String[][]{
+ {"CCC", "CCC", "CCC"},
+ }))
+ .addShape(mName + "mid", transpose(new String[][]{
+ {"CCC", "C-C", "CCC"},
+ }))
+ .addShape(mName + "bottom", transpose(new String[][]{
+ {"B~B", "BBB", "BBB"},
+ }))
+ .addElement(
+ 'C',
+ ofChain(
+ ofHatchAdder(
+ GregtechMetaTileEntity_IndustrialMacerator::addIndustrialMaceratorMidList, TAE.GTPP_INDEX(7), 2
+ ),
+ onElementPass(
+ x -> ++x.mCasing,
+ ofBlock(
+ ModBlocks.blockCasingsMisc, 7
+ )
+ )
+ )
+ )
+ .addElement(
+ 'B',
+ ofChain(
+ ofHatchAdder(
+ GregtechMetaTileEntity_IndustrialMacerator::addIndustrialMaceratorBottomList, TAE.GTPP_INDEX(7), 1
+ ),
+ onElementPass(
+ x -> ++x.mCasing,
+ ofBlock(
+ ModBlocks.blockCasingsMisc, 7
+ )
+ )
+ )
+ )
+ .build();
+ }
+ return STRUCTURE_DEFINITION;
+ }
+
+ @Override
+ public void construct(ItemStack stackSize, boolean hintsOnly) {
+ buildPiece(mName + "bottom", stackSize, hintsOnly, 1, 0, 0);
+ buildPiece(mName + "mid", stackSize, hintsOnly, 1, 1, 0);
+ buildPiece(mName + "mid", stackSize, hintsOnly, 1, 2, 0);
+ buildPiece(mName + "mid", stackSize, hintsOnly, 1, 3, 0);
+ buildPiece(mName + "mid", stackSize, hintsOnly, 1, 4, 0);
+ buildPiece(mName + "top", stackSize, hintsOnly, 1, 5, 0);
+ }
+
+ @Override
+ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ mCasing = 0;
+ mPerLayer = 0;
+ if (checkPiece(mName + "bottom", 1, 0 ,0)) {
+ while (mPerLayer < 4) {
+ if (!checkPiece(mName + "mid", 1, mPerLayer + 1, 0) ||
+ mPerLayer + 1 != mOutputBusses.size()) return false;
+ mPerLayer ++;
+ }
+ return checkPiece(mName + "top", 1, 5, 0) && mOutputBusses.size() == 5 && mCasing >= 26 && checkHatch();
+ }
+ return false;
+ }
+
+ public final boolean addIndustrialMaceratorBottomList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null) {
+ return false;
+ } else {
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ }
+ return false;
+ }
+
+ public final boolean addIndustrialMaceratorMidList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null) {
+ return false;
+ } else {
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public String getSound() {
+ return GregTech_API.sSoundList.get(Integer.valueOf(201));
+ }
+
+ @Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+ if (aSide == aFacing) {
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(TAE.GTPP_INDEX(7)), new GT_RenderedTexture(aActive ? TexturesGtBlock.Overlay_MatterFab_Active : TexturesGtBlock.Overlay_MatterFab)};
+ }
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(TAE.GTPP_INDEX(7))};
+ }
+
+ @Override
+ public boolean hasSlotInGUI() {
+ return false;
+ }
+
+ @Override
+ public String getCustomGUIResourceName() {
+ return "MacerationStack";
+ }
+
+ @Override
+ public GT_Recipe.GT_Recipe_Map getRecipeMap() {
+ return GT_Recipe.GT_Recipe_Map.sMaceratorRecipes;
+ }
+
+ @Override
+ public void onPreTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) {
+ super.onPreTick(aBaseMetaTileEntity, aTick);
+ if ((aBaseMetaTileEntity.isClientSide()) && (aBaseMetaTileEntity.isActive()) && (aBaseMetaTileEntity.getFrontFacing() != 1) && (aBaseMetaTileEntity.getCoverIDAtSide((byte) 1) == 0) && (!aBaseMetaTileEntity.getOpacityAtSide((byte) 1))) {
+ final Random tRandom = aBaseMetaTileEntity.getWorld().rand;
+ aBaseMetaTileEntity.getWorld().spawnParticle("smoke", (aBaseMetaTileEntity.getXCoord() + 0.8F) - (tRandom.nextFloat() * 0.6F), aBaseMetaTileEntity.getYCoord() + 0.3f + (tRandom.nextFloat() * 0.2F), (aBaseMetaTileEntity.getZCoord() + 1.2F) - (tRandom.nextFloat() * 1.6F), 0.0D, 0.0D, 0.0D);
+ }
+ }
+
+ @Override
+ public boolean checkRecipe(final ItemStack aStack) {
+ return checkRecipeGeneric(getMaxParallelRecipes(), getEuDiscountForParallelism(), 60, 7500);
+ }
+
+ @Override
+ protected boolean doesMachineBoostOutput() {
+ return true;
+ }
+
+ @Override
+ public int getMaxParallelRecipes() {
+ final long tVoltage = getMaxInputVoltage();
+ final byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage));
+ return Math.max(1, 8 * tTier);
+ }
+
+ @Override
+ public int getEuDiscountForParallelism() {
+ return 100;
+ }
+
+ @Override
+ public int getMaxEfficiency(final ItemStack aStack) {
+ return 10000;
+ }
+
+ @Override
+ public int getPollutionPerSecond(final ItemStack aStack) {
+ return CORE.ConfigSwitches.pollutionPerSecondMultiIndustrialMacerator;
+ }
+
+ @Override
+ public int getAmountOfOutputs() {
+ return 16;
+ }
+
+ @Override
+ public boolean explodesOnComponentBreak(final ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public boolean isOverclockerUpgradable() {
+ return true;
+ }
+
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMixer.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMixer.java
new file mode 100644
index 0000000000..5e405d426d
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMixer.java
@@ -0,0 +1,257 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing;
+
+import java.util.ArrayList;
+
+import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
+import com.gtnewhorizon.structurelib.structure.StructureDefinition;
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.TAE;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.implementations.*;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.fluids.FluidStack;
+
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
+
+public class GregtechMetaTileEntity_IndustrialMixer
+extends GregtechMeta_MultiBlockBase {
+
+ public static int CASING_TEXTURE_ID;
+ public static String mCasingName = "Advanced Blast Furnace Casing";
+ public static String mCasingName2 = "Advanced Blast Furnace Casing";
+ private int mCasing;
+ private IStructureDefinition<GregtechMetaTileEntity_IndustrialMixer> STRUCTURE_DEFINITION = null;
+
+
+ public GregtechMetaTileEntity_IndustrialMixer(final int aID, final String aName, final String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ CASING_TEXTURE_ID = TAE.getIndexFromPage(2, 2);
+ mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings3Misc, 2);
+ mCasingName2 = ItemUtils.getLocalizedNameOfBlock(GregTech_API.sBlockCasings4, 11);
+ }
+
+ public GregtechMetaTileEntity_IndustrialMixer(final String aName) {
+ super(aName);
+ CASING_TEXTURE_ID = TAE.getIndexFromPage(2, 2);
+ mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings3Misc, 2);
+ mCasingName2 = ItemUtils.getLocalizedNameOfBlock(GregTech_API.sBlockCasings4, 11);
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaTileEntity_IndustrialMixer(this.mName);
+ }
+
+ @Override
+ public String getMachineType() {
+ return "Mixer";
+ }
+
+ @Override
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
+
+ if (mCasingName.toLowerCase().contains(".name")) {
+ mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings3Misc, 2);
+ }
+ if (mCasingName2.toLowerCase().contains(".name")) {
+ mCasingName2 = ItemUtils.getLocalizedNameOfBlock(GregTech_API.sBlockCasings4, 11);
+ }
+
+ GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType(getMachineType())
+ .addInfo("Controller Block for the Industrial Mixer")
+ .addInfo("250% faster than using single block machines of the same voltage")
+ .addInfo("Processes eight recipes per voltage tier")
+ .addPollutionAmount(getPollutionPerSecond(null))
+ .addSeparator()
+ .beginStructureBlock(3, 4, 3, false)
+ .addController("Second Layer Center")
+ .addCasingInfo(mCasingName, 16)
+ .addCasingInfo(mCasingName2, 2)
+ .addInputBus("Any Casing", 1)
+ .addOutputBus("Any Casing", 1)
+ .addInputHatch("Any Casing", 1)
+ .addOutputHatch("Any Casing", 1)
+ .addEnergyHatch("Any Casing", 1)
+ .addMaintenanceHatch("Any Casing", 1)
+ .addMufflerHatch("Any Casing", 1)
+ .toolTipFinisher(CORE.GT_Tooltip_Builder);
+ return tt;
+ }
+
+ @Override
+ public IStructureDefinition<GregtechMetaTileEntity_IndustrialMixer> getStructureDefinition() {
+ if (STRUCTURE_DEFINITION == null) {
+ STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_IndustrialMixer>builder()
+ .addShape(mName, transpose(new String[][]{
+ {"CCC", "CCC", "CCC"},
+ {"CCC", "CMC", "CCC"},
+ {"C~C", "CMC", "CCC"},
+ {"CCC", "CCC", "CCC"},
+ }))
+ .addElement(
+ 'C',
+ ofChain(
+ ofHatchAdder(
+ GregtechMetaTileEntity_IndustrialMixer::addIndustrialMixerList, CASING_TEXTURE_ID, 1
+ ),
+ onElementPass(
+ x -> ++x.mCasing,
+ ofBlock(
+ ModBlocks.blockCasings3Misc, 2
+ )
+ )
+ )
+ )
+ .addElement(
+ 'M',
+ ofBlock(
+ GregTech_API.sBlockCasings4, 11
+ )
+ )
+ .build();
+ }
+ return STRUCTURE_DEFINITION;
+ }
+
+ @Override
+ public void construct(ItemStack stackSize, boolean hintsOnly) {
+ buildPiece(mName , stackSize, hintsOnly, 1, 2, 0);
+ }
+
+ @Override
+ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ mCasing = 0;
+ return checkPiece(mName, 1, 2, 0) && mCasing >= 16 && checkHatch();
+ }
+
+ public final boolean addIndustrialMixerList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null) {
+ return false;
+ } else {
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public String getSound() {
+ return GregTech_API.sSoundList.get(Integer.valueOf(203));
+ }
+
+ @Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+ if (aSide == aFacing) {
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(CASING_TEXTURE_ID), new GT_RenderedTexture(aActive ? TexturesGtBlock.Overlay_Machine_Controller_Default_Active : TexturesGtBlock.Overlay_Machine_Controller_Default)};
+ }
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(CASING_TEXTURE_ID)};
+ }
+
+ @Override
+ public boolean hasSlotInGUI() {
+ return false;
+ }
+
+ @Override
+ public String getCustomGUIResourceName() {
+ return "IndustrialMixer";
+ }
+
+ @Override
+ public GT_Recipe.GT_Recipe_Map getRecipeMap() {
+ return gregtech.api.util.GTPP_Recipe.GTPP_Recipe_Map.sMultiblockMixerRecipes_GT;
+ }
+
+ @Override
+ public boolean checkRecipe(final ItemStack aStack) {
+ for (GT_MetaTileEntity_Hatch_InputBus tBus : mInputBusses) {
+ ArrayList<ItemStack> tBusItems = new ArrayList<ItemStack>();
+ tBus.mRecipeMap = getRecipeMap();
+ if (isValidMetaTileEntity(tBus)) {
+ for (int i = tBus.getBaseMetaTileEntity().getSizeInventory() - 1; i >= 0; i--) {
+ if (tBus.getBaseMetaTileEntity().getStackInSlot(i) != null)
+ tBusItems.add(tBus.getBaseMetaTileEntity().getStackInSlot(i));
+ }
+ }
+ ItemStack[] inputs = new ItemStack[tBusItems.size()];
+ int slot = 0;
+ for (ItemStack g : tBusItems) {
+ inputs[slot++] = g;
+ }
+ if (inputs.length > 0) {
+ log("Recipe. ["+inputs.length+"]["+getMaxParallelRecipes()+"]");
+ FluidStack[] fluid = this.getStoredFluids().toArray(new FluidStack[] {});
+ if (checkRecipeGeneric(inputs,fluid , getMaxParallelRecipes(), getEuDiscountForParallelism(), 250, 10000)) {
+ log("Recipe 2.");
+ return true;
+ }
+ }
+
+ }
+ return false;
+ }
+
+ @Override
+ public int getMaxParallelRecipes() {
+ return (8 * GT_Utility.getTier(this.getMaxInputVoltage()));
+ }
+
+ @Override
+ public int getEuDiscountForParallelism() {
+ return 100;
+ }
+
+ @Override
+ public void startProcess() {
+ this.sendLoopStart((byte) 1);
+ }
+
+ @Override
+ public int getMaxEfficiency(final ItemStack aStack) {
+ return 10000;
+ }
+
+ @Override
+ public int getPollutionPerSecond(final ItemStack aStack) {
+ return CORE.ConfigSwitches.pollutionPerSecondMultiIndustrialMixer;
+ }
+
+ @Override
+ public int getAmountOfOutputs() {
+ return 1;
+ }
+
+ @Override
+ public boolean explodesOnComponentBreak(final ItemStack aStack) {
+ return false;
+ }
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMultiMachine.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMultiMachine.java
new file mode 100644
index 0000000000..a0909a4fff
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMultiMachine.java
@@ -0,0 +1,541 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing;
+
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
+import static gtPlusPlus.core.util.data.ArrayUtils.removeNulls;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
+import com.gtnewhorizon.structurelib.structure.StructureDefinition;
+import gregtech.api.metatileentity.implementations.*;
+import gregtech.api.util.*;
+import gtPlusPlus.core.lib.CORE;
+import org.apache.commons.lang3.ArrayUtils;
+
+import gregtech.api.enums.TAE;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.objects.GT_RenderedTexture;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.recipe.common.CI;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import gtPlusPlus.core.util.minecraft.PlayerUtils;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraftforge.fluids.FluidStack;
+
+public class GregtechMetaTileEntity_IndustrialMultiMachine
+extends GregtechMeta_MultiBlockBase {
+
+ protected int mInternalMode = 0;
+ protected GT_Recipe[] mLastRecipeExtended = new GT_Recipe[9];
+ private static final int MODE_COMPRESSOR = 0;
+ private static final int MODE_LATHE = 1;
+ private static final int MODE_MAGNETIC = 2;
+ private static final int MODE_FERMENTER = 3;
+ private static final int MODE_FLUIDEXTRACT = 4;
+ private static final int MODE_EXTRACTOR = 5;
+ private static final int MODE_LASER = 6;
+ private static final int MODE_AUTOCLAVE = 7;
+ private static final int MODE_FLUIDSOLIDIFY = 8;
+ private static final int[][] MODE_MAP = new int[][] {{0, 1, 2}, {3, 4, 5}, {6, 7, 8}};
+ public static final String[] aToolTipNames = new String[9];
+ private int mCasing;
+ private IStructureDefinition<GregtechMetaTileEntity_IndustrialMultiMachine> STRUCTURE_DEFINITION = null;
+
+ static {
+ for (int id = 0; id < 9; id++) {
+ String aNEI = GT_LanguageManager.getTranslation(getRecipeMap(id).mUnlocalizedName);
+ aToolTipNames[id] = aNEI != null ? aNEI : "BAD NEI NAME (Report to Github)";
+ }
+ }
+
+
+ public GregtechMetaTileEntity_IndustrialMultiMachine(final int aID, final String aName, final String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ }
+
+ public GregtechMetaTileEntity_IndustrialMultiMachine(final String aName) {
+ super(aName);
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaTileEntity_IndustrialMultiMachine(this.mName);
+ }
+
+ @Override
+ public String getMachineType() {
+ return "Nine in One";
+ }
+
+ @Override
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
+
+ String[] aBuiltStrings = new String[3];
+ aBuiltStrings[0] = aToolTipNames[0] + ", " + aToolTipNames[1] + ", " + aToolTipNames[2];
+ aBuiltStrings[1] = aToolTipNames[3] + ", " + aToolTipNames[4] + ", " + aToolTipNames[5];
+ aBuiltStrings[2] = aToolTipNames[6] + ", " + aToolTipNames[7];
+
+ GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType(getMachineType())
+ .addInfo("Controller Block for the Industrial Multi-Machine")
+ .addInfo("250% faster than using single block machines of the same voltage")
+ .addInfo("Only uses 80% of the eu/t normally required")
+ .addInfo("Processes two items per voltage tier")
+ .addInfo("Machine Type: [A] - " + EnumChatFormatting.YELLOW + aBuiltStrings[0] + EnumChatFormatting.RESET)
+ .addInfo("Machine Type: [B] - " + EnumChatFormatting.YELLOW + aBuiltStrings[1] + EnumChatFormatting.RESET)
+ .addInfo("Machine Type: [C] - " + EnumChatFormatting.YELLOW + aBuiltStrings[2] + EnumChatFormatting.RESET)
+ .addInfo("Read Multi-Machine Manual for extra information")
+ .addPollutionAmount(getPollutionPerSecond(null))
+ .addSeparator()
+ .beginStructureBlock(3, 3, 3, true)
+ .addController("Front Center")
+ .addCasingInfo("Multi-Use Casings", 6)
+ .addInputBus("Any Casing", 1)
+ .addOutputBus("Any Casing", 1)
+ .addInputHatch("Any Casing", 1)
+ .addOutputHatch("Any Casing", 1)
+ .addEnergyHatch("Any Casing", 1)
+ .addMaintenanceHatch("Any Casing", 1)
+ .addMufflerHatch("Any Casing", 1)
+ .toolTipFinisher(CORE.GT_Tooltip_Builder);
+ return tt;
+ }
+
+ @Override
+ public IStructureDefinition<GregtechMetaTileEntity_IndustrialMultiMachine> getStructureDefinition() {
+ if (STRUCTURE_DEFINITION == null) {
+ STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_IndustrialMultiMachine>builder()
+ .addShape(mName, transpose(new String[][]{
+ {"CCC", "CCC", "CCC"},
+ {"C~C", "C-C", "CCC"},
+ {"CCC", "CCC", "CCC"},
+ }))
+ .addElement(
+ 'C',
+ ofChain(
+ ofHatchAdder(
+ GregtechMetaTileEntity_IndustrialMultiMachine::addIndustrialMultiMachineList, getTextureIndex(), 1
+ ),
+ onElementPass(
+ x -> ++x.mCasing,
+ ofBlock(
+ ModBlocks.blockCasings3Misc, 2
+ )
+ )
+ )
+ )
+ .build();
+ }
+ return STRUCTURE_DEFINITION;
+ }
+
+ @Override
+ public void construct(ItemStack stackSize, boolean hintsOnly) {
+ buildPiece(mName , stackSize, hintsOnly, 1, 1, 0);
+ }
+
+ @Override
+ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ mCasing = 0;
+ return checkPiece(mName, 1, 1, 0) && mCasing >= 6 && checkHatch();
+ }
+
+ public final boolean addIndustrialMultiMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null) {
+ return false;
+ } else {
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+ if (aSide == aFacing) {
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(getTextureIndex()), new GT_RenderedTexture(aActive ? TexturesGtBlock.Overlay_Machine_Controller_Advanced_Active : TexturesGtBlock.Overlay_Machine_Controller_Advanced)};
+ }
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(getTextureIndex())};
+ }
+
+ @Override
+ public boolean hasSlotInGUI() {
+ return false;
+ }
+
+ @Override
+ public String getCustomGUIResourceName() {
+ return "Generic3By3";
+ }
+
+ @Override
+ public boolean checkRecipe(final ItemStack aStack) {
+ ArrayList<FluidStack> tFluids = getStoredFluids();
+ //Logger.MACHINE_INFO("1");
+ for (GT_MetaTileEntity_Hatch_InputBus tBus : mInputBusses) {
+ ArrayList<ItemStack> tBusItems = new ArrayList<ItemStack>();
+ tBus.mRecipeMap = getRecipeMap();
+ //Logger.MACHINE_INFO("2");
+ if (isValidMetaTileEntity(tBus)) {
+ //Logger.MACHINE_INFO("3");
+ for (int i = tBus.getBaseMetaTileEntity().getSizeInventory() - 1; i >= 0; i--) {
+ if (tBus.getBaseMetaTileEntity().getStackInSlot(i) != null)
+ tBusItems.add(tBus.getBaseMetaTileEntity().getStackInSlot(i));
+ }
+ }
+
+ boolean aFoundCircuitInBus = false;
+ for (ItemStack aBusItem : tBusItems) {
+ if (ItemUtils.isControlCircuit(aBusItem)) {
+ aFoundCircuitInBus = true;
+ }
+ }
+ if (!aFoundCircuitInBus) {
+ continue;
+ }
+
+ Object[] tempArray = tFluids.toArray(new FluidStack[] {});
+ FluidStack[] properArray;
+ properArray = ((tempArray != null && tempArray.length > 0) ? (FluidStack[]) tempArray : new FluidStack[] {});
+
+ //Logger.MACHINE_INFO("4");
+ if (checkRecipeGeneric(tBusItems.toArray(new ItemStack[]{}), properArray,
+ (2*GT_Utility.getTier(this.getMaxInputVoltage())), 80, 250, 10000)) return true;
+ }
+ return false;
+
+ //return checkRecipeGeneric(2*GT_Utility.getTier(this.getMaxInputVoltage()), 90, 180);
+ }
+
+ @Override
+ public int getMaxParallelRecipes() {
+ return (2 * GT_Utility.getTier(this.getMaxInputVoltage()));
+ }
+
+ @Override
+ public int getEuDiscountForParallelism() {
+ return 80;
+ }
+
+ @Override
+ public int getMaxEfficiency(final ItemStack aStack) {
+ return 10000;
+ }
+
+ @Override
+ public int getPollutionPerSecond(final ItemStack aStack) {
+ if (mInternalMode == 0) {
+ return CORE.ConfigSwitches.pollutionPerSecondMultiIndustrialMultiMachine_ModeMetal;
+ }
+ else if (mInternalMode == 1) {
+ return CORE.ConfigSwitches.pollutionPerSecondMultiIndustrialMultiMachine_ModeFluid;
+ }
+ else { //config 2
+ return CORE.ConfigSwitches.pollutionPerSecondMultiIndustrialMultiMachine_ModeMisc;
+ }
+ }
+
+ public int getTextureIndex() {
+ return TAE.getIndexFromPage(2, 2);
+ }
+
+ @Override
+ public int getAmountOfOutputs() {
+ return 1;
+ }
+
+ @Override
+ public boolean explodesOnComponentBreak(final ItemStack aStack) {
+ return false;
+ }
+
+ private ItemStack getCircuit(ItemStack[] t) {
+ for (ItemStack j : t) {
+ if (j.getItem() == CI.getNumberedCircuit(0).getItem()) {
+ if (j.getItemDamage() >= 20 && j.getItemDamage() <= 22) {
+ return j;
+ }
+ }
+ }
+ return null;
+ }
+
+ private final int getCircuitID(ItemStack circuit) {
+ int H = circuit.getItemDamage();
+ int T = (H == 20 ? 0 : (H == 21 ? 1 : (H == 22 ? 2 : -1)));
+ return MODE_MAP[this.mInternalMode][T];
+ }
+
+ @Override
+ public GT_Recipe.GT_Recipe_Map getRecipeMap() {
+ return null;
+ }
+
+ private final GT_Recipe.GT_Recipe_Map getRecipeMap(ItemStack circuit) {
+ return getRecipeMap(getCircuitID(circuit));
+ }
+
+ private static final GT_Recipe.GT_Recipe_Map getRecipeMap(int aMode) {
+ if (aMode == MODE_COMPRESSOR) {
+ return GT_Recipe.GT_Recipe_Map.sCompressorRecipes;
+ }
+ else if (aMode == MODE_LATHE) {
+ return GT_Recipe.GT_Recipe_Map.sLatheRecipes;
+ }
+ else if (aMode == MODE_MAGNETIC) {
+ return GT_Recipe.GT_Recipe_Map.sPolarizerRecipes;
+ }
+ else if (aMode == MODE_FERMENTER) {
+ return GT_Recipe.GT_Recipe_Map.sFermentingRecipes;
+ }
+ else if (aMode == MODE_FLUIDEXTRACT) {
+ return GT_Recipe.GT_Recipe_Map.sFluidExtractionRecipes;
+ }
+ else if (aMode == MODE_EXTRACTOR) {
+ return GT_Recipe.GT_Recipe_Map.sExtractorRecipes;
+ }
+ else if (aMode == MODE_LASER) {
+ return GT_Recipe.GT_Recipe_Map.sLaserEngraverRecipes;
+ }
+ else if (aMode == MODE_AUTOCLAVE) {
+ return GT_Recipe.GT_Recipe_Map.sAutoclaveRecipes;
+ }
+ else if (aMode == MODE_FLUIDSOLIDIFY) {
+ return GT_Recipe.GT_Recipe_Map.sFluidSolidficationRecipes;
+ }
+ else {
+ return null;
+ }
+ }
+
+ @Override
+ public boolean checkRecipeGeneric(
+ ItemStack[] aItemInputs, FluidStack[] aFluidInputs,
+ int aMaxParallelRecipes, int aEUPercent,
+ int aSpeedBonusPercent, int aOutputChanceRoll) {
+
+ // Based on the Processing Array. A bit overkill, but very flexible.
+
+ // Get Circuit info for this recipe.
+ ItemStack tCircuit = getCircuit(aItemInputs);
+ int tCircuitID = getCircuitID(tCircuit);
+
+ Logger.MACHINE_INFO("Mode: "+tCircuitID);
+
+ // Reset outputs and progress stats
+ this.mEUt = 0;
+ this.mMaxProgresstime = 0;
+ this.mOutputItems = new ItemStack[]{};
+ this.mOutputFluids = new FluidStack[]{};
+
+
+
+ long tVoltage = getMaxInputVoltage();
+ byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage));
+
+ GT_Recipe.GT_Recipe_Map tRecipeMap = this.getRecipeMap(tCircuit);
+ if (tRecipeMap == null)
+ return false;
+ GT_Recipe tRecipe = tRecipeMap.findRecipe(
+ getBaseMetaTileEntity(), this.mLastRecipeExtended[tCircuitID], false,
+ gregtech.api.enums.GT_Values.V[tTier], aFluidInputs, aItemInputs);
+
+ // Remember last recipe - an optimization for findRecipe()
+ //this.mLastRecipe = tRecipe; //Let's not do this, it's bad.
+ //Instead, how about I use a array for types?
+ this.mLastRecipeExtended[tCircuitID] = tRecipe;
+
+ if (tRecipe == null) {
+ Logger.MACHINE_INFO("BAD RETURN - 1|"+tCircuitID);
+
+ if (aItemInputs.length > 0) {
+ Logger.MACHINE_INFO("Input Items: "+ItemUtils.getArrayStackNames(aItemInputs));
+ }
+ if (aFluidInputs.length > 0) {
+ Logger.MACHINE_INFO("Input Fluids: "+ItemUtils.getFluidArrayStackNames(aFluidInputs));
+ }
+ return false;
+ }
+
+ aMaxParallelRecipes = this.canBufferOutputs(tRecipe, aMaxParallelRecipes);
+ if (aMaxParallelRecipes == 0) {
+ Logger.MACHINE_INFO("BAD RETURN - 2|"+tCircuitID);
+ return false;
+ }
+
+ // EU discount
+ float tRecipeEUt = (tRecipe.mEUt * aEUPercent) / 100.0f;
+ float tTotalEUt = 0.0f;
+
+ int parallelRecipes = 0;
+
+ Logger.WARNING("parallelRecipes: "+parallelRecipes);
+ Logger.WARNING("aMaxParallelRecipes: "+aMaxParallelRecipes);
+ Logger.WARNING("tTotalEUt: "+tTotalEUt);
+ Logger.WARNING("tVoltage: "+tVoltage);
+ Logger.WARNING("tRecipeEUt: "+tRecipeEUt);
+ // Count recipes to do in parallel, consuming input items and fluids and considering input voltage limits
+ for (; parallelRecipes < aMaxParallelRecipes && tTotalEUt < (tVoltage - tRecipeEUt); parallelRecipes++) {
+ if (!tRecipe.isRecipeInputEqual(true, aFluidInputs, aItemInputs)) {
+ Logger.WARNING("Broke at "+parallelRecipes+".");
+ break;
+ }
+ Logger.WARNING("Bumped EU from "+tTotalEUt+" to "+(tTotalEUt+tRecipeEUt)+".");
+ tTotalEUt += tRecipeEUt;
+ }
+
+ if (parallelRecipes == 0) {
+ Logger.MACHINE_INFO("BAD RETURN - 3|"+tCircuitID);
+ return false;
+ }
+
+ // -- Try not to fail after this point - inputs have already been consumed! --
+
+
+ // Convert speed bonus to duration multiplier
+ // e.g. 100% speed bonus = 200% speed = 100%/200% = 50% recipe duration.
+ aSpeedBonusPercent = Math.max(-99, aSpeedBonusPercent);
+ float tTimeFactor = 100.0f / (100.0f + aSpeedBonusPercent);
+ this.mMaxProgresstime = (int)(tRecipe.mDuration * tTimeFactor);
+
+ this.mEUt = (int)Math.ceil(tTotalEUt);
+
+ this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
+ this.mEfficiencyIncrease = 10000;
+
+ // Overclock
+ if (this.mEUt <= 16) {
+ this.mEUt = (this.mEUt * (1 << tTier - 1) * (1 << tTier - 1));
+ this.mMaxProgresstime = (this.mMaxProgresstime / (1 << tTier - 1));
+ } else {
+ while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) {
+ this.mEUt *= 4;
+ this.mMaxProgresstime /= 2;
+ }
+ }
+
+ if (this.mEUt > 0) {
+ this.mEUt = (-this.mEUt);
+ }
+
+ this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
+
+ // Collect fluid outputs
+ FluidStack[] tOutputFluids = new FluidStack[tRecipe.mFluidOutputs.length];
+ for (int h = 0; h < tRecipe.mFluidOutputs.length; h++) {
+ if (tRecipe.getFluidOutput(h) != null) {
+ tOutputFluids[h] = tRecipe.getFluidOutput(h).copy();
+ tOutputFluids[h].amount *= parallelRecipes;
+ }
+ }
+
+ // Collect output item types
+ ItemStack[] tOutputItems = new ItemStack[tRecipe.mOutputs.length];
+ for (int h = 0; h < tRecipe.mOutputs.length; h++) {
+ if (tRecipe.getOutput(h) != null) {
+ tOutputItems[h] = tRecipe.getOutput(h).copy();
+ tOutputItems[h].stackSize = 0;
+ }
+ }
+
+ // Set output item stack sizes (taking output chance into account)
+ for (int f = 0; f < tOutputItems.length; f++) {
+ if (tRecipe.mOutputs[f] != null && tOutputItems[f] != null) {
+ for (int g = 0; g < parallelRecipes; g++) {
+ if (getBaseMetaTileEntity().getRandomNumber(aOutputChanceRoll) < tRecipe.getOutputChance(f))
+ tOutputItems[f].stackSize += tRecipe.mOutputs[f].stackSize;
+ }
+ }
+ }
+
+ tOutputItems = removeNulls(tOutputItems);
+
+ // Sanitize item stack size, splitting any stacks greater than max stack size
+ List<ItemStack> splitStacks = new ArrayList<ItemStack>();
+ for (ItemStack tItem : tOutputItems) {
+ while (tItem.getMaxStackSize() < tItem.stackSize) {
+ ItemStack tmp = tItem.copy();
+ tmp.stackSize = tmp.getMaxStackSize();
+ tItem.stackSize = tItem.stackSize - tItem.getMaxStackSize();
+ splitStacks.add(tmp);
+ }
+ }
+
+ if (splitStacks.size() > 0) {
+ ItemStack[] tmp = new ItemStack[splitStacks.size()];
+ tmp = splitStacks.toArray(tmp);
+ tOutputItems = ArrayUtils.addAll(tOutputItems, tmp);
+ }
+
+ // Strip empty stacks
+ List<ItemStack> tSList = new ArrayList<ItemStack>();
+ for (ItemStack tS : tOutputItems) {
+ if (tS.stackSize > 0) tSList.add(tS);
+ }
+ tOutputItems = tSList.toArray(new ItemStack[tSList.size()]);
+
+ // Commit outputs
+ this.mOutputItems = tOutputItems;
+ this.mOutputFluids = tOutputFluids;
+ updateSlots();
+
+ // Play sounds (GT++ addition - GT multiblocks play no sounds)
+ startProcess();
+
+ Logger.MACHINE_INFO("GOOD RETURN - 1|"+tCircuitID);
+ return true;
+ }
+
+ @Override
+ public void onModeChangeByScrewdriver(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ if (mInternalMode < 2) {
+ mInternalMode++;
+ }
+ else {
+ mInternalMode = 0;
+ }
+ String mModeString = (mInternalMode == 0 ? "Metal" : mInternalMode == 1 ? "Fluid" : mInternalMode == 2 ? "Misc." : "null");
+ PlayerUtils.messagePlayer(aPlayer, "Multi-Machine is now in "+mModeString+" mode.");
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ aNBT.setInteger("mInternalMode", mInternalMode);
+ super.saveNBTData(aNBT);
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ this.mInternalMode = aNBT.getInteger("mInternalMode");
+ super.loadNBTData(aNBT);
+ }
+
+
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialPlatePress.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialPlatePress.java
new file mode 100644
index 0000000000..007d1a0d0f
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialPlatePress.java
@@ -0,0 +1,242 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing;
+
+import java.util.ArrayList;
+
+import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
+import com.gtnewhorizon.structurelib.structure.StructureDefinition;
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.implementations.*;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.minecraft.PlayerUtils;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraftforge.fluids.FluidStack;
+
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
+
+public class GregtechMetaTileEntity_IndustrialPlatePress extends GregtechMeta_MultiBlockBase {
+
+ private boolean mFormingMode = false;
+ private int mCasing;
+ private IStructureDefinition<GregtechMetaTileEntity_IndustrialPlatePress> STRUCTURE_DEFINITION = null;
+
+ public GregtechMetaTileEntity_IndustrialPlatePress(final int aID, final String aName, final String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ }
+
+ public GregtechMetaTileEntity_IndustrialPlatePress(final String aName) {
+ super(aName);
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaTileEntity_IndustrialPlatePress(this.mName);
+ }
+
+ @Override
+ public String getMachineType() {
+ return "Bending Machine, Forming Press";
+ }
+
+ @Override
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
+ GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType(getMachineType())
+ .addInfo("Controller Block for Advanced Bending & Forming")
+ .addInfo("500% faster than using single block machines of the same voltage")
+ .addInfo("Processes four items per voltage tier")
+ .addInfo("Circuit for recipe goes in the Input Bus")
+ .addInfo("Each Input Bus can have a different Circuit/Shape!")
+ .addPollutionAmount(getPollutionPerSecond(null))
+ .addSeparator()
+ .beginStructureBlock(3, 3, 3, true)
+ .addController("Front Center")
+ .addCasingInfo("Material Press Machine Casings", 10)
+ .addInputBus("Any Casing", 1)
+ .addOutputBus("Any Casing", 1)
+ .addEnergyHatch("Any Casing", 1)
+ .addMaintenanceHatch("Any Casing", 1)
+ .addMufflerHatch("Any Casing", 1)
+ .toolTipFinisher(CORE.GT_Tooltip_Builder);
+ return tt;
+ }
+
+ @Override
+ public IStructureDefinition<GregtechMetaTileEntity_IndustrialPlatePress> getStructureDefinition() {
+ if (STRUCTURE_DEFINITION == null) {
+ STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_IndustrialPlatePress>builder()
+ .addShape(mName, transpose(new String[][]{
+ {"CCC", "CCC", "CCC"},
+ {"C~C", "C-C", "CCC"},
+ {"CCC", "CCC", "CCC"},
+ }))
+ .addElement(
+ 'C',
+ ofChain(
+ ofHatchAdder(
+ GregtechMetaTileEntity_IndustrialPlatePress::addIndustrialPlatePressList, 50, 1
+ ),
+ onElementPass(
+ x -> ++x.mCasing,
+ ofBlock(
+ ModBlocks.blockCasingsMisc, 4
+ )
+ )
+ )
+ )
+ .build();
+ }
+ return STRUCTURE_DEFINITION;
+ }
+
+ @Override
+ public void construct(ItemStack stackSize, boolean hintsOnly) {
+ buildPiece(mName , stackSize, hintsOnly, 1, 1, 0);
+ }
+
+ @Override
+ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ mCasing = 0;
+ return checkPiece(mName, 1, 1, 0) && mCasing >= 10 && checkHatch();
+ }
+
+ public final boolean addIndustrialPlatePressList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null) {
+ return false;
+ } else {
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public String getSound() {
+ return GregTech_API.sSoundList.get(Integer.valueOf(203));
+ }
+
+ @Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+ if (aSide == aFacing) {
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(50), new GT_RenderedTexture(aActive ? TexturesGtBlock.Overlay_Machine_Controller_Default_Active : TexturesGtBlock.Overlay_Machine_Controller_Default)};
+ }
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(50)};
+ }
+
+ @Override
+ public boolean hasSlotInGUI() {
+ return false;
+ }
+
+ @Override
+ public String getCustomGUIResourceName() {
+ return "MaterialPress";
+ }
+
+ @Override
+ public GT_Recipe.GT_Recipe_Map getRecipeMap() {
+ return mFormingMode ? GT_Recipe.GT_Recipe_Map.sPressRecipes : GT_Recipe.GT_Recipe_Map.sBenderRecipes;
+ }
+
+ @Override
+ public boolean checkRecipe(final ItemStack aStack) {
+ for (GT_MetaTileEntity_Hatch_InputBus tBus : mInputBusses) {
+ ArrayList<ItemStack> tBusItems = new ArrayList<ItemStack>();
+ tBus.mRecipeMap = getRecipeMap();
+ if (isValidMetaTileEntity(tBus)) {
+ for (int i = tBus.getBaseMetaTileEntity().getSizeInventory() - 1; i >= 0; i--) {
+ if (tBus.getBaseMetaTileEntity().getStackInSlot(i) != null)
+ tBusItems.add(tBus.getBaseMetaTileEntity().getStackInSlot(i));
+ }
+ }
+
+ if (checkRecipeGeneric(tBusItems.toArray(new ItemStack[]{}), new FluidStack[]{},
+ (4* GT_Utility.getTier(this.getMaxInputVoltage())), 100, 500, 10000)) return true;
+ }
+ return false;
+ }
+
+ @Override
+ public int getMaxParallelRecipes() {
+ return (4 * GT_Utility.getTier(this.getMaxInputVoltage()));
+ }
+
+ @Override
+ public int getEuDiscountForParallelism() {
+ return 100;
+ }
+
+ @Override
+ public void startProcess() {
+ this.sendLoopStart((byte) 1);
+ }
+
+ @Override
+ public int getMaxEfficiency(final ItemStack aStack) {
+ return 10000;
+ }
+
+ @Override
+ public int getPollutionPerSecond(final ItemStack aStack) {
+ if (this.mFormingMode) return CORE.ConfigSwitches.pollutionPerSecondMultiIndustrialPlatePress_ModeForming;
+ return CORE.ConfigSwitches.pollutionPerSecondMultiIndustrialPlatePress_ModeBending;
+ }
+
+ @Override
+ public int getAmountOfOutputs() {
+ return 1;
+ }
+
+ @Override
+ public boolean explodesOnComponentBreak(final ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ aNBT.setBoolean("mFormingMode", mFormingMode);
+ super.saveNBTData(aNBT);
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ mFormingMode = aNBT.getBoolean("mFormingMode");
+ super.loadNBTData(aNBT);
+ }
+
+ @Override
+ public void onModeChangeByScrewdriver(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ mFormingMode = Utils.invertBoolean(mFormingMode);
+ if (mFormingMode){
+ PlayerUtils.messagePlayer(aPlayer, "Now running in Forming Press Mode.");
+ }
+ else {
+ PlayerUtils.messagePlayer(aPlayer, "Now running in Bending Mode.");
+ }
+ }
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialSifter.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialSifter.java
new file mode 100644
index 0000000000..c5450fec5b
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialSifter.java
@@ -0,0 +1,225 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing;
+
+import java.util.Random;
+
+import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
+import com.gtnewhorizon.structurelib.structure.StructureDefinition;
+import gregtech.api.enums.TAE;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.implementations.*;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.common.util.ForgeDirection;
+
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
+
+public class GregtechMetaTileEntity_IndustrialSifter
+extends GregtechMeta_MultiBlockBase {
+ private int mCasing;
+ private IStructureDefinition<GregtechMetaTileEntity_IndustrialSifter> STRUCTURE_DEFINITION = null;
+
+ public GregtechMetaTileEntity_IndustrialSifter(final int aID, final String aName, final String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ }
+
+ public GregtechMetaTileEntity_IndustrialSifter(final String aName) {
+ super(aName);
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaTileEntity_IndustrialSifter(this.mName);
+ }
+
+ @Override
+ public String getMachineType() {
+ return "Sifter";
+ }
+
+ @Override
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
+ GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType(getMachineType())
+ .addInfo("Controller Block for the Industrial Sifter")
+ .addInfo("400% faster than single-block machines of the same voltage")
+ .addInfo("Only uses 75% of the eu/t normally required")
+ .addInfo("Processes four items per voltage tier")
+ .addPollutionAmount(getPollutionPerSecond(null))
+ .addSeparator()
+ .beginStructureBlock(5, 3, 5, false)
+ .addController("Bottom Center")
+ .addCasingInfo("Sieve Grate", 18)
+ .addCasingInfo("Sieve Casings", 35)
+ .addInputBus("Any Casing", 1)
+ .addOutputBus("Any Casing", 1)
+ .addEnergyHatch("Any Casing", 1)
+ .addMaintenanceHatch("Any Casing", 1)
+ .addMufflerHatch("Any Casing", 1)
+ .toolTipFinisher(CORE.GT_Tooltip_Builder);
+ return tt;
+ }
+
+ @Override
+ public IStructureDefinition<GregtechMetaTileEntity_IndustrialSifter> getStructureDefinition() {
+ if (STRUCTURE_DEFINITION == null) {
+ STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_IndustrialSifter>builder()
+ .addShape(mName, transpose(new String[][]{
+ {"CCCCC", "CMMMC", "CMMMC", "CMMMC", "CCCCC"},
+ {"CCCCC", "CMMMC", "CMMMC", "CMMMC", "CCCCC"},
+ {"CC~CC", "CCCCC", "CCCCC", "CCCCC", "CCCCC"},
+ }))
+ .addElement(
+ 'C',
+ ofChain(
+ ofHatchAdder(
+ GregtechMetaTileEntity_IndustrialSifter::addIndustrialSifterList, TAE.GTPP_INDEX(21), 1
+ ),
+ onElementPass(
+ x -> ++x.mCasing,
+ ofBlock(
+ ModBlocks.blockCasings2Misc, 5
+ )
+ )
+ )
+ )
+ .addElement(
+ 'M',
+ ofBlock(
+ ModBlocks.blockCasings2Misc, 6
+ )
+ )
+ .build();
+ }
+ return STRUCTURE_DEFINITION;
+ }
+
+ @Override
+ public void construct(ItemStack stackSize, boolean hintsOnly) {
+ buildPiece(mName , stackSize, hintsOnly, 2, 2, 0);
+ }
+
+ @Override
+ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ mCasing = 0;
+ return checkPiece(mName, 2, 2, 0) && mCasing >= 35 && mOutputBusses.size() >= 4 && checkHatch();
+ }
+
+ public final boolean addIndustrialSifterList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null) {
+ return false;
+ } else {
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+ if (aSide == aFacing) {
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(TAE.GTPP_INDEX(21)), new GT_RenderedTexture(aActive ? TexturesGtBlock.Overlay_Machine_Controller_Default_Active : TexturesGtBlock.Overlay_Machine_Controller_Default)};
+ }
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(TAE.GTPP_INDEX(21))};
+ }
+
+ @Override
+ public boolean hasSlotInGUI() {
+ return false;
+ }
+
+ @Override
+ public String getCustomGUIResourceName() {
+ return "IndustrialSifter";
+ }
+
+ @Override
+ public GT_Recipe.GT_Recipe_Map getRecipeMap() {
+ return GT_Recipe.GT_Recipe_Map.sSifterRecipes;
+ }
+
+ @Override
+ public void onPreTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) {
+ super.onPreTick(aBaseMetaTileEntity, aTick);
+ if ((aBaseMetaTileEntity.isClientSide()) && (aBaseMetaTileEntity.isActive()) && (aBaseMetaTileEntity.getFrontFacing() != 1) && (aBaseMetaTileEntity.getCoverIDAtSide((byte) 1) == 0) && (!aBaseMetaTileEntity.getOpacityAtSide((byte) 1))) {
+ final Random tRandom = aBaseMetaTileEntity.getWorld().rand;
+ if (tRandom.nextFloat() > 0.4) return;
+
+ final int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 2;
+ final int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * 2;
+
+ aBaseMetaTileEntity.getWorld().spawnParticle("smoke",
+ (aBaseMetaTileEntity.getXCoord() + xDir + 2.1F) - (tRandom.nextFloat() * 3.2F),
+ aBaseMetaTileEntity.getYCoord() + 2.5f + (tRandom.nextFloat() * 1.2F),
+ (aBaseMetaTileEntity.getZCoord() + zDir + 2.1F) - (tRandom.nextFloat() * 3.2F),
+ 0.0, 0.0, 0.0);
+
+ }
+ }
+
+ @Override
+ public boolean checkRecipe(final ItemStack aStack) {
+ return checkRecipeGeneric((4* GT_Utility.getTier(this.getMaxInputVoltage())), 75, 400, 10000);
+ }
+
+ @Override
+ protected boolean doesMachineBoostOutput() {
+ return false;
+ }
+
+ @Override
+ public int getMaxParallelRecipes() {
+ return (4 * GT_Utility.getTier(this.getMaxInputVoltage()));
+ }
+
+ @Override
+ public int getEuDiscountForParallelism() {
+ return 75;
+ }
+
+ @Override
+ public int getMaxEfficiency(final ItemStack aStack) {
+ return 10000;
+ }
+
+ @Override
+ public int getPollutionPerSecond(final ItemStack aStack) {
+ return CORE.ConfigSwitches.pollutionPerSecondMultiIndustrialSifter;
+ }
+
+ @Override
+ public int getAmountOfOutputs() {
+ return 16;
+ }
+
+ @Override
+ public boolean explodesOnComponentBreak(final ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public boolean isOverclockerUpgradable() {
+ return true;
+ }
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialSinter.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialSinter.java
new file mode 100644
index 0000000000..5a62c6c335
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialSinter.java
@@ -0,0 +1,268 @@
+/*
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing;
+
+import java.util.ArrayList;
+
+import net.minecraft.block.Block;
+import net.minecraft.client.renderer.RenderBlocks;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.ItemStack;
+
+import gregtech.api.enums.TAE;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Maintenance;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_Utility;
+
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.xmod.gregtech.api.gui.GUI_MultiMachine;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+
+public class GregtechMetaTileEntity_IndustrialSinter
+extends GT_MetaTileEntity_MultiBlockBase {
+
+
+ RenderBlocks asdasd = RenderBlocks.getInstance();
+
+ public GregtechMetaTileEntity_IndustrialSinter(final int aID, final String aName, final String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ }
+
+ public GregtechMetaTileEntity_IndustrialSinter(final String aName) {
+ super(aName);
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaTileEntity_IndustrialSinter(this.mName);
+ }
+
+ @Override
+ public String[] getDescription() {
+ return new String[]{
+ "Controller Block for the Industrial Sinter Furnace",
+ "Size: 3x5x3 [WxLxH] (Hollow)", "Controller (front centered)",
+ "2x Input Bus (side centered)",
+ "2x Output Bus (side centered)",
+ "1x Energy Hatch (top or bottom centered)",
+ "1x Maintenance Hatch (back centered)",
+ "Sinter Furnace Casings for the rest (32 at least!)",
+ "Causes " + 20 * this.getPollutionPerTick(null) + " Pollution per second",
+ CORE.GT_Tooltip
+ };
+ }
+
+ @Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+ if (aSide == aFacing) {
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(TAE.GTPP_INDEX(7)), new GT_RenderedTexture(aActive ? TexturesGtBlock.Overlay_Machine_Controller_Default_Active : TexturesGtBlock.Overlay_Machine_Controller_Default)};
+ }
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(TAE.GTPP_INDEX(7))};
+ }
+
+ @Override
+ public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "WireFactory.png");
+ }
+
+ @Override
+ public GT_Recipe.GT_Recipe_Map getRecipeMap() {
+ return GT_Recipe.GT_Recipe_Map.sWiremillRecipes;
+ }
+
+ @Override
+ public boolean isCorrectMachinePart(final ItemStack aStack) {
+ return true;
+ }
+
+ @Override
+ public boolean isFacingValid(final byte aFacing) {
+ return aFacing > 1;
+ }
+
+ @Override
+ public boolean checkRecipe(final ItemStack aStack) {
+ final ArrayList<ItemStack> tInputList = this.getStoredInputs();
+ for (final ItemStack tInput : tInputList) {
+ final long tVoltage = this.getMaxInputVoltage();
+ final byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage));
+
+ final GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sWiremillRecipes.findRecipe(this.getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], null, new ItemStack[]{tInput});
+ if (tRecipe != null) {
+ if (tRecipe.isRecipeInputEqual(true, null, new ItemStack[]{tInput})) {
+ this.mEfficiency = (10000 - ((this.getIdealStatus() - this.getRepairStatus()) * 1000));
+ this.mEfficiencyIncrease = 10000;
+ if (tRecipe.mEUt <= 16) {
+ this.mEUt = (tRecipe.mEUt * (1 << (tTier - 1)) * (1 << (tTier - 1)));
+ this.mMaxProgresstime = (tRecipe.mDuration / (1 << (tTier - 1)));
+ } else {
+ this.mEUt = tRecipe.mEUt;
+ this.mMaxProgresstime = tRecipe.mDuration;
+ while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) {
+ this.mEUt *= 4;
+ this.mMaxProgresstime /= 2;
+ }
+ }
+ if (this.mEUt > 0) {
+ this.mEUt = (-this.mEUt);
+ }
+ this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
+ this.mOutputItems = new ItemStack[]{tRecipe.getOutput(0)};
+ this.updateSlots();
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public boolean checkMachine(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) {
+ final int controllerX = aBaseMetaTileEntity.getXCoord();
+ final int controllerY = aBaseMetaTileEntity.getYCoord();
+ final int controllerZ = aBaseMetaTileEntity.getZCoord();
+
+ final byte tSide = this.getBaseMetaTileEntity().getBackFacing();
+ if ((this.getBaseMetaTileEntity().getAirAtSideAndDistance(this.getBaseMetaTileEntity().getBackFacing(), 1)) && (this.getBaseMetaTileEntity().getAirAtSideAndDistance(this.getBaseMetaTileEntity().getBackFacing(), 2) && (this.getBaseMetaTileEntity().getAirAtSideAndDistance(this.getBaseMetaTileEntity().getBackFacing(), 3)))) {
+ int tAirCount = 0;
+ for (byte i = -1; i < 2; i = (byte) (i + 1)) {
+ for (byte j = -1; j < 2; j = (byte) (j + 1)) {
+ for (byte k = -1; k < 2; k = (byte) (k + 1)) {
+ if (this.getBaseMetaTileEntity().getAirOffset(i, j, k)) {
+ Logger.INFO("Found Air at: "+(controllerX+i)+" "+(controllerY+k)+" "+(controllerZ+k));
+ //if (aBaseMetaTileEntity.getWorld().isRemote){
+ //asdasd.renderStandardBlock(ModBlocks.MatterFabricatorEffectBlock, (controllerX+i), (controllerY+k), (controllerZ+k));
+ //UtilsRendering.drawBlockInWorld((controllerX+i), (controllerY+k), (controllerZ+k), Color.YELLOW_GREEN);
+ //}
+ tAirCount++;
+ }
+ }
+ }
+ }
+ if (tAirCount != 10) {
+ Logger.INFO("False. Air != 10. Air == "+tAirCount);
+ //return false;
+ }
+ for (byte i = 2; i < 6; i = (byte) (i + 1)) {
+ //UtilsRendering.drawBlockInWorld((controllerX+i), (controllerY), (controllerZ), Color.LIME_GREEN);
+ IGregTechTileEntity tTileEntity;
+ if ((null != (tTileEntity = this.getBaseMetaTileEntity().getIGregTechTileEntityAtSideAndDistance(i, 2))) &&
+ (tTileEntity.getFrontFacing() == this.getBaseMetaTileEntity().getFrontFacing()) && (tTileEntity.getMetaTileEntity() != null) &&
+ ((tTileEntity.getMetaTileEntity() instanceof GregtechMetaTileEntity_IndustrialSinter))) {
+ //Utils.LOG_INFO("False 1");
+ return false;
+ }
+ }
+ final int tX = this.getBaseMetaTileEntity().getXCoord();
+ final int tY = this.getBaseMetaTileEntity().getYCoord();
+ final int tZ = this.getBaseMetaTileEntity().getZCoord();
+ for (byte i = -1; i < 2; i = (byte) (i + 1)) {
+ for (byte j = -1; j < 2; j = (byte) (j + 1)) {
+ if ((i != 0) || (j != 0)) {
+ for (byte k = 0; k < 5; k = (byte) (k + 1)) {
+ //UtilsRendering.drawBlockInWorld((controllerX+i), (controllerY+k), (controllerZ+k), Color.ORANGE);
+ if (((i == 0) || (j == 0)) && ((k == 1) || (k == 2) || (k == 3))) {
+ //UtilsRendering.drawBlockInWorld((controllerX+i), (controllerY+k), (controllerZ+k), Color.TOMATO);
+ if ((this.getBaseMetaTileEntity().getBlock(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i)) == this.getCasingBlock()) && (this.getBaseMetaTileEntity().getMetaID(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i)) == this.getCasingMeta())) {
+ }
+ else if (!this.addToMachineList(this.getBaseMetaTileEntity().getIGregTechTileEntity(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i))) && (!this.addEnergyInputToMachineList(this.getBaseMetaTileEntity().getIGregTechTileEntity(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i))))) {
+ Logger.INFO("False 2");
+ return false;
+ }
+ }
+ else if ((this.getBaseMetaTileEntity().getBlock(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i)) == this.getCasingBlock()) && (this.getBaseMetaTileEntity().getMetaID(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i)) == this.getCasingMeta())) {
+ }
+ else {
+ Logger.INFO("False 3");
+ return false;
+ }
+ }
+ }
+ }
+ }
+ if ((this.mOutputHatches.size() != 0) || (this.mInputHatches.size() != 0)) {
+ Logger.INFO("Use Busses, Not Hatches for Input/Output.");
+ return false;
+ }
+ if ((this.mInputBusses.size() != 2) || (this.mOutputBusses.size() != 2)) {
+ Logger.INFO("Incorrect amount of Input & Output busses.");
+ return false;
+ }
+ this.mMaintenanceHatches.clear();
+ final IGregTechTileEntity tTileEntity = this.getBaseMetaTileEntity().getIGregTechTileEntityAtSideAndDistance(this.getBaseMetaTileEntity().getBackFacing(), 4);
+ if ((tTileEntity != null) && (tTileEntity.getMetaTileEntity() != null)) {
+ if ((tTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_Hatch_Maintenance)) {
+ this.mMaintenanceHatches.add((GT_MetaTileEntity_Hatch_Maintenance) tTileEntity.getMetaTileEntity());
+ ((GT_MetaTileEntity_Hatch) tTileEntity.getMetaTileEntity()).mMachineBlock = this.getCasingTextureIndex();
+ } else {
+ Logger.INFO("Maintenance hatch must be in the middle block on the back.");
+ return false;
+ }
+ }
+ if ((this.mMaintenanceHatches.size() != 1) || (this.mEnergyHatches.size() != 1)) {
+ Logger.INFO("Incorrect amount of Maintenance or Energy hatches.");
+ return false;
+ }
+ } else {
+ Logger.INFO("False 5");
+ return false;
+ }
+ Logger.INFO("True");
+ return true;
+ }
+
+ @Override
+ public int getMaxEfficiency(final ItemStack aStack) {
+ return 10000;
+ }
+
+ @Override
+ public int getPollutionPerTick(final ItemStack aStack) {
+ return 0;
+ }
+
+ @Override
+ public int getDamageToComponent(final ItemStack aStack) {
+ return 0;
+ }
+
+ public int getAmountOfOutputs() {
+ return 1;
+ }
+
+ @Override
+ public boolean explodesOnComponentBreak(final ItemStack aStack) {
+ return false;
+ }
+
+ public Block getCasingBlock() {
+ return ModBlocks.blockCasingsMisc;
+ }
+
+
+ public byte getCasingMeta() {
+ return 6;
+ }
+
+
+ public byte getCasingTextureIndex() {
+ return 1; //TODO
+ }
+
+ private boolean addToMachineList(final IGregTechTileEntity tTileEntity) {
+ return ((this.addMaintenanceToMachineList(tTileEntity, this.getCasingTextureIndex())) || (this.addInputToMachineList(tTileEntity, this.getCasingTextureIndex())) || (this.addOutputToMachineList(tTileEntity, this.getCasingTextureIndex())) || (this.addMufflerToMachineList(tTileEntity, this.getCasingTextureIndex())));
+ }
+
+ private boolean addEnergyInputToMachineList(final IGregTechTileEntity tTileEntity) {
+ return ((this.addEnergyInputToMachineList(tTileEntity, this.getCasingTextureIndex())));
+ }
+}
+*/
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialThermalCentrifuge.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialThermalCentrifuge.java
new file mode 100644
index 0000000000..01b887694a
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialThermalCentrifuge.java
@@ -0,0 +1,224 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing;
+
+import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
+import com.gtnewhorizon.structurelib.structure.StructureDefinition;
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.TAE;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.implementations.*;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import net.minecraft.block.Block;
+import net.minecraft.item.ItemStack;
+
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
+
+public class GregtechMetaTileEntity_IndustrialThermalCentrifuge
+extends GregtechMeta_MultiBlockBase {
+
+ private int mCasing;
+ private IStructureDefinition<GregtechMetaTileEntity_IndustrialThermalCentrifuge> STRUCTURE_DEFINITION = null;
+
+ public GregtechMetaTileEntity_IndustrialThermalCentrifuge(final int aID, final String aName, final String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ }
+
+ public GregtechMetaTileEntity_IndustrialThermalCentrifuge(final String aName) {
+ super(aName);
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaTileEntity_IndustrialThermalCentrifuge(this.mName);
+ }
+
+ @Override
+ public String getMachineType() {
+ return "Thermal Centrifuge";
+ }
+
+ @Override
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
+ GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType(getMachineType())
+ .addInfo("Controller Block for the Industrial Thermal Centrifuge")
+ .addInfo("150% faster than using single block machines of the same voltage")
+ .addInfo("Only uses 80% of the eu/t normally required")
+ .addInfo("Processes eight items per voltage tier")
+ .addPollutionAmount(getPollutionPerSecond(null))
+ .addSeparator()
+ .beginStructureBlock(3, 2, 3, false)
+ .addController("Front Center")
+ .addCasingInfo("Thermal Processing Casings/Noise Hazard Sign Blocks", 8)
+ .addInputBus("Bottom Casing", 1)
+ .addOutputBus("Bottom Casing", 1)
+ .addEnergyHatch("Bottom Casing", 1)
+ .addMaintenanceHatch("Bottom Casing", 1)
+ .addMufflerHatch("Bottom Casing", 1)
+ .toolTipFinisher(CORE.GT_Tooltip_Builder);
+ return tt;
+ }
+
+ @Override
+ public IStructureDefinition<GregtechMetaTileEntity_IndustrialThermalCentrifuge> getStructureDefinition() {
+ if (STRUCTURE_DEFINITION == null) {
+ STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_IndustrialThermalCentrifuge>builder()
+ .addShape(mName, transpose(new String[][]{
+ {"X~X", "XXX", "XXX"},
+ {"CCC", "CCC", "CCC"},
+ }))
+ .addElement(
+ 'C',
+ ofChain(
+ ofHatchAdder(
+ GregtechMetaTileEntity_IndustrialThermalCentrifuge::addIndustrialThermalCentrifugeList, getCasingTextureIndex(), 1
+ ),
+ onElementPass(
+ x -> ++x.mCasing,
+ ofBlock(
+ ModBlocks.blockCasings2Misc, 0
+ )
+ ),
+ onElementPass(
+ x -> ++x.mCasing,
+ ofBlock(
+ GregTech_API.sBlockCasings3, 9
+ )
+ )
+ )
+ )
+ .addElement(
+ 'X',
+ ofChain(
+ onElementPass(
+ x -> ++x.mCasing,
+ ofBlock(
+ ModBlocks.blockCasings2Misc, 0
+ )
+ ),
+ onElementPass(
+ x -> ++x.mCasing,
+ ofBlock(
+ GregTech_API.sBlockCasings3, 9
+ )
+ )
+ )
+ )
+ .build();
+ }
+ return STRUCTURE_DEFINITION;
+ }
+
+ @Override
+ public void construct(ItemStack stackSize, boolean hintsOnly) {
+ buildPiece(mName , stackSize, hintsOnly, 1, 0, 0);
+ }
+
+ @Override
+ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ mCasing = 0;
+ return checkPiece(mName, 1, 0, 0) && mCasing >= 8 && checkHatch();
+ }
+
+ public final boolean addIndustrialThermalCentrifugeList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null) {
+ return false;
+ } else {
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+ if (aSide == aFacing) {
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(getCasingTextureIndex()), new GT_RenderedTexture(aActive ? TexturesGtBlock.Overlay_Machine_Controller_Default_Active : TexturesGtBlock.Overlay_Machine_Controller_Default)};
+ }
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(getCasingTextureIndex())};
+ }
+
+ @Override
+ public boolean hasSlotInGUI() {
+ return false;
+ }
+
+ @Override
+ public String getCustomGUIResourceName() {
+ return "IndustrialThermalCentrifuge";
+ }
+
+ @Override
+ public GT_Recipe.GT_Recipe_Map getRecipeMap() {
+ return GT_Recipe.GT_Recipe_Map.sThermalCentrifugeRecipes;
+ }
+
+ @Override
+ public boolean checkRecipe(final ItemStack aStack) {
+ return checkRecipeGeneric((8* GT_Utility.getTier(this.getMaxInputVoltage())), 80, 150);
+ }
+
+ @Override
+ public int getMaxParallelRecipes() {
+ return (8 * GT_Utility.getTier(this.getMaxInputVoltage()));
+ }
+
+ @Override
+ public int getEuDiscountForParallelism() {
+ return 80;
+ }
+
+ @Override
+ public int getMaxEfficiency(final ItemStack aStack) {
+ return 10000;
+ }
+
+ @Override
+ public int getPollutionPerSecond(final ItemStack aStack) {
+ return CORE.ConfigSwitches.pollutionPerSecondMultiIndustrialThermalCentrifuge;
+ }
+
+ @Override
+ public int getAmountOfOutputs() {
+ return 1;
+ }
+
+ @Override
+ public boolean explodesOnComponentBreak(final ItemStack aStack) {
+ return false;
+ }
+
+ public Block getCasingBlock() {
+ return ModBlocks.blockCasings2Misc;
+ }
+
+ public byte getCasingMeta() {
+ return 0;
+ }
+
+ public byte getCasingTextureIndex() {
+ return (byte) TAE.GTPP_INDEX(16);
+ }
+
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialVacuumFreezer.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialVacuumFreezer.java
new file mode 100644
index 0000000000..1f63995651
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialVacuumFreezer.java
@@ -0,0 +1,261 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing;
+
+import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
+import com.gtnewhorizon.structurelib.structure.StructureDefinition;
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.TAE;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.IIconContainer;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.implementations.*;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GTPP_Recipe;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
+import gregtech.api.util.GT_Recipe;
+import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.minecraft.FluidUtils;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GT_MetaTileEntity_Hatch_CustomFluidBase;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.fluids.FluidStack;
+
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
+
+public class GregtechMetaTileEntity_IndustrialVacuumFreezer extends GregtechMeta_MultiBlockBase {
+
+ public static int CASING_TEXTURE_ID;
+ public static String mCryoFuelName = "Gelid Cryotheum";
+ public static String mCasingName = "Advanced Cryogenic Casing";
+ public static String mHatchName = "Cryotheum Hatch";
+ public static FluidStack mFuelStack;
+ private boolean mHaveHatch;
+ private int mCasing;
+ private IStructureDefinition<GregtechMetaTileEntity_IndustrialVacuumFreezer> STRUCTURE_DEFINITION = null;
+
+
+ public GregtechMetaTileEntity_IndustrialVacuumFreezer(final int aID, final String aName, final String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ mFuelStack = FluidUtils.getFluidStack("cryotheum", 1);
+ CASING_TEXTURE_ID = TAE.getIndexFromPage(2, 10);
+ mCryoFuelName = mFuelStack.getLocalizedName();
+ mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings3Misc, 10);
+ mHatchName = ItemUtils.getLocalizedNameOfBlock(GregTech_API.sBlockMachines, 967);
+ }
+
+ public GregtechMetaTileEntity_IndustrialVacuumFreezer(final String aName) {
+ super(aName);
+ mFuelStack = FluidUtils.getFluidStack("cryotheum", 1);
+ CASING_TEXTURE_ID = TAE.getIndexFromPage(2, 10);
+ mCryoFuelName = mFuelStack.getLocalizedName();
+ mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings3Misc, 10);
+ mHatchName = ItemUtils.getLocalizedNameOfBlock(GregTech_API.sBlockMachines, 967);
+ }
+
+ public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
+ return (IMetaTileEntity) new GregtechMetaTileEntity_IndustrialVacuumFreezer(this.mName);
+ }
+
+ @Override
+ public String getMachineType() {
+ return "Vacuum Freezer";
+ }
+
+ @Override
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
+
+ if (mCasingName.toLowerCase().contains(".name")) {
+ mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings3Misc, 10);
+ }
+ if (mCryoFuelName.toLowerCase().contains(".")) {
+ mCryoFuelName = FluidUtils.getFluidStack("cryotheum", 1).getLocalizedName();
+ }
+ if (mHatchName.toLowerCase().contains(".name")) {
+ mHatchName = ItemUtils.getLocalizedNameOfBlock(GregTech_API.sBlockMachines, 967);
+ }
+
+ GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType(getMachineType())
+ .addInfo("Factory Grade Advanced Vacuum Freezer")
+ .addInfo("Speed: 200% | Eu Usage: 100% | Parallel: 4")
+ .addInfo("Consumes 1L of " + mCryoFuelName + "/t during operation")
+ .addInfo("Constructed exactly the same as a normal Vacuum Freezer")
+ .addPollutionAmount(getPollutionPerSecond(null))
+ .addSeparator()
+ .beginStructureBlock(3, 3, 3, true)
+ .addController("Front Center")
+ .addCasingInfo(mCasingName, 10)
+ .addStructureHint(mHatchName, 1)
+ .addInputBus("Any Casing", 1)
+ .addOutputBus("Any Casing", 1)
+ .addInputHatch("Any Casing", 1)
+ .addOutputHatch("Any Casing", 1)
+ .addEnergyHatch("Any Casing", 1)
+ .addMaintenanceHatch("Any Casing", 1)
+ .addMufflerHatch("Any Casing", 1)
+ .toolTipFinisher(CORE.GT_Tooltip_Builder);
+ return tt;
+ }
+
+ @Override
+ public IStructureDefinition<GregtechMetaTileEntity_IndustrialVacuumFreezer> getStructureDefinition() {
+ if (STRUCTURE_DEFINITION == null) {
+ STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_IndustrialVacuumFreezer>builder()
+ .addShape(mName, transpose(new String[][]{
+ {"CCC", "CCC", "CCC"},
+ {"C~C", "C-C", "CCC"},
+ {"CCC", "CCC", "CCC"},
+ }))
+ .addElement(
+ 'C',
+ ofChain(
+ ofHatchAdder(
+ GregtechMetaTileEntity_IndustrialVacuumFreezer::addIndustrialVacuumFreezerList, CASING_TEXTURE_ID, 1
+ ),
+ onElementPass(
+ x -> ++x.mCasing,
+ ofBlock(
+ ModBlocks.blockCasings3Misc, 10
+ )
+ )
+ )
+ )
+ .build();
+ }
+ return STRUCTURE_DEFINITION;
+ }
+
+ @Override
+ public void construct(ItemStack stackSize, boolean hintsOnly) {
+ buildPiece(mName , stackSize, hintsOnly, 1, 1, 0);
+ }
+
+ @Override
+ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ mCasing = 0;
+ mHaveHatch = false;
+ return checkPiece(mName, 1, 1, 0) && mCasing >= 10 && mHaveHatch && checkHatch();
+ }
+
+ public final boolean addIndustrialVacuumFreezerList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null) {
+ return false;
+ } else {
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_CustomFluidBase && aMetaTileEntity.getBaseMetaTileEntity().getMetaTileID() == 967) {
+ mHaveHatch = true;
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ }
+ return false;
+ }
+
+
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing,
+ final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+ if (aSide == aFacing) {
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(CASING_TEXTURE_ID),
+ new GT_RenderedTexture((IIconContainer) (aActive ? TexturesGtBlock.Overlay_Machine_Controller_Advanced_Active : TexturesGtBlock.Overlay_Machine_Controller_Advanced))};
+ }
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(CASING_TEXTURE_ID)};
+ }
+
+ @Override
+ public boolean hasSlotInGUI() {
+ return true;
+ }
+
+ @Override
+ public boolean requiresVanillaGtGUI() {
+ return true;
+ }
+
+ @Override
+ public String getCustomGUIResourceName() {
+ return "VacuumFreezer";
+ }
+
+ public GT_Recipe.GT_Recipe_Map getRecipeMap() {
+ return GTPP_Recipe.GTPP_Recipe_Map.sAdvFreezerRecipes_GT;
+ }
+
+ public boolean isCorrectMachinePart(final ItemStack aStack) {
+ return true;
+ }
+
+ public boolean checkRecipe(final ItemStack aStack) {
+ return this.checkRecipeGeneric(4, 100, 100);
+ }
+
+ @Override
+ public int getMaxParallelRecipes() {
+ return 4;
+ }
+
+ @Override
+ public int getEuDiscountForParallelism() {
+ return 100;
+ }
+
+ public int getMaxEfficiency(final ItemStack aStack) {
+ return 10000;
+ }
+
+ public int getPollutionPerSecond(final ItemStack aStack) {
+ return CORE.ConfigSwitches.pollutionPerSecondMultiIndustrialVacuumFreezer;
+ }
+
+ public int getDamageToComponent(final ItemStack aStack) {
+ return 0;
+ }
+
+ public boolean explodesOnComponentBreak(final ItemStack aStack) {
+ return false;
+ }
+
+ private volatile int mGraceTimer = 2;
+
+ @Override
+ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ /*if (this.getBaseMetaTileEntity().isActive()) {
+ if (!this.depleteInput(mFuelStack.copy())) {
+ this.getBaseMetaTileEntity().setActive(false);
+ }
+ } */
+ super.onPostTick(aBaseMetaTileEntity, aTick);
+
+ if (this.mStartUpCheck < 0) {
+ if (this.mMaxProgresstime > 0 && this.mProgresstime != 0 || this.getBaseMetaTileEntity().hasWorkJustBeenEnabled()) {
+ if (aTick % 10 == 0 || this.getBaseMetaTileEntity().hasWorkJustBeenEnabled()) {
+ if (!this.depleteInput(FluidUtils.getFluidStack("cryotheum", 10))) {
+ if (mGraceTimer-- == 0) {
+ this.causeMaintenanceIssue();
+ this.stopMachine();
+ mGraceTimer = 2;
+ }
+ }
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWashPlant.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWashPlant.java
new file mode 100644
index 0000000000..168d4ff6d6
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWashPlant.java
@@ -0,0 +1,335 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing;
+
+import com.gtnewhorizon.structurelib.alignment.IAlignmentLimits;
+import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
+import com.gtnewhorizon.structurelib.structure.StructureDefinition;
+import gregtech.api.enums.TAE;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.implementations.*;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.minecraft.FluidUtils;
+import gtPlusPlus.core.util.minecraft.PlayerUtils;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import ic2.core.init.BlocksItems;
+import ic2.core.init.InternalName;
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.init.Blocks;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.FluidStack;
+
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
+
+public class GregtechMetaTileEntity_IndustrialWashPlant
+extends GregtechMeta_MultiBlockBase {
+
+ private boolean mChemicalMode = false;
+ private int mCasing;
+ private IStructureDefinition<GregtechMetaTileEntity_IndustrialWashPlant> STRUCTURE_DEFINITION = null;
+
+ public GregtechMetaTileEntity_IndustrialWashPlant(final int aID, final String aName, final String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ }
+
+ public GregtechMetaTileEntity_IndustrialWashPlant(final String aName) {
+ super(aName);
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaTileEntity_IndustrialWashPlant(this.mName);
+ }
+
+ @Override
+ public String getMachineType() {
+ return "Ore Washer, Chemical Bath";
+ }
+
+ @Override
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
+ GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType(getMachineType())
+ .addInfo("Controller Block for the Industrial Ore Washing Plant")
+ .addInfo("Can be configured with a screwdriver to also process Chemical Bathing")
+ .addInfo("400% faster than using single block machines of the same voltage")
+ .addInfo("Processes four item per voltage tier")
+ .addInfo("Always requires an Input Hatch full of water to refill structure")
+ .addPollutionAmount(getPollutionPerSecond(null))
+ .addSeparator()
+ .beginStructureBlock(5, 3, 7, true)
+ .addController("Front Center")
+ .addCasingInfo("Wash Plant Casings", 40)
+ .addInputBus("Any Casing", 1)
+ .addOutputBus("Any Casing", 1)
+ .addInputHatch("Any Casing", 1)
+ .addEnergyHatch("Any Casing", 1)
+ .addMaintenanceHatch("Any Casing", 1)
+ .addMufflerHatch("Any Casing", 1)
+ .toolTipFinisher(CORE.GT_Tooltip_Builder);
+ return tt;
+ }
+
+ @Override
+ public IStructureDefinition<GregtechMetaTileEntity_IndustrialWashPlant> getStructureDefinition() {
+ if (STRUCTURE_DEFINITION == null) {
+ STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_IndustrialWashPlant>builder()
+ .addShape(mName, transpose(new String[][]{
+ {"CCCCC", "C C", "C C", "C C", "C C", "C C", "CCCCC"},
+ {"CC~CC", "C C", "C C", "C C", "C C", "C C", "CCCCC"},
+ {"CCCCC", "CCCCC", "CCCCC", "CCCCC", "CCCCC", "CCCCC", "CCCCC"},
+ }))
+ .addElement(
+ 'C',
+ ofChain(
+ ofHatchAdder(
+ GregtechMetaTileEntity_IndustrialWashPlant::addIndustrialWashPlantList, getCasingTextureIndex(), 1
+ ),
+ onElementPass(
+ x -> ++x.mCasing,
+ ofBlock(
+ getCasingBlock(), getCasingMeta()
+ )
+ )
+ )
+ )
+ .build();
+ }
+ return STRUCTURE_DEFINITION;
+ }
+
+ @Override
+ public void construct(ItemStack stackSize, boolean hintsOnly) {
+ buildPiece(mName , stackSize, hintsOnly, 2, 1, 0);
+ }
+
+ @Override
+ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ mCasing = 0;
+ return checkPiece(mName, 2, 1, 0) && mCasing >= 40 && checkHatch();
+ }
+
+ public final boolean addIndustrialWashPlantList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null) {
+ return false;
+ } else {
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ }
+ return false;
+ }
+
+ @Override
+ protected IAlignmentLimits getInitialAlignmentLimits() {
+ // don't rotate a washer, water will flow out.
+ return (d, r, f) -> d.offsetY == 0 && r.isNotRotated() && !f.isVerticallyFliped();
+ }
+
+ @Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+ if (aSide == aFacing) {
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(getCasingTextureIndex()), new GT_RenderedTexture(aActive ? TexturesGtBlock.Overlay_Machine_Controller_Default_Active : TexturesGtBlock.Overlay_Machine_Controller_Default)};
+ }
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(getCasingTextureIndex())};
+ }
+
+ @Override
+ public boolean hasSlotInGUI() {
+ return false;
+ }
+
+ @Override
+ public String getCustomGUIResourceName() {
+ return "IndustrialWashPlant";
+ }
+
+ @Override
+ public GT_Recipe.GT_Recipe_Map getRecipeMap() {
+ return mChemicalMode ? GT_Recipe.GT_Recipe_Map.sChemicalBathRecipes : GT_Recipe.GT_Recipe_Map.sOreWasherRecipes;
+ }
+
+ @Override
+ public boolean checkRecipe(final ItemStack aStack) {
+ if (checkForWater()) {
+ return checkRecipeGeneric((4 * GT_Utility.getTier(this.getMaxInputVoltage())), 100, 400);
+ }
+ return false;
+ }
+
+ @Override
+ public int getMaxParallelRecipes() {
+ return (4* GT_Utility.getTier(this.getMaxInputVoltage()));
+ }
+
+ @Override
+ public int getEuDiscountForParallelism() {
+ return 100;
+ }
+
+ @Override
+ public int getMaxEfficiency(final ItemStack aStack) {
+ return 10000;
+ }
+
+ @Override
+ public int getPollutionPerSecond(final ItemStack aStack) {
+ if (this.mChemicalMode) return CORE.ConfigSwitches.pollutionPerSecondMultiIndustrialWashPlant_ModeChemBath;
+ return CORE.ConfigSwitches.pollutionPerSecondMultiIndustrialWashPlant_ModeWasher;
+ }
+
+ @Override
+ public int getAmountOfOutputs() {
+ return 1;
+ }
+
+ @Override
+ public boolean explodesOnComponentBreak(final ItemStack aStack) {
+ return false;
+ }
+
+ public Block getCasingBlock() {
+ return ModBlocks.blockCasings2Misc;
+ }
+
+
+ public byte getCasingMeta() {
+ return 4;
+ }
+
+
+ public byte getCasingTextureIndex() {
+ return (byte) TAE.GTPP_INDEX(11);
+ }
+
+ public boolean checkForWater() {
+
+ //Get Facing direction
+ IGregTechTileEntity aBaseMetaTileEntity = this.getBaseMetaTileEntity();
+ int mDirectionX = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX;
+ int mCurrentDirectionX;
+ int mCurrentDirectionZ;
+ int mOffsetX_Lower = 0;
+ int mOffsetX_Upper = 0;
+ int mOffsetZ_Lower = 0;
+ int mOffsetZ_Upper = 0;
+
+ if (mDirectionX == 0){
+ mCurrentDirectionX = 2;
+ mCurrentDirectionZ = 3;
+ mOffsetX_Lower = -2;
+ mOffsetX_Upper = 2;
+ mOffsetZ_Lower = -3;
+ mOffsetZ_Upper = 3;
+ }
+ else {
+ mCurrentDirectionX = 3;
+ mCurrentDirectionZ = 2;
+ mOffsetX_Lower = -3;
+ mOffsetX_Upper = 3;
+ mOffsetZ_Lower = -2;
+ mOffsetZ_Upper = 2;
+ }
+
+ //if (aBaseMetaTileEntity.fac)
+
+ final int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * mCurrentDirectionX;
+ final int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * mCurrentDirectionZ;
+
+ int tAmount = 0;
+ for (int i = mOffsetX_Lower + 1; i <= mOffsetX_Upper - 1; ++i) {
+ for (int j = mOffsetZ_Lower + 1; j <= mOffsetZ_Upper - 1; ++j) {
+ for (int h = 0; h < 2; ++h) {
+ Block tBlock = aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j);
+ byte tMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j);
+ if (tBlock == Blocks.air || tBlock == Blocks.flowing_water || tBlock == Blocks.water) {
+ if (this.getStoredFluids() != null) {
+ for (FluidStack stored : this.getStoredFluids()) {
+ if (stored.isFluidEqual(FluidUtils.getFluidStack("water", 1))) {
+ if (stored.amount >= 1000) {
+ //Utils.LOG_WARNING("Going to try swap an air block for water from inut bus.");
+ stored.amount -= 1000;
+ Block fluidUsed = null;
+ if (tBlock == Blocks.air || tBlock == Blocks.flowing_water) {
+ fluidUsed = Blocks.water;
+ }
+ if (tBlock == Blocks.water) {
+ fluidUsed = BlocksItems.getFluidBlock(InternalName.fluidDistilledWater);
+ }
+ aBaseMetaTileEntity.getWorld().setBlock(aBaseMetaTileEntity.getXCoord() + xDir + i, aBaseMetaTileEntity.getYCoord() + h, aBaseMetaTileEntity.getZCoord() + zDir + j, fluidUsed);
+
+
+ }
+ }
+ }
+ }
+ }
+ if (tBlock == Blocks.water) {
+ ++tAmount;
+ //Utils.LOG_WARNING("Found Water");
+ } else if (tBlock == BlocksItems.getFluidBlock(InternalName.fluidDistilledWater)) {
+ ++tAmount;
+ ++tAmount;
+ //Utils.LOG_WARNING("Found Distilled Water");
+ }
+ }
+ }
+ }
+ if ((tAmount >= 45)){
+ Logger.WARNING("Filled structure.");
+ }
+ else {
+ Logger.WARNING("Did not fill structure.");
+ }
+ return (tAmount >= 45);
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ aNBT.setBoolean("mChemicalMode", mChemicalMode);
+ super.saveNBTData(aNBT);
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ mChemicalMode = aNBT.getBoolean("mChemicalMode");
+ super.loadNBTData(aNBT);
+ }
+
+ @Override
+ public void onModeChangeByScrewdriver(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ mChemicalMode = Utils.invertBoolean(mChemicalMode);
+ if (mChemicalMode){
+ PlayerUtils.messagePlayer(aPlayer, "Wash Plant is now running in Chemical Bath Mode.");
+ }
+ else {
+ PlayerUtils.messagePlayer(aPlayer, "Wash Plant is now running in Ore Washer Mode.");
+ }
+ }
+
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWireMill.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWireMill.java
new file mode 100644
index 0000000000..ccce25d925
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWireMill.java
@@ -0,0 +1,206 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing;
+
+import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
+import com.gtnewhorizon.structurelib.structure.StructureDefinition;
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.TAE;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.implementations.*;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import net.minecraft.block.Block;
+import net.minecraft.item.ItemStack;
+
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
+
+public class GregtechMetaTileEntity_IndustrialWireMill
+extends GregtechMeta_MultiBlockBase {
+
+ private int mCasing;
+ private IStructureDefinition<GregtechMetaTileEntity_IndustrialWireMill> STRUCTURE_DEFINITION = null;
+
+ public GregtechMetaTileEntity_IndustrialWireMill(final int aID, final String aName, final String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ }
+
+ public GregtechMetaTileEntity_IndustrialWireMill(final String aName) {
+ super(aName);
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaTileEntity_IndustrialWireMill(this.mName);
+ }
+
+ @Override
+ public String getMachineType() {
+ return "Wiremill";
+ }
+
+ @Override
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
+ GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType(getMachineType())
+ .addInfo("Controller Block for the Industrial Wire Factory")
+ .addInfo("200% faster than using single block machines of the same voltage")
+ .addInfo("Only uses 75% of the eu/t normally required")
+ .addInfo("Processes four items per voltage tier")
+ .addPollutionAmount(getPollutionPerSecond(null))
+ .addSeparator()
+ .beginStructureBlock(3, 3, 5, true)
+ .addController("Front Center")
+ .addCasingInfo("Wire Factory Casings", 32)
+ .addInputBus("Any Casing", 1)
+ .addOutputBus("Any Casing", 1)
+ .addEnergyHatch("Any Casing", 1)
+ .addMaintenanceHatch("Any Casing", 1)
+ .addMufflerHatch("Any Casing", 1)
+ .toolTipFinisher(CORE.GT_Tooltip_Builder);
+ return tt;
+ }
+
+ @Override
+ public IStructureDefinition<GregtechMetaTileEntity_IndustrialWireMill> getStructureDefinition() {
+ if (STRUCTURE_DEFINITION == null) {
+ STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_IndustrialWireMill>builder()
+ .addShape(mName, transpose(new String[][]{
+ {"CCC", "CCC", "CCC", "CCC", "CCC"},
+ {"C~C", "C-C", "C-C", "C-C", "CCC"},
+ {"CCC", "CCC", "CCC", "CCC", "CCC"},
+ }))
+ .addElement(
+ 'C',
+ ofChain(
+ ofHatchAdder(
+ GregtechMetaTileEntity_IndustrialWireMill::addIndustrialWireMillList, getCasingTextureIndex(), 1
+ ),
+ onElementPass(
+ x -> ++x.mCasing,
+ ofBlock(
+ getCasingBlock(), getCasingMeta()
+ )
+ )
+ )
+ )
+ .build();
+ }
+ return STRUCTURE_DEFINITION;
+ }
+
+ @Override
+ public void construct(ItemStack stackSize, boolean hintsOnly) {
+ buildPiece(mName , stackSize, hintsOnly, 1, 1, 0);
+ }
+
+ @Override
+ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ mCasing = 0;
+ return checkPiece(mName, 1, 1, 0) && mCasing >= 32 && checkHatch();
+ }
+
+ public final boolean addIndustrialWireMillList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null) {
+ return false;
+ } else {
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public String getSound() {
+ return GregTech_API.sSoundList.get(Integer.valueOf(204));
+ }
+
+ @Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+ if (aSide == aFacing) {
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(TAE.GTPP_INDEX(6)), new GT_RenderedTexture(aActive ? TexturesGtBlock.Overlay_Machine_Controller_Default_Active : TexturesGtBlock.Overlay_Machine_Controller_Default)};
+ }
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(TAE.GTPP_INDEX(6))};
+ }
+
+ @Override
+ public boolean hasSlotInGUI() {
+ return false;
+ }
+
+ @Override
+ public String getCustomGUIResourceName() {
+ return "IndustrialWireFactory";
+ }
+
+ @Override
+ public GT_Recipe.GT_Recipe_Map getRecipeMap() {
+ return GT_Recipe.GT_Recipe_Map.sWiremillRecipes;
+ }
+
+ @Override
+ public boolean checkRecipe(final ItemStack aStack) {
+ return checkRecipeGeneric((4* GT_Utility.getTier(this.getMaxInputVoltage())), 75, 200);
+ }
+
+ @Override
+ public int getMaxParallelRecipes() {
+ return (4* GT_Utility.getTier(this.getMaxInputVoltage()));
+ }
+
+ @Override
+ public int getEuDiscountForParallelism() {
+ return 75;
+ }
+
+ @Override
+ public int getMaxEfficiency(final ItemStack aStack) {
+ return 10000;
+ }
+
+ @Override
+ public int getPollutionPerSecond(final ItemStack aStack) {
+ return CORE.ConfigSwitches.pollutionPerSecondMultiIndustrialWireMill;
+ }
+
+ @Override
+ public int getAmountOfOutputs() {
+ return 1;
+ }
+
+ @Override
+ public boolean explodesOnComponentBreak(final ItemStack aStack) {
+ return false;
+ }
+
+ public Block getCasingBlock() {
+ return ModBlocks.blockCasingsMisc;
+ }
+
+ public byte getCasingMeta() {
+ return 6;
+ }
+
+ public byte getCasingTextureIndex() {
+ return (byte) TAE.GTPP_INDEX(6);
+ }
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IronBlastFurnace.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IronBlastFurnace.java
new file mode 100644
index 0000000000..5d6904bd46
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IronBlastFurnace.java
@@ -0,0 +1,403 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.init.Blocks;
+import net.minecraft.init.Items;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+
+import gregtech.GT_Mod;
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.Materials;
+import gregtech.api.enums.OrePrefixes;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.MetaTileEntity;
+import gregtech.api.objects.GT_ItemStack;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_OreDictUnificator;
+import gregtech.api.util.GT_Utility;
+
+import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.xmod.gregtech.api.gui.CONTAINER_IronBlastFurnace;
+import gtPlusPlus.xmod.gregtech.api.gui.GUI_IronBlastFurnace;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import net.minecraftforge.common.util.ForgeDirection;
+
+public class GregtechMetaTileEntity_IronBlastFurnace
+extends MetaTileEntity {
+ private static final ITexture[] FACING_SIDE = {new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Top)};
+ private static final ITexture[] FACING_FRONT = {new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Redstone_Off)};
+ private static final ITexture[] FACING_ACTIVE = {new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Redstone_On)};
+ public int mMaxProgresstime = 0;
+ public int mUpdate = 30;
+ public int mProgresstime = 0;
+ public boolean mMachine = false;
+ public ItemStack mOutputItem1;
+ public ItemStack mOutputItem2;
+
+ public GregtechMetaTileEntity_IronBlastFurnace(final int aID, final String aName, final String aNameRegional) {
+ super(aID, aName, aNameRegional, 4);
+ }
+
+ public GregtechMetaTileEntity_IronBlastFurnace(final String aName) {
+ super(aName, 4);
+ }
+
+ @Override
+ public String[] getDescription() {
+ if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK) {
+ return new String[]{"Iron is a much better furnace material!",
+ "Can be Automated",
+ "Multiblock: 3x3x5 hollow with opening on top",
+ "Same shape as Bronze/Bricked blast furnace, except one ring of 8 taller.",
+ "40 Iron Plated Bricks required",
+ };
+ }
+ else {
+ return new String[]{"Sloooowly, Skip the Bronze age, Get some Steel!",
+ "Multiblock: 3x3x5 hollow with opening on top",
+ "40 Iron Plated Bricks required",
+ "----",
+ "Even though Iron melts hotter than bronze,",
+ "this machine is to help players skip looking",
+ "for tin and copper, which are not as common",
+ "as Iron is. This machine takes 5x longer than the bronze",
+ "blast furnace as a result.",
+ "----",
+ };
+ }
+ }
+
+ @Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+ if (aSide == aFacing) {
+ return aActive ? FACING_ACTIVE : FACING_FRONT;
+ }
+ return FACING_SIDE;
+ }
+
+ @Override
+ public boolean isSteampowered() {
+ return false;
+ }
+
+ @Override
+ public boolean isElectric() {
+ return false;
+ }
+
+ @Override
+ public boolean isPneumatic() {
+ return false;
+ }
+
+ @Override
+ public boolean isEnetInput() {
+ return false;
+ }
+
+ @Override
+ public boolean isEnetOutput() {
+ return false;
+ }
+
+ @Override
+ public boolean isInputFacing(final byte aSide) {
+ return false;
+ }
+
+ @Override
+ public boolean isOutputFacing(final byte aSide) {
+ return false;
+ }
+
+ @Override
+ public boolean isTeleporterCompatible() {
+ return false;
+ }
+
+ @Override
+ public boolean isFacingValid(final byte aFacing) {
+ return aFacing > 1;
+ }
+
+ @Override
+ public boolean isAccessAllowed(final EntityPlayer aPlayer) {
+ return true;
+ }
+
+ @Override
+ public int getProgresstime() {
+ return this.mProgresstime;
+ }
+
+ @Override
+ public int maxProgresstime() {
+ return this.mMaxProgresstime;
+ }
+
+ @Override
+ public int increaseProgress(final int aProgress) {
+ this.mProgresstime += aProgress;
+ return this.mMaxProgresstime - this.mProgresstime;
+ }
+
+ @Override
+ public boolean allowCoverOnSide(final byte aSide, final GT_ItemStack aCoverID) {
+ return (GregTech_API.getCoverBehavior(aCoverID.toStack()).isSimpleCover()) && (super.allowCoverOnSide(aSide, aCoverID));
+ }
+
+ @Override
+ public MetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaTileEntity_IronBlastFurnace(this.mName);
+ }
+
+ @Override
+ public void saveNBTData(final NBTTagCompound aNBT) {
+ aNBT.setInteger("mProgresstime", this.mProgresstime);
+ aNBT.setInteger("mMaxProgresstime", this.mMaxProgresstime);
+ if (this.mOutputItem1 != null) {
+ final NBTTagCompound tNBT = new NBTTagCompound();
+ this.mOutputItem1.writeToNBT(tNBT);
+ aNBT.setTag("mOutputItem1", tNBT);
+ }
+ if (this.mOutputItem2 != null) {
+ final NBTTagCompound tNBT = new NBTTagCompound();
+ this.mOutputItem2.writeToNBT(tNBT);
+ aNBT.setTag("mOutputItem2", tNBT);
+ }
+ }
+
+ @Override
+ public void loadNBTData(final NBTTagCompound aNBT) {
+ this.mUpdate = 30;
+ this.mProgresstime = aNBT.getInteger("mProgresstime");
+ this.mMaxProgresstime = aNBT.getInteger("mMaxProgresstime");
+ this.mOutputItem1 = GT_Utility.loadItem(aNBT, "mOutputItem1");
+ this.mOutputItem2 = GT_Utility.loadItem(aNBT, "mOutputItem2");
+ }
+
+ @Override
+ public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) {
+ if (aBaseMetaTileEntity.isClientSide()) {
+ return true;
+ }
+ aBaseMetaTileEntity.openGUI(aPlayer);
+ return true;
+ }
+
+ @Override
+ public Object getServerGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) {
+ return new CONTAINER_IronBlastFurnace(aPlayerInventory, aBaseMetaTileEntity);
+ }
+
+ @Override
+ public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GUI_IronBlastFurnace(aPlayerInventory, aBaseMetaTileEntity);
+ }
+
+ private boolean checkMachine() {
+ final int xDir = ForgeDirection.getOrientation(this.getBaseMetaTileEntity().getBackFacing()).offsetX;
+ final int zDir = ForgeDirection.getOrientation(this.getBaseMetaTileEntity().getBackFacing()).offsetZ;
+ for (int i = -1; i < 2; i++) {
+ for (int j = -1; j < 4; j++) { //This is height
+ for (int k = -1; k < 2; k++) {
+ if (((xDir + i) != 0) || (j != 0) || ((zDir + k) != 0)) {
+ if ((i != 0) || (j == -1) || (k != 0)) {
+ if ((this.getBaseMetaTileEntity().getBlockOffset(xDir + i, j, zDir + k) != ModBlocks.blockCasingsMisc) || (this.getBaseMetaTileEntity().getMetaIDOffset(xDir + i, j, zDir + k) != 10)) {
+ return false;
+ }
+ } else if ((!GT_Utility.arrayContains(this.getBaseMetaTileEntity().getBlockOffset(xDir + i, j, zDir + k), new Object[]{Blocks.lava, Blocks.flowing_lava, null})) && (!this.getBaseMetaTileEntity().getAirOffset(xDir + i, j, zDir + k))) {
+ return false;
+ }
+ }
+ }
+ }
+ }
+ return true;
+ }
+
+ @Override
+ public void onMachineBlockUpdate() {
+ this.mUpdate = 30;
+ }
+
+ @Override
+ public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTimer) {
+ if ((aBaseMetaTileEntity.isClientSide()) &&
+ (aBaseMetaTileEntity.isActive())) {
+ aBaseMetaTileEntity.getWorld().spawnParticle("cloud", aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1) + Math.random(), aBaseMetaTileEntity.getOffsetY(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1) + Math.random(), 0.0D, 0.3D, 0.0D);
+ }
+ if (aBaseMetaTileEntity.isServerSide()) {
+ if (this.mUpdate-- == 0) {
+ this.mMachine = this.checkMachine();
+ }
+ if (this.mMachine) {
+ if (this.mMaxProgresstime > 0) {
+ if (++this.mProgresstime >= this.mMaxProgresstime) {
+ this.addOutputProducts();
+ this.mOutputItem1 = null;
+ this.mOutputItem2 = null;
+ this.mProgresstime = 0;
+ this.mMaxProgresstime = 0;
+ try {
+ GT_Mod.instance.achievements.issueAchievement(aBaseMetaTileEntity.getWorld().getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()), "steel");
+ } catch (final Exception e) {
+ }
+ }
+ } else if (aBaseMetaTileEntity.isAllowedToWork()) {
+ this.checkRecipe();
+ }
+ }
+ aBaseMetaTileEntity.setActive((this.mMaxProgresstime > 0) && (this.mMachine));
+ if (aBaseMetaTileEntity.isActive()) {
+ if (aBaseMetaTileEntity.getAir(aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1))) {
+ aBaseMetaTileEntity.getWorld().setBlock(aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1), Blocks.lava, 1, 2);
+ this.mUpdate = 1;
+ }
+ if (aBaseMetaTileEntity.getAir(aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getYCoord() + 1, aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1))) {
+ aBaseMetaTileEntity.getWorld().setBlock(aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getYCoord() + 1, aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1), Blocks.lava, 1, 2);
+ this.mUpdate = 1;
+ }
+ } else {
+ if (aBaseMetaTileEntity.getBlock(aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1)) == Blocks.lava) {
+ aBaseMetaTileEntity.getWorld().setBlock(aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1), Blocks.air, 0, 2);
+ this.mUpdate = 1;
+ }
+ if (aBaseMetaTileEntity.getBlock(aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getYCoord() + 1, aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1)) == Blocks.lava) {
+ aBaseMetaTileEntity.getWorld().setBlock(aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getYCoord() + 1, aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1), Blocks.air, 0, 2);
+ this.mUpdate = 1;
+ }
+ }
+ }
+ }
+
+ private void addOutputProducts() {
+ if (this.mOutputItem1 != null) {
+ if (this.mInventory[2] == null) {
+ this.mInventory[2] = GT_Utility.copy(new Object[]{this.mOutputItem1});
+ } else if (GT_Utility.areStacksEqual(this.mInventory[2], this.mOutputItem1)) {
+ this.mInventory[2].stackSize = Math.min(this.mOutputItem1.getMaxStackSize(), this.mOutputItem1.stackSize + this.mInventory[2].stackSize);
+ }
+ }
+ if (this.mOutputItem2 != null) {
+ if (this.mInventory[3] == null) {
+ this.mInventory[3] = GT_Utility.copy(new Object[]{this.mOutputItem2});
+ } else if (GT_Utility.areStacksEqual(this.mInventory[3], this.mOutputItem2)) {
+ this.mInventory[3].stackSize = Math.min(this.mOutputItem2.getMaxStackSize(), this.mOutputItem2.stackSize + this.mInventory[3].stackSize);
+ }
+ }
+ }
+
+ private boolean spaceForOutput(final ItemStack aStack1, final ItemStack aStack2) {
+ if (((this.mInventory[2] == null) || (aStack1 == null) || (((this.mInventory[2].stackSize + aStack1.stackSize) <= this.mInventory[2].getMaxStackSize()) && (GT_Utility.areStacksEqual(this.mInventory[2], aStack1)))) && (
+ (this.mInventory[3] == null) || (aStack2 == null) || (((this.mInventory[3].stackSize + aStack2.stackSize) <= this.mInventory[3].getMaxStackSize()) && (GT_Utility.areStacksEqual(this.mInventory[3], aStack2))))) {
+ return true;
+ }
+ return false;
+ }
+
+ private int getProperTime(int time) {
+ if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK) {
+ return (int) (time/3);
+ }
+ else {
+ return time;
+ }
+ }
+
+ private boolean checkRecipe() {
+
+ if (!this.mMachine) {
+ return false;
+ }
+ if ((this.mInventory[0] != null) && (this.mInventory[1] != null) && (this.mInventory[0].stackSize >= 1)) {
+ if ((GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[0], "dustIron")) || (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[0], "ingotIron"))) {
+ if ((this.mInventory[1].getItem() == Items.coal) && (this.mInventory[1].stackSize >= 4) && (this.spaceForOutput(this.mOutputItem1 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Steel, 1L), this.mOutputItem2 = GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.DarkAsh, 4L)))) {
+ this.getBaseMetaTileEntity().decrStackSize(0, 1);
+ this.getBaseMetaTileEntity().decrStackSize(1, 4*3);
+ this.mMaxProgresstime = getProperTime(36000);
+ return true;
+ }
+ if ((GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[1], "fuelCoke")) && (this.mInventory[1].stackSize >= 2) && (this.spaceForOutput(this.mOutputItem1 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Steel, 1L), this.mOutputItem2 = GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.Ash, 4L)))) {
+ this.getBaseMetaTileEntity().decrStackSize(0, 1);
+ this.getBaseMetaTileEntity().decrStackSize(1, 2*3);
+ this.mMaxProgresstime = getProperTime(4800);
+ return true;
+ }
+ if ((this.mInventory[0].stackSize >= 9) && ((GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[1], "blockCoal")) || (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[1], "blockCharcoal"))) && (this.mInventory[1].stackSize >= 4) && (this.spaceForOutput(this.mOutputItem1 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Steel, 9L), this.mOutputItem2 = GT_OreDictUnificator.get(OrePrefixes.dust, Materials.DarkAsh, 4L)))) {
+ this.getBaseMetaTileEntity().decrStackSize(0, 9);
+ this.getBaseMetaTileEntity().decrStackSize(1, 4*3);
+ this.mMaxProgresstime = getProperTime(64800);
+ return true;
+ }
+ } else if (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[0], "dustSteel")) {
+ if ((this.mInventory[1].getItem() == Items.coal) && (this.mInventory[1].stackSize >= 2) && (this.spaceForOutput(this.mOutputItem1 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Steel, 1L), this.mOutputItem2 = GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.DarkAsh, 2L)))) {
+ this.getBaseMetaTileEntity().decrStackSize(0, 1);
+ this.getBaseMetaTileEntity().decrStackSize(1, 2*3);
+ this.mMaxProgresstime = getProperTime(3600);
+ return true;
+ }
+ if ((GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[1], "fuelCoke")) && (this.mInventory[1].stackSize >= 1) && (this.spaceForOutput(this.mOutputItem1 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Steel, 1L), this.mOutputItem2 = GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.Ash, 2L)))) {
+ this.getBaseMetaTileEntity().decrStackSize(0, 1);
+ this.getBaseMetaTileEntity().decrStackSize(1, 1*3);
+ this.mMaxProgresstime = getProperTime(2400);
+ return true;
+ }
+ if ((this.mInventory[0].stackSize >= 9) && ((GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[1], "blockCoal")) || (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[1], "blockCharcoal"))) && (this.mInventory[1].stackSize >= 2) && (this.spaceForOutput(this.mOutputItem1 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Steel, 9L), this.mOutputItem2 = GT_OreDictUnificator.get(OrePrefixes.dust, Materials.DarkAsh, 2L)))) {
+ this.getBaseMetaTileEntity().decrStackSize(0, 9);
+ this.getBaseMetaTileEntity().decrStackSize(1, 2*3);
+ this.mMaxProgresstime = getProperTime(32400);
+ return true;
+ }
+ } else if (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[0], "blockIron")) {
+ if ((this.mInventory[1].getItem() == Items.coal) && (this.mInventory[1].stackSize >= 36) && (this.spaceForOutput(this.mOutputItem1 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Steel, 9L), this.mOutputItem2 = GT_OreDictUnificator.get(OrePrefixes.dust, Materials.DarkAsh, 4L)))) {
+ this.getBaseMetaTileEntity().decrStackSize(0, 1);
+ this.getBaseMetaTileEntity().decrStackSize(1, 64);
+ this.mMaxProgresstime = getProperTime(64800);
+ return true;
+ }
+ if ((GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[1], "fuelCoke")) && (this.mInventory[1].stackSize >= 18) && (this.spaceForOutput(this.mOutputItem1 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Steel, 9L), this.mOutputItem2 = GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Ash, 4L)))) {
+ this.getBaseMetaTileEntity().decrStackSize(0, 1);
+ this.getBaseMetaTileEntity().decrStackSize(1, 18*3);
+ this.mMaxProgresstime = getProperTime(43200);
+ return true;
+ }
+ if (((GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[1], "blockCoal")) || (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[1], "blockCharcoal"))) && (this.mInventory[1].stackSize >= 4) && (this.spaceForOutput(this.mOutputItem1 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Steel, 9L), this.mOutputItem2 = GT_OreDictUnificator.get(OrePrefixes.dust, Materials.DarkAsh, 4L)))) {
+ this.getBaseMetaTileEntity().decrStackSize(0, 1);
+ this.getBaseMetaTileEntity().decrStackSize(1, 4*3);
+ this.mMaxProgresstime = getProperTime(64800);
+ return true;
+ }
+ }
+ }
+ this.mOutputItem1 = null;
+ this.mOutputItem2 = null;
+ return false;
+ }
+
+ @Override
+ public boolean isGivingInformation() {
+ return false;
+ }
+
+ @Override
+ public boolean allowPullStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) {
+ return aIndex > 1;
+ }
+
+ @Override
+ public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) {
+ if (aIndex < 2) {
+ }
+ return !GT_Utility.areStacksEqual(aStack, this.mInventory[0]);
+ }
+
+ @Override
+ public byte getTileEntityBaseType() {
+ return 0;
+ }
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IsaMill.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IsaMill.java
new file mode 100644
index 0000000000..59e6e78757
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IsaMill.java
@@ -0,0 +1,666 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing;
+
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
+import static gtPlusPlus.core.util.data.ArrayUtils.removeNulls;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+
+import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
+import com.gtnewhorizon.structurelib.structure.StructureDefinition;
+import gregtech.api.metatileentity.implementations.*;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
+import gtPlusPlus.core.lib.CORE;
+import org.apache.commons.lang3.ArrayUtils;
+
+import gregtech.api.enums.TAE;
+import gregtech.api.enums.Textures;
+import gregtech.api.gui.GT_GUIContainer_MultiMachine;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_Utility;
+import gregtech.api.util.GTPP_Recipe;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.api.objects.data.AutoMap;
+import gtPlusPlus.api.objects.minecraft.BlockPos;
+import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.item.chemistry.general.ItemGenericChemBase;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.math.MathUtils;
+import gtPlusPlus.core.util.minecraft.EntityUtils;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import gtPlusPlus.core.util.minecraft.PlayerUtils;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.nbthandlers.GT_MetaTileEntity_Hatch_MillingBalls;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.CustomIcon;
+import net.minecraft.block.Block;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.DamageSource;
+import net.minecraft.world.World;
+import net.minecraft.world.chunk.Chunk;
+import net.minecraftforge.fluids.FluidStack;
+
+public class GregtechMetaTileEntity_IsaMill extends GregtechMeta_MultiBlockBase {
+
+ protected boolean boostEu = false;
+ private int mCasing;
+ private IStructureDefinition<GregtechMetaTileEntity_IsaMill> STRUCTURE_DEFINITION = null;
+
+ private static ITexture frontFace;
+ private static ITexture frontFaceActive;
+
+ private ArrayList<GT_MetaTileEntity_Hatch_MillingBalls> mMillingBallBuses = new ArrayList<GT_MetaTileEntity_Hatch_MillingBalls>();
+ private static final DamageSource mIsaMillDamageSource = new DamageSource("gtpp.grinder").setDamageBypassesArmor();
+
+ public GregtechMetaTileEntity_IsaMill(int aID, String aName, String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ frontFaceActive = new GT_RenderedTexture(new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE5"));
+ frontFace = new GT_RenderedTexture(new CustomIcon("iconsets/Grinder/GRINDER5"));
+ }
+
+ public GregtechMetaTileEntity_IsaMill(String aName) {
+ super(aName);
+ }
+
+ @Override
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
+ GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType(getMachineType())
+ .addInfo("Controller Block for the Large Grinding Machine")
+ .addInfo("Grind ores.")
+ .addPollutionAmount(getPollutionPerSecond(null))
+ .addSeparator()
+ .beginStructureBlock(3, 3, 7, false)
+ .addController("Front Center")
+ .addCasingInfo("IsaMill Exterior Casing", 40)
+ .addOtherStructurePart("IsaMill Gearbox", "Inner Blocks")
+ .addOtherStructurePart("IsaMill Piping", "8x, ring around controller")
+ .addStructureInfo("IsaMill Pipings must not be obstructed in front (only air blocks)")
+ .addOtherStructurePart("Milling Ball Hatch", "Any Casing")
+ .addInputBus("Any Casing", 1)
+ .addOutputBus("Any Casing", 1)
+ .addEnergyHatch("Any Casing", 1)
+ .addMaintenanceHatch("Any Casing", 1)
+ .addMufflerHatch("Any Casing", 1)
+ .toolTipFinisher(CORE.GT_Tooltip_Builder);
+ return tt;
+ }
+
+ @Override
+ public IStructureDefinition<GregtechMetaTileEntity_IsaMill> getStructureDefinition() {
+ if (STRUCTURE_DEFINITION == null) {
+ STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_IsaMill>builder()
+ .addShape(mName, transpose(new String[][]{
+ {"DDD", "CCC", "CCC", "CCC", "CCC", "CCC", "CCC"},
+ {"D~D", "CGC", "CGC", "CGC", "CGC", "CGC", "CCC"},
+ {"DDD", "CCC", "CCC", "CCC", "CCC", "CCC", "CCC"},
+ }))
+ .addElement(
+ 'C',
+ ofChain(
+ ofHatchAdder(
+ GregtechMetaTileEntity_IsaMill::addToMachineList, getCasingTextureIndex(), 1
+ ),
+ onElementPass(
+ x -> ++x.mCasing,
+ ofBlock(
+ getCasingBlock(), getCasingMeta()
+ )
+ )
+ )
+ )
+ .addElement(
+ 'D',
+ ofBlock(
+ getIntakeBlock(), getIntakeMeta()
+ )
+ )
+ .addElement(
+ 'G',
+ ofBlock(
+ getGearboxBlock(), getGearboxMeta()
+ )
+ )
+ .build();
+ }
+ return STRUCTURE_DEFINITION;
+ }
+
+ @Override
+ public void construct(ItemStack stackSize, boolean hintsOnly) {
+ buildPiece(mName , stackSize, hintsOnly, 1, 1, 0);
+ }
+
+ @Override
+ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ mCasing = 0;
+ mMillingBallBuses.clear();
+ return checkPiece(mName, 1, 1, 0) && mCasing >= 48 - 8 && checkHatch();
+ }
+
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+ return new ITexture[]{
+ Textures.BlockIcons.getCasingTextureForId(TAE.GTPP_INDEX(2)),
+ aFacing == aSide ? aActive ? frontFaceActive : frontFace : Textures.BlockIcons.getCasingTextureForId(TAE.GTPP_INDEX(2))};
+ }
+
+ @Override
+ public boolean isCorrectMachinePart(ItemStack aStack) {
+ return getMaxEfficiency(aStack) > 0;
+ }
+
+ @Override
+ public boolean addToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+
+ final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity == null) {
+ return false;
+ }
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_MillingBalls) {
+ log("Found GT_MetaTileEntity_Hatch_MillingBalls");
+ return addToMachineListInternal(mMillingBallBuses, aMetaTileEntity, aBaseCasingIndex);
+ }
+ return super.addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+
+ public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "LargeDieselEngine.png");
+ }
+
+ @Override
+ public GT_Recipe.GT_Recipe_Map getRecipeMap() {
+ return GTPP_Recipe.GTPP_Recipe_Map.sOreMillRecipes;
+ }
+
+ @Override
+ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ if (aBaseMetaTileEntity.isServerSide()) {
+ if (this.mUpdate == 1 || this.mStartUpCheck == 1) {
+ this.mMillingBallBuses.clear();
+ }
+ }
+ if (aTick % 20 == 0) {
+ checkForEntities(aBaseMetaTileEntity, aTick);
+ }
+ super.onPostTick(aBaseMetaTileEntity, aTick);
+ }
+
+ private final AutoMap<BlockPos> mFrontBlockPosCache = new AutoMap<BlockPos>();
+
+ public void checkForEntities(IGregTechTileEntity aBaseMetaTileEntity, long aTime) {
+
+ if (aTime % 100 == 0) {
+ mFrontBlockPosCache.clear();
+ }
+ if (mFrontBlockPosCache.isEmpty()) {
+ byte tSide = aBaseMetaTileEntity.getBackFacing();
+ int aTileX = aBaseMetaTileEntity.getXCoord();
+ int aTileY = aBaseMetaTileEntity.getYCoord();
+ int aTileZ = aBaseMetaTileEntity.getZCoord();
+ boolean xFacing = (tSide == 4 || tSide == 5);
+ boolean zFacing = (tSide == 2 || tSide == 3);
+
+ // Check Casings
+ int aDepthOffset = (tSide == 2 || tSide == 4) ? 1 : -1;
+ for (int aHorizontalOffset = -1; aHorizontalOffset < 2; aHorizontalOffset++) {
+ for (int aVerticalOffset = -1; aVerticalOffset < 2; aVerticalOffset++) {
+ int aX = !xFacing ? (aTileX + aHorizontalOffset) : (aTileX + aDepthOffset);
+ int aY = aTileY + aVerticalOffset;
+ int aZ = !zFacing ? (aTileZ + aHorizontalOffset) : (aTileZ + aDepthOffset);
+ mFrontBlockPosCache.add(new BlockPos(aX, aY, aZ, aBaseMetaTileEntity.getWorld()));
+ }
+ }
+ }
+
+ AutoMap<EntityLivingBase> aEntities = getEntities(mFrontBlockPosCache, aBaseMetaTileEntity.getWorld());
+ if (!aEntities.isEmpty()) {
+ for (EntityLivingBase aFoundEntity : aEntities) {
+ if (aFoundEntity instanceof EntityPlayer) {
+ EntityPlayer aPlayer = (EntityPlayer) aFoundEntity;
+ if (PlayerUtils.isCreative(aPlayer) || !PlayerUtils.canTakeDamage(aPlayer)) {
+ continue;
+ }
+ else {
+ if (aFoundEntity.getHealth() > 0) {
+ EntityUtils.doDamage(aFoundEntity, mIsaMillDamageSource, (int) (aFoundEntity.getMaxHealth() / 5));
+ if ((aBaseMetaTileEntity.isClientSide()) && (aBaseMetaTileEntity.isActive())) {
+ generateParticles(aFoundEntity);
+ }
+ }
+ }
+ }
+ if (aFoundEntity.getHealth() > 0) {
+ EntityUtils.doDamage(aFoundEntity, mIsaMillDamageSource, Math.max(1, (int) (aFoundEntity.getMaxHealth() / 3)));
+ if ((aBaseMetaTileEntity.isClientSide()) && (aBaseMetaTileEntity.isActive())) {
+ generateParticles(aFoundEntity);
+ }
+ }
+ }
+ }
+ }
+
+ private static final AutoMap<EntityLivingBase> getEntities(AutoMap<BlockPos> aPositionsToCheck, World aWorld){
+ AutoMap<EntityLivingBase> aEntities = new AutoMap<EntityLivingBase>();
+ HashSet<Chunk> aChunksToCheck = new HashSet<Chunk>();
+ if (!aPositionsToCheck.isEmpty()) {
+ Chunk aLocalChunk;
+ for (BlockPos aPos : aPositionsToCheck) {
+ aLocalChunk = aWorld.getChunkFromBlockCoords(aPos.xPos, aPos.zPos);
+ aChunksToCheck.add(aLocalChunk);
+ }
+ }
+ if (!aChunksToCheck.isEmpty()) {
+ AutoMap<EntityLivingBase> aEntitiesFound = new AutoMap<EntityLivingBase>();
+ for (Chunk aChunk : aChunksToCheck) {
+ if (aChunk.isChunkLoaded) {
+ List[] aEntityLists = aChunk.entityLists;
+ for (List aEntitySubList : aEntityLists) {
+ for (Object aEntity : aEntitySubList) {
+ if (aEntity instanceof EntityLivingBase) {
+ EntityLivingBase aPlayer = (EntityLivingBase) aEntity;
+ aEntitiesFound.add(aPlayer);
+ }
+ }
+ }
+ }
+ }
+ if (!aEntitiesFound.isEmpty()) {
+ for (EntityLivingBase aEntity : aEntitiesFound) {
+ BlockPos aPlayerPos = EntityUtils.findBlockPosOfEntity(aEntity);
+ for (BlockPos aBlockSpaceToCheck : aPositionsToCheck) {
+ if (aBlockSpaceToCheck.equals(aPlayerPos)) {
+ aEntities.add(aEntity);
+ }
+ }
+ }
+ }
+ }
+ return aEntities;
+ }
+
+ private static void generateParticles(EntityLivingBase aEntity) {
+ BlockPos aPlayerPosBottom = EntityUtils.findBlockPosOfEntity(aEntity);
+ BlockPos aPlayerPosTop = aPlayerPosBottom.getUp();
+ AutoMap<BlockPos> aEntityPositions = new AutoMap<BlockPos>();
+ aEntityPositions.add(aPlayerPosBottom);
+ aEntityPositions.add(aPlayerPosTop);
+ for (int i = 0; i < 64; i++) {
+ BlockPos aEffectPos = aEntityPositions.get(aEntity.height > 1f ? MathUtils.randInt(0, 1) : 0);
+ float aOffsetX = MathUtils.randFloat(-0.35f, 0.35f);
+ float aOffsetY = MathUtils.randFloat(-0.25f, 0.35f);
+ float aOffsetZ = MathUtils.randFloat(-0.35f, 0.35f);
+ aEntity.worldObj.spawnParticle("reddust", aEffectPos.xPos + aOffsetX, aEffectPos.yPos + 0.3f + aOffsetY, aEffectPos.zPos + aOffsetZ, 0.0D, 0.0D, 0.0D);
+ }
+ }
+
+ @Override
+ public boolean checkRecipe(ItemStack aStack) {
+ return checkRecipeGeneric();
+ }
+
+ public Block getCasingBlock() {
+ return ModBlocks.blockCasings5Misc;
+ }
+
+ public byte getCasingMeta() {
+ return 0;
+ }
+
+ public Block getIntakeBlock() {
+ return ModBlocks.blockCasings5Misc;
+ }
+
+ public byte getIntakeMeta() {
+ return 1;
+ }
+
+ public Block getGearboxBlock() {
+ return ModBlocks.blockCasings5Misc;
+ }
+
+ public byte getGearboxMeta() {
+ return 2;
+ }
+
+ public byte getCasingTextureIndex() {
+ return 66;
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaTileEntity_IsaMill(this.mName);
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ super.saveNBTData(aNBT);
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ super.loadNBTData(aNBT);
+ }
+
+ @Override
+ public int getDamageToComponent(ItemStack aStack) {
+ return 1;
+ }
+
+ public int getMaxEfficiency(ItemStack aStack) {
+ return 10000;
+ }
+
+ @Override
+ public int getPollutionPerSecond(ItemStack aStack) {
+ return CORE.ConfigSwitches.pollutionPerSecondMultiIsaMill;
+ }
+
+ @Override
+ public boolean explodesOnComponentBreak(ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public String[] getExtraInfoData() {
+ return new String[]{
+ "IsaMill Grinding Machine",
+ "Current Efficiency: " + (mEfficiency / 100) + "%",
+ getIdealStatus() == getRepairStatus() ? "No Maintainance issues" : "Needs Maintainance"
+ };
+ }
+
+ @Override
+ public boolean isGivingInformation() {
+ return true;
+ }
+
+ @Override
+ public boolean hasSlotInGUI() {
+ return false;
+ }
+
+ @Override
+ public String getCustomGUIResourceName() {
+ return null;
+ }
+
+ @Override
+ public String getMachineType() {
+ return "Grinding Machine";
+ }
+
+ @Override
+ public int getMaxParallelRecipes() {
+ return 1;
+ }
+
+ @Override
+ public int getEuDiscountForParallelism() {
+ return 0;
+ }
+
+ /*
+ * Milling Ball Handling
+ */
+
+ @Override
+ public ArrayList<ItemStack> getStoredInputs() {
+ ArrayList<ItemStack> tItems = super.getStoredInputs();
+ for (GT_MetaTileEntity_Hatch_MillingBalls tHatch : mMillingBallBuses) {
+ tHatch.mRecipeMap = getRecipeMap();
+ if (isValidMetaTileEntity(tHatch)) {
+ tItems.addAll(tHatch.getContentUsageSlots());
+ }
+ }
+ return tItems;
+ }
+
+
+ public int getMaxBallDurability(ItemStack aStack) {
+ return ItemGenericChemBase.getMaxBallDurability(aStack);
+ }
+
+ private ItemStack findMillingBall(ItemStack[] aItemInputs) {
+ if (mMillingBallBuses.isEmpty() || mMillingBallBuses.size() > 1) {
+ return null;
+ }
+ else {
+ GT_MetaTileEntity_Hatch_MillingBalls aBus = mMillingBallBuses.get(0);
+ if (aBus != null) {
+ AutoMap<ItemStack> aAvailableItems = aBus.getContentUsageSlots();
+ if (!aAvailableItems.isEmpty()) {
+ for (final ItemStack aInput : aItemInputs) {
+ if (ItemUtils.isMillingBall(aInput)) {
+ for (ItemStack aBall : aAvailableItems) {
+ if (GT_Utility.areStacksEqual(aBall, aInput, true)) {
+ Logger.INFO("Found a valid milling ball to use.");
+ return aBall;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+
+ private void damageMillingBall(ItemStack aStack) {
+ if (MathUtils.randFloat(0, 10000000)/10000000f < (1.2f - (0.2 * 1))) {
+ int damage = getMillingBallDamage(aStack) + 1;
+ log("damage milling ball "+damage);
+ if (damage >= getMaxBallDurability(aStack)) {
+ log("consuming milling ball");
+ aStack.stackSize -= 1;
+ }
+ else {
+ setDamage(aStack,damage);
+ }
+ }
+ else {
+ log("not damaging milling ball");
+ }
+ }
+
+ private int getMillingBallDamage(ItemStack aStack) {
+ return ItemGenericChemBase.getMillingBallDamage(aStack);
+ }
+
+ private void setDamage(ItemStack aStack,int aAmount) {
+ ItemGenericChemBase.setMillingBallDamage(aStack, aAmount);
+ }
+
+
+ @Override
+ public boolean checkRecipeGeneric(
+ ItemStack[] aItemInputs, FluidStack[] aFluidInputs,
+ int aMaxParallelRecipes, int aEUPercent,
+ int aSpeedBonusPercent, int aOutputChanceRoll, GT_Recipe aRecipe, boolean isOC) {
+
+ // Based on the Processing Array. A bit overkill, but very flexible.
+
+ // Reset outputs and progress stats
+ this.mEUt = 0;
+ this.mMaxProgresstime = 0;
+ this.mOutputItems = new ItemStack[]{};
+ this.mOutputFluids = new FluidStack[]{};
+
+ long tVoltage = getMaxInputVoltage();
+ byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage));
+ long tEnergy = getMaxInputEnergy();
+ log("Running checkRecipeGeneric(0)");
+
+ // checks if it has a milling ball with enough durability
+ ItemStack tMillingBallRecipe = findMillingBall(aItemInputs);
+ if (tMillingBallRecipe == null) {
+ log("does not have milling ball");
+ return false;
+ }
+
+ GT_Recipe tRecipe = findRecipe(
+ getBaseMetaTileEntity(), mLastRecipe, false,
+ gregtech.api.enums.GT_Values.V[tTier], aFluidInputs, aItemInputs);
+
+
+ log("Running checkRecipeGeneric(1)");
+ // Remember last recipe - an optimization for findRecipe()
+ this.mLastRecipe = tRecipe;
+
+
+ if (tRecipe == null) {
+ log("BAD RETURN - 1");
+ return false;
+ }
+
+ aMaxParallelRecipes = this.canBufferOutputs(tRecipe, aMaxParallelRecipes);
+ if (aMaxParallelRecipes == 0) {
+ log("BAD RETURN - 2");
+ return false;
+ }
+
+ // EU discount
+ float tRecipeEUt = (tRecipe.mEUt * aEUPercent) / 100.0f;
+ float tTotalEUt = 0.0f;
+ log("aEUPercent "+aEUPercent);
+ log("mEUt "+tRecipe.mEUt);
+
+ int parallelRecipes = 0;
+
+ log("parallelRecipes: "+parallelRecipes);
+ log("aMaxParallelRecipes: "+1);
+ log("tTotalEUt: "+tTotalEUt);
+ log("tVoltage: "+tVoltage);
+ log("tEnergy: "+tEnergy);
+ log("tRecipeEUt: "+tRecipeEUt);
+ // Count recipes to do in parallel, consuming input items and fluids and considering input voltage limits
+ for (; parallelRecipes < 1 && tTotalEUt < (tEnergy - tRecipeEUt); parallelRecipes++) {
+ if (!tRecipe.isRecipeInputEqual(true, aFluidInputs, aItemInputs)) {
+ log("Broke at "+parallelRecipes+".");
+ break;
+ }
+ log("Bumped EU from "+tTotalEUt+" to "+(tTotalEUt+tRecipeEUt)+".");
+ tTotalEUt += tRecipeEUt;
+ }
+
+ if (parallelRecipes == 0) {
+ log("BAD RETURN - 3");
+ return false;
+ }
+
+ // -- Try not to fail after this point - inputs have already been consumed! --
+
+
+ // Convert speed bonus to duration multiplier
+ // e.g. 100% speed bonus = 200% speed = 100%/200% = 50% recipe duration.
+ aSpeedBonusPercent = Math.max(-99, aSpeedBonusPercent);
+ float tTimeFactor = 100.0f / (100.0f + aSpeedBonusPercent);
+ this.mMaxProgresstime = (int)(tRecipe.mDuration * tTimeFactor);
+
+ this.mEUt = (int)Math.ceil(tTotalEUt);
+
+ this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
+ this.mEfficiencyIncrease = 10000;
+
+ // Overclock
+ if (this.mEUt <= 16) {
+ this.mEUt = (this.mEUt * (1 << tTier - 1) * (1 << tTier - 1));
+ this.mMaxProgresstime = (this.mMaxProgresstime / (1 << tTier - 1));
+ } else {
+ while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) {
+ this.mEUt *= 4;
+ this.mMaxProgresstime /= 2;
+ }
+ }
+
+ if (this.mEUt > 0) {
+ this.mEUt = (-this.mEUt);
+ }
+
+
+ this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
+
+ // Collect fluid outputs
+ FluidStack[] tOutputFluids = new FluidStack[tRecipe.mFluidOutputs.length];
+ for (int h = 0; h < tRecipe.mFluidOutputs.length; h++) {
+ if (tRecipe.getFluidOutput(h) != null) {
+ tOutputFluids[h] = tRecipe.getFluidOutput(h).copy();
+ tOutputFluids[h].amount *= parallelRecipes;
+ }
+ }
+
+ // Collect output item types
+ ItemStack[] tOutputItems = new ItemStack[tRecipe.mOutputs.length];
+ for (int h = 0; h < tRecipe.mOutputs.length; h++) {
+ if (tRecipe.getOutput(h) != null) {
+ tOutputItems[h] = tRecipe.getOutput(h).copy();
+ tOutputItems[h].stackSize = 0;
+ }
+ }
+
+ // Set output item stack sizes (taking output chance into account)
+ for (int f = 0; f < tOutputItems.length; f++) {
+ if (tRecipe.mOutputs[f] != null && tOutputItems[f] != null) {
+ for (int g = 0; g < parallelRecipes; g++) {
+ if (getBaseMetaTileEntity().getRandomNumber(aOutputChanceRoll) < tRecipe.getOutputChance(f))
+ tOutputItems[f].stackSize += tRecipe.mOutputs[f].stackSize;
+ }
+ }
+ }
+
+ tOutputItems = removeNulls(tOutputItems);
+
+ // Sanitize item stack size, splitting any stacks greater than max stack size
+ List<ItemStack> splitStacks = new ArrayList<ItemStack>();
+ for (ItemStack tItem : tOutputItems) {
+ while (tItem.getMaxStackSize() < tItem.stackSize) {
+ ItemStack tmp = tItem.copy();
+ tmp.stackSize = tmp.getMaxStackSize();
+ tItem.stackSize = tItem.stackSize - tItem.getMaxStackSize();
+ splitStacks.add(tmp);
+ }
+ }
+
+ if (splitStacks.size() > 0) {
+ ItemStack[] tmp = new ItemStack[splitStacks.size()];
+ tmp = splitStacks.toArray(tmp);
+ tOutputItems = ArrayUtils.addAll(tOutputItems, tmp);
+ }
+
+ // Strip empty stacks
+ List<ItemStack> tSList = new ArrayList<ItemStack>();
+ for (ItemStack tS : tOutputItems) {
+ if (tS.stackSize > 0) tSList.add(tS);
+ }
+ tOutputItems = tSList.toArray(new ItemStack[tSList.size()]);
+
+
+ // Damage Milling ball once all is said and done.
+ if (tMillingBallRecipe != null) {
+ log("damaging milling ball");
+ damageMillingBall(tMillingBallRecipe);
+ }
+
+ // Commit outputs
+ this.mOutputItems = tOutputItems;
+ this.mOutputFluids = tOutputFluids;
+ updateSlots();
+
+ // Play sounds (GT++ addition - GT multiblocks play no sounds)
+ startProcess();
+
+ log("GOOD RETURN - 1");
+ return true;
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_SpargeTower.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_SpargeTower.java
new file mode 100644
index 0000000000..81f8ba9edb
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_SpargeTower.java
@@ -0,0 +1,414 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing;
+
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.isAir;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.gtnewhorizon.structurelib.alignment.IAlignmentLimits;
+import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
+import com.gtnewhorizon.structurelib.structure.StructureDefinition;
+
+import gregtech.api.enums.Textures;
+import gregtech.api.enums.Textures.BlockIcons;
+import gregtech.api.gui.GT_GUIContainer_MultiMachine;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output;
+import gregtech.api.render.TextureFactory;
+import gregtech.api.util.GTPP_Recipe;
+import gregtech.api.util.GTPP_Recipe.GTPP_Recipe_Map;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_Utility;
+import gregtech.api.util.GasSpargingRecipe;
+import gregtech.api.util.GasSpargingRecipeMap;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.math.MathUtils;
+import gtPlusPlus.core.util.minecraft.PlayerUtils;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.fluids.FluidStack;
+
+public class GregtechMetaTileEntity_SpargeTower extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_SpargeTower> {
+
+ protected static final String STRUCTURE_PIECE_BASE = "base";
+ protected static final String STRUCTURE_PIECE_LAYER = "layer";
+ protected static final String STRUCTURE_PIECE_LAYER_HINT = "layerHint";
+ protected static final String STRUCTURE_PIECE_TOP_HINT = "topHint";
+ private static final IStructureDefinition<GregtechMetaTileEntity_SpargeTower> STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_SpargeTower>builder()
+ .addShape(STRUCTURE_PIECE_BASE, transpose(new String[][]{
+ {"b~b", "bbb", "bbb"},
+ }))
+ .addShape(STRUCTURE_PIECE_LAYER, transpose(new String[][]{
+ {"lll", "lcl", "lll"}
+ }))
+ .addShape(STRUCTURE_PIECE_LAYER_HINT, transpose(new String[][]{
+ {"lll", "l-l", "lll"}
+ }))
+ .addShape(STRUCTURE_PIECE_TOP_HINT, transpose(new String[][]{
+ {"lll", "lll", "lll"}
+ }))
+ .addElement('b', ofChain(
+ ofHatchAdder(GregtechMetaTileEntity_SpargeTower::addEnergyInputToMachineList, getCasingIndex(), 1),
+ ofHatchAdder(GregtechMetaTileEntity_SpargeTower::addInputToMachineList, getCasingIndex(), 1),
+ ofHatchAdder(GregtechMetaTileEntity_SpargeTower::addMaintenanceToMachineList, getCasingIndex(), 1),
+ onElementPass(GregtechMetaTileEntity_SpargeTower::onCasingFound, ofBlock(ModBlocks.blockCasings5Misc, 4))
+ ))
+ .addElement('l', ofChain(
+ ofHatchAdder(GregtechMetaTileEntity_SpargeTower::addEnergyInputToMachineList, getCasingIndex(), 2),
+ ofHatchAdder(GregtechMetaTileEntity_SpargeTower::addLayerOutputHatch, getCasingIndex(), 2),
+ ofHatchAdder(GregtechMetaTileEntity_SpargeTower::addMaintenanceToMachineList, getCasingIndex(), 2),
+ onElementPass(GregtechMetaTileEntity_SpargeTower::onCasingFound, ofBlock(ModBlocks.blockCasings5Misc, 4))
+ ))
+ .addElement('c', ofChain(
+ onElementPass(t -> t.onTopLayerFound(false), ofHatchAdder(GregtechMetaTileEntity_SpargeTower::addOutputToMachineList, getCasingIndex(), 3)),
+ onElementPass(t -> t.onTopLayerFound(false), ofHatchAdder(GregtechMetaTileEntity_SpargeTower::addMaintenanceToMachineList, getCasingIndex(), 3)),
+ onElementPass(t -> t.onTopLayerFound(true), ofBlock(ModBlocks.blockCasings5Misc, 4)),
+ isAir()
+ ))
+ .build();
+
+ protected final List<List<GT_MetaTileEntity_Hatch_Output>> mOutputHatchesByLayer = new ArrayList<>();
+ protected int mHeight;
+ protected int mCasing;
+ protected boolean mTopLayerFound;
+
+ public GregtechMetaTileEntity_SpargeTower(int aID, String aName, String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ }
+
+ public GregtechMetaTileEntity_SpargeTower(String aName) {
+ super(aName);
+ }
+
+ public static int getCasingIndex() {
+ return 68;
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaTileEntity_SpargeTower(this.mName);
+ }
+
+ @Override
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
+ final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType("Gas Sparge Tower")
+ .addInfo("Controller block for the Sparging Tower")
+ .addInfo("Fluids are only put out at the correct height")
+ .addInfo("The correct height equals the slot number in the NEI recipe")
+ .addSeparator()
+ .beginStructureBlock(3, 8, 3, true)
+ .addController("Front bottom")
+ .addOtherStructurePart("Sparge Tower Exterior Casing", "45 (minimum)")
+ .addEnergyHatch("Any casing", 1, 2)
+ .addMaintenanceHatch("Any casing", 1, 2, 3)
+ .addInputHatch("2x Input Hatches (Any bottom layer casing)", 1)
+ .addOutputHatch("6x Output Hatches (At least one per layer except bottom layer)", 2, 3)
+ .toolTipFinisher(CORE.GT_Tooltip_Builder);
+ return tt;
+ }
+
+ @Override
+ public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
+ if (aSide == aFacing) {
+ if (aActive)
+ return new ITexture[]{
+ BlockIcons.getCasingTextureForId(getCasingIndex()),
+ TextureFactory.builder().addIcon(TexturesGtBlock.Overlay_Machine_Controller_Advanced_Active).extFacing().build()};
+ return new ITexture[]{
+ BlockIcons.getCasingTextureForId(getCasingIndex()),
+ TextureFactory.builder().addIcon(TexturesGtBlock.Overlay_Machine_Controller_Advanced).extFacing().build()};
+ }
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(getCasingIndex())};
+ }
+
+ @Override
+ public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "DistillationTower.png");
+ }
+
+ @Override
+ public GT_Recipe.GT_Recipe_Map getRecipeMap() {
+ if (GTPP_Recipe_Map.sSpargeTowerRecipes.mRecipeList.isEmpty()) {
+ generateRecipes();
+ }
+ return GTPP_Recipe_Map.sSpargeTowerRecipes;
+ }
+
+ private static boolean generateRecipes() {
+ for (GasSpargingRecipe aRecipe : GasSpargingRecipeMap.mRecipes) {
+ GTPP_Recipe newRecipe = new GTPP_Recipe(
+ false,
+ new ItemStack[] {},
+ new ItemStack[] {},
+ null,
+ null,
+ aRecipe.mFluidInputs.clone(),
+ new FluidStack[] {},
+ aRecipe.mDuration,
+ aRecipe.mEUt,
+ 0);
+ GTPP_Recipe_Map.sSpargeTowerRecipes.add(newRecipe);
+ }
+ if (GTPP_Recipe_Map.sSpargeTowerRecipes.mRecipeList.isEmpty()) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public boolean isCorrectMachinePart(ItemStack aStack) {
+ return true;
+ }
+
+ @Override
+ public boolean checkRecipe(ItemStack aStack) {
+ ArrayList<FluidStack> tFluidList = getStoredFluids();
+ long tVoltage = getMaxInputVoltage();
+ byte tTier = (byte) Math.max(0, GT_Utility.getTier(tVoltage));
+ FluidStack[] tFluids = tFluidList.toArray(new FluidStack[0]);
+ if (tFluids.length > 0) {
+ Logger.INFO("Found "+tFluids.length+" input fluids. Searching "+GTPP_Recipe_Map.sSpargeTowerRecipes.mRecipeList.size()+" recipes.");
+ GT_Recipe tRecipe = getRecipeMap().findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], tFluids);
+ if (tRecipe != null) {
+ Logger.INFO("Found recipe!");
+ if (tRecipe.isRecipeInputEqual(true, tFluids)) {
+ Logger.INFO("Found recipe that matches!");
+ this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
+ this.mEfficiencyIncrease = 10000;
+
+ // Reset outputs and progress stats
+ this.mEUt = 0;
+ this.mProgresstime = 0;
+ this.mMaxProgresstime = 0;
+ this.mOutputItems = new ItemStack[]{};
+ this.mOutputFluids = new FluidStack[]{};
+ this.mLastRecipe = tRecipe;
+
+ calculateOverclockedNessMulti(tRecipe.mEUt, tRecipe.mDuration, 1, tVoltage);
+ int aDevProgress = this.mMaxProgresstime / 10;
+ this.mMaxProgresstime = Math.max(1, aDevProgress);
+ this.mOutputItems = new ItemStack[]{};
+ ArrayList<FluidStack> aFluidOutputs = getByproductsOfSparge(tRecipe.mFluidInputs[0], tRecipe.mFluidInputs[1]);
+ this.mOutputFluids = (FluidStack[]) aFluidOutputs.toArray(new FluidStack[0]);
+ updateSlots();
+ Logger.INFO("Done!");
+ return true;
+ }
+ }
+ else {
+ Logger.INFO("Did not find recipe!");
+ }
+ }
+ this.mEUt = 0;
+ this.mEfficiency = 0;
+ Logger.INFO("Did not find recipe! (2)");
+ return false;
+ }
+
+ private static ArrayList<FluidStack> getByproductsOfSparge(final FluidStack aSpargeGas, final FluidStack aSpentFuel){
+ GasSpargingRecipe aSpargeRecipe = GasSpargingRecipeMap.findRecipe(aSpargeGas, aSpentFuel);
+ ArrayList<FluidStack> aOutputGases = new ArrayList<FluidStack>();
+ if (aSpargeRecipe == null) {
+ Logger.INFO("Did not find sparge recipe!");
+ return aOutputGases;
+ }
+ int aSpargeGasAmount = aSpargeRecipe.mInputGas.amount;
+
+ aOutputGases.add(aSpargeRecipe.mOutputSpargedFuel.copy());
+ ArrayList<FluidStack> aTempMap = new ArrayList<FluidStack>();
+ for (int i=2;i<aSpargeRecipe.mFluidOutputs.length;i++) {
+ int aGasAmount = MathUtils.randInt(0, (aSpargeRecipe.mMaxOutputQuantity[i-2]/100));
+ FluidStack aOutput = aSpargeRecipe.mFluidOutputs[i].copy();
+ aSpargeGasAmount -= aGasAmount;
+ FluidStack aSpargeOutput = null;
+ if (aGasAmount > 0) {
+ aSpargeOutput = new FluidStack(aOutput.getFluid(), aGasAmount);
+ }
+ aTempMap.add(aSpargeOutput);
+ }
+ Logger.INFO("Sparge gas left: "+aSpargeGasAmount);
+ if (aSpargeGasAmount > 0) {
+ aOutputGases.add(new FluidStack(aSpargeRecipe.mInputGas.getFluid(), aSpargeGasAmount));
+ }
+ //Logger.INFO("Sparge Outputs: "+ItemUtils.getArrayStackNames(aTempMap));
+ aOutputGases.addAll(aTempMap);
+ Logger.INFO("Sparge output size: "+aOutputGases.size());
+ //Logger.INFO("Output of sparging: "+ItemUtils.getArrayStackNames(aOutputGases));
+ return aOutputGases;
+ }
+
+ protected void onCasingFound() {
+ mCasing++;
+ }
+
+ protected void onTopLayerFound(boolean aIsCasing) {
+ mTopLayerFound = true;
+ if (aIsCasing) {
+ onCasingFound();
+ }
+ }
+
+ protected boolean addLayerOutputHatch(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null || aTileEntity.isDead() || !(aTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_Hatch_Output)) {
+ Logger.INFO("Bad Output Hatch");
+ return false;
+ }
+ while (mOutputHatchesByLayer.size() < mHeight) {
+ mOutputHatchesByLayer.add(new ArrayList<>());
+ }
+ GT_MetaTileEntity_Hatch_Output tHatch = (GT_MetaTileEntity_Hatch_Output) aTileEntity.getMetaTileEntity();
+ tHatch.updateTexture(aBaseCasingIndex);
+ boolean addedHatch = mOutputHatchesByLayer.get(mHeight - 1).add(tHatch);
+ Logger.INFO("Added Hatch: "+addedHatch);
+ return addedHatch;
+ }
+
+ @Override
+ protected IAlignmentLimits getInitialAlignmentLimits() {
+ // don't rotate a freaking tower, it won't work
+ return (d, r, f) -> d.offsetY == 0 && r.isNotRotated() && !f.isVerticallyFliped();
+ }
+
+ @Override
+ public IStructureDefinition<GregtechMetaTileEntity_SpargeTower> getStructureDefinition() {
+ return STRUCTURE_DEFINITION;
+ }
+
+ @Override
+ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ // reset
+ mOutputHatchesByLayer.forEach(List::clear);
+ mHeight = 1;
+ mTopLayerFound = false;
+ mCasing = 0;
+
+ // check base
+ if (!checkPiece(STRUCTURE_PIECE_BASE, 1, 0, 0)) {
+ Logger.INFO("Bad Base. Height: "+mHeight);
+ return false;
+ }
+
+ // check each layer
+ while (mHeight < 8 && checkPiece(STRUCTURE_PIECE_LAYER, 1, mHeight, 0) && !mTopLayerFound) {
+ if (mOutputHatchesByLayer.get(mHeight - 1).isEmpty()) {
+ // layer without output hatch
+ Logger.INFO("Height: "+mHeight + " - Missing output on "+(mHeight - 1));
+ return false;
+ }
+ // not top
+ mHeight++;
+ }
+
+ // validate final invariants...
+ Logger.INFO("Height: "+mHeight);
+ Logger.INFO("Casings: "+mCasing);
+ Logger.INFO("Required: "+(7 * mHeight - 5));
+ Logger.INFO("Found Top: "+mTopLayerFound);
+ return mCasing >= 45 && mTopLayerFound && mMaintenanceHatches.size() == 1;
+ }
+
+ @Override
+ public int getMaxEfficiency(ItemStack aStack) {
+ return 10000;
+ }
+
+ @Override
+ public int getPollutionPerTick(ItemStack aStack) {
+ return 0;
+ }
+
+ @Override
+ public int getDamageToComponent(ItemStack aStack) {
+ return 0;
+ }
+
+ @Override
+ public boolean explodesOnComponentBreak(ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ protected void addFluidOutputs(FluidStack[] mOutputFluids2) {
+ for (int i = 0; i < mOutputFluids2.length && i < mOutputHatchesByLayer.size(); i++) {
+ FluidStack tStack = mOutputFluids2[i] != null ? mOutputFluids2[i].copy() : null;
+ if (tStack == null) {
+ continue;
+ }
+ if (!dumpFluid(mOutputHatchesByLayer.get(i), tStack, true)) {
+ dumpFluid(mOutputHatchesByLayer.get(i), tStack, false);
+ }
+ }
+ }
+
+ @Override
+ public void construct(ItemStack stackSize, boolean hintsOnly) {
+ buildPiece(STRUCTURE_PIECE_BASE, stackSize, hintsOnly, 1, 0, 0);
+ int tTotalHeight = 8; // min 2 output layer, so at least 1 + 2 height
+ for (int i = 1; i < tTotalHeight - 1; i++) {
+ buildPiece(STRUCTURE_PIECE_LAYER_HINT, stackSize, hintsOnly, 1, i, 0);
+ }
+ buildPiece(STRUCTURE_PIECE_TOP_HINT, stackSize, hintsOnly, 1, tTotalHeight - 1, 0);
+ }
+
+ @Override
+ public boolean hasSlotInGUI() {
+ return false;
+ }
+
+ @Override
+ public String getCustomGUIResourceName() {
+ return null;
+ }
+
+ @Override
+ public boolean requiresVanillaGtGUI() {
+ return true;
+ }
+
+ @Override
+ public String getMachineType() {
+ return "Gas Sparger";
+ }
+
+ @Override
+ public int getMaxParallelRecipes() {
+ return 1;
+ }
+
+ @Override
+ public int getEuDiscountForParallelism() {
+ return 0;
+ }
+
+ @Override
+ public boolean onPlungerRightClick(EntityPlayer aPlayer, byte aSide, float aX, float aY, float aZ) {
+ int aLayerIndex = 0;
+ PlayerUtils.messagePlayer(aPlayer, "Trying to clear "+mOutputHatchesByLayer.size()+" layers of output hatches.");
+ for (List<GT_MetaTileEntity_Hatch_Output> layer : this.mOutputHatchesByLayer) {
+ int aHatchIndex = 0;
+ for (GT_MetaTileEntity_Hatch_Output hatch : layer) {
+ if (hatch.mFluid != null) {
+ PlayerUtils.messagePlayer(aPlayer, "Clearing "+hatch.mFluid.amount+"L of "+hatch.mFluid.getLocalizedName()+" from hatch "+aHatchIndex+" on layer "+aLayerIndex+".");
+ hatch.mFluid = null;
+ }
+ aHatchIndex++;
+ }
+ aLayerIndex++;
+ }
+ return aLayerIndex > 0;
+ }
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_AssemblyLine.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_AssemblyLine.java
new file mode 100644
index 0000000000..8c9e886e94
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_AssemblyLine.java
@@ -0,0 +1,629 @@
+/*
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.advanced;
+
+import java.util.ArrayList;
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.GT_Values;
+import gregtech.api.enums.ItemList;
+import gregtech.api.enums.TAE;
+import gregtech.api.enums.Textures;
+import gregtech.api.gui.GT_GUIContainer_MultiMachine;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_DataAccess;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.util.minecraft.LangUtils;
+import gtPlusPlus.core.util.minecraft.PlayerUtils;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Naquadah;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.FluidStack;
+
+public class GregtechMetaTileEntity_Adv_AssemblyLine
+ extends GregtechMeta_MultiBlockBase {
+
+ public ArrayList<GT_MetaTileEntity_Hatch_DataAccess> mDataAccessHatches = new ArrayList<GT_MetaTileEntity_Hatch_DataAccess>();
+
+ public static String[] mCasingName = new String[5];
+ private final int CASING_TEXTURE_ID = TAE.getIndexFromPage(0, 13);
+ private final int META_BaseCasing = 0; //4
+ private final int META_ContainmentCasing = 15; //3
+ private final int META_Shielding = 13; //1
+ private final int META_PipeCasing = 1; //4
+ private final int META_IntegralCasing = 6; //0
+ private final int META_ContainmentChamberCasing = 2; //4
+
+
+ public GregtechMetaTileEntity_Adv_AssemblyLine(int aID, String aName, String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ mCasingName[0] = LangUtils.getLocalizedNameOfBlock(getCasing(4), 0);
+ mCasingName[1] = LangUtils.getLocalizedNameOfBlock(getCasing(4), 1);
+ mCasingName[2] = LangUtils.getLocalizedNameOfBlock(getCasing(4), 2);
+ mCasingName[3] = LangUtils.getLocalizedNameOfBlock(getCasing(3), 15);
+ mCasingName[4] = LangUtils.getLocalizedNameOfBlock(getCasing(1), 13);
+ }
+
+ public GregtechMetaTileEntity_Adv_AssemblyLine(String aName) {
+ super(aName);
+ }
+
+ public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaTileEntity_Adv_AssemblyLine(this.mName);
+ }
+
+ public String[] getTooltip() {
+ if (mCasingName[0].toLowerCase().contains(".name")) {
+ mCasingName[0] = LangUtils.getLocalizedNameOfBlock(getCasing(4), 0);
+ }
+ if (mCasingName[1].toLowerCase().contains(".name")) {
+ mCasingName[1] = LangUtils.getLocalizedNameOfBlock(getCasing(4), 1);
+ }
+ if (mCasingName[2].toLowerCase().contains(".name")) {
+ mCasingName[2] = LangUtils.getLocalizedNameOfBlock(getCasing(4), 2);
+ }
+ if (mCasingName[3].toLowerCase().contains(".name")) {
+ mCasingName[3] = LangUtils.getLocalizedNameOfBlock(getCasing(3), 15);
+ }
+ if (mCasingName[4].toLowerCase().contains(".name")) {
+ mCasingName[4] = LangUtils.getLocalizedNameOfBlock(getCasing(1), 13);
+ }
+ return new String[]{
+ "Advanced Integrated Assembly Line"
+ };
+ }
+
+ private Block getCasing(int casingID) {
+ if (casingID == 1) {
+ return ModBlocks.blockCasingsMisc;
+ }
+ else if (casingID == 2) {
+ return ModBlocks.blockCasings2Misc;
+ }
+ else if (casingID == 3) {
+ return ModBlocks.blockCasings3Misc;
+ }
+ else if (casingID == 4) {
+ return ModBlocks.blockCasings4Misc;
+ }
+ else {
+ return ModBlocks.blockCasingsTieredGTPP;
+ }
+ }
+
+ public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
+ if (aSide == aFacing) {
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(16), new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_ASSEMBLY_LINE_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_ASSEMBLY_LINE)};
+ }
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(16)};
+ }
+
+ public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "AssemblyLine.png");
+ }
+
+ public GT_Recipe.GT_Recipe_Map getRecipeMap() {
+ return null;
+ }
+
+ public boolean isCorrectMachinePart(ItemStack aStack) {
+ return true;
+ }
+
+ public boolean isFacingValid(byte aFacing) {
+ return aFacing > 1;
+ }
+
+ public boolean checkRecipe(ItemStack aStack) {
+ if(GT_Values.D1)System.out.println("Start ALine recipe check");
+ ArrayList<ItemStack> tDataStickList = getDataItems(2);
+ if (tDataStickList.size() == 0) return false;
+ if(GT_Values.D1)System.out.println("Stick accepted, " + tDataStickList.size() + " Data Sticks found");
+
+ ItemStack tStack[] = new ItemStack[15];
+ FluidStack[] tFluids = new FluidStack[4];
+ boolean findRecipe = false;
+ nextDS:for (ItemStack tDataStick : tDataStickList){
+ NBTTagCompound tTag = tDataStick.getTagCompound();
+ if (tTag == null) continue;
+ for (int i = 0; i < 15; i++) {
+ int count = tTag.getInteger("a"+i);
+ if (!tTag.hasKey("" + i) && count <= 0) continue;
+ if (mInputBusses.get(i) == null) {
+ continue nextDS;
+ }
+
+ ItemStack stackInSlot = mInputBusses.get(i).getBaseMetaTileEntity().getStackInSlot(0);
+ boolean flag = true;
+ if (count > 0) {
+ for (int j = 0; j < count; j++) {
+ tStack[i] = GT_Utility.loadItem(tTag, "a" + i + ":" + j);
+ if (tStack[i] == null) continue;
+ if(GT_Values.D1)System.out.println("Item "+i+" : "+tStack[i].getUnlocalizedName());
+ if (GT_Utility.areStacksEqual(tStack[i], stackInSlot, true) && tStack[i].stackSize <= stackInSlot.stackSize) {
+ flag = false;
+ break;
+ }
+ }
+ }
+ if (flag) {
+ tStack[i] = GT_Utility.loadItem(tTag, "" + i);
+ if (tStack[i] == null) {
+ flag = false;
+ continue;
+ }
+ if(GT_Values.D1)System.out.println("Item "+i+" : "+tStack[i].getUnlocalizedName());
+ if (GT_Utility.areStacksEqual(tStack[i], stackInSlot, true) && tStack[i].stackSize <= stackInSlot.stackSize) {
+ flag = false;
+ }
+ }
+ if(GT_Values.D1) System.out.println(i + (flag ? " not accepted" : " accepted"));
+ if (flag) continue nextDS;
+ }
+
+ if(GT_Values.D1)System.out.println("All Items done, start fluid check");
+ for (int i = 0; i < 4; i++) {
+ if (!tTag.hasKey("f" + i)) continue;
+ tFluids[i] = GT_Utility.loadFluid(tTag, "f" + i);
+ if (tFluids[i] == null) continue;
+ if(GT_Values.D1)System.out.println("Fluid "+i+" "+tFluids[i].getUnlocalizedName());
+ if (mInputHatches.get(i) == null) {
+ continue nextDS;
+ }
+ FluidStack fluidInHatch = mInputHatches.get(i).mFluid;
+ if (fluidInHatch == null || !GT_Utility.areFluidsEqual(fluidInHatch, tFluids[i], true) || fluidInHatch.amount < tFluids[i].amount) {
+ if(GT_Values.D1)System.out.println(i+" not accepted");
+ continue nextDS;
+ }
+ if(GT_Values.D1)System.out.println(i+" accepted");
+ }
+
+ if(GT_Values.D1)System.out.println("Input accepted, check other values");
+ if (!tTag.hasKey("output")) continue;
+ mOutputItems = new ItemStack[]{GT_Utility.loadItem(tTag, "output")};
+ if (mOutputItems[0] == null || !GT_Utility.isStackValid(mOutputItems[0]))
+ continue;
+
+ if (!tTag.hasKey("time")) continue;
+ mMaxProgresstime = tTag.getInteger("time");
+ if (mMaxProgresstime <= 0) continue;
+
+ if (!tTag.hasKey("eu")) continue;
+ mEUt = tTag.getInteger("eu");
+
+ if(GT_Values.D1)System.out.println("Find avaiable recipe");
+ findRecipe = true;
+ break;
+ }
+ if (!findRecipe) return false;
+
+ if(GT_Values.D1)System.out.println("All checked start consuming inputs");
+ for (int i = 0; i < 15; i++) {
+ if (tStack[i] == null) continue;
+ ItemStack stackInSlot = mInputBusses.get(i).getBaseMetaTileEntity().getStackInSlot(0);
+ stackInSlot.stackSize -= tStack[i].stackSize;
+ }
+
+ for (int i = 0; i < 4; i++) {
+ if (tFluids[i] == null) continue;
+ mInputHatches.get(i).mFluid.amount -= tFluids[i].amount;
+ if (mInputHatches.get(i).mFluid.amount <= 0) {
+ mInputHatches.get(i).mFluid = null;
+ }
+ }
+ if(GT_Values.D1)System.out.println("Check overclock");
+
+ byte tTier = (byte) Math.max(1, GT_Utility.getTier(getMaxInputVoltage()));
+ this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
+ this.mEfficiencyIncrease = 10000;
+ if (mEUt <= 16) {
+ this.mEUt = (mEUt * (1 << tTier - 1) * (1 << tTier - 1));
+ this.mMaxProgresstime = (mMaxProgresstime / (1 << tTier - 1));
+ } else {
+ while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) {
+ this.mEUt *= 4;
+ this.mMaxProgresstime /= 2;
+ }
+ }
+ if (this.mEUt > 0) {
+ this.mEUt = -this.mEUt;
+ }
+ this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
+ updateSlots();
+ if(GT_Values.D1)System.out.println("Recipe sucessfull");
+ return true;
+ }
+
+ public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) {
+ super.startSoundLoop(aIndex, aX, aY, aZ);
+ if (aIndex == 20) {
+ GT_Utility.doSoundAtClient(GregTech_API.sSoundList.get(212), 10, 1.0F, aX, aY, aZ);
+ }
+ }
+
+ public boolean checkMultiblock(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 4;
+ int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * 4;
+
+ // Counts for all Casing Types
+ int aBaseCasingCount = 0;
+ int aContainmentCasingCount = 0;
+ int aShieldingCount = 0;
+ int aPipeCount = 0;
+ int aIntegralCasingCount = 0;
+ int aContainmentChamberCount = 0;
+
+ // Bottom Layer
+ aBaseCasingCount += checkEntireLayer(aBaseMetaTileEntity, getCasing(4), META_BaseCasing, -7, xDir, zDir);
+ log("Bottom Layer is Valid. Moving to Layer 1.");
+
+ // Layer 1
+ aShieldingCount += checkOuterRing(aBaseMetaTileEntity, getCasing(1), this.META_Shielding, -6, xDir, zDir);
+ aIntegralCasingCount += checkIntegralRing(aBaseMetaTileEntity, getCasing(0), this.META_IntegralCasing, -6, xDir, zDir);
+ aContainmentChamberCount += checkContainmentRing(aBaseMetaTileEntity, getCasing(4), this.META_ContainmentChamberCasing, -6, xDir, zDir);
+ log("Layer 1 is Valid. Moving to Layer 2.");
+
+ // Layer 2
+ aShieldingCount += checkOuterRing(aBaseMetaTileEntity, getCasing(1), this.META_Shielding, -5, xDir, zDir);
+ aPipeCount += checkPipes(aBaseMetaTileEntity, getCasing(4), this.META_PipeCasing, -5, xDir, zDir);
+ log("Layer 2 is Valid. Moving to Layer 3.");
+
+ // Layer 3
+ aContainmentCasingCount += checkOuterRing(aBaseMetaTileEntity, getCasing(3), this.META_ContainmentCasing, -4, xDir, zDir);
+ aPipeCount += checkPipes(aBaseMetaTileEntity, getCasing(4), this.META_PipeCasing, -4, xDir, zDir);
+ log("Layer 3 is Valid. Moving to Layer 4.");
+
+ // Layer 4
+ aContainmentCasingCount += checkOuterRing(aBaseMetaTileEntity, getCasing(3), this.META_ContainmentCasing, -3, xDir, zDir);
+ aPipeCount += checkPipes(aBaseMetaTileEntity, getCasing(4), this.META_PipeCasing, -3, xDir, zDir);
+ log("Layer 4 is Valid. Moving to Layer 5.");
+
+ // Layer 5
+ aShieldingCount += checkOuterRing(aBaseMetaTileEntity, getCasing(1), this.META_Shielding, -2, xDir, zDir);
+ aPipeCount += checkPipes(aBaseMetaTileEntity, getCasing(4), this.META_PipeCasing, -2, xDir, zDir);
+ log("Layer 5 is Valid. Moving to Layer 6.");
+
+ // Layer 6
+ aShieldingCount += checkOuterRing(aBaseMetaTileEntity, getCasing(1), this.META_Shielding, -1, xDir, zDir);
+ aIntegralCasingCount += checkIntegralRing(aBaseMetaTileEntity, getCasing(0), this.META_IntegralCasing, -1, xDir, zDir);
+ aContainmentChamberCount += checkContainmentRing(aBaseMetaTileEntity, getCasing(4), this.META_ContainmentChamberCasing, -1, xDir, zDir);
+ log("Layer 6 is Valid. Moving to Top Layer.");
+
+ // Top Layer
+ aBaseCasingCount += checkEntireLayer(aBaseMetaTileEntity, getCasing(4), META_BaseCasing, 0, xDir, zDir);
+
+ log("Found "+aBaseCasingCount+" "+mCasingName[0]+"s");
+ log("Found "+aShieldingCount+" "+mCasingName[4]+"s");
+ log("Found "+aPipeCount+" "+mCasingName[1]+"s");
+ log("Found "+aContainmentCasingCount+" "+mCasingName[3]+"s");
+ log("Found "+aIntegralCasingCount+" "+LangUtils.getLocalizedNameOfBlock(getCasing(0), 6)+"s");
+ log("Found "+aContainmentChamberCount+" "+mCasingName[2]+"s");
+
+ // Try mesage player
+ String aOwnerName = this.getBaseMetaTileEntity().getOwnerName();
+ EntityPlayer aOwner = null;
+ if (aOwnerName != null && aOwnerName.length() > 0) {
+ aOwner = PlayerUtils.getPlayer(aOwnerName);
+ }
+
+ if (aShieldingCount != 128) {
+ log("Not enough "+mCasingName[4]+"s, require 128.");
+ if (aOwner != null) {
+ PlayerUtils.messagePlayer(aOwner, "Not enough "+mCasingName[4]+"s, require 128.");
+ }
+ return false;
+ }
+ if (aPipeCount != 20) {
+ log("Not enough "+mCasingName[1]+"s, require 20.");
+ if (aOwner != null) {
+ PlayerUtils.messagePlayer(aOwner, "Not enough "+mCasingName[1]+"s, require 20.");
+ }
+ return false;
+ }
+ if (aContainmentCasingCount != 64) {
+ log("Not enough "+mCasingName[3]+"s, require 64.");
+ if (aOwner != null) {
+ PlayerUtils.messagePlayer(aOwner, "Not enough "+mCasingName[3]+"s, require 64.");
+ }
+ return false;
+ }
+ if (aContainmentChamberCount != 42) {
+ log("Not enough "+mCasingName[2]+"s, require 42.");
+ if (aOwner != null) {
+ PlayerUtils.messagePlayer(aOwner, "Not enough "+mCasingName[2]+"s, require 42.");
+ }
+ return false;
+ }
+ if (aBaseCasingCount < 140) {
+ log("Not enough "+mCasingName[0]+"s, require 140 at a minimum.");
+ if (aOwner != null) {
+ PlayerUtils.messagePlayer(aOwner, "Not enough "+mCasingName[0]+"s, require 140 at a minimum.");
+ }
+ return false;
+ }
+ if (aIntegralCasingCount != 48) {
+ log("Not enough "+LangUtils.getLocalizedNameOfBlock(getCasing(0), 6)+"s, require 48.");
+ if (aOwner != null) {
+ PlayerUtils.messagePlayer(aOwner, "Not enough "+LangUtils.getLocalizedNameOfBlock(getCasing(0), 6)+"s, require 48.");
+ }
+ return false;
+ }
+ log("LNR Formed.");
+ if (aOwner != null) {
+ PlayerUtils.messagePlayer(aOwner, "Large Naquadah Reactor has formed successfully.");
+ }
+ return true;
+ }
+
+ public boolean addNaquadahHatchToMachineInput(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null) {
+ return false;
+ }
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity == null) {
+ return false;
+ }
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_DataAccess) {
+ ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex);
+ return mDataAccessHatches.add((GT_MetaTileEntity_Hatch_DataAccess) aMetaTileEntity);
+ }
+ return false;
+ }
+
+ public int checkEntireLayer(IGregTechTileEntity aBaseMetaTileEntity, Block aBlock, int aMeta, int aY, int xDir, int zDir) {
+ int aCasingCount = 0;
+ for (int x = -4; x < 5; x++) {
+ for (int z = -4; z < 5; z++) {
+ int aOffsetX = this.getBaseMetaTileEntity().getXCoord() + x;
+ int aOffsetY = this.getBaseMetaTileEntity().getYCoord() + aY;
+ int aOffsetZ = this.getBaseMetaTileEntity().getZCoord() + z;
+ //Skip the corners
+ if ((x == 4 && z == 4) || (x == -4 && z == -4) || (x == 4 && z == -4) || (x == -4 && z == 4)) {
+ continue;
+ }
+ // Skip controller
+ if (aY == 0 && x == 0 && z == 0) {
+ continue;
+ }
+
+ Block aCurrentBlock = aBaseMetaTileEntity.getBlockOffset(xDir + x, aY, zDir + z);
+ int aCurrentMeta = (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + x, aY, zDir + z);
+ if (aCurrentBlock == aBlock && aCurrentMeta == aMeta) {
+ aCasingCount++;
+ }
+ final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + x, aY, zDir + z);
+ if (!isValidBlockForStructure(tTileEntity, CASING_TEXTURE_ID, true, aCurrentBlock, aCurrentMeta, aBlock, aMeta)) {
+ log("Layer has error. Height: "+aY);
+ //this.getBaseMetaTileEntity().getWorld().setBlock(aOffsetX, aOffsetY, aOffsetZ, aBlock, aMeta, 3);
+ return 0;
+ }
+ }
+ }
+ return aCasingCount;
+ }
+
+ public int checkOuterRing(IGregTechTileEntity aBaseMetaTileEntity, Block aBlock, int aMeta, int aY, int xDir, int zDir) {
+ int aCasingCount = 0;
+ for (int x = -4; x < 5; x++) {
+ for (int z = -4; z < 5; z++) {
+ int aOffsetX = this.getBaseMetaTileEntity().getXCoord() + x;
+ int aOffsetY = this.getBaseMetaTileEntity().getYCoord() + aY;
+ int aOffsetZ = this.getBaseMetaTileEntity().getZCoord() + z;
+ //Skip the corners
+ if ((x == 4 && z == 4) || (x == -4 && z == -4) || (x == 4 && z == -4) || (x == -4 && z == 4)) {
+ continue;
+ }
+
+ // If we are on the 5x5 ring, proceed
+ if ((x > -4 && x < 4 ) && (z > -4 && z < 4)) {
+ if ((x == 3 && z == 3) || (x == -3 && z == -3) || (x == 3 && z == -3) || (x == -3 && z == 3)) {
+ //this.getBaseMetaTileEntity().getWorld().setBlock(aOffsetX, aOffsetY, aOffsetZ, aBlock, aMeta, 3);
+ }
+ else {
+ continue;
+ }
+ }
+
+ Block aCurrentBlock = aBaseMetaTileEntity.getBlockOffset(xDir + x, aY, zDir + z);
+ int aCurrentMeta = (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + x, aY, zDir + z);
+ if (aCurrentBlock == aBlock && aCurrentMeta == aMeta) {
+ aCasingCount++;
+ }
+ final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + x, aY, zDir + z);
+ if (!isValidBlockForStructure(tTileEntity, CASING_TEXTURE_ID, false, aCurrentBlock, aCurrentMeta, aBlock, aMeta)) {
+ log("Layer has error. Height: "+aY);
+ //this.getBaseMetaTileEntity().getWorld().setBlock(aOffsetX, aOffsetY, aOffsetZ, aBlock, aMeta, 3);
+ return 0;
+ }
+ }
+ }
+ return aCasingCount;
+ }
+ public int checkIntegralRing(IGregTechTileEntity aBaseMetaTileEntity, Block aBlock, int aMeta, int aY, int xDir, int zDir) {
+ int aCasingCount = 0;
+ for (int x = -3; x < 4; x++) {
+ for (int z = -3; z < 4; z++) {
+ int aOffsetX = this.getBaseMetaTileEntity().getXCoord() + x;
+ int aOffsetY = this.getBaseMetaTileEntity().getYCoord() + aY;
+ int aOffsetZ = this.getBaseMetaTileEntity().getZCoord() + z;
+ //Skip the corners
+ if ((x == 3 && z == 3) || (x == -3 && z == -3) || (x == 3 && z == -3) || (x == -3 && z == 3)) {
+ continue;
+ }
+
+ // If we are on the 5x5 ring, proceed
+ if ((x > -3 && x < 3 ) && (z > -3 && z < 3)) {
+ if ((x == 2 && z == 2) || (x == -2 && z == -2) || (x == 2 && z == -2) || (x == -2 && z == 2)) {
+ //this.getBaseMetaTileEntity().getWorld().setBlock(aOffsetX, aOffsetY, aOffsetZ, aBlock, aMeta, 3);
+ }
+ else {
+ continue;
+ }
+ }
+
+ Block aCurrentBlock = aBaseMetaTileEntity.getBlockOffset(xDir + x, aY, zDir + z);
+ int aCurrentMeta = (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + x, aY, zDir + z);
+ if (aCurrentBlock == aBlock && aCurrentMeta == aMeta) {
+ aCasingCount++;
+ }
+ final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + x, aY, zDir + z);
+ if (!isValidBlockForStructure(tTileEntity, CASING_TEXTURE_ID, false, aCurrentBlock, aCurrentMeta, aBlock, aMeta)) {
+ log("Layer has error. Height: "+aY);
+ //this.getBaseMetaTileEntity().getWorld().setBlock(aOffsetX, aOffsetY, aOffsetZ, aBlock, aMeta, 3);
+ return 0;
+ }
+ }
+ }
+ return aCasingCount;
+ }
+
+ public int checkPipes(IGregTechTileEntity aBaseMetaTileEntity, Block aBlock, int aMeta, int aY, int xDir, int zDir) {
+ int aCasingCount = 0;
+ for (int x = -1; x < 2; x++) {
+ for (int z = -1; z < 2; z++) {
+ int aOffsetX = this.getBaseMetaTileEntity().getXCoord() + x;
+ int aOffsetY = this.getBaseMetaTileEntity().getYCoord() + aY;
+ int aOffsetZ = this.getBaseMetaTileEntity().getZCoord() + z;
+ //Skip the corners
+ if ((x == 1 && z == 1) || (x == -1 && z == -1) || (x == 1 && z == -1) || (x == -1 && z == 1) || (x == 0 && z == 0)) {
+ Block aCurrentBlock = aBaseMetaTileEntity.getBlockOffset(xDir + x, aY, zDir + z);
+ int aCurrentMeta = (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + x, aY, zDir + z);
+ if (aCurrentBlock == aBlock && aCurrentMeta == aMeta) {
+ aCasingCount++;
+ }
+ final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + x, aY, zDir + z);
+ if (!isValidBlockForStructure(tTileEntity, CASING_TEXTURE_ID, false, aCurrentBlock, aCurrentMeta, aBlock, aMeta)) {
+ log("Pipe has error. Height: "+aY);
+ //this.getBaseMetaTileEntity().getWorld().setBlock(aOffsetX, aOffsetY, aOffsetZ, aBlock, aMeta, 3);
+ return 0;
+ };
+ }
+ }
+ }
+ return aCasingCount;
+ }
+
+ public int checkContainmentRing(IGregTechTileEntity aBaseMetaTileEntity, Block aBlock, int aMeta, int aY, int xDir, int zDir) {
+ int aCasingCount = 0;
+ for (int x = -2; x < 3; x++) {
+ for (int z = -2; z < 3; z++) {
+ int aOffsetX = this.getBaseMetaTileEntity().getXCoord() + x;
+ int aOffsetY = this.getBaseMetaTileEntity().getYCoord() + aY;
+ int aOffsetZ = this.getBaseMetaTileEntity().getZCoord() + z;
+ //Skip the corners
+ if ((x == 2 && z == 2) || (x == -2 && z == -2) || (x == 2 && z == -2) || (x == -2 && z == 2)) {
+ continue;
+ }
+
+ Block aCurrentBlock = aBaseMetaTileEntity.getBlockOffset(xDir + x, aY, zDir + z);
+ int aCurrentMeta = (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + x, aY, zDir + z);
+ if (aCurrentBlock == aBlock && aCurrentMeta == aMeta) {
+ aCasingCount++;
+ }
+ final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + x, aY, zDir + z);
+ if (!isValidBlockForStructure(tTileEntity, CASING_TEXTURE_ID, false, aCurrentBlock, aCurrentMeta, aBlock, aMeta)) {
+ log("Layer has error. Height: "+aY);
+ //this.getBaseMetaTileEntity().getWorld().setBlock(aOffsetX, aOffsetY, aOffsetZ, aBlock, aMeta, 3);
+ return 0;
+ }
+ }
+ }
+ return aCasingCount;
+ }
+
+ */
+/**
+ * @param state using bitmask, 1 for IntegratedCircuit, 2 for DataStick, 4 for DataOrb
+ *//*
+
+ private boolean isCorrectDataItem(ItemStack aStack, int state){
+ if ((state & 1) != 0 && ItemList.Circuit_Integrated.isStackEqual(aStack, true, true)) return true;
+ if ((state & 2) != 0 && ItemList.Tool_DataStick.isStackEqual(aStack, false, true)) return true;
+ if ((state & 4) != 0 && ItemList.Tool_DataOrb.isStackEqual(aStack, false, true)) return true;
+ return false;
+ }
+
+ */
+/**
+ * @param state using bitmask, 1 for IntegratedCircuit, 2 for DataStick, 4 for DataOrb
+ *//*
+
+ public ArrayList<ItemStack> getDataItems(int state) {
+ ArrayList<ItemStack> rList = new ArrayList<ItemStack>();
+ if (GT_Utility.isStackValid(mInventory[1]) && isCorrectDataItem(mInventory[1], state)) {
+ rList.add(mInventory[1]);
+ }
+ for (GT_MetaTileEntity_Hatch_DataAccess tHatch : mDataAccessHatches) {
+ if (isValidMetaTileEntity(tHatch)) {
+ for (int i = 0; i < tHatch.getBaseMetaTileEntity().getSizeInventory(); i++) {
+ if (tHatch.getBaseMetaTileEntity().getStackInSlot(i) != null
+ && isCorrectDataItem(tHatch.getBaseMetaTileEntity().getStackInSlot(i), state))
+ rList.add(tHatch.getBaseMetaTileEntity().getStackInSlot(i));
+ }
+ }
+ }
+ return rList;
+ }
+
+ public boolean addDataAccessToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null) return false;
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity == null) return false;
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_DataAccess) {
+ ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex);
+ return mDataAccessHatches.add((GT_MetaTileEntity_Hatch_DataAccess) aMetaTileEntity);
+ }
+ return false;
+ }
+
+ public int getMaxEfficiency(ItemStack aStack) {
+ return 10000;
+ }
+
+ public int getPollutionPerTick(ItemStack aStack) {
+ return 0;
+ }
+
+ public int getDamageToComponent(ItemStack aStack) {
+ return 0;
+ }
+
+ public boolean explodesOnComponentBreak(ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public boolean hasSlotInGUI() {
+ return false;
+ }
+
+ @Override
+ public String getCustomGUIResourceName() {
+ return null;
+ }
+
+ @Override
+ public String getMachineType() {
+ return "Assembly Line";
+ }
+
+ @Override
+ public int getMaxParallelRecipes() {
+ return 0;
+ }
+
+ @Override
+ public int getEuDiscountForParallelism() {
+ return 0;
+ }
+}
+*/
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_DistillationTower.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_DistillationTower.java
new file mode 100644
index 0000000000..6d8ca49d7d
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_DistillationTower.java
@@ -0,0 +1,481 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.advanced;
+
+import com.gtnewhorizon.structurelib.alignment.IAlignmentLimits;
+import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
+import com.gtnewhorizon.structurelib.structure.StructureDefinition;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.Textures;
+import gregtech.api.gui.GT_GUIContainer_MultiMachine;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.implementations.*;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_ModHandler;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import gtPlusPlus.core.util.minecraft.PlayerUtils;
+import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraftforge.fluids.FluidStack;
+
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional;
+
+public class GregtechMetaTileEntity_Adv_DistillationTower extends GregtechMeta_MultiBlockBase {
+
+ private short mControllerY = 0;
+ private byte mMode = 0;
+ private boolean mUpgraded = false;
+ private IStructureDefinition<GregtechMetaTileEntity_Adv_DistillationTower> STRUCTURE_DEFINITION = null;
+
+ public GregtechMetaTileEntity_Adv_DistillationTower(int aID, String aName, String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ }
+
+ public GregtechMetaTileEntity_Adv_DistillationTower(String aName) {
+ super(aName);
+ }
+
+ public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaTileEntity_Adv_DistillationTower(this.mName);
+ }
+
+ @Override
+ public IStructureDefinition<GregtechMetaTileEntity_Adv_DistillationTower> getStructureDefinition() {
+ if (STRUCTURE_DEFINITION == null) {
+ STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_Adv_DistillationTower>builder()
+ .addShape(mName + "bottom", transpose(new String[][]{
+ {"I~I", "III", "III"}
+ }))
+ .addShape(mName + "mid", transpose(new String[][]{
+ {"CCC", "C-C", "CCC"}
+ }))
+ .addShape(mName + "top", transpose(new String[][]{
+ {"MMM", "MMM", "MMM"}
+ }))
+ .addElement(
+ 'I',
+ ofHatchAdderOptional(
+ GregtechMetaTileEntity_Adv_DistillationTower::addAdvDistillationTowerBottomList, getCasingTextureID(),
+ 1, GregTech_API.sBlockCasings4, 1
+ )
+ )
+ .addElement(
+ 'C',
+ ofHatchAdderOptional(
+ GregtechMetaTileEntity_Adv_DistillationTower::addAdvDistillationTowerMidList, getCasingTextureID(),
+ 2, GregTech_API.sBlockCasings4, 1
+ )
+ )
+ .addElement(
+ 'M',
+ ofHatchAdderOptional(
+ GregtechMetaTileEntity_Adv_DistillationTower::addAdvDistillationTowerTopList, getCasingTextureID(),
+ 3, GregTech_API.sBlockCasings4, 1
+ )
+ )
+ .build();
+ }
+ return STRUCTURE_DEFINITION;
+ }
+
+ public final boolean addAdvDistillationTowerBottomList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null) {
+ return false;
+ } else {
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ }
+ return false;
+ }
+
+ public final boolean addAdvDistillationTowerMidList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null) {
+ return false;
+ } else {
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ }
+ return false;
+ }
+
+ public final boolean addAdvDistillationTowerTopList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null) {
+ return false;
+ } else {
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ }
+ return false;
+ }
+
+ @Override
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
+ GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType(getMachineType())
+ .addInfo("Controller Block for the Advanced Distillation Tower")
+ .addInfo("T1 and T2 constructed identical to standard DT")
+ .addInfo("Right click the controller with screwdriver to change mode.")
+ .addInfo("Max parallel dictated by tower tier and mode")
+ .addInfo("DTower Mode: T1=4, T2=12")
+ .addInfo("Distilery Mode: Tower Tier * (4*InputTier)")
+ .addPollutionAmount(getPollutionPerSecond(null))
+ .addSeparator()
+ .addCasingInfo("Clean Stainless Steel Machine Casing", 7)
+ .addInputBus("Bottom Casing", 1)
+ .addOutputBus("Bottom Casing", 1)
+ .addInputHatch("Bottom Casing", 1)
+ .addMaintenanceHatch("Bottom Casing", 1)
+ .addEnergyHatch("Bottom Casing", 1)
+ .addOutputHatch("One per layer except bottom", 2)
+ .addMufflerHatch("Top Center Casing", 3)
+ .toolTipFinisher(CORE.GT_Tooltip_Builder);
+ return tt;
+ }
+
+ @Override
+ public void construct(ItemStack stackSize, boolean hintsOnly) {
+ int layer = Math.min(stackSize.stackSize + 2, 12);
+ buildPiece(mName + "bottom", stackSize, hintsOnly, 1, 0, 0);
+ for (int i = 1; i < layer - 1; i++) {
+ buildPiece(mName + "mid", stackSize, hintsOnly, 1, i, 0);
+ }
+ buildPiece(mName + "top", stackSize, hintsOnly, 1, layer - 1, 0);
+ }
+
+ @Override
+ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ if (!checkPiece(mName + "bottom", 1, 0, 0))
+ return false;
+ int layer = 1;
+ while (checkPiece(mName + "mid", 1, layer, 0)) {
+ if (layer != mOutputHatches.size()) return false;
+ layer ++;
+ }
+ if (layer > 12 || !checkPiece(mName + "top", 1, layer, 0))
+ return false;
+ return layer == mOutputHatches.size() && checkHatch();
+ }
+
+ public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName()+(mUpgraded ? " T2" : ""), "MultiblockDisplay.png");
+ }
+
+ public GT_Recipe.GT_Recipe_Map getRecipeMap() {
+ return mMode == 0 ? GT_Recipe.GT_Recipe_Map.sDistillationRecipes : GT_Recipe.GT_Recipe_Map.sDistilleryRecipes;
+ }
+
+ public boolean isCorrectMachinePart(ItemStack aStack) {
+ return true;
+ }
+
+ @Override
+ protected IAlignmentLimits getInitialAlignmentLimits() {
+ // don't rotate a freaking tower, it won't work
+ return (d, r, f) -> d.offsetY == 0 && r.isNotRotated() && !f.isVerticallyFliped();
+ }
+
+ public int getMaxEfficiency(ItemStack aStack) {
+ return 10000;
+ }
+
+ public int getPollutionPerSecond(ItemStack aStack) {
+ if (this.mMode == 1) return CORE.ConfigSwitches.pollutionPerSecondMultiAdvDistillationTower_ModeDistillery;
+ return CORE.ConfigSwitches.pollutionPerSecondMultiAdvDistillationTower_ModeDT;
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ aNBT.setByte("mMode", mMode);
+ aNBT.setInteger("mCasingTier", this.mCasingTier);
+ aNBT.setBoolean("mUpgraded", mUpgraded);
+ super.saveNBTData(aNBT);
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ mMode = aNBT.getByte("mMode");
+ mCasingTier = aNBT.getInteger("mCasingTier");
+ mUpgraded = aNBT.getBoolean("mUpgraded");
+ super.loadNBTData(aNBT);
+ }
+
+ @Override
+ public String getSound() {
+ return GregTech_API.sSoundList.get(Integer.valueOf(203));
+ }
+
+ @Override
+ public void startProcess() {
+ this.sendLoopStart((byte) 1);
+ }
+
+ @Override
+ public void onModeChangeByScrewdriver(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ mMode++;
+ if (mMode > 1){
+ mMode = 0;
+ PlayerUtils.messagePlayer(aPlayer, "Now running in Distillation Tower Mode.");
+ }
+ else {
+ PlayerUtils.messagePlayer(aPlayer, "Now running in Distillery Mode.");
+ }
+ }
+
+ public int getDamageToComponent(ItemStack aStack) {
+ return 0;
+ }
+
+ public boolean explodesOnComponentBreak(ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public boolean addOutput(FluidStack aLiquid) {
+ if (aLiquid == null) return false;
+ FluidStack tLiquid = aLiquid.copy();
+ for (GT_MetaTileEntity_Hatch_Output tHatch : mOutputHatches) {
+ if (isValidMetaTileEntity(tHatch) && GT_ModHandler.isSteam(aLiquid) ? tHatch.outputsSteam() : tHatch.outputsLiquids()) {
+ if (tHatch.getBaseMetaTileEntity().getYCoord() == this.mControllerY + 1) {
+ int tAmount = tHatch.fill(tLiquid, false);
+ if (tAmount >= tLiquid.amount) {
+ return tHatch.fill(tLiquid, true) >= tLiquid.amount;
+ } else if (tAmount > 0) {
+ tLiquid.amount = tLiquid.amount - tHatch.fill(tLiquid, true);
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ @Override
+ protected void addFluidOutputs(FluidStack[] mOutputFluids2) {
+ for (int i = 0; i < mOutputFluids2.length; i++) {
+ if (mOutputHatches.size() > i && mOutputHatches.get(i) != null && mOutputFluids2[i] != null && isValidMetaTileEntity(mOutputHatches.get(i))) {
+ if (mOutputHatches.get(i).getBaseMetaTileEntity().getYCoord() == this.mControllerY + 1 + i) {
+ mOutputHatches.get(i).fill(mOutputFluids2[i], true);
+ }
+ }
+ }
+
+ }
+
+ @Override
+ public boolean hasSlotInGUI() {
+ return true;
+ }
+
+ @Override
+ public boolean requiresVanillaGtGUI() {
+ return true;
+ }
+
+ @Override
+ public String getCustomGUIResourceName() {
+ return "DistillationTower";
+ }
+
+ @Override
+ public String getMachineType() {
+ return "Distillery, Distillation Tower";
+ }
+
+ @Override
+ public boolean checkRecipe(final ItemStack aStack) {
+ // Run standard recipe handling for distillery recipes
+ if (mMode == 1) {
+ return this.checkRecipeGeneric(getMaxParallelRecipes(), getEuDiscountForParallelism(), 100);
+ }
+ else {
+ for (GT_MetaTileEntity_Hatch_Input hatch : mInputHatches) {
+ FluidStack tFluid = hatch.getFluid();
+ if (tFluid != null) {
+ int para = (4* GT_Utility.getTier(this.getMaxInputVoltage()));
+ if (checkRecipeGeneric(null, new FluidStack[]{tFluid}, para,100, 250, 10000)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+ }
+
+ @Override
+ public int getMaxParallelRecipes() {
+ if (this.mMode == 0) {
+ return getTierOfTower() == 1 ? 4 : getTierOfTower() == 2 ? 12 : 0;
+ }
+ else if (this.mMode == 1) {
+ return getTierOfTower() * (4 * GT_Utility.getTier(this.getMaxInputVoltage()));
+ }
+ return 0;
+ }
+
+ @Override
+ public int getEuDiscountForParallelism() {
+ return 15;
+ }
+
+ private int getTierOfTower() {
+ return mUpgraded ? 2 : 1;
+ }
+
+ private int mCasingTier = 0;
+
+ private int getMachineCasingTier() {
+ return mCasingTier;
+ }
+
+ @Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+
+ ITexture aOriginalTexture;
+
+ // Check things exist client side (The worst code ever)
+ if (aBaseMetaTileEntity.getWorld() != null) {
+
+ }
+ // Check the Tier Client Side
+ int aTier = mCasingTier;
+
+ if (aTier == 0) {
+ aOriginalTexture = Textures.BlockIcons.getCasingTextureForId(49);
+ }
+ else if (aTier == 1) {
+ aOriginalTexture = Textures.BlockIcons.getCasingTextureForId(43);
+ }
+ else {
+ aOriginalTexture = Textures.BlockIcons.getCasingTextureForId(49);
+ }
+
+ if (aSide == aFacing) {
+ return new ITexture[]{aOriginalTexture, new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_DISTILLATION_TOWER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_DISTILLATION_TOWER)};
+ }
+ return new ITexture[]{aOriginalTexture};
+ }
+
+ private int getCasingTextureID() {
+ // Check the Tier Client Side
+ int aTier = mCasingTier;
+
+ if (aTier == 1) {
+ return 49;
+ }
+ else if (aTier == 2) {
+ return 43;
+ }
+ else {
+ return 49;
+ }
+ }
+
+ public boolean addToMachineList(IGregTechTileEntity aTileEntity) {
+ int aMaxTier = getMachineCasingTier();
+ final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_TieredMachineBlock) {
+ GT_MetaTileEntity_TieredMachineBlock aMachineBlock = (GT_MetaTileEntity_TieredMachineBlock) aMetaTileEntity;
+ int aTileTier = aMachineBlock.mTier;
+ if (aTileTier > aMaxTier) {
+ Logger.INFO("Hatch tier too high.");
+ return false;
+ }
+ else {
+ return addToMachineList(aTileEntity, getCasingTextureID());
+ }
+ }
+ else {
+ Logger.INFO("Bad Tile Entity being added to hatch map."); // Shouldn't ever happen, but.. ya know..
+ return false;
+ }
+ }
+
+ @Override
+ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ super.onPostTick(aBaseMetaTileEntity, aTick);
+ if (aTick % 20 == 0 && !mUpgraded) {
+ ItemStack aGuiStack = this.getGUIItemStack();
+ if (aGuiStack != null) {
+ if (GT_Utility.areStacksEqual(aGuiStack, GregtechItemList.Distillus_Upgrade_Chip.get(1))) {
+ this.mUpgraded = true;
+ ItemUtils.depleteStack(aGuiStack);
+ }
+ }
+ }
+ // Silly Client Syncing
+ if (aBaseMetaTileEntity.isClientSide()) {
+ this.mCasingTier = getCasingTierOnClientSide();
+ }
+ }
+
+
+
+ @SideOnly(Side.CLIENT)
+ private final int getCasingTierOnClientSide() {
+ if (this == null || this.getBaseMetaTileEntity().getWorld() == null) {
+ return 0;
+ }
+ try {
+ Block aInitStructureCheck;
+ int aInitStructureCheckMeta;
+ IGregTechTileEntity aBaseMetaTileEntity = this.getBaseMetaTileEntity();
+ if (aBaseMetaTileEntity == null || aBaseMetaTileEntity.getWorld() == null || aBaseMetaTileEntity.getWorld().getChunkFromBlockCoords(aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getZCoord()) == null) {
+ return 0;
+ }
+ for (int i=1;i<10;i++) {
+ aInitStructureCheck = aBaseMetaTileEntity.getBlockOffset(0, i, 0);
+ aInitStructureCheckMeta = aBaseMetaTileEntity.getMetaIDOffset(0, i, 0);
+ if (aInitStructureCheck == null) {
+ continue;
+ }
+ if (aInitStructureCheck == GregTech_API.sBlockCasings4 && aInitStructureCheckMeta == 1) {
+ return 0;
+ }
+ else if (aInitStructureCheck == ModBlocks.blockCasingsTieredGTPP) {
+ return 1;
+ }
+ }
+ }
+ catch (Throwable t) {
+ //t.printStackTrace();
+ }
+ return 0;
+
+ }
+
+ @Override
+ public void setItemNBT(NBTTagCompound aNBT) {
+ aNBT.setBoolean("mUpgraded", mUpgraded);
+ super.setItemNBT(aNBT);
+ }
+
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_EBF.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_EBF.java
new file mode 100644
index 0000000000..ce54aef282
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_EBF.java
@@ -0,0 +1,484 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.advanced;
+
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
+import static gregtech.api.util.GT_StructureUtility.ofCoil;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
+import static gtPlusPlus.core.util.data.ArrayUtils.removeNulls;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
+import com.gtnewhorizon.structurelib.structure.StructureDefinition;
+import gregtech.api.enums.HeatingCoilLevel;
+import gregtech.api.metatileentity.implementations.*;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GT_MetaTileEntity_Hatch_CustomFluidBase;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.ChatComponentTranslation;
+import org.apache.commons.lang3.ArrayUtils;
+
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.TAE;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.minecraft.FluidUtils;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.fluids.FluidStack;
+
+public class GregtechMetaTileEntity_Adv_EBF extends GregtechMeta_MultiBlockBase {
+
+ public static int CASING_TEXTURE_ID;
+ public static String mHotFuelName = "Blazing Pyrotheum";
+ public static String mCasingName = "Advanced Blast Furnace Casing";
+ public static String mHatchName = "Pyrotheum Hatch";
+ private IStructureDefinition<GregtechMetaTileEntity_Adv_EBF> STRUCTURE_DEFINITION = null;
+ private int mCasing;
+ private boolean mHaveHatch;
+
+ private HeatingCoilLevel mHeatingCapacity;
+ private boolean isBussesSeparate = false;
+
+ public GregtechMetaTileEntity_Adv_EBF(int aID, String aName, String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ CASING_TEXTURE_ID = TAE.getIndexFromPage(2, 11);
+ mHotFuelName = FluidUtils.getFluidStack("pyrotheum", 1).getLocalizedName();
+ mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings3Misc, 11);
+ mHatchName = ItemUtils.getLocalizedNameOfBlock(GregTech_API.sBlockMachines, 968);
+ }
+
+ public GregtechMetaTileEntity_Adv_EBF(String aName) {
+ super(aName);
+ CASING_TEXTURE_ID = TAE.getIndexFromPage(2, 11);
+ mHotFuelName = FluidUtils.getFluidStack("pyrotheum", 1).getLocalizedName();
+ mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings3Misc, 11);
+ mHatchName = ItemUtils.getLocalizedNameOfBlock(GregTech_API.sBlockMachines, 968);
+ }
+
+ @Override
+ public String getMachineType() {
+ return "Blast Furnace";
+ }
+
+ public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaTileEntity_Adv_EBF(this.mName);
+ }
+
+ @Override
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
+ if (mCasingName.toLowerCase().contains(".name")) {
+ mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings3Misc, 11);
+ }
+ if (mHotFuelName.toLowerCase().contains(".")) {
+ mHotFuelName = FluidUtils.getFluidStack("pyrotheum", 1).getLocalizedName();
+ }
+ if (mHatchName.toLowerCase().contains(".name")) {
+ mHatchName = ItemUtils.getLocalizedNameOfBlock(GregTech_API.sBlockMachines, 968);
+ }
+ GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType(getMachineType())
+ .addInfo("Factory Grade Advanced Blast Furnace")
+ .addInfo("Speed: 120% | Eu Usage: 90% | Parallel: 8")
+ .addInfo("Consumes 10L of " + mHotFuelName + " per second during operation")
+ .addInfo("Constructed exactly the same as a normal EBF")
+ .addPollutionAmount(getPollutionPerSecond(null))
+ .addSeparator()
+ .addController("Bottom center")
+ .addCasingInfo(mCasingName, 9)
+ .addInputHatch("Any Casing", 1)
+ .addInputBus("Any Casing", 1)
+ .addOutputBus("Any Casing", 1)
+ .addOutputHatch("Any Casing", 1)
+ .addStructureHint(mHatchName, 1)
+ .addEnergyHatch("Any Casing", 1)
+ .addMufflerHatch("Any Casing", 1)
+ .addMaintenanceHatch("Any Casing", 1)
+ .toolTipFinisher(CORE.GT_Tooltip_Builder);
+ return tt;
+ }
+
+ @Override
+ public IStructureDefinition<GregtechMetaTileEntity_Adv_EBF> getStructureDefinition() {
+ if (STRUCTURE_DEFINITION == null) {
+ STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_Adv_EBF>builder()
+ .addShape(mName, transpose(new String[][]{
+ {"CCC", "CCC", "CCC"},
+ {"HHH", "H-H", "HHH"},
+ {"HHH", "H-H", "HHH"},
+ {"C~C", "CCC", "CCC"},
+ }))
+ .addElement(
+ 'C',
+ ofChain(
+ ofHatchAdder(
+ GregtechMetaTileEntity_Adv_EBF::addAdvEBFList, CASING_TEXTURE_ID, 1
+ ),
+ onElementPass(
+ x -> ++x.mCasing,
+ ofBlock(
+ ModBlocks.blockCasings3Misc, 11
+ )
+ )
+ )
+ )
+ .addElement(
+ 'H',
+ ofCoil(
+ GregtechMetaTileEntity_Adv_EBF::setCoilLevel, GregtechMetaTileEntity_Adv_EBF::getCoilLevel
+ )
+ )
+ .build();
+ }
+ return STRUCTURE_DEFINITION;
+ }
+
+ @Override
+ public void construct(ItemStack stackSize, boolean hintsOnly) {
+ buildPiece(mName, stackSize, hintsOnly, 1, 3, 0);
+ }
+
+ @Override
+ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ mCasing = 0;
+ mHaveHatch = false;
+ setCoilLevel(HeatingCoilLevel.None);
+ return checkPiece(mName, 1, 3, 0) && mCasing >= 9 && mHaveHatch && getCoilLevel() != HeatingCoilLevel.None && checkHatch();
+ }
+
+ public final boolean addAdvEBFList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null) {
+ return false;
+ } else {
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_CustomFluidBase && aMetaTileEntity.getBaseMetaTileEntity().getMetaTileID() == 968) {
+ mHaveHatch = true;
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ }
+ return false;
+ }
+
+ public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex,
+ boolean aActive, boolean aRedstone) {
+ if (aSide == aFacing) {
+ return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(CASING_TEXTURE_ID),
+ new GT_RenderedTexture(aActive ? TexturesGtBlock.Overlay_Machine_Controller_Advanced_Active : TexturesGtBlock.Overlay_Machine_Controller_Advanced) };
+ }
+ return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(CASING_TEXTURE_ID) };
+ }
+
+ @Override
+ public boolean hasSlotInGUI() {
+ return true;
+ }
+
+ @Override
+ public boolean requiresVanillaGtGUI() {
+ return true;
+ }
+
+ @Override
+ public String getCustomGUIResourceName() {
+ return "ElectricBlastFurnace";
+ }
+
+ public GT_Recipe.GT_Recipe_Map getRecipeMap() {
+ return GT_Recipe.GT_Recipe_Map.sBlastRecipes;
+ }
+
+ public boolean isCorrectMachinePart(ItemStack aStack) {
+ return true;
+ }
+
+ @Override
+ public boolean checkRecipe(ItemStack aStack) {
+ if (isBussesSeparate) {
+ FluidStack[] tFluids = getStoredFluids().toArray(new FluidStack[0]);
+ for (GT_MetaTileEntity_Hatch_InputBus tBus : mInputBusses) {
+ ArrayList<ItemStack> tInputs = new ArrayList<>();
+ if (isValidMetaTileEntity(tBus)) {
+ for (int i = tBus.getBaseMetaTileEntity().getSizeInventory() - 1; i >= 0; i--) {
+ if (tBus.getBaseMetaTileEntity().getStackInSlot(i) != null) {
+ tInputs.add(tBus.getBaseMetaTileEntity().getStackInSlot(i));
+ }
+ }
+ }
+ if (tInputs.size() > 0) {
+ if (checkRecipeGeneric(tInputs.toArray(new ItemStack[0]), tFluids, 8, 90, 120, 10000)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ } else {
+ return checkRecipeGeneric(8, 90, 120);
+ }
+ }
+
+ public int getMaxEfficiency(ItemStack aStack) {
+ return 10000;
+ }
+
+ public int getPollutionPerSecond(ItemStack aStack) {
+ return CORE.ConfigSwitches.pollutionPerSecondMultiAdvEBF;
+ }
+
+ public int getDamageToComponent(ItemStack aStack) {
+ return 0;
+ }
+
+ public boolean explodesOnComponentBreak(ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public boolean checkRecipeGeneric(ItemStack[] aItemInputs, FluidStack[] aFluidInputs, int aMaxParallelRecipes,
+ int aEUPercent, int aSpeedBonusPercent, int aOutputChanceRoll) {
+ // Based on the Processing Array. A bit overkill, but very flexible.
+
+ // Reset outputs and progress stats
+ this.mEUt = 0;
+ this.mMaxProgresstime = 0;
+ this.mOutputItems = new ItemStack[] {};
+ this.mOutputFluids = new FluidStack[] {};
+
+ long tVoltage = getMaxInputVoltage();
+ byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage));
+ long tEnergy = getMaxInputEnergy();
+ Logger.WARNING("Running checkRecipeGeneric(0)");
+
+ GT_Recipe tRecipe = this.getRecipeMap().findRecipe(getBaseMetaTileEntity(), mLastRecipe, false,
+ gregtech.api.enums.GT_Values.V[tTier], aFluidInputs, aItemInputs);
+
+ Logger.WARNING("Running checkRecipeGeneric(1)");
+ // Remember last recipe - an optimization for findRecipe()
+ this.mLastRecipe = tRecipe;
+
+ if (tRecipe == null || this.mHeatingCapacity.getHeat() < tRecipe.mSpecialValue) {
+ Logger.WARNING("BAD RETURN - 1");
+ return false;
+ }
+
+ aMaxParallelRecipes = this.canBufferOutputs(tRecipe, aMaxParallelRecipes);
+ if (aMaxParallelRecipes == 0) {
+ Logger.WARNING("BAD RETURN - 2");
+ return false;
+ }
+
+ // EU discount
+ float tRecipeEUt = (tRecipe.mEUt * aEUPercent) / 100.0f;
+ int tHeatCapacityDivTiers = (int) (mHeatingCapacity.getHeat() - tRecipe.mSpecialValue) / 900;
+ if (tHeatCapacityDivTiers > 0)
+ tRecipeEUt = (int) (tRecipeEUt * (Math.pow(0.95, tHeatCapacityDivTiers)));
+ float tTotalEUt = 0.0f;
+
+ int parallelRecipes = 0;
+ // Count recipes to do in parallel, consuming input items and fluids and
+ // considering input voltage limits
+ for (; parallelRecipes < aMaxParallelRecipes && tTotalEUt < (tEnergy - tRecipeEUt); parallelRecipes++) {
+ if (!tRecipe.isRecipeInputEqual(true, aFluidInputs, aItemInputs)) {
+ Logger.WARNING("Broke at " + parallelRecipes + ".");
+ break;
+ }
+ Logger.WARNING("Bumped EU from " + tTotalEUt + " to " + (tTotalEUt + tRecipeEUt) + ".");
+ tTotalEUt += tRecipeEUt;
+ }
+
+ if (parallelRecipes == 0) {
+ Logger.WARNING("BAD RETURN - 3");
+ return false;
+ }
+
+ // -- Try not to fail after this point - inputs have already been consumed! --
+
+ // Convert speed bonus to duration multiplier
+ // e.g. 100% speed bonus = 200% speed = 100%/200% = 50% recipe duration.
+ aSpeedBonusPercent = Math.max(-99, aSpeedBonusPercent);
+ float tTimeFactor = 100.0f / (100.0f + aSpeedBonusPercent);
+ this.mMaxProgresstime = (int) (tRecipe.mDuration * tTimeFactor);
+ int tHalfHeatCapacityDivTiers = tHeatCapacityDivTiers / 2;
+
+ this.mEUt = (int) Math.ceil(tTotalEUt);
+
+ this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
+ this.mEfficiencyIncrease = 10000;
+
+ // Overclock
+ if (this.mEUt <= 16) {
+ this.mEUt = (this.mEUt * (1 << tTier - 1) * (1 << tTier - 1));
+ this.mMaxProgresstime = (this.mMaxProgresstime / (1 << tTier - 1));
+ } else {
+ while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) {
+ this.mEUt *= 4;
+ if (tHalfHeatCapacityDivTiers > 0) {
+ this.mMaxProgresstime = mMaxProgresstime / 4;
+ tHalfHeatCapacityDivTiers--;
+ } else {
+ this.mMaxProgresstime = mMaxProgresstime / 2;
+ }
+ if (this.mMaxProgresstime <= 1) {
+ break;
+ }
+ }
+ }
+ if (this.mEUt > 0) {
+ this.mEUt = (-this.mEUt);
+ }
+
+ this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
+
+ // Collect fluid outputs
+ FluidStack[] tOutputFluids = new FluidStack[tRecipe.mFluidOutputs.length];
+ for (int h = 0; h < tRecipe.mFluidOutputs.length; h++) {
+ if (tRecipe.getFluidOutput(h) != null) {
+ tOutputFluids[h] = tRecipe.getFluidOutput(h).copy();
+ tOutputFluids[h].amount *= parallelRecipes;
+ }
+ }
+
+ // Collect output item types
+ ItemStack[] tOutputItems = new ItemStack[tRecipe.mOutputs.length];
+ for (int h = 0; h < tRecipe.mOutputs.length; h++) {
+ if (tRecipe.getOutput(h) != null) {
+ tOutputItems[h] = tRecipe.getOutput(h).copy();
+ tOutputItems[h].stackSize = 0;
+ }
+ }
+
+ // Set output item stack sizes (taking output chance into account)
+ for (int f = 0; f < tOutputItems.length; f++) {
+ if (tRecipe.mOutputs[f] != null && tOutputItems[f] != null) {
+ for (int g = 0; g < parallelRecipes; g++) {
+ if (getBaseMetaTileEntity().getRandomNumber(aOutputChanceRoll) < tRecipe.getOutputChance(f))
+ tOutputItems[f].stackSize += tRecipe.mOutputs[f].stackSize;
+ }
+ }
+ }
+
+ tOutputItems = removeNulls(tOutputItems);
+
+ // Sanitize item stack size, splitting any stacks greater than max stack size
+ List<ItemStack> splitStacks = new ArrayList<ItemStack>();
+ for (ItemStack tItem : tOutputItems) {
+ while (tItem.getMaxStackSize() < tItem.stackSize) {
+ ItemStack tmp = tItem.copy();
+ tmp.stackSize = tmp.getMaxStackSize();
+ tItem.stackSize = tItem.stackSize - tItem.getMaxStackSize();
+ splitStacks.add(tmp);
+ }
+ }
+
+ if (splitStacks.size() > 0) {
+ ItemStack[] tmp = new ItemStack[splitStacks.size()];
+ tmp = splitStacks.toArray(tmp);
+ tOutputItems = ArrayUtils.addAll(tOutputItems, tmp);
+ }
+
+ // Strip empty stacks
+ List<ItemStack> tSList = new ArrayList<ItemStack>();
+ for (ItemStack tS : tOutputItems) {
+ if (tS.stackSize > 0)
+ tSList.add(tS);
+ }
+ tOutputItems = tSList.toArray(new ItemStack[tSList.size()]);
+
+ // Commit outputs
+ this.mOutputItems = tOutputItems;
+ this.mOutputFluids = tOutputFluids;
+ updateSlots();
+
+ // Play sounds (GT++ addition - GT multiblocks play no sounds)
+ startProcess();
+
+ Logger.WARNING("GOOD RETURN - 1");
+ return true;
+
+ }
+
+ private volatile int mGraceTimer = 2;
+
+ @Override
+ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ super.onPostTick(aBaseMetaTileEntity, aTick);
+ //Try dry Pyrotheum after all other logic
+ if (this.mStartUpCheck < 0) {
+ if (this.mMaxProgresstime > 0 && this.mProgresstime != 0 || this.getBaseMetaTileEntity().hasWorkJustBeenEnabled()) {
+ if (aTick % 10 == 0 || this.getBaseMetaTileEntity().hasWorkJustBeenEnabled()) {
+ if (!this.depleteInput(FluidUtils.getFluidStack("pyrotheum", 5))) {
+ if (mGraceTimer-- == 0) {
+ this.causeMaintenanceIssue();
+ this.stopMachine();
+ mGraceTimer = 2;
+ }
+ }
+ }
+ }
+ }
+
+ }
+
+ @Override
+ public int getMaxParallelRecipes() {
+ return 8;
+ }
+
+ @Override
+ public int getEuDiscountForParallelism() {
+ return 90;
+ }
+
+ @Override
+ public void onModeChangeByScrewdriver(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ isBussesSeparate = !isBussesSeparate;
+ aPlayer.addChatMessage(new ChatComponentTranslation(isBussesSeparate ? "interaction.separateBusses.enabled" : "interaction.separateBusses.disabled"));
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ aNBT.setBoolean("isBussesSeparate", isBussesSeparate);
+ super.saveNBTData(aNBT);
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ isBussesSeparate = aNBT.getBoolean("isBussesSeparate");
+ super.loadNBTData(aNBT);
+ }
+
+ public HeatingCoilLevel getCoilLevel() {
+ return mHeatingCapacity;
+ }
+
+ public void setCoilLevel(HeatingCoilLevel aCoilLevel) {
+ mHeatingCapacity = aCoilLevel;
+ }
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_Fusion_MK4.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_Fusion_MK4.java
new file mode 100644
index 0000000000..56206f8178
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_Fusion_MK4.java
@@ -0,0 +1,153 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.advanced;
+
+import gregtech.api.enums.Dyes;
+import gregtech.api.enums.TAE;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.IIconContainer;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.MetaTileEntity;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
+import gregtech.common.tileentities.machines.multi.GT_MetaTileEntity_FusionComputer;
+import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.reflect.ReflectionUtils;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import net.minecraft.block.Block;
+
+import java.lang.reflect.Method;
+
+public class GregtechMetaTileEntity_Adv_Fusion_MK4 extends GT_MetaTileEntity_FusionComputer {
+
+ public static final Method mUpdateHatchTexture;
+
+ static {
+ mUpdateHatchTexture = ReflectionUtils.getMethod(GT_MetaTileEntity_Hatch.class, "updateTexture", int.class);
+ }
+
+ public GregtechMetaTileEntity_Adv_Fusion_MK4(int aID, String aName, String aNameRegional) {
+ super(aID, aName, aNameRegional, 6);
+ }
+
+ public GregtechMetaTileEntity_Adv_Fusion_MK4(String aName) {
+ super(aName);
+ }
+
+ @Override
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
+ GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType("Fusion Reactor")
+ .addInfo("HARNESSING THE POWER OF A NEUTRON STAR")
+ .addSeparator()
+ .beginStructureBlock(15, 3, 15, false)
+ .addController("See diagram when placed")
+ .addCasingInfo("Fusion Machine Casings MK III", 79)
+ .addStructureInfo("Cover the coils with casing")
+ .addOtherStructurePart("Advanced Fusion Coils", "Center part of the ring")
+ .addEnergyHatch("1-16, Specified casings", 2)
+ .addInputHatch("2-16, Specified casings", 1)
+ .addOutputHatch("1-16, Specified casings", 3)
+ .addStructureInfo("ALL Hatches must be UHV or better")
+ .toolTipFinisher(CORE.GT_Tooltip_Builder);
+ return tt;
+ }
+
+ @Override
+ public int tier() {
+ return 9;
+ }
+
+ @Override
+ public long maxEUStore() {
+ return (640010000L * 4) * (Math.min(16, this.mEnergyHatches.size())) / 8L;
+ }
+
+ @Override
+ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaTileEntity_Adv_Fusion_MK4(mName);
+ }
+
+ @Override
+ public Block getCasing() {
+ return getFusionCoil();
+ }
+
+ @Override
+ public int getCasingMeta() {
+ return 12;
+ }
+
+ @Override
+ public Block getFusionCoil() {
+ return ModBlocks.blockCasings3Misc;
+ }
+
+ @Override
+ public int getFusionCoilMeta() {
+ return 13;
+ }
+
+ @Override
+ public int tierOverclock() {
+ return 8;
+ }
+
+ @Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing,
+ final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+ ITexture[] sTexture;
+ if (aSide == aFacing) {
+ sTexture = new ITexture[]{
+ new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS,
+ Dyes.getModulation(-1, Dyes._NULL.mRGBa)),
+ new GT_RenderedTexture(this.getIconOverlay())};
+ } else if (!aActive) {
+ sTexture = new ITexture[]{
+ new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS,
+ Dyes.getModulation(-1, Dyes._NULL.mRGBa))};
+ } else {
+ sTexture = new ITexture[]{
+ new GT_RenderedTexture(TexturesGtBlock.TEXTURE_CASING_FUSION_CASING_ULTRA,
+ Dyes.getModulation(-1, Dyes._NULL.mRGBa))};
+ }
+ return sTexture;
+ }
+
+ @Override
+ public ITexture getTextureOverlay() {
+ return new GT_RenderedTexture(this.mMaxProgresstime > 0 ? TexturesGtBlock.Casing_Machine_Screen_3 : TexturesGtBlock.Casing_Machine_Screen_1);
+ }
+
+ public IIconContainer getIconOverlay() {
+ return this.mMaxProgresstime > 0 ? TexturesGtBlock.Casing_Machine_Screen_3 : TexturesGtBlock.Casing_Machine_Screen_1;
+ }
+
+ public boolean turnCasingActive(final boolean status) {
+ try {
+ if (this.mEnergyHatches != null) {
+ for (final GT_MetaTileEntity_Hatch_Energy hatch : this.mEnergyHatches) {
+ mUpdateHatchTexture.invoke(hatch, (status ? TAE.getIndexFromPage(2, 14) : 53));
+ }
+ }
+ if (this.mOutputHatches != null) {
+ for (final GT_MetaTileEntity_Hatch_Output hatch2 : this.mOutputHatches) {
+ mUpdateHatchTexture.invoke(hatch2, (status ? TAE.getIndexFromPage(2, 14) : 53));
+ }
+ }
+ if (this.mInputHatches != null) {
+ for (final GT_MetaTileEntity_Hatch_Input hatch3 : this.mInputHatches) {
+ mUpdateHatchTexture.invoke(hatch3, (status ? TAE.getIndexFromPage(2, 14) : 53));
+ }
+ }
+ }
+ catch (Throwable t) {
+ return false;
+ }
+ return true;
+ }
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_Implosion.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_Implosion.java
new file mode 100644
index 0000000000..aff614184a
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_Implosion.java
@@ -0,0 +1,207 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.advanced;
+
+import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
+import com.gtnewhorizon.structurelib.structure.StructureDefinition;
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.ItemList;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.implementations.*;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import net.minecraft.item.ItemStack;
+
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
+import static gregtech.api.GregTech_API.sBlockCasings4;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
+
+public class GregtechMetaTileEntity_Adv_Implosion
+extends GregtechMeta_MultiBlockBase {
+
+ private String mCasingName;
+ private int mCasing;
+ private IStructureDefinition<GregtechMetaTileEntity_Adv_Implosion> STRUCTURE_DEFINITION = null;
+
+ public GregtechMetaTileEntity_Adv_Implosion(int aID, String aName, String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ mCasingName = ItemList.Casing_RobustTungstenSteel.get(1).getDisplayName();
+ }
+
+ public GregtechMetaTileEntity_Adv_Implosion(String aName) {
+ super(aName);
+ mCasingName = ItemList.Casing_RobustTungstenSteel.get(1).getDisplayName();
+ }
+
+ public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaTileEntity_Adv_Implosion(this.mName);
+ }
+
+ @Override
+ public String getMachineType() {
+ return "Implosion Compressor";
+ }
+
+ @Override
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
+ if (mCasingName.contains("gt.blockcasings")) {
+ mCasingName = ItemList.Casing_RobustTungstenSteel.get(1).getDisplayName();
+ }
+ GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType(getMachineType())
+ .addInfo("Factory Grade Advanced Implosion Compressor")
+ .addInfo("Speed: 100% | Eu Usage: 100% | Parallel: ((Tier/2)+1)")
+ .addInfo("Constructed exactly the same as a normal Implosion Compressor")
+ .addPollutionAmount(getPollutionPerSecond(null))
+ .addSeparator()
+ .beginStructureBlock(3, 3, 3, true)
+ .addController("Front center")
+ .addCasingInfo(mCasingName, 10)
+ .addInputBus("Any casing", 1)
+ .addOutputBus("Any casing", 1)
+ .addEnergyHatch("Any casing", 1)
+ .addMaintenanceHatch("Any casing", 1)
+ .addMufflerHatch("Any casing", 1)
+ .toolTipFinisher(CORE.GT_Tooltip_Builder);
+ return tt;
+ }
+
+ @Override
+ public IStructureDefinition<GregtechMetaTileEntity_Adv_Implosion> getStructureDefinition() {
+ if (STRUCTURE_DEFINITION == null) {
+ STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_Adv_Implosion>builder()
+ .addShape(mName, transpose(new String[][]{
+ {"CCC", "CCC", "CCC"},
+ {"C~C", "C-C", "CCC"},
+ {"CCC", "CCC", "CCC"},
+ }))
+ .addElement(
+ 'C',
+ ofChain(
+ ofHatchAdder(
+ GregtechMetaTileEntity_Adv_Implosion::addAdvImplosionList, 48, 1
+ ),
+ onElementPass(
+ x -> ++x.mCasing,
+ ofBlock(
+ sBlockCasings4, 0
+ )
+ )
+ )
+ )
+ .build();
+ }
+ return STRUCTURE_DEFINITION;
+ }
+
+ public final boolean addAdvImplosionList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null) {
+ return false;
+ } else {
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public void construct(ItemStack stackSize, boolean hintsOnly) {
+ buildPiece(mName, stackSize, hintsOnly, 1, 1, 0);
+ }
+
+ @Override
+ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ mCasing = 0;
+ return checkPiece(mName, 1, 1, 0) && mCasing >= 10 && checkHatch();
+ }
+
+ public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
+ if (aSide == aFacing) {
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(48), new GT_RenderedTexture(aActive ? TexturesGtBlock.Overlay_Machine_Controller_Advanced_Active : TexturesGtBlock.Overlay_Machine_Controller_Advanced)};
+ }
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(48)};
+ }
+
+ @Override
+ public boolean hasSlotInGUI() {
+ return true;
+ }
+
+ @Override
+ public String getCustomGUIResourceName() {
+ return "ImplosionCompressor";
+ }
+
+ @Override
+ public boolean requiresVanillaGtGUI() {
+ return true;
+ }
+
+ public GT_Recipe.GT_Recipe_Map getRecipeMap() {
+ return GT_Recipe.GT_Recipe_Map.sImplosionRecipes;
+ }
+
+ public boolean isCorrectMachinePart(ItemStack aStack) {
+ return true;
+ }
+
+ public boolean checkRecipe(final ItemStack aStack) {
+ return checkRecipeGeneric((GT_Utility.getTier(this.getMaxInputVoltage())/2+1), 100, 100);
+ }
+
+ public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) {
+ super.startSoundLoop(aIndex, aX, aY, aZ);
+ if (aIndex == 20) {
+ GT_Utility.doSoundAtClient((String) GregTech_API.sSoundList.get(Integer.valueOf(5)), 10, 1.0F, aX, aY, aZ);
+ }
+ }
+
+ @Override
+ public String getSound() {
+ return (String) GregTech_API.sSoundList.get(Integer.valueOf(5));
+ }
+
+ public int getMaxEfficiency(ItemStack aStack) {
+ return 10000;
+ }
+
+ public int getPollutionPerSecond(ItemStack aStack) {
+ return CORE.ConfigSwitches.pollutionPerSecondMultiAdvImplosion;
+ }
+
+ public int getDamageToComponent(ItemStack aStack) {
+ return 0;
+ }
+
+ public boolean explodesOnComponentBreak(ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public int getMaxParallelRecipes() {
+ return (GT_Utility.getTier(this.getMaxInputVoltage())/2+1);
+ }
+
+ @Override
+ public int getEuDiscountForParallelism() {
+ return 100;
+ }
+
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/steam/GregtechMetaTileEntity_SteamMacerator.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/steam/GregtechMetaTileEntity_SteamMacerator.java
new file mode 100644
index 0000000000..3191f56889
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/steam/GregtechMetaTileEntity_SteamMacerator.java
@@ -0,0 +1,165 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.steam;
+
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
+import static gregtech.api.GregTech_API.sBlockCasings1;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
+
+import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
+import com.gtnewhorizon.structurelib.structure.StructureDefinition;
+import gregtech.api.enums.ItemList;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.implementations.*;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
+import gregtech.api.util.GT_Recipe;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Steam_BusInput;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Steam_BusOutput;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GT_MetaTileEntity_Hatch_CustomFluidBase;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_SteamMultiBase;
+import net.minecraft.item.ItemStack;
+
+public class GregtechMetaTileEntity_SteamMacerator extends GregtechMeta_SteamMultiBase {
+
+ private String mCasingName = "Bronze Plated Bricks";
+ private IStructureDefinition<GregtechMetaTileEntity_SteamMacerator> STRUCTURE_DEFINITION = null;
+ private int mCasing;
+
+ public GregtechMetaTileEntity_SteamMacerator(String aName) {
+ super(aName);
+ }
+
+ public GregtechMetaTileEntity_SteamMacerator(int aID, String aName, String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(IGregTechTileEntity arg0) {
+ return new GregtechMetaTileEntity_SteamMacerator(this.mName);
+ }
+
+ @Override
+ protected GT_RenderedTexture getFrontOverlay() {
+ return new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_STEAM_MACERATOR);
+ }
+
+ @Override
+ protected GT_RenderedTexture getFrontOverlayActive() {
+ return new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_STEAM_MACERATOR_ACTIVE);
+ }
+
+ @Override
+ public String getMachineType() {
+ return "Macerator";
+ }
+
+ @Override
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
+ if (mCasingName.contains("gt.blockcasings")) {
+ mCasingName = ItemList.Casing_BronzePlatedBricks.get(1).getDisplayName();
+ }
+ GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType(getMachineType())
+ .addInfo("Controller Block for the Steam Macerator")
+ .addInfo("Macerates " + getMaxParallelRecipes() + " ores at a time")
+ .addSeparator()
+ .beginStructureBlock(3, 3, 3, true)
+ .addController("Front center")
+ .addCasingInfo(mCasingName, 14)
+ .addStructureHint("Input Bus (Steam)", 1)
+ .addStructureHint("Output Bus (Steam)", 1)
+ .addStructureHint("Steam Hatch", 1)
+ .toolTipFinisher(CORE.GT_Tooltip_Builder);
+ return tt;
+ }
+
+ @Override
+ public IStructureDefinition<GregtechMetaTileEntity_SteamMacerator> getStructureDefinition() {
+ if (STRUCTURE_DEFINITION == null) {
+ STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_SteamMacerator>builder()
+ .addShape(mName, transpose(new String[][]{
+ {"CCC", "CCC", "CCC"},
+ {"C~C", "C-C", "CCC"},
+ {"CCC", "CCC", "CCC"},
+ }))
+ .addElement(
+ 'C',
+ ofChain(
+ ofHatchAdder(
+ GregtechMetaTileEntity_SteamMacerator::addSteamMaceratorList, 10, 1
+ ),
+ onElementPass(
+ x -> ++x.mCasing,
+ ofBlock(
+ sBlockCasings1, 10
+ )
+ )
+ )
+ )
+ .build();
+ }
+ return STRUCTURE_DEFINITION;
+ }
+
+ public final boolean addSteamMaceratorList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null) {
+ return false;
+ } else {
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_CustomFluidBase && aMetaTileEntity.getBaseMetaTileEntity().getMetaTileID() == 31040){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Steam_BusInput){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Steam_BusOutput){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public void construct(ItemStack stackSize, boolean hintsOnly) {
+ buildPiece(mName, stackSize, hintsOnly, 1, 1, 0);
+ }
+
+ @Override
+ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ mCasing = 0;
+ fixAllMaintenanceIssue();
+ return checkPiece(mName, 1, 1, 0) && mCasing >= 14;
+ }
+
+ @Override
+ public int getMaxParallelRecipes() {
+ return 8;
+ }
+
+
+ public GT_Recipe.GT_Recipe_Map getRecipeMap() {
+ return GT_Recipe.GT_Recipe_Map.sMaceratorRecipes;
+ }
+
+ @Override
+ public ItemStack[] getOutputItems(GT_Recipe aRecipe) {
+ // Collect output item types
+ ItemStack[] tOutputItems = new ItemStack[1];
+ for (int h = 0; h < 1; h++) {
+ if (aRecipe.getOutput(h) != null) {
+ tOutputItems[h] = aRecipe.getOutput(h).copy();
+ tOutputItems[h].stackSize = 0;
+ }
+ }
+ return tOutputItems;
+ }
+
+ @Override
+ public int getOutputCount(ItemStack[] aOutputs) {
+ return 1;
+ }
+
+
+
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_AutoCrafter.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_AutoCrafter.java
new file mode 100644
index 0000000000..eae51e5c1d
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_AutoCrafter.java
@@ -0,0 +1,656 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production;
+
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+
+import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
+import com.gtnewhorizon.structurelib.structure.StructureDefinition;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.metatileentity.implementations.*;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.EnumChatFormatting;
+import gregtech.api.enums.TAE;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.MetaTileEntity;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
+import gregtech.api.util.GT_Utility;
+
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.minecraft.PlayerUtils;
+import gtPlusPlus.core.util.reflect.ReflectionUtils;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
+import gtPlusPlus.xmod.gregtech.common.helpers.CraftingHelper;
+import gtPlusPlus.xmod.gregtech.common.helpers.autocrafter.AC_Helper_Utils;
+import net.minecraftforge.fluids.FluidStack;
+
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
+
+public class GT4Entity_AutoCrafter extends GregtechMeta_MultiBlockBase {
+
+ private MODE mMachineMode = MODE.ASSEMBLY;
+ private byte mTier = 1;
+ protected GT_Recipe mLastRecipeToBuffer;
+ private int mCasing;
+ private IStructureDefinition<GT4Entity_AutoCrafter> STRUCTURE_DEFINITION = null;
+
+ /** The crafting matrix inventory (3x3). */
+ public CraftingHelper mInventoryCrafter;
+
+ public static enum MODE {
+ CRAFTING("CIRCUIT", "ASSEMBLY"), ASSEMBLY("CRAFTING", "DISASSEMBLY"), DISASSEMBLY("ASSEMBLY", "CIRCUIT"), CIRCUIT("DISASSEMBLY", "CRAFTING");
+
+ private final String lastMode;
+ private final String nextMode;
+
+ MODE(String previous, String next) {
+ this.lastMode = previous;
+ this.nextMode = next;
+ }
+
+ public MODE nextMode() {
+ return MODE.valueOf(this.nextMode);
+ }
+
+ public MODE lastMode() {
+ return MODE.valueOf(this.lastMode);
+ }
+
+ }
+
+ public void onRightclick(EntityPlayer aPlayer) {
+ }
+
+ public GT4Entity_AutoCrafter(int aID, String aName, String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ }
+
+ public GT4Entity_AutoCrafter(String mName) {
+ super(mName);
+ }
+
+ @Override
+ public String getMachineType() {
+ String sType = "Assembler, Disassembler, "+((CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK && !CORE.GTNH) ? "Circuit Assembler" : "");
+ return sType;
+ }
+
+ @Override
+ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT4Entity_AutoCrafter(this.mName);
+ }
+
+ @Override
+ public boolean isCorrectMachinePart(ItemStack aStack) {
+ return true;
+ }
+
+ @Override
+ public int getDamageToComponent(ItemStack aStack) {
+ return 0;
+ }
+
+ @Override
+ public boolean onRunningTick(ItemStack aStack) {
+ return super.onRunningTick(aStack);
+ //return true;
+ }
+
+ @Override
+ public boolean explodesOnComponentBreak(ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public int getMaxEfficiency(ItemStack aStack) {
+ return 10000;
+ }
+
+ @Override
+ public int getPollutionPerSecond(ItemStack aStack) {
+ return CORE.ConfigSwitches.pollutionPerSecondMultiAutoCrafter;
+ }
+
+ public int getAmountOfOutputs() {
+ return 1;
+ }
+
+ @Override
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
+ GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType(getMachineType())
+ .addInfo("Highly Advanced Autocrafter")
+ .addInfo("Right Click with a Screwdriver to change mode")
+ .addInfo("200% faster than using single block machines of the same voltage")
+ .addInfo("Processes two items per voltage tier")
+ .addPollutionAmount(getPollutionPerSecond(null))
+ .addSeparator()
+ .beginStructureBlock(3, 3, 3, true)
+ .addController("Front Center")
+ .addCasingInfo("Autocrafter Frame", 10)
+ .addInputBus("Any Casing", 1)
+ .addOutputBus("Any Casing", 1)
+ .addInputHatch("Any Casing", 1)
+ .addEnergyHatch("Any Casing", 1)
+ .addMaintenanceHatch("Any Casing", 1)
+ .addMufflerHatch("Any Casing", 1)
+ .toolTipFinisher(CORE.GT_Tooltip_Builder);
+ return tt;
+ }
+
+ @Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing,
+ final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+ if (aSide == aFacing) {
+ return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(TAE.getIndexFromPage(0, 10)),
+ new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_DISASSEMBLER_ACTIVE
+ : Textures.BlockIcons.OVERLAY_FRONT_DISASSEMBLER) };
+ }
+ return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(TAE.getIndexFromPage(0, 10)) };
+ }
+
+ @Override
+ public IStructureDefinition<GT4Entity_AutoCrafter> getStructureDefinition() {
+ if (STRUCTURE_DEFINITION == null) {
+ STRUCTURE_DEFINITION = StructureDefinition.<GT4Entity_AutoCrafter>builder()
+ .addShape(mName, transpose(new String[][]{
+ {"CCC", "CCC", "CCC"},
+ {"C~C", "C-C", "CCC"},
+ {"CCC", "CCC", "CCC"},
+ }))
+ .addElement(
+ 'C',
+ ofChain(
+ ofHatchAdder(
+ GT4Entity_AutoCrafter::addAutoCrafterList, TAE.getIndexFromPage(0, 10), 1
+ ),
+ onElementPass(
+ x -> ++x.mCasing,
+ ofBlock(
+ ModBlocks.blockCasings2Misc, 12
+ )
+ )
+ )
+ )
+ .build();
+ }
+ return STRUCTURE_DEFINITION;
+ }
+
+ @Override
+ public void construct(ItemStack stackSize, boolean hintsOnly) {
+ buildPiece(mName , stackSize, hintsOnly, 1, 1, 0);
+ }
+
+ @Override
+ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ mCasing = 0;
+ if (checkPiece(mName, 1, 1, 0) && mCasing >= 10 && checkHatch()) {
+ setTier();
+ return true;
+ } else return false;
+ }
+
+ public final boolean addAutoCrafterList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null) {
+ return false;
+ } else {
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ }
+ return false;
+ }
+
+ private static GT_Recipe_Map fCircuitMap;
+
+ @Override
+ public GT_Recipe.GT_Recipe_Map getRecipeMap() {
+ if (this.mMachineMode == MODE.ASSEMBLY) {
+ return GT_Recipe.GT_Recipe_Map.sAssemblerRecipes;
+ }
+ else if (this.mMachineMode == MODE.CIRCUIT && !CORE.GTNH) {
+ if (fCircuitMap != null) {
+ return fCircuitMap;
+ }
+ GT_Recipe_Map r;
+ try {
+ Field f = ReflectionUtils.getField(GT_Recipe.GT_Recipe_Map.class, "sCircuitAssemblerRecipes");
+ if (f != null) {
+ r = (GT_Recipe_Map) f.get(null);
+ if (r != null) {
+ fCircuitMap = r;
+ return r;
+ }
+ }
+ } catch (IllegalArgumentException | IllegalAccessException e) {
+ }
+ }
+ else if (this.mMachineMode == MODE.DISASSEMBLY || this.mMachineMode == MODE.CRAFTING) {
+ return null;
+ }
+ return GT_Recipe.GT_Recipe_Map.sAssemblerRecipes;
+ }
+
+ private boolean isModernGT = true;
+
+ @Override
+ public void onModeChangeByScrewdriver(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ if (isModernGT && !CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK) {
+ isModernGT = false;
+ }
+ //5.09 support
+ if (isModernGT && !CORE.GTNH) {
+ mMachineMode = mMachineMode.nextMode();
+ if (mMachineMode == MODE.CRAFTING) {
+ PlayerUtils.messagePlayer(aPlayer, "Running the Auto-Crafter in mode: "+EnumChatFormatting.AQUA+"AutoCrafting");
+ } else if (mMachineMode == MODE.ASSEMBLY) {
+ PlayerUtils.messagePlayer(aPlayer, "Running the Auto-Crafter in mode: "+EnumChatFormatting.GREEN+"Assembly");
+ } else if (mMachineMode == MODE.DISASSEMBLY) {
+ PlayerUtils.messagePlayer(aPlayer, "Running the Auto-Crafter in mode: "+EnumChatFormatting.RED+"Disassembly");
+ } else {
+ PlayerUtils.messagePlayer(aPlayer, "Running the Auto-Crafter in mode: "+EnumChatFormatting.YELLOW+"Circuit Assembly");
+ }
+ }
+ //5.08 support
+ else {
+ if (mMachineMode.nextMode() == MODE.CIRCUIT) {
+ mMachineMode = MODE.ASSEMBLY;
+ }
+ else if (mMachineMode.nextMode() == MODE.CRAFTING) {
+ mMachineMode = MODE.ASSEMBLY;
+ }
+ else {
+ mMachineMode = mMachineMode.nextMode();
+ }
+
+ if (mMachineMode == MODE.CRAFTING) {
+ PlayerUtils.messagePlayer(aPlayer, "You are now running the Auto-Crafter in mode: "+EnumChatFormatting.AQUA+"AutoCrafting");
+ } else if (mMachineMode == MODE.ASSEMBLY) {
+ PlayerUtils.messagePlayer(aPlayer, "You are now running the Auto-Crafter in mode: "+EnumChatFormatting.GREEN+"Assembly");
+ } else {
+ PlayerUtils.messagePlayer(aPlayer, "You are now running the Auto-Crafter in mode: "+EnumChatFormatting.RED+"Disassembly");
+ }
+ }
+ }
+
+// @Override
+// public boolean checkRecipe(final ItemStack aStack) {
+//
+// final long tVoltage = this.getMaxInputVoltage();
+// final byte tTier = this.mTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage));
+//
+// if (mMachineMode == MODE.DISASSEMBLY) {
+// return doDisassembly();
+// } else if (mMachineMode == MODE.CRAFTING) {
+// return doCrafting(aStack);
+// } else {
+// return super.checkRecipeGeneric(getMaxParallelRecipes(), 100, 200);
+// }
+// }
+
+ private void setTier() {
+ long tVoltage = getMaxInputVoltage();
+ this.mTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage));
+ }
+
+ @Override
+ public boolean checkRecipe(final ItemStack aStack) {
+ if (mMachineMode == MODE.DISASSEMBLY) {
+ return doDisassembly();
+ } else if (mMachineMode == MODE.CRAFTING) {
+ return doCrafting(aStack);
+ } else {
+ ArrayList<FluidStack> tFluids = getStoredFluids();
+ //Logger.MACHINE_INFO("1");
+ for (GT_MetaTileEntity_Hatch_InputBus tBus : mInputBusses) {
+ ArrayList<ItemStack> tBusItems = new ArrayList<ItemStack>();
+ //Logger.MACHINE_INFO("2");
+ if (isValidMetaTileEntity(tBus)) {
+ //Logger.MACHINE_INFO("3");
+ for (int i = tBus.getBaseMetaTileEntity().getSizeInventory() - 1; i >= 0; i--) {
+ if (tBus.getBaseMetaTileEntity().getStackInSlot(i) != null)
+ tBusItems.add(tBus.getBaseMetaTileEntity().getStackInSlot(i));
+ }
+ }
+
+ Object[] tempArray = tFluids.toArray(new FluidStack[] {});
+ FluidStack[] properArray;
+ properArray = ((tempArray != null && tempArray.length > 0) ? (FluidStack[]) tempArray : new FluidStack[] {});
+
+ //Logger.MACHINE_INFO("4");
+ if (checkRecipeGeneric(tBusItems.toArray(new ItemStack[]{}), properArray,
+ getMaxParallelRecipes(), 100, 200, 10000)) return true;
+ }
+ return false;
+ }
+ }
+
+ @Override
+ public int getMaxParallelRecipes() {
+ return 2 * (Math.max(1, GT_Utility.getTier(getMaxInputVoltage())));
+ }
+
+ @Override
+ public int getEuDiscountForParallelism() {
+ return 100;
+ }
+
+ public boolean doDisassembly() {
+
+ final ArrayList<ItemStack> tInputList = this.getStoredInputs();
+ for (int tInputList_sS = tInputList.size(), i = 0; i < tInputList_sS - 1; ++i) {
+ for (int j = i + 1; j < tInputList_sS; ++j) {
+ if (GT_Utility.areStacksEqual(tInputList.get(i), tInputList.get(j))) {
+ if (tInputList.get(i).stackSize < tInputList.get(j).stackSize) {
+ tInputList.remove(i--);
+ tInputList_sS = tInputList.size();
+ break;
+ }
+ tInputList.remove(j--);
+ tInputList_sS = tInputList.size();
+ }
+ }
+ }
+ final ItemStack[] tInputs = tInputList.toArray(new ItemStack[tInputList.size()]);
+
+ ItemStack inputItem = tInputs[0];
+ if (tInputs[0].stackSize <= 0) {
+ tInputs[0] = null;
+ this.updateSlots();
+ }
+ int outputSlots = this.mOutputBusses.get(0).getSizeInventory();
+
+ if (this.mOutputBusses.size() > 1) {
+ outputSlots = 0;
+ for (GT_MetaTileEntity_Hatch_OutputBus r : this.mOutputBusses) {
+ outputSlots += r.getSizeInventory();
+ }
+ }
+
+ this.mOutputItems = new ItemStack[outputSlots];
+ if (inputItem != null && inputItem.stackSize > 0) {
+ NBTTagCompound tNBT = inputItem.getTagCompound();
+ if (tNBT != null) {
+ tNBT = tNBT.getCompoundTag("GT.CraftingComponents");
+ if (tNBT != null) {
+ this.mEUt = 16 * (1 << this.mTier - 1) * (1 << this.mTier - 1);
+ this.mMaxProgresstime = (100 - (8 * this.mTier));
+ for (int i = 0; i < this.mOutputItems.length; ++i) {
+ if (this.getBaseMetaTileEntity().getRandomNumber(100) < 60 + 12 * this.mTier) {
+ this.mOutputItems[i] = GT_Utility.loadItem(tNBT, "Ingredient." + i);
+ if (this.mOutputItems[i] != null) {
+ this.mMaxProgresstime *= (int) 1.5;
+ }
+ }
+ }
+
+ if (this.mTier > 5) {
+ this.mMaxProgresstime >>= this.mTier - 5;
+ }
+ if (this.mEUt > 0)
+ this.mEUt = (-this.mEUt);
+ this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
+ this.mEfficiencyIncrease = 10000;
+ inputItem.stackSize--;
+ if (inputItem.stackSize <= 0) {
+ tInputs[0] = null;
+ }
+ this.updateSlots();
+ return true;
+
+ }
+ }
+ }
+ return false;
+ }
+
+ private boolean doesCrafterHave9SlotInput() {
+ GT_MetaTileEntity_Hatch_InputBus craftingInput = null;
+ if (!this.mInputBusses.isEmpty()) {
+ for (GT_MetaTileEntity_Hatch_InputBus x : this.mInputBusses) {
+ if (x.mInventory.length == 9) {
+ craftingInput = x;
+ }
+ }
+ }
+ // Return if no input hatch set.
+ if (craftingInput == null) {
+ Logger.WARNING("Cannot do Auto-Crafting without a 9-slot Input Bus [MV].");
+ return false;
+
+ } else {
+ return true;
+ }
+ }
+
+ private boolean doCrafting(ItemStack aStack) {
+ this.mMaxProgresstime = 0;
+ return false; // do nothing
+ /*
+ try {
+ // Set Crafting input hatch
+ if (!doesCrafterHave9SlotInput()) {
+ return false;
+ }
+
+ // Read stored data from encrypted data stick.
+ ItemStack storedData_Output[] = NBTUtils.readItemsFromNBT(aStack, "Output");
+ ItemStack storedData_Input[] = NBTUtils.readItemsFromNBT(aStack);
+ if (storedData_Output != null && storedData_Input != null) {
+ ItemStack loadedData[] = new ItemStack[9];
+ if (storedData_Input.length >= 1) {
+ int number = 0;
+ for (ItemStack a : storedData_Input) {
+ if (a.getItem() == ModItems.ZZZ_Empty) {
+ // Utils.LOG_WARNING("Allocating free memory into crafting manager slot
+ // "+number+".");
+ loadedData[number] = null;
+ } else {
+ // Utils.LOG_WARNING("Downloading "+a.getDisplayName()+" into crafting manager
+ // slot "+number+".");
+ loadedData[number] = a;
+ }
+ number++;
+ }
+ }
+
+ // Remove inputs here
+ ArrayList<ItemStack> mInputArray = new ArrayList<ItemStack>();
+ ItemStack allInputs[];
+
+ for (GT_MetaTileEntity_Hatch_InputBus x : this.mInputBusses) {
+ if (x.mInventory.length > 0) {
+ for (ItemStack r : x.mInventory) {
+ if (r != null) {
+ mInputArray.add(r);
+ }
+ }
+ }
+ }
+
+ if (mInputArray.isEmpty()) {
+ return false;
+ } else {
+ List<ItemStack> list = mInputArray;
+ allInputs = list.toArray(new ItemStack[list.size()]);
+
+ if (allInputs != null && allInputs.length > 0) {
+
+ this.mEUt = 8 * (1 << this.mTier - 1) * (1 << this.mTier - 1);
+ this.mMaxProgresstime = MathUtils.roundToClosestInt((50 - (5
+ * MathUtils.randDouble(((this.mTier - 2) <= 0 ? 1 : (this.mTier - 2)), this.mTier))));
+
+ Logger.WARNING("MPT: " + mMaxProgresstime + " | " + mEUt);
+ this.getBaseMetaTileEntity().setActive(true);
+
+ // Setup some vars
+ int counter = 0;
+
+ ItemStack toUse[] = new ItemStack[9];
+
+ outerloop: for (ItemStack inputItem : loadedData) {
+ if (inputItem == null) {
+ toUse[counter] = null;
+ continue outerloop;
+ }
+ for (ItemStack r : allInputs) {
+ if (r != null) {
+ // Utils.LOG_WARNING("Input Bus Inventory Iteration - Found:"
+ // +r.getDisplayName()+" | "+allInputs.length);
+ if (GT_Utility.areStacksEqual(r, inputItem)) {
+ if (this.getBaseMetaTileEntity().isServerSide()) {
+ toUse[counter] = inputItem;
+ counter++;
+ continue outerloop;
+ }
+
+ }
+ }
+ }
+ counter++;
+ }
+
+ int mCorrectInputs = 0;
+ for (ItemStack isValid : toUse) {
+ if (isValid == null || this.depleteInput(isValid)) {
+ mCorrectInputs++;
+ } else {
+ Logger.WARNING("Input in Slot " + mCorrectInputs + " was not valid.");
+ }
+ }
+
+ if (this.mTier > 5) {
+ this.mMaxProgresstime >>= this.mTier - 5;
+ }
+ if (this.mEUt > 0)
+ this.mEUt = (-this.mEUt);
+ this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
+ this.mEfficiencyIncrease = 10000;
+
+ if (mCorrectInputs == 9) {
+ ItemStack mOutputItem = storedData_Output[0];
+ NBTUtils.writeItemsToGtCraftingComponents(mOutputItem, loadedData, true);
+ this.addOutput(mOutputItem);
+ this.updateSlots();
+ return true;
+ } else {
+ return false;
+ }
+
+ }
+ }
+ }
+ }
+ // End Debug
+ catch (Throwable t) {
+ t.printStackTrace();
+ this.mMaxProgresstime = 0;
+ }
+
+ this.mMaxProgresstime = 0;
+ return false;
+ */
+ }
+
+ @Override
+ public String[] getExtraInfoData() {
+ final String tRunning = (this.mMaxProgresstime > 0 ? "Auto-Crafter running" : "Auto-Crafter stopped");
+ final String tMaintainance = (this.getIdealStatus() == this.getRepairStatus() ? "No Maintainance issues"
+ : "Needs Maintainance");
+ String tSpecialText = "" + (60 + 12 * this.mTier) + "% chance to recover disassembled parts.";
+ String tMode;
+ if (mMachineMode == MODE.DISASSEMBLY) {
+ tMode = "§cDisassembly";
+ tSpecialText = "" + (60 + 12 * this.mTier) + "% chance to recover disassembled parts.";
+ } else if (mMachineMode == MODE.ASSEMBLY || mMachineMode == MODE.CIRCUIT) {
+ tMode = mMachineMode == MODE.ASSEMBLY ? "§aAssembly" : "§eCircuit Assembly";
+ if (mLastRecipeToBuffer != null && mLastRecipeToBuffer.mOutputs[0].getDisplayName() != null) {
+ tSpecialText = "Currently processing: " + mLastRecipeToBuffer.mOutputs[0].getDisplayName();
+ } else {
+ tSpecialText = "Currently processing: Nothing";
+ }
+ } else {
+ tMode = "§dAuto-Crafting";
+ tSpecialText = "Does Auto-Crafter have 9-slot input bus? " + doesCrafterHave9SlotInput();
+ }
+
+ return new String[] { "Large Scale Auto-Asesembler v1.01c", tRunning, tMaintainance, "Mode: " + tMode,
+ tSpecialText };
+ }
+
+ private String getMode() {
+ return this.mMachineMode.name();
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ String mMode = getMode();
+ aNBT.setString("mMode", mMode);
+ super.saveNBTData(aNBT);
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ String modeString = aNBT.getString("mMode");
+ MODE newMode = MODE.valueOf(modeString);
+ this.mMachineMode = newMode;
+ super.loadNBTData(aNBT);
+ }
+
+ @Override
+ public void explodeMultiblock() {
+ AC_Helper_Utils.removeCrafter(this);
+ super.explodeMultiblock();
+ }
+
+ @Override
+ public void onExplosion() {
+ AC_Helper_Utils.removeCrafter(this);
+ super.onExplosion();
+ }
+
+ @Override
+ public void onRemoval() {
+ AC_Helper_Utils.removeCrafter(this);
+ super.onRemoval();
+ }
+
+ @Override
+ public void doExplosion(long aExplosionPower) {
+ AC_Helper_Utils.removeCrafter(this);
+ super.doExplosion(aExplosionPower);
+ }
+
+ @Override
+ public boolean hasSlotInGUI() {
+ return true;
+ }
+
+ @Override
+ public String getCustomGUIResourceName() {
+ return "Generic3By3";
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_ThermalBoiler.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_ThermalBoiler.java
new file mode 100644
index 0000000000..65474d38ed
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_ThermalBoiler.java
@@ -0,0 +1,354 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production;
+
+import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
+import com.gtnewhorizon.structurelib.structure.StructureDefinition;
+import gregtech.api.enums.ItemList;
+import gregtech.api.enums.Materials;
+import gregtech.api.enums.TAE;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.MetaTileEntity;
+import gregtech.api.metatileentity.implementations.*;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.*;
+import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.item.general.ItemLavaFilter;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.fluids.FluidStack;
+
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
+
+public class GT4Entity_ThermalBoiler
+extends GregtechMeta_MultiBlockBase
+{
+ private int mCasing;
+ private IStructureDefinition<GT4Entity_ThermalBoiler> STRUCTURE_DEFINITION = null;
+ private int mSuperEfficencyIncrease = 0;
+
+ public void onRightclick(EntityPlayer aPlayer)
+ {
+ getBaseMetaTileEntity().openGUI(aPlayer, 158);
+ }
+
+ public GT4Entity_ThermalBoiler(int aID, String aName, String aNameRegional)
+ {
+ super(aID, aName, aNameRegional);
+ }
+
+ public GT4Entity_ThermalBoiler(String mName) {
+ super(mName);
+ }
+
+ @Override
+ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity)
+ {
+ return new GT4Entity_ThermalBoiler(this.mName);
+ }
+
+ @Override
+ public boolean isCorrectMachinePart(ItemStack aStack)
+ {
+ return true;
+ }
+
+ @Override
+ public String getMachineType() {
+ return "Boiler";
+ }
+
+ @Override
+ public int getDamageToComponent(ItemStack aStack){
+ //log("Trying to damage component.");
+ return ItemList.Component_LavaFilter.get(1L).getClass().isInstance(aStack) ? 1 : 0;
+ }
+
+ private static Item mLavaFilter;
+
+ @Override
+ public boolean checkRecipe(ItemStack aStack) {
+ this.mSuperEfficencyIncrease=0;
+
+ if (mLavaFilter == null) {
+ mLavaFilter = ItemList.Component_LavaFilter.getItem();
+ }
+
+ //Try reload new Lava Filter
+ if (aStack == null) {
+ ItemStack uStack = this.findItemInInventory(mLavaFilter);
+ if (uStack != null) {
+ this.setGUIItemStack(uStack);
+ aStack = this.getGUIItemStack();
+ }
+ }
+
+
+ for (GT_Recipe tRecipe : GTPP_Recipe.GTPP_Recipe_Map.sThermalFuels.mRecipeList) {
+ FluidStack tFluid = tRecipe.mFluidInputs[0];
+ if (tFluid != null) {
+ if (depleteInput(tFluid)) {
+ this.mMaxProgresstime = Math.max(1, runtimeBoost(tRecipe.mSpecialValue * 2));
+ this.mEUt = getEUt();
+ this.mEfficiencyIncrease = (this.mMaxProgresstime * getEfficiencyIncrease());
+
+ int loot_MAXCHANCE = 100000;
+ if (mLavaFilter.getClass().isInstance(aStack.getItem())) {
+
+ if ((tRecipe.getOutput(0) != null) && (getBaseMetaTileEntity().getRandomNumber(loot_MAXCHANCE) < tRecipe.getOutputChance(0))) {
+ this.mOutputItems = new ItemStack[] { GT_Utility.copy(new Object[] { tRecipe.getOutput(0) }) };
+ }
+ if ((tRecipe.getOutput(1) != null) && (getBaseMetaTileEntity().getRandomNumber(loot_MAXCHANCE) < tRecipe.getOutputChance(1))) {
+ this.mOutputItems = new ItemStack[] { GT_Utility.copy(new Object[] { tRecipe.getOutput(1) }) };
+ }
+ if ((tRecipe.getOutput(2) != null) && (getBaseMetaTileEntity().getRandomNumber(loot_MAXCHANCE) < tRecipe.getOutputChance(2))) {
+ this.mOutputItems = new ItemStack[] { GT_Utility.copy(new Object[] { tRecipe.getOutput(2) }) };
+ }
+ if ((tRecipe.getOutput(3) != null) && (getBaseMetaTileEntity().getRandomNumber(loot_MAXCHANCE) < tRecipe.getOutputChance(3))) {
+ this.mOutputItems = new ItemStack[] { GT_Utility.copy(new Object[] { tRecipe.getOutput(3) }) };
+ }
+ if ((tRecipe.getOutput(4) != null) && (getBaseMetaTileEntity().getRandomNumber(loot_MAXCHANCE) < tRecipe.getOutputChance(4))) {
+ this.mOutputItems = new ItemStack[] { GT_Utility.copy(new Object[] { tRecipe.getOutput(4) }) };
+ }
+ if ((tRecipe.getOutput(5) != null) && (getBaseMetaTileEntity().getRandomNumber(loot_MAXCHANCE) < tRecipe.getOutputChance(5))) {
+ this.mOutputItems = new ItemStack[] { GT_Utility.copy(new Object[] { tRecipe.getOutput(5) }) };
+ }
+
+ }
+ //Give Obsidian without Lava Filter
+ if (tFluid.isFluidEqual(GT_ModHandler.getLava(86))){
+ if ((tRecipe.getOutput(6) != null) && (getBaseMetaTileEntity().getRandomNumber(loot_MAXCHANCE) < tRecipe.getOutputChance(6))) {
+ this.mOutputItems = new ItemStack[] { GT_Utility.copy(new Object[] { tRecipe.getOutput(6) }) };
+ }
+ }
+
+
+ return true;
+ }
+ }
+ }
+ this.mMaxProgresstime = 0;
+ this.mEUt = 0;
+ return false;
+ }
+
+ @Override
+ public int getMaxParallelRecipes() {
+ return 1;
+ }
+
+ @Override
+ public int getEuDiscountForParallelism() {
+ return 0;
+ }
+
+ @Override
+ public boolean onRunningTick(ItemStack aStack) {
+ if (this.mEUt > 0) {
+ if(this.mSuperEfficencyIncrease>0){
+ this.mEfficiency = Math.min(10000, this.mEfficiency + this.mSuperEfficencyIncrease);
+ }
+ int tGeneratedEU = (int) (this.mEUt * 2L * this.mEfficiency / 10000L);
+ if (tGeneratedEU > 0) {
+ long amount = (tGeneratedEU + 160) / 160;
+ if (depleteInput(Materials.Water.getFluid(amount)) || depleteInput(GT_ModHandler.getDistilledWater(amount))) {
+ addOutput(GT_ModHandler.getSteam(tGeneratedEU));
+ } else {
+ explodeMultiblock();
+ }
+ }
+ return true;
+ }
+ return true;
+ }
+
+ public int getEUt() {
+ return 400;
+ }
+
+ public int getEfficiencyIncrease() {
+ return 12;
+ }
+
+ int runtimeBoost(int mTime) {
+ return mTime * 150 / 100;
+ }
+
+ @Override
+ public boolean explodesOnComponentBreak(ItemStack aStack)
+ {
+ return false;
+ }
+
+ @Override
+ public int getMaxEfficiency(ItemStack aStack)
+ {
+ return 10000;
+ }
+
+ @Override
+ public int getPollutionPerSecond(ItemStack aStack)
+ {
+ return CORE.ConfigSwitches.pollutionPerSecondMultiThermalBoiler;
+ }
+
+ public int getAmountOfOutputs()
+ {
+ return 7;
+ }
+
+ @Override
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
+ GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType(getMachineType())
+ .addInfo("Thermal Boiler Controller")
+ .addInfo("Converts Water & Heat into Steam")
+ .addInfo("Consult user manual for more information")
+ .addPollutionAmount(getPollutionPerSecond(null))
+ .addSeparator()
+ .beginStructureBlock(3, 3, 3, true)
+ .addController("Front Center")
+ .addCasingInfo("Thermal Containment Casings", 10)
+ .addInputBus("Any Casing", 1)
+ .addOutputBus("Any Casing", 1)
+ .addInputHatch("Any Casing", 1)
+ .addOutputHatch("Any Casing", 1)
+ .addMaintenanceHatch("Any Casing", 1)
+ .addMufflerHatch("Any Casing", 1)
+ .toolTipFinisher(CORE.GT_Tooltip_Builder);
+ return tt;
+ }
+
+ @Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+ if (aSide == aFacing) {
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(TAE.GTPP_INDEX(1)),
+ new GT_RenderedTexture(aActive ? TexturesGtBlock.Overlay_Machine_Controller_Advanced_Active : TexturesGtBlock.Overlay_Machine_Controller_Advanced)};
+ }
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(TAE.GTPP_INDEX(1))};
+ }
+
+ @Override
+ public IStructureDefinition<GT4Entity_ThermalBoiler> getStructureDefinition() {
+ if (STRUCTURE_DEFINITION == null) {
+ STRUCTURE_DEFINITION = StructureDefinition.<GT4Entity_ThermalBoiler>builder()
+ .addShape(mName, transpose(new String[][]{
+ {"CCC", "CCC", "CCC"},
+ {"C~C", "C-C", "CCC"},
+ {"CCC", "CCC", "CCC"},
+ }))
+ .addElement(
+ 'C',
+ ofChain(
+ ofHatchAdder(
+ GT4Entity_ThermalBoiler::addThermalBoilerList, TAE.getIndexFromPage(0, 1), 1
+ ),
+ onElementPass(
+ x -> ++x.mCasing,
+ ofBlock(
+ ModBlocks.blockCasings2Misc, 11
+ )
+ )
+ )
+ )
+ .build();
+ }
+ return STRUCTURE_DEFINITION;
+ }
+
+ @Override
+ public void construct(ItemStack stackSize, boolean hintsOnly) {
+ buildPiece(mName , stackSize, hintsOnly, 1, 1, 0);
+ }
+
+ @Override
+ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ mCasing = 0;
+ return checkPiece(mName, 1, 1, 0) && mCasing >= 10 && checkHatch();
+ }
+
+ public final boolean addThermalBoilerList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null) {
+ return false;
+ } else {
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ }
+ return false;
+ }
+
+ public void damageFilter(){
+ ItemStack filter = this.mInventory[1];
+ if (filter != null){
+ if (filter.getItem() instanceof ItemLavaFilter){
+
+ long currentUse = ItemLavaFilter.getFilterDamage(filter);
+
+ //Remove broken Filter
+ if (currentUse >= 100-1){
+ this.mInventory[1] = null;
+ }
+ else {
+ //Do Damage
+ ItemLavaFilter.setFilterDamage(filter, currentUse+1);
+ }
+ }
+ }
+
+ }
+
+ @Override
+ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ if (aBaseMetaTileEntity.isServerSide()){
+ // Reload Lava Filter
+ if (this.getGUIItemStack() == null) {
+ if (this.mInputBusses.size() > 0) {
+ for (GT_MetaTileEntity_Hatch_InputBus aBus : this.mInputBusses) {
+ for (ItemStack aStack : aBus.mInventory) {
+ if (aStack != null && aStack.getItem() instanceof ItemLavaFilter) {
+ this.setGUIItemStack(aStack);
+ }
+ }
+ }
+ }
+ }
+
+ if (this.mEUt > 0){
+ if (aTick % 600L == 0L){
+ damageFilter();
+ }
+ }
+ }
+ super.onPostTick(aBaseMetaTileEntity, aTick);
+ }
+
+ @Override
+ public boolean hasSlotInGUI() {
+ return true;
+ }
+
+ @Override
+ public String getCustomGUIResourceName() {
+ return "Generic3By3";
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_ElementalDuplicator.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_ElementalDuplicator.java
new file mode 100644
index 0000000000..326cc01de7
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_ElementalDuplicator.java
@@ -0,0 +1,744 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production;
+
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
+import static gtPlusPlus.core.util.data.ArrayUtils.removeNulls;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import org.apache.commons.lang3.ArrayUtils;
+
+import com.gtnewhorizon.structurelib.StructureLibAPI;
+import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
+import com.gtnewhorizon.structurelib.structure.IStructureElement;
+import com.gtnewhorizon.structurelib.structure.StructureDefinition;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Maintenance;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBus;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_TieredMachineBlock;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GTPP_Recipe;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.api.objects.data.AutoMap;
+import gtPlusPlus.api.objects.data.Triplet;
+import gtPlusPlus.core.item.chemistry.general.ItemGenericChemBase;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.recipe.common.CI;
+import gtPlusPlus.core.util.math.MathUtils;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_ElementalDataOrbHolder;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import net.minecraft.block.Block;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.world.World;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.FluidStack;
+
+public class GregtechMTE_ElementalDuplicator extends GregtechMeta_MultiBlockBase {
+
+ private int mSolidCasingTier = 0;
+ private int mMachineCasingTier = 0;
+ private int mPipeCasingTier = 0;
+ private int mCoilTier = 0;
+ private int checkCoil;
+ private int[] checkCasing = new int[8];
+ private int checkMachine;
+ private int checkPipe;
+ private int maxTierOfHatch;
+ private int mCasing;
+ private IStructureDefinition<GregtechMTE_ElementalDuplicator> STRUCTURE_DEFINITION = null;
+
+ private ArrayList<GT_MetaTileEntity_Hatch_ElementalDataOrbHolder> mReplicatorDataOrbHatches = new ArrayList<GT_MetaTileEntity_Hatch_ElementalDataOrbHolder>();
+
+ private static final HashMap<Integer, Triplet<Block, Integer, Integer>> mTieredBlockRegistry = new HashMap<Integer, Triplet<Block, Integer, Integer>>();
+
+ public GregtechMTE_ElementalDuplicator(final int aID, final String aName, final String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ }
+
+ public GregtechMTE_ElementalDuplicator(final String aName) {
+ super(aName);
+ }
+
+ public static boolean registerMachineCasingForTier(int aTier, Block aBlock, int aMeta, int aCasingTextureID) {
+ int aSize = mTieredBlockRegistry.size();
+ int aSize2 = aSize;
+ Triplet<Block, Integer, Integer> aCasingData = new Triplet<Block, Integer, Integer>(aBlock, aMeta, aCasingTextureID);
+ if (mTieredBlockRegistry.containsKey(aTier)) {
+ CORE.crash("Tried to register a Machine casing for tier "+aTier+" to the Chemical Plant, however this tier already contains one.");
+ }
+ mTieredBlockRegistry.put(aTier, aCasingData);
+ aSize = mTieredBlockRegistry.size();
+ return aSize > aSize2;
+ }
+
+ private static int getCasingTextureIdForTier(int aTier) {
+ if (!mTieredBlockRegistry.containsKey(aTier)) {
+ return 10;
+ }
+ int aCasingID = mTieredBlockRegistry.get(aTier).getValue_3();
+ //Logger.INFO("Found casing texture ID "+aCasingID+" for tier "+aTier);
+ return aCasingID;
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
+ return new GregtechMTE_ElementalDuplicator(this.mName);
+ }
+
+ @Override
+ public String getMachineType() {
+ return "Replicator";
+ }
+
+ @Override
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
+ GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType(getMachineType())
+ .addInfo("Controller Block for the Industrial Replication Machine")
+ .addInfo("Now replication is less painful")
+ .addInfo("Please read to user manual for more information on construction & usage")
+ .addSeparator()
+ .addController("Bottom Center")
+ .addStructureHint("Catalyst Housing", 1)
+ .addInputBus("Bottom Casing", 1)
+ .addOutputBus("Bottom Casing", 1)
+ .addInputHatch("Bottom Casing", 1)
+ .addOutputHatch("Bottom Casing", 1)
+ .addEnergyHatch("Bottom Casing", 1)
+ .addMaintenanceHatch("Bottom Casing", 1)
+ .toolTipFinisher(CORE.GT_Tooltip_Builder);
+ return tt;
+ }
+
+ public void setMachineMeta(int meta) {
+ checkMachine = meta;
+ }
+
+ public int getMachineMeta() {
+ return checkMachine;
+ }
+
+ public void setPipeMeta(int meta) {
+ checkPipe = meta;
+ }
+
+ public int getPipeMeta() {
+ return checkPipe;
+ }
+
+ public void setCoilMeta(int meta) {
+ checkCoil = meta;
+ }
+
+ public int getCoilMeta() {
+ return checkCoil;
+ }
+
+ public int coilTier(int meta) {
+ switch (meta) {
+ case 0: return 1;
+ case 1: return 2;
+ case 2: return 3;
+ case 3: return 4;
+ case 4: return 5;
+ case 5: return 7;
+ case 6: return 8;
+ case 7: return 10;
+ case 8: return 11;
+ case 9: return 6;
+ case 10: return 9;
+ }
+ return 0;
+ }
+
+ @Override
+ public IStructureDefinition<GregtechMTE_ElementalDuplicator> getStructureDefinition() {
+ if (STRUCTURE_DEFINITION == null) {
+ STRUCTURE_DEFINITION = StructureDefinition.<GregtechMTE_ElementalDuplicator>builder()
+ .addShape(mName, transpose(new String[][]{
+ {"XXXXXXX", "XXXXXXX", "XXXXXXX", "XXXXXXX", "XXXXXXX", "XXXXXXX", "XXXXXXX"},
+ {"X X", " MMMMM ", " MHHHM ", " MHHHM ", " MHHHM ", " MMMMM ", "X X"},
+ {"X X", " ", " PPP ", " PPP ", " PPP ", " ", "X X"},
+ {"X X", " ", " HHH ", " HHH ", " HHH ", " ", "X X"},
+ {"X X", " ", " PPP ", " PPP ", " PPP ", " ", "X X"},
+ {"X X", " MMMMM ", " MHHHM ", " MHHHM ", " MHHHM ", " MMMMM ", "X X"},
+ {"CCC~CCC", "CMMMMMC", "CMMMMMC", "CMMMMMC", "CMMMMMC", "CMMMMMC", "CCCCCCC"},
+ }))
+ .addElement(
+ 'C',
+ ofChain(
+ ofHatchAdder(
+ GregtechMTE_ElementalDuplicator::addChemicalPlantList, getCasingTextureID(), 1
+ ),
+ onElementPass(
+ x -> {++x.checkCasing[0]; ++x.mCasing;},
+ ofSolidCasing(0)
+ ),
+ onElementPass(
+ x -> {++x.checkCasing[1]; ++x.mCasing;},
+ ofSolidCasing(1)
+ ),
+ onElementPass(
+ x -> {++x.checkCasing[2]; ++x.mCasing;},
+ ofSolidCasing(2)
+ ),
+ onElementPass(
+ x -> {++x.checkCasing[3]; ++x.mCasing;},
+ ofSolidCasing(3)
+ ),
+ onElementPass(
+ x -> {++x.checkCasing[4]; ++x.mCasing;},
+ ofSolidCasing(4)
+ ),
+ onElementPass(
+ x -> {++x.checkCasing[5]; ++x.mCasing;},
+ ofSolidCasing(5)
+ ),
+ onElementPass(
+ x -> {++x.checkCasing[6]; ++x.mCasing;},
+ ofSolidCasing(6)
+ ),
+ onElementPass(
+ x -> {++x.checkCasing[7]; ++x.mCasing;},
+ ofSolidCasing(7)
+ )
+ )
+ )
+ .addElement(
+ 'X',
+ ofChain(
+ onElementPass(
+ x -> {++x.checkCasing[0]; ++x.mCasing;},
+ ofSolidCasing(0)
+ ),
+ onElementPass(
+ x -> {++x.checkCasing[1]; ++x.mCasing;},
+ ofSolidCasing(1)
+ ),
+ onElementPass(
+ x -> {++x.checkCasing[2]; ++x.mCasing;},
+ ofSolidCasing(2)
+ ),
+ onElementPass(
+ x -> {++x.checkCasing[3]; ++x.mCasing;},
+ ofSolidCasing(3)
+ ),
+ onElementPass(
+ x -> {++x.checkCasing[4]; ++x.mCasing;},
+ ofSolidCasing(4)
+ ),
+ onElementPass(
+ x -> {++x.checkCasing[5]; ++x.mCasing;},
+ ofSolidCasing(5)
+ ),
+ onElementPass(
+ x -> {++x.checkCasing[6]; ++x.mCasing;},
+ ofSolidCasing(6)
+ ),
+ onElementPass(
+ x -> {++x.checkCasing[7]; ++x.mCasing;},
+ ofSolidCasing(7)
+ )
+ )
+ )
+ .addElement(
+ 'M',
+ addTieredBlock(
+ GregTech_API.sBlockCasings1, GregtechMTE_ElementalDuplicator::setMachineMeta, GregtechMTE_ElementalDuplicator::getMachineMeta, 10
+ )
+ )
+ .addElement(
+ 'H',
+ addTieredBlock(
+ GregTech_API.sBlockCasings5, GregtechMTE_ElementalDuplicator::setCoilMeta, GregtechMTE_ElementalDuplicator::getCoilMeta, 11
+ )
+ )
+ .addElement(
+ 'P',
+ addTieredBlock(
+ GregTech_API.sBlockCasings2, GregtechMTE_ElementalDuplicator::setPipeMeta, GregtechMTE_ElementalDuplicator::getPipeMeta, 12, 16
+ )
+ )
+ .build();
+ }
+ return STRUCTURE_DEFINITION;
+ }
+
+ public static <T> IStructureElement<T> ofSolidCasing(int aIndex) {
+ return new IStructureElement<T>() {
+ @Override
+ public boolean check(T t, World world, int x, int y, int z) {
+ Block block = world.getBlock(x, y, z);
+ int meta = world.getBlockMetadata(x, y, z);
+ Block target = mTieredBlockRegistry.get(aIndex).getValue_1();
+ int targetMeta = mTieredBlockRegistry.get(aIndex).getValue_2();
+ return target.equals(block) && meta == targetMeta;
+ }
+
+ int getIndex(int size) {
+ if (size > 8) size = 8;
+ return size - 1;
+ }
+
+ @Override
+ public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
+ StructureLibAPI.hintParticle(world, x, y, z, mTieredBlockRegistry.get(getIndex(trigger.stackSize)).getValue_1(), mTieredBlockRegistry.get(getIndex(trigger.stackSize)).getValue_2());
+ return true;
+ }
+
+ @Override
+ public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
+ return world.setBlock(x, y, z, mTieredBlockRegistry.get(getIndex(trigger.stackSize)).getValue_1(), mTieredBlockRegistry.get(getIndex(trigger.stackSize)).getValue_2(), 3);
+ }
+ };
+ }
+
+ @Override
+ public void construct(ItemStack stackSize, boolean hintsOnly) {
+ buildPiece(mName , stackSize, hintsOnly, 3, 6, 0);
+ }
+
+ @Override
+ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ mCasing = 0;
+ for (int i = 0; i < 8; i++) {
+ checkCasing[i] = 0;
+ }
+ checkCoil = 0;
+ checkPipe = 0;
+ checkMachine = 0;
+ mSolidCasingTier = 0;
+ mMachineCasingTier = 0;
+ mPipeCasingTier = 0;
+ mCoilTier = 0;
+ mReplicatorDataOrbHatches.clear();
+ if (checkPiece(mName, 3, 6, 0) && mCasing >= 80) {
+ for (int i = 0; i < 8; i++) {
+ if (checkCasing[i] == mCasing) {
+ mSolidCasingTier = i;
+ }
+ else if (checkCasing[i] > 0)
+ return false;
+ }
+ mMachineCasingTier = checkMachine - 1;
+ mPipeCasingTier = checkPipe - 12;
+ mCoilTier = coilTier(checkCoil - 1);
+ updateHatchTexture();
+ return mMachineCasingTier >= maxTierOfHatch;
+ }
+ return false;
+ }
+
+ public void updateHatchTexture() {
+ for (GT_MetaTileEntity_Hatch h : mReplicatorDataOrbHatches) h.updateTexture(getCasingTextureID());
+ for (GT_MetaTileEntity_Hatch h : mInputBusses) h.updateTexture(getCasingTextureID());
+ for (GT_MetaTileEntity_Hatch h : mMaintenanceHatches) h.updateTexture(getCasingTextureID());
+ for (GT_MetaTileEntity_Hatch h : mEnergyHatches) h.updateTexture(getCasingTextureID());
+ for (GT_MetaTileEntity_Hatch h : mOutputBusses) h.updateTexture(getCasingTextureID());
+ for (GT_MetaTileEntity_Hatch h : mInputHatches) h.updateTexture(getCasingTextureID());
+ for (GT_MetaTileEntity_Hatch h : mOutputHatches) h.updateTexture(getCasingTextureID());
+ }
+
+ public final boolean addChemicalPlantList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null) {
+ return false;
+ } else {
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_ElementalDataOrbHolder){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus){
+ maxTierOfHatch = Math.max(maxTierOfHatch, ((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity).mTier);
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy){
+ maxTierOfHatch = Math.max(maxTierOfHatch, ((GT_MetaTileEntity_Hatch_Energy) aMetaTileEntity).mTier);
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) {
+ maxTierOfHatch = Math.max(maxTierOfHatch, ((GT_MetaTileEntity_Hatch_OutputBus) aMetaTileEntity).mTier);
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) {
+ maxTierOfHatch = Math.max(maxTierOfHatch, ((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity).mTier);
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) {
+ maxTierOfHatch = Math.max(maxTierOfHatch, ((GT_MetaTileEntity_Hatch_Output) aMetaTileEntity).mTier);
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public String getSound() {
+ return GregTech_API.sSoundList.get(Integer.valueOf(207));
+ }
+
+ @Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+
+ ITexture aOriginalTexture;
+
+ // Check things exist client side (The worst code ever)
+ if (aBaseMetaTileEntity.getWorld() != null) {
+
+ }
+ int aCasingID = getCasingTextureID();
+ aOriginalTexture = Textures.BlockIcons.getCasingTextureForId(aCasingID);
+
+ if (aSide == aFacing) {
+ return new ITexture[]{aOriginalTexture, new GT_RenderedTexture(aActive ? TexturesGtBlock.Overlay_Machine_Controller_Advanced_Active : TexturesGtBlock.Overlay_Machine_Controller_Advanced)};
+ }
+ return new ITexture[]{aOriginalTexture};
+ }
+
+ @Override
+ public boolean hasSlotInGUI() {
+ return true;
+ }
+
+ @Override
+ public GT_Recipe.GT_Recipe_Map getRecipeMap() {
+ if (GTPP_Recipe.GTPP_Recipe_Map.sChemicalPlant_GT.mRecipeList.size() == 0) {
+ generateRecipes();
+ }
+ return GTPP_Recipe.GTPP_Recipe_Map.sChemicalPlant_GT;
+ }
+
+ public static void generateRecipes() {
+ for (GT_Recipe i : GTPP_Recipe.GTPP_Recipe_Map.sChemicalPlantRecipes.mRecipeList) {
+ GTPP_Recipe.GTPP_Recipe_Map.sChemicalPlant_GT.add(i);
+ }
+ }
+
+ @Override
+ public int getMaxParallelRecipes() {
+ return 2 * getPipeCasingTier();
+ }
+
+ @Override
+ public int getEuDiscountForParallelism() {
+ return 100;
+ }
+
+ private int getSolidCasingTier() {
+ return this.mSolidCasingTier;
+ }
+
+ private int getMachineCasingTier() {
+ return mMachineCasingTier;
+ }
+
+ private int getPipeCasingTier() {
+ return mPipeCasingTier;
+ }
+
+ private int getCasingTextureID() {
+ // Check the Tier Client Side
+ int aTier = mSolidCasingTier;
+ int aCasingID = getCasingTextureIdForTier(aTier);
+ return aCasingID;
+ }
+
+ public boolean addToMachineList(IGregTechTileEntity aTileEntity) {
+ int aMaxTier = getMachineCasingTier();
+ final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_TieredMachineBlock) {
+ GT_MetaTileEntity_TieredMachineBlock aMachineBlock = (GT_MetaTileEntity_TieredMachineBlock) aMetaTileEntity;
+ int aTileTier = aMachineBlock.mTier;
+ if (aTileTier > aMaxTier) {
+ log("Hatch tier too high.");
+ return false;
+ }
+ else {
+ return addToMachineList(aTileEntity, getCasingTextureID());
+ }
+ }
+ else {
+ log("Bad Tile Entity being added to hatch map."); // Shouldn't ever happen, but.. ya know..
+ return false;
+ }
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ super.saveNBTData(aNBT);
+ aNBT.setInteger("mSolidCasingTier", this.mSolidCasingTier);
+ aNBT.setInteger("mMachineCasingTier", this.mMachineCasingTier);
+ aNBT.setInteger("mPipeCasingTier", this.mPipeCasingTier);
+ aNBT.setInteger("mCoilTier", this.mCoilTier);
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ super.loadNBTData(aNBT);
+ mSolidCasingTier = aNBT.getInteger("mSolidCasingTier");
+ mMachineCasingTier = aNBT.getInteger("mMachineCasingTier");
+ mPipeCasingTier = aNBT.getInteger("mPipeCasingTier");
+ mCoilTier = aNBT.getInteger("mCoilTier");
+ }
+
+ @Override
+ public boolean addToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity == null) {
+ return false;
+ }
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_ElementalDataOrbHolder) {
+ log("Found GT_MetaTileEntity_Hatch_ElementalDataOrbHolder");
+ ((GT_MetaTileEntity_Hatch_ElementalDataOrbHolder) aTileEntity).mRecipeMap = getRecipeMap();
+ return addToMachineListInternal(mReplicatorDataOrbHatches, aMetaTileEntity, aBaseCasingIndex);
+ }
+ return super.addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+
+ @Override
+ public int getMaxEfficiency(final ItemStack aStack) {
+ return 10000;
+ }
+
+ @Override
+ public int getPollutionPerTick(final ItemStack aStack) {
+ return 100;
+ }
+
+ @Override
+ public int getAmountOfOutputs() {
+ return 1;
+ }
+
+ @Override
+ public boolean explodesOnComponentBreak(final ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public String getCustomGUIResourceName() {
+ return null;
+ }
+
+ // Same speed bonus as pyro oven
+ public int getSpeedBonus() {
+ return 50 * (this.mCoilTier - 2);
+ }
+
+ @Override
+ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ if (aBaseMetaTileEntity.isServerSide()) {
+ if (this.mUpdate == 1 || this.mStartUpCheck == 1) {
+ this.mReplicatorDataOrbHatches.clear();
+ }
+ }
+ super.onPostTick(aBaseMetaTileEntity, aTick);
+ }
+
+ @Override
+ public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ super.onPreTick(aBaseMetaTileEntity, aTick);
+ }
+
+ @Override
+ public boolean checkRecipe(final ItemStack aStack) {
+ return checkRecipeGeneric(getMaxParallelRecipes(), getEuDiscountForParallelism(), getSpeedBonus());
+ }
+
+
+ @Override
+ public boolean checkRecipeGeneric(
+ ItemStack[] aItemInputs, FluidStack[] aFluidInputs,
+ int aMaxParallelRecipes, int aEUPercent,
+ int aSpeedBonusPercent, int aOutputChanceRoll, GT_Recipe aRecipe, boolean isOC) {
+ return false;
+ }
+
+ private static final HashMap<Long, AutoMap<GT_Recipe>> mTieredRecipeMap = new HashMap<Long, AutoMap<GT_Recipe>>();
+ private static final AutoMap<GT_Recipe> aTier0Recipes = new AutoMap<GT_Recipe>();
+ private static final AutoMap<GT_Recipe> aTier1Recipes = new AutoMap<GT_Recipe>();
+ private static final AutoMap<GT_Recipe> aTier2Recipes = new AutoMap<GT_Recipe>();
+ private static final AutoMap<GT_Recipe> aTier3Recipes = new AutoMap<GT_Recipe>();
+ private static final AutoMap<GT_Recipe> aTier4Recipes = new AutoMap<GT_Recipe>();
+ private static final AutoMap<GT_Recipe> aTier5Recipes = new AutoMap<GT_Recipe>();
+ private static final AutoMap<GT_Recipe> aTier6Recipes = new AutoMap<GT_Recipe>();
+ private static final AutoMap<GT_Recipe> aTier7Recipes = new AutoMap<GT_Recipe>();
+ private static boolean mInitRecipeCache = false;
+
+ private static void initRecipeCaches() {
+ if (!mInitRecipeCache) {
+ mTieredRecipeMap.put((long) 0, aTier0Recipes);
+ mTieredRecipeMap.put((long) 1, aTier1Recipes);
+ mTieredRecipeMap.put((long) 2, aTier2Recipes);
+ mTieredRecipeMap.put((long) 3, aTier3Recipes);
+ mTieredRecipeMap.put((long) 4, aTier4Recipes);
+ mTieredRecipeMap.put((long) 5, aTier5Recipes);
+ mTieredRecipeMap.put((long) 6, aTier6Recipes);
+ mTieredRecipeMap.put((long) 7, aTier7Recipes);
+ for (GT_Recipe aRecipe : GTPP_Recipe.GTPP_Recipe_Map.sChemicalPlant_GT.mRecipeList) {
+ if (aRecipe != null) {
+ switch (aRecipe.mSpecialValue) {
+ case 0:
+ aTier0Recipes.add(aRecipe);
+ continue;
+ case 1:
+ aTier1Recipes.add(aRecipe);
+ continue;
+ case 2:
+ aTier2Recipes.add(aRecipe);
+ continue;
+ case 3:
+ aTier3Recipes.add(aRecipe);
+ continue;
+ case 4:
+ aTier4Recipes.add(aRecipe);
+ continue;
+ case 5:
+ aTier5Recipes.add(aRecipe);
+ continue;
+ case 6:
+ aTier6Recipes.add(aRecipe);
+ continue;
+ case 7:
+ aTier7Recipes.add(aRecipe);
+ continue;
+ }
+ }
+ }
+ mInitRecipeCache = true;
+ }
+ }
+
+ private static boolean areInputsEqual(GT_Recipe aComparator, ItemStack[] aInputs, FluidStack[] aFluids) {
+ int aInputCount = aComparator.mInputs.length;
+ if (aInputCount > 0) {
+ //Logger.INFO("Looking for recipe with "+aInputCount+" Items");
+ int aMatchingInputs = 0;
+ recipe : for (ItemStack a : aComparator.mInputs) {
+ for (ItemStack b : aInputs) {
+ if (a.getItem() == b.getItem()) {
+ if (a.getItemDamage() == b.getItemDamage()) {
+ //Logger.INFO("Found matching Item Input - "+b.getUnlocalizedName());
+ aMatchingInputs++;
+ continue recipe;
+ }
+ }
+ }
+ }
+ if (aMatchingInputs != aInputCount) {
+ return false;
+ }
+ }
+ int aFluidInputCount = aComparator.mFluidInputs.length;
+ if (aFluidInputCount > 0) {
+ //Logger.INFO("Looking for recipe with "+aFluidInputCount+" Fluids");
+ int aMatchingFluidInputs = 0;
+ recipe : for (FluidStack b : aComparator.mFluidInputs) {
+ //Logger.INFO("Checking for fluid "+b.getLocalizedName());
+ for (FluidStack a : aFluids) {
+ if (GT_Utility.areFluidsEqual(a, b)) {
+ //Logger.INFO("Found matching Fluid Input - "+b.getLocalizedName());
+ aMatchingFluidInputs++;
+ continue recipe;
+ }
+ else {
+ //Logger.INFO("Found fluid which did not match - "+a.getLocalizedName());
+ }
+ }
+ }
+ if (aMatchingFluidInputs != aFluidInputCount) {
+ return false;
+ }
+ }
+ Logger.INFO("Recipes Match!");
+ return true;
+ }
+
+ public GT_Recipe findRecipe(final GT_Recipe aRecipe, final long aVoltage, final long aSpecialValue, ItemStack[] aInputs, final FluidStack[] aFluids) {
+ if (!mInitRecipeCache) {
+ initRecipeCaches();
+ }
+ if (this.getRecipeMap().mRecipeList.isEmpty()) {
+ log("No Recipes in Map to search through.");
+ return null;
+ }
+ else {
+ log("Checking tier "+aSpecialValue+" recipes and below. Using Input Voltage of "+aVoltage+"V.");
+ log("We have "+aInputs.length+" Items and "+aFluids.length+" Fluids.");
+ // Try check the cached recipe first
+ if (aRecipe != null) {
+ if (areInputsEqual(aRecipe, aInputs, aFluids)) {
+ if (aRecipe.mEUt <= aVoltage) {
+ Logger.INFO("Using cached recipe.");
+ return aRecipe;
+ }
+ }
+ }
+
+ // Get all recipes for the tier
+ AutoMap<AutoMap<GT_Recipe>> aMasterMap = new AutoMap<AutoMap<GT_Recipe>>();
+ for (long i=0;i<=aSpecialValue;i++) {
+ aMasterMap.add(mTieredRecipeMap.get(i));
+ }
+ GT_Recipe aFoundRecipe = null;
+
+ // Iterate the tiers recipes until we find the one with all inputs matching
+ master : for (AutoMap<GT_Recipe> aTieredMap : aMasterMap) {
+ for (GT_Recipe aRecipeToCheck : aTieredMap) {
+ if (areInputsEqual(aRecipeToCheck, aInputs, aFluids)) {
+ log("Found recipe with matching inputs!");
+ if (aRecipeToCheck.mSpecialValue <= aSpecialValue) {
+ if (aRecipeToCheck.mEUt <= aVoltage) {
+ aFoundRecipe = aRecipeToCheck;
+ break master;
+ }
+ }
+ }
+ }
+ }
+
+ // If we found a recipe, return it
+ if (aFoundRecipe != null) {
+ log("Found valid recipe.");
+ return aFoundRecipe;
+ }
+ }
+ log("Did not find valid recipe.");
+ return null;
+ }
+
+ /*
+ * Catalyst Handling
+ */
+
+ @Override
+ public ArrayList<ItemStack> getStoredInputs() {
+ ArrayList<ItemStack> tItems = super.getStoredInputs();
+ for (GT_MetaTileEntity_Hatch_ElementalDataOrbHolder tHatch : mReplicatorDataOrbHatches) {
+ tHatch.mRecipeMap = getRecipeMap();
+ if (isValidMetaTileEntity(tHatch)) {
+ tItems.addAll(tHatch.getInventory());
+ }
+ }
+ return tItems;
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_FastNeutronReactor.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_FastNeutronReactor.java
new file mode 100644
index 0000000000..3941d59edb
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_FastNeutronReactor.java
@@ -0,0 +1,231 @@
+/*
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production;
+
+import gregtech.api.enums.TAE;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.MetaTileEntity;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_ModHandler;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.core.util.minecraft.FluidUtils;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.fluids.FluidStack;
+
+public class GregtechMTE_FastNeutronReactor
+extends GregtechMeta_MultiBlockBase
+{
+
+ private int mSuperEfficencyIncrease = 0;
+
+
+ public GregtechMTE_FastNeutronReactor(int aID, String aName, String aNameRegional)
+ {
+ super(aID, aName, aNameRegional);
+ }
+
+ public GregtechMTE_FastNeutronReactor(String mName) {
+ super(mName);
+ }
+
+ @Override
+ public String getMachineType() {
+ return "Reactor";
+ }
+
+ @Override
+ public String getCustomGUIResourceName() {
+ return null;
+ }
+
+ @Override
+ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity)
+ {
+ return new GregtechMTE_FastNeutronReactor(this.mName);
+ }
+ @Override
+ public boolean isFacingValid(byte aFacing)
+ {
+ return aFacing > 1;
+ }
+
+ @Override
+ public boolean isCorrectMachinePart(ItemStack aStack)
+ {
+ return true;
+ }
+
+ @Override
+ public int getDamageToComponent(ItemStack aStack){
+ return 0;
+ }
+
+ @Override
+ public boolean checkRecipe(final ItemStack aStack) {
+ this.mSuperEfficencyIncrease=0;
+ if (processing_Stage_1()) {
+ if (processing_Stage_2()) {
+ if (processing_Stage_3()) {
+ if (processing_Stage_4()) {
+
+ }
+ else {
+ //Stage 4
+ }
+ }
+ else {
+ //Stage 3
+ }
+ }
+ else {
+ //Stage 2
+ }
+ }
+ else {
+ //Stage 1
+ }
+ return false;
+ }
+
+ @Override
+ public int getMaxParallelRecipes() {
+ return 1;
+ }
+
+ @Override
+ public int getEuDiscountForParallelism() {
+ return 0;
+ }
+
+ public boolean processing_Stage_1() { //Deplete Water, Add More Progress Time
+ for (GT_MetaTileEntity_Hatch_Input tRecipe : this.mInputHatches) {
+ if (tRecipe.getFluid() != null){
+ FluidStack tFluid = FluidUtils.getFluidStack(tRecipe.getFluid(), 200);
+ if (tFluid != null) {
+ if (tFluid == GT_ModHandler.getDistilledWater(1)) {
+ if (depleteInput(tFluid)) {
+ this.mMaxProgresstime = Math.max(1, runtimeBoost(8 * 2));
+ this.mEUt = getEUt();
+ this.mEfficiencyIncrease = (this.mMaxProgresstime * getEfficiencyIncrease());
+ return true;
+ }
+ }
+
+ }
+ }
+ }
+ this.mMaxProgresstime = 0;
+ this.mEUt = 0;
+ return false;
+ }
+ public boolean processing_Stage_2() {
+ return false;
+ }
+ public boolean processing_Stage_3() {
+ return false;
+ }
+ public boolean processing_Stage_4() {
+ return false;
+ }
+
+ @Override
+ public boolean onRunningTick(ItemStack aStack) {
+ if (this.mEUt > 0) {
+ if(this.mSuperEfficencyIncrease>0){
+ this.mEfficiency = Math.min(10000, this.mEfficiency + this.mSuperEfficencyIncrease);
+ }
+ int tGeneratedEU = (int) (this.mEUt * 2L * this.mEfficiency / 10000L);
+ if (tGeneratedEU > 0) {
+ long amount = (tGeneratedEU + 160) / 160;
+ if (!depleteInput(GT_ModHandler.getDistilledWater(amount))) {
+ explodeMultiblock();
+ } else {
+ addOutput(GT_ModHandler.getSteam(tGeneratedEU));
+ }
+ }
+ return true;
+ }
+ return true;
+ }
+
+ public int getEUt() {
+ return 0; //Default 400
+ }
+
+ public int getEfficiencyIncrease() {
+ return 0; //Default 12
+ }
+
+ int runtimeBoost(int mTime) {
+ return mTime * 150 / 100;
+ }
+
+ @Override
+ public boolean explodesOnComponentBreak(ItemStack aStack)
+ {
+ return true;
+ }
+
+ @Override
+ public int getMaxEfficiency(ItemStack aStack)
+ {
+ return 10000;
+ }
+
+ @Override
+ public int getPollutionPerTick(ItemStack aStack)
+ {
+ return 0;
+ }
+
+ public int getAmountOfOutputs()
+ {
+ return 1;
+ }
+
+ @Override
+ public String[] getTooltip()
+ {
+ return new String[]{
+ "Fukushima-Daiichi Reactor No. 6",
+ "------------------------------------------",
+ "Boiling Water Reactor",
+ "Harness the power of Nuclear Fission",
+ "------------------------------------------",
+ "Consult user manual for more information",
+ };
+ }
+
+ @Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+ if (aSide == aFacing) {
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(TAE.GTPP_INDEX(1)),
+ new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE)};
+ }
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(TAE.GTPP_INDEX(1))};
+ }
+
+ @Override
+ public boolean checkMultiblock(IGregTechTileEntity aBaseMetaTileEntity, ItemStack arg1) {
+ return true;
+ }
+
+ public boolean damageFilter(){
+ return false;
+ }
+
+ @Override
+ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ super.onPostTick(aBaseMetaTileEntity, aTick);
+ }
+
+ @Override
+ public boolean hasSlotInGUI() {
+ return false;
+ }
+
+}
+*/
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_FrothFlotationCell.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_FrothFlotationCell.java
new file mode 100644
index 0000000000..8a936525f0
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_FrothFlotationCell.java
@@ -0,0 +1,449 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production;
+
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
+import static gtPlusPlus.core.util.data.ArrayUtils.removeNulls;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
+import com.gtnewhorizon.structurelib.structure.StructureDefinition;
+import gregtech.api.metatileentity.implementations.*;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
+import gtPlusPlus.core.lib.CORE;
+import org.apache.commons.lang3.ArrayUtils;
+
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.TAE;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_Utility;
+import gregtech.api.util.GTPP_Recipe;
+import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import gtPlusPlus.xmod.gregtech.common.helpers.FlotationRecipeHandler;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraftforge.fluids.FluidStack;
+
+public class GregtechMTE_FrothFlotationCell extends GregtechMeta_MultiBlockBase {
+
+ private int mCasing;
+ private IStructureDefinition<GregtechMTE_FrothFlotationCell> STRUCTURE_DEFINITION = null;
+
+ public GregtechMTE_FrothFlotationCell(final int aID, final String aName, final String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ }
+
+ public GregtechMTE_FrothFlotationCell(final String aName) {
+ super(aName);
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
+ return new GregtechMTE_FrothFlotationCell(this.mName);
+ }
+
+ @Override
+ public String getMachineType() {
+ return "Flotation Cell";
+ }
+
+ @Override
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
+ GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType(getMachineType())
+ .addInfo("Process that milled ore!")
+ .addPollutionAmount(getPollutionPerSecond(null))
+ .addSeparator()
+ .beginStructureBlock(3, 3, 3, true)
+ .addController("Front Center")
+ .addCasingInfo("Inconel Reinforced Casing", 68)
+ .addCasingInfo("Flotation Casings", 52)
+ .addInputBus("Bottom Casing", 1)
+ .addInputHatch("Bottom Casing", 1)
+ .addOutputHatch("Bottom Casing", 1)
+ .addEnergyHatch("Bottom Casing", 1)
+ .addMaintenanceHatch("Bottom Casing", 1)
+ .toolTipFinisher(CORE.GT_Tooltip_Builder);
+ return tt;
+ }
+
+ @Override
+ public String getSound() {
+ return GregTech_API.sSoundList.get(Integer.valueOf(207));
+ }
+
+ @Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+ int aID = TAE.getIndexFromPage(2, 1);
+ if (aSide == aFacing) {
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(aID), new GT_RenderedTexture(aActive ? TexturesGtBlock.Overlay_Machine_Controller_Default_Active : TexturesGtBlock.Overlay_Machine_Controller_Default)};
+ }
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(aID)};
+ }
+
+ @Override
+ public boolean hasSlotInGUI() {
+ return true;
+ }
+
+ @Override
+ public GT_Recipe.GT_Recipe_Map getRecipeMap() {
+ return GTPP_Recipe.GTPP_Recipe_Map.sFlotationCellRecipes;
+ }
+
+ @Override
+ public int getMaxParallelRecipes() {
+ return 1;
+ }
+
+ @Override
+ public int getEuDiscountForParallelism() {
+ return 0;
+ }
+
+ @Override
+ public IStructureDefinition<GregtechMTE_FrothFlotationCell> getStructureDefinition() {
+ if (STRUCTURE_DEFINITION == null) {
+ STRUCTURE_DEFINITION = StructureDefinition.<GregtechMTE_FrothFlotationCell>builder()
+ .addShape(mName, new String[][]{
+ {" ", " ", " X ", " X~X ", " X ", " ", " "},
+ {" ", " F ", " FFF ", " FF FF ", " FFF ", " F ", " "},
+ {" ", " F ", " F F ", " F F ", " F F ", " F ", " "},
+ {" ", " F ", " F F ", " F F ", " F F ", " F ", " "},
+ {" ", " F ", " F F ", " F F ", " F F ", " F ", " "},
+ {" ", " F ", " F F ", " F F ", " F F ", " F ", " "},
+ {" ", " F ", " F F ", " F F ", " F F ", " F ", " "},
+ {" CCC ", " CCCCC ", "CCCCCCC", "CCCCCCC", "CCCCCCC", " CCCCC ", " CCC "},
+ {" CCC ", " CCCCC ", "CCCCCCC", "CCCCCCC", "CCCCCCC", " CCCCC ", " CCC "},
+ })
+ .addElement(
+ 'C',
+ ofChain(
+ ofHatchAdder(
+ GregtechMTE_FrothFlotationCell::addFrothFlotationCellList, TAE.getIndexFromPage(2, 1), 1
+ ),
+ onElementPass(
+ x -> ++x.mCasing,
+ ofBlock(
+ ModBlocks.blockCasings3Misc, 1
+ )
+ )
+ )
+ )
+ .addElement(
+ 'F',
+ ofBlock(
+ ModBlocks.blockSpecialMultiCasings, 9
+ )
+ )
+ .addElement(
+ 'X',
+ ofBlock(
+ ModBlocks.blockCasings3Misc, 1
+ )
+ )
+ .build();
+ }
+ return STRUCTURE_DEFINITION;
+ }
+
+ @Override
+ public void construct(ItemStack stackSize, boolean hintsOnly) {
+ buildPiece(mName , stackSize, hintsOnly, 3, 3, 0);
+ }
+
+ @Override
+ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ mCasing = 0;
+ return checkPiece(mName, 3, 3, 0) && mCasing >= 68 - 4 && checkHatch();
+ }
+
+ public final boolean addFrothFlotationCellList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null) {
+ return false;
+ } else {
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public int getMaxEfficiency(final ItemStack aStack) {
+ return 10000;
+ }
+
+ @Override
+ public int getPollutionPerSecond(final ItemStack aStack) {
+ return CORE.ConfigSwitches.pollutionPerSecondMultiFrothFlotationCell;
+ }
+
+ @Override
+ public int getAmountOfOutputs() {
+ return 1;
+ }
+
+ @Override
+ public boolean explodesOnComponentBreak(final ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public String getCustomGUIResourceName() {
+ return null;
+ }
+
+ @Override
+ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ super.onPostTick(aBaseMetaTileEntity, aTick);
+ }
+
+ @Override
+ public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ super.onPreTick(aBaseMetaTileEntity, aTick);
+ // Fix GT bug
+ if (this.getBaseMetaTileEntity().getFrontFacing() == 0 && this.getBaseMetaTileEntity().getBackFacing() == 1) {
+ log("Fixing Bad Facing. (GT Bug)");
+ this.getBaseMetaTileEntity().setFrontFacing((byte) 1);
+ }
+ }
+
+ @Override
+ public boolean checkRecipe(ItemStack arg0) {
+ return super.checkRecipeGeneric();
+ }
+
+ public boolean checkRecipeGeneric(
+ ItemStack[] aItemInputs, FluidStack[] aFluidInputs,
+ int aMaxParallelRecipes, int aEUPercent,
+ int aSpeedBonusPercent, int aOutputChanceRoll, GT_Recipe aRecipe) {
+ // Based on the Processing Array. A bit overkill, but very flexible.
+
+ // Reset outputs and progress stats
+ this.mEUt = 0;
+ this.mMaxProgresstime = 0;
+ this.mOutputItems = new ItemStack[]{};
+ this.mOutputFluids = new FluidStack[]{};
+
+ long tVoltage = getMaxInputVoltage();
+ byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage));
+ long tEnergy = getMaxInputEnergy();
+ log("Running checkRecipeGeneric(0)");
+
+ GT_Recipe tRecipe = findRecipe(
+ getBaseMetaTileEntity(), mLastRecipe, false,
+ gregtech.api.enums.GT_Values.V[tTier], aFluidInputs, aItemInputs);
+
+ log("Running checkRecipeGeneric(1)");
+ // Remember last recipe - an optimization for findRecipe()
+ this.mLastRecipe = tRecipe;
+
+ if (tRecipe == null) {
+ log("BAD RETURN - 1");
+ return false;
+ }
+
+ /*
+ *
+ * Material Hash checks
+ * Makes sure we can only ever use one type of material in this flotation cell.
+ *
+ */
+ int aExpectedMaterialHash;
+ // Set the hash of expected material type
+ if (mLockedOreType == -1) {
+ mLockedOreType = FlotationRecipeHandler.getHashForMaterial(FlotationRecipeHandler.getMaterialOfMilledProduct(FlotationRecipeHandler.findMilledStack(aRecipe)));
+ }
+ // Set the hash for this recipe check
+ aExpectedMaterialHash = mLockedOreType;
+
+ // Compute hash of current inputs
+ int aFoundMaterialHash = FlotationRecipeHandler.getHashForMaterial(FlotationRecipeHandler.getMaterialOfMilledProduct(FlotationRecipeHandler.findMilledStack(aItemInputs)));
+
+ // Check hashes match
+ if (aExpectedMaterialHash != aFoundMaterialHash) {
+ log("Did not find the correct milled type.");
+ log("Found: "+aFoundMaterialHash);
+ log("Expected: "+mLockedOreType);
+ return false;
+ }
+
+ aMaxParallelRecipes = this.canBufferOutputs(tRecipe, aMaxParallelRecipes);
+ if (aMaxParallelRecipes == 0) {
+ log("BAD RETURN - 2");
+ return false;
+ }
+
+ // EU discount
+ float tRecipeEUt = (tRecipe.mEUt * aEUPercent) / 100.0f;
+ float tTotalEUt = 0.0f;
+
+ int parallelRecipes = 0;
+
+ log("parallelRecipes: "+parallelRecipes);
+ log("aMaxParallelRecipes: "+aMaxParallelRecipes);
+ log("tTotalEUt: "+tTotalEUt);
+ log("tVoltage: "+tVoltage);
+ log("tRecipeEUt: "+tRecipeEUt);
+ // Count recipes to do in parallel, consuming input items and fluids and considering input voltage limits
+ for (; parallelRecipes < aMaxParallelRecipes && tTotalEUt < (tEnergy - tRecipeEUt); parallelRecipes++) {
+ if (!tRecipe.isRecipeInputEqual(true, aFluidInputs, aItemInputs)) {
+ log("Broke at "+parallelRecipes+".");
+ break;
+ }
+ log("Bumped EU from "+tTotalEUt+" to "+(tTotalEUt+tRecipeEUt)+".");
+ tTotalEUt += tRecipeEUt;
+ }
+
+ if (parallelRecipes == 0) {
+ log("BAD RETURN - 3");
+ return false;
+ }
+
+ // -- Try not to fail after this point - inputs have already been consumed! --
+
+
+
+ // Convert speed bonus to duration multiplier
+ // e.g. 100% speed bonus = 200% speed = 100%/200% = 50% recipe duration.
+ aSpeedBonusPercent = Math.max(-99, aSpeedBonusPercent);
+ float tTimeFactor = 100.0f / (100.0f + aSpeedBonusPercent);
+ this.mMaxProgresstime = (int)(tRecipe.mDuration * tTimeFactor);
+
+ this.mEUt = (int)Math.ceil(tTotalEUt);
+
+ this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
+ this.mEfficiencyIncrease = 10000;
+
+ // Overclock
+ if (this.mEUt <= 16) {
+ this.mEUt = (this.mEUt * (1 << tTier - 1) * (1 << tTier - 1));
+ this.mMaxProgresstime = (this.mMaxProgresstime / (1 << tTier - 1));
+ } else {
+ while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) {
+ this.mEUt *= 4;
+ this.mMaxProgresstime /= 2;
+ }
+ }
+
+ if (this.mEUt > 0) {
+ this.mEUt = (-this.mEUt);
+ }
+
+ this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
+
+ // Collect fluid outputs
+ FluidStack[] tOutputFluids = new FluidStack[tRecipe.mFluidOutputs.length];
+ for (int h = 0; h < tRecipe.mFluidOutputs.length; h++) {
+ if (tRecipe.getFluidOutput(h) != null) {
+ tOutputFluids[h] = tRecipe.getFluidOutput(h).copy();
+ tOutputFluids[h].amount *= parallelRecipes;
+ }
+ }
+
+ // Collect output item types
+ ItemStack[] tOutputItems = new ItemStack[tRecipe.mOutputs.length];
+ for (int h = 0; h < tRecipe.mOutputs.length; h++) {
+ if (tRecipe.getOutput(h) != null) {
+ tOutputItems[h] = tRecipe.getOutput(h).copy();
+ tOutputItems[h].stackSize = 0;
+ }
+ }
+
+ // Set output item stack sizes (taking output chance into account)
+ for (int f = 0; f < tOutputItems.length; f++) {
+ if (tRecipe.mOutputs[f] != null && tOutputItems[f] != null) {
+ for (int g = 0; g < parallelRecipes; g++) {
+ if (getBaseMetaTileEntity().getRandomNumber(aOutputChanceRoll) < tRecipe.getOutputChance(f))
+ tOutputItems[f].stackSize += tRecipe.mOutputs[f].stackSize;
+ }
+ }
+ }
+
+ tOutputItems = removeNulls(tOutputItems);
+
+ // Sanitize item stack size, splitting any stacks greater than max stack size
+ List<ItemStack> splitStacks = new ArrayList<ItemStack>();
+ for (ItemStack tItem : tOutputItems) {
+ while (tItem.getMaxStackSize() < tItem.stackSize) {
+ ItemStack tmp = tItem.copy();
+ tmp.stackSize = tmp.getMaxStackSize();
+ tItem.stackSize = tItem.stackSize - tItem.getMaxStackSize();
+ splitStacks.add(tmp);
+ }
+ }
+
+ if (splitStacks.size() > 0) {
+ ItemStack[] tmp = new ItemStack[splitStacks.size()];
+ tmp = splitStacks.toArray(tmp);
+ tOutputItems = ArrayUtils.addAll(tOutputItems, tmp);
+ }
+
+ // Strip empty stacks
+ List<ItemStack> tSList = new ArrayList<ItemStack>();
+ for (ItemStack tS : tOutputItems) {
+ if (tS.stackSize > 0) tSList.add(tS);
+ }
+ tOutputItems = tSList.toArray(new ItemStack[tSList.size()]);
+
+ // Commit outputs
+ this.mOutputItems = tOutputItems;
+ this.mOutputFluids = tOutputFluids;
+ updateSlots();
+
+ // Play sounds (GT++ addition - GT multiblocks play no sounds)
+ startProcess();
+
+ log("GOOD RETURN - 1");
+ return true;
+ }
+
+ /*
+ * Handle NBT
+ */
+
+ private int mLockedOreType = -1;
+
+ @Override
+ public void setItemNBT(NBTTagCompound aNBT) {
+ if (mLockedOreType != -1) {
+ aNBT.setInteger("mLockedOreType", mLockedOreType);
+ }
+ super.setItemNBT(aNBT);
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ super.saveNBTData(aNBT);
+ if (mLockedOreType != -1) {
+ aNBT.setInteger("mLockedOreType", mLockedOreType);
+ }
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ super.loadNBTData(aNBT);
+ mLockedOreType = aNBT.getInteger("mLockedOreType");
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_LargeNaqReactor.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_LargeNaqReactor.java
new file mode 100644
index 0000000000..1ead7edad5
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_LargeNaqReactor.java
@@ -0,0 +1,501 @@
+/*
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production;
+
+import java.util.ArrayList;
+
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.TAE;
+import gregtech.api.enums.Textures.BlockIcons;
+import gregtech.api.gui.GT_GUIContainer_MultiMachine;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.util.minecraft.LangUtils;
+import gtPlusPlus.core.util.minecraft.PlayerUtils;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Naquadah;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.init.Blocks;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.common.util.ForgeDirection;
+
+public class GregtechMTE_LargeNaqReactor extends GregtechMeta_MultiBlockBase {
+
+ public ArrayList<GT_MetaTileEntity_Hatch_Naquadah> mNaqHatches = new ArrayList<GT_MetaTileEntity_Hatch_Naquadah>();
+ public static String[] mCasingName = new String[5];
+ public static String mHatchName = "Naquadah Fuel Hatch";
+
+ private final int CASING_TEXTURE_ID = TAE.getIndexFromPage(0, 13);
+ private final int META_BaseCasing = 0; //4
+ private final int META_ContainmentCasing = 15; //3
+ private final int META_Shielding = 13; //1
+ private final int META_PipeCasing = 1; //4
+ private final int META_IntegralCasing = 6; //0
+ private final int META_ContainmentChamberCasing = 2; //4
+
+ public GregtechMTE_LargeNaqReactor(int aID, String aName, String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ mCasingName[0] = LangUtils.getLocalizedNameOfBlock(getCasing(4), 0);
+ mCasingName[1] = LangUtils.getLocalizedNameOfBlock(getCasing(4), 1);
+ mCasingName[2] = LangUtils.getLocalizedNameOfBlock(getCasing(4), 2);
+ mCasingName[3] = LangUtils.getLocalizedNameOfBlock(getCasing(3), 15);
+ mCasingName[4] = LangUtils.getLocalizedNameOfBlock(getCasing(1), 13);
+ mHatchName = LangUtils.getLocalizedNameOfBlock(GregTech_API.sBlockMachines, 969);
+ }
+
+ public GregtechMTE_LargeNaqReactor(String aName) {
+ super(aName);
+ }
+
+ public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GregtechMTE_LargeNaqReactor(this.mName);
+ }
+
+ public String[] getTooltip() {
+ if (mCasingName[0].toLowerCase().contains(".name")) {
+ mCasingName[0] = LangUtils.getLocalizedNameOfBlock(getCasing(4), 0);
+ }
+ if (mCasingName[1].toLowerCase().contains(".name")) {
+ mCasingName[1] = LangUtils.getLocalizedNameOfBlock(getCasing(4), 1);
+ }
+ if (mCasingName[2].toLowerCase().contains(".name")) {
+ mCasingName[2] = LangUtils.getLocalizedNameOfBlock(getCasing(4), 2);
+ }
+ if (mCasingName[3].toLowerCase().contains(".name")) {
+ mCasingName[3] = LangUtils.getLocalizedNameOfBlock(getCasing(3), 15);
+ }
+ if (mCasingName[4].toLowerCase().contains(".name")) {
+ mCasingName[4] = LangUtils.getLocalizedNameOfBlock(getCasing(1), 13);
+ }
+ if (mHatchName.toLowerCase().contains(".name")) {
+ mHatchName = LangUtils.getLocalizedNameOfBlock(GregTech_API.sBlockMachines, 969);
+ }
+ return new String[]{
+ "Naquadah reacts violently with potassium, ",
+ "resulting in massive explosions with radioactive potential.",
+ "Size: 3x4x12, WxHxL",
+ "Bottom Layer: "+mCasingName[0]+"s, (30x min)",
+ "Middle Layer: "+mCasingName[2]+"s (10x), with",
+ " "+mCasingName[3]+"s on either side",
+ " "+mCasingName[3]+"s also on each end (x26)",
+ "Middle Layer2: "+mCasingName[1]+" (12x total), with",
+ " "+mCasingName[4]+"s on either side (x24)",
+ "Top: Single row of "+mCasingName[0]+" along the middle (x12) ",
+ "",
+ "1x " + mHatchName + " (Any bottom layer casing)",
+ "1x " + "Maintenance Hatch" + " (Any bottom layer side casing)",
+ "1x " + "Energy Hatch" + " (Any top layer casing)",
+
+ };
+ }
+
+ public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex,
+ boolean aActive, boolean aRedstone) {
+ return aSide == aFacing
+ ? new ITexture[]{BlockIcons.getCasingTextureForId(TAE.getIndexFromPage(3, 0)),
+ new GT_RenderedTexture(aActive
+ ? TexturesGtBlock.Overlay_Machine_Controller_Default_Active
+ : TexturesGtBlock.Overlay_Machine_Controller_Default)}
+ : new ITexture[]{BlockIcons.getCasingTextureForId(TAE.getIndexFromPage(3, 0))};
+ }
+
+ public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(),
+ "AssemblyLine.png");
+ }
+
+ public GT_Recipe_Map getRecipeMap() {
+ return null;
+ }
+
+ public boolean isCorrectMachinePart(ItemStack aStack) {
+ return true;
+ }
+
+ public boolean isFacingValid(byte aFacing) {
+ return aFacing == 1;
+ }
+
+ public boolean checkRecipe(ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public int getMaxParallelRecipes() {
+ return 1;
+ }
+
+ @Override
+ public int getEuDiscountForParallelism() {
+ return 0;
+ }
+
+ public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) {
+ super.startSoundLoop(aIndex, aX, aY, aZ);
+ if (aIndex == 20) {
+ GT_Utility.doSoundAtClient((String) GregTech_API.sSoundList.get(Integer.valueOf(212)), 10, 1.0F, aX, aY,
+ aZ);
+ }
+ }
+
+ @Override
+ public String getSound() {
+ return (String) GregTech_API.sSoundList.get(Integer.valueOf(212));
+ }
+
+ private Block getCasing(int casingID) {
+ if (casingID == 1) {
+ return ModBlocks.blockCasingsMisc;
+ }
+ else if (casingID == 2) {
+ return ModBlocks.blockCasings2Misc;
+ }
+ else if (casingID == 3) {
+ return ModBlocks.blockCasings3Misc;
+ }
+ else if (casingID == 4) {
+ return ModBlocks.blockCasings4Misc;
+ }
+ else {
+ return ModBlocks.blockCasingsTieredGTPP;
+ }
+ }
+
+
+
+ //Casing3, Meta 10 - "Grate Machine Casing");
+ //Casing2, Meta 0 - "Solid Steel Machine Casing"
+ //Casing2, Meta 5 - "Assembling Line Casing"
+ //Casing2, Meta 9 - "Assembler Machine Casing"
+ //Magic Glass - blockAlloyGlass
+
+ public boolean checkMultiblock(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 4;
+ int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * 4;
+
+ // Counts for all Casing Types
+ int aBaseCasingCount = 0;
+ int aContainmentCasingCount = 0;
+ int aShieldingCount = 0;
+ int aPipeCount = 0;
+ int aIntegralCasingCount = 0;
+ int aContainmentChamberCount = 0;
+
+ // Bottom Layer
+ aBaseCasingCount += checkEntireLayer(aBaseMetaTileEntity, getCasing(4), META_BaseCasing, -7, xDir, zDir);
+ log("Bottom Layer is Valid. Moving to Layer 1.");
+
+ // Layer 1
+ aShieldingCount += checkOuterRing(aBaseMetaTileEntity, getCasing(1), this.META_Shielding, -6, xDir, zDir);
+ aIntegralCasingCount += checkIntegralRing(aBaseMetaTileEntity, getCasing(0), this.META_IntegralCasing, -6, xDir, zDir);
+ aContainmentChamberCount += checkContainmentRing(aBaseMetaTileEntity, getCasing(4), this.META_ContainmentChamberCasing, -6, xDir, zDir);
+ log("Layer 1 is Valid. Moving to Layer 2.");
+
+ // Layer 2
+ aShieldingCount += checkOuterRing(aBaseMetaTileEntity, getCasing(1), this.META_Shielding, -5, xDir, zDir);
+ aPipeCount += checkPipes(aBaseMetaTileEntity, getCasing(4), this.META_PipeCasing, -5, xDir, zDir);
+ log("Layer 2 is Valid. Moving to Layer 3.");
+
+ // Layer 3
+ aContainmentCasingCount += checkOuterRing(aBaseMetaTileEntity, getCasing(3), this.META_ContainmentCasing, -4, xDir, zDir);
+ aPipeCount += checkPipes(aBaseMetaTileEntity, getCasing(4), this.META_PipeCasing, -4, xDir, zDir);
+ log("Layer 3 is Valid. Moving to Layer 4.");
+
+ // Layer 4
+ aContainmentCasingCount += checkOuterRing(aBaseMetaTileEntity, getCasing(3), this.META_ContainmentCasing, -3, xDir, zDir);
+ aPipeCount += checkPipes(aBaseMetaTileEntity, getCasing(4), this.META_PipeCasing, -3, xDir, zDir);
+ log("Layer 4 is Valid. Moving to Layer 5.");
+
+ // Layer 5
+ aShieldingCount += checkOuterRing(aBaseMetaTileEntity, getCasing(1), this.META_Shielding, -2, xDir, zDir);
+ aPipeCount += checkPipes(aBaseMetaTileEntity, getCasing(4), this.META_PipeCasing, -2, xDir, zDir);
+ log("Layer 5 is Valid. Moving to Layer 6.");
+
+ // Layer 6
+ aShieldingCount += checkOuterRing(aBaseMetaTileEntity, getCasing(1), this.META_Shielding, -1, xDir, zDir);
+ aIntegralCasingCount += checkIntegralRing(aBaseMetaTileEntity, getCasing(0), this.META_IntegralCasing, -1, xDir, zDir);
+ aContainmentChamberCount += checkContainmentRing(aBaseMetaTileEntity, getCasing(4), this.META_ContainmentChamberCasing, -1, xDir, zDir);
+ log("Layer 6 is Valid. Moving to Top Layer.");
+
+ // Top Layer
+ aBaseCasingCount += checkEntireLayer(aBaseMetaTileEntity, getCasing(4), META_BaseCasing, 0, xDir, zDir);
+
+ log("Found "+aBaseCasingCount+" "+mCasingName[0]+"s");
+ log("Found "+aShieldingCount+" "+mCasingName[4]+"s");
+ log("Found "+aPipeCount+" "+mCasingName[1]+"s");
+ log("Found "+aContainmentCasingCount+" "+mCasingName[3]+"s");
+ log("Found "+aIntegralCasingCount+" "+LangUtils.getLocalizedNameOfBlock(getCasing(0), 6)+"s");
+ log("Found "+aContainmentChamberCount+" "+mCasingName[2]+"s");
+
+ // Try mesage player
+ String aOwnerName = this.getBaseMetaTileEntity().getOwnerName();
+ EntityPlayer aOwner = null;
+ if (aOwnerName != null && aOwnerName.length() > 0) {
+ aOwner = PlayerUtils.getPlayer(aOwnerName);
+ }
+
+ if (aShieldingCount != 128) {
+ log("Not enough "+mCasingName[4]+"s, require 128.");
+ if (aOwner != null) {
+ PlayerUtils.messagePlayer(aOwner, "Not enough "+mCasingName[4]+"s, require 128.");
+ }
+ return false;
+ }
+ if (aPipeCount != 20) {
+ log("Not enough "+mCasingName[1]+"s, require 20.");
+ if (aOwner != null) {
+ PlayerUtils.messagePlayer(aOwner, "Not enough "+mCasingName[1]+"s, require 20.");
+ }
+ return false;
+ }
+ if (aContainmentCasingCount != 64) {
+ log("Not enough "+mCasingName[3]+"s, require 64.");
+ if (aOwner != null) {
+ PlayerUtils.messagePlayer(aOwner, "Not enough "+mCasingName[3]+"s, require 64.");
+ }
+ return false;
+ }
+ if (aContainmentChamberCount != 42) {
+ log("Not enough "+mCasingName[2]+"s, require 42.");
+ if (aOwner != null) {
+ PlayerUtils.messagePlayer(aOwner, "Not enough "+mCasingName[2]+"s, require 42.");
+ }
+ return false;
+ }
+ if (aBaseCasingCount < 140) {
+ log("Not enough "+mCasingName[0]+"s, require 140 at a minimum.");
+ if (aOwner != null) {
+ PlayerUtils.messagePlayer(aOwner, "Not enough "+mCasingName[0]+"s, require 140 at a minimum.");
+ }
+ return false;
+ }
+ if (aIntegralCasingCount != 48) {
+ log("Not enough "+LangUtils.getLocalizedNameOfBlock(getCasing(0), 6)+"s, require 48.");
+ if (aOwner != null) {
+ PlayerUtils.messagePlayer(aOwner, "Not enough "+LangUtils.getLocalizedNameOfBlock(getCasing(0), 6)+"s, require 48.");
+ }
+ return false;
+ }
+ log("LNR Formed.");
+ if (aOwner != null) {
+ PlayerUtils.messagePlayer(aOwner, "Large Naquadah Reactor has formed successfully.");
+ }
+ return true;
+ }
+
+ public boolean addNaquadahHatchToMachineInput(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null) {
+ return false;
+ } else {
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity == null) {
+ return false;
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Naquadah) {
+ this.updateTexture(aMetaTileEntity, aBaseCasingIndex);
+ return this.mNaqHatches.add((GT_MetaTileEntity_Hatch_Naquadah) aMetaTileEntity);
+ } else {
+ return false;
+ }
+ }
+ }
+
+ public int checkEntireLayer(IGregTechTileEntity aBaseMetaTileEntity, Block aBlock, int aMeta, int aY, int xDir, int zDir) {
+ int aCasingCount = 0;
+ for (int x = -4; x < 5; x++) {
+ for (int z = -4; z < 5; z++) {
+ int aOffsetX = this.getBaseMetaTileEntity().getXCoord() + x;
+ int aOffsetY = this.getBaseMetaTileEntity().getYCoord() + aY;
+ int aOffsetZ = this.getBaseMetaTileEntity().getZCoord() + z;
+ //Skip the corners
+ if ((x == 4 && z == 4) || (x == -4 && z == -4) || (x == 4 && z == -4) || (x == -4 && z == 4)) {
+ continue;
+ }
+ // Skip controller
+ if (aY == 0 && x == 0 && z == 0) {
+ continue;
+ }
+
+ Block aCurrentBlock = aBaseMetaTileEntity.getBlockOffset(xDir + x, aY, zDir + z);
+ int aCurrentMeta = (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + x, aY, zDir + z);
+ if (aCurrentBlock == aBlock && aCurrentMeta == aMeta) {
+ aCasingCount++;
+ }
+ final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + x, aY, zDir + z);
+ if (!isValidBlockForStructure(tTileEntity, CASING_TEXTURE_ID, true, aCurrentBlock, aCurrentMeta, aBlock, aMeta)) {
+ log("Layer has error. Height: "+aY);
+ //this.getBaseMetaTileEntity().getWorld().setBlock(aOffsetX, aOffsetY, aOffsetZ, aBlock, aMeta, 3);
+ return 0;
+ }
+ }
+ }
+ return aCasingCount;
+ }
+
+ public int checkOuterRing(IGregTechTileEntity aBaseMetaTileEntity, Block aBlock, int aMeta, int aY, int xDir, int zDir) {
+ int aCasingCount = 0;
+ for (int x = -4; x < 5; x++) {
+ for (int z = -4; z < 5; z++) {
+ int aOffsetX = this.getBaseMetaTileEntity().getXCoord() + x;
+ int aOffsetY = this.getBaseMetaTileEntity().getYCoord() + aY;
+ int aOffsetZ = this.getBaseMetaTileEntity().getZCoord() + z;
+ //Skip the corners
+ if ((x == 4 && z == 4) || (x == -4 && z == -4) || (x == 4 && z == -4) || (x == -4 && z == 4)) {
+ continue;
+ }
+
+ // If we are on the 5x5 ring, proceed
+ if ((x > -4 && x < 4 ) && (z > -4 && z < 4)) {
+ if ((x == 3 && z == 3) || (x == -3 && z == -3) || (x == 3 && z == -3) || (x == -3 && z == 3)) {
+ //this.getBaseMetaTileEntity().getWorld().setBlock(aOffsetX, aOffsetY, aOffsetZ, aBlock, aMeta, 3);
+ }
+ else {
+ continue;
+ }
+ }
+
+ Block aCurrentBlock = aBaseMetaTileEntity.getBlockOffset(xDir + x, aY, zDir + z);
+ int aCurrentMeta = (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + x, aY, zDir + z);
+ if (aCurrentBlock == aBlock && aCurrentMeta == aMeta) {
+ aCasingCount++;
+ }
+ final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + x, aY, zDir + z);
+ if (!isValidBlockForStructure(tTileEntity, CASING_TEXTURE_ID, false, aCurrentBlock, aCurrentMeta, aBlock, aMeta)) {
+ log("Layer has error. Height: "+aY);
+ //this.getBaseMetaTileEntity().getWorld().setBlock(aOffsetX, aOffsetY, aOffsetZ, aBlock, aMeta, 3);
+ return 0;
+ }
+ }
+ }
+ return aCasingCount;
+ }
+ public int checkIntegralRing(IGregTechTileEntity aBaseMetaTileEntity, Block aBlock, int aMeta, int aY, int xDir, int zDir) {
+ int aCasingCount = 0;
+ for (int x = -3; x < 4; x++) {
+ for (int z = -3; z < 4; z++) {
+ int aOffsetX = this.getBaseMetaTileEntity().getXCoord() + x;
+ int aOffsetY = this.getBaseMetaTileEntity().getYCoord() + aY;
+ int aOffsetZ = this.getBaseMetaTileEntity().getZCoord() + z;
+ //Skip the corners
+ if ((x == 3 && z == 3) || (x == -3 && z == -3) || (x == 3 && z == -3) || (x == -3 && z == 3)) {
+ continue;
+ }
+
+ // If we are on the 5x5 ring, proceed
+ if ((x > -3 && x < 3 ) && (z > -3 && z < 3)) {
+ if ((x == 2 && z == 2) || (x == -2 && z == -2) || (x == 2 && z == -2) || (x == -2 && z == 2)) {
+ //this.getBaseMetaTileEntity().getWorld().setBlock(aOffsetX, aOffsetY, aOffsetZ, aBlock, aMeta, 3);
+ }
+ else {
+ continue;
+ }
+ }
+
+ Block aCurrentBlock = aBaseMetaTileEntity.getBlockOffset(xDir + x, aY, zDir + z);
+ int aCurrentMeta = (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + x, aY, zDir + z);
+ if (aCurrentBlock == aBlock && aCurrentMeta == aMeta) {
+ aCasingCount++;
+ }
+ final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + x, aY, zDir + z);
+ if (!isValidBlockForStructure(tTileEntity, CASING_TEXTURE_ID, false, aCurrentBlock, aCurrentMeta, aBlock, aMeta)) {
+ log("Layer has error. Height: "+aY);
+ //this.getBaseMetaTileEntity().getWorld().setBlock(aOffsetX, aOffsetY, aOffsetZ, aBlock, aMeta, 3);
+ return 0;
+ }
+ }
+ }
+ return aCasingCount;
+ }
+
+ public int checkPipes(IGregTechTileEntity aBaseMetaTileEntity, Block aBlock, int aMeta, int aY, int xDir, int zDir) {
+ int aCasingCount = 0;
+ for (int x = -1; x < 2; x++) {
+ for (int z = -1; z < 2; z++) {
+ int aOffsetX = this.getBaseMetaTileEntity().getXCoord() + x;
+ int aOffsetY = this.getBaseMetaTileEntity().getYCoord() + aY;
+ int aOffsetZ = this.getBaseMetaTileEntity().getZCoord() + z;
+ //Skip the corners
+ if ((x == 1 && z == 1) || (x == -1 && z == -1) || (x == 1 && z == -1) || (x == -1 && z == 1) || (x == 0 && z == 0)) {
+ Block aCurrentBlock = aBaseMetaTileEntity.getBlockOffset(xDir + x, aY, zDir + z);
+ int aCurrentMeta = (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + x, aY, zDir + z);
+ if (aCurrentBlock == aBlock && aCurrentMeta == aMeta) {
+ aCasingCount++;
+ }
+ final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + x, aY, zDir + z);
+ if (!isValidBlockForStructure(tTileEntity, CASING_TEXTURE_ID, false, aCurrentBlock, aCurrentMeta, aBlock, aMeta)) {
+ log("Pipe has error. Height: "+aY);
+ //this.getBaseMetaTileEntity().getWorld().setBlock(aOffsetX, aOffsetY, aOffsetZ, aBlock, aMeta, 3);
+ return 0;
+ };
+ }
+ }
+ }
+ return aCasingCount;
+ }
+
+ public int checkContainmentRing(IGregTechTileEntity aBaseMetaTileEntity, Block aBlock, int aMeta, int aY, int xDir, int zDir) {
+ int aCasingCount = 0;
+ for (int x = -2; x < 3; x++) {
+ for (int z = -2; z < 3; z++) {
+ int aOffsetX = this.getBaseMetaTileEntity().getXCoord() + x;
+ int aOffsetY = this.getBaseMetaTileEntity().getYCoord() + aY;
+ int aOffsetZ = this.getBaseMetaTileEntity().getZCoord() + z;
+ //Skip the corners
+ if ((x == 2 && z == 2) || (x == -2 && z == -2) || (x == 2 && z == -2) || (x == -2 && z == 2)) {
+ continue;
+ }
+
+ Block aCurrentBlock = aBaseMetaTileEntity.getBlockOffset(xDir + x, aY, zDir + z);
+ int aCurrentMeta = (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + x, aY, zDir + z);
+ if (aCurrentBlock == aBlock && aCurrentMeta == aMeta) {
+ aCasingCount++;
+ }
+ final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + x, aY, zDir + z);
+ if (!isValidBlockForStructure(tTileEntity, CASING_TEXTURE_ID, false, aCurrentBlock, aCurrentMeta, aBlock, aMeta)) {
+ log("Layer has error. Height: "+aY);
+ //this.getBaseMetaTileEntity().getWorld().setBlock(aOffsetX, aOffsetY, aOffsetZ, aBlock, aMeta, 3);
+ return 0;
+ }
+ }
+ }
+ return aCasingCount;
+ }
+
+ public int getMaxEfficiency(ItemStack aStack) {
+ return 10000;
+ }
+
+ public int getPollutionPerTick(ItemStack aStack) {
+ return 133;
+ }
+
+ public int getDamageToComponent(ItemStack aStack) {
+ return 0;
+ }
+
+ public boolean explodesOnComponentBreak(ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public boolean hasSlotInGUI() {
+ return true;
+ }
+
+ @Override
+ public String getCustomGUIResourceName() {
+ return null;
+ }
+
+ @Override
+ public String getMachineType() {
+ return "Reactor";
+ }
+}*/
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_MiniFusionPlant.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_MiniFusionPlant.java
new file mode 100644
index 0000000000..9c2e3289c3
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_MiniFusionPlant.java
@@ -0,0 +1,386 @@
+/*
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production;
+
+import java.util.ArrayList;
+
+import gregtech.api.enums.GT_Values;
+import gregtech.api.enums.TAE;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.MetaTileEntity;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_Utility;
+import gregtech.api.util.GTPP_Recipe;
+import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.api.objects.data.AutoMap;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_ControlCore;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Plasma;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.FluidStack;
+
+public class GregtechMTE_MiniFusionPlant extends GregtechMeta_MultiBlockBase {
+
+ public long currentVoltage = GT_Values.V[7];
+ public byte currentTier = 8;
+
+ public void upvolt() {
+ byte f = currentTier;
+ if ((f+1) > 10) {
+ f = 8;
+ }
+ else {
+ f++;
+ }
+ this.currentTier = f;
+ updateVoltage();
+ }
+
+ public void downvolt() {
+ byte f = currentTier;
+ if ((f-1) < 8) {
+ f = 10;
+ }
+ else {
+ f--;
+ }
+ this.currentTier = f;
+ updateVoltage();
+ }
+
+ private long updateVoltage() {
+ this.currentVoltage = GT_Values.V[this.currentTier-1];
+ return currentVoltage;
+ }
+
+ public GregtechMTE_MiniFusionPlant(String aName) {
+ super(aName);
+ }
+
+ public GregtechMTE_MiniFusionPlant(int aID, String aName, String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ }
+
+ @Override
+ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GregtechMTE_MiniFusionPlant(this.mName);
+ }
+
+ @Override
+ public boolean isCorrectMachinePart(ItemStack aStack) {
+ return true;
+ }
+
+ @Override
+ public int getDamageToComponent(ItemStack aStack) {
+ return 0;
+ }
+
+ @Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing,
+ final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+ if (aSide == this.getBaseMetaTileEntity().getBackFacing()) {
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(TAE.GTPP_INDEX(10)),
+ Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI[(int) this.getInputTier()]};
+ }
+ if (aSide == 1) {
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(TAE.GTPP_INDEX(10)),
+ Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[(int) this.getOutputTier()]};
+ }
+ if (aSide == aFacing) {
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(TAE.GTPP_INDEX(10)),
+ new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_DISASSEMBLER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_DISASSEMBLER)};
+ }
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(TAE.GTPP_INDEX(10))};
+ }
+
+
+ @Override
+ public GT_Recipe.GT_Recipe_Map getRecipeMap() {
+ return GTPP_Recipe.GTPP_Recipe_Map.sSlowFusionRecipes;
+ }
+
+ @Override
+ public boolean hasSlotInGUI() {
+ return false;
+ }
+
+ @Override
+ public String getCustomGUIResourceName() {
+ return null;
+ }
+
+ @Override
+ public String getMachineType() {
+ return "Fusion Reactor";
+ }
+
+ @Override
+ public String[] getTooltip() {
+ return new String[] {
+ "Small scale fusion",
+ "16x slower than using Multiblock of the same voltage",
+ //"Input voltage can be changed within the GUI",
+ "Place Input/Output Hatches on sides and bottom",
+ "Power can only be inserted into the back",
+ //e"Power can only be extracted from the top",
+ TAG_HIDE_HATCHES
+ };
+ }
+
+ @Override
+ public int getMaxParallelRecipes() {
+ return 1;
+ }
+
+ @Override
+ public int getEuDiscountForParallelism() {
+ return 0;
+ }
+
+ @Override
+ public boolean checkMultiblock(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX;
+ int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ;
+ int xDir2 = ForgeDirection.getOrientation(aBaseMetaTileEntity.getFrontFacing()).offsetX;
+ int zDir2 = ForgeDirection.getOrientation(aBaseMetaTileEntity.getFrontFacing()).offsetZ;
+ int tAmount = 0;
+
+ ForgeDirection aDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing());
+
+ //Require air in front, I think
+ if (!aBaseMetaTileEntity.getAirOffset(xDir2, 0, zDir2)) {
+ Logger.INFO("Did not find air in front");
+ return false;
+ } else {
+ for (int i = -1; i < 2; ++i) {
+ for (int j = -1; j < 2; ++j) {
+ for (int h = -1; h < 2; ++h) {
+ if (h != 0 || (xDir + i != 0 || zDir + j != 0) && (i != 0 || j != 0)) {
+ IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i,
+ h, zDir + j);
+ if (this.addToMachineList(tTileEntity, TAE.GTPP_INDEX(10))) {
+ tAmount++;
+ }
+ }
+ }
+ }
+ }
+ }
+ Logger.INFO("Tanks found: "+tAmount);
+ return tAmount == 3;
+ }
+
+ @Override
+ public boolean checkRecipe(ItemStack arg0) {
+
+
+ ArrayList tFluidList = this.getStoredFluids();
+ int tFluidList_sS = tFluidList.size();
+
+ for (int tFluids = 0; tFluids < tFluidList_sS - 1; ++tFluids) {
+ for (int tRecipe = tFluids + 1; tRecipe < tFluidList_sS; ++tRecipe) {
+ if (GT_Utility.areFluidsEqual((FluidStack) tFluidList.get(tFluids),
+ (FluidStack) tFluidList.get(tRecipe))) {
+ if (((FluidStack) tFluidList.get(tFluids)).amount < ((FluidStack) tFluidList.get(tRecipe)).amount) {
+ tFluidList.remove(tFluids--);
+ tFluidList_sS = tFluidList.size();
+ break;
+ }
+
+ tFluidList.remove(tRecipe--);
+ tFluidList_sS = tFluidList.size();
+ }
+ }
+ }
+ int aStep = 0;
+ //Logger.INFO("Step "+aStep++);
+ if (tFluidList.size() > 1) {
+ //Logger.INFO("Step "+aStep++);
+ FluidStack[] arg5 = (FluidStack[]) tFluidList.toArray(new FluidStack[tFluidList.size()]);
+ GT_Recipe arg6 = getRecipeMap().findRecipe(this.getBaseMetaTileEntity(), this.mLastRecipe,
+ false, this.getMaxInputVoltage(), arg5, new ItemStack[0]);
+ if (arg6 == null && !this.mRunningOnLoad || (arg6 != null && this.maxEUStore() < (long) arg6.mSpecialValue)) {
+ //Logger.INFO("Bad Step "+aStep++);
+ //this.turnCasingActive(false);
+ this.mLastRecipe = null;
+ return false;
+ }
+ //Logger.INFO("Step "+aStep++);
+
+ if (this.mRunningOnLoad || (arg6 != null && arg6.isRecipeInputEqual(true, arg5, new ItemStack[0]))) {
+ //Logger.INFO("Step "+aStep++);
+ this.mLastRecipe = arg6;
+ this.mEUt = this.mLastRecipe.mEUt * 1;
+ this.mMaxProgresstime = this.mLastRecipe.mDuration / 1;
+ this.mEfficiencyIncrease = 10000;
+ this.mOutputFluids = this.mLastRecipe.mFluidOutputs;
+ //this.turnCasingActive(true);
+ this.mRunningOnLoad = false;
+ return true;
+ }
+ //Logger.INFO("Step "+aStep++);
+ }
+ //Logger.INFO("Step "+aStep++);
+
+ return false;
+
+
+
+
+ //return this.checkRecipeGeneric(this.getMaxParallelRecipes(), getEuDiscountForParallelism(), 0);
+ }
+
+ @Override
+ public int getMaxEfficiency(ItemStack arg0) {
+ return 10000;
+ }
+
+ @Override
+ public boolean drainEnergyInput(long aEU) {
+ // Not applicable to this machine
+ return true;
+ }
+
+ @Override
+ public boolean addEnergyOutput(long aEU) {
+ // Not applicable to this machine
+ return true;
+ }
+
+ @Override
+ public long maxEUStore() {
+ return this.getMaxInputVoltage() * 256 * 512;
+ }
+
+ @Override
+ public long getMinimumStoredEU() {
+ return 0;
+ }
+
+ @Override
+ public String[] getExtraInfoData() {
+ String mode = EnumChatFormatting.BLUE + "" + currentVoltage + EnumChatFormatting.RESET;
+ String aOutput = EnumChatFormatting.BLUE + "" + mEUt + EnumChatFormatting.RESET;
+ String storedEnergyText;
+ if (this.getEUVar() > maxEUStore()) {
+ storedEnergyText = EnumChatFormatting.RED + GT_Utility.formatNumbers(this.getEUVar()) + EnumChatFormatting.RESET;
+ } else {
+ storedEnergyText = EnumChatFormatting.GREEN + GT_Utility.formatNumbers(this.getEUVar()) + EnumChatFormatting.RESET;
+ }
+
+ return new String[]{
+ "Stored EU: " + storedEnergyText,
+ "Capacity: " + EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(this.maxEUStore()) + EnumChatFormatting.RESET,
+ "Voltage: " + mode,
+ "Output Voltage: " + aOutput
+ };
+ }
+
+ @Override
+ public void explodeMultiblock() {
+ super.explodeMultiblock();
+ }
+
+ @Override
+ public void doExplosion(long aExplosionPower) {
+ super.doExplosion(aExplosionPower);
+ }
+
+ @Override
+ public long getMaxInputVoltage() {
+ return updateVoltage();
+ }
+
+ @Override
+ public long getInputTier() {
+ return (long) GT_Utility.getTier(maxEUInput());
+ }
+
+ @Override
+ public boolean isElectric() {
+ return true;
+ }
+
+ @Override
+ public boolean isEnetInput() {
+ return true;
+ }
+
+ @Override
+ public boolean isEnetOutput() {
+ return false;
+ }
+
+ @Override
+ public boolean isInputFacing(byte aSide) {
+ return (aSide == this.getBaseMetaTileEntity().getBackFacing());
+ }
+
+ @Override
+ public boolean isOutputFacing(byte aSide) {
+ return aSide == 1;
+ }
+
+ @Override
+ public long maxAmperesIn() {
+ return 32;
+ }
+
+ @Override
+ public long maxAmperesOut() {
+ return 1;
+ }
+
+ @Override
+ public long maxEUInput() {
+ return updateVoltage();
+ }
+
+ @Override
+ public long maxEUOutput() {
+ return mEUt > 0 ? mEUt : 0;
+ }
+
+ @Override
+ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ super.onPostTick(aBaseMetaTileEntity, aTick);
+ this.mWrench = true;
+ this.mScrewdriver = true;
+ this.mSoftHammer = true;
+ this.mHardHammer = true;
+ this.mSolderingTool = true;
+ this.mCrowbar = true;
+ }
+
+ @Override
+ public boolean causeMaintenanceIssue() {
+ return true;
+ }
+
+ @Override
+ public int getControlCoreTier() {
+ return this.currentTier;
+ }
+
+ @Override
+ public int getPollutionPerTick(ItemStack arg0) {
+ return 0;
+ }
+
+ @Override
+ public GT_MetaTileEntity_Hatch_ControlCore getControlCoreBus() {
+ GT_MetaTileEntity_Hatch_ControlCore x = new GT_MetaTileEntity_Hatch_ControlCore("", 0, "", null);
+ return (GT_MetaTileEntity_Hatch_ControlCore) x;
+ }
+
+}
+*/
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_NuclearReactor.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_NuclearReactor.java
new file mode 100644
index 0000000000..1f6ae41be2
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_NuclearReactor.java
@@ -0,0 +1,523 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production;
+
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
+
+import java.util.Collection;
+
+import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
+import com.gtnewhorizon.structurelib.structure.StructureDefinition;
+
+import gregtech.api.enums.TAE;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.MetaTileEntity;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Dynamo;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Maintenance;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output;
+import gregtech.api.objects.GT_ItemStack;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GTPP_Recipe.GTPP_Recipe_Map;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.material.ELEMENT;
+import gtPlusPlus.core.material.nuclear.NUCLIDE;
+import gtPlusPlus.core.util.math.MathUtils;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraftforge.fluids.FluidStack;
+
+public class GregtechMTE_NuclearReactor extends GregtechMeta_MultiBlockBase<GregtechMTE_NuclearReactor> {
+
+ protected int mFuelRemaining = 0;
+
+ private int mCasing;
+ private IStructureDefinition<GregtechMTE_NuclearReactor> STRUCTURE_DEFINITION = null;
+
+
+ public GregtechMTE_NuclearReactor(final int aID, final String aName, final String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ }
+
+ public GregtechMTE_NuclearReactor(final String aName) {
+ super(aName);
+ }
+
+ @Override
+ public long maxEUStore() {
+ return (640000000L * (Math.min(16, this.mEnergyHatches.size()))) / 16L;
+ }
+
+ @Override
+ public String getMachineType() {
+ return "Reactor";
+ }
+
+ @Override
+ public GT_Recipe_Map getRecipeMap() {
+ return GTPP_Recipe_Map.sLiquidFluorineThoriumReactorRecipes;
+ }
+
+ @Override
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
+ GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType(getMachineType())
+ .addInfo("Controller Block for the Liquid Fluoride Thorium Reactor.")
+ .addInfo("Produces Heat & Energy from Radioactive Beta Decay.")
+ .addInfo("Outputs U233 every 10 seconds, on average")
+ .addInfo("Input Fluorine and Helium for bonus byproducts")
+ .addInfo("Input Li2BeF4 and a molten salt as fuel.")
+ .addInfo("LiFBeF2ThF4UF4, LiFBeF2ZrF4UF4 or LiFBeF2ZrF4U235")
+ .addPollutionAmount(getPollutionPerSecond(null))
+ .addSeparator()
+ .beginStructureBlock(7, 4, 7, true)
+ .addController("Bottom Center")
+ .addCasingInfo("Hastelloy-N Reactor Casing", 27)
+ .addCasingInfo("Zeron-100 Reactor Shielding", 26)
+ .addInputHatch("Top or bottom layer edges", 1)
+ .addOutputHatch("Top or bottom layer edges", 1)
+ .addDynamoHatch("Top or bottom layer edges", 1)
+ .addMaintenanceHatch("Top or bottom layer edges", 1)
+ .addMufflerHatch("Top 3x3", 2)
+ .addStructureInfo("All dynamos must be IV or LuV tier.")
+ .addStructureInfo("All other hatches must be IV+ tier.")
+ .addStructureInfo("3x Output Hatches, 2x Input Hatches, 4x Dynamo Hatches")
+ .addStructureInfo("2x Maintenance Hatches, 4x Mufflers")
+ .toolTipFinisher(CORE.GT_Tooltip_Builder);
+ return tt;
+ }
+
+ @Override
+ public String[] getExtraInfoData() {
+ final String tRunning = (this.mMaxProgresstime>0 ? "Reactor running":"Reactor stopped");
+ final String tMaintainance = (this.getIdealStatus() == this.getRepairStatus() ? "No Maintainance issues" : "Needs Maintainance");
+
+ return new String[]{
+ "Liquid Fluoride Thorium Reactor",
+ tRunning,
+ tMaintainance,
+ "Current Output: "+this.mEUt+" EU/t",
+ "Fuel Remaining: "+this.mFuelRemaining+" Litres",
+ "Current Efficiency: "+(this.mEfficiency/5)+"%",
+ "Current Efficiency (Raw): "+(this.mEfficiency),
+ "It requires you to have 100% Efficiency."};
+ }
+
+ @Override
+ public boolean allowCoverOnSide(final byte aSide, final GT_ItemStack aStack) {
+ return aSide != this.getBaseMetaTileEntity().getFrontFacing();
+ }
+
+ @Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+ boolean aWarmedUp = this.mEfficiency == this.getMaxEfficiency(null);
+ if (!aBaseMetaTileEntity.isActive() || !aWarmedUp){
+ if (aSide == aFacing) {
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(TAE.GTPP_INDEX(12)),
+ new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_REPLICATOR_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_REPLICATOR)};
+ }
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(TAE.GTPP_INDEX(12))};
+ }
+ else if(aBaseMetaTileEntity.isActive() && aWarmedUp){
+ if (aSide == aFacing) {
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(TAE.GTPP_INDEX(13)),
+ new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_REPLICATOR_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_REPLICATOR)};
+ }
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(TAE.GTPP_INDEX(13))};
+ }
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(TAE.GTPP_INDEX(12))};
+
+ }
+
+ @Override
+ public boolean hasSlotInGUI() {
+ return false;
+ }
+
+ @Override
+ public String getCustomGUIResourceName() {
+ return "MatterFabricator";
+ }
+
+ public final boolean addNuclearReactorEdgeList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null) {
+ return false;
+ } else {
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Dynamo && (((GT_MetaTileEntity_Hatch_Dynamo) aMetaTileEntity).mTier >= 5 && ((GT_MetaTileEntity_Hatch_Dynamo) aMetaTileEntity).mTier <= 6)){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input && ((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity).mTier >= 5) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output && ((GT_MetaTileEntity_Hatch_Output) aMetaTileEntity).mTier >= 5) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ }
+ return false;
+ }
+
+ public final boolean addNuclearReactorTopList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null) {
+ return false;
+ } else {
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler && ((GT_MetaTileEntity_Hatch_Muffler) aMetaTileEntity).mTier >= 5) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public IStructureDefinition<GregtechMTE_NuclearReactor> getStructureDefinition() {
+ if (STRUCTURE_DEFINITION == null) {
+ STRUCTURE_DEFINITION = StructureDefinition.<GregtechMTE_NuclearReactor>builder()
+ .addShape(mName, transpose(new String[][]{
+ {"CCCCCCC", "COOOOOC", "COXXXOC", "COXXXOC", "COXXXOC", "COOOOOC", "CCCCCCC"},
+ {"GGGGGGG", "G-----G", "G-----G", "G-----G", "G-----G", "G-----G", "GGGGGGG"},
+ {"GGGGGGG", "G-----G", "G-----G", "G-----G", "G-----G", "G-----G", "GGGGGGG"},
+ {"CCC~CCC", "COOOOOC", "COOOOOC", "COOOOOC", "COOOOOC", "COOOOOC", "CCCCCCC"},
+ }))
+ .addElement(
+ 'C',
+ ofChain(
+ ofHatchAdder(
+ GregtechMTE_NuclearReactor::addNuclearReactorEdgeList, TAE.GTPP_INDEX(12), 1
+ ),
+ onElementPass(
+ x -> ++x.mCasing,
+ ofBlock(
+ ModBlocks.blockCasingsMisc, 12
+ )
+ )
+ )
+ )
+ .addElement(
+ 'X',
+ ofChain(
+ ofHatchAdder(
+ GregtechMTE_NuclearReactor::addNuclearReactorTopList, TAE.GTPP_INDEX(12), 2
+ ),
+ onElementPass(
+ x -> ++x.mCasing,
+ ofBlock(
+ ModBlocks.blockCasingsMisc, 12
+ )
+ )
+ )
+ )
+ .addElement(
+ 'O',
+ ofBlock(
+ ModBlocks.blockCasingsMisc, 12
+ )
+ )
+ .addElement(
+ 'G',
+ ofBlock(
+ ModBlocks.blockCasingsMisc, 13
+ )
+ )
+ .build();
+ }
+ return STRUCTURE_DEFINITION;
+ }
+
+ @Override
+ public void construct(ItemStack stackSize, boolean hintsOnly) {
+ buildPiece(mName , stackSize, hintsOnly, 3, 3, 0);
+ }
+
+ @Override
+ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ mCasing = 0;
+ if (checkPiece(mName, 3, 3, 0) && mCasing >= 27) {
+ if (mOutputHatches.size() >= 3 && mInputHatches.size() >= 2 && mDynamoHatches.size() == 4 &&
+ mMufflerHatches.size() == 4 && mMaintenanceHatches.size() == 2) {
+ this.mWrench = true;
+ this.mScrewdriver = true;
+ this.mSoftHammer = true;
+ this.mHardHammer = true;
+ this.mSolderingTool = true;
+ this.mCrowbar = true;
+ this.turnCasingActive(false);
+ return true;
+ }
+ }
+ return false;
+ }
+
+ // Alk's Life Lessons from Greg.
+ /*
+ [23:41:15] <GregoriusTechneticies> xdir and zdir are x2 and not x3
+ [23:41:26] <GregoriusTechneticies> thats you issue
+ [23:44:33] <Alkalus> mmm?
+ [23:44:49] <Alkalus> Should they be x3?
+ [23:44:50] <GregoriusTechneticies> you just do a x2, what is for a 5x5 multiblock
+ [23:45:01] <GregoriusTechneticies> x3 is for a 7x7 one
+ [23:45:06] <Alkalus> I have no idea what that value does, tbh..
+ [23:45:15] <GregoriusTechneticies> its the offset
+ [23:45:23] <Alkalus> Debugging checkMachine has been a pain and I usually trash designs that don't work straight up..
+ [23:45:28] <GregoriusTechneticies> it determines the horizontal middle of the multiblock
+ [23:45:47] <GregoriusTechneticies> which is in your case THREE blocks away from the controller
+ [23:45:51] <Alkalus> Ahh
+ [23:45:57] <GregoriusTechneticies> and not 2
+ [23:46:06] <Alkalus> Noted, thanks :D
+ */
+
+ @Override
+ public boolean isCorrectMachinePart(final ItemStack aStack) {
+ return true;
+ }
+
+ @Override
+ public int getMaxEfficiency(final ItemStack aStack) {
+ return 10000;
+ }
+
+ @Override
+ public int getPollutionPerTick(final ItemStack aStack) {
+ return 0;
+ }
+
+ @Override
+ public int getDamageToComponent(final ItemStack aStack) {
+ return 0;
+ }
+
+ @Override
+ public boolean explodesOnComponentBreak(final ItemStack aStack) {
+ return true;
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
+ return new GregtechMTE_NuclearReactor(this.mName);
+ }
+
+ public boolean turnCasingActive(final boolean status) {
+ //TODO
+ if (this.mDynamoHatches != null) {
+ for (final GT_MetaTileEntity_Hatch_Dynamo hatch : this.mDynamoHatches) {
+ hatch.mMachineBlock = status ? (byte) TAE.GTPP_INDEX(13) : (byte) TAE.GTPP_INDEX(12);
+ }
+ }
+ if (this.mMufflerHatches != null) {
+ for (final GT_MetaTileEntity_Hatch_Muffler hatch : this.mMufflerHatches) {
+ hatch.mMachineBlock = status ? (byte) TAE.GTPP_INDEX(13) : (byte) TAE.GTPP_INDEX(12);
+ }
+ }
+ if (this.mOutputHatches != null) {
+ for (final GT_MetaTileEntity_Hatch_Output hatch : this.mOutputHatches) {
+ hatch.mMachineBlock = status ? (byte) TAE.GTPP_INDEX(13) : (byte) TAE.GTPP_INDEX(12);
+ }
+ }
+ if (this.mInputHatches != null) {
+ for (final GT_MetaTileEntity_Hatch_Input hatch : this.mInputHatches) {
+ hatch.mMachineBlock = status ? (byte) TAE.GTPP_INDEX(13) : (byte) TAE.GTPP_INDEX(12);
+ }
+ }
+ if (this.mMaintenanceHatches != null) {
+ for (final GT_MetaTileEntity_Hatch_Maintenance hatch : this.mMaintenanceHatches) {
+ hatch.mMachineBlock = status ? (byte) TAE.GTPP_INDEX(13) : (byte) TAE.GTPP_INDEX(12);
+ }
+ }
+ return true;
+ }
+
+ public FluidStack[] getStoredFluidsAsArray() {
+ return getStoredFluids().toArray(new FluidStack[0]);
+ }
+
+ public int getStoredFuel(GT_Recipe aRecipe) {
+ int aFuelStored = 0;
+ FluidStack aFuelFluid = null;
+ for (FluidStack aFluidInput : aRecipe.mFluidInputs) {
+ if (!aFluidInput.getFluid().equals(NUCLIDE.Li2BeF4.getFluid())) {
+ aFuelFluid = aFluidInput;
+ break;
+ }
+ }
+ if (aFuelFluid != null) {
+ for (GT_MetaTileEntity_Hatch_Input aInputHatch : this.mInputHatches) {
+ if (aInputHatch.getFluid() != null && aInputHatch.getFluidAmount() > 0) {
+ if (aInputHatch.getFluid().isFluidEqual(aFuelFluid)) {
+ aFuelStored += aInputHatch.getFluidAmount();
+ }
+ }
+ }
+ }
+ return aFuelStored;
+ }
+
+ @Override
+ public boolean checkRecipe(final ItemStack aStack) {
+ // Warm up for 4~ minutes
+ Logger.WARNING("Checking LFTR recipes.");
+ if (mEfficiency < this.getMaxEfficiency(null)) {
+ this.mProgresstime = 0;
+ this.mMaxProgresstime = 1;
+ this.mEfficiencyIncrease = 2;
+ Logger.WARNING("Warming Up! "+this.mEfficiency+"/"+this.getMaxEfficiency(null));
+ return true;
+ }
+ Logger.WARNING("Warmed up, checking LFTR recipes.");
+
+ final FluidStack[] tFluids = getStoredFluidsAsArray();
+ final Collection<GT_Recipe> tRecipeList = getRecipeMap().mRecipeList;
+ if(tFluids.length > 0 && tRecipeList != null && tRecipeList.size() > 0) { //Does input hatch have a LFTR fuel?
+ Logger.WARNING("Found more than one input fluid and a list of valid recipes.");
+ // Find a valid recipe
+ GT_Recipe aFuelProcessing = this.findRecipe(getBaseMetaTileEntity(), mLastRecipe, true, 0, tFluids, new ItemStack[] {});
+ if (aFuelProcessing == null) {
+ Logger.WARNING("Did not find valid recipe for given inputs.");
+ return false;
+ }
+ else {
+ Logger.WARNING("Found recipe? "+(aFuelProcessing != null ? "true" : "false"));
+ for (FluidStack aFluidInput : aFuelProcessing.mFluidInputs) {
+ Logger.WARNING("Using "+aFluidInput.getLocalizedName());
+ }
+ }
+ // Reset outputs and progress stats
+ this.mEUt = 0;
+ this.mMaxProgresstime = 0;
+ this.mOutputItems = new ItemStack[]{};
+ this.mOutputFluids = new FluidStack[]{};
+ this.mLastRecipe = aFuelProcessing;
+ // Deplete Inputs
+ if (aFuelProcessing.mFluidInputs.length > 0) {
+ for (FluidStack aInputToConsume : aFuelProcessing.mFluidInputs) {
+ Logger.WARNING("Depleting "+aInputToConsume.getLocalizedName()+" - "+aInputToConsume.amount+"L");
+ this.depleteInput(aInputToConsume);
+ }
+ }
+ // -- Try not to fail after this point - inputs have already been consumed! --
+ this.mMaxProgresstime = (int)(aFuelProcessing.mDuration);
+ this.mEUt = aFuelProcessing.mSpecialValue * 4;
+ Logger.WARNING("Outputting "+this.mEUt+"eu/t");
+ this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
+ this.mEfficiencyIncrease = 10000;
+ this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
+ Logger.WARNING("Recipe time: "+this.mMaxProgresstime);
+ mFuelRemaining = getStoredFuel(aFuelProcessing); //Record available fuel
+
+ this.mOutputFluids = aFuelProcessing.mFluidOutputs.clone();
+ updateSlots();
+ Logger.WARNING("Recipe Good!");
+ return true;
+ }
+ this.mEUt = 0;
+ this.mEfficiency = 0;
+ Logger.WARNING("Recipe Bad!");
+ return false;
+ }
+
+ @Override
+ public int getMaxParallelRecipes() {
+ return 1;
+ }
+
+ @Override
+ public int getEuDiscountForParallelism() {
+ return 0;
+ }
+
+ @Override
+ public void explodeMultiblock() {
+ this.mInventory[1] = null;
+ long explodevalue = MathUtils.randLong(Integer.MAX_VALUE, 8589934588L);
+ for (final MetaTileEntity tTileEntity : this.mInputBusses) {
+ explodevalue = MathUtils.randLong(Integer.MAX_VALUE, 8589934588L);
+ tTileEntity.getBaseMetaTileEntity().doExplosion(explodevalue);
+ }
+ for (final MetaTileEntity tTileEntity : this.mOutputBusses) {
+ explodevalue = MathUtils.randLong(Integer.MAX_VALUE, 8589934588L);
+ tTileEntity.getBaseMetaTileEntity().doExplosion(explodevalue);
+ }
+ for (final MetaTileEntity tTileEntity : this.mInputHatches) {
+ explodevalue = MathUtils.randLong(Integer.MAX_VALUE, 8589934588L);
+ tTileEntity.getBaseMetaTileEntity().doExplosion(explodevalue);
+ }
+ for (final MetaTileEntity tTileEntity : this.mOutputHatches) {
+ explodevalue = MathUtils.randLong(Integer.MAX_VALUE, 8589934588L);
+ tTileEntity.getBaseMetaTileEntity().doExplosion(explodevalue);
+ }
+ for (final MetaTileEntity tTileEntity : this.mDynamoHatches) {
+ explodevalue = MathUtils.randLong(Integer.MAX_VALUE, 8589934588L);
+ tTileEntity.getBaseMetaTileEntity().doExplosion(explodevalue);
+ }
+ for (final MetaTileEntity tTileEntity : this.mMufflerHatches) {
+ explodevalue = MathUtils.randLong(Integer.MAX_VALUE, 8589934588L);
+ tTileEntity.getBaseMetaTileEntity().doExplosion(explodevalue);
+ }
+ for (final MetaTileEntity tTileEntity : this.mEnergyHatches) {
+ explodevalue = MathUtils.randLong(Integer.MAX_VALUE, 8589934588L);
+ tTileEntity.getBaseMetaTileEntity().doExplosion(explodevalue);
+ }
+ for (final MetaTileEntity tTileEntity : this.mMaintenanceHatches) {
+ explodevalue = MathUtils.randLong(Integer.MAX_VALUE, 8589934588L);
+ tTileEntity.getBaseMetaTileEntity().doExplosion(explodevalue);
+ }
+ explodevalue = MathUtils.randLong(Integer.MAX_VALUE, 8589934588L);
+ this.getBaseMetaTileEntity().doExplosion(explodevalue);
+ }
+
+ @Override
+ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ if (aBaseMetaTileEntity.getWorld().isRemote) {
+ if (aBaseMetaTileEntity.isActive()){
+ // Set casings active if we're warmed up.
+ if (this.mEfficiency == this.getMaxEfficiency(null)){
+ this.turnCasingActive(true);
+ }
+ else {
+ this.turnCasingActive(false);
+ }
+ }
+ else {
+ this.turnCasingActive(false);
+ }
+ }
+ super.onPostTick(aBaseMetaTileEntity, aTick);
+ }
+
+ @Override
+ public boolean onRunningTick(ItemStack aStack) {
+ // See if we're warmed up.
+ if (this.mEfficiency == this.getMaxEfficiency(null)){
+ // Try output some Uranium-233
+ if (MathUtils.randInt(1, 300) == 1){
+ this.addOutput(ELEMENT.getInstance().URANIUM233.getFluidStack(MathUtils.randInt(1, 10)));
+ }
+
+ }
+ return super.onRunningTick(aStack);
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ aNBT.setInteger("mFuelRemaining", this.mFuelRemaining);
+ super.saveNBTData(aNBT);
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ this.mFuelRemaining = aNBT.getInteger("mFuelRemaining");
+ super.loadNBTData(aNBT);
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityGeneratorArray.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityGeneratorArray.java
new file mode 100644
index 0000000000..cccee84c99
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityGeneratorArray.java
@@ -0,0 +1,521 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
+import com.gtnewhorizon.structurelib.structure.StructureDefinition;
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.Materials;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.implementations.*;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_Utility;
+import gregtech.api.util.GTPP_Recipe;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.fluids.FluidStack;
+
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
+
+public class GregtechMetaTileEntityGeneratorArray extends GregtechMeta_MultiBlockBase {
+
+ private int mCasing;
+ private IStructureDefinition<GregtechMetaTileEntityGeneratorArray> STRUCTURE_DEFINITION = null;
+
+ public GregtechMetaTileEntityGeneratorArray(int aID, String aName, String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ }
+
+ public GregtechMetaTileEntityGeneratorArray(String aName) {
+ super(aName);
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaTileEntityGeneratorArray(this.mName);
+ }
+
+ @Override
+ public String getMachineType() {
+ return "Processing Array";
+ }
+
+ @Override
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
+ GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType(getMachineType())
+ .addInfo("Controller Block for the Generator Array")
+ .addInfo("Runs supplied generators as if placed in the world")
+ .addInfo("Place up to 16 Single Block GT Generators into the Controller")
+ .addSeparator()
+ .beginStructureBlock(3, 3, 3, true)
+ .addController("Front center")
+ .addCasingInfo("Robust Tungstensteel Machine Casings", 10)
+ .addInputBus("Any casing", 1)
+ .addOutputBus("Any casing", 1)
+ .addInputHatch("Any Casing", 1)
+ .addOutputHatch("Any Casing", 1)
+ .addDynamoHatch("Any casing", 1)
+ .addMaintenanceHatch("Any casing", 1)
+ .toolTipFinisher(CORE.GT_Tooltip_Builder);
+ return tt;
+ }
+
+ @Override
+ public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
+ if (aSide == aFacing) {
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(48), new GT_RenderedTexture(aActive ? TexturesGtBlock.Overlay_Machine_Controller_Advanced_Active : TexturesGtBlock.Overlay_Machine_Controller_Advanced)};
+ }
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(48)};
+ }
+
+ @Override
+ public boolean hasSlotInGUI() {
+ return true;
+ }
+
+ @Override
+ public String getCustomGUIResourceName() {
+ return "ProcessingArray";
+ }
+
+ @Override
+ public boolean requiresVanillaGtGUI() {
+ return true;
+ }
+
+ @Override
+ public GT_Recipe.GT_Recipe_Map getRecipeMap() {
+ this.mMode = getModeFromInventorySlot(this.getGUIItemStack());
+ if (this.mMode == MODE_NONE) {
+ return null;
+ }
+ else if (this.mMode == MODE_STEAM) {
+ return GTPP_Recipe.GTPP_Recipe_Map.sSteamTurbineFuels;
+ }
+ else if (this.mMode == MODE_DIESEL) {
+ return GT_Recipe.GT_Recipe_Map.sDieselFuels;
+ }
+ else if (this.mMode == MODE_GAS) {
+ return GT_Recipe.GT_Recipe_Map.sTurbineFuels;
+ }
+ else if (this.mMode == MODE_SEMIFLUID) {
+ return GTPP_Recipe.GTPP_Recipe_Map.sSemiFluidLiquidFuels;
+ }
+ else if (this.mMode == MODE_GEOTHERMAL) {
+ return GTPP_Recipe.GTPP_Recipe_Map.sThermalFuels;
+ }
+ else if (this.mMode == MODE_ROCKETFUEL) {
+ return GTPP_Recipe.GTPP_Recipe_Map.sRocketFuels;
+ }
+ else if (this.mMode == MODE_MAGIC_A) {
+ return GT_Recipe.GT_Recipe_Map.sMagicFuels;
+ }
+ else if (this.mMode == MODE_PLASMA) {
+ return GT_Recipe.GT_Recipe_Map.sPlasmaFuels;
+ }
+ else if (this.mMode == MODE_NAQUADAH) {
+ return GT_Recipe.GT_Recipe_Map.sFluidNaquadahReactorFuels;
+ }
+ return null;
+ }
+
+ @Override
+ public boolean isCorrectMachinePart(ItemStack aStack) {
+ if (aStack != null && aStack.getUnlocalizedName().startsWith("gt.blockmachines.")) {
+ return true;
+ }
+ return false;
+ }
+
+ public String mMachine = "";
+ protected int fuelConsumption = 0;
+ protected int fuelValue = 0;
+ protected int fuelRemaining = 0;
+ protected boolean boostEu = false;
+
+ int mMode = 0;
+
+ private final static int MODE_STEAM = 0;
+ private final static int MODE_DIESEL = 1;
+ private final static int MODE_GAS = 2;
+ private final static int MODE_SEMIFLUID = 3;
+ private final static int MODE_GEOTHERMAL = 4;
+ private final static int MODE_ROCKETFUEL = 5;
+ private final static int MODE_MAGIC_A = 6;
+ private final static int MODE_MAGIC_B_DISABLED = 7;
+ private final static int MODE_PLASMA = 8;
+ private final static int MODE_NAQUADAH = 9;
+ private final static int MODE_NONE = 100;
+
+ private final static int[] ID_STEAM = new int[] {962, 1120, 1121, 1122};
+ private final static int[] ID_GAS = new int[] {961, 1115, 1116, 1117};
+ private final static int[] ID_DIESEL = new int[] {960, 1110, 1111, 1112};
+ private final static int[] ID_SEMIFLUID = new int[] {837, 838, 839};
+ private final static int[] ID_GEOTHERMAL = new int[] {830, 831, 832};
+ private final static int[] ID_ROCKETFUEL = new int[] {793, 794, 795};
+ private final static int[] ID_MAGIC_A = new int[] {1123, 1124, 1125};
+ private final static int[] ID_MAGIC_B_DISABLED = new int[] {1127, 1128, 1129, 1130};
+ private final static int[] ID_PLASMA = new int[] {1196, 1197, 1198};
+ private final static int[] ID_NAQUADAH = new int[] {1190, 1191, 1192};
+
+ private static final int getModeFromInventorySlot(ItemStack aStack) {
+
+ if (aStack == null) {
+ return MODE_NONE;
+ }
+
+ String aItemStackName = aStack == null ? "" : aStack.getUnlocalizedName();
+ //Logger.INFO("Item Name: "+aItemStackName+" ("+aStack.getItemDamage()+")");
+ if (aItemStackName.toLowerCase().contains("gt.blockmachines")) {
+ for (int g : ID_STEAM) {
+ if (aStack.getItemDamage() == g) {
+ return MODE_STEAM;
+ }
+ }
+ for (int g : ID_GAS) {
+ if (aStack.getItemDamage() == g) {
+ return MODE_GAS;
+ }
+ }
+ for (int g : ID_DIESEL) {
+ if (aStack.getItemDamage() == g) {
+ return MODE_DIESEL;
+ }
+ }
+ for (int g : ID_SEMIFLUID) {
+ if (aStack.getItemDamage() == g) {
+ return MODE_SEMIFLUID;
+ }
+ }
+ for (int g : ID_GEOTHERMAL) {
+ if (aStack.getItemDamage() == g) {
+ return MODE_GEOTHERMAL;
+ }
+ }
+ for (int g : ID_ROCKETFUEL) {
+ if (aStack.getItemDamage() == g) {
+ return MODE_ROCKETFUEL;
+ }
+ }
+ for (int g : ID_MAGIC_A) {
+ if (aStack.getItemDamage() == g) {
+ return MODE_MAGIC_A;
+ }
+ }
+ for (int g : ID_PLASMA) {
+ if (aStack.getItemDamage() == g) {
+ return MODE_PLASMA;
+ }
+ }
+ for (int g : ID_NAQUADAH) {
+ if (aStack.getItemDamage() == g) {
+ return MODE_NAQUADAH;
+ }
+ }
+ }
+ return MODE_NONE;
+ }
+
+ @Override
+ public boolean checkRecipe(ItemStack aStack) {
+
+ this.resetRecipeMapForAllInputHatches();
+ this.mMode = getModeFromInventorySlot(aStack);
+ if (mMode == MODE_NONE) {
+ Logger.INFO("Did not find valid generator.");
+ return false;
+ }
+ else {
+ Logger.INFO("Changed Mode to "+mMode);
+ }
+ int aMulti = this.getGUIItemStack() != null ? this.getGUIItemStack().stackSize : 0;
+ if (aMulti > 16 || aMulti == 0) {
+ return false;
+ }
+
+
+
+ ArrayList<FluidStack> tFluids = this.getStoredFluids();
+
+ Collection<GT_Recipe> tRecipeList = this.getRecipeMap().mRecipeList;
+ Logger.INFO("Got Recipe Map");
+ if (tFluids.size() > 0 && tRecipeList != null) {
+ Logger.INFO("Found Fuels for Map.");
+ Iterator<FluidStack> arg3 = tFluids.iterator();
+ int aCount = 0;
+ while (arg3.hasNext()) {
+ FluidStack hatchFluid1 = (FluidStack) arg3.next();
+ Logger.INFO("Iterating Fluid Found "+(aCount++)+" | "+hatchFluid1.getLocalizedName());
+ Iterator<GT_Recipe> arg5 = tRecipeList.iterator();
+
+ int Hatch = 0;
+ int totalFuelValue = 0;
+ while (arg5.hasNext()) {
+ Logger.INFO("Iterating Recipe "+(Hatch++));
+ GT_Recipe aFuel = (GT_Recipe) arg5.next();
+ FluidStack tLiquid;
+ boolean addedFuelOnce = false;
+ for (int a = 0; a < aMulti; a++) {
+ if ((tLiquid = GT_Utility.getFluidForFilledItem(aFuel.getRepresentativeInput(0), true)) != null
+ && hatchFluid1.isFluidEqual(tLiquid)) {
+ this.fuelConsumption = tLiquid.amount = this.boostEu
+ ? 4096 / aFuel.mSpecialValue
+ : 2048 / aFuel.mSpecialValue;
+ if (this.depleteInput(tLiquid)) {
+ Logger.INFO("Depleted Fuel");
+ this.boostEu = this.depleteInput(Materials.Oxygen.getGas(2L));
+
+/*if (!tFluids.contains(Materials.Lubricant.getFluid(1L))) {
+ Logger.INFO("No Lube.");
+ return false;
+ }*/
+
+ if (this.mRuntime % 72 == 0 || this.mRuntime == 0) {
+ this.depleteInput(Materials.Lubricant.getFluid(this.boostEu ? 2L : 1L));
+ }
+ Logger.INFO("ADDING POWER");
+ this.fuelRemaining = hatchFluid1.amount;
+ totalFuelValue++;
+ }
+ }
+ }
+ //Do things after consuming Fuel
+ if (totalFuelValue == aMulti) {
+ this.fuelValue = aFuel.mSpecialValue*aMulti;
+ this.mEUt = this.mEfficiency < 2000 ? 0 : aFuel.mSpecialValue*aMulti;
+ this.mProgresstime = aMulti;
+ this.mMaxProgresstime = aMulti;
+ this.mEfficiencyIncrease = 15*aMulti;
+ return true;
+ }
+ }
+ }
+ }
+
+ this.mEUt = 0;
+ this.mEfficiency = 0;
+ return false;
+ }
+
+ public static ItemStack[] clean(final ItemStack[] v) {
+ List<ItemStack> list = new ArrayList<ItemStack>(Arrays.asList(v));
+ list.removeAll(Collections.singleton(null));
+ return list.toArray(new ItemStack[list.size()]);
+ }
+
+ @Override
+ public IStructureDefinition<GregtechMetaTileEntityGeneratorArray> getStructureDefinition() {
+ if (STRUCTURE_DEFINITION == null) {
+ STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntityGeneratorArray>builder()
+ .addShape(mName, transpose(new String[][]{
+ {"CCC", "CCC", "CCC"},
+ {"C~C", "C-C", "CCC"},
+ {"CCC", "CCC", "CCC"},
+ }))
+ .addElement(
+ 'C',
+ ofChain(
+ ofHatchAdder(
+ GregtechMetaTileEntityGeneratorArray::addGeneratorArrayList, 48, 1
+ ),
+ onElementPass(
+ x -> ++x.mCasing,
+ ofBlock(
+ GregTech_API.sBlockCasings4, 0
+ )
+ )
+ )
+ )
+ .build();
+ }
+ return STRUCTURE_DEFINITION;
+ }
+
+ @Override
+ public void construct(ItemStack stackSize, boolean hintsOnly) {
+ buildPiece(mName , stackSize, hintsOnly, 1, 1, 0);
+ }
+
+ @Override
+ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ mCasing = 0;
+ return checkPiece(mName, 1, 1, 0) && mCasing >= 10;
+ }
+
+ public final boolean addGeneratorArrayList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null) {
+ return false;
+ } else {
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Dynamo){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public int getMaxEfficiency(ItemStack aStack) {
+ return 10000;
+ }
+
+ @Override
+ public int getPollutionPerTick(ItemStack aStack) {
+ return 0;
+ }
+
+ @Override
+ public int getDamageToComponent(ItemStack aStack) {
+ return 0;
+ }
+
+ @Override
+ public boolean explodesOnComponentBreak(ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public int getAmountOfOutputs() {
+ return 1;
+ }
+
+ @Override
+ public int getMaxParallelRecipes() {
+ return 1;
+ }
+
+ @Override
+ public int getEuDiscountForParallelism() {
+ return 0;
+ }
+
+ /**
+ * Code from single blocks
+ */
+
+ public void tryProcessFuelItems(IGregTechTileEntity aBaseMetaTileEntity, ItemStack a) {
+ if (a != null
+ && aBaseMetaTileEntity.getUniversalEnergyStored() < this.maxEUOutput() * 20L + this.getMinimumStoredEU()
+ && GT_Utility.getFluidForFilledItem(a, true) == null) {
+ int tFuelValue;
+ tFuelValue = this.getFuelValue(a);
+ if (tFuelValue > 0) {
+ ItemStack tEmptyContainer1 = this.getEmptyContainer(a);
+ if (this.addOutput(tEmptyContainer1)) {
+ aBaseMetaTileEntity.increaseStoredEnergyUnits((long) tFuelValue, true);
+ this.depleteInput(a);
+ PollutionUtils.addPollution(this.getBaseMetaTileEntity(), 10 * this.getPollutionPerTick(null));
+ }
+ }
+ }
+ }
+
+ public void tryProcessFuel(IGregTechTileEntity aBaseMetaTileEntity, long aTick, FluidStack mFluid) {
+ if (aBaseMetaTileEntity.isServerSide() && aBaseMetaTileEntity.isAllowedToWork() && aTick % 10L == 0L) {
+ int tFuelValue;
+ if (mFluid != null) {
+ tFuelValue = this.getFuelValue(mFluid);
+ int tEmptyContainer = this.consumedFluidPerOperation(mFluid);
+ if (tFuelValue > 0 && tEmptyContainer > 0 && mFluid.amount > tEmptyContainer) {
+ long tFluidAmountToUse = Math.min((long) (mFluid.amount / tEmptyContainer),
+ (this.maxEUStore() - aBaseMetaTileEntity.getUniversalEnergyStored()) / (long) tFuelValue);
+ if (tFluidAmountToUse > 0L && aBaseMetaTileEntity
+ .increaseStoredEnergyUnits(tFluidAmountToUse * (long) tFuelValue, true)) {
+ PollutionUtils.addPollution(this.getBaseMetaTileEntity(), 10 * this.getPollutionPerTick(null));
+ mFluid.amount = (int) ((long) mFluid.amount
+ - tFluidAmountToUse * (long) tEmptyContainer);
+ }
+ }
+ }
+
+ //Check items
+ }
+
+ if (aBaseMetaTileEntity.isServerSide()) {
+ aBaseMetaTileEntity.setActive(aBaseMetaTileEntity.isAllowedToWork() && aBaseMetaTileEntity
+ .getUniversalEnergyStored() >= this.maxEUOutput() + this.getMinimumStoredEU());
+ }
+
+ }
+
+ public boolean isFluidInputAllowed(FluidStack aFluid) {
+ return this.getFuelValue(aFluid) > 0;
+ }
+
+
+ public int consumedFluidPerOperation(FluidStack aLiquid) {
+ return 1;
+ }
+
+ public int getFuelValue(FluidStack aLiquid) {
+ if (aLiquid != null && this.getRecipeMap() != null) {
+ Collection<GT_Recipe> tRecipeList = this.getRecipeMap().mRecipeList;
+ if (tRecipeList != null) {
+ Iterator<GT_Recipe> arg3 = tRecipeList.iterator();
+
+ while (arg3.hasNext()) {
+ GT_Recipe tFuel = (GT_Recipe) arg3.next();
+ FluidStack tLiquid;
+ if ((tLiquid = GT_Utility.getFluidForFilledItem(tFuel.getRepresentativeInput(0), true)) != null
+ && aLiquid.isFluidEqual(tLiquid)) {
+ return (int) ((long) tFuel.mSpecialValue * (long) this.mEfficiency
+ * (long) this.consumedFluidPerOperation(tLiquid) / 100L);
+ }
+ }
+ }
+
+ return 0;
+ } else {
+ return 0;
+ }
+ }
+
+ public int getFuelValue(ItemStack aStack) {
+ if (!GT_Utility.isStackInvalid(aStack) && this.getRecipeMap() != null) {
+ GT_Recipe tFuel = this.getRecipeMap().findRecipe(this.getBaseMetaTileEntity(), false, Long.MAX_VALUE,
+ (FluidStack[]) null, new ItemStack[]{aStack});
+ return tFuel != null ? (int) ((long) tFuel.mSpecialValue * 1000L * (long) this.mEfficiency / 100L) : 0;
+ } else {
+ return 0;
+ }
+ }
+
+ public ItemStack getEmptyContainer(ItemStack aStack) {
+ if (!GT_Utility.isStackInvalid(aStack) && this.getRecipeMap() != null) {
+ GT_Recipe tFuel = this.getRecipeMap().findRecipe(this.getBaseMetaTileEntity(), false, Long.MAX_VALUE,
+ (FluidStack[]) null, new ItemStack[]{aStack});
+ return tFuel != null
+ ? GT_Utility.copy(new Object[]{tFuel.getOutput(0)})
+ : GT_Utility.getContainerItem(aStack, true);
+ } else {
+ return null;
+ }
+ }
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityTreeFarm.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityTreeFarm.java
new file mode 100644
index 0000000000..83b8eae458
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityTreeFarm.java
@@ -0,0 +1,332 @@
+
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production;
+
+import codechicken.nei.ItemStackMap;
+import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
+import com.gtnewhorizon.structurelib.structure.StructureDefinition;
+import gregtech.api.enums.Materials;
+import gregtech.api.enums.TAE;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.*;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.items.GT_MetaGenerated_Tool;
+import gregtech.api.metatileentity.implementations.*;
+import gregtech.api.render.TextureFactory;
+import gregtech.api.util.*;
+import gtPlusPlus.api.objects.data.AutoMap;
+import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.math.MathUtils;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import gtPlusPlus.xmod.gregtech.common.helpers.TreeFarmHelper;
+import gtPlusPlus.xmod.gregtech.common.helpers.treefarm.TreeGenerator;
+import net.minecraft.init.Blocks;
+import net.minecraft.item.ItemStack;
+
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
+
+public class GregtechMetaTileEntityTreeFarm extends GregtechMeta_MultiBlockBase {
+
+ public static int CASING_TEXTURE_ID;
+ public static String mCasingName = "Advanced Cryogenic Casing";
+ public static TreeGenerator mTreeData;
+ private int mCasing;
+ private IStructureDefinition<GregtechMetaTileEntityTreeFarm> STRUCTURE_DEFINITION = null;
+
+ static {
+ new Thread("GTPP-TreeDataWorker") {
+ @Override
+ public void run() {
+ mTreeData = new TreeGenerator();
+ }
+ }.start();
+ }
+
+ private static ItemStack aLeaves;
+
+ public GregtechMetaTileEntityTreeFarm(final int aID, final String aName, final String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ CASING_TEXTURE_ID = TAE.getIndexFromPage(1, 15);
+ mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings2Misc, 15);
+ }
+
+ public GregtechMetaTileEntityTreeFarm(final String aName) {
+ super(aName);
+ CASING_TEXTURE_ID = TAE.getIndexFromPage(1, 15);
+ mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings2Misc, 15);
+ }
+
+ public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaTileEntityTreeFarm(this.mName);
+ }
+
+ @Override
+ public String getMachineType() {
+ return "Tree Farm";
+ }
+
+ @Override
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
+ if (mCasingName.toLowerCase().contains(".name")) {
+ mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings2Misc, 15);
+ }
+ GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType(getMachineType())
+ .addInfo("Converts EU to Oak Logs")
+ .addInfo("Eu Usage: 100% | Parallel: 1")
+ .addInfo("Requires a Saw or Chainsaw in GUI slot")
+ .addPollutionAmount(getPollutionPerSecond(null))
+ .addSeparator()
+ .beginStructureBlock(3, 3, 3, true)
+ .addController("Front center")
+ .addCasingInfo("Sterile Farm Casing", 10)
+ .addInputBus("Any casing", 1)
+ .addOutputBus("Any casing", 1)
+ .addEnergyHatch("Any casing", 1)
+ .addMaintenanceHatch("Any casing", 1)
+ .addMufflerHatch("Any casing", 1)
+ .toolTipFinisher(CORE.GT_Tooltip_Builder);
+ return tt;
+ }
+
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing,
+ final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+ if (aSide == aFacing) {
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(CASING_TEXTURE_ID),
+ TextureFactory.of(aActive ? TexturesGtBlock.Overlay_Machine_Controller_Advanced_Active : TexturesGtBlock.Overlay_Machine_Controller_Advanced)};
+ }
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(CASING_TEXTURE_ID)};
+ }
+
+ @Override
+ public boolean hasSlotInGUI() {
+ return true;
+ }
+
+ @Override
+ public boolean requiresVanillaGtGUI() {
+ return true;
+ }
+
+ @Override
+ public String getCustomGUIResourceName() {
+ return "VacuumFreezer";
+ }
+
+ public GT_Recipe.GT_Recipe_Map getRecipeMap() {
+ return null;
+ }
+
+ public boolean isCorrectMachinePart(final ItemStack aStack) {
+ // is correct part && either not powered tool or have enough power
+ return TreeFarmHelper.getPartType(aStack) != null && !GT_ModHandler.isElectricItem(aStack) || GT_ModHandler.canUseElectricItem(aStack, 1);
+ }
+
+ public boolean checkRecipe(final ItemStack aStack) {
+ if (mTreeData == null)
+ // not finished somehow
+ return false;
+ if (aStack == null && !replaceTool())
+ // no tool
+ return false;
+ if (!isCorrectMachinePart(aStack))
+ // not a tool
+ return false;
+ if (mTreeData != null) {
+
+ long tVoltage = getMaxInputVoltage();
+ byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage));
+
+ this.mMaxProgresstime = 100;
+ this.mEUt = (int) tVoltage;
+
+ this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
+ this.mEfficiencyIncrease = 10000;
+
+ // Overclock
+ if (this.mEUt <= 16) {
+ this.mEUt = (this.mEUt * (1 << tTier - 1) * (1 << tTier - 1));
+ this.mMaxProgresstime = (this.mMaxProgresstime / (1 << tTier - 1));
+ } else {
+ while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) {
+ this.mEUt *= 4;
+ this.mMaxProgresstime /= 2;
+ }
+ }
+
+ if (this.mEUt > 0) {
+ this.mEUt = (-this.mEUt);
+ }
+
+
+ int aChance = MathUtils.randInt(0, 10);
+
+ try {
+ if (aChance < 8) {
+ ItemStackMap<Integer> allOutputs = new ItemStackMap<>();
+ if (aLeaves == null)
+ aLeaves = ItemUtils.getSimpleStack(Blocks.leaves);
+ //1% Chance per Tick
+ for (int u = 0; u < (Math.max(4, (MathUtils.randInt((3 * tTier), 100) * tTier * tTier) / 14)); u++) {
+ AutoMap<ItemStack> aOutputs = mTreeData.generateOutput(0);
+ if (aOutputs.size() > 0) {
+ for (ItemStack aOutputItemStack : aOutputs) {
+ if (!GT_Utility.areStacksEqual(aLeaves, aOutputItemStack)) {
+ Integer oldStackSize = allOutputs.get(aOutputItemStack);
+ int oldStackSizeUnboxed = oldStackSize == null ? 0 : oldStackSize;
+ allOutputs.put(aOutputItemStack, oldStackSizeUnboxed + aOutputItemStack.stackSize);
+ }
+ }
+ }
+ }
+
+ mOutputItems = allOutputs.entries().stream()
+ .map(e -> {
+ e.key.stackSize = e.value;
+ return e.key;
+ }).toArray(ItemStack[]::new);
+ }
+ } catch (Throwable t) {
+ t.printStackTrace(GT_Log.err);
+ }
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ @Override
+ public boolean checkHatch() {
+ return super.checkHatch() && mEnergyHatches.size() == 1;
+ }
+
+ @Override
+ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ mCasing = 0;
+ return checkPiece(mName, 1, 1, 0) && mCasing >= 10 - 8 && checkHatch();
+ }
+
+ @Override
+ public int getMaxParallelRecipes() {
+ return 1;
+ }
+
+ @Override
+ public int getEuDiscountForParallelism() {
+ return 0;
+ }
+
+ @Override
+ public IStructureDefinition<GregtechMetaTileEntityTreeFarm> getStructureDefinition() {
+ if (STRUCTURE_DEFINITION == null) {
+ STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntityTreeFarm>builder()
+ .addShape(mName, transpose(new String[][]{
+ {"CCC", "CCC", "CCC"},
+ {"C~C", "C-C", "CCC"},
+ {"CCC", "CCC", "CCC"},
+ }))
+ .addElement(
+ 'C',
+ ofChain(
+ ofHatchAdder(
+ GregtechMetaTileEntityTreeFarm::addTreeFarmList, CASING_TEXTURE_ID, 1
+ ),
+ onElementPass(
+ x -> ++x.mCasing,
+ ofBlock(
+ ModBlocks.blockCasings2Misc, 15
+ )
+ )
+ )
+ )
+ .build();
+ }
+ return STRUCTURE_DEFINITION;
+ }
+
+ public final boolean addTreeFarmList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null) {
+ return false;
+ } else {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ }
+
+ public int getMaxEfficiency(final ItemStack aStack) {
+ return 10000;
+ }
+
+ public int getPollutionPerSecond(final ItemStack aStack) {
+ return CORE.ConfigSwitches.pollutionPerSecondMultiTreeFarm;
+ }
+
+ public int getDamageToComponent(final ItemStack aStack) {
+ return MathUtils.balance((int) (75 - ((GT_MetaGenerated_Tool.getPrimaryMaterial(aStack).getMass()))), 5, 120);
+ }
+
+ public boolean explodesOnComponentBreak(final ItemStack aStack) {
+ return false;
+ }
+
+ public boolean replaceTool() {
+ ItemStack invItem = this.mInventory[1];
+ if (invItem == null) {
+ for (GT_MetaTileEntity_Hatch_InputBus mInputBus : this.mInputBusses) {
+ for (int i = 0; i < mInputBus.mInventory.length; i++) {
+ ItemStack uStack = mInputBus.mInventory[i];
+ if (uStack != null && TreeFarmHelper.getPartType(uStack) != null) {
+ this.setGUIItemStack(uStack);
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ public boolean tryDamageTool(ItemStack invItem) {
+ if (invItem != null && invItem.getItem() instanceof GT_MetaGenerated_Tool) {
+ long aDmg = GT_MetaGenerated_Tool.getToolDamage(invItem);
+ long aDmgMax = GT_MetaGenerated_Tool.getToolMaxDamage(invItem);
+ if (aDmg < aDmgMax && GT_MetaGenerated_Tool.getPrimaryMaterial(invItem) != Materials._NULL) {
+ return GT_ModHandler.damageOrDechargeItem(invItem, 1, 0, null);
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public boolean doRandomMaintenanceDamage() {
+ ItemStack tSaw = mInventory[1];
+ if (!isCorrectMachinePart(tSaw) || getRepairStatus() == 0) {
+ stopMachine();
+ return false;
+ }
+ if (CORE.RANDOM.nextInt(200) == 0) {
+ if (!tryDamageTool(tSaw)) {
+ if (tSaw.getItem().isDamageable())
+ addOutput(tSaw);
+ this.mInventory[1] = null;
+ if (!replaceTool())
+ this.getBaseMetaTileEntity().disableWorking();
+ tryDamageTool(tSaw);
+ }
+ }
+ return super.doRandomMaintenanceDamage();
+ }
+
+ @Override
+ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ super.onPostTick(aBaseMetaTileEntity, aTick);
+ replaceTool();
+ }
+
+ @Override
+ public void construct(ItemStack stackSize, boolean hintsOnly) {
+ buildPiece(mName , stackSize, hintsOnly, 1, 1, 0);
+ }
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_AlloyBlastSmelter.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_AlloyBlastSmelter.java
new file mode 100644
index 0000000000..c84c5e162e
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_AlloyBlastSmelter.java
@@ -0,0 +1,336 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
+import com.gtnewhorizon.structurelib.structure.StructureDefinition;
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.TAE;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.implementations.*;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_Utility;
+import gregtech.api.util.GTPP_Recipe;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.recipe.common.CI;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.fluids.FluidStack;
+
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
+
+public class GregtechMetaTileEntity_AlloyBlastSmelter
+extends GregtechMeta_MultiBlockBase {
+
+ private int mMode = 0;
+ private boolean isUsingControllerCircuit = false;
+ private static Item circuit;
+ private int mCasing;
+ private IStructureDefinition<GregtechMetaTileEntity_AlloyBlastSmelter> STRUCTURE_DEFINITION = null;
+
+
+ public GregtechMetaTileEntity_AlloyBlastSmelter(final int aID, final String aName, final String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ }
+
+ public GregtechMetaTileEntity_AlloyBlastSmelter(final String aName) {
+ super(aName);
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaTileEntity_AlloyBlastSmelter(this.mName);
+ }
+
+ @Override
+ public String getMachineType() {
+ return "Fluid Alloy Cooker";
+ }
+
+ @Override
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
+ GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType(getMachineType())
+ .addInfo("Controller Block for the Alloy Blast Smelter")
+ .addInfo("20% Faster than the Electric Blast Furnace")
+ .addInfo("Allows Complex GT++ alloys to be created")
+ .addInfo("Circuit for recipe goes in the Input Bus or GUI slot")
+ .addPollutionAmount(getPollutionPerSecond(null))
+ .addSeparator()
+ .beginStructureBlock(3, 4, 3, true)
+ .addController("Bottom Center")
+ .addCasingInfo("Blast Smelter Casings", 10)
+ .addCasingInfo("Blast Smelter Heat Containment Coils", 16)
+ .addInputBus("Any Casing", 1)
+ .addInputHatch("Any Casing", 1)
+ .addOutputHatch("Any Casing", 1)
+ .addEnergyHatch("Any Casing", 1)
+ .addMaintenanceHatch("Any Casing", 1)
+ .addMufflerHatch("Any Casing", 1)
+ .toolTipFinisher(CORE.GT_Tooltip_Builder);
+ return tt;
+ }
+
+ @Override
+ public IStructureDefinition<GregtechMetaTileEntity_AlloyBlastSmelter> getStructureDefinition() {
+ if (STRUCTURE_DEFINITION == null) {
+ STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_AlloyBlastSmelter>builder()
+ .addShape(mName, transpose(new String[][]{
+ {"CCC", "CCC", "CCC"},
+ {"HHH", "H-H", "HHH"},
+ {"HHH", "H-H", "HHH"},
+ {"C~C", "CCC", "CCC"},
+ }))
+ .addElement(
+ 'C',
+ ofChain(
+ ofHatchAdder(
+ GregtechMetaTileEntity_AlloyBlastSmelter::addAlloyBlastSmelterList, TAE.GTPP_INDEX(15), 1
+ ),
+ onElementPass(
+ x -> ++x.mCasing,
+ ofBlock(
+ ModBlocks.blockCasingsMisc, 15
+ )
+ )
+ )
+ )
+ .addElement(
+ 'H',
+ ofBlock(
+ ModBlocks.blockCasingsMisc, 14
+ )
+ )
+ .build();
+ }
+ return STRUCTURE_DEFINITION;
+ }
+
+ @Override
+ public void construct(ItemStack stackSize, boolean hintsOnly) {
+ buildPiece(mName , stackSize, hintsOnly, 1, 3, 0);
+ }
+
+ @Override
+ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ mCasing = 0;
+ return checkPiece(mName, 1, 3, 0) && mCasing >= 10 && mEnergyHatches.size() == 1 && checkHatch();
+ }
+
+ public final boolean addAlloyBlastSmelterList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null) {
+ return false;
+ } else {
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ }
+ return false;
+ }
+
+
+ @Override
+ public String getSound() {
+ return GregTech_API.sSoundList.get(Integer.valueOf(208));
+ }
+
+ @Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+ if (aSide == aFacing) {
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(TAE.GTPP_INDEX(15)), new GT_RenderedTexture(aActive ? TexturesGtBlock.Overlay_Machine_Controller_Advanced_Active : TexturesGtBlock.Overlay_Machine_Controller_Advanced)};
+ }
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(TAE.GTPP_INDEX(15))};
+ }
+
+ @Override
+ public boolean hasSlotInGUI() {
+ return true;
+ }
+
+ @Override
+ public boolean requiresVanillaGtGUI() {
+ return true;
+ }
+
+ @Override
+ public String getCustomGUIResourceName() {
+ return "ElectricBlastFurnace";
+ }
+
+ @Override
+ public GT_Recipe.GT_Recipe_Map getRecipeMap() {
+ return GTPP_Recipe.GTPP_Recipe_Map.sAlloyBlastSmelterRecipes;
+ }
+
+ @Override
+ public boolean isCorrectMachinePart(final ItemStack aStack) {
+ if (this.getBaseMetaTileEntity().isServerSide()) {
+ //Get Controller Circuit
+ if (circuit == null) {
+ circuit = CI.getNumberedCircuit(0).getItem();
+ }
+ if (aStack != null && aStack.getItem() == circuit) {
+ this.mMode = aStack.getItemDamage();
+ return this.isUsingControllerCircuit = true;
+ }
+ else {
+ if (aStack == null) {
+ this.isUsingControllerCircuit = false;
+ return true; //Allowed empty
+ }
+ Logger.WARNING("Not circuit in GUI inputs.");
+ return this.isUsingControllerCircuit = false;
+ }
+ }
+ Logger.WARNING("No Circuit, clientside.");
+ return this.isUsingControllerCircuit = false;
+ }
+
+ @Override
+ public boolean checkRecipe(final ItemStack aStack) {
+
+ if (this.getBaseMetaTileEntity().isServerSide()) {
+ //Get Controller Circuit
+ this.isUsingControllerCircuit = isCorrectMachinePart(aStack);
+
+ final ArrayList<ItemStack> tInputList = this.getStoredInputs();
+ for (int i = 0; i < (tInputList.size() - 1); i++) {
+ for (int j = i + 1; j < tInputList.size(); j++) {
+ if (GT_Utility.areStacksEqual(tInputList.get(i), tInputList.get(j))) {
+ if (tInputList.get(i).stackSize >= tInputList.get(j).stackSize) {
+ tInputList.remove(j--);
+ } else {
+ tInputList.remove(i--);
+ break;
+ }
+ }
+ }
+ }
+
+ //Validity check
+ if ((isUsingControllerCircuit && tInputList.size() < 1) || (!isUsingControllerCircuit && tInputList.size() < 2)) {
+ Logger.WARNING("Not enough inputs.");
+ return false;
+ }
+ else if (isUsingControllerCircuit && tInputList.size() >= 1) {
+ tInputList.add(CI.getNumberedCircuit(this.mMode));
+ }
+
+
+ final ItemStack[] tInputs = Arrays.copyOfRange(tInputList.toArray(new ItemStack[tInputList.size()]), 0, tInputList.size());
+
+ final ArrayList<FluidStack> tFluidList = this.getStoredFluids();
+ for (int i = 0; i < (tFluidList.size() - 1); i++) {
+ for (int j = i + 1; j < tFluidList.size(); j++) {
+ if (GT_Utility.areFluidsEqual(tFluidList.get(i), tFluidList.get(j))) {
+ if (tFluidList.get(i).amount >= tFluidList.get(j).amount) {
+ tFluidList.remove(j--);
+ } else {
+ tFluidList.remove(i--);
+ break;
+ }
+ }
+ }
+ }
+ final FluidStack[] tFluids = Arrays.copyOfRange(tFluidList.toArray(new FluidStack[tInputList.size()]), 0, 1);
+ if (tInputList.size() > 1) {
+ final long tVoltage = this.getMaxInputVoltage();
+ final byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage));
+ final GT_Recipe tRecipe = GTPP_Recipe.GTPP_Recipe_Map.sAlloyBlastSmelterRecipes.findRecipe(this.getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs);
+ if ((tRecipe != null) && (tRecipe.isRecipeInputEqual(true, tFluids, tInputs))) {
+ Logger.WARNING("Found some Valid Inputs.");
+ this.mEfficiency = (10000 - ((this.getIdealStatus() - this.getRepairStatus()) * 1000));
+ this.mEfficiencyIncrease = 10000;
+ if (tRecipe.mEUt <= 16) {
+ this.mEUt = (tRecipe.mEUt * (1 << (tTier - 1)) * (1 << (tTier - 1)));
+ this.mMaxProgresstime = (tRecipe.mDuration / (1 << (tTier - 1)));
+ } else {
+ this.mEUt = tRecipe.mEUt;
+ this.mMaxProgresstime = tRecipe.mDuration;
+ while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) {
+ this.mEUt *= 4;
+ this.mMaxProgresstime /= 2;
+ }
+ }
+ if (this.mEUt > 0) {
+ this.mEUt = (-this.mEUt);
+ }
+ this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
+ this.mOutputFluids = new FluidStack[]{tRecipe.getFluidOutput(0)};
+ List<ItemStack> tOutPutItems = new ArrayList<ItemStack>();
+ for (ItemStack tOut : tRecipe.mOutputs) {
+ if (ItemUtils.checkForInvalidItems(tOut)) {
+ tOutPutItems.add(tOut);
+ }
+ }
+ if (tOutPutItems.size() > 0)
+ this.mOutputItems = tOutPutItems.toArray(new ItemStack[tOutPutItems.size()]);
+ this.updateSlots();
+ return true;
+ }
+ }
+ }
+ Logger.WARNING("Failed to find some Valid Inputs or Clientside.");
+ return false;
+ }
+
+ @Override
+ public int getMaxParallelRecipes() {
+ return 1;
+ }
+
+ @Override
+ public int getEuDiscountForParallelism() {
+ return 0;
+ }
+
+ @Override
+ public int getMaxEfficiency(final ItemStack aStack) {
+ return 10000;
+ }
+
+ @Override
+ public int getPollutionPerSecond(final ItemStack aStack) {
+ return CORE.ConfigSwitches.pollutionPerSecondMultiABS;
+ }
+
+ @Override
+ public int getDamageToComponent(final ItemStack aStack) {
+ return 0;
+ }
+
+ @Override
+ public int getAmountOfOutputs() {
+ return 2;
+ }
+
+ @Override
+ public boolean explodesOnComponentBreak(final ItemStack aStack) {
+ return false;
+ }
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java
new file mode 100644
index 0000000000..ecd4882516
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java
@@ -0,0 +1,481 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production;
+
+import java.util.ArrayList;
+
+import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
+import com.gtnewhorizon.structurelib.structure.StructureDefinition;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.IIconContainer;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.MetaTileEntity;
+import gregtech.api.metatileentity.implementations.*;
+import gregtech.api.objects.GT_ItemStack;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_Utility;
+import gregtech.api.util.GTPP_Recipe;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.item.chemistry.IonParticles;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.math.MathUtils;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraftforge.fluids.FluidStack;
+
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
+
+public class GregtechMetaTileEntity_Cyclotron extends GregtechMeta_MultiBlockBase {
+
+ private int mCasing;
+ private IStructureDefinition<GregtechMetaTileEntity_Cyclotron> STRUCTURE_DEFINITION = null;
+
+ public GregtechMetaTileEntity_Cyclotron(int aID, String aName, String aNameRegional, int tier) {
+ super(aID, aName, aNameRegional);
+ }
+
+ public GregtechMetaTileEntity_Cyclotron(String aName) {
+ super(aName);
+ }
+
+ @Override
+ public String getMachineType() {
+ return "Particle Accelerator";
+ }
+
+ public int tier(){
+ return 5;
+ }
+
+ @Override
+ public long maxEUStore() {
+ return 1800000000L;
+ }
+
+ @Override
+ public boolean hasSlotInGUI() {
+ return false;
+ }
+
+ @Override
+ public String getCustomGUIResourceName() {
+ return null;
+ }
+
+ @Override
+ public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ return super.getServerGUI(aID, aPlayerInventory, aBaseMetaTileEntity);
+ //return new CONTAINER_Cyclotron(aPlayerInventory, aBaseMetaTileEntity);
+ }
+
+ @Override
+ public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ return super.getClientGUI(aID, aPlayerInventory, aBaseMetaTileEntity);
+ //return new GUI_Cyclotron(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), Recipe_GT.Gregtech_Recipe_Map.sCyclotronRecipes.mNEIName);
+ }
+
+ @Override
+ public MetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaTileEntity_Cyclotron(this.mName);
+ }
+
+ @Override
+ public boolean allowCoverOnSide(byte aSide, GT_ItemStack aStack) {
+ return aSide != getBaseMetaTileEntity().getFrontFacing();
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ super.saveNBTData(aNBT);
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ super.loadNBTData(aNBT);
+ }
+
+ @Override
+ public IStructureDefinition<GregtechMetaTileEntity_Cyclotron> getStructureDefinition() {
+ if (STRUCTURE_DEFINITION == null) {
+ STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_Cyclotron>builder()
+ .addShape(mName, transpose(new String[][]{
+ {
+ " ",
+ " hhh ",
+ " hh hh ",
+ " h h ",
+ " h h ",
+ " h h ",
+ " h h ",
+ " h h ",
+ " h h ",
+ " h h ",
+ " h h ",
+ " h h ",
+ " hh hh ",
+ " hhh ",
+ " ",
+ },
+ {
+ " hhh ",
+ " hhccchh ",
+ " hcchhhcch ",
+ " hchh hhch ",
+ " hch hch ",
+ " hch hch ",
+ "hch hch",
+ "hch hch",
+ "hch hch",
+ " hch hch ",
+ " hch hch ",
+ " hchh hhch ",
+ " hcch~hcch ",
+ " hhccchh ",
+ " hhh ",
+ },
+ {
+ " ",
+ " hhh ",
+ " hh hh ",
+ " h h ",
+ " h h ",
+ " h h ",
+ " h h ",
+ " h h ",
+ " h h ",
+ " h h ",
+ " h h ",
+ " h h ",
+ " hh hh ",
+ " hhh ",
+ " ",
+ }
+ }))
+ .addElement(
+ 'h',
+ ofChain(
+ ofHatchAdder(
+ GregtechMetaTileEntity_Cyclotron::addCyclotronList, 44, 1
+ ),
+ onElementPass(
+ x -> ++x.mCasing,
+ ofBlock(
+ getCasing(), getCasingMeta()
+ )
+ )
+ )
+ )
+ .addElement(
+ 'c',
+ ofBlock(
+ getCyclotronCoil(), getCyclotronCoilMeta()
+ )
+ )
+ .build();
+ }
+ return STRUCTURE_DEFINITION;
+ }
+
+ @Override
+ public void construct(ItemStack stackSize, boolean hintsOnly) {
+ buildPiece(mName , stackSize, hintsOnly, 7, 1, 12);
+ }
+
+ @Override
+ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ mCasing = 0;
+ return checkPiece(mName, 7, 1, 12) && mCasing >= 40 && checkHatch();
+ }
+
+ public final boolean addCyclotronList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null) {
+ return false;
+ } else {
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus && ((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity).mTier >= 5){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy && ((GT_MetaTileEntity_Hatch_Energy) aMetaTileEntity).mTier >= 5){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus && ((GT_MetaTileEntity_Hatch_OutputBus) aMetaTileEntity).mTier >= 5) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler && ((GT_MetaTileEntity_Hatch_Muffler) aMetaTileEntity).mTier >= 5) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input && ((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity).mTier >= 5) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ }
+ return false;
+ }
+
+ public Block getCasing() {
+ return ModBlocks.blockCasings2Misc;
+ }
+
+ public int getCasingMeta() {
+ return 10;
+ }
+
+ public Block getCyclotronCoil() {
+ return ModBlocks.blockCasings2Misc;
+ }
+
+ public int getCyclotronCoilMeta() {
+ return 9;
+ }
+
+ @Override
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
+ GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType(getMachineType())
+ .addInfo("Super Magnetic Speed Shooter")
+ .addSeparator()
+ .addInfo("Particles are accelerated over 186 revolutions to 80% light speed")
+ .addInfo("Can produce a continuous beam current of 2.2 mA at 590 MeV")
+ .addInfo("Which will be extracted from the Isochronous Cyclotron")
+ .addSeparator()
+ .addInfo("Consists of the same layout as a Fusion Reactor")
+ .addInfo("Any external casing can be a hatch/bus, unlike Fusion")
+ .addInfo("Cyclotron Machine Casings around Cyclotron Coil Blocks")
+ .addInfo("All Hatches must be IV or better")
+ .addPollutionAmount(getPollutionPerSecond(null))
+ .addSeparator()
+ .addCasingInfo("Cyclotron Machine Casings", 40)
+ .addCasingInfo("Cyclotron Coil", 32)
+ .addInputBus("Any Casing", 1)
+ .addOutputBus("Any Casing", 1)
+ .addInputHatch("Any Casing", 1)
+ .addEnergyHatch("Any Casing", 1)
+ .addMaintenanceHatch("Any Casing", 1)
+ .addMufflerHatch("Any Casing", 1)
+ .toolTipFinisher(CORE.GT_Tooltip_Builder);
+ return tt;
+ }
+
+ @Override
+ public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
+ ITexture[] sTexture;
+ if (aSide == aFacing) {
+ sTexture = new ITexture[]{Textures.BlockIcons.getCasingTextureForId(44), new GT_RenderedTexture(getIconOverlay())};
+ } else {
+ if (!aActive) {
+ sTexture = new ITexture[]{Textures.BlockIcons.getCasingTextureForId(44)};
+ } else {
+ sTexture = new ITexture[]{Textures.BlockIcons.getCasingTextureForId(44)};
+ }
+ }
+ return sTexture;
+ }
+
+ public IIconContainer getIconOverlay() {
+ if (this.getBaseMetaTileEntity().isActive()){
+ return TexturesGtBlock.Overlay_MatterFab_Active_Animated;
+ }
+ return TexturesGtBlock.Overlay_MatterFab_Animated;
+ }
+
+ @Override
+ public boolean isCorrectMachinePart(ItemStack aStack) {
+ return true;
+ }
+
+ @Override
+ public boolean checkRecipe(ItemStack aStack) {
+
+ /*if (CORE.DEVENV) {
+ return this.checkRecipeGeneric();
+ }*/
+ this.fixAllMaintenanceIssue();
+
+ //log("Recipe Check.");
+ ArrayList<ItemStack> tItemList = getStoredInputs();
+ ItemStack[] tItemInputs = tItemList.toArray(new ItemStack[tItemList.size()]);
+ ArrayList<FluidStack> tInputList = getStoredFluids();
+ FluidStack[] tFluidInputs = tInputList.toArray(new FluidStack[tInputList.size()]);
+ long tVoltage = getMaxInputVoltage();
+ byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage));
+
+ GT_Recipe tRecipe = GTPP_Recipe.GTPP_Recipe_Map.sCyclotronRecipes.findRecipe(getBaseMetaTileEntity(), false,
+ gregtech.api.enums.GT_Values.V[tTier], tFluidInputs, tItemInputs);
+ if (tRecipe != null){
+ if (tRecipe.isRecipeInputEqual(true, tFluidInputs, tItemInputs)) {
+
+ this.mEfficiency = (10000 - ((getIdealStatus() - getRepairStatus()) * 1000));
+ this.mEfficiencyIncrease = 10000;
+ this.mEUt = tRecipe.mEUt;
+ this.mMaxProgresstime = tRecipe.mDuration;
+
+ while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) {
+ this.mEUt *= 4;
+ this.mMaxProgresstime /= 2;
+ }
+
+ if (this.mEUt > 0) {
+ this.mEUt = (-this.mEUt);
+ }
+
+ this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
+
+ final ItemStack[] outputs = new ItemStack[tRecipe.mOutputs.length];
+ for (int i = 0; i < tRecipe.mOutputs.length; i++){
+ if (this.getBaseMetaTileEntity().getRandomNumber(10000) < tRecipe.getOutputChance(i)){
+ Logger.WARNING("Adding a bonus output");
+ outputs[i] = tRecipe.getOutput(i);
+ }
+ else {
+ Logger.WARNING("Adding null output");
+ outputs[i] = null;
+ }
+ }
+
+ for (ItemStack s : outputs) {
+ if (s != null) {
+ if (s.getItem() instanceof IonParticles) {
+ long aCharge = IonParticles.getChargeState(s);
+ if (aCharge == 0) {
+ IonParticles.setChargeState(s, MathUtils.getRandomFromArray(new int[] {
+ -5, -5,
+ -4, -4, -4,
+ -3, -3, -3, -3, -3,
+ -2, -2, -2, -2, -2, -2, -2,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 3, 3, 3, 3, 3, 3, 3,
+ 4, 4, 4, 4,
+ 5, 5, 5,
+ 6, 6}));
+ }
+ }
+ }
+ }
+
+ this.mOutputItems = outputs;
+ this.mOutputFluids = new FluidStack[] {tRecipe.getFluidOutput(0)};
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public int getMaxParallelRecipes() {
+ return 1;
+ }
+
+ @Override
+ public int getEuDiscountForParallelism() {
+ return 0;
+ }
+
+ @Override
+ public boolean onRunningTick(ItemStack aStack) {
+ if (this.mOutputBusses.size() > 0) {
+ for (GT_MetaTileEntity_Hatch_OutputBus g : this.mOutputBusses) {
+ if (g != null) {
+ for (ItemStack s : g.mInventory) {
+ if (s != null) {
+ if (s.getItem() instanceof IonParticles) {
+ long aCharge = IonParticles.getChargeState(s);
+ if (aCharge == 0) {
+ IonParticles.setChargeState(s, MathUtils.getRandomFromArray(new int[] {
+ -5, -5,
+ -4, -4, -4,
+ -3, -3, -3, -3, -3,
+ -2, -2, -2, -2, -2, -2, -2,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 3, 3, 3, 3, 3, 3, 3,
+ 4, 4, 4, 4,
+ 5, 5, 5,
+ 6, 6}));
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ this.fixAllMaintenanceIssue();
+ return super.onRunningTick(aStack);
+ }
+
+
+ @Override
+ public int getMaxEfficiency(ItemStack aStack) {
+ return 10000;
+ }
+
+ @Override
+ public int getPollutionPerSecond(ItemStack aStack) {
+ return CORE.ConfigSwitches.pollutionPerSecondMultiCyclotron;
+ }
+
+ @Override
+ public int getDamageToComponent(ItemStack aStack) {
+ return 0;
+ }
+ @Override
+ public boolean explodesOnComponentBreak(ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public String[] getExtraInfoData() {
+ String tier = tier() == 5 ? "I" : "II";
+ float plasmaOut = 0;
+ int powerRequired = 0;
+ if (this.mLastRecipe != null) {
+ powerRequired = this.mLastRecipe.mEUt;
+ if (this.mLastRecipe.getFluidOutput(0) != null) {
+ plasmaOut = (float)this.mLastRecipe.getFluidOutput(0).amount / (float)this.mLastRecipe.mDuration;
+ }
+ }
+
+ return new String[]{
+ "COMET - Compact Cyclotron MK "+tier,
+ "EU Required: "+powerRequired+"EU/t",
+ "Stored EU: "+this.getEUVar()+" / "+maxEUStore()};
+ }
+
+ @Override
+ public int getAmountOfOutputs() {
+ return 1;
+ }
+
+ @SuppressWarnings("deprecation")
+ public boolean turnCasingActive(final boolean status) {
+ if (this.mEnergyHatches != null) {
+ for (final GT_MetaTileEntity_Hatch_Muffler hatch : this.mMufflerHatches) {
+ hatch.mMachineBlock = status ? (byte) 44 : (byte) 44;
+ }
+ }
+ if (this.mOutputHatches != null) {
+ for (final GT_MetaTileEntity_Hatch_Output hatch : this.mOutputHatches) {
+ hatch.mMachineBlock = status ? (byte) 44 : (byte) 44;
+ }
+ }
+ if (this.mInputHatches != null) {
+ for (final GT_MetaTileEntity_Hatch_Input hatch : this.mInputHatches) {
+ hatch.mMachineBlock = status ? (byte) 44 : (byte) 44;
+ }
+ }
+ if (this.mMaintenanceHatches != null) {
+ for (final GT_MetaTileEntity_Hatch_Maintenance hatch : this.mMaintenanceHatches) {
+ hatch.mMachineBlock = status ? (byte) 44 : (byte) 44;
+ }
+ }
+ return true;
+ }
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_IndustrialFishingPond.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_IndustrialFishingPond.java
new file mode 100644
index 0000000000..80eb09640d
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_IndustrialFishingPond.java
@@ -0,0 +1,623 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production;
+
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
+import static gtPlusPlus.core.util.data.ArrayUtils.removeNulls;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+import com.gtnewhorizon.structurelib.alignment.IAlignmentLimits;
+import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
+import com.gtnewhorizon.structurelib.structure.StructureDefinition;
+import gregtech.api.enums.TAE;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.implementations.*;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.*;
+import gtPlusPlus.api.objects.data.AutoMap;
+import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.recipe.common.CI;
+import gtPlusPlus.core.util.math.MathUtils;
+import gtPlusPlus.core.util.minecraft.FluidUtils;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import gtPlusPlus.core.util.reflect.ReflectionUtils;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
+import ic2.core.init.BlocksItems;
+import ic2.core.init.InternalName;
+import net.minecraft.block.Block;
+import net.minecraft.init.Blocks;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.WeightedRandomFishable;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.FluidStack;
+
+public class GregtechMetaTileEntity_IndustrialFishingPond extends GregtechMeta_MultiBlockBase {
+
+ private boolean isUsingControllerCircuit = false;
+ private static final Item circuit = CI.getNumberedCircuit(0).getItem();
+ private int mCasing;
+ private IStructureDefinition<GregtechMetaTileEntity_IndustrialFishingPond> STRUCTURE_DEFINITION = null;
+
+ public GregtechMetaTileEntity_IndustrialFishingPond(final int aID, final String aName, final String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ }
+
+ public GregtechMetaTileEntity_IndustrialFishingPond(final String aName) {
+ super(aName);
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaTileEntity_IndustrialFishingPond(this.mName);
+ }
+
+ @Override
+ public String getMachineType() {
+ return "Fish Trap";
+ }
+
+ @Override
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
+ GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType(getMachineType())
+ .addInfo("Controller Block for the Fishing Pond")
+ .addInfo("Can process (Tier + 1) * 2 recipes")
+ .addInfo("Put a numbered circuit into the input bus.")
+ .addInfo("Circuit 14 for Fish")
+ .addInfo("Circuit 15 for Junk")
+ .addInfo("Circuit 16 for Treasure")
+ .addPollutionAmount(getPollutionPerSecond(null))
+ .addSeparator()
+ .beginStructureBlock(9, 3, 9, true)
+ .addController("Front Center")
+ .addCasingInfo("Aquatic Casings", 64)
+ .addInputBus("Any Casing", 1)
+ .addOutputBus("Any Casing", 1)
+ .addInputHatch("Any Casing", 1)
+ .addEnergyHatch("Any Casing", 1)
+ .addMaintenanceHatch("Any Casing", 1)
+ .addMufflerHatch("Any Casing", 1)
+ .toolTipFinisher(CORE.GT_Tooltip_Builder);
+ return tt;
+ }
+
+ @Override
+ protected IAlignmentLimits getInitialAlignmentLimits() {
+ // fuck
+ return (d, r, f) -> d.offsetY == 0 && r.isNotRotated() && !f.isVerticallyFliped();
+ }
+
+ @Override
+ public IStructureDefinition<GregtechMetaTileEntity_IndustrialFishingPond> getStructureDefinition() {
+ if (STRUCTURE_DEFINITION == null) {
+ STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_IndustrialFishingPond>builder()
+ .addShape(mName, transpose(new String[][]{
+ {"XXXXXXXXX", "X X", "X X", "X X", "X X", "X X", "X X", "X X", "XXXXXXXXX"},
+ {"XXXX~XXXX", "X X", "X X", "X X", "X X", "X X", "X X", "X X", "XXXXXXXXX"},
+ {"XXXXXXXXX", "XXXXXXXXX", "XXXXXXXXX", "XXXXXXXXX", "XXXXXXXXX", "XXXXXXXXX", "XXXXXXXXX", "XXXXXXXXX", "XXXXXXXXX"},
+ }))
+ .addElement(
+ 'X',
+ ofChain(
+ ofHatchAdder(
+ GregtechMetaTileEntity_IndustrialFishingPond::addIndustrialFishingPondList, getCasingTextureIndex(), 1
+ ),
+ onElementPass(
+ x -> ++x.mCasing,
+ ofBlock(
+ getCasingBlock(), getCasingMeta()
+ )
+ )
+ )
+ )
+ .build();
+ }
+ return STRUCTURE_DEFINITION;
+ }
+
+ public final boolean addIndustrialFishingPondList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null) {
+ return false;
+ } else {
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public void construct(ItemStack stackSize, boolean hintsOnly) {
+ buildPiece(mName , stackSize, hintsOnly, 4, 1, 0);
+ }
+
+ @Override
+ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ mCasing = 0;
+ return checkPiece(mName, 4, 1, 0) && mCasing >= 64 && checkHatch();
+ }
+
+ @Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing,
+ final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+ if (aSide == aFacing) {
+ return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(getCasingTextureIndex()),
+ new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_VACUUM_FREEZER_ACTIVE
+ : Textures.BlockIcons.OVERLAY_FRONT_VACUUM_FREEZER) };
+ }
+ return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(getCasingTextureIndex()) };
+ }
+
+ @Override
+ public boolean hasSlotInGUI() {
+ return true;
+ }
+
+ @Override
+ public String getCustomGUIResourceName() {
+ return null;
+ }
+
+ @Override
+ public GT_Recipe.GT_Recipe_Map getRecipeMap() {
+ return null;
+ }
+
+ @Override
+ public boolean checkRecipe(final ItemStack aStack) {
+ if (aStack != null) {
+ log("Found " + aStack.getDisplayName());
+ if (aStack.getItem() == circuit) {
+ this.isUsingControllerCircuit = true;
+ this.mMode = aStack.getItemDamage();
+ log("Found Circuit!");
+ } else {
+ this.isUsingControllerCircuit = false;
+ }
+ } else {
+ this.isUsingControllerCircuit = false;
+ }
+ if (!hasGenerateRecipes) {
+ log("Generating Recipes.");
+ generateRecipes();
+ }
+ if (hasGenerateRecipes) {
+ if (!checkForWater()) {
+ return false;
+ }
+
+ log("Trying to run recipe.");
+ ArrayList<ItemStack> tItems = getStoredInputs();
+ ArrayList<FluidStack> tFluids = getStoredFluids();
+ ItemStack[] tItemInputs = tItems.toArray(new ItemStack[tItems.size()]);
+ FluidStack[] tFluidInputs = tFluids.toArray(new FluidStack[tFluids.size()]);
+
+ if (!isUsingControllerCircuit && tItems.size() == 0) {
+ return false;
+ }
+
+ return checkRecipeGeneric(tItemInputs, tFluidInputs, getMaxParallelRecipes(), 100, 80, 100);
+ }
+ return true;
+ }
+
+ @Override
+ public int getMaxParallelRecipes() {
+ return (2 * (GT_Utility.getTier(this.getMaxInputVoltage())+1));
+ }
+
+ @Override
+ public int getEuDiscountForParallelism() {
+ return 100;
+ }
+
+ @Override
+ public int getMaxEfficiency(final ItemStack aStack) {
+ return 10000;
+ }
+
+ @Override
+ public int getPollutionPerSecond(final ItemStack aStack) {
+ return CORE.ConfigSwitches.pollutionPerSecondMultiIndustrialFishingPond;
+ }
+
+ @Override
+ public int getAmountOfOutputs() {
+ return 1;
+ }
+
+ @Override
+ public boolean explodesOnComponentBreak(final ItemStack aStack) {
+ return false;
+ }
+
+ public Block getCasingBlock() {
+ return ModBlocks.blockCasings3Misc;
+ }
+
+ public byte getCasingMeta() {
+ return 0;
+ }
+
+ public int getCasingTextureIndex() {
+ return TAE.GTPP_INDEX(32);
+ }
+
+ public boolean checkForWater() {
+
+ // Get Facing direction
+ IGregTechTileEntity aBaseMetaTileEntity = this.getBaseMetaTileEntity();
+ int mDirectionX = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX;
+ int mCurrentDirectionX;
+ int mCurrentDirectionZ;
+ int mOffsetX_Lower = 0;
+ int mOffsetX_Upper = 0;
+ int mOffsetZ_Lower = 0;
+ int mOffsetZ_Upper = 0;
+
+ mCurrentDirectionX = 4;
+ mCurrentDirectionZ = 4;
+
+ mOffsetX_Lower = -4;
+ mOffsetX_Upper = 4;
+ mOffsetZ_Lower = -4;
+ mOffsetZ_Upper = 4;
+
+ // if (aBaseMetaTileEntity.fac)
+
+ final int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX
+ * mCurrentDirectionX;
+ final int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ
+ * mCurrentDirectionZ;
+
+ int tAmount = 0;
+ for (int i = mOffsetX_Lower + 1; i <= mOffsetX_Upper - 1; ++i) {
+ for (int j = mOffsetZ_Lower + 1; j <= mOffsetZ_Upper - 1; ++j) {
+ for (int h = 0; h < 2; h++) {
+ Block tBlock = aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j);
+ // byte tMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j);
+ if (tBlock == Blocks.air || tBlock == Blocks.flowing_water || tBlock == BlocksItems.getFluidBlock(InternalName.fluidDistilledWater)) {
+ if (this.getStoredFluids() != null) {
+ for (FluidStack stored : this.getStoredFluids()) {
+ if (stored.isFluidEqual(FluidUtils.getFluidStack("water", 1))) {
+ if (stored.amount >= 1000) {
+ // Utils.LOG_WARNING("Going to try swap an air block for water from inut bus.");
+ stored.amount -= 1000;
+ Block fluidUsed = Blocks.water;
+ aBaseMetaTileEntity.getWorld().setBlock(
+ aBaseMetaTileEntity.getXCoord() + xDir + i,
+ aBaseMetaTileEntity.getYCoord() + h,
+ aBaseMetaTileEntity.getZCoord() + zDir + j, fluidUsed);
+
+ }
+ }
+ }
+ }
+ }
+ tBlock = aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j);
+ if (tBlock == Blocks.water || tBlock == Blocks.flowing_water) {
+ ++tAmount;
+ // log("Found Water");
+ }
+ }
+ }
+ }
+
+ boolean isValidWater = tAmount >= 60;
+
+ if (isValidWater) {
+ log("Filled structure.");
+ return true;
+ }
+ else {
+
+ long aAvgVoltage = 0;
+ for (GT_MetaTileEntity_Hatch_Energy g : this.mEnergyHatches) {
+ if (g != null) {
+ aAvgVoltage += (g.maxEUInput() * g.maxAmperesIn());
+ }
+ }
+ this.mEUt = (int) Math.max(30, aAvgVoltage);
+ this.mMaxProgresstime = (int) Math.max(((aAvgVoltage/8)*20/10), 100);
+ this.mProgresstime = 1;
+ log("Did not fill structure. Consuming "+aAvgVoltage+"eu/t to try fill.");
+ return false;
+ }
+ }
+
+ private static AutoMap<AutoMap<WeightedRandomFishable>> categories = new AutoMap<AutoMap<WeightedRandomFishable>>();
+ private static AutoMap<WeightedRandomFishable> categoryFish = new AutoMap<WeightedRandomFishable>();
+ private static AutoMap<WeightedRandomFishable> categoryJunk = new AutoMap<WeightedRandomFishable>();
+ private static AutoMap<WeightedRandomFishable> categoryLoot = new AutoMap<WeightedRandomFishable>();
+ private static boolean hasGenerateRecipes = false;
+ private int mMode = 14;
+ private int mMax = 8;
+
+ private boolean generateRecipes() {
+ if (!hasGenerateRecipes) {
+ categories.put(categoryFish);
+ categories.put(categoryJunk);
+ categories.put(categoryLoot);
+ for (WeightedRandomFishable h : FishPondFakeRecipe.fish) {
+ categoryFish.put(h);
+ }
+ for (WeightedRandomFishable h : FishPondFakeRecipe.junk) {
+ categoryJunk.put(h);
+ }
+ for (WeightedRandomFishable h : FishPondFakeRecipe.treasure) {
+ categoryLoot.put(h);
+ }
+ hasGenerateRecipes = true;
+ return true;
+ } else {
+ return true;
+ }
+ }
+
+ private int getCircuit(ItemStack[] t) {
+ if (!this.isUsingControllerCircuit) {
+ for (ItemStack j : t) {
+ if (j.getItem() == CI.getNumberedCircuit(0).getItem()) {
+ // Fish
+ if (j.getItemDamage() == 14) {
+ mMax = 8 + (this.getMaxParallelRecipes() - 2);
+ this.mMode = 14;
+ break;
+ }
+ // Junk
+ else if (j.getItemDamage() == 15) {
+ this.mMode = 15;
+ mMax = 4;
+ break;
+ }
+ // Loot
+ else if (j.getItemDamage() == 16) {
+ this.mMode = 16;
+ mMax = 4;
+ break;
+ } else {
+ this.mMode = 0;
+ mMax = 0;
+ break;
+ }
+ } else {
+ this.mMode = 0;
+ mMax = 0;
+ break;
+ }
+ }
+ }
+ return this.mMode;
+ }
+
+ // reflection map
+ private static Map<WeightedRandomFishable, ItemStack> reflectiveFishMap = new HashMap<WeightedRandomFishable, ItemStack>();
+
+ private ItemStack reflectiveFish(WeightedRandomFishable y) {
+ if (reflectiveFishMap.containsKey(y)) {
+ return reflectiveFishMap.get(y);
+ }
+ ItemStack t;
+ try {
+ t = (ItemStack) ReflectionUtils.getField(WeightedRandomFishable.class, "field_150711_b").get(y);
+ ItemStack k = ItemUtils.getSimpleStack(t, 1);
+ reflectiveFishMap.put(y, k);
+ return t;
+ } catch (IllegalArgumentException | IllegalAccessException e) {
+ }
+ return null;
+ }
+
+ private ItemStack[] generateLoot(int mode) {
+ ItemStack[] mFishOutput = new ItemStack[this.mMax];
+ if (this.mMode == 14) {
+ for (int k = 0; k < this.mMax; k++) {
+ if (mFishOutput[k] == null)
+ for (WeightedRandomFishable g : categoryFish.values()) {
+ if (MathUtils.randInt(0, (65 - getMaxParallelRecipes())) <= 2) {
+ ItemStack t = reflectiveFish(g);
+ if (t != null) {
+ mFishOutput[k] = ItemUtils.getSimpleStack(t, 1);
+ }
+ }
+ }
+ }
+ } else if (this.mMode == 15) {
+ for (int k = 0; k < this.mMax; k++) {
+ if (mFishOutput[k] == null)
+ for (WeightedRandomFishable g : categoryJunk.values()) {
+ if (MathUtils.randInt(0, 100) <= 1) {
+ ItemStack t = reflectiveFish(g);
+ if (t != null) {
+ mFishOutput[k] = ItemUtils.getSimpleStack(t, 1);
+ }
+ }
+ }
+ }
+ } else if (this.mMode == 16) {
+ for (int k = 0; k < this.mMax; k++) {
+ if (mFishOutput[k] == null)
+ for (WeightedRandomFishable g : categoryLoot.values()) {
+ if (MathUtils.randInt(0, 1000) <= 2) {
+ ItemStack t = reflectiveFish(g);
+ if (t != null) {
+ mFishOutput[k] = ItemUtils.getSimpleStack(t, 1);
+ }
+ }
+ }
+ }
+ } else {
+ mFishOutput = null;
+ }
+ return mFishOutput;
+ }
+
+ @Override
+ public boolean checkRecipeGeneric(ItemStack[] aItemInputs, FluidStack[] aFluidInputs, int aMaxParallelRecipes,
+ int aEUPercent, int aSpeedBonusPercent, int aOutputChanceRoll) {
+
+
+
+ //Control Core to control the Multiblocks behaviour.
+ int aControlCoreTier = getControlCoreTier();
+
+ //If no core, return false;
+ if (aControlCoreTier == 0 && CORE.ConfigSwitches.requireControlCores) {
+ log("Invalid/No Control Core");
+ return false;
+ }
+
+
+ // Reset outputs and progress stats
+ this.mEUt = 0;
+ this.mMaxProgresstime = 0;
+ this.mOutputItems = new ItemStack[]{};
+ this.mOutputFluids = new FluidStack[]{};
+
+
+ long tVoltage = getMaxInputVoltage();
+ byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage));
+ log("Running checkRecipeGeneric(0)");
+
+ //Check to see if Voltage Tier > Control Core Tier
+ if (tTier > aControlCoreTier && CORE.ConfigSwitches.requireControlCores) {
+ return false;
+ }
+
+ // Based on the Processing Array. A bit overkill, but very flexible.
+ getCircuit(aItemInputs);
+
+ /*
+ * GT_Recipe tRecipe = this.getRecipeMap().findRecipe( getBaseMetaTileEntity(),
+ * mLastRecipe, false, gregtech.api.enums.GT_Values.V[tTier], aFluidInputs,
+ * aItemInputs);
+ */
+
+ ItemStack[] mFishOutput = generateLoot(this.mMode);
+ mFishOutput = removeNulls(mFishOutput);
+ GT_Recipe g = new GTPP_Recipe(true, new ItemStack[] {}, mFishOutput, null, new int[] {}, aFluidInputs, mOutputFluids, 200, 16, 0);
+ aMaxParallelRecipes = this.canBufferOutputs(g, aMaxParallelRecipes);
+ if (aMaxParallelRecipes == 0) {
+ log("No Space");
+ return false;
+ }
+
+ log("Mode: " + this.mMode + " | Is loot valid? " + (mFishOutput != null));
+
+ int jslot = 0;
+ for (ItemStack x : mFishOutput) {
+ if (x != null) {
+ log(
+ "Slot " + jslot + " in mFishOutput contains " + x.stackSize + "x " + x.getDisplayName() + ".");
+ } else {
+ log("Slot " + jslot + " in mFishOutput was null.");
+ }
+ jslot++;
+ }
+
+ // EU discount
+ float tRecipeEUt = (8 * aEUPercent) / 100.0f;
+ float tTotalEUt = 0.0f;
+
+ int parallelRecipes = 0;
+
+ log("parallelRecipes: "+parallelRecipes);
+ log("aMaxParallelRecipes: "+aMaxParallelRecipes);
+ log("tTotalEUt: "+tTotalEUt);
+ log("tVoltage: "+tVoltage);
+ log("tRecipeEUt: "+tRecipeEUt);
+ // Count recipes to do in parallel, consuming input items and fluids and considering input voltage limits
+ for (; parallelRecipes < aMaxParallelRecipes && tTotalEUt < (tVoltage - tRecipeEUt); parallelRecipes++) {
+ log("Bumped EU from "+tTotalEUt+" to "+(tTotalEUt+tRecipeEUt)+".");
+ tTotalEUt += tRecipeEUt;
+ }
+
+ if (parallelRecipes == 0) {
+ log("BAD RETURN - 3");
+ return false;
+ }
+
+ // -- Try not to fail after this point - inputs have already been consumed! --
+
+
+ // Convert speed bonus to duration multiplier
+ // e.g. 100% speed bonus = 200% speed = 100%/200% = 50% recipe duration.
+ aSpeedBonusPercent = Math.max(-99, aSpeedBonusPercent);
+ float tTimeFactor = 100.0f / (100.0f + aSpeedBonusPercent);
+ this.mMaxProgresstime = (int)(20 * tTimeFactor * 4);
+
+ this.mEUt = (int)Math.ceil(tTotalEUt);
+
+ this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
+ this.mEfficiencyIncrease = 10000;
+
+
+ //Only Overclock as high as the control circuit.
+ byte tTierOld = tTier;
+ tTier = CORE.ConfigSwitches.requireControlCores ? (byte) aControlCoreTier : tTierOld;
+
+ // Overclock
+ if (this.mEUt <= 16) {
+ this.mEUt = (this.mEUt * (1 << tTier - 1) * (1 << tTier - 1));
+ this.mMaxProgresstime = (this.mMaxProgresstime / (1 << tTier - 1));
+ } else {
+ while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) {
+ this.mEUt *= 4;
+ this.mMaxProgresstime /= 2;
+ }
+ }
+
+ if (this.mEUt > 0) {
+ this.mEUt = (-this.mEUt);
+ }
+
+ this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
+
+
+ log("Recipe Step. [3]");
+ // Collect output item types
+ ItemStack[] tOutputItems = mFishOutput;
+
+ int rslot = 0;
+ tOutputItems = removeNulls(mFishOutput);
+
+ for (ItemStack x : tOutputItems) {
+ if (x != null) {
+ log(
+ "rSlot " + rslot + " in mFishOutput contains " + x.stackSize + "x " + x.getDisplayName() + ".");
+ } else {
+ log("rSlot " + rslot + " in mFishOutput was null.");
+ }
+ rslot++;
+ }
+
+ // Commit outputs
+ this.mOutputItems = tOutputItems;
+ updateSlots();
+
+ // Play sounds (GT++ addition - GT multiblocks play no sounds)
+ startProcess();
+
+ return true;
+ }
+
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeRocketEngine.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeRocketEngine.java
new file mode 100644
index 0000000000..d9162cea89
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeRocketEngine.java
@@ -0,0 +1,629 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
+import com.gtnewhorizon.structurelib.structure.StructureDefinition;
+import gregtech.api.enums.GT_Values;
+import gregtech.api.enums.TAE;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.implementations.*;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GTPP_Recipe;
+import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.item.chemistry.RocketFuels;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.lib.LoadedMods;
+import gtPlusPlus.core.material.MISC_MATERIALS;
+import gtPlusPlus.core.util.minecraft.FluidUtils;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_AirIntake;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler_Adv;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraftforge.fluids.FluidStack;
+
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
+
+public class GregtechMetaTileEntity_LargeRocketEngine extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_LargeRocketEngine>
+{
+ protected int fuelConsumption;
+ protected int fuelValue;
+ protected int fuelRemaining;
+ protected int freeFuelTicks = 0;
+ protected int euProduction = 0;
+ protected boolean boostEu;
+
+ public static String mLubricantName = "Carbon Dioxide";
+ public static String mCoolantName = "Liquid Hydrogen";
+
+ public static String mCasingName = "Turbodyne Casing";
+ public static String mIntakeHatchName = "Tungstensteel Turbine Casing";
+ public static String mGearboxName = "Inconel Reinforced Casing";
+
+ private int mCasing;
+ private IStructureDefinition<GregtechMetaTileEntity_LargeRocketEngine> STRUCTURE_DEFINITION = null;
+
+ private final static int CASING_ID = TAE.getIndexFromPage(3, 11);
+
+ public GregtechMetaTileEntity_LargeRocketEngine(final int aID, final String aName, final String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ this.fuelConsumption = 0;
+ this.fuelValue = 0;
+ this.fuelRemaining = 0;
+ this.boostEu = false;
+ }
+
+ public GregtechMetaTileEntity_LargeRocketEngine(final String aName) {
+ super(aName);
+ this.fuelConsumption = 0;
+ this.fuelValue = 0;
+ this.fuelRemaining = 0;
+ this.boostEu = false;
+ }
+
+ @Override
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
+ if (mCasingName.toLowerCase().contains(".name")) {
+ mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings4Misc, 11);
+ }
+ if (mIntakeHatchName.toLowerCase().contains(".name")) {
+ mIntakeHatchName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings4Misc, 11);
+ }
+ if (mGearboxName.toLowerCase().contains(".name")) {
+ mGearboxName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings3Misc, 1);
+ }
+ if (mLubricantName.toLowerCase().contains(".")) {
+ mLubricantName = FluidUtils.getFluidStack("carbondioxide", 1).getLocalizedName();
+ }
+ if (mCoolantName.toLowerCase().contains(".")) {
+ mCoolantName = FluidUtils.getFluidStack("liquidhydrogen", 1).getLocalizedName();
+ }
+
+ GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType(getMachineType())
+ .addInfo("Controller Block for the Large Rocket Engine")
+ .addInfo("Supply Rocket Fuels and 1000L(3000L boosted) of " + mLubricantName + " per hour to run")
+ .addInfo("Supply 4L of " + mCoolantName + " per second per 2100 eu/t to boost output (optional)")
+ .addInfo("Consumes 2000L/s of air per 16384 eu/t produced")
+ .addInfo("Produces as much energy as you put fuel in")
+ .addInfo("Produces 1500 pollution/S per 16384 eu/t produced")
+ .addInfo("When producing more then 32K eu/t fuel wil be consume less efficiently (3x - 1.5x eff@57Keu/t input energy)")
+ .addInfo("formula: x = input of energy (10K^(1/3)/ x^(1/3)) * (40K^(1/3)/ x^(1/3))")
+ .addInfo("Boosting will produce 3x the amount of power but will consume 3x fuel")
+ .addSeparator()
+ .beginStructureBlock(3, 3, 10, false)
+ .addController("Front Center")
+ .addCasingInfo(mCasingName, 64)
+ .addCasingInfo(mGearboxName, 8)
+ .addStructureHint("Air Intake Hatch", 1)
+ .addInputBus("Side center line", 1)
+ .addInputHatch("Side center line", 1)
+ .addMaintenanceHatch("Side center line", 1)
+ .addDynamoHatch("Top center line", 2)
+ .addMufflerHatch("Back Center", 3)
+ .toolTipFinisher(CORE.GT_Tooltip_Builder);
+ return tt;
+ }
+
+ @Override
+ public IStructureDefinition<GregtechMetaTileEntity_LargeRocketEngine> getStructureDefinition() {
+ if (STRUCTURE_DEFINITION == null) {
+ STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_LargeRocketEngine>builder()
+ .addShape(mName, transpose(new String[][]{
+ {"CCC", "CTC", "CTC", "CTC", "CTC", "CTC", "CTC", "CTC", "CTC", "CCC"},
+ {"C~C", "SIS", "SIS", "SIS", "SIS", "SIS", "SIS", "SIS", "SIS", "CMC"},
+ {"CCC", "CSC", "CSC", "CSC", "CSC", "CSC", "CSC", "CSC", "CSC", "CCC"},
+ }))
+ .addElement(
+ 'C',
+ ofBlock(
+ getCasingBlock(), getCasingMeta()
+ )
+ )
+ .addElement(
+ 'I',
+ ofBlock(
+ getGearboxBlock(), getGearboxMeta()
+ )
+ )
+ .addElement(
+ 'T',
+ ofChain(
+ ofHatchAdder(
+ GregtechMetaTileEntity_LargeRocketEngine::addLargeRocketEngineTopList, getCasingTextureIndex(), 2
+ ),
+ onElementPass(
+ x -> ++x.mCasing,
+ ofBlock(
+ getCasingBlock(), getCasingMeta()
+ )
+ )
+ )
+ )
+ .addElement(
+ 'S',
+ ofChain(
+ ofHatchAdder(
+ GregtechMetaTileEntity_LargeRocketEngine::addLargeRocketEngineSideList, getCasingTextureIndex(), 1
+ ),
+ onElementPass(
+ x -> ++x.mCasing,
+ ofBlock(
+ getCasingBlock(), getCasingMeta()
+ )
+ )
+ )
+ )
+ .addElement(
+ 'M',
+ ofHatchAdder(
+ GregtechMetaTileEntity_LargeRocketEngine::addLargeRocketEngineBackList, getCasingTextureIndex(), 3
+ )
+ )
+ .build();
+ }
+ return STRUCTURE_DEFINITION;
+ }
+
+ @Override
+ public void construct(ItemStack stackSize, boolean hintsOnly) {
+ buildPiece(mName , stackSize, hintsOnly, 1, 1, 0);
+ }
+
+ @Override
+ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ mCasing = 0;
+ this.mTecTechDynamoHatches.clear();
+ this.mAllDynamoHatches.clear();
+ this.mAirIntakes.clear();
+ return checkPiece(mName, 1, 1, 0) && mCasing >= 64 - 48 && mAirIntakes.size() >= 8 && checkHatch();
+ }
+
+ public final boolean addLargeRocketEngineTopList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null) {
+ return false;
+ } else {
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Dynamo) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } if (LoadedMods.TecTech) {
+ if (isThisHatchMultiDynamo(aMetaTileEntity)) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ }
+ }
+ return false;
+ }
+
+ public final boolean addLargeRocketEngineSideList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null) {
+ return false;
+ } else {
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_AirIntake) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ }
+ return false;
+ }
+
+ public final boolean addLargeRocketEngineBackList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null) {
+ return false;
+ } else {
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+ if (aSide == aFacing) {
+ return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(CASING_ID), new GT_RenderedTexture(aActive ? TexturesGtBlock.Overlay_Machine_Controller_Advanced_Active : TexturesGtBlock.Overlay_Machine_Controller_Advanced) };
+ }
+ return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(CASING_ID) };
+ }
+
+ @Override
+ public boolean isCorrectMachinePart(final ItemStack aStack) {
+ return this.getMaxEfficiency(aStack) > 0;
+ }
+
+ @Override
+ public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) {
+ return super.getClientGUI(aID, aPlayerInventory, aBaseMetaTileEntity);
+ }
+
+ public int getAir() {
+ if (this.mAirIntakes.isEmpty() || this.mAirIntakes.size() <= 0) {
+ return 0;
+ }
+ else {
+ int totalAir = 0;
+ FluidStack airstack = FluidUtils.getFluidStack("air", 1);
+ for (GT_MetaTileEntity_Hatch_AirIntake u : this.mAirIntakes) {
+ if (u != null && u.mFluid != null) {
+ // had this trow errors cousing the machine to stop probebly fixed
+ FluidStack f = u.mFluid;
+ if (f.isFluidEqual(airstack)) {
+ totalAir += f.amount;
+ }
+ }
+ }
+ return totalAir;
+ }
+ }
+
+ @Override
+ public boolean checkRecipe(final ItemStack aStack) {
+ final ArrayList<FluidStack> tFluids = this.getStoredFluids();
+ FluidStack air = FluidUtils.getFluidStack("air", 1);
+
+ int aircount = getAir() ;
+ if (aircount < euProduction/100) {
+ //log("Not Enough Air to Run "+aircount);
+ return false;
+ }
+ else {
+ boolean hasIntakeAir = this.depleteInput(FluidUtils.getFluidStack(air, euProduction/100));
+ if (!hasIntakeAir) {
+ //log("Could not consume Air to run "+aircount);
+ freeFuelTicks = 0;
+ return false;
+ }
+ }
+ // reste fuel ticks incase it does not reset when it stops
+ if (freeFuelTicks != 0 && this.mProgresstime == 0 && this.mEfficiency == 0)
+ freeFuelTicks = 0;
+
+ //log("Running "+aircount);
+ log("looking at hatch");
+ final Collection<GT_Recipe> tRecipeList = GTPP_Recipe.GTPP_Recipe_Map.sRocketFuels.mRecipeList;
+
+
+ if (tFluids.size() > 0 && tRecipeList != null) {
+
+ if (tFluids.contains(MISC_MATERIALS.CARBON_DIOXIDE.getFluidStack(this.boostEu ? 3 : 1)) || tFluids.contains(FluidUtils.getFluidStack("carbondioxide", (this.boostEu ? 3 : 1)))) {
+ if (this.mRuntime % 72 == 0 || this.mRuntime == 0) {
+ if (!consumeCO2()) {
+ freeFuelTicks = 0;
+ return false;
+ }
+ }
+ } else
+ {
+ freeFuelTicks = 0;
+ return false;
+ }
+
+ if (freeFuelTicks == 0)
+ this.boostEu = consumeLOH();
+
+ for (final FluidStack hatchFluid1 : tFluids) {
+ if (hatchFluid1.isFluidEqual(air)) {
+ continue;
+ }
+
+ if (freeFuelTicks == 0) {
+ for (final GT_Recipe aFuel : tRecipeList) {
+ final FluidStack tLiquid;
+ tLiquid = aFuel.mFluidInputs[0];
+ if (hatchFluid1.isFluidEqual(tLiquid)) {
+ if (!consumeFuel(aFuel,hatchFluid1.amount)) {
+ continue;
+ }
+ this.fuelValue = aFuel.mSpecialValue;
+ this.fuelRemaining = hatchFluid1.amount;
+ this.mEUt = (int) ((this.mEfficiency < 2000) ? 0 : GT_Values.V[5]<<1);
+ this.mProgresstime = 1;
+ this.mMaxProgresstime = 1;
+ this.mEfficiencyIncrease = euProduction/2000;
+ return true;
+ //log("");
+ }
+ }
+
+ } else
+ {
+ this.mEfficiencyIncrease = euProduction/2000;
+ freeFuelTicks--;
+ this.mEUt = (int) ((this.mEfficiency < 1000) ? 0 : GT_Values.V[5]<<1);
+ this.mProgresstime = 1;
+ this.mMaxProgresstime = 1;
+ return true;
+ }
+
+ }
+ }
+ this.mEUt = 0;
+ this.mEfficiency = 0;
+ freeFuelTicks = 0;
+ return false;
+ }
+
+ /**
+ * Consumes Fuel if required. Free Fuel Ticks are handled here.
+ * @param aFuel
+ * @return
+ */
+ public boolean consumeFuel(GT_Recipe aFuel,int amount) {
+ amount *= this.boostEu ? 0.3 : 0.9;
+ freeFuelTicks = 0;
+ int value = aFuel.mSpecialValue * 3;
+ int energy = value * amount;
+ if (amount < 5)
+ return false;
+ FluidStack tLiquid = FluidUtils.getFluidStack(aFuel.mFluidInputs[0], (this.boostEu ? amount * 3 : amount));
+ if (!this.depleteInput(tLiquid)) {
+ return false;
+ }
+ else {
+ this.fuelConsumption = this.boostEu ? amount * 3 : amount;
+ this.freeFuelTicks = 20;
+ setEUProduction(energy);
+ return true;
+ }
+ }
+
+ public void setEUProduction(int energy){
+ energy /= 20;
+ double energyEfficiency;
+ double tDevideEnergy = Math.cbrt(energy);
+ if (energy > 10000) {
+ //cbrt(10 000) /
+ energyEfficiency = ((double) 21.5443469/tDevideEnergy);
+ if (energy >= 40000)
+ //cbrt(40 000) /
+ energyEfficiency *= ((double)34.19951893/tDevideEnergy);
+ energyEfficiency *= energy;
+ }
+ else {
+ energyEfficiency = energy;
+ }
+ euProduction = (int) ((double) energyEfficiency * 1.84);
+ if (this.boostEu)
+ euProduction *= 3;
+ }
+
+ public boolean consumeCO2() {
+ if (this.depleteInput(MISC_MATERIALS.CARBON_DIOXIDE.getFluidStack(this.boostEu ? 3 : 1)) || this.depleteInput(FluidUtils.getFluidStack("carbondioxide", (this.boostEu ? 3 : 1)))) {
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+
+ public boolean consumeLOH() {
+ int LOHamount = (3 * euProduction)/1000;
+ return this.depleteInput(FluidUtils.getFluidStack(RocketFuels.Liquid_Hydrogen, LOHamount)); //(40 * ((long) euProduction / 10000))
+ }
+
+ @Override
+ public boolean addEnergyOutput(long aEU) {
+ if (aEU <= 0) {
+ return true;
+ }
+ if (mAllDynamoHatches.size() > 0) {
+ return addEnergyOutputMultipleDynamos(aEU, true);
+ }
+ return false;
+ }
+
+
+ public boolean addEnergyOutputMultipleDynamos(long aEU, boolean aAllowMixedVoltageDynamos) {
+ int injected = 0;
+ long totalOutput = 0;
+ long aFirstVoltageFound = -1;
+ boolean aFoundMixedDynamos = false;
+ for (GT_MetaTileEntity_Hatch aDynamo : mAllDynamoHatches) {
+ if( aDynamo == null ) {
+ return false;
+ }
+ if (isValidMetaTileEntity(aDynamo)) {
+ long aVoltage = aDynamo.maxEUOutput();
+ long aTotal = aDynamo.maxAmperesOut() * aVoltage;
+ // Check against voltage to check when hatch mixing
+ if (aFirstVoltageFound == -1) {
+ aFirstVoltageFound = aVoltage;
+ }
+ else {
+ /**
+ * Calcualtes overclocked ness using long integers
+ * @param aEUt - recipe EUt
+ * @param aDuration - recipe Duration
+ * @param mAmperage - should be 1 ?
+ */
+ //Long time calculation
+ if (aFirstVoltageFound != aVoltage) {
+ aFoundMixedDynamos = true;
+ }
+ }
+ totalOutput += aTotal;
+ }
+ }
+
+ if (totalOutput < aEU || (aFoundMixedDynamos && !aAllowMixedVoltageDynamos)) {
+ explodeMultiblock();
+ return false;
+ }
+
+ long leftToInject;
+ //Long EUt calculation
+ long aVoltage;
+ //Isnt too low EUt check?
+ int aAmpsToInject;
+ int aRemainder;
+
+ //xEUt *= 4;//this is effect of everclocking
+ for (GT_MetaTileEntity_Hatch aDynamo : mAllDynamoHatches) {
+ if (isValidMetaTileEntity(aDynamo)) {
+ leftToInject = aEU - injected;
+ aVoltage = aDynamo.maxEUOutput();
+ aAmpsToInject = (int) (leftToInject / aVoltage);
+ aRemainder = (int) (leftToInject - (aAmpsToInject * aVoltage));
+ long powerGain;
+ for (int i = 0; i < Math.min(aDynamo.maxAmperesOut(), aAmpsToInject + 1); i++) {
+ if (i == Math.min(aDynamo.maxAmperesOut(), aAmpsToInject)){
+ powerGain = aRemainder;
+ }else{
+ powerGain = aVoltage;
+ }
+ aDynamo.getBaseMetaTileEntity().increaseStoredEnergyUnits(powerGain, false);
+ injected += powerGain;
+ }
+ }
+ }
+ return injected > 0;
+ }
+
+ @Override
+ public boolean onRunningTick(ItemStack aStack) {
+ if (this.mRuntime%20 == 0) {
+ if (mMufflerHatches.size() == 1 && mMufflerHatches.get(0) instanceof GT_MetaTileEntity_Hatch_Muffler_Adv) {
+ GT_MetaTileEntity_Hatch_Muffler_Adv tMuffler = (GT_MetaTileEntity_Hatch_Muffler_Adv) mMufflerHatches.get(0);
+ if (!tMuffler.hasValidFilter()) {
+ ArrayList<ItemStack> tInputs = getStoredInputs();
+ for (ItemStack tItem : tInputs) {
+ if (tMuffler.isAirFilter(tItem)) {
+ tMuffler.mInventory[0] = tItem.copy();
+ depleteInput(tItem);
+ updateSlots();
+ break;
+ }
+ }
+ }
+ }
+ }
+ super.onRunningTick(aStack);
+ return true;
+ }
+
+ public Block getCasingBlock() {
+ return ModBlocks.blockCasings4Misc;
+ }
+
+ public byte getCasingMeta() {
+ return 11;
+ }
+
+ public Block getGearboxBlock() {
+ return ModBlocks.blockCasings3Misc;
+ }
+
+ public byte getGearboxMeta() {
+ return 1;
+ }
+
+ public byte getCasingTextureIndex() {
+ return (byte) CASING_ID;
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaTileEntity_LargeRocketEngine(this.mName);
+ }
+
+ @Override
+ public void saveNBTData(final NBTTagCompound aNBT) {
+ aNBT.setInteger("freeFuelTicks", freeFuelTicks);
+ aNBT.setInteger("euProduction", euProduction);
+ super.saveNBTData(aNBT);
+ }
+
+ @Override
+ public void loadNBTData(final NBTTagCompound aNBT) {
+ super.loadNBTData(aNBT);
+ freeFuelTicks = aNBT.getInteger("freeFuelTicks");
+ euProduction = aNBT.getInteger("euProduction");
+ }
+
+ @Override
+ public int getDamageToComponent(final ItemStack aStack) {
+ return 1;
+ }
+
+ @Override
+ public int getMaxEfficiency(final ItemStack aStack) {
+ return euProduction;
+ }
+
+ @Override
+ public int getPollutionPerTick(final ItemStack aStack) {
+ return 75 * ( euProduction / 10000);
+ }
+
+ @Override
+ public boolean explodesOnComponentBreak(final ItemStack aStack) {
+ return true;
+ }
+
+ @Override
+ public String[] getExtraInfoData() {
+ return new String[] {
+ "Rocket Engine",
+ "Current Air: "+getAir(),
+ "Current Pollution: " + getPollutionPerTick(null),
+ "Time until next fuel consumption: "+freeFuelTicks,
+ "Current Output: " + this.mEUt * this.mEfficiency / 10000 + " EU/t",
+ "Fuel Consumption: " + (this.fuelConsumption) + "L/s",
+ "Fuel Value: " + this.fuelValue*3 + " EU/L",
+ "Fuel Remaining: " + this.fuelRemaining + " Litres",
+ "Current Efficiency: " + this.mEfficiency / 100 + "%",
+ (this.getIdealStatus() == this.getRepairStatus()) ? "No Maintainance issues" : "Needs Maintainance" };
+ }
+
+ @Override
+ public boolean isGivingInformation() {
+ return true;
+ }
+
+ @Override
+ public boolean hasSlotInGUI() {
+ return false;
+ }
+
+ @Override
+ public String getCustomGUIResourceName() {
+ return null;
+ }
+
+ @Override
+ public String getMachineType() {
+ return "Rocket Engine";
+ }
+
+ @Override
+ public int getMaxParallelRecipes() {
+ return 1;
+ }
+
+ @Override
+ public int getEuDiscountForParallelism() {
+ return 0;
+ }
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeSemifluidGenerator.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeSemifluidGenerator.java
new file mode 100644
index 0000000000..9be787e922
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeSemifluidGenerator.java
@@ -0,0 +1,341 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production;
+
+import java.util.ArrayList;
+
+import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
+import com.gtnewhorizon.structurelib.structure.StructureDefinition;
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.Materials;
+import gregtech.api.enums.Textures;
+import gregtech.api.gui.GT_GUIContainer_MultiMachine;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.implementations.*;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GTPP_Recipe.GTPP_Recipe_Map;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraftforge.fluids.FluidStack;
+
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
+
+public class GregtechMetaTileEntity_LargeSemifluidGenerator extends GregtechMeta_MultiBlockBase {
+
+ private int mCasing;
+ private IStructureDefinition<GregtechMetaTileEntity_LargeSemifluidGenerator> STRUCTURE_DEFINITION = null;
+
+ protected int fuelConsumption = 0;
+ protected int fuelValue = 0;
+ protected int fuelRemaining = 0;
+ protected boolean boostEu = false;
+
+ public GregtechMetaTileEntity_LargeSemifluidGenerator(int aID, String aName, String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ }
+
+ public GregtechMetaTileEntity_LargeSemifluidGenerator(String aName) {
+ super(aName);
+ }
+
+ @Override
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
+ GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType(getMachineType())
+ .addInfo("Controller Block for the Large Semifluid Generator")
+ .addInfo("Engine Intake Casings must not be obstructed in front (only air blocks)")
+ .addInfo("Supply Semifluid Fuels and 2000L of Lubricant per hour to run.")
+ .addInfo("Supply 80L of Oxygen per second to boost output (optional).")
+ .addInfo("Default: Produces 2048EU/t at 100% efficiency")
+ .addInfo("Boosted: Produces 6144EU/t at 150% efficiency")
+ .addPollutionAmount(getPollutionPerSecond(null))
+ .addSeparator()
+ .beginStructureBlock(3, 3, 4, false)
+ .addController("Front Center")
+ .addCasingInfo("Stable Titanium Machine Casing", 16)
+ .addCasingInfo("Steel Gear Box Machine Casing", 2)
+ .addCasingInfo("Engine Intake Machine Casing", 8)
+ .addInputHatch("Any Casing", 1)
+ .addMaintenanceHatch("Any Casing", 1)
+ .addMufflerHatch("Any Casing", 1)
+ .addDynamoHatch("Back Center", 2)
+ .toolTipFinisher(CORE.GT_Tooltip_Builder);
+ return tt;
+ }
+
+ public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
+ if (aSide == aFacing) {
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(50), new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_DIESEL_ENGINE_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_DIESEL_ENGINE)};
+ }
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(50)};
+ }
+
+ @Override
+ public boolean isCorrectMachinePart(ItemStack aStack) {
+ return getMaxEfficiency(aStack) > 0;
+ }
+
+ public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "LargeDieselEngine.png");
+ }
+
+ @Override
+ public boolean checkRecipe(ItemStack aStack) {
+ ArrayList<FluidStack> tFluids = getStoredFluids();
+
+ // Check for lubricant and oxygen first, so we can compute costs ahead of time.
+ // This will allow us to check costs without needing to actually try to deplete fluids
+ // (wasting earlier fluids in the check if later fluids turn out to be insufficient).
+ FluidStack lubricant = Materials.Lubricant.getFluid(0L);
+ FluidStack oxygen = Materials.Oxygen.getGas(0L);
+ for (FluidStack hatchFluid : tFluids) {
+ if (hatchFluid.isFluidEqual(lubricant)) {
+ lubricant.amount = Math.max(lubricant.amount, hatchFluid.amount);
+ } else if (hatchFluid.isFluidEqual(oxygen)) {
+ oxygen.amount = Math.max(oxygen.amount, hatchFluid.amount);
+ }
+ }
+ boostEu = oxygen.amount >= 4L;
+ long lubricantCost = boostEu ? 2L : 1L;
+ if (lubricant.amount < lubricantCost) {
+ return false;
+ }
+
+ for (FluidStack hatchFluid : tFluids) { //Loops through hatches
+ GT_Recipe aFuel = GTPP_Recipe_Map.sSemiFluidLiquidFuels.findFuel(hatchFluid);
+ if (aFuel == null) {
+ // Not a valid semi-fluid fuel.
+ continue;
+ }
+
+ int newEUt = boostEu ? 4096 : 2048;
+ fuelConsumption = newEUt / aFuel.mSpecialValue; //Calc fuel consumption
+ FluidStack tLiquid = new FluidStack(hatchFluid.getFluid(), fuelConsumption);
+ if(depleteInput(tLiquid)) { //Deplete that amount
+ // We checked beforehand, so both of these depletions should succeed.
+ // But check the return values anyway just to be safe.
+ if (boostEu) {
+ if (!depleteInput(Materials.Oxygen.getGas(4L))) {
+ return false;
+ }
+ }
+ //Deplete Lubricant. 2000L should = 1 hour of runtime (if baseEU = 2048)
+ if(mRuntime % 72 == 0 || mRuntime == 0) {
+ if(!depleteInput(Materials.Lubricant.getFluid(lubricantCost))) {
+ return false;
+ }
+ }
+
+ fuelValue = aFuel.mSpecialValue;
+ fuelRemaining = hatchFluid.amount; //Record available fuel
+ this.mEUt = mEfficiency < 2000 ? 0 : newEUt; //Output 0 if startup is less than 20%
+ this.mProgresstime = 1;
+ this.mMaxProgresstime = 1;
+ this.mEfficiencyIncrease = 15;
+ return true;
+ }
+ }
+
+ this.mEUt = 0;
+ this.mEfficiency = 0;
+ return false;
+ }
+
+ @Override
+ public IStructureDefinition<GregtechMetaTileEntity_LargeSemifluidGenerator> getStructureDefinition() {
+ if (STRUCTURE_DEFINITION == null) {
+ STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_LargeSemifluidGenerator>builder()
+ .addShape(mName, transpose(new String[][]{
+ {"III", "CCC", "CCC", "CCC"},
+ {"I~I", "CGC", "CGC", "CMC"},
+ {"III", "CCC", "CCC", "CCC"},
+ }))
+ .addElement(
+ 'C',
+ ofChain(
+ ofHatchAdder(
+ GregtechMetaTileEntity_LargeSemifluidGenerator::addLargeSemifluidGeneratorList, getCasingTextureIndex(), 1
+ ),
+ onElementPass(
+ x -> ++x.mCasing,
+ ofBlock(
+ getCasingBlock(), getCasingMeta()
+ )
+ )
+ )
+ )
+ .addElement(
+ 'G',
+ ofBlock(
+ getGearboxBlock(), getGearboxMeta()
+ )
+ )
+ .addElement(
+ 'I',
+ ofBlock(
+ getIntakeBlock(), getIntakeMeta()
+ )
+ )
+ .addElement(
+ 'M',
+ ofHatchAdder(
+ GregtechMetaTileEntity_LargeSemifluidGenerator::addLargeSemifluidGeneratorBackList, getCasingTextureIndex(), 2
+ )
+ )
+ .build();
+ }
+ return STRUCTURE_DEFINITION;
+ }
+
+ @Override
+ public void construct(ItemStack stackSize, boolean hintsOnly) {
+ buildPiece(mName , stackSize, hintsOnly, 1, 1, 0);
+ }
+
+ @Override
+ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ mCasing = 0;
+ mDynamoHatches.clear();
+ return checkPiece(mName, 1, 1, 0) && mCasing >= 16 && checkHatch();
+ }
+
+ public final boolean addLargeSemifluidGeneratorList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null) {
+ return false;
+ } else {
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ }
+ return false;
+ }
+
+ public final boolean addLargeSemifluidGeneratorBackList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null) {
+ return false;
+ } else {
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Dynamo || this.isThisHatchMultiDynamo(aTileEntity)){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ }
+ return false;
+ }
+
+ public Block getCasingBlock() {
+ return GregTech_API.sBlockCasings4;
+ }
+
+ public byte getCasingMeta() {
+ return 2;
+ }
+
+ public Block getIntakeBlock() {
+ return GregTech_API.sBlockCasings4;
+ }
+
+ public byte getIntakeMeta() {
+ return 13;
+ }
+
+ public Block getGearboxBlock() {
+ return GregTech_API.sBlockCasings2;
+ }
+
+ public byte getGearboxMeta() {
+ return 3;
+ }
+
+ public byte getCasingTextureIndex() {
+ return 50;
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaTileEntity_LargeSemifluidGenerator(this.mName);
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ super.saveNBTData(aNBT);
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ super.loadNBTData(aNBT);
+ }
+
+ @Override
+ public int getDamageToComponent(ItemStack aStack) {
+ return 1;
+ }
+
+ public int getMaxEfficiency(ItemStack aStack) {
+ return boostEu ? 15000 : 10000;
+ }
+
+ @Override
+ public int getPollutionPerSecond(ItemStack aStack) {
+ return CORE.ConfigSwitches.pollutionPerSecondMultiLargeSemiFluidGenerator;
+ }
+
+ @Override
+ public boolean explodesOnComponentBreak(ItemStack aStack) {
+ return true;
+ }
+
+ @Override
+ public String[] getExtraInfoData() {
+ return new String[]{
+ "Large Semifluid Generator",
+ "Current Output: " + mEUt * mEfficiency / 10000 + " EU/t",
+ "Fuel Consumption: " + fuelConsumption + "L/t",
+ "Fuel Value: " + fuelValue + " EU/L",
+ "Fuel Remaining: " + fuelRemaining + " Litres",
+ "Current Efficiency: " + (mEfficiency / 100) + "%",
+ getIdealStatus() == getRepairStatus() ? "No Maintainance issues" : "Needs Maintainance"};
+ }
+
+ @Override
+ public boolean isGivingInformation() {
+ return true;
+ }
+
+ @Override
+ public boolean hasSlotInGUI() {
+ return false;
+ }
+
+ @Override
+ public String getCustomGUIResourceName() {
+ return null;
+ }
+
+ @Override
+ public String getMachineType() {
+ return "Semifluid Generator";
+ }
+
+ @Override
+ public int getMaxParallelRecipes() {
+ return 0;
+ }
+
+ @Override
+ public int getEuDiscountForParallelism() {
+ return 0;
+ }
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_MassFabricator.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_MassFabricator.java
new file mode 100644
index 0000000000..f016288547
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_MassFabricator.java
@@ -0,0 +1,425 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
+import com.gtnewhorizon.structurelib.structure.StructureDefinition;
+import gregtech.api.enums.ConfigCategories;
+import gregtech.api.enums.ItemList;
+import gregtech.api.enums.Materials;
+import gregtech.api.enums.TAE;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.implementations.*;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.*;
+import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import gtPlusPlus.core.util.minecraft.PlayerUtils;
+import gtPlusPlus.xmod.gregtech.api.gui.GUI_MatterFab;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraftforge.fluids.FluidStack;
+
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
+
+public class GregtechMetaTileEntity_MassFabricator extends GregtechMeta_MultiBlockBase {
+
+ public static int sUUAperUUM = 1;
+ public static int sUUASpeedBonus = 4;
+ public static int sDurationMultiplier = 3200;
+
+ private int mMatterProduced = 0;
+ private int mScrapProduced = 0;
+ private int mAmplifierProduced = 0;
+ private int mScrapUsed = 0;
+ private int mAmplifierUsed = 0;
+
+ public static String mCasingName1 = "Matter Fabricator Casing";
+ public static String mCasingName2 = "Containment Casing";
+ public static String mCasingName3 = "Matter Generation Coil";
+
+ private int mMode = 0;
+
+ private final static int MODE_SCRAP = 1;
+ private final static int MODE_UU = 0;
+
+ public static boolean sRequiresUUA = false;
+ private static FluidStack[] mUU = new FluidStack[2];
+ private static ItemStack mScrap[] = new ItemStack[2];
+
+ private int mCasing;
+ private IStructureDefinition<GregtechMetaTileEntity_MassFabricator> STRUCTURE_DEFINITION = null;
+
+ public int getAmplifierUsed(){
+ return this.mAmplifierUsed;
+ }
+
+ public int getMatterProduced(){
+ return this.mMatterProduced;
+ }
+
+ public GregtechMetaTileEntity_MassFabricator(final int aID, final String aName, final String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ mCasingName1 = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasingsMisc, 9);
+ mCasingName2 = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings3Misc, 15);
+ mCasingName3 = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasingsMisc, 8);
+ }
+
+ public GregtechMetaTileEntity_MassFabricator(final String aName) {
+ super(aName);
+ mCasingName1 = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasingsMisc, 9);
+ mCasingName2 = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings3Misc, 15);
+ mCasingName3 = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasingsMisc, 8);
+ }
+
+ @Override
+ public String getMachineType() {
+ return "Mass Fabricator / Recycler";
+ }
+
+ @Override
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
+
+ if (mCasingName1.toLowerCase().contains(".name")) {
+ mCasingName1 = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasingsMisc, 9);
+ }
+ if (mCasingName2.toLowerCase().contains(".name")) {
+ mCasingName2 = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings3Misc, 15);
+ }
+ if (mCasingName3.toLowerCase().contains(".name")) {
+ mCasingName3 = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasingsMisc, 8);
+ }
+
+ GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType(getMachineType())
+ .addInfo("Controller Block for the Matter Fabricator")
+ .addInfo("Produces UU-A, UU-M & Scrap")
+ .addPollutionAmount(getPollutionPerSecond(null))
+ .addSeparator()
+ .beginStructureBlock(5, 4, 5, true)
+ .addController("Front Center")
+ .addCasingInfo(mCasingName3, 9)
+ .addCasingInfo(mCasingName2, 24)
+ .addCasingInfo(mCasingName1, 40)
+ .addInputBus("Any Casing", 1)
+ .addOutputBus("Any Casing", 1)
+ .addInputHatch("Any Casing", 1)
+ .addOutputHatch("Any Casing", 1)
+ .addEnergyHatch("Any Casing", 1)
+ .addMaintenanceHatch("Any Casing", 1)
+ .addMufflerHatch("Any Casing", 1)
+ .toolTipFinisher(CORE.GT_Tooltip_Builder);
+ return tt;
+ }
+
+ @Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+ if (aSide == aFacing) {
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(TAE.GTPP_INDEX(9)),
+ new GT_RenderedTexture(aActive ? TexturesGtBlock.Overlay_MatterFab_Active_Animated : TexturesGtBlock.Overlay_MatterFab_Animated)};
+ }
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(TAE.GTPP_INDEX(9))};
+ }
+
+ @Override
+ public boolean hasSlotInGUI() {
+ return false;
+ }
+
+ @Override
+ public String getCustomGUIResourceName() {
+ return "MatterFabricator";
+ }
+
+ public static ItemStack getScrapPile() {
+ if (mScrap[0] == null) {
+ mScrap[0] = ItemUtils.getSimpleStack(ItemUtils.getItemFromFQRN("IC2:itemScrap"));
+ }
+ return mScrap[0];
+ }
+ public static ItemStack getScrapBox() {
+ if (mScrap[1] == null) {
+ mScrap[1] = ItemUtils.getSimpleStack(ItemUtils.getItemFromFQRN("IC2:itemScrapbox"));
+ }
+ return mScrap[1];
+ }
+
+ @Override
+ public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GUI_MatterFab(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "MatterFabricator.png");
+ }
+
+ @Override
+ public void onConfigLoad(final GT_Config aConfig) {
+ super.onConfigLoad(aConfig);
+ sDurationMultiplier = aConfig.get(ConfigCategories.machineconfig, "Massfabricator.UUM_Duration_Multiplier", sDurationMultiplier);
+ sUUAperUUM = aConfig.get(ConfigCategories.machineconfig, "Massfabricator.UUA_per_UUM", sUUAperUUM);
+ sUUASpeedBonus = aConfig.get(ConfigCategories.machineconfig, "Massfabricator.UUA_Speed_Bonus", sUUASpeedBonus);
+ sRequiresUUA = aConfig.get(ConfigCategories.machineconfig, "Massfabricator.UUA_Requirement", sRequiresUUA);
+ //Materials.UUAmplifier.mChemicalFormula = ("Mass Fabricator Eff/Speed Bonus: x" + sUUASpeedBonus);
+ }
+
+ @Override
+ public boolean checkRecipe(final ItemStack aStack) {
+ ArrayList<ItemStack> tItems = getStoredInputs();
+ ArrayList<FluidStack> tFluids = getStoredFluids();
+ ItemStack[] tItemInputs = tItems.toArray(new ItemStack[tItems.size()]);
+ FluidStack[] tFluidInputs = tFluids.toArray(new FluidStack[tFluids.size()]);
+ return checkRecipeGeneric(tItemInputs, tFluidInputs, 4, 80, 00, 100);
+ }
+
+ @Override
+ public IStructureDefinition<GregtechMetaTileEntity_MassFabricator> getStructureDefinition() {
+ if (STRUCTURE_DEFINITION == null) {
+ STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_MassFabricator>builder()
+ .addShape(mName, transpose(new String[][]{
+ {"CCCCC", "CCCCC", "CCCCC", "CCCCC", "CCCCC"},
+ {"CGGGC", "G---G", "G---G", "G---G", "CGGGC"},
+ {"CGGGC", "G---G", "G---G", "G---G", "CGGGC"},
+ {"CC~CC", "CHHHC", "CHHHC", "CHHHC", "CCCCC"},
+ }))
+ .addElement(
+ 'C',
+ ofChain(
+ ofHatchAdder(
+ GregtechMetaTileEntity_MassFabricator::addMassFabricatorList, TAE.GTPP_INDEX(9), 1
+ ),
+ onElementPass(
+ x -> ++x.mCasing,
+ ofBlock(
+ ModBlocks.blockCasingsMisc, 9
+ )
+ )
+ )
+ )
+ .addElement(
+ 'H',
+ ofBlock(
+ ModBlocks.blockCasingsMisc, 8
+ )
+ )
+ .addElement(
+ 'G',
+ ofBlock(
+ ModBlocks.blockCasings3Misc, 15
+ )
+ )
+ .build();
+ }
+ return STRUCTURE_DEFINITION;
+ }
+
+ @Override
+ public void construct(ItemStack stackSize, boolean hintsOnly) {
+ buildPiece(mName , stackSize, hintsOnly, 2, 3, 0);
+ }
+
+ @Override
+ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ mCasing = 0;
+ return checkPiece(mName, 2, 3, 0) && mCasing >= 40 && checkHatch();
+ }
+
+ public final boolean addMassFabricatorList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null) {
+ return false;
+ } else {
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public int getMaxEfficiency(final ItemStack aStack) {
+ return 10000;
+ }
+
+ @Override
+ public int getPollutionPerSecond(final ItemStack aStack) {
+ return CORE.ConfigSwitches.pollutionPerSecondMultiMassFabricator;
+ }
+
+ @Override
+ public int getAmountOfOutputs() {
+ return 10;
+ }
+
+ @Override
+ public boolean explodesOnComponentBreak(final ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaTileEntity_MassFabricator(this.mName);
+ }
+
+ public boolean doesHatchContainUUA() {
+ if (mUU[0] == null) {
+ mUU[0] = Materials.UUAmplifier.getFluid(100);
+ }
+ if (mUU[1] == null) {
+ mUU[1] = Materials.UUMatter.getFluid(100);
+ }
+
+ if (mUU[0] != null && mUU[1] != null) {
+ for (GT_MetaTileEntity_Hatch_Input g : this.mInputHatches) {
+ if (g.getFluid() != null) {
+ if (g.mFluid.isFluidEqual(mUU[0])) {
+ return true;
+ }
+ }
+ }
+ }
+
+ return false;
+ }
+
+
+ /**
+ * Special Recipe Handling
+ */
+
+
+ @Override
+ public GT_Recipe_Map getRecipeMap() {
+ return this.mMode == MODE_SCRAP ? GT_Recipe_Map.sRecyclerRecipes : GTPP_Recipe.GTPP_Recipe_Map.sMatterFab2Recipes;
+ //return Recipe_GT.Gregtech_Recipe_Map.sMatterFab2Recipes;
+ }
+
+ @Override
+ public boolean checkRecipeGeneric(
+ ItemStack[] aItemInputs, FluidStack[] aFluidInputs,
+ int aMaxParallelRecipes, int aEUPercent,
+ int aSpeedBonusPercent, int aOutputChanceRoll) {
+
+ if (this.mMode == MODE_SCRAP) {
+
+ long tVoltage = getMaxInputVoltage();
+ byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage));
+ long tEnergy = getMaxInputEnergy();
+ GT_Recipe c = new GTPP_Recipe(false, new ItemStack[] { GT_Utility.copyAmount(1, aItemInputs[0]) },
+ GT_ModHandler.getRecyclerOutput(GT_Utility.copyAmount(64, aItemInputs[0]), 0) == null ? null
+ : new ItemStack[] { ItemList.IC2_Scrap.get(1) },
+ null, new int[] { 2000 }, null, null, 100,
+ (int) gregtech.api.enums.GT_Values.V[2], 0);
+
+ // EU discount
+ float tRecipeEUt = (c.mEUt * aEUPercent) / 100.0f;
+ float tTotalEUt = 0.0f;
+
+ int parallelRecipes = 0;
+ // Count recipes to do in parallel, consuming input items and fluids and considering input voltage limits
+ for (; parallelRecipes < aMaxParallelRecipes && tTotalEUt < (tEnergy - tRecipeEUt); parallelRecipes++) {
+ if (!c.isRecipeInputEqual(true, aFluidInputs, aItemInputs)) {
+ log("Broke at "+parallelRecipes+".");
+ break;
+ }
+ log("Bumped EU from "+tTotalEUt+" to "+(tTotalEUt+tRecipeEUt)+".");
+ tTotalEUt += tRecipeEUt;
+ }
+
+ if (parallelRecipes == 0) {
+ this.mEUt = (int) gregtech.api.enums.GT_Values.V[tTier];
+ this.mMaxProgresstime = 10;
+ return true;
+ }
+
+ return super.checkRecipeGeneric(c, getMaxParallelRecipes(), getEuDiscountForParallelism(), aSpeedBonusPercent, aOutputChanceRoll, true);
+ }
+
+ //Return normal Recipe handling
+ return super.checkRecipeGeneric(aItemInputs, aFluidInputs, getMaxParallelRecipes(), getEuDiscountForParallelism(), aSpeedBonusPercent, aOutputChanceRoll, true);
+ }
+
+ @Override
+ public int getMaxParallelRecipes() {
+ return this.mMode == MODE_SCRAP ? 32 : 2 * (Math.max(1, GT_Utility.getTier(getMaxInputVoltage())));
+ }
+
+ @Override
+ public int getEuDiscountForParallelism() {
+ return 80;
+ }
+
+ @Override
+ public void onModeChangeByScrewdriver(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ int aMode = this.mMode + 1;
+ if (aMode > 1) {
+ this.mMode = MODE_UU;
+ PlayerUtils.messagePlayer(aPlayer, "Mode ["+this.mMode+"]: Matter/AmpliFabricator");
+ }
+ else if (aMode == 1) {
+ this.mMode = MODE_SCRAP;
+ PlayerUtils.messagePlayer(aPlayer, "Mode ["+this.mMode+"]: Recycler");
+ }
+ else {
+ this.mMode = MODE_SCRAP;
+ PlayerUtils.messagePlayer(aPlayer, "Mode ["+this.mMode+"]: Recycler");
+ }
+ GT_Recipe_Map r = this.getRecipeMap();
+ final Collection<GT_Recipe> x = r.mRecipeList;
+ Logger.INFO("Dumping " + r.mUnlocalizedName + " Recipes for Debug. size: "+x.size());
+ for (final GT_Recipe newBo : x) {
+ Logger.INFO("========================");
+ Logger.INFO("Dumping Input: " + ItemUtils.getArrayStackNames(newBo.mInputs));
+ Logger.INFO("Dumping Inputs " + ItemUtils.getFluidArrayStackNames(newBo.mFluidInputs));
+ Logger.INFO("Dumping Duration: " + newBo.mDuration);
+ Logger.INFO("Dumping EU/t: " + newBo.mEUt);
+ Logger.INFO("Dumping Output: " + ItemUtils.getArrayStackNames(newBo.mOutputs));
+ Logger.INFO("Dumping Output: " + ItemUtils.getFluidArrayStackNames(newBo.mFluidOutputs));
+ Logger.INFO("========================");
+ }
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ aNBT.setInteger("mScrapProduced", mScrapProduced);
+ aNBT.setInteger("mAmplifierProduced", mAmplifierProduced);
+ aNBT.setInteger("mMatterProduced", mMatterProduced);
+ aNBT.setInteger("mScrapUsed", mScrapUsed);
+ aNBT.setInteger("mAmplifierUsed", mAmplifierUsed);
+ aNBT.setInteger("mMode", mMode);
+ super.saveNBTData(aNBT);
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ mScrapProduced = aNBT.getInteger("mScrapProduced");
+ mAmplifierProduced = aNBT.getInteger("mAmplifierProduced");
+ mMatterProduced = aNBT.getInteger("mMatterProduced");
+ mScrapUsed = aNBT.getInteger("mScrapUsed");
+ mAmplifierUsed = aNBT.getInteger("mAmplifierUsed");
+ mMode = aNBT.getInteger("mMode");
+ super.loadNBTData(aNBT);
+ }
+
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Refinery.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Refinery.java
new file mode 100644
index 0000000000..f86ecf3196
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Refinery.java
@@ -0,0 +1,238 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production;
+
+import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
+import com.gtnewhorizon.structurelib.structure.StructureDefinition;
+import gregtech.api.enums.TAE;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.implementations.*;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GTPP_Recipe;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
+import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
+import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
+import net.minecraft.item.ItemStack;
+
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
+
+public class GregtechMetaTileEntity_Refinery extends GregtechMeta_MultiBlockBase {
+
+ private int mCasing;
+ private IStructureDefinition<GregtechMetaTileEntity_Refinery> STRUCTURE_DEFINITION = null;
+
+ public GregtechMetaTileEntity_Refinery(final int aID, final String aName, final String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ }
+
+ public GregtechMetaTileEntity_Refinery(final String aName) {
+ super(aName);
+ }
+
+ @Override
+ public String getMachineType() {
+ return "Fuel Refinery";
+ }
+
+ @Override
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
+ GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType(getMachineType())
+ .addInfo("Controller Block for the Fission Fuel Processing Unit")
+ .addPollutionAmount(getPollutionPerSecond(null))
+ .addSeparator()
+ .beginStructureBlock(3, 9, 3, false)
+ .addController("Bottom Center")
+ .addCasingInfo("Hastelloy-X Structural Casing", 7)
+ .addCasingInfo("Incoloy-DS Fluid Containment Block", 5)
+ .addCasingInfo("Zeron-100 Reactor Shielding", 4)
+ .addCasingInfo("Hastelloy-N Sealant Blocks", 17)
+ .addInputHatch("Base platform", 1)
+ .addOutputHatch("Base platform", 1)
+ .addOutputBus("Base platform", 1)
+ .addMufflerHatch("Base platform", 1)
+ .addMaintenanceHatch("Base platform", 1)
+ .addEnergyHatch("Base platform", 1)
+ .addStructureInfo("Muffler's Tier must be LuV+")
+ .addStructureInfo("4x Input Hatches, 2x Output Hatches, 1x Output Bus")
+ .addStructureInfo("1x Muffler, 1x Maintenance Hatch, 1x Energy Hatch")
+ .toolTipFinisher(CORE.GT_Tooltip_Builder);
+ return tt;
+ }
+
+ @Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+ if (aSide == aFacing) {
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(TAE.GTPP_INDEX(18)), new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_MULTI_SMELTER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_MULTI_SMELTER)};
+ }
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(TAE.GTPP_INDEX(18))};
+ }
+
+ @Override
+ public boolean hasSlotInGUI() {
+ return false;
+ }
+
+ @Override
+ public String getCustomGUIResourceName() {
+ return "MatterFabricator";
+ }
+
+ @Override
+ public GT_Recipe_Map getRecipeMap() {
+ return GTPP_Recipe.GTPP_Recipe_Map.sFissionFuelProcessing;
+ }
+
+ @Override
+ public boolean checkRecipe(ItemStack aStack) {
+ //this.resetRecipeMapForAllInputHatches();
+ for (GT_MetaTileEntity_Hatch_Input g : this.mInputHatches) {
+ g.mRecipeMap = null;
+ }
+ boolean ab = super.checkRecipeGeneric();
+ //Logger.INFO("Did Recipe? "+ab);
+ return ab;
+ }
+
+ @Override
+ public int getMaxParallelRecipes() {
+ return 1;
+ }
+
+ @Override
+ public int getEuDiscountForParallelism() {
+ return 0;
+ }
+
+ public final boolean addRefineryList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null) {
+ return false;
+ } else {
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler && ((GT_MetaTileEntity_Hatch_Muffler) aMetaTileEntity).mTier >= 6) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public IStructureDefinition<GregtechMetaTileEntity_Refinery> getStructureDefinition() {
+ if (STRUCTURE_DEFINITION == null) {
+ STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_Refinery>builder()
+ .addShape(mName, transpose(new String[][]{
+ {" ", " N ", " "},
+ {" N ", "NIN", " N "},
+ {" N ", "NIN", " N "},
+ {" N ", "NIN", " N "},
+ {" Z ", "ZIZ", " Z "},
+ {" N ", "NIN", " N "},
+ {"XXX", "XXX", "XXX"},
+ {"X~X", "XXX", "XXX"},
+ }))
+ .addElement(
+ 'X',
+ ofChain(
+ ofHatchAdder(
+ GregtechMetaTileEntity_Refinery::addRefineryList, TAE.GTPP_INDEX(18), 1
+ ),
+ onElementPass(
+ x -> ++x.mCasing,
+ ofBlock(
+ ModBlocks.blockCasings2Misc, 2
+ )
+ )
+ )
+ )
+ .addElement(
+ 'I',
+ ofBlock(
+ ModBlocks.blockCasings2Misc, 3
+ )
+ )
+ .addElement(
+ 'N',
+ ofBlock(
+ ModBlocks.blockCasings2Misc, 1
+ )
+ )
+ .addElement(
+ 'Z',
+ ofBlock(
+ ModBlocks.blockCasingsMisc, 13
+ )
+ )
+ .build();
+ }
+ return STRUCTURE_DEFINITION;
+ }
+
+ @Override
+ public void construct(ItemStack stackSize, boolean hintsOnly) {
+ buildPiece(mName , stackSize, hintsOnly, 1, 7, 0);
+ }
+
+ @Override
+ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ mCasing = 0;
+ if (checkPiece(mName, 1, 7, 0) && mCasing >= 7) {
+ if (this.mInputHatches.size() == 4 && this.mOutputHatches.size() == 2 &&
+ this.mOutputBusses.size() == 1 && this.mMufflerHatches.size() == 1 &&
+ this.mMaintenanceHatches.size() == 1 && this.mEnergyHatches.size() == 1) {
+ this.resetRecipeMapForAllInputHatches(this.getRecipeMap());
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public boolean isCorrectMachinePart(final ItemStack aStack) {
+ return true;
+ }
+
+ @Override
+ public int getMaxEfficiency(final ItemStack aStack) {
+ return 10000;
+ }
+
+ @Override
+ public int getPollutionPerSecond(final ItemStack aStack) {
+ return CORE.ConfigSwitches.pollutionPerSecondMultiRefinery;
+ }
+
+ @Override
+ public int getDamageToComponent(final ItemStack aStack) {
+ return 0;
+ }
+
+ public int getAmountOfOutputs() {
+ return 5;
+ }
+
+ @Override
+ public boolean explodesOnComponentBreak(final ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaTileEntity_Refinery(this.mName);
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_SolarTower.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_SolarTower.java
new file mode 100644
index 0000000000..d42b33a403
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_SolarTower.java
@@ -0,0 +1,702 @@
+/*
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.TAE;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Recipe;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.api.objects.minecraft.BlockPos;
+import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.util.math.MathUtils;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import gtPlusPlus.xmod.gregtech.common.tileentities.misc.TileEntitySolarHeater;
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.world.World;
+
+public class GregtechMetaTileEntity_SolarTower
+extends GregtechMeta_MultiBlockBase {
+
+ //862
+ private static final int mCasingTextureID = TAE.getIndexFromPage(3, 4);
+ public static String mCasingName = "";
+ private int mHeight = 0;
+ private int mHeatLevel = 0;
+
+ public GregtechMetaTileEntity_SolarTower(final int aID, final String aName, final String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings4Misc, 4);
+ }
+
+ public GregtechMetaTileEntity_SolarTower(final String aName) {
+ super(aName);
+ mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings4Misc, 4);
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaTileEntity_SolarTower(this.mName);
+ }
+
+ @Override
+ public String getMachineType() {
+ return "Solar Tower";
+ }
+
+ @Override
+ public String[] getTooltip() {
+ if (mCasingName.toLowerCase().contains(".name")) {
+ mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings4Misc, 4);
+ }
+ return new String[]{
+ "Contributing Green Energy towards the future",
+ mCasingName+"s for the base of the tower",
+ };
+ }
+
+ @Override
+ public String getSound() {
+ return GregTech_API.sSoundList.get(Integer.valueOf(212));
+ }
+
+ @Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+ if (aSide == 0 || aSide == 1) {
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(TAE.getIndexFromPage(3, 6)),
+ new GT_RenderedTexture(aActive ? TexturesGtBlock.Overlay_Machine_Controller_Default_Active : TexturesGtBlock.Overlay_Machine_Controller_Default)};
+ }
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(TAE.getIndexFromPage(3, 6))};
+ }
+
+ @Override
+ public boolean hasSlotInGUI() {
+ return false;
+ }
+
+ @Override
+ public String getCustomGUIResourceName() {
+ return null;
+ }
+
+ @Override
+ public GT_Recipe.GT_Recipe_Map getRecipeMap() {
+ return null;
+ }
+
+ @Override
+ public boolean isFacingValid(final byte aFacing) {
+ return aFacing <= 1;
+ }
+
+ private Set<String> mCachedReflectors = new HashSet<String>();
+
+ public Set<String> getConnectedSolarReflectors(){
+ Set<String> mValidTilePositions = new HashSet<String>();
+ IGregTechTileEntity tTileEntity;
+ Map<String, BlockPos> mFastMap = new HashMap<String, BlockPos>();
+ for (int x = -64; x <= 64; x++) {
+ for (int z = -64; z <= 64; z++) {
+ int aX, aY, aZ;
+ aX = this.getBaseMetaTileEntity().getXCoord();
+ aY = this.mHeight;
+ aZ = this.getBaseMetaTileEntity().getZCoord();
+ BlockPos b = new BlockPos(aX+x, aY, aZ+z, this.getBaseMetaTileEntity().getWorld());
+
+ tTileEntity = getBaseMetaTileEntity().getIGregTechTileEntity(aX + x, this.mHeight, aZ + z);
+ if (tTileEntity == null) {
+ continue;
+ }
+ else {
+ Logger.INFO("Found Tile Entity at "+b.getLocationString());
+ if (tTileEntity.getMetaTileEntity() instanceof TileEntitySolarHeater) {
+ TileEntitySolarHeater mTile = (TileEntitySolarHeater) tTileEntity.getMetaTileEntity();
+ if (mTile != null) {
+ b = new BlockPos(tTileEntity.getXCoord(), tTileEntity.getYCoord(), tTileEntity.getZCoord(), tTileEntity.getWorld());
+ if (!mTile.mHasTower || mTile.mSolarTower == null) {
+ Logger.INFO("Found Solar Reflector, Injecting Data.");
+ mTile.setSolarTower(b);
+ }
+ mFastMap.put(b.getUniqueIdentifier(), b);
+ }
+ }
+ else {
+ continue;
+ }
+ }
+
+ if (addToMachineList(tTileEntity, mCasingTextureID)) {
+ continue;
+ }
+ }
+ }
+
+ for (BlockPos p : mFastMap.values()) {
+ if (mValidTilePositions.add(p.getUniqueIdentifier()));
+ }
+ mCachedReflectors = mValidTilePositions;
+ return mCachedReflectors;
+ }
+
+ @Override
+ public boolean checkRecipe(final ItemStack aStack) {
+ //this.mEfficiencyIncrease = 100;
+ //this.mMaxProgresstime = 100;
+ //this.mEUt = -4;
+ return true;
+ }
+
+ @Override
+ public int getMaxParallelRecipes() {
+ return 1;
+ }
+
+ @Override
+ public int getEuDiscountForParallelism() {
+ return 0;
+ }
+
+ @Override
+ public void startProcess() {
+ this.sendLoopStart((byte) 1);
+ }
+
+ @Override
+ public boolean checkMultiblock(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) {
+ this.mHeight = 0;
+ for (int i = 0; i <= 19; i++) {
+ if (!checkLayer(i)) {
+ Logger.INFO("Invalid Structure on Y level "+i);
+ return false;
+ }
+ }
+ if (mMaintenanceHatches.size() != 1) {
+ Logger.INFO("Bad Hatches");
+ return false;
+ }
+
+ this.mHeight = this.getBaseMetaTileEntity().getYCoord() - 19;
+ Logger.INFO("Built Structure");
+ if (!aBaseMetaTileEntity.getWorld().isRemote)
+ getConnectedSolarReflectors();
+ return true;
+ }
+
+ @Override
+ public int getMaxEfficiency(final ItemStack aStack) {
+ return 10000;
+ }
+
+ @Override
+ public int getPollutionPerTick(final ItemStack aStack) {
+ return 0;
+ }
+
+ @Override
+ public int getAmountOfOutputs() {
+ return 1;
+ }
+
+ @Override
+ public boolean explodesOnComponentBreak(final ItemStack aStack) {
+ return false;
+ }
+
+ public Block getCasingBlock() {
+ return ModBlocks.blockCasings4Misc;
+ }
+
+
+ public byte getCasingMeta() {
+ return 4;
+ }
+
+
+ public byte getCasingMeta2() {
+ return 5;
+ }
+
+
+ public byte getCasingMeta3() {
+ return 6;
+ }
+
+ public boolean isValidCasingBlock(Block aBlock, int aMeta) {
+ if (aBlock == getCasingBlock() && aMeta == getCasingMeta()) {
+ return true;
+ }
+ if (aBlock == getCasingBlock() && aMeta == getCasingMeta2()) {
+ return true;
+ }
+ if (aBlock == getCasingBlock() && aMeta == getCasingMeta3()) {
+ return true;
+ }
+ Logger.INFO("Found "+(aBlock != null ? aBlock.getLocalizedName() : "Air") + "With Meta "+aMeta);
+ return false;
+ }
+
+ public byte getCasingTextureIndex() {
+ return (byte) mCasingTextureID;
+ }
+
+ @Override
+ public void onModeChangeByScrewdriver(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ if (this.mHeight > 3) {}
+
+
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ super.saveNBTData(aNBT);
+ aNBT.setInteger("mHeight", mHeight);
+ aNBT.setInteger("mHeatLevel", mHeatLevel);
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ super.loadNBTData(aNBT);
+ mHeight = aNBT.getInteger("mHeight");
+ mHeatLevel = aNBT.getInteger("mHeatLevel");
+ }
+
+ public boolean checkLayer(int aY) {
+ if (aY >= 0 && aY <= 6) {
+ return checkTopLayers(-aY);
+ }
+ if (aY >= 7 && aY <= 16) {
+ return checkTowerLayer(-aY);
+ }
+ else if (aY >= 17 && aY <= 19) {
+ return checkBaseLayer(-aY);
+ }
+ Logger.INFO("Bad Y level to check");
+ return false;
+ }
+
+ public boolean checkTopLayers(int aY) {
+ Block aBlock;
+ int aMeta;
+
+ if (aY == 0) {
+ return true;
+ } else if (aY == -1) {
+ for (int x = -1; x <= 1; x++) {
+ for (int z = -1; z <= 1; z++) {
+ aBlock = this.getBaseMetaTileEntity().getBlockOffset(x, aY, z);
+ aMeta = this.getBaseMetaTileEntity().getMetaIDOffset(x, aY, z);
+ if (aBlock == getCasingBlock() && aMeta == getCasingMeta3()) {
+ continue;
+ } else {
+ Logger.INFO("Error at offset: X:"+x+", Y:"+aY+", Z:"+z);
+ Logger.INFO("Found Bad Block on Layer "+aY+": "+(aBlock != null ? aBlock.getLocalizedName() : "Air")+" | Meta: "+aMeta);
+ return false;
+ }
+ }
+ }
+ } else if (aY == -2 || aY == -6) {
+ for (int x = -2; x <= 2; x++) {
+ for (int z = -2; z <= 2; z++) {
+ aBlock = this.getBaseMetaTileEntity().getBlockOffset(x, aY, z);
+ aMeta = this.getBaseMetaTileEntity().getMetaIDOffset(x, aY, z);
+ //Edge Casing
+ if (x == -2 || x == 2 || z == -2 || z == 2) {
+ //Edge Corners
+ if ((x == 2 || x == -2) && (z == 2 | z == -2)) {
+ if (!getBaseMetaTileEntity().getAirOffset(x, aY, z)) {
+ Logger.INFO("Error at offset: X:"+x+", Y:"+aY+", Z:"+z);
+ Logger.INFO("Found Bad Block on Outside Corner "+aY+": "+(aBlock != null ? aBlock.getLocalizedName() : "Air")+" | Meta: "+aMeta);
+ return false;
+ }
+ else {
+ continue;
+ }
+ }
+ else {
+ //Edge Sides
+ if (aBlock == getCasingBlock() && aMeta == getCasingMeta3()) {
+ continue;
+ } else {
+ Logger.INFO("Error at offset: X:"+x+", Y:"+aY+", Z:"+z);
+ Logger.INFO("Found Bad Block on Layer "+aY+": "+(aBlock != null ? aBlock.getLocalizedName() : "Air")+" | Meta: "+aMeta);
+ return false;
+ }
+ }
+ }
+
+ //Internal
+ else {
+ if (aBlock == getCasingBlock() && aMeta == getCasingMeta2()) {
+ continue;
+ } else {
+ Logger.INFO("Error at offset: X:"+x+", Y:"+aY+", Z:"+z);
+ Logger.INFO("Found Bad Block Internally on Layer "+aY+": "+(aBlock != null ? aBlock.getLocalizedName() : "Air")+" | Meta: "+aMeta);
+ return false;
+ }
+ }
+ }
+ }
+ }
+ //Top Layers 7x7
+ else if (aY == -3 || aY == -5) {
+ for (int x = -3; x <= 3; x++) {
+ for (int z = -3; z <= 3; z++) {
+ aBlock = this.getBaseMetaTileEntity().getBlockOffset(x, aY, z);
+ aMeta = this.getBaseMetaTileEntity().getMetaIDOffset(x, aY, z);
+ //Edge Casing
+ if (x == -3 || x == 3 || z == -3 || z == 3) {
+
+ //3, 3
+ //2, 3
+ //3, 2
+
+ //Air Spacing
+ if (x == 3 && (z == -3 || z == -2 || z == 2 || z == 3)) {
+ if (!getBaseMetaTileEntity().getAirOffset(x, aY, z)) {
+ Logger.INFO("Error at offset: X:"+x+", Y:"+aY+", Z:"+z);
+ Logger.INFO("Found Bad Block on Outside Corner "+aY+": "+(aBlock != null ? aBlock.getLocalizedName() : "Air")+" | Meta: "+aMeta);
+ return false;
+ }
+ else {
+ continue;
+ }
+ }
+ else if (x == -3 && (z == -3 || z == -2 || z == 2 || z == 3)) {
+ if (!getBaseMetaTileEntity().getAirOffset(x, aY, z)) {
+ Logger.INFO("Error at offset: X:"+x+", Y:"+aY+", Z:"+z);
+ Logger.INFO("Found Bad Block on Outside Corner "+aY+": "+(aBlock != null ? aBlock.getLocalizedName() : "Air")+" | Meta: "+aMeta);
+ return false;
+ }
+ else {
+ continue;
+ }
+ }
+ else if (z == 3 && (x == -3 || x == -2 || x == 2 || x == 3)) {
+ if (!getBaseMetaTileEntity().getAirOffset(x, aY, z)) {
+ Logger.INFO("Error at offset: X:"+x+", Y:"+aY+", Z:"+z);
+ Logger.INFO("Found Bad Block on Outside Corner "+aY+": "+(aBlock != null ? aBlock.getLocalizedName() : "Air")+" | Meta: "+aMeta);
+ return false;
+ }
+ else {
+ continue;
+ }
+ }
+ else if (z == -3 && (x == -3 || x == -2 || x == 2 || x == 3)) {
+ if (!getBaseMetaTileEntity().getAirOffset(x, aY, z)) {
+ Logger.INFO("Error at offset: X:"+x+", Y:"+aY+", Z:"+z);
+ Logger.INFO("Found Bad Block on Outside Corner "+aY+": "+(aBlock != null ? aBlock.getLocalizedName() : "Air")+" | Meta: "+aMeta);
+ return false;
+ }
+ else {
+ continue;
+ }
+ }
+ else {
+ //Edge Sides
+ if (aBlock == getCasingBlock() && aMeta == getCasingMeta3()) {
+ continue;
+ } else {
+ Logger.INFO("Error at offset: X:"+x+", Y:"+aY+", Z:"+z);
+ Logger.INFO("Found Bad Block on Layer "+aY+": "+(aBlock != null ? aBlock.getLocalizedName() : "Air")+" | Meta: "+aMeta);
+ return false;
+ }
+ }
+ }
+ else if ((x == -2 || x == 2) & (z == -2 || z == 2)) {
+ if (aBlock == getCasingBlock() && aMeta == getCasingMeta3()) {
+ continue;
+ } else {
+ Logger.INFO("Error at offset: X:"+x+", Y:"+aY+", Z:"+z);
+ Logger.INFO("Found Bad Block on Layer "+aY+": "+(aBlock != null ? aBlock.getLocalizedName() : "Air")+" | Meta: "+aMeta);
+ return false;
+ }
+ }
+ //Internal
+ else {
+ if (aBlock == getCasingBlock() && aMeta == getCasingMeta2()) {
+ continue;
+ } else {
+ Logger.INFO("Error at offset: X:"+x+", Y:"+aY+", Z:"+z);
+ Logger.INFO("Found Bad Block Internally on Layer "+aY+": "+(aBlock != null ? aBlock.getLocalizedName() : "Air")+" | Meta: "+aMeta);
+ return false;
+ }
+ }
+ }
+ }
+ }
+ //Midle Top Layer 9x9
+ else if (aY == -4) {
+ //Check Inner 5x5
+ for (int x = -2; x <= 2; x++) {
+ for (int z = -2; z <= 2; z++) {
+ if (getBaseMetaTileEntity().getBlockOffset(x, aY, z) != getCasingBlock() && this.getBaseMetaTileEntity().getMetaIDOffset(x, aY, z) != getCasingMeta2()) {
+ Logger.INFO("Error at offset: X:" + x + ", Y:" + aY + ", Z:" + z);
+ return false;
+ }
+ else {
+ continue;
+ }
+ }
+ }
+ //Check Pos Sides
+ for (int z = -1; z <= -1; z++) {
+ if (getBaseMetaTileEntity().getBlockOffset(3, aY, z) == getCasingBlock()
+ && this.getBaseMetaTileEntity().getMetaIDOffset(3, aY, z) == getCasingMeta2()) {
+ continue;
+ } else if (getBaseMetaTileEntity().getBlockOffset(-3, aY, z) == getCasingBlock()
+ && this.getBaseMetaTileEntity().getMetaIDOffset(-3, aY, z) == getCasingMeta2()) {
+ continue;
+ } else {
+ Logger.INFO("1 Error at offset: X:3/-3" + ", Y:" + aY + ", Z:" + z);
+ return false;
+ }
+
+ }
+ for (int x = -1; x <= -1; x++) {
+ if (getBaseMetaTileEntity().getBlockOffset(x, aY, 3) == getCasingBlock()
+ && this.getBaseMetaTileEntity().getMetaIDOffset(x, aY, 3) == getCasingMeta2()) {
+ continue;
+ } else if (getBaseMetaTileEntity().getBlockOffset(x, aY, -3) == getCasingBlock()
+ && this.getBaseMetaTileEntity().getMetaIDOffset(x, aY, -3) == getCasingMeta2()) {
+ continue;
+ } else {
+ Logger.INFO("1 Error at offset: X:" + x + ", Y:" + aY + ", Z:3/-3");
+ return false;
+ }
+ }
+
+ //Corner Casings
+ for (int z = -2; z <= -2; z++) {
+ if (z == -2 || z == 2) {
+ if (getBaseMetaTileEntity().getBlockOffset(3, aY, z) == getCasingBlock()
+ && this.getBaseMetaTileEntity().getMetaIDOffset(3, aY, z) == getCasingMeta3()) {
+ continue;
+ } else if (getBaseMetaTileEntity().getBlockOffset(-3, aY, z) == getCasingBlock()
+ && this.getBaseMetaTileEntity().getMetaIDOffset(-3, aY, z) == getCasingMeta3()) {
+ continue;
+ } else {
+ Logger.INFO("2 Error at offset: X:3/-3" + ", Y:" + aY + ", Z:" + z);
+ return false;
+ }
+ }
+ }
+ for (int x = -2; x <= -2; x++) {
+ if (x == -2 || x == 2) {
+ if (getBaseMetaTileEntity().getBlockOffset(x, aY, 3) == getCasingBlock()
+ && this.getBaseMetaTileEntity().getMetaIDOffset(x, aY, 3) == getCasingMeta3()) {
+ continue;
+ } else if (getBaseMetaTileEntity().getBlockOffset(x, aY, -3) == getCasingBlock()
+ && this.getBaseMetaTileEntity().getMetaIDOffset(x, aY, -3) == getCasingMeta3()) {
+ continue;
+ } else {
+ Logger.INFO("2 Error at offset: X:" + x + ", Y:" + aY + ", Z:3/-3");
+ return false;
+ }
+ }
+ }
+ //Check Sides Casings
+ for (int z = -1; z <= -1; z++) {
+ if (getBaseMetaTileEntity().getBlockOffset(4, aY, z) == getCasingBlock()
+ && this.getBaseMetaTileEntity().getMetaIDOffset(4, aY, z) == getCasingMeta3()) {
+ continue;
+ } else if (getBaseMetaTileEntity().getBlockOffset(-4, aY, z) == getCasingBlock()
+ && this.getBaseMetaTileEntity().getMetaIDOffset(-4, aY, z) == getCasingMeta3()) {
+ continue;
+ } else {
+ Logger.INFO("1 Error at offset: X:3/-3" + ", Y:" + aY + ", Z:" + z);
+ return false;
+ }
+
+ }
+ for (int x = -1; x <= -1; x++) {
+ if (getBaseMetaTileEntity().getBlockOffset(x, aY, 4) == getCasingBlock()
+ && this.getBaseMetaTileEntity().getMetaIDOffset(x, aY, 4) == getCasingMeta3()) {
+ continue;
+ } else if (getBaseMetaTileEntity().getBlockOffset(x, aY, -4) == getCasingBlock()
+ && this.getBaseMetaTileEntity().getMetaIDOffset(x, aY, -4) == getCasingMeta3()) {
+ continue;
+ } else {
+ Logger.INFO("1 Error at offset: X:" + x + ", Y:" + aY + ", Z:3/-3");
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+
+ public boolean checkTowerLayer(int aY) {
+ Block aBlock;
+ int aMeta;
+ for (int x = -1; x <= 1; x++) {
+ for (int z = -1; z <= 1; z++) {
+ aBlock = this.getBaseMetaTileEntity().getBlockOffset(x, aY, z);
+ aMeta = this.getBaseMetaTileEntity().getMetaIDOffset(x, aY, z);
+ if (x == -1 || x == 1 || z == -1 || z == 1) {
+ if (aBlock == getCasingBlock() && aMeta == getCasingMeta()) {
+ continue;
+ } else {
+ Logger.INFO("Error at offset: X:"+x+", Y:"+aY+", Z:"+z);
+ Logger.INFO("Found Bad Block Externally on Layer "+aY+": "+(aBlock != null ? aBlock.getLocalizedName() : "Air")+" | Meta: "+aMeta);
+ return false;
+ }
+ } else {
+ if (aBlock == getCasingBlock() && aMeta == getCasingMeta2()) {
+ continue;
+ } else {
+ Logger.INFO("Error at offset: X:"+x+", Y:"+aY+", Z:"+z);
+ Logger.INFO("Found Bad Block Internally on Layer "+aY+": "+(aBlock != null ? aBlock.getLocalizedName() : "Air")+" | Meta: "+aMeta);
+ return false;
+ }
+ }
+ }
+ }
+ return true;
+ }
+
+ public boolean checkBaseLayer(int aY) {
+ Block aBlock;
+ int aMeta;
+
+ int requiredMeta = getCasingMeta2();
+ if (aY == -19) {
+ requiredMeta = getCasingMeta();
+ }
+
+ for (int x = -3; x <= 3; x++) {
+ for (int z = -3; z <= 3; z++) {
+ aBlock = this.getBaseMetaTileEntity().getBlockOffset(x, aY, z);
+ aMeta = this.getBaseMetaTileEntity().getMetaIDOffset(x, aY, z);
+
+ if ((x == 3 && z == 3) || (x == 2 && z == 2) || (x == 3 && z == 2) || (x == 2 && z == 3)) {
+ if (!getBaseMetaTileEntity().getAirOffset(x, aY, z)) {
+ Logger.INFO("Error at offset: X:"+x+", Y:"+aY+", Z:"+z);
+ return false;
+ }
+ }
+ else if ((x == -3 && z == -3) || (x == -2 && z == -2) || (x == -3 && z == -2) || (x == -2 && z == -3)) {
+ if (!getBaseMetaTileEntity().getAirOffset(x, aY, z)) {
+ Logger.INFO("Error at offset: X:"+x+", Y:"+aY+", Z:"+z);
+ return false;
+ }
+ }
+ else if ((x == -3 && z == 3) || (x == -2 && z == 2) || (x == -3 && z == 2) || (x == -2 && z == 3)) {
+ if (!getBaseMetaTileEntity().getAirOffset(x, aY, z)) {
+ Logger.INFO("Error at offset: X:"+x+", Y:"+aY+", Z:"+z);
+ return false;
+ }
+ }
+ else if ((x == 3 && z == -3) || (x == 2 && z == -2) || (x == 3 && z == -2) || (x == 2 && z == -3)) {
+ if (!getBaseMetaTileEntity().getAirOffset(x, aY, z)) {
+ Logger.INFO("Error at offset: X:"+x+", Y:"+aY+", Z:"+z);
+ return false;
+ }
+ }
+ else {
+ IGregTechTileEntity tTileEntity = getBaseMetaTileEntity().getIGregTechTileEntityOffset(x, aY, z);
+ if (addToMachineList(tTileEntity, mCasingTextureID)) {
+ continue;
+ }
+ if (x == 0 && z == 0) {
+ if (aBlock == getCasingBlock() && aMeta == requiredMeta) {
+ continue;
+ } else {
+ Logger.INFO("Error at offset: X:"+x+", Y:"+aY+", Z:"+z);
+ Logger.INFO("Found Bad Block Internally on Layer "+aY+": "+(aBlock != null ? aBlock.getLocalizedName() : "Air")+" | Meta: "+aMeta);
+ return false;
+ }
+ }
+ else {
+ if (aBlock == getCasingBlock() && aMeta == getCasingMeta()) {
+ continue;
+ } else {
+ Logger.INFO("Error at offset: X:"+x+", Y:"+aY+", Z:"+z);
+ Logger.INFO("Found Bad Block Internally on Layer "+aY+": "+(aBlock != null ? aBlock.getLocalizedName() : "Air")+" | Meta: "+aMeta);
+ return false;
+ }
+ }
+ }
+ }
+ }
+ return true;
+ }
+
+ @Override
+ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ super.onPostTick(aBaseMetaTileEntity, aTick);
+
+ //Add Heat every second
+ if (aTick % 20 == 0) {
+
+ //Add Heat First, if sources available
+ int aCacheSize = this.mCachedReflectors.size();
+ if (aCacheSize > 0) {
+ int aCount = aCacheSize;
+ for (int i = 0; i < aCount; i++) {
+ this.mHeatLevel++;
+ }
+ }
+
+ //Remove Heat, based on time of day
+ World w = this.getBaseMetaTileEntity().getWorld();
+ if (w != null) {
+ int aRemovalFactor = 0;
+ if (w.isDaytime()) {
+ aRemovalFactor = 1;
+ }
+ else {
+ aRemovalFactor = 3;
+ }
+ for (int i = 0; i<MathUtils.randInt((aCacheSize/10), (aCacheSize*10)); i++){
+ this.mHeatLevel -= aRemovalFactor;
+ }
+ }
+ }
+ }
+
+ @Override
+ public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ super.onPreTick(aBaseMetaTileEntity, aTick);
+ if (this.mCachedReflectors.isEmpty()) {
+ if (aTick % (30*20) == 0) {
+ this.getConnectedSolarReflectors();
+ }
+ }
+ }
+
+ @Override
+ public void onRemoval() {
+ this.mCachedReflectors.clear();
+ super.onRemoval();
+ }
+
+ @Override
+ public String[] getExtraInfoData() {
+ return new String[] {
+ "Internal Heat Level: "+this.mHeatLevel,
+ "Connected Solar Reflectors: "+this.mCachedReflectors.size()
+ };
+ }
+
+
+
+
+
+
+
+
+
+}
+*/
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/algae/GregtechMTE_AlgaePondBase.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/algae/GregtechMTE_AlgaePondBase.java
new file mode 100644
index 0000000000..4759457d8d
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/algae/GregtechMTE_AlgaePondBase.java
@@ -0,0 +1,486 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.algae;
+
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
+import static gtPlusPlus.core.util.data.ArrayUtils.removeNulls;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.gtnewhorizon.structurelib.alignment.IAlignmentLimits;
+import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
+import com.gtnewhorizon.structurelib.structure.StructureDefinition;
+import gregtech.api.metatileentity.implementations.*;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
+import gtPlusPlus.core.lib.CORE;
+import org.apache.commons.lang3.ArrayUtils;
+
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.TAE;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.item.chemistry.AgriculturalChem;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.minecraft.FluidUtils;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import gtPlusPlus.xmod.gregtech.loaders.recipe.RecipeLoader_AlgaeFarm;
+import ic2.core.init.BlocksItems;
+import ic2.core.init.InternalName;
+import net.minecraft.block.Block;
+import net.minecraft.init.Blocks;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.FluidStack;
+
+public class GregtechMTE_AlgaePondBase extends GregtechMeta_MultiBlockBase {
+
+ private int mLevel = -1;
+ private int mCasing;
+ private IStructureDefinition<GregtechMTE_AlgaePondBase> STRUCTURE_DEFINITION = null;
+ private int checkMeta;
+
+ public GregtechMTE_AlgaePondBase(final int aID, final String aName, final String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ }
+
+ public GregtechMTE_AlgaePondBase(final String aName) {
+ super(aName);
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
+ return new GregtechMTE_AlgaePondBase(this.mName);
+ }
+
+ @Override
+ public String getMachineType() {
+ return "Algae Pond";
+ }
+
+ @Override
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
+ GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType(getMachineType())
+ .addInfo("Grows Algae!")
+ .addInfo("Controller Block for the Algae Farm")
+ .addInfo("Provide compost to boost production by one tier")
+ .addInfo("Does not require power or maintenance")
+ .addInfo("All Machine Casings must be the same tier, this dictates machine speed.")
+ .addInfo("Fill Input Hatch with water.")
+ .addPollutionAmount(getPollutionPerSecond(null))
+ .addSeparator()
+ .beginStructureBlock(9, 3, 9, true)
+ .addController("Front Center")
+ .addCasingInfo("Machine Casings", 64)
+ .addCasingInfo("Sterile Farm Casings", 34)
+ .addInputBus("Any Casing", 1)
+ .addOutputBus("Any Casing", 1)
+ .addInputHatch("Any Casing", 1)
+ .toolTipFinisher(CORE.GT_Tooltip_Builder);
+ return tt;
+ }
+
+ public void setMeta(int meta) {
+ checkMeta = meta;
+ }
+
+ public int getMeta() {
+ return checkMeta;
+ }
+
+ @Override
+ public IStructureDefinition<GregtechMTE_AlgaePondBase> getStructureDefinition() {
+ if (STRUCTURE_DEFINITION == null) {
+ STRUCTURE_DEFINITION = StructureDefinition.<GregtechMTE_AlgaePondBase>builder()
+ .addShape(mName, transpose(new String[][]{
+ {"XXXXXXXXX", "X X", "X X", "X X", "X X", "X X", "X X", "X X", "XXXXXXXXX"},
+ {"XXXXXXXXX", "X X", "X X", "X X", "X X", "X X", "X X", "X X", "XXXXXXXXX"},
+ {"CCCC~CCCC", "CCCCCCCCC", "CCCCCCCCC", "CCCCCCCCC", "CCCCCCCCC", "CCCCCCCCC", "CCCCCCCCC", "CCCCCCCCC", "CCCCCCCCC"},
+ }))
+ .addElement(
+ 'C',
+ ofChain(
+ ofHatchAdder(
+ GregtechMTE_AlgaePondBase::addAlgaePondBaseList, TAE.getIndexFromPage(1, 15), 1
+ ),
+ onElementPass(
+ x -> ++x.mCasing,
+ addTieredBlock(
+ GregTech_API.sBlockCasings1, GregtechMTE_AlgaePondBase::setMeta, GregtechMTE_AlgaePondBase::getMeta, 10
+ )
+ )
+ )
+ )
+ .addElement(
+ 'X',
+ ofBlock(
+ ModBlocks.blockCasings2Misc, 15
+ )
+ )
+ .build();
+ }
+ return STRUCTURE_DEFINITION;
+ }
+
+ @Override
+ public void construct(ItemStack stackSize, boolean hintsOnly) {
+ buildPiece(mName , stackSize, hintsOnly, 4, 2, 0);
+ }
+
+ @Override
+ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ mCasing = 0;
+ mLevel = 0;
+ checkMeta = 0;
+ if (checkPiece(mName, 4, 2, 0) && mCasing >= 64 && checkMeta > 0) {
+ mLevel = checkMeta - 1;
+ return true;
+ }
+ return false;
+ }
+
+ public final boolean addAlgaePondBaseList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null) {
+ return false;
+ } else {
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ }
+ return false;
+ }
+
+ @Override
+ protected IAlignmentLimits getInitialAlignmentLimits() {
+ // fuck
+ return (d, r, f) -> d.offsetY == 0 && r.isNotRotated() && !f.isVerticallyFliped();
+ }
+
+ @Override
+ public String getSound() {
+ return GregTech_API.sSoundList.get(Integer.valueOf(207));
+ }
+
+ @Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+
+ int aID = TAE.getIndexFromPage(1, 15);
+ if (mLevel > -1) {
+ aID = mLevel;
+ }
+ if (aSide == aFacing) {
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(aID), new GT_RenderedTexture(aActive ? TexturesGtBlock.Overlay_Machine_Controller_Default_Active : TexturesGtBlock.Overlay_Machine_Controller_Default)};
+ }
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(aID)};
+ }
+
+ @Override
+ public boolean hasSlotInGUI() {
+ return true;
+ }
+
+ @Override
+ public GT_Recipe.GT_Recipe_Map getRecipeMap() {
+ return null;
+ }
+
+ @Override
+ public int getMaxParallelRecipes() {
+ return 2;
+ }
+
+ @Override
+ public int getEuDiscountForParallelism() {
+ return 0;
+ }
+
+ public boolean checkForWater() {
+
+ // Get Facing direction
+ IGregTechTileEntity aBaseMetaTileEntity = this.getBaseMetaTileEntity();
+ int mDirectionX = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX;
+ int mCurrentDirectionX;
+ int mCurrentDirectionZ;
+ int mOffsetX_Lower = 0;
+ int mOffsetX_Upper = 0;
+ int mOffsetZ_Lower = 0;
+ int mOffsetZ_Upper = 0;
+
+ mCurrentDirectionX = 4;
+ mCurrentDirectionZ = 4;
+
+ mOffsetX_Lower = -4;
+ mOffsetX_Upper = 4;
+ mOffsetZ_Lower = -4;
+ mOffsetZ_Upper = 4;
+
+ // if (aBaseMetaTileEntity.fac)
+
+ final int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX
+ * mCurrentDirectionX;
+ final int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ
+ * mCurrentDirectionZ;
+
+ int tAmount = 0;
+ for (int i = mOffsetX_Lower + 1; i <= mOffsetX_Upper - 1; ++i) {
+ for (int j = mOffsetZ_Lower + 1; j <= mOffsetZ_Upper - 1; ++j) {
+ for (int h = 0; h < 2; h++) {
+ Block tBlock = aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j);
+ // byte tMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j);
+ if (tBlock == Blocks.air || tBlock == Blocks.flowing_water || tBlock == BlocksItems.getFluidBlock(InternalName.fluidDistilledWater)) {
+ if (this.getStoredFluids() != null) {
+ for (FluidStack stored : this.getStoredFluids()) {
+ if (stored.isFluidEqual(FluidUtils.getFluidStack("water", 1))) {
+ if (stored.amount >= 1000) {
+ // Utils.LOG_WARNING("Going to try swap an air block for water from inut bus.");
+ stored.amount -= 1000;
+ Block fluidUsed = Blocks.water;
+ aBaseMetaTileEntity.getWorld().setBlock(
+ aBaseMetaTileEntity.getXCoord() + xDir + i,
+ aBaseMetaTileEntity.getYCoord() + h,
+ aBaseMetaTileEntity.getZCoord() + zDir + j, fluidUsed);
+
+ }
+ }
+ }
+ }
+ }
+ tBlock = aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j);
+ if (tBlock == Blocks.water || tBlock == Blocks.flowing_water) {
+ ++tAmount;
+ // Logger.INFO("Found Water");
+ }
+ }
+ }
+ }
+
+ boolean isValidWater = tAmount >= 60;
+
+ if (isValidWater) {
+ Logger.INFO("Filled structure.");
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+
+ @Override
+ public int getMaxEfficiency(final ItemStack aStack) {
+ return 10000;
+ }
+
+ @Override
+ public int getPollutionPerSecond(final ItemStack aStack) {
+ return CORE.ConfigSwitches.pollutionPerSecondMultiAlgaePond;
+ }
+
+ @Override
+ public int getAmountOfOutputs() {
+ return 1;
+ }
+
+ @Override
+ public boolean explodesOnComponentBreak(final ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public String getCustomGUIResourceName() {
+ return null;
+ }
+
+ @Override
+ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ super.onPostTick(aBaseMetaTileEntity, aTick);
+ }
+
+ @Override
+ public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ super.onPreTick(aBaseMetaTileEntity, aTick);
+ this.fixAllMaintenanceIssue();
+ // Silly Client Syncing
+ if (aBaseMetaTileEntity.isClientSide()) {
+ this.mLevel = getCasingTier();
+ }
+
+ }
+
+ @Override
+ public boolean checkRecipe(final ItemStack aStack) {
+ return checkRecipeGeneric(getMaxParallelRecipes(), getEuDiscountForParallelism(), 0);
+ }
+
+ public boolean checkRecipeGeneric(
+ ItemStack[] aItemInputs, FluidStack[] aFluidInputs,
+ int aMaxParallelRecipes, int aEUPercent,
+ int aSpeedBonusPercent, int aOutputChanceRoll, GT_Recipe aRecipe) {
+
+ if (this.mLevel < 0) {
+ Logger.INFO("Bad Tier.");
+ return false;
+ }
+
+ if (!checkForWater()) {
+ Logger.INFO("Not enough Water.");
+ return false;
+ }
+
+ // Reset outputs and progress stats
+ this.mEUt = 0;
+ this.mMaxProgresstime = 0;
+ this.mOutputItems = new ItemStack[]{};
+ this.mOutputFluids = new FluidStack[]{};
+
+ Logger.INFO("Running checkRecipeGeneric(0)");
+
+ GT_Recipe tRecipe = RecipeLoader_AlgaeFarm.getTieredRecipeFromCache(this.mLevel, isUsingCompost(aItemInputs));
+
+ this.mLastRecipe = tRecipe;
+
+ if (tRecipe == null) {
+ return false;
+ }
+
+ aMaxParallelRecipes = this.canBufferOutputs(tRecipe, aMaxParallelRecipes);
+ if (aMaxParallelRecipes == 0) {
+ return false;
+ }
+ if (tRecipe.mInputs.length > 0) {
+ for (ItemStack aInputToConsume : tRecipe.mInputs) {
+ this.depleteInput(aInputToConsume);
+ }
+ }
+
+
+ // -- Try not to fail after this point - inputs have already been consumed! --
+
+
+ this.mMaxProgresstime = (int)(tRecipe.mDuration);
+ this.mEUt = 0;
+ this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
+ this.mEfficiencyIncrease = 10000;
+ Logger.INFO("Recipe time: "+this.mMaxProgresstime);
+ this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
+
+ // Collect fluid outputs
+ FluidStack[] tOutputFluids = new FluidStack[tRecipe.mFluidOutputs.length];
+ for (int h = 0; h < tRecipe.mFluidOutputs.length; h++) {
+ if (tRecipe.getFluidOutput(h) != null) {
+ tOutputFluids[h] = tRecipe.getFluidOutput(h).copy();
+ tOutputFluids[h].amount *= aMaxParallelRecipes;
+ }
+ }
+
+ // Collect output item types
+ ItemStack[] tOutputItems = new ItemStack[tRecipe.mOutputs.length];
+ for (int h = 0; h < tRecipe.mOutputs.length; h++) {
+ if (tRecipe.getOutput(h) != null) {
+ tOutputItems[h] = tRecipe.getOutput(h).copy();
+ tOutputItems[h].stackSize = 0;
+ }
+ }
+
+ // Set output item stack sizes (taking output chance into account)
+ for (int f = 0; f < tOutputItems.length; f++) {
+ if (tRecipe.mOutputs[f] != null && tOutputItems[f] != null) {
+ for (int g = 0; g < aMaxParallelRecipes; g++) {
+ if (getBaseMetaTileEntity().getRandomNumber(aOutputChanceRoll) < tRecipe.getOutputChance(f))
+ tOutputItems[f].stackSize += tRecipe.mOutputs[f].stackSize;
+ }
+ }
+ }
+
+ tOutputItems = removeNulls(tOutputItems);
+
+ // Sanitize item stack size, splitting any stacks greater than max stack size
+ List<ItemStack> splitStacks = new ArrayList<ItemStack>();
+ for (ItemStack tItem : tOutputItems) {
+ while (tItem.getMaxStackSize() < tItem.stackSize) {
+ ItemStack tmp = tItem.copy();
+ tmp.stackSize = tmp.getMaxStackSize();
+ tItem.stackSize = tItem.stackSize - tItem.getMaxStackSize();
+ splitStacks.add(tmp);
+ }
+ }
+
+ if (splitStacks.size() > 0) {
+ ItemStack[] tmp = new ItemStack[splitStacks.size()];
+ tmp = splitStacks.toArray(tmp);
+ tOutputItems = ArrayUtils.addAll(tOutputItems, tmp);
+ }
+
+ // Strip empty stacks
+ List<ItemStack> tSList = new ArrayList<ItemStack>();
+ for (ItemStack tS : tOutputItems) {
+ if (tS.stackSize > 0) tSList.add(tS);
+ }
+ tOutputItems = tSList.toArray(new ItemStack[tSList.size()]);
+
+ // Commit outputs
+ this.mOutputItems = tOutputItems;
+ this.mOutputFluids = tOutputFluids;
+ updateSlots();
+
+ // Play sounds (GT++ addition - GT multiblocks play no sounds)
+ startProcess();
+
+ Logger.INFO("GOOD RETURN - 1");
+ return true;
+
+ }
+
+ private boolean isUsingCompost(ItemStack[] aItemInputs) {
+ ItemStack aCompost = ItemUtils.getSimpleStack(AgriculturalChem.mCompost, 1);
+ for (ItemStack i : aItemInputs) {
+ if (GT_Utility.areStacksEqual(aCompost, i)) {
+ if (i.stackSize >= 8) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+
+ private int getCasingTier() {
+ if (this.getBaseMetaTileEntity().getWorld() == null) {
+ return 0;
+ }
+ try {
+ Block aInitStructureCheck;
+ int aInitStructureCheckMeta;
+ IGregTechTileEntity aBaseMetaTileEntity = this.getBaseMetaTileEntity();
+ int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX;
+ int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ;
+ aInitStructureCheck = aBaseMetaTileEntity.getBlockOffset(xDir, -1, zDir);
+ aInitStructureCheckMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir, -1, zDir);
+ if (aInitStructureCheck == GregTech_API.sBlockCasings1) {
+ return aInitStructureCheckMeta;
+ }
+ return 0;
+ }
+ catch (Throwable t) {
+ t.printStackTrace();
+ return 0;
+ }
+ }
+
+
+
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/bedrock/GregtechMetaTileEntity_BedrockMiningPlatform1.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/bedrock/GregtechMetaTileEntity_BedrockMiningPlatform1.java
new file mode 100644
index 0000000000..018120d614
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/bedrock/GregtechMetaTileEntity_BedrockMiningPlatform1.java
@@ -0,0 +1,46 @@
+/*
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.bedrock;
+
+import gregtech.api.enums.TAE;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gtPlusPlus.core.material.ALLOY;
+import gtPlusPlus.core.material.Material;
+
+public class GregtechMetaTileEntity_BedrockMiningPlatform1 extends GregtechMetaTileEntity_BedrockMiningPlatformBase {
+ public GregtechMetaTileEntity_BedrockMiningPlatform1(final int aID, final String aName, final String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ }
+
+ public GregtechMetaTileEntity_BedrockMiningPlatform1(final String aName) {
+ super(aName);
+ }
+
+ public String[] getTooltip() {
+ return this.getDescriptionInternal("I");
+ }
+
+ public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
+ return (IMetaTileEntity) new GregtechMetaTileEntity_BedrockMiningPlatform1(this.mName);
+ }
+
+ protected Material getFrameMaterial() {
+ return ALLOY.INCONEL_690;
+ }
+
+ protected int getCasingTextureIndex() {
+ return TAE.getIndexFromPage(0, 14);
+ }
+
+ protected int getRadiusInChunks() {
+ return 9;
+ }
+
+ protected int getMinTier() {
+ return 5;
+ }
+
+ protected int getBaseProgressTime() {
+ return (int) (420*(this.mProductionModifier/100));
+ }
+}*/
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/bedrock/GregtechMetaTileEntity_BedrockMiningPlatform2.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/bedrock/GregtechMetaTileEntity_BedrockMiningPlatform2.java
new file mode 100644
index 0000000000..6b97cb7ee2
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/bedrock/GregtechMetaTileEntity_BedrockMiningPlatform2.java
@@ -0,0 +1,46 @@
+/*
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.bedrock;
+
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+
+import gtPlusPlus.core.material.ELEMENT;
+import gtPlusPlus.core.material.Material;
+
+public class GregtechMetaTileEntity_BedrockMiningPlatform2 extends GregtechMetaTileEntity_BedrockMiningPlatformBase {
+ public GregtechMetaTileEntity_BedrockMiningPlatform2(final int aID, final String aName, final String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ }
+
+ public GregtechMetaTileEntity_BedrockMiningPlatform2(final String aName) {
+ super(aName);
+ }
+
+ public String[] getTooltip() {
+ return this.getDescriptionInternal("II");
+ }
+
+ public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
+ return (IMetaTileEntity) new GregtechMetaTileEntity_BedrockMiningPlatform2(this.mName);
+ }
+
+ protected Material getFrameMaterial() {
+ return ELEMENT.getInstance().AMERICIUM241;
+ }
+
+ protected int getCasingTextureIndex() {
+ return 62;
+ }
+
+ protected int getRadiusInChunks() {
+ return 9;
+ }
+
+ protected int getMinTier() {
+ return 5;
+ }
+
+ protected int getBaseProgressTime() {
+ return 480;
+ }
+}*/
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/bedrock/GregtechMetaTileEntity_BedrockMiningPlatformBase.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/bedrock/GregtechMetaTileEntity_BedrockMiningPlatformBase.java
new file mode 100644
index 0000000000..05a05d53e0
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/bedrock/GregtechMetaTileEntity_BedrockMiningPlatformBase.java
@@ -0,0 +1,683 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.bedrock;
+
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.GT_Values;
+import gregtech.api.enums.Textures;
+import gregtech.api.gui.GT_GUIContainer_MultiMachine;
+import gregtech.api.interfaces.IIconContainer;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_ModHandler;
+import gregtech.api.util.GT_Utility;
+import gregtech.common.GT_Worldgen_GT_Ore_Layer;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.api.objects.data.AutoMap;
+import gtPlusPlus.api.objects.data.Pair;
+import gtPlusPlus.core.lib.LoadedMods;
+import gtPlusPlus.core.material.ELEMENT;
+import gtPlusPlus.core.material.Material;
+import gtPlusPlus.core.material.ORES;
+import gtPlusPlus.core.util.math.MathUtils;
+import gtPlusPlus.core.util.minecraft.FluidUtils;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import gtPlusPlus.core.util.minecraft.MiningUtils;
+import gtPlusPlus.core.util.minecraft.OreDictUtils;
+import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.oredict.OreDictionary;
+
+public abstract class GregtechMetaTileEntity_BedrockMiningPlatformBase extends GregtechMeta_MultiBlockBase {
+
+ protected double mProductionModifier = 0;
+
+
+ private static final ItemStack miningPipe;
+ private static final ItemStack miningPipeTip;
+
+ private Block casingBlock;
+ private int casingMeta;
+ // private int frameMeta;
+ private int casingTextureIndex;
+
+ private ForgeDirection back;
+
+ private int xDrill;
+ private int yDrill;
+ private int zDrill;
+
+ private int[] xCenter = new int[5];
+ private int[] zCenter = new int[5];
+
+ public GregtechMetaTileEntity_BedrockMiningPlatformBase(final int aID, final String aName,
+ final String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ this.initFields();
+ }
+
+ public GregtechMetaTileEntity_BedrockMiningPlatformBase(final String aName) {
+ super(aName);
+ this.initFields();
+ }
+
+ private void initFields() {
+ this.casingBlock = this.getCasingBlockItem().getBlock();
+ this.casingMeta = this.getCasingBlockItem().get(0L, new Object[0]).getItemDamage();
+ this.casingTextureIndex = this.getCasingTextureIndex();
+ }
+
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing,
+ final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+ if (aSide == aFacing) {
+ return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(this.casingTextureIndex),
+ new GT_RenderedTexture(
+ (IIconContainer) (aActive ? Textures.BlockIcons.NAQUADAH_REACTOR_SOLID_FRONT_ACTIVE
+ : Textures.BlockIcons.NAQUADAH_REACTOR_SOLID_FRONT)) };
+ }
+ return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(this.casingTextureIndex) };
+ }
+
+ public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory,
+ final IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(),
+ "OreDrillingPlant.png");
+ }
+
+
+ public int getAmountOfOutputs() {
+ return 1;
+ }
+
+ public void saveNBTData(final NBTTagCompound aNBT) {
+ super.saveNBTData(aNBT);
+ aNBT.setDouble("mProductionModifier", mProductionModifier);
+ }
+
+ public void loadNBTData(final NBTTagCompound aNBT) {
+ super.loadNBTData(aNBT);
+ this.mProductionModifier = aNBT.getDouble("mProductionModifier");
+ }
+
+ public boolean checkRecipe(final ItemStack aStack) {
+ //this.setElectricityStats();
+
+
+ if (true) {
+ return false;
+ }
+
+ boolean[] didWork = new boolean[5];
+
+ if (!this.tryConsumeDrillingFluid()) {
+ Logger.INFO("No drilling Fluid.");
+ return false;
+ }
+
+ if (MathUtils.isNumberEven((int) this.mProductionModifier)) {
+ if (!this.tryConsumePyrotheum()) {
+ Logger.INFO("No tryConsumePyrotheum Fluid.");
+ return false;
+ }
+ else {
+ mProductionModifier++;
+ }
+ }
+ else {
+ if (!this.tryConsumeCryotheum()) {
+ Logger.INFO("No tryConsumeCryotheum Fluid.");
+ return false;
+ }
+ else {
+ mProductionModifier++;
+ }
+ }
+
+ for (int i = 0; i < 5; i++) {
+ process();
+ didWork[i] = true;
+ }
+
+ // Fail recipe handling if one pipe didn't handle properly, to try again
+ // next run.
+ for (boolean y : didWork) {
+ if (!y) {
+ Logger.INFO("[Bedrock Miner] Fail [x]");
+ return false;
+ }
+ }
+
+ this.mEUt = -8000;
+ this.mMaxProgresstime = 1;
+ this.mEfficiencyIncrease = 10000;
+
+ return true;
+ }
+
+ private boolean isEnergyEnough() {
+ long requiredEnergy = 512L + this.getMaxInputVoltage() * 4L;
+ for (final GT_MetaTileEntity_Hatch_Energy energyHatch : this.mEnergyHatches) {
+ requiredEnergy -= energyHatch.getEUVar();
+ if (requiredEnergy <= 0L) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private void setElectricityStats() {
+ //this.mEfficiency = this.getCurrentEfficiency((ItemStack) null);
+ this.mEfficiencyIncrease = 10000;
+ final int overclock = 8 << GT_Utility.getTier(this.getMaxInputVoltage());
+ //this.mEUt = -12 * overclock * overclock;
+ Logger.INFO("Trying to set EU to "+(12 * overclock * overclock));
+ int mCombinedAvgTime = 0;
+ for (int g = 0; g < 5; g++) {
+ mCombinedAvgTime += this.getBaseProgressTime() / overclock;
+ }
+ Logger.INFO("Trying to set Max Time to "+(mCombinedAvgTime));
+ //this.mMaxProgresstime = (mCombinedAvgTime / 5);
+ }
+
+ private boolean tryConsumeDrillingFluid() {
+ boolean consumed = false;
+ boolean g = (this.getBaseMetaTileEntity().getWorld().getTotalWorldTime() % 2 == 0);
+ consumed = (g ? tryConsumePyrotheum() : tryConsumeCryotheum());
+ if (consumed) {
+ //increaseProduction(g ? 2 : 1);
+ }
+ else {
+ //lowerProduction(g ? 5 : 3);
+ }
+ return consumed;
+ }
+
+ private boolean tryConsumePyrotheum() {
+ return this.depleteInput(FluidUtils.getFluidStack("pyrotheum", 4));
+ }
+
+ private boolean tryConsumeCryotheum() {
+ return this.depleteInput(FluidUtils.getFluidStack("cryotheum", 4));
+ }
+
+ private void putMiningPipesFromInputsInController() {
+ final int maxPipes = 64;
+ if (this.isHasMiningPipes(maxPipes)) {
+ return;
+ }
+ ItemStack pipes = this.getStackInSlot(1);
+ for (final ItemStack storedItem : this.getStoredInputs()) {
+ if (!storedItem.isItemEqual(GregtechMetaTileEntity_BedrockMiningPlatformBase.miningPipe)) {
+ continue;
+ }
+ if (pipes == null) {
+ this.setInventorySlotContents(1,
+ GT_Utility.copy(new Object[] { GregtechMetaTileEntity_BedrockMiningPlatformBase.miningPipe }));
+ pipes = this.getStackInSlot(1);
+ }
+ if (pipes.stackSize == maxPipes) {
+ break;
+ }
+ final int needPipes = maxPipes - pipes.stackSize;
+ final int transferPipes = (storedItem.stackSize < needPipes) ? storedItem.stackSize : needPipes;
+ final ItemStack itemStack = pipes;
+ itemStack.stackSize += transferPipes;
+ final ItemStack itemStack2 = storedItem;
+ itemStack2.stackSize -= transferPipes;
+ }
+ this.updateSlots();
+ }
+
+
+
+ private boolean isHasMiningPipes(final int minCount) {
+ final ItemStack pipe = this.getStackInSlot(1);
+ return pipe != null && pipe.stackSize > minCount - 1
+ && pipe.isItemEqual(GregtechMetaTileEntity_BedrockMiningPlatformBase.miningPipe);
+ }
+
+ public boolean checkMultiblock(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) {
+ this.updateCoordinates();
+ int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX;
+ int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ;
+ int tAmount = 0;
+ if (!aBaseMetaTileEntity.getAirOffset(xDir, 0, zDir)) {
+ return false;
+ } else {
+
+ Block aCasing = Block.getBlockFromItem(getCasingBlockItem().getItem());
+
+ for (int i = -1; i < 2; ++i) {
+ for (int j = -1; j < 2; ++j) {
+ for (int h = -1; h < 2; ++h) {
+ if (h != 0 || (xDir + i != 0 || zDir + j != 0) && (i != 0 || j != 0)) {
+ IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i,
+ h, zDir + j);
+ Block aBlock = aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j);
+ int aMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j);
+
+ if (!this.addToMachineList(tTileEntity, 48)) {
+ if (aBlock != aCasing) {
+ Logger.INFO("Found Bad Casing");
+ return false;
+ }
+ if (aMeta != 3) {
+ Logger.INFO("Found Bad Meta");
+ return false;
+ }
+ }
+ ++tAmount;
+
+
+
+ /*if (!isValidBlockForStructure(tTileEntity, 48, true, aBlock, aMeta, sBlockCasings4, 0)) {
+ Logger.INFO("Bad centrifuge casing");
+ return false;
+ }*/
+
+ }
+ }
+ }
+ }
+ return tAmount >= 10;
+ }
+
+ }
+
+ private void updateCoordinates() {
+ this.xDrill = this.getBaseMetaTileEntity().getXCoord();
+ this.yDrill = this.getBaseMetaTileEntity().getYCoord()-1;
+ this.zDrill = this.getBaseMetaTileEntity().getZCoord();
+ this.back = ForgeDirection.getOrientation((int) this.getBaseMetaTileEntity().getBackFacing());
+
+ // Middle
+ this.xCenter[0] = this.xDrill + this.back.offsetX;
+ this.zCenter[0] = this.zDrill + this.back.offsetZ;
+
+ this.xCenter[1] = xCenter[0] + 1;
+ this.zCenter[1] = zCenter[0];
+
+ this.xCenter[2] = xCenter[0] - 1;
+ this.zCenter[2] = zCenter[0];
+
+ this.xCenter[3] = xCenter[0];
+ this.zCenter[3] = zCenter[0] + 1;
+
+ this.xCenter[4] = xCenter[0];
+ this.zCenter[4] = zCenter[0] - 1;
+
+ }
+
+ public boolean isCorrectMachinePart(final ItemStack aStack) {
+ return true;
+ }
+
+ public int getMaxEfficiency(final ItemStack aStack) {
+ return 10000;
+ }
+
+ public int getPollutionPerTick(final ItemStack aStack) {
+ return 0;
+ }
+
+ public int getDamageToComponent(final ItemStack aStack) {
+ return 0;
+ }
+
+ public boolean explodesOnComponentBreak(final ItemStack aStack) {
+ return false;
+ }
+
+ protected GregtechItemList getCasingBlockItem() {
+ return GregtechItemList.Casing_BedrockMiner;
+ }
+
+ protected abstract Material getFrameMaterial();
+
+ protected abstract int getCasingTextureIndex();
+
+ protected abstract int getRadiusInChunks();
+
+ protected abstract int getMinTier();
+
+ protected abstract int getBaseProgressTime();
+
+ protected String[] getDescriptionInternal(final String tierSuffix) {
+ final String casings = this.getCasingBlockItem().get(0L, new Object[0]).getDisplayName();
+ return new String[] {
+ "Controller Block for the Experimental Deep Earth Drilling Platform - MK "
+ + ((tierSuffix != null) ? tierSuffix : ""),
+ "Size(WxHxD): 3x7x3, Controller (Front middle bottom)", "3x1x3 Base of " + casings,
+ "1x3x1 " + casings + " pillar (Center of base)",
+ "1x3x1 " + this.getFrameMaterial().getLocalizedName() + " Frame Boxes (Each pillar side and on top)",
+ "2x Input Hatch (Any bottom layer casing)",
+ "1x Input Bus for mining pipes (Any bottom layer casing; not necessary)",
+ "1x Output Bus (Any bottom layer casing)", "1x Maintenance Hatch (Any bottom layer casing)",
+ "1x " + GT_Values.VN[this.getMinTier()] + "+ Energy Hatch (Any bottom layer casing)",
+ "Radius is " + (this.getRadiusInChunks() << 4) + " blocks",
+ "Every tick, this machine altenates betweem consumption of Pyrotheum & Cryotheum",
+ "Pyrotheum is used to bore through the Mantle of the world",
+ "Cryotheum is used to keep the internal components cool",};
+ }
+
+ static {
+ miningPipe = GT_ModHandler.getIC2Item("miningPipe", 0L);
+ miningPipeTip = GT_ModHandler.getIC2Item("miningPipeTip", 0L);
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ private AutoMap<ItemStack> mOutputs;
+
+ public void process() {
+ ItemStack aOutput = generateOutputWithchance();
+ if (aOutput != null) {
+ this.addOutput(aOutput);
+ Logger.INFO("Mined some "+aOutput.getDisplayName());
+ }
+ this.updateSlots();
+ }
+
+ public ItemStack generateOutputWithchance() {
+ int aChance = MathUtils.randInt(0, 7500);
+ if (aChance < 100) {
+ return generateOutput();
+ }
+ else {
+ return null;
+ }
+ }
+
+ public ItemStack generateOutput() {
+ AutoMap<ItemStack> aData = generateOreForOutput();
+ int aMax = aData.size()-1;
+ return aData.get(MathUtils.randInt(0, aMax));
+ }
+
+ /**
+ * Here we generate valid ores and also a basic loot set
+ */
+
+ public AutoMap<ItemStack> generateOreForOutput() {
+
+ if (mOutputs != null) {
+ return mOutputs;
+ }
+
+ AutoMap<GT_Worldgen_GT_Ore_Layer> aOverWorldOres = MiningUtils.getOresForDim(0);
+ AutoMap<GT_Worldgen_GT_Ore_Layer> aNetherOres = MiningUtils.getOresForDim(-1);
+ AutoMap<GT_Worldgen_GT_Ore_Layer> aEndOres = MiningUtils.getOresForDim(1);
+
+ AutoMap<ItemStack> aTempMap = new AutoMap<ItemStack>();
+ Block tOreBlock = GregTech_API.sBlockOres1;
+ Logger.INFO("Ore Map contains "+aTempMap.size()+" values. [Initial]");
+
+ for (GT_Worldgen_GT_Ore_Layer layer : aOverWorldOres) {
+ if (layer.mEnabled) {
+ ItemStack aTempOreStack1 = ItemUtils.simpleMetaStack(tOreBlock, layer.mPrimaryMeta, 1);
+ ItemStack aTempOreStack2 = ItemUtils.simpleMetaStack(tOreBlock, layer.mSecondaryMeta, 1);
+ ItemStack aTempOreStack3 = ItemUtils.simpleMetaStack(tOreBlock, layer.mBetweenMeta, 1);
+ ItemStack aTempOreStack4 = ItemUtils.simpleMetaStack(tOreBlock, layer.mSporadicMeta, 1);
+ aTempMap.put(aTempOreStack1);
+ aTempMap.put(aTempOreStack2);
+ aTempMap.put(aTempOreStack3);
+ aTempMap.put(aTempOreStack4);
+ aTempMap.put(aTempOreStack1);
+ aTempMap.put(aTempOreStack2);
+ aTempMap.put(aTempOreStack3);
+ aTempMap.put(aTempOreStack4);
+ aTempMap.put(aTempOreStack1);
+ aTempMap.put(aTempOreStack2);
+ aTempMap.put(aTempOreStack3);
+ aTempMap.put(aTempOreStack4);
+ }
+ }
+ Logger.INFO("Ore Map contains "+aTempMap.size()+" values. [Overworld]");
+ for (GT_Worldgen_GT_Ore_Layer layer : aNetherOres) {
+ if (layer.mEnabled) {
+ ItemStack aTempOreStack1 = ItemUtils.simpleMetaStack(tOreBlock, layer.mPrimaryMeta, 1);
+ ItemStack aTempOreStack2 = ItemUtils.simpleMetaStack(tOreBlock, layer.mSecondaryMeta, 1);
+ ItemStack aTempOreStack3 = ItemUtils.simpleMetaStack(tOreBlock, layer.mBetweenMeta, 1);
+ ItemStack aTempOreStack4 = ItemUtils.simpleMetaStack(tOreBlock, layer.mSporadicMeta, 1);
+ aTempMap.put(aTempOreStack1);
+ aTempMap.put(aTempOreStack2);
+ aTempMap.put(aTempOreStack3);
+ aTempMap.put(aTempOreStack4);
+ aTempMap.put(aTempOreStack1);
+ aTempMap.put(aTempOreStack2);
+ aTempMap.put(aTempOreStack3);
+ aTempMap.put(aTempOreStack4);
+ }
+ }
+ Logger.INFO("Ore Map contains "+aTempMap.size()+" values. [Nether]");
+ for (GT_Worldgen_GT_Ore_Layer layer : aEndOres) {
+ if (layer.mEnabled) {
+ ItemStack aTempOreStack1 = ItemUtils.simpleMetaStack(tOreBlock, layer.mPrimaryMeta, 1);
+ ItemStack aTempOreStack2 = ItemUtils.simpleMetaStack(tOreBlock, layer.mSecondaryMeta, 1);
+ ItemStack aTempOreStack3 = ItemUtils.simpleMetaStack(tOreBlock, layer.mBetweenMeta, 1);
+ ItemStack aTempOreStack4 = ItemUtils.simpleMetaStack(tOreBlock, layer.mSporadicMeta, 1);
+ aTempMap.put(aTempOreStack1);
+ aTempMap.put(aTempOreStack2);
+ aTempMap.put(aTempOreStack3);
+ aTempMap.put(aTempOreStack4);
+ }
+ }
+ Logger.INFO("Ore Map contains "+aTempMap.size()+" values. [End]");
+
+ addOreTypeToMap(ELEMENT.getInstance().IRON, 200, aTempMap);
+ addOreTypeToMap(ELEMENT.getInstance().COPPER, 175, aTempMap);
+ addOreTypeToMap(ELEMENT.getInstance().TIN, 150, aTempMap);
+ addOreTypeToMap(ELEMENT.getInstance().GOLD, 150, aTempMap);
+ addOreTypeToMap(ELEMENT.getInstance().SILVER, 110, aTempMap);
+ addOreTypeToMap(ELEMENT.getInstance().NICKEL, 40, aTempMap);
+ addOreTypeToMap(ELEMENT.getInstance().ZINC, 40, aTempMap);
+ addOreTypeToMap(ELEMENT.getInstance().LEAD, 40, aTempMap);
+ addOreTypeToMap(ELEMENT.getInstance().ALUMINIUM, 30, aTempMap);
+ addOreTypeToMap(ELEMENT.getInstance().THORIUM, 20, aTempMap);
+ Logger.INFO("Ore Map contains "+aTempMap.size()+" values. [Extra Common Ores]");
+
+ AutoMap<Pair<String, Integer>> mMixedOreData = new AutoMap<Pair<String, Integer>>();
+ mMixedOreData.put(new Pair<String, Integer>("oreRuby", 30));
+ mMixedOreData.put(new Pair<String, Integer>("oreSapphire", 25));
+ mMixedOreData.put(new Pair<String, Integer>("oreEmerald", 25));
+ mMixedOreData.put(new Pair<String, Integer>("oreLapis", 40));
+ mMixedOreData.put(new Pair<String, Integer>("oreRedstone", 40));
+
+ if (LoadedMods.Thaumcraft || (OreDictUtils.containsValidEntries("oreAmber") && OreDictUtils.containsValidEntries("oreCinnabar"))) {
+ mMixedOreData.put(new Pair<String, Integer>("oreAmber", 20));
+ mMixedOreData.put(new Pair<String, Integer>("oreCinnabar", 20));
+ }
+ if (LoadedMods.Railcraft || OreDictUtils.containsValidEntries("oreSaltpeter")) {
+ mMixedOreData.put(new Pair<String, Integer>("oreSaltpeter", 10));
+ }
+ if (LoadedMods.IndustrialCraft2 || OreDictUtils.containsValidEntries("oreUranium")) {
+ mMixedOreData.put(new Pair<String, Integer>("oreUranium", 10));
+ }
+ if (OreDictUtils.containsValidEntries("oreSulfur")) {
+ mMixedOreData.put(new Pair<String, Integer>("oreSulfur", 15));
+ }
+ if (OreDictUtils.containsValidEntries("oreSilicon")) {
+ mMixedOreData.put(new Pair<String, Integer>("oreSilicon", 15));
+ }
+ if (OreDictUtils.containsValidEntries("oreApatite")) {
+ mMixedOreData.put(new Pair<String, Integer>("oreApatite", 25));
+ }
+
+ mMixedOreData.put(new Pair<String, Integer>("oreFirestone", 2));
+ mMixedOreData.put(new Pair<String, Integer>("oreBismuth", 20));
+ mMixedOreData.put(new Pair<String, Integer>("oreLithium", 20));
+ mMixedOreData.put(new Pair<String, Integer>("oreManganese", 20));
+ mMixedOreData.put(new Pair<String, Integer>("oreBeryllium", 20));
+ mMixedOreData.put(new Pair<String, Integer>("oreCoal", 75));
+ mMixedOreData.put(new Pair<String, Integer>("oreLignite", 75));
+ mMixedOreData.put(new Pair<String, Integer>("oreSalt", 15));
+ mMixedOreData.put(new Pair<String, Integer>("oreCalcite", 15));
+ mMixedOreData.put(new Pair<String, Integer>("oreBauxite", 20));
+ mMixedOreData.put(new Pair<String, Integer>("oreAlmandine", 15));
+ mMixedOreData.put(new Pair<String, Integer>("oreGraphite", 25));
+ mMixedOreData.put(new Pair<String, Integer>("oreGlauconite", 15));
+ mMixedOreData.put(new Pair<String, Integer>("orePyrolusite", 15));
+ mMixedOreData.put(new Pair<String, Integer>("oreGrossular", 15));
+ mMixedOreData.put(new Pair<String, Integer>("oreTantalite", 15));
+
+ for (Pair<String, Integer> g : mMixedOreData) {
+ for (int i=0; i<g.getValue();i++) {
+ aTempMap.put(ItemUtils.getItemStackOfAmountFromOreDict(g.getKey(), 1));
+ }
+ }
+ Logger.INFO("Ore Map contains "+aTempMap.size()+" values. [Extra Mixed Ores]");
+
+
+ addOreTypeToMap(ELEMENT.STANDALONE.RUNITE, 2, aTempMap);
+ addOreTypeToMap(ELEMENT.STANDALONE.GRANITE, 8, aTempMap);
+ Logger.INFO("Ore Map contains "+aTempMap.size()+" values. [OSRS Ores]");
+
+
+ AutoMap<Material> aMyOreMaterials = new AutoMap<Material>();
+ aMyOreMaterials.add(ORES.CROCROITE);
+ aMyOreMaterials.add(ORES.GEIKIELITE);
+ aMyOreMaterials.add(ORES.NICHROMITE);
+ aMyOreMaterials.add(ORES.TITANITE);
+ aMyOreMaterials.add(ORES.ZIMBABWEITE);
+ aMyOreMaterials.add(ORES.ZIRCONILITE);
+ aMyOreMaterials.add(ORES.GADOLINITE_CE);
+ aMyOreMaterials.add(ORES.GADOLINITE_Y);
+ aMyOreMaterials.add(ORES.LEPERSONNITE);
+ aMyOreMaterials.add(ORES.SAMARSKITE_Y);
+ aMyOreMaterials.add(ORES.SAMARSKITE_YB);
+ aMyOreMaterials.add(ORES.XENOTIME);
+ aMyOreMaterials.add(ORES.YTTRIAITE);
+ aMyOreMaterials.add(ORES.YTTRIALITE);
+ aMyOreMaterials.add(ORES.YTTROCERITE);
+ aMyOreMaterials.add(ORES.ZIRCON);
+ aMyOreMaterials.add(ORES.POLYCRASE);
+ aMyOreMaterials.add(ORES.ZIRCOPHYLLITE);
+ aMyOreMaterials.add(ORES.ZIRKELITE);
+ aMyOreMaterials.add(ORES.LANTHANITE_LA);
+ aMyOreMaterials.add(ORES.LANTHANITE_CE);
+ aMyOreMaterials.add(ORES.LANTHANITE_ND);
+ aMyOreMaterials.add(ORES.AGARDITE_Y);
+ aMyOreMaterials.add(ORES.AGARDITE_CD);
+ aMyOreMaterials.add(ORES.AGARDITE_LA);
+ aMyOreMaterials.add(ORES.AGARDITE_ND);
+ aMyOreMaterials.add(ORES.HIBONITE);
+ aMyOreMaterials.add(ORES.CERITE);
+ aMyOreMaterials.add(ORES.FLUORCAPHITE);
+ aMyOreMaterials.add(ORES.FLORENCITE);
+ aMyOreMaterials.add(ORES.CRYOLITE);
+ aMyOreMaterials.add(ORES.LAUTARITE);
+ aMyOreMaterials.add(ORES.LAFOSSAITE);
+ aMyOreMaterials.add(ORES.DEMICHELEITE_BR);
+ aMyOreMaterials.add(ORES.COMANCHEITE);
+ aMyOreMaterials.add(ORES.PERROUDITE);
+ aMyOreMaterials.add(ORES.HONEAITE);
+ aMyOreMaterials.add(ORES.ALBURNITE);
+ aMyOreMaterials.add(ORES.MIESSIITE);
+ aMyOreMaterials.add(ORES.KASHINITE);
+ aMyOreMaterials.add(ORES.IRARSITE);
+ aMyOreMaterials.add(ORES.RADIOBARITE);
+ aMyOreMaterials.add(ORES.DEEP_EARTH_REACTOR_FUEL_DEPOSIT);
+
+ for (Material aOreType : aMyOreMaterials) {
+ if (aOreType == ORES.DEEP_EARTH_REACTOR_FUEL_DEPOSIT || aOreType == ORES.RADIOBARITE) {
+ addOreTypeToMap(aOreType, 4, aTempMap);
+ }
+ else {
+ addOreTypeToMap(aOreType, 7, aTempMap);
+ }
+ }
+
+ //Cleanup Map
+ Logger.INFO("Ore Map contains "+aTempMap.size()+" values. [GT++]");
+ AutoMap<ItemStack> aCleanUp = new AutoMap<ItemStack>();
+ for (ItemStack verify : aTempMap) {
+ if (!ItemUtils.checkForInvalidItems(verify)) {
+ aCleanUp.put(verify);
+ }
+ }
+ Logger.INFO("Cleanup Map contains "+aCleanUp.size()+" values.");
+ for (ItemStack remove : aCleanUp) {
+ aTempMap.remove(remove);
+ }
+
+ //Generate Massive Map
+ AutoMap<ItemStack> aFinalMap = new AutoMap<ItemStack>();
+ for (ItemStack aTempItem : aTempMap) {
+ int aTempMulti = MathUtils.randInt(20, 50);
+ for (int i=0;i<aTempMulti;i++) {
+ aFinalMap.put(aTempItem.copy());
+ }
+ }
+ Logger.INFO("Final Ore Map contains "+aFinalMap.size()+" values.");
+ mOutputs = aFinalMap;
+ return mOutputs;
+ }
+
+
+ private static void addOreTypeToMap(Material aMaterial, int aAmount, AutoMap<ItemStack> aMap) {
+ for (int i=0; i<aAmount;i++) {
+ aMap.add(aMaterial.getOre(1));
+ }
+ }
+
+
+
+ @Override
+ public boolean hasSlotInGUI() {
+ return true;
+ }
+
+ @Override
+ public String getCustomGUIResourceName() {
+ return null;
+ }
+
+ @Override
+ public String getMachineType() {
+ return "Miner";
+ }
+
+ @Override
+ public int getMaxParallelRecipes() {
+ return 1;
+ }
+
+ @Override
+ public int getEuDiscountForParallelism() {
+ return 0;
+ }
+
+
+
+
+
+
+
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/GregtechMTE_ChemicalPlant.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/GregtechMTE_ChemicalPlant.java
new file mode 100644
index 0000000000..42912c4fa8
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/GregtechMTE_ChemicalPlant.java
@@ -0,0 +1,1046 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.chemplant;
+
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
+import static gtPlusPlus.core.util.data.ArrayUtils.removeNulls;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import org.apache.commons.lang3.ArrayUtils;
+
+import com.gtnewhorizon.structurelib.StructureLibAPI;
+import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
+import com.gtnewhorizon.structurelib.structure.IStructureElement;
+import com.gtnewhorizon.structurelib.structure.StructureDefinition;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Maintenance;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBus;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_TieredMachineBlock;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GTPP_Recipe;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.api.objects.data.AutoMap;
+import gtPlusPlus.api.objects.data.Triplet;
+import gtPlusPlus.core.item.chemistry.general.ItemGenericChemBase;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.recipe.common.CI;
+import gtPlusPlus.core.util.math.MathUtils;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.nbthandlers.GT_MetaTileEntity_Hatch_Catalysts;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import net.minecraft.block.Block;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.world.World;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.FluidStack;
+
+public class GregtechMTE_ChemicalPlant extends GregtechMeta_MultiBlockBase {
+
+ private int mSolidCasingTier = 0;
+ private int mMachineCasingTier = 0;
+ private int mPipeCasingTier = 0;
+ private int mCoilTier = 0;
+ private int checkCoil;
+ private int[] checkCasing = new int[8];
+ private int checkMachine;
+ private int checkPipe;
+ private int maxTierOfHatch;
+ private int mCasing;
+ private IStructureDefinition<GregtechMTE_ChemicalPlant> STRUCTURE_DEFINITION = null;
+
+ private ArrayList<GT_MetaTileEntity_Hatch_Catalysts> mCatalystBuses = new ArrayList<GT_MetaTileEntity_Hatch_Catalysts>();
+
+ private static final HashMap<Integer, Triplet<Block, Integer, Integer>> mTieredBlockRegistry = new HashMap<Integer, Triplet<Block, Integer, Integer>>();
+
+ public GregtechMTE_ChemicalPlant(final int aID, final String aName, final String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ }
+
+ public GregtechMTE_ChemicalPlant(final String aName) {
+ super(aName);
+ }
+
+ public static boolean registerMachineCasingForTier(int aTier, Block aBlock, int aMeta, int aCasingTextureID) {
+ int aSize = mTieredBlockRegistry.size();
+ int aSize2 = aSize;
+ Triplet<Block, Integer, Integer> aCasingData = new Triplet<Block, Integer, Integer>(aBlock, aMeta, aCasingTextureID);
+ if (mTieredBlockRegistry.containsKey(aTier)) {
+ CORE.crash("Tried to register a Machine casing for tier "+aTier+" to the Chemical Plant, however this tier already contains one.");
+ }
+ mTieredBlockRegistry.put(aTier, aCasingData);
+ aSize = mTieredBlockRegistry.size();
+ return aSize > aSize2;
+ }
+
+ private static int getCasingTextureIdForTier(int aTier) {
+ if (!mTieredBlockRegistry.containsKey(aTier)) {
+ return 10;
+ }
+ int aCasingID = mTieredBlockRegistry.get(aTier).getValue_3();
+ //Logger.INFO("Found casing texture ID "+aCasingID+" for tier "+aTier);
+ return aCasingID;
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
+ return new GregtechMTE_ChemicalPlant(this.mName);
+ }
+
+ @Override
+ public String getMachineType() {
+ return "Chemical Plant";
+ }
+
+ @Override
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
+ GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType(getMachineType())
+ .addInfo("Controller Block for the Chemical Plant")
+ .addInfo("Heavy Industry, now right at your doorstep!")
+ .addInfo("Please read the user manual for more information on construction and usage")
+ .addSeparator()
+ .addController("Bottom Center")
+ .addStructureHint("Catalyst Housing", 1)
+ .addInputBus("Bottom Casing", 1)
+ .addOutputBus("Bottom Casing", 1)
+ .addInputHatch("Bottom Casing", 1)
+ .addOutputHatch("Bottom Casing", 1)
+ .addEnergyHatch("Bottom Casing", 1)
+ .addMaintenanceHatch("Bottom Casing", 1)
+ .toolTipFinisher(CORE.GT_Tooltip_Builder);
+ return tt;
+ }
+
+ public void setMachineMeta(int meta) {
+ checkMachine = meta;
+ }
+
+ public int getMachineMeta() {
+ return checkMachine;
+ }
+
+ public void setPipeMeta(int meta) {
+ checkPipe = meta;
+ }
+
+ public int getPipeMeta() {
+ return checkPipe;
+ }
+
+ public void setCoilMeta(int meta) {
+ checkCoil = meta;
+ }
+
+ public int getCoilMeta() {
+ return checkCoil;
+ }
+
+ public int coilTier(int meta) {
+ switch (meta) {
+ case 0: return 1;
+ case 1: return 2;
+ case 2: return 3;
+ case 3: return 4;
+ case 4: return 5;
+ case 5: return 7;
+ case 6: return 8;
+ case 7: return 10;
+ case 8: return 11;
+ case 9: return 6;
+ case 10: return 9;
+ }
+ return 0;
+ }
+
+ @Override
+ public IStructureDefinition<GregtechMTE_ChemicalPlant> getStructureDefinition() {
+ if (STRUCTURE_DEFINITION == null) {
+ STRUCTURE_DEFINITION = StructureDefinition.<GregtechMTE_ChemicalPlant>builder()
+ .addShape(mName, transpose(new String[][]{
+ {"XXXXXXX", "XXXXXXX", "XXXXXXX", "XXXXXXX", "XXXXXXX", "XXXXXXX", "XXXXXXX"},
+ {"X X", " MMMMM ", " MHHHM ", " MHHHM ", " MHHHM ", " MMMMM ", "X X"},
+ {"X X", " ", " PPP ", " PPP ", " PPP ", " ", "X X"},
+ {"X X", " ", " HHH ", " HHH ", " HHH ", " ", "X X"},
+ {"X X", " ", " PPP ", " PPP ", " PPP ", " ", "X X"},
+ {"X X", " MMMMM ", " MHHHM ", " MHHHM ", " MHHHM ", " MMMMM ", "X X"},
+ {"CCC~CCC", "CMMMMMC", "CMMMMMC", "CMMMMMC", "CMMMMMC", "CMMMMMC", "CCCCCCC"},
+ }))
+ .addElement(
+ 'C',
+ ofChain(
+ ofHatchAdder(
+ GregtechMTE_ChemicalPlant::addChemicalPlantList, getCasingTextureID(), 1
+ ),
+ onElementPass(
+ x -> {++x.checkCasing[0]; ++x.mCasing;},
+ ofSolidCasing(0)
+ ),
+ onElementPass(
+ x -> {++x.checkCasing[1]; ++x.mCasing;},
+ ofSolidCasing(1)
+ ),
+ onElementPass(
+ x -> {++x.checkCasing[2]; ++x.mCasing;},
+ ofSolidCasing(2)
+ ),
+ onElementPass(
+ x -> {++x.checkCasing[3]; ++x.mCasing;},
+ ofSolidCasing(3)
+ ),
+ onElementPass(
+ x -> {++x.checkCasing[4]; ++x.mCasing;},
+ ofSolidCasing(4)
+ ),
+ onElementPass(
+ x -> {++x.checkCasing[5]; ++x.mCasing;},
+ ofSolidCasing(5)
+ ),
+ onElementPass(
+ x -> {++x.checkCasing[6]; ++x.mCasing;},
+ ofSolidCasing(6)
+ ),
+ onElementPass(
+ x -> {++x.checkCasing[7]; ++x.mCasing;},
+ ofSolidCasing(7)
+ )
+ )
+ )
+ .addElement(
+ 'X',
+ ofChain(
+ onElementPass(
+ x -> {++x.checkCasing[0]; ++x.mCasing;},
+ ofSolidCasing(0)
+ ),
+ onElementPass(
+ x -> {++x.checkCasing[1]; ++x.mCasing;},
+ ofSolidCasing(1)
+ ),
+ onElementPass(
+ x -> {++x.checkCasing[2]; ++x.mCasing;},
+ ofSolidCasing(2)
+ ),
+ onElementPass(
+ x -> {++x.checkCasing[3]; ++x.mCasing;},
+ ofSolidCasing(3)
+ ),
+ onElementPass(
+ x -> {++x.checkCasing[4]; ++x.mCasing;},
+ ofSolidCasing(4)
+ ),
+ onElementPass(
+ x -> {++x.checkCasing[5]; ++x.mCasing;},
+ ofSolidCasing(5)
+ ),
+ onElementPass(
+ x -> {++x.checkCasing[6]; ++x.mCasing;},
+ ofSolidCasing(6)
+ ),
+ onElementPass(
+ x -> {++x.checkCasing[7]; ++x.mCasing;},
+ ofSolidCasing(7)
+ )
+ )
+ )
+ .addElement(
+ 'M',
+ addTieredBlock(
+ GregTech_API.sBlockCasings1, GregtechMTE_ChemicalPlant::setMachineMeta, GregtechMTE_ChemicalPlant::getMachineMeta, 10
+ )
+ )
+ .addElement(
+ 'H',
+ addTieredBlock(
+ GregTech_API.sBlockCasings5, GregtechMTE_ChemicalPlant::setCoilMeta, GregtechMTE_ChemicalPlant::getCoilMeta, 11
+ )
+ )
+ .addElement(
+ 'P',
+ addTieredBlock(
+ GregTech_API.sBlockCasings2, GregtechMTE_ChemicalPlant::setPipeMeta, GregtechMTE_ChemicalPlant::getPipeMeta, 12, 16
+ )
+ )
+ .build();
+ }
+ return STRUCTURE_DEFINITION;
+ }
+
+ public static <T> IStructureElement<T> ofSolidCasing(int aIndex) {
+ return new IStructureElement<T>() {
+ @Override
+ public boolean check(T t, World world, int x, int y, int z) {
+ Block block = world.getBlock(x, y, z);
+ int meta = world.getBlockMetadata(x, y, z);
+ Block target = mTieredBlockRegistry.get(aIndex).getValue_1();
+ int targetMeta = mTieredBlockRegistry.get(aIndex).getValue_2();
+ return target.equals(block) && meta == targetMeta;
+ }
+
+ int getIndex(int size) {
+ if (size > 8) size = 8;
+ return size - 1;
+ }
+
+ @Override
+ public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
+ StructureLibAPI.hintParticle(world, x, y, z, mTieredBlockRegistry.get(getIndex(trigger.stackSize)).getValue_1(), mTieredBlockRegistry.get(getIndex(trigger.stackSize)).getValue_2());
+ return true;
+ }
+
+ @Override
+ public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
+ return world.setBlock(x, y, z, mTieredBlockRegistry.get(getIndex(trigger.stackSize)).getValue_1(), mTieredBlockRegistry.get(getIndex(trigger.stackSize)).getValue_2(), 3);
+ }
+ };
+ }
+
+ @Override
+ public void construct(ItemStack stackSize, boolean hintsOnly) {
+ buildPiece(mName , stackSize, hintsOnly, 3, 6, 0);
+ }
+
+ @Override
+ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ mCasing = 0;
+ for (int i = 0; i < 8; i++) {
+ checkCasing[i] = 0;
+ }
+ checkCoil = 0;
+ checkPipe = 0;
+ checkMachine = 0;
+ mSolidCasingTier = 0;
+ mMachineCasingTier = 0;
+ mPipeCasingTier = 0;
+ mCoilTier = 0;
+ mCatalystBuses.clear();
+ if (checkPiece(mName, 3, 6, 0) && mCasing >= 80) {
+ for (int i = 0; i < 8; i++) {
+ if (checkCasing[i] == mCasing) {
+ mSolidCasingTier = i;
+ }
+ else if (checkCasing[i] > 0)
+ return false;
+ }
+ mMachineCasingTier = checkMachine - 1;
+ mPipeCasingTier = checkPipe - 12;
+ mCoilTier = coilTier(checkCoil - 1);
+ updateHatchTexture();
+ return mMachineCasingTier >= maxTierOfHatch;
+ }
+ return false;
+ }
+
+ public void updateHatchTexture() {
+ for (GT_MetaTileEntity_Hatch h : mCatalystBuses) h.updateTexture(getCasingTextureID());
+ for (GT_MetaTileEntity_Hatch h : mInputBusses) h.updateTexture(getCasingTextureID());
+ for (GT_MetaTileEntity_Hatch h : mMaintenanceHatches) h.updateTexture(getCasingTextureID());
+ for (GT_MetaTileEntity_Hatch h : mEnergyHatches) h.updateTexture(getCasingTextureID());
+ for (GT_MetaTileEntity_Hatch h : mOutputBusses) h.updateTexture(getCasingTextureID());
+ for (GT_MetaTileEntity_Hatch h : mInputHatches) h.updateTexture(getCasingTextureID());
+ for (GT_MetaTileEntity_Hatch h : mOutputHatches) h.updateTexture(getCasingTextureID());
+ }
+
+ public final boolean addChemicalPlantList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null) {
+ return false;
+ } else {
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Catalysts){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus){
+ maxTierOfHatch = Math.max(maxTierOfHatch, ((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity).mTier);
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy){
+ maxTierOfHatch = Math.max(maxTierOfHatch, ((GT_MetaTileEntity_Hatch_Energy) aMetaTileEntity).mTier);
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) {
+ maxTierOfHatch = Math.max(maxTierOfHatch, ((GT_MetaTileEntity_Hatch_OutputBus) aMetaTileEntity).mTier);
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) {
+ maxTierOfHatch = Math.max(maxTierOfHatch, ((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity).mTier);
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) {
+ maxTierOfHatch = Math.max(maxTierOfHatch, ((GT_MetaTileEntity_Hatch_Output) aMetaTileEntity).mTier);
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public String getSound() {
+ return GregTech_API.sSoundList.get(Integer.valueOf(207));
+ }
+
+ @Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+
+ ITexture aOriginalTexture;
+
+ // Check things exist client side (The worst code ever)
+ if (aBaseMetaTileEntity.getWorld() != null) {
+
+ }
+ int aCasingID = getCasingTextureID();
+ aOriginalTexture = Textures.BlockIcons.getCasingTextureForId(aCasingID);
+
+ if (aSide == aFacing) {
+ return new ITexture[]{aOriginalTexture, new GT_RenderedTexture(aActive ? TexturesGtBlock.Overlay_Machine_Controller_Advanced_Active : TexturesGtBlock.Overlay_Machine_Controller_Advanced)};
+ }
+ return new ITexture[]{aOriginalTexture};
+ }
+
+ @Override
+ public boolean hasSlotInGUI() {
+ return true;
+ }
+
+ @Override
+ public GT_Recipe.GT_Recipe_Map getRecipeMap() {
+ if (GTPP_Recipe.GTPP_Recipe_Map.sChemicalPlant_GT.mRecipeList.size() == 0) {
+ generateRecipes();
+ }
+ return GTPP_Recipe.GTPP_Recipe_Map.sChemicalPlant_GT;
+ }
+
+ public static void generateRecipes() {
+ for (GT_Recipe i : GTPP_Recipe.GTPP_Recipe_Map.sChemicalPlantRecipes.mRecipeList) {
+ GTPP_Recipe.GTPP_Recipe_Map.sChemicalPlant_GT.add(i);
+ }
+ }
+
+ @Override
+ public int getMaxParallelRecipes() {
+ return 2 * getPipeCasingTier();
+ }
+
+ @Override
+ public int getEuDiscountForParallelism() {
+ return 100;
+ }
+
+ private int getSolidCasingTier() {
+ return this.mSolidCasingTier;
+ }
+
+ private int getMachineCasingTier() {
+ return mMachineCasingTier;
+ }
+
+ private int getPipeCasingTier() {
+ return mPipeCasingTier;
+ }
+
+ private int getCasingTextureID() {
+ // Check the Tier Client Side
+ int aTier = mSolidCasingTier;
+ return getCasingTextureIdForTier(aTier);
+ }
+
+ public boolean addToMachineList(IGregTechTileEntity aTileEntity) {
+ int aMaxTier = getMachineCasingTier();
+ final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_TieredMachineBlock) {
+ GT_MetaTileEntity_TieredMachineBlock aMachineBlock = (GT_MetaTileEntity_TieredMachineBlock) aMetaTileEntity;
+ int aTileTier = aMachineBlock.mTier;
+ if (aTileTier > aMaxTier) {
+ log("Hatch tier too high.");
+ return false;
+ }
+ else {
+ return addToMachineList(aTileEntity, getCasingTextureID());
+ }
+ }
+ else {
+ log("Bad Tile Entity being added to hatch map."); // Shouldn't ever happen, but.. ya know..
+ return false;
+ }
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ super.saveNBTData(aNBT);
+ aNBT.setInteger("mSolidCasingTier", this.mSolidCasingTier);
+ aNBT.setInteger("mMachineCasingTier", this.mMachineCasingTier);
+ aNBT.setInteger("mPipeCasingTier", this.mPipeCasingTier);
+ aNBT.setInteger("mCoilTier", this.mCoilTier);
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ super.loadNBTData(aNBT);
+ mSolidCasingTier = aNBT.getInteger("mSolidCasingTier");
+ mMachineCasingTier = aNBT.getInteger("mMachineCasingTier");
+ mPipeCasingTier = aNBT.getInteger("mPipeCasingTier");
+ mCoilTier = aNBT.getInteger("mCoilTier");
+ }
+
+ @Override
+ public boolean addToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity == null) {
+ return false;
+ }
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Catalysts) {
+ log("Found GT_MetaTileEntity_Hatch_Catalysts");
+ return addToMachineListInternal(mCatalystBuses, aMetaTileEntity, aBaseCasingIndex);
+ }
+ return super.addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+
+ @Override
+ public int getMaxEfficiency(final ItemStack aStack) {
+ return 10000;
+ }
+
+ @Override
+ public int getPollutionPerTick(final ItemStack aStack) {
+ return 0;
+ }
+
+ @Override
+ public int getAmountOfOutputs() {
+ return 1;
+ }
+
+ @Override
+ public boolean explodesOnComponentBreak(final ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public String getCustomGUIResourceName() {
+ return null;
+ }
+
+ // Same speed bonus as pyro oven
+ public int getSpeedBonus() {
+ return 50 * (this.mCoilTier - 2);
+ }
+
+ public int getMaxCatalystDurability() {
+ return 50;
+ }
+
+ @Override
+ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ if (aBaseMetaTileEntity.isServerSide()) {
+ if (this.mUpdate == 1 || this.mStartUpCheck == 1) {
+ this.mCatalystBuses.clear();
+ }
+ }
+ // Silly Client Syncing
+ if (aBaseMetaTileEntity.isClientSide()) {
+ if (this != null && this.getBaseMetaTileEntity() != null && this.getBaseMetaTileEntity().getWorld() != null) {
+ this.mSolidCasingTier = getCasingTierOnClientSide();
+ markDirty();
+ }
+ }
+ super.onPostTick(aBaseMetaTileEntity, aTick);
+ }
+
+ @Override
+ public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ super.onPreTick(aBaseMetaTileEntity, aTick);
+ }
+
+ @Override
+ public boolean checkRecipe(final ItemStack aStack) {
+ return checkRecipeGeneric(getMaxParallelRecipes(), getEuDiscountForParallelism(), getSpeedBonus());
+ }
+
+
+ @Override
+ public boolean checkRecipeGeneric(
+ ItemStack[] aItemInputs, FluidStack[] aFluidInputs,
+ int aMaxParallelRecipes, int aEUPercent,
+ int aSpeedBonusPercent, int aOutputChanceRoll, GT_Recipe aRecipe, boolean isOC) {
+
+ // Based on the Processing Array. A bit overkill, but very flexible.
+
+ // Reset outputs and progress stats
+ this.mEUt = 0;
+ this.mMaxProgresstime = 0;
+ this.mOutputItems = new ItemStack[]{};
+ this.mOutputFluids = new FluidStack[]{};
+
+ long tVoltage = getMaxInputVoltage();
+ byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage));
+ long tEnergy = getMaxInputEnergy();
+ log("Running checkRecipeGeneric(0)");
+
+ //GT_Recipe tRecipe = findRecipe(getBaseMetaTileEntity(), mLastRecipe, false, gregtech.api.enums.GT_Values.V[tTier], aFluidInputs, aItemInputs);
+ GT_Recipe tRecipe = findRecipe(mLastRecipe, gregtech.api.enums.GT_Values.V[tTier], getSolidCasingTier(), aItemInputs, aFluidInputs);
+
+ if (tRecipe == null) {
+ log("BAD RETURN - 1");
+ return false;
+ }
+
+ // checks if it has a catalyst
+ ItemStack tCatalystRecipe = findCatalyst(aItemInputs);
+ boolean aDoesRecipeNeedCatalyst = false;
+ for (ItemStack aInputItem : tRecipe.mInputs) {
+ if (ItemUtils.isCatalyst(aInputItem)) {
+ aDoesRecipeNeedCatalyst = true;
+ break;
+ }
+ }
+ if (aDoesRecipeNeedCatalyst) {
+ if (tCatalystRecipe == null) {
+ log("does not have catalyst");
+ return false;
+ }
+ if (mCatalystBuses.size() != 1) {
+ log("does not have correct number of catalyst hatches. (Required 1, found "+mCatalystBuses.size()+")");
+ return false;
+ }
+ }
+
+
+ log("Running checkRecipeGeneric(1)");
+ // Remember last recipe - an optimization for findRecipe()
+ this.mLastRecipe = tRecipe;
+
+ if (tRecipe.mSpecialValue > this.mSolidCasingTier) {
+ log("solid tier is too low");
+ return false;
+ }
+
+ aMaxParallelRecipes = this.canBufferOutputs(tRecipe, aMaxParallelRecipes);
+ if (aMaxParallelRecipes == 0) {
+ log("BAD RETURN - 2");
+ return false;
+ }
+
+ // checks if it has enough catalyst durability
+ ArrayList<ItemStack>tCatalysts = null;
+ int tMaxParallelCatalyst = aMaxParallelRecipes;
+ if (tCatalystRecipe != null) {
+ tCatalysts = new ArrayList<ItemStack>();
+ tMaxParallelCatalyst = getCatalysts(aItemInputs, tCatalystRecipe, aMaxParallelRecipes, tCatalysts);
+ log("Can process "+tMaxParallelCatalyst+" recipes. If less than "+aMaxParallelRecipes+", catalyst does not have enough durability.");
+ }
+
+ if (tMaxParallelCatalyst == 0) {
+ log("found not enough catalysts");
+ return false;
+ }
+
+ // EU discount
+ float tRecipeEUt = (tRecipe.mEUt * aEUPercent) / 100.0f;
+ float tTotalEUt = 0.0f;
+ log("aEUPercent "+aEUPercent);
+ log("mEUt "+tRecipe.mEUt);
+
+ int parallelRecipes = 0;
+
+ log("parallelRecipes: "+parallelRecipes);
+ log("aMaxParallelRecipes: "+tMaxParallelCatalyst);
+ log("tTotalEUt: "+tTotalEUt);
+ log("tVoltage: "+tVoltage);
+ log("tEnergy: "+tEnergy);
+ log("tRecipeEUt: "+tRecipeEUt);
+ // Count recipes to do in parallel, consuming input items and fluids and considering input voltage limits
+ for (; parallelRecipes < tMaxParallelCatalyst && tTotalEUt < (tEnergy - tRecipeEUt); parallelRecipes++) {
+ if (!tRecipe.isRecipeInputEqual(true, aFluidInputs, aItemInputs)) {
+ log("Broke at "+parallelRecipes+".");
+ break;
+ }
+ log("Bumped EU from "+tTotalEUt+" to "+(tTotalEUt+tRecipeEUt)+".");
+ tTotalEUt += tRecipeEUt;
+ }
+
+ if (parallelRecipes == 0) {
+ log("BAD RETURN - 3");
+ return false;
+ }
+
+ // -- Try not to fail after this point - inputs have already been consumed! --
+
+
+ // Convert speed bonus to duration multiplier
+ // e.g. 100% speed bonus = 200% speed = 100%/200% = 50% recipe duration.
+ aSpeedBonusPercent = Math.max(-99, aSpeedBonusPercent);
+ float tTimeFactor = 100.0f / (100.0f + aSpeedBonusPercent);
+ this.mMaxProgresstime = (int)(tRecipe.mDuration * tTimeFactor);
+
+ this.mEUt = (int)Math.ceil(tTotalEUt);
+
+ this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
+ this.mEfficiencyIncrease = 10000;
+
+ // Overclock
+ if (this.mEUt <= 16) {
+ this.mEUt = (this.mEUt * (1 << tTier - 1) * (1 << tTier - 1));
+ this.mMaxProgresstime = (this.mMaxProgresstime / (1 << tTier - 1));
+ } else {
+ while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) {
+ this.mEUt *= 4;
+ this.mMaxProgresstime /= 2;
+ }
+ }
+
+ if (this.mEUt > 0) {
+ this.mEUt = (-this.mEUt);
+ }
+
+
+ this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
+
+ // Collect fluid outputs
+ FluidStack[] tOutputFluids = new FluidStack[tRecipe.mFluidOutputs.length];
+ for (int h = 0; h < tRecipe.mFluidOutputs.length; h++) {
+ if (tRecipe.getFluidOutput(h) != null) {
+ tOutputFluids[h] = tRecipe.getFluidOutput(h).copy();
+ tOutputFluids[h].amount *= parallelRecipes;
+ }
+ }
+
+ // Collect output item types
+ ItemStack[] tOutputItems = new ItemStack[tRecipe.mOutputs.length];
+ for (int h = 0; h < tRecipe.mOutputs.length; h++) {
+ if (tRecipe.getOutput(h) != null) {
+ tOutputItems[h] = tRecipe.getOutput(h).copy();
+ tOutputItems[h].stackSize = 0;
+ }
+ }
+
+ // Set output item stack sizes (taking output chance into account)
+ for (int f = 0; f < tOutputItems.length; f++) {
+ if (tRecipe.mOutputs[f] != null && tOutputItems[f] != null) {
+ for (int g = 0; g < parallelRecipes; g++) {
+ if (getBaseMetaTileEntity().getRandomNumber(aOutputChanceRoll) < tRecipe.getOutputChance(f))
+ tOutputItems[f].stackSize += tRecipe.mOutputs[f].stackSize;
+ }
+ }
+ }
+
+ tOutputItems = removeNulls(tOutputItems);
+
+ // Sanitize item stack size, splitting any stacks greater than max stack size
+ List<ItemStack> splitStacks = new ArrayList<ItemStack>();
+ for (ItemStack tItem : tOutputItems) {
+ while (tItem.getMaxStackSize() < tItem.stackSize) {
+ ItemStack tmp = tItem.copy();
+ tmp.stackSize = tmp.getMaxStackSize();
+ tItem.stackSize = tItem.stackSize - tItem.getMaxStackSize();
+ splitStacks.add(tmp);
+ }
+ }
+
+ if (splitStacks.size() > 0) {
+ ItemStack[] tmp = new ItemStack[splitStacks.size()];
+ tmp = splitStacks.toArray(tmp);
+ tOutputItems = ArrayUtils.addAll(tOutputItems, tmp);
+ }
+
+ // Strip empty stacks
+ List<ItemStack> tSList = new ArrayList<ItemStack>();
+ for (ItemStack tS : tOutputItems) {
+ if (tS.stackSize > 0) tSList.add(tS);
+ }
+ tOutputItems = tSList.toArray(new ItemStack[tSList.size()]);
+
+ // Damage catalyst once all is said and done.
+ if (tCatalystRecipe != null) {
+ log("damaging catalyst");
+ damageCatalyst(tCatalystRecipe, parallelRecipes);
+ }
+
+ // Commit outputs
+ this.mOutputItems = tOutputItems;
+ this.mOutputFluids = tOutputFluids;
+ updateSlots();
+ for (GT_MetaTileEntity_Hatch_Catalysts h : mCatalystBuses) {
+ h.updateSlots();
+ h.tryFillUsageSlots();
+ }
+
+ // Play sounds (GT++ addition - GT multiblocks play no sounds)
+ startProcess();
+
+ log("GOOD RETURN - 1");
+ return true;
+ }
+
+ private static final HashMap<Long, AutoMap<GT_Recipe>> mTieredRecipeMap = new HashMap<Long, AutoMap<GT_Recipe>>();
+ private static final AutoMap<GT_Recipe> aTier0Recipes = new AutoMap<GT_Recipe>();
+ private static final AutoMap<GT_Recipe> aTier1Recipes = new AutoMap<GT_Recipe>();
+ private static final AutoMap<GT_Recipe> aTier2Recipes = new AutoMap<GT_Recipe>();
+ private static final AutoMap<GT_Recipe> aTier3Recipes = new AutoMap<GT_Recipe>();
+ private static final AutoMap<GT_Recipe> aTier4Recipes = new AutoMap<GT_Recipe>();
+ private static final AutoMap<GT_Recipe> aTier5Recipes = new AutoMap<GT_Recipe>();
+ private static final AutoMap<GT_Recipe> aTier6Recipes = new AutoMap<GT_Recipe>();
+ private static final AutoMap<GT_Recipe> aTier7Recipes = new AutoMap<GT_Recipe>();
+ private static boolean mInitRecipeCache = false;
+
+ private static void initRecipeCaches() {
+ if (!mInitRecipeCache) {
+ mTieredRecipeMap.put((long) 0, aTier0Recipes);
+ mTieredRecipeMap.put((long) 1, aTier1Recipes);
+ mTieredRecipeMap.put((long) 2, aTier2Recipes);
+ mTieredRecipeMap.put((long) 3, aTier3Recipes);
+ mTieredRecipeMap.put((long) 4, aTier4Recipes);
+ mTieredRecipeMap.put((long) 5, aTier5Recipes);
+ mTieredRecipeMap.put((long) 6, aTier6Recipes);
+ mTieredRecipeMap.put((long) 7, aTier7Recipes);
+ for (GT_Recipe aRecipe : GTPP_Recipe.GTPP_Recipe_Map.sChemicalPlant_GT.mRecipeList) {
+ if (aRecipe != null) {
+ switch (aRecipe.mSpecialValue) {
+ case 0:
+ aTier0Recipes.add(aRecipe);
+ continue;
+ case 1:
+ aTier1Recipes.add(aRecipe);
+ continue;
+ case 2:
+ aTier2Recipes.add(aRecipe);
+ continue;
+ case 3:
+ aTier3Recipes.add(aRecipe);
+ continue;
+ case 4:
+ aTier4Recipes.add(aRecipe);
+ continue;
+ case 5:
+ aTier5Recipes.add(aRecipe);
+ continue;
+ case 6:
+ aTier6Recipes.add(aRecipe);
+ continue;
+ case 7:
+ aTier7Recipes.add(aRecipe);
+ continue;
+ }
+ }
+ }
+ mInitRecipeCache = true;
+ }
+ }
+
+ private static boolean areInputsEqual(GT_Recipe aComparator, ItemStack[] aInputs, FluidStack[] aFluids) {
+ int aInputCount = aComparator.mInputs.length;
+ if (aInputCount > 0) {
+ //Logger.INFO("Looking for recipe with "+aInputCount+" Items");
+ int aMatchingInputs = 0;
+ recipe : for (ItemStack a : aComparator.mInputs) {
+ for (ItemStack b : aInputs) {
+ if (a.getItem() == b.getItem()) {
+ if (a.getItemDamage() == b.getItemDamage()) {
+ //Logger.INFO("Found matching Item Input - "+b.getUnlocalizedName());
+ aMatchingInputs++;
+ continue recipe;
+ }
+ }
+ }
+ }
+ if (aMatchingInputs != aInputCount) {
+ return false;
+ }
+ }
+ int aFluidInputCount = aComparator.mFluidInputs.length;
+ if (aFluidInputCount > 0) {
+ //Logger.INFO("Looking for recipe with "+aFluidInputCount+" Fluids");
+ int aMatchingFluidInputs = 0;
+ recipe : for (FluidStack b : aComparator.mFluidInputs) {
+ //Logger.INFO("Checking for fluid "+b.getLocalizedName());
+ for (FluidStack a : aFluids) {
+ if (GT_Utility.areFluidsEqual(a, b)) {
+ //Logger.INFO("Found matching Fluid Input - "+b.getLocalizedName());
+ aMatchingFluidInputs++;
+ continue recipe;
+ }
+ else {
+ //Logger.INFO("Found fluid which did not match - "+a.getLocalizedName());
+ }
+ }
+ }
+ if (aMatchingFluidInputs != aFluidInputCount) {
+ return false;
+ }
+ }
+ Logger.INFO("Recipes Match!");
+ return true;
+ }
+
+ public GT_Recipe findRecipe(final GT_Recipe aRecipe, final long aVoltage, final long aSpecialValue, ItemStack[] aInputs, final FluidStack[] aFluids) {
+ if (!mInitRecipeCache) {
+ initRecipeCaches();
+ }
+ if (this.getRecipeMap().mRecipeList.isEmpty()) {
+ log("No Recipes in Map to search through.");
+ return null;
+ }
+ else {
+ log("Checking tier "+aSpecialValue+" recipes and below. Using Input Voltage of "+aVoltage+"V.");
+ log("We have "+aInputs.length+" Items and "+aFluids.length+" Fluids.");
+ // Try check the cached recipe first
+ if (aRecipe != null) {
+ if (areInputsEqual(aRecipe, aInputs, aFluids)) {
+ if (aRecipe.mEUt <= aVoltage) {
+ Logger.INFO("Using cached recipe.");
+ return aRecipe;
+ }
+ }
+ }
+
+ // Get all recipes for the tier
+ AutoMap<AutoMap<GT_Recipe>> aMasterMap = new AutoMap<AutoMap<GT_Recipe>>();
+ for (long i=0;i<=aSpecialValue;i++) {
+ aMasterMap.add(mTieredRecipeMap.get(i));
+ }
+ GT_Recipe aFoundRecipe = null;
+
+ // Iterate the tiers recipes until we find the one with all inputs matching
+ master : for (AutoMap<GT_Recipe> aTieredMap : aMasterMap) {
+ for (GT_Recipe aRecipeToCheck : aTieredMap) {
+ if (areInputsEqual(aRecipeToCheck, aInputs, aFluids)) {
+ log("Found recipe with matching inputs!");
+ if (aRecipeToCheck.mSpecialValue <= aSpecialValue) {
+ if (aRecipeToCheck.mEUt <= aVoltage) {
+ aFoundRecipe = aRecipeToCheck;
+ break master;
+ }
+ }
+ }
+ }
+ }
+
+ // If we found a recipe, return it
+ if (aFoundRecipe != null) {
+ log("Found valid recipe.");
+ return aFoundRecipe;
+ }
+ }
+ log("Did not find valid recipe.");
+ return null;
+ }
+
+ private int getCatalysts(ItemStack[] aItemInputs, ItemStack aRecipeCatalyst, int aMaxParrallel, ArrayList<ItemStack> aOutPut) {
+ int allowedParallel = 0;
+ for (final ItemStack aInput : aItemInputs) {
+ if (aRecipeCatalyst.isItemEqual(aInput)) {
+ int aDurabilityRemaining = getMaxCatalystDurability() - getDamage(aInput);
+ return Math.min(aMaxParrallel, aDurabilityRemaining);
+ }
+ }
+ return allowedParallel;
+ }
+
+ private ItemStack findCatalyst(ItemStack[] aItemInputs) {
+ if (aItemInputs != null) {
+ for (final ItemStack aInput : aItemInputs) {
+ if (aInput != null) {
+ if (ItemUtils.isCatalyst(aInput)) {
+ return aInput;
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+
+ private void damageCatalyst(ItemStack aStack, int parallelRecipes) {
+ for (int i=0; i<parallelRecipes; i++){
+ if (MathUtils.randFloat(0, 10000000)/10000000f < (1.2f - (0.2 * this.mPipeCasingTier))) {
+ int damage = getDamage(aStack) + 1;
+ log("damage catalyst "+damage);
+ if (damage >= getMaxCatalystDurability()) {
+ log("consume catalyst");
+ addOutput(CI.getEmptyCatalyst(1));
+ aStack.stackSize -= 1;
+ }
+ else {
+ log("damaging catalyst");
+ setDamage(aStack, damage);
+ }
+ }
+ else {
+ log("not consuming catalyst");
+ }
+ }
+ }
+
+ private int getDamage(ItemStack aStack) {
+ return ItemGenericChemBase.getCatalystDamage(aStack);
+ }
+
+ private void setDamage(ItemStack aStack,int aAmount) {
+ ItemGenericChemBase.setCatalystDamage(aStack, aAmount);
+ }
+
+ @SideOnly(Side.CLIENT)
+ private final int getCasingTierOnClientSide() {
+
+ if (this == null || this.getBaseMetaTileEntity().getWorld() == null) {
+ return 0;
+ }
+ try {
+ Block aInitStructureCheck;
+ int aInitStructureCheckMeta;
+ IGregTechTileEntity aBaseMetaTileEntity = this.getBaseMetaTileEntity();
+ int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 3;
+ int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * 3;
+ if (xDir == 0) {
+ aInitStructureCheck = aBaseMetaTileEntity.getBlockOffset(zDir, 1, 0);
+ aInitStructureCheckMeta = aBaseMetaTileEntity.getMetaIDOffset(zDir, 1, 0);
+ }
+ else {
+ aInitStructureCheck = aBaseMetaTileEntity.getBlockOffset(0, 1, xDir);
+ aInitStructureCheckMeta = aBaseMetaTileEntity.getMetaIDOffset(0, 1, xDir);
+ }
+ for (int aTier : mTieredBlockRegistry.keySet()) {
+ Triplet<Block, Integer, Integer> aData = mTieredBlockRegistry.get(aTier);
+ if (aData.getValue_1() == aInitStructureCheck && aData.getValue_2() == aInitStructureCheckMeta) {
+ return aTier;
+ }
+ }
+ return 0;
+ }
+ catch (Throwable t) {
+ t.printStackTrace();
+ return 0;
+ }
+ }
+
+ /*
+ * Catalyst Handling
+ */
+
+ @Override
+ public ArrayList<ItemStack> getStoredInputs() {
+ ArrayList<ItemStack> tItems = super.getStoredInputs();
+ for (GT_MetaTileEntity_Hatch_Catalysts tHatch : mCatalystBuses) {
+ tHatch.mRecipeMap = getRecipeMap();
+ if (isValidMetaTileEntity(tHatch)) {
+ tItems.addAll(tHatch.getContentUsageSlots());
+ }
+ }
+ return tItems;
+ }
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_SHSteam.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_SHSteam.java
new file mode 100644
index 0000000000..f52f02b5de
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_SHSteam.java
@@ -0,0 +1,179 @@
+/*
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.turbines;
+
+import java.util.ArrayList;
+
+import gregtech.GT_Mod;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.util.GT_ModHandler;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.math.MathUtils;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraftforge.fluids.FluidStack;
+
+public class GT_MTE_LargeTurbine_SHSteam extends GregtechMetaTileEntity_LargerTurbineBase {
+
+ public boolean achievement = false;
+ private boolean looseFit=false;
+
+ public GT_MTE_LargeTurbine_SHSteam(int aID, String aName, String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ }
+
+ public GT_MTE_LargeTurbine_SHSteam(String aName) {
+ super(aName);
+ }
+
+ public String[] getTooltip() {
+ if (mCasingName.toLowerCase().contains(".name")) {
+ mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings4Misc, 9);
+ }
+ return new String[]{
+ "Controller Block for the XL High Pressure Steam Turbine",
+ "Size(WxHxD): 3x3x4 (Hollow), Controller (Front centered)",
+ "1x Superheated Steam Input Hatch (Side centered)",
+ "1x Maintenance Hatch (Side centered)",
+ "1x Dynamo Hatch (Back centered)",
+ "1x Output Hatch for Steam (Side centered)",
+ mCasingName+"s for the rest (24 at least!)",
+ "Needs a Turbine Item (Inside controller GUI)",
+ "Output depending on Rotor and fitting",
+ "Use screwdriver to adjust fitting of turbine"};
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT_MTE_LargeTurbine_SHSteam(mName);
+ }
+
+ @Override
+ public Block getCasingBlock() {
+ return ModBlocks.blockCasings4Misc;
+ }
+
+ @Override
+ public byte getCasingMeta() {
+ return 9;
+ }
+
+ @Override
+ public byte getCasingTextureIndex() {
+ return 59;
+ }
+
+ @Override
+ public int getPollutionPerTick(ItemStack aStack) {
+ return 0;
+ }
+
+ @Override
+ int fluidIntoPower(ArrayList<FluidStack> aFluids, int aOptFlow, int aBaseEff) {
+ if(looseFit) {
+ aOptFlow*=4;
+ if(aBaseEff>10000){
+ aOptFlow*=Math.pow(1.1f,((aBaseEff-7500)/10000F)*20f);
+ aBaseEff=7500;
+ }else if(aBaseEff>7500){
+ aOptFlow*=Math.pow(1.1f,((aBaseEff-7500)/10000F)*20f);
+ aBaseEff*=0.75f;
+ }else{
+ aBaseEff*=0.75f;
+ }
+ }
+ int tEU = 0;
+ int totalFlow = 0; // Byproducts are based on actual flow
+ int flow = 0;
+ int remainingFlow = MathUtils.safeInt((long)(aOptFlow * 1.25f)); // Allowed to use up to 125% of optimal flow. Variable required outside of loop for multi-hatch scenarios.
+ this.realOptFlow = aOptFlow;
+
+ storedFluid=0;
+ for (int i = 0; i < aFluids.size() && remainingFlow > 0; i++) {
+ String fluidName = aFluids.get(i).getFluid().getUnlocalizedName(aFluids.get(i));
+ if (fluidName.equals("ic2.fluidSuperheatedSteam")) {
+ flow = Math.min(aFluids.get(i).amount, remainingFlow); // try to use up w/o exceeding remainingFlow
+ depleteInput(new FluidStack(aFluids.get(i), flow)); // deplete that amount
+ this.storedFluid += aFluids.get(i).amount;
+ remainingFlow -= flow; // track amount we're allowed to continue depleting from hatches
+ totalFlow += flow; // track total input used
+ if (!achievement) {
+ try {
+ GT_Mod.achievements.issueAchievement(this.getBaseMetaTileEntity().getWorld().getPlayerEntityByName(this.getBaseMetaTileEntity().getOwnerName()), "efficientsteam");
+ } catch (Exception e) {
+ }
+ achievement = true;
+ }
+ }else if(fluidName.equals("fluid.steam") || fluidName.equals("ic2.fluidSteam") || fluidName.equals("fluid.mfr.steam.still.name")){
+ depleteInput(new FluidStack(aFluids.get(i), aFluids.get(i).amount));
+ }
+ }
+ if(totalFlow<=0)return 0;
+ tEU = totalFlow;
+ addOutput(GT_ModHandler.getSteam(totalFlow));
+ if (totalFlow != aOptFlow) {
+ float efficiency = 1.0f - Math.abs((totalFlow - aOptFlow) / (float)aOptFlow);
+ //if(totalFlow>aOptFlow){efficiency = 1.0f;}
+ tEU *= efficiency;
+ tEU = Math.max(1, MathUtils.safeInt((long)tEU * (long)aBaseEff / 10000L));
+ } else {
+ tEU = MathUtils.safeInt((long)tEU * (long)aBaseEff / 10000L);
+ }
+
+ return tEU;
+ }
+
+ @Override
+ public void onModeChangeByScrewdriver(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ if (aSide == getBaseMetaTileEntity().getFrontFacing()) {
+ looseFit^=true;
+ GT_Utility.sendChatToPlayer(aPlayer, looseFit ? "Fitting: Loose - More Flow" : "Fitting: Tight - More Efficiency");
+ }
+ super.onModeChangeByScrewdriver(aSide, aPlayer, aX, aY, aZ);
+ }
+
+ @Override
+ public int getDamageToComponent(ItemStack aStack) {
+ return (looseFit && CORE.RANDOM.nextInt(4)==0)?0:1;
+ }
+
+ @Override
+ public String[] getExtraInfoData() {
+ super.looseFit = looseFit;
+ return super.getInfoData();
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ super.saveNBTData(aNBT);
+ aNBT.setBoolean("turbineFitting",looseFit);
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ super.loadNBTData(aNBT);
+ looseFit=aNBT.getBoolean("turbineFitting");
+ }
+
+ @Override
+ public boolean hasSlotInGUI() {
+ return true;
+ }
+
+ @Override
+ public String getCustomGUIResourceName() {
+ return null;
+ }
+
+ @Override
+ public String getMachineType() {
+ return "Large Super-heated Steam Turbine";
+ }
+
+}
+*/
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_Steam.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_Steam.java
new file mode 100644
index 0000000000..2e6f6149e7
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_Steam.java
@@ -0,0 +1,189 @@
+/*
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.turbines;
+
+import static gtPlusPlus.core.lib.CORE.RANDOM;
+
+import java.util.ArrayList;
+
+import gregtech.GT_Mod;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.util.GT_ModHandler;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.util.math.MathUtils;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraftforge.fluids.FluidStack;
+
+public class GT_MTE_LargeTurbine_Steam extends GregtechMetaTileEntity_LargerTurbineBase {
+
+ private float water;
+ private boolean achievement = false;
+ private boolean looseFit=false;
+
+ public GT_MTE_LargeTurbine_Steam(int aID, String aName, String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ }
+
+
+ public GT_MTE_LargeTurbine_Steam(String aName) {
+ super(aName);
+ }
+
+ public String[] getTooltip() {
+ if (mCasingName.toLowerCase().contains(".name")) {
+ mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings4Misc, 8);
+ }
+ return new String[]{
+ "Controller Block for the XL Steam Turbine",
+ "Size(WxHxD): 3x3x4 (Hollow), Controller (Front centered)",
+ "1x Steam Input Hatch (Side centered)",
+ "1x Maintenance Hatch (Side centered)",
+ "1x Dynamo Hatch (Back centered)",
+ "1x Output Hatch for Distilled Water (Side centered)",
+ mCasingName+"s for the rest (24 at least!)",
+ "Needs a Turbine Item (Inside controller GUI)",
+ "Output depending on Rotor and fitting",
+ "Use screwdriver to adjust fitting of turbine"};
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT_MTE_LargeTurbine_Steam(mName);
+ }
+
+ @Override
+ public Block getCasingBlock() {
+ return ModBlocks.blockCasings4Misc;
+ }
+
+ @Override
+ public byte getCasingMeta() {
+ return 8;
+ }
+
+ @Override
+ public byte getCasingTextureIndex() {
+ return 16;
+ }
+
+ @Override
+ public int getPollutionPerTick(ItemStack aStack) {
+ return 0;
+ }
+
+ private int useWater(float input) {
+ water = water + input;
+ int usage = (int) water;
+ water = water - usage;
+ return usage;
+ }
+
+ @Override
+ int fluidIntoPower(ArrayList<FluidStack> aFluids, int aOptFlow, int aBaseEff) {
+ if(looseFit) {
+ aOptFlow*=4;
+ if(aBaseEff>10000){
+ aOptFlow*=Math.pow(1.1f,((aBaseEff-7500)/10000F)*20f);
+ aBaseEff=7500;
+ }else if(aBaseEff>7500){
+ aOptFlow*=Math.pow(1.1f,((aBaseEff-7500)/10000F)*20f);
+ aBaseEff*=0.75f;
+ }else{
+ aBaseEff*=0.75f;
+ }
+ }
+ int tEU = 0;
+ int totalFlow = 0; // Byproducts are based on actual flow
+ int flow = 0;
+ int remainingFlow = MathUtils.safeInt((long)(aOptFlow * 1.25f)); // Allowed to use up to 125% of optimal flow. Variable required outside of loop for multi-hatch scenarios.
+ this.realOptFlow = aOptFlow;
+
+ storedFluid=0;
+ for (int i = 0; i < aFluids.size() && remainingFlow > 0; i++) { // loop through each hatch; extract inputs and track totals.
+ String fluidName = aFluids.get(i).getFluid().getUnlocalizedName(aFluids.get(i));
+ if (fluidName.equals("fluid.steam") || fluidName.equals("ic2.fluidSteam") || fluidName.equals("fluid.mfr.steam.still.name")) {
+ flow = Math.min(aFluids.get(i).amount, remainingFlow); // try to use up w/o exceeding remainingFlow
+ depleteInput(new FluidStack(aFluids.get(i), flow)); // deplete that amount
+ this.storedFluid += aFluids.get(i).amount;
+ remainingFlow -= flow; // track amount we're allowed to continue depleting from hatches
+ totalFlow += flow; // track total input used
+ if (!achievement) {
+ GT_Mod.achievements.issueAchievement(this.getBaseMetaTileEntity().getWorld().getPlayerEntityByName(this.getBaseMetaTileEntity().getOwnerName()), "muchsteam");
+ achievement = true;
+ }
+ }else if(fluidName.equals("ic2.fluidSuperheatedSteam")){
+ depleteInput(new FluidStack(aFluids.get(i), aFluids.get(i).amount));
+ }
+ }
+ if(totalFlow<=0)return 0;
+ tEU = totalFlow;
+ int waterToOutput = useWater(totalFlow / 160.0f);
+ addOutput(GT_ModHandler.getDistilledWater(waterToOutput));
+ if (totalFlow != aOptFlow) {
+ float efficiency = 1.0f - Math.abs((totalFlow - aOptFlow) / (float)aOptFlow);
+ //if(totalFlow>aOptFlow){efficiency = 1.0f;}
+ tEU *= efficiency;
+ tEU = Math.max(1, MathUtils.safeInt((long)tEU * (long)aBaseEff / 20000L));
+ } else {
+ tEU = MathUtils.safeInt((long)tEU * (long)aBaseEff / 20000L);
+ }
+
+ return tEU;
+ }
+
+ @Override
+ public void onModeChangeByScrewdriver(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ if (aSide == getBaseMetaTileEntity().getFrontFacing()) {
+ looseFit^=true;
+ GT_Utility.sendChatToPlayer(aPlayer, looseFit ? "Fitting: Loose - More Flow" : "Fitting: Tight - More Efficiency");
+ }
+ super.onModeChangeByScrewdriver(aSide, aPlayer, aX, aY, aZ);
+ }
+
+ @Override
+ public int getDamageToComponent(ItemStack aStack) {
+ return (looseFit && RANDOM.nextInt(4)==0)?0:1;
+ }
+
+
+ @Override
+ public String[] getExtraInfoData() {
+ super.looseFit = looseFit;
+ return super.getInfoData();
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ super.saveNBTData(aNBT);
+ aNBT.setBoolean("turbineFitting",looseFit);
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ super.loadNBTData(aNBT);
+ looseFit=aNBT.getBoolean("turbineFitting");
+ }
+
+ @Override
+ public boolean hasSlotInGUI() {
+ return true;
+ }
+
+
+ @Override
+ public String getCustomGUIResourceName() {
+ return null;
+ }
+
+ @Override
+ public String getMachineType() {
+ return "Large Steam Turbine";
+ }
+
+}
+*/
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GregtechMetaTileEntity_LargerTurbineBase.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GregtechMetaTileEntity_LargerTurbineBase.java
new file mode 100644
index 0000000000..9da724c6eb
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GregtechMetaTileEntity_LargerTurbineBase.java
@@ -0,0 +1,663 @@
+/*
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.turbines;
+
+import java.util.ArrayList;
+
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.TAE;
+import gregtech.api.enums.Textures;
+import gregtech.api.gui.GT_GUIContainer_MultiMachine;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.items.GT_MetaGenerated_Tool;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Dynamo;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Utility;
+import gregtech.common.items.GT_MetaGenerated_Tool_01;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.api.objects.minecraft.BlockPos;
+import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.math.MathUtils;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import gtPlusPlus.core.util.minecraft.PlayerUtils;
+import gtPlusPlus.core.util.sys.KeyboardUtils;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Turbine;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
+import gtPlusPlus.xmod.gregtech.common.StaticFields59;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.CustomIcon;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.turbine.LargeTurbineTextureHandler;
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.StatCollector;
+import net.minecraftforge.fluids.FluidStack;
+
+public abstract class GregtechMetaTileEntity_LargerTurbineBase extends GregtechMeta_MultiBlockBase {
+
+ protected int baseEff = 0;
+ protected int optFlow = 0;
+ protected double realOptFlow = 0;
+ protected int storedFluid = 0;
+ protected int counter = 0;
+ protected boolean looseFit=false;
+
+ private final int mCasingTextureID;
+ public static String mCasingName;
+
+ public ArrayList<GT_MetaTileEntity_Hatch_Turbine> mTurbineRotorHatches = new ArrayList<GT_MetaTileEntity_Hatch_Turbine>();
+
+ public GregtechMetaTileEntity_LargerTurbineBase(int aID, String aName, String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings4Misc, getCasingMeta());
+ mCasingTextureID = getTAE();
+ GT9_5_Active = getCasingMeta() == 8 ? LargeTurbineTextureHandler.frontFaceActive_4 : LargeTurbineTextureHandler.frontFaceHPActive_4;
+ GT9_5 = getCasingMeta() == 8 ? LargeTurbineTextureHandler.frontFace_4 : LargeTurbineTextureHandler.frontFaceHP_4;
+ frontFaceActive = new GT_RenderedTexture(GT9_5_Active);
+ frontFace = new GT_RenderedTexture(GT9_5);
+
+ }
+ public GregtechMetaTileEntity_LargerTurbineBase(String aName) {
+ super(aName);
+ mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings4Misc, getCasingMeta());
+ mCasingTextureID = getTAE();
+ GT9_5_Active = getCasingMeta() == 8 ? LargeTurbineTextureHandler.frontFaceActive_4 : LargeTurbineTextureHandler.frontFaceHPActive_4;
+ GT9_5 = getCasingMeta() == 8 ? LargeTurbineTextureHandler.frontFace_4 : LargeTurbineTextureHandler.frontFaceHP_4;
+ frontFaceActive = new GT_RenderedTexture(GT9_5_Active);
+ frontFace = new GT_RenderedTexture(GT9_5);
+ }
+
+ public final int getTAE() {
+ return TAE.getIndexFromPage(3, getCasingMeta());
+ }
+
+ public final String getCasingNaming() {
+ return ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings4Misc, getCasingMeta());
+ }
+
+ @Override
+ public boolean isCorrectMachinePart(ItemStack aStack) {
+ return getMaxEfficiency(aStack) > 0;
+ }
+
+ public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "LargeTurbine.png");
+ }
+
+ @Override
+ public boolean checkMultiblock(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ return checkMachine2(aBaseMetaTileEntity, aStack);
+ }
+
+ public boolean checkMachine2(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) {
+ //9 high
+ //7x7
+
+ this.mDynamoHatches.clear();
+ this.mTurbineRotorHatches.clear();
+ this.mMaintenanceHatches.clear();
+ this.mMufflerHatches.clear();
+ this.mInputHatches.clear();
+ this.mOutputHatches.clear();
+
+ for (int i=0;i>-9;i--) {
+ if (!getLayer(i)) {
+ Logger.INFO("Bad Layer: "+(+i));
+ return false;
+ }
+ }
+
+ Logger.INFO("Hatches | Found "+mTurbineRotorHatches.size()+" Rotor Assemblies, "+12+" are required.");
+ Logger.INFO("Hatches | Found "+mMaintenanceHatches.size()+" Maint. hatches, "+1+" are required.");
+ Logger.INFO("Hatches | Found "+mDynamoHatches.size()+" Dynamos, "+1+" or more are required.");
+ Logger.INFO("Hatches | Found "+mMufflerHatches.size()+" Mufflers, "+4+" are required.");
+ Logger.INFO("Hatches | Found "+mInputHatches.size()+" Input Hatches, "+1+" or more are required.");
+ Logger.INFO("Hatches | Found "+mOutputHatches.size()+" Output Hatches, "+1+" ore more are required.");
+
+ if (mTurbineRotorHatches.size() != 12 ||
+ mMaintenanceHatches.size() != 1 ||
+ mDynamoHatches.size() < 1 ||
+ mMufflerHatches.size() != 4 ||
+ mInputHatches.size() < 1 ||
+ mOutputHatches.size() < 1
+ ) {
+ return false;
+ }
+ Logger.INFO("Built Structure");
+ return true;
+ }
+
+
+ public boolean getLayer(int aY) {
+ if (aY == 0 || aY == -2 || aY == -3 || aY == -5 || aY == -6 || aY == -8) {
+ return checkNormalLayer(aY);
+ }
+ else {
+ return checkTurbineLayer(aY);
+ }
+ }
+
+ public boolean checkNormalLayer(int aY) {
+ Block tBlock;
+ int tMeta;
+ for (int x = -3; x <= 3; x++) {
+ for (int z = -3; z <= 3; z++) {
+ tBlock = this.getBaseMetaTileEntity().getBlockOffset(x, aY, z);
+ tMeta = this.getBaseMetaTileEntity().getMetaIDOffset(x, aY, z);
+ IGregTechTileEntity tTileEntity;
+
+ if (aY == 0 && x == 0 && z == 0) {
+ continue;
+ }
+ else if ((x == 0 && z == -3) || (x == 0 && z == 3) || (x == 3 && z == 0) || (x == -3 && z == 0) ||
+ ((aY == 0) && (x == 0 && z == -2) || (x == 0 && z == 2) || (x == 2 && z == 0) || (x == -2 && z == 0))) {
+ tTileEntity = this.getBaseMetaTileEntity().getIGregTechTileEntityOffset(x, aY, z);
+ if (this.addToMachineList(tTileEntity, this.mCasingTextureID)) {
+ Logger.INFO("Added Hatch at offset "+x+", "+aY+", "+z+" | Type: "+tTileEntity.getInventoryName());
+ continue;
+ }
+ }
+ else if (isValidCasingBlock(tBlock, tMeta)) {
+ continue;
+ } else {
+ if (tBlock != null) {
+ log("Offset: "+x+", "+aY+", "+z);
+ log("Found "+tBlock.getLocalizedName()+" with Meta "+tMeta);
+ log("Expected "+getCasingBlock().getLocalizedName()+" with Meta "+getCasingMeta());
+ }
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+
+
+ public boolean checkTurbineLayer(int aY) {
+ if (!checkTurbineLayerX(aY)) {
+ return checkTurbineLayerZ(aY);
+ }
+ else {
+ return true;
+ }
+ }
+
+ public boolean checkTurbineLayerX(int aY) {
+ Logger.INFO("checking X");
+ Block tBlock;
+ int tMeta;
+ for (int x = -3; x <= 3; x++) {
+ for (int z = -3; z <= 3; z++) {
+ tBlock = this.getBaseMetaTileEntity().getBlockOffset(x, aY, z);
+ tMeta = this.getBaseMetaTileEntity().getMetaIDOffset(x, aY, z);
+
+ if ((x == 0 && z == -3) || (x == 0 && z == 3) || (x == 3 && z == 0) || (x == -3 && z == 0) ||
+ ((aY == 0) && (x == 0 && z == -2) || (x == 0 && z == 2) || (x == 2 && z == 0) || (x == -2 && z == 0))) {
+ IGregTechTileEntity tTileEntity = this.getBaseMetaTileEntity().getIGregTechTileEntityOffset(x, aY, z);
+ if (this.addToMachineList(tTileEntity, this.mCasingTextureID)) {
+ Logger.INFO("Added Hatch at offset "+x+", "+aY+", "+z+" | Type: "+tTileEntity.getInventoryName());
+ continue;
+ }
+ }
+
+
+ if (x == -2 || x == 2) {
+
+ //Find Hatches on the ends
+ if (z == -3 || z == 3) {
+ IGregTechTileEntity tTileEntity = this.getBaseMetaTileEntity().getIGregTechTileEntityOffset(x, aY, z);
+ if (this.addTurbineHatch(tTileEntity, this.mCasingTextureID)) {
+ log("Found x axis Turbine Assembly at Offset: "+x+", "+aY+", "+z);
+ continue;
+ }
+ else {
+ log("Missing x axis Turbine Assembly at Offset: "+x+", "+aY+", "+z);
+ }
+ }
+
+ if (isValidTurbineBlock(tBlock, tMeta)) {
+ continue;
+ }
+ else {
+ return false;
+ }
+ }
+ else {
+ if (isValidCasingBlock(tBlock, tMeta)) {
+ continue;
+ }
+ else {
+ return false;
+ }
+ }
+ }
+ }
+ return true;
+ }
+
+ public boolean checkTurbineLayerZ(int aY) {
+ Logger.INFO("checking Z");
+ Block tBlock;
+ int tMeta;
+ for (int x = -3; x <= 3; x++) {
+ for (int z = -3; z <= 3; z++) {
+ tBlock = this.getBaseMetaTileEntity().getBlockOffset(x, aY, z);
+ tMeta = this.getBaseMetaTileEntity().getMetaIDOffset(x, aY, z);
+
+ if ((x == 0 && z == -3) || (x == 0 && z == 3) || (x == 3 && z == 0) || (x == -3 && z == 0) ||
+ ((aY == 0) && (x == 0 && z == -2) || (x == 0 && z == 2) || (x == 2 && z == 0) || (x == -2 && z == 0))) {
+ IGregTechTileEntity tTileEntity = this.getBaseMetaTileEntity().getIGregTechTileEntityOffset(x, aY, z);
+ if (this.addToMachineList(tTileEntity, this.mCasingTextureID)) {
+ Logger.INFO("Added Hatch at offset "+x+", "+aY+", "+z+" | Type: "+tTileEntity.getInventoryName());
+ continue;
+ }
+ }
+
+ if (z == -2 || z == 2) {
+
+ //Find Hatches on the ends
+ if (x == -3 || x == 3) {
+ IGregTechTileEntity tTileEntity = this.getBaseMetaTileEntity().getIGregTechTileEntityOffset(x, aY, z);
+ if (this.addTurbineHatch(tTileEntity, this.mCasingTextureID)) {
+ log("Found z axis Turbine Assembly at Offset: "+x+", "+aY+", "+z);
+ continue;
+ }
+ else {
+ log("Missing z axis Turbine Assembly at Offset: "+x+", "+aY+", "+z);
+ }
+ }
+
+ if (isValidTurbineBlock(tBlock, tMeta)) {
+ continue;
+ }
+ else {
+ return false;
+ }
+ }
+ else {
+ if (isValidCasingBlock(tBlock, tMeta)) {
+ continue;
+ }
+ else {
+ return false;
+ }
+ }
+ }
+ }
+ return true;
+ }
+
+ public boolean isValidCasingBlock(Block aBlock, int aMeta) {
+ if (GregTech_API.sBlockMachines == aBlock) {
+ return true;
+ }
+ if (Block.isEqualTo(aBlock, getCasingBlock()) && (int) aMeta == (int) getCasingMeta()) {
+ return true;
+ }
+ log("Found "+(aBlock != null ? aBlock.getLocalizedName() : "Air") + " With Meta "+aMeta+", Expected "+getCasingBlock().getLocalizedName()+" With Meta "+getCasingMeta());
+ return false;
+ }
+
+ public boolean isValidTurbineBlock(Block aBlock, int aMeta) {
+ if (aBlock == getCasingBlock() && aMeta == getCasingMetaTurbine()) {
+ return true;
+ }
+ log("Found "+(aBlock != null ? aBlock.getLocalizedName() : "Air") + " With Meta "+aMeta+", Expected "+getCasingBlock().getLocalizedName()+" With Meta "+getCasingMetaTurbine());
+ return false;
+ }
+
+ public Block getCasingBlock() {
+ return ModBlocks.blockCasings4Misc;
+ }
+
+ public abstract byte getCasingMeta();
+
+ public byte getCasingMetaTurbine() {
+ return 7;
+ }
+
+ public abstract byte getCasingTextureIndex();
+
+ @Override
+ public boolean checkRecipe(ItemStack aStack) {
+ if((counter&7)==0 && (aStack==null || !(aStack.getItem() instanceof GT_MetaGenerated_Tool) || aStack.getItemDamage() < 170 || aStack.getItemDamage() >179)) {
+ stopMachine();
+ return false;
+ }
+ ArrayList<FluidStack> tFluids = getStoredFluids();
+ if (tFluids.size() > 0) {
+ if (baseEff == 0 || optFlow == 0 || counter >= 512 || this.getBaseMetaTileEntity().hasWorkJustBeenEnabled()
+ || this.getBaseMetaTileEntity().hasInventoryBeenModified()) {
+ counter = 0;
+ baseEff = MathUtils.safeInt((long)((5F + ((GT_MetaGenerated_Tool) aStack.getItem()).getToolCombatDamage(aStack)) * 1000F));
+ optFlow = MathUtils.safeInt((long)Math.max(Float.MIN_NORMAL,
+ ((GT_MetaGenerated_Tool) aStack.getItem()).getToolStats(aStack).getSpeedMultiplier()
+ * GT_MetaGenerated_Tool.getPrimaryMaterial(aStack).mToolSpeed
+ * 50));
+ if(optFlow<=0 || baseEff<=0){
+ stopMachine();//in case the turbine got removed
+ return false;
+ }
+ } else {
+ counter++;
+ }
+ }
+ else {
+ Logger.INFO("Did not find any valid input fluids.");
+ }
+
+ int newPower = fluidIntoPower(tFluids, optFlow, baseEff); // How much the turbine should be producing with this flow
+ int difference = newPower - this.mEUt; // difference between current output and new output
+
+ // Magic numbers: can always change by at least 10 eu/t, but otherwise by at most 1 percent of the difference in power level (per tick)
+ // This is how much the turbine can actually change during this tick
+ int maxChangeAllowed = Math.max(10, MathUtils.safeInt((long)Math.abs(difference)/100));
+
+ if (Math.abs(difference) > maxChangeAllowed) { // If this difference is too big, use the maximum allowed change
+ int change = maxChangeAllowed * (difference > 0 ? 1 : -1); // Make the change positive or negative.
+ this.mEUt += change; // Apply the change
+ } else {
+ this.mEUt = newPower;
+ }
+
+ if (this.mEUt <= 0) {
+ //stopMachine();
+ this.mEUt=0;
+ this.mEfficiency=0;
+ return false;
+ } else {
+ this.mMaxProgresstime = 1;
+ this.mEfficiencyIncrease = 10;
+ if(this.mDynamoHatches.size()>0){
+ for(GT_MetaTileEntity_Hatch dynamo:mDynamoHatches)
+ if(isValidMetaTileEntity(dynamo) && dynamo.maxEUOutput() < mEUt)
+ explodeMultiblock();
+ }
+ return true;
+ }
+ }
+
+ abstract int fluidIntoPower(ArrayList<FluidStack> aFluids, int aOptFlow, int aBaseEff);
+
+ @Override
+ public int getDamageToComponent(ItemStack aStack) {
+ return 1;
+ }
+
+ public int getMaxEfficiency(ItemStack aStack) {
+ if (GT_Utility.isStackInvalid(aStack)) {
+ return 0;
+ }
+ if (aStack.getItem() instanceof GT_MetaGenerated_Tool_01) {
+ return 10000;
+ }
+ return 0;
+ }
+ @Override
+ public boolean explodesOnComponentBreak(ItemStack aStack) {
+ return true;
+ }
+
+ @Override
+ public String[] getExtraInfoData() {
+ int mPollutionReduction=0;
+ for (GT_MetaTileEntity_Hatch_Muffler tHatch : mMufflerHatches) {
+ if (isValidMetaTileEntity(tHatch)) {
+ mPollutionReduction=Math.max(StaticFields59.calculatePollutionReducation(tHatch, 100),mPollutionReduction);
+ }
+ }
+
+ String tRunning = mMaxProgresstime>0 ?
+
+ EnumChatFormatting.GREEN+StatCollector.translateToLocal("GT5U.turbine.running.true")+EnumChatFormatting.RESET :
+ EnumChatFormatting.RED+StatCollector.translateToLocal("GT5U.turbine.running.false")+EnumChatFormatting.RESET;
+ String tMaintainance = getIdealStatus() == getRepairStatus() ?
+ EnumChatFormatting.GREEN+StatCollector.translateToLocal("GT5U.turbine.maintenance.false")+EnumChatFormatting.RESET :
+ EnumChatFormatting.RED+StatCollector.translateToLocal("GT5U.turbine.maintenance.true")+EnumChatFormatting.RESET ;
+ int tDura = 0;
+
+ if (mInventory[1] != null && mInventory[1].getItem() instanceof GT_MetaGenerated_Tool_01) {
+ tDura = MathUtils.safeInt((long)(100.0f / GT_MetaGenerated_Tool.getToolMaxDamage(mInventory[1]) * (GT_MetaGenerated_Tool.getToolDamage(mInventory[1]))+1));
+ }
+
+ long storedEnergy=0;
+ long maxEnergy=0;
+ for(GT_MetaTileEntity_Hatch_Dynamo tHatch : mDynamoHatches) {
+ if (isValidMetaTileEntity(tHatch)) {
+ storedEnergy+=tHatch.getBaseMetaTileEntity().getStoredEU();
+ maxEnergy+=tHatch.getBaseMetaTileEntity().getEUCapacity();
+ }
+ }
+ String[] ret = new String[]{
+ // 8 Lines available for information panels
+ tRunning + ": " + EnumChatFormatting.RED+mEUt+EnumChatFormatting.RESET+" EU/t", */
+/* 1 *//*
+
+ tMaintainance, */
+/* 2 *//*
+
+ StatCollector.translateToLocal("GT5U.turbine.efficiency")+": "+EnumChatFormatting.YELLOW+(mEfficiency/100F)+EnumChatFormatting.RESET+"%", */
+/* 2 *//*
+
+ StatCollector.translateToLocal("GT5U.multiblock.energy")+": " + EnumChatFormatting.GREEN + Long.toString(storedEnergy) + EnumChatFormatting.RESET +" EU / "+ */
+/* 3 *//*
+
+ EnumChatFormatting.YELLOW + Long.toString(maxEnergy) + EnumChatFormatting.RESET +" EU",
+ StatCollector.translateToLocal("GT5U.turbine.flow")+": "+EnumChatFormatting.YELLOW+MathUtils.safeInt((long)realOptFlow)+EnumChatFormatting.RESET+" L/t" + */
+/* 4 *//*
+
+ EnumChatFormatting.YELLOW+" ("+(looseFit?StatCollector.translateToLocal("GT5U.turbine.loose"):StatCollector.translateToLocal("GT5U.turbine.tight"))+")", */
+/* 5 *//*
+
+ StatCollector.translateToLocal("GT5U.turbine.fuel")+": "+EnumChatFormatting.GOLD+storedFluid+EnumChatFormatting.RESET+"L", */
+/* 6 *//*
+
+ StatCollector.translateToLocal("GT5U.turbine.dmg")+": "+EnumChatFormatting.RED+Integer.toString(tDura)+EnumChatFormatting.RESET+"%", */
+/* 7 *//*
+
+ StatCollector.translateToLocal("GT5U.multiblock.pollution")+": "+ EnumChatFormatting.GREEN + mPollutionReduction+ EnumChatFormatting.RESET+" %" */
+/* 8 *//*
+
+ };
+ if (!this.getClass().getName().contains("Steam"))
+ ret[4]=StatCollector.translateToLocal("GT5U.turbine.flow")+": "+EnumChatFormatting.YELLOW+MathUtils.safeInt((long)realOptFlow)+EnumChatFormatting.RESET+" L/t";
+ return ret;
+
+
+ }
+
+ @Override
+ public boolean isGivingInformation() {
+ return true;
+ }
+
+
+ public boolean polluteEnvironment(int aPollutionLevel) {
+ mPollution += aPollutionLevel;
+ for (GT_MetaTileEntity_Hatch_Muffler tHatch : mMufflerHatches) {
+ if (isValidMetaTileEntity(tHatch)) {
+ if (mPollution >= 1000) {
+ if (tHatch.polluteEnvironment()) {
+ mPollution -= 1000;
+ }
+ } else {
+ break;
+ }
+ }
+ }
+ return mPollution < 1000;
+ }
+ @Override
+ public long maxAmperesOut() {
+ return 16;
+ }
+
+
+ @Override
+ public void onModeChangeByScrewdriver(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ if (!KeyboardUtils.isShiftKeyDown()) {
+ //super.onModeChangeByScrewdriver(aSide, aPlayer, aX, aY, aZ);
+ }
+ else {
+ this.mIsAnimated = Utils.invertBoolean(mIsAnimated);
+ if (this.mIsAnimated) {
+ PlayerUtils.messagePlayer(aPlayer, "Using Animated Turbine Texture.");
+ }
+ else {
+ PlayerUtils.messagePlayer(aPlayer, "Using Static Turbine Texture.");
+ }
+ if (mTurbineRotorHatches.size() > 0) {
+ for (GT_MetaTileEntity_Hatch_Turbine h : mTurbineRotorHatches) {
+ if (h != null) {
+ h.mUsingAnimation = mIsAnimated;
+ }
+ }
+ }
+ }
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ super.saveNBTData(aNBT);
+ aNBT.setBoolean("mIsAnimated", mIsAnimated);
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ super.loadNBTData(aNBT);
+ mIsAnimated = aNBT.getBoolean("mIsAnimated");
+ }
+
+ private boolean mIsAnimated = true;
+ public ITexture frontFace;
+ public ITexture frontFaceActive;
+ private CustomIcon GT9_5_Active;
+ private CustomIcon GT9_5;
+
+ public boolean usingAnimations() {
+ return mIsAnimated;
+ }
+
+ @Override
+ public final ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[1][aColorIndex + 1], aFacing == aSide ? getFrontFacingTurbineTexture(aActive) : Textures.BlockIcons.getCasingTextureForId(getTAE())};
+ }
+
+ protected ITexture getFrontFacingTurbineTexture(boolean isActive) {
+ if (usingAnimations()) {
+ if (isActive) {
+ return frontFaceActive;
+ }
+ }
+ return frontFace;
+ }
+
+ public boolean addTurbineHatch(final IGregTechTileEntity aTileEntity,
+ final int aBaseCasingIndex) {
+ if (aTileEntity == null) {
+ return false;
+ }
+ final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity == null) {
+ return false;
+ }
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Turbine) {
+ log("Found GT_MetaTileEntity_Hatch_Turbine");
+ updateTexture(aTileEntity, aBaseCasingIndex);
+ GT_MetaTileEntity_Hatch_Turbine aTurbineHatch = (GT_MetaTileEntity_Hatch_Turbine) aMetaTileEntity;
+ IGregTechTileEntity g = this.getBaseMetaTileEntity();
+ if (aTurbineHatch.setController(new BlockPos(g.getXCoord(), g.getYCoord(), g.getZCoord(), g.getWorld()))) {
+ Logger.INFO("Injected Controller into Turbine Assembly.");
+ return this.mTurbineRotorHatches.add(aTurbineHatch);
+ }
+ else {
+ Logger.INFO("Failed to inject controller into Turbine Assembly Hatch.");
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ super.onPostTick(aBaseMetaTileEntity, aTick);
+ if (aBaseMetaTileEntity.isServerSide()) {
+ if (mUpdate == 0 || this.mStartUpCheck == 0) {
+ this.mTurbineRotorHatches.clear();
+ }
+ }
+ if (aTick % 20 == 0 || this.getBaseMetaTileEntity().hasWorkJustBeenEnabled()) {
+ enableAllTurbineHatches();
+ }
+
+ }
+ @Override
+ public void startProcess() {
+ super.startProcess();
+ enableAllTurbineHatches();
+ }
+ @Override
+ public void onMachineBlockUpdate() {
+ super.onMachineBlockUpdate();
+ }
+ @Override
+ public boolean onRunningTick(ItemStack aStack) {
+ return super.onRunningTick(aStack);
+ }
+ @Override
+ public void stopMachine() {
+ super.stopMachine();
+ disableAllTurbineHatches();
+ }
+ @Override
+ public void onRemoval() {
+ super.onRemoval();
+ for (GT_MetaTileEntity_Hatch_Turbine h : this.mTurbineRotorHatches) {
+ h.clearController();
+ }
+ disableAllTurbineHatches();
+ this.mTurbineRotorHatches.clear();
+ }
+
+ public boolean enableAllTurbineHatches() {
+ return updateTurbineHatches(this.isMachineRunning()) > 0;
+ }
+ public boolean disableAllTurbineHatches() {
+ return updateTurbineHatches(false) > 0;
+ }
+
+ private Long mLastHatchUpdate;
+ public int updateTurbineHatches(boolean aState) {
+ int aUpdated = 0;
+ if (mLastHatchUpdate == null) {
+ mLastHatchUpdate = System.currentTimeMillis()/1000;
+ }
+ if (this.mTurbineRotorHatches.isEmpty() || ((System.currentTimeMillis()/1000)-mLastHatchUpdate) <= 2) {
+ return 0;
+ }
+ for (GT_MetaTileEntity_Hatch_Turbine h : this.mTurbineRotorHatches) {
+ h.setActive(aState);
+ aUpdated++;
+ }
+
+ mLastHatchUpdate = System.currentTimeMillis()/1000;
+ return aUpdated;
+ }
+
+ @Override
+ public int getMaxParallelRecipes() {
+ return 1;
+ }
+
+ @Override
+ public int getEuDiscountForParallelism() {
+ return 0;
+ }
+
+}
+*/
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_MultiTank.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_MultiTank.java
new file mode 100644
index 0000000000..6ed14eb2a9
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_MultiTank.java
@@ -0,0 +1,621 @@
+/*
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.storage;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+
+import gregtech.api.enums.GT_Values;
+import gregtech.api.enums.TAE;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.api.objects.data.Pair;
+import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.util.minecraft.FluidUtils;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.init.Blocks;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidStack;
+
+public class GregtechMetaTileEntity_MultiTank
+extends GregtechMeta_MultiBlockBase {
+ public GregtechMetaTileEntity_MultiTank(final int aID, final String aName, final String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ }
+
+ private short multiblockCasingCount = 0;
+ private int mInternalSaveClock = 0;
+ private final short storageMultiplier = 1;
+ private int maximumFluidStorage = 128000;
+ private FluidStack internalStorageTank = null;
+ private final NBTTagCompound internalCraftingComponentsTag = new NBTTagCompound();
+
+ @Override
+ public String getMachineType() {
+ return "Fluid Tank";
+ }
+
+ @Override
+ public String[] getExtraInfoData() {
+ final ArrayList<GT_MetaTileEntity_Hatch_Energy> mTier = this.mEnergyHatches;
+ if (!mTier.isEmpty()){
+ final int temp = mTier.get(0).mTier;
+ if (this.internalStorageTank == null) {
+ return new String[]{
+ GT_Values.VOLTAGE_NAMES[temp]+" Large Fluid Tank",
+ "Stored Fluid: No Fluid",
+ "Internal | Current: "+Integer.toString(0) + "L",
+ "Internal | Maximum: "+Integer.toString(this.maximumFluidStorage) + "L"};
+ }
+ return new String[]{
+ GT_Values.VOLTAGE_NAMES[temp]+" Large Fluid Tank",
+ "Stored Fluid: "+this.internalStorageTank.getLocalizedName(),
+ "Internal | Current: "+Integer.toString(this.internalStorageTank.amount) + "L",
+ "Internal | Maximum: "+Integer.toString(this.maximumFluidStorage) + "L"};
+ }
+ return new String[]{
+ "Voltage Tier not set -" +" Large Fluid Tank",
+ "Stored Fluid: No Fluid",
+ "Internal | Current: "+Integer.toString(0) + "L",
+ "Internal | Maximum: "+Integer.toString(this.maximumFluidStorage) + "L"};
+ }
+
+ @Override
+ public void saveNBTData(final NBTTagCompound aNBT) {
+ super.saveNBTData(aNBT);
+ */
+/*final NBTTagCompound gtCraftingComponentsTag = aNBT.getCompoundTag("GT.CraftingComponents");
+ if (gtCraftingComponentsTag != null){
+
+ Utils.LOG_WARNING("Got Crafting Tag");
+
+ if (this.internalStorageTank != null){
+ Utils.LOG_WARNING("mFluid was not null, Saving TileEntity NBT data.");
+
+ gtCraftingComponentsTag.setString("xFluid", this.internalStorageTank.getFluid().getName());
+ gtCraftingComponentsTag.setInteger("xAmount", this.internalStorageTank.amount);
+ gtCraftingComponentsTag.setLong("xAmountMax", this.maximumFluidStorage);
+
+ aNBT.setTag("GT.CraftingComponents", gtCraftingComponentsTag);
+ }
+ else {
+ Utils.LOG_WARNING("mFluid was null, Saving TileEntity NBT data.");
+ gtCraftingComponentsTag.removeTag("xFluid");
+ gtCraftingComponentsTag.removeTag("xAmount");
+ gtCraftingComponentsTag.removeTag("xAmountMax");
+ gtCraftingComponentsTag.setLong("xAmountMax", this.maximumFluidStorage);
+
+
+ aNBT.setTag("GT.CraftingComponents", gtCraftingComponentsTag);
+ }
+ }*//*
+
+ }
+
+ @Override
+ public void loadNBTData(final NBTTagCompound aNBT) {
+ super.loadNBTData(aNBT);
+ */
+/*final NBTTagCompound gtCraftingComponentsTag = aNBT.getCompoundTag("GT.CraftingComponents");
+ String xFluid = null;
+ int xAmount = 0;
+ if (gtCraftingComponentsTag.hasNoTags()){
+ if (this.internalStorageTank != null){
+ Utils.LOG_WARNING("mFluid was not null, Creating TileEntity NBT data.");
+ gtCraftingComponentsTag.setInteger("xAmount", this.internalStorageTank.amount);
+ gtCraftingComponentsTag.setString("xFluid", this.internalStorageTank.getFluid().getName());
+ aNBT.setTag("GT.CraftingComponents", gtCraftingComponentsTag);
+ }
+ }
+ else {
+
+ //internalCraftingComponentsTag = gtCraftingComponentsTag.getCompoundTag("backupTag");
+
+ if (gtCraftingComponentsTag.hasKey("xFluid")){
+ Utils.LOG_WARNING("xFluid was not null, Loading TileEntity NBT data.");
+ xFluid = gtCraftingComponentsTag.getString("xFluid");
+ }
+ if (gtCraftingComponentsTag.hasKey("xAmount")){
+ Utils.LOG_WARNING("xAmount was not null, Loading TileEntity NBT data.");
+ xAmount = gtCraftingComponentsTag.getInteger("xAmount");
+ }
+ if ((xFluid != null) && (xAmount != 0)){
+ Utils.LOG_WARNING("Setting Internal Tank, loading "+xAmount+"L of "+xFluid);
+ this.setInternalTank(xFluid, xAmount);
+ }
+ }*//*
+
+ }
+
+ private boolean setInternalTank(final String fluidName, final int amount){
+ final FluidStack temp = FluidUtils.getFluidStack(fluidName, amount);
+ if (temp != null){
+ if (this.internalStorageTank == null){
+ this.internalStorageTank = temp;
+ Logger.WARNING(temp.getFluid().getName()+" Amount: "+temp.amount+"L");
+ }
+ else{
+ Logger.WARNING("Retained Fluid.");
+ Logger.WARNING(this.internalStorageTank.getFluid().getName()+" Amxount: "+this.internalStorageTank.amount+"L");
+ }
+ this.markDirty();
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public void onLeftclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) {
+ this.tryForceNBTUpdate();
+ super.onLeftclick(aBaseMetaTileEntity, aPlayer);
+ }
+
+ @Override
+ public boolean onWrenchRightClick(final byte aSide, final byte aWrenchingSide, final EntityPlayer aPlayer, final float aX, final float aY, final float aZ) {
+ this.tryForceNBTUpdate();
+ return super.onWrenchRightClick(aSide, aWrenchingSide, aPlayer, aX, aY, aZ);
+ }
+
+ @Override
+ public void onRemoval() {
+ this.tryForceNBTUpdate();
+ super.onRemoval();
+ }
+
+
+ @Override
+ public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) {
+ super.onPostTick(aBaseMetaTileEntity, aTick);
+
+ if ((this.internalStorageTank != null) && this.internalStorageTank.amount >= this.maximumFluidStorage){
+ if (this.internalStorageTank.amount > this.maximumFluidStorage){
+ this.internalStorageTank.amount = this.maximumFluidStorage;
+ }
+ this.stopMachine();
+ }
+
+ if (this.mInternalSaveClock != 20){
+ this.mInternalSaveClock++;
+ }
+ else {
+ this.mInternalSaveClock = 0;
+ this.tryForceNBTUpdate();
+ }
+
+ }
+
+ public GregtechMetaTileEntity_MultiTank(final String aName) {
+ super(aName);
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaTileEntity_MultiTank(this.mName);
+ }
+
+ @Override
+ public String[] getTooltip() {
+ return new String[]{
+ "Controller Block for the Multitank",
+ "Size: 3xHx3 (Block behind controller must be air)",
+ "Structure must be at least 4 blocks tall, maximum 20.",
+ "Each casing within the structure adds 128000L storage.",
+ "Multitank Exterior Casings (16 at least!)",
+ "Controller (front centered)",
+ "1x Input hatch",
+ "1x Output hatch",
+ "1x Energy Hatch",
+ };
+ }
+
+ @Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+ if (aSide == aFacing) {
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(TAE.GTPP_INDEX(11)), new GT_RenderedTexture(aActive ? TexturesGtBlock.Overlay_Machine_Screen_Logo : TexturesGtBlock.Overlay_Machine_Screen_Logo)};
+ }
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(TAE.GTPP_INDEX(11))};
+ }
+
+ @Override
+ public boolean hasSlotInGUI() {
+ return false;
+ }
+
+ @Override
+ public String getCustomGUIResourceName() {
+ return null;
+ }
+
+ @Override
+ public GT_Recipe.GT_Recipe_Map getRecipeMap() {
+ return null;
+ }
+
+ @Override
+ public boolean isFacingValid(final byte aFacing) {
+ return aFacing > 1;
+ }
+
+ @Override
+ public boolean checkRecipe(final ItemStack aStack) {
+
+ final ArrayList<ItemStack> tInputList = this.getStoredInputs();
+ for (int i = 0; i < (tInputList.size() - 1); i++) {
+ for (int j = i + 1; j < tInputList.size(); j++) {
+ if (GT_Utility.areStacksEqual(tInputList.get(i), tInputList.get(j))) {
+ if (tInputList.get(i).stackSize >= tInputList.get(j).stackSize) {
+ tInputList.remove(j--);
+ } else {
+ tInputList.remove(i--);
+ break;
+ }
+ }
+ }
+ }
+ final ItemStack[] tInputs = Arrays.copyOfRange(tInputList.toArray(new ItemStack[tInputList.size()]), 0, 2);
+
+ final ArrayList<FluidStack> tFluidList = this.getStoredFluids();
+ for (int i = 0; i < (tFluidList.size() - 1); i++) {
+ for (int j = i + 1; j < tFluidList.size(); j++) {
+ if (GT_Utility.areFluidsEqual(tFluidList.get(i), tFluidList.get(j))) {
+ if (tFluidList.get(i).amount >= tFluidList.get(j).amount) {
+ tFluidList.remove(j--);
+ } else {
+ tFluidList.remove(i--);
+ break;
+ }
+ }
+ }
+ }
+ final FluidStack[] tFluids = Arrays.copyOfRange(tFluidList.toArray(new FluidStack[1]), 0, 1);
+
+ if (tFluids.length >= 2){
+ Logger.WARNING("Bad");
+ return false;
+ }
+
+ final ArrayList<Pair<GT_MetaTileEntity_Hatch_Input, Boolean>> rList = new ArrayList<>();
+ int slotInputCount = 0;
+ for (final GT_MetaTileEntity_Hatch_Input tHatch : this.mInputHatches) {
+ boolean containsFluid = false;
+ if (isValidMetaTileEntity(tHatch)) {
+ slotInputCount++;
+ for (int i=0; i<tHatch.getBaseMetaTileEntity().getSizeInventory(); i++) {
+ if (tHatch.canTankBeEmptied()){containsFluid=true;}
+ }
+ rList.add(new Pair<>(tHatch, containsFluid));
+ }
+ }
+ if ((tFluids.length <= 0) || (slotInputCount > 1)){
+ Logger.WARNING("Bad");
+ return false;
+ }
+
+ Logger.WARNING("Okay - 2");
+ if (this.internalStorageTank == null){
+ Logger.WARNING("Okay - 3");
+ if ((rList.get(0).getKey().mFluid != null) && (rList.get(0).getKey().mFluid.amount > 0)){
+ Logger.WARNING("Okay - 4");
+ Logger.WARNING("Okay - 1"+" rList.get(0).getKey().mFluid.amount: "+rList.get(0).getKey().mFluid.amount */
+/*+" internalStorageTank:"+internalStorageTank.amount*//*
+);
+ final FluidStack tempFluidStack = rList.get(0).getKey().mFluid;
+ final Fluid tempFluid = tempFluidStack.getFluid();
+ this.internalStorageTank = FluidUtils.getFluidStack(tempFluid.getName(), tempFluidStack.amount);
+ rList.get(0).getKey().mFluid.amount = 0;
+ Logger.WARNING("Okay - 1.1"+" rList.get(0).getKey().mFluid.amount: "+rList.get(0).getKey().mFluid.amount +" internalStorageTank:"+this.internalStorageTank.amount);
+ return true;
+ }
+ Logger.WARNING("No Fluid in hatch.");
+ return false;
+ }
+ else if (this.internalStorageTank.isFluidEqual(rList.get(0).getKey().mFluid)){
+ Logger.WARNING("Storing "+rList.get(0).getKey().mFluid.amount+"L");
+ Logger.WARNING("Contains "+this.internalStorageTank.amount+"L");
+
+
+ int tempAdd = 0;
+ tempAdd = rList.get(0).getKey().getFluidAmount();
+ rList.get(0).getKey().mFluid = null;
+ Logger.WARNING("adding "+tempAdd);
+ this.internalStorageTank.amount = this.internalStorageTank.amount + tempAdd;
+ Logger.WARNING("Tank now Contains "+this.internalStorageTank.amount+"L of "+this.internalStorageTank.getFluid().getName()+".");
+
+
+ //Utils.LOG_WARNING("Tank");
+ return true;
+ }
+ else {
+ final FluidStack superTempFluidStack = rList.get(0).getKey().mFluid;
+ Logger.WARNING("is input fluid equal to stored fluid? "+(this.internalStorageTank.isFluidEqual(superTempFluidStack)));
+ if (superTempFluidStack != null) {
+ Logger.WARNING("Input hatch[0] Contains "+superTempFluidStack.amount+"L of "+superTempFluidStack.getFluid().getName()+".");
+ }
+ Logger.WARNING("Large Multi-Tank Contains "+this.internalStorageTank.amount+"L of "+this.internalStorageTank.getFluid().getName()+".");
+
+ if (this.internalStorageTank.amount <= 0){
+ Logger.WARNING("Internal Tank is empty, sitting idle.");
+ return false;
+ }
+
+ if ((this.mOutputHatches.get(0).mFluid == null) || this.mOutputHatches.isEmpty() || (this.mOutputHatches.get(0).mFluid.isFluidEqual(this.internalStorageTank) && (this.mOutputHatches.get(0).mFluid.amount < this.mOutputHatches.get(0).getCapacity()))){
+ Logger.WARNING("Okay - 3");
+ final int tempCurrentStored = this.internalStorageTank.amount;
+ int tempResult = 0;
+ final int tempHatchSize = this.mOutputHatches.get(0).getCapacity();
+ final int tempHatchCurrentHolding = this.mOutputHatches.get(0).getFluidAmount();
+ final int tempHatchRemainingSpace = tempHatchSize - tempHatchCurrentHolding;
+ final FluidStack tempOutputFluid = this.internalStorageTank;
+ if (tempHatchRemainingSpace <= 0){
+ return false;
+ }
+ Logger.WARNING("Okay - 3.1.x"+" hatchCapacity: "+tempHatchSize +" tempCurrentStored: "+tempCurrentStored+" output hatch holds: "+tempHatchCurrentHolding+" tank has "+tempHatchRemainingSpace+"L of space left.");
+
+ if (tempHatchSize >= tempHatchRemainingSpace){
+ Logger.WARNING("Okay - 3.1.1"+" hatchCapacity: "+tempHatchSize +" tempCurrentStored: "+tempCurrentStored+" output hatch holds: "+tempHatchCurrentHolding+" tank has "+tempHatchRemainingSpace+"L of space left.");
+
+ int adder;
+ if ((tempCurrentStored > 0) && (tempCurrentStored <= tempHatchSize)){
+ adder = tempCurrentStored;
+ if (adder >= tempHatchRemainingSpace){
+ adder = tempHatchRemainingSpace;
+ }
+ }
+ else {
+ adder = 0;
+ if (tempCurrentStored >= tempHatchRemainingSpace){
+ adder = tempHatchRemainingSpace;
+ }
+ }
+
+ tempResult = adder;
+ tempOutputFluid.amount = tempResult;
+ Logger.WARNING("Okay - 3.1.2"+" result: "+tempResult +" tempCurrentStored: "+tempCurrentStored + " filling output hatch with: "+tempOutputFluid.amount+"L of "+tempOutputFluid.getFluid().getName());
+ this.mOutputHatches.get(0).fill(tempOutputFluid, true);
+ //mOutputHatches.get(0).mFluid.amount = tempResult;
+ this.internalStorageTank.amount = (tempCurrentStored-adder);
+ Logger.WARNING("Okay - 3.1.3"+" internalTankStorage: "+this.internalStorageTank.amount +"L | output hatch contains: "+this.mOutputHatches.get(0).mFluid.amount+"L of "+this.mOutputHatches.get(0).mFluid.getFluid().getName());
+ */
+/*if (internalStorageTank.amount <= 0)
+ internalStorageTank = null;*//*
+
+ }
+ Logger.WARNING("Tank ok.");
+ return true;
+ }
+ }
+ //this.getBaseMetaTileEntity().(tFluids[0].amount, true);
+ Logger.WARNING("Tank");
+ return false;
+ }
+
+ @Override
+ public int getMaxParallelRecipes() {
+ return 1;
+ }
+
+ @Override
+ public int getEuDiscountForParallelism() {
+ return 0;
+ }
+
+ @Override
+ public boolean checkMultiblock(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) {
+ final int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX;
+ final int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ;
+ if (!aBaseMetaTileEntity.getAirOffset(xDir, 0, zDir)) {
+ Logger.WARNING("Must be hollow.");
+ return false;
+ }
+ int tAmount = 0;
+ for (int i = -1; i < 2; i++) {
+ for (int j = -1; j < 2; j++) {
+ for (int h = -1; h < 19; h++) {
+ if ((h != 0) || ((((xDir + i) != 0) || ((zDir + j) != 0)) && ((i != 0) || (j != 0)))) {
+ final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j);
+ if ((!this.addMaintenanceToMachineList(tTileEntity, TAE.GTPP_INDEX(11))) && (!this.addInputToMachineList(tTileEntity, TAE.GTPP_INDEX(11))) && (!this.addOutputToMachineList(tTileEntity, TAE.GTPP_INDEX(11))) && (!this.addEnergyInputToMachineList(tTileEntity, TAE.GTPP_INDEX(11)))) {
+ if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) {
+ if (h < 3){
+ Logger.WARNING("Casing Expected.");
+ return false;
+ }
+ else if (h >= 3){
+ //Utils.LOG_WARNING("Your Multitank can be 20 blocks tall.");
+ }
+ }
+ if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != 11) {
+ if (h < 3){
+ Logger.WARNING("Wrong Meta.");
+ return false;
+ }
+ else if (h >= 3){
+ //Utils.LOG_WARNING("Your Multitank can be 20 blocks tall.");
+ }
+ }
+ if (h < 3){
+ tAmount++;
+ }
+ else if (h >= 3){
+ if ((aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) == Blocks.air) || aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getUnlocalizedName().contains("residual")){
+ Logger.WARNING("Found air");
+ }
+ else {
+ Logger.WARNING("Layer "+(h+2)+" is complete. Adding "+(64000*9)+"L storage to the tank.");
+ tAmount++;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ this.multiblockCasingCount = (short) tAmount;
+ this.maximumFluidStorage = getMaximumTankStorage(tAmount);
+ Logger.INFO("Your Multitank can be 20 blocks tall.");
+ Logger.INFO("Casings Count: "+this.multiblockCasingCount+" Valid Multiblock: "+(tAmount >= 16)+" Tank Storage Capacity:"+this.maximumFluidStorage+"L");
+ this.tryForceNBTUpdate();
+ return tAmount >= 16;
+ }
+
+ */
+/*public int countCasings() {
+ Utils.LOG_INFO("Counting Machine Casings");
+ try{
+ if (this.getBaseMetaTileEntity().getWorld() == null){
+ Utils.LOG_INFO("Tile Entity's world was null for casing count.");
+ return 0;
+ }
+ if (this.getBaseMetaTileEntity() == null){
+ Utils.LOG_INFO("Tile Entity was null for casing count.");
+ return 0;
+ }
+ } catch(NullPointerException r){
+ Utils.LOG_INFO("Null Pointer Exception caught.");
+ return 0;
+ }
+ int xDir = ForgeDirection.getOrientation(this.getBaseMetaTileEntity().getBackFacing()).offsetX;
+ int zDir = ForgeDirection.getOrientation(this.getBaseMetaTileEntity().getBackFacing()).offsetZ;
+ if (!this.getBaseMetaTileEntity().getAirOffset(xDir, 0, zDir)) {
+ Utils.LOG_INFO("Failed due to air being misplaced.");
+ Utils.LOG_WARNING("Must be hollow.");
+ return 0;
+ }
+ int tAmount = 0;
+ Utils.LOG_INFO("Casing Count set to 0.");
+ for (int i = -1; i < 2; i++) {
+ for (int j = -1; j < 2; j++) {
+ for (int h = -1; h < 19; h++) {
+ if ((h != 0) || (((xDir + i != 0) || (zDir + j != 0)) && ((i != 0) || (j != 0)))) {
+ IGregTechTileEntity tTileEntity = this.getBaseMetaTileEntity().getIGregTechTileEntityOffset(xDir + i, h, zDir + j);
+ if ((!addMaintenanceToMachineList(tTileEntity, TAE.GTPP_INDEX(11))) && (!addInputToMachineList(tTileEntity, TAE.GTPP_INDEX(11))) && (!addOutputToMachineList(tTileEntity, TAE.GTPP_INDEX(11))) && (!addEnergyInputToMachineList(tTileEntity, TAE.GTPP_INDEX(11)))) {
+ if (this.getBaseMetaTileEntity().getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) {
+ if (h < 3){
+ Utils.LOG_WARNING("Casing Expected.");
+ return 0;
+ }
+ else if (h >= 3){
+ //Utils.LOG_WARNING("Your Multitank can be 20 blocks tall.");
+ }
+ }
+ if (this.getBaseMetaTileEntity().getMetaIDOffset(xDir + i, h, zDir + j) != 11) {
+ if (h < 3){
+ Utils.LOG_WARNING("Wrong Meta.");
+ return 0;
+ }
+ else if (h >= 3){
+ //Utils.LOG_WARNING("Your Multitank can be 20 blocks tall.");
+ }
+ }
+ if (h < 3){
+ tAmount++;
+ }
+ else if (h >= 3){
+ if (this.getBaseMetaTileEntity().getBlockOffset(xDir + i, h, zDir + j) == Blocks.air || this.getBaseMetaTileEntity().getBlockOffset(xDir + i, h, zDir + j).getUnlocalizedName().contains("residual")){
+ Utils.LOG_WARNING("Found air");
+ }
+ else {
+ Utils.LOG_WARNING("Layer "+(h+2)+" is complete. Adding "+(64000*9)+"L storage to the tank.");
+ tAmount++;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ Utils.LOG_INFO("Finished counting.");
+ multiblockCasingCount = (short) tAmount;
+ //Utils.LOG_INFO("Your Multitank can be 20 blocks tall.");
+ Utils.LOG_INFO("Casings Count: "+tAmount+" Valid Multiblock: "+(tAmount >= 16)+" Tank Storage Capacity:"+getMaximumTankStorage(tAmount)+"L");
+ return tAmount;
+ }*//*
+
+
+ @Override
+ public int getMaxEfficiency(final ItemStack aStack) {
+ return 10000;
+ }
+
+ @Override
+ public int getPollutionPerTick(final ItemStack aStack) {
+ return 5;
+ }
+
+ @Override
+ public int getAmountOfOutputs() {
+ return 1;
+ }
+
+ @Override
+ public boolean explodesOnComponentBreak(final ItemStack aStack) {
+ return false;
+ }
+
+ private static short getStorageMultiplier(final int casingCount){
+ final int tsm = 1*casingCount;
+ if (tsm <= 0){
+ return 1;
+ }
+ return (short) tsm;
+ }
+
+ private static int getMaximumTankStorage(final int casingCount){
+ final int multiplier = getStorageMultiplier(casingCount);
+ final int tempTankStorageMax = 128000*multiplier;
+ if (tempTankStorageMax <= 0){return 128000;}
+ return tempTankStorageMax;
+ }
+
+ private boolean tryForceNBTUpdate(){
+*/
+/*
+ //Block is invalid.
+ if ((this == null) || (this.getBaseMetaTileEntity() == null)){
+ Utils.LOG_WARNING("Block was not valid for saving data.");
+ return false;
+ }
+
+ //Don't need this to run clientside.
+ if (!this.getBaseMetaTileEntity().isServerSide()) {
+ return false;
+ }
+
+ //Internal Tag was not valid.
+ try{
+ if (this.internalCraftingComponentsTag == null){
+ Utils.LOG_WARNING("Internal NBT data tag was null.");
+ return false;
+ }
+ } catch (final NullPointerException x){
+ Utils.LOG_WARNING("Caught null NBT.");
+ }
+
+ //Internal tag was valid.
+ this.saveNBTData(this.internalCraftingComponentsTag);
+
+
+ //Mark block for update
+ int x,y,z = 0;
+ x = this.getBaseMetaTileEntity().getXCoord();
+ y = this.getBaseMetaTileEntity().getYCoord();
+ z = this.getBaseMetaTileEntity().getZCoord();
+ this.getBaseMetaTileEntity().getWorld().markBlockForUpdate(x, y, z);
+
+ //Mark block dirty, let chunk know it's data has changed and it must be saved to disk. (Albeit slowly)
+ this.getBaseMetaTileEntity().markDirty();*//*
+
+ return true;
+ }
+}*/
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java
new file mode 100644
index 0000000000..a90c962cae
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java
@@ -0,0 +1,657 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.storage;
+
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
+
+import com.gtnewhorizon.structurelib.StructureLibAPI;
+import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
+import com.gtnewhorizon.structurelib.structure.IStructureElement;
+import com.gtnewhorizon.structurelib.structure.StructureDefinition;
+
+import gregtech.api.enums.TAE;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.MetaTileEntity;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Dynamo;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.lib.LoadedMods;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.math.MathUtils;
+import gtPlusPlus.core.util.minecraft.PlayerUtils;
+import gtPlusPlus.preloader.asm.AsmConfig;
+import gtPlusPlus.xmod.gregtech.api.gui.CONTAINER_PowerSubStation;
+import gtPlusPlus.xmod.gregtech.api.gui.GUI_PowerSubStation;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBattery;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBattery;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.world.World;
+
+public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_PowerSubStationController> {
+
+ protected long mAverageEuUsage = 0;
+ protected long mTotalEnergyAdded = 0;
+ protected long mTotalEnergyConsumed = 0;
+ protected long mTotalEnergyLost = 0;
+ protected boolean mIsOutputtingPower = false;
+ protected long mBatteryCapacity = 0;
+
+ private final int ENERGY_TAX = 2;
+
+ private int mCasing;
+ private int[] cellCount = new int[6];
+ private IStructureDefinition<GregtechMetaTileEntity_PowerSubStationController> STRUCTURE_DEFINITION = null;
+
+ public GregtechMetaTileEntity_PowerSubStationController(final int aID, final String aName, final String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ }
+
+ public GregtechMetaTileEntity_PowerSubStationController(final String aName) {
+ super(aName);
+ }
+
+ @Override
+ public String getMachineType() {
+ return "Energy Buffer";
+ }
+
+ @Override
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
+ GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType(getMachineType())
+ .addInfo("[BUG] GUI does not work until structure is assembled correctly. (Do Not Report issue)")
+ .addInfo("Consumes " + this.ENERGY_TAX + "% of the average voltage of all energy type hatches")
+ .addInfo("Does not require maintenance")
+ .addInfo("Can be built with variable height between " + (CELL_HEIGHT_MIN + 2) + "-" + (CELL_HEIGHT_MAX + 2) + "")
+ .addInfo("Hatches can be placed nearly anywhere")
+ .addInfo("HV Energy/Dynamo Hatches are the lowest tier you can use")
+ .addInfo("Supports voltages >= UHV using MAX tier components.")
+ .addSeparator()
+ .addController("Bottom Center")
+ .addCasingInfo("Sub-Station External Casings", 10)
+ .addDynamoHatch("Any Casing", 1)
+ .addEnergyHatch("Any Casing", 1)
+ .toolTipFinisher(CORE.GT_Tooltip_Builder);
+ return tt;
+ }
+
+ @Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+ if (aSide == aFacing) {
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(TAE.GTPP_INDEX(24)),
+ new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_DISASSEMBLER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_DISASSEMBLER)};
+ }
+ if (aSide == this.getBaseMetaTileEntity().getBackFacing()) {
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(TAE.GTPP_INDEX(24)),
+ mIsOutputtingPower ? Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[(int) this.getOutputTier()] : Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI[(int) this.getInputTier()]};
+ }
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(TAE.GTPP_INDEX(23))};
+ }
+
+ @Override
+ public boolean hasSlotInGUI() {
+ return true;
+ }
+
+ @Override
+ public String getCustomGUIResourceName() {
+ return null;
+ }
+
+ @Override
+ public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) {
+ if (mBatteryCapacity <= 0) return false;
+ if (!aBaseMetaTileEntity.isClientSide()) {
+ aBaseMetaTileEntity.openGUI(aPlayer);
+ }
+ return true;
+ }
+
+ @Override
+ public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GUI_PowerSubStation(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "Ergon Energy - Sub Station");
+ }
+
+ @Override
+ public Object getServerGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) {
+ return new CONTAINER_PowerSubStation(aPlayerInventory, aBaseMetaTileEntity);
+ }
+
+ private void checkMachineProblem(String msg, int xOff, int yOff, int zOff) {
+ final IGregTechTileEntity te = this.getBaseMetaTileEntity();
+ final Block tBlock = te.getBlockOffset(xOff, yOff, zOff);
+ final byte tMeta = te.getMetaIDOffset(xOff, yOff, zOff);
+ String name = tBlock.getLocalizedName();
+ String problem = msg + ": (" + xOff + ", " + yOff + ", " + zOff + ") " + name + ":" + tMeta;
+ checkMachineProblem(problem);
+ }
+ private void checkMachineProblem(String msg) {
+ if (!AsmConfig.disableAllLogging) {
+ Logger.INFO("Power Sub-Station problem: " + msg);
+ }
+ }
+
+ public static int getCellTier(Block aBlock, int aMeta) {
+ if (aBlock == ModBlocks.blockCasings2Misc && aMeta == 7) {
+ return 4;
+ } else if (aBlock == ModBlocks.blockCasings3Misc && aMeta == 4) {
+ return 5;
+ } else if (aBlock == ModBlocks.blockCasings3Misc && aMeta == 5) {
+ return 6;
+ } else if (aBlock == ModBlocks.blockCasings3Misc && aMeta == 6) {
+ return 7;
+ } else if (aBlock == ModBlocks.blockCasings3Misc && aMeta == 7) {
+ return 8;
+ } else if (aBlock == ModBlocks.blockCasings3Misc && aMeta == 8) {
+ return 9;
+ } else {
+ return -1;
+ }
+ }
+
+ public static int getMetaFromTier(int tier) {
+ if (tier == 4) return 7;
+ if (tier >= 5 && tier <= 9) return tier - 1;
+ return 0;
+ }
+
+ public static Block getBlockFromTier(int tier) {
+ switch (tier) {
+ case 4: return ModBlocks.blockCasings2Misc;
+ case 5: case 6: case 7: case 8: case 9: return ModBlocks.blockCasings3Misc;
+ default: return null;
+ }
+ }
+
+ public static int getMaxHatchTier(int aCellTier) {
+ switch(aCellTier) {
+ case 9:
+ return CORE.GTNH ? 15 : 9;
+ default:
+ if (aCellTier < 4) {
+ return 0;
+ }
+ else {
+ return aCellTier;
+ }
+ }
+ }
+
+ public static final int CELL_HEIGHT_MAX = 16;
+ public static final int CELL_HEIGHT_MIN = 2;
+
+ @Override
+ public IStructureDefinition<GregtechMetaTileEntity_PowerSubStationController> getStructureDefinition() {
+ if (STRUCTURE_DEFINITION == null) {
+ STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_PowerSubStationController>builder()
+ .addShape(mName + "bottom", transpose(new String[][]{
+ {"CC~CC", "CCCCC", "CCCCC", "CCCCC", "CCCCC"}
+ }))
+ .addShape(mName + "mid", transpose(new String[][]{
+ {"CCCCC", "CHHHC", "CHHHC", "CHHHC", "CCCCC"}
+ }))
+ .addShape(mName + "top", transpose(new String[][]{
+ {"CCCCC", "CCCCC", "CCCCC", "CCCCC", "CCCCC"}
+ }))
+ .addElement(
+ 'C',
+ ofChain(
+ ofHatchAdder(
+ GregtechMetaTileEntity_PowerSubStationController::addPowerSubStationList, TAE.GTPP_INDEX(24), 1
+ ),
+ onElementPass(
+ x -> ++x.mCasing,
+ ofBlock(
+ ModBlocks.blockCasings2Misc, 8
+ )
+ )
+ )
+ )
+ .addElement(
+ 'H',
+ ofChain(
+ onElementPass(
+ x -> ++x.cellCount[0],
+ ofCell(4)
+ ),
+ onElementPass(
+ x -> ++x.cellCount[1],
+ ofCell(5)
+ ),
+ onElementPass(
+ x -> ++x.cellCount[2],
+ ofCell(6)
+ ),
+ onElementPass(
+ x -> ++x.cellCount[3],
+ ofCell(7)
+ ),
+ onElementPass(
+ x -> ++x.cellCount[4],
+ ofCell(8)
+ ),
+ onElementPass(
+ x -> ++x.cellCount[5],
+ ofCell(9)
+ )
+ )
+ )
+ .build();
+ }
+ return STRUCTURE_DEFINITION;
+ }
+
+ public static <T> IStructureElement<T> ofCell(int aIndex) {
+ return new IStructureElement<T>() {
+ @Override
+ public boolean check(T t, World world, int x, int y, int z) {
+ Block block = world.getBlock(x, y, z);
+ int meta = world.getBlockMetadata(x, y, z);
+ int tier = getCellTier(block, meta);
+ return aIndex == tier;
+ }
+
+ public int getIndex(int size) {
+ if (size > 6) size = 6;
+ return size + 3;
+ }
+
+ @Override
+ public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
+ StructureLibAPI.hintParticle(world, x, y, z, getBlockFromTier(getIndex(trigger.stackSize)), getMetaFromTier(getIndex(trigger.stackSize)));
+ return true;
+ }
+
+ @Override
+ public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
+ return world.setBlock(x, y, z, getBlockFromTier(getIndex(trigger.stackSize)), getMetaFromTier(getIndex(trigger.stackSize)), 3);
+ }
+ };
+ }
+
+ @Override
+ public void construct(ItemStack stackSize, boolean hintsOnly) {
+ int layer = Math.min(stackSize.stackSize + 3, 18);
+ buildPiece(mName + "bottom" , stackSize, hintsOnly, 2, 0, 0);
+ for (int i = 1; i < layer - 1; i++) {
+ buildPiece(mName + "mid", stackSize, hintsOnly, 2, i, 0);
+ }
+ buildPiece(mName + "top", stackSize, hintsOnly, 2, layer - 1, 0);
+ }
+
+ @Override
+ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ mCasing = 0;
+ mAllEnergyHatches.clear();
+ mAllDynamoHatches.clear();
+ for (int i = 0; i < 6; i++) {
+ cellCount[i] = 0;
+ }
+ if (!checkPiece(mName + "bottom", 2, 0, 0))
+ return false;
+ int layer = 1;
+ while (checkPiece(mName + "mid", 2, layer, 0)) {
+ layer ++;
+ }
+ if (layer > 19 || !checkPiece(mName + "top", 2, layer, 0))
+ return false;
+ int level = 0;
+ for (int i = 0; i < 6; i++) {
+ if (cellCount[i] != 0) {
+ if (level == 0) level = i + 4;
+ else return false;
+ }
+ }
+ int tier = getMaxHatchTier(level);
+ long volSum = 0;
+ for (GT_MetaTileEntity_Hatch hatch : mAllDynamoHatches) {
+ if (hatch.mTier > tier || hatch.mTier < 3) return false;
+ volSum += (8 << (hatch.mTier * 2));
+ }
+ for (GT_MetaTileEntity_Hatch hatch : mAllEnergyHatches) {
+ if (hatch.mTier > tier || hatch.mTier < 3) return false;
+ volSum += (8 << (hatch.mTier * 2));
+ }
+ mBatteryCapacity = getCapacityFromCellTier(level) * cellCount[level - 4];
+ if (mAllEnergyHatches.size() + mAllDynamoHatches.size() > 0) {
+ mAverageEuUsage = volSum / (mAllEnergyHatches.size() + mAllDynamoHatches.size());
+ }
+ else mAverageEuUsage = 0;
+ fixAllMaintenanceIssue();
+ return true;
+ }
+
+ public final boolean addPowerSubStationList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null) {
+ return false;
+ } else {
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Dynamo) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } if (LoadedMods.TecTech) {
+ if (isThisHatchMultiDynamo(aMetaTileEntity)) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (isThisHatchMultiEnergy(aMetaTileEntity)) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ }
+ }
+ return false;
+ }
+
+ // Define storage capacity of smallest cell tier (EV) and compute higher tiers from it
+ private static final long CELL_TIER_EV_CAPACITY = 100 * 1000 * 1000; // one lapotronic orb
+ private static final long CELL_TIER_MULTIPLIER = 4; // each tier's capacity is this many times the previous tier
+
+ public static long getCapacityFromCellTier(int aOverallCellTier) {
+ // Use integer math instead of `Math.pow` to avoid range/precision errors
+ if (aOverallCellTier < 4) return 0;
+ aOverallCellTier -= 4;
+ long capacity = CELL_TIER_EV_CAPACITY;
+ while (aOverallCellTier > 0) {
+ capacity *= CELL_TIER_MULTIPLIER;
+ aOverallCellTier--;
+ }
+ return capacity;
+ }
+
+ @Override
+ public int getMaxEfficiency(final ItemStack aStack) {
+ return 10000;
+ }
+
+ @Override
+ public boolean explodesOnComponentBreak(final ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaTileEntity_PowerSubStationController(this.mName);
+ }
+
+ //mTotalEnergyAdded
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ aNBT.setLong("mAverageEuUsage", this.mAverageEuUsage);
+
+ //Usage Stats
+ aNBT.setLong("mTotalEnergyAdded", this.mTotalEnergyAdded);
+ aNBT.setLong("mTotalEnergyLost", this.mTotalEnergyLost);
+ aNBT.setLong("mTotalEnergyConsumed", this.mTotalEnergyConsumed);
+ aNBT.setLong("mTotalRunTime", this.mTotalRunTime);
+ aNBT.setBoolean("mIsOutputtingPower", this.mIsOutputtingPower);
+ aNBT.setLong("mBatteryCapacity", this.mBatteryCapacity);
+ super.saveNBTData(aNBT);
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+
+ // Best not to get a long if the Tag Map is holding an int
+ if (aNBT.hasKey("mAverageEuUsage")) {
+ this.mAverageEuUsage = aNBT.getLong("mAverageEuUsage");
+ }
+
+ //Usage Stats
+ this.mTotalEnergyAdded = aNBT.getLong("mTotalEnergyAdded");
+ this.mTotalEnergyLost = aNBT.getLong("mTotalEnergyLost");
+ this.mTotalEnergyConsumed = aNBT.getLong("mTotalEnergyConsumed");
+ this.mTotalRunTime = aNBT.getLong("mTotalRunTime");
+
+ this.mIsOutputtingPower = aNBT.getBoolean("mIsOutputtingPower");
+
+ this.mBatteryCapacity = aNBT.getLong("mBatteryCapacity");
+
+ super.loadNBTData(aNBT);
+ }
+
+ @Override
+ public boolean checkRecipe(final ItemStack aStack) {
+ this.mProgresstime = 1;
+ this.mMaxProgresstime = 1;
+ this.mEUt = 0;
+ this.mEfficiencyIncrease = 10000;
+ this.fixAllMaintenanceIssue();
+ return true;
+ }
+
+ @Override
+ public int getMaxParallelRecipes() {
+ return 1;
+ }
+
+ @Override
+ public int getEuDiscountForParallelism() {
+ return 0;
+ }
+
+ private void drawEnergyFromHatch(MetaTileEntity aHatch) {
+ if (!isValidMetaTileEntity(aHatch)) return;
+
+ long stored = aHatch.getEUVar();
+ long voltage = aHatch.maxEUInput() * aHatch.maxAmperesIn();
+
+ if (voltage > stored) {
+ return;
+ }
+
+ if (this.getBaseMetaTileEntity().increaseStoredEnergyUnits(voltage, false)) {
+ aHatch.setEUVar((stored - voltage));
+ this.mTotalEnergyAdded += voltage;
+ }
+ }
+
+ private void addEnergyToHatch(MetaTileEntity aHatch) {
+ if (!isValidMetaTileEntity(aHatch)) return;
+
+ long voltage = aHatch.maxEUOutput() * aHatch.maxAmperesOut();
+
+ if (aHatch.getEUVar() > aHatch.maxEUStore() - voltage) return;
+
+ if (this.getBaseMetaTileEntity().decreaseStoredEnergyUnits(voltage, false)) {
+ aHatch.getBaseMetaTileEntity().increaseStoredEnergyUnits(voltage, false);
+ this.mTotalEnergyConsumed+=voltage;
+ }
+
+ }
+
+ private long computeEnergyTax() {
+ float mTax = mAverageEuUsage * (ENERGY_TAX / 100f);
+
+ // Increase tax up to 2x if machine is not fully repaired
+ mTax = mTax * (1f + (10000f - mEfficiency) / 10000f);
+
+ return MathUtils.roundToClosestLong(mTax);
+ }
+
+
+ @Override
+ public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ this.fixAllMaintenanceIssue();
+ }
+
+ @Override
+ public boolean onRunningTick(ItemStack aStack) {
+ // First, decay overcharge (0.1% of stored energy plus 1000 EU per tick)
+ if (this.getEUVar() > this.mBatteryCapacity) {
+ long energy = (long) (this.getEUVar() * 0.999f) - 1000;
+ this.setEUVar(energy);
+ }
+
+ // Pay Tax
+ long mDecrease = computeEnergyTax();
+ this.mTotalEnergyLost += Math.min(mDecrease, this.getEUVar());
+ this.setEUVar(Math.max(0, this.getEUVar() - mDecrease));
+
+ // Input Power
+ for (Object THatch : this.mDischargeHatches) {
+ GT_MetaTileEntity_Hatch_OutputBattery tHatch = (GT_MetaTileEntity_Hatch_OutputBattery) THatch;
+ drawEnergyFromHatch(tHatch);
+ }
+ for (GT_MetaTileEntity_Hatch tHatch : this.mAllEnergyHatches) {
+ drawEnergyFromHatch(tHatch);
+ }
+
+ // Output Power
+ for (Object THatch : this.mChargeHatches) {
+ GT_MetaTileEntity_Hatch_InputBattery tHatch = (GT_MetaTileEntity_Hatch_InputBattery) THatch;
+ addEnergyToHatch(tHatch);
+ }
+ for (GT_MetaTileEntity_Hatch tHatch : this.mAllDynamoHatches) {
+ addEnergyToHatch(tHatch);
+ }
+
+ return true;
+
+ }
+
+ @Override
+ public boolean drainEnergyInput(long aEU) {
+ // Not applicable to this machine
+ return true;
+ }
+
+ @Override
+ public boolean addEnergyOutput(long aEU) {
+ // Not applicable to this machine
+ return true;
+ }
+
+ @Override
+ public long maxEUStore() {
+ return mBatteryCapacity;
+ }
+
+ @Override
+ public long getMinimumStoredEU() {
+ return 0;
+ }
+
+ @Override
+ public String[] getExtraInfoData() {
+ String mode;
+ if (mIsOutputtingPower) {
+ mode = EnumChatFormatting.GOLD + "Output" + EnumChatFormatting.RESET;
+ } else {
+ mode = EnumChatFormatting.BLUE + "Input" + EnumChatFormatting.RESET;
+ }
+
+ String storedEnergyText;
+ if (this.getEUVar() > this.mBatteryCapacity) {
+ storedEnergyText = EnumChatFormatting.RED + GT_Utility.formatNumbers(this.getEUVar()) + EnumChatFormatting.RESET;
+ } else {
+ storedEnergyText = EnumChatFormatting.GREEN + GT_Utility.formatNumbers(this.getEUVar()) + EnumChatFormatting.RESET;
+ }
+
+ int errorCode = this.getBaseMetaTileEntity().getErrorDisplayID();
+ boolean mMaint = (errorCode != 0);
+
+ return new String[]{
+ "Ergon Energy - District Sub-Station",
+ "Stored EU: " + storedEnergyText,
+ "Capacity: " + EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(this.maxEUStore()) + EnumChatFormatting.RESET,
+ "Running Costs: " + EnumChatFormatting.RED + GT_Utility.formatNumbers(this.computeEnergyTax()) + EnumChatFormatting.RESET + " EU/t",
+ "Controller Mode: " + mode,
+ "Requires Maintenance: " + (!mMaint ? EnumChatFormatting.GREEN : EnumChatFormatting.RED)+ mMaint + EnumChatFormatting.RESET +" | Code: ["+(!mMaint ? EnumChatFormatting.GREEN : EnumChatFormatting.RED) + errorCode + EnumChatFormatting.RESET +"]",
+ "----------------------",
+ "Stats for Nerds",
+ "Total Input: " + EnumChatFormatting.BLUE + GT_Utility.formatNumbers(this.mTotalEnergyAdded) + EnumChatFormatting.RESET + " EU",
+ "Total Output: " + EnumChatFormatting.GOLD + GT_Utility.formatNumbers(this.mTotalEnergyConsumed) + EnumChatFormatting.RESET + " EU",
+ "Total Costs: " + EnumChatFormatting.RED + GT_Utility.formatNumbers(this.mTotalEnergyLost) + EnumChatFormatting.RESET + " EU",
+ };
+ }
+
+ @Override
+ public void explodeMultiblock() {
+ // TODO Auto-generated method stub
+ super.explodeMultiblock();
+ }
+
+ @Override
+ public void doExplosion(long aExplosionPower) {
+ // TODO Auto-generated method stub
+ super.doExplosion(aExplosionPower);
+ }
+
+ @Override
+ public long getMaxInputVoltage() {
+ return 32768;
+ }
+
+ @Override
+ public boolean isElectric() {
+ return true;
+ }
+
+ @Override
+ public boolean isEnetInput() {
+ return !mIsOutputtingPower;
+ }
+
+ @Override
+ public boolean isEnetOutput() {
+ return mIsOutputtingPower;
+ }
+
+ @Override
+ public boolean isInputFacing(byte aSide) {
+ return (aSide == this.getBaseMetaTileEntity().getBackFacing() && !mIsOutputtingPower);
+ }
+
+ @Override
+ public boolean isOutputFacing(byte aSide) {
+ return (aSide == this.getBaseMetaTileEntity().getBackFacing() && mIsOutputtingPower);
+ }
+
+ @Override
+ public long maxAmperesIn() {
+ return 32;
+ }
+
+ @Override
+ public long maxAmperesOut() {
+ return 32;
+ }
+
+ @Override
+ public long maxEUInput() {
+ return 32768;
+ }
+
+ @Override
+ public long maxEUOutput() {
+ return 32768;
+ }
+
+ @Override
+ public void onModeChangeByScrewdriver(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ mIsOutputtingPower = Utils.invertBoolean(mIsOutputtingPower);
+ if (mIsOutputtingPower) {
+ PlayerUtils.messagePlayer(aPlayer, "Sub-Station is now outputting power from the controller.");
+ }
+ else {
+ PlayerUtils.messagePlayer(aPlayer, "Sub-Station is now inputting power into the controller.");
+ }
+ }
+
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/misc/TileEntitySolarHeater.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/misc/TileEntitySolarHeater.java
new file mode 100644
index 0000000000..5d8e9d468d
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/misc/TileEntitySolarHeater.java
@@ -0,0 +1,348 @@
+/*
+package gtPlusPlus.xmod.gregtech.common.tileentities.misc;
+
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_TieredMachineBlock;
+import gregtech.api.objects.GT_ItemStack;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.api.objects.minecraft.BlockPos;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.GregtechMetaTileEntity_SolarTower;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+
+public class TileEntitySolarHeater extends GT_MetaTileEntity_TieredMachineBlock {
+
+ public String mSolarTower;
+ public boolean mHasTower = false;
+
+ private Integer mTX, mTY, mTZ;
+ private Byte mRequiredFacing;
+
+ public TileEntitySolarHeater(final int aID, final String aName, final String aNameRegional, final int aTier,
+ final String aDescription, final int aSlotCount) {
+ super(aID, aName, aNameRegional, aTier, aSlotCount, aDescription);
+ }
+
+ public TileEntitySolarHeater(final String aName, final int aTier, final String aDescription,
+ final ITexture[][][] aTextures, final int aSlotCount) {
+ super(aName, aTier, aSlotCount, aDescription, aTextures);
+ }
+
+ @Override
+ public String[] getDescription() {
+ return new String[] {
+ this.mDescription,
+ "Point me at a Solar Tower",
+ CORE.GT_Tooltip };
+ }
+
+ @Override
+ public ITexture[][][] getTextureSet(final ITexture[] aTextures) {
+ final ITexture[][][] rTextures = new ITexture[10][17][];
+ for (byte i = -1; i < 16; i++) {
+ rTextures[0][i + 1] = this.getFront(i);
+ rTextures[1][i + 1] = this.getBack(i);
+ rTextures[2][i + 1] = this.getBottom(i);
+ rTextures[3][i + 1] = this.getTop(i);
+ rTextures[4][i + 1] = this.getSides(i);
+ rTextures[5][i + 1] = this.getFrontActive(i);
+ rTextures[6][i + 1] = this.getBackActive(i);
+ rTextures[7][i + 1] = this.getBottomActive(i);
+ rTextures[8][i + 1] = this.getTopActive(i);
+ rTextures[9][i + 1] = this.getSidesActive(i);
+ }
+ return rTextures;
+ }
+
+ @Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing,
+ final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+ return this.mTextures[(aActive ? 5 : 0) + (aSide == aFacing ? 0
+ : aSide == GT_Utility.getOppositeSide(aFacing) ? 1 : aSide == 0 ? 2 : aSide == 1 ? 3 : 4)][aColorIndex
+ + 1];
+ }
+
+ public ITexture[] getFront(final byte aColor) {
+ return new ITexture[] { new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Top),
+ new GT_RenderedTexture(Textures.BlockIcons.SOLARPANEL_IV) };
+ }
+
+ public ITexture[] getBack(final byte aColor) {
+ return new ITexture[] { new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Top) };
+ }
+
+ public ITexture[] getBottom(final byte aColor) {
+ return new ITexture[] { new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom) };
+ }
+
+ public ITexture[] getTop(final byte aColor) {
+ return new ITexture[] { new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Top),
+ new GT_RenderedTexture(Textures.BlockIcons.SOLARPANEL_LuV) };
+ }
+
+ public ITexture[] getSides(final byte aColor) {
+ return new ITexture[] { new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Top) };
+ }
+
+ public ITexture[] getFrontActive(final byte aColor) {
+ return new ITexture[] { new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Top),
+ new GT_RenderedTexture(Textures.BlockIcons.SOLARPANEL_IV) };
+ }
+
+ public ITexture[] getBackActive(final byte aColor) {
+ return new ITexture[] { new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Top) };
+ }
+
+ public ITexture[] getBottomActive(final byte aColor) {
+ return new ITexture[] { new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom) };
+ }
+
+ public ITexture[] getTopActive(final byte aColor) {
+ return new ITexture[] { new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Top),
+ new GT_RenderedTexture(Textures.BlockIcons.SOLARPANEL_LuV) };
+ }
+
+ public ITexture[] getSidesActive(final byte aColor) {
+ return new ITexture[] { new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Top) };
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
+ return new TileEntitySolarHeater(this.mName, this.mTier, this.mDescription, this.mTextures, 0);
+ }
+
+ @Override
+ public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public String[] getInfoData() {
+ return new String[] {
+ this.getLocalName(),
+ "Testificate"
+ };
+ }
+
+ @Override
+ public boolean isGivingInformation() {
+ return true;
+ }
+
+ @Override
+ public boolean isUseableByPlayer(final EntityPlayer p_70300_1_) {
+ return false;
+ }
+
+ public boolean allowCoverOnSide(final byte aSide, final int aCoverID) {
+ return false;
+ }
+
+ @Override
+ public int[] getAccessibleSlotsFromSide(final int p_94128_1_) {
+ return new int[] {};
+ }
+
+ @Override
+ public int getSizeInventory() {
+ return 0;
+ }
+
+ @Override
+ public ItemStack getStackInSlot(final int p_70301_1_) {
+ return null;
+ }
+
+ @Override
+ public long maxEUStore() {
+ return 0;
+ }
+
+ @Override
+ public int getCapacity() {
+ return 0;
+ }
+
+ @Override
+ public long maxEUInput() {
+ return 0;
+ }
+
+ @Override
+ public long maxEUOutput() {
+ return 0;
+ }
+
+ @Override
+ public long maxAmperesIn() {
+ return 0;
+ }
+
+ @Override
+ public long maxAmperesOut() {
+ return 0;
+ }
+
+ @Override
+ public boolean isElectric() {
+ return false;
+ }
+
+ @Override
+ public boolean isValidSlot(final int aIndex) {
+ return false;
+ }
+
+ @Override
+ public boolean isFacingValid(final byte aFacing) {
+ return aFacing >= 2;
+ }
+
+ @Override
+ public boolean isEnetInput() {
+ return false;
+ }
+
+ @Override
+ public boolean isEnetOutput() {
+ return false;
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ aNBT.setBoolean("mHasTower", mHasTower);
+ if (mHasTower && mTX != null && mTY != null && mTZ != null) {
+ aNBT.setInteger("mTX", mTX);
+ aNBT.setInteger("mTY", mTY);
+ aNBT.setInteger("mTZ", mTZ);
+ }
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ this.mHasTower = aNBT.getBoolean("mHasTower");
+ if (this.mHasTower) {
+ if (aNBT.hasKey("mTX"))
+ this.mTX = aNBT.getInteger("mTX");
+ if (aNBT.hasKey("mTY"))
+ this.mTY = aNBT.getInteger("mTY");
+ if (aNBT.hasKey("mTZ"))
+ this.mTZ = aNBT.getInteger("mTZ");
+ }
+ }
+
+ @Override
+ public long getInputTier() {
+ return 0;
+ }
+
+ @Override
+ public long getOutputTier() {
+ return 0;
+ }
+
+ @Override
+ public boolean allowCoverOnSide(byte aSide, GT_ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public void onExplosion() {
+
+ }
+
+ public GregtechMetaTileEntity_SolarTower getSolarTower() {
+ if (this.mHasTower && this.mSolarTower != null && this.mSolarTower.length() > 0) {
+ BlockPos p = BlockPos.generateBlockPos(mSolarTower);
+ if (p != null) {
+ IGregTechTileEntity tTileEntity = getBaseMetaTileEntity().getIGregTechTileEntity(p.xPos, p.yPos, p.zPos);
+ if (tTileEntity != null && tTileEntity instanceof GregtechMetaTileEntity_SolarTower) {
+ return (GregtechMetaTileEntity_SolarTower) tTileEntity;
+ }
+ }
+ }
+ return null;
+ }
+
+
+ public boolean setSolarTower(BlockPos aTowerPos) {
+ if (!this.mHasTower && setSolarTowerInternal(aTowerPos.getUniqueIdentifier())) {
+ IGregTechTileEntity tTileEntity = getBaseMetaTileEntity().getIGregTechTileEntity(aTowerPos.xPos, aTowerPos.yPos, aTowerPos.zPos);
+ if (tTileEntity != null && tTileEntity instanceof GregtechMetaTileEntity_SolarTower) {
+ this.mTX = tTileEntity.getXCoord();
+ this.mTY = (int) tTileEntity.getYCoord();
+ this.mTZ = tTileEntity.getZCoord();
+ this.mHasTower = true;
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private boolean clearSolarTower() {
+ if (mHasTower || mTX != null || mTY != null || mTZ != null || mRequiredFacing != null || this.mSolarTower != null) {
+ this.mTX = null;
+ this.mTY = null;
+ this.mTZ = null;
+ this.mRequiredFacing = null;
+ this.mSolarTower = null;
+ this.mHasTower = false;
+ return true;
+ }
+ return false;
+ }
+
+ private final boolean setSolarTowerInternal(String aTowerPos) {
+ this.mSolarTower = aTowerPos;
+ return this.mSolarTower != null && this.mSolarTower.length() > 0;
+ }
+
+ @Override
+ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ super.onPostTick(aBaseMetaTileEntity, aTick);
+
+ }
+
+ @Override
+ public void onRemoval() {
+ super.onRemoval();
+ }
+
+ @Override
+ public boolean isOutputFacing(byte aSide) {
+ return aSide > 1;
+ }
+
+ @Override
+ public boolean isInputFacing(byte aSide) {
+ return false;
+ }
+
+ @Override
+ public long getMinimumStoredEU() {
+ return 0;
+ }
+
+ @Override
+ public void onFacingChange() {
+ super.onFacingChange();
+ }
+
+ @Override
+ public void doExplosion(long aExplosionPower) {
+
+ }
+}
+*/
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_ConnectableCrate.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_ConnectableCrate.java
new file mode 100644
index 0000000000..a3c11d486b
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_ConnectableCrate.java
@@ -0,0 +1,574 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.storage;
+
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.Textures.BlockIcons;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.MetaTileEntity;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_TieredMachineBlock;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Utility;
+
+import gtPlusPlus.api.objects.data.AutoMap;
+import gtPlusPlus.api.objects.minecraft.BlockPos;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.data.ArrayUtils;
+import gtPlusPlus.xmod.gregtech.api.gui.CONTAINER_SuperChest;
+import gtPlusPlus.xmod.gregtech.api.gui.GUI_SuperChest;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+
+public class GT_MetaTileEntity_ConnectableCrate extends GT_MetaTileEntity_TieredMachineBlock {
+
+ /*sides.put(getUp());
+ sides.put(getDown());
+ sides.put(getXPos());
+ sides.put(getXNeg());
+ sides.put(getZPos());
+ sides.put(getZNeg());*/
+
+ public int mItemCount = 0;
+ public ItemStack mItemStack = null;
+ private final static double mStorageFactor = 2;
+
+ //Meta Tile ID
+ public final static int mCrateID = 955;
+
+ //Sides
+ public final static int SIDE_Up = 0;
+ public final static int SIDE_Down = 1;
+ public final static int SIDE_XPos = 2;
+ public final static int SIDE_XNeg = 3;
+ public final static int SIDE_ZPos = 4;
+ public final static int SIDE_ZNeg = 5;
+ public final static int[] SIDES = new int[] {SIDE_Up, SIDE_Down, SIDE_XPos, SIDE_XNeg, SIDE_ZPos, SIDE_ZNeg};
+
+ //Neighbour Cache
+ private GT_MetaTileEntity_ConnectableCrate[] mNeighbourCache = new GT_MetaTileEntity_ConnectableCrate[6];
+ //Cached Crate Location
+ private BlockPos mCurrentPos = null;
+ //Master Crate Position
+ protected BlockPos mMasterCrateLocation = null;
+ //Is Master?
+ protected boolean mIsMaster = false;
+ //Is Connected?
+ protected boolean mIsConnected[] = new boolean[] {false, false, false, false, false, false};
+ //How many are connected?
+ protected int mConnectedCount = 0;
+ //Map of connected locations
+ protected AutoMap<String> mConnectedCache = new AutoMap<String>();
+
+
+ public GT_MetaTileEntity_ConnectableCrate(int aID, String aName, String aNameRegional, int aTier) {
+ super(aID, aName, aNameRegional, aTier, 3,
+ "This Crate stores " + (int) (Math.pow(6.0D, (double) aTier) * mStorageFactor) + " Items", new ITexture[0]);
+ }
+
+ public GT_MetaTileEntity_ConnectableCrate(String aName, int aTier, String aDescription, ITexture[][][] aTextures) {
+ super(aName, aTier, 3, aDescription, aTextures);
+ }
+
+ @Override
+ public String[] getDescription() {
+ return new String[]{
+ this.mDescription,
+ CORE.GT_Tooltip};
+ }
+
+ public boolean isSimpleMachine() {
+ return true;
+ }
+
+ public boolean isFacingValid(byte aFacing) {
+ return true;
+ }
+
+ public boolean isAccessAllowed(EntityPlayer aPlayer) {
+ return true;
+ }
+
+ public boolean isValidSlot(int aIndex) {
+ return true;
+ }
+
+ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT_MetaTileEntity_ConnectableCrate(this.mName, this.mTier, this.mDescription, this.mTextures);
+ }
+
+ public int getOppositeSide(int side) {
+ if (side == SIDE_Up) {
+ return SIDE_Down;
+ }
+ else if (side == SIDE_Down) {
+ return SIDE_Up;
+ }
+ else if (side == SIDE_XNeg) {
+ return SIDE_XPos;
+ }
+ else if (side == SIDE_XPos) {
+ return SIDE_XNeg;
+ }
+ else if (side == SIDE_ZNeg) {
+ return SIDE_ZPos;
+ }
+ else {
+ return SIDE_ZNeg;
+ }
+ }
+
+ public boolean calculateOwnershipIfConnected() {
+ if (mCurrentPos == null) {
+ mCurrentPos = new BlockPos(this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord(), this.getBaseMetaTileEntity().getWorld());
+ }
+ AutoMap<BlockPos> n = mCurrentPos.getSurroundingBlocks();
+ int p = 0;
+ for (BlockPos i : n) {
+ if (i != null) {
+ if (doesSideContainCrate(p)) {
+ GT_MetaTileEntity_ConnectableCrate yu = getCrateAtBlockPos(i);
+ if (yu != null) {
+ mNeighbourCache[p] = yu;
+ }
+ }
+ }
+ p++;
+ }
+
+ int e4 = 0;
+ if (mNeighbourCache.length > 0) {
+ for (GT_MetaTileEntity_ConnectableCrate e : mNeighbourCache) {
+ this.mConnectedCount = this.mConnectedCache.size();
+ if (e != null) {
+ //First, we check if this Crate is a Master, if not, continue checking what it is.
+ if (this.mIsMaster) {
+ //So this other Crate is also a master? Which is more Powerful
+ if (e.mIsMaster) {
+ //This crate holds more connected, it becomes master now.
+ if (this.mConnectedCount > e.mConnectedCount) {
+ e.mIsMaster = false;
+ e.mMasterCrateLocation = this.mCurrentPos;
+ if (!e.mIsConnected[getOppositeSide(e4)]) {
+ e.mIsConnected[getOppositeSide(e4)] = true;
+ }
+ if (!this.mIsConnected[e4]) {
+ this.mIsConnected[e4] = true;
+ }
+ this.mConnectedCache = ArrayUtils.mergeTwoMaps(this.mConnectedCache, e.mConnectedCache);
+ continue;
+ }
+ //Other crate held more connected, it is now master.
+ else {
+ this.mIsMaster = false;
+ this.mMasterCrateLocation = e.mCurrentPos;
+ if (!this.mIsConnected[e4]) {
+ this.mIsConnected[e4] = true;
+ }
+ if (!e.mIsConnected[getOppositeSide(e4)]) {
+ e.mIsConnected[getOppositeSide(e4)] = true;
+ }
+ e.mConnectedCache = ArrayUtils.mergeTwoMaps(e.mConnectedCache, this.mConnectedCache);
+ //Best wipe our cache of connected blocks then, since they no longer hold value.
+ mConnectedCache.clear();
+ continue;
+ }
+ }
+ //Other Crate was not a Master, but we are, time to inherit it into our connection hivemind.
+ else {
+ //It would appear this controller has another master, time to query it.
+ if (e.mMasterCrateLocation != null && !e.mMasterCrateLocation.getUniqueIdentifier().equalsIgnoreCase(this.mMasterCrateLocation.getUniqueIdentifier())) {
+ GT_MetaTileEntity_ConnectableCrate gM = getCrateAtBlockPos(e.mMasterCrateLocation);
+ if (gM != null) {
+ //Lets compare controller strengths
+ int gM_Owned = gM.mConnectedCount;
+ //We are stronger, let's inherit it.
+ if (this.mConnectedCount > gM_Owned) {
+ e.mIsMaster = false;
+ e.mMasterCrateLocation = this.mCurrentPos;
+ gM.mIsMaster = false;
+ gM.mMasterCrateLocation = this.mCurrentPos;
+ if (!e.mIsConnected[getOppositeSide(e4)]) {
+ e.mIsConnected[getOppositeSide(e4)] = true;
+ }
+ if (!this.mIsConnected[e4]) {
+ this.mIsConnected[e4] = true;
+ }
+ this.mConnectedCache = ArrayUtils.mergeTwoMaps(this.mConnectedCache, gM.mConnectedCache);
+ continue;
+ }
+ //We lost, time to submit to a new master crate
+ else {
+ this.mIsMaster = false;
+ this.mMasterCrateLocation = e.mMasterCrateLocation;
+ if (!this.mIsConnected[e4]) {
+ this.mIsConnected[e4] = true;
+ }
+ if (!e.mIsConnected[getOppositeSide(e4)]) {
+ e.mIsConnected[getOppositeSide(e4)] = true;
+ }
+ gM.mConnectedCache = ArrayUtils.mergeTwoMaps(gM.mConnectedCache, this.mConnectedCache);
+ //Best wipe our cache of connected blocks then, since they no longer hold value.
+ mConnectedCache.clear();
+ continue;
+ }
+ }
+ else {
+ //Could not get the Tile Entity for the Other Master Crate.. Guess I can just ignore this case for now~ TODO
+ continue;
+ }
+ }
+ //Either the other crate has no known Master or it is already this crate.
+ else {
+ //The other crate has no master, time to inherit.
+ if (e.mMasterCrateLocation == null || (!e.mIsConnected[getOppositeSide(e4)])) {
+ e.mMasterCrateLocation = this.mCurrentPos;
+ if (!e.mIsConnected[getOppositeSide(e4)]) {
+ e.mIsConnected[getOppositeSide(e4)] = true;
+ }
+ if (!this.mIsConnected[e4]) {
+ this.mIsConnected[e4] = true;
+ }
+ mConnectedCache.put(e.mCurrentPos.getUniqueIdentifier());
+ continue;
+ }
+ else {
+ //Do nothing, we own this Crate already :)
+ continue;
+ }
+
+
+ }
+ }
+ }
+
+ //We are not a Storage Master Crate, into a brave new world we go
+ else {
+ //Best wipe our cache of connected blocks then, since they no longer hold value.
+ mConnectedCache.clear();
+
+ //Dang, the other crate is a master, time to get incorporated.
+ if (e.mIsMaster) {
+ this.mIsMaster = false;
+ this.mMasterCrateLocation = e.mCurrentPos;
+ this.mIsConnected[e4] = true;
+ if (!e.mIsConnected[e4]) {
+ e.mIsConnected[e4] = true;
+ }
+ if (e.mMasterCrateLocation == null) {
+ e.mMasterCrateLocation = e.mCurrentPos;
+ }
+ e.mConnectedCache.put(this.mCurrentPos.getUniqueIdentifier());
+ continue;
+ }
+ //So the Crate we Checked is not a Master, so let's see if it knows where one is
+ else {
+ //So, this Crate we have found knows about a master
+ if (e.mMasterCrateLocation != null) {
+ GT_MetaTileEntity_ConnectableCrate gM = getCrateAtBlockPos(e.mMasterCrateLocation);
+ //Found the master crate
+ if (gM != null) {
+ this.mIsMaster = false;
+ this.mMasterCrateLocation = e.mMasterCrateLocation;
+ if (!this.mIsConnected[e4]) {
+ this.mIsConnected[e4] = true;
+ }
+ if (!e.mIsConnected[getOppositeSide(e4)]) {
+ e.mIsConnected[getOppositeSide(e4)] = true;
+ }
+ gM.mConnectedCache.put(this.mCurrentPos.getUniqueIdentifier());
+ continue;
+ }
+ else {
+ //Could not get the Tile Entity for the Other Master Crate.. Guess I can just ignore this case for now~ TODO
+ continue;
+ }
+ }
+ //This crate has no master, not going to check if it's connected.
+ else {
+ this.mIsMaster = true;
+ this.mMasterCrateLocation = this.mCurrentPos;
+ e.mIsMaster = false;
+ e.mMasterCrateLocation = this.mCurrentPos;
+ if (!e.mIsConnected[getOppositeSide(e4)]) {
+ e.mIsConnected[getOppositeSide(e4)] = true;
+ }
+ if (!this.mIsConnected[e4]) {
+ this.mIsConnected[e4] = true;
+ }
+ mConnectedCache.put(e.mCurrentPos.getUniqueIdentifier());
+ continue;
+ }
+ }
+ }
+ }
+ e4++;
+ }
+ return true;
+ }
+ else {
+ return false;
+ }
+
+
+
+
+ }
+
+ public boolean doesSideContainCrate(int side) {
+ return checkSideForDataType(0, side);
+ }
+
+ public boolean isCrateAtSideController(int side) {
+ return checkSideForDataType(1, side);
+ }
+
+ private boolean checkSideForDataType(int aType, int aSide) {
+ BlockPos mPosToCheck =
+ aSide == SIDE_Up ? mCurrentPos.getUp() :
+ aSide == SIDE_Down ? mCurrentPos.getDown() :
+ aSide == SIDE_XPos ? mCurrentPos.getXPos() :
+ aSide == SIDE_XNeg ? mCurrentPos.getXNeg() :
+ aSide == SIDE_ZPos ? mCurrentPos.getZPos() :
+ mCurrentPos.getZNeg();
+ GT_MetaTileEntity_ConnectableCrate g = getCrateAtBlockPos(mPosToCheck);
+ if (g != null) {
+ if (aType == 0) {
+ return true;
+ }
+ else {
+ if (g.mIsMaster) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ public GT_MetaTileEntity_ConnectableCrate getCrateAtBlockPos(BlockPos pos) {
+ if (pos != null) {
+ Block b = pos.getBlockAtPos();
+ int m = pos.getMetaAtPos();
+ TileEntity t = pos.world.getTileEntity(pos.xPos, pos.yPos, pos.zPos);
+ if (b != null && t != null) {
+ if (b == GregTech_API.sBlockMachines && m == mCrateID) {
+ if (t instanceof IGregTechTileEntity) {
+ IGregTechTileEntity g = (IGregTechTileEntity) t;
+ final IMetaTileEntity aMetaTileEntity = g.getMetaTileEntity();
+ if (aMetaTileEntity == null) {
+ return null;
+ }
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_ConnectableCrate) {
+ return ((GT_MetaTileEntity_ConnectableCrate) aMetaTileEntity);
+
+ }
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+
+
+
+
+
+
+
+
+
+
+ public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) {
+ if (aBaseMetaTileEntity.isClientSide()) {
+ return true;
+ } else {
+ aBaseMetaTileEntity.openGUI(aPlayer);
+ return true;
+ }
+ }
+
+ public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ return new CONTAINER_SuperChest(aPlayerInventory, aBaseMetaTileEntity);
+ }
+
+ public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GUI_SuperChest(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName());
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) {
+ if (this.getBaseMetaTileEntity().isServerSide() && this.getBaseMetaTileEntity().isAllowedToWork()) {
+ if (this.getItemCount() <= 0) {
+ this.mItemStack = null;
+ this.mItemCount = 0;
+ }
+
+ if (this.mItemStack == null && this.mInventory[0] != null) {
+ this.mItemStack = this.mInventory[0].copy();
+ }
+
+ if (this.mInventory[0] != null && this.mItemCount < this.getMaxItemCount()
+ && GT_Utility.areStacksEqual(this.mInventory[0], this.mItemStack)) {
+ this.mItemCount += this.mInventory[0].stackSize;
+ if (this.mItemCount > this.getMaxItemCount()) {
+ this.mInventory[0].stackSize = this.mItemCount - this.getMaxItemCount();
+ this.mItemCount = this.getMaxItemCount();
+ } else {
+ this.mInventory[0] = null;
+ }
+ }
+
+ if (this.mInventory[1] == null && this.mItemStack != null) {
+ this.mInventory[1] = this.mItemStack.copy();
+ this.mInventory[1].stackSize = Math.min(this.mItemStack.getMaxStackSize(), this.mItemCount);
+ this.mItemCount -= this.mInventory[1].stackSize;
+ } else if (this.mItemCount > 0 && GT_Utility.areStacksEqual(this.mInventory[1], this.mItemStack)
+ && this.mInventory[1].getMaxStackSize() > this.mInventory[1].stackSize) {
+ int tmp = Math.min(this.mItemCount,
+ this.mInventory[1].getMaxStackSize() - this.mInventory[1].stackSize);
+ this.mInventory[1].stackSize += tmp;
+ this.mItemCount -= tmp;
+ }
+
+ if (this.mItemStack != null) {
+ this.mInventory[2] = this.mItemStack.copy();
+ this.mInventory[2].stackSize = Math.min(this.mItemStack.getMaxStackSize(), this.mItemCount);
+ } else {
+ this.mInventory[2] = null;
+ }
+ }
+
+ }
+
+ private int getItemCount() {
+ return this.mItemCount;
+ }
+
+ public void setItemCount(int aCount) {
+ this.mItemCount = aCount;
+ }
+
+ public int getProgresstime() {
+ return this.mItemCount + (this.mInventory[0] == null ? 0 : this.mInventory[0].stackSize)
+ + (this.mInventory[1] == null ? 0 : this.mInventory[1].stackSize);
+ }
+
+ public int maxProgresstime() {
+ return this.getMaxItemCount();
+ }
+
+ public int getMaxItemCount() {
+ return (int) (Math.pow(6.0D, (double) this.mTier) * mStorageFactor - 128.0D);
+ }
+
+ public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ return aIndex == 1;
+ }
+
+ public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ return aIndex == 0 && (this.mInventory[0] == null || GT_Utility.areStacksEqual(this.mInventory[0], aStack));
+ }
+
+ public String[] getInfoData() {
+ return this.mItemStack == null
+ ? new String[]{"Super Storage Chest", "Stored Items:", "No Items", Integer.toString(0),
+ Integer.toString(this.getMaxItemCount())}
+ : new String[]{"Super Storage Chest", "Stored Items:", this.mItemStack.getDisplayName(),
+ Integer.toString(this.mItemCount), Integer.toString(this.getMaxItemCount())};
+ }
+
+ public boolean isGivingInformation() {
+ return true;
+ }
+
+ public void saveNBTData(NBTTagCompound aNBT) {
+ aNBT.setInteger("mItemCount", this.mItemCount);
+ if (this.mItemStack != null) {
+ aNBT.setTag("mItemStack", this.mItemStack.writeToNBT(new NBTTagCompound()));
+ }
+ aNBT.setString("mMasterCrateLocation", mMasterCrateLocation.getUniqueIdentifier());
+ aNBT.setBoolean("mIsMaster", mIsMaster);
+ for (int y=0;y<this.mIsConnected.length;y++) {
+ aNBT.setBoolean("mIsConnected"+y, mIsConnected[y]);
+ }
+ aNBT.setInteger("mConnectedCount", mConnectedCount);
+ }
+
+ public void loadNBTData(NBTTagCompound aNBT) {
+ if (aNBT.hasKey("mItemCount")) {
+ this.mItemCount = aNBT.getInteger("mItemCount");
+ }
+ if (aNBT.hasKey("mItemStack")) {
+ this.mItemStack = ItemStack.loadItemStackFromNBT((NBTTagCompound) aNBT.getTag("mItemStack"));
+ }
+ if (aNBT.hasKey("mMasterCrateLocation")) {
+ this.mMasterCrateLocation = BlockPos.generateBlockPos(aNBT.getString("mMasterCrateLocation"));
+ }
+ if (aNBT.hasKey("mIsMaster")) {
+ this.mIsMaster = aNBT.getBoolean("mIsMaster");
+ }
+
+ for (int y=0;y<this.mIsConnected.length;y++) {
+ if (aNBT.hasKey("mIsConnected"+y)) {
+ this.mIsConnected[y] = aNBT.getBoolean("mIsConnected"+y);
+ }
+ }
+
+ if (aNBT.hasKey("mConnectedCount")) {
+ this.mConnectedCount = aNBT.getInteger("mConnectedCount");
+ }
+
+ }
+
+ public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex,
+ boolean aActive, boolean aRedstone) {
+ return aBaseMetaTileEntity.getFrontFacing() == 0 && aSide == 4
+ ? new ITexture[]{new GT_RenderedTexture(TexturesGtBlock.TEXTURE_CASING_AMAZON),
+ new GT_RenderedTexture(BlockIcons.OVERLAY_QCHEST)}
+ : (aSide == aBaseMetaTileEntity.getFrontFacing()
+ ? new ITexture[]{new GT_RenderedTexture(TexturesGtBlock.TEXTURE_CASING_AMAZON),
+ new GT_RenderedTexture(BlockIcons.OVERLAY_QCHEST)}
+ : new ITexture[]{new GT_RenderedTexture(TexturesGtBlock.TEXTURE_CASING_AMAZON)});
+ }
+
+ public ITexture[][][] getTextureSet(ITexture[] aTextures) {
+ return new ITexture[0][0][0];
+ }
+
+ @Override
+ public void onExplosion() {
+ // TODO Auto-generated method stub
+ super.onExplosion();
+ }
+
+ @Override
+ public void onRemoval() {
+ // TODO Auto-generated method stub
+ super.onRemoval();
+ }
+
+ @Override
+ public void onMachineBlockUpdate() {
+ // TODO Auto-generated method stub
+ super.onMachineBlockUpdate();
+ }
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_TieredChest.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_TieredChest.java
new file mode 100644
index 0000000000..951b4223dc
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_TieredChest.java
@@ -0,0 +1,199 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.storage;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+
+import gregtech.api.enums.Textures.BlockIcons;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.MetaTileEntity;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_TieredMachineBlock;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.xmod.gregtech.api.gui.CONTAINER_SuperChest;
+import gtPlusPlus.xmod.gregtech.api.gui.GUI_SuperChest;
+
+public class GT_MetaTileEntity_TieredChest extends GT_MetaTileEntity_TieredMachineBlock {
+ public int mItemCount = 0;
+ public ItemStack mItemStack = null;
+ private final static double mStorageFactor = (270000.0D/16);
+
+ public GT_MetaTileEntity_TieredChest(int aID, String aName, String aNameRegional, int aTier) {
+ super(aID, aName, aNameRegional, aTier, 3,
+ "This Chest stores " + (int) (Math.pow(6.0D, (double) aTier) * mStorageFactor) + " Items", new ITexture[0]);
+ }
+
+ public GT_MetaTileEntity_TieredChest(String aName, int aTier, String aDescription, ITexture[][][] aTextures) {
+ super(aName, aTier, 3, aDescription, aTextures);
+ }
+
+ /*public GT_MetaTileEntity_TieredChest(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) {
+ super(aName, aTier, 3, aDescription, aTextures);
+ }*/
+
+ @Override
+ public String[] getDescription() {
+ return new String[]{
+ this.mDescription,
+ CORE.GT_Tooltip};
+ }
+
+ public boolean isSimpleMachine() {
+ return true;
+ }
+
+ public boolean isFacingValid(byte aFacing) {
+ return true;
+ }
+
+ public boolean isAccessAllowed(EntityPlayer aPlayer) {
+ return true;
+ }
+
+ public boolean isValidSlot(int aIndex) {
+ return true;
+ }
+
+ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT_MetaTileEntity_TieredChest(this.mName, this.mTier, this.mDescription, this.mTextures);
+ }
+
+ public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) {
+ if (aBaseMetaTileEntity.isClientSide()) {
+ return true;
+ } else {
+ aBaseMetaTileEntity.openGUI(aPlayer);
+ return true;
+ }
+ }
+
+ public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ return new CONTAINER_SuperChest(aPlayerInventory, aBaseMetaTileEntity);
+ }
+
+ public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GUI_SuperChest(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName());
+ }
+
+ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) {
+ if (this.getBaseMetaTileEntity().isServerSide() && this.getBaseMetaTileEntity().isAllowedToWork()) {
+ if (this.getItemCount() <= 0) {
+ this.mItemStack = null;
+ this.mItemCount = 0;
+ }
+
+ if (this.mItemStack == null && this.mInventory[0] != null) {
+ this.mItemStack = this.mInventory[0].copy();
+ }
+
+ if (this.mInventory[0] != null && this.mItemCount < this.getMaxItemCount()
+ && GT_Utility.areStacksEqual(this.mInventory[0], this.mItemStack)) {
+ this.mItemCount += this.mInventory[0].stackSize;
+ if (this.mItemCount > this.getMaxItemCount()) {
+ this.mInventory[0].stackSize = this.mItemCount - this.getMaxItemCount();
+ this.mItemCount = this.getMaxItemCount();
+ } else {
+ this.mInventory[0] = null;
+ }
+ }
+
+ if (this.mInventory[1] == null && this.mItemStack != null) {
+ this.mInventory[1] = this.mItemStack.copy();
+ this.mInventory[1].stackSize = Math.min(this.mItemStack.getMaxStackSize(), this.mItemCount);
+ this.mItemCount -= this.mInventory[1].stackSize;
+ } else if (this.mItemCount > 0 && GT_Utility.areStacksEqual(this.mInventory[1], this.mItemStack)
+ && this.mInventory[1].getMaxStackSize() > this.mInventory[1].stackSize) {
+ int tmp = Math.min(this.mItemCount,
+ this.mInventory[1].getMaxStackSize() - this.mInventory[1].stackSize);
+ this.mInventory[1].stackSize += tmp;
+ this.mItemCount -= tmp;
+ }
+
+ if (this.mItemStack != null) {
+ this.mInventory[2] = this.mItemStack.copy();
+ this.mInventory[2].stackSize = Math.min(this.mItemStack.getMaxStackSize(), this.mItemCount);
+ } else {
+ this.mInventory[2] = null;
+ }
+ }
+
+ }
+
+ private int getItemCount() {
+ return this.mItemCount;
+ }
+
+ public void setItemCount(int aCount) {
+ this.mItemCount = aCount;
+ }
+
+ public int getProgresstime() {
+ return this.mItemCount + (this.mInventory[0] == null ? 0 : this.mInventory[0].stackSize)
+ + (this.mInventory[1] == null ? 0 : this.mInventory[1].stackSize);
+ }
+
+ public int maxProgresstime() {
+ return this.getMaxItemCount();
+ }
+
+ public int getMaxItemCount() {
+ return (int) (Math.pow(6.0D, (double) this.mTier) * mStorageFactor - 128.0D);
+ }
+
+ public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ return aIndex == 1;
+ }
+
+ public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ return aIndex == 0 && (this.mInventory[0] == null || GT_Utility.areStacksEqual(this.mInventory[0], aStack));
+ }
+
+ public String[] getInfoData() {
+ return this.mItemStack == null
+ ? new String[]{"Super Storage Chest", "Stored Items:", "No Items", Integer.toString(0),
+ Integer.toString(this.getMaxItemCount())}
+ : new String[]{"Super Storage Chest", "Stored Items:", this.mItemStack.getDisplayName(),
+ Integer.toString(this.mItemCount), Integer.toString(this.getMaxItemCount())};
+ }
+
+ public boolean isGivingInformation() {
+ return true;
+ }
+
+ public void saveNBTData(NBTTagCompound aNBT) {
+ aNBT.setInteger("mItemCount", this.mItemCount);
+ if (this.mItemStack != null) {
+ aNBT.setTag("mItemStack", this.mItemStack.writeToNBT(new NBTTagCompound()));
+ }
+
+ }
+
+ public void loadNBTData(NBTTagCompound aNBT) {
+ if (aNBT.hasKey("mItemCount")) {
+ this.mItemCount = aNBT.getInteger("mItemCount");
+ }
+
+ if (aNBT.hasKey("mItemStack")) {
+ this.mItemStack = ItemStack.loadItemStackFromNBT((NBTTagCompound) aNBT.getTag("mItemStack"));
+ }
+
+ }
+
+ public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex,
+ boolean aActive, boolean aRedstone) {
+ return aBaseMetaTileEntity.getFrontFacing() == 0 && aSide == 4
+ ? new ITexture[]{BlockIcons.MACHINE_CASINGS[this.mTier][aColorIndex + 1],
+ new GT_RenderedTexture(BlockIcons.OVERLAY_QCHEST)}
+ : (aSide == aBaseMetaTileEntity.getFrontFacing()
+ ? new ITexture[]{BlockIcons.MACHINE_CASINGS[this.mTier][aColorIndex + 1],
+ new GT_RenderedTexture(BlockIcons.OVERLAY_QCHEST)}
+ : new ITexture[]{BlockIcons.MACHINE_CASINGS[this.mTier][aColorIndex + 1]});
+ }
+
+ public ITexture[][][] getTextureSet(ITexture[] aTextures) {
+ return new ITexture[0][0][0];
+ }
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_TieredTank.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_TieredTank.java
new file mode 100644
index 0000000000..ef7fe829d4
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_TieredTank.java
@@ -0,0 +1,160 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.storage;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.nbt.NBTTagCompound;
+
+import gregtech.api.enums.GT_Values;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.MetaTileEntity;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicTank;
+import gregtech.api.objects.GT_RenderedTexture;
+
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.preloader.asm.AsmConfig;
+
+public class GT_MetaTileEntity_TieredTank extends GT_MetaTileEntity_BasicTank {
+
+ public GT_MetaTileEntity_TieredTank(final int aID, final String aName, final String aNameRegional, final int aTier) {
+ super(aID, aName, aNameRegional, aTier, 3, "Stores " + ((int) (Math.pow(2, aTier) * 32000)) + "L of fluid");
+ }
+
+ public GT_MetaTileEntity_TieredTank(final String aName, final int aTier, final String aDescription, final ITexture[][][] aTextures) {
+ super(aName, aTier, 3, "Stores " + ((int) (Math.pow(2, aTier) * 32000)) + "L of fluid", aTextures);
+ }
+
+ @Override
+ public String[] getDescription() {
+ String[] aTip;
+
+ String aTankPortableness = "portable";
+
+ if (this.mFluid == null) {
+ aTip = new String[] {this.mDescription, "A "+aTankPortableness+" tank.", CORE.GT_Tooltip};
+ }
+ else {
+ aTip = new String[] {this.mDescription, "A "+aTankPortableness+" tank.", "Fluid: "+mFluid.getLocalizedName()+" "+mFluid.amount+"L", CORE.GT_Tooltip};
+ }
+ return aTip;
+ }
+
+ @Override
+ public ITexture[][][] getTextureSet(final ITexture[] aTextures) {
+ return new ITexture[0][0][0];
+ }
+
+ @Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+ return aSide == 1 ? new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColorIndex + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_POTIONBREWER_ACTIVE)} : new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColorIndex + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_POTIONBREWER)};
+ }
+
+ @Override
+ public boolean isSimpleMachine() {
+ return true;
+ }
+
+ @Override
+ public boolean isFacingValid(final byte aFacing) {
+ return true;
+ }
+
+ @Override
+ public boolean isAccessAllowed(final EntityPlayer aPlayer) {
+ return true;
+ }
+
+ @Override
+ public final byte getUpdateData() {
+ return 0x00;
+ }
+
+ @Override
+ public boolean doesFillContainers() {
+ return true;
+ }
+
+ @Override
+ public boolean doesEmptyContainers() {
+ return true;
+ }
+
+ @Override
+ public boolean canTankBeFilled() {
+ return true;
+ }
+
+ @Override
+ public boolean canTankBeEmptied() {
+ return true;
+ }
+
+ @Override
+ public String[] getInfoData() {
+
+ if (this.mFluid == null) {
+ return new String[]{
+ GT_Values.VOLTAGE_NAMES[this.mTier]+" Fluid Tank",
+ "Stored Fluid:",
+ "No Fluid",
+ Integer.toString(0) + "L",
+ Integer.toString(this.getCapacity()) + "L"};
+ }
+ return new String[]{
+ GT_Values.VOLTAGE_NAMES[this.mTier]+" Fluid Tank",
+ "Stored Fluid:",
+ this.mFluid.getLocalizedName(),
+ Integer.toString(this.mFluid.amount) + "L",
+ Integer.toString(this.getCapacity()) + "L"};
+ }
+
+ @Override
+ public MetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
+ return new GT_MetaTileEntity_TieredTank(this.mName, this.mTier, this.mDescription, this.mTextures);
+ }
+
+ @Override
+ public int getCapacity() {
+ return (int) (Math.pow(2, this.mTier) * 32000);
+ }
+
+ @Override
+ public int getTankPressure() {
+ return 100;
+ }
+
+ @Override
+ public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) {
+ if (aBaseMetaTileEntity.isClientSide()){
+ //setVars();
+ return true;
+ }
+ aBaseMetaTileEntity.openGUI(aPlayer);
+ return true;
+ }
+
+ @Override
+ public boolean displaysItemStack() {
+ return true;
+ }
+
+ @Override
+ public boolean displaysStackSize() {
+ return false;
+ }
+
+ @Override
+ public void setItemNBT(NBTTagCompound aNBT) {
+ if (CORE.NBT_PERSISTENCY_PATCH_APPLIED) {
+ if (mFluid != null){
+ Logger.WARNING("Setting item fluid nbt");
+ aNBT.setTag("mFluid", mFluid.writeToNBT(new NBTTagCompound()));
+ if (aNBT.hasKey("mFluid")) {
+ Logger.WARNING("Set mFluid to NBT.");
+ }
+ }
+ }
+ }
+
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GregtechMetaEnergyBuffer.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GregtechMetaEnergyBuffer.java
new file mode 100644
index 0000000000..320e2175b0
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GregtechMetaEnergyBuffer.java
@@ -0,0 +1,421 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.storage;
+
+import static gregtech.api.enums.GT_Values.V;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.world.World;
+
+import gregtech.api.enums.Textures;
+import gregtech.api.gui.GT_Container_1by1;
+import gregtech.api.gui.GT_GUIContainer_1by1;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.objects.GT_ItemStack;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Utility;
+
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.minecraft.PlayerUtils;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMetaTileEntity;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+
+public class GregtechMetaEnergyBuffer extends GregtechMetaTileEntity {
+
+ protected byte aCurrentOutputAmperage = 4;
+
+ public GregtechMetaEnergyBuffer(final int aID, final String aName, final String aNameRegional, final int aTier, final String aDescription, final int aSlotCount) {
+ super(aID, aName, aNameRegional, aTier, aSlotCount, aDescription);
+ }
+
+ public GregtechMetaEnergyBuffer(final String aName, final int aTier, final String aDescription, final ITexture[][][] aTextures, final int aSlotCount) {
+ super(aName, aTier, aSlotCount, aDescription, aTextures);
+ }
+
+ @Override
+ public String[] getDescription() {
+ return new String[] {this.mDescription,
+ "Defaults 4A In/Out",
+ "Change output Amperage with a screwdriver",
+ "Now Portable!",
+ CORE.GT_Tooltip};
+ }
+
+ @Override
+ public boolean allowCoverOnSide(byte aSide, GT_ItemStack aCover) {
+ if (aSide != this.getBaseMetaTileEntity().getFrontFacing()) {
+ return true;
+ }
+ return super.allowCoverOnSide(aSide, aCover);
+ }
+
+ /*
+ * MACHINE_STEEL_SIDE
+ */
+
+ @Override
+ public ITexture[][][] getTextureSet(final ITexture[] aTextures) {
+ final ITexture[][][] rTextures = new ITexture[10][17][];
+ for (byte i = -1; i < 16; i++) {
+ rTextures[0][i + 1] = this.getFront(i);
+ rTextures[1][i + 1] = this.getBack(i);
+ rTextures[2][i + 1] = this.getBottom(i);
+ rTextures[3][i + 1] = this.getTop(i);
+ rTextures[4][i + 1] = this.getSides(i);
+ rTextures[5][i + 1] = this.getFrontActive(i);
+ rTextures[6][i + 1] = this.getBackActive(i);
+ rTextures[7][i + 1] = this.getBottomActive(i);
+ rTextures[8][i + 1] = this.getTopActive(i);
+ rTextures[9][i + 1] = this.getSidesActive(i);
+ }
+ return rTextures;
+ }
+
+ @Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+ return this.mTextures[(aActive ? 5 : 0) + (aSide == aFacing ? 0 : aSide == GT_Utility.getOppositeSide(aFacing) ? 1 : aSide == 0 ? 2 : aSide == 1 ? 3 : 4)][aColorIndex + 1];
+ }
+
+
+ public ITexture[] getFront(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier]};
+ }
+
+
+ public ITexture[] getBack(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Dimensional_Orange)};
+ }
+
+
+ public ITexture[] getBottom(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Dimensional_Orange)};
+ }
+
+
+ public ITexture[] getTop(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Screen_Logo)};
+ }
+
+
+ public ITexture[] getSides(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Dimensional_Orange)};
+ }
+
+
+ public ITexture[] getFrontActive(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier]};
+ }
+
+
+ public ITexture[] getBackActive(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Dimensional_Orange)};
+ }
+
+
+ public ITexture[] getBottomActive(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Dimensional_Orange)};
+ }
+
+
+ public ITexture[] getTopActive(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Screen_Logo)};
+ }
+
+
+ public ITexture[] getSidesActive(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Dimensional_Orange)};
+ }
+
+ /*@Override
+ public ITexture[][][] getTextureSet(ITexture[] aTextures) {
+ ITexture[][][] rTextures = new ITexture[2][17][];
+ for (byte i = -1; i < 16; i++) {
+ rTextures[0][i + 1] = new ITexture[] { new GT_RenderedTexture(
+ Textures.BlockIcons.MACHINE_HEATPROOFCASING) };
+ rTextures[1][i + 1] = new ITexture[] {
+ new GT_RenderedTexture(
+ Textures.BlockIcons.MACHINE_HEATPROOFCASING),
+ mInventory.length > 4 ? Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[mTier]
+ : Textures.BlockIcons.OVERLAYS_ENERGY_OUT[mTier] };
+ }
+ return rTextures;
+ }*/
+
+ /*
+ * @Override public ITexture[][][] getTextureSet(ITexture[] aTextures) {
+ * ITexture[][][] rTextures = new ITexture[5][17][]; for (byte i = -1; i <
+ * 16; i = (byte) (i + 1)) { ITexture[] tmp0 = { new GT_RenderedTexture(
+ * Textures.BlockIcons.MACHINE_STEEL_BOTTOM, Dyes.getModulation(i,
+ * Dyes._NULL.mRGBa)) }; rTextures[0][(i + 1)] = tmp0; ITexture[] tmp1 = {
+ * new GT_RenderedTexture( Textures.BlockIcons.MACHINE_STEEL_TOP) };
+ * rTextures[1][(i + 1)] = tmp1; ITexture[] tmp2 = { new GT_RenderedTexture(
+ * Textures.BlockIcons.MACHINE_STEEL_SIDE, Dyes.getModulation(i,
+ * Dyes._NULL.mRGBa)), new
+ * GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE) }; rTextures[2][(i +
+ * 1)] = tmp2; ITexture[] tmp4 = { new GT_RenderedTexture(
+ * Textures.BlockIcons.MACHINE_STEEL_SIDE, Dyes.getModulation(i,
+ * Dyes._NULL.mRGBa)), new
+ * GT_RenderedTexture(Textures.BlockIcons.BOILER_FRONT) }; rTextures[3][(i +
+ * 1)] = tmp4; ITexture[] tmp5 = { new GT_RenderedTexture(
+ * Textures.BlockIcons.MACHINE_STEEL_SIDE, Dyes.getModulation(i,
+ * Dyes._NULL.mRGBa)), new GT_RenderedTexture(
+ * Textures.BlockIcons.BOILER_FRONT_ACTIVE) }; rTextures[4][(i + 1)] = tmp5;
+ * } return rTextures; }
+ */
+
+ /*@Override
+ public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
+ return mTextures[aSide == aFacing ? 1 : 0][aColorIndex+1];
+ }*/
+
+ @Override
+ public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaEnergyBuffer(this.mName, this.mTier, this.mDescription, this.mTextures, this.mInventory.length);
+ }
+
+ @Override public boolean isSimpleMachine() {return false;}
+ @Override public boolean isElectric() {return true;}
+ @Override public boolean isValidSlot(final int aIndex) {return true;}
+ @Override public boolean isFacingValid(final byte aFacing) {return true;}
+ @Override public boolean isEnetInput() {return true;}
+ @Override public boolean isEnetOutput() {return true;}
+ @Override public boolean isInputFacing(final byte aSide) {return aSide!=this.getBaseMetaTileEntity().getFrontFacing();}
+ @Override public boolean isOutputFacing(final byte aSide) {return aSide==this.getBaseMetaTileEntity().getFrontFacing();}
+ @Override public boolean isTeleporterCompatible() {return false;}
+ @Override public long getMinimumStoredEU() {return V[this.mTier]*2;}
+ @Override public long maxEUStore() {return V[this.mTier]*250000;}
+
+ @Override
+ public long maxEUInput() {
+ return V[this.mTier];
+ }
+
+ @Override
+ public long maxEUOutput() {
+ return V[this.mTier];
+ }
+
+ @Override
+ public long maxAmperesIn() {
+ return aCurrentOutputAmperage;
+ }
+
+ @Override
+ public long maxAmperesOut() {
+ return aCurrentOutputAmperage;
+ }
+ @Override public int rechargerSlotStartIndex() {return 0;}
+ @Override public int dechargerSlotStartIndex() {return 0;}
+ @Override public int rechargerSlotCount() {return 0;}
+ @Override public int dechargerSlotCount() {return 0;}
+ @Override public int getProgresstime() {return (int)this.getBaseMetaTileEntity().getUniversalEnergyStored();}
+ @Override public int maxProgresstime() {return (int)this.getBaseMetaTileEntity().getUniversalEnergyCapacity();}
+ @Override public boolean isAccessAllowed(final EntityPlayer aPlayer) {return true;}
+
+ @Override
+ public void saveNBTData(final NBTTagCompound aNBT) {
+ aNBT.setByte("aCurrentOutputAmperage", aCurrentOutputAmperage);
+ if (CORE.NBT_PERSISTENCY_PATCH_APPLIED) {
+ long aEU = this.getBaseMetaTileEntity().getStoredEU();
+ if (aEU > 0){
+ aNBT.setLong("aStoredEU", aEU);
+ if (aNBT.hasKey("aStoredEU")) {
+ Logger.WARNING("Set aStoredEU to NBT.");
+ }
+ }
+ }
+ }
+
+ @Override
+ public void loadNBTData(final NBTTagCompound aNBT) {
+ aCurrentOutputAmperage = aNBT.getByte("aCurrentOutputAmperage");
+ if (aNBT.hasKey("aStoredEU")) {
+ this.setEUVar(aNBT.getLong("aStoredEU"));
+ }
+ }
+
+ @Override
+ public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) {
+ Logger.WARNING("Right Click on MTE by Player");
+ if (aBaseMetaTileEntity.isClientSide())
+ {
+ return true;
+ //aBaseMetaTileEntity.openGUI(aPlayer);
+ }
+
+ Logger.WARNING("MTE is Client-side");
+ this.showEnergy(aPlayer.getEntityWorld(), aPlayer);
+ return true;
+ }
+
+ private void showEnergy(final World worldIn, final EntityPlayer playerIn){
+ final long tempStorage = this.getBaseMetaTileEntity().getStoredEU();
+ final double c = ((double) tempStorage / this.maxEUStore()) * 100;
+ final double roundOff = Math.round(c * 100.00) / 100.00;
+ PlayerUtils.messagePlayer(playerIn, "Energy: " + GT_Utility.formatNumbers(tempStorage) + " EU at "+V[this.mTier]+"v ("+roundOff+"%)");
+ PlayerUtils.messagePlayer(playerIn, "Amperage: " + GT_Utility.formatNumbers(maxAmperesOut())+"A");
+
+ }
+ //Utils.LOG_WARNING("Begin Show Energy");
+ /*
+ *
+ //Utils.LOG_INFO("getProgresstime: "+tempStorage+" maxProgresstime: "+maxEUStore()+" C: "+c);
+ Utils.LOG_INFO("getProgressTime: "+getProgresstime());
+ Utils.LOG_INFO("maxProgressTime: "+maxProgresstime());
+ Utils.LOG_INFO("getMinimumStoredEU: "+getMinimumStoredEU());
+ Utils.LOG_INFO("maxEUStore: "+maxEUStore());*/
+ /*final long d = (tempStorage * 100L) / maxEUStore();
+ Utils.LOG_INFO("getProgresstime: "+tempStorage+" maxProgresstime: "+maxEUStore()+" D: "+d);
+ final double roundOff2 = Math.round(d * 100.00) / 100.00;
+ Utils.messagePlayer(playerIn, "Energy: " + tempStorage + " EU at "+V[mTier]+"v ("+roundOff2+"%)");
+ Utils.LOG_WARNING("Making new instance of Guihandler");
+ GuiHandler block = new GuiHandler();
+ Utils.LOG_WARNING("Guihandler.toString(): "+block.toString());
+ block.getClientGuiElement(1, playerIn, worldIn, (int) playerIn.posX, (int) playerIn.posY, (int) playerIn.posZ);*/
+
+
+ @Override
+ public Object getServerGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GT_Container_1by1(aPlayerInventory, aBaseMetaTileEntity);
+ }
+
+ @Override
+ public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GT_GUIContainer_1by1(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName());
+ }
+
+ @Override
+ public boolean allowPullStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public String[] getInfoData() {
+ String cur = GT_Utility.formatNumbers(this.getBaseMetaTileEntity().getStoredEU());
+ String max = GT_Utility.formatNumbers(this.getBaseMetaTileEntity().getEUCapacity());
+
+ // Right-align current storage with maximum storage
+ String fmt = String.format("%%%ds", max.length());
+ cur = String.format(fmt, cur);
+
+ return new String[] {
+ cur+" EU stored",
+ max+" EU capacity"};
+ }
+
+ @Override
+ public boolean isGivingInformation() {
+ return true;
+ }
+
+ @Override
+ public int[] getAccessibleSlotsFromSide(final int p_94128_1_) {
+ return new int[] {};
+ }
+
+ @Override
+ public boolean canInsertItem(final int p_102007_1_, final ItemStack p_102007_2_, final int p_102007_3_) {
+ return false;
+ }
+
+ @Override
+ public boolean canExtractItem(final int p_102008_1_, final ItemStack p_102008_2_, final int p_102008_3_) {
+ return false;
+ }
+
+ @Override
+ public int getSizeInventory() {
+ return 0;
+ }
+
+ @Override
+ public ItemStack getStackInSlot(final int p_70301_1_) {
+ return null;
+ }
+
+ @Override
+ public ItemStack decrStackSize(final int p_70298_1_, final int p_70298_2_) {
+ return null;
+ }
+
+ @Override
+ public ItemStack getStackInSlotOnClosing(final int p_70304_1_) {
+ return null;
+ }
+
+ @Override
+ public void setInventorySlotContents(final int p_70299_1_, final ItemStack p_70299_2_) {
+ }
+
+ @Override
+ public String getInventoryName() {
+ return super.getInventoryName();
+ }
+
+ @Override
+ public boolean hasCustomInventoryName() {
+ return false;
+ }
+
+ @Override
+ public int getInventoryStackLimit() {
+ return 0;
+ }
+
+ @Override
+ public boolean isUseableByPlayer(final EntityPlayer p_70300_1_) {
+ return false;
+ }
+
+ @Override
+ public void openInventory() {
+ }
+
+ @Override
+ public void closeInventory() {
+ }
+
+ @Override
+ public boolean isItemValidForSlot(final int p_94041_1_, final ItemStack p_94041_2_) {
+ return false;
+ }
+
+ @Override
+ public void setItemNBT(NBTTagCompound aNBT) {
+ if (CORE.NBT_PERSISTENCY_PATCH_APPLIED) {
+ aNBT.setByte("aCurrentOutputAmperage", aCurrentOutputAmperage);
+ long aEU = this.getBaseMetaTileEntity().getStoredEU();
+ if (aEU > 0){
+ aNBT.setLong("aStoredEU", aEU);
+ if (aNBT.hasKey("aStoredEU")) {
+ Logger.WARNING("Set aStoredEU to NBT.");
+ }
+ }
+ }
+ }
+
+ @Override
+ public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ byte aTest = (byte) (aCurrentOutputAmperage + 1);
+ if (aTest > 16 || aTest <= 0 ) {
+ aTest = 1;
+ }
+ aCurrentOutputAmperage = aTest;
+ PlayerUtils.messagePlayer(aPlayer, "Now handling "+aCurrentOutputAmperage+" Amps.");
+ }
+
+
+
+
+
+
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GregtechMetaSafeBlock.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GregtechMetaSafeBlock.java
new file mode 100644
index 0000000000..63042d4702
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GregtechMetaSafeBlock.java
@@ -0,0 +1,62 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.storage;
+
+import net.minecraft.entity.player.InventoryPlayer;
+
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.objects.GT_RenderedTexture;
+
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.xmod.gregtech.api.gui.CONTAINER_SafeBlock;
+import gtPlusPlus.xmod.gregtech.api.gui.GUI_SafeBlock;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.machines.GregtechMetaSafeBlockBase;
+
+public class GregtechMetaSafeBlock
+extends GregtechMetaSafeBlockBase {
+
+ public GregtechMetaSafeBlock(final int aID, final String aName, final String aNameRegional, final int aTier) {
+ super(aID, aName, aNameRegional, aTier, 28, "Protecting your items from sticky fingers.");
+ }
+
+ public GregtechMetaSafeBlock(final int aID, final String aName, final String aNameRegional, final int aTier, final int aInvSlotCount, final String aDescription) {
+ super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription);
+ }
+
+ public GregtechMetaSafeBlock(final String aName, final int aTier, final int aInvSlotCount, final String aDescription, final ITexture[][][] aTextures) {
+ super(aName, aTier, aInvSlotCount, aDescription, aTextures);
+ }
+
+ @Override
+ public String[] getDescription() {
+ return new String[]{
+ this.mDescription,
+ CORE.GT_Tooltip};
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaSafeBlock(this.mName, this.mTier, this.mInventory.length, this.mDescription, this.mTextures);
+ }
+
+ @Override
+ public ITexture getOverlayIcon() {
+ return new GT_RenderedTexture(Textures.BlockIcons.VOID);
+ }
+
+ @Override
+ public boolean isValidSlot(final int aIndex) {
+ return aIndex < (this.mInventory.length - 1);
+ }
+
+ @Override
+ public Object getServerGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) {
+ return new CONTAINER_SafeBlock(aPlayerInventory, aBaseMetaTileEntity);
+ }
+
+ @Override
+ public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GUI_SafeBlock(aPlayerInventory, aBaseMetaTileEntity);
+ }
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/creative/GT_MetaTileEntity_InfiniteItemHolder.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/creative/GT_MetaTileEntity_InfiniteItemHolder.java
new file mode 100644
index 0000000000..fb37f33055
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/creative/GT_MetaTileEntity_InfiniteItemHolder.java
@@ -0,0 +1,105 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.storage.creative;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.ItemStack;
+
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.MetaTileEntity;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.minecraft.PlayerUtils;
+import gtPlusPlus.core.util.sys.KeyboardUtils;
+import gtPlusPlus.xmod.gregtech.common.tileentities.storage.GT_MetaTileEntity_TieredChest;
+
+public class GT_MetaTileEntity_InfiniteItemHolder extends GT_MetaTileEntity_TieredChest {
+
+ public GT_MetaTileEntity_InfiniteItemHolder(int aID, String aName, String aNameRegional, int aTier) {
+ super(aID, aName, aNameRegional, aTier);
+ }
+
+ public GT_MetaTileEntity_InfiniteItemHolder(String aName, int aTier, String aDescription, ITexture[][][] aTextures) {
+ super(aName, aTier, aDescription, aTextures);
+ }
+
+ @Override
+ public String[] getDescription() {
+ return new String[]{
+ this.mDescription,
+ CORE.GT_Tooltip};
+ }
+
+ @Override
+ public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) {
+ if (aBaseMetaTileEntity.getWorld().isRemote) {
+ return false;
+ }
+
+ if (!KeyboardUtils.isShiftKeyDown()) {
+ if (this.mItemStack == null) {
+ if (aPlayer.getHeldItem() != null) {
+ this.mItemStack = aPlayer.getHeldItem().copy();
+ this.mItemCount = Short.MAX_VALUE;
+ aPlayer.setCurrentItemOrArmor(0, null);
+ PlayerUtils.messagePlayer(aPlayer, "Now holding "+this.mItemStack.getDisplayName()+" x"+Short.MAX_VALUE+".");
+ return true;
+ }
+ }
+ else {
+ if (aPlayer.getHeldItem() == null) {
+ aPlayer.entityDropItem(mItemStack, 1);
+ this.mItemStack = null;
+ this.mItemCount = 0;
+ PlayerUtils.messagePlayer(aPlayer, "Emptying.");
+ return true;
+ }
+ }
+ }
+
+ PlayerUtils.messagePlayer(aPlayer, "Currently holding: "+(this.mItemStack != null ? this.mItemStack.getDisplayName() : "Nothing")+" x"+this.mItemCount);
+ return true;
+ //return super.onRightclick(aBaseMetaTileEntity, aPlayer);
+ }
+
+ @Override
+ public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ return null;
+ }
+
+ @Override
+ public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ return null;
+ }
+
+ @Override
+ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) {
+ if (mItemStack != null) {
+ setItemCount(0);
+ }
+ super.onPostTick(aBaseMetaTileEntity, aTimer);
+ }
+
+ @Override
+ public void setItemCount(int aCount) {
+ super.setItemCount(Short.MAX_VALUE);
+ }
+
+ @Override
+ public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ return true;
+ }
+
+ @Override
+ public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ return false;
+ }
+
+ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT_MetaTileEntity_InfiniteItemHolder(this.mName, this.mTier, this.mDescription, this.mTextures);
+ }
+
+
+
+
+
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/shelving/GT4Entity_Shelf.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/shelving/GT4Entity_Shelf.java
new file mode 100644
index 0000000000..43d5cffe82
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/shelving/GT4Entity_Shelf.java
@@ -0,0 +1,359 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.storage.shelving;
+
+import net.minecraft.entity.item.EntityItem;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+
+import gregtech.api.enums.*;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.MetaTileEntity;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicHull_NonElectric;
+import gregtech.api.objects.GT_ItemStack;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Utility;
+import gregtech.common.items.GT_MetaGenerated_Tool_01;
+
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.math.MathUtils;
+import gtPlusPlus.core.util.minecraft.PlayerUtils;
+import gtPlusPlus.core.util.sys.KeyboardUtils;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.CustomIcon;
+
+public class GT4Entity_Shelf extends GT_MetaTileEntity_BasicHull_NonElectric {
+ public byte mType = 0;
+ public String mOldDesc = "";
+ public boolean mLocked = false;
+ protected byte mIndex = (byte) MathUtils.randInt(1, 3);
+ public static GT_RenderedTexture texBottom = new GT_RenderedTexture(new CustomIcon("TileEntities/gt4/machine_bottom"));
+ public static GT_RenderedTexture texTop = new GT_RenderedTexture(new CustomIcon("TileEntities/gt4/machine_top"));
+ public static GT_RenderedTexture texSide = new GT_RenderedTexture(new CustomIcon("TileEntities/gt4/machine_side"));
+ public static GT_RenderedTexture texSideCabinet = new GT_RenderedTexture(new CustomIcon("TileEntities/gt4/machine_side_cabinet"));
+
+ public GT4Entity_Shelf(final int aID, final String aName, final String aNameRegional, final String aDescription) {
+ super(aID, aName, aNameRegional, 0, aDescription);
+ mOldDesc = aDescription;
+ }
+
+ public GT4Entity_Shelf(final String aName, final String aDescription, final ITexture[][][] aTextures) {
+ super(aName, 0, aDescription, aTextures);
+ mOldDesc = aDescription;
+ }
+
+ @Override
+ public boolean isSimpleMachine() {
+ return true;
+ }
+
+ public int getInvSize() {
+ return 1;
+ }
+
+ @Override
+ public boolean isFacingValid(byte aFacing) {
+ return aFacing > 1;
+ }
+
+ @Override
+ public boolean isAccessAllowed(EntityPlayer aPlayer) {
+ if (this.getBaseMetaTileEntity().getOwnerName().equalsIgnoreCase(aPlayer.getDisplayName())) {
+ return true;
+ }
+ PlayerUtils.messagePlayer(aPlayer, "This container belongs to "+this.getBaseMetaTileEntity().getOwnerName()+".");
+ return false;
+ }
+
+ @Override
+ public boolean ownerControl() {
+ return false;
+ }
+
+ @Override
+ public boolean isEnetOutput() {
+ return false;
+ }
+
+ @Override
+ public boolean isEnetInput() {
+ return false;
+ }
+
+ @Override
+ public boolean isOutputFacing(final byte aSide) {
+ return aSide != this.getBaseMetaTileEntity().getFrontFacing();
+ }
+
+ @Override
+ public boolean isInputFacing(byte aSide) {
+ return false;
+ }
+
+ @Override
+ public boolean onRightclick(IGregTechTileEntity aTile, EntityPlayer aPlayer) {
+ if (aTile.isClientSide()) {
+ return true;
+ }
+ ItemStack tStack = aPlayer.inventory.getStackInSlot(aPlayer.inventory.currentItem);
+ if (tStack == null) {
+ if (KeyboardUtils.isCtrlKeyDown()) {
+ if (this.mInventory[0] != null) {
+ PlayerUtils.messagePlayer(aPlayer, "Contains "+this.mInventory[0].getDisplayName()+" x"+this.mInventory[0].stackSize+".");
+ }
+ return false;
+ }
+ else {
+ if ((this.mInventory[0] != null) && (this.mInventory[0].stackSize > 0)) {
+ if (!this.mLocked) {
+ PlayerUtils.messagePlayer(aPlayer, "Removed "+this.mInventory[0].getDisplayName()+" x"+this.mInventory[0].stackSize+".");
+ aPlayer.inventory.setInventorySlotContents(aPlayer.inventory.currentItem, this.mInventory[0]);
+ getBaseMetaTileEntity().setInventorySlotContents(0, null);
+ this.mType = 0;
+ return true;
+ }
+ else {
+ PlayerUtils.messagePlayer(aPlayer, "This container is locked. It belongs to "+aTile.getOwnerName()+".");
+ return false;
+ }
+ }
+ return false;
+ }
+ }
+ else if (tStack != null && this.mInventory[0] == null) {
+
+ if (KeyboardUtils.isCtrlKeyDown() || GT_MetaGenerated_Tool_01.class.isInstance(tStack.getItem())) {
+ return false;
+ }
+ PlayerUtils.messagePlayer(aPlayer, "Stored "+tStack.getDisplayName()+" x"+tStack.stackSize+".");
+ aPlayer.inventory.setInventorySlotContents(aPlayer.inventory.currentItem, null);
+ getBaseMetaTileEntity().setInventorySlotContents(0, tStack);
+ this.mType = (byte) MathUtils.randInt(1, 3);
+ return true;
+ }
+ else {
+ if (this.mInventory[0] == null) {
+ this.mType = 0;
+ }
+ return super.onRightclick(aTile, aPlayer);
+ }
+ }
+
+ @Override
+ public void onLeftclick(IGregTechTileEntity aTile,EntityPlayer aPlayer) {
+ if ((this.mInventory[0] != null) && (this.mInventory[0].stackSize > 0)) {
+ ItemStack tOutput = GT_Utility.copy(new Object[] { this.mInventory[0] });
+ if (!aPlayer.isSneaking()) {
+ tOutput.stackSize = 1;
+ }
+ getBaseMetaTileEntity().decrStackSize(0, tOutput.stackSize);
+ EntityItem tEntity = new EntityItem(getBaseMetaTileEntity().getWorld(),
+ getBaseMetaTileEntity().getOffsetX(getBaseMetaTileEntity().getFrontFacing(), 1) + 0.5D,
+ getBaseMetaTileEntity().getOffsetY(getBaseMetaTileEntity().getFrontFacing(), 1) + 0.5D,
+ getBaseMetaTileEntity().getOffsetZ(getBaseMetaTileEntity().getFrontFacing(), 1) + 0.5D, tOutput);
+ tEntity.motionX = 0.0D;
+ tEntity.motionY = 0.0D;
+ tEntity.motionZ = 0.0D;
+ getBaseMetaTileEntity().getWorld().spawnEntityInWorld(tEntity);
+ if (this.mInventory[0] == null) {
+ this.mType = 0;
+ }
+ }
+ super.onLeftclick(aTile, aPlayer);
+ }
+
+ @Override
+ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT4Entity_Shelf(this.mName, this.mDescription, this.mTextures);
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {//mLocked
+ aNBT.setInteger("mType", this.mType);
+ aNBT.setBoolean("mLocked", this.mLocked);
+ aNBT.setByte("mIndex", this.mIndex);
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ if (aNBT.hasKey("mIndex")) {
+ this.mType = ((byte) aNBT.getInteger("mType"));
+ }
+ if (aNBT.hasKey("mIndex")) {
+ this.mLocked = (aNBT.getBoolean("mLocked"));
+ }
+ if (aNBT.hasKey("mIndex")) {
+ this.mIndex = aNBT.getByte("mIndex");
+ }
+ }
+
+ @Override
+ public void onValueUpdate(byte aValue) {
+ this.mType = aValue;
+ }
+
+ @Override
+ public byte getUpdateData() {
+ return this.mType;
+ }
+
+ @Override
+ public String[] getDescription() {
+ return new String[] {
+ mOldDesc,
+ "Decorative Item Storage",
+ "Right click to store/remove something",
+ "Ctrl + Rmb to check contents",
+ "Ctrl + Rmb with a screwdriver to lock",
+ };
+ }
+
+ @Override
+ public byte getTileEntityBaseType() {
+ return 0;
+ }
+
+ @Override
+ public boolean allowCoverOnSide(byte aSide, GT_ItemStack aStack) {
+ //return aSide != getBaseMetaTileEntity().getFrontFacing();
+ return false;
+ }
+
+ @Override
+ public boolean allowPullStack(IGregTechTileEntity p0, int p1, byte p2, ItemStack p3) {
+ return true;
+ }
+
+ @Override
+ public boolean allowPutStack(IGregTechTileEntity p0, int p1, byte p2, ItemStack p3) {
+ return false;
+ }
+
+ @Override
+ public ITexture[][][] getTextureSet(ITexture[] aTextures) {
+ ITexture[][][] rTextures = new ITexture[7][17][];
+ for (byte i = -1; i < 16; i = (byte) (i + 1)) {
+ ITexture[] tmp0 = {this.getBottom((byte) 0)[0]};
+ rTextures[0][(i + 1)] = tmp0;
+ ITexture[] tmp1 = { this.getTop((byte) 0)[0]};
+ rTextures[1][(i + 1)] = tmp1;
+ ITexture[] tmp2 = { this.getSides((byte) 0)[0]};
+ rTextures[2][(i + 1)] = tmp2;
+ ITexture[] tmp4 = {this.getSides((byte) 0)[0]};
+ rTextures[3][(i + 1)] = tmp4;
+ ITexture[] tmp5 = {this.getSides((byte) 0)[0], getFront((byte) 0)[0]};
+ rTextures[4][(i + 1)] = tmp5;
+ ITexture[] tmp6 = {this.getSides((byte) 0)[0], getFront((byte) 1)[0]};
+ rTextures[5][(i + 1)] = tmp6;
+ ITexture[] tmp7 = {this.getSides((byte) 0)[0], getFront((byte) 2)[0]};
+ rTextures[6][(i + 1)] = tmp7;
+ }
+ return rTextures;
+ }
+
+ @Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity,
+ final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive,
+ final boolean aRedstone) {
+
+ ITexture[] tmp = this.mTextures[(aSide >= 2) ? ((aSide != aFacing) ? 2 : ((byte) this.mType == 0 ? 4 : this.mType == 1 || this.mType == 2 ? 5 : this.mType == 3 ? 6 : 0)) : aSide][aColorIndex + 1];
+ if (aSide != aFacing && tmp.length == 2) {
+ tmp = new ITexture[]{tmp[0]};
+ }
+ return tmp;
+ }
+
+ private static GT_RenderedTexture x1 = new GT_RenderedTexture(TexturesGtBlock.OVERLAY_WOODEN_SHELF_FRONT);
+ private static GT_RenderedTexture x2 = new GT_RenderedTexture(TexturesGtBlock.OVERLAY_WOODEN_SHELF_PAPER_FRONT);
+ private static GT_RenderedTexture x3 = new GT_RenderedTexture(TexturesGtBlock.OVERLAY_WOODEN_SHELF_CANS_FRONT);
+
+ public ITexture[] getFrontNormal() {
+ return new ITexture[]{x1};
+ }
+ public ITexture[] getFrontActive() {
+ return new ITexture[]{x2};
+ }
+ public ITexture[] getFrontAlternative() {
+ return new ITexture[]{x3};
+ }
+
+ public ITexture[] getBack(final byte aColor) {
+ return new ITexture[]{ new GT_RenderedTexture(TexturesGtBlock.VanillaIcon_OakPlanks)};
+ }
+
+ public ITexture[] getBottom(final byte aColor) {
+ return new ITexture[]{ new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Acacia_Log)};
+ }
+
+ public ITexture[] getTop(final byte aColor) {
+ return new ITexture[]{ new GT_RenderedTexture(TexturesGtBlock.VanillaIcon_OakPlanks)};
+ }
+
+ public ITexture[] getSides(final byte aColor) {
+ return new ITexture[]{ new GT_RenderedTexture(TexturesGtBlock.VanillaIcon_OakPlanks)};
+ }
+
+ public ITexture[] getFrontActive(final byte aColor) {
+ return this.getFrontNormal();
+ }
+
+ public ITexture[] getBackActive(final byte aColor) {
+ return this.getBack(aColor);
+ }
+
+ public ITexture[] getBottomActive(final byte aColor) {
+ return this.getBottom(aColor);
+ }
+
+ public ITexture[] getTopActive(final byte aColor) {
+ return this.getTop(aColor);
+ }
+
+ public ITexture[] getSidesActive(final byte aColor) {
+ return this.getSides(aColor);
+ }
+
+ @Override
+ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ super.onPostTick(aBaseMetaTileEntity, aTick);
+ }
+
+ public ITexture[] getFront(byte aColour) {
+ if (aColour == 1) {
+ return getFrontActive();
+ }
+ else if (aColour == 2) {
+ return getFrontAlternative();
+ }
+ return getFrontNormal();
+ }
+
+ @Override
+ public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ if (KeyboardUtils.isCtrlKeyDown()) {
+ if (!aPlayer.getDisplayName().equalsIgnoreCase(this.getBaseMetaTileEntity().getOwnerName())) {
+ PlayerUtils.messagePlayer(aPlayer, "Container is not yours to lock.");
+ }
+ else {
+ this.mLocked = Utils.invertBoolean(this.mLocked);
+ if (this.mLocked) {
+ PlayerUtils.messagePlayer(aPlayer, "Container is now locked.");
+ }
+ else {
+ PlayerUtils.messagePlayer(aPlayer, "Container is now unlocked.");
+ }
+ }
+ }
+ else {
+ super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ);
+ }
+ }
+
+ @Override
+ public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ super.onPreTick(aBaseMetaTileEntity, aTick);
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/shelving/GT4Entity_Shelf_Compartment.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/shelving/GT4Entity_Shelf_Compartment.java
new file mode 100644
index 0000000000..7dcb76a22e
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/shelving/GT4Entity_Shelf_Compartment.java
@@ -0,0 +1,39 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.storage.shelving;
+
+import net.minecraft.entity.player.EntityPlayer;
+
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.MetaTileEntity;
+import gtPlusPlus.core.util.minecraft.PlayerUtils;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+
+public class GT4Entity_Shelf_Compartment extends GT4Entity_Shelf {
+
+
+ public GT4Entity_Shelf_Compartment(final int aID, final String aName, final String aNameRegional, final String aDescription) {
+ super(aID, aName, aNameRegional, aDescription);
+ }
+
+ public GT4Entity_Shelf_Compartment(String mName, String mDescriptionArray, ITexture[][][] mTextures) {
+ super(mName, mDescriptionArray, mTextures);
+ }
+
+ @Override
+ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT4Entity_Shelf_Compartment(this.mName, this.mDescription, this.mTextures);
+ }
+
+ @Override
+ public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ if (aSide == getBaseMetaTileEntity().getFrontFacing()) {
+ this.mType = ((byte) ((this.mType + 1) % 16));
+ PlayerUtils.messagePlayer(aPlayer, "Set type to "+this.mType+".");
+ }
+ }
+
+ @Override
+ public ITexture[] getFront(final byte aColor) {
+ return new ITexture[]{TexturesGtBlock.OVERLAYS_COMPARTMENT_FRONT[this.mType < 16 ? this.mType : 0]};
+ }
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/shelving/GT4Entity_Shelf_Desk.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/shelving/GT4Entity_Shelf_Desk.java
new file mode 100644
index 0000000000..2c7186a3ce
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/shelving/GT4Entity_Shelf_Desk.java
@@ -0,0 +1,45 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.storage.shelving;
+
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.MetaTileEntity;
+import gregtech.api.objects.GT_RenderedTexture;
+
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+
+public class GT4Entity_Shelf_Desk extends GT4Entity_Shelf {
+
+ public GT4Entity_Shelf_Desk(final int aID, final String aName, final String aNameRegional, final String aDescription) {
+ super(aID, aName, aNameRegional, aDescription);
+ }
+
+ public GT4Entity_Shelf_Desk(String mName, String mDescriptionArray, ITexture[][][] mTextures) {
+ super(mName, mDescriptionArray, mTextures);
+ }
+
+ @Override
+ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT4Entity_Shelf_Desk(this.mName, this.mDescription, this.mTextures);
+ }
+
+ @Override
+ public ITexture[] getFront(final byte aColor) {
+ return new ITexture[]{TexturesGtBlock.OVERLAYS_CABINET_FRONT[this.mType < 16 ? this.mType : 0]};
+ }
+
+ public ITexture[] getBack(final byte aColor) {
+ return new ITexture[]{new GT_RenderedTexture(TexturesGtBlock.VanillaIcon_OakPlanks)};
+ }
+
+ public ITexture[] getBottom(final byte aColor) {
+ return new ITexture[]{new GT_RenderedTexture(TexturesGtBlock.VanillaIcon_OakPlanks)};
+ }
+
+ public ITexture[] getTop(final byte aColor) {
+ return new ITexture[]{new GT_RenderedTexture(TexturesGtBlock.VanillaIcon_OakPlanks)};
+ }
+
+ public ITexture[] getSides(final byte aColor) {
+ return new ITexture[]{new GT_RenderedTexture(TexturesGtBlock.VanillaIcon_OakPlanks)};
+ }
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/shelving/GT4Entity_Shelf_FileCabinet.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/shelving/GT4Entity_Shelf_FileCabinet.java
new file mode 100644
index 0000000000..93bb7d5bb9
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/shelving/GT4Entity_Shelf_FileCabinet.java
@@ -0,0 +1,55 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.storage.shelving;
+
+import net.minecraft.entity.player.EntityPlayer;
+
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.MetaTileEntity;
+
+import gtPlusPlus.core.util.minecraft.PlayerUtils;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+
+public class GT4Entity_Shelf_FileCabinet extends GT4Entity_Shelf {
+
+ public GT4Entity_Shelf_FileCabinet(final int aID, final String aName, final String aNameRegional, final String aDescription) {
+ super(aID, aName, aNameRegional, aDescription);
+ }
+
+ public GT4Entity_Shelf_FileCabinet(String mName, String mDescriptionArray, ITexture[][][] mTextures) {
+ super(mName, mDescriptionArray, mTextures);
+ }
+
+ @Override
+ public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ if (aSide == getBaseMetaTileEntity().getFrontFacing()) {
+ this.mType = ((byte) ((this.mType + 1) % 16));
+ PlayerUtils.messagePlayer(aPlayer, "Set type to "+this.mType+".");
+ }
+ }
+
+ @Override
+ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT4Entity_Shelf_FileCabinet(this.mName, this.mDescription, this.mTextures);
+ }
+
+ @Override
+ public ITexture[] getFront(final byte aColor) {
+ return new ITexture[]{TexturesGtBlock.OVERLAYS_CABINET_FRONT[this.mType < 16 ? this.mType : 0]};
+ }
+
+ public ITexture[] getBack(final byte aColor) {
+ return new ITexture[]{texSide};
+ }
+
+ public ITexture[] getBottom(final byte aColor) {
+ return new ITexture[]{texBottom};
+ }
+
+ public ITexture[] getTop(final byte aColor) {
+ return new ITexture[]{texTop};
+ }
+
+ public ITexture[] getSides(final byte aColor) {
+ return new ITexture[]{texSide};
+ }
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/shelving/GT4Entity_Shelf_Iron.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/shelving/GT4Entity_Shelf_Iron.java
new file mode 100644
index 0000000000..606496501f
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/shelving/GT4Entity_Shelf_Iron.java
@@ -0,0 +1,41 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.storage.shelving;
+
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.MetaTileEntity;
+
+public class GT4Entity_Shelf_Iron extends GT4Entity_Shelf {
+
+ public GT4Entity_Shelf_Iron(final int aID, final String aName, final String aNameRegional, final String aDescription) {
+ super(aID, aName, aNameRegional, aDescription);
+ }
+
+ public GT4Entity_Shelf_Iron(String mName, String mDescriptionArray, ITexture[][][] mTextures) {
+ super(mName, mDescriptionArray, mTextures);
+ }
+
+ @Override
+ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT4Entity_Shelf_Iron(this.mName, this.mDescription, this.mTextures);
+ }
+
+ public ITexture[] getFront(final byte aColor) {
+ return new ITexture[]{texSideCabinet};
+ }
+
+ public ITexture[] getBack(final byte aColor) {
+ return new ITexture[]{texSide};
+ }
+
+ public ITexture[] getBottom(final byte aColor) {
+ return new ITexture[]{texBottom};
+ }
+
+ public ITexture[] getTop(final byte aColor) {
+ return new ITexture[]{texTop};
+ }
+
+ public ITexture[] getSides(final byte aColor) {
+ return new ITexture[]{texSide};
+ }
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/shelving/GT4Entity_Shelf_Large.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/shelving/GT4Entity_Shelf_Large.java
new file mode 100644
index 0000000000..cc17f49d83
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/shelving/GT4Entity_Shelf_Large.java
@@ -0,0 +1,266 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.storage.shelving;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTBase;
+import net.minecraft.nbt.NBTTagCompound;
+
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.MetaTileEntity;
+import gregtech.api.util.GT_Utility;
+
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.util.minecraft.PlayerUtils;
+import gtPlusPlus.core.util.sys.KeyboardUtils;
+import gtPlusPlus.xmod.gregtech.api.gui.CONTAINER_SuperChest;
+import gtPlusPlus.xmod.gregtech.api.gui.GUI_SuperChest;
+
+public class GT4Entity_Shelf_Large extends GT4Entity_Shelf {
+
+ private final int mSize;
+ public int mItemCount;
+ public ItemStack mItemStack;
+
+
+ public GT4Entity_Shelf_Large(final int aID, final String aName, final String aNameRegional, final String aDescription, final int aSize) {
+ super(aID, aName, aNameRegional, aDescription);
+ this.mSize = aSize;
+ this.mItemCount = 0;
+ this.mItemStack = null;
+ }
+
+ public GT4Entity_Shelf_Large(String mName, String mDescriptionArray, final int aSize, ITexture[][][] mTextures) {
+ super(mName, mDescriptionArray, mTextures);
+ this.mSize = aSize;
+ this.mItemCount = 0;
+ this.mItemStack = null;
+ }
+
+ @Override
+ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT4Entity_Shelf_Large(this.mName, this.mDescription, mSize, this.mTextures);
+ }
+
+ /*@Override
+ public int getInvSize() {
+ return (mSize > 0 && mSize < 255 ? mSize : 255);
+ }*/
+
+ @Override
+ public boolean isGivingInformation() {
+ return true;
+ }
+
+ @Override
+ public boolean isDigitalChest() {
+ return true;
+ }
+
+ @Override
+ public boolean isValidSlot(final int aIndex) {
+ return true;
+ }
+
+ @Override
+ public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) {
+ if (aBaseMetaTileEntity.isClientSide()) {
+ return true;
+ }
+ if (KeyboardUtils.isCtrlKeyDown()) {
+ String itemName = (this.mItemStack != null ? this.mItemStack.getDisplayName() : "Nothing.");
+ String itemAmount = (this.mItemCount > 0 ? ""+this.mItemCount : "bad");
+ String itemMessage = "This container currently holds "+(itemAmount.equalsIgnoreCase("bad") ? "nothing." : itemName+" x"+itemAmount+".");
+ PlayerUtils.messagePlayer(aPlayer, itemMessage);
+ }
+ else {
+ aBaseMetaTileEntity.openGUI(aPlayer);
+ }
+ return true;
+ }
+
+ public Object getServerGUI(final int aID, final InventoryPlayer aPlayerInventory,
+ final IGregTechTileEntity aBaseMetaTileEntity) {
+ return new CONTAINER_SuperChest(aPlayerInventory, aBaseMetaTileEntity);
+ }
+
+ public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory,
+ final IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GUI_SuperChest(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName());
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ aNBT.setInteger("mItemCount", this.mItemCount);
+ if (this.mItemStack != null) {
+ aNBT.setTag("mItemStack", (NBTBase) this.mItemStack.writeToNBT(new NBTTagCompound()));
+ }
+ super.saveNBTData(aNBT);
+
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ if (aNBT.hasKey("mItemCount")) {
+ this.mItemCount = aNBT.getInteger("mItemCount");
+ }
+ if (aNBT.hasKey("mItemStack")) {
+ this.mItemStack = ItemStack.loadItemStackFromNBT((NBTTagCompound) aNBT.getTag("mItemStack"));
+ }
+ super.loadNBTData(aNBT);
+ }
+
+ @Override
+ public void onOpenGUI() {
+ super.onOpenGUI();
+ }
+
+ public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTimer) {
+ if (this.getBaseMetaTileEntity().isServerSide() && this.getBaseMetaTileEntity().isAllowedToWork()) {
+ try {
+ if (this.mInventory[0] != null) {
+ this.mType = (byte) this.mIndex;
+ }
+ else {
+ this.mType = 0;
+ }
+
+ if (this.getItemCount() <= 0) {
+ this.mItemStack = null;
+ this.mItemCount = 0;
+ }
+ if (this.mItemStack == null && this.mInventory[0] != null) {
+ this.mItemStack = this.mInventory[0].copy();
+ }
+ if (this.mInventory[0] != null && this.mItemCount < this.getMaxItemCount()
+ && GT_Utility.areStacksEqual(this.mInventory[0], this.mItemStack)) {
+ this.mItemCount += this.mInventory[0].stackSize;
+ if (this.mItemCount > this.getMaxItemCount()) {
+ this.mInventory[0].stackSize = this.mItemCount - this.getMaxItemCount();
+ this.mItemCount = this.getMaxItemCount();
+ } else {
+ this.mInventory[0] = null;
+ }
+ }
+ if (this.mInventory[1] == null && this.mItemStack != null) {
+ this.mInventory[1] = this.mItemStack.copy();
+ this.mInventory[1].stackSize = Math.min(this.mItemStack.getMaxStackSize(), this.mItemCount);
+ this.mItemCount -= this.mInventory[1].stackSize;
+ } else if (this.mItemCount > 0 && GT_Utility.areStacksEqual(this.mInventory[1], this.mItemStack)
+ && this.mInventory[1].getMaxStackSize() > this.mInventory[1].stackSize) {
+ final int tmp = Math.min(this.mItemCount,
+ this.mInventory[1].getMaxStackSize() - this.mInventory[1].stackSize);
+ final ItemStack itemStack = this.mInventory[1];
+ itemStack.stackSize += tmp;
+ this.mItemCount -= tmp;
+ }
+ if (this.mItemStack != null) {
+ this.mInventory[2] = this.mItemStack.copy();
+ this.mInventory[2].stackSize = Math.min(this.mItemStack.getMaxStackSize(), this.mItemCount);
+ } else {
+ this.mInventory[2] = null;
+ }
+ }
+ catch (Throwable t) {
+ if (t instanceof ArrayIndexOutOfBoundsException) {
+
+ }
+ }
+ }
+ }
+
+ private int getItemCount() {
+ return this.mItemCount;
+ }
+
+ public void setItemCount(final int aCount) {
+ this.mItemCount = aCount;
+ }
+
+ public int getProgresstime() {
+ try {
+ return this.mItemCount + ((this.mInventory[0] == null) ? 0 : this.mInventory[0].stackSize)
+ + ((this.mInventory[1] == null) ? 0 : this.mInventory[1].stackSize);
+ }
+ catch (Throwable t) {
+ return 0;
+ }
+ }
+
+ public int maxProgresstime() {
+ return this.getMaxItemCount();
+ }
+
+ public int getMaxItemCount() {
+ return this.mSize;
+ }
+
+ public boolean allowPullStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide,
+ final ItemStack aStack) {
+ return aIndex == 1;
+ }
+
+ public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide,
+ final ItemStack aStack) {
+ return aIndex == 0 && ((this.mInventory[0] == null && this.mItemStack == null) || GT_Utility.areStacksEqual(this.mInventory[0], aStack) || (this.mItemStack != null && GT_Utility.areStacksEqual(this.mItemStack, aStack)));
+ }
+
+ public String[] getInfoData() {
+ if (this.mItemStack == null) {
+ return new String[]{
+ this.getLocalName(), "No Items Stored", "Free Space: "+Integer.toString(this.getMaxItemCount())};
+ }
+ return new String[]{
+ this.getLocalName(),
+ "Storing: "+this.mItemStack.getDisplayName()+" x"+Integer.toString(this.mItemCount),
+ "Space Remaining: "+Integer.toString(this.getMaxItemCount()-this.getItemCount())+"/"+Integer.toString(this.getMaxItemCount())};
+ }
+
+ @Override
+ public String[] getDescription() {
+ String[] mSuper = super.getDescription();
+ String[] desc = new String[mSuper.length+1];
+ for (int i=0;i>mSuper.length;i++) {
+ desc[i] = mSuper[i];
+ }
+ desc[desc.length-1] = "Control + Rmb block to check contents";
+ return desc;
+ }
+
+ @Override
+ public boolean isItemValidForSlot(int aIndex, ItemStack aStack) {
+ Logger.INFO("1:"+aIndex);
+ if (aIndex == 2) {
+ if (ItemStack.areItemStacksEqual(aStack, mItemStack)) {
+ return true;
+ }
+ else {
+ if (mItemStack == null) {
+ return true;
+ }
+ return false;
+ }
+ }
+ return super.isItemValidForSlot(aIndex, aStack);
+ }
+
+ @Override
+ public boolean canInsertItem(int aIndex, ItemStack aStack, int aSide) {
+ Logger.INFO("2:"+aIndex);
+ if (aIndex == 0) {
+ if (ItemStack.areItemStacksEqual(aStack, mItemStack)) {
+ return true;
+ }
+ else {
+ if (mItemStack == null) {
+ return true;
+ }
+ return false;
+ }
+ }
+ return super.canInsertItem(aIndex, aStack, aSide);
+ }
+
+
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_AngleGrinder.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_AngleGrinder.java
new file mode 100644
index 0000000000..27f118e363
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_AngleGrinder.java
@@ -0,0 +1,199 @@
+package gtPlusPlus.xmod.gregtech.common.tools;
+
+import java.util.Arrays;
+import java.util.List;
+
+import gregtech.GT_Mod;
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.Materials;
+import gregtech.api.enums.OrePrefixes;
+import gregtech.api.enums.Textures.ItemIcons;
+import gregtech.api.interfaces.IIconContainer;
+import gregtech.api.items.GT_MetaGenerated_Tool;
+import gregtech.common.items.behaviors.Behaviour_None;
+import gregtech.common.tools.GT_Tool;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtTools;
+import gtPlusPlus.xmod.gregtech.common.items.behaviours.Behaviour_Choocher;
+import net.minecraft.block.Block;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.monster.EntityIronGolem;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.stats.AchievementList;
+import net.minecraft.util.ChatComponentText;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.IChatComponent;
+import net.minecraftforge.event.world.BlockEvent;
+
+public class TOOL_Gregtech_AngleGrinder
+extends GT_Tool {
+
+ public static final List<String> mEffectiveList = Arrays.asList(new String[]{EntityIronGolem.class.getName(), "EntityTowerGuardian"});
+
+
+ @Override
+ public float getNormalDamageAgainstEntity(final float aOriginalDamage, final Entity aEntity, final ItemStack aStack, final EntityPlayer aPlayer) {
+ String tName = aEntity.getClass().getName();
+ tName = tName.substring(tName.lastIndexOf(".") + 1);
+ return (mEffectiveList.contains(tName)) || (tName.contains("Golem")) ? aOriginalDamage * 2.0F : aOriginalDamage;
+ }
+
+ @Override
+ public int getToolDamagePerBlockBreak() {
+ return 50;
+ }
+
+ @Override
+ public int getToolDamagePerDropConversion() {
+ return 100;
+ }
+
+ @Override
+ public int getToolDamagePerContainerCraft() {
+ return 400;
+ }
+
+ @Override
+ public int getToolDamagePerEntityAttack() {
+ return 100;
+ }
+
+ @Override
+ public int getBaseQuality() {
+ return 0;
+ }
+
+ @Override
+ public float getBaseDamage() {
+ return 8.0F;
+ }
+
+ @Override
+ public float getSpeedMultiplier() {
+ return 2F;
+ }
+
+ @Override
+ public float getMaxDurabilityMultiplier() {
+ return 1.8F;
+ }
+
+ @Override
+ public String getCraftingSound() {
+ return GregTech_API.sSoundList.get(Integer.valueOf(1));
+ }
+
+ @Override
+ public String getEntityHitSound() {
+ return GregTech_API.sSoundList.get(Integer.valueOf(2));
+ }
+
+ @Override
+ public String getBreakingSound() {
+ return GregTech_API.sSoundList.get(Integer.valueOf(0));
+ }
+
+ @Override
+ public String getMiningSound() {
+ return null;
+ }
+
+ @Override
+ public boolean canBlock() {
+ return false;
+ }
+
+ public boolean isWrench(){
+ return false;
+ }
+
+ @Override
+ public boolean isCrowbar() {
+ return false;
+ }
+
+ @Override
+ public boolean isWeapon() {
+ return true;
+ }
+
+ @Override
+ public boolean isMinableBlock(final Block aBlock, final byte aMetaData) {
+ final String tTool = aBlock.getHarvestTool(aMetaData);
+ return (tTool != null) && (tTool.equals("sword") || tTool.equals("file"));
+ }
+
+
+ @Override
+ public int convertBlockDrops(final List<ItemStack> aDrops, final ItemStack aStack, final EntityPlayer aPlayer, final Block aBlock, final int aX, final int aY, final int aZ, final byte aMetaData, final int aFortune, final boolean aSilkTouch, final BlockEvent.HarvestDropsEvent aEvent) {
+ int rConversions = 0;
+ /*GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sHammerRecipes.findRecipe(null, true, 2147483647L, null, new ItemStack[]{new ItemStack(aBlock, 1, aMetaData)});
+ if ((tRecipe == null) || (aBlock.hasTileEntity(aMetaData))) {
+ for (final ItemStack tDrop : aDrops) {
+ tRecipe = GT_Recipe.GT_Recipe_Map.sHammerRecipes.findRecipe(null, true, 2147483647L, null, new ItemStack[]{GT_Utility.copyAmount(1L, new Object[]{tDrop})});
+ if (tRecipe != null) {
+ final ItemStack tHammeringOutput = tRecipe.getOutput(0);
+ if (tHammeringOutput != null) {
+ rConversions += tDrop.stackSize;
+ tDrop.stackSize *= tHammeringOutput.stackSize;
+ tHammeringOutput.stackSize = tDrop.stackSize;
+ GT_Utility.setStack(tDrop, tHammeringOutput);
+ }
+ }
+ }
+ } else {
+ aDrops.clear();
+ aDrops.add(tRecipe.getOutput(0));
+ rConversions++;
+ }*/
+ return rConversions;
+ }
+
+ @Override
+ public ItemStack getBrokenItem(final ItemStack aStack) {
+ return null;
+ }
+
+ public IIconContainer getIcon(boolean aIsToolHead, ItemStack aStack) {
+ return (IIconContainer) (aIsToolHead
+ ? TexturesGtTools.ANGLE_GRINDER
+ : ItemIcons.POWER_UNIT_HV);
+ }
+
+ public short[] getRGBa(boolean aIsToolHead, ItemStack aStack) {
+ return aIsToolHead
+ ? GT_MetaGenerated_Tool.getPrimaryMaterial(aStack).mRGBa
+ : Materials.TungstenSteel.mRGBa;
+ }
+
+
+
+
+ @Override
+ public void onToolCrafted(final ItemStack aStack, final EntityPlayer aPlayer) {
+ super.onToolCrafted(aStack, aPlayer);
+ aPlayer.triggerAchievement(AchievementList.buildSword);
+ try {
+ GT_Mod.achievements.issueAchievement(aPlayer, "tools");
+ GT_Mod.achievements.issueAchievement(aPlayer, "unitool");
+ } catch (final Exception e) {
+ }
+ }
+
+ @Override
+ public IChatComponent getDeathMessage(final EntityLivingBase aPlayer, final EntityLivingBase aEntity) {
+ return new ChatComponentText(EnumChatFormatting.RED + aEntity.getCommandSenderName() + EnumChatFormatting.WHITE + " has been Ground out of existence by " + EnumChatFormatting.GREEN + aPlayer.getCommandSenderName() + EnumChatFormatting.WHITE);
+ }
+
+ @Override
+ public void onStatsAddedToTool(final GT_MetaGenerated_Tool aItem, final int aID) {
+ aItem.addItemBehavior(aID, new Behaviour_None());
+ }
+
+ @Override
+ public boolean isGrafter() {
+ return false;
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_Base.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_Base.java
new file mode 100644
index 0000000000..97f9a43187
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_Base.java
@@ -0,0 +1,180 @@
+package gtPlusPlus.xmod.gregtech.common.tools;
+
+import java.util.List;
+
+import net.minecraft.block.Block;
+import net.minecraft.enchantment.Enchantment;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.stats.AchievementList;
+import net.minecraft.util.DamageSource;
+import net.minecraft.util.EntityDamageSource;
+import net.minecraft.util.IChatComponent;
+
+import gregtech.api.GregTech_API;
+import gregtech.api.damagesources.GT_DamageSources;
+
+import gtPlusPlus.xmod.gregtech.api.interfaces.internal.Interface_ToolStats;
+import gtPlusPlus.xmod.gregtech.api.items.Gregtech_MetaTool;
+import net.minecraftforge.event.world.BlockEvent;
+
+public abstract class TOOL_Gregtech_Base
+implements Interface_ToolStats {
+ public static final Enchantment[] FORTUNE_ENCHANTMENT = {Enchantment.fortune};
+ public static final Enchantment[] LOOTING_ENCHANTMENT = {Enchantment.looting};
+ public static final Enchantment[] ZERO_ENCHANTMENTS = new Enchantment[0];
+ public static final int[] ZERO_ENCHANTMENT_LEVELS = new int[0];
+
+ @Override
+ public int getToolDamagePerBlockBreak() {
+ return 100;
+ }
+
+ @Override
+ public int getToolDamagePerDropConversion() {
+ return 100;
+ }
+
+ @Override
+ public int getToolDamagePerContainerCraft() {
+ return 800;
+ }
+
+ @Override
+ public int getToolDamagePerEntityAttack() {
+ return 200;
+ }
+
+ @Override
+ public float getSpeedMultiplier() {
+ return 1.0F;
+ }
+
+ @Override
+ public float getMaxDurabilityMultiplier() {
+ return 1.0F;
+ }
+
+ @Override
+ public int getHurtResistanceTime(final int aOriginalHurtResistance, final Entity aEntity) {
+ return aOriginalHurtResistance;
+ }
+
+ @Override
+ public String getMiningSound() {
+ return null;
+ }
+
+ @Override
+ public String getCraftingSound() {
+ return null;
+ }
+
+ @Override
+ public String getEntityHitSound() {
+ return null;
+ }
+
+ @Override
+ public String getBreakingSound() {
+ return GregTech_API.sSoundList.get(Integer.valueOf(0));
+ }
+
+ @Override
+ public int getBaseQuality() {
+ return 0;
+ }
+
+ @Override
+ public boolean canBlock() {
+ return false;
+ }
+
+ @Override
+ public boolean isCrowbar() {
+ return false;
+ }
+
+ @Override
+ public boolean isWrench() {
+ return false;
+ }
+
+ @Override
+ public boolean isWeapon() {
+ return false;
+ }
+
+ @Override
+ public boolean isRangedWeapon() {
+ return false;
+ }
+
+ @Override
+ public boolean isMiningTool() {
+ return true;
+ }
+
+ public boolean isChainsaw(){
+ return false;
+ }
+
+
+ @Override
+ public boolean isGrafter(){
+ return false;
+ }
+
+
+ @Override
+ public DamageSource getDamageSource(final EntityLivingBase aPlayer, final Entity aEntity) {
+ return GT_DamageSources.getCombatDamage((aPlayer instanceof EntityPlayer) ? "player" : "mob", aPlayer, (aEntity instanceof EntityLivingBase) ? this.getDeathMessage(aPlayer, (EntityLivingBase) aEntity) : null);
+ }
+
+ public IChatComponent getDeathMessage(final EntityLivingBase aPlayer, final EntityLivingBase aEntity) {
+ return new EntityDamageSource((aPlayer instanceof EntityPlayer) ? "player" : "mob", aPlayer).func_151519_b(aEntity);
+ }
+
+ @Override
+ public int convertBlockDrops(final List<ItemStack> aDrops, final ItemStack aStack, final EntityPlayer aPlayer, final Block aBlock, final int aX, final int aY, final int aZ, final byte aMetaData, final int aFortune, final boolean aSilkTouch, final BlockEvent.HarvestDropsEvent aEvent) {
+ return 0;
+ }
+
+ @Override
+ public ItemStack getBrokenItem(final ItemStack aStack) {
+ return null;
+ }
+
+ @Override
+ public Enchantment[] getEnchantments(final ItemStack aStack) {
+ return ZERO_ENCHANTMENTS;
+ }
+
+ @Override
+ public int[] getEnchantmentLevels(final ItemStack aStack) {
+ return ZERO_ENCHANTMENT_LEVELS;
+ }
+
+ @Override
+ public void onToolCrafted(final ItemStack aStack, final EntityPlayer aPlayer) {
+ aPlayer.triggerAchievement(AchievementList.openInventory);
+ aPlayer.triggerAchievement(AchievementList.mineWood);
+ aPlayer.triggerAchievement(AchievementList.buildWorkBench);
+ }
+
+ @Override
+ public void onStatsAddedToTool(final Gregtech_MetaTool aItem, final int aID) {
+ }
+
+ @Override
+ public float getNormalDamageAgainstEntity(final float aOriginalDamage, final Entity aEntity, final ItemStack aStack, final EntityPlayer aPlayer) {
+ return aOriginalDamage;
+ }
+
+ @Override
+ public float getMagicDamageAgainstEntity(final float aOriginalDamage, final Entity aEntity, final ItemStack aStack, final EntityPlayer aPlayer) {
+ return aOriginalDamage;
+ }
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_Choocher.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_Choocher.java
new file mode 100644
index 0000000000..1fd1e8241a
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_Choocher.java
@@ -0,0 +1,196 @@
+package gtPlusPlus.xmod.gregtech.common.tools;
+
+import java.util.Arrays;
+import java.util.List;
+
+import net.minecraft.block.Block;
+import net.minecraft.block.material.Material;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.monster.EntityIronGolem;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.init.Blocks;
+import net.minecraft.item.ItemStack;
+import net.minecraft.stats.AchievementList;
+import net.minecraft.util.ChatComponentText;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.IChatComponent;
+
+import gregtech.GT_Mod;
+import gregtech.api.GregTech_API;
+import gregtech.api.interfaces.IIconContainer;
+import gregtech.api.items.GT_MetaGenerated_Tool;
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_Utility;
+import gregtech.common.tools.GT_Tool;
+
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtTools;
+import gtPlusPlus.xmod.gregtech.common.items.behaviours.Behaviour_Choocher;
+import net.minecraftforge.event.world.BlockEvent;
+
+public class TOOL_Gregtech_Choocher
+extends GT_Tool {
+
+ public static final List<String> mEffectiveList = Arrays.asList(new String[]{EntityIronGolem.class.getName(), "EntityTowerGuardian"});
+
+
+ @Override
+ public float getNormalDamageAgainstEntity(final float aOriginalDamage, final Entity aEntity, final ItemStack aStack, final EntityPlayer aPlayer) {
+ String tName = aEntity.getClass().getName();
+ tName = tName.substring(tName.lastIndexOf(".") + 1);
+ return (mEffectiveList.contains(tName)) || (tName.contains("Golem")) ? aOriginalDamage * 2.0F : aOriginalDamage;
+ }
+
+ @Override
+ public int getToolDamagePerBlockBreak() {
+ return 50;
+ }
+
+ @Override
+ public int getToolDamagePerDropConversion() {
+ return 100;
+ }
+
+ @Override
+ public int getToolDamagePerContainerCraft() {
+ return 400;
+ }
+
+ @Override
+ public int getToolDamagePerEntityAttack() {
+ return 100;
+ }
+
+ @Override
+ public int getBaseQuality() {
+ return 0;
+ }
+
+ @Override
+ public float getBaseDamage() {
+ return 4.0F;
+ }
+
+ @Override
+ public float getSpeedMultiplier() {
+ return 0.85F;
+ }
+
+ @Override
+ public float getMaxDurabilityMultiplier() {
+ return 1.2F;
+ }
+
+ @Override
+ public String getCraftingSound() {
+ return GregTech_API.sSoundList.get(Integer.valueOf(1));
+ }
+
+ @Override
+ public String getEntityHitSound() {
+ return GregTech_API.sSoundList.get(Integer.valueOf(2));
+ }
+
+ @Override
+ public String getBreakingSound() {
+ return GregTech_API.sSoundList.get(Integer.valueOf(0));
+ }
+
+ @Override
+ public String getMiningSound() {
+ return null;
+ }
+
+ @Override
+ public boolean canBlock() {
+ return true;
+ }
+
+ public boolean isWrench(){
+ return true;
+ }
+
+ @Override
+ public boolean isCrowbar() {
+ return false;
+ }
+
+ @Override
+ public boolean isWeapon() {
+ return true;
+ }
+
+ @Override
+ public boolean isMinableBlock(final Block aBlock, final byte aMetaData) {
+ final String tTool = aBlock.getHarvestTool(aMetaData);
+ return ((tTool != null) && ((tTool.equals("sword")) || (tTool.equals("wrench")) || (tTool.equals("hammer")) || (tTool.equals("pickaxe")))) || (aBlock.getMaterial() == Material.rock) || (aBlock.getMaterial() == Material.glass) || (aBlock.getMaterial() == Material.piston) || (aBlock == Blocks.hopper) || (aBlock == Blocks.dispenser) || (aBlock == Blocks.dropper) || (aBlock.getMaterial() == Material.ice) || (aBlock.getMaterial() == Material.packedIce) || (GT_Recipe.GT_Recipe_Map.sHammerRecipes.containsInput(new ItemStack(aBlock, 1, aMetaData))) || (aBlock.getMaterial() == Material.sand) || (aBlock.getMaterial() == Material.grass) || (aBlock.getMaterial() == Material.ground) || (aBlock.getMaterial() == Material.snow) || (aBlock.getMaterial() == Material.clay) || (aBlock.getMaterial() == Material.leaves) || (aBlock.getMaterial() == Material.vine) || (aBlock.getMaterial() == Material.wood) || (aBlock.getMaterial() == Material.cactus) || (aBlock.getMaterial() == Material.circuits) || (aBlock.getMaterial() == Material.gourd) || (aBlock.getMaterial() == Material.web) || (aBlock.getMaterial() == Material.cloth) || (aBlock.getMaterial() == Material.carpet) || (aBlock.getMaterial() == Material.plants) || (aBlock.getMaterial() == Material.cake) || (aBlock.getMaterial() == Material.tnt) || (aBlock.getMaterial() == Material.sponge);
+ }
+
+ @Override
+ public int convertBlockDrops(final List<ItemStack> aDrops, final ItemStack aStack, final EntityPlayer aPlayer, final Block aBlock, final int aX, final int aY, final int aZ, final byte aMetaData, final int aFortune, final boolean aSilkTouch, final BlockEvent.HarvestDropsEvent aEvent) {
+ int rConversions = 0;
+ GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sHammerRecipes.findRecipe(null, true, 2147483647L, null, new ItemStack[]{new ItemStack(aBlock, 1, aMetaData)});
+ if ((tRecipe == null) || (aBlock.hasTileEntity(aMetaData))) {
+ for (final ItemStack tDrop : aDrops) {
+ tRecipe = GT_Recipe.GT_Recipe_Map.sHammerRecipes.findRecipe(null, true, 2147483647L, null, new ItemStack[]{GT_Utility.copyAmount(1L, new Object[]{tDrop})});
+ if (tRecipe != null) {
+ final ItemStack tHammeringOutput = tRecipe.getOutput(0);
+ if (tHammeringOutput != null) {
+ rConversions += tDrop.stackSize;
+ tDrop.stackSize *= tHammeringOutput.stackSize;
+ tHammeringOutput.stackSize = tDrop.stackSize;
+ GT_Utility.setStack(tDrop, tHammeringOutput);
+ }
+ }
+ }
+ } else {
+ aDrops.clear();
+ aDrops.add(tRecipe.getOutput(0));
+ rConversions++;
+ }
+ return rConversions;
+ }
+
+ @Override
+ public ItemStack getBrokenItem(final ItemStack aStack) {
+ return null;
+ }
+
+ @Override
+ public IIconContainer getIcon(final boolean aIsToolHead, final ItemStack aStack) {
+ //Utils.LOG_INFO("Texture: "+TexturesGtTools.SKOOKUM_CHOOCHER.getTextureFile());
+ return TexturesGtTools.SKOOKUM_CHOOCHER;
+ }
+
+ @Override
+ public short[] getRGBa(final boolean aIsToolHead, final ItemStack aStack) {
+ return GT_MetaGenerated_Tool.getPrimaryMaterial(aStack).mRGBa;
+ }
+
+ @Override
+ public void onToolCrafted(final ItemStack aStack, final EntityPlayer aPlayer) {
+ super.onToolCrafted(aStack, aPlayer);
+ aPlayer.triggerAchievement(AchievementList.buildSword);
+ try {
+ GT_Mod.achievements.issueAchievement(aPlayer, "tools");
+ GT_Mod.achievements.issueAchievement(aPlayer, "unitool");
+ } catch (final Exception e) {
+ }
+ }
+
+ @Override
+ public IChatComponent getDeathMessage(final EntityLivingBase aPlayer, final EntityLivingBase aEntity) {
+ return new ChatComponentText(EnumChatFormatting.RED + aEntity.getCommandSenderName() + EnumChatFormatting.WHITE + " has been Choochered by " + EnumChatFormatting.GREEN + aPlayer.getCommandSenderName() + EnumChatFormatting.WHITE);
+ }
+
+ @Override
+ public void onStatsAddedToTool(final GT_MetaGenerated_Tool aItem, final int aID) {
+ aItem.addItemBehavior(aID, new Behaviour_Choocher());
+ }
+
+ @Override
+ public boolean isGrafter() {
+ return false;
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_ElectricButcherKnife.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_ElectricButcherKnife.java
new file mode 100644
index 0000000000..7aa7529817
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_ElectricButcherKnife.java
@@ -0,0 +1,192 @@
+package gtPlusPlus.xmod.gregtech.common.tools;
+
+import java.util.Arrays;
+import java.util.List;
+
+import gregtech.GT_Mod;
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.Materials;
+import gregtech.api.enums.Textures.ItemIcons;
+import gregtech.api.interfaces.IIconContainer;
+import gregtech.api.items.GT_MetaGenerated_Tool;
+import gregtech.common.items.behaviors.Behaviour_None;
+import gregtech.common.tools.GT_Tool;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtTools;
+import net.minecraft.block.Block;
+import net.minecraft.enchantment.Enchantment;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.monster.EntityIronGolem;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.stats.AchievementList;
+import net.minecraft.util.ChatComponentText;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.IChatComponent;
+import net.minecraftforge.event.world.BlockEvent;
+
+public class TOOL_Gregtech_ElectricButcherKnife
+extends GT_Tool {
+
+ public static final List<String> mEffectiveList = Arrays.asList(new String[]{EntityIronGolem.class.getName(), "EntityTowerGuardian"});
+
+
+ @Override
+ public float getNormalDamageAgainstEntity(final float aOriginalDamage, final Entity aEntity, final ItemStack aStack, final EntityPlayer aPlayer) {
+ String tName = aEntity.getClass().getName();
+ tName = tName.substring(tName.lastIndexOf(".") + 1);
+ return (mEffectiveList.contains(tName)) || (tName.contains("Golem")) ? aOriginalDamage * 2.0F : aOriginalDamage;
+ }
+
+ @Override
+ public int getToolDamagePerBlockBreak() {
+ return 100;
+ }
+
+ @Override
+ public int getToolDamagePerDropConversion() {
+ return 100;
+ }
+
+ @Override
+ public int getToolDamagePerContainerCraft() {
+ return 100;
+ }
+
+ @Override
+ public int getToolDamagePerEntityAttack() {
+ return 200;
+ }
+
+ @Override
+ public int getBaseQuality() {
+ return 0;
+ }
+
+ @Override
+ public float getBaseDamage() {
+ return 8.0F;
+ }
+
+ @Override
+ public float getSpeedMultiplier() {
+ return 2F;
+ }
+
+ @Override
+ public float getMaxDurabilityMultiplier() {
+ return 1.8F;
+ }
+
+ @Override
+ public String getCraftingSound() {
+ return GregTech_API.sSoundList.get(Integer.valueOf(1));
+ }
+
+ @Override
+ public String getEntityHitSound() {
+ return GregTech_API.sSoundList.get(Integer.valueOf(2));
+ }
+
+ @Override
+ public String getBreakingSound() {
+ return GregTech_API.sSoundList.get(Integer.valueOf(0));
+ }
+
+ @Override
+ public String getMiningSound() {
+ return null;
+ }
+
+ @Override
+ public boolean canBlock() {
+ return false;
+ }
+
+ public boolean isWrench(){
+ return false;
+ }
+
+ @Override
+ public boolean isCrowbar() {
+ return false;
+ }
+
+ @Override
+ public boolean isMinableBlock(final Block aBlock, final byte aMetaData) {
+ final String tTool = aBlock.getHarvestTool(aMetaData);
+ return (tTool != null) && (tTool.equals("sword") || tTool.equals("knife"));
+ }
+
+ @Override
+ public ItemStack getBrokenItem(final ItemStack aStack) {
+ return null;
+ }
+
+ public IIconContainer getIcon(boolean aIsToolHead, ItemStack aStack) {
+ return (IIconContainer) (aIsToolHead
+ ? TexturesGtTools.ELECTRIC_BUTCHER_KNIFE
+ : ItemIcons.POWER_UNIT_HV);
+ }
+
+ public short[] getRGBa(boolean aIsToolHead, ItemStack aStack) {
+ return aIsToolHead
+ ? GT_MetaGenerated_Tool.getPrimaryMaterial(aStack).mRGBa
+ : Materials.RedSteel.mRGBa;
+ }
+
+
+
+
+ @Override
+ public void onToolCrafted(final ItemStack aStack, final EntityPlayer aPlayer) {
+ super.onToolCrafted(aStack, aPlayer);
+ aPlayer.triggerAchievement(AchievementList.buildSword);
+ try {
+ GT_Mod.achievements.issueAchievement(aPlayer, "tools");
+ GT_Mod.achievements.issueAchievement(aPlayer, "unitool");
+ } catch (final Exception e) {
+ }
+ }
+
+ @Override
+ public IChatComponent getDeathMessage(final EntityLivingBase aPlayer, final EntityLivingBase aEntity) {
+ return new ChatComponentText(EnumChatFormatting.RED + aEntity.getCommandSenderName() + EnumChatFormatting.WHITE + " has been Sliced out of existence by " + EnumChatFormatting.GREEN + aPlayer.getCommandSenderName() + EnumChatFormatting.WHITE);
+ }
+
+ @Override
+ public void onStatsAddedToTool(final GT_MetaGenerated_Tool aItem, final int aID) {
+ aItem.addItemBehavior(aID, new Behaviour_None());
+ }
+
+ @Override
+ public boolean isGrafter() {
+ return false;
+ }
+
+ @Override
+ public int getHurtResistanceTime(int aOriginalHurtResistance, Entity aEntity) {
+ return aOriginalHurtResistance * 2;
+ }
+
+ @Override
+ public boolean isWeapon() {
+ return true;
+ }
+
+ @Override
+ public boolean isMiningTool() {
+ return false;
+ }
+
+ @Override
+ public Enchantment[] getEnchantments(ItemStack aStack) {
+ return LOOTING_ENCHANTMENT;
+ }
+
+ @Override
+ public int[] getEnchantmentLevels(ItemStack aStack) {
+ return new int[]{(4 + GT_MetaGenerated_Tool.getPrimaryMaterial(aStack).mToolQuality) / 2};
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_ElectricLighter.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_ElectricLighter.java
new file mode 100644
index 0000000000..395a7c42cb
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_ElectricLighter.java
@@ -0,0 +1,166 @@
+package gtPlusPlus.xmod.gregtech.common.tools;
+
+import java.util.Arrays;
+import java.util.List;
+
+import gregtech.GT_Mod;
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.Materials;
+import gregtech.api.enums.Textures.ItemIcons;
+import gregtech.api.interfaces.IIconContainer;
+import gregtech.api.items.GT_MetaGenerated_Tool;
+import gregtech.common.tools.GT_Tool;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtTools;
+import gtPlusPlus.xmod.gregtech.common.items.behaviours.Behaviour_Electric_Lighter;
+import net.minecraft.block.Block;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.monster.EntityIronGolem;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.stats.AchievementList;
+import net.minecraft.util.ChatComponentText;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.IChatComponent;
+
+public class TOOL_Gregtech_ElectricLighter
+extends GT_Tool {
+
+ public static final List<String> mEffectiveList = Arrays.asList(new String[]{EntityIronGolem.class.getName(), "EntityTowerGuardian"});
+
+
+ @Override
+ public float getNormalDamageAgainstEntity(final float aOriginalDamage, final Entity aEntity, final ItemStack aStack, final EntityPlayer aPlayer) {
+ String tName = aEntity.getClass().getName();
+ tName = tName.substring(tName.lastIndexOf(".") + 1);
+ return (mEffectiveList.contains(tName)) || (tName.contains("Golem")) ? aOriginalDamage * 2.0F : aOriginalDamage;
+ }
+
+ @Override
+ public int getToolDamagePerBlockBreak() {
+ return 50;
+ }
+
+ @Override
+ public int getToolDamagePerDropConversion() {
+ return 100;
+ }
+
+ @Override
+ public int getToolDamagePerContainerCraft() {
+ return 400;
+ }
+
+ @Override
+ public int getToolDamagePerEntityAttack() {
+ return 100;
+ }
+
+ @Override
+ public int getBaseQuality() {
+ return 0;
+ }
+
+ @Override
+ public float getBaseDamage() {
+ return 8.0F;
+ }
+
+ @Override
+ public float getSpeedMultiplier() {
+ return 2F;
+ }
+
+ @Override
+ public float getMaxDurabilityMultiplier() {
+ return 1.8F;
+ }
+
+ @Override
+ public String getCraftingSound() {
+ return GregTech_API.sSoundList.get(Integer.valueOf(1));
+ }
+
+ @Override
+ public String getEntityHitSound() {
+ return GregTech_API.sSoundList.get(Integer.valueOf(2));
+ }
+
+ @Override
+ public String getBreakingSound() {
+ return GregTech_API.sSoundList.get(Integer.valueOf(0));
+ }
+
+ @Override
+ public String getMiningSound() {
+ return null;
+ }
+
+ @Override
+ public boolean canBlock() {
+ return false;
+ }
+
+ public boolean isWrench(){
+ return false;
+ }
+
+ @Override
+ public boolean isCrowbar() {
+ return false;
+ }
+
+ @Override
+ public boolean isWeapon() {
+ return true;
+ }
+
+ @Override
+ public boolean isMinableBlock(final Block aBlock, final byte aMetaData) {
+ return false;
+ }
+
+ @Override
+ public ItemStack getBrokenItem(final ItemStack aStack) {
+ return null;
+ }
+
+ public IIconContainer getIcon(boolean aIsToolHead, ItemStack aStack) {
+ return (IIconContainer) (aIsToolHead
+ ? TexturesGtTools.ELECTRIC_LIGHTER
+ : ItemIcons.POWER_UNIT_HV);
+ }
+
+ public short[] getRGBa(boolean aIsToolHead, ItemStack aStack) {
+ return !aIsToolHead
+ ? GT_MetaGenerated_Tool.getPrimaryMaterial(aStack).mRGBa
+ : Materials.Silver.mRGBa;
+ }
+
+ @Override
+ public void onToolCrafted(final ItemStack aStack, final EntityPlayer aPlayer) {
+ super.onToolCrafted(aStack, aPlayer);
+ aPlayer.triggerAchievement(AchievementList.buildSword);
+ try {
+ GT_Mod.achievements.issueAchievement(aPlayer, "tools");
+ GT_Mod.achievements.issueAchievement(aPlayer, "unitool");
+ } catch (final Exception e) {
+ }
+ }
+
+ @Override
+ public IChatComponent getDeathMessage(final EntityLivingBase aPlayer, final EntityLivingBase aEntity) {
+ return new ChatComponentText(EnumChatFormatting.RED + aEntity.getCommandSenderName() + EnumChatFormatting.WHITE + " has been burnt out of existence by " + EnumChatFormatting.GREEN + aPlayer.getCommandSenderName() + EnumChatFormatting.WHITE);
+ }
+
+ @Override
+ public void onStatsAddedToTool(final GT_MetaGenerated_Tool aItem, final int aID) {
+ aItem.addItemBehavior(aID, new Behaviour_Electric_Lighter());
+ }
+
+ @Override
+ public boolean isGrafter() {
+ return false;
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_ElectricSnips.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_ElectricSnips.java
new file mode 100644
index 0000000000..2277ce339f
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_ElectricSnips.java
@@ -0,0 +1,97 @@
+package gtPlusPlus.xmod.gregtech.common.tools;
+
+import gregtech.GT_Mod;
+import gregtech.api.enums.Materials;
+import gregtech.api.enums.Textures.ItemIcons;
+import gregtech.api.interfaces.IIconContainer;
+import gregtech.api.items.GT_MetaGenerated_Tool;
+import gregtech.common.tools.GT_Tool_WireCutter;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtTools;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.stats.AchievementList;
+import net.minecraft.util.ChatComponentText;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.IChatComponent;
+
+public class TOOL_Gregtech_ElectricSnips
+extends GT_Tool_WireCutter {
+
+
+ @Override
+ public int getToolDamagePerBlockBreak() {
+ return 50;
+ }
+
+ @Override
+ public int getToolDamagePerDropConversion() {
+ return 100;
+ }
+
+ @Override
+ public int getToolDamagePerContainerCraft() {
+ return 400;
+ }
+
+ @Override
+ public int getToolDamagePerEntityAttack() {
+ return 100;
+ }
+
+ @Override
+ public int getBaseQuality() {
+ return 0;
+ }
+
+ @Override
+ public float getBaseDamage() {
+ return 4.0F;
+ }
+
+ @Override
+ public float getSpeedMultiplier() {
+ return 1F;
+ }
+
+ @Override
+ public float getMaxDurabilityMultiplier() {
+ return 1.4F;
+ }
+
+ @Override
+ public ItemStack getBrokenItem(final ItemStack aStack) {
+ return null;
+ }
+
+ public IIconContainer getIcon(boolean aIsToolHead, ItemStack aStack) {
+ return (IIconContainer) (aIsToolHead
+ ? TexturesGtTools.ELECTRIC_SNIPS
+ : ItemIcons.POWER_UNIT_MV);
+ }
+
+ public short[] getRGBa(boolean aIsToolHead, ItemStack aStack) {
+ return aIsToolHead
+ ? GT_MetaGenerated_Tool.getPrimaryMaterial(aStack).mRGBa
+ : Materials.TungstenSteel.mRGBa;
+ }
+
+
+
+ @Override
+ public void onToolCrafted(final ItemStack aStack, final EntityPlayer aPlayer) {
+ super.onToolCrafted(aStack, aPlayer);
+ aPlayer.triggerAchievement(AchievementList.buildSword);
+ try {
+ GT_Mod.achievements.issueAchievement(aPlayer, "tools");
+ GT_Mod.achievements.issueAchievement(aPlayer, "unitool");
+ } catch (final Exception e) {
+ }
+ }
+
+ @Override
+ public IChatComponent getDeathMessage(final EntityLivingBase aPlayer, final EntityLivingBase aEntity) {
+ return new ChatComponentText(EnumChatFormatting.RED + aEntity.getCommandSenderName() + EnumChatFormatting.WHITE + " has been Snipped out of existence by " + EnumChatFormatting.GREEN + aPlayer.getCommandSenderName() + EnumChatFormatting.WHITE);
+ }
+
+}