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

The following are Jave code examples for showing how to use dye() 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: DecompiledMinecraft   File: EntitySheep.java   View Source Code Vote up 6 votes
/**
 * Attempts to mix both parent sheep to come up with a mixed dye color.
 */
private EnumDyeColor getDyeColorMixFromParents(EntityAnimal father, EntityAnimal mother)
{
    int i = ((EntitySheep)father).getFleeceColor().getDyeDamage();
    int j = ((EntitySheep)mother).getFleeceColor().getDyeDamage();
    this.inventoryCrafting.getStackInSlot(0).setItemDamage(i);
    this.inventoryCrafting.getStackInSlot(1).setItemDamage(j);
    ItemStack itemstack = CraftingManager.getInstance().findMatchingRecipe(this.inventoryCrafting, ((EntitySheep)father).worldObj);
    int k;

    if (itemstack != null && itemstack.getItem() == Items.dye)
    {
        k = itemstack.getMetadata();
    }
    else
    {
        k = this.worldObj.rand.nextBoolean() ? i : j;
    }

    return EnumDyeColor.byDyeDamage(k);
}
 
Example 2
Project: DecompiledMinecraft   File: EntitySheep.java   View Source Code Vote up 6 votes
/**
 * Attempts to mix both parent sheep to come up with a mixed dye color.
 */
private EnumDyeColor getDyeColorMixFromParents(EntityAnimal father, EntityAnimal mother)
{
    int i = ((EntitySheep)father).getFleeceColor().getDyeDamage();
    int j = ((EntitySheep)mother).getFleeceColor().getDyeDamage();
    this.inventoryCrafting.getStackInSlot(0).setItemDamage(i);
    this.inventoryCrafting.getStackInSlot(1).setItemDamage(j);
    ItemStack itemstack = CraftingManager.getInstance().findMatchingRecipe(this.inventoryCrafting, ((EntitySheep)father).worldObj);
    int k;

    if (itemstack != null && itemstack.getItem() == Items.dye)
    {
        k = itemstack.getMetadata();
    }
    else
    {
        k = this.worldObj.rand.nextBoolean() ? i : j;
    }

    return EnumDyeColor.byDyeDamage(k);
}
 
Example 3
Project: BaseClient   File: EntitySheep.java   View Source Code Vote up 6 votes
/**
 * Attempts to mix both parent sheep to come up with a mixed dye color.
 */
private EnumDyeColor getDyeColorMixFromParents(EntityAnimal father, EntityAnimal mother)
{
    int i = ((EntitySheep)father).getFleeceColor().getDyeDamage();
    int j = ((EntitySheep)mother).getFleeceColor().getDyeDamage();
    this.inventoryCrafting.getStackInSlot(0).setItemDamage(i);
    this.inventoryCrafting.getStackInSlot(1).setItemDamage(j);
    ItemStack itemstack = CraftingManager.getInstance().findMatchingRecipe(this.inventoryCrafting, ((EntitySheep)father).worldObj);
    int k;

    if (itemstack != null && itemstack.getItem() == Items.dye)
    {
        k = itemstack.getMetadata();
    }
    else
    {
        k = this.worldObj.rand.nextBoolean() ? i : j;
    }

    return EnumDyeColor.byDyeDamage(k);
}
 
Example 4
Project: BaseClient   File: EntitySheep.java   View Source Code Vote up 6 votes
/**
 * Attempts to mix both parent sheep to come up with a mixed dye color.
 */
private EnumDyeColor getDyeColorMixFromParents(EntityAnimal father, EntityAnimal mother)
{
    int i = ((EntitySheep)father).getFleeceColor().getDyeDamage();
    int j = ((EntitySheep)mother).getFleeceColor().getDyeDamage();
    this.inventoryCrafting.getStackInSlot(0).setItemDamage(i);
    this.inventoryCrafting.getStackInSlot(1).setItemDamage(j);
    ItemStack itemstack = CraftingManager.getInstance().findMatchingRecipe(this.inventoryCrafting, ((EntitySheep)father).worldObj);
    int k;

    if (itemstack != null && itemstack.getItem() == Items.dye)
    {
        k = itemstack.getMetadata();
    }
    else
    {
        k = this.worldObj.rand.nextBoolean() ? i : j;
    }

    return EnumDyeColor.byDyeDamage(k);
}
 
