本文整理汇总了Java中net.minecraft.potion.PotionType.hasInstantEffect方法的典型用法代码示例。如果您正苦于以下问题:Java PotionType.hasInstantEffect方法的具体用法?Java PotionType.hasInstantEffect怎么用?Java PotionType.hasInstantEffect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.potion.PotionType
的用法示例。
在下文中一共展示了PotionType.hasInstantEffect方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onImpact
import net.minecraft.potion.PotionType; //导入方法依赖的package包/类
/**
* Called when this EntityThrowable hits a block or entity.
*/
protected void onImpact(RayTraceResult result)
{
if (!this.world.isRemote)
{
ItemStack itemstack = this.getPotion();
PotionType potiontype = PotionUtils.getPotionFromItem(itemstack);
List<PotionEffect> list = PotionUtils.getEffectsFromStack(itemstack);
boolean flag = potiontype == PotionTypes.WATER && list.isEmpty();
if (result.typeOfHit == RayTraceResult.Type.BLOCK && flag)
{
BlockPos blockpos = result.getBlockPos().offset(result.sideHit);
this.extinguishFires(blockpos);
for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL)
{
this.extinguishFires(blockpos.offset(enumfacing));
}
}
if (flag)
{
this.func_190545_n();
}
else if (!list.isEmpty())
{
if (this.isLingering())
{
this.func_190542_a(itemstack, potiontype);
}
else
{
this.func_190543_a(result, list);
}
}
int i = potiontype.hasInstantEffect() ? 2007 : 2002;
this.world.playEvent(i, new BlockPos(this), PotionUtils.func_190932_c(itemstack));
this.setDead();
}
}