本文整理汇总了Java中net.minecraft.init.Items.TIPPED_ARROW属性的典型用法代码示例。如果您正苦于以下问题:Java Items.TIPPED_ARROW属性的具体用法?Java Items.TIPPED_ARROW怎么用?Java Items.TIPPED_ARROW使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类net.minecraft.init.Items
的用法示例。
在下文中一共展示了Items.TIPPED_ARROW属性的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: func_190726_a
protected EntityArrow func_190726_a(float p_190726_1_)
{
ItemStack itemstack = this.getItemStackFromSlot(EntityEquipmentSlot.OFFHAND);
if (itemstack.getItem() == Items.SPECTRAL_ARROW)
{
EntitySpectralArrow entityspectralarrow = new EntitySpectralArrow(this.world, this);
entityspectralarrow.func_190547_a(this, p_190726_1_);
return entityspectralarrow;
}
else
{
EntityArrow entityarrow = super.func_190726_a(p_190726_1_);
if (itemstack.getItem() == Items.TIPPED_ARROW && entityarrow instanceof EntityTippedArrow)
{
((EntityTippedArrow)entityarrow).setPotionEffect(itemstack);
}
return entityarrow;
}
}
示例2: getCraftingResult
/**
* Returns an Item that is the result of this recipe
*/
public ItemStack getCraftingResult(InventoryCrafting inv)
{
ItemStack itemstack = inv.getStackInRowAndColumn(1, 1);
if (itemstack.getItem() != Items.LINGERING_POTION)
{
return ItemStack.field_190927_a;
}
else
{
ItemStack itemstack1 = new ItemStack(Items.TIPPED_ARROW, 8);
PotionUtils.addPotionToItemStack(itemstack1, PotionUtils.getPotionFromItem(itemstack));
PotionUtils.appendEffects(itemstack1, PotionUtils.getFullEffectsFromItem(itemstack));
return itemstack1;
}
}
示例3: canCombineItems
private boolean canCombineItems(ItemStack stackA, ItemStack stackB)
{
if (ItemStack.areItemsEqual(stackA, stackB)) return true;
if (stackA.getItem() == Items.POTIONITEM && stackB.getItem() == Item.getByNameOrId("potioncore:custom_potion") && stackB.getMetadata() == 0) return true;
if (stackA.getItem() == Items.SPLASH_POTION && stackB.getItem() == Item.getByNameOrId("potioncore:custom_potion") && stackB.getMetadata() == 1) return true;
if (stackA.getItem() == Items.LINGERING_POTION && stackB.getItem() == Item.getByNameOrId("potioncore:custom_potion") && stackB.getMetadata() == 2) return true;
if (stackB.getItem() == Items.POTIONITEM && stackA.getItem() == Item.getByNameOrId("potioncore:custom_potion") && stackA.getMetadata() == 0) return true;
if (stackB.getItem() == Items.SPLASH_POTION && stackA.getItem() == Item.getByNameOrId("potioncore:custom_potion") && stackA.getMetadata() == 1) return true;
if (stackB.getItem() == Items.LINGERING_POTION && stackA.getItem() == Item.getByNameOrId("potioncore:custom_potion") && stackA.getMetadata() == 2) return true;
if (stackA.getItem() == Items.TIPPED_ARROW && stackB.getItem() == Item.getByNameOrId("potioncore:custom_arrow")) return true;
if (stackB.getItem() == Items.TIPPED_ARROW && stackA.getItem() == Item.getByNameOrId("potioncore:custom_arrow")) return true;
return false;
}
示例4: getOutputStack
private ItemStack getOutputStack(ItemStack inputStack)
{
Item item = inputStack.getItem();
if (item == Items.POTIONITEM || (item == Item.getByNameOrId("potioncore:custom_potion") && inputStack.getMetadata() == 0))
{
return new ItemStack(Items.POTIONITEM, 1, 0);
}
else if (item == Items.SPLASH_POTION || (item == Item.getByNameOrId("potioncore:custom_potion") && inputStack.getMetadata() == 1))
{
return new ItemStack(Items.SPLASH_POTION, 1, 0);
}
else if (item == Items.LINGERING_POTION || (item == Item.getByNameOrId("potioncore:custom_potion") && inputStack.getMetadata() == 2))
{
return new ItemStack(Items.LINGERING_POTION, 1, 0);
}
else if (item == Items.TIPPED_ARROW || item == Item.getByNameOrId("potioncore:custom_arrow"))
{
return new ItemStack(Items.TIPPED_ARROW, 1, 0);
}
else return ItemStack.EMPTY;
}
示例5: setPotionEffect
public void setPotionEffect(ItemStack stack)
{
if (stack.getItem() == Items.TIPPED_ARROW)
{
this.potion = PotionUtils.getPotionTypeFromNBT(stack.getTagCompound());
Collection<PotionEffect> collection = PotionUtils.getFullEffectsFromItem(stack);
if (!collection.isEmpty())
{
for (PotionEffect potioneffect : collection)
{
this.customPotionEffects.add(new PotionEffect(potioneffect));
}
}
this.dataManager.set(COLOR, Integer.valueOf(PotionUtils.getPotionColorFromEffectList(PotionUtils.mergeEffects(this.potion, collection))));
}
else if (stack.getItem() == Items.ARROW)
{
this.potion = PotionTypes.EMPTY;
this.customPotionEffects.clear();
this.dataManager.set(COLOR, Integer.valueOf(0));
}
}
示例6: getCraftingResult
/**
* Returns an Item that is the result of this recipe
*/
@Nullable
public ItemStack getCraftingResult(InventoryCrafting inv)
{
ItemStack itemstack = inv.getStackInRowAndColumn(1, 1);
if (itemstack != null && itemstack.getItem() == Items.LINGERING_POTION)
{
ItemStack itemstack1 = new ItemStack(Items.TIPPED_ARROW, 8);
PotionUtils.addPotionToItemStack(itemstack1, PotionUtils.getPotionFromItem(itemstack));
PotionUtils.appendEffects(itemstack1, PotionUtils.getFullEffectsFromItem(itemstack));
return itemstack1;
}
else
{
return null;
}
}
示例7: setPotionEffect
public void setPotionEffect(ItemStack stack)
{
if (stack.getItem() == Items.TIPPED_ARROW)
{
this.potion = PotionUtils.getPotionFromItem(stack);
Collection<PotionEffect> collection = PotionUtils.getFullEffectsFromItem(stack);
if (!collection.isEmpty())
{
for (PotionEffect potioneffect : collection)
{
this.customPotionEffects.add(new PotionEffect(potioneffect));
}
}
int i = func_191508_b(stack);
if (i == -1)
{
this.func_190548_o();
}
else
{
this.func_191507_d(i);
}
}
else if (stack.getItem() == Items.ARROW)
{
this.potion = PotionTypes.EMPTY;
this.customPotionEffects.clear();
this.dataManager.set(COLOR, Integer.valueOf(-1));
}
}
示例8: matches
@Override
public boolean matches(InventoryCrafting inv, World worldIn)
{
ItemStack tempStack = ItemStack.EMPTY;
int potionEffects = 0;
for (int i = 0; i < inv.getSizeInventory(); i++)
{
ItemStack stack = inv.getStackInSlot(i);
if (!stack.isEmpty())
{
Item item = stack.getItem();
if (item != Items.TIPPED_ARROW && item != Items.POTIONITEM && item != Items.SPLASH_POTION && item != Items.LINGERING_POTION) return false;
if (tempStack.isEmpty())
{
tempStack = stack.copy();
}
else
{
if (!ItemStack.areItemsEqual(tempStack, stack)) return false;
}
if (ModConfiguration.maxPotionEffects >= 0)
{
potionEffects += PotionUtils.getEffectsFromStack(stack).size();
if (potionEffects > ModConfiguration.maxPotionEffects) return false;
}
}
}
return true;
}
示例9: getArrowStack
protected ItemStack getArrowStack()
{
if (this.customPotionEffects.isEmpty() && this.potion == PotionTypes.EMPTY)
{
return new ItemStack(Items.ARROW);
}
else
{
ItemStack itemstack = new ItemStack(Items.TIPPED_ARROW);
PotionUtils.addPotionToItemStack(itemstack, this.potion);
PotionUtils.appendEffects(itemstack, this.customPotionEffects);
return itemstack;
}
}
示例10: attackEntityWithRangedAttack
/**
* Attack the specified entity using a ranged attack.
*
* @param distanceFactor How far the target is, normalized and clamped between 0.1 and 1.0
*/
public void attackEntityWithRangedAttack(EntityLivingBase target, float distanceFactor)
{
EntityTippedArrow entitytippedarrow = new EntityTippedArrow(this.worldObj, this);
double d0 = target.posX - this.posX;
double d1 = target.getEntityBoundingBox().minY + (double)(target.height / 3.0F) - entitytippedarrow.posY;
double d2 = target.posZ - this.posZ;
double d3 = (double)MathHelper.sqrt_double(d0 * d0 + d2 * d2);
entitytippedarrow.setThrowableHeading(d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, (float)(14 - this.worldObj.getDifficulty().getDifficultyId() * 4));
int i = EnchantmentHelper.getMaxEnchantmentLevel(Enchantments.POWER, this);
int j = EnchantmentHelper.getMaxEnchantmentLevel(Enchantments.PUNCH, this);
DifficultyInstance difficultyinstance = this.worldObj.getDifficultyForLocation(new BlockPos(this));
entitytippedarrow.setDamage((double)(distanceFactor * 2.0F) + this.rand.nextGaussian() * 0.25D + (double)((float)this.worldObj.getDifficulty().getDifficultyId() * 0.11F));
if (i > 0)
{
entitytippedarrow.setDamage(entitytippedarrow.getDamage() + (double)i * 0.5D + 0.5D);
}
if (j > 0)
{
entitytippedarrow.setKnockbackStrength(j);
}
boolean flag = this.isBurning() && difficultyinstance.isHard() && this.rand.nextBoolean() || this.getSkeletonType() == SkeletonType.WITHER;
flag = flag || EnchantmentHelper.getMaxEnchantmentLevel(Enchantments.FLAME, this) > 0;
if (flag)
{
entitytippedarrow.setFire(100);
}
ItemStack itemstack = this.getHeldItem(EnumHand.OFF_HAND);
if (itemstack != null && itemstack.getItem() == Items.TIPPED_ARROW)
{
entitytippedarrow.setPotionEffect(itemstack);
}
else if (this.getSkeletonType() == SkeletonType.STRAY)
{
entitytippedarrow.addEffect(new PotionEffect(MobEffects.SLOWNESS, 600));
}
this.playSound(SoundEvents.ENTITY_SKELETON_SHOOT, 1.0F, 1.0F / (this.getRNG().nextFloat() * 0.4F + 0.8F));
this.worldObj.spawnEntityInWorld(entitytippedarrow);
}