Solved Pathfinders in 1.17

Discussion in 'Spigot Plugin Development' started by KotoHacker, Jun 11, 2021.

Thread Status:
Not open for further replies.
  1. With new version methods like goalSelector and targetSelector was disappeared. What should I replace them with?

    And, already from 1.16 I have problem with clearing bField. new UnsafeList<PathfinderGoalSelector>()) doesn't works. What should I replace this with too?

    Code:
    Code (Text):
    public void removePathFinders(Entity entity) {
            EntityCreature c = (EntityCreature) ((CraftEntity) entity).getHandle();
            try {
                Field bField = PathfinderGoalSelector.class.getDeclaredField("b");
                bField.setAccessible(true);
                Field cField = PathfinderGoalSelector.class.getDeclaredField("c");
                cField.setAccessible(true);
                bField.set(c.goalSelector, new UnsafeList<PathfinderGoalSelector>());
                bField.set(c.targetSelector, new UnsafeList<PathfinderGoalSelector>());
                cField.set(c.goalSelector, new EnumMap<>(PathfinderGoal.Type.class));
                cField.set(c.targetSelector, new EnumMap<>(PathfinderGoal.Type.class));
            } catch (Exception exc) {
                exc.printStackTrace();
            }
        }
     
  2. Read annoucment of 1.17 at developers notes about nms, they reverted to obfuscates names of methods or something idk
     
  3. Have you all conspired or what? I know, but I can't find the method I need.
     
  4. gsk

    gsk

    I believe you are looking for this:
    upload_2021-6-11_14-15-42.png
    bO and bP are the the goalSelector and targetSelector. I'm not sure which is which yet.
     
    • Agree Agree x 1
  5. How have you done the mappings thing?
     
  6. Doing this with Mojang mappings is much more fun. You can reobfuscate your jar afterwards using specialsource.
     
  7. Thanks! It works...? I can't check it because i've this error when compiling project using maven:
    I am importing this class. This also applies to other similar package classes.
     
  8. I changed JDK to 16 in my project. Now it has compiled.
     
  9. Solved. I removed this code.
     
Thread Status:
Not open for further replies.