本文整理汇总了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);
}
}
示例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);
}
}
示例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);
}
}
}
示例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));
}
}
}
示例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);
}
}
}
示例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);
}
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
}
示例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);
}
}
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
示例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;
}
}