Skip to content

[ref:seggan/feature/elektrikity] ELEKTRIKITY#971

Open
Seggan wants to merge 79 commits into
masterfrom
seggan/feature/elektrikity
Open

[ref:seggan/feature/elektrikity] ELEKTRIKITY#971
Seggan wants to merge 79 commits into
masterfrom
seggan/feature/elektrikity

Conversation

@Seggan

@Seggan Seggan commented May 5, 2026

Copy link
Copy Markdown
Member

See #987 section "Foundational Pylon PR"

Seggan and others added 5 commits June 1, 2026 10:20
# Conflicts:
#	src/main/java/io/github/pylonmc/pylon/PylonBlocks.java
#	src/main/java/io/github/pylonmc/pylon/PylonFluids.java
#	src/main/java/io/github/pylonmc/pylon/PylonItems.java
#	src/main/java/io/github/pylonmc/pylon/PylonKeys.java
#	src/main/java/io/github/pylonmc/pylon/content/components/FluidHatch.java
#	src/main/java/io/github/pylonmc/pylon/content/machines/smelting/SmelteryBurner.java
#	src/main/java/io/github/pylonmc/pylon/content/machines/smelting/SmelteryController.java
#	src/main/resources/lang/en.yml
#	src/main/resources/recipes/minecraft/crafting_shaped.yml
#	src/main/resources/researches.yml
Comment thread src/main/resources/lang/en.yml Outdated
JustAHuman-xD and others added 6 commits June 1, 2026 12:43
# Conflicts:
#	src/main/java/io/github/pylonmc/pylon/PylonItems.java
#	src/main/java/io/github/pylonmc/pylon/PylonRecipes.java
#	src/main/java/io/github/pylonmc/pylon/content/components/FluidHatch.java
#	src/main/java/io/github/pylonmc/pylon/content/machines/diesel/machines/DieselBreaker.java
#	src/main/java/io/github/pylonmc/pylon/content/machines/diesel/machines/DieselBrickMolder.java
#	src/main/java/io/github/pylonmc/pylon/content/machines/diesel/machines/DieselFurnace.java
#	src/main/java/io/github/pylonmc/pylon/content/machines/diesel/machines/DieselGrindstone.java
#	src/main/java/io/github/pylonmc/pylon/content/machines/diesel/machines/DieselPipeBender.java
#	src/main/java/io/github/pylonmc/pylon/content/machines/diesel/machines/DieselPress.java
#	src/main/java/io/github/pylonmc/pylon/content/machines/diesel/machines/DieselQuarry.java
#	src/main/java/io/github/pylonmc/pylon/content/machines/diesel/machines/DieselTableSaw.java
#	src/main/java/io/github/pylonmc/pylon/content/machines/diesel/machines/PalladiumCondenser.java
#	src/main/java/io/github/pylonmc/pylon/content/machines/diesel/production/Biorefinery.java
#	src/main/java/io/github/pylonmc/pylon/content/machines/diesel/production/Fermenter.java
#	src/main/java/io/github/pylonmc/pylon/content/machines/experience/FluidExperienceBottler.java
#	src/main/java/io/github/pylonmc/pylon/content/machines/fluid/FluidLimiter.java
#	src/main/java/io/github/pylonmc/pylon/content/machines/hydraulics/Quarry.java
#	src/main/java/io/github/pylonmc/pylon/content/machines/smelting/Bloomery.java
#	src/main/java/io/github/pylonmc/pylon/content/machines/smelting/SmelteryBurner.java
#	src/main/java/io/github/pylonmc/pylon/content/machines/smelting/SmelteryController.java
#	src/main/resources/lang/en.yml
@Seggan Seggan marked this pull request as ready for review June 3, 2026 17:33
Comment on lines +42 to +43
@lombok.Builder.Default
private final Consumer<Player> reopenWindow = _unused -> {};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is unused completely? also no idea why you would need to re-open the window, also is there a reason this is in pylon and not rebar?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was used to reopen the window once the player had inputted a specific value in the chat, now that that's been removed this currently sits unused while we switch it over to dialogs

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 to moving this to Rebar

