CatsAttack

Discussion in 'Plugin Requests' started by Smurfamel, Dec 29, 2019.

  1. Offline

    Smurfamel

    Minecraft version: 1.8

    Plugin category: Mobs

    Suggested name: CatAttack

    What i want: So when you hit any living entity the cat attacks it just like a wolf I also want the cats be auto tamed to whoever spawns the cat.

    Ideas for commands: none

    Ideas for permissions: none

    When I'd like it by: whenever
     
    Gh0stKitty likes this.
  2. Offline

    Smurfamel

  3. Offline

    travja

    I've got a few other projects to work on and I need to take a look at the NMS needed to make this happen, but I could potentially do this. I'll let you know when I get an opportunity to start.
     
  4. Offline

    Smurfamel

    Ok also I forgot to add that when you get hit by a mob or player the cat will also attack then and also if the cat gets hit it also attacks then.
     
    Last edited: Jan 18, 2020
  5. Offline

    Smurfamel

  6. Offline

    Smurfamel

  7. Offline

    Xp10d3

    @Smurfamel Uh idk if this is possible since it requires modeling and stuff. Do you want animation or just plain attacking?
     
  8. Offline

    Smurfamel

    just attacking i know cats have attack animation as i saw them attack chickens before
     
    Xp10d3 likes this.
  9. Offline

    Xp10d3

    Alright then. I don't know if any devs are experts in this, but it'll be a while till someone is able to do this. Sorry; just be patient :)
     
  10. Offline

    travja

    I may have some time to work on this. But it won't be top priority and it might take some time. If any other devs are around that would want to take it on, I'll provide a little bit of resources. Ocelots by default only have a targetSelector goal to target chickens, and only when they aren't tamed. https://hastebin.com/iyajazagoz.java

    On the contrast, wolves have a targetSelector goal to target anything that damages them, or their owner, or if their owner attacks it. https://hastebin.com/awesaveqec.java

    So the solution would be relatively simple in concept. Assign the cat target selection to target the same things that the wolf does, and you're golden!
     
    Xp10d3 likes this.
  11. Offline

    Xp10d3

    Reminds me of my modding days. Glad I don't do that kind of stuff; way too difficult.
    EDIT: Same with travja I might be able to tackle this but I don't have that kind of time. So travja please let me know when you're going to do this. I'll let you know as well when I'll do this and if I will :D
     
    travja likes this.
  12. Offline

    Xp10d3

    Okay, I tried a bit of this. I don't think I'm skilled enough to complete this but I did figure out a few things. I believe you have to mess around with PathfinderGoalNearestAttackableGoal. This is kinda as far as I got.
    Code:
    package cats.attack.xp10d3;
    
    import org.bukkit.event.Listener;
    
    public class PlayerListeners implements Listener {
        /*
        @EventHandler
        public void tameing(EntityTameEvent event) {
            EntityType entity = event.getEntityType();
            if (entity == EntityType.OCELOT) {
                PathfinderGoalNearestAttackableTarget<EntityOcelot> finder = new PathfinderGoalNearestAttackableTarget<EntityOcelot>(entityinsentient, oclass, flag)
            }
        }
    
        @Override
        public AttributeInstance getAttribute(Attribute arg0) {
          
            return null;
        }
        */
    }
    
    Here are some helpful links:
    https://github.com/Bukkit/mc-
    dev/blob/master/net/minecraft/server/PathfinderGoalNearestAttackableTarget.java#start-of-content

    https://bukkit.org/threads/getting-a-players-tamed-wolf.196751/
    https://siiam.es/plugins/QuickWebPr...ate-speed-and-the-target-of-an-entity.190421/
    https://siiam.es/plugins/QuickWebPr...w.spigotmc.org/resources/attributedemo.18793/

    EDIT: If anyone else wants to give it a shot go ahead.
     

Share This Page