mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-01 05:47:45 +01:00
Fix a couple of upstream bed issues
Upstream incorrectly skipped explosion logic if the bed was occupied and added a "feature" where if you set your spawn in a respawn anchor world but then replaced it with a bed, you could respawn at the bed in that world.
This commit is contained in:
parent
8e6779e8e9
commit
988f9ed56f
@ -10,7 +10,14 @@
|
|||||||
world.removeBlock(pos, false);
|
world.removeBlock(pos, false);
|
||||||
BlockPos blockposition1 = pos.relative(((Direction) state.getValue(BedBlock.FACING)).getOpposite());
|
BlockPos blockposition1 = pos.relative(((Direction) state.getValue(BedBlock.FACING)).getOpposite());
|
||||||
|
|
||||||
@@ -114,19 +115,59 @@
|
@@ -108,25 +109,65 @@
|
||||||
|
world.explode((Entity) null, world.damageSources().badRespawnPointExplosion(vec3d), (ExplosionDamageCalculator) null, vec3d, 5.0F, true, Level.ExplosionInteraction.BLOCK);
|
||||||
|
return InteractionResult.SUCCESS_SERVER;
|
||||||
|
} else if ((Boolean) state.getValue(BedBlock.OCCUPIED)) {
|
||||||
|
+ if (!BedBlock.canSetSpawn(world)) return this.explodeBed(state, world, pos); // Paper - check explode first
|
||||||
|
if (!this.kickVillagerOutOfBed(world, pos)) {
|
||||||
|
player.displayClientMessage(Component.translatable("block.minecraft.bed.occupied"), true);
|
||||||
|
}
|
||||||
|
|
||||||
return InteractionResult.SUCCESS_SERVER;
|
return InteractionResult.SUCCESS_SERVER;
|
||||||
} else {
|
} else {
|
||||||
@ -67,8 +74,7 @@
|
|||||||
|
|
||||||
public static boolean canSetSpawn(Level world) {
|
public static boolean canSetSpawn(Level world) {
|
||||||
- return world.dimensionType().bedWorks();
|
- return world.dimensionType().bedWorks();
|
||||||
+ // CraftBukkit - moved world and biome check into EntityHuman
|
+ return world.dimensionType().bedWorks(); // Paper - actually check if the bed works
|
||||||
+ return true || world.dimensionType().bedWorks();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean kickVillagerOutOfBed(Level world, BlockPos pos) {
|
private boolean kickVillagerOutOfBed(Level world, BlockPos pos) {
|
||||||
|
Loading…
Reference in New Issue
Block a user