Example 5
Project: DecompiledMinecraft   File: RecipesArmorDyes.java   View Source Code Vote up 5 votes
/**
 * Used to check if a recipe matches current crafting inventory
 */
public boolean matches(InventoryCrafting inv, World worldIn)
{
    ItemStack itemstack = null;
    List<ItemStack> list = Lists.<ItemStack>newArrayList();

    for (int i = 0; i < inv.getSizeInventory(); ++i)
    {
        ItemStack itemstack1 = inv.getStackInSlot(i);

        if (itemstack1 != null)
        {
            if (itemstack1.getItem() instanceof ItemArmor)
            {
                ItemArmor itemarmor = (ItemArmor)itemstack1.getItem();

                if (itemarmor.getArmorMaterial() != ItemArmor.ArmorMaterial.LEATHER || itemstack != null)
                {
                    return false;
                }

                itemstack = itemstack1;
            }
            else
            {
                if (itemstack1.getItem() != Items.dye)
                {
                    return false;
                }

                list.add(itemstack1);
            }
        }
    }

    return itemstack != null && !list.isEmpty();
}
 
Example 6
Project: DecompiledMinecraft   File: RecipesArmorDyes.java   View Source Code Vote up 5 votes
/**
 * Used to check if a recipe matches current crafting inventory
 */
public boolean matches(InventoryCrafting inv, World worldIn)
{
    ItemStack itemstack = null;
    List<ItemStack> list = Lists.<ItemStack>newArrayList();

    for (int i = 0; i < inv.getSizeInventory(); ++i)
    {
        ItemStack itemstack1 = inv.getStackInSlot(i);

        if (itemstack1 != null)
        {
            if (itemstack1.getItem() instanceof ItemArmor)
            {
                ItemArmor itemarmor = (ItemArmor)itemstack1.getItem();

                if (itemarmor.getArmorMaterial() != ItemArmor.ArmorMaterial.LEATHER || itemstack != null)
                {
                    return false;
                }

                itemstack = itemstack1;
            }
            else
            {
                if (itemstack1.getItem() != Items.dye)
                {
                    return false;
                }

                list.add(itemstack1);
            }
        }
    }

    return itemstack != null && !list.isEmpty();
}
 
Example 7
Project: BaseClient   File: RecipesArmorDyes.java   View Source Code Vote up 5 votes
/**
 * Used to check if a recipe matches current crafting inventory
 */
public boolean matches(InventoryCrafting inv, World worldIn)
{
    ItemStack itemstack = null;
    List<ItemStack> list = Lists.<ItemStack>newArrayList();

    for (int i = 0; i < inv.getSizeInventory(); ++i)
    {
        ItemStack itemstack1 = inv.getStackInSlot(i);

        if (itemstack1 != null)
        {
            if (itemstack1.getItem() instanceof ItemArmor)
            {
                ItemArmor itemarmor = (ItemArmor)itemstack1.getItem();

                if (itemarmor.getArmorMaterial() != ItemArmor.ArmorMaterial.LEATHER || itemstack != null)
                {
                    return false;
                }

                itemstack = itemstack1;
            }
            else
            {
                if (itemstack1.getItem() != Items.dye)
                {
                    return false;
                }

                list.add(itemstack1);
            }
        }
    }

    return itemstack != null && !list.isEmpty();
}
 
Example 8
Project: BaseClient   File: RecipesArmorDyes.java   View Source Code Vote up 5 votes
/**
 * Used to check if a recipe matches current crafting inventory
 */
public boolean matches(InventoryCrafting inv, World worldIn)
{
    ItemStack itemstack = null;
    List<ItemStack> list = Lists.<ItemStack>newArrayList();

    for (int i = 0; i < inv.getSizeInventory(); ++i)
    {
        ItemStack itemstack1 = inv.getStackInSlot(i);

        if (itemstack1 != null)
        {
            if (itemstack1.getItem() instanceof ItemArmor)
            {
                ItemArmor itemarmor = (ItemArmor)itemstack1.getItem();

                if (itemarmor.getArmorMaterial() != ItemArmor.ArmorMaterial.LEATHER || itemstack != null)
                {
                    return false;
                }

                itemstack = itemstack1;
            }
            else
            {
                if (itemstack1.getItem() != Items.dye)
                {
                    return false;
                }

                list.add(itemstack1);
            }
        }
    }

    return itemstack != null && !list.isEmpty();
}
 
