|
1 | 1 | --- a/net/minecraft/world/level/dimension/end/EndDragonFight.java
|
2 | 2 | +++ b/net/minecraft/world/level/dimension/end/EndDragonFight.java
|
| 3 | +@@ -48,6 +_,7 @@ |
| 4 | + import net.minecraft.world.level.block.state.pattern.BlockPattern; |
| 5 | + import net.minecraft.world.level.block.state.pattern.BlockPatternBuilder; |
| 6 | + import net.minecraft.world.level.block.state.predicate.BlockPredicate; |
| 7 | ++import net.minecraft.world.level.block.state.BlockState; |
| 8 | + import net.minecraft.world.level.chunk.ChunkAccess; |
| 9 | + import net.minecraft.world.level.chunk.LevelChunk; |
| 10 | + import net.minecraft.world.level.chunk.status.ChunkStatus; |
3 | 11 | @@ -69,8 +_,9 @@
|
4 | 12 | private static final int GATEWAY_DISTANCE = 96;
|
5 | 13 | public static final int DRAGON_SPAWN_Y = 128;
|
|
37 | 45 | this.dragonUUID = null;
|
38 | 46 | }
|
39 | 47 | }
|
| 48 | +@@ -267,21 +_,45 @@ |
| 49 | + return false; |
| 50 | + } |
| 51 | + |
| 52 | ++ // Paper start - Fix inefficient Ender Dragon respawn sequence |
| 53 | + @Nullable |
| 54 | + public BlockPattern.BlockPatternMatch findExitPortal() { |
| 55 | ++ |
| 56 | ++ BlockPos location = EndPodiumFeature.getLocation(this.origin); |
| 57 | ++ int i1 = this.level.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, location).getY(); |
| 58 | ++ BlockPos current_position; |
| 59 | ++ BlockState state; |
| 60 | ++ |
| 61 | ++ for (int i2 = i1; i2 >= this.level.getMinY(); i2--) { |
| 62 | ++ |
| 63 | ++ current_position = new BlockPos(location.getX(), i2, location.getZ()); |
| 64 | ++ state = level.getBlockState(current_position); |
| 65 | ++ |
| 66 | ++ if (state.getBlock() == Blocks.BEDROCK) { |
| 67 | ++ BlockPattern.BlockPatternMatch blockPatternMatch1 = this.exitPortalPattern.find(this.level, current_position); |
| 68 | ++ if (blockPatternMatch1 != null) { |
| 69 | ++ if (this.portalLocation == null) { |
| 70 | ++ this.portalLocation = blockPatternMatch1.getBlock(3, 3, 3).getPos(); |
| 71 | ++ } |
| 72 | ++ |
| 73 | ++ return blockPatternMatch1; |
| 74 | ++ } |
| 75 | ++ } |
| 76 | ++ } |
| 77 | ++ |
| 78 | + ChunkPos chunkPos = new ChunkPos(this.origin); |
| 79 | + |
| 80 | + for (int i = -8 + chunkPos.x; i <= 8 + chunkPos.x; i++) { |
| 81 | +- for (int i1 = -8 + chunkPos.z; i1 <= 8 + chunkPos.z; i1++) { |
| 82 | ++ for (i1 = -8 + chunkPos.z; i1 <= 8 + chunkPos.z; i1++) { |
| 83 | + LevelChunk chunk = this.level.getChunk(i, i1); |
| 84 | + |
| 85 | + for (BlockEntity blockEntity : chunk.getBlockEntities().values()) { |
| 86 | + if (blockEntity instanceof TheEndPortalBlockEntity) { |
| 87 | + BlockPattern.BlockPatternMatch blockPatternMatch = this.exitPortalPattern.find(this.level, blockEntity.getBlockPos()); |
| 88 | + if (blockPatternMatch != null) { |
| 89 | +- BlockPos pos = blockPatternMatch.getBlock(3, 3, 3).getPos(); |
| 90 | ++ |
| 91 | + if (this.portalLocation == null) { |
| 92 | +- this.portalLocation = pos; |
| 93 | ++ this.portalLocation = blockPatternMatch.getBlock(3, 3, 3).getPos(); |
| 94 | + } |
| 95 | + |
| 96 | + return blockPatternMatch; |
| 97 | +@@ -290,23 +_,10 @@ |
| 98 | + } |
| 99 | + } |
| 100 | + } |
| 101 | +- |
| 102 | +- BlockPos location = EndPodiumFeature.getLocation(this.origin); |
| 103 | +- int i1 = this.level.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, location).getY(); |
| 104 | +- |
| 105 | +- for (int i2 = i1; i2 >= this.level.getMinY(); i2--) { |
| 106 | +- BlockPattern.BlockPatternMatch blockPatternMatch1 = this.exitPortalPattern.find(this.level, new BlockPos(location.getX(), i2, location.getZ())); |
| 107 | +- if (blockPatternMatch1 != null) { |
| 108 | +- if (this.portalLocation == null) { |
| 109 | +- this.portalLocation = blockPatternMatch1.getBlock(3, 3, 3).getPos(); |
| 110 | +- } |
| 111 | +- |
| 112 | +- return blockPatternMatch1; |
| 113 | +- } |
| 114 | +- } |
| 115 | +- |
| 116 | ++ |
| 117 | + return null; |
| 118 | + } |
| 119 | ++ // Paper end - Fix inefficient Ender Dragon respawn sequence |
| 120 | + |
| 121 | + private boolean isArenaLoaded() { |
| 122 | + if (this.skipArenaLoadedCheck) { |
40 | 123 | @@ -365,12 +_,22 @@
|
41 | 124 | this.dragonEvent.setVisible(false);
|
42 | 125 | this.spawnExitPortal(true);
|
|
0 commit comments