Skip to content
This repository has been archived by the owner on Nov 18, 2023. It is now read-only.

Commit

Permalink
Fixed Item Pipes using the wrong side of an inventory
Browse files Browse the repository at this point in the history
  • Loading branch information
raoulvdberge committed Mar 26, 2020
1 parent bd8e169 commit 8f4a477
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 5 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Refined Pipes Changelog

## 0.1.3
- Fixed Item Pipes using the wrong side of an inventory (raoulvdberge)

## 0.1.2
- Updated the textures slightly (raoulvdberge)
- Updated the recipes slightly (raoulvdberge)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,8 @@ private static boolean hasConnection(IWorld world, BlockPos pos, Direction direc
private static boolean hasInvConnection(IWorld world, BlockPos pos, Direction direction) {
TileEntity facingTile = world.getTileEntity(pos.offset(direction));

return facingTile != null && facingTile.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY).isPresent();
return facingTile != null
&& facingTile.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, direction.getOpposite()).isPresent();
}

private static BlockState getState(BlockState currentState, IWorld world, BlockPos pos) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ private void singleScanAt(NetworkGraphScannerRequest request) {
TileEntity tile = request.getWorld().getTileEntity(request.getPos());

if (tile != null) {
tile.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, request.getDirection())
tile.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, request.getDirection().getOpposite())
.ifPresent(itemHandler -> destinations.add(new Destination(request.getPos(), request.getDirection(), connectedPipe)));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public void update(World world, Network network, ItemPipe pipe, Attachment attac
return;
}

tile.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, attachment.getDirection())
tile.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, attachment.getDirection().getOpposite())
.ifPresent(itemHandler -> update(network, pipe, attachment, itemHandlerPos, itemHandler));
}

Expand Down Expand Up @@ -123,7 +123,7 @@ private boolean isDestinationApplicable(Attachment attachment, BlockPos sourcePo
return false;
}

IItemHandler handler = tile.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, destination.getIncomingDirection()).orElse(null);
IItemHandler handler = tile.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, destination.getIncomingDirection().getOpposite()).orElse(null);
if (handler == null) {
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public void call(Network network, World world, BlockPos currentPos, TransportCal
return;
}

IItemHandler itemHandler = tile.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, incomingDirection).orElse(null);
IItemHandler itemHandler = tile.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, incomingDirection.getOpposite()).orElse(null);
if (itemHandler == null) {
LOGGER.warn("Destination item handler is no longer exposing a capability at " + itemHandlerPosition);
cancelCallback.call(network, world, currentPos, cancelCallback);
Expand Down

0 comments on commit 8f4a477

Please sign in to comment.