本文整理汇总了Java中net.minecraft.init.PotionTypes.EMPTY属性的典型用法代码示例。如果您正苦于以下问题:Java PotionTypes.EMPTY属性的具体用法?Java PotionTypes.EMPTY怎么用?Java PotionTypes.EMPTY使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类net.minecraft.init.PotionTypes
的用法示例。
在下文中一共展示了PotionTypes.EMPTY属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addPotionToItemStack
public static ItemStack addPotionToItemStack(ItemStack itemIn, PotionType potionIn)
{
ResourceLocation resourcelocation = (ResourceLocation)PotionType.REGISTRY.getNameForObject(potionIn);
if (potionIn == PotionTypes.EMPTY)
{
if (itemIn.hasTagCompound())
{
NBTTagCompound nbttagcompound = itemIn.getTagCompound();
nbttagcompound.removeTag("Potion");
if (nbttagcompound.hasNoTags())
{
itemIn.setTagCompound((NBTTagCompound)null);
}
}
}
else
{
NBTTagCompound nbttagcompound1 = itemIn.hasTagCompound() ? itemIn.getTagCompound() : new NBTTagCompound();
nbttagcompound1.setString("Potion", resourcelocation.toString());
itemIn.setTagCompound(nbttagcompound1);
}
return itemIn;
}
示例2: 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));
}
}
示例3: writeEntityToNBT
/**
* (abstract) Protected helper method to write subclass entity data to NBT.
*/
public void writeEntityToNBT(NBTTagCompound compound)
{
super.writeEntityToNBT(compound);
if (this.potion != PotionTypes.EMPTY && this.potion != null)
{
compound.setString("Potion", ((ResourceLocation)PotionType.REGISTRY.getNameForObject(this.potion)).toString());
}
if (!this.customPotionEffects.isEmpty())
{
NBTTagList nbttaglist = new NBTTagList();
for (PotionEffect potioneffect : this.customPotionEffects)
{
nbttaglist.appendTag(potioneffect.writeCustomPotionEffectToNBT(new NBTTagCompound()));
}
compound.setTag("CustomPotionEffects", nbttaglist);
}
}
示例4: readEntityFromNBT
/**
* (abstract) Protected helper method to read subclass entity data from NBT.
*/
public void readEntityFromNBT(NBTTagCompound compound)
{
super.readEntityFromNBT(compound);
if (compound.hasKey("Potion", 8))
{
this.potion = PotionUtils.getPotionTypeFromNBT(compound);
}
for (PotionEffect potioneffect : PotionUtils.getFullEffectsFromTag(compound))
{
this.addEffect(potioneffect);
}
if (this.potion != PotionTypes.EMPTY || !this.customPotionEffects.isEmpty())
{
this.dataManager.set(COLOR, Integer.valueOf(PotionUtils.getPotionColorFromEffectList(PotionUtils.mergeEffects(this.potion, this.customPotionEffects))));
}
}
示例5: setPotion
public void setPotion(PotionType potionIn)
{
this.potion = potionIn;
if (!this.colorSet)
{
if (potionIn == PotionTypes.EMPTY && this.effects.isEmpty())
{
this.getDataManager().set(COLOR, Integer.valueOf(0));
}
else
{
this.getDataManager().set(COLOR, Integer.valueOf(PotionUtils.getPotionColorFromEffectList(PotionUtils.mergeEffects(potionIn, this.effects))));
}
}
}
示例6: getArrowStack
protected ItemStack getArrowStack()
{
ItemStack dart = new ItemStack(ModItems.dart, 1, getType().getMetadata());
if(potion !=PotionTypes.EMPTY){
PotionUtils.addPotionToItemStack(dart, this.potion);
PotionUtils.appendEffects(dart, this.customPotionEffects);
if (this.hasColor)
{
NBTTagCompound nbttagcompound = dart.getTagCompound();
if (nbttagcompound == null)
{
nbttagcompound = new NBTTagCompound();
dart.setTagCompound(nbttagcompound);
}
nbttagcompound.setInteger("CustomPotionColor", this.getColor());
}
}
return dart;
}
示例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: onUpdate
/**
* Called to update the entity's position/logic.
*/
public void onUpdate()
{
super.onUpdate();
if (this.world.isRemote)
{
if (this.inGround)
{
if (this.timeInGround % 5 == 0)
{
this.spawnPotionParticles(1);
}
}
else
{
this.spawnPotionParticles(2);
}
}
else if (this.inGround && this.timeInGround != 0 && !this.customPotionEffects.isEmpty() && this.timeInGround >= 600)
{
this.world.setEntityState(this, (byte)0);
this.potion = PotionTypes.EMPTY;
this.customPotionEffects.clear();
this.dataManager.set(COLOR, Integer.valueOf(-1));
}
}
示例9: writeEntityToNBT
/**
* (abstract) Protected helper method to write subclass entity data to NBT.
*/
public void writeEntityToNBT(NBTTagCompound compound)
{
super.writeEntityToNBT(compound);
if (this.potion != PotionTypes.EMPTY && this.potion != null)
{
compound.setString("Potion", ((ResourceLocation)PotionType.REGISTRY.getNameForObject(this.potion)).toString());
}
if (this.field_191509_at)
{
compound.setInteger("Color", this.getColor());
}
if (!this.customPotionEffects.isEmpty())
{
NBTTagList nbttaglist = new NBTTagList();
for (PotionEffect potioneffect : this.customPotionEffects)
{
nbttaglist.appendTag(potioneffect.writeCustomPotionEffectToNBT(new NBTTagCompound()));
}
compound.setTag("CustomPotionEffects", nbttaglist);
}
}
示例10: EntityAreaEffectCloud
public EntityAreaEffectCloud(World worldIn)
{
super(worldIn);
this.potion = PotionTypes.EMPTY;
this.effects = Lists.<PotionEffect>newArrayList();
this.reapplicationDelayMap = Maps.<Entity, Integer>newHashMap();
this.duration = 600;
this.waitTime = 20;
this.reapplicationDelay = 20;
this.noClip = true;
this.isImmuneToFire = true;
this.setRadius(3.0F);
}
示例11: func_190618_C
private void func_190618_C()
{
if (this.potion == PotionTypes.EMPTY && this.effects.isEmpty())
{
this.getDataManager().set(COLOR, Integer.valueOf(0));
}
else
{
this.getDataManager().set(COLOR, Integer.valueOf(PotionUtils.getPotionColorFromEffectList(PotionUtils.mergeEffects(this.potion, this.effects))));
}
}
示例12: getSubItems
/**
* returns a list of items with the same ID, but different meta (eg: dye returns 16 items)
*/
public void getSubItems(Item itemIn, CreativeTabs tab, NonNullList<ItemStack> subItems)
{
for (PotionType potiontype : PotionType.REGISTRY)
{
if (potiontype != PotionTypes.EMPTY)
{
subItems.add(PotionUtils.addPotionToItemStack(new ItemStack(itemIn), potiontype));
}
}
}
示例13: func_190901_a
public ItemStack func_190901_a(EntityPlayer p_190901_1_, ItemStack p_190901_2_)
{
PotionType potiontype = PotionUtils.getPotionFromItem(p_190901_2_);
if (potiontype != PotionTypes.WATER && potiontype != PotionTypes.EMPTY)
{
this.player.addStat(AchievementList.POTION);
}
super.func_190901_a(p_190901_1_, p_190901_2_);
return p_190901_2_;
}
示例14: onUpdate
/**
* Called to update the entity's position/logic.
*/
public void onUpdate()
{
super.onUpdate();
if (this.worldObj.isRemote)
{
if (this.inGround)
{
if (this.timeInGround % 5 == 0)
{
this.spawnPotionParticles(1);
}
}
else
{
this.spawnPotionParticles(2);
}
}
else if (this.inGround && this.timeInGround != 0 && !this.customPotionEffects.isEmpty() && this.timeInGround >= 600)
{
this.worldObj.setEntityState(this, (byte)0);
this.potion = PotionTypes.EMPTY;
this.customPotionEffects.clear();
this.dataManager.set(COLOR, Integer.valueOf(0));
}
}
示例15: 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;
}
}