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