当前位置: 首页>>代码示例>>Java>>正文


Java Items.water_bucket方法代码示例

本文整理汇总了Java中net.minecraft.init.Items.water_bucket方法的典型用法代码示例。如果您正苦于以下问题:Java Items.water_bucket方法的具体用法?Java Items.water_bucket怎么用?Java Items.water_bucket使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.init.Items的用法示例。


在下文中一共展示了Items.water_bucket方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: smeltItem

import net.minecraft.init.Items; //导入方法依赖的package包/类
/**
 * Turn one item from the furnace source stack into the appropriate smelted item in the furnace result stack
 */
public void smeltItem()
{
    if (this.canSmelt())
    {
        ItemStack itemstack = FurnaceRecipes.instance().getSmeltingResult(this.furnaceItemStacks[0]);

        if (this.furnaceItemStacks[2] == null)
        {
            this.furnaceItemStacks[2] = itemstack.copy();
        }
        else if (this.furnaceItemStacks[2].getItem() == itemstack.getItem())
        {
            ++this.furnaceItemStacks[2].stackSize;
        }

        if (this.furnaceItemStacks[0].getItem() == Item.getItemFromBlock(Blocks.sponge) && this.furnaceItemStacks[0].getMetadata() == 1 && this.furnaceItemStacks[1] != null && this.furnaceItemStacks[1].getItem() == Items.bucket)
        {
            this.furnaceItemStacks[1] = new ItemStack(Items.water_bucket);
        }

        --this.furnaceItemStacks[0].stackSize;

        if (this.furnaceItemStacks[0].stackSize <= 0)
        {
            this.furnaceItemStacks[0] = null;
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:32,代码来源:TileEntityFurnace.java

示例2: canExtractItem

import net.minecraft.init.Items; //导入方法依赖的package包/类
/**
 * Returns true if automation can extract the given item in the given slot from the given side. Args: slot, item,
 * side
 */
public boolean canExtractItem(int index, ItemStack stack, EnumFacing direction)
{
    if (direction == EnumFacing.DOWN && index == 1)
    {
        Item item = stack.getItem();

        if (item != Items.water_bucket && item != Items.bucket)
        {
            return false;
        }
    }

    return true;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:19,代码来源:TileEntityFurnace.java

示例3: isItemUsedInRecipe

import net.minecraft.init.Items; //导入方法依赖的package包/类
public static boolean isItemUsedInRecipe(ItemStack itemStack) {
	Item[] itemsUsed = new Item[] { Items.water_bucket, TechnicalItem.PyrolusiteDust, TechnicalItem.MagnesiumChlorideDust, TechnicalItem.BerylliumChlorideDust };
	for(Item item : itemsUsed)
		if(item == itemStack.getItem())
			return true;
	return false;
}
 
开发者ID:viddeno,项目名称:Technical,代码行数:8,代码来源:ElectrolyserRecipes.java

示例4: burnInventory

import net.minecraft.init.Items; //导入方法依赖的package包/类
/** Consume fuel from the player's inventory.<br>
 * Take it first from their cache, if present, and then from their inventory, starting
 * at the first slot and working upwards.
 * @param player
 * @param burnAmount amount of fuel to burn, in ticks.
 */
public static void burnInventory(EntityPlayerMP player, int burnAmount, ItemStack input)
{
    if (!fuelCaches.containsKey(player))
        fuelCaches.put(player, -burnAmount);
    else
        fuelCaches.put(player, fuelCaches.get(player) - burnAmount);
    int index = 0;
    while (fuelCaches.get(player) < 0 && index < player.inventory.mainInventory.length)
    {
        ItemStack is = player.inventory.mainInventory[index];
        if (is != null)
        {
            int burnTime = TileEntityFurnace.getItemBurnTime(is);
            if (burnTime != 0)
            {
                // Consume item:
                if (is.stackSize > 1)
                    is.stackSize--;
                else
                {
                    // If this is a bucket of lava, we need to consume the lava but leave the bucket.
                    if (is.getItem() == Items.lava_bucket)
                    {
                        // And if we're cooking wet sponge, we need to leave the bucket filled with water.
                        if (input.getItem() == Item.getItemFromBlock(Blocks.sponge) && input.getMetadata() == 1)
                            player.inventory.mainInventory[index] = new ItemStack(Items.water_bucket);
                        else
                            player.inventory.mainInventory[index] = new ItemStack(Items.bucket);
                    }
                    else
                        player.inventory.mainInventory[index] = null;
                    index++;
                }
                fuelCaches.put(player, fuelCaches.get(player) + burnTime);
            }
            else
                index++;
        }
        else
            index++;
    }
}
 
开发者ID:Yarichi,项目名称:Proyecto-DASI,代码行数:49,代码来源:CraftingHelper.java


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