Skip to content

Commit

Permalink
Fixed #2899
Browse files Browse the repository at this point in the history
  • Loading branch information
Mgazul committed Jan 22, 2024
1 parent 07189cc commit 6f61b48
Showing 1 changed file with 24 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
--- a/net/minecraft/block/ConcretePowderBlock.java
+++ b/net/minecraft/block/ConcretePowderBlock.java
@@ -10,6 +_,8 @@
@@ -10,6 +_,9 @@
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
+import org.bukkit.craftbukkit.v1_16_R3.block.CraftBlockState;
+import org.bukkit.event.block.BlockFormEvent;
+import org.spigotmc.AsyncCatcher;

public class ConcretePowderBlock extends FallingBlock {
private final BlockState field_200294_a;
Expand All @@ -18,7 +19,7 @@
}

}
@@ -30,7 +_,19 @@
@@ -30,7 +_,23 @@
IBlockReader iblockreader = p_196258_1_.func_195991_k();
BlockPos blockpos = p_196258_1_.func_195995_a();
BlockState blockstate = iblockreader.func_180495_p(blockpos);
Expand All @@ -27,31 +28,39 @@
+ if (!func_230137_b_(iblockreader, blockpos, blockstate)) {
+ return super.func_196258_a(p_196258_1_);
+ }
+ CraftBlockState blockState = CraftBlockState.getBlockState(p_196258_1_.func_195991_k(), blockpos);
+ blockState.setData(this.field_200294_a);
+ BlockFormEvent event = new BlockFormEvent(blockState.getBlock(), blockState);
+ p_196258_1_.func_195991_k().getCBServer().getPluginManager().callEvent(event);
+ if (!event.isCancelled()) {
+ return blockState.getHandle();
+ if (AsyncCatcher.catchAsync()) {
+ return this.field_200294_a;
+ } else {
+ CraftBlockState blockState = CraftBlockState.getBlockState(p_196258_1_.func_195991_k(), blockpos);
+ blockState.setData(this.field_200294_a);
+ BlockFormEvent event = new BlockFormEvent(blockState.getBlock(), blockState);
+ p_196258_1_.func_195991_k().getCBServer().getPluginManager().callEvent(event);
+ if (!event.isCancelled()) {
+ return blockState.getHandle();
+ }
+ }
+ return super.func_196258_a(p_196258_1_);
+ // CraftBukkit end
}

private static boolean func_230137_b_(IBlockReader p_230137_0_, BlockPos p_230137_1_, BlockState p_230137_2_) {
@@ -61,7 +_,18 @@
@@ -61,7 +_,22 @@
}

public BlockState func_196271_a(BlockState p_196271_1_, Direction p_196271_2_, BlockState p_196271_3_, IWorld p_196271_4_, BlockPos p_196271_5_, BlockPos p_196271_6_) {
- return func_196441_b(p_196271_4_, p_196271_5_) ? this.field_200294_a : super.func_196271_a(p_196271_1_, p_196271_2_, p_196271_3_, p_196271_4_, p_196271_5_, p_196271_6_);
+ // CraftBukkit start
+ if (func_196441_b(p_196271_4_, p_196271_5_)) {
+ CraftBlockState blockState = CraftBlockState.getBlockState(p_196271_4_, p_196271_5_);
+ blockState.setData(this.field_200294_a);
+ BlockFormEvent event = new BlockFormEvent(blockState.getBlock(), blockState);
+ p_196271_4_.getMinecraftWorld().getCBServer().getPluginManager().callEvent(event);
+ if (!event.isCancelled()) {
+ return blockState.getHandle();
+ if (AsyncCatcher.catchAsync()) {
+ return this.field_200294_a;
+ } else {
+ CraftBlockState blockState = CraftBlockState.getBlockState(p_196271_4_, p_196271_5_);
+ blockState.setData(this.field_200294_a);
+ BlockFormEvent event = new BlockFormEvent(blockState.getBlock(), blockState);
+ p_196271_4_.getMinecraftWorld().getCBServer().getPluginManager().callEvent(event);
+ if (!event.isCancelled()) {
+ return blockState.getHandle();
+ }
+ }
+ }
+ return super.func_196271_a(p_196271_1_, p_196271_2_, p_196271_3_, p_196271_4_, p_196271_5_, p_196271_6_);
Expand Down

0 comments on commit 6f61b48

Please sign in to comment.