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


Java EnumDyeColor.byDyeDamage方法代码示例

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


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

示例1: getDyeColorMixFromParents

import net.minecraft.item.EnumDyeColor; //导入方法依赖的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:F1r3w477,项目名称:CustomWorldGen,代码行数:24,代码来源:EntitySheep.java

示例2: onRenderLiving

import net.minecraft.item.EnumDyeColor; //导入方法依赖的package包/类
@SuppressWarnings("rawtypes")
@SideOnly(Side.CLIENT)
@Override
public void onRenderLiving(RenderLivingEvent.Pre event, RenderLivingBase renderer, int amplifier) {
	GlStateManager.pushMatrix();

	EnumDyeColor dye = EnumDyeColor.byDyeDamage(Math.min(amplifier, EnumDyeColor.values().length - 1));
	int rgb = dye.getColorValue();

	float r = (rgb >>> 16 & 0xFF) / 256.0F;
	float g = (rgb >>> 8 & 0xFF) / 256.0F;
	float b = (rgb & 0xFF) / 256.0F;
	GlStateManager.color(r, g, b);

	GlStateManager.popMatrix();
}
 
开发者ID:Um-Mitternacht,项目名称:Bewitchment,代码行数:17,代码来源:SkinTintBrew.java

示例3: getDyeColorMixFromParents

import net.minecraft.item.EnumDyeColor; //导入方法依赖的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

示例4: readFromNBT

