Development Assistance [Problem] Entity won't obey it's goal

Discussion in 'Plugin Help/Development/Requests' started by westjet, Mar 1, 2015.

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



    I'm attempting to create a brand new "Snake" plugin to use on my server that supports 1.8. However, I'm not certain as to whats the best way to make all the snake follow each other in a line.
    For those that have never played it, here's the effect I'm trying to achieve:
    Any ideas?
    Last edited: Mar 7, 2015
  2. Offline

    timtower Administrator Administrator Moderator

    Moved to Bukkit alternatives.
    @westjet Chances are big that those are custom coded mobs
  3. Offline


    @timtower Can confirm, am friends with Mineplex dev.
  4. Offline


    Isn't the whole point of plugins to make things custom-coded? I thought that Mineplex just uses

    If I want to custom-code a mob, would I make a class that extends EntitySheep (or whatever they call it)? And if I do that, what commands would I use to make a sheep follow another sheep? Can the same command be used to make a sheep follow a player?
  5. Offline

    timtower Administrator Administrator Moderator

    @westjet They just tell the sheep to move to a specific location. You can let it follow items if you want.
  6. Offline


    How can I set a custom sheep's pathfinder goal to a player or another sheep? (I'm using NMS)
  7. Offline


    Problem: I spawn in a custom sheep, and I tried creating a new Pathfinder goal for it. Here's the goal code:

    Show Spoiler

    package com.westjet.realquicktest;
    import org.bukkit.Bukkit;
    import org.bukkit.Location;
    import net.minecraft.server.v1_8_R1.EntityCreature;
    import net.minecraft.server.v1_8_R1.PathEntity;
    import net.minecraft.server.v1_8_R1.PathfinderGoal;
    import net.minecraft.server.v1_8_R1.Vec3D;
    public class PathfinderSnake extends PathfinderGoal {
        float speed;
        private EntityCreature entitycreature;
        private PathEntity path;
        public PathfinderSnake(EntityCreature entitycreature, float speed){
            this.speed = speed;
            this.entitycreature = entitycreature;
        public boolean a() {
            Location targetLocation = new Location(Bukkit.getWorld("world"), 30, 63, 400);
       this.path = this.entitycreature.getNavigation().a(targetLocation.getX(), targetLocation.getY(), targetLocation.getZ());
            return this.path != null;
        public void c() { 
            this.entitycreature.getNavigation().a(this.path, (double) this.speed);
        public boolean b() {
            return true;
    And for the custom Sheep class:

    package com.westjet.realquicktest;
    import java.lang.reflect.Field;
    import org.bukkit.Bukkit;
    import org.bukkit.craftbukkit.v1_8_R1.util.UnsafeList;
    import org.bukkit.entity.Player;
    import net.minecraft.server.v1_8_R1.EntitySheep;
    import net.minecraft.server.v1_8_R1.PathfinderGoalFloat;
    import net.minecraft.server.v1_8_R1.PathfinderGoalSelector;
    public class CustomEntitySheep extends EntitySheep {
        private float bw;
        public CustomEntitySheep(net.minecraft.server.v1_8_R1.World mcWorld) {
   = 0.50F;
            try {
                Field bField = PathfinderGoalSelector.class.getDeclaredField("b");
                Field cField = PathfinderGoalSelector.class.getDeclaredField("c");
                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) {
            this.goalSelector.a(0, new PathfinderGoalFloat(this));
            this.goalSelector.a(new PathfinderSnake(this, (float);

    I register everything and spawn the sheep in, and, if I don't use the default goals, it just stands still. I want it to move to a certain position, block, entity, player, really anything!
    Last edited: Mar 7, 2015
Thread Status:
Not open for further replies.

Share This Page