Prevent softlocked end exit portal generation

This commit is contained in:
Noah van der Aa 2021-08-30 15:22:18 +02:00
parent 457b4033ab
commit f911fd4880

View file

@ -61,7 +61,19 @@
this.previouslyKilled = true;
this.dragonKilled = true;
@@ -469,6 +489,7 @@
@@ -449,6 +469,11 @@
}
}
+ // Paper start - Prevent "softlocked" exit portal generation
+ if (this.portalLocation.getY() <= this.level.getMinY()) {
+ this.portalLocation = this.portalLocation.atY(this.level.getMinY() + 1);
+ }
+ // Paper end - Prevent "softlocked" exit portal generation
if (worldgenendtrophy.place(FeatureConfiguration.NONE, this.level, this.level.getChunkSource().getGenerator(), RandomSource.create(), this.portalLocation)) {
int i = Mth.positiveCeilDiv(4, 16);
@@ -469,6 +494,7 @@
entityenderdragon.moveTo((double) this.origin.getX(), (double) (128 + this.origin.getY()), (double) this.origin.getZ(), this.level.random.nextFloat() * 360.0F, 0.0F);
this.level.addFreshEntity(entityenderdragon);
this.dragonUUID = entityenderdragon.getUUID();
@ -69,7 +81,7 @@
}
return entityenderdragon;
@@ -513,7 +534,7 @@
@@ -513,7 +539,7 @@
return this.previouslyKilled;
}
@ -78,7 +90,7 @@
if (this.dragonKilled && this.respawnStage == null) {
BlockPos blockposition = this.portalLocation;
@@ -540,19 +561,19 @@
@@ -540,19 +566,19 @@
List<EndCrystal> list1 = this.level.getEntitiesOfClass(EndCrystal.class, new AABB(blockposition1.relative(enumdirection, 2)));
if (list1.isEmpty()) {
@ -102,7 +114,7 @@
if (this.dragonKilled && this.respawnStage == null) {
for (BlockPattern.BlockPatternMatch shapedetector_shapedetectorcollection = this.findExitPortal(); shapedetector_shapedetectorcollection != null; shapedetector_shapedetectorcollection = this.findExitPortal()) {
for (int i = 0; i < this.exitPortalPattern.getWidth(); ++i) {
@@ -571,9 +592,10 @@
@@ -571,9 +597,10 @@
this.respawnStage = DragonRespawnAnimation.START;
this.respawnTime = 0;
this.spawnExitPortal(false);