Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minebot and Zyin'sHud #108

Closed
beppe9000 opened this issue May 23, 2016 · 5 comments
Closed

Minebot and Zyin'sHud #108

beppe9000 opened this issue May 23, 2016 · 5 comments

Comments

@beppe9000
Copy link

beppe9000 commented May 23, 2016

The game crashes when some minebot commands are issued. walk seems not to be affected. The stack trace points at @Zyin055's HUD mod key handling, but the crash is triggered by /minebot store and a few other minebot actions.


UPDATE
Here is the actual functions mentioned by the stack trace:
ZyinHUDKeyHandlers.FireUseBlockEvents->Keyboard.isKeyDown->ByteBuffer.get

I investigated the sources and as the ByteBuffer.get page says it throws

IndexOutOfBoundsException - If index is negative or not smaller than the buffer's limit

So the number returned by mc.gameSettings.keyBindUseItem.getKeyCode() is negative or smaller than the buffer's limit.

I have unbinded most of zyinhud keys so maybe that can be the cause.

UPDATE 2
I'm starting to believe that this has to do with how Minebot simulates key presses.


Here it is the stack trace for completeness:

[23:37:19] [Client thread/INFO]: Evaluating: store
[23:37:19] [Client thread/INFO]: [net.famzangl.minecraft.minebot.ai.path.MovePathFinder:addHorizontalFastMove:282]: Shortcut from BlockPos{x=-405, y=57, z=969} to BlockPos{x=-412, y=57, z=965}
[23:37:21] [Client thread/ERROR]: Exception caught during firing event net.minecraftforge.fml.common.gameevent.TickEvent$ClientTickEvent@10fd1970:
java.lang.IndexOutOfBoundsException
    at java.nio.Buffer.checkIndex(Unknown Source) ~[?:1.8.0_77]
    at java.nio.DirectByteBuffer.get(Unknown Source) ~[?:1.8.0_77]
    at org.lwjgl.input.Keyboard.isKeyDown(Keyboard.java:407) ~[lwjgl-2.9.1.jar:?]
    at com.zyin.zyinhud.ZyinHUDKeyHandlers.FireUseBlockEvents(ZyinHUDKeyHandlers.java:185) ~[ZyinHUDKeyHandlers.class:?]
    at com.zyin.zyinhud.ZyinHUDKeyHandlers.ClientTickEvent(ZyinHUDKeyHandlers.java:161) ~[ZyinHUDKeyHandlers.class:?]
    at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_25_ZyinHUDKeyHandlers_ClientTickEvent_ClientTickEvent.invoke(.dynamic) ~[?:?]
    at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:55) ~[ASMEventHandler.class:?]
    at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:140) [EventBus.class:?]
    at net.minecraftforge.fml.common.FMLCommonHandler.onPreClientTick(FMLCommonHandler.java:366) [FMLCommonHandler.class:?]
    at net.minecraft.client.Minecraft.func_71407_l(Minecraft.java:1617) [bsu.class:?]
    at net.minecraft.client.Minecraft.func_71411_J(Minecraft.java:1028) [bsu.class:?]
    at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:345) [bsu.class:?]
    at net.minecraft.client.main.Main.main(SourceFile:120) [Main.class:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_77]
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_77]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_77]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_77]
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.11.jar:?]
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.11.jar:?]
[23:37:21] [Client thread/ERROR]: Index: 2 Listeners:
[23:37:21] [Client thread/ERROR]: 0: NORMAL
[23:37:21] [Client thread/ERROR]: 1: ASM: net.famzangl.minecraft.minebot.ai.AIController@77aa1e4 onPlayerTick(Lnet/minecraftforge/fml/common/gameevent/TickEvent$ClientTickEvent;)V
[23:37:21] [Client thread/ERROR]: 2: ASM: com.zyin.zyinhud.ZyinHUDKeyHandlers@43b60ce1 ClientTickEvent(Lnet/minecraftforge/fml/common/gameevent/TickEvent$ClientTickEvent;)V
[23:37:21] [Client thread/ERROR]: 3: ASM: com.zyin.zyinhud.mods.Miscellaneous@384841e3 ClientTickEvent(Lnet/minecraftforge/fml/common/gameevent/TickEvent$ClientTickEvent;)V
[23:37:21] [Client thread/ERROR]: 4: ASM: com.zyin.zyinhud.mods.HealthMonitor@248f1090 ClientTickEvent(Lnet/minecraftforge/fml/common/gameevent/TickEvent$ClientTickEvent;)V
[23:37:22] [Client thread/INFO]: Applying holder lookups
[23:37:22] [Client thread/INFO]: Holder lookups applied
[23:37:22] [Client thread/FATAL]: Unreported exception thrown!
java.lang.IndexOutOfBoundsException
    at java.nio.Buffer.checkIndex(Unknown Source) ~[?:1.8.0_77]
    at java.nio.DirectByteBuffer.get(Unknown Source) ~[?:1.8.0_77]
    at org.lwjgl.input.Keyboard.isKeyDown(Keyboard.java:407) ~[lwjgl-2.9.1.jar:?]
    at com.zyin.zyinhud.ZyinHUDKeyHandlers.FireUseBlockEvents(ZyinHUDKeyHandlers.java:185) ~[ZyinHUDKeyHandlers.class:?]
    at com.zyin.zyinhud.ZyinHUDKeyHandlers.ClientTickEvent(ZyinHUDKeyHandlers.java:161) ~[ZyinHUDKeyHandlers.class:?]
    at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_25_ZyinHUDKeyHandlers_ClientTickEvent_ClientTickEvent.invoke(.dynamic) ~[?:?]
    at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:55) ~[ASMEventHandler.class:?]
    at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:140) ~[EventBus.class:?]
    at net.minecraftforge.fml.common.FMLCommonHandler.onPreClientTick(FMLCommonHandler.java:366) ~[FMLCommonHandler.class:?]
    at net.minecraft.client.Minecraft.func_71407_l(Minecraft.java:1617) ~[bsu.class:?]
    at net.minecraft.client.Minecraft.func_71411_J(Minecraft.java:1028) ~[bsu.class:?]
    at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:345) [bsu.class:?]
    at net.minecraft.client.main.Main.main(SourceFile:120) [Main.class:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_77]
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_77]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_77]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_77]
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.11.jar:?]
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.11.jar:?]
[23:37:23] [Client thread/INFO]: [net.minecraft.init.Bootstrap:func_179870_a:571]: ---- Minecraft Crash Report ----

