We have SPONGE!

(and not only for mixins...)
This commit is contained in:
grimmauld 2021-03-20 22:49:42 +01:00
parent 3d0898c59b
commit 9df9a99185

View file

@ -22,6 +22,7 @@ import net.minecraft.entity.item.ItemEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUseContext;
import net.minecraft.item.Items;
import net.minecraft.state.DirectionProperty;
import net.minecraft.state.StateContainer.Builder;
import net.minecraft.state.properties.BlockStateProperties;
@ -36,6 +37,10 @@ import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorldReader;
import net.minecraft.world.World;
import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
import net.minecraftforge.fluids.capability.IFluidHandler;
import net.minecraftforge.items.IItemHandlerModifiable;
import net.minecraftforge.items.ItemHandlerHelper;
import net.minecraftforge.items.ItemStackHandler;
@ -95,6 +100,11 @@ public class BasinBlock extends Block implements ITE<BasinTileEntity>, IWrenchab
if (EmptyingByBasin.canItemBeEmptied(worldIn, heldItem)
|| GenericItemFilling.canItemBeFilled(worldIn, heldItem))
return ActionResultType.SUCCESS;
if (heldItem.getItem().equals(Items.SPONGE) &&
!te.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY).map(iFluidHandler ->
iFluidHandler.drain(Integer.MAX_VALUE, IFluidHandler.FluidAction.EXECUTE)).orElse(FluidStack.EMPTY).isEmpty()) {
return ActionResultType.SUCCESS;
}
return ActionResultType.PASS;
}