diff --git a/changelog.md b/changelog.md index 13cbf4878..c397f54f8 100644 --- a/changelog.md +++ b/changelog.md @@ -7,4 +7,5 @@ - Fixed The Ti-69s red and green lights being swapped from the item texture (#479). - Added painting translations (#485). - The Nasa workbench now works with recipes with less than 14 ingredients (#483). -- Prevent configured pipes from resetting on neighbor update (#484). \ No newline at end of file +- Prevent configured pipes from resetting on neighbor update (#484). +- Fixed machines and cables input/output energy to the wrong side of blocks adjacent (#467). \ No newline at end of file diff --git a/common/src/main/java/earth/terrarium/adastra/common/blockentities/pipes/CableBlockEntity.java b/common/src/main/java/earth/terrarium/adastra/common/blockentities/pipes/CableBlockEntity.java index fbc54ce92..fd828fdbc 100644 --- a/common/src/main/java/earth/terrarium/adastra/common/blockentities/pipes/CableBlockEntity.java +++ b/common/src/main/java/earth/terrarium/adastra/common/blockentities/pipes/CableBlockEntity.java @@ -32,7 +32,7 @@ public void addNode(@NotNull BlockEntity entity, PipeProperty pipeProperty, Dire public void moveContents(long transferRate, @NotNull BlockEntity source, @NotNull BlockEntity consumer, Direction direction) { var sourceContainer = EnergyContainer.of(source, direction); if (sourceContainer == null) return; - var consumerContainer = EnergyContainer.of(consumer, direction); + var consumerContainer = EnergyContainer.of(consumer, direction.getOpposite()); if (consumerContainer == null) return; EnergyApi.moveEnergy(sourceContainer, consumerContainer, Math.min(transferRate, sourceContainer.getStoredEnergy()), false); } diff --git a/common/src/main/java/earth/terrarium/adastra/common/blockentities/pipes/FluidPipeBlockEntity.java b/common/src/main/java/earth/terrarium/adastra/common/blockentities/pipes/FluidPipeBlockEntity.java index 3237f112e..4e6e0a718 100644 --- a/common/src/main/java/earth/terrarium/adastra/common/blockentities/pipes/FluidPipeBlockEntity.java +++ b/common/src/main/java/earth/terrarium/adastra/common/blockentities/pipes/FluidPipeBlockEntity.java @@ -35,7 +35,7 @@ public void moveContents(long transferRate, @NotNull BlockEntity source, @NotNul var sourceContainer = FluidContainer.of(source, direction); if (sourceContainer == null) return; if (!(FluidContainer.holdsFluid(consumer, direction))) return; - var consumerContainer = FluidContainer.of(consumer, direction); + var consumerContainer = FluidContainer.of(consumer, direction.getOpposite()); if (consumerContainer == null) return; for (var fluid : sourceContainer.getFluids()) { if (fluid.isEmpty()) continue; diff --git a/common/src/main/java/earth/terrarium/adastra/common/utils/TransferUtils.java b/common/src/main/java/earth/terrarium/adastra/common/utils/TransferUtils.java index ed18dde98..5cc91fc74 100644 --- a/common/src/main/java/earth/terrarium/adastra/common/utils/TransferUtils.java +++ b/common/src/main/java/earth/terrarium/adastra/common/utils/TransferUtils.java @@ -31,7 +31,7 @@ public static void pushEnergyNearby(ContainerMachineBlockEntity machine, BlockPo if (!filter.test(direction)) continue; BlockEntity nearbyEntity = machine.level().getBlockEntity(pos.relative(direction)); if (nearbyEntity == null) continue; - EnergyContainer nearbyContainer = EnergyContainer.of(nearbyEntity, direction); + EnergyContainer nearbyContainer = EnergyContainer.of(nearbyEntity, direction.getOpposite()); if (nearbyContainer == null) continue; EnergyApi.moveEnergy(container, nearbyContainer, amount, false); } @@ -48,7 +48,7 @@ public static void pullEnergyNearby(ContainerMachineBlockEntity machine, BlockPo if (!filter.test(direction)) continue; BlockEntity nearbyEntity = machine.level().getBlockEntity(pos.relative(direction)); if (nearbyEntity == null) continue; - EnergyContainer nearbyContainer = EnergyContainer.of(nearbyEntity, direction); + EnergyContainer nearbyContainer = EnergyContainer.of(nearbyEntity, direction.getOpposite()); if (nearbyContainer == null) continue; EnergyApi.moveEnergy(nearbyContainer, container, amount, false); } @@ -65,7 +65,7 @@ public static void pushFluidNearby(ContainerMachineBlockEntity machine, BlockPos BlockEntity nearbyEntity = machine.level().getBlockEntity(pos.relative(direction)); if (nearbyEntity == null) continue; if (!FluidContainer.holdsFluid(nearbyEntity, direction)) continue; - FluidContainer nearbyContainer = FluidContainer.of(nearbyEntity, direction); + FluidContainer nearbyContainer = FluidContainer.of(nearbyEntity, direction.getOpposite()); if (nearbyContainer == null) continue; FluidHolder holder = container.getFluids().get(tank); if (holder.isEmpty()) continue; @@ -84,7 +84,7 @@ public static void pullFluidNearby(ContainerMachineBlockEntity machine, BlockPos BlockEntity nearbyEntity = machine.level().getBlockEntity(pos.relative(direction)); if (nearbyEntity == null) continue; if (!FluidContainer.holdsFluid(nearbyEntity, direction)) continue; - FluidContainer nearbyContainer = FluidContainer.of(nearbyEntity, direction); + FluidContainer nearbyContainer = FluidContainer.of(nearbyEntity, direction.getOpposite()); if (nearbyContainer == null) continue; FluidHolder holder = nearbyContainer.getFluids().get(tank); if (holder.isEmpty()) continue;