--- a/net/minecraft/world/level/border/WorldBorder.java
+++ b/net/minecraft/world/level/border/WorldBorder.java
@@ -2,6 +2,7 @@
 
 import com.google.common.collect.Lists;
 import com.mojang.serialization.DynamicLike;
+import java.util.Iterator;
 import java.util.List;
 import net.minecraft.Util;
 import net.minecraft.core.BlockPos;
@@ -16,21 +17,25 @@
 import net.minecraft.world.phys.shapes.VoxelShape;
 
 public class WorldBorder {
-    public static final double MAX_SIZE = 5.999997E7F;
-    public static final double MAX_CENTER_COORDINATE = 2.9999984E7;
+
+    public static final double MAX_SIZE = 5.9999968E7D;
+    public static final double MAX_CENTER_COORDINATE = 2.9999984E7D;
     private final List<BorderChangeListener> listeners = Lists.newArrayList();
-    private double damagePerBlock = 0.2;
-    private double damageSafeZone = 5.0;
+    private double damagePerBlock = 0.2D;
+    private double damageSafeZone = 5.0D;
     private int warningTime = 15;
     private int warningBlocks = 5;
     private double centerX;
     private double centerZ;
     int absoluteMaxSize = 29999984;
-    private WorldBorder.BorderExtent extent = new WorldBorder.StaticBorderExtent(5.999997E7F);
-    public static final WorldBorder.Settings DEFAULT_SETTINGS = new WorldBorder.Settings(0.0, 0.0, 0.2, 5.0, 5, 15, 5.999997E7F, 0L, 0.0);
+    private WorldBorder.BorderExtent extent = new WorldBorder.StaticBorderExtent(5.9999968E7D);
+    public static final WorldBorder.Settings DEFAULT_SETTINGS = new WorldBorder.Settings(0.0D, 0.0D, 0.2D, 5.0D, 5, 15, 5.9999968E7D, 0L, 0.0D);
+    public net.minecraft.server.level.ServerLevel world; // CraftBukkit
+
+    public WorldBorder() {}
 
     public boolean isWithinBounds(BlockPos pos) {
-        return this.isWithinBounds((double)pos.getX(), (double)pos.getZ());
+        return this.isWithinBounds((double) pos.getX(), (double) pos.getZ());
     }
 
     public boolean isWithinBounds(Vec3 pos) {
@@ -38,12 +43,23 @@
     }
 
     public boolean isWithinBounds(ChunkPos chunkPos) {
-        return this.isWithinBounds((double)chunkPos.getMinBlockX(), (double)chunkPos.getMinBlockZ())
-            && this.isWithinBounds((double)chunkPos.getMaxBlockX(), (double)chunkPos.getMaxBlockZ());
+        return this.isWithinBounds((double) chunkPos.getMinBlockX(), (double) chunkPos.getMinBlockZ()) && this.isWithinBounds((double) chunkPos.getMaxBlockX(), (double) chunkPos.getMaxBlockZ());
+    }
+
+    // Paper start - Bound treasure maps to world border
+    private final BlockPos.MutableBlockPos mutPos = new BlockPos.MutableBlockPos();
+    public boolean isBlockInBounds(int chunkX, int chunkZ) {
+        this.mutPos.set(chunkX, 64, chunkZ);
+        return this.isWithinBounds(this.mutPos);
     }
+    public boolean isChunkInBounds(int chunkX, int chunkZ) {
+        this.mutPos.set(((chunkX << 4) + 15), 64, (chunkZ << 4) + 15);
+        return this.isWithinBounds(this.mutPos);
+    }
+    // Paper end - Bound treasure maps to world border
 
     public boolean isWithinBounds(AABB box) {
-        return this.isWithinBounds(box.minX, box.minZ, box.maxX - 1.0E-5F, box.maxZ - 1.0E-5F);
+        return this.isWithinBounds(box.minX, box.minZ, box.maxX - 9.999999747378752E-6D, box.maxZ - 9.999999747378752E-6D);
     }
 
     private boolean isWithinBounds(double minX, double minZ, double maxX, double maxZ) {
@@ -51,7 +67,7 @@
     }
 
     public boolean isWithinBounds(double x, double z) {
-        return this.isWithinBounds(x, z, 0.0);
+        return this.isWithinBounds(x, z, 0.0D);
     }
 
     public boolean isWithinBounds(double x, double z, double margin) {
@@ -59,7 +75,7 @@
     }
 
     public BlockPos clampToBounds(BlockPos pos) {
-        return this.clampToBounds((double)pos.getX(), (double)pos.getY(), (double)pos.getZ());
+        return this.clampToBounds((double) pos.getX(), (double) pos.getY(), (double) pos.getZ());
     }
 
     public BlockPos clampToBounds(Vec3 pos) {
@@ -67,7 +83,7 @@
     }
 
     public BlockPos clampToBounds(double x, double y, double z) {
-        return BlockPos.containing(Mth.clamp(x, this.getMinX(), this.getMaxX() - 1.0), y, Mth.clamp(z, this.getMinZ(), this.getMaxZ() - 1.0));
+        return BlockPos.containing(Mth.clamp(x, this.getMinX(), this.getMaxX() - 1.0D), y, Mth.clamp(z, this.getMinZ(), this.getMaxZ() - 1.0D));
     }
 
     public double getDistanceToBorder(Entity entity) {
@@ -79,18 +95,20 @@
     }
 
     public double getDistanceToBorder(double x, double z) {
-        double d = z - this.getMinZ();
-        double e = this.getMaxZ() - z;
-        double f = x - this.getMinX();
-        double g = this.getMaxX() - x;
-        double h = Math.min(f, g);
-        h = Math.min(h, d);
-        return Math.min(h, e);
+        double d2 = z - this.getMinZ();
+        double d3 = this.getMaxZ() - z;
+        double d4 = x - this.getMinX();
+        double d5 = this.getMaxX() - x;
+        double d6 = Math.min(d4, d5);
+
+        d6 = Math.min(d6, d2);
+        return Math.min(d6, d3);
     }
 
     public boolean isInsideCloseToBorder(Entity entity, AABB box) {
-        double d = Math.max(Mth.absMax(box.getXsize(), box.getZsize()), 1.0);
-        return this.getDistanceToBorder(entity) < d * 2.0 && this.isWithinBounds(entity.getX(), entity.getZ(), d);
+        double d0 = Math.max(Mth.absMax(box.getXsize(), box.getZsize()), 1.0D);
+
+        return this.getDistanceToBorder(entity) < d0 * 2.0D && this.isWithinBounds(entity.getX(), entity.getZ(), d0);
     }
 
     public BorderStatus getStatus() {
@@ -122,13 +140,25 @@
     }
 
     public void setCenter(double x, double z) {
+        // Paper start - Add worldborder events
+        if (this.world != null) {
+            io.papermc.paper.event.world.border.WorldBorderCenterChangeEvent event = new io.papermc.paper.event.world.border.WorldBorderCenterChangeEvent(world.getWorld(), world.getWorld().getWorldBorder(), new org.bukkit.Location(world.getWorld(), this.getCenterX(), 0, this.getCenterZ()), new org.bukkit.Location(world.getWorld(), x, 0, z));
+            if (!event.callEvent()) return;
+            x = event.getNewCenter().getX();
+            z = event.getNewCenter().getZ();
+        }
+        // Paper end - Add worldborder events
         this.centerX = x;
         this.centerZ = z;
         this.extent.onCenterChange();
+        Iterator iterator = this.getListeners().iterator();
 
-        for (BorderChangeListener borderChangeListener : this.getListeners()) {
-            borderChangeListener.onBorderCenterSet(this, x, z);
+        while (iterator.hasNext()) {
+            BorderChangeListener iworldborderlistener = (BorderChangeListener) iterator.next();
+
+            iworldborderlistener.onBorderCenterSet(this, x, z);
         }
+
     }
 
     public double getSize() {
@@ -144,21 +174,52 @@
     }
 
     public void setSize(double size) {
+        // Paper start - Add worldborder events
+        if (this.world != null) {
+            io.papermc.paper.event.world.border.WorldBorderBoundsChangeEvent event = new io.papermc.paper.event.world.border.WorldBorderBoundsChangeEvent(world.getWorld(), world.getWorld().getWorldBorder(), io.papermc.paper.event.world.border.WorldBorderBoundsChangeEvent.Type.INSTANT_MOVE, getSize(), size, 0);
+            if (!event.callEvent()) return;
+            if (event.getType() == io.papermc.paper.event.world.border.WorldBorderBoundsChangeEvent.Type.STARTED_MOVE && event.getDuration() > 0) { // If changed to a timed transition
+                lerpSizeBetween(event.getOldSize(), event.getNewSize(), event.getDuration());
+                return;
+            }
+            size = event.getNewSize();
+        }
+        // Paper end - Add worldborder events
         this.extent = new WorldBorder.StaticBorderExtent(size);
+        Iterator iterator = this.getListeners().iterator();
 
-        for (BorderChangeListener borderChangeListener : this.getListeners()) {
-            borderChangeListener.onBorderSizeSet(this, size);
+        while (iterator.hasNext()) {
+            BorderChangeListener iworldborderlistener = (BorderChangeListener) iterator.next();
+
+            iworldborderlistener.onBorderSizeSet(this, size);
         }
+
     }
 
     public void lerpSizeBetween(double fromSize, double toSize, long time) {
-        this.extent = (WorldBorder.BorderExtent)(fromSize == toSize
-            ? new WorldBorder.StaticBorderExtent(toSize)
-            : new WorldBorder.MovingBorderExtent(fromSize, toSize, time));
+        // Paper start - Add worldborder events
+        if (this.world != null) {
+            io.papermc.paper.event.world.border.WorldBorderBoundsChangeEvent.Type type;
+            if (fromSize == toSize) { // new size = old size
+                type = io.papermc.paper.event.world.border.WorldBorderBoundsChangeEvent.Type.INSTANT_MOVE; // Use INSTANT_MOVE because below it creates a Static border if they are equal.
+            } else {
+                type = io.papermc.paper.event.world.border.WorldBorderBoundsChangeEvent.Type.STARTED_MOVE;
+            }
+            io.papermc.paper.event.world.border.WorldBorderBoundsChangeEvent event = new io.papermc.paper.event.world.border.WorldBorderBoundsChangeEvent(world.getWorld(), world.getWorld().getWorldBorder(), type, fromSize, toSize, time);
+            if (!event.callEvent()) return;
+            toSize = event.getNewSize();
+            time = event.getDuration();
+        }
+        // Paper end - Add worldborder events
+        this.extent = (WorldBorder.BorderExtent) (fromSize == toSize ? new WorldBorder.StaticBorderExtent(toSize) : new WorldBorder.MovingBorderExtent(fromSize, toSize, time));
+        Iterator iterator = this.getListeners().iterator();
 
-        for (BorderChangeListener borderChangeListener : this.getListeners()) {
-            borderChangeListener.onBorderSizeLerping(this, fromSize, toSize, time);
+        while (iterator.hasNext()) {
+            BorderChangeListener iworldborderlistener = (BorderChangeListener) iterator.next();
+
+            iworldborderlistener.onBorderSizeLerping(this, fromSize, toSize, time);
         }
+
     }
 
     protected List<BorderChangeListener> getListeners() {
@@ -166,6 +227,7 @@
     }
 
     public void addListener(BorderChangeListener listener) {
+        if (this.listeners.contains(listener)) return; // CraftBukkit
         this.listeners.add(listener);
     }
 
@@ -188,10 +250,14 @@
 
     public void setDamageSafeZone(double safeZone) {
         this.damageSafeZone = safeZone;
+        Iterator iterator = this.getListeners().iterator();
 
-        for (BorderChangeListener borderChangeListener : this.getListeners()) {
-            borderChangeListener.onBorderSetDamageSafeZOne(this, safeZone);
+        while (iterator.hasNext()) {
+            BorderChangeListener iworldborderlistener = (BorderChangeListener) iterator.next();
+
+            iworldborderlistener.onBorderSetDamageSafeZOne(this, safeZone);
         }
+
     }
 
     public double getDamagePerBlock() {
@@ -200,10 +266,14 @@
 
     public void setDamagePerBlock(double damagePerBlock) {
         this.damagePerBlock = damagePerBlock;
+        Iterator iterator = this.getListeners().iterator();
 
-        for (BorderChangeListener borderChangeListener : this.getListeners()) {
-            borderChangeListener.onBorderSetDamagePerBlock(this, damagePerBlock);
+        while (iterator.hasNext()) {
+            BorderChangeListener iworldborderlistener = (BorderChangeListener) iterator.next();
+
+            iworldborderlistener.onBorderSetDamagePerBlock(this, damagePerBlock);
         }
+
     }
 
     public double getLerpSpeed() {
@@ -216,10 +286,14 @@
 
     public void setWarningTime(int warningTime) {
         this.warningTime = warningTime;
+        Iterator iterator = this.getListeners().iterator();
 
-        for (BorderChangeListener borderChangeListener : this.getListeners()) {
-            borderChangeListener.onBorderSetWarningTime(this, warningTime);
+        while (iterator.hasNext()) {
+            BorderChangeListener iworldborderlistener = (BorderChangeListener) iterator.next();
+
+            iworldborderlistener.onBorderSetWarningTime(this, warningTime);
         }
+
     }
 
     public int getWarningBlocks() {
@@ -228,10 +302,14 @@
 
     public void setWarningBlocks(int warningBlocks) {
         this.warningBlocks = warningBlocks;
+        Iterator iterator = this.getListeners().iterator();
 
-        for (BorderChangeListener borderChangeListener : this.getListeners()) {
-            borderChangeListener.onBorderSetWarningBlocks(this, warningBlocks);
+        while (iterator.hasNext()) {
+            BorderChangeListener iworldborderlistener = (BorderChangeListener) iterator.next();
+
+            iworldborderlistener.onBorderSetWarningBlocks(this, warningBlocks);
         }
+
     }
 
     public void tick() {
@@ -253,9 +331,99 @@
         } else {
             this.setSize(properties.getSize());
         }
+
     }
 
-    interface BorderExtent {
+    private class StaticBorderExtent implements WorldBorder.BorderExtent {
+
+        private final double size;
+        private double minX;
+        private double minZ;
+        private double maxX;
+        private double maxZ;
+        private VoxelShape shape;
+
+        public StaticBorderExtent(final double d0) {
+            this.size = d0;
+            this.updateBox();
+        }
+
+        @Override
+        public double getMinX() {
+            return this.minX;
+        }
+
+        @Override
+        public double getMaxX() {
+            return this.maxX;
+        }
+
+        @Override
+        public double getMinZ() {
+            return this.minZ;
+        }
+
+        @Override
+        public double getMaxZ() {
+            return this.maxZ;
+        }
+
+        @Override
+        public double getSize() {
+            return this.size;
+        }
+
+        @Override
+        public BorderStatus getStatus() {
+            return BorderStatus.STATIONARY;
+        }
+
+        @Override
+        public double getLerpSpeed() {
+            return 0.0D;
+        }
+
+        @Override
+        public long getLerpRemainingTime() {
+            return 0L;
+        }
+
+        @Override
+        public double getLerpTarget() {
+            return this.size;
+        }
+
+        private void updateBox() {
+            this.minX = Mth.clamp(WorldBorder.this.getCenterX() - this.size / 2.0D, (double) (-WorldBorder.this.absoluteMaxSize), (double) WorldBorder.this.absoluteMaxSize);
+            this.minZ = Mth.clamp(WorldBorder.this.getCenterZ() - this.size / 2.0D, (double) (-WorldBorder.this.absoluteMaxSize), (double) WorldBorder.this.absoluteMaxSize);
+            this.maxX = Mth.clamp(WorldBorder.this.getCenterX() + this.size / 2.0D, (double) (-WorldBorder.this.absoluteMaxSize), (double) WorldBorder.this.absoluteMaxSize);
+            this.maxZ = Mth.clamp(WorldBorder.this.getCenterZ() + this.size / 2.0D, (double) (-WorldBorder.this.absoluteMaxSize), (double) WorldBorder.this.absoluteMaxSize);
+            this.shape = Shapes.join(Shapes.INFINITY, Shapes.box(Math.floor(this.getMinX()), Double.NEGATIVE_INFINITY, Math.floor(this.getMinZ()), Math.ceil(this.getMaxX()), Double.POSITIVE_INFINITY, Math.ceil(this.getMaxZ())), BooleanOp.ONLY_FIRST);
+        }
+
+        @Override
+        public void onAbsoluteMaxSizeChange() {
+            this.updateBox();
+        }
+
+        @Override
+        public void onCenterChange() {
+            this.updateBox();
+        }
+
+        @Override
+        public WorldBorder.BorderExtent update() {
+            return this;
+        }
+
+        @Override
+        public VoxelShape getCollisionShape() {
+            return this.shape;
+        }
+    }
+
+    private interface BorderExtent {
+
         double getMinX();
 
         double getMaxX();
@@ -283,58 +451,52 @@
         VoxelShape getCollisionShape();
     }
 
-    class MovingBorderExtent implements WorldBorder.BorderExtent {
+    private class MovingBorderExtent implements WorldBorder.BorderExtent {
+
         private final double from;
         private final double to;
         private final long lerpEnd;
         private final long lerpBegin;
         private final double lerpDuration;
 
-        MovingBorderExtent(final double oldSize, final double newSize, final long timeDuration) {
-            this.from = oldSize;
-            this.to = newSize;
-            this.lerpDuration = (double)timeDuration;
+        MovingBorderExtent(final double d0, final double d1, final long i) {
+            this.from = d0;
+            this.to = d1;
+            this.lerpDuration = (double) i;
             this.lerpBegin = Util.getMillis();
-            this.lerpEnd = this.lerpBegin + timeDuration;
+            this.lerpEnd = this.lerpBegin + i;
         }
 
         @Override
         public double getMinX() {
-            return Mth.clamp(
-                WorldBorder.this.getCenterX() - this.getSize() / 2.0, (double)(-WorldBorder.this.absoluteMaxSize), (double)WorldBorder.this.absoluteMaxSize
-            );
+            return Mth.clamp(WorldBorder.this.getCenterX() - this.getSize() / 2.0D, (double) (-WorldBorder.this.absoluteMaxSize), (double) WorldBorder.this.absoluteMaxSize);
         }
 
         @Override
         public double getMinZ() {
-            return Mth.clamp(
-                WorldBorder.this.getCenterZ() - this.getSize() / 2.0, (double)(-WorldBorder.this.absoluteMaxSize), (double)WorldBorder.this.absoluteMaxSize
-            );
+            return Mth.clamp(WorldBorder.this.getCenterZ() - this.getSize() / 2.0D, (double) (-WorldBorder.this.absoluteMaxSize), (double) WorldBorder.this.absoluteMaxSize);
         }
 
         @Override
         public double getMaxX() {
-            return Mth.clamp(
-                WorldBorder.this.getCenterX() + this.getSize() / 2.0, (double)(-WorldBorder.this.absoluteMaxSize), (double)WorldBorder.this.absoluteMaxSize
-            );
+            return Mth.clamp(WorldBorder.this.getCenterX() + this.getSize() / 2.0D, (double) (-WorldBorder.this.absoluteMaxSize), (double) WorldBorder.this.absoluteMaxSize);
         }
 
         @Override
         public double getMaxZ() {
-            return Mth.clamp(
-                WorldBorder.this.getCenterZ() + this.getSize() / 2.0, (double)(-WorldBorder.this.absoluteMaxSize), (double)WorldBorder.this.absoluteMaxSize
-            );
+            return Mth.clamp(WorldBorder.this.getCenterZ() + this.getSize() / 2.0D, (double) (-WorldBorder.this.absoluteMaxSize), (double) WorldBorder.this.absoluteMaxSize);
         }
 
         @Override
         public double getSize() {
-            double d = (double)(Util.getMillis() - this.lerpBegin) / this.lerpDuration;
-            return d < 1.0 ? Mth.lerp(d, this.from, this.to) : this.to;
+            double d0 = (double) (Util.getMillis() - this.lerpBegin) / this.lerpDuration;
+
+            return d0 < 1.0D ? Mth.lerp(d0, this.from, this.to) : this.to;
         }
 
         @Override
         public double getLerpSpeed() {
-            return Math.abs(this.from - this.to) / (double)(this.lerpEnd - this.lerpBegin);
+            return Math.abs(this.from - this.to) / (double) (this.lerpEnd - this.lerpBegin);
         }
 
         @Override
@@ -353,36 +515,25 @@
         }
 
         @Override
-        public void onCenterChange() {
-        }
+        public void onCenterChange() {}
 
         @Override
-        public void onAbsoluteMaxSizeChange() {
-        }
+        public void onAbsoluteMaxSizeChange() {}
 
         @Override
         public WorldBorder.BorderExtent update() {
-            return (WorldBorder.BorderExtent)(this.getLerpRemainingTime() <= 0L ? WorldBorder.this.new StaticBorderExtent(this.to) : this);
+            if (world != null && this.getLerpRemainingTime() <= 0L) new io.papermc.paper.event.world.border.WorldBorderBoundsChangeFinishEvent(world.getWorld(), world.getWorld().getWorldBorder(), this.from, this.to, this.lerpDuration).callEvent(); // Paper - Add worldborder events
+            return (WorldBorder.BorderExtent) (this.getLerpRemainingTime() <= 0L ? WorldBorder.this.new StaticBorderExtent(this.to) : this);
         }
 
         @Override
         public VoxelShape getCollisionShape() {
-            return Shapes.join(
-                Shapes.INFINITY,
-                Shapes.box(
-                    Math.floor(this.getMinX()),
-                    Double.NEGATIVE_INFINITY,
-                    Math.floor(this.getMinZ()),
-                    Math.ceil(this.getMaxX()),
-                    Double.POSITIVE_INFINITY,
-                    Math.ceil(this.getMaxZ())
-                ),
-                BooleanOp.ONLY_FIRST
-            );
+            return Shapes.join(Shapes.INFINITY, Shapes.box(Math.floor(this.getMinX()), Double.NEGATIVE_INFINITY, Math.floor(this.getMinZ()), Math.ceil(this.getMaxX()), Double.POSITIVE_INFINITY, Math.ceil(this.getMaxZ())), BooleanOp.ONLY_FIRST);
         }
     }
 
     public static class Settings {
+
         private final double centerX;
         private final double centerZ;
         private final double damagePerBlock;
@@ -393,17 +544,7 @@
         private final long sizeLerpTime;
         private final double sizeLerpTarget;
 
-        Settings(
-            double centerX,
-            double centerZ,
-            double damagePerBlock,
-            double safeZone,
-            int warningBlocks,
-            int warningTime,
-            double size,
-            long sizeLerpTime,
-            double sizeLerpTarget
-        ) {
+        Settings(double centerX, double centerZ, double damagePerBlock, double safeZone, int warningBlocks, int warningTime, double size, long sizeLerpTime, double sizeLerpTarget) {
             this.centerX = centerX;
             this.centerZ = centerZ;
             this.damagePerBlock = damagePerBlock;
@@ -464,16 +605,17 @@
         }
 
         public static WorldBorder.Settings read(DynamicLike<?> dynamic, WorldBorder.Settings properties) {
-            double d = Mth.clamp(dynamic.get("BorderCenterX").asDouble(properties.centerX), -2.9999984E7, 2.9999984E7);
-            double e = Mth.clamp(dynamic.get("BorderCenterZ").asDouble(properties.centerZ), -2.9999984E7, 2.9999984E7);
-            double f = dynamic.get("BorderSize").asDouble(properties.size);
-            long l = dynamic.get("BorderSizeLerpTime").asLong(properties.sizeLerpTime);
-            double g = dynamic.get("BorderSizeLerpTarget").asDouble(properties.sizeLerpTarget);
-            double h = dynamic.get("BorderSafeZone").asDouble(properties.safeZone);
-            double i = dynamic.get("BorderDamagePerBlock").asDouble(properties.damagePerBlock);
+            double d0 = Mth.clamp(dynamic.get("BorderCenterX").asDouble(properties.centerX), -2.9999984E7D, 2.9999984E7D);
+            double d1 = Mth.clamp(dynamic.get("BorderCenterZ").asDouble(properties.centerZ), -2.9999984E7D, 2.9999984E7D);
+            double d2 = dynamic.get("BorderSize").asDouble(properties.size);
+            long i = dynamic.get("BorderSizeLerpTime").asLong(properties.sizeLerpTime);
+            double d3 = dynamic.get("BorderSizeLerpTarget").asDouble(properties.sizeLerpTarget);
+            double d4 = dynamic.get("BorderSafeZone").asDouble(properties.safeZone);
+            double d5 = dynamic.get("BorderDamagePerBlock").asDouble(properties.damagePerBlock);
             int j = dynamic.get("BorderWarningBlocks").asInt(properties.warningBlocks);
             int k = dynamic.get("BorderWarningTime").asInt(properties.warningTime);
-            return new WorldBorder.Settings(d, e, i, h, j, k, f, l, g);
+
+            return new WorldBorder.Settings(d0, d1, d5, d4, j, k, d2, i, d3);
         }
 
         public void write(CompoundTag nbt) {
@@ -484,114 +626,8 @@
             nbt.putDouble("BorderSafeZone", this.safeZone);
             nbt.putDouble("BorderDamagePerBlock", this.damagePerBlock);
             nbt.putDouble("BorderSizeLerpTarget", this.sizeLerpTarget);
-            nbt.putDouble("BorderWarningBlocks", (double)this.warningBlocks);
-            nbt.putDouble("BorderWarningTime", (double)this.warningTime);
-        }
-    }
-
-    class StaticBorderExtent implements WorldBorder.BorderExtent {
-        private final double size;
-        private double minX;
-        private double minZ;
-        private double maxX;
-        private double maxZ;
-        private VoxelShape shape;
-
-        public StaticBorderExtent(final double size) {
-            this.size = size;
-            this.updateBox();
-        }
-
-        @Override
-        public double getMinX() {
-            return this.minX;
-        }
-
-        @Override
-        public double getMaxX() {
-            return this.maxX;
-        }
-
-        @Override
-        public double getMinZ() {
-            return this.minZ;
-        }
-
-        @Override
-        public double getMaxZ() {
-            return this.maxZ;
-        }
-
-        @Override
-        public double getSize() {
-            return this.size;
-        }
-
-        @Override
-        public BorderStatus getStatus() {
-            return BorderStatus.STATIONARY;
-        }
-
-        @Override
-        public double getLerpSpeed() {
-            return 0.0;
-        }
-
-        @Override
-        public long getLerpRemainingTime() {
-            return 0L;
-        }
-
-        @Override
-        public double getLerpTarget() {
-            return this.size;
-        }
-
-        private void updateBox() {
-            this.minX = Mth.clamp(
-                WorldBorder.this.getCenterX() - this.size / 2.0, (double)(-WorldBorder.this.absoluteMaxSize), (double)WorldBorder.this.absoluteMaxSize
-            );
-            this.minZ = Mth.clamp(
-                WorldBorder.this.getCenterZ() - this.size / 2.0, (double)(-WorldBorder.this.absoluteMaxSize), (double)WorldBorder.this.absoluteMaxSize
-            );
-            this.maxX = Mth.clamp(
-                WorldBorder.this.getCenterX() + this.size / 2.0, (double)(-WorldBorder.this.absoluteMaxSize), (double)WorldBorder.this.absoluteMaxSize
-            );
-            this.maxZ = Mth.clamp(
-                WorldBorder.this.getCenterZ() + this.size / 2.0, (double)(-WorldBorder.this.absoluteMaxSize), (double)WorldBorder.this.absoluteMaxSize
-            );
-            this.shape = Shapes.join(
-                Shapes.INFINITY,
-                Shapes.box(
-                    Math.floor(this.getMinX()),
-                    Double.NEGATIVE_INFINITY,
-                    Math.floor(this.getMinZ()),
-                    Math.ceil(this.getMaxX()),
-                    Double.POSITIVE_INFINITY,
-                    Math.ceil(this.getMaxZ())
-                ),
-                BooleanOp.ONLY_FIRST
-            );
-        }
-
-        @Override
-        public void onAbsoluteMaxSizeChange() {
-            this.updateBox();
-        }
-
-        @Override
-        public void onCenterChange() {
-            this.updateBox();
-        }
-
-        @Override
-        public WorldBorder.BorderExtent update() {
-            return this;
-        }
-
-        @Override
-        public VoxelShape getCollisionShape() {
-            return this.shape;
+            nbt.putDouble("BorderWarningBlocks", (double) this.warningBlocks);
+            nbt.putDouble("BorderWarningTime", (double) this.warningTime);
         }
     }
 }