.material(material)
.itemStack(
ItemStackBuilder.of(material)
.addCustomModelDataString("pylon:display_projectile/" + key)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.addCustomModelDataString("pylon:display_projectile/" + key)
.addCustomModelDataString("pylon:display_projectile:" + key)


private static final ItemStackBuilder NOT_BURNING = ItemStackBuilder.of(Material.CHARCOAL)
.name(Component.translatable("pylon.gui.burning.not_burning"))
.addCustomModelDataString("pylon:burner_progress/not_burning");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.addCustomModelDataString("pylon:burner_progress/not_burning");
.addCustomModelDataString("pylon:burner_progress:not_burning");

.addCustomModelDataString("pylon:burner_progress/not_burning");
private static final ItemStackBuilder BURNING = ItemStackBuilder.of(Material.BLAZE_POWDER)
.name(Component.translatable("pylon.gui.burning.burning"))
.addCustomModelDataString("pylon:burner_progress/burning");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.addCustomModelDataString("pylon:burner_progress/burning");
.addCustomModelDataString("pylon:burner_progress:burning");

Furnace furnace = (Furnace) getBlock().getBlockData();
furnace.setLit(false);
getBlock().setBlockData(furnace);
refreshBlockTextureItem();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
refreshBlockTextureItem();

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the block texture entities now automatically update when block data changes so you don't need to manually refresh it

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably be documented somewhere

Comment on lines +169 to +173





Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

Comment on lines +111 to +133
protected abstract @NotNull List<ItemStack> getResults(@NotNull T recipe);

protected boolean tryStartRecipe(T recipe, ItemStack stack) {
RecipeInput.Item input = (RecipeInput.Item) recipe.getInputs().getFirst();
if (!input.matches(stack)) {
return false;
}

List<ItemStack> results = getResults(recipe);
if (results.size() > 3) {
throw new IllegalStateException("Recipe has more than 3 results, which is not supported by GenericMachine");
}

if (!outputInventory.canHold(results)) {
return true;
}

this.results = results;
startRecipe(recipe, getRecipeTicks(recipe));
getRecipeProgressItem().setItem(ItemStackBuilder.of(stack.asOne()).clearLore());
inputInventory.setItem(new MachineUpdateReason(), 0, stack.subtract(input.getAmount()));
return true;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would update getResults & how you use it so that you clone the return value of getResults instead of all the implementations supplying clones

  1. reduce the tons of .clone() in implementing classes
  2. you can clone only when you are sure those are going to be the results which can save memory & tick time

if (max != null) {
lore.add(Component.translatable("pylon.gui.number-button.max", RebarArgument.of("max", valueFormatter.apply(max))));
}
return ItemStackBuilder.gui(material, pylonKey("number_input_button"))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say we'd want custom model data specific to each usage of this not a singular "number_input_button"

Comment on lines +21 to +27
Location playerLocation = event.getPlayer().getLocation();
ElectricityPylon pylon = BlockStorage.getByType(ElectricityPylon.class).stream()
.min(Comparator.comparing(p -> p.getBlock().getLocation().toCenterLocation().distanceSquared(playerLocation)))
.filter(p -> p.getBlock().getLocation().toCenterLocation().distanceSquared(playerLocation) < 64 * 64)
.orElse(null);
if (pylon == null) return;
throw new UnsupportedOperationException("Multimeter interaction not implemented yet");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

regardless of how this is changed I just don't think we should every be using getByType like this, instead maybe getting by chunk in a chunk radius loop if you don't change this to just be direct block interaction (which is what I think this should be)

even if you do keep using getByType like this, this will throw an exception for any blocks not in the same dimension as the player, but again I would not do this.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh oops forgot to remove debug code lol

@LordIdra LordIdra left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stuff I have found from in-game testing so far (have not looked at code much yet):

Almost everything is missing recipes

Almost everything is missing researches

Basically all electric machines are missing WAILAs. (Might be worth rebasing off my PR for this since you'll have to change the WAILAs anyway? I am happy to rebase it and deal with conflicts if you want)

Quarries appear to now be trying to mine air? Not 100% sure if that was introduced by this PR

A lot of the electric machines are iron blocks. I would use some more variety here as it makes them very hard to distinguish, as we do for diesel and hydraulic machines. You could do this in conjunction with some very simple item displays potentially, if you want to keep the base as an iron blocks.

It is also a bit strange that some electric machines have extra item displays (like the press) and some don't

Would be worth adding electric experience bottler (I know this requires a rework of the experience bottler... this is why we should not abstract stuff like we did with the bottler...)

I am not able to test several items in this PR because they immediately cause errors...

public static final SimpleStaticGuidePage CARGO = new SimpleStaticGuidePage(pylonKey("machines_cargo"));
public static final SimpleStaticGuidePage DIESEL_MACHINES = new SimpleStaticGuidePage(pylonKey("machines_diesel_machines"));
public static final SimpleStaticGuidePage DIESEL_PRODUCTION = new SimpleStaticGuidePage(pylonKey("machines_diesel_production"));
public static final SimpleStaticGuidePage ELECTRICITY = new SimpleStaticGuidePage(pylonKey("machines_electricity"));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe split this into Electricity Production, Electric Machines, and Electric Utilities?

Comment on lines +36 to +46
@Override
public void tick() {
ElectricNetwork network = getElectricNodes().getFirst().getNetwork();
for (ElectricNode node : network.getNodes()) {
Particle.DUST.builder()
.color(Color.fromARGB(network.hashCode()))
.location(node.getBlock().toLocation().toCenterLocation().add(0, 0.6, 0))
.receivers(32, true)
.spawn();
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forgot to remove?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This being a sea lantern feels a bit weird, and the name is also a bit weird considering it's much more a node than a pylon from a player perspective. Maybe worth changing this to use a small cube item display and changing it to 'Electric connector' or similar?

Comment on lines +3436 to +3442
public static final ItemStack WIRE_1_GAUGE = ItemStackBuilder.rebar(Material.STRING, PylonKeys.WIRE_1_GAUGE)
.build();

static {
RebarItem.register(PylonWire.class, WIRE_1_GAUGE, PylonKeys.WIRE_1_GAUGE);
PylonPages.TOOLS.addItem(WIRE_1_GAUGE);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This being in tools doesn't make much sense from a gameplay perspective - I'd suggest moving it to electric machines or components

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to use six item displays which each span the length of the block, rather than twelve? I know this is quite annoying, but given how many of these are likely to be placed I'm very worried about performance

heat_exchanger:
name: "Heat Exchanger"
lore: |-
<arrow> Exchanges heat between two fluids

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clueless on what this does from the description

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The WAILA just constantly errors when not completed

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The turbine errors and turns into a phantom block on completion???

Comment on lines +2463 to +2467
wire_1_gauge:
name: "1-Gauge Wire"
lore: |-
<arrow> Transmits electricity
<arrow> <attr>Max power:</attr> %max-power%

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing instructions

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be worth having the power connection on the top or back here

@Seggan

Seggan commented Jun 8, 2026

Copy link
Copy Markdown
Member Author

I mentioned in Discord that I'm splitting the electric content PR into 2: these are just the base, and recipes/researches/more items will come in my next PR

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why aren't we using FluidTankWithDisplayEntity here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cause the original code didn't

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original code worked differently so it didn't need to. The way it works now I think you can take advantage of FluidTankWithDisplayEntity to remove a lot of code

name: "Gas Turbine"
lore: |-
<arrow> Uses hot gases to produce power
<arrow> The more hot gases piped into it, the more power it produces

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah ok. SO presumably it'll be fine once the display recipes are viewable. Might still be worth adding something to hint towards that like 'different gases produce different amounts of power' but idk

Seggan added 11 commits June 16, 2026 21:46
# Conflicts:
#	src/main/java/io/github/pylonmc/pylon/PylonRecipes.java
#	src/main/java/io/github/pylonmc/pylon/content/components/FluidHatch.java
#	src/main/java/io/github/pylonmc/pylon/content/machines/diesel/machines/DieselBrickMolder.java
#	src/main/java/io/github/pylonmc/pylon/content/machines/diesel/machines/DieselFurnace.java
#	src/main/java/io/github/pylonmc/pylon/content/machines/diesel/machines/DieselGrindstone.java
#	src/main/java/io/github/pylonmc/pylon/content/machines/diesel/machines/DieselPipeBender.java
#	src/main/java/io/github/pylonmc/pylon/content/machines/diesel/machines/DieselPress.java
#	src/main/java/io/github/pylonmc/pylon/content/machines/diesel/machines/DieselTableSaw.java
#	src/main/java/io/github/pylonmc/pylon/content/machines/diesel/machines/PalladiumCondenser.java
#	src/main/java/io/github/pylonmc/pylon/content/machines/diesel/production/Biorefinery.java
#	src/main/java/io/github/pylonmc/pylon/content/machines/diesel/production/Fermenter.java
#	src/main/java/io/github/pylonmc/pylon/content/machines/hydraulics/BurnerHydraulicPurifier.java
#	src/main/java/io/github/pylonmc/pylon/content/machines/hydraulics/Quarry.java
#	src/main/java/io/github/pylonmc/pylon/content/machines/smelting/SmelteryBurner.java
#	src/main/java/io/github/pylonmc/pylon/guide/HydraulicRefuelableItemsPage.java
#	src/main/resources/lang/en.yml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants