本文整理汇总了Java中net.minecraft.init.Items.potionitem方法的典型用法代码示例。如果您正苦于以下问题:Java Items.potionitem方法的具体用法?Java Items.potionitem怎么用?Java Items.potionitem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.init.Items
的用法示例。
在下文中一共展示了Items.potionitem方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setPotionDamage
import net.minecraft.init.Items; //导入方法依赖的package包/类
/**
* Sets the PotionEffect by the given id of the potion effect.
*/
public void setPotionDamage(int potionId)
{
if (this.potionDamage == null)
{
this.potionDamage = new ItemStack(Items.potionitem, 1, 0);
}
this.potionDamage.setItemDamage(potionId);
}
示例2: getPotionDamage
import net.minecraft.init.Items; //导入方法依赖的package包/类
/**
* Returns the damage value of the thrown potion that this EntityPotion represents.
*/
public int getPotionDamage()
{
if (this.potionDamage == null)
{
this.potionDamage = new ItemStack(Items.potionitem, 1, 0);
}
return this.potionDamage.getMetadata();
}
示例3: canBrew
import net.minecraft.init.Items; //导入方法依赖的package包/类
private boolean canBrew() {
if (fuel > 0 && inventory[3] != null && inventory[3].stackSize > 0) {
ItemStack itemstack = inventory[3];
if (!itemstack.getItem().isPotionIngredient(itemstack))
return false;
else if (itemstack.getItem() == ModItems.dragon_breath) {
for (int i = 0; i < 3; i++)
if (inventory[i] != null && inventory[i].getItem() == Items.potionitem)
if (ItemPotion.isSplash(inventory[i].getItemDamage()))
return true;
return false;
} else {
boolean flag = false;
for (int i = 0; i < 3; i++)
if (inventory[i] != null && inventory[i].getItem() instanceof ItemPotion) {
int j = inventory[i].getItemDamage();
int k = applyIngredient(j, itemstack);
if (!ItemPotion.isSplash(j) && ItemPotion.isSplash(k)) {
flag = true;
break;
}
List<?> list = Items.potionitem.getEffects(j);
List<?> list1 = Items.potionitem.getEffects(k);
if ((j <= 0 || list != list1) && (list == null || !list.equals(list1) && list1 != null) && j != k) {
flag = true;
break;
}
}
return flag;
}
} else
return false;
}
示例4: onPickupFromSlot
import net.minecraft.init.Items; //导入方法依赖的package包/类
public void onPickupFromSlot(EntityPlayer playerIn, ItemStack stack)
{
if (stack.getItem() == Items.potionitem && stack.getMetadata() > 0)
{
this.player.triggerAchievement(AchievementList.potion);
}
super.onPickupFromSlot(playerIn, stack);
}
示例5: brewPotions
import net.minecraft.init.Items; //导入方法依赖的package包/类
private void brewPotions()
{
if (this.canBrew())
{
ItemStack itemstack = this.brewingItemStacks[3];
for (int i = 0; i < 3; ++i)
{
if (this.brewingItemStacks[i] != null && this.brewingItemStacks[i].getItem() == Items.potionitem)
{
int j = this.brewingItemStacks[i].getMetadata();
int k = this.getPotionResult(j, itemstack);
List<PotionEffect> list = Items.potionitem.getEffects(j);
List<PotionEffect> list1 = Items.potionitem.getEffects(k);
if (j > 0 && list == list1 || list != null && (list.equals(list1) || list1 == null))
{
if (!ItemPotion.isSplash(j) && ItemPotion.isSplash(k))
{
this.brewingItemStacks[i].setItemDamage(k);
}
}
else if (j != k)
{
this.brewingItemStacks[i].setItemDamage(k);
}
}
}
if (itemstack.getItem().hasContainerItem())
{
this.brewingItemStacks[3] = new ItemStack(itemstack.getItem().getContainerItem());
}
else
{
--this.brewingItemStacks[3].stackSize;
if (this.brewingItemStacks[3].stackSize <= 0)
{
this.brewingItemStacks[3] = null;
}
}
}
}
示例6: onItemRightClick
import net.minecraft.init.Items; //导入方法依赖的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)
{
MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(worldIn, playerIn, true);
if (movingobjectposition == null)
{
return itemStackIn;
}
else
{
if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
{
BlockPos blockpos = movingobjectposition.getBlockPos();
if (!worldIn.isBlockModifiable(playerIn, blockpos))
{
return itemStackIn;
}
if (!playerIn.canPlayerEdit(blockpos.offset(movingobjectposition.sideHit), movingobjectposition.sideHit, itemStackIn))
{
return itemStackIn;
}
if (worldIn.getBlockState(blockpos).getBlock().getMaterial() == Material.water)
{
--itemStackIn.stackSize;
playerIn.triggerAchievement(StatList.objectUseStats[Item.getIdFromItem(this)]);
if (itemStackIn.stackSize <= 0)
{
return new ItemStack(Items.potionitem);
}
if (!playerIn.inventory.addItemStackToInventory(new ItemStack(Items.potionitem)))
{
playerIn.dropPlayerItemWithRandomChoice(new ItemStack(Items.potionitem, 1, 0), false);
}
}
}
return itemStackIn;
}
}
示例7: getTabIconItem
import net.minecraft.init.Items; //导入方法依赖的package包/类
public Item getTabIconItem()
{
return Items.potionitem;
}
示例8: isItemValidForSlot
import net.minecraft.init.Items; //导入方法依赖的package包/类
/**
* Returns true if automation is allowed to insert the given stack (ignoring stack size) into the given slot.
*/
public boolean isItemValidForSlot(int index, ItemStack stack)
{
return index == 3 ? stack.getItem().isPotionIngredient(stack) : stack.getItem() == Items.potionitem || stack.getItem() == Items.glass_bottle;
}
示例9: canBrew
import net.minecraft.init.Items; //导入方法依赖的package包/类
private boolean canBrew()
{
if (this.brewingItemStacks[3] != null && this.brewingItemStacks[3].stackSize > 0)
{
ItemStack itemstack = this.brewingItemStacks[3];
if (!itemstack.getItem().isPotionIngredient(itemstack))
{
return false;
}
else
{
boolean flag = false;
for (int i = 0; i < 3; ++i)
{
if (this.brewingItemStacks[i] != null && this.brewingItemStacks[i].getItem() == Items.potionitem)
{
int j = this.brewingItemStacks[i].getMetadata();
int k = this.getPotionResult(j, itemstack);
if (!ItemPotion.isSplash(j) && ItemPotion.isSplash(k))
{
flag = true;
break;
}
List<PotionEffect> list = Items.potionitem.getEffects(j);
List<PotionEffect> list1 = Items.potionitem.getEffects(k);
if ((j <= 0 || list != list1) && (list == null || !list.equals(list1) && list1 != null) && j != k)
{
flag = true;
break;
}
}
}
return flag;
}
}
else
{
return false;
}
}
示例10: EntityPotion
import net.minecraft.init.Items; //导入方法依赖的package包/类
public EntityPotion(World worldIn, EntityLivingBase throwerIn, int meta)
{
this(worldIn, throwerIn, new ItemStack(Items.potionitem, 1, meta));
}
示例11: canHoldPotion
import net.minecraft.init.Items; //导入方法依赖的package包/类
public static boolean canHoldPotion(ItemStack stack)
{
return stack != null && (stack.getItem() == Items.potionitem || stack.getItem() == Items.glass_bottle);
}
示例12: EntityPotion
import net.minecraft.init.Items; //导入方法依赖的package包/类
public EntityPotion(World worldIn, double x, double y, double z, int p_i1791_8_)
{
this(worldIn, x, y, z, new ItemStack(Items.potionitem, 1, p_i1791_8_));
}
示例13: onLivingUpdate
import net.minecraft.init.Items; //导入方法依赖的package包/类
/**
* Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons
* use this to react to sunlight and start to burn.
*/
public void onLivingUpdate()
{
if (!this.worldObj.isRemote)
{
if (this.getAggressive())
{
if (this.witchAttackTimer-- <= 0)
{
this.setAggressive(false);
ItemStack itemstack = this.getHeldItem();
this.setCurrentItemOrArmor(0, (ItemStack)null);
if (itemstack != null && itemstack.getItem() == Items.potionitem)
{
List<PotionEffect> list = Items.potionitem.getEffects(itemstack);
if (list != null)
{
for (PotionEffect potioneffect : list)
{
this.addPotionEffect(new PotionEffect(potioneffect));
}
}
}
this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).removeModifier(MODIFIER);
}
}
else
{
int i = -1;
if (this.rand.nextFloat() < 0.15F && this.isInsideOfMaterial(Material.water) && !this.isPotionActive(Potion.waterBreathing))
{
i = 8237;
}
else if (this.rand.nextFloat() < 0.15F && this.isBurning() && !this.isPotionActive(Potion.fireResistance))
{
i = 16307;
}
else if (this.rand.nextFloat() < 0.05F && this.getHealth() < this.getMaxHealth())
{
i = 16341;
}
else if (this.rand.nextFloat() < 0.25F && this.getAttackTarget() != null && !this.isPotionActive(Potion.moveSpeed) && this.getAttackTarget().getDistanceSqToEntity(this) > 121.0D)
{
i = 16274;
}
else if (this.rand.nextFloat() < 0.25F && this.getAttackTarget() != null && !this.isPotionActive(Potion.moveSpeed) && this.getAttackTarget().getDistanceSqToEntity(this) > 121.0D)
{
i = 16274;
}
if (i > -1)
{
this.setCurrentItemOrArmor(0, new ItemStack(Items.potionitem, 1, i));
this.witchAttackTimer = this.getHeldItem().getMaxItemUseDuration();
this.setAggressive(true);
IAttributeInstance iattributeinstance = this.getEntityAttribute(SharedMonsterAttributes.movementSpeed);
iattributeinstance.removeModifier(MODIFIER);
iattributeinstance.applyModifier(MODIFIER);
}
}
if (this.rand.nextFloat() < 7.5E-4F)
{
this.worldObj.setEntityState(this, (byte)15);
}
}
super.onLivingUpdate();
}
示例14: RenderPotion
import net.minecraft.init.Items; //导入方法依赖的package包/类
public RenderPotion(RenderManager renderManagerIn, RenderItem itemRendererIn)
{
super(renderManagerIn, Items.potionitem, itemRendererIn);
}