diff options
author | Max Lee <[email protected]> | 2021-06-07 16:38:33 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2021-06-07 16:38:33 +0100 |
commit | 5e3604f1b41886a8c190a4069aec0ec1cc6023b4 (patch) | |
tree | 6f5b56ae260a84cb527f6c36e5bf1758a571c5b7 /Spigot-Server-Patches/0752-Fix-invulnerable-end-crystals.patch | |
parent | d5fe9c8174e1e6a93b2900140565b2290a460e57 (diff) | |
download | Paper-5e3604f1b41886a8c190a4069aec0ec1cc6023b4.tar.gz Paper-5e3604f1b41886a8c190a4069aec0ec1cc6023b4.zip |
Better fix for invulnerable crystals and improve Origin API (#5761)
Diffstat (limited to 'Spigot-Server-Patches/0752-Fix-invulnerable-end-crystals.patch')
-rw-r--r-- | Spigot-Server-Patches/0752-Fix-invulnerable-end-crystals.patch | 76 |
1 files changed, 44 insertions, 32 deletions
diff --git a/Spigot-Server-Patches/0752-Fix-invulnerable-end-crystals.patch b/Spigot-Server-Patches/0752-Fix-invulnerable-end-crystals.patch index 454fc3b3de..35b32af72a 100644 --- a/Spigot-Server-Patches/0752-Fix-invulnerable-end-crystals.patch +++ b/Spigot-Server-Patches/0752-Fix-invulnerable-end-crystals.patch @@ -1,5 +1,5 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic <[email protected]> +From: Max Lee <[email protected]> Date: Thu, 27 May 2021 14:52:30 -0700 Subject: [PATCH] Fix invulnerable end crystals @@ -19,34 +19,54 @@ index 25db335f457eefd13798394ebfb6b6684be26610..5c91c007691efeea1d4383efcd1ca069 + fixInvulnerableEndCrystalExploit = getBoolean("unsupported-settings.fix-invulnerable-end-crystal-exploit", fixInvulnerableEndCrystalExploit); + } } -diff --git a/src/main/java/net/minecraft/world/level/dimension/end/EnderDragonBattle.java b/src/main/java/net/minecraft/world/level/dimension/end/EnderDragonBattle.java -index 0ab6319aa3e4e1f5679f37be36999ca56ca2484c..558216ea96bcdc34ffa595c848151278c33b5ca1 100644 ---- a/src/main/java/net/minecraft/world/level/dimension/end/EnderDragonBattle.java -+++ b/src/main/java/net/minecraft/world/level/dimension/end/EnderDragonBattle.java -@@ -570,6 +570,7 @@ public class EnderDragonBattle { +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 - while (iterator.hasNext()) { - WorldGenEnder.Spike worldgenender_spike = (WorldGenEnder.Spike) iterator.next(); -+ if (!this.world.paperConfig.fixInvulnerableEndCrystalExploit || worldgenender_spike.crystal == null) { // Paper - List<EntityEnderCrystal> list = this.world.a(EntityEnderCrystal.class, worldgenender_spike.f()); - Iterator iterator1 = list.iterator(); - -@@ -579,6 +580,13 @@ public class EnderDragonBattle { - entityendercrystal.setInvulnerable(false); - entityendercrystal.setBeamTarget((BlockPosition) null); + public EntityEnderCrystal(EntityTypes<? extends EntityEnderCrystal> entitytypes, World world) { + super(entitytypes, world); +@@ -66,6 +67,17 @@ public class EntityEnderCrystal extends Entity { + } + // CraftBukkit end } -+ // Paper start -+ } else { -+ worldgenender_spike.crystal.setInvulnerable(false); -+ worldgenender_spike.crystal.setBeamTarget(null); -+ worldgenender_spike.crystal = null; ++ // 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..1960fc029262d54c6a5ee05c99d86428386cba4a 100644 +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 @@ -58,19 +78,11 @@ index dd623702131eaa1a65937a19a0e986e865322258..1960fc029262d54c6a5ee05c99d86428 List<WorldGenEnder.Spike> list = worldgenfeatureendspikeconfiguration.c(); if (list.isEmpty()) { -@@ -107,6 +107,7 @@ public class WorldGenEnder extends WorldGenerator<WorldGenFeatureEndSpikeConfigu +@@ -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); -+ worldgenender_spike.crystal = entityendercrystal; // Paper this.a(worldaccess, new BlockPosition(worldgenender_spike.a(), worldgenender_spike.d(), worldgenender_spike.b()), Blocks.BEDROCK.getBlockData()); } - -@@ -156,6 +157,7 @@ public class WorldGenEnder extends WorldGenerator<WorldGenFeatureEndSpikeConfigu - private final int e; - private final boolean f; - private final AxisAlignedBB g; -+ public EntityEnderCrystal crystal; // Paper - - public Spike(int i, int j, int k, int l, boolean flag) { - this.b = i; |