當前位置: 首頁>>代碼示例>>Java>>正文


Java StatBase類代碼示例

本文整理匯總了Java中net.minecraft.stats.StatBase的典型用法代碼示例。如果您正苦於以下問題:Java StatBase類的具體用法?Java StatBase怎麽用?Java StatBase使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


StatBase類屬於net.minecraft.stats包,在下文中一共展示了StatBase類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getChangeForSpawn

import net.minecraft.stats.StatBase; //導入依賴的package包/類
@Override
public int getChangeForSpawn(SpawnEventDetails details) {

    int brokenBlocks = PlayerAreaStatAccumulator.getStatForPlayersInArea(type,details.entity,128,(player)->{
        int accum = 0;
        for(StatBase brokenStat : StatList.MINE_BLOCK_STATS) {
            accum+=player.getStatFile().readStat(brokenStat);
        }
        return accum;
    });

    int contribution = (int)(((double)brokenBlocks * difficultyPerHundredBlocks) / 100);

    if(maxAddedDifficulty>=0){
        contribution = Math.min(contribution,maxAddedDifficulty);
    }

    return contribution;
}
 
開發者ID:talandar,項目名稱:ProgressiveDifficulty,代碼行數:20,代碼來源:BlocksBrokenControl.java

示例2: addStat

import net.minecraft.stats.StatBase; //導入依賴的package包/類
/**
 * Adds a value to a statistic field.
 */
