當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。