• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java FluidHandlerItemStack类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中net.minecraftforge.fluids.capability.templates.FluidHandlerItemStack的典型用法代码示例。如果您正苦于以下问题:Java FluidHandlerItemStack类的具体用法?Java FluidHandlerItemStack怎么用?Java FluidHandlerItemStack使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



FluidHandlerItemStack类属于net.minecraftforge.fluids.capability.templates包,在下文中一共展示了FluidHandlerItemStack类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getSubItems

import net.minecraftforge.fluids.capability.templates.FluidHandlerItemStack; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
@Override
public void getSubItems(@Nullable CreativeTabs tab, @Nonnull NonNullList<ItemStack> subItems)
{
    if (isInCreativeTab(tab))
    {
        subItems.add(new ItemStack(this));

        for (Fluid fluid : FluidRegistry.getRegisteredFluids().values())
        {
            if (!fluid.getName().equals("milk"))
            {
                // add all fluids that the bucket can be filled  with
                FluidStack fs = new FluidStack(fluid, content.capacity);
                ItemStack stack = new ItemStack(this);
                IFluidHandlerItem fluidHandler = new FluidHandlerItemStack(stack, content.capacity);
                if (fluidHandler.fill(fs, true) == fs.amount)
                {
                    ItemStack filled = fluidHandler.getContainer();
                    subItems.add(filled);
                }
            }
        }
    }
}
 
开发者ID:cubex2,项目名称:customstuff4,代码行数:26,代码来源:ItemFluidContainer.java


示例2: initCapabilities

import net.minecraftforge.fluids.capability.templates.FluidHandlerItemStack; //导入依赖的package包/类
@Override
public ICapabilityProvider initCapabilities(@Nonnull ItemStack stack, @Nullable NBTTagCompound nbt) {
    return new FluidHandlerItemStack(stack,capacity)
    {
        @Override
        public int fill(FluidStack resource, boolean doFill) {
            if(resource == null || resource.amount < capacity)
                return 0;

            return super.fill(resource, doFill);
        }
    };
}
 
开发者ID:DaedalusGame,项目名称:Soot,代码行数:14,代码来源:ItemMug.java


示例3: initCapabilities

import net.minecraftforge.fluids.capability.templates.FluidHandlerItemStack; //导入依赖的package包/类
@Nullable
@Override
public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable NBTTagCompound nbt) {
    FluidHandlerItemStack handlerItemStack = new FluidHandlerItemStack(stack, 128000) {
        @Override
        public boolean canFillFluidType(FluidStack fluid) {
            return fluid.getFluid().equals(FluidsRegistry.MEAT);
        }

    };
    handlerItemStack.fill(new FluidStack(FluidsRegistry.MEAT, 0), true);
    return handlerItemStack;
}
 
开发者ID:Buuz135,项目名称:Industrial-Foregoing,代码行数:14,代码来源:MeatFeederItem.java


示例4: loadTank

import net.minecraftforge.fluids.capability.templates.FluidHandlerItemStack; //导入依赖的package包/类
public static FluidTank loadTank(NBTTagCompound nbtRoot) {
	int tankType = nbtRoot.hasKey("tankType") ? nbtRoot.getInteger("tankType") : 0;
	tankType = MathHelper.clamp(tankType, 0, BlockTank.tankCaps.length);
	int cap = BlockTank.tankCaps[tankType]*Fluid.BUCKET_VOLUME;
    FluidTank ret = new FluidTank(cap);
    
    if(nbtRoot.hasKey(FluidHandlerItemStack.FLUID_NBT_KEY)) {
      FluidStack fl = FluidStack.loadFluidStackFromNBT((NBTTagCompound) nbtRoot.getTag(FluidHandlerItemStack.FLUID_NBT_KEY));
      ret.setFluid(fl);
    } else {
      ret.setFluid(null);
    }
    return ret;
}
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:15,代码来源:ItemBlockTank.java