Example 9
Project: DecompiledMinecraft   File: BlockOre.java   View Source Code Vote up 4 votes
/**
 * Get the Item that this Block should drop when harvested.
 */
public Item getItemDropped(IBlockState state, Random rand, int fortune)
{
    return this == Blocks.coal_ore ? Items.coal : (this == Blocks.diamond_ore ? Items.diamond : (this == Blocks.lapis_ore ? Items.dye : (this == Blocks.emerald_ore ? Items.emerald : (this == Blocks.quartz_ore ? Items.quartz : Item.getItemFromBlock(this)))));
}
 
Example 10
Project: DecompiledMinecraft   File: ContainerEnchantment.java   View Source Code Vote up 4 votes
/**
 * Take a stack from the specified inventory slot.
 */
public ItemStack transferStackInSlot(EntityPlayer playerIn, int index)
{
    ItemStack itemstack = null;
    Slot slot = (Slot)this.inventorySlots.get(index);

    if (slot != null && slot.getHasStack())
    {
        ItemStack itemstack1 = slot.getStack();
        itemstack = itemstack1.copy();

        if (index == 0)
        {
            if (!this.mergeItemStack(itemstack1, 2, 38, true))
            {
                return null;
            }
        }
        else if (index == 1)
        {
            if (!this.mergeItemStack(itemstack1, 2, 38, true))
            {
                return null;
            }
        }
        else if (itemstack1.getItem() == Items.dye && EnumDyeColor.byDyeDamage(itemstack1.getMetadata()) == EnumDyeColor.BLUE)
        {
            if (!this.mergeItemStack(itemstack1, 1, 2, true))
            {
                return null;
            }
        }
        else
        {
            if (((Slot)this.inventorySlots.get(0)).getHasStack() || !((Slot)this.inventorySlots.get(0)).isItemValid(itemstack1))
            {
                return null;
            }

            if (itemstack1.hasTagCompound() && itemstack1.stackSize == 1)
            {
                ((Slot)this.inventorySlots.get(0)).putStack(itemstack1.copy());
                itemstack1.stackSize = 0;
            }
            else if (itemstack1.stackSize >= 1)
            {
                ((Slot)this.inventorySlots.get(0)).putStack(new ItemStack(itemstack1.getItem(), 1, itemstack1.getMetadata()));
                --itemstack1.stackSize;
            }
        }

        if (itemstack1.stackSize == 0)
        {
            slot.putStack((ItemStack)null);
        }
        else
        {
            slot.onSlotChanged();
        }

        if (itemstack1.stackSize == itemstack.stackSize)
        {
            return null;
        }

        slot.onPickupFromSlot(playerIn, itemstack1);
    }

    return itemstack;
}
 
Example 11
Project: DecompiledMinecraft   File: BlockCocoa.java   View Source Code Vote up 4 votes
public Item getItem(World worldIn, BlockPos pos)
{
    return Items.dye;
}
 
Example 12
Project: DecompiledMinecraft   File: BlockOre.java   View Source Code Vote up 4 votes
/**
 * Get the Item that this Block should drop when harvested.
 */
public Item getItemDropped(IBlockState state, Random rand, int fortune)
{
    return this == Blocks.coal_ore ? Items.coal : (this == Blocks.diamond_ore ? Items.diamond : (this == Blocks.lapis_ore ? Items.dye : (this == Blocks.emerald_ore ? Items.emerald : (this == Blocks.quartz_ore ? Items.quartz : Item.getItemFromBlock(this)))));
}
 
Example 13
Project: DecompiledMinecraft   File: ContainerEnchantment.java   View Source Code Vote up 4 votes
/**
 * Take a stack from the specified inventory slot.
 */
