Java Code Examples for net.minecraft.init.Items.saddle()

The following are Jave code examples for showing how to use saddle() of the net.minecraft.init.Items class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: minecraft-quiverbow   File: PackedUpAA.java   View Source Code Vote up 5 votes
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");
}
 
Example 2
Project: DecompiledMinecraft   File: EntityHorse.java   View Source Code Vote up 4 votes
/**
 * (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();
}
 
Example 3
Project: DecompiledMinecraft   File: EntityHorse.java   View Source Code Vote up 4 votes
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;
        }
    }
}
 
Example 4
Project: DecompiledMinecraft   File: EntityHorse.java   View Source Code Vote up 4 votes
/**
 * (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();
}
 
Example 5
Project: DecompiledMinecraft   File: EntityHorse.java   View Source Code Vote up 4 votes
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;
        }
    }
}
 
Example 6
Project: BaseClient   File: EntityHorse.java   View Source Code Vote up 4 votes
/**
 * (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();
}
 
Example 7
Project: BaseClient   File: EntityHorse.java   View Source Code Vote up 4 votes
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;
        }
    }
}
 
Example 8
Project: BaseClient   File: EntityHorse.java   View Source Code Vote up 4 votes
/**
 * (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();
}
 
Example 9
Project: BaseClient   File: EntityHorse.java   View Source Code Vote up 4 votes
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;
        }
    }
}