本文整理汇总了Java中net.minecraft.potion.Potion.moveSlowdown方法的典型用法代码示例。如果您正苦于以下问题:Java Potion.moveSlowdown方法的具体用法?Java Potion.moveSlowdown怎么用?Java Potion.moveSlowdown使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.potion.Potion
的用法示例。
在下文中一共展示了Potion.moveSlowdown方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fireShot
import net.minecraft.potion.Potion; //导入方法依赖的package包/类
private void fireShot(World world, Entity entity)
{
float spreadHor = world.rand.nextFloat() * 20 - 10; // Spread between -5 and 5
float spreadVert = world.rand.nextFloat() * 20 - 10;
SnowShot snow = new SnowShot(world, entity, (float) this.Speed, spreadHor, spreadVert);
// Random Damage
int dmg_range = this.DmgMax - this.DmgMin; // If max dmg is 20 and min is 10, then the range will be 10
int dmg = world.rand.nextInt(dmg_range + 1); // Range will be between 0 and 10
dmg += this.DmgMin; // Adding the min dmg of 10 back on top, giving us the proper damage range (10-20)
snow.damage = dmg;
ShotPotion effect = new ShotPotion();
effect.potion = Potion.moveSlowdown;
effect.Strength = this.Slow_Strength;
effect.Duration = this.Slow_Duration;
snow.pot1 = effect;
world.spawnEntityInWorld(snow);
}
示例2: doSingleFire
import net.minecraft.potion.Potion; //导入方法依赖的package包/类
@Override
public void doSingleFire(ItemStack stack, World world, Entity entity) // Server side
{
if (this.getCooldown(stack) > 0) { return; } // Hasn't cooled down yet
Helper.knockUserBack(entity, this.Kickback); // Kickback
// SFX
world.playSoundAtEntity(entity, "random.explode", 0.8F, 1.5F);
NetHelper.sendParticleMessageToAllPlayers(world, entity.getEntityId(), (byte) 3, (byte) 1); // smoke
// Firing
ColdIron shot = new ColdIron(world, entity, (float) this.Speed);
// Random Damage
int dmg_range = this.DmgMax - this.DmgMin; // If max dmg is 20 and min is 10, then the range will be 10
int dmg = world.rand.nextInt(dmg_range + 1); // Range will be between 0 and 10
dmg += this.DmgMin; // Adding the min dmg of 10 back on top, giving us the proper damage range (10-20)
shot.damage = dmg;
shot.knockbackStrength = this.Knockback;
// Gas
ShotPotion effect1 = new ShotPotion();
effect1.potion = Potion.moveSlowdown; // Nausea
effect1.Strength = this.Slowness_Str;
effect1.Duration = this.Slowness_Dur;
shot.pot1 = effect1;
ShotPotion effect2 = new ShotPotion();
effect2.potion = Potion.hunger;
effect2.Strength = 1;
effect2.Duration = this.Nausea_Dur;
shot.pot2 = effect2;
world.spawnEntityInWorld(shot); // Firing!
this.consumeAmmo(stack, entity, 1);
this.setCooldown(stack, this.Cooldown);
}