本文整理汇总了Java中net.minecraft.potion.Potion.getPotionFromResourceLocation方法的典型用法代码示例。如果您正苦于以下问题:Java Potion.getPotionFromResourceLocation方法的具体用法?Java Potion.getPotionFromResourceLocation怎么用?Java Potion.getPotionFromResourceLocation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.potion.Potion
的用法示例。
在下文中一共展示了Potion.getPotionFromResourceLocation方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ItemMistcloak
import net.minecraft.potion.Potion; //导入方法依赖的package包/类
public ItemMistcloak() {
super("cloak");
this.setHasSubtypes(true);
this.setMaxDamage(0);
this.setMaxStackSize(1);
this.setCreativeTab(Thermionics.TAB_THERMIONICS);
POTION_INVIS = Potion.getPotionFromResourceLocation("minecraft:invisibility");
}
示例2: getBuff
import net.minecraft.potion.Potion; //导入方法依赖的package包/类
public Potion getBuff(ItemStack stack) {
return Potion.getPotionFromResourceLocation(getData(stack).getString(PropertyType.EFFECT_TYPE));
}
示例3: onUpdate
import net.minecraft.potion.Potion; //导入方法依赖的package包/类
@Override
public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5) {
super.onUpdate(par1ItemStack, par2World, par3Entity, par4, par5);
if (par1ItemStack.isEmpty())
return;
if (par5 && !this.canFire(par2World, (EntityLivingBase) par3Entity, par1ItemStack)) {
par3Entity.getCapability(TF2weapons.WEAPONS_CAP, null).setHealTarget(-1);
}
Potion effect=Potion.getPotionFromResourceLocation(ItemFromData.getData(par1ItemStack).getString(PropertyType.EFFECT_TYPE));
if (!par2World.isRemote&&par1ItemStack.getTagCompound().getBoolean("Activated")) {
par1ItemStack.getTagCompound().setFloat("ubercharge",
Math.max(0, par1ItemStack.getTagCompound().getFloat("ubercharge") - 0.00625f));
if(par5 && effect != null && par3Entity.ticksExisted%4==0)
((EntityLivingBase)par3Entity).addPotionEffect(new PotionEffect(effect,15));
if (par1ItemStack.getTagCompound().getFloat("ubercharge") == 0) {
par1ItemStack.getTagCompound().setBoolean("Activated", false);
TF2Util.playSound(par3Entity,ItemFromData.getSound(par1ItemStack, PropertyType.UBER_STOP_SOUND), 1.5f, 1);
((EntityLivingBase)par3Entity).removePotionEffect(effect);
// TF2weapons.sendTracking(new
// TF2Message.PropertyMessage("UberCharged",
// (byte)0,par3Entity),par3Entity);
}
}
if(par5){
Entity healTargetEnt = par2World.getEntityByID(par3Entity.getCapability(TF2weapons.WEAPONS_CAP, null).getHealTarget());
if(healTargetEnt != null && healTargetEnt instanceof EntityLivingBase){
EntityLivingBase healTarget=(EntityLivingBase) healTargetEnt;
// System.out.println("healing:
// "+ItemUsable.itemProperties.server.get(par3Entity).getInteger("HealTarget"));
if (!par2World.isRemote && healTarget != null && par3Entity.getDistanceSqToEntity(healTarget) > 72) {
par3Entity.getCapability(TF2weapons.WEAPONS_CAP, null).setHealTarget(-1);
// TF2weapons.sendTracking(new
// TF2Message.PropertyMessage("HealTarget",
// -1,par3Entity),par3Entity);
} else if (healTarget != null && healTarget instanceof EntityLivingBase) {
if(!par2World.isRemote)
this.heal(par1ItemStack, (EntityLivingBase) par3Entity, par2World, (EntityLivingBase) healTarget);
if (effect != null && par1ItemStack.getTagCompound().getBoolean("Activated") && (healTarget.getActivePotionEffect(effect)==null||healTarget.ticksExisted%4==0))
healTarget.addPotionEffect(new PotionEffect(effect,15));
// TF2weapons.sendTracking(new
// TF2Message.PropertyMessage("UberCharged",
// (byte)1,healTarget),healTarget);
}
}
}
}