1.15.2 Adding a custom entity into the game

Discussion in 'Spigot Plugin Development' started by kingmo100, Feb 2, 2020.

  1. Thank you very much , now I'm able to spawn my CustomZombie,

    Now I need to clear his actual Zombie's Goals and Target and put my own PathfinderGoal.
    do you know how I could do this ?
  2. Override the initPathfinder method
    #22 Schottky, Feb 12, 2020
    Last edited: Feb 13, 2020
    • Agree Agree x 1
  3. I tried several things to ask my Zombie to go to a Location,
    I have my PathfinderGoal :
    Code (Text):
        public PathfinderGoalWalkToLoc(EntityCreature entitycreature, float speed){
            this.entitycreature = entitycreature;
            this.speed = speed;

        public boolean a(){
            return true;

        public void c(){
            this.entitycreature.getNavigation().a(-48, 66.0, -246.0, speed);//Location I want my Zombie to go
    And in the initPathfinderGoals I did :
    Code (Text):
        protected void initPathfinder() {
            this.goalSelector.a(1, (new PathfinderGoalWalkToLoc(this, 1)));
            this.setOnFire(0, false); // Zombie not burning anymore

    and now my Zombie doesn't move anymore (and still burning by daylight)
  4. not sure if this is the case for why your zombie is not moving, but it might be due to the fact that it it always requests an update.
    Try to store your location as Vector and only update if the values are not set (resp. when they are 0)

    For why it's still burning: This is basically what's happening in the method:
    Code (Java):
    int j = i * 20;

    if (this.fireTicks < j) {
        this.fireTicks = j;
    You are setting it's fire-ticks to 0. But once it comes into contact with sunlight, it starts burning again.There are several ways of keeping the zombie from burning:
    1) Equip it with a Helmet
    2) Override the tick()-Method. Keep in mind thou, that you will have to 'mock' all the super tick-Methods because otherwise nothing will happen anymore
    3) Listen for the EntityCombustEvent and cancel it
    4) override the setOnFire-method (I think this is the way to go)
  5. Yo quick Q How do I spawn the custom entity with armor in initially
  6. Try adding the armor either in the constructor or in your custom entity's maker where the constructor is invoked.
  7. I figured it out. for future notice cast spawned entity as a living entity.
  8. I love you, thanks for assisting with this.
    • Friendly Friendly x 1