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


Java StatList類代碼示例

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


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

示例1: jump

import net.minecraft.stats.StatList; //導入依賴的package包/類
/**
 * Causes this entity to do an upwards motion (jumping).
 */
public void jump()
{
	if (this == Minecraft.getMinecraft().thePlayer)
	{
	    JumpEvent event = new JumpEvent();
	    event.call();

	    if (event.isCancelled()) return;
	}

    super.jump();
    this.triggerAchievement(StatList.jumpStat);

    if (this.isSprinting())
    {
        this.addExhaustion(0.8F);
    }
    else
    {
        this.addExhaustion(0.2F);
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:26,代碼來源:EntityPlayer.java

示例2: onItemRightClick

import net.minecraft.stats.StatList; //導入依賴的package包/類
/**
 * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
 */
public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn)
{
    if (!playerIn.capabilities.isCreativeMode)
    {
        --itemStackIn.stackSize;
    }

    worldIn.playSoundAtEntity(playerIn, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));

    if (!worldIn.isRemote)
    {
        worldIn.spawnEntityInWorld(new EntityExpBottle(worldIn, playerIn));
    }

    playerIn.triggerAchievement(StatList.objectUseStats[Item.getIdFromItem(this)]);
    return itemStackIn;
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:21,代碼來源:ItemExpBottle.java

示例3: onItemUseFinish

import net.minecraft.stats.StatList; //導入依賴的package包/類
/**
 * Called when the player finishes using this Item (E.g. finishes eating.). Not called when the player stops using
 * the Item before the action is complete.
 */
public ItemStack onItemUseFinish(ItemStack stack, World worldIn, EntityPlayer playerIn)
{
    if (!playerIn.capabilities.isCreativeMode)
    {
        --stack.stackSize;
    }

    if (!worldIn.isRemote)
    {
        playerIn.clearActivePotions();
    }

    playerIn.triggerAchievement(StatList.objectUseStats[Item.getIdFromItem(this)]);
    return stack.stackSize <= 0 ? new ItemStack(Items.bucket) : stack;
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:20,代碼來源:ItemBucketMilk.java

示例4: getChangeForSpawn

import net.minecraft.stats.StatList; //導入依賴的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

示例5: readPacketData

import net.minecraft.stats.StatList; //導入依賴的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:SkidJava,項目名稱:BaseClient,代碼行數:20,代碼來源:S37PacketStatistics.java

示例6: getMaterialStatistic

import net.minecraft.stats.StatList; //導入依賴的package包/類
public static net.minecraft.stats.StatBase getMaterialStatistic(org.bukkit.Statistic stat, Material material) {
    try {
        if (stat == Statistic.MINE_BLOCK) {
            return StatList.mineBlockStatArray[material.getId()];
        }
        if (stat == Statistic.CRAFT_ITEM) {
            return StatList.objectCraftStats[material.getId()];
        }
        if (stat == Statistic.USE_ITEM) {
            return StatList.objectUseStats[material.getId()];
        }
        if (stat == Statistic.BREAK_ITEM) {
            return StatList.objectBreakStats[material.getId()];
        }
    } catch (ArrayIndexOutOfBoundsException e) {
        return null;
    }
    return null;
}
 
開發者ID:UraniumMC,項目名稱:Uranium,代碼行數:20,代碼來源:CraftStatistic.java

示例7: onItemRightClick

import net.minecraft.stats.StatList; //導入依賴的package包/類
/**
 * Called when the equipped item is right clicked.
 */
@Override
public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn)
{
    ItemStack itemstack = playerIn.getHeldItem(handIn);
		itemstack.shrink(1);

    worldIn.playSound((EntityPlayer)null, playerIn.posX, playerIn.posY, playerIn.posZ, SoundEvents.ENTITY_EGG_THROW, SoundCategory.PLAYERS, 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));

    if (!worldIn.isRemote)
    {
    		EntityEgg entityegg = new CoreEntityEgg(worldIn, playerIn);
        entityegg.setHeadingFromThrower(playerIn, playerIn.rotationPitch, playerIn.rotationYaw, 0.0F, 1.5F, 1.0F);
        worldIn.spawnEntity(entityegg);
    }

    playerIn.addStat(StatList.getObjectUseStats(this));
    return new ActionResult(EnumActionResult.SUCCESS, itemstack);
}
 
開發者ID:hlgr360,項目名稱:SentinentAImod,代碼行數:22,代碼來源:CoreItemEgg.java

示例8: onItemRightClick

