本文整理匯總了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;
}
}
}
}
示例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);
}
}
}
示例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;
}
}
}
}
示例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;
}
}
}
}