Milky_way_boy
本帖最后由 Milky_way_boy 于 2022-11-24 14:32 编辑

目的:创建物品一重压缩泥土,二重压缩泥土,三重压缩泥土和修改原木硬度
脚本(zhu_xian2):
  1. #loader contenttweaker
  2. import crafttweaker.item.IItemStack;
  3. import mods.ltt.LootTable;
  4. import loottweaker.LootTweaker;
  5. import mods.contenttweaker.VanillaFactory;//专用
  6. import mods.contenttweaker.Item;
  7. import mods.contenttweaker.Block;
  8. import mods.contenttweaker.Fluid;
  9. import mods.contenttweaker.CreativeTab;
  10. //尝试创建压缩泥土
  11. val dc1 as Item = VanillaFactory.createItem("dirt_c1");
  12. var dc1 as Block = VanillaFactory.createBlock("dirt_c1",<hdxk:dirt_c1>);
  13. dc1.blockHardness = 4.5;
  14. dc1.blockResistance = 4.5;
  15. dc1.dropHandler = <dirt_c1>;
  16. dc1.toolLevel = 1;
  17. dc1.toolClass = "shovel";
  18. dc1.register();
  19. <hdxk:dirt_c1>.displayName = "一重压缩泥土";
  20. //二重压缩泥土
  21. val dc2 as Item = VanillaFactory.createItem("dirt_c2");
  22. var dc2 as Block = VanillaFactory.createBlock("dirt_c2",<hdxk:dirt_c2>);
  23. dc2.blockHardness = 10;
  24. dc2.blockResistance = 10;
  25. dc2.dropHandler = <dirt_c2>;
  26. dc2.toolLevel = 2;
  27. dc2.toolClass = "shovel";
  28. dc2.register();
  29. <hdxk:dirt_c2>.displayName = "二重压缩泥土";
  30. //三重压缩泥土
  31. val dc3 as Item = VanillaFactory.createItem("dirt_c3");
  32. var dc3 as Block = VanillaFactory.createBlock("dirt_c3",<hdxk:dirt_c3>);
  33. dc3.blockHardness = 30;
  34. dc3.blockResistance = 30;
  35. dc3.dropHandler = <dirt_c3>;
  36. dc3.toolLevel = 3;
  37. dc3.toolClass = "shovel";
  38. dc3.register();
  39. <hdxk:dirt_c3>.displayName = "三重压缩泥土";
  40. //合成配方
  41. recipes.addShaped(<hdxk:dirt_c1>,
  42. [[<ore:dirt>, <ore:dirt>, <ore:dirt>],
  43. [<ore:dirt>, <ore:dirt>, <ore:dirt>],
  44. [<ore:dirt>,<ore:dirt>, <ore:dirt>]]);
  45. recipes.addShaped(<hdxk:dirt_c2>,
  46. [[<hdxk:dirt_c2>, <hdxk:dirt_c2>, <hdxk:dirt_c2>],
  47. [<hdxk:dirt_c2>, <hdxk:dirt_c2>, <hdxk:dirt_c2>],
  48. [<hdxk:dirt_c2>,<hdxk:dirt_c2>, <hdxk:dirt_c2>]]);
  49. recipes.addShaped(<hdxk:dirt_c3>,
  50. [[<hdxk:dirt_c3>, <hdxk:dirt_c3>, <hdxk:dirt_c3>],
  51. [<hdxk:dirt_c3>, <hdxk:dirt_c3>, <hdxk:dirt_c3>],
  52. [<hdxk:dirt_c3>,<hdxk:dirt_c3>, <hdxk:dirt_c3>]]);
  53. //修改<ore:logWood>硬度
  54. <ore:logWood>.blockHardness = 10;