示例5: saveTank

import net.minecraftforge.fluids.capability.templates.FluidHandlerItemStack; //导入依赖的package包/类
public static void saveTank(NBTTagCompound nbtRoot, FluidTank tank) {
	if(tank.getFluidAmount() > 0) {
		NBTTagCompound fluidRoot = new NBTTagCompound();
		tank.getFluid().writeToNBT(fluidRoot);
		nbtRoot.setTag(FluidHandlerItemStack.FLUID_NBT_KEY, fluidRoot);
	} else {
		nbtRoot.removeTag(FluidHandlerItemStack.FLUID_NBT_KEY);
	}
}
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:10,代码来源:ItemBlockTank.java


示例6: fillContainer

import net.minecraftforge.fluids.capability.templates.FluidHandlerItemStack; //导入依赖的package包/类
public static void fillContainer(ItemStack container, FluidStack fluidStack, ItemStack heldStack, EntityPlayer player, EnumHand hand) {
    if (!player.isCreative()) {
        NBTTagCompound fluidTag = new NBTTagCompound();

        fluidStack.writeToNBT(fluidTag);
        NBTHelper.getTag(container).setTag(FluidHandlerItemStack.FLUID_NBT_KEY, fluidTag);

        InventoryHandlerHelper.giveItem(player, hand, container);
        heldStack.shrink(1);
    }
}
 
开发者ID:GirafiStudios,项目名称:Culinary-Cultivation,代码行数:12,代码来源:InventoryHandlerHelper.java


示例7: addInformation

import net.minecraftforge.fluids.capability.templates.FluidHandlerItemStack; //导入依赖的package包/类
@Override
public void addInformation(ItemStack stack, @Nullable World worldIn, List<String> tooltip, ITooltipFlag flagIn) {
    super.addInformation(stack, worldIn, tooltip, flagIn);
    FluidHandlerItemStack handlerItemStack = (FluidHandlerItemStack) stack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, EnumFacing.DOWN);
    tooltip.add(getFilledAmount(stack) + "/" + handlerItemStack.getTankProperties()[0].getCapacity() + "mb of Meat");
}
 
开发者ID:Buuz135,项目名称:Industrial-Foregoing,代码行数:7,代码来源:MeatFeederItem.java


示例8: getFilledAmount

import net.minecraftforge.fluids.capability.templates.FluidHandlerItemStack; //导入依赖的package包/类
public int getFilledAmount(ItemStack stack) {
    FluidHandlerItemStack handlerItemStack = (FluidHandlerItemStack) stack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, EnumFacing.DOWN);
    return (handlerItemStack.getFluid() == null ? 0 : handlerItemStack.getFluid().amount);
}
 
开发者ID:Buuz135,项目名称:Industrial-Foregoing,代码行数:5,代码来源:MeatFeederItem.java


示例9: drain

import net.minecraftforge.fluids.capability.templates.FluidHandlerItemStack; //导入依赖的package包/类
public void drain(ItemStack stack, int amount) {
    FluidHandlerItemStack handlerItemStack = (FluidHandlerItemStack) stack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, EnumFacing.DOWN);
    handlerItemStack.drain(new FluidStack(FluidsRegistry.MEAT, amount), true);
}
 
开发者ID:Buuz135,项目名称:Industrial-Foregoing,代码行数:5,代码来源:MeatFeederItem.java


示例10: initCapabilities

import net.minecraftforge.fluids.capability.templates.FluidHandlerItemStack; //导入依赖的package包/类
@Override
public ICapabilityProvider initCapabilities(ItemStack stack, NBTTagCompound nbt)
{
    return new FluidHandlerItemStack(stack, capacity);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:6,代码来源:ItemFluidContainer.java



注:本文中的net.minecraftforge.fluids.capability.templates.FluidHandlerItemStack类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ManagedObjectManagerFactory类代码示例发布时间:2022-05-23
下一篇:
Java XSDeclaration类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap