Solved Custom Enchantments Anvil Client Crash

Discussion in 'Spigot Plugin Development' started by Tabuu, Jun 4, 2018.

  1. Hello SpigotForum user,

    I have an issue with my custom enchants plugin. When I try to combine an item that has a custom enchant with a regular enchantment book my client crashes.


    Crash report:
    Code (Text):
    ---- Minecraft Crash Report ----
    // Ooh. Shiny.

    Time: 6/4/18 11:19 PM
    Description: Updating screen events

    java.lang.NullPointerException: Updating screen events
        at alk.c(SourceFile:106)
        at afs.e(SourceFile:244)
        at afs.a(SourceFile:150)
        at afs$1.y_(SourceFile:45)
        at uk.a(SourceFile:104)
        at agr.d(SourceFile:79)
        at afr.a(SourceFile:228)
        at bsa.a(SourceFile:422)
        at bmg.a(SourceFile:524)
        at bmg.b(SourceFile:495)
        at blk.k(SourceFile:406)
        at blk.q(SourceFile:377)
        at bib.t(SourceFile:1625)
        at bib.az(SourceFile:1000)
        at bib.a(SourceFile:419)
        at net.minecraft.client.main.Main.main(SourceFile:123)


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

    -- Head --
    Thread: Client thread
    Stacktrace:
        at alk.c(SourceFile:106)
        at afs.e(SourceFile:244)
        at afs.a(SourceFile:150)
        at afs$1.y_(SourceFile:45)
        at uk.a(SourceFile:104)
        at agr.d(SourceFile:79)
        at afr.a(SourceFile:228)
        at bsa.a(SourceFile:422)
        at bmg.a(SourceFile:524)
        at bmg.b(SourceFile:495)
        at blk.k(SourceFile:406)
        at blk.q(SourceFile:377)

    -- Affected screen --
    Details:
        Screen name: bmh

    -- Affected level --
    Details:
        Level name: MpServer
        All players: 1 total; [bud['Tabuu'/368, l='MpServer', x=-894.59, y=6.00, z=-1954.67]]
        Chunk stats: MultiplayerChunkCache: 441, 441
        Level seed: 0
        Level generator: ID 01 - flat, ver 0. Features enabled: false
        Level generator options:
        Level spawn location: World: (-892,4,-1955), Chunk: (at 4,0,13 in -56,-123; contains blocks -896,0,-1968 to -881,255,-1953), Region: (-2,-4; contains chunks -64,-128 to -33,-97, blocks -1024,0,-2048 to -513,255,-1537)
        Level time: 22899419 game time, 38000 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: creative (ID 1). Hardcore: false. Cheats: false
        Forced entities: 7 total; [bud['Tabuu'/368, l='MpServer', x=-894.59, y=6.00, z=-1954.67], aai['Snow Golem'/70, l='MpServer', x=-891.60, y=6.00, z=-1971.81], aai['Snow Golem'/71, l='MpServer', x=-894.21, y=6.00, z=-1970.59], aai['Snow Golem'/72, l='MpServer', x=-892.80, y=6.00, z=-1971.47], aai['Snow Golem'/73, l='MpServer', x=-895.28, y=6.00, z=-1972.31], aai['Snow Golem'/74, l='MpServer', x=-896.20, y=6.00, z=-1976.49], aai['Snow Golem'/75, l='MpServer', x=-892.77, y=6.00, z=-1974.49]]
        Retry entities: 0 total; []
        Server brand: Spigot
        Server type: Non-integrated multiplayer server
    Stacktrace:
        at bsb.a(SourceFile:366)
        at bib.b(SourceFile:2587)
        at bib.a(SourceFile:428)
        at net.minecraft.client.main.Main.main(SourceFile:123)

    -- System Details --
    Details:
        Minecraft Version: 1.12.2
        Operating System: Windows 10 (amd64) version 10.0
        Java Version: 1.8.0_51, Oracle Corporation
        Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
        Memory: 276808408 bytes (263 MB) / 419430400 bytes (400 MB) up to 1073741824 bytes (1024 MB)
        JVM Flags: 8 total; -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump -Xmx1G -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC -XX:G1NewSizePercent=20 -XX:G1ReservePercent=20 -XX:MaxGCPauseMillis=50 -XX:G1HeapRegionSize=16M
        IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
        Launched Version: 1.12.2
        LWJGL: 2.9.4
        OpenGL: GeForce GTX 750 Ti/PCIe/SSE2 GL version 4.6.0 NVIDIA 388.13, NVIDIA Corporation
        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: Probably not. Jar signature remains and client brand is untouched.
        Type: Client (map_client.txt)
        Resource Packs: Faithful 1.12.zip, LowFire.zip, No pumpkin.zip, Rainbow destroy.zip, Transgui.zip
        Current Language: English (US)
        Profiler Position: N/A (disabled)
        CPU: 4x Intel(R) Core(TM) i5-4460 CPU @ 3.20GHz
    To create the custom enchants I use the methodes by CaptainBern: https://bukkit.org/threads/custom-enchantments-you-say-what.160684/

    I was wondering if anybody has experienced this issue before...
     
    #1 Tabuu, Jun 4, 2018
    Last edited: Jun 5, 2018
  2. To the end of the tutorial he said that it will crash the client and you will have to use a listener to prevent that..
     
  3. From my experience the crash is unavoidable without a client mod. I made lava walker enchantment and it crashed the same way. The client calls a method internally to reference the enchantments name. However, the client does not know the name, it's null. It's hard to explain because obviously the client knows the name somewhere to display it on the book. But this one method doesn't reference its own name, it's a name from the Lang file or some crap, which obviously isn't there. This started in 1.9 or 1.10, I can't remember, when they added this internal method to the client. Anyways, I made a liteloader mod for my lava walker enchantment. It basically registered the new enchantment internally, the same way you're doing on the server end. Doing this on the client removed the crash, and actually gave me better control over the diaokay name via Lang file.
     
  4. I would be careful with registering enchantments directly to the Server, limited slots asides, custom enchantment plugins are guaranteed to overlap another. Work with NBT or just write it to the lore.
     
  5. Oh my... I am really bad at reading, thank you for pointing that out!
    [​IMG]
    Ah, that is bad news for me since I can't use any mods for this project. But thank you for giving a solution; maybe someone else with the same problem can use it.
    [​IMG]
    Working with NBT was my plan B, I'd rather use systems that are already in place. But it seems that using it those systems isn't very reliable.
    [​IMG]
    A big thanks to everybody for the help and support, I will be using @Blutkrone's suggestion. This thread wil be marked as solved!
     
    • Like Like x 1
  6. I recommend PowerNBT, I tested on the versions 1.10.2 to 1.12.2 without any issues (Dont forget that you need to write after reading!) You can try it on your versions.
     
  7. Thanks for the suggestion, fortunatly I have my own API that deals with things like that :D.