From 5fc8994a01b6647a0e94285173f8abee56b87554 Mon Sep 17 00:00:00 2001 From: StaffiX <32968022+StaffiX@users.noreply.github.com> Date: Fri, 27 Dec 2024 11:00:15 +0100 Subject: [PATCH 1/9] make bio vat use metadata --- .../API/recipe/BacterialVatFrontend.java | 37 +++++++++---------- .../common/loaders/BioRecipeLoader.java | 14 +++---- .../common/tileentities/multis/MTEBioVat.java | 29 +++++++-------- .../processingLoaders/AdditionalRecipes.java | 5 +-- .../java/gregtech/api/recipe/RecipeMaps.java | 5 +-- .../api/recipe/metadata/Sieverts.java | 12 ++++++ .../gregtech/api/util/GTRecipeConstants.java | 10 +++-- 7 files changed, 59 insertions(+), 53 deletions(-) create mode 100644 src/main/java/gregtech/api/recipe/metadata/Sieverts.java diff --git a/src/main/java/bartworks/API/recipe/BacterialVatFrontend.java b/src/main/java/bartworks/API/recipe/BacterialVatFrontend.java index b310ad576ff..2b86bbd7dcd 100644 --- a/src/main/java/bartworks/API/recipe/BacterialVatFrontend.java +++ b/src/main/java/bartworks/API/recipe/BacterialVatFrontend.java @@ -1,6 +1,7 @@ package bartworks.API.recipe; -import java.util.Arrays; +import static gregtech.api.util.GTRecipeConstants.GLASS; + import java.util.List; import javax.annotation.ParametersAreNonnullByDefault; @@ -10,15 +11,15 @@ import com.gtnewhorizons.modularui.api.math.Alignment; -import bartworks.common.tileentities.multis.MTEBioVat; import gregtech.api.enums.GTValues; import gregtech.api.recipe.BasicUIPropertiesBuilder; import gregtech.api.recipe.NEIRecipePropertiesBuilder; import gregtech.api.recipe.RecipeMapFrontend; +import gregtech.api.recipe.metadata.Sieverts; +import gregtech.api.util.GTRecipeConstants; import gregtech.api.util.MethodsReturnNonnullByDefault; import gregtech.nei.GTNEIDefaultHandler; import gregtech.nei.RecipeDisplayInfo; -import gregtech.nei.formatter.INEISpecialInfoFormatter; @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault @@ -26,9 +27,7 @@ public class BacterialVatFrontend extends RecipeMapFrontend { public BacterialVatFrontend(BasicUIPropertiesBuilder uiPropertiesBuilder, NEIRecipePropertiesBuilder neiPropertiesBuilder) { - super( - uiPropertiesBuilder, - neiPropertiesBuilder.neiSpecialInfoFormatter(new BacterialVatSpecialValueFormatter())); + super(uiPropertiesBuilder, neiPropertiesBuilder); } @Override @@ -75,21 +74,19 @@ private void drawFluidOverlay(GTNEIDefaultHandler.FixedPositionedStack stack) { super.drawNEIOverlayForOutput(stack); } - private static class BacterialVatSpecialValueFormatter implements INEISpecialInfoFormatter { - - @Override - public List format(RecipeDisplayInfo recipeInfo) { - int[] tSpecialA = MTEBioVat.specialValueUnpack(recipeInfo.recipe.mSpecialValue); - String glassTier = StatCollector.translateToLocalFormatted("nei.biovat.0.name", GTValues.VN[tSpecialA[0]]); - String sievert = ""; - if (!(tSpecialA[3] == 0)) { - if (tSpecialA[2] == 1) { - sievert = StatCollector.translateToLocalFormatted("nei.biovat.1.name", tSpecialA[3]); - } else { - sievert = StatCollector.translateToLocalFormatted("nei.biovat.2.name", tSpecialA[3]); - } + @Override + protected void drawEnergyInfo(RecipeDisplayInfo recipeInfo) { + int glassTier = recipeInfo.recipe.getMetadataOrDefault(GLASS, 3); + Sieverts data = recipeInfo.recipe.getMetadataOrDefault(GTRecipeConstants.SIEVERTS, new Sieverts(0, false)); + int sievert = data.sievert; + boolean isExact = data.isExact; + recipeInfo.drawText(StatCollector.translateToLocalFormatted("nei.biovat.0.name", GTValues.VN[glassTier])); + if (sievert != 0) { + if (!isExact) { + recipeInfo.drawText(StatCollector.translateToLocalFormatted("nei.biovat.1.name", sievert)); + } else { + recipeInfo.drawText(StatCollector.translateToLocalFormatted("nei.biovat.2.name", sievert)); } - return Arrays.asList(glassTier, sievert); } } } diff --git a/src/main/java/bartworks/common/loaders/BioRecipeLoader.java b/src/main/java/bartworks/common/loaders/BioRecipeLoader.java index 8d0f975e3e5..cce8032d8dc 100644 --- a/src/main/java/bartworks/common/loaders/BioRecipeLoader.java +++ b/src/main/java/bartworks/common/loaders/BioRecipeLoader.java @@ -15,12 +15,11 @@ import static bartworks.API.recipe.BartWorksRecipeMaps.bacterialVatRecipes; import static bartworks.API.recipe.BartWorksRecipeMaps.bioLabRecipes; -import static bartworks.util.BWRecipes.computeSieverts; import static gregtech.api.enums.Mods.CropsPlusPlus; import static gregtech.api.util.GTRecipeBuilder.MINUTES; import static gregtech.api.util.GTRecipeBuilder.SECONDS; import static gregtech.api.util.GTRecipeBuilder.TICKS; -import static gregtech.api.util.GTRecipeConstants.SIEVERTS; +import static gregtech.api.util.GTRecipeConstants.GLASS; import net.minecraft.init.Blocks; import net.minecraft.init.Items; @@ -132,7 +131,6 @@ public static void registerWaterBasedBacterialVatRecipes() { .special(BioItemList.getPetriDish(BioCultureLoader.CommonYeast)) .fluidInputs(new FluidStack(fluidStack, 100)) .fluidOutputs(FluidRegistry.getFluidStack("potion.ghp", 1)) - .metadata(SIEVERTS, computeSieverts(0, 3, false, false, false)) .duration(17 * SECONDS + 10 * TICKS) .eut(TierEU.RECIPE_EV) .noOptimize() @@ -144,7 +142,7 @@ public static void registerWaterBasedBacterialVatRecipes() { .special(BioItemList.getPetriDish(BioCultureLoader.WhineYeast)) .fluidInputs(new FluidStack(fluidStack, 100)) .fluidOutputs(FluidRegistry.getFluidStack("potion.wine", 12)) - .metadata(SIEVERTS, computeSieverts(0, 3, false, false, false)) + .metadata(GLASS, 3) .duration(10 * SECONDS) .eut(TierEU.RECIPE_MV) .noOptimize() @@ -158,7 +156,7 @@ public static void registerWaterBasedBacterialVatRecipes() { .special(BioItemList.getPetriDish(BioCultureLoader.BeerYeast)) .fluidInputs(new FluidStack(fluidStack, 100)) .fluidOutputs(FluidRegistry.getFluidStack("potion.beer", 5)) - .metadata(SIEVERTS, computeSieverts(0, 3, false, false, false)) + .metadata(GLASS, 3) .duration(30 * SECONDS) .eut(TierEU.RECIPE_LV) .noOptimize() @@ -169,7 +167,7 @@ public static void registerWaterBasedBacterialVatRecipes() { .special(BioItemList.getPetriDish(BioCultureLoader.BeerYeast)) .fluidInputs(new FluidStack(fluidStack, 100)) .fluidOutputs(FluidRegistry.getFluidStack("potion.darkbeer", 10)) - .metadata(SIEVERTS, computeSieverts(0, 3, false, false, false)) + .metadata(GLASS, 3) .duration(30 * SECONDS) .eut(TierEU.RECIPE_LV) .noOptimize() @@ -184,7 +182,7 @@ public static void registerBacterialVatRecipes() { .special(BioItemList.getPetriDish(BioCultureLoader.WhineYeast)) .fluidInputs(FluidRegistry.getFluidStack("potion.grapejuice", 100)) .fluidOutputs(FluidRegistry.getFluidStack("potion.wine", 12)) - .metadata(SIEVERTS, computeSieverts(0, 3, false, false, false)) + .metadata(GLASS, 3) .duration(20 * SECONDS) .eut(TierEU.RECIPE_LV) .noOptimize() @@ -194,7 +192,7 @@ public static void registerBacterialVatRecipes() { .special(BioItemList.getPetriDish(BioCultureLoader.anaerobicOil)) .fluidInputs(Materials.FermentedBiomass.getFluid(10000)) .fluidOutputs(new FluidStack(FluidLoader.fulvicAcid, 1000)) - .metadata(SIEVERTS, computeSieverts(0, 3, false, false, false)) + .metadata(GLASS, 3) .duration(2 * MINUTES + 17 * SECONDS + 8 * TICKS) .eut(TierEU.RECIPE_LV) .noOptimize() diff --git a/src/main/java/bartworks/common/tileentities/multis/MTEBioVat.java b/src/main/java/bartworks/common/tileentities/multis/MTEBioVat.java index e61650e4923..2e535f93cff 100644 --- a/src/main/java/bartworks/common/tileentities/multis/MTEBioVat.java +++ b/src/main/java/bartworks/common/tileentities/multis/MTEBioVat.java @@ -24,6 +24,7 @@ import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_DISTILLATION_TOWER_ACTIVE; import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_DISTILLATION_TOWER_ACTIVE_GLOW; import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_DISTILLATION_TOWER_GLOW; +import static gregtech.api.util.GTRecipeConstants.GLASS; import static gregtech.api.util.GTStructureUtility.ofHatchAdder; import java.util.ArrayList; @@ -79,8 +80,10 @@ import gregtech.api.recipe.RecipeMap; import gregtech.api.recipe.check.CheckRecipeResult; import gregtech.api.recipe.check.CheckRecipeResultRegistry; +import gregtech.api.recipe.metadata.Sieverts; import gregtech.api.render.TextureFactory; import gregtech.api.util.GTRecipe; +import gregtech.api.util.GTRecipeConstants; import gregtech.api.util.GTUtility; import gregtech.api.util.MultiblockTooltipBuilder; import gregtech.api.util.ParallelHelper; @@ -170,15 +173,6 @@ protected MultiblockTooltipBuilder createTooltip() { return tt; } - public static int[] specialValueUnpack(int aSpecialValue) { - int[] ret = new int[4]; - ret[0] = aSpecialValue & 0xF; // = glass tier - ret[1] = aSpecialValue >>> 4 & 0b11; // = special value - ret[2] = aSpecialValue >>> 6 & 0b1; // boolean exact svt | 1 = true | 0 = false - ret[3] = aSpecialValue >>> 7 & Integer.MAX_VALUE; // = sievert - return ret; - } - private int getInputCapacity() { return this.mInputHatches.stream() .mapToInt(MTEHatchInput::getCapacity) @@ -244,21 +238,24 @@ protected ProcessingLogic createProcessingLogic() { @NotNull @Override protected CheckRecipeResult validateRecipe(@NotNull GTRecipe recipe) { + Sieverts data = recipe.getMetadataOrDefault(GTRecipeConstants.SIEVERTS, new Sieverts(0, false)); + int sievert = data.sievert; + boolean isExact = data.isExact; + int glass = recipe.getMetadataOrDefault(GLASS, 0); if (!BWUtil.areStacksEqualOrNull((ItemStack) recipe.mSpecialItems, MTEBioVat.this.getControllerSlot())) return CheckRecipeResultRegistry.NO_RECIPE; - int[] conditions = MTEBioVat.specialValueUnpack(recipe.mSpecialValue); - MTEBioVat.this.mNeededSievert = conditions[3]; + MTEBioVat.this.mNeededSievert = sievert; - if (MTEBioVat.this.mGlassTier < conditions[0]) { - return CheckRecipeResultRegistry.insufficientMachineTier(conditions[0]); + if (MTEBioVat.this.mGlassTier < glass) { + return CheckRecipeResultRegistry.insufficientMachineTier(glass); } - if (conditions[2] == 0) { + if (!isExact) { if (MTEBioVat.this.mSievert < MTEBioVat.this.mNeededSievert) { return ResultWrongSievert.insufficientSievert(MTEBioVat.this.mNeededSievert); } - } else if (MTEBioVat.this.mSievert != conditions[3]) { - return ResultWrongSievert.wrongSievert(conditions[3]); + } else if (MTEBioVat.this.mSievert != sievert) { + return ResultWrongSievert.wrongSievert(sievert); } return CheckRecipeResultRegistry.SUCCESSFUL; diff --git a/src/main/java/bartworks/system/material/processingLoaders/AdditionalRecipes.java b/src/main/java/bartworks/system/material/processingLoaders/AdditionalRecipes.java index f76877734ff..a3d22e2e144 100644 --- a/src/main/java/bartworks/system/material/processingLoaders/AdditionalRecipes.java +++ b/src/main/java/bartworks/system/material/processingLoaders/AdditionalRecipes.java @@ -15,7 +15,6 @@ import static bartworks.API.recipe.BartWorksRecipeMaps.bacterialVatRecipes; import static bartworks.API.recipe.BartWorksRecipeMaps.bioLabRecipes; -import static bartworks.util.BWRecipes.computeSieverts; import static gregtech.api.enums.Mods.Gendustry; import static gregtech.api.enums.OrePrefixes.bolt; import static gregtech.api.enums.OrePrefixes.crushed; @@ -49,7 +48,7 @@ import static gregtech.api.util.GTRecipeConstants.COIL_HEAT; import static gregtech.api.util.GTRecipeConstants.FUEL_VALUE; import static gregtech.api.util.GTRecipeConstants.FUSION_THRESHOLD; -import static gregtech.api.util.GTRecipeConstants.SIEVERTS; +import static gregtech.api.util.GTRecipeConstants.GLASS; import static gregtech.api.util.GTRecipeConstants.UniversalChemical; import java.util.Arrays; @@ -232,7 +231,7 @@ private static void runBWRecipes() { .special(BioItemList.getPetriDish(bioCulture)) .fluidInputs(fluidStack) .fluidOutputs(new FluidStack(bioCulture.getFluid(), 10)) - .metadata(SIEVERTS, computeSieverts(0, 3, false, false, false)) + .metadata(GLASS, 3) .duration(50 * SECONDS) .eut(TierEU.RECIPE_MV) .addTo(bacterialVatRecipes); diff --git a/src/main/java/gregtech/api/recipe/RecipeMaps.java b/src/main/java/gregtech/api/recipe/RecipeMaps.java index 31c4ce8b249..d3f107123de 100644 --- a/src/main/java/gregtech/api/recipe/RecipeMaps.java +++ b/src/main/java/gregtech/api/recipe/RecipeMaps.java @@ -1,6 +1,5 @@ package gregtech.api.recipe; -import static bartworks.util.BWRecipes.computeSieverts; import static gregtech.api.enums.Mods.Avaritia; import static gregtech.api.enums.Mods.GTNHIntergalactic; import static gregtech.api.enums.Mods.NEICustomDiagrams; @@ -9,7 +8,7 @@ import static gregtech.api.util.GTModHandler.getModItem; import static gregtech.api.util.GTRecipeConstants.ADDITIVE_AMOUNT; import static gregtech.api.util.GTRecipeConstants.FUEL_VALUE; -import static gregtech.api.util.GTRecipeConstants.SIEVERTS; +import static gregtech.api.util.GTRecipeConstants.GLASS; import static gregtech.api.util.GTRecipeMapUtil.GTRecipeTemplate; import static gregtech.api.util.GTRecipeMapUtil.asTemplate; import static gregtech.api.util.GTRecipeMapUtil.buildOrEmpty; @@ -1221,7 +1220,7 @@ && isArrayEmptyOrNull(b.getFluidOutputs()) b -> BartWorksRecipeMaps.bacterialVatRecipes.doAdd( b.copy() .special(BioItemList.getPetriDish(BioCultureLoader.generalPurposeFermentingBacteria)) - .metadata(SIEVERTS, computeSieverts(0, 3, false, false, false)) + .metadata(GLASS, 3) .eut(b.getEUt())))); RecipeMaps.implosionRecipes.addDownstream( IRecipeMap.newRecipeMap( diff --git a/src/main/java/gregtech/api/recipe/metadata/Sieverts.java b/src/main/java/gregtech/api/recipe/metadata/Sieverts.java new file mode 100644 index 00000000000..cf27a4726c3 --- /dev/null +++ b/src/main/java/gregtech/api/recipe/metadata/Sieverts.java @@ -0,0 +1,12 @@ +package gregtech.api.recipe.metadata; + +public class Sieverts { + + public final int sievert; + public final boolean isExact; + + public Sieverts(int sievert, boolean isExact) { + this.sievert = sievert; + this.isExact = isExact; + } +} diff --git a/src/main/java/gregtech/api/util/GTRecipeConstants.java b/src/main/java/gregtech/api/util/GTRecipeConstants.java index e0af3d0d7d2..6485c1b6919 100644 --- a/src/main/java/gregtech/api/util/GTRecipeConstants.java +++ b/src/main/java/gregtech/api/util/GTRecipeConstants.java @@ -26,6 +26,7 @@ import gregtech.api.recipe.RecipeCategories; import gregtech.api.recipe.RecipeMaps; import gregtech.api.recipe.RecipeMetadataKey; +import gregtech.api.recipe.metadata.Sieverts; import gregtech.api.recipe.metadata.SimpleRecipeMetadataKey; import gregtech.common.items.IDMetaItem03; import gregtech.common.items.MetaGeneratedItem03; @@ -214,9 +215,13 @@ public class GTRecipeConstants { .create(Integer.class, "research_station_data"); /** - * glass tier required for the biovat recipes. + * sievert data required for the biovat recipes. */ - public static final RecipeMetadataKey SIEVERTS = SimpleRecipeMetadataKey.create(Integer.class, "sieverts"); + + public static final RecipeMetadataKey SIEVERTS = SimpleRecipeMetadataKey + .create(Sieverts.class, "SIEVERTS"); + + public static final RecipeMetadataKey GLASS = SimpleRecipeMetadataKey.create(Integer.class, "GLASS"); public static final RecipeMetadataKey DECAY_TICKS = SimpleRecipeMetadataKey .create(Integer.class, "decay_ticks"); @@ -709,7 +714,6 @@ public IRecipeMap getTarget() { GTRecipeMapUtil.SPECIAL_VALUE_ALIASES.add(PRECISE_ASSEMBLER_CASING_TIER); GTRecipeMapUtil.SPECIAL_VALUE_ALIASES.add(COAL_CASING_TIER); GTRecipeMapUtil.SPECIAL_VALUE_ALIASES.add(RESEARCH_STATION_DATA); - GTRecipeMapUtil.SPECIAL_VALUE_ALIASES.add(SIEVERTS); GTRecipeMapUtil.SPECIAL_VALUE_ALIASES.add(DECAY_TICKS); } From abf1a9e7a08b30737461ed1e8580c6128261a66a Mon Sep 17 00:00:00 2001 From: StaffiX <32968022+StaffiX@users.noreply.github.com> Date: Fri, 27 Dec 2024 15:43:37 +0100 Subject: [PATCH 2/9] remove special value, duration and eu/t usage for decay time, mass and sievert --- .../API/recipe/BacterialVatFrontend.java | 4 +- .../API/recipe/RadioHatchFrontend.java | 14 +- .../loaders/RadioHatchMaterialLoader.java | 338 ++++++++++-------- .../common/tileentities/multis/MTEBioVat.java | 4 +- .../tiered/GT_MetaTileEntity_RadioHatch.java | 31 +- src/main/java/bartworks/util/BWRecipes.java | 71 ---- .../java/gregtech/api/recipe/RecipeMaps.java | 5 +- .../metadata/{Sieverts.java => Sievert.java} | 9 +- .../gregtech/api/util/GTRecipeConstants.java | 10 +- .../assets/bartworks/lang/en_US.lang | 2 +- 10 files changed, 237 insertions(+), 251 deletions(-) delete mode 100644 src/main/java/bartworks/util/BWRecipes.java rename src/main/java/gregtech/api/recipe/metadata/{Sieverts.java => Sievert.java} (50%) diff --git a/src/main/java/bartworks/API/recipe/BacterialVatFrontend.java b/src/main/java/bartworks/API/recipe/BacterialVatFrontend.java index 2b86bbd7dcd..1112c830fcd 100644 --- a/src/main/java/bartworks/API/recipe/BacterialVatFrontend.java +++ b/src/main/java/bartworks/API/recipe/BacterialVatFrontend.java @@ -15,7 +15,7 @@ import gregtech.api.recipe.BasicUIPropertiesBuilder; import gregtech.api.recipe.NEIRecipePropertiesBuilder; import gregtech.api.recipe.RecipeMapFrontend; -import gregtech.api.recipe.metadata.Sieverts; +import gregtech.api.recipe.metadata.Sievert; import gregtech.api.util.GTRecipeConstants; import gregtech.api.util.MethodsReturnNonnullByDefault; import gregtech.nei.GTNEIDefaultHandler; @@ -77,7 +77,7 @@ private void drawFluidOverlay(GTNEIDefaultHandler.FixedPositionedStack stack) { @Override protected void drawEnergyInfo(RecipeDisplayInfo recipeInfo) { int glassTier = recipeInfo.recipe.getMetadataOrDefault(GLASS, 3); - Sieverts data = recipeInfo.recipe.getMetadataOrDefault(GTRecipeConstants.SIEVERTS, new Sieverts(0, false)); + Sievert data = recipeInfo.recipe.getMetadataOrDefault(GTRecipeConstants.SIEVERT, new Sievert(0, false)); int sievert = data.sievert; boolean isExact = data.isExact; recipeInfo.drawText(StatCollector.translateToLocalFormatted("nei.biovat.0.name", GTValues.VN[glassTier])); diff --git a/src/main/java/bartworks/API/recipe/RadioHatchFrontend.java b/src/main/java/bartworks/API/recipe/RadioHatchFrontend.java index 1335323f4e4..3a0b64d6d00 100644 --- a/src/main/java/bartworks/API/recipe/RadioHatchFrontend.java +++ b/src/main/java/bartworks/API/recipe/RadioHatchFrontend.java @@ -7,9 +7,12 @@ import net.minecraft.util.StatCollector; +import bartworks.common.tileentities.tiered.GT_MetaTileEntity_RadioHatch; import gregtech.api.recipe.BasicUIPropertiesBuilder; import gregtech.api.recipe.NEIRecipePropertiesBuilder; import gregtech.api.recipe.RecipeMapFrontend; +import gregtech.api.recipe.metadata.Sievert; +import gregtech.api.util.GTRecipeConstants; import gregtech.api.util.MethodsReturnNonnullByDefault; import gregtech.nei.RecipeDisplayInfo; import gregtech.nei.formatter.INEISpecialInfoFormatter; @@ -33,13 +36,14 @@ private static class RadioHatchSpecialInfoFormatter implements INEISpecialInfoFo @Override public List format(RecipeDisplayInfo recipeInfo) { - int radioLevel = recipeInfo.recipe.mEUt; - int amount = recipeInfo.recipe.mDuration; - long time = recipeInfo.recipe.mSpecialValue; + Sievert data = recipeInfo.recipe.getMetadataOrDefault(GTRecipeConstants.SIEVERT, new Sievert(0)); + int radioLevel = data.sievert; + int mass = recipeInfo.recipe.getMetadataOrDefault(GTRecipeConstants.MASS, 0); + long time = GT_MetaTileEntity_RadioHatch.calcDecayTicks(radioLevel); return Arrays.asList( StatCollector.translateToLocalFormatted("BW.NEI.display.radhatch.0", radioLevel), - StatCollector.translateToLocalFormatted("BW.NEI.display.radhatch.1", amount), - StatCollector.translateToLocalFormatted("BW.NEI.display.radhatch.2", time * amount / 20.0)); + StatCollector.translateToLocalFormatted("BW.NEI.display.radhatch.1", mass), + StatCollector.translateToLocalFormatted("BW.NEI.display.radhatch.2", time * mass / 20.0)); } } } diff --git a/src/main/java/bartworks/common/loaders/RadioHatchMaterialLoader.java b/src/main/java/bartworks/common/loaders/RadioHatchMaterialLoader.java index 193be473b39..6087f52259c 100644 --- a/src/main/java/bartworks/common/loaders/RadioHatchMaterialLoader.java +++ b/src/main/java/bartworks/common/loaders/RadioHatchMaterialLoader.java @@ -1,9 +1,9 @@ package bartworks.common.loaders; import static bartworks.API.recipe.BartWorksRecipeMaps.radioHatchRecipes; -import static bartworks.util.BWRecipes.calcDecayTicks; import static gregtech.api.enums.Mods.IndustrialCraft2; -import static gregtech.api.util.GTRecipeConstants.DECAY_TICKS; +import static gregtech.api.util.GTRecipeConstants.MASS; +import static gregtech.api.util.GTRecipeConstants.SIEVERT; import bartworks.system.material.BWNonMetaMaterialItems; import bartworks.system.material.Werkstoff; @@ -12,6 +12,7 @@ import gregtech.api.enums.ItemList; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; +import gregtech.api.recipe.metadata.Sievert; import gregtech.api.util.GTModHandler; import gregtech.api.util.GTOreDictUnificator; @@ -30,16 +31,18 @@ public static void run() { .getProtons(); if (material.hasItemType(OrePrefixes.stick)) GTValues.RA.stdBuilder() .itemInputs(material.get(OrePrefixes.stick)) - .duration(1) - .eut(level) - .metadata(DECAY_TICKS, (int) calcDecayTicks(level)) + .duration(0) + .eut(0) + .metadata(SIEVERT, new Sievert(level)) + .metadata(MASS, 1) .noOptimize() .addTo(radioHatchRecipes); if (material.hasItemType(OrePrefixes.stickLong)) GTValues.RA.stdBuilder() .itemInputs(material.get(OrePrefixes.stickLong)) - .duration(2) - .eut(level) - .metadata(DECAY_TICKS, (int) calcDecayTicks(level)) + .duration(0) + .eut(0) + .metadata(SIEVERT, new Sievert(level)) + .metadata(MASS, 2) .noOptimize() .addTo(radioHatchRecipes); } @@ -53,18 +56,20 @@ public static void run() { if (GTOreDictUnificator.get(OrePrefixes.stick, material, 1) != null) { GTValues.RA.stdBuilder() .itemInputs(GTOreDictUnificator.get(OrePrefixes.stick, material, 1)) - .duration(1) - .eut(level) - .metadata(DECAY_TICKS, (int) calcDecayTicks(level)) + .duration(0) + .eut(0) + .metadata(SIEVERT, new Sievert(level)) + .metadata(MASS, 1) .noOptimize() .addTo(radioHatchRecipes); } if (GTOreDictUnificator.get(OrePrefixes.stickLong, material, 1) != null) { GTValues.RA.stdBuilder() .itemInputs(GTOreDictUnificator.get(OrePrefixes.stickLong, material, 1)) - .duration(2) - .eut(level) - .metadata(DECAY_TICKS, (int) calcDecayTicks(level)) + .duration(0) + .eut(0) + .metadata(SIEVERT, new Sievert(level)) + .metadata(MASS, 2) .noOptimize() .addTo(radioHatchRecipes); } @@ -78,9 +83,10 @@ public static void run() { if (GTOreDictUnificator.get(OrePrefixes.stick, spacialMaterial[i], 1) != null) { GTValues.RA.stdBuilder() .itemInputs(GTOreDictUnificator.get(OrePrefixes.stick, spacialMaterial[i], 1)) - .duration(1) - .eut(spacialValue[i]) - .metadata(DECAY_TICKS, (int) calcDecayTicks(spacialValue[i])) + .duration(0) + .eut(0) + .metadata(SIEVERT, new Sievert(spacialValue[i])) + .metadata(MASS, 1) .noOptimize() .addTo(radioHatchRecipes); } @@ -88,9 +94,10 @@ public static void run() { if (GTOreDictUnificator.get(OrePrefixes.stickLong, spacialMaterial[i], 1) != null) { GTValues.RA.stdBuilder() .itemInputs(GTOreDictUnificator.get(OrePrefixes.stickLong, spacialMaterial[i], 1)) - .duration(2) - .eut(spacialValue[i]) - .metadata(DECAY_TICKS, (int) calcDecayTicks(spacialValue[i])) + .duration(0) + .eut(0) + .metadata(SIEVERT, new Sievert(spacialValue[i])) + .metadata(MASS, 2) .noOptimize() .addTo(radioHatchRecipes); } @@ -98,268 +105,293 @@ public static void run() { GTValues.RA.stdBuilder() .itemInputs(ItemList.ThoriumCell_1.get(1)) - .duration(3) - .eut((int) Materials.Thorium.getProtons()) - .metadata(DECAY_TICKS, (int) calcDecayTicks((int) Materials.Thorium.getProtons())) + .duration(0) + .eut(0) + .metadata(SIEVERT, new Sievert((int) Materials.Thorium.getProtons())) + .metadata(MASS, 3) .addTo(radioHatchRecipes); GTValues.RA.stdBuilder() .itemInputs(ItemList.ThoriumCell_2.get(1)) - .duration(6) - .eut((int) Materials.Thorium.getProtons()) - .metadata(DECAY_TICKS, (int) calcDecayTicks((int) Materials.Thorium.getProtons())) + .duration(0) + .eut(0) + .metadata(SIEVERT, new Sievert((int) Materials.Thorium.getProtons())) + .metadata(MASS, 6) .addTo(radioHatchRecipes); GTValues.RA.stdBuilder() .itemInputs(ItemList.ThoriumCell_4.get(1)) - .duration(12) - .eut((int) Materials.Thorium.getProtons()) - .metadata(DECAY_TICKS, (int) calcDecayTicks((int) Materials.Thorium.getProtons())) + .duration(0) + .eut(0) + .metadata(SIEVERT, new Sievert((int) Materials.Thorium.getProtons())) + .metadata(MASS, 12) .addTo(radioHatchRecipes); GTValues.RA.stdBuilder() .itemInputs(ItemList.NaquadahCell_1.get(1)) - .duration(3) - .eut(140) - .metadata(DECAY_TICKS, (int) calcDecayTicks(140)) + .duration(0) + .eut(0) + .metadata(SIEVERT, new Sievert(140)) + .metadata(MASS, 3) .addTo(radioHatchRecipes); GTValues.RA.stdBuilder() .itemInputs(ItemList.NaquadahCell_2.get(1)) - .duration(6) - .eut(140) - .metadata(DECAY_TICKS, (int) calcDecayTicks(140)) + .duration(0) + .eut(0) + .metadata(SIEVERT, new Sievert(140)) + .metadata(MASS, 6) .addTo(radioHatchRecipes); GTValues.RA.stdBuilder() .itemInputs(ItemList.NaquadahCell_4.get(1)) - .duration(12) - .eut(140) - .metadata(DECAY_TICKS, (int) calcDecayTicks(140)) + .duration(0) + .eut(0) + .metadata(SIEVERT, new Sievert(140)) + .metadata(MASS, 12) .addTo(radioHatchRecipes); GTValues.RA.stdBuilder() .itemInputs(ItemList.Moxcell_1.get(1)) - .duration(3) - .eut((int) Materials.Plutonium.getProtons()) - .metadata(DECAY_TICKS, (int) calcDecayTicks((int) Materials.Plutonium.getProtons())) + .duration(0) + .eut(0) + .metadata(SIEVERT, new Sievert((int) Materials.Plutonium.getProtons())) + .metadata(MASS, 3) .addTo(radioHatchRecipes); GTValues.RA.stdBuilder() .itemInputs(ItemList.Moxcell_2.get(1)) - .duration(6) - .eut((int) Materials.Plutonium.getProtons()) - .metadata(DECAY_TICKS, (int) calcDecayTicks((int) Materials.Plutonium.getProtons())) + .duration(0) + .eut(0) + .metadata(SIEVERT, new Sievert((int) Materials.Plutonium.getProtons())) + .metadata(MASS, 6) .addTo(radioHatchRecipes); GTValues.RA.stdBuilder() .itemInputs(ItemList.Moxcell_4.get(1)) - .duration(12) - .eut((int) Materials.Plutonium.getProtons()) - .metadata(DECAY_TICKS, (int) calcDecayTicks((int) Materials.Plutonium.getProtons())) + .duration(0) + .eut(0) + .metadata(SIEVERT, new Sievert((int) Materials.Plutonium.getProtons())) + .metadata(MASS, 12) .addTo(radioHatchRecipes); GTValues.RA.stdBuilder() .itemInputs(ItemList.Uraniumcell_1.get(1)) - .duration(3) - .eut((int) Materials.Uranium.getProtons()) - .metadata(DECAY_TICKS, (int) calcDecayTicks((int) Materials.Uranium.getProtons())) + .duration(0) + .eut(0) + .metadata(SIEVERT, new Sievert((int) Materials.Uranium.getProtons())) + .metadata(MASS, 3) .addTo(radioHatchRecipes); GTValues.RA.stdBuilder() .itemInputs(ItemList.Uraniumcell_2.get(1)) - .duration(6) - .eut((int) Materials.Uranium.getProtons()) - .metadata(DECAY_TICKS, (int) calcDecayTicks((int) Materials.Uranium.getProtons())) + .duration(0) + .eut(0) + .metadata(SIEVERT, new Sievert((int) Materials.Uranium.getProtons())) + .metadata(MASS, 6) .addTo(radioHatchRecipes); GTValues.RA.stdBuilder() .itemInputs(ItemList.Uraniumcell_4.get(1)) - .duration(12) - .eut((int) Materials.Uranium.getProtons()) - .metadata(DECAY_TICKS, (int) calcDecayTicks((int) Materials.Uranium.getProtons())) + .duration(0) + .eut(0) + .metadata(SIEVERT, new Sievert((int) Materials.Uranium.getProtons())) + .metadata(MASS, 12) .addTo(radioHatchRecipes); GTValues.RA.stdBuilder() .itemInputs(BWNonMetaMaterialItems.TiberiumCell_1.get(1)) - .duration(3) - .eut( - (int) WerkstoffLoader.Tiberium.getBridgeMaterial() - .getProtons()) + .duration(0) + .eut(0) .metadata( - DECAY_TICKS, - (int) calcDecayTicks( + SIEVERT, + new Sievert( (int) WerkstoffLoader.Tiberium.getBridgeMaterial() .getProtons())) + .metadata(MASS, 3) .addTo(radioHatchRecipes); GTValues.RA.stdBuilder() .itemInputs(BWNonMetaMaterialItems.TiberiumCell_2.get(1)) - .duration(6) - .eut( - (int) WerkstoffLoader.Tiberium.getBridgeMaterial() - .getProtons()) + .duration(0) + .eut(0) .metadata( - DECAY_TICKS, - (int) calcDecayTicks( + SIEVERT, + new Sievert( (int) WerkstoffLoader.Tiberium.getBridgeMaterial() .getProtons())) + .metadata(MASS, 6) .addTo(radioHatchRecipes); GTValues.RA.stdBuilder() .itemInputs(BWNonMetaMaterialItems.TiberiumCell_4.get(1)) - .duration(12) - .eut( - (int) WerkstoffLoader.Tiberium.getBridgeMaterial() - .getProtons()) + .duration(0) + .eut(0) .metadata( - DECAY_TICKS, - (int) calcDecayTicks( + SIEVERT, + new Sievert( (int) WerkstoffLoader.Tiberium.getBridgeMaterial() .getProtons())) + .metadata(MASS, 12) .addTo(radioHatchRecipes); GTValues.RA.stdBuilder() .itemInputs(BWNonMetaMaterialItems.TheCoreCell.get(1)) - .duration(96) - .eut(140) - .metadata(DECAY_TICKS, (int) calcDecayTicks(140)) + .duration(0) + .eut(0) + .metadata(SIEVERT, new Sievert(140)) + .metadata(MASS, 96) .addTo(radioHatchRecipes); GTValues.RA.stdBuilder() .itemInputs(ItemList.Depleted_Thorium_1.get(1)) - .duration(3) - .eut((int) Materials.Thorium.getProtons() / 10) - .metadata(DECAY_TICKS, (int) calcDecayTicks((int) Materials.Thorium.getProtons() / 10)) + .duration(0) + .eut(0) + .metadata(SIEVERT, new Sievert((int) Materials.Thorium.getProtons() / 10)) + .metadata(MASS, 3) .addTo(radioHatchRecipes); GTValues.RA.stdBuilder() .itemInputs(ItemList.Depleted_Thorium_2.get(1)) - .duration(6) - .eut((int) Materials.Thorium.getProtons() / 10) - .metadata(DECAY_TICKS, (int) calcDecayTicks((int) Materials.Thorium.getProtons() / 10)) + .duration(0) + .eut(0) + .metadata(SIEVERT, new Sievert((int) Materials.Thorium.getProtons() / 10)) + .metadata(MASS, 6) .addTo(radioHatchRecipes); GTValues.RA.stdBuilder() .itemInputs(ItemList.Depleted_Thorium_4.get(1)) - .duration(12) - .eut((int) Materials.Thorium.getProtons() / 10) - .metadata(DECAY_TICKS, (int) calcDecayTicks((int) Materials.Thorium.getProtons() / 10)) + .duration(0) + .eut(0) + .metadata(SIEVERT, new Sievert((int) Materials.Thorium.getProtons() / 10)) + .metadata(MASS, 12) .addTo(radioHatchRecipes); GTValues.RA.stdBuilder() .itemInputs(ItemList.Depleted_Naquadah_1.get(1)) - .duration(3) - .eut(14) - .metadata(DECAY_TICKS, (int) calcDecayTicks(14)) + .duration(0) + .eut(0) + .metadata(SIEVERT, new Sievert(14)) + .metadata(MASS, 3) .addTo(radioHatchRecipes); GTValues.RA.stdBuilder() .itemInputs(ItemList.Depleted_Naquadah_2.get(1)) - .duration(6) - .eut(14) - .metadata(DECAY_TICKS, (int) calcDecayTicks(14)) + .duration(0) + .eut(0) + .metadata(SIEVERT, new Sievert(14)) + .metadata(MASS, 6) .addTo(radioHatchRecipes); GTValues.RA.stdBuilder() .itemInputs(ItemList.Depleted_Naquadah_4.get(1)) - .duration(12) - .eut(14) - .metadata(DECAY_TICKS, (int) calcDecayTicks(14)) + .duration(0) + .eut(0) + .metadata(SIEVERT, new Sievert(14)) + .metadata(MASS, 12) .addTo(radioHatchRecipes); GTValues.RA.stdBuilder() .itemInputs(GTModHandler.getModItem(IndustrialCraft2.ID, "reactorMOXSimpledepleted", 1)) - .duration(3) - .eut((int) Materials.Plutonium.getProtons() / 10) - .metadata(DECAY_TICKS, (int) calcDecayTicks((int) Materials.Plutonium.getProtons() / 10)) + .duration(0) + .eut(0) + .metadata(SIEVERT, new Sievert((int) Materials.Plutonium.getProtons() / 10)) + .metadata(MASS, 3) .addTo(radioHatchRecipes); GTValues.RA.stdBuilder() .itemInputs(GTModHandler.getModItem(IndustrialCraft2.ID, "reactorMOXDualdepleted", 1)) - .duration(6) - .eut((int) Materials.Plutonium.getProtons() / 10) - .metadata(DECAY_TICKS, (int) calcDecayTicks((int) Materials.Plutonium.getProtons() / 10)) + .duration(0) + .eut(0) + .metadata(SIEVERT, new Sievert((int) Materials.Plutonium.getProtons() / 10)) + .metadata(MASS, 6) .addTo(radioHatchRecipes); GTValues.RA.stdBuilder() .itemInputs(GTModHandler.getModItem(IndustrialCraft2.ID, "reactorMOXQuaddepleted", 1)) - .duration(12) - .eut((int) Materials.Plutonium.getProtons() / 10) - .metadata(DECAY_TICKS, (int) calcDecayTicks((int) Materials.Plutonium.getProtons() / 10)) + .duration(0) + .eut(0) + .metadata(SIEVERT, new Sievert((int) Materials.Plutonium.getProtons() / 10)) + .metadata(MASS, 12) .addTo(radioHatchRecipes); GTValues.RA.stdBuilder() .itemInputs(GTModHandler.getModItem(IndustrialCraft2.ID, "reactorUraniumSimpledepleted", 1)) - .duration(3) - .eut((int) Materials.Uranium.getProtons() / 10) - .metadata(DECAY_TICKS, (int) calcDecayTicks((int) Materials.Uranium.getProtons() / 10)) + .duration(0) + .eut(0) + .metadata(SIEVERT, new Sievert((int) Materials.Uranium.getProtons() / 10)) + .metadata(MASS, 3) .addTo(radioHatchRecipes); GTValues.RA.stdBuilder() .itemInputs(GTModHandler.getModItem(IndustrialCraft2.ID, "reactorUraniumDualdepleted", 1)) - .duration(6) - .eut((int) Materials.Uranium.getProtons() / 10) - .metadata(DECAY_TICKS, (int) calcDecayTicks((int) Materials.Uranium.getProtons() / 10)) + .duration(0) + .eut(0) + .metadata(SIEVERT, new Sievert((int) Materials.Uranium.getProtons() / 10)) + .metadata(MASS, 6) .addTo(radioHatchRecipes); GTValues.RA.stdBuilder() .itemInputs(GTModHandler.getModItem(IndustrialCraft2.ID, "reactorUraniumQuaddepleted", 1)) - .duration(12) - .eut((int) Materials.Uranium.getProtons() / 10) - .metadata(DECAY_TICKS, (int) calcDecayTicks((int) Materials.Uranium.getProtons() / 10)) + .duration(0) + .eut(0) + .metadata(SIEVERT, new Sievert((int) Materials.Uranium.getProtons() / 10)) + .metadata(MASS, 12) .addTo(radioHatchRecipes); GTValues.RA.stdBuilder() .itemInputs(BWNonMetaMaterialItems.Depleted_Tiberium_1.get(1)) - .duration(3) - .eut( - (int) WerkstoffLoader.Tiberium.getBridgeMaterial() - .getProtons() / 10) + .duration(0) + .eut(0) .metadata( - DECAY_TICKS, - (int) calcDecayTicks( + SIEVERT, + new Sievert( (int) WerkstoffLoader.Tiberium.getBridgeMaterial() .getProtons() / 10)) + .metadata(MASS, 3) .addTo(radioHatchRecipes); GTValues.RA.stdBuilder() .itemInputs(BWNonMetaMaterialItems.Depleted_Tiberium_2.get(1)) - .duration(6) - .eut( - (int) WerkstoffLoader.Tiberium.getBridgeMaterial() - .getProtons() / 10) + .duration(0) + .eut(0) .metadata( - DECAY_TICKS, - (int) calcDecayTicks( + SIEVERT, + new Sievert( (int) WerkstoffLoader.Tiberium.getBridgeMaterial() .getProtons() / 10)) + .metadata(MASS, 6) .addTo(radioHatchRecipes); GTValues.RA.stdBuilder() .itemInputs(BWNonMetaMaterialItems.Depleted_Tiberium_4.get(1)) - .duration(12) - .eut( - (int) WerkstoffLoader.Tiberium.getBridgeMaterial() - .getProtons() / 10) + .duration(0) + .eut(0) .metadata( - DECAY_TICKS, - (int) calcDecayTicks( + SIEVERT, + new Sievert( (int) WerkstoffLoader.Tiberium.getBridgeMaterial() .getProtons() / 10)) + .metadata(MASS, 12) .addTo(radioHatchRecipes); GTValues.RA.stdBuilder() .itemInputs(BWNonMetaMaterialItems.Depleted_TheCoreCell.get(1)) - .duration(96) - .eut(13) - .metadata(DECAY_TICKS, (int) calcDecayTicks(13)) + .duration(0) + .eut(0) + .metadata(SIEVERT, new Sievert(13)) + .metadata(MASS, 96) .addTo(radioHatchRecipes); GTValues.RA.stdBuilder() .itemInputs(ItemList.MNqCell_1.get(1)) - .duration(3) - .eut(150) - .metadata(DECAY_TICKS, (int) calcDecayTicks(150)) + .duration(0) + .eut(0) + .metadata(SIEVERT, new Sievert(150)) + .metadata(MASS, 3) .addTo(radioHatchRecipes); GTValues.RA.stdBuilder() .itemInputs(ItemList.MNqCell_2.get(1)) - .duration(6) - .eut(150) - .metadata(DECAY_TICKS, (int) calcDecayTicks(150)) + .duration(0) + .eut(0) + .metadata(SIEVERT, new Sievert(150)) + .metadata(MASS, 6) .addTo(radioHatchRecipes); GTValues.RA.stdBuilder() .itemInputs(ItemList.MNqCell_4.get(1)) - .duration(12) - .eut(150) - .metadata(DECAY_TICKS, (int) calcDecayTicks(150)) + .duration(0) + .eut(0) + .metadata(SIEVERT, new Sievert(150)) + .metadata(MASS, 12) .addTo(radioHatchRecipes); GTValues.RA.stdBuilder() .itemInputs(ItemList.Depleted_MNq_1.get(1)) - .duration(3) - .eut(15) - .metadata(DECAY_TICKS, (int) calcDecayTicks(15)) + .duration(0) + .eut(0) + .metadata(SIEVERT, new Sievert(15)) + .metadata(MASS, 3) .addTo(radioHatchRecipes); GTValues.RA.stdBuilder() .itemInputs(ItemList.Depleted_MNq_2.get(1)) - .duration(6) - .eut(15) - .metadata(DECAY_TICKS, (int) calcDecayTicks(15)) + .duration(0) + .eut(0) + .metadata(SIEVERT, new Sievert(15)) + .metadata(MASS, 6) .addTo(radioHatchRecipes); GTValues.RA.stdBuilder() .itemInputs(ItemList.Depleted_MNq_4.get(1)) - .duration(12) - .eut(15) - .metadata(DECAY_TICKS, (int) calcDecayTicks(15)) + .duration(0) + .eut(0) + .metadata(SIEVERT, new Sievert(15)) + .metadata(MASS, 12) .addTo(radioHatchRecipes); - } } diff --git a/src/main/java/bartworks/common/tileentities/multis/MTEBioVat.java b/src/main/java/bartworks/common/tileentities/multis/MTEBioVat.java index 2e535f93cff..c8b7dcefc86 100644 --- a/src/main/java/bartworks/common/tileentities/multis/MTEBioVat.java +++ b/src/main/java/bartworks/common/tileentities/multis/MTEBioVat.java @@ -80,7 +80,7 @@ import gregtech.api.recipe.RecipeMap; import gregtech.api.recipe.check.CheckRecipeResult; import gregtech.api.recipe.check.CheckRecipeResultRegistry; -import gregtech.api.recipe.metadata.Sieverts; +import gregtech.api.recipe.metadata.Sievert; import gregtech.api.render.TextureFactory; import gregtech.api.util.GTRecipe; import gregtech.api.util.GTRecipeConstants; @@ -238,7 +238,7 @@ protected ProcessingLogic createProcessingLogic() { @NotNull @Override protected CheckRecipeResult validateRecipe(@NotNull GTRecipe recipe) { - Sieverts data = recipe.getMetadataOrDefault(GTRecipeConstants.SIEVERTS, new Sieverts(0, false)); + Sievert data = recipe.getMetadataOrDefault(GTRecipeConstants.SIEVERT, new Sievert(0, false)); int sievert = data.sievert; boolean isExact = data.isExact; int glass = recipe.getMetadataOrDefault(GLASS, 0); diff --git a/src/main/java/bartworks/common/tileentities/tiered/GT_MetaTileEntity_RadioHatch.java b/src/main/java/bartworks/common/tileentities/tiered/GT_MetaTileEntity_RadioHatch.java index b7e4e966fb7..99829e09e19 100644 --- a/src/main/java/bartworks/common/tileentities/tiered/GT_MetaTileEntity_RadioHatch.java +++ b/src/main/java/bartworks/common/tileentities/tiered/GT_MetaTileEntity_RadioHatch.java @@ -61,9 +61,11 @@ import gregtech.api.metatileentity.implementations.MTEHatch; import gregtech.api.objects.ItemData; import gregtech.api.recipe.RecipeMap; +import gregtech.api.recipe.metadata.Sievert; import gregtech.api.render.TextureFactory; import gregtech.api.util.GTOreDictUnificator; import gregtech.api.util.GTRecipe; +import gregtech.api.util.GTRecipeConstants; import gregtech.api.util.GTUtility; import gregtech.common.items.IDMetaTool01; import gregtech.common.items.MetaGeneratedTool01; @@ -200,9 +202,12 @@ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { if (!this.lastFail && this.lastUsedItem != null && this.lastRecipe != null) { if (GTUtility.areStacksEqual(this.lastUsedItem, lStack, true)) { - this.mass = (byte) this.lastRecipe.mDuration; - this.decayTime = this.lastRecipe.mSpecialValue; - this.sievert = this.lastRecipe.mEUt; + Sievert data = this.lastRecipe + .getMetadataOrDefault(GTRecipeConstants.SIEVERT, new Sievert(0, false)); + this.mass = this.lastRecipe.getMetadataOrDefault(GTRecipeConstants.MASS, 0) + .byteValue(); + this.decayTime = calcDecayTicks(data.sievert); + this.sievert = data.sievert; this.material = this.lastUsedItem.getDisplayName(); lStack.stackSize--; this.updateSlots(); @@ -219,16 +224,19 @@ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { this.lastFail = true; this.lastUsedItem = this.mInventory[0] == null ? null : this.mInventory[0].copy(); } else { - if (this.lastRecipe.mDuration > this.cap) { + if (this.lastRecipe.getMetadataOrDefault(GTRecipeConstants.MASS, 0) > this.cap) { this.lastFail = true; this.lastUsedItem = this.mInventory[0].copy(); return; } this.lastFail = false; this.lastUsedItem = this.mInventory[0].copy(); - this.mass = (byte) this.lastRecipe.mDuration; - this.decayTime = this.lastRecipe.mSpecialValue; - this.sievert = this.lastRecipe.mEUt; + Sievert data = this.lastRecipe + .getMetadataOrDefault(GTRecipeConstants.SIEVERT, new Sievert(0, false)); + this.mass = this.lastRecipe.getMetadataOrDefault(GTRecipeConstants.MASS, 0) + .byteValue(); + this.decayTime = calcDecayTicks(data.sievert); + this.sievert = data.sievert; this.material = lStack.getDisplayName(); lStack.stackSize--; this.updateSlots(); @@ -488,4 +496,13 @@ public GUITextureSet getGUITextureSet() { return new GUITextureSet().setMainBackground(GTUITextures.BACKGROUND_SINGLEBLOCK_DEFAULT) .setGregTechLogo(GTUITextures.PICTURE_GT_LOGO_17x17_TRANSPARENT); } + + public static long calcDecayTicks(int x) { + long ret; + if (x == 43) ret = 5000; + else if (x == 61) ret = 4500; + else if (x <= 100) ret = MathUtils.ceilLong((8000D * Math.tanh(-x / 20D) + 8000D) * 1000D); + else ret = MathUtils.ceilLong(8000D * Math.tanh(-x / 65D) + 8000D); + return ret; + } } diff --git a/src/main/java/bartworks/util/BWRecipes.java b/src/main/java/bartworks/util/BWRecipes.java deleted file mode 100644 index 1d6cd56c008..00000000000 --- a/src/main/java/bartworks/util/BWRecipes.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2018-2020 bartimaeusnek Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following - * conditions: The above copyright notice and this permission notice shall be included in all copies or substantial - * portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, - * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - -package bartworks.util; - -import gregtech.api.enums.Materials; - -public class BWRecipes { - - public static long calcDecayTicks(int x) { - long ret; - if (x == 43) ret = 5000; - else if (x == 61) ret = 4500; - else if (x <= 100) ret = MathUtils.ceilLong((8000D * Math.tanh(-x / 20D) + 8000D) * 1000D); - else ret = MathUtils.ceilLong(8000D * Math.tanh(-x / 65D) + 8000D); - return ret; - } - - public static int computeSieverts(int givenSievert, int glassTier, boolean requiresExactSieverts, boolean cleanroom, - boolean lowGravity) { - byte specialValue = 0; - if (cleanroom && lowGravity) { - specialValue = 3; - } else if (cleanroom) { - specialValue = 2; - } else if (lowGravity) { - specialValue = 1; - } - int sievertValue = 0; - if (givenSievert >= 83 || givenSievert == 61 || givenSievert == 43) sievertValue += givenSievert; - sievertValue = sievertValue << 1; - sievertValue = sievertValue | (requiresExactSieverts ? 1 : 0); - sievertValue = sievertValue << 2; - sievertValue = sievertValue | specialValue; - sievertValue = sievertValue << 4; - sievertValue = sievertValue | glassTier; - return sievertValue; - } - - public static int computeSieverts(Materials material, int glassTier, boolean requiresExactSieverts, - boolean cleanroom, boolean lowGravity) { - byte specialValue = 0; - if (cleanroom && lowGravity) { - specialValue = 3; - } else if (cleanroom) { - specialValue = 2; - } else if (lowGravity) { - specialValue = 1; - } - int aSievert = 0; - if (material.getProtons() >= 83 || material.getProtons() == 61 || material.getProtons() == 43) - aSievert += BWUtil.calculateSv(material); - aSievert = aSievert << 1; - aSievert = aSievert | (requiresExactSieverts ? 1 : 0); - aSievert = aSievert << 2; - aSievert = aSievert | specialValue; - aSievert = aSievert << 4; - aSievert = aSievert | glassTier; - return aSievert; - } -} diff --git a/src/main/java/gregtech/api/recipe/RecipeMaps.java b/src/main/java/gregtech/api/recipe/RecipeMaps.java index d3f107123de..62c5d4693b1 100644 --- a/src/main/java/gregtech/api/recipe/RecipeMaps.java +++ b/src/main/java/gregtech/api/recipe/RecipeMaps.java @@ -9,6 +9,7 @@ import static gregtech.api.util.GTRecipeConstants.ADDITIVE_AMOUNT; import static gregtech.api.util.GTRecipeConstants.FUEL_VALUE; import static gregtech.api.util.GTRecipeConstants.GLASS; +import static gregtech.api.util.GTRecipeConstants.SIEVERT; import static gregtech.api.util.GTRecipeMapUtil.GTRecipeTemplate; import static gregtech.api.util.GTRecipeMapUtil.asTemplate; import static gregtech.api.util.GTRecipeMapUtil.buildOrEmpty; @@ -73,6 +74,7 @@ import gregtech.api.recipe.metadata.CompressionTierKey; import gregtech.api.recipe.metadata.PCBFactoryTierKey; import gregtech.api.recipe.metadata.PurificationPlantBaseChanceKey; +import gregtech.api.recipe.metadata.Sievert; import gregtech.api.util.GTModHandler; import gregtech.api.util.GTOreDictUnificator; import gregtech.api.util.GTRecipe; @@ -1220,7 +1222,8 @@ && isArrayEmptyOrNull(b.getFluidOutputs()) b -> BartWorksRecipeMaps.bacterialVatRecipes.doAdd( b.copy() .special(BioItemList.getPetriDish(BioCultureLoader.generalPurposeFermentingBacteria)) - .metadata(GLASS, 3) + .metadata(GLASS, 5) + .metadata(SIEVERT, new Sievert(140, true)) .eut(b.getEUt())))); RecipeMaps.implosionRecipes.addDownstream( IRecipeMap.newRecipeMap( diff --git a/src/main/java/gregtech/api/recipe/metadata/Sieverts.java b/src/main/java/gregtech/api/recipe/metadata/Sievert.java similarity index 50% rename from src/main/java/gregtech/api/recipe/metadata/Sieverts.java rename to src/main/java/gregtech/api/recipe/metadata/Sievert.java index cf27a4726c3..2defd48b809 100644 --- a/src/main/java/gregtech/api/recipe/metadata/Sieverts.java +++ b/src/main/java/gregtech/api/recipe/metadata/Sievert.java @@ -1,12 +1,17 @@ package gregtech.api.recipe.metadata; -public class Sieverts { +public class Sievert { public final int sievert; public final boolean isExact; - public Sieverts(int sievert, boolean isExact) { + public Sievert(int sievert, boolean isExact) { this.sievert = sievert; this.isExact = isExact; } + + public Sievert(int sievert) { + this.sievert = sievert; + isExact = false; + } } diff --git a/src/main/java/gregtech/api/util/GTRecipeConstants.java b/src/main/java/gregtech/api/util/GTRecipeConstants.java index 394793c97ae..c9488039603 100644 --- a/src/main/java/gregtech/api/util/GTRecipeConstants.java +++ b/src/main/java/gregtech/api/util/GTRecipeConstants.java @@ -26,7 +26,7 @@ import gregtech.api.recipe.RecipeCategories; import gregtech.api.recipe.RecipeMaps; import gregtech.api.recipe.RecipeMetadataKey; -import gregtech.api.recipe.metadata.Sieverts; +import gregtech.api.recipe.metadata.Sievert; import gregtech.api.recipe.metadata.SimpleRecipeMetadataKey; import gregtech.common.items.IDMetaItem03; import gregtech.common.items.MetaGeneratedItem03; @@ -224,13 +224,11 @@ public class GTRecipeConstants { * sievert data required for the biovat recipes. */ - public static final RecipeMetadataKey SIEVERTS = SimpleRecipeMetadataKey - .create(Sieverts.class, "SIEVERTS"); + public static final RecipeMetadataKey SIEVERT = SimpleRecipeMetadataKey.create(Sievert.class, "SIEVERT"); public static final RecipeMetadataKey GLASS = SimpleRecipeMetadataKey.create(Integer.class, "GLASS"); - public static final RecipeMetadataKey DECAY_TICKS = SimpleRecipeMetadataKey - .create(Integer.class, "decay_ticks"); + public static final RecipeMetadataKey MASS = SimpleRecipeMetadataKey.create(Integer.class, "mass"); public static final RecipeMetadataKey NOBLE_GASES = SimpleRecipeMetadataKey .create(Boolean.class, "noble_gases"); @@ -720,7 +718,5 @@ public IRecipeMap getTarget() { GTRecipeMapUtil.SPECIAL_VALUE_ALIASES.add(PRECISE_ASSEMBLER_CASING_TIER); GTRecipeMapUtil.SPECIAL_VALUE_ALIASES.add(COAL_CASING_TIER); GTRecipeMapUtil.SPECIAL_VALUE_ALIASES.add(RESEARCH_STATION_DATA); - GTRecipeMapUtil.SPECIAL_VALUE_ALIASES.add(DECAY_TICKS); - } } diff --git a/src/main/resources/assets/bartworks/lang/en_US.lang b/src/main/resources/assets/bartworks/lang/en_US.lang index 4e50c9b4d53..d83bbdd0f6d 100644 --- a/src/main/resources/assets/bartworks/lang/en_US.lang +++ b/src/main/resources/assets/bartworks/lang/en_US.lang @@ -162,7 +162,7 @@ tooltip.tile.radhatch.0.name=Radioactive Item Chamber for Multiblocks tooltip.tile.radhatch.1.name=Use a screwdriver to set the containment level tooltip.tile.radhatch.2.name=Material: tooltip.tile.radhatch.3.name=Sievert: -tooltip.tile.radhatch.4.name=Amount: +tooltip.tile.radhatch.4.name=Mass: tooltip.tile.radhatch.5.name=Time (in t/s/m/h) to decay (1kg): tooltip.tile.radhatch.6.name=t tooltip.tile.radhatch.7.name=s From 929b796b02647bd4f8dd5043a757700ea0159a6e Mon Sep 17 00:00:00 2001 From: StaffiX <32968022+StaffiX@users.noreply.github.com> Date: Sun, 29 Dec 2024 12:41:01 +0100 Subject: [PATCH 3/9] make radio hatch stop using eu/t and duration data for sievert and mass --- .../API/recipe/BacterialVatFrontend.java | 2 +- .../API/recipe/BartWorksRecipeMaps.java | 2 +- .../API/recipe/RadioHatchFrontend.java | 2 +- .../loaders/RadioHatchMaterialLoader.java | 519 ++++++------------ .../loaders/recipes/CraftingRecipes.java | 102 ++-- .../common/tileentities/multis/MTEBioVat.java | 2 +- .../tiered/GT_MetaTileEntity_RadioHatch.java | 97 ++-- .../java/gregtech/api/recipe/RecipeMaps.java | 2 +- .../gregtech/api/util/GTRecipeConstants.java | 2 +- .../metadata => util/recipe}/Sievert.java | 2 +- 10 files changed, 261 insertions(+), 471 deletions(-) rename src/main/java/gregtech/api/{recipe/metadata => util/recipe}/Sievert.java (89%) diff --git a/src/main/java/bartworks/API/recipe/BacterialVatFrontend.java b/src/main/java/bartworks/API/recipe/BacterialVatFrontend.java index 1112c830fcd..68e376a80f2 100644 --- a/src/main/java/bartworks/API/recipe/BacterialVatFrontend.java +++ b/src/main/java/bartworks/API/recipe/BacterialVatFrontend.java @@ -15,9 +15,9 @@ import gregtech.api.recipe.BasicUIPropertiesBuilder; import gregtech.api.recipe.NEIRecipePropertiesBuilder; import gregtech.api.recipe.RecipeMapFrontend; -import gregtech.api.recipe.metadata.Sievert; import gregtech.api.util.GTRecipeConstants; import gregtech.api.util.MethodsReturnNonnullByDefault; +import gregtech.api.util.recipe.Sievert; import gregtech.nei.GTNEIDefaultHandler; import gregtech.nei.RecipeDisplayInfo; diff --git a/src/main/java/bartworks/API/recipe/BartWorksRecipeMaps.java b/src/main/java/bartworks/API/recipe/BartWorksRecipeMaps.java index a367cca300a..48fdc0e9df1 100644 --- a/src/main/java/bartworks/API/recipe/BartWorksRecipeMaps.java +++ b/src/main/java/bartworks/API/recipe/BartWorksRecipeMaps.java @@ -65,7 +65,7 @@ public class BartWorksRecipeMaps { .specialSlotSensitive() .progressBar(GTUITextures.PROGRESSBAR_CIRCUIT_ASSEMBLER) .build(); - public static final RecipeMap radioHatchRecipes = RecipeMapBuilder.of("bw.recipe.radhatch") + public static final RecipeMap radioHatchFakeRecipes = RecipeMapBuilder.of("bw.recipe.radhatch") .maxIO(1, 0, 0, 0) .minInputs(1, 0) .slotOverlays((index, isFluid, isOutput, isSpecial) -> BWUITextures.OVERLAY_SLOT_ROD) diff --git a/src/main/java/bartworks/API/recipe/RadioHatchFrontend.java b/src/main/java/bartworks/API/recipe/RadioHatchFrontend.java index 3a0b64d6d00..7a895c36688 100644 --- a/src/main/java/bartworks/API/recipe/RadioHatchFrontend.java +++ b/src/main/java/bartworks/API/recipe/RadioHatchFrontend.java @@ -11,9 +11,9 @@ import gregtech.api.recipe.BasicUIPropertiesBuilder; import gregtech.api.recipe.NEIRecipePropertiesBuilder; import gregtech.api.recipe.RecipeMapFrontend; -import gregtech.api.recipe.metadata.Sievert; import gregtech.api.util.GTRecipeConstants; import gregtech.api.util.MethodsReturnNonnullByDefault; +import gregtech.api.util.recipe.Sievert; import gregtech.nei.RecipeDisplayInfo; import gregtech.nei.formatter.INEISpecialInfoFormatter; diff --git a/src/main/java/bartworks/common/loaders/RadioHatchMaterialLoader.java b/src/main/java/bartworks/common/loaders/RadioHatchMaterialLoader.java index 6087f52259c..6e60b1d95ca 100644 --- a/src/main/java/bartworks/common/loaders/RadioHatchMaterialLoader.java +++ b/src/main/java/bartworks/common/loaders/RadioHatchMaterialLoader.java @@ -1,10 +1,15 @@ package bartworks.common.loaders; -import static bartworks.API.recipe.BartWorksRecipeMaps.radioHatchRecipes; +import static bartworks.API.recipe.BartWorksRecipeMaps.radioHatchFakeRecipes; import static gregtech.api.enums.Mods.IndustrialCraft2; import static gregtech.api.util.GTRecipeConstants.MASS; import static gregtech.api.util.GTRecipeConstants.SIEVERT; +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.item.ItemStack; + import bartworks.system.material.BWNonMetaMaterialItems; import bartworks.system.material.Werkstoff; import bartworks.system.material.WerkstoffLoader; @@ -12,14 +17,41 @@ import gregtech.api.enums.ItemList; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; -import gregtech.api.recipe.metadata.Sievert; import gregtech.api.util.GTModHandler; import gregtech.api.util.GTOreDictUnificator; +import gregtech.api.util.recipe.Sievert; -// cursed way of using a recipe map... public class RadioHatchMaterialLoader { + static List radioHatchMaterials = new ArrayList<>(); + + public static void radioHatchMaterialAdder(ItemStack recipeInput, int recipeSievert, byte recipeMass) { + radioHatchMaterials.add(new RadioHatchMaterial(recipeInput, recipeSievert, recipeMass)); + } + + public static class RadioHatchMaterial { + + private final ItemStack recipeInput; + public final int recipeSievert; + public final byte recipeMass; + + public RadioHatchMaterial(ItemStack recipeInput, int recipeSievert, byte recipeMass) { + this.recipeInput = recipeInput; + this.recipeSievert = recipeSievert; + this.recipeMass = recipeMass; + } + + public ItemStack getRecipeInput() { + return recipeInput.copy(); + } + } + public static void run() { + addRadioHatchMaterials(); + loadRadioHatchNEI(); + } + + public static void addRadioHatchMaterials() { for (Werkstoff material : Werkstoff.werkstoffHashSet) { if (material == null || !material.getStats() @@ -29,22 +61,11 @@ public static void run() { int level = (int) material.getStats() .getProtons(); - if (material.hasItemType(OrePrefixes.stick)) GTValues.RA.stdBuilder() - .itemInputs(material.get(OrePrefixes.stick)) - .duration(0) - .eut(0) - .metadata(SIEVERT, new Sievert(level)) - .metadata(MASS, 1) - .noOptimize() - .addTo(radioHatchRecipes); - if (material.hasItemType(OrePrefixes.stickLong)) GTValues.RA.stdBuilder() - .itemInputs(material.get(OrePrefixes.stickLong)) - .duration(0) - .eut(0) - .metadata(SIEVERT, new Sievert(level)) - .metadata(MASS, 2) - .noOptimize() - .addTo(radioHatchRecipes); + if (material.hasItemType(OrePrefixes.stick)) + radioHatchMaterialAdder(material.get(OrePrefixes.stick), level, (byte) 1); + if (material.hasItemType(OrePrefixes.stickLong)) + radioHatchMaterialAdder(material.get(OrePrefixes.stickLong), level, (byte) 2); + } for (Materials material : Materials.getAll()) { @@ -54,344 +75,150 @@ public static void run() { if (validProton) { int level = (int) material.getProtons(); if (GTOreDictUnificator.get(OrePrefixes.stick, material, 1) != null) { - GTValues.RA.stdBuilder() - .itemInputs(GTOreDictUnificator.get(OrePrefixes.stick, material, 1)) - .duration(0) - .eut(0) - .metadata(SIEVERT, new Sievert(level)) - .metadata(MASS, 1) - .noOptimize() - .addTo(radioHatchRecipes); + radioHatchMaterialAdder(GTOreDictUnificator.get(OrePrefixes.stick, material, 1), level, (byte) 1); + } if (GTOreDictUnificator.get(OrePrefixes.stickLong, material, 1) != null) { - GTValues.RA.stdBuilder() - .itemInputs(GTOreDictUnificator.get(OrePrefixes.stickLong, material, 1)) - .duration(0) - .eut(0) - .metadata(SIEVERT, new Sievert(level)) - .metadata(MASS, 2) - .noOptimize() - .addTo(radioHatchRecipes); + radioHatchMaterialAdder( + GTOreDictUnificator.get(OrePrefixes.stickLong, material, 1), + level, + (byte) 2); } } } - Materials[] spacialMaterial = { Materials.Naquadah, Materials.NaquadahEnriched, Materials.Naquadria }; - int[] spacialValue = { 130, 140, 150 }; + Materials[] specialMaterial = { Materials.Naquadah, Materials.NaquadahEnriched, Materials.Naquadria }; + int[] specialValue = { 130, 140, 150 }; - for (int i = 0; i < spacialMaterial.length; i++) { - if (GTOreDictUnificator.get(OrePrefixes.stick, spacialMaterial[i], 1) != null) { - GTValues.RA.stdBuilder() - .itemInputs(GTOreDictUnificator.get(OrePrefixes.stick, spacialMaterial[i], 1)) - .duration(0) - .eut(0) - .metadata(SIEVERT, new Sievert(spacialValue[i])) - .metadata(MASS, 1) - .noOptimize() - .addTo(radioHatchRecipes); + for (int i = 0; i < specialMaterial.length; i++) { + if (GTOreDictUnificator.get(OrePrefixes.stick, specialMaterial[i], 1) != null) { + radioHatchMaterialAdder( + GTOreDictUnificator.get(OrePrefixes.stick, specialMaterial[i], 1), + specialValue[i], + (byte) 2); } - if (GTOreDictUnificator.get(OrePrefixes.stickLong, spacialMaterial[i], 1) != null) { - GTValues.RA.stdBuilder() - .itemInputs(GTOreDictUnificator.get(OrePrefixes.stickLong, spacialMaterial[i], 1)) - .duration(0) - .eut(0) - .metadata(SIEVERT, new Sievert(spacialValue[i])) - .metadata(MASS, 2) - .noOptimize() - .addTo(radioHatchRecipes); + if (GTOreDictUnificator.get(OrePrefixes.stickLong, specialMaterial[i], 1) != null) { + radioHatchMaterialAdder( + GTOreDictUnificator.get(OrePrefixes.stickLong, specialMaterial[i], 1), + specialValue[i], + (byte) 2); } } - GTValues.RA.stdBuilder() - .itemInputs(ItemList.ThoriumCell_1.get(1)) - .duration(0) - .eut(0) - .metadata(SIEVERT, new Sievert((int) Materials.Thorium.getProtons())) - .metadata(MASS, 3) - .addTo(radioHatchRecipes); - GTValues.RA.stdBuilder() - .itemInputs(ItemList.ThoriumCell_2.get(1)) - .duration(0) - .eut(0) - .metadata(SIEVERT, new Sievert((int) Materials.Thorium.getProtons())) - .metadata(MASS, 6) - .addTo(radioHatchRecipes); - GTValues.RA.stdBuilder() - .itemInputs(ItemList.ThoriumCell_4.get(1)) - .duration(0) - .eut(0) - .metadata(SIEVERT, new Sievert((int) Materials.Thorium.getProtons())) - .metadata(MASS, 12) - .addTo(radioHatchRecipes); - GTValues.RA.stdBuilder() - .itemInputs(ItemList.NaquadahCell_1.get(1)) - .duration(0) - .eut(0) - .metadata(SIEVERT, new Sievert(140)) - .metadata(MASS, 3) - .addTo(radioHatchRecipes); - GTValues.RA.stdBuilder() - .itemInputs(ItemList.NaquadahCell_2.get(1)) - .duration(0) - .eut(0) - .metadata(SIEVERT, new Sievert(140)) - .metadata(MASS, 6) - .addTo(radioHatchRecipes); - GTValues.RA.stdBuilder() - .itemInputs(ItemList.NaquadahCell_4.get(1)) - .duration(0) - .eut(0) - .metadata(SIEVERT, new Sievert(140)) - .metadata(MASS, 12) - .addTo(radioHatchRecipes); - GTValues.RA.stdBuilder() - .itemInputs(ItemList.Moxcell_1.get(1)) - .duration(0) - .eut(0) - .metadata(SIEVERT, new Sievert((int) Materials.Plutonium.getProtons())) - .metadata(MASS, 3) - .addTo(radioHatchRecipes); - GTValues.RA.stdBuilder() - .itemInputs(ItemList.Moxcell_2.get(1)) - .duration(0) - .eut(0) - .metadata(SIEVERT, new Sievert((int) Materials.Plutonium.getProtons())) - .metadata(MASS, 6) - .addTo(radioHatchRecipes); - GTValues.RA.stdBuilder() - .itemInputs(ItemList.Moxcell_4.get(1)) - .duration(0) - .eut(0) - .metadata(SIEVERT, new Sievert((int) Materials.Plutonium.getProtons())) - .metadata(MASS, 12) - .addTo(radioHatchRecipes); - GTValues.RA.stdBuilder() - .itemInputs(ItemList.Uraniumcell_1.get(1)) - .duration(0) - .eut(0) - .metadata(SIEVERT, new Sievert((int) Materials.Uranium.getProtons())) - .metadata(MASS, 3) - .addTo(radioHatchRecipes); - GTValues.RA.stdBuilder() - .itemInputs(ItemList.Uraniumcell_2.get(1)) - .duration(0) - .eut(0) - .metadata(SIEVERT, new Sievert((int) Materials.Uranium.getProtons())) - .metadata(MASS, 6) - .addTo(radioHatchRecipes); - GTValues.RA.stdBuilder() - .itemInputs(ItemList.Uraniumcell_4.get(1)) - .duration(0) - .eut(0) - .metadata(SIEVERT, new Sievert((int) Materials.Uranium.getProtons())) - .metadata(MASS, 12) - .addTo(radioHatchRecipes); - GTValues.RA.stdBuilder() - .itemInputs(BWNonMetaMaterialItems.TiberiumCell_1.get(1)) - .duration(0) - .eut(0) - .metadata( - SIEVERT, - new Sievert( - (int) WerkstoffLoader.Tiberium.getBridgeMaterial() - .getProtons())) - .metadata(MASS, 3) - .addTo(radioHatchRecipes); - GTValues.RA.stdBuilder() - .itemInputs(BWNonMetaMaterialItems.TiberiumCell_2.get(1)) - .duration(0) - .eut(0) - .metadata( - SIEVERT, - new Sievert( - (int) WerkstoffLoader.Tiberium.getBridgeMaterial() - .getProtons())) - .metadata(MASS, 6) - .addTo(radioHatchRecipes); - GTValues.RA.stdBuilder() - .itemInputs(BWNonMetaMaterialItems.TiberiumCell_4.get(1)) - .duration(0) - .eut(0) - .metadata( - SIEVERT, - new Sievert( - (int) WerkstoffLoader.Tiberium.getBridgeMaterial() - .getProtons())) - .metadata(MASS, 12) - .addTo(radioHatchRecipes); - GTValues.RA.stdBuilder() - .itemInputs(BWNonMetaMaterialItems.TheCoreCell.get(1)) - .duration(0) - .eut(0) - .metadata(SIEVERT, new Sievert(140)) - .metadata(MASS, 96) - .addTo(radioHatchRecipes); - GTValues.RA.stdBuilder() - .itemInputs(ItemList.Depleted_Thorium_1.get(1)) - .duration(0) - .eut(0) - .metadata(SIEVERT, new Sievert((int) Materials.Thorium.getProtons() / 10)) - .metadata(MASS, 3) - .addTo(radioHatchRecipes); - GTValues.RA.stdBuilder() - .itemInputs(ItemList.Depleted_Thorium_2.get(1)) - .duration(0) - .eut(0) - .metadata(SIEVERT, new Sievert((int) Materials.Thorium.getProtons() / 10)) - .metadata(MASS, 6) - .addTo(radioHatchRecipes); - GTValues.RA.stdBuilder() - .itemInputs(ItemList.Depleted_Thorium_4.get(1)) - .duration(0) - .eut(0) - .metadata(SIEVERT, new Sievert((int) Materials.Thorium.getProtons() / 10)) - .metadata(MASS, 12) - .addTo(radioHatchRecipes); - GTValues.RA.stdBuilder() - .itemInputs(ItemList.Depleted_Naquadah_1.get(1)) - .duration(0) - .eut(0) - .metadata(SIEVERT, new Sievert(14)) - .metadata(MASS, 3) - .addTo(radioHatchRecipes); - GTValues.RA.stdBuilder() - .itemInputs(ItemList.Depleted_Naquadah_2.get(1)) - .duration(0) - .eut(0) - .metadata(SIEVERT, new Sievert(14)) - .metadata(MASS, 6) - .addTo(radioHatchRecipes); - GTValues.RA.stdBuilder() - .itemInputs(ItemList.Depleted_Naquadah_4.get(1)) - .duration(0) - .eut(0) - .metadata(SIEVERT, new Sievert(14)) - .metadata(MASS, 12) - .addTo(radioHatchRecipes); - GTValues.RA.stdBuilder() - .itemInputs(GTModHandler.getModItem(IndustrialCraft2.ID, "reactorMOXSimpledepleted", 1)) - .duration(0) - .eut(0) - .metadata(SIEVERT, new Sievert((int) Materials.Plutonium.getProtons() / 10)) - .metadata(MASS, 3) - .addTo(radioHatchRecipes); - GTValues.RA.stdBuilder() - .itemInputs(GTModHandler.getModItem(IndustrialCraft2.ID, "reactorMOXDualdepleted", 1)) - .duration(0) - .eut(0) - .metadata(SIEVERT, new Sievert((int) Materials.Plutonium.getProtons() / 10)) - .metadata(MASS, 6) - .addTo(radioHatchRecipes); - GTValues.RA.stdBuilder() - .itemInputs(GTModHandler.getModItem(IndustrialCraft2.ID, "reactorMOXQuaddepleted", 1)) - .duration(0) - .eut(0) - .metadata(SIEVERT, new Sievert((int) Materials.Plutonium.getProtons() / 10)) - .metadata(MASS, 12) - .addTo(radioHatchRecipes); - GTValues.RA.stdBuilder() - .itemInputs(GTModHandler.getModItem(IndustrialCraft2.ID, "reactorUraniumSimpledepleted", 1)) - .duration(0) - .eut(0) - .metadata(SIEVERT, new Sievert((int) Materials.Uranium.getProtons() / 10)) - .metadata(MASS, 3) - .addTo(radioHatchRecipes); - GTValues.RA.stdBuilder() - .itemInputs(GTModHandler.getModItem(IndustrialCraft2.ID, "reactorUraniumDualdepleted", 1)) - .duration(0) - .eut(0) - .metadata(SIEVERT, new Sievert((int) Materials.Uranium.getProtons() / 10)) - .metadata(MASS, 6) - .addTo(radioHatchRecipes); - GTValues.RA.stdBuilder() - .itemInputs(GTModHandler.getModItem(IndustrialCraft2.ID, "reactorUraniumQuaddepleted", 1)) - .duration(0) - .eut(0) - .metadata(SIEVERT, new Sievert((int) Materials.Uranium.getProtons() / 10)) - .metadata(MASS, 12) - .addTo(radioHatchRecipes); - GTValues.RA.stdBuilder() - .itemInputs(BWNonMetaMaterialItems.Depleted_Tiberium_1.get(1)) - .duration(0) - .eut(0) - .metadata( - SIEVERT, - new Sievert( - (int) WerkstoffLoader.Tiberium.getBridgeMaterial() - .getProtons() / 10)) - .metadata(MASS, 3) - .addTo(radioHatchRecipes); - GTValues.RA.stdBuilder() - .itemInputs(BWNonMetaMaterialItems.Depleted_Tiberium_2.get(1)) - .duration(0) - .eut(0) - .metadata( - SIEVERT, - new Sievert( - (int) WerkstoffLoader.Tiberium.getBridgeMaterial() - .getProtons() / 10)) - .metadata(MASS, 6) - .addTo(radioHatchRecipes); - GTValues.RA.stdBuilder() - .itemInputs(BWNonMetaMaterialItems.Depleted_Tiberium_4.get(1)) - .duration(0) - .eut(0) - .metadata( - SIEVERT, - new Sievert( - (int) WerkstoffLoader.Tiberium.getBridgeMaterial() - .getProtons() / 10)) - .metadata(MASS, 12) - .addTo(radioHatchRecipes); - GTValues.RA.stdBuilder() - .itemInputs(BWNonMetaMaterialItems.Depleted_TheCoreCell.get(1)) - .duration(0) - .eut(0) - .metadata(SIEVERT, new Sievert(13)) - .metadata(MASS, 96) - .addTo(radioHatchRecipes); - GTValues.RA.stdBuilder() - .itemInputs(ItemList.MNqCell_1.get(1)) - .duration(0) - .eut(0) - .metadata(SIEVERT, new Sievert(150)) - .metadata(MASS, 3) - .addTo(radioHatchRecipes); - GTValues.RA.stdBuilder() - .itemInputs(ItemList.MNqCell_2.get(1)) - .duration(0) - .eut(0) - .metadata(SIEVERT, new Sievert(150)) - .metadata(MASS, 6) - .addTo(radioHatchRecipes); - GTValues.RA.stdBuilder() - .itemInputs(ItemList.MNqCell_4.get(1)) - .duration(0) - .eut(0) - .metadata(SIEVERT, new Sievert(150)) - .metadata(MASS, 12) - .addTo(radioHatchRecipes); - GTValues.RA.stdBuilder() - .itemInputs(ItemList.Depleted_MNq_1.get(1)) - .duration(0) - .eut(0) - .metadata(SIEVERT, new Sievert(15)) - .metadata(MASS, 3) - .addTo(radioHatchRecipes); - GTValues.RA.stdBuilder() - .itemInputs(ItemList.Depleted_MNq_2.get(1)) - .duration(0) - .eut(0) - .metadata(SIEVERT, new Sievert(15)) - .metadata(MASS, 6) - .addTo(radioHatchRecipes); - GTValues.RA.stdBuilder() - .itemInputs(ItemList.Depleted_MNq_4.get(1)) - .duration(0) - .eut(0) - .metadata(SIEVERT, new Sievert(15)) - .metadata(MASS, 12) - .addTo(radioHatchRecipes); + radioHatchMaterialAdder(ItemList.ThoriumCell_1.get(1), (int) Materials.Thorium.getProtons(), (byte) 3); + radioHatchMaterialAdder(ItemList.ThoriumCell_2.get(1), (int) Materials.Thorium.getProtons(), (byte) 6); + radioHatchMaterialAdder(ItemList.ThoriumCell_4.get(1), (int) Materials.Thorium.getProtons(), (byte) 12); + radioHatchMaterialAdder(ItemList.NaquadahCell_1.get(1), 140, (byte) 3); + radioHatchMaterialAdder(ItemList.NaquadahCell_2.get(1), 140, (byte) 6); + radioHatchMaterialAdder(ItemList.NaquadahCell_4.get(1), 140, (byte) 12); + radioHatchMaterialAdder(ItemList.Moxcell_1.get(1), (int) Materials.Plutonium.getProtons(), (byte) 3); + radioHatchMaterialAdder(ItemList.Moxcell_2.get(1), (int) Materials.Plutonium.getProtons(), (byte) 6); + radioHatchMaterialAdder(ItemList.Moxcell_4.get(1), (int) Materials.Plutonium.getProtons(), (byte) 12); + radioHatchMaterialAdder(ItemList.Uraniumcell_1.get(1), (int) Materials.Duranium.getProtons(), (byte) 3); + radioHatchMaterialAdder(ItemList.Uraniumcell_2.get(1), (int) Materials.Duranium.getProtons(), (byte) 6); + radioHatchMaterialAdder(ItemList.Uraniumcell_4.get(1), (int) Materials.Duranium.getProtons(), (byte) 12); + radioHatchMaterialAdder( + BWNonMetaMaterialItems.TiberiumCell_1.get(1), + (int) WerkstoffLoader.Tiberium.getBridgeMaterial() + .getProtons(), + (byte) 3); + radioHatchMaterialAdder( + BWNonMetaMaterialItems.TiberiumCell_2.get(1), + (int) WerkstoffLoader.Tiberium.getBridgeMaterial() + .getProtons(), + (byte) 6); + radioHatchMaterialAdder( + BWNonMetaMaterialItems.TiberiumCell_4.get(1), + (int) WerkstoffLoader.Tiberium.getBridgeMaterial() + .getProtons(), + (byte) 12); + radioHatchMaterialAdder( + ItemList.Depleted_Thorium_1.get(1), + (int) Materials.Thorium.getProtons() / 10, + (byte) 3); + radioHatchMaterialAdder( + ItemList.Depleted_Thorium_2.get(1), + (int) Materials.Thorium.getProtons() / 10, + (byte) 6); + radioHatchMaterialAdder( + ItemList.Depleted_Thorium_4.get(1), + (int) Materials.Thorium.getProtons() / 10, + (byte) 12); + radioHatchMaterialAdder(BWNonMetaMaterialItems.TheCoreCell.get(1), 140, (byte) 96); + radioHatchMaterialAdder(ItemList.Depleted_Naquadah_1.get(1), 14, (byte) 3); + radioHatchMaterialAdder(ItemList.Depleted_Naquadah_2.get(1), 14, (byte) 6); + radioHatchMaterialAdder(ItemList.Depleted_Naquadah_4.get(1), 14, (byte) 12); + radioHatchMaterialAdder( + GTModHandler.getModItem(IndustrialCraft2.ID, "reactorMOXSimpledepleted", 1), + (int) Materials.Plutonium.getProtons() / 10, + (byte) 3); + radioHatchMaterialAdder( + GTModHandler.getModItem(IndustrialCraft2.ID, "reactorMOXDualdepleted", 1), + (int) Materials.Plutonium.getProtons() / 10, + (byte) 6); + radioHatchMaterialAdder( + GTModHandler.getModItem(IndustrialCraft2.ID, "reactorMOXQuaddepleted", 1), + (int) Materials.Plutonium.getProtons() / 10, + (byte) 12); + radioHatchMaterialAdder( + GTModHandler.getModItem(IndustrialCraft2.ID, "reactorUraniumSimpledepleted", 1), + (int) Materials.Uranium.getProtons() / 10, + (byte) 3); + radioHatchMaterialAdder( + GTModHandler.getModItem(IndustrialCraft2.ID, "reactorUraniumDualdepleted", 1), + (int) Materials.Uranium.getProtons() / 10, + (byte) 6); + radioHatchMaterialAdder( + GTModHandler.getModItem(IndustrialCraft2.ID, "reactorUraniumQuaddepleted", 1), + (int) Materials.Uranium.getProtons() / 10, + (byte) 12); + radioHatchMaterialAdder( + BWNonMetaMaterialItems.Depleted_Tiberium_1.get(1), + (int) WerkstoffLoader.Tiberium.getBridgeMaterial() + .getProtons() / 10, + (byte) 3); + radioHatchMaterialAdder( + BWNonMetaMaterialItems.Depleted_Tiberium_2.get(1), + (int) WerkstoffLoader.Tiberium.getBridgeMaterial() + .getProtons() / 10, + (byte) 6); + radioHatchMaterialAdder( + BWNonMetaMaterialItems.Depleted_Tiberium_4.get(1), + (int) WerkstoffLoader.Tiberium.getBridgeMaterial() + .getProtons() / 10, + (byte) 12); + radioHatchMaterialAdder(BWNonMetaMaterialItems.Depleted_TheCoreCell.get(1), 13, (byte) 96); + radioHatchMaterialAdder(ItemList.MNqCell_1.get(1), 150, (byte) 3); + radioHatchMaterialAdder(ItemList.MNqCell_2.get(1), 150, (byte) 6); + radioHatchMaterialAdder(ItemList.MNqCell_4.get(1), 150, (byte) 12); + radioHatchMaterialAdder(ItemList.Depleted_MNq_1.get(1), 15, (byte) 3); + radioHatchMaterialAdder(ItemList.Depleted_MNq_2.get(1), 15, (byte) 6); + radioHatchMaterialAdder(ItemList.Depleted_MNq_4.get(1), 15, (byte) 12); + } + + public static void loadRadioHatchNEI() { + for (RadioHatchMaterial recipes : radioHatchMaterials) { + GTValues.RA.stdBuilder() + .itemInputs(recipes.getRecipeInput()) + .duration(0) + .eut(0) + .metadata(SIEVERT, new Sievert(recipes.recipeSievert)) + .metadata(MASS, (int) recipes.recipeMass) + .fake() + .addTo(radioHatchFakeRecipes); + } + } + + public static RadioHatchMaterial getRadioHatchMaterialFromInput(RadioHatchMaterial recipe, ItemStack Material) { + if (recipe.getRecipeInput() + .isItemEqual(Material)) { + return recipe; + } + return (new RadioHatchMaterial(null, 0, (byte) 0)); + } + + public static List getRadioHatchMaterialList() { + return radioHatchMaterials; } } diff --git a/src/main/java/bartworks/common/loaders/recipes/CraftingRecipes.java b/src/main/java/bartworks/common/loaders/recipes/CraftingRecipes.java index 724100826ce..3c6e9fc7171 100644 --- a/src/main/java/bartworks/common/loaders/recipes/CraftingRecipes.java +++ b/src/main/java/bartworks/common/loaders/recipes/CraftingRecipes.java @@ -525,7 +525,8 @@ public void run() { RadioHatch_HV.ID, "bw.radiohatchHV", "HV " + StatCollector.translateToLocal("tile.radiohatch.name"), - 3).getStackForm(1L), + 3, + false).getStackForm(1L), RecipeLoader.BITSD, new Object[] { "DPD", "DCD", "DKD", 'D', GTOreDictUnificator.get(OrePrefixes.plateDense, Materials.Lead, 1L), 'C', @@ -533,70 +534,39 @@ public void run() { GTOreDictUnificator.get(OrePrefixes.cableGt08, Materials.Gold, 1L), 'P', ItemList.Electric_Piston_HV.get(1) }); - GTModHandler.addCraftingRecipe( - new GT_MetaTileEntity_RadioHatch( - RadioHatch_EV.ID, - "bw.radiohatchEV", - "EV " + StatCollector.translateToLocal("tile.radiohatch.name"), - 4).getStackForm(1L), - RecipeLoader.BITSD, - new Object[] { "DPD", "DCD", "DKD", 'D', - GTOreDictUnificator.get(OrePrefixes.plateDense, Materials.Lead, 1L), 'C', - ItemList.MACHINE_HULLS[4].get(1L), 'K', - GTOreDictUnificator.get(OrePrefixes.cableGt08, Materials.Aluminium, 1L), 'P', - ItemList.Electric_Piston_EV.get(1) }); - - GTModHandler.addCraftingRecipe( - new GT_MetaTileEntity_RadioHatch( - RadioHatch_IV.ID, - "bw.radiohatchIV", - "IV " + StatCollector.translateToLocal("tile.radiohatch.name"), - 5).getStackForm(1L), - RecipeLoader.BITSD, - new Object[] { "DPD", "DCD", "DKD", 'D', - GTOreDictUnificator.get(OrePrefixes.plateDense, Materials.Lead, 1L), 'C', - ItemList.MACHINE_HULLS[5].get(1L), 'K', - GTOreDictUnificator.get(OrePrefixes.cableGt08, Materials.Tungsten, 1L), 'P', - ItemList.Electric_Piston_IV.get(1) }); - - GTModHandler.addCraftingRecipe( - new GT_MetaTileEntity_RadioHatch( - RadioHatch_LuV.ID, - "bw.radiohatchLuV", - "LuV " + StatCollector.translateToLocal("tile.radiohatch.name"), - 6).getStackForm(1L), - RecipeLoader.BITSD, - new Object[] { "DPD", "DCD", "DKD", 'D', - GTOreDictUnificator.get(OrePrefixes.plateDense, Materials.Lead, 1L), 'C', - ItemList.MACHINE_HULLS[6].get(1L), 'K', - GTOreDictUnificator.get(OrePrefixes.cableGt08, Materials.VanadiumGallium, 1L), 'P', - ItemList.Electric_Piston_LuV.get(1) }); - - GTModHandler.addCraftingRecipe( - new GT_MetaTileEntity_RadioHatch( - RadioHatch_ZPM.ID, - "bw.radiohatchZPM", - "ZPM " + StatCollector.translateToLocal("tile.radiohatch.name"), - 7).getStackForm(1L), - RecipeLoader.BITSD, - new Object[] { "DPD", "DCD", "DKD", 'D', - GTOreDictUnificator.get(OrePrefixes.plateDense, Materials.Lead, 1L), 'C', - ItemList.MACHINE_HULLS[7].get(1L), 'K', - GTOreDictUnificator.get(OrePrefixes.cableGt08, Materials.Naquadah, 1L), 'P', - ItemList.Electric_Piston_ZPM.get(1) }); - - GTModHandler.addCraftingRecipe( - new GT_MetaTileEntity_RadioHatch( - RadioHatch_UV.ID, - "bw.radiohatchUV", - "UV " + StatCollector.translateToLocal("tile.radiohatch.name"), - 8).getStackForm(1L), - RecipeLoader.BITSD, - new Object[] { "DPD", "DCD", "DKD", 'D', - GTOreDictUnificator.get(OrePrefixes.plateDense, Materials.Lead, 1L), 'C', - ItemList.MACHINE_HULLS[8].get(1L), 'K', - GTOreDictUnificator.get(OrePrefixes.cableGt08, Materials.NaquadahAlloy, 1L), 'P', - ItemList.Electric_Piston_UV.get(1) }); - + new GT_MetaTileEntity_RadioHatch( + RadioHatch_EV.ID, + "bw.radiohatchEV", + "EV " + StatCollector.translateToLocal("tile.radiohatch.name"), + 4, + true); + + new GT_MetaTileEntity_RadioHatch( + RadioHatch_IV.ID, + "bw.radiohatchIV", + "IV " + StatCollector.translateToLocal("tile.radiohatch.name"), + 5, + true); + + new GT_MetaTileEntity_RadioHatch( + RadioHatch_LuV.ID, + "bw.radiohatchLuV", + "LuV " + StatCollector.translateToLocal("tile.radiohatch.name"), + 6, + true); + + new GT_MetaTileEntity_RadioHatch( + RadioHatch_ZPM.ID, + "bw.radiohatchZPM", + "ZPM " + StatCollector.translateToLocal("tile.radiohatch.name"), + 7, + true); + + new GT_MetaTileEntity_RadioHatch( + RadioHatch_UV.ID, + "bw.radiohatchUV", + "UV " + StatCollector.translateToLocal("tile.radiohatch.name"), + 8, + true); } } diff --git a/src/main/java/bartworks/common/tileentities/multis/MTEBioVat.java b/src/main/java/bartworks/common/tileentities/multis/MTEBioVat.java index c8b7dcefc86..3e05ad9b394 100644 --- a/src/main/java/bartworks/common/tileentities/multis/MTEBioVat.java +++ b/src/main/java/bartworks/common/tileentities/multis/MTEBioVat.java @@ -80,13 +80,13 @@ import gregtech.api.recipe.RecipeMap; import gregtech.api.recipe.check.CheckRecipeResult; import gregtech.api.recipe.check.CheckRecipeResultRegistry; -import gregtech.api.recipe.metadata.Sievert; import gregtech.api.render.TextureFactory; import gregtech.api.util.GTRecipe; import gregtech.api.util.GTRecipeConstants; import gregtech.api.util.GTUtility; import gregtech.api.util.MultiblockTooltipBuilder; import gregtech.api.util.ParallelHelper; +import gregtech.api.util.recipe.Sievert; public class MTEBioVat extends MTEEnhancedMultiBlockBase implements ISurvivalConstructable { diff --git a/src/main/java/bartworks/common/tileentities/tiered/GT_MetaTileEntity_RadioHatch.java b/src/main/java/bartworks/common/tileentities/tiered/GT_MetaTileEntity_RadioHatch.java index 99829e09e19..9bec41c3477 100644 --- a/src/main/java/bartworks/common/tileentities/tiered/GT_MetaTileEntity_RadioHatch.java +++ b/src/main/java/bartworks/common/tileentities/tiered/GT_MetaTileEntity_RadioHatch.java @@ -13,17 +13,24 @@ package bartworks.common.tileentities.tiered; +import static bartworks.common.loaders.RadioHatchMaterialLoader.getRadioHatchMaterialFromInput; +import static bartworks.common.loaders.RadioHatchMaterialLoader.getRadioHatchMaterialList; import static gregtech.api.enums.GTValues.ticksBetweenSounds; import java.util.Collections; +import java.util.List; 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.ResourceLocation; import net.minecraft.util.StatCollector; import net.minecraftforge.common.util.ForgeDirection; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + import com.gtnewhorizons.modularui.api.ModularUITextures; import com.gtnewhorizons.modularui.api.drawable.ItemDrawable; import com.gtnewhorizons.modularui.api.drawable.shapes.Rectangle; @@ -44,6 +51,7 @@ import bartworks.API.modularUI.BWUITextures; import bartworks.API.recipe.BartWorksRecipeMaps; import bartworks.MainMod; +import bartworks.common.loaders.RadioHatchMaterialLoader.RadioHatchMaterial; import bartworks.util.BWColorUtil; import bartworks.util.BWTooltipReference; import bartworks.util.MathUtils; @@ -61,18 +69,14 @@ import gregtech.api.metatileentity.implementations.MTEHatch; import gregtech.api.objects.ItemData; import gregtech.api.recipe.RecipeMap; -import gregtech.api.recipe.metadata.Sievert; import gregtech.api.render.TextureFactory; import gregtech.api.util.GTOreDictUnificator; -import gregtech.api.util.GTRecipe; -import gregtech.api.util.GTRecipeConstants; import gregtech.api.util.GTUtility; import gregtech.common.items.IDMetaTool01; import gregtech.common.items.MetaGeneratedTool01; public class GT_MetaTileEntity_RadioHatch extends MTEHatch implements RecipeMapWorkable, IAddGregtechLogo { - private final int cap; public int sievert; private long timer = 1; private long decayTime = 1; @@ -82,9 +86,12 @@ public class GT_MetaTileEntity_RadioHatch extends MTEHatch implements RecipeMapW private byte coverage; private ItemStack lastUsedItem = null; private boolean lastFail = false; - private GTRecipe lastRecipe = null; + private RadioHatchMaterial radioHatchMaterial = null; + private final List radioHatchMaterials = getRadioHatchMaterialList(); + + public static final Logger LOGGER = LogManager.getLogger("Test"); - public GT_MetaTileEntity_RadioHatch(int aID, String aName, String aNameRegional, int aTier) { + public GT_MetaTileEntity_RadioHatch(int aID, String aName, String aNameRegional, int aTier, boolean isDeprecated) { super( aID, aName, @@ -92,19 +99,15 @@ public GT_MetaTileEntity_RadioHatch(int aID, String aName, String aNameRegional, aTier, 1, new String[] { StatCollector.translateToLocal("tooltip.tile.radhatch.0.name"), - StatCollector.translateToLocal("tooltip.tile.tiereddsc.3.name") + " " - + (aTier - 2) - + " " - + (aTier - 2 >= 2 ? StatCollector.translateToLocal("tooltip.bw.kg.1.name") - : StatCollector.translateToLocal("tooltip.bw.kg.0.name")), - StatCollector.translateToLocal("tooltip.tile.radhatch.1.name"), - BWTooltipReference.ADDED_BY_BARTIMAEUSNEK_VIA_BARTWORKS.get() }); - this.cap = aTier - 2; + (isDeprecated + ? EnumChatFormatting.RED + + "DEPRECATED! This hatch will be removed in the next major update, use HV Radio Hatch instead" + : StatCollector.translateToLocal("tooltip.tile.radhatch.1.name")), + BWTooltipReference.ADDED_BY_BARTIMAEUSNEK_VIA_BARTWORKS.get(), }); } public GT_MetaTileEntity_RadioHatch(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { super(aName, aTier, 1, aDescription, aTextures); - this.cap = aTier - 2; } public int getSievert() { @@ -159,13 +162,12 @@ public void updateSlots() { @Override public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { + BaseMetaTileEntity myMetaTileEntity = (BaseMetaTileEntity) this.getBaseMetaTileEntity(); if (myMetaTileEntity.isServerSide()) { - if (this.mass > 0) { ++this.timer; } - if (this.mass > 0 && (this.decayTime == 0 || this.decayTime > 0 && this.timer % this.decayTime == 0)) { this.mass--; if (this.mass == 0) { @@ -174,16 +176,13 @@ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { } this.timer = 1; } - if (myMetaTileEntity.mTickTimer > myMetaTileEntity.mLastSoundTick + ticksBetweenSounds && this.sievert > 0) { this.sendLoopStart((byte) 1); myMetaTileEntity.mLastSoundTick = myMetaTileEntity.mTickTimer; } - if (this.mass == 0) { ItemStack lStack = this.mInventory[0]; - if (lStack == null) { this.colorForGUI = new short[] { 0x37, 0x37, 0x37 }; return; @@ -195,48 +194,42 @@ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { } else { this.colorForGUI = new short[] { 0x37, 0x37, 0x37 }; } - if (this.lastFail && GTUtility.areStacksEqual(this.lastUsedItem, lStack, true)) { return; } - - if (!this.lastFail && this.lastUsedItem != null && this.lastRecipe != null) { + if (!this.lastFail && this.lastUsedItem != null && this.radioHatchMaterial != null) { if (GTUtility.areStacksEqual(this.lastUsedItem, lStack, true)) { - Sievert data = this.lastRecipe - .getMetadataOrDefault(GTRecipeConstants.SIEVERT, new Sievert(0, false)); - this.mass = this.lastRecipe.getMetadataOrDefault(GTRecipeConstants.MASS, 0) - .byteValue(); - this.decayTime = calcDecayTicks(data.sievert); - this.sievert = data.sievert; - this.material = this.lastUsedItem.getDisplayName(); - lStack.stackSize--; - this.updateSlots(); + for (RadioHatchMaterial recipes : radioHatchMaterials) { + this.radioHatchMaterial = getRadioHatchMaterialFromInput(recipes, this.lastUsedItem); + } + if (radioHatchMaterial.recipeSievert != 0) { + this.sievert = this.radioHatchMaterial.recipeSievert; + this.mass = this.radioHatchMaterial.recipeMass; + this.decayTime = calcDecayTicks(radioHatchMaterial.recipeSievert); + this.material = this.lastUsedItem.getDisplayName(); + lStack.stackSize--; + this.updateSlots(); + } } else { - this.lastRecipe = null; + this.radioHatchMaterial = null; } } - - if (this.lastRecipe == null || this.lastFail) { - this.lastRecipe = BartWorksRecipeMaps.radioHatchRecipes.findRecipeQuery() - .items(this.mInventory[0]) - .find(); - if (this.lastRecipe == null) { + if (this.radioHatchMaterial == null || this.lastFail || this.radioHatchMaterial.recipeSievert == 0) { + for (RadioHatchMaterial recipes : radioHatchMaterials) { + this.radioHatchMaterial = getRadioHatchMaterialFromInput(recipes, this.mInventory[0]); + if (radioHatchMaterial.recipeSievert != 0) { + break; + } + } + if (this.radioHatchMaterial == null || radioHatchMaterial.recipeSievert == 0) { this.lastFail = true; this.lastUsedItem = this.mInventory[0] == null ? null : this.mInventory[0].copy(); } else { - if (this.lastRecipe.getMetadataOrDefault(GTRecipeConstants.MASS, 0) > this.cap) { - this.lastFail = true; - this.lastUsedItem = this.mInventory[0].copy(); - return; - } this.lastFail = false; this.lastUsedItem = this.mInventory[0].copy(); - Sievert data = this.lastRecipe - .getMetadataOrDefault(GTRecipeConstants.SIEVERT, new Sievert(0, false)); - this.mass = this.lastRecipe.getMetadataOrDefault(GTRecipeConstants.MASS, 0) - .byteValue(); - this.decayTime = calcDecayTicks(data.sievert); - this.sievert = data.sievert; + this.sievert = radioHatchMaterial.recipeSievert; + this.mass = radioHatchMaterial.recipeMass; + this.decayTime = calcDecayTicks(radioHatchMaterial.recipeSievert); this.material = lStack.getDisplayName(); lStack.stackSize--; this.updateSlots(); @@ -307,7 +300,7 @@ public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aInde public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, ItemStack aStack) { return side == this.getBaseMetaTileEntity() - .getFrontFacing() && BartWorksRecipeMaps.radioHatchRecipes.containsInput(aStack); + .getFrontFacing() && BartWorksRecipeMaps.radioHatchFakeRecipes.containsInput(aStack); } @Override @@ -346,7 +339,7 @@ public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) { @Override public RecipeMap getRecipeMap() { // Only for visual - return BartWorksRecipeMaps.radioHatchRecipes; + return BartWorksRecipeMaps.radioHatchFakeRecipes; } private static final int RADIATION_SHUTTER_WINDOW_ID = 999; diff --git a/src/main/java/gregtech/api/recipe/RecipeMaps.java b/src/main/java/gregtech/api/recipe/RecipeMaps.java index 62c5d4693b1..b94d7c81a66 100644 --- a/src/main/java/gregtech/api/recipe/RecipeMaps.java +++ b/src/main/java/gregtech/api/recipe/RecipeMaps.java @@ -74,12 +74,12 @@ import gregtech.api.recipe.metadata.CompressionTierKey; import gregtech.api.recipe.metadata.PCBFactoryTierKey; import gregtech.api.recipe.metadata.PurificationPlantBaseChanceKey; -import gregtech.api.recipe.metadata.Sievert; import gregtech.api.util.GTModHandler; import gregtech.api.util.GTOreDictUnificator; import gregtech.api.util.GTRecipe; import gregtech.api.util.GTRecipeConstants; import gregtech.api.util.GTUtility; +import gregtech.api.util.recipe.Sievert; import gregtech.common.tileentities.machines.multi.purification.PurifiedWaterHelpers; import gregtech.nei.formatter.FuelSpecialValueFormatter; import gregtech.nei.formatter.FusionSpecialValueFormatter; diff --git a/src/main/java/gregtech/api/util/GTRecipeConstants.java b/src/main/java/gregtech/api/util/GTRecipeConstants.java index c9488039603..5d79f0017e8 100644 --- a/src/main/java/gregtech/api/util/GTRecipeConstants.java +++ b/src/main/java/gregtech/api/util/GTRecipeConstants.java @@ -26,8 +26,8 @@ import gregtech.api.recipe.RecipeCategories; import gregtech.api.recipe.RecipeMaps; import gregtech.api.recipe.RecipeMetadataKey; -import gregtech.api.recipe.metadata.Sievert; import gregtech.api.recipe.metadata.SimpleRecipeMetadataKey; +import gregtech.api.util.recipe.Sievert; import gregtech.common.items.IDMetaItem03; import gregtech.common.items.MetaGeneratedItem03; import gtnhlanth.common.item.ItemPhotolithographicMask; diff --git a/src/main/java/gregtech/api/recipe/metadata/Sievert.java b/src/main/java/gregtech/api/util/recipe/Sievert.java similarity index 89% rename from src/main/java/gregtech/api/recipe/metadata/Sievert.java rename to src/main/java/gregtech/api/util/recipe/Sievert.java index 2defd48b809..bc2a4af88ee 100644 --- a/src/main/java/gregtech/api/recipe/metadata/Sievert.java +++ b/src/main/java/gregtech/api/util/recipe/Sievert.java @@ -1,4 +1,4 @@ -package gregtech.api.recipe.metadata; +package gregtech.api.util.recipe; public class Sievert { From c01c9a87921747f64db9af8dccdfe2a80944607a Mon Sep 17 00:00:00 2001 From: StaffiX <32968022+StaffiX@users.noreply.github.com> Date: Sun, 29 Dec 2024 19:33:50 +0100 Subject: [PATCH 4/9] remove unused lang key --- .../loaders/recipes/CraftingRecipes.java | 2 +- .../tiered/GT_MetaTileEntity_RadioHatch.java | 22 +++++++++---------- .../java/gregtech/api/recipe/RecipeMaps.java | 5 +---- .../assets/bartworks/lang/de_DE.lang | 2 -- .../assets/bartworks/lang/en_US.lang | 2 -- .../assets/bartworks/lang/fr_FR.lang | 2 -- 6 files changed, 13 insertions(+), 22 deletions(-) diff --git a/src/main/java/bartworks/common/loaders/recipes/CraftingRecipes.java b/src/main/java/bartworks/common/loaders/recipes/CraftingRecipes.java index 3c6e9fc7171..d613e822d3d 100644 --- a/src/main/java/bartworks/common/loaders/recipes/CraftingRecipes.java +++ b/src/main/java/bartworks/common/loaders/recipes/CraftingRecipes.java @@ -524,7 +524,7 @@ public void run() { new GT_MetaTileEntity_RadioHatch( RadioHatch_HV.ID, "bw.radiohatchHV", - "HV " + StatCollector.translateToLocal("tile.radiohatch.name"), + "" + StatCollector.translateToLocal("tile.radiohatch.name"), 3, false).getStackForm(1L), RecipeLoader.BITSD, diff --git a/src/main/java/bartworks/common/tileentities/tiered/GT_MetaTileEntity_RadioHatch.java b/src/main/java/bartworks/common/tileentities/tiered/GT_MetaTileEntity_RadioHatch.java index 9bec41c3477..c1eb63e0dc2 100644 --- a/src/main/java/bartworks/common/tileentities/tiered/GT_MetaTileEntity_RadioHatch.java +++ b/src/main/java/bartworks/common/tileentities/tiered/GT_MetaTileEntity_RadioHatch.java @@ -18,7 +18,6 @@ import static gregtech.api.enums.GTValues.ticksBetweenSounds; import java.util.Collections; -import java.util.List; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -28,9 +27,6 @@ import net.minecraft.util.StatCollector; import net.minecraftforge.common.util.ForgeDirection; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - import com.gtnewhorizons.modularui.api.ModularUITextures; import com.gtnewhorizons.modularui.api.drawable.ItemDrawable; import com.gtnewhorizons.modularui.api.drawable.shapes.Rectangle; @@ -87,10 +83,8 @@ public class GT_MetaTileEntity_RadioHatch extends MTEHatch implements RecipeMapW private ItemStack lastUsedItem = null; private boolean lastFail = false; private RadioHatchMaterial radioHatchMaterial = null; - private final List radioHatchMaterials = getRadioHatchMaterialList(); - - public static final Logger LOGGER = LogManager.getLogger("Test"); + // TODO: remove aNameRegional after removing the other tiers public GT_MetaTileEntity_RadioHatch(int aID, String aName, String aNameRegional, int aTier, boolean isDeprecated) { super( aID, @@ -101,7 +95,7 @@ public GT_MetaTileEntity_RadioHatch(int aID, String aName, String aNameRegional, new String[] { StatCollector.translateToLocal("tooltip.tile.radhatch.0.name"), (isDeprecated ? EnumChatFormatting.RED - + "DEPRECATED! This hatch will be removed in the next major update, use HV Radio Hatch instead" + + "DEPRECATED! This hatch will be removed in the next major update, use \"Radio Hatch\" instead" : StatCollector.translateToLocal("tooltip.tile.radhatch.1.name")), BWTooltipReference.ADDED_BY_BARTIMAEUSNEK_VIA_BARTWORKS.get(), }); } @@ -162,12 +156,13 @@ public void updateSlots() { @Override public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { - BaseMetaTileEntity myMetaTileEntity = (BaseMetaTileEntity) this.getBaseMetaTileEntity(); if (myMetaTileEntity.isServerSide()) { + if (this.mass > 0) { ++this.timer; } + if (this.mass > 0 && (this.decayTime == 0 || this.decayTime > 0 && this.timer % this.decayTime == 0)) { this.mass--; if (this.mass == 0) { @@ -176,17 +171,21 @@ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { } this.timer = 1; } + if (myMetaTileEntity.mTickTimer > myMetaTileEntity.mLastSoundTick + ticksBetweenSounds && this.sievert > 0) { this.sendLoopStart((byte) 1); myMetaTileEntity.mLastSoundTick = myMetaTileEntity.mTickTimer; } + if (this.mass == 0) { ItemStack lStack = this.mInventory[0]; + if (lStack == null) { this.colorForGUI = new short[] { 0x37, 0x37, 0x37 }; return; } + ItemData itemData = GTOreDictUnificator.getAssociation(lStack); if (itemData != null) { Materials mat = itemData.mMaterial.mMaterial; @@ -199,7 +198,7 @@ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { } if (!this.lastFail && this.lastUsedItem != null && this.radioHatchMaterial != null) { if (GTUtility.areStacksEqual(this.lastUsedItem, lStack, true)) { - for (RadioHatchMaterial recipes : radioHatchMaterials) { + for (RadioHatchMaterial recipes : getRadioHatchMaterialList()) { this.radioHatchMaterial = getRadioHatchMaterialFromInput(recipes, this.lastUsedItem); } if (radioHatchMaterial.recipeSievert != 0) { @@ -214,8 +213,9 @@ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { this.radioHatchMaterial = null; } } + if (this.radioHatchMaterial == null || this.lastFail || this.radioHatchMaterial.recipeSievert == 0) { - for (RadioHatchMaterial recipes : radioHatchMaterials) { + for (RadioHatchMaterial recipes : getRadioHatchMaterialList()) { this.radioHatchMaterial = getRadioHatchMaterialFromInput(recipes, this.mInventory[0]); if (radioHatchMaterial.recipeSievert != 0) { break; diff --git a/src/main/java/gregtech/api/recipe/RecipeMaps.java b/src/main/java/gregtech/api/recipe/RecipeMaps.java index b94d7c81a66..d3f107123de 100644 --- a/src/main/java/gregtech/api/recipe/RecipeMaps.java +++ b/src/main/java/gregtech/api/recipe/RecipeMaps.java @@ -9,7 +9,6 @@ import static gregtech.api.util.GTRecipeConstants.ADDITIVE_AMOUNT; import static gregtech.api.util.GTRecipeConstants.FUEL_VALUE; import static gregtech.api.util.GTRecipeConstants.GLASS; -import static gregtech.api.util.GTRecipeConstants.SIEVERT; import static gregtech.api.util.GTRecipeMapUtil.GTRecipeTemplate; import static gregtech.api.util.GTRecipeMapUtil.asTemplate; import static gregtech.api.util.GTRecipeMapUtil.buildOrEmpty; @@ -79,7 +78,6 @@ import gregtech.api.util.GTRecipe; import gregtech.api.util.GTRecipeConstants; import gregtech.api.util.GTUtility; -import gregtech.api.util.recipe.Sievert; import gregtech.common.tileentities.machines.multi.purification.PurifiedWaterHelpers; import gregtech.nei.formatter.FuelSpecialValueFormatter; import gregtech.nei.formatter.FusionSpecialValueFormatter; @@ -1222,8 +1220,7 @@ && isArrayEmptyOrNull(b.getFluidOutputs()) b -> BartWorksRecipeMaps.bacterialVatRecipes.doAdd( b.copy() .special(BioItemList.getPetriDish(BioCultureLoader.generalPurposeFermentingBacteria)) - .metadata(GLASS, 5) - .metadata(SIEVERT, new Sievert(140, true)) + .metadata(GLASS, 3) .eut(b.getEUt())))); RecipeMaps.implosionRecipes.addDownstream( IRecipeMap.newRecipeMap( diff --git a/src/main/resources/assets/bartworks/lang/de_DE.lang b/src/main/resources/assets/bartworks/lang/de_DE.lang index 10dc2feab68..4726f76c2fb 100644 --- a/src/main/resources/assets/bartworks/lang/de_DE.lang +++ b/src/main/resources/assets/bartworks/lang/de_DE.lang @@ -85,8 +85,6 @@ tooltip.LESU.1.name=Mehrere Kontroller! tooltip.bw.0.name=Hinzugefügt von tooltip.bw.1.name=Hinzugefügt von bartimaeusnek durch tooltip.bw.empty.name=Leer -tooltip.bw.kg.0.name=kg -tooltip.bw.kg.1.name=kgs tooltip.bw.no.name=Nein tooltip.bw.tier.name=Tier: tooltip.bw.yes.name=Ja diff --git a/src/main/resources/assets/bartworks/lang/en_US.lang b/src/main/resources/assets/bartworks/lang/en_US.lang index d83bbdd0f6d..21494af0a5b 100644 --- a/src/main/resources/assets/bartworks/lang/en_US.lang +++ b/src/main/resources/assets/bartworks/lang/en_US.lang @@ -124,8 +124,6 @@ tooltip.bw.1.name=Added by bartimaeusnek via tooltip.bw.yes.name=Yes tooltip.bw.no.name=No tooltip.bw.tier.name=Tier: -tooltip.bw.kg.0.name=kg -tooltip.bw.kg.1.name=kgs tooltip.bw.empty.name=Empty tooltip.bw.mb_via.name=%s§7 via §2BartWorks diff --git a/src/main/resources/assets/bartworks/lang/fr_FR.lang b/src/main/resources/assets/bartworks/lang/fr_FR.lang index aa132af43b3..9a3c0f408e6 100644 --- a/src/main/resources/assets/bartworks/lang/fr_FR.lang +++ b/src/main/resources/assets/bartworks/lang/fr_FR.lang @@ -80,8 +80,6 @@ tooltip.bw.1.name=Ajouté par bartimaeusnek via tooltip.bw.yes.name=Oui tooltip.bw.no.name=Non tooltip.bw.tier.name=Tier: -tooltip.bw.kg.0.name=kg -tooltip.bw.kg.1.name=kgs tooltip.bw.empty.name=Vide tooltip.teslastaff.0.name=Pas de garrantie! From cffdc0ab10adecd531ba452c8463be1f89292dc3 Mon Sep 17 00:00:00 2001 From: StaffiX <32968022+StaffiX@users.noreply.github.com> Date: Sun, 29 Dec 2024 22:25:54 +0100 Subject: [PATCH 5/9] fix sievert bug --- .../tileentities/tiered/GT_MetaTileEntity_RadioHatch.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/bartworks/common/tileentities/tiered/GT_MetaTileEntity_RadioHatch.java b/src/main/java/bartworks/common/tileentities/tiered/GT_MetaTileEntity_RadioHatch.java index c1eb63e0dc2..ce89009a21e 100644 --- a/src/main/java/bartworks/common/tileentities/tiered/GT_MetaTileEntity_RadioHatch.java +++ b/src/main/java/bartworks/common/tileentities/tiered/GT_MetaTileEntity_RadioHatch.java @@ -306,7 +306,7 @@ public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex @Override public void saveNBTData(NBTTagCompound aNBT) { aNBT.setByte("mMass", this.mass); - aNBT.setByte("mSv", (byte) (this.sievert - 100)); + aNBT.setInteger("mSv", this.sievert); aNBT.setByte("mCoverage", this.coverage); aNBT.setInteger("mTextColor", BWColorUtil.getColorFromRGBArray(this.getColorForGUI())); if (this.material != null && !this.material.isEmpty()) aNBT.setString("mMaterial", this.material); @@ -319,7 +319,7 @@ public void saveNBTData(NBTTagCompound aNBT) { public void loadNBTData(NBTTagCompound aNBT) { this.timer = aNBT.getLong("timer"); this.mass = aNBT.getByte("mMass"); - this.sievert = aNBT.getByte("mSv") + 100; + this.sievert = (aNBT.getByte("mSv") != 0) ? aNBT.getByte("mSv") + 100 : aNBT.getInteger("mSv"); this.coverage = aNBT.getByte("mCoverage"); this.colorForGUI = BWColorUtil.splitColorToRBGArray(aNBT.getInteger("mTextColor")); this.material = aNBT.getString("mMaterial"); From 1ae1214745ed00098c8063a3eed0644585b646fa Mon Sep 17 00:00:00 2001 From: StaffiX <32968022+StaffiX@users.noreply.github.com> Date: Mon, 30 Dec 2024 09:24:56 +0100 Subject: [PATCH 6/9] address review --- .../bartworks/common/loaders/BioRecipeLoader.java | 1 + .../common/loaders/RadioHatchMaterialLoader.java | 2 +- .../common/loaders/recipes/CraftingRecipes.java | 2 +- .../common/tileentities/multis/MTEBioVat.java | 3 ++- .../tiered/GT_MetaTileEntity_RadioHatch.java | 13 ++++++++----- 5 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/main/java/bartworks/common/loaders/BioRecipeLoader.java b/src/main/java/bartworks/common/loaders/BioRecipeLoader.java index cce8032d8dc..c5c0052dc4a 100644 --- a/src/main/java/bartworks/common/loaders/BioRecipeLoader.java +++ b/src/main/java/bartworks/common/loaders/BioRecipeLoader.java @@ -131,6 +131,7 @@ public static void registerWaterBasedBacterialVatRecipes() { .special(BioItemList.getPetriDish(BioCultureLoader.CommonYeast)) .fluidInputs(new FluidStack(fluidStack, 100)) .fluidOutputs(FluidRegistry.getFluidStack("potion.ghp", 1)) + .metadata(GLASS, 3) .duration(17 * SECONDS + 10 * TICKS) .eut(TierEU.RECIPE_EV) .noOptimize() diff --git a/src/main/java/bartworks/common/loaders/RadioHatchMaterialLoader.java b/src/main/java/bartworks/common/loaders/RadioHatchMaterialLoader.java index 6e60b1d95ca..806fa640844 100644 --- a/src/main/java/bartworks/common/loaders/RadioHatchMaterialLoader.java +++ b/src/main/java/bartworks/common/loaders/RadioHatchMaterialLoader.java @@ -215,7 +215,7 @@ public static RadioHatchMaterial getRadioHatchMaterialFromInput(RadioHatchMateri .isItemEqual(Material)) { return recipe; } - return (new RadioHatchMaterial(null, 0, (byte) 0)); + return null; } public static List getRadioHatchMaterialList() { diff --git a/src/main/java/bartworks/common/loaders/recipes/CraftingRecipes.java b/src/main/java/bartworks/common/loaders/recipes/CraftingRecipes.java index d613e822d3d..1bdb4d69ea6 100644 --- a/src/main/java/bartworks/common/loaders/recipes/CraftingRecipes.java +++ b/src/main/java/bartworks/common/loaders/recipes/CraftingRecipes.java @@ -524,7 +524,7 @@ public void run() { new GT_MetaTileEntity_RadioHatch( RadioHatch_HV.ID, "bw.radiohatchHV", - "" + StatCollector.translateToLocal("tile.radiohatch.name"), + StatCollector.translateToLocal("tile.radiohatch.name"), 3, false).getStackForm(1L), RecipeLoader.BITSD, diff --git a/src/main/java/bartworks/common/tileentities/multis/MTEBioVat.java b/src/main/java/bartworks/common/tileentities/multis/MTEBioVat.java index 3e05ad9b394..a246b5d7a33 100644 --- a/src/main/java/bartworks/common/tileentities/multis/MTEBioVat.java +++ b/src/main/java/bartworks/common/tileentities/multis/MTEBioVat.java @@ -108,6 +108,7 @@ public class MTEBioVat extends MTEEnhancedMultiBlockBase implements I private int mExpectedMultiplier = 0; private int mTimes = 0; private boolean isVisibleFluid = false; + private final Sievert defaultSievertData = new Sievert(0, false); public MTEBioVat(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); @@ -238,7 +239,7 @@ protected ProcessingLogic createProcessingLogic() { @NotNull @Override protected CheckRecipeResult validateRecipe(@NotNull GTRecipe recipe) { - Sievert data = recipe.getMetadataOrDefault(GTRecipeConstants.SIEVERT, new Sievert(0, false)); + Sievert data = recipe.getMetadataOrDefault(GTRecipeConstants.SIEVERT, defaultSievertData); int sievert = data.sievert; boolean isExact = data.isExact; int glass = recipe.getMetadataOrDefault(GLASS, 0); diff --git a/src/main/java/bartworks/common/tileentities/tiered/GT_MetaTileEntity_RadioHatch.java b/src/main/java/bartworks/common/tileentities/tiered/GT_MetaTileEntity_RadioHatch.java index ce89009a21e..26d7f5f666f 100644 --- a/src/main/java/bartworks/common/tileentities/tiered/GT_MetaTileEntity_RadioHatch.java +++ b/src/main/java/bartworks/common/tileentities/tiered/GT_MetaTileEntity_RadioHatch.java @@ -200,8 +200,11 @@ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { if (GTUtility.areStacksEqual(this.lastUsedItem, lStack, true)) { for (RadioHatchMaterial recipes : getRadioHatchMaterialList()) { this.radioHatchMaterial = getRadioHatchMaterialFromInput(recipes, this.lastUsedItem); + if (radioHatchMaterial != null) { + break; + } } - if (radioHatchMaterial.recipeSievert != 0) { + if (radioHatchMaterial != null) { this.sievert = this.radioHatchMaterial.recipeSievert; this.mass = this.radioHatchMaterial.recipeMass; this.decayTime = calcDecayTicks(radioHatchMaterial.recipeSievert); @@ -217,11 +220,11 @@ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { if (this.radioHatchMaterial == null || this.lastFail || this.radioHatchMaterial.recipeSievert == 0) { for (RadioHatchMaterial recipes : getRadioHatchMaterialList()) { this.radioHatchMaterial = getRadioHatchMaterialFromInput(recipes, this.mInventory[0]); - if (radioHatchMaterial.recipeSievert != 0) { + if (radioHatchMaterial != null) { break; } } - if (this.radioHatchMaterial == null || radioHatchMaterial.recipeSievert == 0) { + if (this.radioHatchMaterial == null) { this.lastFail = true; this.lastUsedItem = this.mInventory[0] == null ? null : this.mInventory[0].copy(); } else { @@ -306,7 +309,7 @@ public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex @Override public void saveNBTData(NBTTagCompound aNBT) { aNBT.setByte("mMass", this.mass); - aNBT.setInteger("mSv", this.sievert); + aNBT.setInteger("mSievert", this.sievert); aNBT.setByte("mCoverage", this.coverage); aNBT.setInteger("mTextColor", BWColorUtil.getColorFromRGBArray(this.getColorForGUI())); if (this.material != null && !this.material.isEmpty()) aNBT.setString("mMaterial", this.material); @@ -319,7 +322,7 @@ public void saveNBTData(NBTTagCompound aNBT) { public void loadNBTData(NBTTagCompound aNBT) { this.timer = aNBT.getLong("timer"); this.mass = aNBT.getByte("mMass"); - this.sievert = (aNBT.getByte("mSv") != 0) ? aNBT.getByte("mSv") + 100 : aNBT.getInteger("mSv"); + this.sievert = (aNBT.getByte("mSv") != 0) ? aNBT.getByte("mSv") + 100 : aNBT.getInteger("mSievert"); this.coverage = aNBT.getByte("mCoverage"); this.colorForGUI = BWColorUtil.splitColorToRBGArray(aNBT.getInteger("mTextColor")); this.material = aNBT.getString("mMaterial"); From 37b7e8e13d30107ecf849694c7d415ba9ccaa0db Mon Sep 17 00:00:00 2001 From: StaffiX <32968022+StaffiX@users.noreply.github.com> Date: Mon, 30 Dec 2024 14:17:50 +0100 Subject: [PATCH 7/9] Remove comment --- .../common/tileentities/tiered/GT_MetaTileEntity_RadioHatch.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/bartworks/common/tileentities/tiered/GT_MetaTileEntity_RadioHatch.java b/src/main/java/bartworks/common/tileentities/tiered/GT_MetaTileEntity_RadioHatch.java index 26d7f5f666f..4918b0b79b3 100644 --- a/src/main/java/bartworks/common/tileentities/tiered/GT_MetaTileEntity_RadioHatch.java +++ b/src/main/java/bartworks/common/tileentities/tiered/GT_MetaTileEntity_RadioHatch.java @@ -84,7 +84,6 @@ public class GT_MetaTileEntity_RadioHatch extends MTEHatch implements RecipeMapW private boolean lastFail = false; private RadioHatchMaterial radioHatchMaterial = null; - // TODO: remove aNameRegional after removing the other tiers public GT_MetaTileEntity_RadioHatch(int aID, String aName, String aNameRegional, int aTier, boolean isDeprecated) { super( aID, From 04fd2a4a082bfcc5d747513de59d59a874b1bfd3 Mon Sep 17 00:00:00 2001 From: StaffiX <32968022+StaffiX@users.noreply.github.com> Date: Tue, 31 Dec 2024 00:09:15 +0100 Subject: [PATCH 8/9] fix uranium fuel cell --- .../bartworks/common/loaders/RadioHatchMaterialLoader.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/bartworks/common/loaders/RadioHatchMaterialLoader.java b/src/main/java/bartworks/common/loaders/RadioHatchMaterialLoader.java index 806fa640844..e93b80a8ce8 100644 --- a/src/main/java/bartworks/common/loaders/RadioHatchMaterialLoader.java +++ b/src/main/java/bartworks/common/loaders/RadioHatchMaterialLoader.java @@ -115,9 +115,9 @@ public static void addRadioHatchMaterials() { radioHatchMaterialAdder(ItemList.Moxcell_1.get(1), (int) Materials.Plutonium.getProtons(), (byte) 3); radioHatchMaterialAdder(ItemList.Moxcell_2.get(1), (int) Materials.Plutonium.getProtons(), (byte) 6); radioHatchMaterialAdder(ItemList.Moxcell_4.get(1), (int) Materials.Plutonium.getProtons(), (byte) 12); - radioHatchMaterialAdder(ItemList.Uraniumcell_1.get(1), (int) Materials.Duranium.getProtons(), (byte) 3); - radioHatchMaterialAdder(ItemList.Uraniumcell_2.get(1), (int) Materials.Duranium.getProtons(), (byte) 6); - radioHatchMaterialAdder(ItemList.Uraniumcell_4.get(1), (int) Materials.Duranium.getProtons(), (byte) 12); + radioHatchMaterialAdder(ItemList.Uraniumcell_1.get(1), (int) Materials.Uranium.getProtons(), (byte) 3); + radioHatchMaterialAdder(ItemList.Uraniumcell_2.get(1), (int) Materials.Uranium.getProtons(), (byte) 6); + radioHatchMaterialAdder(ItemList.Uraniumcell_4.get(1), (int) Materials.Uranium.getProtons(), (byte) 12); radioHatchMaterialAdder( BWNonMetaMaterialItems.TiberiumCell_1.get(1), (int) WerkstoffLoader.Tiberium.getBridgeMaterial() From 60a1d42e1239699c5e1c45812968824fec48295d Mon Sep 17 00:00:00 2001 From: Maya <10861407+serenibyss@users.noreply.github.com> Date: Sat, 11 Jan 2025 02:05:45 -0600 Subject: [PATCH 9/9] spotless --- src/main/java/gregtech/api/util/GTRecipeConstants.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/gregtech/api/util/GTRecipeConstants.java b/src/main/java/gregtech/api/util/GTRecipeConstants.java index 7efe9579bc4..a719edba387 100644 --- a/src/main/java/gregtech/api/util/GTRecipeConstants.java +++ b/src/main/java/gregtech/api/util/GTRecipeConstants.java @@ -26,8 +26,8 @@ import gregtech.api.recipe.RecipeMaps; import gregtech.api.recipe.RecipeMetadataKey; import gregtech.api.recipe.metadata.SimpleRecipeMetadataKey; -import gregtech.api.util.recipe.Sievert; import gregtech.api.util.recipe.Scanning; +import gregtech.api.util.recipe.Sievert; import gregtech.common.items.IDMetaItem03; import gregtech.common.items.MetaGeneratedItem03; import gtnhlanth.common.item.ItemPhotolithographicMask;