Skip to content

Commit

Permalink
fix: transmission APIs not correctly providing bundled signals
Browse files Browse the repository at this point in the history
  • Loading branch information
MrTJP committed Jul 3, 2023
1 parent 292850d commit 41fe682
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ protected byte[] resolveArray(FaceLookup lookup) {
return ((IBundledTile) lookup.tile).getBundledSignal(Rotation.rotateSide(lookup.otherSide, lookup.otherRotation));

} else if (lookup.tile != null) {
return BundledSignalsLib.getBundledSignalViaInteraction(lookup.tile.getLevel(), lookup.tile.getBlockPos(), Direction.values()[lookup.r]);
return BundledSignalsLib.getBundledSignalViaInteraction(lookup.tile.getLevel(), lookup.tile.getBlockPos(), Direction.values()[Rotation.rotateSide(lookup.otherSide, lookup.otherRotation)]);
}
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,39 +32,7 @@ public void registerBundledTileInteraction(IBundledTileInteraction interaction)

@Override
public byte[] getBundledInput(Level world, BlockPos pos, Direction facing) {

int side = facing.ordinal();
BlockEntity tile = world.getBlockEntity(pos);

if (tile instanceof IBundledTile) {
return ((IBundledTile) tile).getBundledSignal(side ^ 1);
}

if (tile instanceof TileMultipart) {
// Try to source bundled signals from ALL parts capable of outputting to the queried side.
// This includes 4 face parts perpendicular to the queried side, and the center part.

TileMultipart tmp = (TileMultipart) tile;
byte[] signal = null;

// Access face parts on all 4 perpendicular sides to given side
for (int r = 0; r < 4; r++) {
int pside = Rotation.rotateSide(side, r);
MultiPart part = tmp.getSlottedPart(pside);

if (part instanceof IBundledEmitter) {
int otherRotation = Rotation.rotationTo(pside, side^1);
signal = raiseSignal(signal, ((IBundledEmitter) part).getBundledSignal(otherRotation));
}
}

// Access center part
MultiPart part = tmp.getSlottedPart(6);
if (part instanceof IBundledEmitter) {
signal = raiseSignal(signal, ((IBundledEmitter) part).getBundledSignal(side ^ 1));
}
}
return null;
return BundledSignalsLib.getBundledInput(world, pos, facing);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ protected void resolveSignal(FaceLookup lookup) {
raiseSignal(tmpSignal, signalIn);

} else if (lookup.tile != null) {
byte[] externalSignal = BundledSignalsLib.getBundledSignalViaInteraction(lookup.tile.getLevel(), lookup.tile.getBlockPos(), Direction.values()[lookup.r]);
byte[] externalSignal = BundledSignalsLib.getBundledSignalViaInteraction(lookup.tile.getLevel(), lookup.tile.getBlockPos(), Direction.values()[Rotation.rotateSide(lookup.otherSide, lookup.otherRotation)]);
raiseSignal(tmpSignal, externalSignal);
}
}
Expand Down

0 comments on commit 41fe682

Please sign in to comment.