复制代码
报错内容:

  1. [20:00:17] [Client thread/INFO] [net.minecraft.client.gui.GuiNewChat]: [CHAT] §cERROR: zhu_xian2.zs:12: Could not resolve <hdxk : dirt_c1>
  2. [20:00:17] [Client thread/INFO] [net.minecraft.client.gui.GuiNewChat]: [CHAT] §cERROR: zhu_xian2.zs:15: Could not resolve <dirt_c1>
  3. [20:00:17] [Client thread/INFO] [net.minecraft.client.gui.GuiNewChat]: [CHAT] §cERROR: zhu_xian2.zs:19: Could not resolve <hdxk : dirt_c1>
  4. [20:00:17] [Client thread/INFO] [net.minecraft.client.gui.GuiNewChat]: [CHAT] §cERROR: zhu_xian2.zs:22: Could not resolve <hdxk : dirt_c2>
  5. [20:00:17] [Client thread/INFO] [net.minecraft.client.gui.GuiNewChat]: [CHAT] §cERROR: zhu_xian2.zs:25: Could not resolve <dirt_c2>
  6. [20:00:17] [Client thread/INFO] [net.minecraft.client.gui.GuiNewChat]: [CHAT] §cERROR: zhu_xian2.zs:29: Could not resolve <hdxk : dirt_c2>
  7. [20:00:17] [Client thread/INFO] [net.minecraft.client.gui.GuiNewChat]: [CHAT] §cERROR: zhu_xian2.zs:32: Could not resolve <hdxk : dirt_c3>
  8. [20:00:17] [Client thread/INFO] [net.minecraft.client.gui.GuiNewChat]: [CHAT] §cERROR: zhu_xian2.zs:35: Could not resolve <dirt_c3>
  9. [20:00:17] [Client thread/INFO] [net.minecraft.client.gui.GuiNewChat]: [CHAT] §cERROR: zhu_xian2.zs:39: Could not resolve <hdxk : dirt_c3>
  10. [20:00:17] [Client thread/INFO] [net.minecraft.client.gui.GuiNewChat]: [CHAT] §cERROR: zhu_xian2.zs:41: Could not resolve <hdxk : dirt_c1>
  11. [20:00:17] [Client thread/INFO] [net.minecraft.client.gui.GuiNewChat]: [CHAT] §cERROR: zhu_xian2.zs:45: Could not resolve <hdxk : dirt_c2>
  12. [20:00:17] [Client thread/INFO] [net.minecraft.client.gui.GuiNewChat]: [CHAT] §cERROR: zhu_xian2.zs:46: Could not resolve <hdxk : dirt_c2>
  13. [20:00:17] [Client thread/INFO] [net.minecraft.client.gui.GuiNewChat]: [CHAT] §cERROR: zhu_xian2.zs:46: Could not resolve <hdxk : dirt_c2>
  14. [20:00:17] [Client thread/INFO] [net.minecraft.client.gui.GuiNewChat]: [CHAT] §cERROR: zhu_xian2.zs:46: Could not resolve <hdxk : dirt_c2>
  15. [20:00:17] [Client thread/INFO] [net.minecraft.client.gui.GuiNewChat]: [CHAT] §cERROR: zhu_xian2.zs:47: Could not resolve <hdxk : dirt_c2>
  16. [20:00:17] [Client thread/INFO] [net.minecraft.client.gui.GuiNewChat]: [CHAT] §cERROR: zhu_xian2.zs:47: Could not resolve <hdxk : dirt_c2>
  17. [20:00:17] [Client thread/INFO] [net.minecraft.client.gui.GuiNewChat]: [CHAT] §cERROR: zhu_xian2.zs:47: Could not resolve <hdxk : dirt_c2>
  18. [20:00:17] [Client thread/INFO] [net.minecraft.client.gui.GuiNewChat]: [CHAT] §cERROR: zhu_xian2.zs:48: Could not resolve <hdxk : dirt_c2>
  19. [20:00:17] [Client thread/INFO] [net.minecraft.client.gui.GuiNewChat]: [CHAT] §cERROR: zhu_xian2.zs:48: Could not resolve <hdxk : dirt_c2>
  20. [20:00:17] [Client thread/INFO] [net.minecraft.client.gui.GuiNewChat]: [CHAT] §cERROR: zhu_xian2.zs:48: Could not resolve <hdxk : dirt_c2>
  21. [20:00:17] [Client thread/INFO] [net.minecraft.client.gui.GuiNewChat]: [CHAT] §cERROR: zhu_xian2.zs:49: Could not resolve <hdxk : dirt_c3>
  22. [20:00:17] [Client thread/INFO] [net.minecraft.client.gui.GuiNewChat]: [CHAT] §cERROR: zhu_xian2.zs:50: Could not resolve <hdxk : dirt_c3>
  23. [20:00:17] [Client thread/INFO] [net.minecraft.client.gui.GuiNewChat]: [CHAT] §cERROR: zhu_xian2.zs:50: Could not resolve <hdxk : dirt_c3>
  24. [20:00:17] [Client thread/INFO] [net.minecraft.client.gui.GuiNewChat]: [CHAT] §cERROR: zhu_xian2.zs:50: Could not resolve <hdxk : dirt_c3>
  25. [20:00:17] [Client thread/INFO] [net.minecraft.client.gui.GuiNewChat]: [CHAT] §cERROR: zhu_xian2.zs:51: Could not resolve <hdxk : dirt_c3>
  26. [20:00:17] [Client thread/INFO] [net.minecraft.client.gui.GuiNewChat]: [CHAT] §cERROR: zhu_xian2.zs:51: Could not resolve <hdxk : dirt_c3>
  27. [20:00:17] [Client thread/INFO] [net.minecraft.client.gui.GuiNewChat]: [CHAT] §cERROR: zhu_xian2.zs:51: Could not resolve <hdxk : dirt_c3>
  28. [20:00:17] [Client thread/INFO] [net.minecraft.client.gui.GuiNewChat]: [CHAT] §cERROR: zhu_xian2.zs:52: Could not resolve <hdxk : dirt_c3>
  29. [20:00:17] [Client thread/INFO] [net.minecraft.client.gui.GuiNewChat]: [CHAT] §cERROR: zhu_xian2.zs:52: Could not resolve <hdxk : dirt_c3>
  30. [20:00:17] [Client thread/INFO] [net.minecraft.client.gui.GuiNewChat]: [CHAT] §cERROR: zhu_xian2.zs:52: Could not resolve <hdxk : dirt_c3>
  31. [20:00:17] [Client thread/INFO] [net.minecraft.client.gui.GuiNewChat]: [CHAT] §cERROR: zhu_xian2.zs:12 > Value already defined in this scope: dc1
  32. [20:00:17] [Client thread/INFO] [net.minecraft.client.gui.GuiNewChat]: [CHAT] §cERROR: zhu_xian2.zs:13 > No such member in mods.contenttweaker.Item: blockHardness
  33. [20:00:17] [Client thread/INFO] [net.minecraft.client.gui.GuiNewChat]: [CHAT] §cERROR: zhu_xian2.zs:13 > not a valid lvalue
  34. [20:00:17] [Client thread/INFO] [net.minecraft.client.gui.GuiNewChat]: [CHAT] §cERROR: zhu_xian2.zs:14 > No such member in mods.contenttweaker.Item: blockResistance
  35. [20:00:17] [Client thread/INFO] [net.minecraft.client.gui.GuiNewChat]: [CHAT] §cERROR: zhu_xian2.zs:14 > not a valid lvalue
  36. [20:00:17] [Client thread/INFO] [net.minecraft.client.gui.GuiNewChat]: [CHAT] §cERROR: zhu_xian2.zs:15 > No such member in mods.contenttweaker.Item: dropHandler
  37. [20:00:17] [Client thread/INFO] [net.minecraft.client.gui.GuiNewChat]: [CHAT] §cERROR: zhu_xian2.zs:15 > not a valid lvalue
  38. [20:00:17] [Client thread/INFO] [net.minecraft.client.gui.GuiNewChat]: [CHAT] §cERROR: zhu_xian2.zs:19 > not a valid lvalue
  39. [20:00:17] [Client thread/INFO] [net.minecraft.client.gui.GuiNewChat]: [CHAT] §cERROR: zhu_xian2.zs:22 > Value already defined in this scope: dc2
  40. [20:00:17] [Client thread/INFO] [net.minecraft.client.gui.GuiNewChat]: [CHAT] §cERROR: zhu_xian2.zs:23 > No such member in mods.contenttweaker.Item: blockHardness
  41. [20:00:17] [Client thread/INFO] [net.minecraft.client.gui.GuiNewChat]: [CHAT] §cERROR: zhu_xian2.zs:23 > not a valid lvalue
  42. [20:00:17] [Client thread/INFO] [net.minecraft.client.gui.GuiNewChat]: [CHAT] §cERROR: zhu_xian2.zs:24 > No such member in mods.contenttweaker.Item: blockResistance
  43. [20:00:17] [Client thread/INFO] [net.minecraft.client.gui.GuiNewChat]: [CHAT] §cERROR: zhu_xian2.zs:24 > not a valid lvalue
  44. [20:00:17] [Client thread/INFO] [net.minecraft.client.gui.GuiNewChat]: [CHAT] §cERROR: zhu_xian2.zs:25 > No such member in mods.contenttweaker.Item: dropHandler
  45. [20:00:17] [Client thread/INFO] [net.minecraft.client.gui.GuiNewChat]: [CHAT] §cERROR: zhu_xian2.zs:25 > not a valid lvalue
  46. [20:00:17] [Client thread/INFO] [net.minecraft.client.gui.GuiNewChat]: [CHAT] §cERROR: zhu_xian2.zs:29 > not a valid lvalue
  47. [20:00:17] [Client thread/INFO] [net.minecraft.client.gui.GuiNewChat]: [CHAT] §cERROR: zhu_xian2.zs:32 > Value already defined in this scope: dc3
  48. [20:00:17] [Client thread/INFO] [net.minecraft.client.gui.GuiNewChat]: [CHAT] §cERROR: zhu_xian2.zs:33 > No such member in mods.contenttweaker.Item: blockHardness
  49. [20:00:17] [Client thread/INFO] [net.minecraft.client.gui.GuiNewChat]: [CHAT] §cERROR: zhu_xian2.zs:33 > not a valid lvalue
  50. [20:00:17] [Client thread/INFO] [net.minecraft.client.gui.GuiNewChat]: [CHAT] §cERROR: zhu_xian2.zs:34 > No such member in mods.contenttweaker.Item: blockResistance
  51. [20:00:17] [Client thread/INFO] [net.minecraft.client.gui.GuiNewChat]: [CHAT] §cERROR: zhu_xian2.zs:34 > not a valid lvalue
  52. [20:00:17] [Client thread/INFO] [net.minecraft.client.gui.GuiNewChat]: [CHAT] §cERROR: zhu_xian2.zs:35 > No such member in mods.contenttweaker.Item: dropHandler
  53. [20:00:17] [Client thread/INFO] [net.minecraft.client.gui.GuiNewChat]: [CHAT] §cERROR: zhu_xian2.zs:35 > not a valid lvalue
  54. [20:00:17] [Client thread/INFO] [net.minecraft.client.gui.GuiNewChat]: [CHAT] §cERROR: zhu_xian2.zs:39 > not a valid lvalue
  55. [20:00:17] [Client thread/INFO] [net.minecraft.client.gui.GuiNewChat]: [CHAT] §cERROR: zhu_xian2.zs:54 > No such member in crafttweaker.oredict.IOreDictEntry: blockHardness
  56. [20:00:17] [Client thread/INFO] [net.minecraft.client.gui.GuiNewChat]: [CHAT] §cERROR: zhu_xian2.zs:54 > not a valid lvalue
  57. [20:00:17] [Client thread/INFO] [net.minecraft.client.gui.GuiNewChat]: [CHAT] §cERROR: [contenttweaker]: Error executing {[0:contenttweaker]: zhu_xian2.zs}: null, caused by java.lang.NullPointerException
