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

59 Zeilen
2.5 KiB
Diff

--- a/net/minecraft/server/BlockBed.java
+++ b/net/minecraft/server/BlockBed.java
2020-06-25 02:00:00 +02:00
@@ -39,7 +39,8 @@
}
}
2020-06-25 02:00:00 +02:00
- if (!a(world)) {
+ // CraftBukkit - moved world and biome check into EntityHuman
2020-06-25 02:00:00 +02:00
+ if (false && !a(world)) {
world.a(blockposition, false);
BlockPosition blockposition1 = blockposition.shift(((EnumDirection) iblockdata.get(BlockBed.FACING)).opposite());
2019-12-10 23:00:00 +01:00
2020-06-25 02:00:00 +02:00
@@ -56,7 +57,16 @@
return EnumInteractionResult.SUCCESS;
} else {
2020-06-25 02:00:00 +02:00
+ // 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);
2019-12-10 23:00:00 +01:00
+ return EnumInteractionResult.SUCCESS;
+ }
+ }
+ }
2020-06-25 02:00:00 +02:00
+ // CraftBukkit end
+
2020-06-25 02:00:00 +02:00
public static boolean a(World world) {
- return world.getDimensionManager().isBedWorks();
+ // CraftBukkit - moved world and biome check into EntityHuman
+ return true || world.getDimensionManager().isBedWorks();
}
2019-12-10 23:00:00 +01:00
private boolean a(World world, BlockPosition blockposition) {