當前位置: 首頁>>代碼示例>>Java>>正文


Java Items.saddle方法代碼示例

本文整理匯總了Java中net.minecraft.init.Items.saddle方法的典型用法代碼示例。如果您正苦於以下問題:Java Items.saddle方法的具體用法?Java Items.saddle怎麽用?Java Items.saddle使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraft.init.Items的用法示例。


在下文中一共展示了Items.saddle方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: registerRidingRecipe

import net.minecraft.init.Items; //導入方法依賴的package包/類
private void registerRidingRecipe()
{
	ItemStack[] input = new ItemStack[3];
	
	input[0] = new ItemStack(this);
	input[1] = new ItemStack(Items.saddle);
	input[2] = new ItemStack(Items.iron_ingot);
	        
       Helper.registerAAUpgradeRecipe(new ItemStack(this), input, "hasRidingUpgrade");
}
 
開發者ID:Domochevsky,項目名稱:minecraft-quiverbow,代碼行數:11,代碼來源:PackedUpAA.java

示例2: readEntityFromNBT

import net.minecraft.init.Items; //導入方法依賴的package包/類
/**
 * (abstract) Protected helper method to read subclass entity data from NBT.
 */
public void readEntityFromNBT(NBTTagCompound tagCompund)
{
    super.readEntityFromNBT(tagCompund);
    this.setEatingHaystack(tagCompund.getBoolean("EatingHaystack"));
    this.setBreeding(tagCompund.getBoolean("Bred"));
    this.setChested(tagCompund.getBoolean("ChestedHorse"));
    this.setHasReproduced(tagCompund.getBoolean("HasReproduced"));
    this.setHorseType(tagCompund.getInteger("Type"));
    this.setHorseVariant(tagCompund.getInteger("Variant"));
    this.setTemper(tagCompund.getInteger("Temper"));
    this.setHorseTamed(tagCompund.getBoolean("Tame"));
    String s = "";

    if (tagCompund.hasKey("OwnerUUID", 8))
    {
        s = tagCompund.getString("OwnerUUID");
    }
    else
    {
        String s1 = tagCompund.getString("Owner");
        s = PreYggdrasilConverter.getStringUUIDFromName(s1);
    }

    if (s.length() > 0)
    {
        this.setOwnerId(s);
    }

    IAttributeInstance iattributeinstance = this.getAttributeMap().getAttributeInstanceByName("Speed");

    if (iattributeinstance != null)
    {
        this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(iattributeinstance.getBaseValue() * 0.25D);
    }

    if (this.isChested())
    {
        NBTTagList nbttaglist = tagCompund.getTagList("Items", 10);
        this.initHorseChest();

        for (int i = 0; i < nbttaglist.tagCount(); ++i)
        {
            NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(i);
            int j = nbttagcompound.getByte("Slot") & 255;

            if (j >= 2 && j < this.horseChest.getSizeInventory())
            {
                this.horseChest.setInventorySlotContents(j, ItemStack.loadItemStackFromNBT(nbttagcompound));
            }
        }
    }

    if (tagCompund.hasKey("ArmorItem", 10))
    {
        ItemStack itemstack = ItemStack.loadItemStackFromNBT(tagCompund.getCompoundTag("ArmorItem"));

        if (itemstack != null && isArmorItem(itemstack.getItem()))
        {
            this.horseChest.setInventorySlotContents(1, itemstack);
        }
    }

    if (tagCompund.hasKey("SaddleItem", 10))
    {
        ItemStack itemstack1 = ItemStack.loadItemStackFromNBT(tagCompund.getCompoundTag("SaddleItem"));

        if (itemstack1 != null && itemstack1.getItem() == Items.saddle)
        {
            this.horseChest.setInventorySlotContents(0, itemstack1);
        }
    }
    else if (tagCompund.getBoolean("Saddle"))
    {
        this.horseChest.setInventorySlotContents(0, new ItemStack(Items.saddle));
    }

    this.updateHorseSlots();
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:82,代碼來源:EntityHorse.java

示例3: replaceItemInInventory

import net.minecraft.init.Items; //導入方法依賴的package包/類
public boolean replaceItemInInventory(int inventorySlot, ItemStack itemStackIn)
{
    if (inventorySlot == 499 && this.canCarryChest())
    {
        if (itemStackIn == null && this.isChested())
        {
            this.setChested(false);
            this.initHorseChest();
            return true;
        }

        if (itemStackIn != null && itemStackIn.getItem() == Item.getItemFromBlock(Blocks.chest) && !this.isChested())
        {
            this.setChested(true);
            this.initHorseChest();
            return true;
        }
    }

    int i = inventorySlot - 400;

    if (i >= 0 && i < 2 && i < this.horseChest.getSizeInventory())
    {
        if (i == 0 && itemStackIn != null && itemStackIn.getItem() != Items.saddle)
        {
            return false;
        }
        else if (i != 1 || (itemStackIn == null || isArmorItem(itemStackIn.getItem())) && this.canWearArmor())
        {
            this.horseChest.setInventorySlotContents(i, itemStackIn);
            this.updateHorseSlots();
            return true;
        }
        else
        {
            return false;
        }
    }
    else
    {
        int j = inventorySlot - 500 + 2;

        if (j >= 2 && j < this.horseChest.getSizeInventory())
        {
            this.horseChest.setInventorySlotContents(j, itemStackIn);
            return true;
        }
        else
        {
            return false;
        }
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:54,代碼來源:EntityHorse.java


注:本文中的net.minecraft.init.Items.saddle方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。