本文整理汇总了Java中net.minecraft.entity.player.EntityPlayer.getCurrentEquippedItem方法的典型用法代码示例。如果您正苦于以下问题:Java EntityPlayer.getCurrentEquippedItem方法的具体用法?Java EntityPlayer.getCurrentEquippedItem怎么用?Java EntityPlayer.getCurrentEquippedItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.entity.player.EntityPlayer
的用法示例。
在下文中一共展示了EntityPlayer.getCurrentEquippedItem方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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 (playerIn.getCurrentEquippedItem() != null)
{
Item item = playerIn.getCurrentEquippedItem().getItem();
if (item == Items.flint_and_steel || item == Items.fire_charge)
{
this.explode(worldIn, pos, state.withProperty(EXPLODE, Boolean.valueOf(true)), playerIn);
worldIn.setBlockToAir(pos);
if (item == Items.flint_and_steel)
{
playerIn.getCurrentEquippedItem().damageItem(1, playerIn);
}
else if (!playerIn.capabilities.isCreativeMode)
{
--playerIn.getCurrentEquippedItem().stackSize;
}
return true;
}
}
return super.onBlockActivated(worldIn, pos, state, playerIn, side, hitX, hitY, hitZ);
}
示例2: startCapture
import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public CaptureBlock startCapture(EntityPlayer pPlayer){
ItemStack tItem=null;
int tSlot=-1;
if(pPlayer!=null){
tSlot=pPlayer.inventory.currentItem;
tItem=pPlayer.getCurrentEquippedItem();
}
return this.startCapture(pPlayer,tItem,tSlot);
}
示例3: 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(Blocks.vine, 1, 0));
}
else
{
super.harvestBlock(worldIn, player, pos, state, te);
}
}
示例4: 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 || state.getValue(HALF) != BlockDoublePlant.EnumBlockHalf.LOWER || !this.onHarvest(worldIn, pos, state, player))
{
super.harvestBlock(worldIn, player, pos, state, te);
}
}
示例5: onBlockHarvested
import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public void onBlockHarvested(World worldIn, BlockPos pos, IBlockState state, EntityPlayer player)
{
if (!worldIn.isRemote)
{
if (player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == Items.shears)
{
worldIn.setBlockState(pos, state.withProperty(DISARMED, Boolean.valueOf(true)), 4);
}
}
}
示例6: 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(Blocks.deadbush, 1, 0));
}
else
{
super.harvestBlock(worldIn, player, pos, state, te);
}
}
示例7: 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()));
}
else
{
super.harvestBlock(worldIn, player, pos, state, te);
}
}
示例8: 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(Blocks.tallgrass, 1, ((BlockTallGrass.EnumType)state.getValue(TYPE)).getMeta()));
}
else
{
super.harvestBlock(worldIn, player, pos, state, te);
}
}
示例9: interact
import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
/**
* Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig.
*/
public boolean interact(EntityPlayer player)
{
ItemStack itemstack = player.getCurrentEquippedItem();
if (itemstack != null && itemstack.getItem() == Items.golden_apple && itemstack.getMetadata() == 0 && this.isVillager() && this.isPotionActive(Potion.weakness))
{
if (!player.capabilities.isCreativeMode)
{
--itemstack.stackSize;
}
if (itemstack.stackSize <= 0)
{
player.inventory.setInventorySlotContents(player.inventory.currentItem, (ItemStack)null);
}
if (!this.worldObj.isRemote)
{
this.startConversion(this.rand.nextInt(2401) + 3600);
}
return true;
}
else
{
return false;
}
}
示例10: onPlayerPickupXP
import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public static void onPlayerPickupXP(PlayerPickupXpEvent event) {
EntityPlayer player = event.entityPlayer;
EntityXPOrb orb = event.orb;
if (player.worldObj.isRemote)
return;
if (!EtFuturum.enableMending)
return;
ItemStack[] stacks = new ItemStack[5];
stacks[0] = player.getCurrentEquippedItem(); // held
stacks[1] = player.getEquipmentInSlot(1); // boots
stacks[2] = player.getEquipmentInSlot(2); // leggings
stacks[3] = player.getEquipmentInSlot(3); // chestplate
stacks[4] = player.getEquipmentInSlot(4); // helmet
for (ItemStack stack : stacks)
if (stack != null && stack.getItemDamage() > 0 && EnchantmentHelper.getEnchantmentLevel(mending.effectId, stack) > 0) {
int xp = orb.xpValue;
while (xp > 0 && stack.getItemDamage() > 0) {
stack.setItemDamage(stack.getItemDamage() - 2);
xp--;
}
if (xp <= 0) {
orb.setDead();
event.setCanceled(true);
return;
}
}
}
示例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: onBlockHarvested
import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public void onBlockHarvested(World worldIn, BlockPos pos, IBlockState state, EntityPlayer player)
{
if (state.getValue(HALF) == BlockDoublePlant.EnumBlockHalf.UPPER)
{
if (worldIn.getBlockState(pos.down()).getBlock() == this)
{
if (!player.capabilities.isCreativeMode)
{
IBlockState iblockstate = worldIn.getBlockState(pos.down());
BlockDoublePlant.EnumPlantType blockdoubleplant$enumplanttype = (BlockDoublePlant.EnumPlantType)iblockstate.getValue(VARIANT);
if (blockdoubleplant$enumplanttype != BlockDoublePlant.EnumPlantType.FERN && blockdoubleplant$enumplanttype != BlockDoublePlant.EnumPlantType.GRASS)
{
worldIn.destroyBlock(pos.down(), true);
}
else if (!worldIn.isRemote)
{
if (player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == Items.shears)
{
this.onHarvest(worldIn, pos, iblockstate, player);
worldIn.setBlockToAir(pos.down());
}
else
{
worldIn.destroyBlock(pos.down(), true);
}
}
else
{
worldIn.setBlockToAir(pos.down());
}
}
else
{
worldIn.setBlockToAir(pos.down());
}
}
}
else if (player.capabilities.isCreativeMode && worldIn.getBlockState(pos.up()).getBlock() == this)
{
worldIn.setBlockState(pos.up(), Blocks.air.getDefaultState(), 2);
}
super.onBlockHarvested(worldIn, pos, state, player);
}