Skip to content

Commit

Permalink
Simplified tank filling code
Browse files Browse the repository at this point in the history
  • Loading branch information
YannickMG authored and Dream-Master committed Jan 13, 2024
1 parent 8e686f3 commit 39d0c4a
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions src/main/java/tconstruct/smeltery/blocks/LavaTankBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer e
if (amount == liquid.amount) {
logic.fill(ForgeDirection.UNKNOWN, liquid, true);
if (!entityplayer.capabilities.isCreativeMode) {
replaceHeldItem(entityplayer, getEmptyContainer(current));
replaceHeldItem(entityplayer, FluidContainerRegistry.drainFluidContainer(current));
}

// update
Expand Down Expand Up @@ -190,14 +190,6 @@ else if (FluidContainerRegistry.isContainer(current)) {
return false;
}

private static ItemStack getEmptyContainer(ItemStack stack) {
Item item = stack.getItem();
if (item != null && item.hasContainerItem(stack)) return item.getContainerItem(stack);
else if (FluidContainerRegistry.isFilledContainer(stack))
return FluidContainerRegistry.drainFluidContainer(stack);
else return null;
}

/**
* Replace one currently held item for a given player.
*
Expand Down

0 comments on commit 39d0c4a

Please sign in to comment.