public ItemStack transferStackInSlot(EntityPlayer playerIn, int index)
{
    ItemStack itemstack = null;
    Slot slot = (Slot)this.inventorySlots.get(index);

    if (slot != null && slot.getHasStack())
    {
        ItemStack itemstack1 = slot.getStack();
        itemstack = itemstack1.copy();

        if (index == 0)
        {
            if (!this.mergeItemStack(itemstack1, 2, 38, true))
            {
                return null;
            }
        }
        else if (index == 1)
        {
            if (!this.mergeItemStack(itemstack1, 2, 38, true))
            {
                return null;
            }
        }
        else if (itemstack1.getItem() == Items.dye && EnumDyeColor.byDyeDamage(itemstack1.getMetadata()) == EnumDyeColor.BLUE)
        {
            if (!this.mergeItemStack(itemstack1, 1, 2, true))
            {
                return null;
            }
        }
        else
        {
            if (((Slot)this.inventorySlots.get(0)).getHasStack() || !((Slot)this.inventorySlots.get(0)).isItemValid(itemstack1))
            {
                return null;
            }

            if (itemstack1.hasTagCompound() && itemstack1.stackSize == 1)
            {
                ((Slot)this.inventorySlots.get(0)).putStack(itemstack1.copy());
                itemstack1.stackSize = 0;
            }
            else if (itemstack1.stackSize >= 1)
            {
                ((Slot)this.inventorySlots.get(0)).putStack(new ItemStack(itemstack1.getItem(), 1, itemstack1.getMetadata()));
                --itemstack1.stackSize;
            }
        }

        if (itemstack1.stackSize == 0)
        {
            slot.putStack((ItemStack)null);
        }
        else
        {
            slot.onSlotChanged();
        }

        if (itemstack1.stackSize == itemstack.stackSize)
        {
            return null;
        }

        slot.onPickupFromSlot(playerIn, itemstack1);
    }

    return itemstack;
}
 
Example 14
Project: BaseClient   File: BlockCocoa.java   View Source Code Vote up 4 votes
public Item getItem(World worldIn, BlockPos pos)
{
    return Items.dye;
}
 
Example 15
Project: BaseClient   File: BlockOre.java   View Source Code Vote up 4 votes
/**
 * Get the Item that this Block should drop when harvested.
 */
public Item getItemDropped(IBlockState state, Random rand, int fortune)
{
    return this == Blocks.coal_ore ? Items.coal : (this == Blocks.diamond_ore ? Items.diamond : (this == Blocks.lapis_ore ? Items.dye : (this == Blocks.emerald_ore ? Items.emerald : (this == Blocks.quartz_ore ? Items.quartz : Item.getItemFromBlock(this)))));
}
 
Example 16
Project: BaseClient   File: ContainerEnchantment.java   View Source Code Vote up 4 votes
/**
 * Take a stack from the specified inventory slot.
 */
public ItemStack transferStackInSlot(EntityPlayer playerIn, int index)
{
    ItemStack itemstack = null;
    Slot slot = (Slot)this.inventorySlots.get(index);

    if (slot != null && slot.getHasStack())
    {
        ItemStack itemstack1 = slot.getStack();
        itemstack = itemstack1.copy();

        if (index == 0)
        {
            if (!this.mergeItemStack(itemstack1, 2, 38, true))
            {
                return null;
            }
        }
        else if (index == 1)
        {
            if (!this.mergeItemStack(itemstack1, 2, 38, true))
            {
                return null;
            }
        }
        else if (itemstack1.getItem() == Items.dye && EnumDyeColor.byDyeDamage(itemstack1.getMetadata()) == EnumDyeColor.BLUE)
        {
            if (!this.mergeItemStack(itemstack1, 1, 2, true))
            {
                return null;
            }
        }
        else
        {
            if (((Slot)this.inventorySlots.get(0)).getHasStack() || !((Slot)this.inventorySlots.get(0)).isItemValid(itemstack1))
            {
                return null;
            }

            if (itemstack1.hasTagCompound() && itemstack1.stackSize == 1)
            {
                ((Slot)this.inventorySlots.get(0)).putStack(itemstack1.copy());
                itemstack1.stackSize = 0;
            }
            else if (itemstack1.stackSize >= 1)
            {
                ((Slot)this.inventorySlots.get(0)).putStack(new ItemStack(itemstack1.getItem(), 1, itemstack1.getMetadata()));
                --itemstack1.stackSize;
            }
        }

        if (itemstack1.stackSize == 0)
        {
            slot.putStack((ItemStack)null);
        }
        else
        {
            slot.onSlotChanged();
        }

        if (itemstack1.stackSize == itemstack.stackSize)
        {
            return null;
        }

        slot.onPickupFromSlot(playerIn, itemstack1);
    }

    return itemstack;
}
 
Example 17
Project: BaseClient   File: BlockCocoa.java   View Source Code Vote up 4 votes
public Item getItem(World worldIn, BlockPos pos)
{
    return Items.dye;
}
 
