mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-29 07:48:53 +01:00
5c7081fecc
* Updated Upstream (Bukkit/CraftBukkit) Upstream has released updates that appears 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: 45690fe9 SPIGOT-5047: Correct slot types for 1.14 inventories CraftBukkit Changes:4090d01f
SPIGOT-5047: Correct slot types for 1.14 inventoriese8c08362
SPIGOT-5046: World#getLoadedChunks returning inaccessible cached chunks.d445af3b
SPIGOT-5067: Add item meta for 1.14 spawn eggs * Bring Chunk load checks in-line with spigot As of the last upstream merge spigot now checks ticket level status when returning loaded chunks for a world from api. Now our checks will respect that decision. * Fix spawn ticket levels Vanilla would keep the inner chunks of spawn available for ticking, however my changes made all chunks non-ticking. Resolve by changing ticket levels for spawn chunks inside the border to respect this behavior. * Make World#getChunkIfLoadedImmediately return only entity ticking chunks Mojang appears to be using chunks with level > 33 (non-ticking chunks) as cached chunks and not actually loaded chunks. * Bring all loaded checks in line with spigot Loaded chunks must be at least border chunks, or level <= 33
105 lines
4.5 KiB
Diff
105 lines
4.5 KiB
Diff
From 474a91281a23a7277d78441d0f97139feba15b0c Mon Sep 17 00:00:00 2001
|
|
From: Aikar <aikar@aikar.co>
|
|
Date: Wed, 4 Jul 2018 15:22:06 -0400
|
|
Subject: [PATCH] Configurable Bed Search Radius
|
|
|
|
Allows you to increase how far to check for a safe place to respawn
|
|
a player near their bed, allowing a better chance to respawn the
|
|
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 3294fbbeaf..83e54cb904 100644
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
@@ -375,4 +375,15 @@ public class PaperWorldConfig {
|
|
private void scanForLegacyEnderDragon() {
|
|
scanForLegacyEnderDragon = getBoolean("game-mechanics.scan-for-legacy-ender-dragon", true);
|
|
}
|
|
+
|
|
+ public int bedSearchRadius = 1;
|
|
+ private void bedSearchRadius() {
|
|
+ bedSearchRadius = getInt("bed-search-radius", 1);
|
|
+ if (bedSearchRadius < 1) {
|
|
+ bedSearchRadius = 1;
|
|
+ }
|
|
+ if (bedSearchRadius > 1) {
|
|
+ log("Bed Search Radius: " + bedSearchRadius);
|
|
+ }
|
|
+ }
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/BlockBed.java b/src/main/java/net/minecraft/server/BlockBed.java
|
|
index c49eb0ecb3..034226d0b3 100644
|
|
--- a/src/main/java/net/minecraft/server/BlockBed.java
|
|
+++ b/src/main/java/net/minecraft/server/BlockBed.java
|
|
@@ -171,6 +171,58 @@ public class BlockBed extends BlockFacingHorizontal implements ITileEntity {
|
|
|
|
public static Optional<Vec3D> a(EntityTypes<?> entitytypes, IWorldReader iworldreader, BlockPosition blockposition, int i) {
|
|
EnumDirection enumdirection = (EnumDirection) iworldreader.getType(blockposition).get(BlockBed.FACING);
|
|
+ // Paper - configurable bed search radius
|
|
+ World world = (World) iworldreader;
|
|
+ int radius = world.paperConfig.bedSearchRadius;
|
|
+ if (radius > 0) {
|
|
+ for (int r = 1; r <= radius; r++) {
|
|
+ int x = -r;
|
|
+ int z = r;
|
|
+
|
|
+ // Iterates the edge of half of the box; then negates for other half.
|
|
+ while (x <= r && z > -r) {
|
|
+ for (int y = -1; y <= 1; y++) {
|
|
+ BlockPosition pos = blockposition.add(x, y, z);
|
|
+ Optional<Vec3D> vector;
|
|
+ vector = isSafeRespawn(entitytypes, world, pos);
|
|
+ if (vector.isPresent()) {
|
|
+ if (i-- <= 0) {
|
|
+ return vector;
|
|
+ }
|
|
+ }
|
|
+ pos = blockposition.add(-x, y, -z);
|
|
+ vector = isSafeRespawn(entitytypes, world, pos);
|
|
+ if (vector.isPresent()) {
|
|
+ if (i-- <= 0) {
|
|
+ return vector;
|
|
+ }
|
|
+ }
|
|
+
|
|
+ vector = isSafeRespawn(entitytypes, world, pos);
|
|
+ if (vector.isPresent()) {
|
|
+ if (i-- <= 0) {
|
|
+ return vector;
|
|
+ }
|
|
+ }
|
|
+
|
|
+ vector = isSafeRespawn(entitytypes, world, pos);
|
|
+ if (vector.isPresent()) {
|
|
+ if (i-- <= 0) {
|
|
+ return vector;
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ if (x < r) {
|
|
+ x++;
|
|
+ } else {
|
|
+ z--;
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+
|
|
+ return Optional.empty();
|
|
+ }
|
|
+ // Paper end
|
|
int j = blockposition.getX();
|
|
int k = blockposition.getY();
|
|
int l = blockposition.getZ();
|
|
@@ -200,6 +252,7 @@ public class BlockBed extends BlockFacingHorizontal implements ITileEntity {
|
|
return Optional.empty();
|
|
}
|
|
|
|
+ protected static Optional<Vec3D> isSafeRespawn(EntityTypes<?> entityTypes, IWorldReader iworldreader, BlockPosition blockPosition) { return a(entityTypes, iworldreader, blockPosition); } // Paper -- obfhelper
|
|
protected static Optional<Vec3D> a(EntityTypes<?> entitytypes, IWorldReader iworldreader, BlockPosition blockposition) {
|
|
VoxelShape voxelshape = iworldreader.getType(blockposition).getCollisionShape(iworldreader, blockposition);
|
|
|
|
--
|
|
2.21.0
|
|
|