本文整理匯總了Java中net.minecraft.util.StatCollector類的典型用法代碼示例。如果您正苦於以下問題:Java StatCollector類的具體用法?Java StatCollector怎麽用?Java StatCollector使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
StatCollector類屬於net.minecraft.util包,在下文中一共展示了StatCollector類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getName
import net.minecraft.util.StatCollector; //導入依賴的package包/類
/**
* Gets the name of this command sender (usually username, but possibly "Rcon")
*/
public String getName()
{
if (this.hasCustomName())
{
return this.getCustomNameTag();
}
else
{
String s = EntityList.getEntityString(this);
if (s == null)
{
s = "generic";
}
return StatCollector.translateToLocal("entity." + s + ".name");
}
}
示例2: setRabbitType
import net.minecraft.util.StatCollector; //導入依賴的package包/類
public void setRabbitType(int rabbitTypeId)
{
if (rabbitTypeId == 99)
{
this.tasks.removeTask(this.aiAvoidWolves);
this.tasks.addTask(4, new EntityRabbit.AIEvilAttack(this));
this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false, new Class[0]));
this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, true));
this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityWolf.class, true));
if (!this.hasCustomName())
{
this.setCustomNameTag(StatCollector.translateToLocal("entity.KillerBunny.name"));
}
}
this.dataWatcher.updateObject(18, Byte.valueOf((byte)rabbitTypeId));
}
示例3: getItemStackDisplayName
import net.minecraft.util.StatCollector; //導入依賴的package包/類
public String getItemStackDisplayName(ItemStack stack)
{
if (stack.getMetadata() == 3 && stack.hasTagCompound())
{
if (stack.getTagCompound().hasKey("SkullOwner", 8))
{
return StatCollector.translateToLocalFormatted("item.skull.player.name", new Object[] {stack.getTagCompound().getString("SkullOwner")});
}
if (stack.getTagCompound().hasKey("SkullOwner", 10))
{
NBTTagCompound nbttagcompound = stack.getTagCompound().getCompoundTag("SkullOwner");
if (nbttagcompound.hasKey("Name", 8))
{
return StatCollector.translateToLocalFormatted("item.skull.player.name", new Object[] {nbttagcompound.getString("Name")});
}
}
}
return super.getItemStackDisplayName(stack);
}
示例4: addInformation
import net.minecraft.util.StatCollector; //導入依賴的package包/類
/**
* allows items to add custom lines of information to the mouseover description
*/
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced)
{
NBTTagCompound nbttagcompound = stack.getSubCompound("BlockEntityTag", false);
if (nbttagcompound != null && nbttagcompound.hasKey("Patterns"))
{
NBTTagList nbttaglist = nbttagcompound.getTagList("Patterns", 10);
for (int i = 0; i < nbttaglist.tagCount() && i < 6; ++i)
{
NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i);
EnumDyeColor enumdyecolor = EnumDyeColor.byDyeDamage(nbttagcompound1.getInteger("Color"));
TileEntityBanner.EnumBannerPattern tileentitybanner$enumbannerpattern = TileEntityBanner.EnumBannerPattern.getPatternByID(nbttagcompound1.getString("Pattern"));
if (tileentitybanner$enumbannerpattern != null)
{
tooltip.add(StatCollector.translateToLocal("item.banner." + tileentitybanner$enumbannerpattern.getPatternName() + "." + enumdyecolor.getUnlocalizedName()));
}
}
}
}
示例5: addInformation
import net.minecraft.util.StatCollector; //導入依賴的package包/類
/**
* allows items to add custom lines of information to the mouseover description
*/
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced)
{
if (stack.hasTagCompound())
{
NBTTagCompound nbttagcompound = stack.getTagCompound();
String s = nbttagcompound.getString("author");
if (!StringUtils.isNullOrEmpty(s))
{
tooltip.add(EnumChatFormatting.GRAY + StatCollector.translateToLocalFormatted("book.byAuthor", new Object[] {s}));
}
tooltip.add(EnumChatFormatting.GRAY + StatCollector.translateToLocal("book.generation." + nbttagcompound.getInteger("generation")));
}
}
示例6: addInformation
import net.minecraft.util.StatCollector; //導入依賴的package包/類
@Override
@SideOnly(Side.CLIENT)
@SuppressWarnings({ "unchecked", "rawtypes" })
public void addInformation(ItemStack stack, EntityPlayer playerIn, List tooltip, boolean advanced) {
NBTTagCompound nbttagcompound = getSubTag(stack, "BlockEntityTag", false);
if (nbttagcompound != null && nbttagcompound.hasKey("Patterns")) {
NBTTagList nbttaglist = nbttagcompound.getTagList("Patterns", 10);
for (int i = 0; i < nbttaglist.tagCount() && i < 6; i++) {
NBTTagCompound nbt = nbttaglist.getCompoundTagAt(i);
EnumColour colour = EnumColour.fromDamage(nbt.getInteger("Color"));
EnumBannerPattern pattern = EnumBannerPattern.getPatternByID(nbt.getString("Pattern"));
if (pattern != null)
tooltip.add(StatCollector.translateToLocal("item.banner." + pattern.getPatternName() + "." + colour.getMojangName()));
}
}
}
示例7: getFormattedChatText
import net.minecraft.util.StatCollector; //導入依賴的package包/類
public IChatComponent getFormattedChatText() {
String text = StatCollector.translateToLocal("neiLotr.versionChecker.notification.chat");
String[] parts = text.split("7");
String text1 = parts[0];
String text2 = parts[1];
String text3 = parts[2];
String text4 = parts[3];
ChatComponentText chat1 = (ChatComponentText) new ChatComponentText("[NEI LOTR]: ")
.setChatStyle(new ChatStyle().setColor(EnumChatFormatting.GREEN));
ChatComponentText chat2 = (ChatComponentText) new ChatComponentText(text1 + " ")
.setChatStyle(new ChatStyle().setColor(EnumChatFormatting.WHITE));
ChatComponentText chat3 = (ChatComponentText) new ChatComponentText(text2)
.setChatStyle(new ChatStyle().setColor(EnumChatFormatting.BLUE).setUnderlined(true)
.setChatClickEvent(
new ClickEvent(Action.OPEN_URL, "https://goo.gl/EkxFlC"))
.setChatHoverEvent(
new HoverEvent(net.minecraft.event.HoverEvent.Action.SHOW_TEXT,
new ChatComponentText(StatCollector
.translateToLocal("neiLotr.versionChecker.notification.changelog")
.replace("/", "\n")))));
ChatComponentText chat4 = (ChatComponentText) new ChatComponentText(" " + text3 + " ")
.setChatStyle(new ChatStyle().setColor(EnumChatFormatting.WHITE));
ChatComponentText chat5 = (ChatComponentText) new ChatComponentText(state.toString() + " " + version)
.setChatStyle(new ChatStyle().setColor(EnumChatFormatting.YELLOW).setUnderlined(true)
.setChatClickEvent(
new ClickEvent(Action.OPEN_URL, url))
.setChatHoverEvent(
new HoverEvent(net.minecraft.event.HoverEvent.Action.SHOW_TEXT,
new ChatComponentText(StatCollector
.translateToLocal("neiLotr.versionChecker.notification.newVersion")
.replace("/", "\n")))));
ChatComponentText chat6 = (ChatComponentText) new ChatComponentText(" " + text4 + " ")
.setChatStyle(new ChatStyle().setColor(EnumChatFormatting.WHITE));
ChatComponentText chat7 = (ChatComponentText) new ChatComponentText(mcVersion)
.setChatStyle(new ChatStyle().setColor(EnumChatFormatting.WHITE));
return chat1.appendSibling(chat2).appendSibling(chat3).appendSibling(chat4).appendSibling(chat5)
.appendSibling(chat6).appendSibling(chat7);
}
示例8: addOverrideNames
import net.minecraft.util.StatCollector; //導入依賴的package包/類
private void addOverrideNames() {
// Portals
setOverrideName(LOTRMod.elvenPortal, StatCollector.translateToLocal("lotrNei.lotr.block.elvenPortal.name"));
setOverrideName(LOTRMod.morgulPortal, StatCollector.translateToLocal("lotrNei.lotr.block.morgulPortal.name"));
setOverrideName(LOTRMod.utumnoPortal, StatCollector.translateToLocal("lotrNei.lotr.block.utumnoPortal.name"));
setOverrideName(LOTRMod.utumnoReturnPortal,
StatCollector.translateToLocal("lotrNei.lotr.block.utumnoReturnPortal.name"));
setOverrideName(LOTRMod.utumnoReturnPortalBase,
StatCollector.translateToLocal("lotrNei.lotr.block.utumnoReturnPortalBase.name"));
// Others
setOverrideName(LOTRMod.goran, StatCollector.translateToLocal("lotrNei.lotr.block.goranBlock.name"));
setOverrideName(LOTRMod.rhunFire, StatCollector.translateToLocal("lotrNei.lotr.block.rhunFire.name"));
}
示例9: getItemStackDisplayName
import net.minecraft.util.StatCollector; //導入依賴的package包/類
public String getItemStackDisplayName(ItemStack stack)
{
String s = ("" + StatCollector.translateToLocal(this.getUnlocalizedName() + ".name")).trim();
String s1 = EntityList.getStringFromID(stack.getMetadata());
if (s1 != null)
{
s = s + " " + StatCollector.translateToLocal("entity." + s1 + ".name");
}
return s;
}
示例10: addInformation
import net.minecraft.util.StatCollector; //導入依賴的package包/類
/**
* allows items to add custom lines of information to the mouseover description
*/
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced)
{
if (stack.hasTagCompound())
{
NBTTagCompound nbttagcompound = stack.getTagCompound().getCompoundTag("Fireworks");
if (nbttagcompound != null)
{
if (nbttagcompound.hasKey("Flight", 99))
{
tooltip.add(StatCollector.translateToLocal("item.fireworks.flight") + " " + nbttagcompound.getByte("Flight"));
}
NBTTagList nbttaglist = nbttagcompound.getTagList("Explosions", 10);
if (nbttaglist != null && nbttaglist.tagCount() > 0)
{
for (int i = 0; i < nbttaglist.tagCount(); ++i)
{
NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i);
List<String> list = Lists.<String>newArrayList();
ItemFireworkCharge.addExplosionInfo(nbttagcompound1, list);
if (list.size() > 0)
{
for (int j = 1; j < ((List)list).size(); ++j)
{
list.set(j, " " + (String)list.get(j));
}
tooltip.addAll(list);
}
}
}
}
}
}
示例11: BasicTradeHandler
import net.minecraft.util.StatCollector; //導入依賴的package包/類
public BasicTradeHandler(long id, String traderNameRaw, LOTRTradeEntries entriesBuy, LOTRTradeEntries entriesSell) {
super(id);
this.traderName = StatCollector.translateToLocal(traderNameRaw);
this.traderNameRaw = traderNameRaw;
this.entriesBuy = entriesBuy;
this.entriesSell = entriesSell;
this.vesselsBuy = NeiLotrReflection.getDrinkVessels(entriesBuy);
this.vesselsSell = NeiLotrReflection.getDrinkVessels(entriesSell);
}
示例12: getName
import net.minecraft.util.StatCollector; //導入依賴的package包/類
/**
* Gets the name of this command sender (usually username, but possibly "Rcon")
*/
public String getName()
{
if (this.hasCustomName())
{
return this.getCustomNameTag();
}
else
{
int i = this.getHorseType();
switch (i)
{
case 0:
default:
return StatCollector.translateToLocal("entity.horse.name");
case 1:
return StatCollector.translateToLocal("entity.donkey.name");
case 2:
return StatCollector.translateToLocal("entity.mule.name");
case 3:
return StatCollector.translateToLocal("entity.zombiehorse.name");
case 4:
return StatCollector.translateToLocal("entity.skeletonhorse.name");
}
}
}
示例13: getItemStackDisplayName
import net.minecraft.util.StatCollector; //導入依賴的package包/類
public String getItemStackDisplayName(ItemStack stack)
{
String s = "item.banner.";
EnumDyeColor enumdyecolor = this.getBaseColor(stack);
s = s + enumdyecolor.getUnlocalizedName() + ".name";
return StatCollector.translateToLocal(s);
}
示例14: getItemStackDisplayName
import net.minecraft.util.StatCollector; //導入依賴的package包/類
public String getItemStackDisplayName(ItemStack stack)
{
if (stack.getMetadata() == 0)
{
return StatCollector.translateToLocal("item.emptyPotion.name").trim();
}
else
{
String s = "";
if (isSplash(stack.getMetadata()))
{
s = StatCollector.translateToLocal("potion.prefix.grenade").trim() + " ";
}
List<PotionEffect> list = Items.potionitem.getEffects(stack);
if (list != null && !list.isEmpty())
{
String s2 = ((PotionEffect)list.get(0)).getEffectName();
s2 = s2 + ".postfix";
return s + StatCollector.translateToLocal(s2).trim();
}
else
{
String s1 = PotionHelper.getPotionPrefix(stack.getMetadata());
return StatCollector.translateToLocal(s1).trim() + " " + super.getItemStackDisplayName(stack);
}
}
}
示例15: getDisplayNameForEntity
import net.minecraft.util.StatCollector; //導入依賴的package包/類
public static String getDisplayNameForEntity(String mobName) {
return StatCollector.translateToLocal("entity." + mobName + ".name");
}