本帖最后由 Moonboos_666 于 2020-4-5 17:09 编辑
版本1.12.2
如何修改mod中制作的食物的食用时间,使其能瞬吃?
请说的详细些

之前这样覆写了getMaxItemUseDuration,但是进入游戏后右键只会让手上的物品上下晃动一次,物品不会减少,也不会给buff(注释这部分启动游戏是正常的)复制代码
是不能这么弄还是要加些内容
版本1.12.2
如何修改mod中制作的食物的食用时间,使其能瞬吃?
请说的详细些

之前这样覆写了getMaxItemUseDuration,但是进入游戏后右键只会让手上的物品上下晃动一次,物品不会减少,也不会给buff(注释这部分启动游戏是正常的)
- 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;
- }
是不能这么弄还是要加些内容
本帖最后由 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;
}
这个排版。。。直接用文字发吧
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;
}
把return 0改成return 1