PaperMC/paper-server/nms-patches/net/minecraft/world/level/block/BlockBed.patch
CraftBukkit/Spigot 25f3b50f6b Update to Minecraft 1.19
By: md_5 <git@md-5.net>
2022-06-08 02:00:00 +10:00

58 lines
2.6 KiB
Diff

--- a/net/minecraft/world/level/block/BlockBed.java
+++ b/net/minecraft/world/level/block/BlockBed.java
@@ -87,7 +87,8 @@
}
}
- if (!canSetSpawn(world)) {
+ // CraftBukkit - moved world and biome check into EntityHuman
+ if (false && !canSetSpawn(world)) {
world.removeBlock(blockposition, false);
BlockPosition blockposition1 = blockposition.relative(((EnumDirection) iblockdata.getValue(BlockBed.FACING)).getOpposite());
@@ -104,7 +105,16 @@
return EnumInteractionResult.SUCCESS;
} else {
+ // CraftBukkit start
+ IBlockData finaliblockdata = iblockdata;
+ BlockPosition finalblockposition = blockposition;
+ // CraftBukkit end
entityhuman.startSleepInBed(blockposition).ifLeft((entityhuman_enumbedresult) -> {
+ // CraftBukkit start - handling bed explosion from below here
+ if (!world.dimensionType().bedWorks()) {
+ this.explodeBed(finaliblockdata, world, finalblockposition);
+ } else
+ // CraftBukkit end
if (entityhuman_enumbedresult.getMessage() != null) {
entityhuman.displayClientMessage(entityhuman_enumbedresult.getMessage(), true);
}
@@ -115,8 +125,27 @@
}
}
+ // CraftBukkit start
+ private EnumInteractionResult explodeBed(IBlockData iblockdata, World world, BlockPosition blockposition) {
+ {
+ {
+ world.removeBlock(blockposition, false);
+ BlockPosition blockposition1 = blockposition.relative(((EnumDirection) iblockdata.getValue(BlockBed.FACING)).getOpposite());
+
+ if (world.getBlockState(blockposition1).getBlock() == this) {
+ world.removeBlock(blockposition1, false);
+ }
+
+ world.explode((Entity) null, DamageSource.badRespawnPointExplosion(), (ExplosionDamageCalculator) null, (double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, 5.0F, true, Explosion.Effect.DESTROY);
+ return EnumInteractionResult.SUCCESS;
+ }
+ }
+ }
+ // CraftBukkit end
+
public static boolean canSetSpawn(World world) {
- return world.dimensionType().bedWorks();
+ // CraftBukkit - moved world and biome check into EntityHuman
+ return true || world.dimensionType().bedWorks();
}
private boolean kickVillagerOutOfBed(World world, BlockPosition blockposition) {