本文整理汇总了Java中net.minecraftforge.fluids.Fluid.BUCKET_VOLUME属性的典型用法代码示例。如果您正苦于以下问题:Java Fluid.BUCKET_VOLUME属性的具体用法?Java Fluid.BUCKET_VOLUME怎么用?Java Fluid.BUCKET_VOLUME使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类net.minecraftforge.fluids.Fluid
的用法示例。
在下文中一共展示了Fluid.BUCKET_VOLUME属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getFluid
@Nullable
public FluidStack getFluid()
{
Item item = container.getItem();
if (item == Items.WATER_BUCKET)
{
return new FluidStack(FluidRegistry.WATER, Fluid.BUCKET_VOLUME);
}
else if (item == Items.LAVA_BUCKET)
{
return new FluidStack(FluidRegistry.LAVA, Fluid.BUCKET_VOLUME);
}
else if (item == Items.MILK_BUCKET)
{
return FluidRegistry.getFluidStack("milk", Fluid.BUCKET_VOLUME);
}
else if (item == ForgeModContainer.getInstance().universalBucket)
{
return ForgeModContainer.getInstance().universalBucket.getFluid(container);
}
else
{
return null;
}
}
示例2: drain
@Nullable
@Override
public FluidStack drain(FluidStack resource, boolean doDrain)
{
if (container.stackSize != 1 || resource == null || resource.amount < Fluid.BUCKET_VOLUME)
{
return null;
}
FluidStack fluidStack = getFluid();
if (fluidStack != null && fluidStack.isFluidEqual(resource))
{
if (doDrain)
{
setFluid(null);
}
return fluidStack;
}
return null;
}
示例3: drain
@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;
}
示例4: getStack
@Nullable
private FluidStack getStack(IBlockState blockState)
{
Material material = blockState.getMaterial();
if (material == Material.WATER && blockState.getValue(BlockLiquid.LEVEL) == 0)
{
return new FluidStack(FluidRegistry.WATER, Fluid.BUCKET_VOLUME);
}
else if (material == Material.LAVA && blockState.getValue(BlockLiquid.LEVEL) == 0)
{
return new FluidStack(FluidRegistry.LAVA, Fluid.BUCKET_VOLUME);
}
else
{
return null;
}
}
示例5: onBlockActivated
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
if (world.isRemote) return true;
TileEntityBarrel barrel = (TileEntityBarrel) world.getTileEntity(pos);
world.notifyBlockUpdate(pos, state, state, 3);
ItemStack stack = player.getHeldItem(hand);
if (stack.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null)) {
IFluidHandlerItem itemHandler = stack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null);
IFluidHandler barrelHandler = barrel.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, null);
FluidStack fluidInItem = itemHandler.drain(Fluid.BUCKET_VOLUME, false);
FluidStack fluidInBarrel = barrelHandler.drain(Fluid.BUCKET_VOLUME, false);
if ((fluidInBarrel != null && fluidInBarrel.amount > 0) && (fluidInItem == null || fluidInItem.amount == 0 || (fluidInItem.isFluidEqual(fluidInBarrel) && fluidInItem.amount < Fluid.BUCKET_VOLUME))) {
itemHandler.fill(barrelHandler.drain(Fluid.BUCKET_VOLUME, true), true);
player.setHeldItem(hand, itemHandler.getContainer());
} else if (fluidInItem != null && fluidInItem.amount > 0 && fluidInItem.getFluid() != null && (fluidInBarrel == null || fluidInBarrel.amount == 0 || (fluidInBarrel.amount < Fluid.BUCKET_VOLUME && fluidInBarrel.isFluidEqual(fluidInItem)))) {
FluidStack fsin = itemHandler.drain(Fluid.BUCKET_VOLUME, true);
if (fsin != null && fsin.amount > 0 && fsin.getFluid() != null) {
barrelHandler.fill(fsin, true);
player.setHeldItem(hand, itemHandler.getContainer());
player.inventory.markDirty();
}
}
return true;
}
player.openGui(Bewitchment.instance, LibGui.BARREL.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
return true;
}
示例6: fill
@Override
public int fill(FluidStack resource, boolean doFill)
{
if (container.stackSize != 1 || resource == null || resource.amount < Fluid.BUCKET_VOLUME || container.getItem() instanceof ItemBucketMilk || getFluid() != null || !canFillFluidType(resource))
{
return 0;
}
if (doFill)
{
setFluid(resource.getFluid());
}
return Fluid.BUCKET_VOLUME;
}
示例7: getTankProperties
@Override
public IFluidTankProperties[] getTankProperties()
{
float percentFilled = fluidBlock.getFilledPercentage(world, blockPos);
if (percentFilled < 0)
{
percentFilled *= -1;
}
int amountFilled = Math.round(Fluid.BUCKET_VOLUME * percentFilled);
FluidStack fluid = amountFilled > 0 ? new FluidStack(fluidBlock.getFluid(), amountFilled) : null;
return new FluidTankProperties[]{ new FluidTankProperties(fluid, Fluid.BUCKET_VOLUME, false, true)};
}
示例8: getTankProperties
@Override
public IFluidTankProperties[] getTankProperties()
{
FluidStack containedStack = null;
IBlockState blockState = world.getBlockState(blockPos);
if (blockState.getBlock() == blockLiquid)
{
containedStack = getStack(blockState);
}
return new FluidTankProperties[]{new FluidTankProperties(containedStack, Fluid.BUCKET_VOLUME, false, true)};
}
示例9: RecipeInputFluidContainer
public RecipeInputFluidContainer(Fluid fluid) {
this(fluid, Fluid.BUCKET_VOLUME);
}
示例10: render
@SuppressWarnings("ConstantConditions")
@Override
public void render(TileCauldron te, double x, double y, double z, float partialTicks, int destroyStage, float alpha) {
Optional<FluidStack> optional = te.getFluid();
if (optional.isPresent() && optional.get().amount > 0) {
FluidStack fluidStack = optional.get();
Fluid fluid = fluidStack.getFluid();
ResourceLocation location = fluid.getStill();
double level = (double) fluidStack.amount / (Fluid.BUCKET_VOLUME * 2D);
GlStateManager.pushMatrix();
GlStateManager.disableLighting();
GlStateManager.translate(x, y + 0.1 + level, z);
if (fluid == FluidRegistry.WATER || te.hasIngredients()) {
float r = (te.getColorRGB() >>> 16 & 0xFF) / 256.0F;
float g = (te.getColorRGB() >>> 8 & 0xFF) / 256.0F;
float b = (te.getColorRGB() & 0xFF) / 256.0F;
GlStateManager.color(r, g, b);
if (fluid == FluidRegistry.WATER)
location = ResourceLocations.GRAY_WATER;
}
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GlStateManager.disableAlpha();
final float w = 0.125F;
GlStateManager.translate(w, 0, w);
GlStateManager.rotate(90F, 1F, 0F, 0F);
final float s = 0.0460425F;
GlStateManager.scale(s, s, s);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240F, 240F);
renderWater(location);
GlStateManager.enableAlpha();
GlStateManager.disableBlend();
GlStateManager.enableLighting();
GlStateManager.popMatrix();
}
GlStateManager.pushMatrix();
GlStateManager.translate(x + 0.5, y + 0.2D, z + 0.35);
GlStateManager.rotate(90F, 1F, 0, 0);
ItemStack stack = te.getContainer();
if (!stack.isEmpty()) {
Minecraft mc = Minecraft.getMinecraft();
mc.getRenderItem().renderItem(stack, ItemCameraTransforms.TransformType.GROUND);
}
GlStateManager.popMatrix();
}
示例11: createFluidHandler
private CauldronFluid createFluidHandler() {
return new CauldronFluid(this, Fluid.BUCKET_VOLUME);
}
示例12: onContentsChanged
@Override
protected void onContentsChanged() {
if (this.getFluidAmount() == 0 || this.getFluidAmount() == Fluid.BUCKET_VOLUME)
TileEntityBarrel.this.markDirty();
checkRecipe();
}
示例13: getParticleLevel
public float getParticleLevel() {
float level = (float) inv.getFluidAmount() / (Fluid.BUCKET_VOLUME * 2F);
return getPos().getY() + 0.1F + level;
}
示例14: isValidRecipe
@Override
public boolean isValidRecipe(World world, List<ItemStack> stacks, BlockPos pos, FluidStack fluid) {
return fluid != null && fluid.getFluid() != null && fluid.amount == Fluid.BUCKET_VOLUME && fluid.getFluid().equals(FluidRegistry.WATER) && checkEmpty(stacks);// && world.getBiome(pos) instanceof BiomeSwamp;
}
示例15: getTankProperties
@Override
public IFluidTankProperties[] getTankProperties()
{
return new FluidTankProperties[] { new FluidTankProperties(getFluid(), Fluid.BUCKET_VOLUME) };
}