Solved Docile Creeper

Discussion in 'Spigot Plugin Development' started by Nowaha, Jan 14, 2020.

Thread Status:
Not open for further replies.
  1. Hello!

    I'm trying to make a plugin used for Factions, where creepers who are placed using spawn eggs will not follow any targets and will only do their usual random walking around. I tried just disabling the AI, I tried modifying it's pathfinder (Paper) making it follow a pig (it still targets the player if they are in range), I tried changing the explosion time (it just swells up and looks very stupid, and still follows the player).

    Pathfinder code:
    Code (Java):
    @EventHandler(ignoreCancelled = true)
    public void onCreeperSpawn(CreatureSpawnEvent e) {
        if (e.getEntityType().equals(EntityType.CREEPER) && e.getSpawnReason().equals(CreatureSpawnEvent.SpawnReason.SPAWNER_EGG)) {
            Creeper creeper = (Creeper) e.getEntity();
            Pig follow = (Pig) e.getEntity().getWorld().spawnEntity(e.getEntity().getLocation(), EntityType.PIG);

            Bukkit.getScheduler().scheduleSyncRepeatingTask(this, () -> {
            }, 0, 1);
    How can I achieve this effect? I can't find anything about this. Thank you!

    EDIT: I managed to get it to stop following the player, but it still explodes while in range and stays on it's spot (it does rotate around though).

    Code (Java):
    #1 Nowaha, Jan 14, 2020
    Last edited: Jan 14, 2020
  2. 1) Those are paper methods.
    2) You need to extend EntityCreeper and either override the pathfinding methods or clear the Pathfinder goals

    For example this one will just float in water and stroll around randomly.
    #2 7smile7, Jan 14, 2020
    Last edited: Jan 14, 2020
    • Useful Useful x 1
  3. I'm sure that would have worked as well, but I have discovered a far simpler solution: cancelling the EntityTargetEvent for the creeper. Appreciate the help!
Thread Status:
Not open for further replies.