本文整理汇总了Java中net.minecraft.init.Items.BONE属性的典型用法代码示例。如果您正苦于以下问题:Java Items.BONE属性的具体用法?Java Items.BONE怎么用?Java Items.BONE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类net.minecraft.init.Items
的用法示例。
在下文中一共展示了Items.BONE属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: hasPlayerGotBoneInHand
/**
* Gets if the Player has the Bone in the hand.
*/
private boolean hasPlayerGotBoneInHand(EntityPlayer player)
{
for (EnumHand enumhand : EnumHand.values())
{
ItemStack itemstack = player.getHeldItem(enumhand);
if (this.theWolf.isTamed() && itemstack.getItem() == Items.BONE)
{
return true;
}
if (this.theWolf.isBreedingItem(itemstack))
{
return true;
}
}
return false;
}
示例2: hasPlayerGotBoneInHand
/**
* Gets if the Player has the Bone in the hand.
*/
private boolean hasPlayerGotBoneInHand(EntityPlayer player)
{
for (EnumHand enumhand : EnumHand.values())
{
ItemStack itemstack = player.getHeldItem(enumhand);
if (itemstack != null)
{
if (this.theWolf.isTamed() && itemstack.getItem() == Items.BONE)
{
return true;
}
if (this.theWolf.isBreedingItem(itemstack))
{
return true;
}
}
}
return false;
}
示例3: getDrops
@SuppressWarnings("deprecation")
@Override
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
super.getDrops(world, pos, state, fortune);
ItemStack bone = new ItemStack(Items.BONE);
ArrayList<ItemStack> result = new ArrayList<>();
result.add(bone);
return result;
}
示例4: processInteract
public boolean processInteract(EntityPlayer player, EnumHand hand)
{
ItemStack itemstack = player.getHeldItem(hand);
if (this.isTamed())
{
if (!itemstack.func_190926_b())
{
if (itemstack.getItem() instanceof ItemFood)
{
ItemFood itemfood = (ItemFood)itemstack.getItem();
if (itemfood.isWolfsFavoriteMeat() && ((Float)this.dataManager.get(DATA_HEALTH_ID)).floatValue() < 20.0F)
{
if (!player.capabilities.isCreativeMode)
{
itemstack.func_190918_g(1);
}
this.heal((float)itemfood.getHealAmount(itemstack));
return true;
}
}
else if (itemstack.getItem() == Items.DYE)
{
EnumDyeColor enumdyecolor = EnumDyeColor.byDyeDamage(itemstack.getMetadata());
if (enumdyecolor != this.getCollarColor())
{
this.setCollarColor(enumdyecolor);
if (!player.capabilities.isCreativeMode)
{
itemstack.func_190918_g(1);
}
return true;
}
}
}
if (this.isOwner(player) && !this.world.isRemote && !this.isBreedingItem(itemstack))
{
this.aiSit.setSitting(!this.isSitting());
this.isJumping = false;
this.navigator.clearPathEntity();
this.setAttackTarget((EntityLivingBase)null);
}
}
else if (itemstack.getItem() == Items.BONE && !this.isAngry())
{
if (!player.capabilities.isCreativeMode)
{
itemstack.func_190918_g(1);
}
if (!this.world.isRemote)
{
if (this.rand.nextInt(3) == 0)
{
this.setTamed(true);
this.navigator.clearPathEntity();
this.setAttackTarget((EntityLivingBase)null);
this.aiSit.setSitting(true);
this.setHealth(20.0F);
this.setOwnerId(player.getUniqueID());
this.playTameEffect(true);
this.world.setEntityState(this, (byte)7);
}
else
{
this.playTameEffect(false);
this.world.setEntityState(this, (byte)6);
}
}
return true;
}
return super.processInteract(player, hand);
}
示例5: processInteract
public boolean processInteract(EntityPlayer player, EnumHand hand, @Nullable ItemStack stack)
{
if (this.isTamed())
{
if (stack != null)
{
if (stack.getItem() instanceof ItemFood)
{
ItemFood itemfood = (ItemFood)stack.getItem();
if (itemfood.isWolfsFavoriteMeat() && ((Float)this.dataManager.get(DATA_HEALTH_ID)).floatValue() < 20.0F)
{
if (!player.capabilities.isCreativeMode)
{
--stack.stackSize;
}
this.heal((float)itemfood.getHealAmount(stack));
return true;
}
}
else if (stack.getItem() == Items.DYE)
{
EnumDyeColor enumdyecolor = EnumDyeColor.byDyeDamage(stack.getMetadata());
if (enumdyecolor != this.getCollarColor())
{
this.setCollarColor(enumdyecolor);
if (!player.capabilities.isCreativeMode)
{
--stack.stackSize;
}
return true;
}
}
}
if (this.isOwner(player) && !this.worldObj.isRemote && !this.isBreedingItem(stack))
{
this.aiSit.setSitting(!this.isSitting());
this.isJumping = false;
this.navigator.clearPathEntity();
this.setAttackTarget((EntityLivingBase)null);
}
}
else if (stack != null && stack.getItem() == Items.BONE && !this.isAngry())
{
if (!player.capabilities.isCreativeMode)
{
--stack.stackSize;
}
if (!this.worldObj.isRemote)
{
if (this.rand.nextInt(3) == 0)
{
this.setTamed(true);
this.navigator.clearPathEntity();
this.setAttackTarget((EntityLivingBase)null);
this.aiSit.setSitting(true);
this.setHealth(20.0F);
this.setOwnerId(player.getUniqueID());
this.playTameEffect(true);
this.worldObj.setEntityState(this, (byte)7);
}
else
{
this.playTameEffect(false);
this.worldObj.setEntityState(this, (byte)6);
}
}
return true;
}
return super.processInteract(player, hand, stack);
}