MightyPirates / OpenComputers

Home of the OpenComputers mod for Minecraft.
https://oc.cil.li
Other
1.59k stars 433 forks source link

Use shear for sheep return fail. #62

Closed ghost closed 10 years ago

ghost commented 10 years ago

robot.use() with shears.

result = false reason = li.cli.oc.server.component.robot.Player.func_70666_h(F)Lnet/minecraft/util/Vec3;

MC/Forge Version: 1.6.4 / 9.11.1.965 OC Version: 1.1.0pr2a (I check commit but can't find any related issue)

No crash, and no detail log in here. (I check server/client both but can't find any message)

fnuecke commented 10 years ago

Can't reproduce in Forge 953, will try 965 later. Are you using a "special" version of Minecraft? (anything other than vanilla launcher with Forge via its installer, such as MCPC+ for example)

ghost commented 10 years ago

No, just use Forge 965, and any shears (include DartCraft, RailCraft, ThermalExpansion, etc) are not work with sheep. (while human and ThermalExpansion Autonomus Activator are work well.)

I will test later other tools are not work by robot.use() (possible entity targeting fail in my modpack; tools that apply to block (like wrench) don't have problem) and update to latest version.

fnuecke commented 10 years ago

Can't reproduce in Forge 956, either. With OC and the three mentioned mods I tried it with all four kinds of shears (normal, steel, force and invar) and it worked and I got no errors. Try re-downloading OC, and while you're at it get prerelease 3.

ghost commented 10 years ago

No idea, i test with latest version with OC 1.1.0pr3, and It failed with same reason. I will check slowly.

Maybe full stacktrace will help for fix this issue. (And i suggest don't return exception in reason, all robot function?)

DEV RESOURCE: MD: of/l (F)Latc; net/minecraft/entity/EntityLivingBase/func_70666_h (F)Lnet/minecraft/util/Vec3; #C func_70666_h,getPosition,0,interpolated position vector

fnuecke commented 10 years ago

Prerelease 4 has a new config option, computer.logCallbackErrors. Set this to true and it'll log the traceback to the game log when something goes wrong in a Lua callback.

ghost commented 10 years ago
 2014-01-07 04:59:11 [WARN] [OpenComputers] Exception in Lua callback.
 li.cil.oc.server.component.Computer$LimitReachedException$1
       at li.cil.oc.server.component.Computer$$anonfun$init$25.apply(Computer.scala:989)
       at li.cil.oc.server.component.Computer$$anonfun$init$25.apply(Computer.scala:976)
       at li.cil.oc.util.ExtendedLuaState$ExtendedLuaState$$anon$1.invoke(ExtendedLuaState.scala:17)
       at com.naef.jnlua.LuaState.lua_resume(Native Method)
       at com.naef.jnlua.LuaState.resume(LuaState.java:1746)
       at li.cil.oc.server.component.Computer.liftedTree3$1(Computer.scala:1227)
       at li.cil.oc.server.component.Computer.run(Computer.scala:1210)
       at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
       at java.util.concurrent.FutureTask.run(FutureTask.java:262)
       at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.jaa:178)
       at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
       at java.lang.Thread.run(Thread.java:724)

Test in single-player don't make that problem (Windows x64) And in server make that exception (Windows x64)

Where is li.cli.oc.server.component.robot.Player.func_70666_h(F)Lnet/minecraft/util/Vec3;? And robot.use()'s second return (reason) are now return full exception stacktrace if set computer.logCallbackErrors

Environ: No disk no program but only lua and execute robot.use()

fnuecke commented 10 years ago

Eh, forgot to suppress that one. Ignore the LimitReachedExceptions, those are normal and used for control flow (yeah yeah, bad practice, so sue me). But I had another look at func_70666_h, and it turns out it's sided (for no apparent reason and with the annotation well hidden above the comment). So that's probably what caused it.

ghost commented 10 years ago
2014-01-07 04:59:07 [WARN] [OpenComputers] Exception in Lua callback.
java.lang.NoSuchMethodError: li.cil.oc.server.component.robot.Player.func_70666_h(F)Lnet/minecraft/util/Vec3;
        at li.cil.oc.server.component.Robot.li$cil$oc$server$component$Robot$$pick(Robot.scala:593)
        at li.cil.oc.server.component.Robot$$anonfun$use$1.apply(Robot.scala:437)
        at li.cil.oc.server.component.Robot$$anonfun$use$1.apply(Robot.scala:427)
        at scala.collection.IndexedSeqOptimized$class.foreach(IndexedSeqOptimized.scala:33)
        at scala.collection.mutable.WrappedArray.foreach(WrappedArray.scala:34)
        at li.cil.oc.server.component.Robot.use(Robot.scala:427)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at li.cil.oc.server.network.Component$Callback.apply(Component.scala:147)
        at li.cil.oc.server.network.Component$class.invoke(Component.scala:76)
        at li.cil.oc.server.network.Network$ComponentConnectorBuilder$$anon$1.invoke(Network.scala:456)
        at li.cil.oc.server.component.Computer$$anonfun$init$25.apply(Computer.scala:993)
        at li.cil.oc.server.component.Computer$$anonfun$init$25.apply(Computer.scala:976)
        at li.cil.oc.util.ExtendedLuaState$ExtendedLuaState$$anon$1.invoke(ExtendedLuaState.scala:17)
        at com.naef.jnlua.LuaState.lua_pcall(Native Method)
        at com.naef.jnlua.LuaState.call(LuaState.java:669)
        at li.cil.oc.server.component.Computer.liftedTree1$1(Computer.scala:317)
        at li.cil.oc.server.component.Computer.update(Computer.scala:313)
        at li.cil.oc.common.tileentity.Computer.func_70316_g(Computer.scala:89)
        at li.cil.oc.common.tileentity.Robot.func_70316_g(Robot.scala:273)
        at li.cil.oc.common.tileentity.RobotProxy.func_70316_g(RobotProxy.scala:65)
        at net.minecraft.world.World.func_72939_s(World.java:2209)
        at net.minecraft.world.WorldServer.func_72939_s(WorldServer.java:550)
        at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:668)
        at net.minecraft.server.dedicated.DedicatedServer.func_71190_q(DedicatedServer.java:276)
        at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:587)
        at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:484)
        at net.minecraft.server.ThreadMinecraftServer.run(SourceFile:583)

Oh, found it. sorry

https://github.com/MightyPirates/OpenComputers/blob/master/li/cil/oc/server/component/Robot.scala#L593

fnuecke commented 10 years ago

Could you please verify this doesn't happen anymore in prerelease 4a. Thanks.

ghost commented 10 years ago

After 4 hours, i will report result. (Require server restart so i must wait some hours)

ghost commented 10 years ago

Fixed. always thanks!