WARNING: coremods are present:
Contact their authors BEFORE contacting forge

// Don't do that.

Time: 23/05/16 23.37
Description: Unexpected error

java.lang.IndexOutOfBoundsException
    at java.nio.Buffer.checkIndex(Unknown Source)
    at java.nio.DirectByteBuffer.get(Unknown Source)
    at org.lwjgl.input.Keyboard.isKeyDown(Keyboard.java:407)
    at com.zyin.zyinhud.ZyinHUDKeyHandlers.FireUseBlockEvents(ZyinHUDKeyHandlers.java:185)
    at com.zyin.zyinhud.ZyinHUDKeyHandlers.ClientTickEvent(ZyinHUDKeyHandlers.java:161)
    at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_25_ZyinHUDKeyHandlers_ClientTickEvent_ClientTickEvent.invoke(.dynamic)
    at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:55)
    at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:140)
    at net.minecraftforge.fml.common.FMLCommonHandler.onPreClientTick(FMLCommonHandler.java:366)
    at net.minecraft.client.Minecraft.func_71407_l(Minecraft.java:1617)
    at net.minecraft.client.Minecraft.func_71411_J(Minecraft.java:1028)
    at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:345)
    at net.minecraft.client.main.Main.main(SourceFile:120)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28)


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- Head --
Stacktrace:
    at java.nio.Buffer.checkIndex(Unknown Source)
    at java.nio.DirectByteBuffer.get(Unknown Source)
    at org.lwjgl.input.Keyboard.isKeyDown(Keyboard.java:407)
    at com.zyin.zyinhud.ZyinHUDKeyHandlers.FireUseBlockEvents(ZyinHUDKeyHandlers.java:185)
    at com.zyin.zyinhud.ZyinHUDKeyHandlers.ClientTickEvent(ZyinHUDKeyHandlers.java:161)
    at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_25_ZyinHUDKeyHandlers_ClientTickEvent_ClientTickEvent.invoke(.dynamic)
    at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:55)
    at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:140)
    at net.minecraftforge.fml.common.FMLCommonHandler.onPreClientTick(FMLCommonHandler.java:366)