public void addStat(StatBase stat, int amount)
{
    if (stat != null)
    {
        this.statsFile.increaseStat(this, stat, amount);

        for (ScoreObjective scoreobjective : this.getWorldScoreboard().getObjectivesFromCriteria(stat.func_150952_k()))
        {
            this.getWorldScoreboard().getValueFromObjective(this.getName(), scoreobjective).increseScore(amount);
        }

        if (this.statsFile.func_150879_e())
        {
            this.statsFile.func_150876_a(this);
        }
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:21,代碼來源:EntityPlayerMP.java

示例3: func_175145_a

import net.minecraft.stats.StatBase; //導入依賴的package包/類
public void func_175145_a(StatBase p_175145_1_)
{
    if (p_175145_1_ != null)
    {
        this.statsFile.unlockAchievement(this, p_175145_1_, 0);

        for (ScoreObjective scoreobjective : this.getWorldScoreboard().getObjectivesFromCriteria(p_175145_1_.func_150952_k()))
        {
            this.getWorldScoreboard().getValueFromObjective(this.getName(), scoreobjective).setScorePoints(0);
        }

        if (this.statsFile.func_150879_e())
        {
            this.statsFile.func_150876_a(this);
        }
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:18,代碼來源:EntityPlayerMP.java

示例4: readPacketData

import net.minecraft.stats.StatBase; //導入依賴的package包/類
/**
 * Reads the raw packet data from the data stream.
 */
public void readPacketData(PacketBuffer buf) throws IOException
{
    int i = buf.readVarIntFromBuffer();
    this.field_148976_a = Maps.<StatBase, Integer>newHashMap();

    for (int j = 0; j < i; ++j)
    {
        StatBase statbase = StatList.getOneShotStat(buf.readStringFromBuffer(32767));
        int k = buf.readVarIntFromBuffer();

        if (statbase != null)
        {
            this.field_148976_a.put(statbase, Integer.valueOf(k));
        }
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:20,代碼來源:S37PacketStatistics.java

示例5: addTabCompletionOptions

import net.minecraft.stats.StatBase; //導入依賴的package包/類
public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos)
{
    if (args.length == 1)
    {
        return getListOfStringsMatchingLastWord(args, new String[] {"give", "take"});
    }
    else if (args.length != 2)
    {
        return args.length == 3 ? getListOfStringsMatchingLastWord(args, MinecraftServer.getServer().getAllUsernames()) : null;
    }
    else
    {
        List<String> list = Lists.<String>newArrayList();

        for (StatBase statbase : StatList.allStats)
        {
            list.add(statbase.statId);
        }

        return getListOfStringsMatchingLastWord(args, list);
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:23,代碼來源:CommandAchievement.java

示例6: getTabCompletionOptions

import net.minecraft.stats.StatBase; //導入依賴的package包/類
public List<String> getTabCompletionOptions(MinecraftServer server, ICommandSender sender, String[] args, @Nullable BlockPos pos)
{
    if (args.length == 1)
    {
        /**
         * Returns a List of strings (chosen from the given strings) which the last word in the given string array
         * is a beginning-match for. (Tab completion).
         */
        return getListOfStringsMatchingLastWord(args, new String[] {"give", "take"});
    }
    else if (args.length != 2)
    {
        return args.length == 3 ? getListOfStringsMatchingLastWord(args, server.getAllUsernames()) : Collections.<String>emptyList();
    }
    else
    {
        List<String> list = Lists.<String>newArrayList();

        for (StatBase statbase : AchievementList.ACHIEVEMENTS)
        {
            list.add(statbase.statId);
        }

        return getListOfStringsMatchingLastWord(args, list);
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:27,代碼來源:CommandAchievement.java

示例7: buildAchievementStats

import net.minecraft.stats.StatBase; //導入依賴的package包/類
/** Builds the basic achievement world data to be used as observation signals by the listener.
 * @param json a JSON object into which the achievement stats will be added.
 */
public static void buildAchievementStats(JsonObject json, EntityPlayerMP player)
{
    StatFileWriter sfw = player.getStatFile();
    json.addProperty("DistanceTravelled", 
            sfw.readStat((StatBase)StatList.distanceWalkedStat) 
            + sfw.readStat((StatBase)StatList.distanceSwumStat) 
            + sfw.readStat((StatBase)StatList.distanceDoveStat) 
            + sfw.readStat((StatBase)StatList.distanceFallenStat) 
            ); // TODO: there are many other ways of moving!
    json.addProperty("TimeAlive", sfw.readStat((StatBase)StatList.timeSinceDeathStat));
    json.addProperty("MobsKilled", sfw.readStat((StatBase)StatList.mobKillsStat));
    json.addProperty("PlayersKilled", sfw.readStat((StatBase)StatList.playerKillsStat));
    json.addProperty("DamageTaken", sfw.readStat((StatBase)StatList.damageTakenStat));

    /* Other potential reinforcement signals that may be worth researching:
    json.addProperty("BlocksDestroyed", sfw.readStat((StatBase)StatList.objectBreakStats) - but objectBreakStats is an array of 32000 StatBase objects - indexed by block type.);
    json.addProperty("Blocked", ev.player.isMovementBlocked()) - but isMovementBlocker() is a protected method (can get round this with reflection)
    */
}
 
開發者ID:Yarichi,項目名稱:Proyecto-DASI,代碼行數:23,代碼來源:JSONWorldDataHelper.java

示例8: addStat

import net.minecraft.stats.StatBase; //導入依賴的package包/類
/**
 * Adds a value to a statistic field.
 */
public void addStat(StatBase stat, int amount)
{
    if (stat != null)
    {
        this.statsFile.increaseStat(this, stat, amount);

        for (ScoreObjective scoreobjective : this.getWorldScoreboard().getObjectivesFromCriteria(stat.getCriteria()))
        {
            this.getWorldScoreboard().getOrCreateScore(this.getName(), scoreobjective).increaseScore(amount);
        }

        if (this.statsFile.hasUnsentAchievement())
        {
            this.statsFile.sendStats(this);
        }
    }
}
 
開發者ID:NSExceptional,項目名稱:Zombe-Modpack,代碼行數:21,代碼來源:EntityPlayerMP.java

示例9: takeStat

import net.minecraft.stats.StatBase; //導入依賴的package包/類
public void takeStat(StatBase stat)
{
    if (stat != null)
    {
        this.statsFile.unlockAchievement(this, stat, 0);

        for (ScoreObjective scoreobjective : this.getWorldScoreboard().getObjectivesFromCriteria(stat.getCriteria()))
        {
            this.getWorldScoreboard().getOrCreateScore(this.getName(), scoreobjective).setScorePoints(0);
        }

        if (this.statsFile.hasUnsentAchievement())
        {
            this.statsFile.sendStats(this);
        }
    }
}
 
開發者ID:NSExceptional,項目名稱:Zombe-Modpack,代碼行數:18,代碼來源:EntityPlayerMP.java

示例10: readPacketData

import net.minecraft.stats.StatBase; //導入依賴的package包/類
/**
 * Reads the raw packet data from the data stream.
 */
public void readPacketData(PacketBuffer buf) throws IOException
{
    int i = buf.readVarIntFromBuffer();
    this.statisticMap = Maps.<StatBase, Integer>newHashMap();

    for (int j = 0; j < i; ++j)
    {
        StatBase statbase = StatList.getOneShotStat(buf.readStringFromBuffer(32767));
        int k = buf.readVarIntFromBuffer();

        if (statbase != null)
        {
            this.statisticMap.put(statbase, Integer.valueOf(k));
        }
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:20,代碼來源:SPacketStatistics.java

示例11: getTabCompletionOptions

import net.minecraft.stats.StatBase; //導入依賴的package包/類
public List<String> getTabCompletionOptions(MinecraftServer server, ICommandSender sender, String[] args, @Nullable BlockPos pos)
{
    if (args.length == 1)
    {
        return getListOfStringsMatchingLastWord(args, new String[] {"give", "take"});
    }
    else if (args.length != 2)
    {
        return args.length == 3 ? getListOfStringsMatchingLastWord(args, server.getAllUsernames()) : Collections.<String>emptyList();
    }
    else
    {
        List<String> list = Lists.<String>newArrayList();

        for (StatBase statbase : AchievementList.ACHIEVEMENTS)
        {
            list.add(statbase.statId);
        }

        return getListOfStringsMatchingLastWord(args, list);
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:23,代碼來源:CommandAchievement.java

示例12: addStat

import net.minecraft.stats.StatBase; //導入依賴的package包/類
/**
 * Adds a value to a statistic field.
 */
public void addStat(StatBase stat, int amount)
{
    if (stat != null)
    {
        if (stat.isAchievement() && net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.player.AchievementEvent(this, (net.minecraft.stats.Achievement) stat))) return;
        this.statsFile.increaseStat(this, stat, amount);

        for (ScoreObjective scoreobjective : this.getWorldScoreboard().getObjectivesFromCriteria(stat.getCriteria()))
        {
            this.getWorldScoreboard().getOrCreateScore(this.getName(), scoreobjective).increaseScore(amount);
        }

        if (this.statsFile.hasUnsentAchievement())
        {
            this.statsFile.sendStats(this);
        }
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:22,代碼來源:EntityPlayerMP.java

示例13: getStatForPlayersInArea

import net.minecraft.stats.StatBase; //導入依賴的package包/類
public static int getStatForPlayersInArea(MultiplePlayerCombineType type, StatBase stat, EntityLiving entity, int radius) {
    return getStatForPlayersInArea(type,entity,radius, (player)->{
        try {
            return player.getStatFile().readStat(stat);
        }catch(Exception e){
            //catch a case where the stat is not defined
            return 0;
        }
    });
}
 
開發者ID:talandar,項目名稱:ProgressiveDifficulty,代碼行數:11,代碼來源:PlayerAreaStatAccumulator.java

示例14: drawSlot

import net.minecraft.stats.StatBase; //導入依賴的package包/類
protected void drawSlot(int entryID, int insideLeft, int yPos, int insideSlotHeight, int mouseXIn, int mouseYIn)
{
    StatBase statbase = (StatBase)StatList.BASIC_STATS.get(entryID);
    GuiStats.this.drawString(GuiStats.this.fontRendererObj, statbase.getStatName().getUnformattedText(), insideLeft + 2, yPos + 1, entryID % 2 == 0 ? 16777215 : 9474192);
    String s = statbase.format(GuiStats.this.stats.readStat(statbase));
    GuiStats.this.drawString(GuiStats.this.fontRendererObj, s, insideLeft + 2 + 213 - GuiStats.this.fontRendererObj.getStringWidth(s), yPos + 1, entryID % 2 == 0 ? 16777215 : 9474192);
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:8,代碼來源:GuiStats.java

示例15: writePacketData

import net.minecraft.stats.StatBase; //導入依賴的package包/類
/**
 * Writes the raw packet data to the data stream.
 */
public void writePacketData(PacketBuffer buf) throws IOException
{
    buf.writeVarIntToBuffer(this.field_148976_a.size());

    for (Entry<StatBase, Integer> entry : this.field_148976_a.entrySet())
    {
        buf.writeString(((StatBase)entry.getKey()).statId);
        buf.writeVarIntToBuffer(((Integer)entry.getValue()).intValue());
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:14,代碼來源:S37PacketStatistics.java


注:本文中的net.minecraft.stats.StatBase類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。