diff options
author | BlueWeabo <76872108+BlueWeabo@users.noreply.github.com> | 2022-12-13 23:10:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-13 22:10:17 +0100 |
commit | 8a515c7a9f83ca0fe29098d50bc7cab30e137d35 (patch) | |
tree | f8d8ae0ef341bc629a7ef12ad46da3c21a19b011 /src/main/java/gregtech/common | |
parent | c702937ba0bf2e3f6cc8e2c37a2d5a7453a74926 (diff) | |
download | GT5-Unofficial-8a515c7a9f83ca0fe29098d50bc7cab30e137d35.tar.gz GT5-Unofficial-8a515c7a9f83ca0fe29098d50bc7cab30e137d35.tar.bz2 GT5-Unofficial-8a515c7a9f83ca0fe29098d50bc7cab30e137d35.zip |
Nanite material and circuit board multi for later tiers (#1513)
* Base work for ModularUI compat
* Remove useless interface
* Add almost all the widgets
* Invert method
* Refactor NEI stack placement positions
* NEI handlers on ModularUI
* Add some more docs
* AdvDebugStructureWriter
* Fix NEI progressbar not working
* PrimitiveBlastFurnace
* clean
* derp
* clean
* spotlessApply
* Boilers
* Buffers
* clean
* N by N slots containers
* Fix boilers not having bucket interaction
Put opening UI to individual MetaTEs
* Maintenance Hatch
* clean
* spotlessApply
* Add dependency
* IndustrialApiary
* Adapt to ModularUI change
* Base work for covers & fix crash with MP
* Fix crash with server
* Rewrite base work for covers
* Send initial cover data on cover GUI open
so that the time of showing incorrect data will be eliminated
* Covers part 1
* Rename package: ModularUI -> modularui
* Rename class: GT_UIInfo -> GT_UIInfos
* Fix build
* Covers part2
* Fix missing client check with tile UI & fix title overlap
* CoverTabLine
* Move cover window creators to inner class
* Fix crash with null base TE
* Close GUI when tile is broken
* Color cover window with tile colorization
* add nanites as a material
* spotless
* start the work on the nanites multi
* spotless
* Change signature of addUIWidgets
* FluidFilter cover, FluidDisplaySlotWidget, BasicTank, BasicGenerator, Output Hatch, MicrowaveEnergyTransmitter, Teleporter, DigitalChest, DigitalTank
* Add title tab
* Move package: modularui -> modularui/widget
* add controller recipe and new casing
* add prefix and the casing and controller to the item list
* add nano forge controller to its item
* add nanites to PreLoad
* Programmed circuit + IConfigurationCircuitSupport
* clean
* add nano forge multi - complete with some recipes
* new nanite textures
* Apply spotless
* fix nanites not registering, remove recipe lock on the nano forge, other small fixed
no clue why they didn't want to register in run2.
* VolumetricFlask
* Remove integrated circuit overlay from recipe input slots
* Input Hatch & Quadruple Input Hatch
* Multiblock
* Deprecate old cover GUI
* BasicMachines
* Finish BasicMachine & NEI
* Expand DTPF NEI to 9 slots
* Fix ME input bus on MP
* Move AESlotWidget to public class
* Move GT_Recipe_Map constructors with mNEIUnificateOutput to setter method
* Move SteamTexture.Variant to outer enum
* Switch to remote repository
* oops
* Update MUI
* Update MUI
* Minor refactor for change amount buttons
* the start of a new multi, tooltip WIP
* Display items and fluids that exceed usual count
* blah
* use +=, why didn't I do this
* add tier 2 and tier 3. add some more checks
* Update MUI
* Move ModularUI to Base (#1510)
* Move ModularUI to Base
* Move most of the ModularUI functionality to `BaseTileEntity` (and `CoverableTileEntity`)
* `CommonMetaTileEntity` delegates ato the MetaTileEntity
* Added several interfaces (with defaults) to indicate if a tile/metatile override/implement certain behaviors.
* Moved `IConfigurationCircuitSupport` interface such that it will work with BaseTileEntity or a MetaTileEntity
* Address reviews
Co-authored-by: miozune <miozune@gmail.com>
* Update MUI
* make a single shape rotatable by 90 degrees
* Minor changes to NEI
* more shapes, more mechanics
* Return :facepalm:
* IGetTabIconSet override
* Some more changes to NEI
* Merge texture getter interfaces to new class GUITextureSet
* Remove BBF structure picture as it's auto-buildable now
* Make unified title tab style of texture angular
* Expose some boiler texture getters for addon
* Fix crash with cover GUI on pipe
* small changes
* Lower the number of recipe per page for DTPF & update MUI
* Update MUI
* Fix crash with middle-clicking slot on circuit selection GUI
* Fix circuit selection window not syncing item from base machine
* Merge GT_NEI_AssLineHandler into GT_NEI_DefaultHandler
* Update MUI
* Add in TecTech multi message
* Allow changing the way of binding player inventory
* Update MUI
* Update MUI
* Update MUI
* Update MUI
* Update MUI
* Make MUI non-transitive to allow addons to use their own version
* Force enable mixin
* Format fluid amount tooltip
* Add GUITextureSet.STEAM
* Add guard against null ModularWindow creation
* Add constructors for Muffler Hatch with inventory
* Fix output slot on digital chest and tank allowing insertion
* Don't log null ModularWindow
* add a new material, add some recipes, continue the work on the PCB factory. The first recipe is in!
* oops spotless
* update bs
* rename casings
* make material generate plates
* add recipes to the pcb factory
* nei handling
* do some more work on the multi
* fixes to recipes.
* Update build-and-test.yml
* starter work on the PCBFactory GUI. recipe check fully working
* finish gui work
* spotless
thank god drafts don't generate spotless PRs
* final touches. tooltip tomorrow
* fix typos. and finish PCB multi.
* spotless
* changes for requests
* make consumed amount a constant
* fix recipes oopsie
* Remove unused textures
* Add nanites
* fixing recipes
* Fix NEI not showing
* Make nanites share texture
* actually fix recipes and use 2 new lenses
* finally circuits work in recipe
* Add trans metal block
* add default offsets
* spotless
* make parallels actually work
* Downscale nanite texture to 64x64
* improve PCB Factory GUI
* finish fixing gui, fix offsets on cooler, apply a new formula for duration
* Clean up PCB Factory tooltip
* Spotless
* Fix typo in Naquadah
* make sure the roughness multiplier actually slows down the recipe XD
* add a smaller limit to the roughness multipler.... lets not allow for 10x board prodction oops
* fix cooler tier 2 using wrong block in its center, fix controller texture on tier 3
* update mui and uodate the button texture
* fix one button and prevent null arrays
* remove some math. a small rework on recipes
* fix and off by 1
* save the change? never heard of it
* fix tier 3 not forming
* Nano forge tooltip
* hopefully fix nano forge. fix neutroni nanite wrong tier in recipe
* try 2 to fix structure check
* fix nano forge not forming
* fix nano forge data stick. we need better error messages
* do some fixes.
* its 12am, typos....
* never coding at midnight again
* try 2 to fix nano forge and pcb factory
* fix nano and pcb factory not working. address some reviews
* do syncing between client and server. fix recipes asking too much power with multiple upgrades
Co-authored-by: miozune <miozune@gmail.com>
Co-authored-by: Jason Mitchell <mitchej@gmail.com>
Co-authored-by: Martin Robertz <dream-master@gmx.net>
Co-authored-by: GTNH-Colen <54497873+GTNH-Colen@users.noreply.github.com>
Co-authored-by: Sampsa <sampo.vanninen@aalto.fi>
Diffstat (limited to 'src/main/java/gregtech/common')
6 files changed, 1643 insertions, 6 deletions
diff --git a/src/main/java/gregtech/common/GT_RecipeAdder.java b/src/main/java/gregtech/common/GT_RecipeAdder.java index 488ac0a5fb..ee056ddebd 100644 --- a/src/main/java/gregtech/common/GT_RecipeAdder.java +++ b/src/main/java/gregtech/common/GT_RecipeAdder.java @@ -3318,6 +3318,46 @@ public class GT_RecipeAdder implements IGT_RecipeAdder { return true; } + @Override + public boolean addNanoForgeRecipe( + ItemStack[] aInputs, + FluidStack[] aFluidInputs, + ItemStack[] aOutputs, + FluidStack[] aFluidOutputs, + int[] aChances, + int aDuration, + int aEUt, + int aSpecialValue) { + if (aInputs == null || aOutputs == null || aSpecialValue == 0) return false; + + GT_Recipe.GT_Recipe_Map.sNanoForge.addRecipe(new GT_Recipe( + false, aInputs, aOutputs, null, aChances, aFluidInputs, aFluidOutputs, aDuration, aEUt, aSpecialValue)); + return true; + } + + @Override + public boolean addPCBFactoryRecipe( + ItemStack[] aInputs, + FluidStack[] aFluidInputs, + ItemStack[] aOutputs, + int aDuration, + int aEUt, + int aSpecialValue) { + + if (aInputs == null || aFluidInputs == null || aOutputs == null) { + return false; + } + + if (aSpecialValue <= 0 || aEUt < 0 || aDuration < 0) { + return false; + } + + GT_Recipe.GT_Recipe_Map.sPCBFactory.addRecipe(new GT_Recipe( + false, aInputs, aOutputs, null, null, aFluidInputs, null, aDuration, aEUt, aSpecialValue)); + + return true; + } + private boolean areItemsAndFluidsBothNull(ItemStack[] items, FluidStack[] fluids) { boolean itemsNull = true; if (items != null) { diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Casings8.java b/src/main/java/gregtech/common/blocks/GT_Block_Casings8.java index 65583eaa28..ae67f52730 100644 --- a/src/main/java/gregtech/common/blocks/GT_Block_Casings8.java +++ b/src/main/java/gregtech/common/blocks/GT_Block_Casings8.java @@ -18,7 +18,7 @@ public class GT_Block_Casings8 extends GT_Block_Casings_Abstract { // WATCH OUT FOR TEXTURE ID's public GT_Block_Casings8() { - super(GT_Item_Casings8.class, "gt.blockcasings8", GT_Material_Casings.INSTANCE, 10); + super(GT_Item_Casings8.class, "gt.blockcasings8", GT_Material_Casings.INSTANCE, 15); /* * DO NOT USE INDEX 15 ! * USED HERE: https://github.com/GTNewHorizons/Electro-Magic-Tools/pull/17 @@ -37,6 +37,14 @@ public class GT_Block_Casings8 extends GT_Block_Casings_Abstract { getUnlocalizedName() + ".7.name", "Advanced Iridium Plated Machine Casing"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".8.name", "Magical Machine Casing"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".9.name", "HSS-S Turbine Casing"); + GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".10.name", "Radiant Naquadah Alloy Casing"); + GT_LanguageManager.addStringLocalization( + getUnlocalizedName() + ".11.name", "Basic Photolithographic Framework Casing"); + GT_LanguageManager.addStringLocalization( + getUnlocalizedName() + ".12.name", "Reinforced Photolithographic Framework Casing"); + GT_LanguageManager.addStringLocalization( + getUnlocalizedName() + ".13.name", "Radiation Proof Photolithographic Framework Casing"); + GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".14.name", "Infinity Cooled Casing"); ItemList.Casing_Chemically_Inert.set(new ItemStack(this, 1, 0)); ItemList.Casing_Pipe_Polytetrafluoroethylene.set(new ItemStack(this, 1, 1)); @@ -48,6 +56,11 @@ public class GT_Block_Casings8 extends GT_Block_Casings_Abstract { ItemList.Casing_Advanced_Iridium.set(new ItemStack(this, 1, 7)); ItemList.Casing_Magical.set(new ItemStack(this, 1, 8)); ItemList.Casing_TurbineGasAdvanced.set(new ItemStack(this, 1, 9)); + ItemList.RadiantNaquadahAlloyCasing.set(new ItemStack(this, 1, 10)); + ItemList.BasicPhotolithographicFrameworkCasing.set(new ItemStack(this, 1, 11)); + ItemList.ReinforcedPhotolithographicFrameworkCasing.set(new ItemStack(this, 1, 12)); + ItemList.RadiationProofPhotolithographicFrameworkCasing.set(new ItemStack(this, 1, 13)); + ItemList.InfinityCooledCasing.set(new ItemStack(this, 1, 14)); } @Override @@ -80,6 +93,16 @@ public class GT_Block_Casings8 extends GT_Block_Casings_Abstract { return Textures.BlockIcons.MACHINE_CASING_MAGICAL.getIcon(); case 9: return Textures.BlockIcons.MACHINE_CASING_ADVANCEDGAS.getIcon(); + case 10: + return Textures.BlockIcons.MACHINE_CASING_RADIANT_NAQUADAH_ALLOY.getIcon(); + case 11: + return Textures.BlockIcons.MACHINE_CASING_PCB_TIER_1.getIcon(); + case 12: + return Textures.BlockIcons.MACHINE_CASING_PCB_TIER_2.getIcon(); + case 13: + return Textures.BlockIcons.MACHINE_CASING_PCB_TIER_3.getIcon(); + case 14: + return Textures.BlockIcons.INFINITY_COOLED_CASING.getIcon(); } return Textures.BlockIcons.MACHINE_CASING_ROBUST_TUNGSTENSTEEL.getIcon(); } diff --git a/src/main/java/gregtech/common/items/GT_MetaGenerated_Item_03.java b/src/main/java/gregtech/common/items/GT_MetaGenerated_Item_03.java index 01015515e8..00927497c6 100644 --- a/src/main/java/gregtech/common/items/GT_MetaGenerated_Item_03.java +++ b/src/main/java/gregtech/common/items/GT_MetaGenerated_Item_03.java @@ -21,7 +21,8 @@ public class GT_MetaGenerated_Item_03 extends GT_MetaGenerated_Item_X32 { OrePrefixes.crateGtDust, OrePrefixes.crateGtIngot, OrePrefixes.crateGtGem, - OrePrefixes.crateGtPlate); + OrePrefixes.crateGtPlate, + OrePrefixes.nanite); INSTANCE = this; int tLastID = 0; Object[] o = new Object[0]; @@ -810,6 +811,6 @@ public class GT_MetaGenerated_Item_03 extends GT_MetaGenerated_Item_X32 { @Override public boolean doesShowInCreative(OrePrefixes aPrefix, Materials aMaterial, boolean aDoShowAllItems) { - return aDoShowAllItems; + return aDoShowAllItems || (aPrefix.toString().toLowerCase().contains("nanite")); } } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_NanoForge.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_NanoForge.java new file mode 100644 index 0000000000..6bff3c3338 --- /dev/null +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_NanoForge.java @@ -0,0 +1,453 @@ +package gregtech.common.tileentities.machines.multi; + +import static com.gtnewhorizon.structurelib.structure.StructureUtility.*; +import static gregtech.api.enums.GT_HatchElement.*; +import static gregtech.api.enums.GT_Values.AuthorBlueWeabo; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ASSEMBLY_LINE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ASSEMBLY_LINE_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ASSEMBLY_LINE_ACTIVE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ASSEMBLY_LINE_GLOW; +import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; +import static gregtech.api.util.GT_StructureUtility.ofFrame; + +import com.gtnewhorizon.structurelib.alignment.IAlignmentLimits; +import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; +import com.gtnewhorizon.structurelib.alignment.enumerable.Rotation; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; +import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; +import com.gtnewhorizon.structurelib.structure.StructureDefinition; +import gregtech.api.GregTech_API; +import gregtech.api.enums.Materials; +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.implementations.GT_MetaTileEntity_ExtendedPowerMultiBlockBase; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus; +import gregtech.api.render.TextureFactory; +import gregtech.api.util.GT_ExoticEnergyInputHelper; +import gregtech.api.util.GT_Multiblock_Tooltip_Builder; +import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Utility; +import gregtech.common.blocks.GT_Block_Casings8; +import java.util.ArrayList; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.StatCollector; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.FluidStack; + +public class GT_MetaTileEntity_NanoForge + extends GT_MetaTileEntity_ExtendedPowerMultiBlockBase<GT_MetaTileEntity_NanoForge> + implements ISurvivalConstructable { + private static final String STRUCTURE_PIECE_MAIN = "main"; + private static final String STRUCTURE_PIECE_TIER2 = "tier2"; + private static final String STRUCTURE_PIECE_TIER3 = "tier3"; + private static final IStructureDefinition<GT_MetaTileEntity_NanoForge> STRUCTURE_DEFINITION = + StructureDefinition.<GT_MetaTileEntity_NanoForge>builder() + // spotless:off + .addShape(STRUCTURE_PIECE_MAIN, transpose(new String[][] { + {" "," "," F "," C "," C "," C "," C "," F "," "," "}, + {" "," "," F "," C "," C "," C "," C "," F "," "," "}, + {" "," "," F "," C "," C "," C "," C "," F "," "," "}, + {" "," "," F "," C "," C "," C "," C "," F "," "," "}, + {" "," "," F "," C "," C "," C "," C "," F "," "," "}, + {" "," "," FCF "," C C "," C C "," C C "," C C "," FCF "," "," "}, + {" "," "," FCF "," C C "," C C "," C C "," C C "," FCF "," "," "}, + {" "," "," FCF "," C C "," C C "," C C "," C C "," FCF "," "," "}, + {" "," "," FCF "," C C "," C C "," C C "," C C "," FCF "," "," "}, + {" "," "," FCF "," C C "," C C "," C C "," C C "," FCF "," "," "}, + {" "," "," FCF "," C C "," C C "," C C "," C C "," FCF "," "," "}, + {" "," "," FCF "," C C "," C C "," C C "," C C "," FCF "," "," "}, + {" "," "," FCF "," C C "," C C "," C C "," C C "," FCF "," "," "}, + {" "," "," FCF "," C C "," C C "," C C "," C C "," FCF "," "," "}, + {" "," FCF "," FC CF "," C C "," C C "," C C "," C C "," FC CF "," FCF "," "}, + {" "," FCF "," FC CF "," C C "," C C "," C C "," C C "," FC CF "," FCF "," "}, + {" "," FCF "," FC CF "," C C "," C C "," C C "," C C "," FC CF "," FCF "," "}, + {" "," FCF "," FC CF "," C C "," C C "," C C "," C C "," FC CF "," FCF "," "}, + {" C "," FCF "," CC CC "," C C "," C C "," C C "," C C "," CC CC "," FCF "," C "}, + {" C "," FCF "," CC CC "," C C "," C C "," C C "," C C "," CC CC "," FCF "," C "}, + {" C "," FCF "," CC CC "," C C "," C C "," C C "," C C "," CC CC "," FCF "," C "}, + {" C "," FCF "," CC CC "," CC CC "," CC CC "," CC CC "," CC CC "," CC CC "," FCF "," C "}, + {" C "," FCF "," CC CC "," CC CC "," CC CC "," CC CC "," CC CC "," CC CC "," FCF "," C "}, + {" C "," FCF "," CC CC "," C C "," C C "," C C "," C C "," CC CC "," FCF "," C "}, + {" C "," FCF "," CC CC "," C C "," C C "," C C "," C C "," CC CC "," FCF "," C "}, + {" C "," FCF "," CC CC "," C C "," C C "," C C "," C C "," CC CC "," FCF "," C "}, + {" "," FCF "," FC CF "," C C "," C C "," C C "," C C "," FC CF "," FCF "," "}, + {" "," FCF "," FC CF "," C C "," C C "," C C "," C C "," FC CF "," FCF "," "}, + {" "," FCF "," FC CF "," C C "," C C "," C C "," C C "," FC CF "," FCF "," "}, + {" "," FCF "," FC CF "," C C "," C C "," C C "," C C "," FC CF "," FCF "," "}, + {" "," "," FCF "," C C "," C C "," C C "," C C "," FCF "," "," "}, + {" "," "," FCF "," C C "," C C "," C C "," C C "," FCF "," "," "}, + {" "," "," FCF "," C C "," C C "," C C "," C C "," FCF "," "," "}, + {" "," "," FCF "," C C "," C C "," C C "," C C "," FCF "," "," "}, + {" "," "," FCF "," C C "," C C "," C C "," C C "," FCF "," "," "}, + {" "," "," FCF "," C C "," C C "," C C "," C C "," FCF "," "," "}, + {" "," "," FCF "," C C "," C C "," C C "," C C "," FCF "," "," "}, + {" "," BB~BB "," BBBBBBB ","BBBBBBBBB","BBBBBBBBB","BBBBBBBBB","BBBBBBBBB"," BBBBBBB "," BBBBB "," "} + })) + .addShape(STRUCTURE_PIECE_TIER2, transpose(new String[][] { + {" ", " ", " CC ", " CCCC ", " CCCC ", " CC ", " ", " "}, + {" ", " ", " AA ", " ACCA ", " ACCA ", " AA ", " ", " "}, + {" ", " ", " CC ", " CCCC ", " CCCC ", " CC ", " ", " "}, + {" ", " ", " ", " CC ", " CC ", " ", " ", " "}, + {" ", " ", " ", " CC ", " CC ", " ", " ", " "}, + {" ", " ", " ", " CC ", " CC ", " ", " ", " "}, + {" ", " ", " ", " CC ", " CC ", " ", " ", " "}, + {" ", " ", " CC ", " CCCC ", " CCCC ", " CC ", " ", " "}, + {" ", " ", " AA ", " ACCA ", " ACCA ", " AA ", " ", " "}, + {" ", " ", " CC ", " CCCC ", " CCCC ", " CC ", " ", " "}, + {" ", " ", " ", " CC ", " CC ", " ", " ", " "}, + {" ", " ", " ", " CC ", " CC ", " ", " ", " "}, + {" ", " ", " ", " CC ", " CC ", " ", " ", " "}, + {" ", " ", " ", " CC ", " CC ", " ", " ", " "}, + {" CCCCCC ", "CCCCCCCC", "CCCCCCCC", "CCCCCCCC", "CCCCCCCC", "CCCCCCCC", "CCCCCCCC", " CCCCCC "} + })) + .addShape(STRUCTURE_PIECE_TIER3, transpose(new String[][] { + {" ", " ", " CC ", " CCCC ", " CCCC ", " CC ", " ", " "}, + {" ", " ", " FFAA ", " ACCA ", " ACCA ", " AAFF ", " ", " "}, + {" ", " ", "F CC ", "F CCCC ", " CCCC F", " CC F", " ", " "}, + {" ", " ", " F", " CC F", "F CC ", "F ", " ", " "}, + {" ", " F ", " ", " CC ", " CC ", " ", " F ", " "}, + {" FF ", " ", " ", " CC ", " CC ", " ", " ", " FF "}, + {" FF ", " ", " ", " CC ", " CC ", " ", " ", " FF "}, + {" ", " F ", " ", " CC ", " CC ", " ", " F ", " "}, + {" ", " ", "F ", "F CC ", " CC F", " F", " ", " "}, + {" ", " ", " CC F", " CCCC F", "F CCCC ", "F CC ", " ", " "}, + {" ", " F ", " CC ", " CCCC ", " CCCC ", " CC ", " F ", " "}, + {" FF ", " ", " CC ", " CCCC ", " CCCC ", " CC ", " ", " FF "}, + {" FF ", " ", " CC ", " CCCC ", " CCCC ", " CC ", " ", " FF "}, + {" ", " F ", " ", " CC ", " CC ", " ", " F ", " "}, + {" ", " ", "F ", "F CC ", " CC F", " F", " ", " "}, + {" ", " ", " F", " CC F", "F CC ", "F ", " ", " "}, + {" ", " F ", " ", " CC ", " CC ", " ", " F ", " "}, + {" FF ", " ", " ", " CC ", " CC ", " ", " ", " FF "}, + {" FF ", " ", " ", " CC ", " CC ", " ", " ", " FF "}, + {" ", " F ", " ", " CC ", " CC ", " ", " F ", " "}, + {" ", " ", "F CC ", "F CCCC ", " CCCC F", " CC F", " ", " "}, + {" ", " ", " AA F", " ACCA F", "F ACCA ", "F AA ", " ", " "}, + {" ", " F ", " CC ", " CCCC ", " CCCC ", " CC ", " F ", " "}, + {" FF ", " ", " ", " CC ", " CC ", " ", " ", " FF "}, + {" FF ", " ", " ", " CC ", " CC ", " ", " ", " FF "}, + {" ", " F ", " ", " CC ", " CC ", " ", " F ", " "}, + {" CCCCCC ", "CCCCCCCC", "CCCCCCCC", "CCCCCCCC", "CCCCCCCC", "CCCCCCCC", "CCCCCCCC", " CCCCCC "} + })) + //spotless:on + .addElement('F', ofFrame(Materials.StellarAlloy)) + .addElement('C', ofBlock(GregTech_API.sBlockCasings8, 10)) + .addElement('A', ofBlock(GregTech_API.sBlockCasings2, 5)) + .addElement( + 'B', + buildHatchAdder(GT_MetaTileEntity_NanoForge.class) + .atLeast(InputHatch, OutputBus, InputBus, Maintenance, Energy.or(ExoticEnergy)) + .dot(1) + .casingIndex(((GT_Block_Casings8) GregTech_API.sBlockCasings8).getTextureIndex(10)) + .buildAndChain(GregTech_API.sBlockCasings8, 10)) + .build(); + private byte mSpecialTier = 0; + private boolean mSeparate = false; + + public GT_MetaTileEntity_NanoForge(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); + } + + public GT_MetaTileEntity_NanoForge(String aName) { + super(aName); + } + + @Override + public GT_Recipe.GT_Recipe_Map getRecipeMap() { + return GT_Recipe.GT_Recipe_Map.sNanoForge; + } + + @Override + public void construct(ItemStack stackSize, boolean hintsOnly) { + buildPiece(STRUCTURE_PIECE_MAIN, stackSize, hintsOnly, 4, 37, 1); + if (stackSize.stackSize > 1) { + buildPiece(STRUCTURE_PIECE_TIER2, stackSize, hintsOnly, -7, 14, 4); + } + if (stackSize.stackSize > 2) { + buildPiece(STRUCTURE_PIECE_TIER3, stackSize, hintsOnly, 14, 26, 4); + } + } + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_NanoForge(this.mName); + } + + @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(GT_Utility.getCasingTextureIndex(GregTech_API.sBlockCasings8, 10)), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_ASSEMBLY_LINE_ACTIVE) + .extFacing() + .build(), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_ASSEMBLY_LINE_ACTIVE_GLOW) + .extFacing() + .glow() + .build() + }; + return new ITexture[] { + BlockIcons.getCasingTextureForId(GT_Utility.getCasingTextureIndex(GregTech_API.sBlockCasings8, 10)), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_ASSEMBLY_LINE) + .extFacing() + .build(), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_ASSEMBLY_LINE_GLOW) + .extFacing() + .glow() + .build() + }; + } + return new ITexture[] { + BlockIcons.getCasingTextureForId(GT_Utility.getCasingTextureIndex(GregTech_API.sBlockCasings8, 10)) + }; + } + + @Override + public IStructureDefinition<GT_MetaTileEntity_NanoForge> getStructureDefinition() { + return STRUCTURE_DEFINITION; + } + + @Override + public boolean isCorrectMachinePart(ItemStack aStack) { + return true; + } + + @Override + public boolean checkRecipe(ItemStack aStack) { + GT_Recipe.GT_Recipe_Map map = getRecipeMap(); + FluidStack[] tFluidInputs = getCompactedFluids(); + if (mSeparate) { + ArrayList<ItemStack> tInputList = new ArrayList<ItemStack>(); + for (GT_MetaTileEntity_Hatch_InputBus tBus : mInputBusses) { + for (int i = tBus.getSizeInventory() - 1; i >= 0; i--) { + if (tBus.getStackInSlot(i) != null) tInputList.add(tBus.getStackInSlot(i)); + } + ItemStack[] tInputs = tInputList.toArray(new ItemStack[0]); + if (processRecipe(tInputs, tFluidInputs, map)) return true; + else tInputList.clear(); + } + } else { + ItemStack[] tItemInputs = getStoredInputs().toArray(new ItemStack[0]); + return processRecipe(tItemInputs, tFluidInputs, map); + } + return false; + } + + private boolean processRecipe(ItemStack[] tItemInputs, FluidStack[] tFluidInputs, GT_Recipe.GT_Recipe_Map map) { + lEUt = 0; + mOutputItems = null; + mOutputFluids = null; + long tVoltage = GT_ExoticEnergyInputHelper.getMaxInputVoltageMulti(getExoticAndNormalEnergyHatchList()); + long tAmps = GT_ExoticEnergyInputHelper.getMaxInputAmpsMulti(getExoticAndNormalEnergyHatchList()); + long tTotalEU = tVoltage * tAmps; + GT_Recipe tRecipe = + map.findRecipe(getBaseMetaTileEntity(), null, false, false, tTotalEU, tFluidInputs, null, tItemInputs); + + if (tRecipe == null) return false; + + if (tRecipe.mSpecialValue > mSpecialTier) return false; + + if (tRecipe.isRecipeInputEqual(true, tFluidInputs, tItemInputs)) { + this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); + this.mEfficiencyIncrease = 10000; + this.mMaxProgresstime = tRecipe.mDuration; + this.lEUt = -tRecipe.mEUt; + calculateOverclockedNessMultiInternal( + tRecipe.mEUt, tRecipe.mDuration, 1, tTotalEU, tRecipe.mSpecialValue < mSpecialTier); + + if (this.lEUt == Long.MAX_VALUE - 1 || this.mMaxProgresstime == Integer.MAX_VALUE - 1) return false; + + if (this.lEUt > 0) { + this.lEUt *= -1; + } + + ArrayList<ItemStack> tOutputs = new ArrayList<ItemStack>(); + for (int i = 0; i < tRecipe.mOutputs.length; i++) { + if (getBaseMetaTileEntity().getRandomNumber(10000) < tRecipe.getOutputChance(i)) { + tOutputs.add(tRecipe.getOutput(i)); + } + } + + this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); + mOutputItems = tOutputs.toArray(new ItemStack[0]); + mOutputFluids = tRecipe.mFluidOutputs.clone(); + updateSlots(); + + return true; + } + + return false; + } + + @Override + public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { + mSpecialTier = 0; + if (aStack == null) return false; + if (aStack.isItemEqual(Materials.Carbon.getNanite(1)) && checkPiece(STRUCTURE_PIECE_MAIN, 4, 37, 1)) { + mSpecialTier = 1; + } + + if (aStack.isItemEqual(Materials.Neutronium.getNanite(1)) + && checkPiece(STRUCTURE_PIECE_MAIN, 4, 37, 1) + && checkPiece(STRUCTURE_PIECE_TIER2, -7, 14, 4)) { + mSpecialTier = 2; + } + + if (aStack.isItemEqual(Materials.TranscendentMetal.getNanite(1)) + && checkPiece(STRUCTURE_PIECE_MAIN, 4, 37, 1) + && checkPiece(STRUCTURE_PIECE_TIER2, -7, 14, 4) + && checkPiece(STRUCTURE_PIECE_TIER3, 14, 26, 4)) { + mSpecialTier = 3; + } + + if (mMaintenanceHatches.size() != 1 + || mInputBusses.isEmpty() + || mOutputBusses.isEmpty() + || mInputHatches.isEmpty()) { + return false; + } + + // Makes sure that the multi can accept only 1 TT Energy Hatch OR up to 2 Normal Energy Hatches. Deform if both + // present or more than 1 TT Hatch. + boolean hatch = mExoticEnergyHatches.size() == 1 ^ (mEnergyHatches.size() <= 2 && !mEnergyHatches.isEmpty()); + + return mSpecialTier > 0 && hatch; + } + + @Override + public int getMaxEfficiency(ItemStack aStack) { + return 10000; + } + + @Override + public int getDamageToComponent(ItemStack aStack) { + return 0; + } + + @Override + public boolean explodesOnComponentBreak(ItemStack aStack) { + return false; + } + + @Override + public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) { + if (mMachine) return -1; + int built = 0; + built += survivialBuildPiece(STRUCTURE_PIECE_MAIN, stackSize, 4, 37, 1, elementBudget, env, false, true); + if (stackSize.stackSize > 1) { + built += survivialBuildPiece(STRUCTURE_PIECE_TIER2, stackSize, -7, 14, 4, elementBudget, env, false, true); + } + if (stackSize.stackSize > 2) { + built += survivialBuildPiece(STRUCTURE_PIECE_TIER3, stackSize, 14, 26, 4, elementBudget, env, false, true); + } + return built; + } + + @Override + public void saveNBTData(NBTTagCompound aNBT) { + super.saveNBTData(aNBT); + aNBT.setBoolean("mSeparate", mSeparate); + aNBT.setByte("mSpecialTier", mSpecialTier); + } + + @Override + public void loadNBTData(final NBTTagCompound aNBT) { + super.loadNBTData(aNBT); + mSeparate = aNBT.getBoolean("mSeparate"); + mSpecialTier = aNBT.getByte("mSpecialTier"); + } + + /** Get possible alignments of this controller + * + * @return List of alignments that are possible or denied + */ + @Override + public IAlignmentLimits getAlignmentLimits() { + // The nano forge should only be buildable upright + return IAlignmentLimits.Builder.allowAll() + .deny(ForgeDirection.DOWN) + .deny(ForgeDirection.UP) + .deny(Rotation.UPSIDE_DOWN) + .deny(Rotation.CLOCKWISE) + .deny(Rotation.COUNTER_CLOCKWISE) + .build(); + } + + @Override + protected GT_Multiblock_Tooltip_Builder createTooltip() { + GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); + tt.addMachineType("Nanite Fabricator") + .addInfo("Controller block for the Nano Forge") + .addInfo("Requires insane amounts of power to create nanites. Each tier") + .addInfo("the multi gains a new building next to it. The nanite in the") + .addInfo("controller slot controls the tier.") + .addInfo("--------------------------------------------") + .addInfo("Requires a Carbon Nanite to use tier tier " + EnumChatFormatting.DARK_PURPLE + 1) + .addInfo("Requires a Neutronium Nanite to use tier " + EnumChatFormatting.DARK_PURPLE + 2) + .addInfo("Requires a Transcendent Metal Nanite to use tier " + EnumChatFormatting.DARK_PURPLE + 3) + .addInfo("--------------------------------------------") + .addInfo("If a recipe's tier is lower than the tier of the Nano Forge") + .addInfo("it gains " + EnumChatFormatting.RED + "perfect overclock" + EnumChatFormatting.GRAY + ".") + .addInfo(AuthorBlueWeabo) + .addSeparator() + .beginStructureBlock(30, 38, 13, false) + .addStructureInfo("Nano Forge Structure is too complex! See schematic for details.") + .addStructureInfo("--------------------------------------------") + .addStructureInfo("Tier " + EnumChatFormatting.DARK_PURPLE + 1 + EnumChatFormatting.GRAY) + .addStructureInfo( + EnumChatFormatting.GOLD + "527" + EnumChatFormatting.GRAY + " Radiant Naquadah Alloy Casing") + .addStructureInfo( + EnumChatFormatting.GOLD + "171" + EnumChatFormatting.GRAY + " Stellar Alloy Frame Box") + .addStructureInfo("--------------------------------------------") + .addStructureInfo("Tier " + EnumChatFormatting.DARK_PURPLE + 2 + EnumChatFormatting.GRAY) + .addStructureInfo( + EnumChatFormatting.GOLD + "148" + EnumChatFormatting.GRAY + " Radiant Naquadah Alloy Casing") + .addStructureInfo(EnumChatFormatting.GOLD + "16" + EnumChatFormatting.GRAY + " Assembling Line Casing") + .addStructureInfo("--------------------------------------------") + .addStructureInfo("Tier " + EnumChatFormatting.DARK_PURPLE + 3 + EnumChatFormatting.GRAY) + .addStructureInfo( + EnumChatFormatting.GOLD + "228" + EnumChatFormatting.GRAY + " Radiant Naquadah Alloy Casing") + .addStructureInfo(EnumChatFormatting.GOLD + "84" + EnumChatFormatting.GRAY + " Stellar Alloy Frame Box") + .addStructureInfo(EnumChatFormatting.GOLD + "16" + EnumChatFormatting.GRAY + " Assembling Line Casing") + .addStructureInfo("--------------------------------------------") + .addStructureInfo("Requires " + EnumChatFormatting.GOLD + "1" + EnumChatFormatting.GRAY + "-" + + EnumChatFormatting.GOLD + "2" + EnumChatFormatting.GRAY + " energy hatches or " + + EnumChatFormatting.GOLD + "1" + EnumChatFormatting.GRAY + " TT energy hatch.") + .addStructureInfo( + "Requires " + EnumChatFormatting.GOLD + "1" + EnumChatFormatting.GRAY + " maintenance hatch.") + .addStructureInfo("Requires " + EnumChatFormatting.GOLD + 0 + EnumChatFormatting.GRAY + "+" + + EnumChatFormatting.GRAY + " input hatches.") + .addStructureInfo("Requires " + EnumChatFormatting.GOLD + 0 + EnumChatFormatting.GRAY + "+" + + EnumChatFormatting.GRAY + " output hatches.") + .addStructureInfo("Requires " + EnumChatFormatting.GOLD + 1 + EnumChatFormatting.GRAY + "+" + + EnumChatFormatting.GRAY + " input busses.") + .addStructureInfo("Requires " + EnumChatFormatting.GOLD + 1 + EnumChatFormatting.GRAY + "+" + + EnumChatFormatting.GRAY + " output busses.") + .addStructureInfo("--------------------------------------------") + .toolTipFinisher("GregTech"); + return tt; + } + + @Override + public final void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + mSeparate = !mSeparate; + GT_Utility.sendChatToPlayer( + aPlayer, StatCollector.translateToLocal("GT5U.machines.separatebus") + " " + mSeparate); + } +} diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PCBFactory.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PCBFactory.java new file mode 100644 index 0000000000..8b9cb2c373 --- /dev/null +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PCBFactory.java @@ -0,0 +1,1120 @@ +package gregtech.common.tileentities.machines.multi; + +import static com.gtnewhorizon.structurelib.structure.StructureUtility.*; +import static gregtech.api.enums.GT_HatchElement.*; +import static gregtech.api.enums.GT_Values.AuthorBlueWeabo; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ASSEMBLY_LINE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ASSEMBLY_LINE_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ASSEMBLY_LINE_ACTIVE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ASSEMBLY_LINE_GLOW; +import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; +import static gregtech.api.util.GT_StructureUtility.ofFrame; + +import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; +import com.gtnewhorizon.structurelib.alignment.enumerable.ExtendedFacing; +import com.gtnewhorizon.structurelib.alignment.enumerable.Flip; +import com.gtnewhorizon.structurelib.alignment.enumerable.Rotation; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; +import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; +import com.gtnewhorizon.structurelib.structure.StructureDefinition; +import com.gtnewhorizons.modularui.api.drawable.Text; +import com.gtnewhorizons.modularui.api.math.Alignment; +import com.gtnewhorizons.modularui.api.math.Color; +import com.gtnewhorizons.modularui.api.screen.ModularWindow; +import com.gtnewhorizons.modularui.api.screen.UIBuildContext; +import com.gtnewhorizons.modularui.common.widget.ButtonWidget; +import com.gtnewhorizons.modularui.common.widget.CycleButtonWidget; +import com.gtnewhorizons.modularui.common.widget.DrawableWidget; +import com.gtnewhorizons.modularui.common.widget.DynamicPositionedColumn; +import com.gtnewhorizons.modularui.common.widget.DynamicPositionedRow; +import com.gtnewhorizons.modularui.common.widget.MultiChildWidget; +import com.gtnewhorizons.modularui.common.widget.TextWidget; +import com.gtnewhorizons.modularui.common.widget.textfield.TextFieldWidget; +import gregtech.api.GregTech_API; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.enums.Textures.BlockIcons; +import gregtech.api.gui.modularui.GT_UITextures; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.GregTechTileClientEvents; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_ExtendedPowerMultiBlockBase; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus; +import gregtech.api.render.TextureFactory; +import gregtech.api.util.GT_ExoticEnergyInputHelper; +import gregtech.api.util.GT_ModHandler; +import gregtech.api.util.GT_Multiblock_Tooltip_Builder; +import gregtech.api.util.GT_OreDictUnificator; +import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Utility; +import gregtech.common.blocks.GT_Block_Casings8; +import java.util.ArrayList; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumChatFormatting; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidRegistry; +import net.minecraftforge.fluids.FluidStack; + +@SuppressWarnings("SpellCheckingInspection") +public class GT_MetaTileEntity_PCBFactory + extends GT_MetaTileEntity_ExtendedPowerMultiBlockBase<GT_MetaTileEntity_PCBFactory> + implements ISurvivalConstructable { + private static final String tier1 = "tier1"; + private static final String tier2 = "tier2"; + private static final String tier3 = "tier3"; + private static final String bioUpgrade = "bioUpgrade"; + private static final String ocTier1Upgrade = "ocTier1Upgrade"; + private static final String ocTier2Upgrade = "ocTier2Upgrade"; + private boolean mSeparate = false; + private float mRoughnessMultiplier = 1; + private int mTier = 1, mSetTier = 1, mUpgradesInstalled = 0; + private boolean mBioUpgrade = false, mBioRotate = false, mOCTier1 = false, mOCTier2 = false; + private int[] mBioOffsets = new int[] {-5, -1}, + mOCTier1Offsets = new int[] {2, -11}, + mOCTier2Offsets = new int[] {2, -11}; + private GT_MetaTileEntity_Hatch_Input mCoolantInputHatch; + private static final int mBioBitMap = 0b1000; + private static final int mTier3BitMap = 0b100; + private static final int mTier2BitMap = 0b10; + private static final int mTier1BitMap = 0b1; + private static final int COOLANT_CONSUMED_PER_SEC = 10; + private static final IStructureDefinition<GT_MetaTileEntity_PCBFactory> STRUCTURE_DEFINITION = + StructureDefinition.<GT_MetaTileEntity_PCBFactory>builder() + .addShape(tier1, transpose(new String[][] { + // spotless:off + {" ","E E","E E","EEEEEEE","E E","E E"," "}, + {"EEEEEEE","CAAAAAC","CAAAAAC","CCCCCCC","CCCCCCC","CCCCCCC","E E"}, + {"EAAAAAE","C-----C","C-----C","C-----C","C-----C","C-----C","ECCCCCE"}, + {"EAAAAAE","C-----C","B-----B","B-----B","B-----B","C-----C","ECCCCCE"}, + {"EAAAAAE","C-----C","B-FFF-B","B-FFF-B","B-FFF-B","C-----C","EPPPPPE"}, + {"ECC~CCE","CDDDDDC","CDDDDDC","CDDDDDC","CDDDDDC","CDDDDDC","EPPPPPE"} + //spotless:on + })) + .addShape(tier2, transpose(new String[][] { + // spotless:off + {" "," "," ","HGGH","HGGH","HGGH","HGGH","HGGH"," "," "," "}, + {" "," ","HGGH","GGGG","GGGG","GGGG","GGGG","GGGG","HGGH"," "," "}, + {" ","HGGH","GGGG","G G","G G","G G","G G","G G","GGGG","HGGH"," "}, + {" ","HGGH","G G","G G","G G","G G","G G","G G","G G","HGGH"," "}, + {"HGGH","G G","G G","G G","G G","G G","G G","G G","G G","G G","HGGH"}, + {"HGGH","G G","G G","G G","G G","G G","G G","G G","G G","G G","HGGH"}, + {"HGGH","GGGG","GGGG","GGGG","GGGG","GGGG","GGGG","GGGG","GGGG","GGGG","HGGH"} + //spotless:on + })) + .addShape(tier3, transpose(new String[][] { + // spotless:off + {" "," "," "," "," I "," I "," "," "," "," "}, + {" "," "," "," I "," I "," I "," I "," "," "," "}, + {" "," "," KKK "," KIK "," K K "," K K "," I "," "," "," "}, + {" "," "," KKK "," K K "," K K "," K K "," I "," "," "," "}, + {" "," III "," I I "," I I "," I I "," K K "," I "," "," "," "}, + {" "," III "," I I "," I I "," I I "," K K "," I "," "," "," "}, + {" "," III "," I I "," I I "," I I "," K K "," KIK "," "," "," "}, + {" "," I I "," I K I "," I I "," I I "," K K "," KIK "," "," "," "}, + {" "," I I "," I K I "," I I "," I I "," K K "," K K "," KKK "," "," "}, + {" "," I I "," I K I "," I I "," I I "," K K "," K K "," KKK "," "," "}, + {" "," III "," I I "," I I "," I I "," I I "," I I "," I I "," III "," "}, + {" "," III "," I I "," K K "," K K "," K K "," K K "," I I "," III "," "}, + {" "," III "," I I "," I I "," I I "," I I "," I I "," I I "," III "," "}, + {" "," "," KKK "," K K "," K K "," I I "," I I "," I I "," III "," "}, + {" "," "," KKK "," K K "," K K "," I I "," I I "," I I "," III "," "}, + {" "," "," KKK "," K K "," K K "," I I "," I I "," I I "," III "," "}, + {" "," III "," I I "," I I "," I I "," I I "," I I "," I I "," III "," "}, + {" "," III "," I I "," I I "," I I "," I I "," I I "," I I "," III "," "}, + {" "," III "," I I "," I I "," I I "," I I "," I I "," I I "," III "," "}, + {" "," III "," I I "," I I "," I I "," I I "," I I "," I I "," III "," "}, + {" "," III "," I I "," I I "," I I "," I I "," I I "," I I "," III "," "}, + {" II~II ","IIJJJII","IJJJJJI","IJJJJJI","IJJJJJI","IJJJJJI","IJJJJJI","IJJJJJI","IIJJJII"," IIIII "} + //spotless:on + })) + .addShape(bioUpgrade, transpose(new String[][] { + // spotless:off + {" "," "," LLLLLL "," "," "}, + {" "," "," L L "," "," "}, + {"E E E E"," LLL LLL "," LLL LLL "," LLL LLL ","E E E E"}, + {"EAAAE EAAAE","A A A A","A A A A","A A A A","EAAAE EAAAE"}, + {"EAAAE EAAAE","A A A A","A A A A","A A A A","EAAAE EAAAE"}, + {"EAAAE EAAAE","A A A A","A A A A","A A A A","EAAAE EAAAE"}, + {"ELLLE ELLLE","LLLLL LLLLL","LLLLL LLLLL","LLLLL LLLLL","ELLLE ELLLE"} + //spotless:on + })) + .addShape(ocTier1Upgrade, transpose(new String[][] { + // spotless:off + {"EKKKE","K K","K K","K K","EKKKE"}, + {"E E"," KKK "," K K "," KKK ","E E"}, + {"E E"," NNN "," N N "," NNN ","E E"}, + {"E E"," KKK "," K K "," KKK ","E E"}, + {"E E"," KKK "," K K "," KKK ","E E"}, + {"EOOOE","OKKKO","OK KO","OKKKO","EOOOE"}, + {"E E"," KKK "," K K "," KKK ","E E"}, + {"E E"," KKK "," K K "," KKK ","E E"}, + {"ENNNE","NKKKN","NK KN","NKKKN","ENNNE"}, + {"EMMME","MMMMM","MMMMM","MMMMM","EMMME"} + //spotless:on + })) + .addShape(ocTier2Upgrade, transpose(new String[][] { + // spotless:off + {"RGGGR","G G","G G","G G","RGGGR"}, + {"R R"," GGG "," GTG "," GGG ","R R"}, + {"R R"," NNN "," NTN "," NNN ","R R"}, + {"R R"," QQQ "," QTQ "," QQQ ","R R"}, + {"R R"," QQQ "," QTQ "," QQQ ","R R"}, + {"R R"," QQQ "," QTQ "," QQQ ","R R"}, + {"R R"," QQQ "," QTQ "," QQQ ","R R"}, + {"R R"," QQQ "," QTQ "," QQQ ","R R"}, + {"RNNNR","NQQQN","NQPQN","NQQQN","RNNNR"}, + {"RSSSR","SSSSS","SSSSS","SSSSS","RSSSR"} + //spotless:on + })) + .addElement('E', ofFrame(Materials.DamascusSteel)) + .addElement('C', ofBlock(GregTech_API.sBlockCasings8, 11)) + .addElement('D', ofBlock(GregTech_API.sBlockReinforced, 2)) + .addElement( + 'A', + ofChain( + ofBlockUnlocalizedName("IC2", "blockAlloyGlass", 0, true), + ofBlockUnlocalizedName("bartworks", "BW_GlasBlocks", 0, true), + ofBlockUnlocalizedName("bartworks", "BW_GlasBlocks2", 0, true), + // warded glass + ofBlockUnlocalizedName("Thaumcraft", "blockCosmeticOpaque", 2, false))) + .addElement('B', ofBlock(GregTech_API.sBlockCasings3, 10)) + .addElement('F', ofFrame(Materials.VibrantAlloy)) + .addElement( + 'P', + buildHatchAdder(GT_MetaTileEntity_PCBFactory.class) + .atLeast(InputHatch, OutputBus, InputBus, Maintenance, Energy.or(ExoticEnergy)) + .dot(1) + .casingIndex(((GT_Block_Casings8) GregTech_API.sBlockCasings8).getTextureIndex(11)) + .buildAndChain(GregTech_API.sBlockCasings8, 11)) + .addElement('H', ofFrame(Materials.Duranium)) + .addElement('G', ofBlock(GregTech_API.sBlockCasings8, 12)) + .addElement('I', ofBlock(GregTech_API.sBlockCasings8, 13)) + .addElement('K', ofBlock(GregTech_API.sBlockCasings8, 10)) + .addElement( + 'J', + buildHatchAdder(GT_MetaTileEntity_PCBFactory.class) + .atLeast(InputHatch, OutputBus, InputBus, Maintenance, Energy.or(ExoticEnergy)) + .dot(1) + .casingIndex(((GT_Block_Casings8) GregTech_API.sBlockCasings8).getTextureIndex(13)) + .buildAndChain(GregTech_API.sBlockCasings8, 13)) + .addElement('L', ofBlock(GregTech_API.sBlockCasings4, 1)) + .addElement( + 'M', + // spotless:off + ofChain( + ofChain(InputHatch.withAdder(GT_MetaTileEntity_PCBFactory::addCoolantInputToMachineList) + .withCount(t -> isValidMetaTileEntity(t.mCoolantInputHatch) ? 1 : 0) + .newAny(((GT_Block_Casings8) GregTech_API.sBlockCasings8).getTextureIndex(10),2), + ofBlock(GregTech_API.sBlockCasings8, 12)))) + //spotless:on + .addElement('N', ofBlock(GregTech_API.sBlockCasings2, 15)) + .addElement('O', ofBlock(GregTech_API.sBlockCasings8, 4)) + .addElement( + 'S', + // spotless:off + ofChain(InputHatch.withAdder(GT_MetaTileEntity_PCBFactory::addCoolantInputToMachineList) + .withCount(t -> isValidMetaTileEntity(t.mCoolantInputHatch) ? 1 : 0) + .newAny(((GT_Block_Casings8) GregTech_API.sBlockCasings8).getTextureIndex(12),2), + ofBlock(GregTech_API.sBlockCasings8, 12))) + //spotless:on + .addElement('R', ofFrame(Materials.Americium)) + .addElement('Q', ofBlock(GregTech_API.sBlockCasings8, 14)) + .addElement('T', ofBlock(GregTech_API.sBlockCasings1, 15)) + .build(); + + @Override + public void construct(ItemStack stackSize, boolean hintsOnly) { + if (mSetTier < 3) { + buildPiece(tier1, stackSize, hintsOnly, 3, 5, 0); + if (mSetTier == 2) { + buildPiece(tier2, stackSize, hintsOnly, 7, 6, 2); + } + } else { + buildPiece(tier3, stackSize, hintsOnly, 3, 21, 0); + } + + if (mBioUpgrade) { + if (mBioRotate) { + final IGregTechTileEntity tTile = getBaseMetaTileEntity(); + getStructureDefinition() + .buildOrHints( + this, + stackSize, + bioUpgrade, + tTile.getWorld(), + transformFacing(getExtendedFacing()), + tTile.getXCoord(), + tTile.getYCoord(), + tTile.getZCoord(), + mBioOffsets[1], + 6, + mBioOffsets[0], + hintsOnly); + } else { + buildPiece(bioUpgrade, stackSize, hintsOnly, mBioOffsets[0], 6, mBioOffsets[1]); + } + } + + if (mOCTier1 && !mOCTier2) { + buildPiece(ocTier1Upgrade, stackSize, hintsOnly, mOCTier1Offsets[0], 9, mOCTier1Offsets[1]); + } + + if (!mOCTier1 && mOCTier2) { + buildPiece(ocTier2Upgrade, stackSize, hintsOnly, mOCTier2Offsets[0], 9, mOCTier2Offsets[1]); + } + } + + public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) { + if (mMachine) return -1; + int built = 0; + if (mSetTier < 3) { + built += survivialBuildPiece(tier1, stackSize, 3, 5, 0, elementBudget, env, false, true); + if (mSetTier == 2) { + built += survivialBuildPiece(tier2, stackSize, 7, 6, 2, elementBudget, env, false, true); + } + } else { + built += survivialBuildPiece(tier3, stackSize, 3, 21, 0, elementBudget, env, false, true); + } + + if (mBioUpgrade) { + if (mBioRotate) { + final IGregTechTileEntity tTile = getBaseMetaTileEntity(); + getStructureDefinition() + .survivalBuild( + this, + stackSize, + bioUpgrade, + tTile.getWorld(), + transformFacing(getExtendedFacing()), + tTile.getXCoord(), + tTile.getYCoord(), + tTile.getZCoord(), + mBioOffsets[1], + 6, + mBioOffsets[0], + elementBudget, + env, + false); + } else { + built += survivialBuildPiece( + bioUpgrade, stackSize, mBioOffsets[0], 6, mBioOffsets[2], elementBudget, env, false, true); + } + } + + if (mOCTier1 && !mOCTier2) { + built += survivialBuildPiece( + ocTier1Upgrade, + stackSize, + mOCTier1Offsets[0], + 9, + mOCTier1Offsets[1], + elementBudget, + env, + false, + true); + } + if (!mOCTier1 && mOCTier2) { + built += survivialBuildPiece( + ocTier2Upgrade, + stackSize, + mOCTier2Offsets[0], + 9, + mOCTier2Offsets[1], + elementBudget, + env, + false, + true); + } + + return built; + } + + public GT_MetaTileEntity_PCBFactory(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); + } + + public GT_MetaTileEntity_PCBFactory(String aName) { + super(aName); + } + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_PCBFactory(this.mName); + } + + @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( + getTier() < 3 + ? GT_Utility.getCasingTextureIndex(GregTech_API.sBlockCasings8, 11) + : GT_Utility.getCasingTextureIndex(GregTech_API.sBlockCasings8, 11)), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_ASSEMBLY_LINE_ACTIVE) + .extFacing() + .build(), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_ASSEMBLY_LINE_ACTIVE_GLOW) + .extFacing() + .glow() + .build() + }; + return new ITexture[] { + BlockIcons.getCasingTextureForId( + getTier() < 3 + ? GT_Utility.getCasingTextureIndex(GregTech_API.sBlockCasings8, 11) + : GT_Utility.getCasingTextureIndex(GregTech_API.sBlockCasings8, 11)), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_ASSEMBLY_LINE) + .extFacing() + .build(), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_ASSEMBLY_LINE_GLOW) + .extFacing() + .glow() + .build() + }; + } + return new ITexture[] { + BlockIcons.getCasingTextureForId( + mSetTier < 3 + ? ((GT_Block_Casings8) GregTech_API.sBlockCasings8).getTextureIndex(11) + : ((GT_Block_Casings8) GregTech_API.sBlockCasings8).getTextureIndex(13)) + }; + } + + @Override + public IStructureDefinition<GT_MetaTileEntity_PCBFactory> getStructureDefinition() { + return STRUCTURE_DEFINITION; + } + + @Override + public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { + mTier = 0; + if (mSetTier < 3) { + if (!checkPiece(tier1, 3, 5, 0)) { + return false; + } + + if (mSetTier == 2 && checkPiece(tier2, 7, 6, 2)) { + mTier = 2; + } else { + mTier = 1; + } + } else { + if (!checkPiece(tier3, 3, 21, 0)) { + return false; + } + mTier = 3; + } + + if (mBioUpgrade) { + if (mBioRotate) { + final IGregTechTileEntity tTile = getBaseMetaTileEntity(); + if (!getStructureDefinition() + .check( + this, + bioUpgrade, + tTile.getWorld(), + transformFacing(getExtendedFacing()), + tTile.getXCoord(), + tTile.getYCoord(), + tTile.getZCoord(), + mBioOffsets[1], + 6, + mBioOffsets[0], + !mMachine)) { + return false; + } + } else { + if (!checkPiece(bioUpgrade, mBioOffsets[0], 6, mBioOffsets[1])) { + return false; + } + } + mUpgradesInstalled++; + } + + if (mOCTier1 && !mOCTier2) { + if (!checkPiece(ocTier1Upgrade, mOCTier1Offsets[0], 9, mOCTier1Offsets[1])) { + return false; + } + mUpgradesInstalled++; + } + + if (mOCTier2 && !mOCTier1) { + if (!checkPiece(ocTier2Upgrade, mOCTier2Offsets[0], 9, mOCTier2Offsets[1])) { + return false; + } + mUpgradesInstalled++; + } + + getBaseMetaTileEntity().sendBlockEvent(GregTechTileClientEvents.CHANGE_CUSTOM_DATA, getUpdateData()); + + if (mMaintenanceHatches.size() != 1 + || mOutputBusses.isEmpty() + || mInputBusses.isEmpty() + || mInputHatches.isEmpty()) { + return false; + } + + // Makes sure that the multi can accept only 1 TT Energy Hatch OR up to 2 Normal Energy Hatches. Deform if both + // present or more than 1 TT Hatch. + boolean hatch = mExoticEnergyHatches.size() == 1 ^ (mEnergyHatches.size() <= 2 && !mEnergyHatches.isEmpty()); + + return mTier > 0 && hatch; + } + + @Override + public GT_Recipe.GT_Recipe_Map getRecipeMap() { + return GT_Recipe.GT_Recipe_Map.sPCBFactory; + } + + @Override + public boolean checkRecipe(ItemStack aStack) { + GT_Recipe.GT_Recipe_Map aMap = getRecipeMap(); + FluidStack[] tFluidInputs = getCompactedFluids(); + if (mSeparate) { + ArrayList<ItemStack> tInputList = new ArrayList<ItemStack>(); + for (GT_MetaTileEntity_Hatch_InputBus tBus : mInputBusses) { + for (int i = tBus.getSizeInventory() - 1; i >= 0; i--) { + if (tBus.getStackInSlot(i) != null) tInputList.add(tBus.getStackInSlot(i)); + } + ItemStack[] tInputs = tInputList.toArray(new ItemStack[0]); + if (processRecipe(aStack, tInputs, tFluidInputs, aMap)) return true; + else tInputList.clear(); + } + } else { + ItemStack[] tItemInputs = getStoredInputs().toArray(new ItemStack[0]); + return processRecipe(aStack, tItemInputs, tFluidInputs, aMap); + } + + return false; + } + + private boolean processRecipe( + ItemStack aStack, ItemStack[] tItemInputs, FluidStack[] aFluidInputs, GT_Recipe.GT_Recipe_Map aMap) { + mOutputItems = null; + mOutputFluids = null; + if (tItemInputs == null || aFluidInputs == null) { + return false; + } + + long voltage = GT_ExoticEnergyInputHelper.getMaxInputVoltageMulti(getExoticAndNormalEnergyHatchList()); + long amps = GT_ExoticEnergyInputHelper.getMaxInputAmpsMulti(getExoticAndNormalEnergyHatchList()); + long tTotalEU = voltage * amps; + + GT_Recipe tRecipe = aMap.findRecipe(getBaseMetaTileEntity(), true, true, voltage, aFluidInputs, tItemInputs); + + if (tRecipe == null) { + return false; + } + + int recipeBitMap = tRecipe.mSpecialValue; + + int aNanitesOfRecipe = 0; + + ItemStack aNanite = tRecipe.getRepresentativeInput(0); + if (GT_OreDictUnificator.getAssociation(aNanite).mPrefix.equals(OrePrefixes.nanite)) { + for (ItemStack aItem : tItemInputs) { + if (aItem.isItemEqual(aNanite)) { + aNanitesOfRecipe += aItem.stackSize; + } + } + } + + int aMaxParallel = (int) Math.max(Math.ceil(Math.log(aNanitesOfRecipe) / Math.log(2)), 1); + float aExtraPower = (float) Math.ceil(Math.sqrt(mUpgradesInstalled == 0 ? 1 : mUpgradesInstalled)); + + if (tRecipe.mEUt > voltage) { + return false; + } + + if (((recipeBitMap & mTier1BitMap) == 1 + || (recipeBitMap & mTier2BitMap) == 1 + || (recipeBitMap & mTier3BitMap) == 1) + && ((recipeBitMap & mBioBitMap) == 0 || (recipeBitMap & mBioBitMap) == 1 == mBioUpgrade)) { + + int aCurrentParallel = 0; + for (int i = 0; i < aMaxParallel; i++) { + if (tRecipe.isRecipeInputEqual(true, aFluidInputs, tItemInputs)) { + aCurrentParallel++; + } else { + break; + } + } + + if (aCurrentParallel > 0) { + this.mEfficiency = (getMaxEfficiency(aStack) - (getIdealStatus() - getRepairStatus()) * 1000); + this.mEfficiencyIncrease = getMaxEfficiency(aStack); + this.lEUt = (long) -Math.ceil(tRecipe.mEUt * aCurrentParallel * aExtraPower); + this.mMaxProgresstime = (int) Math.ceil(tRecipe.mDuration * Math.pow(mRoughnessMultiplier, 2)); + + if (mOCTier1 || mOCTier2) { + calculateOverclockedNessMultiInternal( + (long) Math.ceil(tRecipe.mEUt * aCurrentParallel * aExtraPower), + (int) Math.ceil(tRecipe.mDuration * Math.pow(mRoughnessMultiplier, 2)), + 1, + tTotalEU, + mOCTier2); + } + + if (this.lEUt == Long.MAX_VALUE - 1 || this.mProgresstime == Integer.MAX_VALUE - 1) return false; + + if (this.lEUt > 0) { + this.lEUt *= -1; + } + + mOutputItems = new ItemStack[tRecipe.mOutputs.length]; + ArrayList<ItemStack> tOutputs = new ArrayList<ItemStack>(); + int remainingEfficiency = getMaxEfficiency(aStack); + int repeats = (int) Math.ceil(getMaxEfficiency(aStack) / 10000); + for (int j = 0; j < repeats; j++) { + int chanced = getBaseMetaTileEntity().getRandomNumber(10000); + for (int i = 0; i < tRecipe.mOutputs.length; i++) { + if (chanced < remainingEfficiency) { + tOutputs.add(tRecipe.getOutput(i)); + } + } + remainingEfficiency -= 10000; + } + + mOutputItems = tOutputs.toArray(new ItemStack[0]); + mOutputFluids = tRecipe.mFluidOutputs.clone(); + updateSlots(); + + return true; + } + } + + return false; + } + + private int ticker = 0; + + @Override + public boolean onRunningTick(ItemStack aStack) { + if (!super.onRunningTick(aStack)) { + criticalStopMachine(); + return false; + } + + if (ticker % 20 == 0) { + if (mOCTier1) { + if (!depleteInput(GT_ModHandler.getDistilledWater(COOLANT_CONSUMED_PER_SEC))) { + criticalStopMachine(); + return false; + } + } + + if (mOCTier2) { + Fluid superCoolant = FluidRegistry.getFluid("supercoolant"); + if (!depleteInput(new FluidStack(superCoolant, COOLANT_CONSUMED_PER_SEC))) { + criticalStopMachine(); + return false; + } + } + ticker = 0; + } + + ticker++; + + return true; + } + + @Override + public int getMaxEfficiency(ItemStack aStack) { + return (int) (mRoughnessMultiplier * 10000); + } + + @Override + public int getDamageToComponent(ItemStack aStack) { + return 0; + } + + private int getTier() { + return mSetTier; + } + + @Override + public void receiveClientEvent(byte aEventID, byte aValue) { + if (aEventID == 1) { + mSetTier = aValue; + } + } + + private ExtendedFacing transformFacing(ExtendedFacing facing) { + ForgeDirection curDirection = facing.getDirection(); + Rotation curRotation = facing.getRotation(); + Flip curFlip = facing.getFlip(); + ForgeDirection newDirection = curDirection; + Rotation newRotation = curRotation; + Flip newFlip = curFlip; + + if (curDirection == ForgeDirection.UP || curDirection == ForgeDirection.DOWN) { + switch (curRotation) { + case CLOCKWISE: + case COUNTER_CLOCKWISE: + newFlip = curFlip == Flip.NONE ? Flip.HORIZONTAL : Flip.NONE; + newDirection = curDirection == ForgeDirection.UP ? ForgeDirection.NORTH : ForgeDirection.SOUTH; + break; + case NORMAL: + newRotation = curDirection == ForgeDirection.UP ? Rotation.CLOCKWISE : Rotation.COUNTER_CLOCKWISE; + newDirection = curDirection == ForgeDirection.UP ? ForgeDirection.EAST : ForgeDirection.WEST; + newFlip = Flip.NONE; + break; + case UPSIDE_DOWN: + newRotation = curDirection == ForgeDirection.UP ? Rotation.COUNTER_CLOCKWISE : Rotation.CLOCKWISE; + newDirection = curDirection == ForgeDirection.UP ? ForgeDirection.EAST : ForgeDirection.WEST; + newFlip = Flip.NONE; + break; + } + } else if (curRotation == Rotation.CLOCKWISE || curRotation == Rotation.COUNTER_CLOCKWISE) { + newFlip = curRotation == Rotation.CLOCKWISE + ? curFlip == Flip.NONE ? Flip.NONE : Flip.HORIZONTAL + : curFlip != Flip.NONE ? Flip.NONE : Flip.HORIZONTAL; + newDirection = curRotation == Rotation.CLOCKWISE ? ForgeDirection.UP : ForgeDirection.DOWN; + } else { + switch (curDirection) { + case EAST: + newDirection = ForgeDirection.SOUTH; + break; + case NORTH: + newDirection = ForgeDirection.EAST; + break; + case WEST: + newDirection = ForgeDirection.NORTH; + break; + case SOUTH: + newDirection = ForgeDirection.WEST; + break; + default: + newDirection = curDirection; + } + } + + if (curRotation == Rotation.UPSIDE_DOWN) { + if (curDirection != ForgeDirection.UP && curDirection != ForgeDirection.DOWN) { + newFlip = curFlip == Flip.NONE ? Flip.HORIZONTAL : Flip.NONE; + } + } + + return ExtendedFacing.of(newDirection, newRotation, newFlip); + } + + @Override + public boolean explodesOnComponentBreak(ItemStack aStack) { + return false; + } + + public boolean addCoolantInputToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { + if (aTileEntity == null) return false; + IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) return false; + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); + ((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity).mRecipeMap = getRecipeMap(); + mCoolantInputHatch = (GT_MetaTileEntity_Hatch_Input) aMetaTileEntity; + return true; + } + return false; + } + + @Override + protected GT_Multiblock_Tooltip_Builder createTooltip() { + GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); + tt.addMachineType("Circuit Board Fabricator") + .addInfo("Controller block for the PCB Factory") + .addInfo(EnumChatFormatting.GOLD.toString() + EnumChatFormatting.BOLD + "IMPORTANT!" + + " Check out the configurations menu before building.") + .addInfo("The tier is selected in the controller GUI. Determines avaliable recipes.") + .addInfo("The configuration menu can be used to add upgrades.") + .addInfo("The parallel of the current recipe is Logâ‚‚(nanites used), rounded up.") + .addInfo("Coolant tier determines overclock ability. No cooler allows no overclocking.") + .addInfo("Tier " + EnumChatFormatting.DARK_PURPLE + 1 + EnumChatFormatting.GRAY + + " cooler allows regular overclocking, takes 10L/s of coolant.") + .addInfo("Tier " + EnumChatFormatting.DARK_PURPLE + 2 + EnumChatFormatting.GRAY + + " allows perfect overclocking, takes 10L/s of space coolant.") + .addInfo("Machine power consumption multiplies by sqrt(upgrade count).") + .addInfo("I.e. cooler + bio upgrade = sqrt(2) power consumption multiplier.") + .addInfo(AuthorBlueWeabo) + .beginStructureBlock(30, 38, 13, false) + .addSeparator() + .addMaintenanceHatch(EnumChatFormatting.GOLD + "1", 1) + .addEnergyHatch(EnumChatFormatting.GOLD + "1" + EnumChatFormatting.GRAY + "+", 1) + .addInputBus(EnumChatFormatting.GOLD + "1" + EnumChatFormatting.GRAY + "+", 1) + .addOutputBus(EnumChatFormatting.GOLD + "1" + EnumChatFormatting.GRAY + "+", 1) + .addInputHatch(EnumChatFormatting.GOLD + "1" + EnumChatFormatting.GRAY + "+", 1) + .addStructureInfo("Coolant Hatch (Input Hatch): " + EnumChatFormatting.GOLD + "1") + .addStructureInfo(EnumChatFormatting.BLUE + "Base Multi (Tier " + EnumChatFormatting.DARK_PURPLE + 1 + + EnumChatFormatting.BLUE + "):") + .addStructureInfo( + EnumChatFormatting.GOLD + "40" + EnumChatFormatting.GRAY + " Damascus Steel Frame Box") + .addStructureInfo(EnumChatFormatting.GOLD + "9" + EnumChatFormatting.GRAY + " Vibrant Alloy Frame Box") + .addStructureInfo(EnumChatFormatting.GOLD + "25" + EnumChatFormatting.GRAY + " Reinforced Glass") + .addStructureInfo(EnumChatFormatting.GOLD + "77" + EnumChatFormatting.GRAY + + " Basic Photolithography Framework Casing") + .addStructureInfo(EnumChatFormatting.GOLD + "12" + EnumChatFormatting.GRAY + " Grate Machine Casing") + .addStructureInfo(EnumChatFormatting.GOLD + "25" + EnumChatFormatting.GRAY + " Plascrete Block") + .addStructureInfo(EnumChatFormatting.BLUE + "Tier " + EnumChatFormatting.DARK_PURPLE + 2 + + EnumChatFormatting.BLUE + " (Adds to Tier " + EnumChatFormatting.DARK_PURPLE + 1 + + EnumChatFormatting.BLUE + "):") + .addStructureInfo(EnumChatFormatting.GOLD + "34" + EnumChatFormatting.GRAY + " Duranium Frame Box") + .addStructureInfo(EnumChatFormatting.GOLD + "158" + EnumChatFormatting.GRAY + + " Reinforced Photolithography Framework Casing") + .addStructureInfo(EnumChatFormatting.BLUE + "Tier " + EnumChatFormatting.DARK_PURPLE + 3 + + EnumChatFormatting.BLUE + ":") + .addStructureInfo(EnumChatFormatting.GOLD + "292" + EnumChatFormatting.GRAY + + " Radiation Proof Photolithography Framework Casing") + .addStructureInfo( + EnumChatFormatting.GOLD + "76" + EnumChatFormatting.GRAY + " Radiant Naquadah Alloy Casing") + .addStructureInfo(EnumChatFormatting.BLUE + "Bio Upgrade") + .addStructureInfo(EnumChatFormatting.GOLD + "68" + EnumChatFormatting.GRAY + + " Clean Stainless Steel Machine Casing") + .addStructureInfo( + EnumChatFormatting.GOLD + "40" + EnumChatFormatting.GRAY + " Damascus Steel Frame Box") + .addStructureInfo(EnumChatFormatting.GOLD + "72" + EnumChatFormatting.GRAY + " Reinforced Glass") + .addStructureInfo(EnumChatFormatting.BLUE + "Cooler Upgrade Tier " + EnumChatFormatting.DARK_PURPLE + 1 + + EnumChatFormatting.BLUE + ":") + .addStructureInfo( + EnumChatFormatting.GOLD + "40" + EnumChatFormatting.GRAY + " Damascus Steel Frame Box") + .addStructureInfo( + EnumChatFormatting.GOLD + "68" + EnumChatFormatting.GRAY + " Radiant Naquadah Alloy Casing") + .addStructureInfo( + EnumChatFormatting.GOLD + "12" + EnumChatFormatting.GRAY + " Extreme Engine Intake Casing") + .addStructureInfo( + EnumChatFormatting.GOLD + "20" + EnumChatFormatting.GRAY + " Tungstensteel Pipe Casing") + .addStructureInfo(EnumChatFormatting.GOLD + "21" + EnumChatFormatting.GRAY + + " Reinforced Photolithography Framework Casing") + .addStructureInfo(EnumChatFormatting.BLUE + "Cooler Upgrade Tier " + EnumChatFormatting.DARK_PURPLE + 2 + + EnumChatFormatting.BLUE + ":") + .addStructureInfo(EnumChatFormatting.GOLD + "40" + EnumChatFormatting.GRAY + " Americium Frame Box") + .addStructureInfo(EnumChatFormatting.GOLD + "41" + EnumChatFormatting.GRAY + + " Reinforced Photolithography Framework Casing") + .addStructureInfo( + EnumChatFormatting.GOLD + "8" + EnumChatFormatting.GRAY + " Superconducting Coil Block") + .addStructureInfo( + EnumChatFormatting.GOLD + "20" + EnumChatFormatting.GRAY + " Tungstensteel Pipe Casing") + .addStructureInfo(EnumChatFormatting.GOLD + "48" + EnumChatFormatting.GRAY + " Infinity Cooled Casing") + .toolTipFinisher("GregTech"); + return tt; + } + + @Override + public void saveNBTData(NBTTagCompound aNBT) { + super.saveNBTData(aNBT); + aNBT.setBoolean("mSeparate", mSeparate); + aNBT.setBoolean("mBioUpgrade", mBioUpgrade); + aNBT.setBoolean("mBioRotate", mBioRotate); + aNBT.setInteger("mBioOffsetX", mBioOffsets[0]); + aNBT.setInteger("mBioOffsetZ", mBioOffsets[1]); + aNBT.setBoolean("mOCTier1Upgrade", mOCTier1); + aNBT.setInteger("mOCTier1OffsetX", mOCTier1Offsets[0]); + aNBT.setInteger("mOCTier1OffsetZ", mOCTier1Offsets[1]); + aNBT.setBoolean("mOCTier2Upgrade", mOCTier2); + aNBT.setInteger("mOCTier2OffsetX", mOCTier2Offsets[0]); + aNBT.setInteger("mOCTier2OffsetZ", mOCTier2Offsets[1]); + aNBT.setFloat("mRoughnessMultiplier", mRoughnessMultiplier); + aNBT.setInteger("mSetTier", mSetTier); + } + + @Override + public void loadNBTData(final NBTTagCompound aNBT) { + super.loadNBTData(aNBT); + mSeparate = aNBT.getBoolean("mSeparate"); + mBioUpgrade = aNBT.getBoolean("mBioUpgrade"); + mBioRotate = aNBT.getBoolean("mBioRotate"); + mBioOffsets[0] = aNBT.getInteger("mBioOffsetX"); + mBioOffsets[1] = aNBT.getInteger("mBioOffsetZ"); + mOCTier1 = aNBT.getBoolean("mOCTier1Upgrade"); + mOCTier1Offsets[0] = aNBT.getInteger("mOCTier1OffsetX"); + mOCTier1Offsets[1] = aNBT.getInteger("mOCTier1OffsetZ"); + mOCTier2 = aNBT.getBoolean("mOCTier2Upgrade"); + mOCTier2Offsets[0] = aNBT.getInteger("mOCTier2OffsetX"); + mOCTier2Offsets[1] = aNBT.getInteger("mOCTier2OffsetZ"); + mRoughnessMultiplier = aNBT.getFloat("mRoughnessMultiplier"); + mSetTier = aNBT.getInteger("mSetTier"); + } + + @Override + public boolean isCorrectMachinePart(ItemStack aStack) { + return true; + } + + @Override + public boolean useModularUI() { + return true; + } + + @Override + public byte getUpdateData() { + return (byte) mSetTier; + } + + @Override + public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { + super.addUIWidgets(builder, buildContext); + buildContext.addSyncedWindow(10, this::createConfigurationWindow); + builder.widget(new ButtonWidget() + .setOnClick((clickData, widget) -> { + if (!widget.isClient()) widget.getContext().openSyncedWindow(10); + }) + .setSize(18, 18) + .setBackground(GT_UITextures.BUTTON_STANDARD) + .setBackground(GT_UITextures.OVERLAY_BUTTON_CYCLIC) + .addTooltip("Configuration Menu") + .setPos(151, 24)) + .widget(new TextWidget(new Text("Tier")) + .setTextAlignment(Alignment.Center) + .setScale(0.91f) + .setSize(20, 16) + .setPos(152, 46)) + .widget(new TextFieldWidget() + .setGetterInt(() -> mSetTier) + .setSetterInt(val -> { + mSetTier = val; + }) + .setNumbers(-16, 16) + .setTextColor(Color.WHITE.normal) + .setTextAlignment(Alignment.Center) + .addTooltip("PCB Factory Tier") + .setBackground(GT_UITextures.BACKGROUND_TEXT_FIELD) + .setSize(18, 18) + .setPos(151, 61)); + } + + protected ModularWindow createConfigurationWindow(final EntityPlayer player) { + ModularWindow.Builder builder = ModularWindow.builder(200, 160); + builder.setBackground(GT_UITextures.BACKGROUND_SINGLEBLOCK_DEFAULT); + builder.setGuiTint(getGUIColorization()); + builder.widget(new DrawableWidget() + .setDrawable(GT_UITextures.OVERLAY_BUTTON_CYCLIC) + .setPos(5, 5) + .setSize(16, 16)) + .widget(new TextWidget("Configuration Menu").setPos(25, 9)) + .widget(ButtonWidget.closeWindowButton(true).setPos(185, 3)) + .widget(new DynamicPositionedColumn() + .setSynced(false) + .widget(new MultiChildWidget() + .addChild(new CycleButtonWidget() + .setToggle(() -> mBioUpgrade, val -> { + mBioUpgrade = val; + if (!mBioUpgrade) { + GT_Utility.sendChatToPlayer( + player, GT_Utility.trans("339.1", "Bio Upgrade Disabled")); + } else { + GT_Utility.sendChatToPlayer( + player, GT_Utility.trans("339", "Bio Upgrade Enabled")); + } + }) + .setVariableBackground(GT_UITextures.BUTTON_STANDARD_TOGGLE) + .setSize(90, 18) + .addTooltip("Required for Bioware and Wetware boards.")) + .addChild(new DrawableWidget() + .setDrawable(GT_UITextures.OVERLAY_BUTTON_CYCLIC) + .setSize(18, 18)) + .addChild(new TextWidget("Bio Upgrade") + .setTextAlignment(Alignment.Center) + .setPos(23, 5)) + .setEnabled(widget -> !getBaseMetaTileEntity().isActive())) + .widget(new MultiChildWidget() + .addChild(new CycleButtonWidget() + .setToggle(() -> mBioRotate, val -> { + mBioRotate = val; + if (!mBioRotate) { + GT_Utility.sendChatToPlayer( + player, + GT_Utility.trans( + "340.1", "Rotate Bio Upgrade 90 Degrees Disabled")); + } else { + GT_Utility.sendChatToPlayer( + player, + GT_Utility.trans( + "340", "Rotate Bio Upgrade 90 Degrees Enabled")); + } + }) + .setVariableBackground(GT_UITextures.BUTTON_STANDARD_TOGGLE) + .setSize(90, 18) + .addTooltip("Switches around the X and Z axis, rotates the shape 90 degrees")) + .addChild(new DrawableWidget() + .setDrawable(GT_UITextures.OVERLAY_BUTTON_CYCLIC) + .setSize(18, 18)) + .addChild(new TextWidget("Bio Rotation") + .setTextAlignment(Alignment.Center) + .setPos(23, 5)) + .setEnabled(widget -> !getBaseMetaTileEntity().isActive())) + .widget(new MultiChildWidget() + .addChild( + new CycleButtonWidget() + .setToggle(() -> mOCTier1, val -> { + mOCTier1 = val; + if (!mOCTier1) { + GT_Utility.sendChatToPlayer( + player, + GT_Utility.trans("341.1", "Tier 1 OC Disabled")); + } else { + GT_Utility.sendChatToPlayer( + player, GT_Utility.trans("341", "Tier 1 OC Enabled")); + } + }) + .setVariableBackground(GT_UITextures.BUTTON_STANDARD_TOGGLE) + .setSize(90, 18) + .addTooltip( + "Incompatible with Tier 2, Requires a constant supply of distilled water. Allows for overclocking")) + .addChild(new DrawableWidget() + .setDrawable(GT_UITextures.OVERLAY_BUTTON_CYCLIC) + .setSize(18, 18)) + .addChild(new TextWidget("Cooler Tier 1") + .setTextAlignment(Alignment.Center) + .setPos(20, 5)) + .setEnabled(widget -> !getBaseMetaTileEntity().isActive())) + .widget(new MultiChildWidget() + .addChild( + new CycleButtonWidget() + .setToggle(() -> mOCTier2, val -> { + mOCTier2 = val; + if (!mOCTier2) { + GT_Utility.sendChatToPlayer( + player, + GT_Utility.trans("342.1", "Tier 2 OC Disabled")); + } else { + GT_Utility.sendChatToPlayer( + player, GT_Utility.trans("342", "Tier 2 OC Enabled")); + } + }) + .setVariableBackground(GT_UITextures.BUTTON_STANDARD_TOGGLE) + .setSize(90, 18) + .addTooltip( + "Incompatible with Tier 1, Requires a constant supply of super coolant. Allows for perfect overclocking")) + .addChild(new DrawableWidget() + .setDrawable(GT_UITextures.OVERLAY_BUTTON_CYCLIC) + .setSize(18, 18)) + .addChild(new TextWidget("Cooler Tier 2") + .setTextAlignment(Alignment.Center) + .setPos(20, 5)) + .setEnabled(widget -> !getBaseMetaTileEntity().isActive())) + .widget(new TextWidget(new Text("Roughness Multiplier")) + .setSize(90, 18) + .setEnabled(widget -> !getBaseMetaTileEntity().isActive()) + .setPos(0, 4)) + .widget(new TextFieldWidget() + .setGetterInt(() -> (int) (mRoughnessMultiplier * 10000)) + .setSetterInt(val -> { + mRoughnessMultiplier = val / 10000f; + }) + .setNumbers(100, 20000) + .setTextColor(Color.WHITE.normal) + .setTextAlignment(Alignment.Center) + .addTooltip("The roughness multiplier is multiplied by 10,000 before displaying!") + .setBackground(GT_UITextures.BACKGROUND_TEXT_FIELD) + .setSize(90, 16)) + .widget(new DrawableWidget() + .setDrawable(GT_UITextures.OVERLAY_BUTTON_CROSS) + .setSize(18, 18) + .addTooltip( + new Text("Can't change configuration when running !").color(Color.RED.dark(3))) + .setEnabled(widget -> getBaseMetaTileEntity().isActive())) + .setPos(10, 25)) + .widget(new DynamicPositionedColumn() + .setSynced(false) + .widget(new TextWidget(new Text("Bio Upgrade Offsets")) + .setSize(72, 18) + .setEnabled(widget -> !getBaseMetaTileEntity().isActive())) + .widget(new DynamicPositionedRow() + .setSynced(false) + .widget(new TextFieldWidget() + .setGetterInt(() -> mBioOffsets[0]) + .setSetterInt(val -> { + mBioOffsets[0] = val; + }) + .setNumbers(-16, 16) + .setTextColor(Color.WHITE.normal) + .setTextAlignment(Alignment.Center) + .addTooltip("X Offset") + .setBackground(GT_UITextures.BACKGROUND_TEXT_FIELD) + .setSize(36, 18)) + .widget(new TextFieldWidget() + .setGetterInt(() -> mBioOffsets[1]) + .setSetterInt(val -> { + mBioOffsets[1] = val; + }) + .setNumbers(-16, 16) + .setTextColor(Color.WHITE.normal) + .setTextAlignment(Alignment.Center) + .addTooltip("Z Offset") + .setBackground(GT_UITextures.BACKGROUND_TEXT_FIELD) + .setSize(36, 18)) + .setEnabled(widget -> !getBaseMetaTileEntity().isActive())) + .widget(new TextWidget(new Text("Cooler Tier 1 Offsets")) + .setSize(72, 18) + .setEnabled(widget -> !getBaseMetaTileEntity().isActive())) + .widget(new DynamicPositionedRow() + .setSynced(false) + .widget(new TextFieldWidget() + .setGetterInt(() -> mOCTier1Offsets[0]) + .setSetterInt(val -> { + mOCTier1Offsets[0] = val; + }) + .setNumbers(-16, 16) + .setTextColor(Color.WHITE.normal) + .setTextAlignment(Alignment.Center) + .addTooltip("X Offset") + .setBackground(GT_UITextures.BACKGROUND_TEXT_FIELD) + .setSize(36, 18)) + .widget(new TextFieldWidget() + .setGetterInt(() -> mOCTier1Offsets[1]) + .setSetterInt(val -> { + mOCTier1Offsets[1] = val; + }) + .setNumbers(-16, 16) + .setTextColor(Color.WHITE.normal) + .setTextAlignment(Alignment.Center) + .addTooltip("Z Offset") + .setBackground(GT_UITextures.BACKGROUND_TEXT_FIELD) + .setSize(36, 18)) + .setEnabled(widget -> !getBaseMetaTileEntity().isActive())) + .widget(new TextWidget(new Text("Cooler Tier 2 Offsets")) + .setSize(72, 18) + .setEnabled(widget -> !getBaseMetaTileEntity().isActive())) + .widget(new DynamicPositionedRow() + .setSynced(false) + .widget(new TextFieldWidget() + .setGetterInt(() -> mOCTier2Offsets[0]) + .setSetterInt(val -> { + mOCTier2Offsets[0] = val; + }) + .setNumbers(-16, 16) + .setTextColor(Color.WHITE.normal) + .setTextAlignment(Alignment.Center) + .addTooltip("X Offset") + .setBackground(GT_UITextures.BACKGROUND_TEXT_FIELD) + .setSize(36, 18)) + .widget(new TextFieldWidget() + .setGetterInt(() -> mOCTier2Offsets[1]) + .setSetterInt(val -> { + mOCTier2Offsets[1] = val; + }) + .setNumbers(-16, 16) + .setTextColor(Color.WHITE.normal) + .setTextAlignment(Alignment.Center) + .addTooltip("Z Offset") + .setBackground(GT_UITextures.BACKGROUND_TEXT_FIELD) + .setSize(36, 18)) + .setEnabled(widget -> !getBaseMetaTileEntity().isActive())) + .setPos(110, 25)); + return builder.build(); + } +} diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PlasmaForge.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PlasmaForge.java index ad60853d50..42170779df 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PlasmaForge.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PlasmaForge.java @@ -1000,12 +1000,12 @@ public class GT_MetaTileEntity_PlasmaForge extends GT_MetaTileEntity_AbstractMul .beginStructureBlock(33, 24, 33, false) .addStructureInfo("DTPF Structure is too complex! See schematic for details.") .addStructureInfo( - EnumChatFormatting.GOLD + "2112" + EnumChatFormatting.GRAY + " Heating coils required.") + EnumChatFormatting.GOLD + "2,112" + EnumChatFormatting.GRAY + " Heating coils required.") .addStructureInfo(EnumChatFormatting.GOLD + "120" + EnumChatFormatting.GRAY + " Dimensional bridge blocks required.") - .addStructureInfo(EnumChatFormatting.GOLD + "1270" + EnumChatFormatting.GRAY + .addStructureInfo(EnumChatFormatting.GOLD + "1,270" + EnumChatFormatting.GRAY + " Dimensional injection casings required.") - .addStructureInfo(EnumChatFormatting.GOLD + "2121" + EnumChatFormatting.GRAY + .addStructureInfo(EnumChatFormatting.GOLD + "2,121" + EnumChatFormatting.GRAY + " Dimensionally transcendent casings required.") .addStructureInfo("--------------------------------------------") .addStructureInfo("Requires " + EnumChatFormatting.GOLD + "1" + EnumChatFormatting.GRAY + "-" |