2021-03-15 23:00:00 +01:00
|
|
|
--- a/net/minecraft/world/level/block/BlockBed.java
|
|
|
|
+++ b/net/minecraft/world/level/block/BlockBed.java
|
2022-12-07 17:00:00 +01:00
|
|
|
@@ -86,7 +86,8 @@
|
2018-11-02 08:31:00 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-21 23:00:00 +01:00
|
|
|
- if (!canSetSpawn(world)) {
|
2018-11-02 08:31:00 +01:00
|
|
|
+ // CraftBukkit - moved world and biome check into EntityHuman
|
2021-11-21 23:00:00 +01:00
|
|
|
+ if (false && !canSetSpawn(world)) {
|
|
|
|
world.removeBlock(blockposition, false);
|
|
|
|
BlockPosition blockposition1 = blockposition.relative(((EnumDirection) iblockdata.getValue(BlockBed.FACING)).getOpposite());
|
2019-12-10 23:00:00 +01:00
|
|
|
|
2022-12-07 17:00:00 +01:00
|
|
|
@@ -105,7 +106,16 @@
|
2020-06-25 02:00:00 +02:00
|
|
|
|
|
|
|
return EnumInteractionResult.SUCCESS;
|
2018-11-02 08:31:00 +01:00
|
|
|
} else {
|
2020-06-25 02:00:00 +02:00
|
|
|
+ // CraftBukkit start
|
|
|
|
+ IBlockData finaliblockdata = iblockdata;
|
|
|
|
+ BlockPosition finalblockposition = blockposition;
|
|
|
|
+ // CraftBukkit end
|
2021-11-21 23:00:00 +01:00
|
|
|
entityhuman.startSleepInBed(blockposition).ifLeft((entityhuman_enumbedresult) -> {
|
2020-06-25 02:00:00 +02:00
|
|
|
+ // CraftBukkit start - handling bed explosion from below here
|
2021-11-21 23:00:00 +01:00
|
|
|
+ if (!world.dimensionType().bedWorks()) {
|
2020-06-25 02:00:00 +02:00
|
|
|
+ this.explodeBed(finaliblockdata, world, finalblockposition);
|
|
|
|
+ } else
|
|
|
|
+ // CraftBukkit end
|
2022-06-07 18:00:00 +02:00
|
|
|
if (entityhuman_enumbedresult.getMessage() != null) {
|
2021-11-21 23:00:00 +01:00
|
|
|
entityhuman.displayClientMessage(entityhuman_enumbedresult.getMessage(), true);
|
2020-06-25 02:00:00 +02:00
|
|
|
}
|
2022-12-07 17:00:00 +01:00
|
|
|
@@ -116,8 +126,29 @@
|
2020-06-25 02:00:00 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
+ // CraftBukkit start
|
|
|
|
+ private EnumInteractionResult explodeBed(IBlockData iblockdata, World world, BlockPosition blockposition) {
|
|
|
|
+ {
|
|
|
|
+ {
|
2021-11-21 23:00:00 +01:00
|
|
|
+ world.removeBlock(blockposition, false);
|
|
|
|
+ BlockPosition blockposition1 = blockposition.relative(((EnumDirection) iblockdata.getValue(BlockBed.FACING)).getOpposite());
|
2020-06-25 02:00:00 +02:00
|
|
|
+
|
2021-11-21 23:00:00 +01:00
|
|
|
+ if (world.getBlockState(blockposition1).getBlock() == this) {
|
|
|
|
+ world.removeBlock(blockposition1, false);
|
2020-06-25 02:00:00 +02:00
|
|
|
+ }
|
|
|
|
+
|
2022-12-07 17:00:00 +01:00
|
|
|
+ Vec3D vec3d = blockposition.getCenter();
|
|
|
|
+
|
|
|
|
+ world.explode((Entity) null, DamageSource.badRespawnPointExplosion(vec3d), (ExplosionDamageCalculator) null, vec3d, 5.0F, true, World.a.BLOCK);
|
2019-12-10 23:00:00 +01:00
|
|
|
+ return EnumInteractionResult.SUCCESS;
|
2018-11-02 08:31:00 +01:00
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
2020-06-25 02:00:00 +02:00
|
|
|
+ // CraftBukkit end
|
2018-11-02 08:31:00 +01:00
|
|
|
+
|
2021-11-21 23:00:00 +01:00
|
|
|
public static boolean canSetSpawn(World world) {
|
|
|
|
- return world.dimensionType().bedWorks();
|
2020-06-25 02:00:00 +02:00
|
|
|
+ // CraftBukkit - moved world and biome check into EntityHuman
|
2021-11-21 23:00:00 +01:00
|
|
|
+ return true || world.dimensionType().bedWorks();
|
2018-11-02 08:31:00 +01:00
|
|
|
}
|
|
|
|
|
2021-11-21 23:00:00 +01:00
|
|
|
private boolean kickVillagerOutOfBed(World world, BlockPosition blockposition) {
|