复制代码
大致意思应该是找不到这个方块,也就是没创建成功,那么该怎么正确注册请问大佬们


Crable_Potion
本人学识有限 但应该是这样的:
WalkThrough - CraftTweaker Documentation (blamejared.com) cot的文档 在章节"FirstBlock"有示范

我不太会zs 理论上应该是这样的 照着文档改的
——————————分割线————————
如果不是这个问题 那也许是vanilla factory的问题 就是11,12,21,22,31,32行的问题
详见Vanilla Factory - CraftTweaker Documentation (blamejared.com)的create item和create block章节

这个我不太懂 但楼主大概应该写的没错

无敌三脚猫
为什么你要定义两个不同的量却使用同一个变量名?不知道你能不能分清楚,但是显然cot已经分不清楚你写的名字应该指代哪个变量了
VanillaFactory.createBlock("dirt_c1",<hdxk:dirt_c1>)这里……如果你想定义一个新的BlockMaterial那应该提前写,而且名字格式也不对
多数时候也没必要定义一个新的BlockMaterial,随便用一个现成的就是
还有,dropHandler应该是一个函数而不是一个物品,而且如果你想让方块被破坏时掉落自身,那就应该直接不写dropHandler,也不需要定义新物品
比如第一个方块就该像这样写
  1. var dc1 as Block = VanillaFactory.createBlock("dirt_c1", <blockmaterial:clay>);
  2. dc1.blockHardness = 4.5;
  3. dc1.blockResistance = 4.5;
  4. dc1.toolLevel = 1;
  5. dc1.toolClass = "shovel";
  6. dc1.register();
复制代码
至于
  1. <contenttweaker:dirt_c1>.displayName = "一重压缩泥土";
复制代码
应该写在另一个脚本里,另一个不以#loader contenttweaker开头的脚本里,当然你也可以不写在脚本里而是写在资源包里

