Bukkit Minecraft setIngredient材料ID结肠问题

时间:2015-07-09 00:58:17

标签: java minecraft bukkit

我试图在下面代码的getmaterial部分中使用块的完整id。这不会影响我尝试。

我找不到任何支持处理包含冒号的ID问题的文档:'

剪辑:(示例下面的5758:6不起作用,字符串名称也不起作用。)

emerald.setIngredient('L', Material.getMaterial("5758:6")); 

Material.getMaterial(406) //this is expecting an integer so i cannot give it two numbers

Material.getMaterial(406:1) //this fails as is expecting int

2 个答案:

答案 0 :(得分:1)

假设emeraldShapedRecipe对象(因为您正在使用setIngredient(char, Material)方法),那么您也可以使用setIngredient(char, MaterialData)方法。您可以使用(不建议使用的......)MaterialData构造函数构造所需的MaterialData(int, byte)对象。您的新代码如下所示:

emerald.setIngredient('L', new MaterialData(5758, 6));

"块的完整id中的冒号"只是将" id"和"数据"值。我认为这会做你想要的,但如果没有,请告诉我,我可以澄清一下。

答案 1 :(得分:0)

我不认为你应该处理那个冒号的事情。相反,如果您想要使用BRICK材料,请使用Material.BRICKMaterial.valueOf("BRICK")。如果您想查找Material m的名称,请使用m.name()返回String

相关问题