本文整理汇总了Java中net.minecraft.scoreboard.IScoreObjectiveCriteria类的典型用法代码示例。如果您正苦于以下问题:Java IScoreObjectiveCriteria类的具体用法?Java IScoreObjectiveCriteria怎么用?Java IScoreObjectiveCriteria使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IScoreObjectiveCriteria类属于net.minecraft.scoreboard包,在下文中一共展示了IScoreObjectiveCriteria类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addToPlayerScore
import net.minecraft.scoreboard.IScoreObjectiveCriteria; //导入依赖的package包/类
/**
* Adds a value to the player score. Currently not actually used and the entity passed in does nothing. Args:
* entity, scoreToAdd
*/
public void addToPlayerScore(Entity entityIn, int amount)
{
this.addScore(amount);
Collection<ScoreObjective> collection = this.getWorldScoreboard().getObjectivesFromCriteria(IScoreObjectiveCriteria.totalKillCount);
if (entityIn instanceof EntityPlayer)
{
this.triggerAchievement(StatList.playerKillsStat);
collection.addAll(this.getWorldScoreboard().getObjectivesFromCriteria(IScoreObjectiveCriteria.playerKillCount));
collection.addAll(this.func_175137_e(entityIn));
}
else
{
this.triggerAchievement(StatList.mobKillsStat);
}
for (ScoreObjective scoreobjective : collection)
{
Score score = this.getWorldScoreboard().getValueFromObjective(this.getName(), scoreobjective);
score.func_96648_a();
}
}
示例2: func_175779_n
import net.minecraft.scoreboard.IScoreObjectiveCriteria; //导入依赖的package包/类
protected void func_175779_n(ICommandSender p_175779_1_, String[] p_175779_2_, int p_175779_3_) throws CommandException
{
Scoreboard scoreboard = this.getScoreboard();
String s = getPlayerName(p_175779_1_, p_175779_2_[p_175779_3_++]);
if (s.length() > 40)
{
throw new SyntaxErrorException("commands.scoreboard.players.name.tooLong", new Object[] {s, Integer.valueOf(40)});
}
else
{
ScoreObjective scoreobjective = this.getObjective(p_175779_2_[p_175779_3_], false);
if (scoreobjective.getCriteria() != IScoreObjectiveCriteria.TRIGGER)
{
throw new CommandException("commands.scoreboard.players.enable.noTrigger", new Object[] {scoreobjective.getName()});
}
else
{
Score score = scoreboard.getValueFromObjective(s, scoreobjective);
score.setLocked(false);
notifyOperators(p_175779_1_, this, "commands.scoreboard.players.enable.success", new Object[] {scoreobjective.getName(), s});
}
}
}
示例3: addTabCompletionOptions
import net.minecraft.scoreboard.IScoreObjectiveCriteria; //导入依赖的package包/类
public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos)
{
if (args.length == 1)
{
Scoreboard scoreboard = MinecraftServer.getServer().worldServerForDimension(0).getScoreboard();
List<String> list = Lists.<String>newArrayList();
for (ScoreObjective scoreobjective : scoreboard.getScoreObjectives())
{
if (scoreobjective.getCriteria() == IScoreObjectiveCriteria.TRIGGER)
{
list.add(scoreobjective.getName());
}
}
return getListOfStringsMatchingLastWord(args, (String[])list.toArray(new String[list.size()]));
}
else
{
return args.length == 2 ? getListOfStringsMatchingLastWord(args, new String[] {"add", "set"}): null;
}
}
示例4: handleScoreboardObjective
import net.minecraft.scoreboard.IScoreObjectiveCriteria; //导入依赖的package包/类
/**
* May create a scoreboard objective, remove an objective from the scoreboard or
* update an objectives' displayname
*/
public void handleScoreboardObjective(S3BPacketScoreboardObjective packetIn) {
PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
Scoreboard scoreboard = this.clientWorldController.getScoreboard();
if (packetIn.func_149338_e() == 0) {
ScoreObjective scoreobjective = scoreboard.addScoreObjective(packetIn.func_149339_c(),
IScoreObjectiveCriteria.DUMMY);
scoreobjective.setDisplayName(packetIn.func_149337_d());
scoreobjective.setRenderType(packetIn.func_179817_d());
} else {
ScoreObjective scoreobjective1 = scoreboard.getObjective(packetIn.func_149339_c());
if (packetIn.func_149338_e() == 1) {
scoreboard.removeObjective(scoreobjective1);
} else if (packetIn.func_149338_e() == 2) {
scoreobjective1.setDisplayName(packetIn.func_149337_d());
scoreobjective1.setRenderType(packetIn.func_179817_d());
}
}
}
示例5: addToPlayerScore
import net.minecraft.scoreboard.IScoreObjectiveCriteria; //导入依赖的package包/类
public void addToPlayerScore(Entity p_70084_1_, int p_70084_2_)
{
addScore(p_70084_2_);
Collection collection = getWorldScoreboard().func_96520_a(IScoreObjectiveCriteria.totalKillCount);
if ((p_70084_1_ instanceof EntityPlayer))
{
addStat(StatList.playerKillsStat, 1);
collection.addAll(getWorldScoreboard().func_96520_a(IScoreObjectiveCriteria.playerKillCount));
}
else
{
addStat(StatList.mobKillsStat, 1);
}
Iterator iterator = collection.iterator();
while (iterator.hasNext())
{
ScoreObjective scoreobjective = (ScoreObjective)iterator.next();
Score score = getWorldScoreboard().func_96529_a(getCommandSenderName(), scoreobjective);
score.func_96648_a();
}
}
示例6: addToPlayerScore
import net.minecraft.scoreboard.IScoreObjectiveCriteria; //导入依赖的package包/类
/**
* Adds a value to the player score. Currently not actually used and the entity passed in does nothing. Args:
* entity, scoreToAdd
*/
public void addToPlayerScore(Entity par1Entity, int par2)
{
this.addScore(par2);
Collection var3 = this.getWorldScoreboard().func_96520_a(IScoreObjectiveCriteria.totalKillCount);
if (par1Entity instanceof EntityPlayer)
{
this.addStat(StatList.playerKillsStat, 1);
var3.addAll(this.getWorldScoreboard().func_96520_a(IScoreObjectiveCriteria.playerKillCount));
}
else
{
this.addStat(StatList.mobKillsStat, 1);
}
Iterator var4 = var3.iterator();
while (var4.hasNext())
{
ScoreObjective var5 = (ScoreObjective)var4.next();
Score var6 = this.getWorldScoreboard().func_96529_a(this.getCommandSenderName(), var5);
var6.func_96648_a();
}
}
示例7: handleScoreboardObjective
import net.minecraft.scoreboard.IScoreObjectiveCriteria; //导入依赖的package包/类
/**
* May create a scoreboard objective, remove an objective from the scoreboard or update an objectives' displayname
*/
public void handleScoreboardObjective(S3BPacketScoreboardObjective p_147291_1_)
{
Scoreboard var2 = this.clientWorldController.getScoreboard();
ScoreObjective var3;
if (p_147291_1_.func_149338_e() == 0)
{
var3 = var2.addScoreObjective(p_147291_1_.func_149339_c(), IScoreObjectiveCriteria.field_96641_b);
var3.setDisplayName(p_147291_1_.func_149337_d());
}
else
{
var3 = var2.getObjective(p_147291_1_.func_149339_c());
if (p_147291_1_.func_149338_e() == 1)
{
var2.func_96519_k(var3);
}
else if (p_147291_1_.func_149338_e() == 2)
{
var3.setDisplayName(p_147291_1_.func_149337_d());
}
}
}
示例8: addToPlayerScore
import net.minecraft.scoreboard.IScoreObjectiveCriteria; //导入依赖的package包/类
public void addToPlayerScore(Entity p_70084_1_, int p_70084_2_)
{
this.addScore(p_70084_2_);
// CraftBukkit - Get our scores instead
Collection<Score> collection = this.worldObj.getServer().getScoreboardManager().getScoreboardScores(IScoreObjectiveCriteria.totalKillCount, this.getCommandSenderName(), new java.util.ArrayList<Score>());
if (p_70084_1_ instanceof EntityPlayer)
{
this.addStat(StatList.playerKillsStat, 1);
// CraftBukkit - Get our scores instead
this.worldObj.getServer().getScoreboardManager().getScoreboardScores(IScoreObjectiveCriteria.playerKillCount, this.getCommandSenderName(), collection);
}
else
{
this.addStat(StatList.mobKillsStat, 1);
}
Iterator iterator = collection.iterator();
while (iterator.hasNext())
{
Score score = (Score) iterator.next(); // CraftBukkit - Use our scores instead
score.func_96648_a();
}
}
示例9: handleScoreboardObjective
import net.minecraft.scoreboard.IScoreObjectiveCriteria; //导入依赖的package包/类
public void handleScoreboardObjective(S3BPacketScoreboardObjective p_147291_1_)
{
Scoreboard scoreboard = this.clientWorldController.getScoreboard();
ScoreObjective scoreobjective;
if (p_147291_1_.func_149338_e() == 0)
{
scoreobjective = scoreboard.addScoreObjective(p_147291_1_.func_149339_c(), IScoreObjectiveCriteria.field_96641_b);
scoreobjective.setDisplayName(p_147291_1_.func_149337_d());
}
else
{
scoreobjective = scoreboard.getObjective(p_147291_1_.func_149339_c());
if (p_147291_1_.func_149338_e() == 1)
{
scoreboard.func_96519_k(scoreobjective);
}
else if (p_147291_1_.func_149338_e() == 2)
{
scoreobjective.setDisplayName(p_147291_1_.func_149337_d());
}
}
}
示例10: addToPlayerScore
import net.minecraft.scoreboard.IScoreObjectiveCriteria; //导入依赖的package包/类
public void addToPlayerScore(Entity p_70084_1_, int p_70084_2_)
{
this.addScore(p_70084_2_);
Collection collection = this.getWorldScoreboard().func_96520_a(IScoreObjectiveCriteria.totalKillCount);
if (p_70084_1_ instanceof EntityPlayer)
{
this.addStat(StatList.playerKillsStat, 1);
collection.addAll(this.getWorldScoreboard().func_96520_a(IScoreObjectiveCriteria.playerKillCount));
}
else
{
this.addStat(StatList.mobKillsStat, 1);
}
Iterator iterator = collection.iterator();
while (iterator.hasNext())
{
ScoreObjective scoreobjective = (ScoreObjective)iterator.next();
Score score = this.getWorldScoreboard().func_96529_a(this.getCommandSenderName(), scoreobjective);
score.func_96648_a();
}
}
示例11: getOrCreateObjective
import net.minecraft.scoreboard.IScoreObjectiveCriteria; //导入依赖的package包/类
@Nonnull
@Override
public Objective getOrCreateObjective(@Nonnull String id) {
Checks.notNull(id, "Id may not be null");
Checks.check(id.length() <= 16, "Id must not be longer than 16");
NailedObjective objective = objectivesById.get(id);
if(objective == null){
objective = new NailedObjective(id, this);
this.objectives.add(objective);
this.objectivesById.put(id, objective);
S3BPacketScoreboardObjective packet = new S3BPacketScoreboardObjective();
packet.objectiveName = objective.getId();
packet.objectiveValue = objective.getDisplayName();
packet.field_149342_c = 0; //0 = Create
packet.type = IScoreObjectiveCriteria.EnumRenderType.INTEGER; //TODO: config option
this.sendPacket(packet);
}
return objective;
}
示例12: func_175137_e
import net.minecraft.scoreboard.IScoreObjectiveCriteria; //导入依赖的package包/类
private Collection<ScoreObjective> func_175137_e(Entity p_175137_1_)
{
ScorePlayerTeam scoreplayerteam = this.getWorldScoreboard().getPlayersTeam(this.getName());
if (scoreplayerteam != null)
{
int i = scoreplayerteam.getChatFormat().getColorIndex();
if (i >= 0 && i < IScoreObjectiveCriteria.field_178793_i.length)
{
for (ScoreObjective scoreobjective : this.getWorldScoreboard().getObjectivesFromCriteria(IScoreObjectiveCriteria.field_178793_i[i]))
{
Score score = this.getWorldScoreboard().getValueFromObjective(p_175137_1_.getName(), scoreobjective);
score.func_96648_a();
}
}
}
ScorePlayerTeam scoreplayerteam1 = this.getWorldScoreboard().getPlayersTeam(p_175137_1_.getName());
if (scoreplayerteam1 != null)
{
int j = scoreplayerteam1.getChatFormat().getColorIndex();
if (j >= 0 && j < IScoreObjectiveCriteria.field_178792_h.length)
{
return this.getWorldScoreboard().getObjectivesFromCriteria(IScoreObjectiveCriteria.field_178792_h[j]);
}
}
return Lists.<ScoreObjective>newArrayList();
}
示例13: readPacketData
import net.minecraft.scoreboard.IScoreObjectiveCriteria; //导入依赖的package包/类
/**
* Reads the raw packet data from the data stream.
*/
public void readPacketData(PacketBuffer buf) throws IOException
{
this.objectiveName = buf.readStringFromBuffer(16);
this.field_149342_c = buf.readByte();
if (this.field_149342_c == 0 || this.field_149342_c == 2)
{
this.objectiveValue = buf.readStringFromBuffer(32);
this.type = IScoreObjectiveCriteria.EnumRenderType.func_178795_a(buf.readStringFromBuffer(16));
}
}
示例14: StatBase
import net.minecraft.scoreboard.IScoreObjectiveCriteria; //导入依赖的package包/类
public StatBase(String statIdIn, IChatComponent statNameIn, IStatType typeIn)
{
this.statId = statIdIn;
this.statName = statNameIn;
this.type = typeIn;
this.field_150957_c = new ObjectiveStat(this);
IScoreObjectiveCriteria.INSTANCES.put(this.field_150957_c.getName(), this.field_150957_c);
}
示例15: StatCrafting
import net.minecraft.scoreboard.IScoreObjectiveCriteria; //导入依赖的package包/类
public StatCrafting(String p_i45910_1_, String p_i45910_2_, IChatComponent statNameIn, Item p_i45910_4_)
{
super(p_i45910_1_ + p_i45910_2_, statNameIn);
this.field_150960_a = p_i45910_4_;
int i = Item.getIdFromItem(p_i45910_4_);
if (i != 0)
{
IScoreObjectiveCriteria.INSTANCES.put(p_i45910_1_ + i, this.func_150952_k());
}
}