From 8a515c7a9f83ca0fe29098d50bc7cab30e137d35 Mon Sep 17 00:00:00 2001 From: BlueWeabo <76872108+BlueWeabo@users.noreply.github.com> Date: Tue, 13 Dec 2022 23:10:17 +0200 Subject: 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 * 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 Co-authored-by: Jason Mitchell Co-authored-by: Martin Robertz Co-authored-by: GTNH-Colen <54497873+GTNH-Colen@users.noreply.github.com> Co-authored-by: Sampsa --- src/main/java/gregtech/common/GT_RecipeAdder.java | 40 + .../gregtech/common/blocks/GT_Block_Casings8.java | 25 +- .../common/items/GT_MetaGenerated_Item_03.java | 5 +- .../multi/GT_MetaTileEntity_NanoForge.java | 453 ++++++++ .../multi/GT_MetaTileEntity_PCBFactory.java | 1120 ++++++++++++++++++++ .../multi/GT_MetaTileEntity_PlasmaForge.java | 6 +- 6 files changed, 1643 insertions(+), 6 deletions(-) create mode 100644 src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_NanoForge.java create mode 100644 src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PCBFactory.java (limited to 'src/main/java/gregtech/common') 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 + 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 STRUCTURE_DEFINITION = + StructureDefinition.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 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 tInputList = new ArrayList(); + 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 tOutputs = new ArrayList(); + 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 + 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 STRUCTURE_DEFINITION = + StructureDefinition.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 aColorInd