Example 18
Project: BaseClient   File: BlockOre.java   View Source Code Vote up 4 votes
/**
 * Get the Item that this Block should drop when harvested.
 */
public Item getItemDropped(IBlockState state, Random rand, int fortune)
{
    return this == Blocks.coal_ore ? Items.coal : (this == Blocks.diamond_ore ? Items.diamond : (this == Blocks.lapis_ore ? Items.dye : (this == Blocks.emerald_ore ? Items.emerald : (this == Blocks.quartz_ore ? Items.quartz : Item.getItemFromBlock(this)))));
}
 
Example 19
Project: BaseClient   File: ContainerEnchantment.java   View Source Code Vote up 4 votes
/**
 * Take a stack from the specified inventory slot.
 */
public ItemStack transferStackInSlot(EntityPlayer playerIn, int index)
{
    ItemStack itemstack = null;
    Slot slot = (Slot)this.inventorySlots.get(index);

    if (slot != null && slot.getHasStack())
    {
        ItemStack itemstack1 = slot.getStack();
        itemstack = itemstack1.copy();

        if (index == 0)
        {
            if (!this.mergeItemStack(itemstack1, 2, 38, true))
            {
                return null;
            }
        }
        else if (index == 1)
        {
            if (!this.mergeItemStack(itemstack1, 2, 38, true))
            {
                return null;
            }
        }
        else if (itemstack1.getItem() == Items.dye && EnumDyeColor.byDyeDamage(itemstack1.getMetadata()) == EnumDyeColor.BLUE)
        {
            if (!this.mergeItemStack(itemstack1, 1, 2, true))
            {
                return null;
            }
        }
        else
        {
            if (((Slot)this.inventorySlots.get(0)).getHasStack() || !((Slot)this.inventorySlots.get(0)).isItemValid(itemstack1))
            {
                return null;
            }

            if (itemstack1.hasTagCompound() && itemstack1.stackSize == 1)
            {
                ((Slot)this.inventorySlots.get(0)).putStack(itemstack1.copy());
                itemstack1.stackSize = 0;
            }
            else if (itemstack1.stackSize >= 1)
            {
                ((Slot)this.inventorySlots.get(0)).putStack(new ItemStack(itemstack1.getItem(), 1, itemstack1.getMetadata()));
                --itemstack1.stackSize;
            }
        }

        if (itemstack1.stackSize == 0)
        {
            slot.putStack((ItemStack)null);
        }
        else
        {
            slot.onSlotChanged();
        }

        if (itemstack1.stackSize == itemstack.stackSize)
        {
            return null;
        }

        slot.onPickupFromSlot(playerIn, itemstack1);
    }

    return itemstack;
}
 
Example 20
Project: connor41-etfuturum2   File: ContainerEnchantment.java   View Source Code Vote up 4 votes
/**
 * Take a stack from the specified inventory slot.
 */
@Override
public ItemStack transferStackInSlot(EntityPlayer playerIn, int index) {
	ItemStack var3 = null;
	Slot var4 = (Slot) inventorySlots.get(index);

	if (var4 != null && var4.getHasStack()) {
		ItemStack var5 = var4.getStack();
		var3 = var5.copy();

		if (index == 0) {
			if (!mergeItemStack(var5, 2, 38, true))
				return null;
		} else if (index == 1) {
			if (!mergeItemStack(var5, 2, 38, true))
				return null;
		} else if (var5.getItem() == Items.dye && var5.getItemDamage() == 4) {
			if (!mergeItemStack(var5, 1, 2, true))
				return null;
		} else {
			if (((Slot) inventorySlots.get(0)).getHasStack() || !((Slot) inventorySlots.get(0)).isItemValid(var5))
				return null;

			if (var5.hasTagCompound() && var5.stackSize == 1) {
				((Slot) inventorySlots.get(0)).putStack(var5.copy());
				var5.stackSize = 0;
			} else if (var5.stackSize >= 1) {
				((Slot) inventorySlots.get(0)).putStack(new ItemStack(var5.getItem(), 1, var5.getItemDamage()));
				--var5.stackSize;
			}
		}

		if (var5.stackSize == 0)
			var4.putStack((ItemStack) null);
		else
			var4.onSlotChanged();

		if (var5.stackSize == var3.stackSize)
			return null;

		var4.onPickupFromSlot(playerIn, var5);
	}

	return var3;
}