本文整理匯總了Java中net.minecraftforge.fluids.FluidStack.containsFluid方法的典型用法代碼示例。如果您正苦於以下問題:Java FluidStack.containsFluid方法的具體用法?Java FluidStack.containsFluid怎麽用?Java FluidStack.containsFluid使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraftforge.fluids.FluidStack
的用法示例。
在下文中一共展示了FluidStack.containsFluid方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: drain
import net.minecraftforge.fluids.FluidStack; //導入方法依賴的package包/類
@Nullable
@Override
public FluidStack drain(FluidStack resource, boolean doDrain)
{
if (resource == null || !fluidBlock.canDrain(world, blockPos))
{
return null;
}
FluidStack simulatedDrain = fluidBlock.drain(world, blockPos, false);
if (resource.containsFluid(simulatedDrain))
{
if (doDrain)
{
return fluidBlock.drain(world, blockPos, true);
}
else
{
return simulatedDrain;
}
}
return null;
}
示例2: drain
import net.minecraftforge.fluids.FluidStack; //導入方法依賴的package包/類
@Nullable
@Override
public FluidStack drain(FluidStack resource, boolean doDrain)
{
if (resource == null || resource.amount < Fluid.BUCKET_VOLUME)
{
return null;
}
IBlockState blockState = world.getBlockState(blockPos);
if (blockState.getBlock() == blockLiquid && blockState.getValue(BlockLiquid.LEVEL) == 0)
{
FluidStack containedStack = getStack(blockState);
if (containedStack != null && resource.containsFluid(containedStack))
{
if (doDrain)
{
world.setBlockState(blockPos, Blocks.AIR.getDefaultState(), 11);
}
return containedStack;
}
}
return null;
}