minecraftpejs吧 关注:18,902贴子:96,927
  • 3回复贴,共1
function addABlock(id,name,tex,model,tm,m){
Block.defineBlock(id,name,
[[tex, m[1]], //下
[tex, m[2]], //上
[tex, m[3]], //后
[tex, m[4]], //前
[tex, m[5]], //左
[tex, m[6]], //右
[tex, m[1]], //下
[tex, m[2]], //上
[tex, m[3]], //后
[tex, m[4]], //前
[tex, m[5]], //左
[tex, m[6]]
], model,tm,0);
Block.setDestroyTime(id,1);
Player.addItemCreativeInv(id,64,0);
}
addABlock(36,"屠宰机","tzj",54,false,1,[0,1,0,0,0,0]);
求大神帮看看哪里错了


IP属地:北京来自Android客户端1楼2017-02-25 22:12回复
    org.mozilla.javascript.WrappedException: Wrapped java.lang.ClassCastException: org.mozilla.javascript.Undefined cannot be cast to java.lang.Number (黯世之旅.js#2)
    at org.mozilla.javascript.Context.throwAsScriptRuntimeEx(Unknown Source)
    at org.mozilla.javascript.MemberBox.invoke(Unknown Source)
    at org.mozilla.javascript.FunctionObject.call(Unknown Source)
    at org.mozilla.javascript.Interpreter.interpretLoop(Unknown Source)
    at script.addABlock(黯世之旅.js:2)
    at script(黯世之旅.js:19)
    at org.mozilla.javascript.Interpreter.interpret(Unknown Source)
    at org.mozilla.javascript.InterpretedFunction.call(Unknown Source)
    at org.mozilla.javascript.ContextFactory.doTopCall(Unknown Source)
    at org.mozilla.javascript.ScriptRuntime.doTopCall(Unknown Source)
    at org.mozilla.javascript.InterpretedFunction.exec(Unknown Source)
    at net.zhuoweizhang.mcpelauncher.ScriptManager.initJustLoadedScript(ScriptManager.java:271)
    at net.zhuoweizhang.mcpelauncher.ScriptManager$ParseThread.run(ScriptManager.java:196)
    at java.lang.Thread.run(Thread.java:818)
    Caused by: java.lang.ClassCastException: org.mozilla.javascript.Undefined cannot be cast to java.lang.Number
    at net.zhuoweizhang.mcpelauncher.ScriptManager.expandTexturesArray(ScriptManager.java:1355)
    at net.zhuoweizhang.mcpelauncher.ScriptManager$NativeBlockApi.defineBlockImpl(ScriptManager.java:4041)
    at net.zhuoweizhang.mcpelauncher.ScriptManager$NativeBlockApi.defineBlock(ScriptManager.java:4010)
    at java.lang.reflect.Method.invoke(Native Method)
    ... 11 more


    IP属地:北京来自Android客户端2楼2017-02-25 22:13
    回复
      应该这样写!
      function addABlock(id,name,tex,model,tm,m){
      Block.defineBlock(id,name,
      [[tex, m[0]], //下
      [tex, m[1]], //上
      [tex, m[2]], //后
      [tex, m[3]], //前
      [tex, m[4]], //左
      [tex, m[5]], //右
      [tex, m[0]], //下
      [tex, m[1]], //上
      [tex, m[2]], //后
      [tex, m[3]], //前
      [tex, m[4]], //左
      [tex, m[5]]
      ], model,tm,0);
      Block.setDestroyTime(id,1);
      Player.addItemCreativeInv(id,64,0);
      }
      addABlock(36,"屠宰机","tzj",54,false,1,[0,1,0,0,0,0]);


      IP属地:中国香港来自Android客户端20楼2017-03-13 17:31
      回复
        马上10级了


        IP属地:贵州来自Android客户端25楼2017-03-14 12:59
        回复