Client crashing on NPC attack

Discussion in 'Spigot Plugin Development' started by Martinusius2, Nov 10, 2018.

  1. Hello, few weeks ago I learnt about a simple way to disguise entities/players: 1. Set the id of the disguise (entity which another entity will be disgusied as) to the id of the disguising entity (that will make the disguise do everything the disguised does) 2. Remove the disguising entity using packets.

    Ok, now to my problem: I've decided to use the thing above to make NPCs that have health, can be punched and can attack you (basically disguising zombie villager as player). The problem is that whenever those disguised zombie villagers try to attack a player, the player's client crashes.

    This is the client error:
    Code (Text):

    Description: Rendering entity in world
    java.lang.ClassCastException: java.lang.Boolean cannot be cast to java.lang.Byte
        at aog.cS(SourceFile:2159)
        at dco.d(SourceFile:99)
        at dco.a(SourceFile:68)
        at dco.a(SourceFile:30)
        at cyo.a(RenderManager.java:434)
        at cyo.a(RenderManager.java:414)
        at cue.a(RenderGlobal.java:881)
        at cty.b(EntityRenderer.java:1394)
        at cty.a(EntityRenderer.java:1217)
        at cty.a(EntityRenderer.java:979)
        at cft.c(SourceFile:850)
        at cft.a(SourceFile:395)
        at net.minecraft.client.main.Main.main(SourceFile:144)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
        at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
     
    I was searching which packet is sent to player when hit by entity but I couldn't find anything so if you know which that'll help too.

    Edit: Happens everytime NPC hits another entity

    Edit 2: I guess the packet is something like play out animation but it's too late - gonna try it tomorrow.
     
    #1 Martinusius2, Nov 10, 2018
    Last edited: Nov 11, 2018

  2. The last time I had this error with pathfinders was when I did not put the right superclass.

    For example: Your CustomVillager MUST extend EntityVillager.

    Here, the problem is probably due to a entity, runned by an another entity.
     
  3. Well, I understand that but I dont know which packets are causing the problem so I could intercept them and change them.
     
  4. Looks like I have to do this manually.
    1: Move and rotation packets are fine

    Edit: Looks like problem is in entity metadata packet. If you know what could be causing it please let me know!
     
    #4 Martinusius2, Nov 11, 2018
    Last edited: Nov 11, 2018
  5. Code ?
     
  6. What about using LibsDisguises? It handles all the metadata already and optionally can show the disguise to the original player too.
    It also supports player.hidePlayer and other bukkit api calls

    https://www.spigotmc.org/resources/libs-disguises.32453/

    Older versions of it also support older minecraft versions. Also it is open source.
     
    • Agree Agree x 1

Share This Page