Disguising mob as another mob

Discussion in 'Plugin Development' started by girardcome, May 28, 2019.

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

    girardcome

    Hello, I'm stuck on a problem disguise a mob with another mob. How could I do that? Knowing that APIs with minecraft versions today are no longer running, at least they are not that many.

    I started to do the basics:
    Code:
    @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
        public void onRightClick(PlayerInteractEntityEvent event) {
            Player p = event.getPlayer();
            if (KitManager.hasKit(p, Kit.Woolymorph)) {
                if (event.getRightClicked().getType() == EntityType.CREEPER) {
                    p.sendMessage("Creeper is a sheep now!");
                    // DISGUISE MOB TO ANOTHER MOB
                }
            }
        }
    Thanks to those who will help me.
     
  2. Offline

    Zombie_Striker

    @girardcome
    IDisguise is still being updated (though the 1.14 version has not been released yet), so you should be able to use their API for now:
    https://www.spigotmc.org/resources/idisguise.5509/

    If you really want to write it yourself, the way those disguise plugins work is they get the entityID for the entity that should be changed, send a packet to all players online that that entity was "killed", and then immediately send another packet saying a new entity with the same entityID has been created, which will be the type you want to disguise the other entity as. Note that you would also have to listen for the entity sounds and either cancel them or replace them with the appropriate sounds for the entity type.
     
Thread Status:
Not open for further replies.

Share This Page