-- Affected level --
Details:
    Level name: MpServer
    All players: 1 total; [EntityPlayerSP['redacted'/52862, l='MpServer', x=-411,52, y=57,00, z=965,49]]
    Chunk stats: MultiplayerChunkCache: 121, 121
    Level seed: 0
    Level generator: ID 00 - default, ver 1. Features enabled: false
    Level generator options: 
    Level spawn location: 0,00,65,00,0,00 - World: (0,65,0), Chunk: (at 0,4,0 in 0,0; contains blocks 0,0,0 to 15,255,15), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511)
    Level time: 153946094 game time, 209490050 day time
    Level dimension: 0
    Level storage version: 0x00000 - Unknown?
    Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false)
    Level game mode: Game mode: survival (ID 0). Hardcore: false. Cheats: false
    Forced entities: 7 total; [EntityPlayerSP['redacted'/52862, l='MpServer', x=-411,52, y=57,00, z=965,49], EntityItemFrame['entity.ItemFrame.name'/33938375, l='MpServer', x=-416,03, y=57,50, z=960,50], EntityItemFrame['entity.ItemFrame.name'/33939254, l='MpServer', x=-416,03, y=57,50, z=956,50], EntityItemFrame['entity.ItemFrame.name'/34036372, l='MpServer', x=-416,03, y=57,50, z=952,50], EntityItemFrame['entity.ItemFrame.name'/33937325, l='MpServer', x=-416,03, y=57,50, z=964,50], EntityItemFrame['entity.ItemFrame.name'/33932175, l='MpServer', x=-416,03, y=57,50, z=968,50], EntityItemFrame['entity.ItemFrame.name'/33921848, l='MpServer', x=-416,03, y=57,50, z=969,50]]
    Retry entities: 0 total; []
    Server brand: BungeeCord (git:BungeeCord-Bootstrap:1.8-SNAPSHOT:"585ab4f":1064) <- Spigot
    Server type: Non-integrated multiplayer server
Stacktrace:
    at net.minecraft.client.multiplayer.WorldClient.func_72914_a(WorldClient.java:407)
    at net.minecraft.client.Minecraft.func_71396_d(Minecraft.java:2502)
    at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:374)
    at net.minecraft.client.main.Main.main(SourceFile:120)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

