本文整理匯總了Java中net.minecraft.item.ItemStack.getChatComponent方法的典型用法代碼示例。如果您正苦於以下問題:Java ItemStack.getChatComponent方法的具體用法?Java ItemStack.getChatComponent怎麽用?Java ItemStack.getChatComponent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraft.item.ItemStack
的用法示例。
在下文中一共展示了ItemStack.getChatComponent方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getDeathMessage
import net.minecraft.item.ItemStack; //導入方法依賴的package包/類
/**
* Gets the death message that is displayed when the player dies
*/
public IChatComponent getDeathMessage(EntityLivingBase p_151519_1_)
{
ItemStack itemstack = this.damageSourceEntity instanceof EntityLivingBase ? ((EntityLivingBase)this.damageSourceEntity).getHeldItem() : null;
String s = "death.attack." + this.damageType;
String s1 = s + ".item";
return itemstack != null && itemstack.hasDisplayName() && StatCollector.canTranslate(s1) ? new ChatComponentTranslation(s1, new Object[] {p_151519_1_.getDisplayName(), this.damageSourceEntity.getDisplayName(), itemstack.getChatComponent()}): new ChatComponentTranslation(s, new Object[] {p_151519_1_.getDisplayName(), this.damageSourceEntity.getDisplayName()});
}
示例2: getDeathMessage
import net.minecraft.item.ItemStack; //導入方法依賴的package包/類
/**
* Gets the death message that is displayed when the player dies
*/
public IChatComponent getDeathMessage(EntityLivingBase p_151519_1_)
{
IChatComponent ichatcomponent = this.indirectEntity == null ? this.damageSourceEntity.getDisplayName() : this.indirectEntity.getDisplayName();
ItemStack itemstack = this.indirectEntity instanceof EntityLivingBase ? ((EntityLivingBase)this.indirectEntity).getHeldItem() : null;
String s = "death.attack." + this.damageType;
String s1 = s + ".item";
return itemstack != null && itemstack.hasDisplayName() && StatCollector.canTranslate(s1) ? new ChatComponentTranslation(s1, new Object[] {p_151519_1_.getDisplayName(), ichatcomponent, itemstack.getChatComponent()}): new ChatComponentTranslation(s, new Object[] {p_151519_1_.getDisplayName(), ichatcomponent});
}
示例3: getDeathMessage
import net.minecraft.item.ItemStack; //導入方法依賴的package包/類
public IChatComponent getDeathMessage()
{
if (this.combatEntries.size() == 0)
{
return new ChatComponentTranslation("death.attack.generic", new Object[] {this.fighter.getDisplayName()});
}
else
{
CombatEntry combatentry = this.func_94544_f();
CombatEntry combatentry1 = (CombatEntry)this.combatEntries.get(this.combatEntries.size() - 1);
IChatComponent ichatcomponent1 = combatentry1.getDamageSrcDisplayName();
Entity entity = combatentry1.getDamageSrc().getEntity();
IChatComponent ichatcomponent;
if (combatentry != null && combatentry1.getDamageSrc() == DamageSource.fall)
{
IChatComponent ichatcomponent2 = combatentry.getDamageSrcDisplayName();
if (combatentry.getDamageSrc() != DamageSource.fall && combatentry.getDamageSrc() != DamageSource.outOfWorld)
{
if (ichatcomponent2 != null && (ichatcomponent1 == null || !ichatcomponent2.equals(ichatcomponent1)))
{
Entity entity1 = combatentry.getDamageSrc().getEntity();
ItemStack itemstack1 = entity1 instanceof EntityLivingBase ? ((EntityLivingBase)entity1).getHeldItem() : null;
if (itemstack1 != null && itemstack1.hasDisplayName())
{
ichatcomponent = new ChatComponentTranslation("death.fell.assist.item", new Object[] {this.fighter.getDisplayName(), ichatcomponent2, itemstack1.getChatComponent()});
}
else
{
ichatcomponent = new ChatComponentTranslation("death.fell.assist", new Object[] {this.fighter.getDisplayName(), ichatcomponent2});
}
}
else if (ichatcomponent1 != null)
{
ItemStack itemstack = entity instanceof EntityLivingBase ? ((EntityLivingBase)entity).getHeldItem() : null;
if (itemstack != null && itemstack.hasDisplayName())
{
ichatcomponent = new ChatComponentTranslation("death.fell.finish.item", new Object[] {this.fighter.getDisplayName(), ichatcomponent1, itemstack.getChatComponent()});
}
else
{
ichatcomponent = new ChatComponentTranslation("death.fell.finish", new Object[] {this.fighter.getDisplayName(), ichatcomponent1});
}
}
else
{
ichatcomponent = new ChatComponentTranslation("death.fell.killer", new Object[] {this.fighter.getDisplayName()});
}
}
else
{
ichatcomponent = new ChatComponentTranslation("death.fell.accident." + this.func_94548_b(combatentry), new Object[] {this.fighter.getDisplayName()});
}
}
else
{
ichatcomponent = combatentry1.getDamageSrc().getDeathMessage(this.fighter);
}
return ichatcomponent;
}
}