Scarecrow's

Discussion in 'Plugin Requests' started by Probdutch, Sep 13, 2017.

Thread Status:
Not open for further replies.
  1. Minecraft version: Minecraft 1.12.1+

    Suggested name: ScareCrows

    What I want: An plugin which will "Scare" passive mobs.
    An scarecrow is created by placing an armor stand with an pumpkin on top. If there is an direct line of sight between the passive mob, And the scarecrow. And the mob is within 15 (configuable) blocks. It will be teleported between 15 and 30 (both configuable) blocks out, Also it would be given 1hp (also configuable) damage.
    When an scarecrow is created, the player also recieves an message. (Configuable, both for success and no permission).

    Ideas for commands:
    /scarecrow reload - Reload config - scarecrow.reload
    /scarecrow list - List all scarecrow's in the wold - scarecrow.list
    /scarecrow remove - Removes the nearest scarecrow (max 5 block away) - scarecrow.remove

    Ideas for permissions:
    Permissions for the commands are listed behind them,

    scarecrow.create would be used for creating scarecrows.

    When I'd like it by: No time limit, But the sooner, the better :D
     
  2. I like the idea. I'll give this a go. Would you like any other, more specific features, like players being able to create one for like $50 in-game money?
     
  3. The $50 (or something else, configuable xD) idea would be awesome!

    I was later thinking about maybe one permisson for creating them automatically, in the way described at the main post, And another command for creating one in an nearby radius (of like 5). So that money will not be taken off your account randomly. However, I would like this to integrate with griefprevention, And possibly worldguard. (would be nice if the integrations are toggleable for an more universal use, same for all the money systems.)

    Also automatically adding something like leather armor, and an "Scarecrow" nametag would be an nice feature.

    Thanks!

    Edit: If you are going to be running checks every tick, Please also add an config option for waiting a few (configuable) ticks between every check, to save some performance.
     
    Last edited: Sep 14, 2017
  4. @Probdutch
    I will do my best to add both WorldGuard and GriefPrevention support into the plugin. And I'll add Vault support, which should enable support for (almost) all economy plugins, which will also be toggleable if you do not want economy support.

    As for the command for creating scarecrows; I can make a command that will spawn a scarecrow at your current location, or at the location you are looking at. Both should be possible in theory.

    I do have doubts about having the tick delay being configurable, but I will try to make it possible.

    EDIT: I will also add Language files support. It's something I always add to my plugins, since it is fairly easy to do, and it gives a ton of customization for the plugin. (Changing plugin prefix etc.)

    EDIT 2: I also am adding possibility to define what a Scarecrow should wear: helmet, chestplate, leggings, boots. I'll just have the default settings to be a pumpkin as helmet, and nothing else.
     
  5. @Kevinzuman22
    Cool!
    Not sure if i explained correctly what i meant with the tick delay, Or if its me not knowing what you mean in the answer ;). To make it clear, I mean letting the server just run at full speed. And not checking every tick, But checking every X amount of ticks.
    Also another idea. You can make whatever you like from it, It's not necessaryat all. But what about not just teleporting the mob, But basically "Hooking" into the mob, And actually sort of scaring it, Just like an zombie & villager, Causing it's own AI to move away from the ScareCrow.

    Again, Many thanks for (starting) making in this plugin idea :)
     
  6. @Probdutch
    I understood your meaning of implementing a configurable tick delay. I though about it, and it should be possible, so don't worry! :)

    I am looking into manipulating mobs, and it seems quite difficult. Not sure if I will be able to make the scare effect, since I have to create custom classes for each entity I want to affect, and override it with the default one, I have never done this before.

    If I won't be able to do it, I'll just do the initial idea of simply teleporting them outside the area.
     
  7. @Kevinzuman22
    No problem, Both are fine. Take your time to see what you can do, If it's too hard. Just go with the easyer option :)
     
  8. Offline

    critikull

    @Kevinzuman22

    An option: You can copy the AI behavior of a creeper avoiding an Ocelot for this:

    1. Use NMS to extend all passive mobs
    2. Create a new path finder class "PathfinderGoalAvoidScarecrow" and copy the code from "PathfinderGoalAvoidTarget".
    3. Modify the code above to check for a nearby scarecrow (instead of an entity).
    4. Override the mobs pathfinder function and add your new pathfinder goal:

    For 1.12 this looks like:

    Code:
    public class ScaredSheep extends EntitySheep {
        public ScaredSheep(World world) {
            super(world);
        }
    
        @Override
        protected void r() {
            super.r();
            this.goalSelector.a(1, new PathfinderGoalAvoidScarecrow(this));
        }
    }
    
     
    Last edited by a moderator: Sep 14, 2017
  9. Another option that might be possible, Is just spawning another custom sheep. As i would like to not modify the sheep as much as possible, else it might conflict with other plugins (and even loottables). I guess critikull's answer has indeed an good idea (with copying the creeper+ cat mechanic). And of course turning it into an normal sheep again once it stop's being scared.
     
  10. I have finished the main part about the Scarecrows itself. The only think I have been busy with recently is getting that scare effect going.

    I have been tinkering around with NMS. It has been really hard trying to use it, as well as using Reflection (getting stuff from classes that is not accessible). The main problem here is most likely that I know Bukkit decently, but I do not have much knowledge about Java itself. As stated on the official Reflection tutorial, this is an advanced feature to use.

    NMS I think I understand how it works.

    I'll keep on trying to get things working for now though. But any help from people who do have some experience with NMS, Reflection and stuff would be much appreciated.

    I will now just use a simple teleport away method to at least test the features of the Scarecrows themselves, after that I will continue with the scare effect.
     
  11. Offline

    Horsey

    @Kevinzuman22 You can't use Reflection since you need to extend a NMS class (Can't be done with Reflection alone).
    You should create a package for every version of minecraft, and in the onEnable, you should launch the correct one for your version.
     
  12. @Probdutch
    I came up with a new idea. I will try to add several types of scarecrows. The types I had in mind were:
    - ALL: scares away all types of mobs,
    - PASSIVE: scares away only passive mobs,
    - NEUTRAL: scares away only neutral mobs,
    - AGRESSIVE: scares away only agressive mobs,
    - PASSIVE_AGRESSIVE: scares away all passive and agressive mobs,
    - PASSIVE_NEUTRAL: scares away all passive and neutral mobs,
    - AGRESSIVE_NEUTRAL: scares away all agressive and neutral mobs.

    If you want, I can also add a 'NONE' type, one that will not scare away anything. Possibly for some decorative purposes, since the plugin creates armor stands that exactly match the player's current location, including eye position (which is more accurate than with simply placing armor stands with the item), and a custom name floating above their head.

    Also, I am hoping to have the plugin finished this weekend, if everything goes as planned. I do still have my doubts about getting the scare effect working in time, but we'll have to see.

    @Horsey
    Do you mean with 'extending an NMS class' as in extending the classes of the entities I want to affect, or something else, such as extending the PathfinderGoal class?

    And with creating a package for every version, do you with that mean, for example, creating a package called 'me.kevinzuman.scarecrow.1_12_2' for version 1.12.2 and so on for the other versions I want to support, and then have those packages contain the whole plugin, and to then edit the classes that have to be changed to work with that specific version? I am not really sure what you mean with this.
     
  13. Offline

    Horsey

    @Kevinzuman22
    Yes, you have to extend the entity classes (like EntityPig).

    Yes, you'd have a package for each and every version; you'd have an interface for all the classes. Then your main class would have various fields for the interfaces. Then, in the onEnable, you assign the field to the correct class.
    For example, if you had an Interface 'ScaredPig' for the custom pic, and your class would be called 'ScaredPig_1_12_2'.

    In your main class, you'd have a field like public ScaredPig pig; in the on enable, you'd assign it to Class.forName("ScaredPig" + Bukkit.getVersion()); (just an example).
     
  14. @Probdutch

    I'm sorry, but for now, trying to get a decent scare effect going goes beyond my level of skill. For now, I'll just teleport the entities away in my version. I'll keep on trying to get it working though after I finished the plugin, and if I happen to succeed, I will of course apply it to the plugin.
     
  15. @Probdutch
    The teleporting system works, but whenever an entity enters the scare radius, it practically stops the server for about 2-3 seconds, and then the entity has been teleported. So I will be trying to make it more lightweight if I can.
     
  16. Offline

    KingOfTheEast01

    Looking at the times, it actually hasn't even been one month. It will be tomorrow though. Which is in 23 hours and 59 minutes for me. XD
     
    RunsWithShovels likes this.
  17. It's been 2 months and 1 day now (from the initial request). I guess the dev gave up or something...
     
  18. Offline

    KingOfTheEast01

    Yeahhh...I think so! Lol. Sorry, mate.
     
Thread Status:
Not open for further replies.

Share This Page