Skip to content

Commit

Permalink
feat: overhaul part 3
Browse files Browse the repository at this point in the history
  • Loading branch information
bruberu committed Jul 21, 2024
1 parent c144c74 commit 5e0974d
Show file tree
Hide file tree
Showing 10 changed files with 79 additions and 53 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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() {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}
Expand Down Expand Up @@ -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)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/gregtech/api/pattern/BlockPattern.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<TraceabilityPredicate.SimplePredicate, Integer> globalCount;
protected final Map<TraceabilityPredicate.SimplePredicate, Integer> layerCount;
Expand Down
17 changes: 4 additions & 13 deletions src/main/java/gregtech/api/pattern/FactoryBlockPattern.java
Original file line number Diff line number Diff line change
Expand Up @@ -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!");
Expand Down
17 changes: 4 additions & 13 deletions src/main/java/gregtech/api/pattern/MultiblockShapeInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -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!");
Expand Down
74 changes: 62 additions & 12 deletions src/main/java/gregtech/api/recipes/RecipeMaps.java
Original file line number Diff line number Diff line change
Expand Up @@ -1471,18 +1471,68 @@ public final class RecipeMaps {
.sound(GTSoundEvents.MOTOR)
.build();

public static final RecipeMap<PrimitiveRecipeBuilder> 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<SimpleRecipeBuilder> 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<SimpleRecipeBuilder> GAS_CENTRIFUGE_RECIPES = new RecipeMap<>("gas_centrifuge", 0, 0,
1, 2, new SimpleRecipeBuilder(), false)
.setProgressBar(GuiTextures.PROGRESS_BAR_MIXER, MoveType.CIRCULAR);
/**
* Example:
*
* <pre>
* RecipeMap.HEAT_EXCHANGER_RECIPES.recipeBuilder()
* .circuitMeta(1)
* .fluidInputs(DistilledWater.getFluid(1000), HotHighPressureSteam.getFluid(100))
* .fluidOutputs(Steam.getFluid(96000), DistilledWater.getFluid(100))
* .duration(1)
* .buildAndRegister();
* </pre>
*/
@ZenProperty
public static final RecipeMap<PrimitiveRecipeBuilder> 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:
*
* <pre>
* RecipeMap.SPENT_FUEL_POOL_RECIPES.recipeBuilder()
* .input(OrePrefix.fuelRodHotDepleted, Materials.LEU235)
* .output(OrePrefix.fuelRodDepleted, Materials.LEU235)
* .duration(1000)
* .buildAndRegister();
* </pre>
*/
@ZenProperty
public static final RecipeMap<SimpleRecipeBuilder> 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:
*
* <pre>
* GAS_CENTRIFUGE_RECIPES.recipeBuilder().duration(800).EUt(VA[HV])
* .fluidInputs(UraniumHexafluoride.getFluid(1000))
* .fluidOutputs(LowEnrichedUraniumHexafluoride.getFluid(100))
* .fluidOutputs(DepletedUraniumHexafluoride.getFluid(900))
* .buildAndRegister();
* </pre>
*/
@ZenProperty
public static final RecipeMap<SimpleRecipeBuilder> 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 //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5e0974d

Please sign in to comment.