From 5e0974daac8f26ae5f5596d7d4f98571a12ec0e7 Mon Sep 17 00:00:00 2001 From: bruberu <80226372+bruberu@users.noreply.github.com> Date: Sat, 20 Jul 2024 20:14:05 -0500 Subject: [PATCH] feat: overhaul part 3 --- .../impl/MultiblockRecipeLogic.java | 4 - .../capability/impl/PrimitiveRecipeLogic.java | 5 +- .../items/materialitem/MetaPrefixItem.java | 7 +- ...ecipeMapPrimitiveMultiblockController.java | 2 +- .../gregtech/api/pattern/BlockPattern.java | 2 +- .../api/pattern/FactoryBlockPattern.java | 17 +---- .../api/pattern/MultiblockShapeInfo.java | 17 +---- .../java/gregtech/api/recipes/RecipeMaps.java | 74 ++++++++++++++++--- .../material/materials/ElementMaterials.java | 2 +- .../MetaTileEntityHeatExchanger.java | 2 +- 10 files changed, 79 insertions(+), 53 deletions(-) diff --git a/src/main/java/gregtech/api/capability/impl/MultiblockRecipeLogic.java b/src/main/java/gregtech/api/capability/impl/MultiblockRecipeLogic.java index 99f17e0aec0..b27685c6987 100644 --- a/src/main/java/gregtech/api/capability/impl/MultiblockRecipeLogic.java +++ b/src/main/java/gregtech/api/capability/impl/MultiblockRecipeLogic.java @@ -40,10 +40,6 @@ public MultiblockRecipeLogic(RecipeMapMultiblockController tileEntity, boolean h super(tileEntity, tileEntity.recipeMap, hasPerfectOC); } - public MultiblockRecipeLogic(MultiblockWithDisplayBase tileEntity, RecipeMap recipeMap) { - super(tileEntity, recipeMap); - } - @Override public void update() {} diff --git a/src/main/java/gregtech/api/capability/impl/PrimitiveRecipeLogic.java b/src/main/java/gregtech/api/capability/impl/PrimitiveRecipeLogic.java index 95ce6f0c269..66ea9dc997e 100644 --- a/src/main/java/gregtech/api/capability/impl/PrimitiveRecipeLogic.java +++ b/src/main/java/gregtech/api/capability/impl/PrimitiveRecipeLogic.java @@ -2,6 +2,7 @@ import gregtech.api.GTValues; import gregtech.api.metatileentity.multiblock.MultiblockWithDisplayBase; +import gregtech.api.metatileentity.multiblock.RecipeMapMultiblockController; import gregtech.api.recipes.RecipeMap; import gregtech.api.recipes.recipeproperties.IRecipePropertyStorage; @@ -14,8 +15,8 @@ */ public class PrimitiveRecipeLogic extends MultiblockRecipeLogic { - public PrimitiveRecipeLogic(MultiblockWithDisplayBase tileEntity, RecipeMap recipeMap) { - super(tileEntity, recipeMap); + public PrimitiveRecipeLogic(RecipeMapMultiblockController tileEntity) { + super(tileEntity); } @Override diff --git a/src/main/java/gregtech/api/items/materialitem/MetaPrefixItem.java b/src/main/java/gregtech/api/items/materialitem/MetaPrefixItem.java index 0c939184016..09f665ae852 100644 --- a/src/main/java/gregtech/api/items/materialitem/MetaPrefixItem.java +++ b/src/main/java/gregtech/api/items/materialitem/MetaPrefixItem.java @@ -84,10 +84,7 @@ private static void registerSpecialOreDict(ItemStack item, Material material, Or if (prefix.getAlternativeOreName() != null) { OreDictUnifier.registerOre(item, prefix.getAlternativeOreName(), material); } - - if (material == Materials.Plutonium239) { - OreDictUnifier.registerOre(item, prefix.name() + material.toCamelCaseString() + "_239"); - } else if (material == Materials.Saltpeter) { + if (material == Materials.Saltpeter) { OreDictUnifier.registerOre(item, prefix.name() + material.toCamelCaseString()); } } @@ -171,7 +168,7 @@ public void onUpdate(@NotNull ItemStack itemStack, @NotNull World worldIn, @NotN } } } - + private void handleHeatDamage(@NotNull Material material, @NotNull EntityLivingBase entity) { float heatDamage = 0.f; if (material.hasProperty(PropertyKey.BLAST)) { diff --git a/src/main/java/gregtech/api/metatileentity/multiblock/RecipeMapPrimitiveMultiblockController.java b/src/main/java/gregtech/api/metatileentity/multiblock/RecipeMapPrimitiveMultiblockController.java index 43d89bddc13..7f63265ff39 100644 --- a/src/main/java/gregtech/api/metatileentity/multiblock/RecipeMapPrimitiveMultiblockController.java +++ b/src/main/java/gregtech/api/metatileentity/multiblock/RecipeMapPrimitiveMultiblockController.java @@ -23,7 +23,7 @@ public abstract class RecipeMapPrimitiveMultiblockController extends RecipeMapMu public RecipeMapPrimitiveMultiblockController(ResourceLocation metaTileEntityId, RecipeMap recipeMap) { super(metaTileEntityId, recipeMap); - this.recipeMapWorkable = new PrimitiveRecipeLogic(this, recipeMap); + this.recipeMapWorkable = new PrimitiveRecipeLogic(this); initializeAbilities(); } diff --git a/src/main/java/gregtech/api/pattern/BlockPattern.java b/src/main/java/gregtech/api/pattern/BlockPattern.java index 587542d8ae9..51ca55a1493 100644 --- a/src/main/java/gregtech/api/pattern/BlockPattern.java +++ b/src/main/java/gregtech/api/pattern/BlockPattern.java @@ -42,7 +42,7 @@ public class BlockPattern { protected final int fingerLength; // z size protected final int thumbLength; // y size protected final int palmLength; // x size - public final BlockWorldState worldState = new BlockWorldState(); + protected final BlockWorldState worldState = new BlockWorldState(); protected final PatternMatchContext matchContext = new PatternMatchContext(); protected final Map globalCount; protected final Map layerCount; diff --git a/src/main/java/gregtech/api/pattern/FactoryBlockPattern.java b/src/main/java/gregtech/api/pattern/FactoryBlockPattern.java index e83c519186d..22f5b2044a7 100644 --- a/src/main/java/gregtech/api/pattern/FactoryBlockPattern.java +++ b/src/main/java/gregtech/api/pattern/FactoryBlockPattern.java @@ -30,20 +30,11 @@ private FactoryBlockPattern(RelativeDirection charDir, RelativeDirection stringD structureDir[1] = stringDir; structureDir[2] = aisleDir; int flags = 0; - for (int i = 0; i < 3; i++) { + for (int i = 0; i < this.structureDir.length; i++) { switch (structureDir[i]) { - case UP: - case DOWN: - flags |= 0x1; - break; - case LEFT: - case RIGHT: - flags |= 0x2; - break; - case FRONT: - case BACK: - flags |= 0x4; - break; + case UP, DOWN -> flags |= 0x1; + case LEFT, RIGHT -> flags |= 0x2; + case FRONT, BACK -> flags |= 0x4; } } if (flags != 0x7) throw new IllegalArgumentException("Must have 3 different axes!"); diff --git a/src/main/java/gregtech/api/pattern/MultiblockShapeInfo.java b/src/main/java/gregtech/api/pattern/MultiblockShapeInfo.java index ded9231b7ce..362cf9edfc9 100644 --- a/src/main/java/gregtech/api/pattern/MultiblockShapeInfo.java +++ b/src/main/java/gregtech/api/pattern/MultiblockShapeInfo.java @@ -56,20 +56,11 @@ public Builder(RelativeDirection... structureDir) { this.structureDir[1] = structureDir[1]; this.structureDir[2] = structureDir[2]; int flags = 0; - for (int i = 0; i < 3; i++) { + for (int i = 0; i < this.structureDir.length; i++) { switch (structureDir[i]) { - case UP: - case DOWN: - flags |= 0x1; - break; - case LEFT: - case RIGHT: - flags |= 0x2; - break; - case FRONT: - case BACK: - flags |= 0x4; - break; + case UP, DOWN -> flags |= 0x1; + case LEFT, RIGHT -> flags |= 0x2; + case FRONT, BACK -> flags |= 0x4; } } if (flags != 0x7) throw new IllegalArgumentException("Must have 3 different axes!"); diff --git a/src/main/java/gregtech/api/recipes/RecipeMaps.java b/src/main/java/gregtech/api/recipes/RecipeMaps.java index 81d16b5637a..dcfea256b3c 100644 --- a/src/main/java/gregtech/api/recipes/RecipeMaps.java +++ b/src/main/java/gregtech/api/recipes/RecipeMaps.java @@ -1471,18 +1471,68 @@ public final class RecipeMaps { .sound(GTSoundEvents.MOTOR) .build(); - public static final RecipeMap HEAT_EXCHANGER_RECIPES = new RecipeMap<>("heat_exchanger", 1, - 0, 2, 2, new PrimitiveRecipeBuilder(), false) - .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW_MULTIPLE, ProgressWidget.MoveType.HORIZONTAL) - .setSound(GTSoundEvents.COOLING); - - public static final RecipeMap SPENT_FUEL_POOL_RECIPES = new RecipeMap<>("spent_fuel_pool", 1, - 1, 1, 1, new SimpleRecipeBuilder(), false) - .setProgressBar(GuiTextures.PROGRESS_BAR_BATH, MoveType.HORIZONTAL); - - public static final RecipeMap GAS_CENTRIFUGE_RECIPES = new RecipeMap<>("gas_centrifuge", 0, 0, - 1, 2, new SimpleRecipeBuilder(), false) - .setProgressBar(GuiTextures.PROGRESS_BAR_MIXER, MoveType.CIRCULAR); + /** + * Example: + * + *
+     * RecipeMap.HEAT_EXCHANGER_RECIPES.recipeBuilder()
+     *         .circuitMeta(1)
+     *         .fluidInputs(DistilledWater.getFluid(1000), HotHighPressureSteam.getFluid(100))
+     *         .fluidOutputs(Steam.getFluid(96000), DistilledWater.getFluid(100))
+     *         .duration(1)
+     *         .buildAndRegister();
+     * 
+ */ + @ZenProperty + public static final RecipeMap HEAT_EXCHANGER_RECIPES = new RecipeMapBuilder<>("heat_exchanger", + new PrimitiveRecipeBuilder()) + .itemInputs(1) + .fluidInputs(2) + .fluidOutputs(2) + .progressBar(GuiTextures.PROGRESS_BAR_ARROW_MULTIPLE, MoveType.HORIZONTAL) + .sound(GTSoundEvents.COOLING) + .build(); + + /** + * Example: + * + *
+     * RecipeMap.SPENT_FUEL_POOL_RECIPES.recipeBuilder()
+     *         .input(OrePrefix.fuelRodHotDepleted, Materials.LEU235)
+     *         .output(OrePrefix.fuelRodDepleted, Materials.LEU235)
+     *         .duration(1000)
+     *         .buildAndRegister();
+     * 
+ */ + @ZenProperty + public static final RecipeMap SPENT_FUEL_POOL_RECIPES = new RecipeMapBuilder<>("spent_fuel_pool", + new SimpleRecipeBuilder()) + .itemInputs(1) + .itemOutputs(1) + .fluidInputs(1) + .fluidOutputs(1) + .progressBar(GuiTextures.PROGRESS_BAR_BATH, MoveType.HORIZONTAL) + .build(); + + /** + * Example: + * + *
+     * GAS_CENTRIFUGE_RECIPES.recipeBuilder().duration(800).EUt(VA[HV])
+     *      .fluidInputs(UraniumHexafluoride.getFluid(1000))
+     *      .fluidOutputs(LowEnrichedUraniumHexafluoride.getFluid(100))
+     *      .fluidOutputs(DepletedUraniumHexafluoride.getFluid(900))
+     *      .buildAndRegister();
+     * 
+ */ + @ZenProperty + public static final RecipeMap GAS_CENTRIFUGE_RECIPES = new RecipeMapBuilder<>("gas_centrifuge", + new SimpleRecipeBuilder()) + .fluidInputs(1) + .fluidOutputs(2) + .progressBar(GuiTextures.PROGRESS_BAR_MIXER, MoveType.CIRCULAR) + .sound(GTSoundEvents.CENTRIFUGE) + .build(); ////////////////////////////////////// // Fuel Recipe Maps // diff --git a/src/main/java/gregtech/api/unification/material/materials/ElementMaterials.java b/src/main/java/gregtech/api/unification/material/materials/ElementMaterials.java index 094610eaf32..9bb91da86ee 100644 --- a/src/main/java/gregtech/api/unification/material/materials/ElementMaterials.java +++ b/src/main/java/gregtech/api/unification/material/materials/ElementMaterials.java @@ -614,7 +614,7 @@ public static void register() { .itemPipeProperties(512, 4.0f) .build(); - Plutonium239 = new Material.Builder(81, gregtechId("plutonium")) + Plutonium239 = new Material.Builder(81, gregtechId("plutonium_239")) .ingot(3) .liquid(new FluidBuilder().temperature(913)) .ore(true) diff --git a/src/main/java/gregtech/common/metatileentities/MetaTileEntityHeatExchanger.java b/src/main/java/gregtech/common/metatileentities/MetaTileEntityHeatExchanger.java index b7041f4599e..6a8cf33d251 100644 --- a/src/main/java/gregtech/common/metatileentities/MetaTileEntityHeatExchanger.java +++ b/src/main/java/gregtech/common/metatileentities/MetaTileEntityHeatExchanger.java @@ -23,7 +23,7 @@ public class MetaTileEntityHeatExchanger extends RecipeMapMultiblockController { public MetaTileEntityHeatExchanger(ResourceLocation metaTileEntityId) { super(metaTileEntityId, RecipeMaps.HEAT_EXCHANGER_RECIPES); - this.recipeMapWorkable = new PrimitiveRecipeLogic(this, RecipeMaps.HEAT_EXCHANGER_RECIPES); + this.recipeMapWorkable = new PrimitiveRecipeLogic(this); } @Override