Milky_way_boy
无敌三脚猫 发表于 2022-11-24 18:33
为什么你要定义两个不同的量却使用同一个变量名?不知道你能不能分清楚,但是显然cot已经分不清楚你写的名 ...

另一个脚本需要设置加载顺序之类的吗?如果需要怎么设置

无敌三脚猫
Milky_way_boy 发表于 2022-11-24 21:30
另一个脚本需要设置加载顺序之类的吗?如果需要怎么设置

不需

Milky_way_boy

谢谢,我先去试一下

Milky_way_boy

把代码部分用代码格式就行,但还是报错,这次根本不明白
现在的的报错是什么情况,我进游戏看了物品还是
  1. #loader contenttweaker
  2. import crafttweaker.item.IItemStack;
  3. import mods.ltt.LootTable;
  4. import loottweaker.LootTweaker;
  5. import mods.contenttweaker.VanillaFactory;//专用
  6. import mods.contenttweaker.Item;
  7. import mods.contenttweaker.Block;
  8. import mods.contenttweaker.Fluid;
  9. import mods.contenttweaker.CreativeTab;
  10. //尝试创建压缩泥土
  11. var dc1 as Block = VanillaFactory.createBlock("dirt_c1", <blockmaterial:dirt_c1>);
  12. dc1.blockHardness = 4.5;
  13. dc1.blockResistance = 4.5;
  14. dc1.toolLevel = 1;
  15. dc1.toolClass = "shovel";
  16. dc1.register();
  17. //二重压缩泥土
  18. var dc2 as Block = VanillaFactory.createBlock("dirt_c2", <blockmaterial:dirt_c2>);
  19. dc2.blockHardness = 10;
  20. dc2.blockResistance = 10;
  21. dc2.toolLevel = 2;
  22. dc2.toolClass = "shovel";
  23. dc2.register();
  24. //三重压缩泥土
  25. var dc3 as Block = VanillaFactory.createBlock("dirt_c3", <blockmaterial:dirt_c3>);
  26. dc3.blockHardness = 30;
  27. dc3.blockResistance = 30;
  28. dc3.toolLevel = 3;
  29. dc3.toolClass = "shovel";
  30. dc3.register();
  31. //修改<ore:logWood>硬度
  32. <ore:logWood>.blockHardness = 10;
  33. 脚本zhu_xian1(从第66行开始):
  34. //重命名压缩泥土
  35. <blockmaterial:dirt_c1>.displayName = "一重简易压缩泥土";
  36. <blockmaterial:dirt_c1>.addTooltip("4块泥土");
  37. <blockmaterial:dirt_c2>.displayName = "二重简易压缩泥土";
  38. <blockmaterial:dirt_c2>.addTooltip("16块泥土");
  39. <blockmaterial:dirt_c3>.displayName = "三重简易压缩泥土";
  40. <blockmaterial:dirt_c3>.addTooltip("64块泥土");
  41. //合成配方(压缩泥土)
  42. recipes.addShaped(<blockmaterial:dirt_c1>,
  43. [[<ore:dirt>, <ore:dirt>, <ore:dirt>],
  44. [<ore:dirt>, <ore:dirt>, <ore:dirt>],
  45. [<ore:dirt>,<ore:dirt>, <ore:dirt>]]);
  46. recipes.addShaped(<blockmaterial:dirt_c2>,
  47. [[<blockmaterial:dirt_c1>,<blockmaterial:dirt_c1>, null],
  48. [<blockmaterial:dirt_c1>,<blockmaterial:dirt_c1>, null],
  49. [null,null,null]]);
  50. recipes.addShaped(<blockmaterial:dirt_c3>,
  51. [[<blockmaterial:dirt_c2>,<blockmaterial:dirt_c2>, null],
  52. [<blockmaterial:dirt_c2>,<blockmaterial:dirt_c2>, null],
  53. [null,null,null]]);
  54. 报错内容:
  55. [07:57:00] [Client thread/INFO] [net.minecraft.client.gui.GuiNewChat]: [CHAT] §cERROR: zhu_xian2.zs:32 > No such member in crafttweaker.oredict.IOreDictEntry: blockHardness
  56. [07:57:00] [Client thread/INFO] [net.minecraft.client.gui.GuiNewChat]: [CHAT] §cERROR: zhu_xian2.zs:32 > not a valid lvalue
  57. [07:57:00] [Client thread/INFO] [net.minecraft.client.gui.GuiNewChat]: [CHAT] §cERROR: Could not find BlockMaterial for name: dirt_c1
  58. [07:57:00] [Client thread/INFO] [net.minecraft.client.gui.GuiNewChat]: [CHAT] §cERROR: [contenttweaker]: Error executing {[0:contenttweaker]: zhu_xian2.zs}: null, caused by java.lang.NullPointerException
  59. [07:57:00] [Client thread/INFO] [net.minecraft.client.gui.GuiNewChat]: [CHAT] §cERROR: zhu_xian1.zs:63 > a method available but §4none§r matches the parameters (ZenTypeNative: crafttweaker.item.IItemStack)\nThis is §ousually§r an error in your script, not in the mod\nmirror(§rZenTypeNative: crafttweaker.oredict.IOreDictEntry)
  60. [07:57:00] [Client thread/INFO] [net.minecraft.client.gui.GuiNewChat]: [CHAT] §cERROR: zhu_xian1.zs:67 > No such member in mods.contenttweaker.BlockMaterial: displayName
  61. [07:57:00] [Client thread/INFO] [net.minecraft.client.gui.GuiNewChat]: [CHAT] §cERROR: zhu_xian1.zs:67 > not a valid lvalue
  62. [07:57:00] [Client thread/INFO] [net.minecraft.client.gui.GuiNewChat]: [CHAT] §cERROR: zhu_xian1.zs:68 > No such member in mods.contenttweaker.BlockMaterial: addTooltip
  63. [07:57:00] [Client thread/INFO] [net.minecraft.client.gui.GuiNewChat]: [CHAT] §cERROR: zhu_xian1.zs:69 > No such member in mods.contenttweaker.BlockMaterial: displayName
  64. [07:57:00] [Client thread/INFO] [net.minecraft.client.gui.GuiNewChat]: [CHAT] §cERROR: zhu_xian1.zs:69 > not a valid lvalue
  65. [07:57:00] [Client thread/INFO] [net.minecraft.client.gui.GuiNewChat]: [CHAT] §cERROR: zhu_xian1.zs:70 > No such member in mods.contenttweaker.BlockMaterial: addTooltip
  66. [07:57:00] [Client thread/INFO] [net.minecraft.client.gui.GuiNewChat]: [CHAT] §cERROR: zhu_xian1.zs:71 > No such member in mods.contenttweaker.BlockMaterial: displayName
  67. [07:57:00] [Client thread/INFO] [net.minecraft.client.gui.GuiNewChat]: [CHAT] §cERROR: zhu_xian1.zs:71 > not a valid lvalue
  68. [07:57:00] [Client thread/INFO] [net.minecraft.client.gui.GuiNewChat]: [CHAT] §cERROR: zhu_xian1.zs:72 > No such member in mods.contenttweaker.BlockMaterial: addTooltip
  69. [07:57:00] [Client thread/INFO] [net.minecraft.client.gui.GuiNewChat]: [CHAT] §cERROR: zhu_xian1.zs:74 > 2 methods available but §4none§r matches the parameters (ZenTypeNative: mods.contenttweaker.BlockMaterial, ZenTypeNative: crafttweaker.item.IIngredient[][])\nThis is §ousually§r an error in your script, not in the mod\naddShaped(§rZenTypeNative: crafttweaker.item.IItemStack, §rZenTypeNative: crafttweaker.item.IIngredient[][], §aOptional §rZenTypeNative: crafttweaker.recipes.IRecipeFunction, §aOptional §rZenTypeNative: crafttweaker.recipes.IRecipeAction)\naddShaped(§rstring, §rZenTypeNative: crafttweaker.item.IItemStack, §rZenTypeNative: crafttweaker.item.IIngredient[][], §aOptional §rZenTypeNative: crafttweaker.recipes.IRecipeFunction, §aOptional §rZenTypeNative: crafttweaker.recipes.IRecipeAction)
  70. [07:57:00] [Client thread/INFO] [net.minecraft.client.gui.GuiNewChat]: [CHAT] §cERROR: zhu_xian1.zs:78 > 2 methods available but §4none§r matches the parameters (ZenTypeNative: mods.contenttweaker.BlockMaterial, ZenTypeNative: crafttweaker.item.IIngredient[][])\nThis is §ousually§r an error in your script, not in the mod\naddShaped(§rZenTypeNative: crafttweaker.item.IItemStack, §rZenTypeNative: crafttweaker.item.IIngredient[][], §aOptional §rZenTypeNative: crafttweaker.recipes.IRecipeFunction, §aOptional §rZenTypeNative: crafttweaker.recipes.IRecipeAction)\naddShaped(§rstring, §rZenTypeNative: crafttweaker.item.IItemStack, §rZenTypeNative: crafttweaker.item.IIngredient[][], §aOptional §rZenTypeNative: crafttweaker.recipes.IRecipeFunction, §aOptional §rZenTypeNative: crafttweaker.recipes.IRecipeAction)
  71. [07:57:00] [Client thread/INFO] [net.minecraft.client.gui.GuiNewChat]: [CHAT] §cERROR: zhu_xian1.zs:82 > 2 methods available but §4none§r matches the parameters (ZenTypeNative: mods.contenttweaker.BlockMaterial, ZenTypeNative: crafttweaker.item.IIngredient[][])\nThis is §ousually§r an error in your script, not in the mod\naddShaped(§rZenTypeNative: crafttweaker.item.IItemStack, §rZenTypeNative: crafttweaker.item.IIngredient[][], §aOptional §rZenTypeNative: crafttweaker.recipes.IRecipeFunction, §aOptional §rZenTypeNative: crafttweaker.recipes.IRecipeAction)\naddShaped(§rstring, §rZenTypeNative: crafttweaker.item.IItemStack, §rZenTypeNative: crafttweaker.item.IIngredient[][], §aOptional §rZenTypeNative: crafttweaker.recipes.IRecipeFunction, §aOptional §rZenTypeNative: crafttweaker.recipes.IRecipeAction)
  72. [07:57:00] [Client thread/INFO] [net.minecraft.client.gui.GuiNewChat]: [CHAT] §cERROR: [crafttweaker]: Error executing {[0:crafttweaker]: zhu_xian1.zs}: Bad type on operand stack\nException Details:\n  Location:\n    Zhu_xian1.__script__()V @1229: invokestatic\n  Reason:\n    Type 'stanhebben/zenscript/value/IAny' (current frame, stack[4]) is not assignable to 'java/lang/String'\n  Current Frame:\n    bci: @1229\n    flags: { }\n    locals: { }\n    stack: { null, '[Lstanhebben/zenscript/value/IAny;', '[Lstanhebben/zenscript/value/IAny;', integer, 'stanhebben/zenscript/value/IAny' }\n  Bytecode:\n    0x0000000: b200 0f12 1112 12b8 0018 03b9 001e 0300\n    0x0000010: b200 0f12 2012 12b8 0018 03b9 001e 0300\n    0x0000020: b200 0f12 2212 12b8 0018 03b9 001e 0300\n    0x0000030: b200 0f12 2412 12b8 0018 03b9 001e 0300\n    0x0000040: b200 0f12 1112 12b8 0018 1225 bd00 2759\n    0x0000050: 1212 1225 bd00 2959 1212 122b b800 3153\n    0x0000060: 5912 3212 34b8 0031 5359 1235 122b b800\n    0x0000070: 3153 5359 1232 1225 bd00 2959 1212 1234\n    0x0000080: b800 3153 5912 3201 5359 1235 1234 b800\n    0x0000090: 3153 5359 1235 1225 bd00 2959 1212 0153\n    0x00000a0: 5912 3201 5359 1235 0153 5301 01b9 0039\n    0x00000b0: 0500 b200 0f12 2012 12b8 0018 1225 bd00\n    0x00000c0: 2759 1212 1225 bd00 2959 1212 1234 b800\n    0x00000d0: 3153 5912 3201 5359 1235 1234 b800 3153\n    0x00000e0: 5359 1232 1225 bd00 2959 1212 122b b800\n    0x00000f0: 3153 5912 3212 34b8 0031 5359 1235 122b\n    0x0000100: b800 3153 5359 1235 1225 bd00 2959 1212\n    0x0000110: 1234 b800 3153 5912 3212 2bb8 0031 5359\n    0x0000120: 1235 1234 b800 3153 5301 01b9 0039 0500\n    0x0000130: b200 0f12 2212 12b8 0018 1225 bd00 2759\n    0x0000140: 1212 1225 bd00 2959 1212 1234 b800 3153\n    0x0000150: 5912 3212 34b8 0031 5359 1235 1234 b800\n    0x0000160: 3153 5359 1232 1225 bd00 2959 1212 1234\n    0x0000170: b800 3153 5912 3201 5359 1235 1234 b800\n    0x0000180: 3153 5359 1235 1225 bd00 2959 1212 1234\n    0x0000190: b800 3153 5912 3201 5359 1235 1234 b800\n    0x00001a0: 3153 5301 01b9 0039 0500 b200 0f12 2412\n    0x00001b0: 12b8 0018 1225 bd00 2759 1212 1225 bd00\n    0x00001c0: 2959 1212 122b b800 3153 5912 3201 5359\n    0x00001d0: 1235 122b b800 3153 5359 1232 1225 bd00\n    0x00001e0: 2959 1212 1234 b800 3153 5912 3201 5359\n    0x00001f0: 1235 1234 b800 3153 5359 1235 1225 bd00\n    0x0000200: 2959 1212 0153 5912 3201 5359 1235 0153\n    0x0000210: 5301 01b9 0039 0500 123b 1212 b800 1812\n    0x0000220: 3db9 0043 0200 b200 0f12 4512 12b8 0018\n    0x0000230: 03b9 001e 0300 b200 0f12 4712 12b8 0018\n    0x0000240: 03b9 001e 0300 b200 0f12 4912 12b8 0018\n    0x0000250: 03b9 001e 0300 b200 0f12 4b12 12b8 0018\n    0x0000260: 03b9 001e 0300 b200 0f12 4512 12b8 0018\n    0x0000270: 1225 bd00 2759 1212 1225 bd00 2959 1212\n    0x0000280: 124d 1212 b800 1853 5912 3212 1112 12b8\n    0x0000290: 0018 b900 5101 00b8 0057 5359 1235 124d\n    0x00002a0: 1212 b800 1853 5359 1232 1225 bd00 2959\n    0x00002b0: 1212 123b 1212 b800 1853 5912 3201 5359\n    0x00002c0: 1235 123b 1212 b800 1853 5359 1235 1225\n    0x00002d0: bd00 2959 1212 0153 5912 3201 5359 1235\n    0x00002e0: 0153 5301 01b9 0039 0500 b200 0f12 4712\n    0x00002f0: 12b8 0018 1225 bd00 2759 1212 1225 bd00\n    0x0000300: 2959 1212 123b 1212 b800 1853 5912 3201\n    0x0000310: 5359 1235 123b 1212 b800 1853 5359 1232\n    0x0000320: 1225 bd00 2959 1212 124d 1212 b800 1853\n    0x0000330: 5912 3212 2012 12b8 0018 b900 5101 00b8\n    0x0000340: 0057 5359 1235 124d 1212 b800 1853 5359\n    0x0000350: 1235 1225 bd00 2959 1212 123b 1212 b800\n    0x0000360: 1853 5912 3212 4d12 12b8 0018 5359 1235\n    0x0000370: 123b 1212 b800 1853 5301 01b9 0039 0500\n    0x0000380: b200 0f12 4912 12b8 0018 1225 bd00 2759\n    0x0000390: 1212 1225 bd00 2959 1212 123b 1212 b800\n    0x00003a0: 1853 5912 3212 2212 12b8 0018 b900 5101\n    0x00003b0: 00b8 0057 5359 1235 123b 1212 b800 1853\n    0x00003c0: 5359 1232 1225 bd00 2959 1212 124d 1212\n    0x00003d0: b800 1853 5912 3201 5359 1235 124d 1212\n    0x00003e0: b800 1853 5359 1235 1225 bd00 2959 1212\n    0x00003f0: 123b 1212 b800 1853 5912 3201 5359 1235\n    0x0000400: 123b 1212 b800 1853 5301 01b9 0039 0500\n    0x0000410: b200 0f12 4b12 12b8 0018 1225 bd00 2759\n    0x0000420: 1212 1225 bd00 2959 1212 124d 1212 b800\n    0x0000430: 1853 5912 3201 5359 1235 1224 1212 b800\n    0x0000440: 18b9 0051 0100 b800 5753 5359 1232 1225\n    0x0000450: bd00 2959 1212 123b 1212 b800 1853 5912\n    0x0000460: 3201 5359 1235 123b 1212 b800 1853 5359\n    0x0000470: 1235 1225 bd00 2959 1212 0153 5912 3201\n    0x0000480: 5359 1235 0153 5301 01b9 0039 0500 b200\n    0x0000490: 5b12 5d12 12b8 0018 125f 1212 b800 1814\n    0x00004a0: 0060 b900 6705 0012 69b8 0031 126b b800\n    0x00004b0: 31b9 0071 0200 0112 32bd 0073 5912 1212\n    0x00004c0: 7559 c700 0857 01a7 0006 b800 7bb8 0081\n    0x00004d0: 53b9 0085 0200 5701 1232 bd00 7359 1212\n    0x00004e0: 1287 59c7 0008 5701 a700 06b8 007b b800\n    0x00004f0: 8153 b900 8502 0057 0112 32bd 0073 5912\n    0x0000500: 1212 8959 c700 0857 01a7 0006 b800 7bb8\n    0x0000510: 0081 53b9 0085 0200 57b1               \n  Stackmap Table:\n    full_frame(@1226,{},{Null,Object[#139],Object[#139],Integer,Object[#141]})\n    full_frame(@1229,{},{Null,Object[#139],Object[#139],Integer,Object[#115]})\n    full_frame(@1259,{},{Null,Object[#139],Object[#139],Integer,Object[#141]})\n    full_frame(@1262,{},{Null,Object[#139],Object[#139],Integer,Object[#115]})\n    full_frame(@1292,{},{Null,Object[#139],Object[#139],Integer,Object[#141]})\n    full_frame(@1295,{},{Null,Object[#139],Object[#139],Integer,Object[#115]})\n, caused by java.lang.VerifyError: Bad type on operand stack\nException Details:\n  Location:\n    Zhu_xian1.__script__()V @1229: invokestatic\n  Reason:\n    Type 'stanhebben/zenscript/value/IAny' (current frame, stack[4]) is not assignable to 'java/lang/String'\n  Current Frame:\n    bci: @1229\n    flags: { }\n    locals: { }\n    stack: { null, '[Lstanhebben/zenscript/value/IAny;', '[Lstanhebben/zenscript/value/IAny;', integer, 'stanhebben/zenscript/value/IAny' }\n  Bytecode:\n    0x0000000: b200 0f12 1112 12b8 0018 03b9 001e 0300\n    0x0000010: b200 0f12 2012 12b8 0018 03b9 001e 0300\n    0x0000020: b200 0f12 2212 12b8 0018 03b9 001e 0300\n    0x0000030: b200 0f12 2412 12b8 0018 03b9 001e 0300\n    0x0000040: b200 0f12 1112 12b8 0018 1225 bd00 2759\n    0x0000050: 1212 1225 bd00 2959 1212 122b b800 3153\n    0x0000060: 5912 3212 34b8 0031 5359 1235 122b b800\n    0x0000070: 3153 5359 1232 1225 bd00 2959 1212 1234\n    0x0000080: b800 3153 5912 3201 5359 1235 1234 b800\n    0x0000090: 3153 5359 1235 1225 bd00 2959 1212 0153\n    0x00000a0: 5912 3201 5359 1235 0153 5301 01b9 0039\n    0x00000b0: 0500 b200 0f12 2012 12b8 0018 1225 bd00\n    0x00000c0: 2759 1212 1225 bd00 2959 1212 1234 b800\n    0x00000d0: 3153 5912 3201 5359 1235 1234 b800 3153\n    0x00000e0: 5359 1232 1225 bd00 2959 1212 122b b800\n    0x00000f0: 3153 5912 3212 34b8 0031 5359 1235 122b\n    0x0000100: b800 3153 5359 1235 1225 bd00 2959 1212\n    0x0000110: 1234 b800 3153 5912 3212 2bb8 0031 5359\n    0x0000120: 1235 1234 b800 3153 5301 01b9 0039 0500\n    0x0000130: b200 0f12 2212 12b8 0018 1225 bd00 2759\n    0x0000140: 1212 1225 bd00 2959 1212 1234 b800 3153\n    0x0000150: 5912 3212 34b8 0031 5359 1235 1234 b800\n    0x0000160: 3153 5359 1232 1225 bd00 2959 1212 1234\n    0x0000170: b800 3153 5912 3201 5359 1235 1234 b800\n    0x0000180: 3153 5359 1235 1225 bd00 2959 1212 1234\n    0x0000190: b800 3153 5912 3201 5359 1235 1234 b800\n    0x00001a0: 3153 5301 01b9 0039 0500 b200 0f12 2412\n    0x00001b0: 12b8 0018 1225 bd00 2759 1212 1225 bd00\n    0x00001c0: 2959 1212 122b b800 3153 5912 3201 5359\n    0x00001d0: 1235 122b b800 3153 5359 1232 1225 bd00\n    0x00001e0: 2959 1212 1234 b800 3153 5912 3201 5359\n    0x00001f0: 1235 1234 b800 3153 5359 1235 1225 bd00\n    0x0000200: 2959 1212 0153 5912 3201 5359 1235 0153\n    0x0000210: 5301 01b9 0039 0500 123b 1212 b800 1812\n    0x0000220: 3db9 0043 0200 b200 0f12 4512 12b8 0018\n    0x0000230: 03b9 001e 0300 b200 0f12 4712 12b8 0018\n    0x0000240: 03b9 001e 0300 b200 0f12 4912 12b8 0018\n    0x0000250: 03b9 001e 0300 b200 0f12 4b12 12b8 0018\n    0x0000260: 03b9 001e 0300 b200 0f12 4512 12b8 0018\n    0x0000270: 1225 bd00 2759 1212 1225 bd00 2959 1212\n    0x0000280: 124d 1212 b800 1853 5912 3212 1112 12b8\n    0x0000290: 0018 b900 5101 00b8 0057 5359 1235 124d\n    0x00002a0: 1212 b800 1853 5359 1232 1225 bd00 2959\n    0x00002b0: 1212 123b 1212 b800 1853 5912 3201 5359\n    0x00002c0: 1235 123b 1212 b800 1853 5359 1235 1225\n    0x00002d0: bd00 2959 1212 0153 5912 3201 5359 1235\n    0x00002e0: 0153 5301 01b9 0039 0500 b200 0f12 4712\n    0x00002f0: 12b8 0018 1225 bd00 2759 1212 1225 bd00\n    0x0000300: 2959 1212 123b 1212 b800 1853 5912 3201\n    0x0000310: 5359 1235 123b 1212 b800 1853 5359 1232\n    0x0000320: 1225 bd00 2959 1212 124d 1212 b800 1853\n    0x0000330: 5912 3212 2012 12b8 0018 b900 5101 00b8\n    0x0000340: 0057 5359 1235 124d 1212 b800 1853 5359\n    0x0000350: 1235 1225 bd00 2959 1212 123b 1212 b800\n    0x0000360: 1853 5912 3212 4d12 12b8 0018 5359 1235\n    0x0000370: 123b 1212 b800 1853 5301 01b9 0039 0500\n    0x0000380: b200 0f12 4912 12b8 0018 1225 bd00 2759\n    0x0000390: 1212 1225 bd00 2959 1212 123b 1212 b800\n    0x00003a0: 1853 5912 3212 2212 12b8 0018 b900 5101\n    0x00003b0: 00b8 0057 5359 1235 123b 1212 b800 1853\n    0x00003c0: 5359 1232 1225 bd00 2959 1212 124d 1212\n    0x00003d0: b800 1853 5912 3201 5359 1235 124d 1212\n    0x00003e0: b800 1853 5359 1235 1225 bd00 2959 1212\n    0x00003f0: 123b 1212 b800 1853 5912 3201 5359 1235\n    0x0000400: 123b 1212 b800 1853 5301 01b9 0039 0500\n    0x0000410: b200 0f12 4b12 12b8 0018 1225 bd00 2759\n    0x0000420: 1212 1225 bd00 2959 1212 124d 1212 b800\n    0x0000430: 1853 5912 3201 5359 1235 1224 1212 b800\n    0x0000440: 18b9 0051 0100 b800 5753 5359 1232 1225\n    0x0000450: bd00 2959 1212 123b 1212 b800 1853 5912\n    0x0000460: 3201 5359 1235 123b 1212 b800 1853 5359\n    0x0000470: 1235 1225 bd00 2959 1212 0153 5912 3201\n    0x0000480: 5359 1235 0153 5301 01b9 0039 0500 b200\n    0x0000490: 5b12 5d12 12b8 0018 125f 1212 b800 1814\n    0x00004a0: 0060 b900 6705 0012 69b8 0031 126b b800\n    0x00004b0: 31b9 0071 0200 0112 32bd 0073 5912 1212\n    0x00004c0: 7559 c700 0857 01a7 0006 b800 7bb8 0081\n    0x00004d0: 53b9 0085 0200 5701 1232 bd00 7359 1212\n    0x00004e0: 1287 59c7 0008 5701 a700 06b8 007b b800\n    0x00004f0: 8153 b900 8502 0057 0112 32bd 0073 5912\n    0x0000500: 1212 8959 c700 0857 01a7 0006 b800 7bb8\n    0x0000510: 0081 53b9 0085 0200 57b1               \n  Stackmap Table:\n    full_frame(@1226,{},{Null,Object[#139],Object[#139],Integer,Object[#141]})\n    full_frame(@1229,{},{Null,Object[#139],Object[#139],Integer,Object[#115]})\n    full_frame(@1259,{},{Null,Object[#139],Object[#139],Integer,Object[#141]})\n    full_frame(@1262,{},{Null,Object[#139],Object[#139],Integer,Object[#115]})\n    full_frame(@1292,{},{Null,Object[#139],Object[#139],Integer,Object[#141]})\n    full_frame(@1295,{},{Null,Object[#139],Object[#139],Integer,Object[#115]})\n
复制代码

没有成功创建,且我在上面还提了一个修改原木硬度的问题,也没解决

无敌三脚猫
Milky_way_boy 发表于 2022-11-25 09:14
把代码部分用代码格式就行,但还是报错,这次根本不明白
现在的的报错是什么情况,我进游戏看了物品还是
没 ...

我前面说了,你要定义新的blockmaterial要提前写啊,哪能不声明、不定义就直接用的?
不对,好像不能定义新的blockmaterial,那你还是死了这条心吧
再说我也不信现成的blockmaterial不够你用,你梦想中的那3种blockmaterial除了名字我就没看出区别
我前面不是明明白白写着
  1. <contenttweaker:dirt_c1>.displayName = "一重压缩泥土";
复制代码
你干嘛要乱改名字
而且cot的事让cot干,crt的事就让crt干,不要写在一起
不只是重命名,你从改木头硬度到添加配方,都应该写在一个不以#loader contenttweaker开头的脚本里
cot它就只负责添加新物品
还有,改硬度当然是改方块的硬度,你改矿物辞典的硬度是什么意思,而且改这个当然要看crt的文档,遵守crt的写法,不能因为cot写blockHardness你就跟着写blockHardness
  1. <blockstate:minecraft:log>.block.definition.hardness=10;
复制代码

Milky_way_boy
无敌三脚猫 发表于 2022-11-25 10:37
我前面说了,你要定义新的blockmaterial要提前写啊,哪能不声明、不定义就直接用的?
不对,好像 ...

我改这个矿物词典的硬度是因为这里面有137种不同的原木,一个一个改太麻烦了。况且1.12仅原版就有log1的4种木头和log2的2种木头

wdcftgg
Milky_way_boy 发表于 2022-11-25 11:16
我改这个矿物词典的硬度是因为这里面有137种不同的原木,一个一个改太麻烦了。况且1.12仅原版就有log1的4 ...

那也不能这样
使用循环来批量更改硬度(game.block)

wdcftgg
还有分成两个脚本
就像另一位说的一样
你把crt的活交给cot干嘛?

无敌三脚猫
Milky_way_boy 发表于 2022-11-25 11:16
我改这个矿物词典的硬度是因为这里面有137种不同的原木,一个一个改太麻烦了。况且1.12仅原版就有log1的4 ...

但是矿物辞典没有硬度啊,它既不是方块也不是物品,它可是矿物辞典啊
  1. for i in <ore:logWood>.items{i.asBlock().definition.hardness=10;}
复制代码
另外,木头其实也没有看起来那么多,1.12原版只有两种木头

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