diff --git a/projects/core/src/main/java/dan200/computercraft/core/asm/MethodSupplierImpl.java b/projects/core/src/main/java/dan200/computercraft/core/asm/MethodSupplierImpl.java index 44e5775e4c..16141485d8 100644 --- a/projects/core/src/main/java/dan200/computercraft/core/asm/MethodSupplierImpl.java +++ b/projects/core/src/main/java/dan200/computercraft/core/asm/MethodSupplierImpl.java @@ -76,7 +76,7 @@ public boolean forEachMethod(Object object, TargetedConsumer consumer) { for (var extra : source.getExtra()) { var extraMethods = getMethods(extra.getClass()); if (!extraMethods.isEmpty()) hasMethods = true; - for (var method : extraMethods) consumer.accept(object, method.name(), method.method(), method); + for (var method : extraMethods) consumer.accept(extra, method.name(), method.method(), method); } } diff --git a/projects/core/src/test/java/dan200/computercraft/core/asm/MethodTest.java b/projects/core/src/test/java/dan200/computercraft/core/asm/MethodTest.java index a61b15ec00..c405250076 100644 --- a/projects/core/src/test/java/dan200/computercraft/core/asm/MethodTest.java +++ b/projects/core/src/test/java/dan200/computercraft/core/asm/MethodTest.java @@ -58,7 +58,7 @@ public void testDynamicPeripheral() { @Test public void testExtra() { - ComputerBootstrap.run("assert(extra.go, 'go')\nassert(extra.go2, 'go2')", + ComputerBootstrap.run("assert(extra.go() == nil, 'go')\nassert(extra.go2() == 456, 'go2')", x -> x.addApi(new ExtraObject()), 50); } @@ -163,7 +163,8 @@ public String[] getNames() { } @LuaFunction - public final void go2() { + public final int go2() { + return 456; } @Override