From 9ce867e5aa95d2f8a8a809e33b3a0fb874e3b36b Mon Sep 17 00:00:00 2001 From: Elisis Date: Sun, 24 Nov 2024 10:14:22 +1100 Subject: Beamline fixes 4 (#3504) Co-authored-by: BlueHero233 Co-authored-by: Martin Robertz Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Ethryan <3237986+Ethryan@users.noreply.github.com> --- .../gtnhlanth/common/beamline/BeamLinePacket.java | 4 +- .../common/item/ItemPhotolithographicMask.java | 7 +- src/main/java/gtnhlanth/common/item/MaskList.java | 131 ++++++++++++++------- .../gtnhlanth/common/register/LanthItemList.java | 1 - .../common/register/WerkstoffMaterialPool.java | 14 ++- .../java/gtnhlanth/common/tileentity/MTELINAC.java | 48 +++----- .../common/tileentity/MTESourceChamber.java | 7 +- .../common/tileentity/MTESynchrotron.java | 119 ++++++++++++++----- .../common/tileentity/MTETargetChamber.java | 80 ++++++++++--- .../recipe/beamline/BeamlineRecipeLoader.java | 110 +++++++++-------- src/main/java/gtnhlanth/loader/RecipeLoader.java | 75 ++++++++---- 11 files changed, 388 insertions(+), 208 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/gtnhlanth/common/beamline/BeamLinePacket.java b/src/main/java/gtnhlanth/common/beamline/BeamLinePacket.java index 7137c6ab7d..fb7bab1f1d 100644 --- a/src/main/java/gtnhlanth/common/beamline/BeamLinePacket.java +++ b/src/main/java/gtnhlanth/common/beamline/BeamLinePacket.java @@ -16,9 +16,7 @@ public class BeamLinePacket extends DataPacket { @Override protected BeamInformation contentFromNBT(NBTTagCompound nbt) { - /* - * NBTTagCompound compound = nbt.getCompoundTag("beamline"); - */ + return new BeamInformation( nbt.getFloat("energy"), nbt.getInteger("rate"), diff --git a/src/main/java/gtnhlanth/common/item/ItemPhotolithographicMask.java b/src/main/java/gtnhlanth/common/item/ItemPhotolithographicMask.java index 30cbac875b..c96212c8e6 100644 --- a/src/main/java/gtnhlanth/common/item/ItemPhotolithographicMask.java +++ b/src/main/java/gtnhlanth/common/item/ItemPhotolithographicMask.java @@ -23,9 +23,6 @@ public class ItemPhotolithographicMask extends Item implements ICanFocus { this.setTextureName(Tags.MODID + ":photomask/" + name); } - /* - * @Override public String getUnlocalizedName() { return "item.photomask." + this.name; } - */ @SuppressWarnings({ "rawtypes", "unchecked" }) @Override public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool) { @@ -33,6 +30,10 @@ public class ItemPhotolithographicMask extends Item implements ICanFocus { if (!this.descSpectrum.isEmpty()) list.add("Suitable for the " + this.descSpectrum + " segment of the electromagnetic spectrum and lower"); + if (this.getMaxDamage() > 0) // Not a precursor. + list.add("Max Uses: " + (this.getMaxDamage() + 1)); // maximum uses = max damage + 1 in general, as + // 0-durability masks still function + } public String getDescSpectrum() { diff --git a/src/main/java/gtnhlanth/common/item/MaskList.java b/src/main/java/gtnhlanth/common/item/MaskList.java index 594180da22..ea132ca3ee 100644 --- a/src/main/java/gtnhlanth/common/item/MaskList.java +++ b/src/main/java/gtnhlanth/common/item/MaskList.java @@ -13,60 +13,94 @@ public enum MaskList { // Use Dyes._NULL to indicate a wafer's lack of a dedicated lens instead of null, if the wafer's mask is to be // generated // Ignore last argument if using all wafers - ERROR("error", "ERROR", 0, "", null, null, 0, 0, 0, 0, 0, null), - BLANK1("blank1", "T1 Blank", 0, "VISIBLE", null, null, 0, 0, 0, 0, 0, null), - BLANK2("blank2", "T2 Blank", 0, "UV", null, null, 0, 0, 0, 0, 0, null), - BLANK3("blank3", "T3 Blank", 0, "X-RAY", null, null, 0, 0, 0, 0, 0, null), + // tcTargetItem specifies the target item used for non-wafer mask+TC recipes, e.g. crystal chips, set to null for + // wafer masks + ERROR("error", "ERROR", 0, "", null, null, 0, 0, 0, 0, 0, null, null), + BLANK1("blank1", "T1 Blank", 0, "VISIBLE", null, null, 0, 0, 0, 0, 0, null, null), + BLANK2("blank2", "T2 Blank", 0, "UV", null, null, 0, 0, 0, 0, 0, null, null), + BLANK3("blank3", "T3 Blank", 0, "X-RAY", null, null, 0, 0, 0, 0, 0, null, null), + + CBLANK("cblank", "Crystal", 0, "X-RAY", null, null, 0, 0, 0, 0, 0, null, null), // Better at resolving smaller + // features, in theory + ILC("ilc", "Integrated Logic Circuit", 100, "", BLANK1, Dyes.dyeRed, TierEU.RECIPE_MV, 0.5e-3f, 4e-3f, 35, 1, - ItemList.Circuit_Wafer_ILC.get(1)), + ItemList.Circuit_Wafer_ILC.get(1), null), RAM("ram", "Random Access Memory", 200, "", BLANK1, Dyes.dyeCyan, TierEU.RECIPE_MV, 2e-3f, 4e-3f, 40, 2, - ItemList.Circuit_Wafer_Ram.get(1), ItemList.Circuit_Silicon_Wafer), + ItemList.Circuit_Wafer_Ram.get(1), null, ItemList.Circuit_Silicon_Wafer), NAND("nand", "NAND", 200, "", BLANK2, Dyes._NULL, TierEU.RECIPE_HV, 7e-3f, 12e-3f, 40, 1, - ItemList.Circuit_Wafer_NAND.get(1), ItemList.Circuit_Silicon_Wafer), // NAND uses only Ender Pearl lens, don't - // ask me why - NOR("nor", "NOR", 100, "", BLANK2, Dyes._NULL, TierEU.RECIPE_LuV, 8e-3f, 10e-3f, 40, 1, - ItemList.Circuit_Wafer_NOR.get(1), ItemList.Circuit_Silicon_Wafer, ItemList.Circuit_Silicon_Wafer2), // Same as - // above, - // but with - // ender - // eye + ItemList.Circuit_Wafer_NAND.get(1), null, ItemList.Circuit_Silicon_Wafer), // NAND uses only Ender Pearl lens, + // don't + // ask me why + NOR("nor", "NOR", 100, "", BLANK2, Dyes._NULL, TierEU.RECIPE_HV, 8e-3f, 10e-3f, 40, 1, + ItemList.Circuit_Wafer_NOR.get(1), null, ItemList.Circuit_Silicon_Wafer, ItemList.Circuit_Silicon_Wafer2), // Same + // as + // above, + // but with + // ender + // eye CPU("cpu", "Central Processing Unit", 10, "", BLANK2, Dyes.dyeWhite, TierEU.RECIPE_MV, 6e-3f, 12e-3f, 45, 2, - ItemList.Circuit_Wafer_CPU.get(1)), + ItemList.Circuit_Wafer_CPU.get(1), null), + PrCPU("prcpu", "Prepared Central Processing Unit", 0, "", CPU, null, TierEU.RECIPE_EV, 0, 0, 0, 0, null, null), + SOC("soc", "SoC", 150, "", BLANK2, Dyes.dyeYellow, TierEU.RECIPE_EV, 3e-3f, 10e-3f, 45, 2, - ItemList.Circuit_Wafer_SoC.get(1), ItemList.Circuit_Silicon_Wafer, ItemList.Circuit_Silicon_Wafer2), + ItemList.Circuit_Wafer_SoC.get(1), null, ItemList.Circuit_Silicon_Wafer, ItemList.Circuit_Silicon_Wafer2), ASOC("asoc", "Advanced SoC", 120, "", BLANK2, Dyes.dyeGreen, TierEU.RECIPE_EV, 100e-3f, 200e-3f, 50, 2, - ItemList.Circuit_Wafer_SoC2.get(1), ItemList.Circuit_Silicon_Wafer, ItemList.Circuit_Silicon_Wafer2), + ItemList.Circuit_Wafer_SoC2.get(1), null, ItemList.Circuit_Silicon_Wafer, ItemList.Circuit_Silicon_Wafer2), + PIC("pic", "Power IC", 100, "", BLANK2, Dyes.dyeBlue, TierEU.RECIPE_HV, 5e-3f, 10e-3f, 50, 4, - ItemList.Circuit_Wafer_PIC.get(1), ItemList.Circuit_Silicon_Wafer), - HPIC("hpic", "High Power IC", 80, "", BLANK3, null, TierEU.RECIPE_IV, 100e-3f, 200e-3f, 50, 6, - ItemList.Circuit_Wafer_HPIC.get(1), ItemList.Circuit_Silicon_Wafer), // Different, made in chemical reactor. - // Figure out something for - // this later? - NCPU("ncpu", "NanoCPU", 60, "", BLANK2, null, TierEU.RECIPE_EV, 5e-3f, 10e-3f, 50, 4, - ItemList.Circuit_Wafer_NanoCPU.get(1), ItemList.Circuit_Silicon_Wafer), // Same as above - QBIT("qbit", "QBit", 50, "", BLANK2, null, TierEU.RECIPE_EV, 3e-3f, 10e-3f, 50, 4, - ItemList.Circuit_Wafer_QuantumCPU.get(1), ItemList.Circuit_Silicon_Wafer), // ^ - UHPIC("uhpic", "Ultra High Power IC", 60, "", BLANK3, null, TierEU.RECIPE_LuV, 200e-3f, 400e-3f, 50, 8, - ItemList.Circuit_Wafer_UHPIC.get(1), ItemList.Circuit_Silicon_Wafer, ItemList.Circuit_Silicon_Wafer2), // You - // get - // the - // gist + ItemList.Circuit_Wafer_PIC.get(1), null, ItemList.Circuit_Silicon_Wafer), + PrPIC("prpic", "Prepared Power IC", 0, "", PIC, null, TierEU.RECIPE_IV, 0, 0, 0, 0, null, null), // Made in CR from + // PIC + + HPIC("hpic", "High Power IC", 80, "", PrPIC, Dyes.dyeBlue, TierEU.RECIPE_IV, 100e-3f, 200e-3f, 50, 6, + ItemList.Circuit_Wafer_HPIC.get(1), null, ItemList.Circuit_Silicon_Wafer), + PrHPIC("prhpic", "Prepared High Power IC", 0, "", HPIC, null, TierEU.RECIPE_LuV, 0, 0, 0, 0, null, null), // Made in + // CR from + // HPIC + + NCPU("ncpu", "NanoCPU", 60, "", PrCPU, Dyes.dyeWhite, TierEU.RECIPE_EV, 5e-3f, 10e-3f, 50, 4, + ItemList.Circuit_Wafer_NanoCPU.get(1), null, ItemList.Circuit_Silicon_Wafer), + PrNCPU("prncpu", "Prepared NanoCPU", 0, "", NCPU, null, TierEU.RECIPE_EV, 0, 0, 0, 0, null, null), + + QBIT("qbit", "QBit", 50, "", PrNCPU, Dyes.dyeWhite, TierEU.RECIPE_EV, 3e-3f, 10e-3f, 50, 4, + ItemList.Circuit_Wafer_QuantumCPU.get(1), null, ItemList.Circuit_Silicon_Wafer), // ^ + UHPIC("uhpic", "Ultra High Power IC", 60, "", PrHPIC, Dyes.dyeBlue, TierEU.RECIPE_LuV, 190e-3f, 400e-3f, 50, 8, + ItemList.Circuit_Wafer_UHPIC.get(1), null, ItemList.Circuit_Silicon_Wafer, ItemList.Circuit_Silicon_Wafer2), SSOC("ssoc", "Simple SoC", 150, "", BLANK1, Dyes.dyeOrange, TierEU.RECIPE_MV, 2e-3f, 4e-3f, 25, 1, - ItemList.Circuit_Wafer_Simple_SoC.get(1)), + ItemList.Circuit_Wafer_Simple_SoC.get(1), null), ULPIC("ulpic", "Ultra Low Power IC", 200, "", BLANK1, Dyes.dyeGreen, TierEU.RECIPE_LV, 2e-3f, 4e-3f, 30, 1, - ItemList.Circuit_Wafer_ULPIC.get(1)), // Can use green for this as well as asoc, given + ItemList.Circuit_Wafer_ULPIC.get(1), null), // Can use green for this as well as asoc, given // the latter uses a different base mask LPIC("lpic", "Low Power IC", 150, "", BLANK1, Dyes.dyeYellow, TierEU.RECIPE_MV, 2e-3f, 4e-3f, 30, 2, - ItemList.Circuit_Wafer_LPIC.get(1)), // Same as above, except for yellow - NPIC("npic", "Nano Power IC", 70, "", BLANK3, Dyes.dyeRed, TierEU.RECIPE_LuV, 1, 3000, 50, 4, - ItemList.Circuit_Wafer_NPIC.get(1), ItemList.Circuit_Silicon_Wafer, ItemList.Circuit_Silicon_Wafer2, + ItemList.Circuit_Wafer_LPIC.get(1), null), // Same as above, except for yellow + + NPIC("npic", "Nano Power IC", 70, "", BLANK2, Dyes.dyeRed, TierEU.RECIPE_LuV, 1, 4, 50, 4, + ItemList.Circuit_Wafer_NPIC.get(1), null, ItemList.Circuit_Silicon_Wafer, ItemList.Circuit_Silicon_Wafer2, ItemList.Circuit_Silicon_Wafer3), // Same - PPIC("ppic", "PPIC", 50, "", BLANK3, null, TierEU.RECIPE_ZPM, 1.5f, 10, 50, 6, ItemList.Circuit_Wafer_PPIC.get(1), - ItemList.Circuit_Silicon_Wafer, ItemList.Circuit_Silicon_Wafer2, ItemList.Circuit_Silicon_Wafer3), // CR - // recipe - QPIC("qpic", "QPIC", 50, "", BLANK3, Dyes.dyeBlue, TierEU.RECIPE_UV, 5, 9, 50, 6, - ItemList.Circuit_Wafer_QPIC.get(1), ItemList.Circuit_Silicon_Wafer, ItemList.Circuit_Silicon_Wafer2, - ItemList.Circuit_Silicon_Wafer3, ItemList.Circuit_Silicon_Wafer4); // Different base mask to PIC + PrNPIC("prnpic", "Prepared Nano Power IC", 0, "", NPIC, null, TierEU.RECIPE_ZPM, 0, 0, 0, 0, null, null), // Made in + // CR from + // NPIC + + PPIC("ppic", "PPIC", 50, "", PrNPIC, Dyes.dyeRed, TierEU.RECIPE_ZPM, 1.5f, 10, 50, 6, + ItemList.Circuit_Wafer_PPIC.get(1), null, ItemList.Circuit_Silicon_Wafer, ItemList.Circuit_Silicon_Wafer2, + ItemList.Circuit_Silicon_Wafer3), + + QPIC("qpic", "QPIC", 50, "", BLANK3, Dyes.dyeBlue, TierEU.RECIPE_UV, 3.2f, 9, 50, 6, + ItemList.Circuit_Wafer_QPIC.get(1), null, ItemList.Circuit_Silicon_Wafer, ItemList.Circuit_Silicon_Wafer2, + ItemList.Circuit_Silicon_Wafer3, ItemList.Circuit_Silicon_Wafer4), // Different base mask to PIC + + CCPU("ccpu", "Crystal Central Processing Unit", 100, "", CBLANK, Dyes.dyeGreen, 10_000, 1, 3, 50, 6, + ItemList.Circuit_Chip_CrystalCPU.get(1), ItemList.Circuit_Parts_Crystal_Chip_Elite.get(1)), // For producing + // Crystal CPUs from + // Engraved CCs + CSOC("csoc", "Crystal SoC", 100, "", CBLANK, Dyes.dyeBlue, 40_000, 2, 7, 50, 8, + ItemList.Circuit_Chip_CrystalSoC.get(1), ItemList.Circuit_Chip_CrystalCPU.get(1)), + ACC("acc", "Advanced Crystal Chip", 100, "", CBLANK, Dyes.dyeLime, 80_000, 3, 9, 55, 12, + ItemList.Circuit_Chip_CrystalSoC2.get(1), ItemList.Circuit_Chip_CrystalSoC.get(1)), + LCC("lcc", "Living Crystal Chip", 75, "", CBLANK, Dyes.dyeWhite, 160_000, 5, 12, 60, 16, + ItemList.Circuit_Parts_Crystal_Chip_Wetware.get(1), ItemList.Circuit_Chip_CrystalSoC2.get(1)) + + ; String name; String englishName; @@ -85,17 +119,19 @@ public enum MaskList { float minFocus; int baselineAmount; + ItemStack tcTargetItem; ItemStack producedItem; ItemList[] forbiddenWafers; - MaskList(String name, String englishName, int maxDamage, String spectrum, MaskList precursor, Dyes lensColour, + MaskList(String name, String englishName, int maxUses, String spectrum, MaskList precursor, Dyes lensColour, long engraverEUt, float minEnergy, float maxEnergy, float minFocus, int baselineAmount, ItemStack producedItem, - ItemList... forbiddenWafers) { + ItemStack tcTargetItem, ItemList... forbiddenWafers) { this.name = name; this.englishName = englishName; this.spectrum = spectrum; - this.maxDamage = maxDamage; + this.maxDamage = maxUses - 1; // 0-durability masks still function, so e.g. maxUses = 100 corresponds to + // durability levels 0-99 this.precursor = precursor; this.lensColour = lensColour; this.engraverEUt = engraverEUt; @@ -103,6 +139,7 @@ public enum MaskList { this.minEnergy = minEnergy; this.maxEnergy = maxEnergy; this.baselineAmount = baselineAmount; + this.tcTargetItem = tcTargetItem; this.producedItem = producedItem; this.forbiddenWafers = forbiddenWafers; } @@ -151,6 +188,10 @@ public enum MaskList { return this.baselineAmount; } + public ItemStack getTCTargetItem() { + return this.tcTargetItem; + } + public ItemStack getProducedItem() { return this.producedItem; } diff --git a/src/main/java/gtnhlanth/common/register/LanthItemList.java b/src/main/java/gtnhlanth/common/register/LanthItemList.java index 50069131d6..400c1a8638 100644 --- a/src/main/java/gtnhlanth/common/register/LanthItemList.java +++ b/src/main/java/gtnhlanth/common/register/LanthItemList.java @@ -70,7 +70,6 @@ public final class LanthItemList { public static final Block COOLANT_DELIVERY_CASING = new BlockCasing("coolant_delivery"); - // public static final Block ANTENNA_CASING_T1 = new Casing("antenna_t1"); public static final Block ANTENNA_CASING_T1 = new BlockAntennaCasing(1); public static final Block ANTENNA_CASING_T2 = new BlockAntennaCasing(2); diff --git a/src/main/java/gtnhlanth/common/register/WerkstoffMaterialPool.java b/src/main/java/gtnhlanth/common/register/WerkstoffMaterialPool.java index 125f0f283f..d35c444ff7 100644 --- a/src/main/java/gtnhlanth/common/register/WerkstoffMaterialPool.java +++ b/src/main/java/gtnhlanth/common/register/WerkstoffMaterialPool.java @@ -1945,7 +1945,7 @@ public class WerkstoffMaterialPool implements Runnable { new short[] { 0, 0, 0 }, "Reactive-Ion Etching Mixture", subscriptNumbers("CHF3/O2"), - new Werkstoff.Stats().setCentrifuge(true), + new Werkstoff.Stats(), Werkstoff.Types.MIXTURE, new Werkstoff.GenerationFeatures().disable() .addCells(), @@ -2015,14 +2015,22 @@ public class WerkstoffMaterialPool implements Runnable { offsetID3b + 10, TextureSet.SET_FLUID); + public static final Werkstoff HotSuperCoolant = new Werkstoff( + new short[] { 155, 17, 30 }, + "Hot Super Coolant", + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID3b + 11, + TextureSet.SET_FLUID); + public static void runInit() { addSubTags(); } private static void addSubTags() { - // WerkstoffMaterialPool.PTMEGElastomer.add(SubTag.BOUNCY, SubTag.STRETCHY); - } @Override diff --git a/src/main/java/gtnhlanth/common/tileentity/MTELINAC.java b/src/main/java/gtnhlanth/common/tileentity/MTELINAC.java index 7ae15db3aa..8fb3a54e92 100644 --- a/src/main/java/gtnhlanth/common/tileentity/MTELINAC.java +++ b/src/main/java/gtnhlanth/common/tileentity/MTELINAC.java @@ -195,7 +195,8 @@ public class MTELINAC extends MTEEnhancedMultiBlockBase implements ISu } - tt.addInfo("Requires (length + 1)kL/s of coolant") + tt.addInfo("Requires (length)kL/s of coolant") + .addSeparator() .beginVariableStructureBlock(7, 7, 7, 7, 19, 83, false) .addController("Front bottom") .addCasingInfoRange(LanthItemList.SHIELDED_ACCELERATOR_CASING.getLocalizedName(), 325, 1285, false) @@ -283,7 +284,8 @@ public class MTELINAC extends MTEEnhancedMultiBlockBase implements ISu FluidStack primFluid = tFluidInputs.get(0); // 1b (1000L)/m/operation - final int fluidConsumed = 1000 * length; + final int fluidConsumed = 1000 * (length + 1); // length variable is technically physical length - 1, adding + // here so as to not affect existing math this.mEfficiency = (10000 - (this.getIdealStatus() - this.getRepairStatus()) * 1000); this.mEfficiencyIncrease = 10000; @@ -307,8 +309,11 @@ public class MTELINAC extends MTEEnhancedMultiBlockBase implements ISu } mMaxProgresstime = 1 * TickTime.SECOND; + // Consume the input tier's corresponding practical voltage instead of the maximum suggested by the logic - mEUt = (int) -GTValues.VP[(int) this.getInputVoltageTier()]; + // 1A if one energy hatch, 4A if two + mEUt = (int) ((this.mEnergyHatches.size() == 1) ? -GTValues.VP[(int) this.getInputVoltageTier()] + : (int) (-this.getMaxInputAmps() * GTValues.VP[(int) this.getInputVoltageTier()])); // Particle stays the same with this multiblock outputParticle = particleId; @@ -336,10 +341,8 @@ public class MTELINAC extends MTEEnhancedMultiBlockBase implements ISu : inputFocus * (machineFocus / 100); // If input focus > machine focus, take the average of both, else // weigh the former by the latter - long voltage = this.getMaxInputVoltage(); - // voltageFactor = calculateVoltageFactor(voltage); - - // machineEnergy = Math.max(-((60) / this.length) * voltageFactor + 60_000, 2000); // Minimum of 2000keV + // 1A of full power if one energy hatch, 4A if two + long voltage = (this.mEnergyHatches.size() == 1) ? this.getMaxInputVoltage() : this.getMaxInputPower(); machineEnergy = (float) Math.max(length / 4 * Math.pow(voltage, 1.0 / 3.0), 50); // Minimum of 50keV @@ -347,13 +350,6 @@ public class MTELINAC extends MTEEnhancedMultiBlockBase implements ISu .getEnergy(); inputEnergy = Math.min(inputEnergy, 7500); // Does not scale past 7500 keV, prevents double LINAC issue - /* - * outputEnergy = Math.min( - * (1 + inputEnergy / Particle.getParticleFromId(outputParticle) - * .maxSourceEnergy()) * machineEnergy, - * 120_000); // TODO more complex calculation than just - * // addition - */ outputEnergy = (float) Math.pow( 10, @@ -408,7 +404,6 @@ public class MTELINAC extends MTEEnhancedMultiBlockBase implements ISu @Override public void stopMachine() { - // GTLog.out.print("Machine stopped"); outputFocus = 0; outputEnergy = 0; outputParticle = 0; @@ -445,6 +440,10 @@ public class MTELINAC extends MTEEnhancedMultiBlockBase implements ISu BeamInformation information = this.getInputInformation(); + if (information == null) { + information = new BeamInformation(0, 0, 0, 0); + } + return new String[] { /* 1 */ StatCollector.translateToLocal("GT5U.multiblock.Progress") + ": " + EnumChatFormatting.GREEN @@ -473,7 +472,9 @@ public class MTELINAC extends MTEEnhancedMultiBlockBase implements ISu + EnumChatFormatting.YELLOW + GTUtility.formatNumbers(getMaxInputVoltage()) + EnumChatFormatting.RESET - + " EU/t(*2A) " + + " EU/t(*" + + getMaxInputAmps() + + "A)" + StatCollector.translateToLocal("GT5U.machines.tier") + ": " + EnumChatFormatting.YELLOW @@ -503,7 +504,7 @@ public class MTELINAC extends MTEEnhancedMultiBlockBase implements ISu StatCollector.translateToLocal("beamline.coolusage") + ": " // Coolant usage: + EnumChatFormatting.AQUA - + length + + (length + 1) + EnumChatFormatting.RESET + " kL/s", // e.g. "24 kL/s @@ -558,7 +559,6 @@ public class MTELINAC extends MTEEnhancedMultiBlockBase implements ISu // Will it matter? No :boubs_glasses: if (in.q == null) return new BeamInformation(0, 0, 0, 0); - // if (in.q == null) return new BeamInformation(10000, 10, 0, 90); // temporary for testing purposes return in.q.getContent(); } @@ -569,13 +569,6 @@ public class MTELINAC extends MTEEnhancedMultiBlockBase implements ISu return (float) Math.pow(1.1, 0.2 * fluidTemp); } - /* - * private static float calculateVoltageFactor(long voltage) { - * float factor = (float) Math.pow(1.00009, -(0.1 * voltage - 114000)); - * return factor; - * } - */ - @Override public String[] getStructureDescription(ItemStack arg0) { return DescTextLocalization.addText("LINAC.hint", 11); @@ -612,8 +605,6 @@ public class MTELINAC extends MTEEnhancedMultiBlockBase implements ISu length += 2; } - // if (!checkPiece(STRUCTURE_PIECE_END, 3, 6, -length)) return false; - // Likely off by one or two, not visible to player however so doesn't particularly matter length += 8; @@ -635,9 +626,6 @@ public class MTELINAC extends MTEEnhancedMultiBlockBase implements ISu } for (int i = -8; i > -lLength - 1; i -= 2) { - - // GTLog.out.print("Building inner piece! i = " + i); - buildPiece(STRUCTURE_PIECE_LAYER, stackSize, hintsOnly, 3, 6, i); } diff --git a/src/main/java/gtnhlanth/common/tileentity/MTESourceChamber.java b/src/main/java/gtnhlanth/common/tileentity/MTESourceChamber.java index 8fb94d505c..5c69bae5a8 100644 --- a/src/main/java/gtnhlanth/common/tileentity/MTESourceChamber.java +++ b/src/main/java/gtnhlanth/common/tileentity/MTESourceChamber.java @@ -154,15 +154,10 @@ public class MTESourceChamber extends MTEEnhancedMultiBlockBase implements ISurvivalConstructable { +public class MTESynchrotron extends MTEExtendedPowerMultiBlockBase implements ISurvivalConstructable { private static final IStructureDefinition STRUCTURE_DEFINITION; @@ -79,6 +82,8 @@ public class MTESynchrotron extends MTEEnhancedMultiBlockBase im private int energyHatchTier; + private boolean usingExotic = false; + private int antennaeTier; private Byte glassTier; @@ -440,7 +445,9 @@ public class MTESynchrotron extends MTEEnhancedMultiBlockBase im ).addElement('c', ofBlock(LanthItemList.SHIELDED_ACCELERATOR_CASING, 0)) .addElement('k', ofBlock(GregTechAPI.sBlockCasings1, 15)) // Superconducting coils .addElement('d', ofBlock(LanthItemList.COOLANT_DELIVERY_CASING, 0)) - .addElement('e', buildHatchAdder(MTESynchrotron.class).atLeast(ImmutableMap.of(Energy, 4)).dot(6).casingIndex(CASING_INDEX).build()) + + // Adder overriden due to ExoticEnergy originally calling its own adder, giving false positives + .addElement('e', buildHatchAdder(MTESynchrotron.class).atLeast(ImmutableMap.of(Energy.or(ExoticEnergy), 4)).adder(MTESynchrotron::addEnergyInputToMachineList).dot(6).casingIndex(CASING_INDEX).build()) .addElement('n', ofBlock(LanthItemList.NIOBIUM_CAVITY_CASING, 0)) .addElement('a', ofBlockAdder(MTESynchrotron::addAntenna, LanthItemList.ANTENNA_CASING_T1, 0)) //Antenna Casings .addElement('i', buildHatchAdder(MTESynchrotron.class).atLeast(ImmutableMap.of(InputHatch, 2)).dot(4).casingIndex(CASING_INDEX).build()) @@ -475,6 +482,8 @@ public class MTESynchrotron extends MTEEnhancedMultiBlockBase im private int machineTemp; + private long energyHatchAmperage; + public MTESynchrotron(String aName) { super(aName); } @@ -620,19 +629,64 @@ public class MTESynchrotron extends MTEEnhancedMultiBlockBase im } IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); if (aMetaTileEntity == null) return false; - if (aMetaTileEntity instanceof MTEHatchEnergy hatch) { - // First energy hatch added - if (this.mEnergyHatches.isEmpty()) this.energyHatchTier = hatch.mTier; + boolean firstHatch = false; + if (this.mEnergyHatches.isEmpty() && this.mExoticEnergyHatches.isEmpty()) firstHatch = true; + + if (aMetaTileEntity instanceof MTEHatch hatch) { + + if (firstHatch) { + + this.energyHatchTier = hatch.mTier; + this.energyHatchAmperage = hatch.maxWorkingAmperesIn(); + + } // Disallow any hatches that don't match the tier of the first hatch added if (hatch.mTier != this.energyHatchTier) return false; - hatch.updateTexture(aBaseCasingIndex); - hatch.updateCraftingIcon(this.getMachineCraftingIcon()); - return mEnergyHatches.add(hatch); + if (hatch.maxWorkingAmperesIn() != this.energyHatchAmperage) // Prevent mixing amperages within a tier + return false; + + if (aMetaTileEntity instanceof MTEHatchEnergy hatchNormal) { + + if (usingExotic) // usingExotic defaults to false, only set when known to be using exotics + return false; // If exotics are already being used, disallow non-exotics + + hatchNormal.updateTexture(aBaseCasingIndex); + hatchNormal.updateCraftingIcon(this.getMachineCraftingIcon()); + return mEnergyHatches.add(hatchNormal); + + } else if (aMetaTileEntity instanceof MTEHatch hatchExotic + && ExoticEnergyInputHelper.isExoticEnergyInput(aMetaTileEntity)) { + + if (firstHatch) usingExotic = true; + + if (!usingExotic) return false; // If normal hatches are already being used, disallow exotics + + hatchExotic.updateTexture(aBaseCasingIndex); + hatchExotic.updateCraftingIcon(this.getMachineCraftingIcon()); + return mExoticEnergyHatches.add(hatchExotic); + + } else { + return false; // Not an energy hatch + } + } else { + return false; // Not a hatch of any kind } - return false; + + /* + * if (aMetaTileEntity instanceof MTEHatchEnergy hatch) { + * // First energy hatch added + * if (this.mEnergyHatches.isEmpty()) this.energyHatchTier = hatch.mTier; + * // Disallow any hatches that don't match the tier of the first hatch added + * if (hatch.mTier != this.energyHatchTier) return false; + * hatch.updateTexture(aBaseCasingIndex); + * hatch.updateCraftingIcon(this.getMachineCraftingIcon()); + * return mEnergyHatches.add(hatch); + * } + * return false; + */ } private boolean addAntenna(Block block, int meta) { @@ -715,9 +769,11 @@ public class MTESynchrotron extends MTEEnhancedMultiBlockBase im mMaxProgresstime = TickTime.SECOND; - long voltage = this.getMaxInputVoltage(); - mEUt = (int) (-voltage / GTValues.V[(int) this.getInputVoltageTier()] - * GTValues.VP[(int) this.getInputVoltageTier()]); // Multiply VP by amps + long voltage = 0; + + voltage = this.getMaxInputEu(); + + lEUt = -GTValues.VP[GTUtility.getTier(this.getAverageInputVoltage())] * this.getMaxInputAmps(); outputParticle = 1; // Photon @@ -766,7 +822,7 @@ public class MTESynchrotron extends MTEEnhancedMultiBlockBase im outputRate = (int) (inputRate * getOutputRatetio(voltageFactor, this.antennaeTier)); if (outputRate == 0) { - stopMachine(SimpleShutDownReason.ofCritical("gtnhlanth.low_input_rate")); + stopMachine(SimpleShutDownReason.ofCritical("gtnhlanth.low_input_eut")); return false; } @@ -841,7 +897,6 @@ public class MTESynchrotron extends MTEEnhancedMultiBlockBase im for (MTEHatchInputBeamline in : this.mInputBeamline) { if (in.q == null) return new BeamInformation(0, 0, 0, 0); - // if (in.q == null) return new BeamInformation(10000, 10, 0, 90); // TODO temporary for testing purposes return in.q.getContent(); } @@ -857,10 +912,6 @@ public class MTESynchrotron extends MTEEnhancedMultiBlockBase im return (float) (Math.sqrt(mEU) / 1500); } - /* - * private static float getTemperatureFactor(int temperature) { float factor = (float) Math.pow(1.11, 0.18 * - * temperature); return factor; } - */ private static double calculateOutputParticleEnergy(long voltage, double inputParticleEnergy, int antennaTier) { /* @@ -905,17 +956,19 @@ public class MTESynchrotron extends MTEEnhancedMultiBlockBase im long storedEnergy = 0; long maxEnergy = 0; - for (MTEHatchEnergy tHatch : mEnergyHatches) { - if (tHatch.isValid()) { - storedEnergy += tHatch.getBaseMetaTileEntity() - .getStoredEU(); - maxEnergy += tHatch.getBaseMetaTileEntity() - .getEUCapacity(); - } + for (MTEHatch tHatch : getExoticAndNormalEnergyHatchList()) { + storedEnergy += tHatch.getBaseMetaTileEntity() + .getStoredEU(); + maxEnergy += tHatch.getBaseMetaTileEntity() + .getEUCapacity(); } BeamInformation information = this.getInputInformation(); + if (information == null) { + information = new BeamInformation(0, 0, 0, 0); + } + return new String[] { /* 1 */ StatCollector.translateToLocal("GT5U.multiblock.Progress") + ": " + EnumChatFormatting.GREEN @@ -942,13 +995,15 @@ public class MTESynchrotron extends MTEEnhancedMultiBlockBase im + " EU/t", /* 4 */ StatCollector.translateToLocal("GT5U.multiblock.mei") + ": " + EnumChatFormatting.YELLOW - + GTUtility.formatNumbers(getMaxInputVoltage()) + + GTUtility.formatNumbers(getAverageInputVoltage()) + EnumChatFormatting.RESET - + " EU/t(*2A) " + + " EU/t(*" + + getMaxInputAmps() + + "A)" + StatCollector.translateToLocal("GT5U.machines.tier") + ": " + EnumChatFormatting.YELLOW - + VN[GTUtility.getTier(getMaxInputVoltage())] + + VN[GTUtility.getTier(getAverageInputVoltage())] + EnumChatFormatting.RESET, /* 5 */ StatCollector.translateToLocal("GT5U.multiblock.problems") + ": " + EnumChatFormatting.RED @@ -1035,7 +1090,11 @@ public class MTESynchrotron extends MTEEnhancedMultiBlockBase im this.mAntennaCasings.clear(); this.mEnergyHatches.clear(); + this.mExoticEnergyHatches.clear(); this.energyHatchTier = 0; + this.energyHatchAmperage = 0; + this.usingExotic = false; + this.antennaeTier = 0; this.glassTier = 0; @@ -1050,7 +1109,7 @@ public class MTESynchrotron extends MTEEnhancedMultiBlockBase im return this.mInputBeamline.size() == 1 && this.mOutputBeamline.size() == 1 && this.mMaintenanceHatches.size() == 1 - && this.mEnergyHatches.size() == 4 + && (this.mEnergyHatches.size() == 4 || this.mExoticEnergyHatches.size() == 4) && this.glassTier >= MIN_GLASS_TIER; } diff --git a/src/main/java/gtnhlanth/common/tileentity/MTETargetChamber.java b/src/main/java/gtnhlanth/common/tileentity/MTETargetChamber.java index ffc16fddf0..988bf1fd5c 100644 --- a/src/main/java/gtnhlanth/common/tileentity/MTETargetChamber.java +++ b/src/main/java/gtnhlanth/common/tileentity/MTETargetChamber.java @@ -272,15 +272,7 @@ public class MTETargetChamber extends MTEEnhancedMultiBlockBase maskLimit) batchAmount = maskLimit; // Limited by mask durability first, if it's + // present in recipe. Assume mask is present in + // machine from above condition + } + + progressTime = 1; + } + + this.mMaxProgresstime = (int) progressTime; // 5 + // seconds + // per // integer multiple // over the rate. E.g., 100a, 10r // would equal 50 seconds + if (this.mMaxProgresstime == Integer.MAX_VALUE - 1 && this.mEUt == Integer.MAX_VALUE - 1) return false; + double maxParallel = tRecipe + .maxParallelCalculatedByInputs(batchAmount, new FluidStack[] {}, tItemsWithFocusItemArray); + + if (maxParallel < 1) // Insufficient items + return false; + + if (batchAmount > maxParallel) batchAmount = (int) maxParallel; + + tRecipe.consumeInput(batchAmount, new FluidStack[] {}, tItemsWithFocusItemArray); + + focusDurabilityDepletion = batchAmount; + + ItemStack[] itemOutputArray = GTUtility.copyItemArray(tRecipe.mOutputs); + + for (ItemStack stack : itemOutputArray) { + + stack.stackSize *= batchAmount; + + } + + this.mEfficiency = (10000 - (this.getIdealStatus() - this.getRepairStatus()) * 1000); + this.mEfficiencyIncrease = 10000; + mEUt = (int) -tVoltage; if (this.mEUt > 0) this.mEUt = (-this.mEUt); - this.mOutputItems = tRecipe.mOutputs; + this.mOutputItems = itemOutputArray; if (tRecipe.focusItem != null) // Recipe actually uses the mask, can also assume machine mask item is nonnull // due to above conditions mInputFocus.get(0) - .depleteFocusDurability(1); + .depleteFocusDurability(focusDurabilityDepletion); this.updateSlots(); @@ -325,9 +366,6 @@ public class MTETargetChamber extends MTEEnhancedMultiBlockBase