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


Java EntityLivingBase.renderBrokenItemStack方法代码示例

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


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

示例1: damageItem

import net.minecraft.entity.EntityLivingBase; //导入方法依赖的package包/类
/**
 * Damages the item in the ItemStack
 */
public void damageItem(int amount, EntityLivingBase entityIn)
{
    if (!(entityIn instanceof EntityPlayer) || !((EntityPlayer)entityIn).capabilities.isCreativeMode)
    {
        if (this.isItemStackDamageable())
        {
            if (this.attemptDamageItem(amount, entityIn.getRNG()))
            {
                entityIn.renderBrokenItemStack(this);
                this.func_190918_g(1);

                if (entityIn instanceof EntityPlayer)
                {
                    EntityPlayer entityplayer = (EntityPlayer)entityIn;
                    entityplayer.addStat(StatList.getObjectBreakStats(this.item));
                }

                this.itemDamage = 0;
            }
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:26,代码来源:ItemStack.java

示例2: onEntityUpdate

import net.minecraft.entity.EntityLivingBase; //导入方法依赖的package包/类
@SubscribeEvent
public void onEntityUpdate(LivingUpdateEvent event)
{
	EntityLivingBase living = event.getEntityLiving();
	if(living instanceof IBurnInDay && living.world.isDaytime() && !living.world.isRemote && !living.isChild() && ((IBurnInDay)living).shouldBurn() && living.getBrightness() > 0.5F && 
			living.getRNG().nextFloat() * 30.0F < (living.getBrightness() - 0.4F) * 2.0F && living.world.canSeeSky(new BlockPos(living.posX, living.posY + (double)living.getEyeHeight(), living.posZ)))
	{
		boolean flag = true;
           ItemStack itemstack = living.getItemStackFromSlot(EntityEquipmentSlot.HEAD);
           if (!itemstack.isEmpty())
           {
               if (itemstack.isItemStackDamageable())
               {
                   itemstack.setItemDamage(itemstack.getItemDamage() + living.getRNG().nextInt(2));

                   if (itemstack.getItemDamage() >= itemstack.getMaxDamage())
                   {
                   	living.renderBrokenItemStack(itemstack);
                   	living.setItemStackToSlot(EntityEquipmentSlot.HEAD, ItemStack.EMPTY);
                   }
               }

               flag = false;
           }

           if (flag)
           {
           	living.setFire(8);
           }
	}
}
 
开发者ID:kenijey,项目名称:harshencastle,代码行数:32,代码来源:HandlerBurnInDaylight.java

示例3: damageItem

import net.minecraft.entity.EntityLivingBase; //导入方法依赖的package包/类
/**
 * Damages the item in the ItemStack
 */
public void damageItem(int amount, EntityLivingBase entityIn)
{
    if (!(entityIn instanceof EntityPlayer) || !((EntityPlayer)entityIn).capabilities.isCreativeMode)
    {
        if (this.isItemStackDamageable())
        {
            if (this.attemptDamageItem(amount, entityIn.getRNG()))
            {
                entityIn.renderBrokenItemStack(this);
                --this.stackSize;

                if (entityIn instanceof EntityPlayer)
                {
                    EntityPlayer entityplayer = (EntityPlayer)entityIn;
                    entityplayer.triggerAchievement(StatList.objectBreakStats[Item.getIdFromItem(this.item)]);

                    if (this.stackSize == 0 && this.getItem() instanceof ItemBow)
                    {
                        entityplayer.destroyCurrentEquippedItem();
                    }
                }

                if (this.stackSize < 0)
                {
                    this.stackSize = 0;
                }

                this.itemDamage = 0;
            }
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:36,代码来源:ItemStack.java

示例4: damageItem

import net.minecraft.entity.EntityLivingBase; //导入方法依赖的package包/类
/**
 * Damages the item in the ItemStack
 */
public void damageItem(int amount, EntityLivingBase entityIn)
{
    if (!(entityIn instanceof EntityPlayer) || !((EntityPlayer)entityIn).capabilities.isCreativeMode)
    {
        if (this.isItemStackDamageable())
        {
            if (this.attemptDamageItem(amount, entityIn.getRNG()))
            {
                entityIn.renderBrokenItemStack(this);
                --this.stackSize;

                if (entityIn instanceof EntityPlayer)
                {
                    EntityPlayer entityplayer = (EntityPlayer)entityIn;
                    entityplayer.addStat(StatList.getObjectBreakStats(this.item));
                }

                if (this.stackSize < 0)
                {
                    this.stackSize = 0;
                }

                this.itemDamage = 0;
            }
        }
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:31,代码来源:ItemStack.java


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