Closed Thutmose closed 8 years ago
@bloodmc: I think this issue is related to the collision patches.
It wasn't fixed by disabling collision patches though, that was tried before I posted the issue here.
I found why this happens, the issue is as follows:
Here, the list of entities is cleared if the event is null or canceled. This causes a problem if the event is null for some reason.
Here a null cause is assigned if not from active entity, tile entity or block snapshot. This then results in the event returning null, thereby clearing the list in MixinChunk. This is why my list is always empty, I am not calling it from either of those three, I am calling it from a class which listens for WorldTickEvent from forge.
Whenever I call world.getEntitiesWithinAABB, I always get an empty list.
https://github.com/Thutmose/Pokecube/blob/1.10/Pokecube%20Core/src/main/java/pokecube/core/events/handlers/SpawnHandler.java#L605-L606
This is the prime location I am calling it, I use it to determine if there are too many mobs in the area before spawning more. This method is called whenever WorldTickEvent is fired, and only server side and if the phase is Phase.END.
When I add in a debug print, like this: if (world.getTotalWorldTime() % 20 == 0) System.out.println(num + " " + list.size() + " " + box); on line 612 of the above class, it prints this without spongeforge:
93 96 box[-359.4350225891916, 4.0, 72.5692321820978 -> -295.4350225891916, 142.0, 136.5692321820978]
and this with spongeforge: 0 0 box[-359.4350225891916, 4.0, 72.5692321820978 -> -295.4350225891916, 142.0, 136.5692321820978]
I only spawn entities if the first of those two numbers is less than a configurable spawn rate, normally set to 10, so when it always returns 0, my mobs never stop spawning.
This also persists if I have the global.conf as follows: http://pastebin.com/Rpn5TpMD
This was tested with spongeforge 1550 for minecraft 1.10.2, using Minecraft Forge 2007, and the following assortment of mods:
where the version of Pokecube Core there was modified to make those above prints.
This issue was mainly brought to my attention due to this: https://github.com/Thutmose/Pokecube/issues/107