Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-18 12:30:06 +01:00
52 Zeilen
2.4 KiB
Diff
52 Zeilen
2.4 KiB
Diff
--- a/net/minecraft/server/BlockBed.java
|
|
+++ b/net/minecraft/server/BlockBed.java
|
|
@@ -41,20 +41,37 @@
|
|
}
|
|
}
|
|
|
|
- if (world.worldProvider.canRespawn() && world.getBiome(blockposition) != Biomes.NETHER) {
|
|
+ // CraftBukkit - moved world and biome check into EntityHuman
|
|
+ if (true || world.worldProvider.canRespawn() && world.getBiome(blockposition) != Biomes.NETHER) {
|
|
if ((Boolean) iblockdata.get(BlockBed.OCCUPIED)) {
|
|
entityhuman.a((IChatBaseComponent) (new ChatMessage("block.minecraft.bed.occupied", new Object[0])), true);
|
|
return true;
|
|
} else {
|
|
+ // CraftBukkit start
|
|
+ IBlockData finaliblockdata = iblockdata;
|
|
+ BlockPosition finalblockposition = blockposition;
|
|
+ // CraftBukkit end
|
|
entityhuman.sleep(blockposition).ifLeft((entityhuman_enumbedresult) -> {
|
|
if (entityhuman_enumbedresult != null) {
|
|
entityhuman.a(entityhuman_enumbedresult.a(), true);
|
|
}
|
|
+ // CraftBukkit start - handling bed explosion from below here
|
|
+ else if (entityhuman_enumbedresult == EntityHuman.EnumBedResult.NOT_POSSIBLE_HERE) {
|
|
+ this.explodeBed(finaliblockdata, world, finalblockposition);
|
|
+ }
|
|
+ // CraftBukkit end
|
|
|
|
});
|
|
return true;
|
|
}
|
|
+ // CraftBukkit start - moved bed explosion into separate method
|
|
} else {
|
|
+ return true;
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+
|
|
+ private boolean explodeBed(IBlockData iblockdata, World world, BlockPosition blockposition) {
|
|
world.a(blockposition, false);
|
|
BlockPosition blockposition1 = blockposition.shift(((EnumDirection) iblockdata.get(BlockBed.FACING)).opposite());
|
|
|
|
@@ -64,8 +81,7 @@
|
|
|
|
world.createExplosion((Entity) null, DamageSource.a(), (double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, 5.0F, true, Explosion.Effect.DESTROY);
|
|
return true;
|
|
- }
|
|
- }
|
|
+ // CraftBukkit end
|
|
}
|
|
|
|
@Override
|