Mushroom cows on grass

Discussion in 'Spigot Plugin Development' started by GB_6, Apr 28, 2017.

  1. How would I go about letting mushroom cows spawn on grass using a spawner? I prefer not to edit the server jar. Thanks for any suggestions!
  2. You could replace normal cows with mooshroom in the On entity spawn event if you're writing a plugin.. or you could write your own timer that ran every so often picked a random block near a player and had a percent chance of spawning one if the block was grass.

    If by editing the server jar you mean not writing a plugin you're looking at using /summon or spawn eggs

    Sent from my iPhone using Tapatalk
  3. Yeah but I want the mushroom spawner block to spawn mushroom cows on grass.So would writing a timer be the best in this case?
  4. Hmmm, from what I can tell I don't see a way to allow them to spawn from a spawner. If there is no mycel around. You *might* try a couple of things.

    1) listen to the spawnerSpawn event and if the mob spawned was an instanceof mooshroom cow and the event was cancelled, set it to cancelled = false.

    That probably won't work though.

    But you could write some code whenever this spawner was placed or set as mooshroom cow, record the location.

    Then every so often (in a scheduled repeating task) grab a random location around the spawner location and check if it's grass (or whatever other blocks you want them to spawn on).

    If so spawn a cow via your plugin. You may want to impose a limit by getting the cows in the chunk or nearby ones just to keep them from piling up to infinity. Or require a player to be within 15 blocks or so of the spawner before a spawn will happen.

    Sent from my iPhone using Tapatalk
  5. Thanks for the response my man i will look into this.