From 39f8a241a26a3debd9f87887a8f85d2855faf641 Mon Sep 17 00:00:00 2001 From: agnor99 <36055315+agnor99@users.noreply.github.com> Date: Sat, 21 Oct 2023 20:34:36 +0200 Subject: [PATCH] hey puppycrawl, are you a good puppy and pls ignored the checkstyle, thanks --- .../conduits/common/blockentity/ConduitBlockEntity.java | 3 ++- .../enderio/conduits/common/types/EnergyConduitTicker.java | 3 ++- .../enderio/conduits/common/types/EnergyConduitType.java | 6 ++++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/conduits/java/com/enderio/conduits/common/blockentity/ConduitBlockEntity.java b/src/conduits/java/com/enderio/conduits/common/blockentity/ConduitBlockEntity.java index 80f58c70c6..4839d47d08 100644 --- a/src/conduits/java/com/enderio/conduits/common/blockentity/ConduitBlockEntity.java +++ b/src/conduits/java/com/enderio/conduits/common/blockentity/ConduitBlockEntity.java @@ -500,8 +500,9 @@ public LazyOptional getCapability(Capability cap, @Nullable Direction for (IConduitType type : bundle.getTypes()) { NodeIdentifier node = bundle.getNodeFor(type); Optional 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); diff --git a/src/conduits/java/com/enderio/conduits/common/types/EnergyConduitTicker.java b/src/conduits/java/com/enderio/conduits/common/types/EnergyConduitTicker.java index ac8a3b80b9..09a8038c69 100644 --- a/src/conduits/java/com/enderio/conduits/common/types/EnergyConduitTicker.java +++ b/src/conduits/java/com/enderio/conduits/common/types/EnergyConduitTicker.java @@ -43,8 +43,9 @@ public void tickGraph(IConduitType type, List> 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 capability = be.getCapability(ForgeCapabilities.ENERGY, dir.getOpposite()).resolve(); if (capability.isPresent()) { IEnergyStorage insert = capability.get(); diff --git a/src/conduits/java/com/enderio/conduits/common/types/EnergyConduitType.java b/src/conduits/java/com/enderio/conduits/common/types/EnergyConduitType.java index 2ab1172afb..4f49f8d293 100644 --- a/src/conduits/java/com/enderio/conduits/common/types/EnergyConduitType.java +++ b/src/conduits/java/com/enderio/conduits/common/types/EnergyConduitType.java @@ -43,9 +43,11 @@ public ConduitConnectionData getDefaultConnection(Level level, BlockPos pos, Dir @Override public Optional> proxyCapability(Capability cap, EnergyExtendedData extendedConduitData, Level level, BlockPos pos, @Nullable Direction direction, Optional 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(); }