Moonboos_666
本帖最后由 Moonboos_666 于 2020-4-5 17:09 编辑

版本1.12.2
如何修改mod中制作的食物的食用时间,使其能瞬吃?
请说的详细些




之前这样覆写了getMaxItemUseDuration,但是进入游戏后右键只会让手上的物品上下晃动一次,物品不会减少,也不会给buff(注释这部分启动游戏是正常的)
  1. public Itemadd2() {
  2.                 super(0, 0F, false);
  3.                 this.maxStackSize = 1;
  4.                 this.setUnlocalizedName("Medicine");
  5.                 this.setCreativeTab(CreativeTabsLoader.tabFMLTutor);
  6.                 this.setPotionEffect(new PotionEffect(MobEffects.INSTANT_HEALTH, 1, 1), 1.0F);
  7.                 this.setAlwaysEdible();
  8.         }
  9.         @Override
  10.         public int getMaxItemUseDuration(ItemStack stack) {
  11.         return 0;
  12.     }
复制代码

是不能这么弄还是要加些内容




Moonboos_666
本帖最后由 Moonboos_666 于 2020-4-5 17:11 编辑
这个排版。。。直接用文字发吧

public Itemadd2() {
    super(0, 0F, false);
    this.maxStackSize = 1;
    this.setUnlocalizedName("Medicine");
    this.setCreativeTab(CreativeTabsLoader.tabFMLTutor);
    this.setPotionEffect(new PotionEffect(MobEffects.INSTANT_HEALTH, 1, 1), 1.0F);
    this.setAlwaysEdible();
}
@Override
public int getMaxItemUseDuration(ItemStack stack) {
    return 0;
}


QWERTY770
把return 0改成return 1

第一页 上一页 下一页 最后一页