Skip to content

Commit

Permalink
hey puppycrawl, are you a good puppy and pls ignored the checkstyle, …
Browse files Browse the repository at this point in the history
…thanks
  • Loading branch information
justliliandev committed Oct 21, 2023
1 parent e11235b commit 39f8a24
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -500,8 +500,9 @@ public <T> LazyOptional<T> getCapability(Capability<T> cap, @Nullable Direction
for (IConduitType<?> type : bundle.getTypes()) {
NodeIdentifier<?> node = bundle.getNodeFor(type);
Optional<NodeIdentifier.IOState> state = Optional.empty();
if (node != null && side != null)
if (node != null && side != null) {
state = node.getIOState(side);
}
var proxiedCap = type.proxyCapability(cap,
node == null ? type.createExtendedConduitData(level, getBlockPos()).cast() : node.getExtendedConduitData().cast(), level, worldPosition, side, state);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@ public void tickGraph(IConduitType<?> type, List<NodeIdentifier<?>> loadedNodes,
for (Direction dir: Direction.values()) {
if (otherNode.getIOState(dir).map(NodeIdentifier.IOState::isInsert).orElse(false)) {
BlockEntity be = level.getBlockEntity(otherNode.getPos().relative(dir));
if (be == null)
if (be == null) {
continue;
}
Optional<IEnergyStorage> capability = be.getCapability(ForgeCapabilities.ENERGY, dir.getOpposite()).resolve();
if (capability.isPresent()) {
IEnergyStorage insert = capability.get();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,11 @@ public ConduitConnectionData getDefaultConnection(Level level, BlockPos pos, Dir

@Override
public <K> Optional<LazyOptional<K>> proxyCapability(Capability<K> cap, EnergyExtendedData extendedConduitData, Level level, BlockPos pos, @Nullable Direction direction, Optional<NodeIdentifier.IOState> state) {
if (ForgeCapabilities.ENERGY == cap && state.map(NodeIdentifier.IOState::isExtract).orElse(true)) {
if (direction == null || !level.getBlockState(pos.relative(direction)).is(ConduitTags.Blocks.ENERGY_CABLE))
if (ForgeCapabilities.ENERGY == cap
&& state.map(NodeIdentifier.IOState::isExtract).orElse(true)
&& (direction == null || !level.getBlockState(pos.relative(direction)).is(ConduitTags.Blocks.ENERGY_CABLE))) {
return Optional.of(extendedConduitData.selfCap.cast());

}
return Optional.empty();
}
Expand Down

0 comments on commit 39f8a24

Please sign in to comment.