Search code examples
minecraftbukkit

This doesn't work, not sure why... SpigotMC


Why isnt the EntityZombieHusk working here? I'm using 1.16.5 jar file for this

package com.TheRealBee.mob;

public class CustomPet extends EntityZombieHusk{}

Any help is appreciated
My IDE has a function that makes it so that if the class is not imported it would give you suggestions on what to import but none showed up

Error type: Cannot resolve symbol "EntityZombieHusk"

Edit: I forgot to import the spigot-1.16.5.jar


Solution

  • The IDE returns an error because it doesn't know where the EntityZombieHusk class is. That class in not present in the Bukkit/Spigot API, which means you have to import NMS (net.minecraft.server) to use it.


    To import NMS:

    Maven:

    <dependency>
        <groupId>org.spigotmc</groupId>
        <artifactId>spigot</artifactId>
        <version>version</version>
        <scope>provided</scope>
    </dependency>
    

    Gradle:

    compileOnly "org.spigotmc:spigot:version"
    

    Note: Make sure to change the version; otherwise, it won't work.