3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 12:30:06 +01:00
Paper/nms-patches/BlockBed.patch
2020-08-12 07:00:00 +10:00

59 Zeilen
2.5 KiB
Diff

--- a/net/minecraft/server/BlockBed.java
+++ b/net/minecraft/server/BlockBed.java
@@ -39,7 +39,8 @@
}
}
- if (!a(world)) {
+ // CraftBukkit - moved world and biome check into EntityHuman
+ if (false && !a(world)) {
world.a(blockposition, false);
BlockPosition blockposition1 = blockposition.shift(((EnumDirection) iblockdata.get(BlockBed.FACING)).opposite());
@@ -56,7 +57,16 @@
return EnumInteractionResult.SUCCESS;
} else {
+ // CraftBukkit start
+ IBlockData finaliblockdata = iblockdata;
+ BlockPosition finalblockposition = blockposition;
+ // CraftBukkit end
entityhuman.sleep(blockposition).ifLeft((entityhuman_enumbedresult) -> {
+ // CraftBukkit start - handling bed explosion from below here
+ if (entityhuman_enumbedresult == EntityHuman.EnumBedResult.NOT_POSSIBLE_HERE) {
+ this.explodeBed(finaliblockdata, world, finalblockposition);
+ } else
+ // CraftBukkit end
if (entityhuman_enumbedresult != null) {
entityhuman.a(entityhuman_enumbedresult.a(), true);
}
@@ -67,8 +77,27 @@
}
}
+ // CraftBukkit start
+ private EnumInteractionResult explodeBed(IBlockData iblockdata, World world, BlockPosition blockposition) {
+ {
+ {
+ world.a(blockposition, false);
+ BlockPosition blockposition1 = blockposition.shift(((EnumDirection) iblockdata.get(BlockBed.FACING)).opposite());
+
+ if (world.getType(blockposition1).getBlock() == this) {
+ world.a(blockposition1, false);
+ }
+
+ world.createExplosion((Entity) null, DamageSource.a(), (ExplosionDamageCalculator) null, (double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, 5.0F, true, Explosion.Effect.DESTROY);
+ return EnumInteractionResult.SUCCESS;
+ }
+ }
+ }
+ // CraftBukkit end
+
public static boolean a(World world) {
- return world.getDimensionManager().isBedWorks();
+ // CraftBukkit - moved world and biome check into EntityHuman
+ return true || world.getDimensionManager().isBedWorks();
}
private boolean a(World world, BlockPosition blockposition) {