Paper/patches/server/0616-Fix-invulnerable-end-crystals.patch
Jake Potrebic 90fe0d58a5
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#9825)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
897a0a23 SPIGOT-5753: Back PotionType by a minecraft registry
255b2aa1 SPIGOT-7080: Add World#locateNearestBiome
ff984826 Remove javadoc.io doc links

CraftBukkit Changes:
71b0135cc SPIGOT-5753: Back PotionType by a minecraft registry
a6bcb8489 SPIGOT-7080: Add World#locateNearestBiome
ad0e57434 SPIGOT-7502: CraftMetaItem - cannot deserialize BlockStateTag
b3efca57a SPIGOT-6400: Use Mockito instead of InvocationHandler
38c599f9d PR-1272: Only allow one entity in CraftItem instead of two
f065271ac SPIGOT-7498: ChunkSnapshot.getBlockEmittedLight() gets 64 blocks upper in Overworld

Spigot Changes:
e0e223fe Remove javadoc.io doc links
2023-10-22 20:12:00 +01:00

66 lines
3.9 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/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java
index cc3f1532a2108ea915d0e8c840e87bc56ab60a65..ffc5b68c4246a7111845230a75552bb15875a209 100644
--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java
+++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java
@@ -29,6 +29,7 @@ public class EndCrystal extends Entity {
private static final EntityDataAccessor<Optional<BlockPos>> DATA_BEAM_TARGET = SynchedEntityData.defineId(EndCrystal.class, EntityDataSerializers.OPTIONAL_BLOCK_POS);
private static final EntityDataAccessor<Boolean> DATA_SHOW_BOTTOM = SynchedEntityData.defineId(EndCrystal.class, EntityDataSerializers.BOOLEAN);
public int time;
+ public boolean generatedByDragonFight = false; // Paper - Fix invulnerable end crystals
public EndCrystal(EntityType<? extends EndCrystal> type, Level world) {
super(type, world);
@@ -65,6 +66,17 @@ public class EndCrystal extends Entity {
}
// CraftBukkit end
}
+ // Paper start - Fix invulnerable end crystals
+ if (this.level().paperConfig().unsupportedSettings.fixInvulnerableEndCrystalExploit && this.generatedByDragonFight && this.isInvulnerable()) {
+ if (!java.util.Objects.equals(((ServerLevel) this.level()).uuid, this.getOriginWorld())
+ || ((ServerLevel) this.level()).getDragonFight() == null
+ || ((ServerLevel) this.level()).getDragonFight().respawnStage == null
+ || ((ServerLevel) this.level()).getDragonFight().respawnStage.ordinal() > net.minecraft.world.level.dimension.end.DragonRespawnAnimation.SUMMONING_DRAGON.ordinal()) {
+ this.setInvulnerable(false);
+ this.setBeamTarget(null);
+ }
+ }
+ // Paper end
}
}
@@ -76,6 +88,7 @@ public class EndCrystal extends Entity {
}
nbt.putBoolean("ShowBottom", this.showsBottom());
+ if (this.generatedByDragonFight) nbt.putBoolean("Paper.GeneratedByDragonFight", this.generatedByDragonFight); // Paper - Fix invulnerable end crystals
}
@Override
@@ -87,6 +100,7 @@ public class EndCrystal extends Entity {
if (nbt.contains("ShowBottom", 1)) {
this.setShowBottom(nbt.getBoolean("ShowBottom"));
}
+ if (nbt.contains("Paper.GeneratedByDragonFight", 1)) this.generatedByDragonFight = nbt.getBoolean("Paper.GeneratedByDragonFight"); // Paper - Fix invulnerable end crystals
}
diff --git a/src/main/java/net/minecraft/world/level/levelgen/feature/SpikeFeature.java b/src/main/java/net/minecraft/world/level/levelgen/feature/SpikeFeature.java
index 4b685e185ebac8553f1f81d1a5a04be8166a6ca4..dbd1e440ced5d23f2f813b12808f9400a49c3f8f 100644
--- a/src/main/java/net/minecraft/world/level/levelgen/feature/SpikeFeature.java
+++ b/src/main/java/net/minecraft/world/level/levelgen/feature/SpikeFeature.java
@@ -101,6 +101,7 @@ public class SpikeFeature extends Feature<SpikeConfiguration> {
endCrystal.setBeamTarget(config.getCrystalBeamTarget());
endCrystal.setInvulnerable(config.isCrystalInvulnerable());
endCrystal.moveTo((double)spike.getCenterX() + 0.5D, (double)(spike.getHeight() + 1), (double)spike.getCenterZ() + 0.5D, random.nextFloat() * 360.0F, 0.0F);
+ endCrystal.generatedByDragonFight = true; // Paper
world.addFreshEntity(endCrystal);
BlockPos blockPos2 = endCrystal.blockPosition();
this.setBlock(world, blockPos2.below(), Blocks.BEDROCK.defaultBlockState());