-
Bug
-
Resolution: Fixed
-
Minecraft 1.14.1, Minecraft 1.14.2 Pre-Release 2, Minecraft 1.14.2 Pre-Release 3, Minecraft 1.14.2 Pre-Release 4, Minecraft 1.14.2
-
None
-
Confirmed
-
(Unassigned)
Hi,
There is a problem with spawning code, which can be clearly visible on the following clip:
https://youtu.be/GGIoeO5btng
tl;dr; in 1.14 A LOT has been added to entity contructor, which causes lots of CPU. Most mobs won't spawn anyways, so e.g. initializing their brains etc at Constructor rather than with some init() method afterwards is not a good idea. Second component to the CPU drain are collision checks (even before entity is created). 1.14 collision check code seems to be much more complex comparing to 1.13, and despite 1.13 calling it twice for each mob, one call in 1.14 costs about 10 times more.
Reproduction steps: create a flat world with one block (white concrete, why not), press Alt F3, observe TPS graph, ->doMobSpawning false, observe graph.
Evidences:
Full code (replaced factory method with simple cow constructor for clarity - no effect on the final result)
[See Exhibit 1]
Commented out collision check with predefined BBs (without creating a mob)
[See Exhibit 2]
Commented out entity creation code - taking a sample cow instead (so skipping CTOR)
[See Exhibit 3]
- relates to
-
MC-138550 High ms ticks in 1.14+, player cannot interact with world normally
- Resolved