本文整理匯總了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);
}