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


Java AchievementList類代碼示例

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


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

示例1: onDeath

import net.minecraft.stats.AchievementList; //導入依賴的package包/類
/**
 * Called when the mob's health reaches 0.
 */
public void onDeath(DamageSource cause)
{
    super.onDeath(cause);

    if (cause.getSourceOfDamage() instanceof EntityArrow && cause.getEntity() instanceof EntityPlayer)
    {
        EntityPlayer entityplayer = (EntityPlayer)cause.getEntity();
        double d0 = entityplayer.posX - this.posX;
        double d1 = entityplayer.posZ - this.posZ;

        if (d0 * d0 + d1 * d1 >= 2500.0D)
        {
            entityplayer.triggerAchievement(AchievementList.snipeSkeleton);
        }
    }
    else if (cause.getEntity() instanceof EntityCreeper && ((EntityCreeper)cause.getEntity()).getPowered() && ((EntityCreeper)cause.getEntity()).isAIEnabled())
    {
        ((EntityCreeper)cause.getEntity()).func_175493_co();
        this.entityDropItem(new ItemStack(Items.skull, 1, this.getSkeletonType() == 1 ? 1 : 0), 0.0F);
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:25,代碼來源:EntitySkeleton.java

示例2: attackEntityFrom

import net.minecraft.stats.AchievementList; //導入依賴的package包/類
/**
 * Called when the entity is attacked.
 */
public boolean attackEntityFrom(DamageSource source, float amount)
{
    if (this.isEntityInvulnerable(source))
    {
        return false;
    }
    else if ("fireball".equals(source.getDamageType()) && source.getEntity() instanceof EntityPlayer)
    {
        super.attackEntityFrom(source, 1000.0F);
        ((EntityPlayer)source.getEntity()).triggerAchievement(AchievementList.ghast);
        return true;
    }
    else
    {
        return super.attackEntityFrom(source, amount);
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:21,代碼來源:EntityGhast.java

示例3: dropFewItems

import net.minecraft.stats.AchievementList; //導入依賴的package包/類
/**
 * Drop 0-2 items of this living's type
 */
protected void dropFewItems(boolean p_70628_1_, int p_70628_2_)
{
    EntityItem entityitem = this.dropItem(Items.nether_star, 1);

    if (entityitem != null)
    {
        entityitem.setNoDespawn();
    }

    if (!this.worldObj.isRemote)
    {
        for (EntityPlayer entityplayer : this.worldObj.getEntitiesWithinAABB(EntityPlayer.class, this.getEntityBoundingBox().expand(50.0D, 100.0D, 50.0D)))
        {
            entityplayer.triggerAchievement(AchievementList.killWither);
        }
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:21,代碼來源:EntityWither.java

示例4: onFoodEaten

import net.minecraft.stats.AchievementList; //導入依賴的package包/類
protected void onFoodEaten(ItemStack stack, World worldIn, EntityPlayer player)
{
    if (!worldIn.isRemote)
    {
        if (stack.getMetadata() > 0)
        {
            player.addStat(AchievementList.OVERPOWERED);
            player.addPotionEffect(new PotionEffect(MobEffects.REGENERATION, 400, 1));
            player.addPotionEffect(new PotionEffect(MobEffects.RESISTANCE, 6000, 0));
            player.addPotionEffect(new PotionEffect(MobEffects.FIRE_RESISTANCE, 6000, 0));
            player.addPotionEffect(new PotionEffect(MobEffects.ABSORPTION, 2400, 3));
        }
        else
        {
            player.addPotionEffect(new PotionEffect(MobEffects.REGENERATION, 100, 1));
            player.addPotionEffect(new PotionEffect(MobEffects.ABSORPTION, 2400, 0));
        }
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:20,代碼來源:ItemAppleGold.java

示例5: onDeath

import net.minecraft.stats.AchievementList; //導入依賴的package包/類
/**
 * Called when the mob's health reaches 0.
 */
public void onDeath(DamageSource cause)
{
    super.onDeath(cause);

    if (cause.getSourceOfDamage() instanceof EntityArrow && cause.getEntity() instanceof EntityPlayer)
    {
        EntityPlayer entityplayer = (EntityPlayer)cause.getEntity();
        double d0 = entityplayer.posX - this.posX;
        double d1 = entityplayer.posZ - this.posZ;

        if (d0 * d0 + d1 * d1 >= 2500.0D)
        {
            entityplayer.addStat(AchievementList.SNIPE_SKELETON);
        }
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:20,代碼來源:AbstractSkeleton.java

示例6: dropFewItems

import net.minecraft.stats.AchievementList; //導入依賴的package包/類
/**
 * Drop 0-2 items of this living's type
 */
protected void dropFewItems(boolean wasRecentlyHit, int lootingModifier)
{
    EntityItem entityitem = this.dropItem(Items.NETHER_STAR, 1);

    if (entityitem != null)
    {
        entityitem.setNoDespawn();
    }

    if (!this.world.isRemote)
    {
        for (EntityPlayer entityplayer : this.world.getEntitiesWithinAABB(EntityPlayer.class, this.getEntityBoundingBox().expand(50.0D, 100.0D, 50.0D)))
        {
            entityplayer.addStat(AchievementList.KILL_WITHER);
        }
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:21,代碼來源:EntityWither.java

示例7: getTabCompletionOptions

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

示例8: getTabCompletionOptions

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

示例9: onDeath

import net.minecraft.stats.AchievementList; //導入依賴的package包/類
/**
 * Called when the mob's health reaches 0.
 */
public void onDeath(DamageSource cause)
{
    super.onDeath(cause);

    if (cause.getSourceOfDamage() instanceof EntityArrow && cause.getEntity() instanceof EntityPlayer)
    {
        EntityPlayer entityplayer = (EntityPlayer)cause.getEntity();
        double d0 = entityplayer.posX - this.posX;
        double d1 = entityplayer.posZ - this.posZ;

        if (d0 * d0 + d1 * d1 >= 2500.0D)
        {
            entityplayer.addStat(AchievementList.SNIPE_SKELETON);
        }
    }
    else if (cause.getEntity() instanceof EntityCreeper && ((EntityCreeper)cause.getEntity()).getPowered() && ((EntityCreeper)cause.getEntity()).isAIEnabled())
    {
        ((EntityCreeper)cause.getEntity()).incrementDroppedSkulls();
        this.entityDropItem(new ItemStack(Items.SKULL, 1, this.getSkeletonType() == SkeletonType.WITHER ? 1 : 0), 0.0F);
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:25,代碼來源:EntitySkeleton.java

示例10: GuiAchievements

import net.minecraft.stats.AchievementList; //導入依賴的package包/類
public GuiAchievements(GuiScreen parentScreenIn, StatisticsManager statFileWriterIn)
{
    this.parentScreen = parentScreenIn;
    this.statFileWriter = statFileWriterIn;
    int i = 141;
    int j = 141;
    this.xScrollTarget = (double)(AchievementList.OPEN_INVENTORY.displayColumn * 24 - 70 - 12);
    this.xScrollO = this.xScrollTarget;
    this.xScrollP = this.xScrollTarget;
    this.yScrollTarget = (double)(AchievementList.OPEN_INVENTORY.displayRow * 24 - 70);
    this.yScrollO = this.yScrollTarget;
    this.yScrollP = this.yScrollTarget;
    minecraftAchievements.clear();
    for (Achievement achievement : AchievementList.ACHIEVEMENTS)
    {
        if (!net.minecraftforge.common.AchievementPage.isAchievementInPages(achievement))
        {
            minecraftAchievements.add(achievement);
        }
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:22,代碼來源:GuiAchievements.java

示例11: addMountedMovementStat

import net.minecraft.stats.AchievementList; //導入依賴的package包/類
/**
 * Adds a value to a mounted movement statistic field - by minecart, boat, or pig.
 */
private void addMountedMovementStat(double p_71015_1_, double p_71015_3_, double p_71015_5_)
{
    if (this.ridingEntity != null)
    {
        int i = Math.round(MathHelper.sqrt_double(p_71015_1_ * p_71015_1_ + p_71015_3_ * p_71015_3_ + p_71015_5_ * p_71015_5_) * 100.0F);

        if (i > 0)
        {
            if (this.ridingEntity instanceof EntityMinecart)
            {
                this.addStat(StatList.distanceByMinecartStat, i);

                if (this.startMinecartRidingCoordinate == null)
                {
                    this.startMinecartRidingCoordinate = new BlockPos(this);
                }
                else if (this.startMinecartRidingCoordinate.distanceSq((double)MathHelper.floor_double(this.posX), (double)MathHelper.floor_double(this.posY), (double)MathHelper.floor_double(this.posZ)) >= 1000000.0D)
                {
                    this.triggerAchievement(AchievementList.onARail);
                }
            }
            else if (this.ridingEntity instanceof EntityBoat)
            {
                this.addStat(StatList.distanceByBoatStat, i);
            }
            else if (this.ridingEntity instanceof EntityPig)
            {
                this.addStat(StatList.distanceByPigStat, i);
            }
            else if (this.ridingEntity instanceof EntityHorse)
            {
                this.addStat(StatList.distanceByHorseStat, i);
            }
        }
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:40,代碼來源:EntityPlayer.java

示例12: onKillEntity

import net.minecraft.stats.AchievementList; //導入依賴的package包/類
/**
 * This method gets called when the entity kills another one.
 */
public void onKillEntity(EntityLivingBase entityLivingIn)
{
    if (entityLivingIn instanceof IMob)
    {
        this.triggerAchievement(AchievementList.killEnemy);
    }

    EntityList.EntityEggInfo entitylist$entityegginfo = (EntityList.EntityEggInfo)EntityList.entityEggs.get(Integer.valueOf(EntityList.getEntityID(entityLivingIn)));

    if (entitylist$entityegginfo != null)
    {
        this.triggerAchievement(entitylist$entityegginfo.field_151512_d);
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:18,代碼來源:EntityPlayer.java

示例13: fall

import net.minecraft.stats.AchievementList; //導入依賴的package包/類
public void fall(float distance, float damageMultiplier)
{
    super.fall(distance, damageMultiplier);

    if (distance > 5.0F && this.riddenByEntity instanceof EntityPlayer)
    {
        ((EntityPlayer)this.riddenByEntity).triggerAchievement(AchievementList.flyPig);
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:10,代碼來源:EntityPig.java

示例14: onPickupFromSlot

import net.minecraft.stats.AchievementList; //導入依賴的package包/類
public void onPickupFromSlot(EntityPlayer playerIn, ItemStack stack)
{
    if (stack.getItem() == Items.potionitem && stack.getMetadata() > 0)
    {
        this.player.triggerAchievement(AchievementList.potion);
    }

    super.onPickupFromSlot(playerIn, stack);
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:10,代碼來源:ContainerBrewingStand.java

示例15: travelToDimension

import net.minecraft.stats.AchievementList; //導入依賴的package包/類
/**
 * Teleports the entity to another dimension. Params: Dimension number to teleport to
 */
public void travelToDimension(int dimensionId)
{
    if (this.dimension == 1 && dimensionId == 1)
    {
        this.triggerAchievement(AchievementList.theEnd2);
        this.worldObj.removeEntity(this);
        this.playerConqueredTheEnd = true;
        this.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(4, 0.0F));
    }
    else
    {
        if (this.dimension == 0 && dimensionId == 1)
        {
            this.triggerAchievement(AchievementList.theEnd);
            BlockPos blockpos = this.mcServer.worldServerForDimension(dimensionId).getSpawnCoordinate();

            if (blockpos != null)
            {
                this.playerNetServerHandler.setPlayerLocation((double)blockpos.getX(), (double)blockpos.getY(), (double)blockpos.getZ(), 0.0F, 0.0F);
            }

            dimensionId = 1;
        }
        else
        {
            this.triggerAchievement(AchievementList.portal);
        }

        this.mcServer.getConfigurationManager().transferPlayerToDimension(this, dimensionId);
        this.lastExperience = -1;
        this.lastHealth = -1.0F;
        this.lastFoodLevel = -1;
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:38,代碼來源:EntityPlayerMP.java


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