Skip to content

Commit

Permalink
Mi/fix hatch capabilities (#676)
Browse files Browse the repository at this point in the history
* fix: capabilities for fluid hatches

* fix: oops...

* chore: version & changelog

* refactor: abilities param in registerFluidHatches()

* fix: only allow single output hatches in distillation tower

* fix: output hatch names

* chore: datagen

---------

Co-authored-by: screret <[email protected]>
  • Loading branch information
mikerooni and screret authored Jan 1, 2024
1 parent a554ca8 commit d0bc854
Show file tree
Hide file tree
Showing 9 changed files with 88 additions and 74 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ChangeLog

Version: 1.0.19.a
Version: 1.0.19.b

- add missing recipe for fluid multi hatches
- fix output hatches not being recognized
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ public class PartAbility {
public static final PartAbility IMPORT_ITEMS = new PartAbility("import_items");
public static final PartAbility EXPORT_FLUIDS = new PartAbility("export_fluids");
public static final PartAbility IMPORT_FLUIDS = new PartAbility("import_fluids");

public static final PartAbility EXPORT_FLUIDS_1X = new PartAbility("export_fluids_1x");
public static final PartAbility IMPORT_FLUIDS_1X = new PartAbility("import_fluids_1x");
public static final PartAbility EXPORT_FLUIDS_4X = new PartAbility("export_fluids_4x");
public static final PartAbility IMPORT_FLUIDS_4X = new PartAbility("import_fluids_4x");
public static final PartAbility EXPORT_FLUIDS_9X = new PartAbility("export_fluids_9x");
public static final PartAbility IMPORT_FLUIDS_9X = new PartAbility("import_fluids_9x");

public static final PartAbility INPUT_ENERGY = new PartAbility("input_energy");
public static final PartAbility OUTPUT_ENERGY = new PartAbility("output_energy");
public static final PartAbility SUBSTATION_INPUT_ENERGY = new PartAbility("substation_input_energy");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -496,34 +496,40 @@ public static BiConsumer<ItemStack, List<Component>> createTankTooltips(String n

public final static MachineDefinition[] FLUID_IMPORT_HATCH = registerFluidHatches(
"input_hatch", "Input Hatch", "fluid_hatch.import",
IO.IN, FluidHatchPartMachine.INITIAL_TANK_CAPACITY_1X, 1, ALL_TIERS
IO.IN, FluidHatchPartMachine.INITIAL_TANK_CAPACITY_1X, 1, ALL_TIERS,
PartAbility.IMPORT_FLUIDS, PartAbility.IMPORT_FLUIDS_1X
);

public final static MachineDefinition[] FLUID_IMPORT_HATCH_4X = registerFluidHatches(
"input_hatch_4x", "Quadruple Input Hatch", "fluid_hatch.import_4x",
IO.IN, FluidHatchPartMachine.INITIAL_TANK_CAPACITY_4X, 4, MULTI_HATCH_TIERS
IO.IN, FluidHatchPartMachine.INITIAL_TANK_CAPACITY_4X, 4, MULTI_HATCH_TIERS,
PartAbility.IMPORT_FLUIDS, PartAbility.IMPORT_FLUIDS_4X
);

public final static MachineDefinition[] FLUID_IMPORT_HATCH_9X = registerFluidHatches(
"input_hatch_9x", "Nonuple Input Hatch", "fluid_hatch.import_9x",
IO.IN, FluidHatchPartMachine.INITIAL_TANK_CAPACITY_9X, 9, MULTI_HATCH_TIERS
IO.IN, FluidHatchPartMachine.INITIAL_TANK_CAPACITY_9X, 9, MULTI_HATCH_TIERS,
PartAbility.IMPORT_FLUIDS, PartAbility.IMPORT_FLUIDS_9X
);


public final static MachineDefinition[] FLUID_EXPORT_HATCH = registerFluidHatches(
"output_hatch", " Output Hatch","fluid_hatch.export",
IO.OUT, FluidHatchPartMachine.INITIAL_TANK_CAPACITY_1X, 1, ALL_TIERS
"output_hatch", "Output Hatch", "fluid_hatch.export",
IO.OUT, FluidHatchPartMachine.INITIAL_TANK_CAPACITY_1X, 1, ALL_TIERS,
PartAbility.EXPORT_FLUIDS, PartAbility.EXPORT_FLUIDS_1X
);


public final static MachineDefinition[] FLUID_EXPORT_HATCH_4X = registerFluidHatches(
"output_hatch_4x", "Quadruple Output Hatch", "fluid_hatch.export_4x",
IO.OUT, FluidHatchPartMachine.INITIAL_TANK_CAPACITY_4X, 4, MULTI_HATCH_TIERS
IO.OUT, FluidHatchPartMachine.INITIAL_TANK_CAPACITY_4X, 4, MULTI_HATCH_TIERS,
PartAbility.EXPORT_FLUIDS, PartAbility.EXPORT_FLUIDS_4X
);

public final static MachineDefinition[] FLUID_EXPORT_HATCH_9X = registerFluidHatches(
"output_hatch_9x", "Nonuple Output Hatch", "fluid_hatch.export_9x",
IO.OUT, FluidHatchPartMachine.INITIAL_TANK_CAPACITY_9X, 9, MULTI_HATCH_TIERS
IO.OUT, FluidHatchPartMachine.INITIAL_TANK_CAPACITY_9X, 9, MULTI_HATCH_TIERS,
PartAbility.EXPORT_FLUIDS, PartAbility.EXPORT_FLUIDS_9X
);

public final static MachineDefinition[] ENERGY_INPUT_HATCH = registerTieredMachines("energy_input_hatch",
Expand Down Expand Up @@ -1079,7 +1085,7 @@ public static BiConsumer<ItemStack, List<Component>> createTankTooltips(String n
.or(Predicates.abilities(PartAbility.INPUT_ENERGY).setMinGlobalLimited(1).setMaxGlobalLimited(3))
.or(Predicates.abilities(PartAbility.IMPORT_FLUIDS).setExactLimit(1)))
.where('X', blocks(CASING_STAINLESS_CLEAN.get())
.or(Predicates.abilities(PartAbility.EXPORT_FLUIDS).setMinLayerLimited(1).setMaxLayerLimited(1)))
.or(Predicates.abilities(PartAbility.EXPORT_FLUIDS_1X).setMinLayerLimited(1).setMaxLayerLimited(1)))
.where('#', Predicates.air())
.build())
.partSorter(Comparator.comparingInt(a -> a.self().getPos().getY()))
Expand Down Expand Up @@ -1608,14 +1614,14 @@ public static MachineDefinition[] registerTieredMachines(String name,
return definitions;
}

private static MachineDefinition[] registerFluidHatches(String name, String displayname, String model, IO io, long initialCapacity, int slots, int[] tiers) {
private static MachineDefinition[] registerFluidHatches(String name, String displayname, String model, IO io, long initialCapacity, int slots, int[] tiers, PartAbility... abilities) {
return registerTieredMachines(name,
(holder, tier) -> new FluidHatchPartMachine(holder, tier, io, initialCapacity, slots),
(tier, builder) -> {
builder.langValue(VNF[tier] + ' ' + displayname)
.rotationState(RotationState.ALL)
.abilities(PartAbility.IMPORT_FLUIDS)
.overlayTieredHullRenderer(model)
.abilities(abilities)
.compassNode("fluid_hatch")
.tooltips(Component.translatable("gtceu.machine.fluid_hatch.import.tooltip"));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
@SuppressWarnings("UnnecessaryUnicodeEscape")
public class FormattingUtil {
private static final NumberFormat NUMBER_FORMAT = NumberFormat.getInstance();
private static final NumberFormat NUMBER_FORMAT = NumberFormat.getInstance(Locale.ROOT);
private static final DecimalFormat TWO_PLACES_FORMAT = new DecimalFormat("#.##");

private static final int SMALL_DOWN_NUMBER_BASE = '\u2080';
Expand Down
30 changes: 15 additions & 15 deletions fabric/src/generated/resources/assets/gtceu/lang/en_ud.json
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@
"block.gtceu.ev_muffler_hatch": "ΛƎϛ§ ɥɔʇɐH ɹǝןɟɟnW",
"block.gtceu.ev_ore_washer": "ɹ§III ɹǝɥsɐM ǝɹO pǝɔuɐʌpⱯϛ§",
"block.gtceu.ev_output_bus": "snᗺ ʇndʇnO ΛƎϛ§",
"block.gtceu.ev_output_hatch": "ɥɔʇɐH ʇndʇnO ΛƎϛ§",
"block.gtceu.ev_output_hatch": "ɥɔʇɐH ʇndʇnO ΛƎϛ§",
"block.gtceu.ev_output_hatch_4x": "ɥɔʇɐH ʇndʇnO ǝןdnɹpɐnὉ ΛƎϛ§",
"block.gtceu.ev_output_hatch_9x": "ɥɔʇɐH ʇndʇnO ǝןdnuoN ΛƎϛ§",
"block.gtceu.ev_packer": "ɹ§III ɹǝʞɔɐԀ pǝɔuɐʌpⱯϛ§",
Expand Down Expand Up @@ -288,7 +288,7 @@
"block.gtceu.hv_muffler_hatch": "ΛH9§ ɥɔʇɐH ɹǝןɟɟnW",
"block.gtceu.hv_ore_washer": "ɹ§II ɹǝɥsɐM ǝɹO pǝɔuɐʌpⱯ9§",
"block.gtceu.hv_output_bus": "snᗺ ʇndʇnO ΛH9§",
"block.gtceu.hv_output_hatch": "ɥɔʇɐH ʇndʇnO ΛH9§",
"block.gtceu.hv_output_hatch": "ɥɔʇɐH ʇndʇnO ΛH9§",
"block.gtceu.hv_packer": "ɹ§II ɹǝʞɔɐԀ pǝɔuɐʌpⱯ9§",
"block.gtceu.hv_polarizer": "ɹ§II ɹǝzıɹɐןoԀ pǝɔuɐʌpⱯ9§",
"block.gtceu.hv_pump": "ɹ§II dɯnԀ pǝɔuɐʌpⱯ9§",
Expand Down Expand Up @@ -374,7 +374,7 @@
"block.gtceu.iv_muffler_hatch": "ΛIƖ§ ɥɔʇɐH ɹǝןɟɟnW",
"block.gtceu.iv_ore_washer": "ɹ§ ɹǝɥsɐM ǝɹO ǝʇıןƎƖ§",
"block.gtceu.iv_output_bus": "snᗺ ʇndʇnO ΛIƖ§",
"block.gtceu.iv_output_hatch": "ɥɔʇɐH ʇndʇnO ΛIƖ§",
"block.gtceu.iv_output_hatch": "ɥɔʇɐH ʇndʇnO ΛIƖ§",
"block.gtceu.iv_output_hatch_4x": "ɥɔʇɐH ʇndʇnO ǝןdnɹpɐnὉ ΛIƖ§",
"block.gtceu.iv_output_hatch_9x": "ɥɔʇɐH ʇndʇnO ǝןdnuoN ΛIƖ§",
"block.gtceu.iv_packer": "ɹ§ ɹǝʞɔɐԀ ǝʇıןƎƖ§",
Expand Down Expand Up @@ -501,7 +501,7 @@
"block.gtceu.luv_muffler_hatch": "ΛnꞀp§ ɥɔʇɐH ɹǝןɟɟnW",
"block.gtceu.luv_ore_washer": "ɹ§II ɹǝɥsɐM ǝɹO ǝʇıןƎp§",
"block.gtceu.luv_output_bus": "snᗺ ʇndʇnO ΛnꞀp§",
"block.gtceu.luv_output_hatch": "ɥɔʇɐH ʇndʇnO ΛnꞀp§",
"block.gtceu.luv_output_hatch": "ɥɔʇɐH ʇndʇnO ΛnꞀp§",
"block.gtceu.luv_output_hatch_4x": "ɥɔʇɐH ʇndʇnO ǝןdnɹpɐnὉ ΛnꞀp§",
"block.gtceu.luv_output_hatch_9x": "ɥɔʇɐH ʇndʇnO ǝןdnuoN ΛnꞀp§",
"block.gtceu.luv_packer": "ɹ§II ɹǝʞɔɐԀ ǝʇıןƎp§",
Expand Down Expand Up @@ -583,7 +583,7 @@
"block.gtceu.lv_muffler_hatch": "ΛꞀㄥ§ ɥɔʇɐH ɹǝןɟɟnW",
"block.gtceu.lv_ore_washer": "ɹ§ ɹǝɥsɐM ǝɹO ɔısɐᗺ",
"block.gtceu.lv_output_bus": "snᗺ ʇndʇnO ΛꞀㄥ§",
"block.gtceu.lv_output_hatch": "ɥɔʇɐH ʇndʇnO ΛꞀㄥ§",
"block.gtceu.lv_output_hatch": "ɥɔʇɐH ʇndʇnO ΛꞀㄥ§",
"block.gtceu.lv_packer": "ɹ§ ɹǝʞɔɐԀ ɔısɐᗺ",
"block.gtceu.lv_polarizer": "ɹ§ ɹǝzıɹɐןoԀ ɔısɐᗺ",
"block.gtceu.lv_pump": "ɹ§ dɯnԀ ɔısɐᗺ",
Expand Down Expand Up @@ -616,7 +616,7 @@
"block.gtceu.max_machine_casing": "buısɐƆ ǝuıɥɔɐW XⱯW",
"block.gtceu.max_machine_hull": "ןןnH ǝuıɥɔɐW XⱯW",
"block.gtceu.max_output_bus": "snᗺ ʇndʇnO XⱯWן§ɔ§",
"block.gtceu.max_output_hatch": "ɥɔʇɐH ʇndʇnO XⱯWן§ɔ§",
"block.gtceu.max_output_hatch": "ɥɔʇɐH ʇndʇnO XⱯWן§ɔ§",
"block.gtceu.max_output_hatch_4x": "ɥɔʇɐH ʇndʇnO ǝןdnɹpɐnὉ XⱯWן§ɔ§",
"block.gtceu.max_output_hatch_9x": "ɥɔʇɐH ʇndʇnO ǝןdnuoN XⱯWן§ɔ§",
"block.gtceu.me_input_bus": "snᗺ ʇnduI buıʞɔoʇS ƎW",
Expand Down Expand Up @@ -692,7 +692,7 @@
"block.gtceu.mv_muffler_hatch": "ΛWq§ ɥɔʇɐH ɹǝןɟɟnW",
"block.gtceu.mv_ore_washer": "ɹ§ ɹǝɥsɐM ǝɹO pǝɔuɐʌpⱯq§",
"block.gtceu.mv_output_bus": "snᗺ ʇndʇnO ΛWq§",
"block.gtceu.mv_output_hatch": "ɥɔʇɐH ʇndʇnO ΛWq§",
"block.gtceu.mv_output_hatch": "ɥɔʇɐH ʇndʇnO ΛWq§",
"block.gtceu.mv_packer": "ɹ§ ɹǝʞɔɐԀ pǝɔuɐʌpⱯq§",
"block.gtceu.mv_polarizer": "ɹ§ ɹǝzıɹɐןoԀ pǝɔuɐʌpⱯq§",
"block.gtceu.mv_pump": "ɹ§ dɯnԀ pǝɔuɐʌpⱯq§",
Expand Down Expand Up @@ -773,7 +773,7 @@
"block.gtceu.opv_muffler_hatch": "ΛdO6§ ɥɔʇɐH ɹǝןɟɟnW",
"block.gtceu.opv_ore_washer": "ɹ§ ɹǝɥsɐM ǝɹO ʎɹɐpuǝbǝꞀ6§",
"block.gtceu.opv_output_bus": "snᗺ ʇndʇnO ΛdO6§",
"block.gtceu.opv_output_hatch": "ɥɔʇɐH ʇndʇnO ΛdO6§",
"block.gtceu.opv_output_hatch": "ɥɔʇɐH ʇndʇnO ΛdO6§",
"block.gtceu.opv_output_hatch_4x": "ɥɔʇɐH ʇndʇnO ǝןdnɹpɐnὉ ΛdO6§",
"block.gtceu.opv_output_hatch_9x": "ɥɔʇɐH ʇndʇnO ǝןdnuoN ΛdO6§",
"block.gtceu.opv_packer": "ɹ§ ɹǝʞɔɐԀ ʎɹɐpuǝbǝꞀ6§",
Expand Down Expand Up @@ -918,7 +918,7 @@
"block.gtceu.uev_muffler_hatch": "ΛƎ∩ɐ§ ɥɔʇɐH ɹǝןɟɟnW",
"block.gtceu.uev_ore_washer": "ɹ§II ɹǝɥsɐM ǝɹO ɔıdƎɐ§",
"block.gtceu.uev_output_bus": "snᗺ ʇndʇnO ΛƎ∩ɐ§",
"block.gtceu.uev_output_hatch": "ɥɔʇɐH ʇndʇnO ΛƎ∩ɐ§",
"block.gtceu.uev_output_hatch": "ɥɔʇɐH ʇndʇnO ΛƎ∩ɐ§",
"block.gtceu.uev_output_hatch_4x": "ɥɔʇɐH ʇndʇnO ǝןdnɹpɐnὉ ΛƎ∩ɐ§",
"block.gtceu.uev_output_hatch_9x": "ɥɔʇɐH ʇndʇnO ǝןdnuoN ΛƎ∩ɐ§",
"block.gtceu.uev_packer": "ɹ§II ɹǝʞɔɐԀ ɔıdƎɐ§",
Expand Down Expand Up @@ -993,7 +993,7 @@
"block.gtceu.uhv_muffler_hatch": "ΛH∩ㄣ§ ɥɔʇɐH ɹǝןɟɟnW",
"block.gtceu.uhv_ore_washer": "ɹ§ ɹǝɥsɐM ǝɹO ɔıdƎㄣ§",
"block.gtceu.uhv_output_bus": "snᗺ ʇndʇnO ΛH∩ㄣ§",
"block.gtceu.uhv_output_hatch": "ɥɔʇɐH ʇndʇnO ΛH∩ㄣ§",
"block.gtceu.uhv_output_hatch": "ɥɔʇɐH ʇndʇnO ΛH∩ㄣ§",
"block.gtceu.uhv_output_hatch_4x": "ɥɔʇɐH ʇndʇnO ǝןdnɹpɐnὉ ΛH∩ㄣ§",
"block.gtceu.uhv_output_hatch_9x": "ɥɔʇɐH ʇndʇnO ǝןdnuoN ΛH∩ㄣ§",
"block.gtceu.uhv_packer": "ɹ§ ɹǝʞɔɐԀ ɔıdƎㄣ§",
Expand Down Expand Up @@ -1066,7 +1066,7 @@
"block.gtceu.uiv_muffler_hatch": "ΛI∩ᄅ§ ɥɔʇɐH ɹǝןɟɟnW",
"block.gtceu.uiv_ore_washer": "ɹ§III ɹǝɥsɐM ǝɹO ɔıdƎᄅ§",
"block.gtceu.uiv_output_bus": "snᗺ ʇndʇnO ΛI∩ᄅ§",
"block.gtceu.uiv_output_hatch": "ɥɔʇɐH ʇndʇnO ΛI∩ᄅ§",
"block.gtceu.uiv_output_hatch": "ɥɔʇɐH ʇndʇnO ΛI∩ᄅ§",
"block.gtceu.uiv_output_hatch_4x": "ɥɔʇɐH ʇndʇnO ǝןdnɹpɐnὉ ΛI∩ᄅ§",
"block.gtceu.uiv_output_hatch_9x": "ɥɔʇɐH ʇndʇnO ǝןdnuoN ΛI∩ᄅ§",
"block.gtceu.uiv_packer": "ɹ§III ɹǝʞɔɐԀ ɔıdƎᄅ§",
Expand All @@ -1092,7 +1092,7 @@
"block.gtceu.ulv_machine_casing": "buısɐƆ ǝuıɥɔɐW ΛꞀ∩",
"block.gtceu.ulv_machine_hull": "ןןnH ǝuıɥɔɐW ΛꞀ∩",
"block.gtceu.ulv_output_bus": "snᗺ ʇndʇnO ΛꞀ∩8§",
"block.gtceu.ulv_output_hatch": "ɥɔʇɐH ʇndʇnO ΛꞀ∩8§",
"block.gtceu.ulv_output_hatch": "ɥɔʇɐH ʇndʇnO ΛꞀ∩8§",
"block.gtceu.ulv_transformer_16a": "ɹǝɯɹoɟsuɐɹ⟘ ɹǝʍoԀ ǝbɐʇןoΛ ʍoꞀ ɐɹʇן∩",
"block.gtceu.ulv_transformer_1a": "ɹǝɯɹoɟsuɐɹ⟘ ǝbɐʇןoΛ ʍoꞀ ɐɹʇן∩",
"block.gtceu.ulv_transformer_2a": "ɹǝɯɹoɟsuɐɹ⟘ )xᄅ( dɯⱯ-ıH ǝbɐʇןoΛ ʍoꞀ ɐɹʇן∩",
Expand Down Expand Up @@ -1163,7 +1163,7 @@
"block.gtceu.uv_muffler_hatch": "Λ∩Ɛ§ ɥɔʇɐH ɹǝןɟɟnW",
"block.gtceu.uv_ore_washer": "ɹ§ ɹǝɥsɐM ǝɹO ǝʇɐɯıʇן∩Ɛ§",
"block.gtceu.uv_output_bus": "snᗺ ʇndʇnO Λ∩Ɛ§",
"block.gtceu.uv_output_hatch": "ɥɔʇɐH ʇndʇnO Λ∩Ɛ§",
"block.gtceu.uv_output_hatch": "ɥɔʇɐH ʇndʇnO Λ∩Ɛ§",
"block.gtceu.uv_output_hatch_4x": "ɥɔʇɐH ʇndʇnO ǝןdnɹpɐnὉ Λ∩Ɛ§",
"block.gtceu.uv_output_hatch_9x": "ɥɔʇɐH ʇndʇnO ǝןdnuoN Λ∩Ɛ§",
"block.gtceu.uv_packer": "ɹ§ ɹǝʞɔɐԀ ǝʇɐɯıʇן∩Ɛ§",
Expand Down Expand Up @@ -1241,7 +1241,7 @@
"block.gtceu.uxv_muffler_hatch": "ΛX∩ǝ§ ɥɔʇɐH ɹǝןɟɟnW",
"block.gtceu.uxv_ore_washer": "ɹ§ΛI ɹǝɥsɐM ǝɹO ɔıdƎǝ§",
"block.gtceu.uxv_output_bus": "snᗺ ʇndʇnO ΛX∩ǝ§",
"block.gtceu.uxv_output_hatch": "ɥɔʇɐH ʇndʇnO ΛX∩ǝ§",
"block.gtceu.uxv_output_hatch": "ɥɔʇɐH ʇndʇnO ΛX∩ǝ§",
"block.gtceu.uxv_output_hatch_4x": "ɥɔʇɐH ʇndʇnO ǝןdnɹpɐnὉ ΛX∩ǝ§",
"block.gtceu.uxv_output_hatch_9x": "ɥɔʇɐH ʇndʇnO ǝןdnuoN ΛX∩ǝ§",
"block.gtceu.uxv_packer": "ɹ§ΛI ɹǝʞɔɐԀ ɔıdƎǝ§",
Expand Down Expand Up @@ -1332,7 +1332,7 @@
"block.gtceu.zpm_muffler_hatch": "WԀZɔ§ ɥɔʇɐH ɹǝןɟɟnW",
"block.gtceu.zpm_ore_washer": "ɹ§III ɹǝɥsɐM ǝɹO ǝʇıןƎɔ§",
"block.gtceu.zpm_output_bus": "snᗺ ʇndʇnO WԀZɔ§",
"block.gtceu.zpm_output_hatch": "ɥɔʇɐH ʇndʇnO WԀZɔ§",
"block.gtceu.zpm_output_hatch": "ɥɔʇɐH ʇndʇnO WԀZɔ§",
"block.gtceu.zpm_output_hatch_4x": "ɥɔʇɐH ʇndʇnO ǝןdnɹpɐnὉ WԀZɔ§",
"block.gtceu.zpm_output_hatch_9x": "ɥɔʇɐH ʇndʇnO ǝןdnuoN WԀZɔ§",
"block.gtceu.zpm_packer": "ɹ§III ɹǝʞɔɐԀ ǝʇıןƎɔ§",
Expand Down
Loading

0 comments on commit d0bc854

Please sign in to comment.