Solved [NMS] protected void aD()

Discussion in 'Plugin Help/Development/Requests' started by DemKazoo, Apr 4, 2015.

Thread Status:
Not open for further replies.
  1. Offline

    DemKazoo

    Hey guys, so I was working on a custom entity recently, and everything worked fine in the 1.7/1.6 versions of Minecraft/NMS. Untill I started working with 1.8,
    Code:
    net.minecraft.server.v1_8_R2
    For some particular reason, the protected void aD() { doesn't seem to work and my IDE tells me to change it to a boolean, I'm pretty sure that won't work, but I still tried it and it messed up the entire NMS code.

    Here is the custom entity class:

    Code:
        public Tarek(World world) {
            super(world);
    
            try {
                Field bField = PathfinderGoalSelector.class.getDeclaredField("b");
                bField.setAccessible(true);
                Field cField = PathfinderGoalSelector.class.getDeclaredField("c");
                cField.setAccessible(true);
                bField.set(goalSelector, new UnsafeList<PathfinderGoalSelector>());
                bField.set(targetSelector, new UnsafeList<PathfinderGoalSelector>());
                cField.set(goalSelector, new UnsafeList<PathfinderGoalSelector>());
                cField.set(targetSelector, new UnsafeList<PathfinderGoalSelector>());
            } catch (Exception exc) {
                exc.printStackTrace();
            }
    
            this.goalSelector.a(0, new PathfinderGoalFloat(this));
    
        }
    
        @Override
        protected void aD() { //Here is the error
            super.aD();
            this.getAttributeInstance(GenericAttributes.e).setValue(1.0D);
        }
    }
    The class is extending EntityVillager, if that was necessary to know :p
    Anyway, I need this fixed soon doe, it's frustrating me.

    I checked every single github source of spigot/bukkit Entity<>.java, for 1.8, and it still says I need to use protected void aD() {, all though I'm not sure if the github is actually 1.8..
     
  2. Offline

    mrCookieSlime

    Moved to Alternatives Section.
     
  3. Offline

    DemKazoo

  4. Offline

    Funergy

    @DemKazoo In every version Mojang obfuscates his code.
    This means that "protected void bD()" in 1.7.5 is "protected void pR()" in 1.8 <- Just an example
    So you will need to find it manually. But its not hard. The method in 1.7.5 is almost everytime at the same place for 1.8 (for example line 10).
     
    Last edited: Apr 4, 2015
  5. Offline

    DemKazoo

    Thanks for your reply, I tried my best on finding it out, I've like tried almost every combination I can imagine so far.
    After that, I again tried to find it online but the issue is, Spigot is not open source on bukkit, and the bukkit repository is not updated because, ya know.. ;-;
     
  6. Offline

    Funergy

    @DemKazoo Haha. You can decompile it in JD-GUI or use IntelliJ's automatically installed decompiler.
     
    DemKazoo likes this.
  7. Offline

    DemKazoo

    Didn't know we were allowed to, anyway it helped thanks!
     
Thread Status:
Not open for further replies.

Share This Page