-- System Details --
Details:
    Minecraft Version: 1.8
    Operating System: Windows 10 (amd64) version 10.0
    Java Version: 1.8.0_77, Oracle Corporation
    Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
    Memory: 193839624 bytes (184 MB) / 995622912 bytes (949 MB) up to 995622912 bytes (949 MB)
    JVM Flags: 2 total; -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump -Xmx1G
    IntCache: cache: 0, tcache: 0, allocated: 13, tallocated: 95
    FML: MCP v9.10 FML v8.0.99.99 Minecraft Forge 11.14.4.1577 Optifine OptiFine_1.8_HD_U_H5 7 mods loaded, 7 mods active
    States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored
    UCHIJAAAAAA mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) 
    UCHIJAAAAAA FML{8.0.99.99} [Forge Mod Loader] (forge-1.8-11.14.4.1577.jar) 
    UCHIJAAAAAA Forge{11.14.4.1577} [Minecraft Forge] (forge-1.8-11.14.4.1577.jar) 
    UCHIJAAAAAA minebot-mod{0.3.0} [Minebot] (Minebot-1.0.jar) 
    UCHIJAAAAAA UltraBiomes{1.0} [IPChat] (modid-1.0.jar) 
    UCHIJAAAAAA XaeroMinimap{1.9} [Xaero's Minimap] (Xaeros_Minimap_1.9_Forge_1.8.jar) 
    UCHIJAAAAAA zyinhud{1.4.5} [Zyin's HUD] (ZyinsHUD-(1.8)-v.1.4.6.jar) 
    Loaded coremods (and transformers): 
    GL info: ' Vendor: 'ATI Technologies Inc.' Version: '4.5.13399 Compatibility Profile Context 15.201.1151.1008' Renderer: 'ASUS EAH5450 Series'
    Launched Version: 1.8
    LWJGL: 2.9.1
    OpenGL: ASUS EAH5450 Series GL version 4.5.13399 Compatibility Profile Context 15.201.1151.1008, ATI Technologies Inc.
    GL Caps: Using GL 1.3 multitexturing.
Using GL 1.3 texture combiners.
Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported.
Shaders are available because OpenGL 2.1 is supported.
VBOs are available because OpenGL 1.5 is supported.

    Using VBOs: Yes
    Is Modded: Definitely; Client brand changed to 'fml,forge'
    Type: Client (map_client.txt)
    Resource Packs: [Clean Glass]
    Current Language: English (US)
    Profiler Position: N/A (disabled)
    OptiFine Version: OptiFine_1.8_HD_U_H5
    Render Distance Chunks: 16
    Mipmaps: 4
    Anisotropic Filtering: 1
    Antialiasing: 0
    Multitexture: false
    Shaders: null
    OpenGlVersion: 4.5.13399 Compatibility Profile Context 15.201.1151.1008
    OpenGlRenderer: ASUS EAH5450 Series
    OpenGlVendor: ATI Technologies Inc.
    CpuCount: 8
@beppe9000 beppe9000 changed the title Game Crash with Forge, Optifine & LiteLoader setup Minebot and Zyin'sHud May 23, 2016
@beppe9000
Copy link
Author

beppe9000 commented May 24, 2016

I finally found the most likely cause of the crash: it has to do with how Minebot injects the key presses by overwriting the keybind with a subclassed one.
So, when Zyin's HUD uses mc.gameSettings.keyBindUseItem.getKeyCode() to get the key code passed to Keyboard.isKeyDown the key code is negative or out of bounds.

The solution

  • @michaelzangl -> I don't know java very well but i think that there is something wrong with the InteractAlways's getKeyCode that prevents it to return a proper key code when asked. Overriding it and calling the super class one should fix it.
  • @Zyin055 -> You could check if there is a more forge-friendly way of doing that.

I will do a test with Zyin's Hud.

UPDATE

I tested it with a modified version of Zyin's mod and got this right before the crash:

getKeyCode = 501
MOUSE = false

@michaelzangl
Copy link
Owner

Workaround: Decrease the key codes Minebot uses to be less than 256 (find some that are not conflicting with your physical keyboard).

Fix: Use the key objects the way Minecraft wants you to use them: Zyin055/zyinhud#59

@beppe9000
Copy link
Author

beppe9000 commented May 24, 2016

Hey @michaelzangl I don't get this: why is the keycode 501 and not -99? Wouldn't make sense to send the same of the original keybind?

@michaelzangl
Copy link
Owner

No, it would not.

The bot is using sort of a virtual keyboard. Otherwise, it would conflict with your real keyboard.

@beppe9000
Copy link
Author

Uh, so you have another Keyboard object somewhere?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants