return itemstack;
}
else {
if(pos.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
{
Coord4D coord = new Coord4D(pos.blockX, pos.blockY, pos.blockZ, world.provider.dimensionId);
if(!world.canMineBlock(entityplayer, coord.xCoord, coord.yCoord, coord.zCoord))
{
return itemstack;
}
if(!entityplayer.isSneaking())
{
if(!entityplayer.canPlayerEdit(coord.xCoord, coord.yCoord, coord.zCoord, pos.sideHit, itemstack))
{
return itemstack;
}
FluidStack fluid = MekanismUtils.getFluid(world, coord.xCoord, coord.yCoord, coord.zCoord);
if(fluid != null && (getFluidStack(itemstack) == null || getFluidStack(itemstack).isFluidEqual(fluid)))
{
int needed = TileEntityPortableTank.MAX_FLUID-(getFluidStack(itemstack) != null ? getFluidStack(itemstack).amount : 0);
if(fluid.amount > needed)
{
return itemstack;
}
if(getFluidStack(itemstack) == null)
{
setFluidStack(fluid, itemstack);
}
else {
FluidStack newStack = getFluidStack(itemstack);
newStack.amount += fluid.amount;
setFluidStack(newStack, itemstack);
}
world.setBlockToAir(coord.xCoord, coord.yCoord, coord.zCoord);
}
}
else {
FluidStack stored = getFluidStack(itemstack);
if(stored == null || stored.amount < FluidContainerRegistry.BUCKET_VOLUME)
{
return itemstack;
}
Coord4D trans = coord.getFromSide(ForgeDirection.getOrientation(pos.sideHit));
if(!entityplayer.canPlayerEdit(trans.xCoord, trans.yCoord, trans.zCoord, pos.sideHit, itemstack))
{
return itemstack;
}