Skip to content

Commit

Permalink
fix: Revert energy conduit connection defaults to check capability ca…
Browse files Browse the repository at this point in the history
…nReceive/canExtract.

Also includes a patch to default to extract only on capabilities that report false on canReceive/canExtract - Flux Networks and Thermals Dynamos for example.

Related-To: GH-817
  • Loading branch information
Rover656 committed Sep 27, 2024
1 parent 33d66c6 commit 8a65b13
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,13 @@ public void onRemoved(ConduitNode node, Level level, BlockPos pos) {
public ConduitConnectionData getDefaultConnection(Level level, BlockPos pos, Direction direction) {
IEnergyStorage capability = level.getCapability(Capabilities.EnergyStorage.BLOCK, pos.relative(direction), direction.getOpposite());
if (capability != null) {
// Always default to both directions.
return new ConduitConnectionData(true, true, RedstoneControl.ALWAYS_ACTIVE);
if (!capability.canReceive() && !capability.canExtract()) {
// This ensures that if there's an energy capability that might be pushing but won't allow pulling is present, we can still interact
// For example Thermal's Dynamos report false until they have energy in them and flux networks always refuse.
return new ConduitConnectionData(false, true, RedstoneControl.ALWAYS_ACTIVE);
}

return new ConduitConnectionData(capability.canReceive(), capability.canExtract(), RedstoneControl.ALWAYS_ACTIVE);
}

return Conduit.super.getDefaultConnection(level, pos, direction);
Expand Down

0 comments on commit 8a65b13

Please sign in to comment.