diff options
Diffstat (limited to 'patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/block/BedBlock.java.patch')
-rw-r--r-- | patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/block/BedBlock.java.patch | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/block/BedBlock.java.patch b/patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/block/BedBlock.java.patch new file mode 100644 index 0000000000..ec6b4b8138 --- /dev/null +++ b/patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/block/BedBlock.java.patch @@ -0,0 +1,87 @@ +--- a/net/minecraft/world/level/block/BedBlock.java ++++ b/net/minecraft/world/level/block/BedBlock.java +@@ -96,9 +94,10 @@ + } + } + +- if (!canSetSpawn(level)) { +- level.removeBlock(blockpos, false); +- BlockPos blockpos1 = blockpos.relative(((Direction) blockstate.getValue(BedBlock.FACING)).getOpposite()); ++ // CraftBukkit - moved world and biome check into EntityHuman ++ if (false && !canSetSpawn(level)) { ++ level.removeBlock(pos, false); ++ BlockPos blockposition1 = pos.relative(((Direction) state.getValue(BedBlock.FACING)).getOpposite()); + + if (level.getBlockState(blockpos1).is((Block) this)) { + level.removeBlock(blockpos1, false); +@@ -115,9 +114,18 @@ + + return InteractionResult.SUCCESS; + } else { +- player.startSleepInBed(blockpos).ifLeft((player_bedsleepingproblem) -> { +- if (player_bedsleepingproblem.getMessage() != null) { +- player.displayClientMessage(player_bedsleepingproblem.getMessage(), true); ++ // CraftBukkit start ++ IBlockData finaliblockdata = state; ++ BlockPos finalblockposition = pos; ++ // CraftBukkit end ++ player.startSleepInBed(pos).ifLeft((entityhuman_enumbedresult) -> { ++ // CraftBukkit start - handling bed explosion from below here ++ if (!level.dimensionType().bedWorks()) { ++ this.explodeBed(finaliblockdata, level, finalblockposition); ++ } else ++ // CraftBukkit end ++ if (entityhuman_enumbedresult.getMessage() != null) { ++ player.displayClientMessage(entityhuman_enumbedresult.getMessage(), true); + } + + }); +@@ -126,8 +134,29 @@ + } + } + ++ // CraftBukkit start ++ private InteractionResult explodeBed(IBlockData iblockdata, Level world, BlockPos blockposition) { ++ { ++ { ++ world.removeBlock(blockposition, false); ++ BlockPos blockposition1 = blockposition.relative(((Direction) iblockdata.getValue(BedBlock.FACING)).getOpposite()); ++ ++ if (world.getBlockState(blockposition1).getBlock() == this) { ++ world.removeBlock(blockposition1, false); ++ } ++ ++ Vec3 vec3d = blockposition.getCenter(); ++ ++ world.explode((Entity) null, world.damageSources().badRespawnPointExplosion(vec3d), (ExplosionDamageCalculator) null, vec3d, 5.0F, true, Level.a.BLOCK); ++ return InteractionResult.SUCCESS; ++ } ++ } ++ } ++ // CraftBukkit end ++ + public static boolean canSetSpawn(Level level) { +- return level.dimensionType().bedWorks(); ++ // CraftBukkit - moved world and biome check into EntityHuman ++ return true || level.dimensionType().bedWorks(); + } + + private boolean kickVillagerOutOfBed(Level level, BlockPos blockpos) { +@@ -335,9 +354,14 @@ + if (!level.isClientSide) { + BlockPos blockpos1 = blockpos.relative((Direction) blockstate.getValue(BedBlock.FACING)); + +- level.setBlock(blockpos1, (BlockState) blockstate.setValue(BedBlock.PART, BedPart.HEAD), 3); +- level.blockUpdated(blockpos, Blocks.AIR); +- blockstate.updateNeighbourShapes(level, blockpos, 3); ++ level.setBlock(blockposition1, (IBlockData) state.setValue(BedBlock.PART, BedPart.HEAD), 3); ++ // CraftBukkit start - SPIGOT-7315: Don't updated if we capture block states ++ if (level.captureBlockStates) { ++ return; ++ } ++ // CraftBukkit end ++ level.blockUpdated(pos, Blocks.AIR); ++ state.updateNeighbourShapes(level, pos, 3); + } + + } |