Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master-1.20-lts' into master-1.21
Browse files Browse the repository at this point in the history
  • Loading branch information
rubensworks committed Sep 5, 2024
2 parents 9476196 + 2e73e73 commit 56081f0
Show file tree
Hide file tree
Showing 3 changed files with 24 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

6 changes: 6 additions & 0 deletions resources/changelog/1.20.1-1.2.46.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.18.4 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 @@ -33,17 +33,18 @@ protected LootFunctionCopyTankData(List<LootItemCondition> conditionsIn) {

@Override
public ItemStack run(ItemStack itemStack, LootContext lootContext) {
BlockEntityTankInventory tile = (BlockEntityTankInventory) lootContext.getParamOrNull(LootContextParams.BLOCK_ENTITY);
SingleUseTank fluidHandlerTile = tile.getTank();
Optional.ofNullable(itemStack.getCapability(Capabilities.FluidHandler.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();
Optional.ofNullable(itemStack.getCapability(Capabilities.FluidHandler.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 56081f0

Please sign in to comment.