import net.minecraft.item.EnumDyeColor; //导入方法依赖的package包/类
public void readFromNBT(NBTTagCompound compound)
{
    super.readFromNBT(compound);

    if (compound.hasKey("CustomName", 8))
    {
        this.field_190617_a = compound.getString("CustomName");
    }

    this.baseColor = EnumDyeColor.byDyeDamage(compound.getInteger("Base"));
    this.patterns = compound.getTagList("Patterns", 10);
    this.patternList = null;
    this.colorList = null;
    this.patternResourceLocation = null;
    this.patternDataSet = true;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:17,代码来源:TileEntityBanner.java

示例5: getDyeColorMixFromParents

import net.minecraft.item.EnumDyeColor; //导入方法依赖的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).world);
    int k;

    if (itemstack.getItem() == Items.DYE)
    {
        k = itemstack.getMetadata();
    }
    else
    {
        k = this.world.rand.nextBoolean() ? i : j;
    }

    return EnumDyeColor.byDyeDamage(k);
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:24,代码来源:EntitySheep.java

示例6: renderHUD

import net.minecraft.item.EnumDyeColor; //导入方法依赖的package包/类
@SideOnly(Side.CLIENT)
@Override
public void renderHUD(int x, int y, Minecraft mc, int amplifier) {
	mc.renderEngine.bindTexture(ResourceLocations.BREW_TEXTURES);
	final Tessellator tessellator = Tessellator.getInstance();
	final BufferBuilder buf = tessellator.getBuffer();
	GlStateManager.color(1F, 1F, 1F, 1F);
	final float f = 0.00390625F;

	buf.begin(7, DefaultVertexFormats.POSITION_TEX);
	buf.pos(x, y + 20, 0).tex(236 * f, (236 + 20) * f).endVertex();
	buf.pos(x + 20, y + 20, 0).tex((236 + 20) * f, (236 + 20) * f).endVertex();
	buf.pos(x + 20, y, 0).tex((236 + 20) * f, 236 * f).endVertex();
	buf.pos(x, y, 0).tex(236 * f, 236 * f).endVertex();
	tessellator.draw();

	int textureX = 9 % 14 * 18;
	int textureY = 0;
	x += 1;
	y += 1;

	GlStateManager.pushMatrix();

	EnumDyeColor dye = EnumDyeColor.byDyeDamage(Math.min(amplifier, EnumDyeColor.values().length - 1));
	int rgb = dye.getColorValue();

	float r = (rgb >>> 16 & 0xFF) / 256.0F;
	float g = (rgb >>> 8 & 0xFF) / 256.0F;
	float b = (rgb & 0xFF) / 256.0F;
	GlStateManager.color(r, g, b);

	buf.begin(7, DefaultVertexFormats.POSITION_TEX);
	buf.pos(x, y + 18, 0).tex(textureX * f, (textureY + 18) * f).endVertex();
	buf.pos(x + 18, y + 18, 0).tex((textureX + 18) * f, (textureY + 18) * f).endVertex();
	buf.pos(x + 18, y, 0).tex((textureX + 18) * f, textureY * f).endVertex();
	buf.pos(x, y, 0).tex(textureX * f, textureY * f).endVertex();
	tessellator.draw();

	GlStateManager.popMatrix();
}
 
开发者ID:Um-Mitternacht,项目名称:Bewitchment,代码行数:41,代码来源:SkinTintBrew.java

示例7: getUnlocalizedName

import net.minecraft.item.EnumDyeColor; //导入方法依赖的package包/类
@Override
public String getUnlocalizedName(ItemStack stack) {
    return super.getUnlocalizedName(stack) + "." + EnumDyeColor.byDyeDamage(MathHelper.clamp(stack.getItemDamage(), 0, 15));
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:5,代码来源:ItemPlastic.java

示例8: getCollarColor

import net.minecraft.item.EnumDyeColor; //导入方法依赖的package包/类
public EnumDyeColor getCollarColor()
{
    return EnumDyeColor.byDyeDamage(this.dataWatcher.getWatchableObjectByte(20) & 15);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:5,代码来源:EntityWolf.java

示例9: transferStackInSlot

import net.minecraft.item.EnumDyeColor; //导入方法依赖的package包/类
/**
 * Take a stack from the specified inventory slot.
 */
@Nullable
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:F1r3w477,项目名称:CustomWorldGen,代码行数:74,代码来源:ContainerEnchantment.java

示例10: transferStackInSlot

import net.minecraft.item.EnumDyeColor; //导入方法依赖的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

示例11: processInteract

import net.minecraft.item.EnumDyeColor; //导入方法依赖的package包/类
public boolean processInteract(EntityPlayer player, EnumHand hand)
{
    ItemStack itemstack = player.getHeldItem(hand);

    if (this.isTamed())
    {
        if (!itemstack.func_190926_b())
        {
            if (itemstack.getItem() instanceof ItemFood)
            {
                ItemFood itemfood = (ItemFood)itemstack.getItem();

                if (itemfood.isWolfsFavoriteMeat() && ((Float)this.dataManager.get(DATA_HEALTH_ID)).floatValue() < 20.0F)
                {
                    if (!player.capabilities.isCreativeMode)
                    {
                        itemstack.func_190918_g(1);
                    }

                    this.heal((float)itemfood.getHealAmount(itemstack));
                    return true;
                }
            }
            else if (itemstack.getItem() == Items.DYE)
            {
                EnumDyeColor enumdyecolor = EnumDyeColor.byDyeDamage(itemstack.getMetadata());

                if (enumdyecolor != this.getCollarColor())
                {
                    this.setCollarColor(enumdyecolor);

                    if (!player.capabilities.isCreativeMode)
                    {
                        itemstack.func_190918_g(1);
                    }

                    return true;
                }
            }
        }

        if (this.isOwner(player) && !this.world.isRemote && !this.isBreedingItem(itemstack))
        {
            this.aiSit.setSitting(!this.isSitting());
            this.isJumping = false;
            this.navigator.clearPathEntity();
            this.setAttackTarget((EntityLivingBase)null);
        }
    }
    else if (itemstack.getItem() == Items.BONE && !this.isAngry())
    {
        if (!player.capabilities.isCreativeMode)
        {
            itemstack.func_190918_g(1);
        }

        if (!this.world.isRemote)
        {
            if (this.rand.nextInt(3) == 0)
            {
                this.setTamed(true);
                this.navigator.clearPathEntity();
                this.setAttackTarget((EntityLivingBase)null);
                this.aiSit.setSitting(true);
                this.setHealth(20.0F);
                this.setOwnerId(player.getUniqueID());
                this.playTameEffect(true);
                this.world.setEntityState(this, (byte)7);
            }
            else
            {
                this.playTameEffect(false);
                this.world.setEntityState(this, (byte)6);
            }
        }

        return true;
    }

    return super.processInteract(player, hand);
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:82,代码来源:EntityWolf.java

示例12: getCollarColor

import net.minecraft.item.EnumDyeColor; //导入方法依赖的package包/类
public EnumDyeColor getCollarColor()
{
    return EnumDyeColor.byDyeDamage(((Integer)this.dataManager.get(COLLAR_COLOR)).intValue() & 15);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:5,代码来源:EntityWolf.java

示例13: processInteract

import net.minecraft.item.EnumDyeColor; //导入方法依赖的package包/类
public boolean processInteract(EntityPlayer player, EnumHand hand, @Nullable ItemStack stack)
{
    if (this.isTamed())
    {
        if (stack != null)
        {
            if (stack.getItem() instanceof ItemFood)
            {
                ItemFood itemfood = (ItemFood)stack.getItem();

                if (itemfood.isWolfsFavoriteMeat() && ((Float)this.dataManager.get(DATA_HEALTH_ID)).floatValue() < 20.0F)
                {
                    if (!player.capabilities.isCreativeMode)
                    {
                        --stack.stackSize;
                    }

                    this.heal((float)itemfood.getHealAmount(stack));
                    return true;
                }
            }
            else if (stack.getItem() == Items.DYE)
            {
                EnumDyeColor enumdyecolor = EnumDyeColor.byDyeDamage(stack.getMetadata());

                if (enumdyecolor != this.getCollarColor())
                {
                    this.setCollarColor(enumdyecolor);

                    if (!player.capabilities.isCreativeMode)
                    {
                        --stack.stackSize;
                    }

                    return true;
                }
            }
        }

        if (this.isOwner(player) && !this.worldObj.isRemote && !this.isBreedingItem(stack))
        {
            this.aiSit.setSitting(!this.isSitting());
            this.isJumping = false;
            this.navigator.clearPathEntity();
            this.setAttackTarget((EntityLivingBase)null);
        }
    }
    else if (stack != null && stack.getItem() == Items.BONE && !this.isAngry())
    {
        if (!player.capabilities.isCreativeMode)
        {
            --stack.stackSize;
        }

        if (!this.worldObj.isRemote)
        {
            if (this.rand.nextInt(3) == 0)
            {
                this.setTamed(true);
                this.navigator.clearPathEntity();
                this.setAttackTarget((EntityLivingBase)null);
                this.aiSit.setSitting(true);
                this.setHealth(20.0F);
                this.setOwnerId(player.getUniqueID());
                this.playTameEffect(true);
                this.worldObj.setEntityState(this, (byte)7);
            }
            else
            {
                this.playTameEffect(false);
                this.worldObj.setEntityState(this, (byte)6);
            }
        }

        return true;
    }

    return super.processInteract(player, hand, stack);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:80,代码来源:EntityWolf.java


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