import net.minecraft.stats.StatList; //導入依賴的package包/類
public ActionResult<ItemStack> onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn, EnumHand hand)
{
    if (!playerIn.capabilities.isCreativeMode)
    {
        --itemStackIn.stackSize;
    }

    worldIn.playSound((EntityPlayer)null, playerIn.posX, playerIn.posY, playerIn.posZ, SoundEvents.ENTITY_ENDERPEARL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
    playerIn.getCooldownTracker().setCooldown(this, 20);

    if (!worldIn.isRemote)
    {
        EntityEnderPearl entityenderpearl = new EntityEnderPearl(worldIn, playerIn);
        entityenderpearl.setHeadingFromThrower(playerIn, playerIn.rotationPitch, playerIn.rotationYaw, 0.0F, 1.5F, 1.0F);
        worldIn.spawnEntityInWorld(entityenderpearl);
    }

    playerIn.addStat(StatList.getObjectUseStats(this));
    return new ActionResult(EnumActionResult.SUCCESS, itemStackIn);
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:21,代碼來源:ItemEnderPearl.java

示例9: eatCake

import net.minecraft.stats.StatList; //導入依賴的package包/類
private boolean eatCake(World worldIn, BlockPos pos, IBlockState state, EntityPlayer player)
{
    if (!player.canEat(false))
    {
        return false;
    }
    else
    {
        player.addStat(StatList.CAKE_SLICES_EATEN);
        player.getFoodStats().addStats(2, 0.1F);
        int i = ((Integer)state.getValue(BITES)).intValue();

        if (i < 6)
        {
            worldIn.setBlockState(pos, state.withProperty(BITES, Integer.valueOf(i + 1)), 3);
        }
        else
        {
            worldIn.setBlockToAir(pos);
        }

        return true;
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:25,代碼來源:BlockCake.java

示例10: addToPlayerScore

import net.minecraft.stats.StatList; //導入依賴的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();
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:27,代碼來源:EntityPlayer.java

示例11: onItemUseFinish

import net.minecraft.stats.StatList; //導入依賴的package包/類
/**
 * Called when the player finishes using this Item (E.g. finishes eating.). Not called when the player stops using
 * the Item before the action is complete.
 */
@Nullable
public ItemStack onItemUseFinish(ItemStack stack, World worldIn, EntityLivingBase entityLiving)
{
    if (entityLiving instanceof EntityPlayer && !((EntityPlayer)entityLiving).capabilities.isCreativeMode)
    {
        --stack.stackSize;
    }

    if (!worldIn.isRemote)
    {
        entityLiving.curePotionEffects(stack);
    }

    if (entityLiving instanceof EntityPlayer)
    {
        ((EntityPlayer)entityLiving).addStat(StatList.getObjectUseStats(this));
    }

    return stack.stackSize <= 0 ? new ItemStack(Items.BUCKET) : stack;
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:25,代碼來源:ItemBucketMilk.java

示例12: onItemRightClick

import net.minecraft.stats.StatList; //導入依賴的package包/類
public ActionResult<ItemStack> onItemRightClick(World itemStackIn, EntityPlayer worldIn, EnumHand playerIn)
{
    ItemStack itemstack = worldIn.getHeldItem(playerIn);
    ItemStack itemstack1 = worldIn.capabilities.isCreativeMode ? itemstack.copy() : itemstack.splitStack(1);
    itemStackIn.playSound((EntityPlayer)null, worldIn.posX, worldIn.posY, worldIn.posZ, SoundEvents.ENTITY_LINGERINGPOTION_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));

    if (!itemStackIn.isRemote)
    {
        EntityPotion entitypotion = new EntityPotion(itemStackIn, worldIn, itemstack1);
        entitypotion.setHeadingFromThrower(worldIn, worldIn.rotationPitch, worldIn.rotationYaw, -20.0F, 0.5F, 1.0F);
        itemStackIn.spawnEntityInWorld(entitypotion);
    }

    worldIn.addStat(StatList.getObjectUseStats(this));
    return new ActionResult(EnumActionResult.SUCCESS, itemstack);
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:17,代碼來源:ItemLingeringPotion.java

示例13: readPacketData

import net.minecraft.stats.StatList; //導入依賴的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:F1r3w477,項目名稱:CustomWorldGen,代碼行數:20,代碼來源:SPacketStatistics.java

示例14: onItemRightClick

import net.minecraft.stats.StatList; //導入依賴的package包/類
public ActionResult<ItemStack> onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn, EnumHand hand)
{
    if (!playerIn.capabilities.isCreativeMode)
    {
        --itemStackIn.stackSize;
    }

    worldIn.playSound((EntityPlayer)null, playerIn.posX, playerIn.posY, playerIn.posZ, SoundEvents.ENTITY_SPLASH_POTION_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));

    if (!worldIn.isRemote)
    {
        EntityPotion entitypotion = new EntityPotion(worldIn, playerIn, itemStackIn);
        entitypotion.setHeadingFromThrower(playerIn, playerIn.rotationPitch, playerIn.rotationYaw, -20.0F, 0.5F, 1.0F);
        worldIn.spawnEntityInWorld(entitypotion);
    }

    playerIn.addStat(StatList.getObjectUseStats(this));
    return new ActionResult(EnumActionResult.SUCCESS, itemStackIn);
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:20,代碼來源:ItemSplashPotion.java

示例15: onItemRightClick

import net.minecraft.stats.StatList; //導入依賴的package包/類
/**
 * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
 */
public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn)
{
    if (playerIn.capabilities.isCreativeMode)
    {
        return itemStackIn;
    }
    else
    {
        --itemStackIn.stackSize;
        worldIn.playSoundAtEntity(playerIn, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));

        if (!worldIn.isRemote)
        {
            worldIn.spawnEntityInWorld(new EntityEnderPearl(worldIn, playerIn));
        }

        playerIn.triggerAchievement(StatList.objectUseStats[Item.getIdFromItem(this)]);
        return itemStackIn;
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:24,代碼來源:ItemEnderPearl.java


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