2295962025
如题,求教各位大佬。

魅-内存君
effect指令了解一下

白精
/effect 名字 药水的id 时间 等级

huxaiozxc
本帖最后由 huxaiozxc 于 2019-8-19 16:58 编辑

你应该指的是给予一个药水的指令/give @p minecraft:potion{"Potion":"long_swiftness"} 1 (1.13及以后)
/give @p minecraft:potion 1 0 {"Potion":"long_swiftness"} (1.12及以前)
将会给予8分钟的速度I状态效果如何用命令给予药水详见:https://minecraft-zh.gamepedia.com/%E8%8D%AF%E6%B0%B4

海螺螺
本帖最后由 754503921 于 2019-8-19 18:51 编辑

水桶代码给药水效果
Player player = ......;
new PotionEffect(PotionEffectType.SPEED, 持续时间, 倍数).apply(player)

给药水

ItemStack potion = new ItemStack(Material.POTION, 1);
PotionMeta meta = (PotionMeta) potion.getItemMeta();
meta.setMainEffect(new PotionEffect(PotionEffectType.SPEED, 持续时间, 倍数));
potion.setItemMeta(meta);
p.getInventory().addItem(potion);


楼主提问时应给出平台(水桶,forge,海绵 ..)

YZL314159265
1.12forge的话。。EntityLivingBase有一个addPotionEffect方法。给实体添加各种状态效果。