Skip to content

Commit

Permalink
made BlockMachine fill cells using internal fluid handler instead of …
Browse files Browse the repository at this point in the history
…external fluid handler
  • Loading branch information
Trinsdar committed Feb 23, 2025
1 parent 4c4d00c commit 52e52a8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ protected boolean checkValidFluid(FluidStack fluid) {
return true;
}

protected void tryFillCell(int slot, long maxFill) {
protected void tryFillCell(int slot, int maxFill) {
if (tile.itemHandler.map(MachineItemHandler::getCellCount).orElse(0) > 0) {
fillCell(slot, maxFill);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ public InteractionResult use(BlockState state, Level world, BlockPos pos, Player
InteractionResult coverInteract = tile.getCoverHandler().map(h -> h.onInteract(player, hand, Utils.getInteractSide(hit), Utils.getToolType(player))).orElse(InteractionResult.PASS);
if (coverInteract != InteractionResult.PASS) return coverInteract;
//Has gui?
if (FluidHooks.safeGetBlockFluidManager(tile, hit.getDirection()).map(fh -> {
if (tile.fluidHandler.map(fh -> {
Consumer<ItemStack> consumer = s -> {
if (player.isCreative()) return;
boolean single = stack.getCount() == 1;
Expand All @@ -226,9 +226,9 @@ public InteractionResult use(BlockState state, Level world, BlockPos pos, Player
}
};
boolean success = false;
if (FluidPlatformUtils.INSTANCE.fillItemFromContainer(Utils.ca(1, stack), fh, consumer)){
if (FluidPlatformUtils.INSTANCE.fillItemFromContainer(-1, Utils.ca(1, stack), fh, consumer)){
success = true;
} else if (FluidPlatformUtils.INSTANCE.emptyItemIntoContainer(Utils.ca(1, stack), fh, consumer)){
} else if (FluidPlatformUtils.INSTANCE.emptyItemIntoContainer(-1, Utils.ca(1, stack), fh, consumer)){
success = true;
}
return success;
Expand Down

0 comments on commit 52e52a8

Please sign in to comment.