我想注册一个烧炼规则,如下
复制代码但是我发现所有药水(不是滞留和投掷型)都可以烧成 itemSalt
于是我用了 ItemStack 和 NBTTagCompound
复制代码但还是等于上面的效果,getCompoundTag(Strng) 里面的参数该怎么填啊 qwq
谢谢大佬
- <font size="2" face="Trebuchet MS">GameRegistry.<i>addSmelting</i>(Items.<b><i><font color="DeepSkyBlue">POTIONITEM</font></i></b>, <b><font color="Purple">new</font></b> ItemStack(<i><font color="DeepSkyBlue">itemSalt</font></i>), <font color="YellowGreen">0.5f</font>);</font>
于是我用了 ItemStack 和 NBTTagCompound
- <font size="2" face="Trebuchet MS">GameRegistry.<i>addSmelting</i>(<b><font color="Purple">new</font></b> ItemStack(Items.<b><i><font color="DeepSkyBlue">POTIONITEM</font></i></b>, <font color="YellowGreen">1</font>, <font color="YellowGreen">0</font>,
- <b><font color="Purple">new</font></b> NBTTagCompound().getCompoundTag(<font color="RoyalBlue">"Potion:"minecraft:water""</font>)), <b><font color="Purple">new</font></b> ItemStack(<i><font color="DeepSkyBlue">itemSalt</font></i>), <font color="YellowGreen">0.5f</font>);</font>
谢谢大佬

emmm...手贱手动上了语法高亮
这是代码:
复制代码复制代码
这是代码:
- GameRegistry.addSmelting(Items.POTIONITEM, new ItemStack(itemSalt), 0.5f);
- GameRegistry.addSmelting(new ItemStack(Items.POTIONITEM, 1, 0,
- new NBTTagCompound().getCompoundTag("Potion:"minecraft:water"")), new ItemStack(itemSalt), 0.5f);
楼主你是不是对 get/set 的理解有误?
复制代码
- NBTTagCompound tag = new NBTTagCompound();
- tag.setString("Potion", "minecraft:water");
- ItemStack input = new ItemStack(Items.POTIONITEM, 1, 0, tag);
u.s.knowledge 发表于 2019-7-26 14:41
楼主你是不是对 get/set 的理解有误?
- NBTTagCompound tag = new NBTTagCompound();
- tag.setString("Potion", "minecraft:water");
- GameRegistry.addSmelting(new ItemStack(Items.POTIONITEM, 1, 0, tag), new ItemStack(itemSalt), 0.5f);
照做了,但试了一下,药水依然可以被烧成 itemSalt,是参数填错了吗 qwq
顺带一提,NBTTagCompound 这个类我是顺着 ItemStack 找得到,用的函数也是蒙的。。。
Star_sea233 发表于 2019-7-26 19:58
照做了,但试了一下,药水依然可以被烧成 itemSalt,是参数填错了吗 qwq
顺带一提,NBTTagCompound 这个 ...
没填错,只是单纯的熔炉比较输入的时候忽略 NBT 数据而已……
见:
FurnaceRecipes.getSmeltingResult(func_151395_a)
FurnaceRecipes.compareItemStacks(func_151397_a)