mojira.dev
MC-184151

Respawning ender dragon replaces most of bedrock near the exit portal to end stone and causes large lag spikes

As I said in the title. 

Surrounding the exit portal with lots of bedrocks and respawn the ender dragon using 4 end crystals. This causes large lag spikes and replace most of bedrocks to end stones. 

 

 

Linked issues

Attachments

Comments 5

Please provide the console log, and also check if this occurs on 20w21a.

Cannot reproduce in 20w49a
Relates to MC-86078

If this is still an issue in 20w49a, please provide a video with the debug screen enabled (hit the F3 key) demonstrating the issue.

Can reproduce in 1.19.2.
When starting spawning sequence repetitively MSPT will raise from ~3.6 to over 40.
To reproduce, build a flying machine and watch it freeze for a short period of time when respawning the dragon.

From my testing every time the dragon is respawned the server thread takes ~13ms to process.

I believe it is because once the last end crystal is placed it triggers the following loops

for(BlockPattern.Result result = this.findEndPortal(); result != null; result = this.findEndPortal()) {
for(int i = 0; i < this.endPortalPattern.getWidth(); ++i) {
for(int j = 0; j < this.endPortalPattern.getHeight(); ++j) {
for(int k = 0; k < this.endPortalPattern.getDepth(); ++k) {

where

findEndPortal

also does the following loops

for(i = -8; i <= 8; ++i) {
for(j = -8; j <= 8; ++j) {
WorldChunk worldChunk = this.world.getChunk(i, j);
Iterator var4 = worldChunk.getBlockEntities().values().iterator();
while(var4.hasNext()) {
BlockEntity blockEntity = (BlockEntity)var4.next();

...which is all just to replace exit portals with endstone from older versions (versions before 15w31a), when they could be spawned at the player position upon death of the ender dragon.

Can confirm in 1.21.1. Here's a optimization code which does not change vanilla behaiviour: 

ishland

(Unassigned)

Unconfirmed

(Unassigned)

1.15.2, 20w21a, 1.16.2

Retrieved