3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-30 01:50:08 +01:00
Paper/nms-patches/BlockBed.patch

46 Zeilen
2.0 KiB
Diff

--- a/net/minecraft/server/BlockBed.java
+++ b/net/minecraft/server/BlockBed.java
@@ -32,7 +32,8 @@
}
}
- 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) {
2018-12-06 00:00:00 +01:00
if ((Boolean) iblockdata.get(BlockBed.OCCUPIED)) {
EntityHuman entityhuman1 = this.a(world, blockposition);
@@ -59,10 +60,22 @@
} else if (entityhuman_enumbedresult == EntityHuman.EnumBedResult.TOO_FAR_AWAY) {
entityhuman.a((IChatBaseComponent) (new ChatMessage("block.minecraft.bed.too_far_away", new Object[0])), true);
}
+ // CraftBukkit start - handling bed explosion from below here
+ else if (entityhuman_enumbedresult == EntityHuman.EnumBedResult.NOT_POSSIBLE_HERE) {
+ this.explodeBed(iblockdata, world, blockposition);
+ }
+ // 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.setAir(blockposition);
BlockPosition blockposition1 = blockposition.shift(((EnumDirection) iblockdata.get(BlockBed.FACING)).opposite());
@@ -72,8 +85,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, true);
return true;
- }
- }
+ // CraftBukkit end
}
@Nullable