Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master-1.19-lts' into master-1.2…
Browse files Browse the repository at this point in the history
…0-lts
  • Loading branch information
rubensworks committed Sep 5, 2024
2 parents a98ddb3 + d902f16 commit c7bd1b6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
6 changes: 6 additions & 0 deletions resources/changelog/1.19.2-1.2.39.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
As always, don't forget to backup your world before updating!
Requires CyclopsCore version 1.17.0 or higher.

Fixes:
* Fix crash when copy_tank_data loot function is applied to wrong block, Closes #1056

Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,18 @@ protected LootFunctionCopyTankData(LootItemCondition[] conditionsIn) {

@Override
public ItemStack run(ItemStack itemStack, LootContext lootContext) {
BlockEntityTankInventory tile = (BlockEntityTankInventory) lootContext.getParamOrNull(LootContextParams.BLOCK_ENTITY);
SingleUseTank fluidHandlerTile = tile.getTank();
itemStack.getCapability(ForgeCapabilities.FLUID_HANDLER_ITEM)
.ifPresent(fluidHandlerItem -> {
if (fluidHandlerItem instanceof IFluidHandlerMutable) {
((IFluidHandlerMutable) fluidHandlerItem).setFluidInTank(0, fluidHandlerTile.getFluidInTank(0));
}
if (fluidHandlerItem instanceof IFluidHandlerItemCapacity) {
((IFluidHandlerItemCapacity) fluidHandlerItem).setCapacity(fluidHandlerTile.getTankCapacity(0));
}
});
if (lootContext.getParamOrNull(LootContextParams.BLOCK_ENTITY) instanceof BlockEntityTankInventory tile) {
SingleUseTank fluidHandlerTile = tile.getTank();
itemStack.getCapability(ForgeCapabilities.FLUID_HANDLER_ITEM)
.ifPresent(fluidHandlerItem -> {
if (fluidHandlerItem instanceof IFluidHandlerMutable) {
((IFluidHandlerMutable) fluidHandlerItem).setFluidInTank(0, fluidHandlerTile.getFluidInTank(0));
}
if (fluidHandlerItem instanceof IFluidHandlerItemCapacity) {
((IFluidHandlerItemCapacity) fluidHandlerItem).setCapacity(fluidHandlerTile.getTankCapacity(0));
}
});
}
return itemStack;
}

Expand Down

0 comments on commit c7bd1b6

Please sign in to comment.