当前位置: 首页>>代码示例>>Java>>正文


Java Items.dye方法代码示例

本文整理汇总了Java中net.minecraft.init.Items.dye方法的典型用法代码示例。如果您正苦于以下问题:Java Items.dye方法的具体用法?Java Items.dye怎么用?Java Items.dye使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.init.Items的用法示例。


在下文中一共展示了Items.dye方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getDyeColorMixFromParents

import net.minecraft.init.Items; //导入方法依赖的package包/类
/**
 * 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);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:24,代码来源:EntitySheep.java

示例2: matches

import net.minecraft.init.Items; //导入方法依赖的package包/类
/**
 * 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();
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:40,代码来源:RecipesArmorDyes.java

示例3: getItemDropped

import net.minecraft.init.Items; //导入方法依赖的package包/类
/**
 * 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)))));
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:8,代码来源:BlockOre.java

示例4: transferStackInSlot

import net.minecraft.init.Items; //导入方法依赖的package包/类
/**
 * 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;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:73,代码来源:ContainerEnchantment.java

示例5: getItem

import net.minecraft.init.Items; //导入方法依赖的package包/类
public Item getItem(World worldIn, BlockPos pos)
{
    return Items.dye;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:5,代码来源:BlockCocoa.java

示例6: transferStackInSlot

import net.minecraft.init.Items; //导入方法依赖的package包/类
/**
 * 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;
}
 
开发者ID:jm-organization,项目名称:connor41-etfuturum2,代码行数:48,代码来源:ContainerEnchantment.java


注:本文中的net.minecraft.init.Items.dye方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。