Maescool / Catacomb-Snatch

Mojang's Humble bundle source
Other
295 stars 99 forks source link

Various errors in new mod-system #950

Closed master-lincoln closed 12 years ago

master-lincoln commented 12 years ago

Starting the game currently yields the following error twice:

NameError: undefined local variable or method `mods' for main:Object
 (root) at <script>:1
org.jruby.embed.EvalFailedException: (NameError) undefined local variable or method `mods' for main:Object
  at org.jruby.embed.internal.EmbedEvalUnitImpl.run(EmbedEvalUnitImpl.java:132)
  at org.jruby.embed.jsr223.JRubyEngine.eval(JRubyEngine.java:129)
  at org.jruby.embed.jsr223.JRubyEngine.eval(JRubyEngine.java:157)
  at com.mojang.mojam.mod.ModSystem.addScript(ModSystem.java:337)
  at com.mojang.mojam.mod.ModSystem.readFromClassPath(ModSystem.java:317)
  at com.mojang.mojam.mod.ModSystem.init(ModSystem.java:129)
  at com.mojang.mojam.MojamComponent.<init>(MojamComponent.java:175)
  at com.mojang.mojam.MojamComponent.startgame(MojamComponent.java:837)
  at com.mojang.mojam.MojamStartup.startgame(MojamStartup.java:216)
  at com.mojang.mojam.downloader.Downloader.CheckFiles(Downloader.java:81)
  at com.mojang.mojam.MojamStartup.main(MojamStartup.java:254)
Caused by: org.jruby.exceptions.RaiseException: (NameError) undefined local variable or method `mods' for >main:Object

After choosing a map the following exception is thrown:

Bad method in mod at method CreateLevel line: -1 column: -1
javax.script.ScriptException: TypeError: CreateLevel() takes exactly 1 argument (0 given)
    at org.python.jsr223.PyScriptEngine.scriptException(PyScriptEngine.java:196)
    at org.python.jsr223.PyScriptEngine.invokeFunction(PyScriptEngine.java:126)
    at com.mojang.mojam.mod.ModSystem.invoke(ModSystem.java:855)
    at com.mojang.mojam.mod.ModSystem.createLevel(ModSystem.java:764)
    at com.mojang.mojam.MojamComponent.initLevel(MojamComponent.java:393)
    at com.mojang.mojam.MojamComponent.createLevel(MojamComponent.java:367)
    at com.mojang.mojam.MojamComponent.handleAction(MojamComponent.java:969)
    at com.mojang.mojam.MojamComponent.buttonPressed(MojamComponent.java:894)
    at com.mojang.mojam.gui.components.ClickableComponent.tick(ClickableComponent.java:41)
    at com.mojang.mojam.gui.GuiMenu.tick(GuiMenu.java:72)
    at com.mojang.mojam.MojamComponent.tick(MojamComponent.java:708)
    at com.mojang.mojam.MojamComponent.run(MojamComponent.java:442)
    at java.lang.Thread.run(Thread.java:722)
Caused by: TypeError: CreateLevel() takes exactly 1 argument (0 given)
    at org.python.core.Py.TypeError(Py.java:221)
    at org.python.core.PyBaseCode.call(PyBaseCode.java:279)
    at org.python.core.PyFunction.function___call__(PyFunction.java:376)
    at org.python.core.PyFunction.__call__(PyFunction.java:371)
    at org.python.core.PyFunction.__call__(PyFunction.java:361)
    at org.python.core.PyFunction.__call__(PyFunction.java:356)
    at org.python.jsr223.PyScriptEngine.invokeFunction(PyScriptEngine.java:124)
    ... 11 more

Additionally the game crashes when pressing B in-game. This key is registered by one of the demo mods.

0x0ade commented 12 years ago

Ruby works : mod_.rb : Add to beginning and replace needed parts :

require 'java' java_import com.mojang.mojam.mod.ModSystem java_import com.mojang.mojam.MojamComponent java_import com.mojang.mojam.screen.MojamScreen java_import com.mojang.mojam.gui.components.Font

def OnRender() ModSystem.getFont().draw(MojamComponent.screen,"Ruby",20,20) end

same for lib.rb :

require 'java' java_import com.mojang.mojam.mod.ModSystem java_import com.mojang.mojam.MojamComponent

mods = ModSystem.new mojam = ModSystem.getMojam()

The puts in ModSystem are unneeded . I do not want to know who forgott the require 'java' and other parts when these are here : https://github.com/jruby/jruby/wiki/CallingJavaFromJRuby

Edit : Pull Request ...

0x0ade commented 12 years ago

Guess can be closed - ruby error fixed , key press crash fixed by eventable add method for Keys and adding missing level parameter to createlevel event ( python ? ) .

master-lincoln commented 12 years ago

Thx