aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/ConcretePowderBlock.java.patch
diff options
context:
space:
mode:
authorMiniDigger | Martin <[email protected]>2024-01-14 11:04:49 +0100
committerMiniDigger | Martin <[email protected]>2024-01-14 11:04:49 +0100
commitbee74680e607c2e29b038329f62181238911cd83 (patch)
tree708fd1a4a0227d9071243adf2a42d5e9e96cde4a /patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/ConcretePowderBlock.java.patch
parent0a44692ef6ff6e255d48eb3ba1bb114166eafda9 (diff)
downloadPaper-softspoon.tar.gz
Paper-softspoon.zip
add remapped patches as a testsoftspoon
Diffstat (limited to 'patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/ConcretePowderBlock.java.patch')
-rw-r--r--patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/ConcretePowderBlock.java.patch87
1 files changed, 87 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/ConcretePowderBlock.java.patch b/patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/ConcretePowderBlock.java.patch
new file mode 100644
index 0000000000..7334a8a06a
--- /dev/null
+++ b/patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/ConcretePowderBlock.java.patch
@@ -0,0 +1,87 @@
+--- a/net/minecraft/world/level/block/ConcretePowderBlock.java
++++ b/net/minecraft/world/level/block/ConcretePowderBlock.java
+@@ -15,6 +14,12 @@
+ import net.minecraft.world.level.block.state.BlockBehaviour;
+ import net.minecraft.world.level.block.state.BlockState;
+
++// CraftBukkit start
++import org.bukkit.craftbukkit.block.CraftBlockState;
++import org.bukkit.craftbukkit.block.CraftBlockStates;
++import org.bukkit.event.block.BlockFormEvent;
++// CraftBukkit end
++
+ public class ConcretePowderBlock extends FallingBlock {
+ public static final MapCodec<ConcretePowderBlock> CODEC = RecordCodecBuilder.mapCodec(
+ instance -> instance.group(
+@@ -37,16 +42,34 @@
+ @Override
+ public void onLand(Level level, BlockPos pos, BlockState state, BlockState replaceableState, FallingBlockEntity fallingBlock) {
+ if (shouldSolidify(level, pos, replaceableState)) {
+- level.setBlock(pos, this.concrete.defaultBlockState(), 3);
++ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(level, pos, this.concrete.defaultBlockState(), 3); // CraftBukkit
+ }
+ }
+
+ @Override
+- public BlockState getStateForPlacement(BlockPlaceContext context) {
+- BlockGetter level = context.getLevel();
+- BlockPos clickedPos = context.getClickedPos();
+- BlockState blockState = level.getBlockState(clickedPos);
+- return shouldSolidify(level, clickedPos, blockState) ? this.concrete.defaultBlockState() : super.getStateForPlacement(context);
++ public IBlockData getStateForPlacement(BlockPlaceContext context) {
++ Level world = context.getLevel();
++ BlockPos blockposition = context.getClickedPos();
++ IBlockData iblockdata = world.getBlockState(blockposition);
++
++ // CraftBukkit start
++ if (!shouldSolidify(world, blockposition, iblockdata)) {
++ return super.getStateForPlacement(context);
++ }
++
++ // TODO: An event factory call for methods like this
++ CraftBlockState blockState = CraftBlockStates.getBlockState(world, blockposition);
++ blockState.setData(this.concrete.defaultBlockState());
++
++ BlockFormEvent event = new BlockFormEvent(blockState.getBlock(), blockState);
++ world.getServer().server.getPluginManager().callEvent(event);
++
++ if (!event.isCancelled()) {
++ return blockState.getHandle();
++ }
++
++ return super.getStateForPlacement(context);
++ // CraftBukkit end
+ }
+
+ private static boolean shouldSolidify(BlockGetter level, BlockPos pos, BlockState state) {
+@@ -77,10 +105,26 @@
+ }
+
+ @Override
+- public BlockState updateShape(BlockState state, Direction facing, BlockState facingState, LevelAccessor level, BlockPos currentPos, BlockPos facingPos) {
+- return touchesLiquid(level, currentPos)
+- ? this.concrete.defaultBlockState()
+- : super.updateShape(state, facing, facingState, level, currentPos, facingPos);
++ public IBlockData updateShape(IBlockData state, Direction facing, IBlockData facingState, LevelAccessor level, BlockPos currentPos, BlockPos facingPos) {
++ // CraftBukkit start
++ if (touchesLiquid(level, currentPos)) {
++ // Suppress during worldgen
++ if (!(level instanceof Level)) {
++ return this.concrete.defaultBlockState();
++ }
++ CraftBlockState blockState = CraftBlockStates.getBlockState(level, currentPos);
++ blockState.setData(this.concrete.defaultBlockState());
++
++ BlockFormEvent event = new BlockFormEvent(blockState.getBlock(), blockState);
++ ((Level) level).getCraftServer().getPluginManager().callEvent(event);
++
++ if (!event.isCancelled()) {
++ return blockState.getHandle();
++ }
++ }
++
++ return super.updateShape(state, facing, facingState, level, currentPos, facingPos);
++ // CraftBukkit end
+ }
+
+ @Override