当前位置: 首页>>代码示例>>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;未经允许,请勿转载。