GithubHelp home page GithubHelp logo

Comments (7)

JitseB avatar JitseB commented on June 15, 2024 1

Solved. Will soon post a release with the fix.

from npclib.

RealGatt avatar RealGatt commented on June 15, 2024

Upon further research, the issue seems to be due to SlimeWorldManager as it creates a new World object ( example )

Not sure if this is something that is fixable on your end.

from npclib.

RealGatt avatar RealGatt commented on June 15, 2024

I've forked NPCLib and attempted to fix it.

Reflection.ConstructorInvoker entityArmorStandConstructor = null;
        try{
            System.out.println("Method 1 Attempt " + worldClass.getName());
            entityArmorStandConstructor = (version.isAboveOrEqual(MinecraftVersion.V1_14_R1) ?
                    Reflection.getConstructor(ENTITY_ARMOR_STAND_CLAZZ, worldClass, double.class, double.class, double.class) :
                    Reflection.getConstructor(ENTITY_ARMOR_STAND_CLAZZ, worldClass));
            System.out.println("Method 1");
        }catch (Exception e){
            System.out.println("Method 1 Failed");
            try {
                worldClass = worldClass.getSuperclass();

                System.out.println("Method 2 Attempt " + worldClass.getName());

                entityArmorStandConstructor = (version.isAboveOrEqual(MinecraftVersion.V1_14_R1) ?
                        Reflection.getConstructor(ENTITY_ARMOR_STAND_CLAZZ, worldClass, double.class, double.class, double.class) :
                        Reflection.getConstructor(ENTITY_ARMOR_STAND_CLAZZ, worldClass));

                System.out.println("Method 2");
            }catch (Exception e2){

                System.out.println("Method 2 Failed");
                if (Bukkit.getPluginManager().getPlugin("SlimeWorldManager") != null){

                    try {
                        worldClass = Reflection.getUntypedClass("com.grinderwolf.swm.nms." + NPCLib.getVersionName() + ".CustomWorldServer");

                        worldClass = worldClass.getSuperclass().getSuperclass();

                        System.out.println("Method 3 Attempt " + worldClass.getName());

                        entityArmorStandConstructor = (version.isAboveOrEqual(MinecraftVersion.V1_14_R1) ?
                                Reflection.getConstructor(ENTITY_ARMOR_STAND_CLAZZ, worldClass, double.class, double.class, double.class) :
                                Reflection.getConstructor(ENTITY_ARMOR_STAND_CLAZZ, worldClass));

                        System.out.println("Method 3");
                    }catch (Exception e3){
                        System.out.println("Failing silently... or not");
                    }
                }
            }
        }

Using the above code I was able to get the NPCs' to spawn with SlimeWorldManager. The main portion of the code is getting the SuperClass of the WorldServer object thats retrieved.

        Reflection.ConstructorInvoker entityArmorStandConstructor = null;
        try{
            entityArmorStandConstructor = (version.isAboveOrEqual(MinecraftVersion.V1_14_R1) ?
                    Reflection.getConstructor(ENTITY_ARMOR_STAND_CLAZZ, worldClass, double.class, double.class, double.class) :
                    Reflection.getConstructor(ENTITY_ARMOR_STAND_CLAZZ, worldClass));
        }catch (Exception e){
            try {
                worldClass = worldClass.getSuperclass();

                entityArmorStandConstructor = (version.isAboveOrEqual(MinecraftVersion.V1_14_R1) ?
                        Reflection.getConstructor(ENTITY_ARMOR_STAND_CLAZZ, worldClass, double.class, double.class, double.class) :
                        Reflection.getConstructor(ENTITY_ARMOR_STAND_CLAZZ, worldClass));
}

Should fix the issue.

Now I'm getting a new issue with non 1.8 clients on a 1.8 server; they get kicked with an ArrayIndexOutOfBoundsException: 6 error. The same issue that #58 is getting

from npclib.

JitseB avatar JitseB commented on June 15, 2024

I'll see what I can do about this. With your fix it should be the same issue as found in #58.
Are you using any sort of server proxy? E.g. BungeeCord?

from npclib.

RealGatt avatar RealGatt commented on June 15, 2024

We're running Waterfall w/ ViaVersion on the Proxy & locally on the 1.8 servers.

If you go onto the server w/ a 1.8 client it works fine, but on any other version it crashes with that error. I don't know enough about packets to properly diagnose the issue myself

from npclib.

JitseB avatar JitseB commented on June 15, 2024

Issue #58 has been solved. I'll add your additions to the library so you can use your JDK of choice.
Hopefully I'll have an update posted by the end of the day.

from npclib.

JitseB avatar JitseB commented on June 15, 2024

https://github.com/JitseB/NPCLib/releases/tag/2.4.2-SNAPSHOT

from npclib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.