当前位置: 首页>>代码示例>>Java>>正文


Java EntityPlayer.triggerAchievement方法代码示例

本文整理汇总了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);
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:19,代码来源:BlockCake.java

示例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;
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:20,代码来源:BlockHopper.java

示例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;
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:29,代码来源:ItemPotion.java

示例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;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:27,代码来源:ItemFishingRod.java

示例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);
        }
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:21,代码来源:EntityWither.java

示例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;
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:20,代码来源:BlockFurnace.java

示例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;
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:22,代码来源:BlockNote.java

示例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;
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:20,代码来源:BlockBeacon.java

示例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;
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:31,代码来源:ItemEmptyMap.java

示例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;
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:28,代码来源:BlockDispenser.java

示例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);
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:13,代码来源:BlockNewLeaf.java

示例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;
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:29,代码来源:BlockEnderChest.java

示例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;
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:14,代码来源:ItemFood.java

示例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)]);
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:13,代码来源:ItemStack.java

示例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;
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:16,代码来源:ItemStack.java


注:本文中的net.minecraft.entity.player.EntityPlayer.triggerAchievement方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。