geforkt von Mirrors/Paper
89 Zeilen
5.6 KiB
Diff
89 Zeilen
5.6 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Max Lee <max@themoep.de>
|
|
Date: Thu, 27 May 2021 14:52:30 -0700
|
|
Subject: [PATCH] Fix invulnerable end crystals
|
|
|
|
MC-108513
|
|
|
|
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
index 25db335f457eefd13798394ebfb6b6684be26610..5c91c007691efeea1d4383efcd1ca06990d0660c 100644
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
@@ -827,4 +827,9 @@ public class PaperWorldConfig {
|
|
private void fixItemsMergingThroughWalls() {
|
|
fixItemsMergingThroughWalls = getBoolean("fix-items-merging-through-walls", fixItemsMergingThroughWalls);
|
|
}
|
|
+
|
|
+ public boolean fixInvulnerableEndCrystalExploit = true;
|
|
+ private void fixInvulnerableEndCrystalExploit() {
|
|
+ fixInvulnerableEndCrystalExploit = getBoolean("unsupported-settings.fix-invulnerable-end-crystal-exploit", fixInvulnerableEndCrystalExploit);
|
|
+ }
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EntityEnderCrystal.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EntityEnderCrystal.java
|
|
index 9658d93615a51375204481cfe0a1fce6f105fd70..5d48c2640f776c9e29598e19afe779ed6997acfc 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EntityEnderCrystal.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EntityEnderCrystal.java
|
|
@@ -30,6 +30,7 @@ public class EntityEnderCrystal extends Entity {
|
|
private static final DataWatcherObject<Optional<BlockPosition>> c = DataWatcher.a(EntityEnderCrystal.class, DataWatcherRegistry.m);
|
|
private static final DataWatcherObject<Boolean> d = DataWatcher.a(EntityEnderCrystal.class, DataWatcherRegistry.i);
|
|
public int b;
|
|
+ public boolean generatedByDragonFight = false; // Paper - Fix invulnerable end crystals
|
|
|
|
public EntityEnderCrystal(EntityTypes<? extends EntityEnderCrystal> entitytypes, World world) {
|
|
super(entitytypes, world);
|
|
@@ -66,6 +67,17 @@ public class EntityEnderCrystal extends Entity {
|
|
}
|
|
// CraftBukkit end
|
|
}
|
|
+ // Paper start - Fix invulnerable end crystals
|
|
+ if (this.world.paperConfig.fixInvulnerableEndCrystalExploit && this.generatedByDragonFight && this.isInvulnerable()) {
|
|
+ if ((this.origin.getWorld() != null && !((WorldServer) this.world).uuid.equals(this.origin.getWorld().getUID()))
|
|
+ || ((WorldServer) this.world).getDragonBattle() == null
|
|
+ || ((WorldServer) this.world).getDragonBattle().respawnPhase == null
|
|
+ || ((WorldServer) this.world).getDragonBattle().respawnPhase.ordinal() > net.minecraft.world.level.dimension.end.EnumDragonRespawn.SUMMONING_DRAGON.ordinal()) {
|
|
+ this.setInvulnerable(false);
|
|
+ this.setBeamTarget(null);
|
|
+ }
|
|
+ }
|
|
+ // Paper end
|
|
}
|
|
|
|
}
|
|
@@ -77,6 +89,7 @@ public class EntityEnderCrystal extends Entity {
|
|
}
|
|
|
|
nbttagcompound.setBoolean("ShowBottom", this.isShowingBottom());
|
|
+ if (this.generatedByDragonFight) nbttagcompound.setBoolean("Paper.GeneratedByDragonFight", this.generatedByDragonFight); // Paper - Fix invulnerable end crystals
|
|
}
|
|
|
|
@Override
|
|
@@ -88,6 +101,7 @@ public class EntityEnderCrystal extends Entity {
|
|
if (nbttagcompound.hasKeyOfType("ShowBottom", 1)) {
|
|
this.setShowingBottom(nbttagcompound.getBoolean("ShowBottom"));
|
|
}
|
|
+ if (nbttagcompound.hasKeyOfType("Paper.GeneratedByDragonFight", 1)) this.generatedByDragonFight = nbttagcompound.getBoolean("Paper.GeneratedByDragonFight"); // Paper - Fix invulnerable end crystals
|
|
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/levelgen/feature/WorldGenEnder.java b/src/main/java/net/minecraft/world/level/levelgen/feature/WorldGenEnder.java
|
|
index dd623702131eaa1a65937a19a0e986e865322258..1bf09c99ba318813755ea3d3456d0fbb60847e5c 100644
|
|
--- a/src/main/java/net/minecraft/world/level/levelgen/feature/WorldGenEnder.java
|
|
+++ b/src/main/java/net/minecraft/world/level/levelgen/feature/WorldGenEnder.java
|
|
@@ -42,7 +42,7 @@ public class WorldGenEnder extends WorldGenerator<WorldGenFeatureEndSpikeConfigu
|
|
return (List) WorldGenEnder.a.getUnchecked(i);
|
|
}
|
|
|
|
- public boolean a(GeneratorAccessSeed generatoraccessseed, ChunkGenerator chunkgenerator, Random random, BlockPosition blockposition, WorldGenFeatureEndSpikeConfiguration worldgenfeatureendspikeconfiguration) {
|
|
+ public boolean generate(GeneratorAccessSeed generatoraccessseed, ChunkGenerator chunkgenerator, Random random, BlockPosition blockposition, WorldGenFeatureEndSpikeConfiguration worldgenfeatureendspikeconfiguration) { // Paper - decompile fix
|
|
List<WorldGenEnder.Spike> list = worldgenfeatureendspikeconfiguration.c();
|
|
|
|
if (list.isEmpty()) {
|
|
@@ -106,6 +106,7 @@ public class WorldGenEnder extends WorldGenerator<WorldGenFeatureEndSpikeConfigu
|
|
entityendercrystal.setBeamTarget(worldgenfeatureendspikeconfiguration.d());
|
|
entityendercrystal.setInvulnerable(worldgenfeatureendspikeconfiguration.b());
|
|
entityendercrystal.setPositionRotation((double) worldgenender_spike.a() + 0.5D, (double) (worldgenender_spike.d() + 1), (double) worldgenender_spike.b() + 0.5D, random.nextFloat() * 360.0F, 0.0F);
|
|
+ entityendercrystal.generatedByDragonFight = true;
|
|
worldaccess.addEntity(entityendercrystal);
|
|
this.a(worldaccess, new BlockPosition(worldgenender_spike.a(), worldgenender_spike.d(), worldgenender_spike.b()), Blocks.BEDROCK.getBlockData());
|
|
}
|