diff options
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 in |
