Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Woot - The Mob Factory Mod
What Is Woot?
Woot is alternative solution to the traditional mob farm in Minecraft. Instead of spawning mobs and creating some method to kill them and then collecting their loot, you can now create a mob factory. The big advantage is that is doesn't spawn any mobs ... WHAT!
The basic idea is that you create the factory structure, then supply it with enough RF/tick to generate the mobs. You also provide an inventory for the factory to put all your lovely loot into.
You can apply upgrades to the factory to increase spawn rate, add looting etc.
The factory is a multiblock. However only the Mob Factory block is a ticking tile entity. All structure formation checking is driven via events, not tick checking.
So the mob learning .... how does that work?
The mod creates a table of loot drops for:
- mob with no looting
- mob with looting I
- mob with looting II
- mob with looting III
These tables are server wide and are only created when someone creates a factory with a new mob/looting pairing. The information in these tables are stored server-side in a file Woot.json.
When a new mob/looting pairing factory is created, Woot needs to work out what loot that mob can drop. To do this it creates the mob entity, but doesn't spawn it in the world. It then kills the entity with a FakePlayer and processes the resultant LivingDropsEvent, which is then cancels. Therefore nothing is actually spawned into the world.
This learning continues on until a maximum number of mob kills of that mob/looting pairing have been sampled. When this maximum is reached, this fake spawning for the mob/looting pair is stopped.
Some "naughty" mods spawn items in the world when they process the LivingDropsEvent rather than adding them to the drops list and letting Forge spawn the items. Therefore during learning, the factory will be checking a small area at the fake spawning point, looking for those extra items. The fake spawning point has to be clear of blocks, or the drops will be forced out of the blocks. Therefore a small 3x3 area will be created directly below the factory at bedrock level. This leaves a clear area for those mob drops to be spawned and then hoovered up by the learning system.
If a mod is removed after loot that it generates has been learned, then on load, those items are processed as bedrock and ignored.
If new mods are added that generate loot for mobs that have already been learned, then the loot tables need flushed, either via the flush command or by deleting the Woot.json file.