|
37 | 37 | this.dragonUUID = null; |
38 | 38 | } |
39 | 39 | } |
| 40 | +@@ -268,21 +_,40 @@ |
| 41 | + return false; |
| 42 | + } |
| 43 | + |
| 44 | ++ // Paper start - Fix inefficient Ender Dragon respawn sequence |
| 45 | + @Nullable |
| 46 | + public BlockPattern.BlockPatternMatch findExitPortal() { |
| 47 | ++ |
| 48 | ++ BlockPos location = EndPodiumFeature.getLocation(this.origin); |
| 49 | ++ LevelChunk chunk = this.level.getChunk(location.getX(), location.getZ()); |
| 50 | ++ |
| 51 | ++ |
| 52 | ++ for (BlockEntity blockEntity : chunk.getBlockEntities().values()) { |
| 53 | ++ if (blockEntity instanceof TheEndPortalBlockEntity) { |
| 54 | ++ BlockPattern.BlockPatternMatch blockPatternMatch1 = this.exitPortalPattern.find(this.level, blockEntity.getBlockPos()); |
| 55 | ++ if (blockPatternMatch1 != null) { |
| 56 | ++ if (this.portalLocation == null) { |
| 57 | ++ this.portalLocation = blockPatternMatch1.getBlock(3, 3, 3).getPos(); |
| 58 | ++ } |
| 59 | ++ |
| 60 | ++ return blockPatternMatch1; |
| 61 | ++ } |
| 62 | ++ } |
| 63 | ++ |
| 64 | ++ } |
| 65 | ++ |
| 66 | + ChunkPos chunkPos = new ChunkPos(this.origin); |
| 67 | + |
| 68 | +- for (int i = -8 + chunkPos.x; i <= 8 + chunkPos.x; i++) { |
| 69 | +- for (int i1 = -8 + chunkPos.z; i1 <= 8 + chunkPos.z; i1++) { |
| 70 | +- LevelChunk chunk = this.level.getChunk(i, i1); |
| 71 | ++ for (int i = -8 + chunkPos.x; i <= 8 + chunkPos.x; i+=16) { |
| 72 | ++ for (int i1 = -8 + chunkPos.z; i1 <= 8 + chunkPos.z; i1+=16) { |
| 73 | ++ chunk = this.level.getChunk(i, i1); |
| 74 | + |
| 75 | + for (BlockEntity blockEntity : chunk.getBlockEntities().values()) { |
| 76 | + if (blockEntity instanceof TheEndPortalBlockEntity) { |
| 77 | + BlockPattern.BlockPatternMatch blockPatternMatch = this.exitPortalPattern.find(this.level, blockEntity.getBlockPos()); |
| 78 | + if (blockPatternMatch != null) { |
| 79 | +- BlockPos pos = blockPatternMatch.getBlock(3, 3, 3).getPos(); |
| 80 | + if (this.portalLocation == null) { |
| 81 | +- this.portalLocation = pos; |
| 82 | ++ this.portalLocation = blockPatternMatch.getBlock(3, 3, 3).getPos(); |
| 83 | + } |
| 84 | + |
| 85 | + return blockPatternMatch; |
| 86 | +@@ -292,22 +_,9 @@ |
| 87 | + } |
| 88 | + } |
| 89 | + |
| 90 | +- BlockPos location = EndPodiumFeature.getLocation(this.origin); |
| 91 | +- int i1 = this.level.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, location).getY(); |
| 92 | +- |
| 93 | +- for (int i2 = i1; i2 >= this.level.getMinY(); i2--) { |
| 94 | +- BlockPattern.BlockPatternMatch blockPatternMatch1 = this.exitPortalPattern.find(this.level, new BlockPos(location.getX(), i2, location.getZ())); |
| 95 | +- if (blockPatternMatch1 != null) { |
| 96 | +- if (this.portalLocation == null) { |
| 97 | +- this.portalLocation = blockPatternMatch1.getBlock(3, 3, 3).getPos(); |
| 98 | +- } |
| 99 | +- |
| 100 | +- return blockPatternMatch1; |
| 101 | +- } |
| 102 | +- } |
| 103 | +- |
| 104 | + return null; |
| 105 | + } |
| 106 | ++ // Paper end - Fix inefficient Ender Dragon respawn sequence |
| 107 | + |
| 108 | + private boolean isArenaLoaded() { |
| 109 | + if (this.skipArenaLoadedCheck) { |
40 | 110 | @@ -366,12 +_,22 @@ |
41 | 111 | this.dragonEvent.setVisible(false); |
42 | 112 | this.spawnExitPortal(true); |
|
0 commit comments