aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNassim Jahnke <[email protected]>2024-12-18 13:00:21 +0100
committerNassim Jahnke <[email protected]>2024-12-18 13:00:21 +0100
commit71bcc8c8450e25c7a716e63cdf353fcfeac6b3d5 (patch)
tree6dc7dda0424d57d2bb7d260bb17b6a4f02a554f1
parenta5e786a5783f113ca2c54b34cda72ba35e1426b5 (diff)
downloadPaper-71bcc8c8450e25c7a716e63cdf353fcfeac6b3d5.tar.gz
Paper-71bcc8c8450e25c7a716e63cdf353fcfeac6b3d5.zip
Fix diffs in block package
-rw-r--r--paper-server/patches/sources/net/minecraft/world/level/block/BedBlock.java.patch4
-rw-r--r--paper-server/patches/sources/net/minecraft/world/level/block/BigDripleafBlock.java.patch11
-rw-r--r--paper-server/patches/sources/net/minecraft/world/level/block/CaveVinesBlock.java.patch21
-rw-r--r--paper-server/patches/sources/net/minecraft/world/level/block/CraftingTableBlock.java.patch5
-rw-r--r--paper-server/patches/sources/net/minecraft/world/level/block/DispenserBlock.java.patch3
-rw-r--r--paper-server/patches/sources/net/minecraft/world/level/block/piston/PistonBaseBlock.java.patch6
6 files changed, 26 insertions, 24 deletions
diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/BedBlock.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/BedBlock.java.patch
index c400669e8f..ad2f90861a 100644
--- a/paper-server/patches/sources/net/minecraft/world/level/block/BedBlock.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/level/block/BedBlock.java.patch
@@ -9,7 +9,7 @@
level.removeBlock(pos, false);
BlockPos blockPos = pos.relative(state.getValue(FACING).getOpposite());
if (level.getBlockState(blockPos).is(this)) {
-@@ -103,22 +_,63 @@
+@@ -103,22 +_,62 @@
level.explode(null, level.damageSources().badRespawnPointExplosion(center), null, center, 5.0F, true, Level.ExplosionInteraction.BLOCK);
return InteractionResult.SUCCESS_SERVER;
} else if (state.getValue(OCCUPIED)) {
@@ -38,7 +38,7 @@
+ } else
+ // CraftBukkit end
if (bedSleepingProblem.getMessage() != null) {
- player.displayClientMessage(bedSleepingProblem.getMessage(), true);
+- player.displayClientMessage(bedSleepingProblem.getMessage(), true);
+ final net.kyori.adventure.text.Component message = event.getMessage(); // Paper - PlayerBedFailEnterEvent
+ if (message != null) player.displayClientMessage(io.papermc.paper.adventure.PaperAdventure.asVanilla(message), true); // Paper - PlayerBedFailEnterEvent
}
diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/BigDripleafBlock.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/BigDripleafBlock.java.patch
index 8f4e70e47f..11a7f55411 100644
--- a/paper-server/patches/sources/net/minecraft/world/level/block/BigDripleafBlock.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/level/block/BigDripleafBlock.java.patch
@@ -46,19 +46,21 @@
} else if (tilt == Tilt.FULL) {
resetTilt(state, level, pos);
}
-@@ -238,8 +_,9 @@
+@@ -238,8 +_,11 @@
return entity.onGround() && entity.position().y > pos.getY() + 0.6875F;
}
- private void setTiltAndScheduleTick(BlockState state, Level level, BlockPos pos, Tilt tilt, @Nullable SoundEvent sound) {
- setTilt(state, level, pos, tilt);
+ private void setTiltAndScheduleTick(BlockState state, Level level, BlockPos pos, Tilt tilt, @Nullable SoundEvent sound, @Nullable Entity entity) {
-+ if (!BigDripleafBlock.setTilt(state, level, pos, tilt, entity)) return;
++ if (!setTilt(state, level, pos, tilt, entity)) {
++ return;
++ }
+ // CraftBukkit end
if (sound != null) {
playTiltSound(level, pos, sound);
}
-@@ -251,18 +_,25 @@
+@@ -251,18 +_,26 @@
}
private static void resetTilt(BlockState state, Level level, BlockPos pos) {
@@ -70,7 +72,8 @@
}
- private static void setTilt(BlockState state, Level level, BlockPos pos, Tilt tilt) {
-+ private static boolean setTilt(BlockState state, Level level, BlockPos pos, Tilt tilt, @Nullable Entity entity) { // CraftBukkit
++ // CraftBukkit start
++ private static boolean setTilt(BlockState state, Level level, BlockPos pos, Tilt tilt, @Nullable Entity entity) {
+ if (entity != null) {
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entity, pos, state.setValue(BigDripleafBlock.TILT, tilt))) {
+ return false;
diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/CaveVinesBlock.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/CaveVinesBlock.java.patch
index 7f52226493..c0eb21e510 100644
--- a/paper-server/patches/sources/net/minecraft/world/level/block/CaveVinesBlock.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/level/block/CaveVinesBlock.java.patch
@@ -1,23 +1,20 @@
--- a/net/minecraft/world/level/block/CaveVinesBlock.java
+++ b/net/minecraft/world/level/block/CaveVinesBlock.java
-@@ -52,7 +_,7 @@
+@@ -52,8 +_,15 @@
@Override
protected BlockState getGrowIntoState(BlockState state, RandomSource random) {
- return super.getGrowIntoState(state, random).setValue(BERRIES, Boolean.valueOf(random.nextFloat() < 0.11F));
-+ return this.getGrowIntoState(state, random, null); // Paper - Fix Spigot growth modifiers
- }
-
- @Override
-@@ -85,4 +_,11 @@
- public void performBonemeal(ServerLevel level, RandomSource random, BlockPos pos, BlockState state) {
- level.setBlock(pos, state.setValue(BERRIES, Boolean.valueOf(true)), 2);
- }
-+ // Paper start - Fix Spigot growth modifiers
+- }
++ // Paper start - Fix Spigot growth modifiers
++ return this.getGrowIntoState(state, random, null);
++ }
+ @Override
+ protected BlockState getGrowIntoState(BlockState state, RandomSource random, @javax.annotation.Nullable Level level) {
+ final boolean value = random.nextFloat() < (level != null ? (0.11F * (level.spigotConfig.glowBerryModifier / 100.0F)) : 0.11F);
-+ return (BlockState) super.getGrowIntoState(state, random).setValue(CaveVinesBlock.BERRIES, value);
++ return super.getGrowIntoState(state, random).setValue(CaveVinesBlock.BERRIES, value);
+ }
+ // Paper end - Fix Spigot growth modifiers
- }
+
+ @Override
+ protected ItemStack getCloneItemStack(LevelReader level, BlockPos pos, BlockState state, boolean includeData) {
diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/CraftingTableBlock.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/CraftingTableBlock.java.patch
index 3285cee056..336a3679c6 100644
--- a/paper-server/patches/sources/net/minecraft/world/level/block/CraftingTableBlock.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/level/block/CraftingTableBlock.java.patch
@@ -1,9 +1,10 @@
--- a/net/minecraft/world/level/block/CraftingTableBlock.java
+++ b/net/minecraft/world/level/block/CraftingTableBlock.java
-@@ -32,7 +_,9 @@
+@@ -31,8 +_,9 @@
+ @Override
protected InteractionResult useWithoutItem(BlockState state, Level level, BlockPos pos, Player player, BlockHitResult hitResult) {
if (!level.isClientSide) {
- player.openMenu(state.getMenuProvider(level, pos));
+- player.openMenu(state.getMenuProvider(level, pos));
+ if (player.openMenu(state.getMenuProvider(level, pos)).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation
player.awardStat(Stats.INTERACT_WITH_CRAFTING_TABLE);
+ } // Paper - Fix InventoryOpenEvent cancellation
diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/DispenserBlock.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/DispenserBlock.java.patch
index 1660450641..2bce500d42 100644
--- a/paper-server/patches/sources/net/minecraft/world/level/block/DispenserBlock.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/level/block/DispenserBlock.java.patch
@@ -18,7 +18,7 @@
player.awardStat(dispenserBlockEntity instanceof DropperBlockEntity ? Stats.INSPECT_DROPPER : Stats.INSPECT_DISPENSER);
}
-@@ -87,18 +_,26 @@
+@@ -87,18 +_,27 @@
BlockSource blockSource = new BlockSource(level, pos, state, dispenserBlockEntity);
int randomSlot = dispenserBlockEntity.getRandomSlot(level.random);
if (randomSlot < 0) {
@@ -31,6 +31,7 @@
DispenseItemBehavior dispenseMethod = this.getDispenseMethod(level, item);
if (dispenseMethod != DispenseItemBehavior.NOOP) {
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockPreDispenseEvent(level, pos, item, randomSlot)) return; // Paper - Add BlockPreDispenseEvent
++ DispenserBlock.eventFired = false; // CraftBukkit - reset event status
dispenserBlockEntity.setItem(randomSlot, dispenseMethod.dispense(blockSource, item));
}
}
diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/piston/PistonBaseBlock.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/piston/PistonBaseBlock.java.patch
index bd32b0d966..239a88e07e 100644
--- a/paper-server/patches/sources/net/minecraft/world/level/block/piston/PistonBaseBlock.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/level/block/piston/PistonBaseBlock.java.patch
@@ -136,7 +136,7 @@
level.setBlock(blockPos2, Blocks.AIR.defaultBlockState(), 18);
level.gameEvent(GameEvent.BLOCK_DESTROY, blockPos2, GameEvent.Context.of(blockState1));
if (!blockState1.is(BlockTags.FIRE)) {
-@@ -321,13 +_,27 @@
+@@ -321,13 +_,26 @@
}
for (int i1 = toPush.size() - 1; i1 >= 0; i1--) {
@@ -152,13 +152,13 @@
map.remove(blockPos2);
BlockState blockState2 = Blocks.MOVING_PISTON.defaultBlockState().setValue(FACING, facing);
level.setBlock(blockPos2, blockState2, 68);
- level.setBlockEntity(MovingPistonBlock.newMovingBlockEntity(blockPos2, blockState2, list.get(i1), facing, extending, false));
+- level.setBlockEntity(MovingPistonBlock.newMovingBlockEntity(blockPos2, blockState2, list.get(i1), facing, extending, false));
+ // Paper start - fix a variety of piston desync dupes
+ if (!allowDesync) {
+ blockState1 = level.getBlockState(oldPos);
+ map.replace(oldPos, blockState1);
+ }
-+ level.setBlockEntity(MovingPistonBlock.newMovingBlockEntity(blockPos2, blockState2, allowDesync ? (BlockState) list.get(i1) : blockState1, facing, extending, false));
++ level.setBlockEntity(MovingPistonBlock.newMovingBlockEntity(blockPos2, blockState2, allowDesync ? list.get(i1) : blockState1, facing, extending, false));
+ if (!allowDesync) {
+ level.setBlock(oldPos, Blocks.AIR.defaultBlockState(), Block.UPDATE_CLIENTS | Block.UPDATE_KNOWN_SHAPE | Block.UPDATE_MOVE_BY_PISTON | 1024); // set air to prevent later physics updates from seeing this block
+ }