Solved Need help with spawning NMS mob

Discussion in 'Plugin Development' started by TheBrightnessMan, Dec 30, 2020.

  1. I've made a custom zombie but it didn't seem to spawn in
    Here's my code
    Code:
    public class CustomZombie extends EntityZombie{
    
    public CustomZombie (net.minecraft.server.v1_16_R3.World world) {
    super(EntityTypes.ZOMBIE, world); this.getWorld().addEntity(this, CreatureSpawnEvent.SpawnReason.CUSTOM);}
    
    public CustomZombie (org.bukkit.World world) {
    super(EntityTypes.ZOMBIE, ((CraftWorld) world).getHandle()); this.getWorld().addEntity(this, CreatureSpawnEvent.SpawnReason.CUSTOM);}
    
    public void spawn(Location location) {
    this.setPosition(location.getX(), location.getY(), location.getZ());}
    }
    
    When I run the spawn() method, I tried to debug by sending
    String.valueOf(customZombie)
    and it seemed to be working, it showed the name of the world, and the location of the zombie, but no zombie spawned in

    Any help is appreciated

    EDIT: I somehow fixed it, no idea how but it works nonetheless
     
    Last edited: Dec 30, 2020

Share This Page