本文整理汇总了Java中net.minecraft.entity.player.EntityPlayer.triggerAchievement方法的典型用法代码示例。如果您正苦于以下问题:Java EntityPlayer.triggerAchievement方法的具体用法?Java EntityPlayer.triggerAchievement怎么用?Java EntityPlayer.triggerAchievement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.entity.player.EntityPlayer
的用法示例。
在下文中一共展示了EntityPlayer.triggerAchievement方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: eatCake
import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
private void eatCake(World worldIn, BlockPos pos, IBlockState state, EntityPlayer player)
{
if (player.canEat(false))
{
player.triggerAchievement(StatList.field_181724_H);
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);
}
}
}
示例2: onBlockActivated
import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ)
{
if (worldIn.isRemote)
{
return true;
}
else
{
TileEntity tileentity = worldIn.getTileEntity(pos);
if (tileentity instanceof TileEntityHopper)
{
playerIn.displayGUIChest((TileEntityHopper)tileentity);
playerIn.triggerAchievement(StatList.field_181732_P);
}
return true;
}
}
示例3: onItemRightClick
import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的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 (isSplash(itemStackIn.getMetadata()))
{
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 EntityPotion(worldIn, playerIn, itemStackIn));
}
playerIn.triggerAchievement(StatList.objectUseStats[Item.getIdFromItem(this)]);
return itemStackIn;
}
else
{
playerIn.setItemInUse(itemStackIn, this.getMaxItemUseDuration(itemStackIn));
return itemStackIn;
}
}
示例4: onItemRightClick
import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的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.fishEntity != null)
{
int i = playerIn.fishEntity.handleHookRetraction();
itemStackIn.damageItem(i, playerIn);
playerIn.swingItem();
}
else
{
worldIn.playSoundAtEntity(playerIn, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
if (!worldIn.isRemote)
{
worldIn.spawnEntityInWorld(new EntityFishHook(worldIn, playerIn));
}
playerIn.swingItem();
playerIn.triggerAchievement(StatList.objectUseStats[Item.getIdFromItem(this)]);
}
return itemStackIn;
}
示例5: dropFewItems
import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的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);
}
}
}
示例6: onBlockActivated
import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ)
{
if (worldIn.isRemote)
{
return true;
}
else
{
TileEntity tileentity = worldIn.getTileEntity(pos);
if (tileentity instanceof TileEntityFurnace)
{
playerIn.displayGUIChest((TileEntityFurnace)tileentity);
playerIn.triggerAchievement(StatList.field_181741_Y);
}
return true;
}
}
示例7: onBlockActivated
import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ)
{
if (worldIn.isRemote)
{
return true;
}
else
{
TileEntity tileentity = worldIn.getTileEntity(pos);
if (tileentity instanceof TileEntityNote)
{
TileEntityNote tileentitynote = (TileEntityNote)tileentity;
tileentitynote.changePitch();
tileentitynote.triggerNote(worldIn, pos);
playerIn.triggerAchievement(StatList.field_181735_S);
}
return true;
}
}
示例8: onBlockActivated
import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ)
{
if (worldIn.isRemote)
{
return true;
}
else
{
TileEntity tileentity = worldIn.getTileEntity(pos);
if (tileentity instanceof TileEntityBeacon)
{
playerIn.displayGUIChest((TileEntityBeacon)tileentity);
playerIn.triggerAchievement(StatList.field_181730_N);
}
return true;
}
}
示例9: onItemRightClick
import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的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)
{
ItemStack itemstack = new ItemStack(Items.filled_map, 1, worldIn.getUniqueDataId("map"));
String s = "map_" + itemstack.getMetadata();
MapData mapdata = new MapData(s);
worldIn.setItemData(s, mapdata);
mapdata.scale = 0;
mapdata.calculateMapCenter(playerIn.posX, playerIn.posZ, mapdata.scale);
mapdata.dimension = (byte)worldIn.provider.getDimensionId();
mapdata.markDirty();
--itemStackIn.stackSize;
if (itemStackIn.stackSize <= 0)
{
return itemstack;
}
else
{
if (!playerIn.inventory.addItemStackToInventory(itemstack.copy()))
{
playerIn.dropPlayerItemWithRandomChoice(itemstack, false);
}
playerIn.triggerAchievement(StatList.objectUseStats[Item.getIdFromItem(this)]);
return itemStackIn;
}
}
示例10: onBlockActivated
import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ)
{
if (worldIn.isRemote)
{
return true;
}
else
{
TileEntity tileentity = worldIn.getTileEntity(pos);
if (tileentity instanceof TileEntityDispenser)
{
playerIn.displayGUIChest((TileEntityDispenser)tileentity);
if (tileentity instanceof TileEntityDropper)
{
playerIn.triggerAchievement(StatList.field_181731_O);
}
else
{
playerIn.triggerAchievement(StatList.field_181733_Q);
}
}
return true;
}
}
示例11: harvestBlock
import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te)
{
if (!worldIn.isRemote && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == Items.shears)
{
player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]);
spawnAsEntity(worldIn, pos, new ItemStack(Item.getItemFromBlock(this), 1, ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata() - 4));
}
else
{
super.harvestBlock(worldIn, player, pos, state, te);
}
}
示例12: onBlockActivated
import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ)
{
InventoryEnderChest inventoryenderchest = playerIn.getInventoryEnderChest();
TileEntity tileentity = worldIn.getTileEntity(pos);
if (inventoryenderchest != null && tileentity instanceof TileEntityEnderChest)
{
if (worldIn.getBlockState(pos.up()).getBlock().isNormalCube())
{
return true;
}
else if (worldIn.isRemote)
{
return true;
}
else
{
inventoryenderchest.setChestTileEntity((TileEntityEnderChest)tileentity);
playerIn.displayGUIChest(inventoryenderchest);
playerIn.triggerAchievement(StatList.field_181738_V);
return true;
}
}
else
{
return true;
}
}
示例13: onItemUseFinish
import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的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)
{
--stack.stackSize;
playerIn.getFoodStats().addStats(this, stack);
worldIn.playSoundAtEntity(playerIn, "random.burp", 0.5F, worldIn.rand.nextFloat() * 0.1F + 0.9F);
this.onFoodEaten(stack, worldIn, playerIn);
playerIn.triggerAchievement(StatList.objectUseStats[Item.getIdFromItem(this)]);
return stack;
}
示例14: onBlockDestroyed
import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
/**
* Called when a Block is destroyed using this ItemStack
*/
public void onBlockDestroyed(World worldIn, Block blockIn, BlockPos pos, EntityPlayer playerIn)
{
boolean flag = this.item.onBlockDestroyed(this, worldIn, blockIn, pos, playerIn);
if (flag)
{
playerIn.triggerAchievement(StatList.objectUseStats[Item.getIdFromItem(this.item)]);
}
}
示例15: onItemUse
import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
/**
* Called when the player uses this ItemStack on a Block (right-click). Places blocks, etc. (Legacy name:
* tryPlaceItemIntoWorld)
*/
public boolean onItemUse(EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ)
{
boolean flag = this.getItem().onItemUse(this, playerIn, worldIn, pos, side, hitX, hitY, hitZ);
if (flag)
{
playerIn.triggerAchievement(StatList.objectUseStats[Item.getIdFromItem(this.item)]);
}
return flag;
}