|
| 1 | +From 734f1e9fe94209b1b033fff4b694460d5d46a64f Mon Sep 17 00:00:00 2001 |
| 2 | +From: RoccoDev <hey@rocco.dev> |
| 3 | +Date: Mon, 19 Aug 2024 05:47:17 +0200 |
| 4 | +Subject: [PATCH] Do not call onPlace when block physics are off |
| 5 | + |
| 6 | + |
| 7 | +diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java |
| 8 | +index 4bf3c09e8..b8807f512 100644 |
| 9 | +--- a/src/main/java/net/minecraft/server/World.java |
| 10 | ++++ b/src/main/java/net/minecraft/server/World.java |
| 11 | +@@ -362,10 +362,11 @@ public abstract class World implements IBlockAccess { |
| 12 | + |
| 13 | + // KigPaper start |
| 14 | + public boolean setTypeAndData(BlockPosition blockposition, IBlockData iblockdata, int i) { |
| 15 | +- return this.setTypeAndData(blockposition, iblockdata, i, true); |
| 16 | ++ return this.setTypeAndData(blockposition, iblockdata, i, true, true); |
| 17 | + } |
| 18 | + |
| 19 | +- public boolean setTypeAndData(BlockPosition blockposition, IBlockData iblockdata, int i, boolean updateLight) { // KigPaper end - add updateLight param |
| 20 | ++ public boolean setTypeAndData(BlockPosition blockposition, IBlockData iblockdata, int i, boolean updateLight, boolean placeCallbacks) { |
| 21 | ++ // KigPaper end - add updateLight, placeCallback params |
| 22 | + // CraftBukkit start - tree generation |
| 23 | + if (this.captureTreeGeneration) { |
| 24 | + BlockState blockstate = null; |
| 25 | +@@ -403,7 +404,8 @@ public abstract class World implements IBlockAccess { |
| 26 | + } |
| 27 | + // CraftBukkit end |
| 28 | + |
| 29 | +- IBlockData iblockdata1 = chunk.a(blockposition, iblockdata, updateLight); // KigPaper - add updateLight |
| 30 | ++ // KigPaper - add updateLight, placeCallbacks |
| 31 | ++ IBlockData iblockdata1 = chunk.setBlock(blockposition, iblockdata, updateLight, placeCallbacks); |
| 32 | + |
| 33 | + if (iblockdata1 == null) { |
| 34 | + // CraftBukkit start - remove blockstate if failed |
| 35 | +diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java |
| 36 | +index c7390e0c6..587810e8d 100644 |
| 37 | +--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java |
| 38 | ++++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java |
| 39 | +@@ -134,9 +134,9 @@ public class CraftBlock implements Block { |
| 40 | + IBlockData blockData = getNMSBlock(type).fromLegacyData(data); |
| 41 | + BlockPosition position = new BlockPosition(x, y, z); |
| 42 | + if (applyPhysics) { |
| 43 | +- return chunk.getHandle().getWorld().setTypeAndData(position, blockData, 3, updateLight); |
| 44 | ++ return chunk.getHandle().getWorld().setTypeAndData(position, blockData, 3, updateLight, true); |
| 45 | + } else { |
| 46 | +- boolean success = chunk.getHandle().getWorld().setTypeAndData(position, blockData, 2, updateLight); |
| 47 | ++ boolean success = chunk.getHandle().getWorld().setTypeAndData(position, blockData, 2, updateLight, false); |
| 48 | + if (success) { |
| 49 | + chunk.getHandle().getWorld().notify(position); |
| 50 | + } |
| 51 | +-- |
| 52 | +2.45.2 |
| 53 | + |
0 commit comments