本文整理汇总了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;
}
}