mirror of
https://github.com/PaperMC/Paper.git
synced 2024-10-30 23:39:58 +01:00
34 lines
3.2 KiB
Diff
34 lines
3.2 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Doc <nachito94@msn.com>
|
|
Date: Fri, 6 Aug 2021 11:23:13 -0400
|
|
Subject: [PATCH] Fix bed handling for custom dimensions
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
|
index 8e1478593fcf79ee7a25d666503736cbe707a52c..8565aa3698a4febe21cb3aae0af51ae3479ec743 100644
|
|
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
|
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
|
@@ -1255,7 +1255,7 @@ public class ServerPlayer extends Player {
|
|
// CraftBukkit start - moved bed result checks from below into separate method
|
|
private Either<Player.BedSleepingProblem, Unit> getBedResult(BlockPos blockposition, Direction enumdirection) {
|
|
if (!this.isSleeping() && this.isAlive()) {
|
|
- if (!this.level.dimensionType().natural()) {
|
|
+ if (!this.level.dimensionType().natural() || !this.level.dimensionType().bedWorks()) { // Paper - check if dimension allows beds (moved from BedBlock#canSetSpawn)
|
|
return Either.left(Player.BedSleepingProblem.NOT_POSSIBLE_HERE);
|
|
} else if (!this.bedInRange(blockposition, enumdirection)) {
|
|
return Either.left(Player.BedSleepingProblem.TOO_FAR_AWAY);
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/BedBlock.java b/src/main/java/net/minecraft/world/level/block/BedBlock.java
|
|
index 163a7861f987c3832aac51cc6df950c768546731..110415afe81ed239599ba85e2dcdc5992cead1f5 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/BedBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/BedBlock.java
|
|
@@ -113,7 +113,8 @@ public class BedBlock extends HorizontalDirectionalBlock implements EntityBlock
|
|
player.startSleepInBed(pos).ifLeft((entityhuman_enumbedresult) -> {
|
|
// Paper start - PlayerBedFailEnterEvent
|
|
if (entityhuman_enumbedresult != null) {
|
|
- io.papermc.paper.event.player.PlayerBedFailEnterEvent event = new io.papermc.paper.event.player.PlayerBedFailEnterEvent((org.bukkit.entity.Player) player.getBukkitEntity(), io.papermc.paper.event.player.PlayerBedFailEnterEvent.FailReason.VALUES[entityhuman_enumbedresult.ordinal()], org.bukkit.craftbukkit.block.CraftBlock.at(world, finalblockposition), entityhuman_enumbedresult == Player.BedSleepingProblem.NOT_POSSIBLE_HERE, io.papermc.paper.adventure.PaperAdventure.asAdventure(entityhuman_enumbedresult.getMessage()));
|
|
+ boolean bedWillExplode = !world.dimensionType().bedWorks(); // Paper - Handle explode flag
|
|
+ io.papermc.paper.event.player.PlayerBedFailEnterEvent event = new io.papermc.paper.event.player.PlayerBedFailEnterEvent((org.bukkit.entity.Player) player.getBukkitEntity(), io.papermc.paper.event.player.PlayerBedFailEnterEvent.FailReason.VALUES[entityhuman_enumbedresult.ordinal()], org.bukkit.craftbukkit.block.CraftBlock.at(world, finalblockposition), bedWillExplode, io.papermc.paper.adventure.PaperAdventure.asAdventure(entityhuman_enumbedresult.getMessage())); // Paper
|
|
if (!event.callEvent()) {
|
|
return;
|
|
}
|