diff options
Diffstat (limited to 'patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/BedBlock.java.patch')
-rw-r--r-- | patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/BedBlock.java.patch | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/BedBlock.java.patch b/patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/BedBlock.java.patch new file mode 100644 index 0000000000..9c276d1845 --- /dev/null +++ b/patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/BedBlock.java.patch @@ -0,0 +1,82 @@ +--- a/net/minecraft/world/level/block/BedBlock.java ++++ b/net/minecraft/world/level/block/BedBlock.java +@@ -92,7 +94,8 @@ + } + } + +- if (!canSetSpawn(level)) { ++ // CraftBukkit - moved world and biome check into EntityHuman ++ if (false && !canSetSpawn(level)) { + level.removeBlock(pos, false); + BlockPos blockPos = pos.relative(state.getValue(FACING).getOpposite()); + if (level.getBlockState(blockPos).is(this)) { +@@ -109,9 +114,18 @@ + + return InteractionResult.SUCCESS; + } else { +- player.startSleepInBed(pos).ifLeft(bedSleepingProblem -> { +- if (bedSleepingProblem.getMessage() != null) { +- player.displayClientMessage(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); + } + }); + return InteractionResult.SUCCESS; +@@ -119,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 pos) { +@@ -305,8 +352,14 @@ + public void setPlacedBy(Level level, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack stack) { + super.setPlacedBy(level, pos, state, placer, stack); + if (!level.isClientSide) { +- BlockPos blockPos = pos.relative(state.getValue(FACING)); +- level.setBlock(blockPos, state.setValue(PART, BedPart.HEAD), 3); ++ BlockPos blockposition1 = pos.relative((Direction) state.getValue(BedBlock.FACING)); ++ ++ 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); + } |