RoBrit / Moo-Fluids

Mod for Minecraft that dynamically generates 'milkable' cows for various fluids
GNU General Public License v3.0
16 stars 18 forks source link

Overhaul the spawning code #81

Open Tora-B opened 5 years ago

Tora-B commented 5 years ago

Some significant changes to how fluid cows are spawned, trying to bring it closer to how things are now done in vanilla, streamline the code, and fix some cases where the client and server could be out of sync.

There's no reason to be using the forge event bus instead of the vanilla spawning system here -- the event bus is for catching events targeted at code you don't own. There's overhead for using the bus, and you receive and have to discard many messages that aren't relevant. Even if there was a reason to use the event bus, EntityConstruction is definitely the wrong event to use for spawning, because there are plenty of reasons to create entity references where you don't want to be generating new random values, and often want to assign existing values. For the same reason, most initial entity setup should not be done in the constructor.

Incidentally, I discovered the pack spawning system, and now Fluid Cows spawn in packs of the same fluid.