diff --git a/Spigot-Server-Patches/0242-Configurable-Bed-Search-Radius.patch b/Spigot-Server-Patches/0242-Configurable-Bed-Search-Radius.patch index 36ddbb2d4..c6b64f46b 100644 --- a/Spigot-Server-Patches/0242-Configurable-Bed-Search-Radius.patch +++ b/Spigot-Server-Patches/0242-Configurable-Bed-Search-Radius.patch @@ -1,4 +1,4 @@ -From 06cdbf697ba30e29c676c9f6ee6e4a72b0114655 Mon Sep 17 00:00:00 2001 +From 9acfa558bf7e3b4f3454663fbb3804ffa9d57007 Mon Sep 17 00:00:00 2001 From: Aikar Date: Wed, 4 Jul 2018 15:22:06 -0400 Subject: [PATCH] Configurable Bed Search Radius @@ -10,7 +10,7 @@ player at their bed should it of became obstructed. Defaults to vanilla 1. diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index cea15d50ed..387e0dcb9f 100644 +index cea15d50e..387e0dcb9 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -377,4 +377,15 @@ public class PaperWorldConfig { @@ -30,21 +30,21 @@ index cea15d50ed..387e0dcb9f 100644 + } } diff --git a/src/main/java/net/minecraft/server/BlockBed.java b/src/main/java/net/minecraft/server/BlockBed.java -index 7947563426..06a35629ab 100644 +index 794756342..74e915c21 100644 --- a/src/main/java/net/minecraft/server/BlockBed.java +++ b/src/main/java/net/minecraft/server/BlockBed.java @@ -196,6 +196,10 @@ public class BlockBed extends BlockFacingHorizontal implements ITileEntity { public static Optional a(EntityTypes entitytypes, IWorldReader iworldreader, BlockPosition blockposition, int i) { EnumDirection enumdirection = (EnumDirection) iworldreader.getType(blockposition).get(BlockBed.FACING); -+ // Paper start - configurable bed search radius ++ // Paper start - configurable bed search radius + return findSafePosition(entitytypes, (World) iworldreader, enumdirection, blockposition); + } -+ /* ++/* int j = blockposition.getX(); int k = blockposition.getY(); int l = blockposition.getZ(); -@@ -224,7 +228,103 @@ public class BlockBed extends BlockFacingHorizontal implements ITileEntity { +@@ -224,8 +228,106 @@ public class BlockBed extends BlockFacingHorizontal implements ITileEntity { return Optional.empty(); } @@ -97,7 +97,7 @@ index 7947563426..06a35629ab 100644 + numIterated++; + + pos = corePosition[index].add(0, h, 0); -+ vector = isSafeRespawn(entitytypes, world, pos); ++ vector = isSafeRespawn(entitytypes, world, pos, 0); + if (vector.isPresent()) { + return vector; + } @@ -117,20 +117,20 @@ index 7947563426..06a35629ab 100644 + tmpPosition[index] = tmpPosition[index].add(tmpPositionDirection[index].getAdjacentX(), 0, tmpPositionDirection[index].getAdjacentZ()); + pos = tmpPosition[index]; + -+ vector = isSafeRespawn(entitytypes, world, pos); ++ vector = isSafeRespawn(entitytypes, world, pos, 0); + if (vector.isPresent()) { + return vector; + } + } + } + switch (h) { -+ case -1: -+ h = 1; -+ break; + case 0: + h = -1; + break; -+ case 1: ++ case -1: ++ h = -2; ++ break; ++ case -2: + h = Integer.MAX_VALUE; + break; + } @@ -144,10 +144,23 @@ index 7947563426..06a35629ab 100644 + } + // Paper end -+ protected static Optional isSafeRespawn(EntityTypes entityTypes, IWorldReader iworldreader, BlockPosition blockPosition) { return a(entityTypes, iworldreader, blockPosition); } // Paper -- obfhelper - protected static Optional a(EntityTypes entitytypes, IWorldReader iworldreader, BlockPosition blockposition) { +- protected static Optional a(EntityTypes entitytypes, IWorldReader iworldreader, BlockPosition blockposition) { ++ // Paper start -- add maxBelow param ++ protected static Optional a(EntityTypes entitytypes, IWorldReader iworldreader, BlockPosition blockposition) { return isSafeRespawn(entitytypes, iworldreader, blockposition, 2); } ++ protected static Optional isSafeRespawn(EntityTypes entitytypes, IWorldReader iworldreader, BlockPosition blockposition, int maxBelow) { ++ // Paper end VoxelShape voxelshape = iworldreader.getType(blockposition).getCollisionShape(iworldreader, blockposition); + if (voxelshape.c(EnumDirection.EnumAxis.Y) > 0.4375D) { +@@ -233,7 +335,7 @@ public class BlockBed extends BlockFacingHorizontal implements ITileEntity { + } else { + BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition(blockposition); + +- while (blockposition_mutableblockposition.getY() >= 0 && blockposition.getY() - blockposition_mutableblockposition.getY() <= 2 && iworldreader.getType(blockposition_mutableblockposition).getCollisionShape(iworldreader, blockposition_mutableblockposition).isEmpty()) { ++ while (blockposition_mutableblockposition.getY() >= 0 && blockposition.getY() - blockposition_mutableblockposition.getY() <= maxBelow && iworldreader.getType(blockposition_mutableblockposition).getCollisionShape(iworldreader, blockposition_mutableblockposition).isEmpty()) { // Paper -- configurable max distance to search below + blockposition_mutableblockposition.c(EnumDirection.DOWN); + } + -- -2.25.1 +2.22.0