mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-20 23:46:57 +01:00
SPIGOT-7248: Bone mealing grass triggers piston block update detector
By: md_5 <git@md-5.net>
This commit is contained in:
parent
fed3e5b5bc
commit
c3fa9fc5b8
1 changed files with 5 additions and 5 deletions
|
@ -123,16 +123,16 @@
|
|||
+ Location location = new Location(world.getWorld(), blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
||||
+ TreeType treeType = BlockSapling.treeType;
|
||||
+ BlockSapling.treeType = null;
|
||||
+ List<BlockState> blocks = new java.util.ArrayList<>(world.capturedBlockStates.values());
|
||||
+ List<CraftBlockState> blocks = new java.util.ArrayList<>(world.capturedBlockStates.values());
|
||||
+ world.capturedBlockStates.clear();
|
||||
+ StructureGrowEvent structureEvent = null;
|
||||
+ if (treeType != null) {
|
||||
+ boolean isBonemeal = getItem() == Items.BONE_MEAL;
|
||||
+ structureEvent = new StructureGrowEvent(location, treeType, isBonemeal, (Player) entityhuman.getBukkitEntity(), blocks);
|
||||
+ structureEvent = new StructureGrowEvent(location, treeType, isBonemeal, (Player) entityhuman.getBukkitEntity(), (List< BlockState>) (List<? extends BlockState>) blocks);
|
||||
+ org.bukkit.Bukkit.getPluginManager().callEvent(structureEvent);
|
||||
+ }
|
||||
+
|
||||
+ BlockFertilizeEvent fertilizeEvent = new BlockFertilizeEvent(CraftBlock.at(world, blockposition), (Player) entityhuman.getBukkitEntity(), blocks);
|
||||
+ BlockFertilizeEvent fertilizeEvent = new BlockFertilizeEvent(CraftBlock.at(world, blockposition), (Player) entityhuman.getBukkitEntity(), (List< BlockState>) (List<? extends BlockState>) blocks);
|
||||
+ fertilizeEvent.setCancelled(structureEvent != null && structureEvent.isCancelled());
|
||||
+ org.bukkit.Bukkit.getPluginManager().callEvent(fertilizeEvent);
|
||||
+
|
||||
|
@ -142,8 +142,8 @@
|
|||
+ this.setTag(newData);
|
||||
+ this.setCount(newCount);
|
||||
+ }
|
||||
+ for (BlockState blockstate : blocks) {
|
||||
+ blockstate.update(true);
|
||||
+ for (CraftBlockState blockstate : blocks) {
|
||||
+ world.setBlock(blockstate.getPosition(),blockstate.getHandle(), blockstate.getFlag()); // SPIGOT-7248 - manual update to avoid physics where appropriate
|
||||
+ }
|
||||
+ entityhuman.awardStat(StatisticList.ITEM_USED.get(item)); // SPIGOT-7236 - award stat
|
||||
+ }
|
||||
|
|
Loading…
Reference in a new issue