Skip to content

Commit

Permalink
Update no block update command
Browse files Browse the repository at this point in the history
  • Loading branch information
s-yh-china committed Aug 17, 2023
1 parent 51b5a64 commit 6326dde
Showing 1 changed file with 29 additions and 3 deletions.
32 changes: 29 additions & 3 deletions patches/server/0083-No-block-update-command.patch
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,18 @@ Date: Fri, 7 Jul 2023 21:27:24 +0800
Subject: [PATCH] No block update command


diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 4453664ac91eb727e340ace3b6bdb083541f816c..55ef6d5ffebe04e678dc89ec2740f031af361cb8 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -2480,6 +2480,7 @@ public class ServerLevel extends Level implements WorldGenLevel {

@Override
public void blockUpdated(BlockPos pos, Block block) {
+ if (top.leavesmc.leaves.command.NoBlockUpdateCommand.isNoBlockUpdate()) return; // Leaves - no block update
if (!this.isDebug()) {
// CraftBukkit start
if (populating) {
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
index 879cc823d56625867eb73bb621db6a13f40ad81c..fac8de87a096e2f3ba71fc4043acf66491c5b62b 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
Expand All @@ -17,6 +29,19 @@ index 879cc823d56625867eb73bb621db6a13f40ad81c..fac8de87a096e2f3ba71fc4043acf664
}

world.notifyAndUpdatePhysics(newblockposition, null, oldBlock, block, world.getBlockState(newblockposition), updateFlag, 512); // send null chunk as chunk.k() returns false by this point
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
index 2c3ca05644bc97d505e8ca92e7a5f48670fd8b66..767ea67271b618d28aa77af683a1889917847e65 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -576,7 +576,7 @@ public class LevelChunk extends ChunkAccess {
} else {
// CraftBukkit - Don't place while processing the BlockPlaceEvent, unless it's a BlockContainer. Prevents blocks such as TNT from activating when cancelled.
if (!this.level.isClientSide && doPlace && (!this.level.captureBlockStates || block instanceof net.minecraft.world.level.block.BaseEntityBlock)) {
- iblockdata.onPlace(this.level, blockposition, iblockdata1, flag);
+ if (!top.leavesmc.leaves.command.NoBlockUpdateCommand.isNoBlockUpdate()) iblockdata.onPlace(this.level, blockposition, iblockdata1, flag); // Leaves - no block update
}

if (iblockdata.hasBlockEntity()) {
diff --git a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java b/src/main/java/net/minecraft/world/level/material/FlowingFluid.java
index 39669ad8e8895f1ff3e3a7e3ee1ab39c1b74b09d..c50fd02935870b0f660544efe3d05ea177a0102e 100644
--- a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java
Expand Down Expand Up @@ -91,12 +116,13 @@ index 54d8bc4d86c78f44206aa5769b7db36e39291a98..579d06b8fd026f4a9b8c865bb8192ec7
public static void load(final YamlConfiguration config) {
diff --git a/src/main/java/top/leavesmc/leaves/command/NoBlockUpdateCommand.java b/src/main/java/top/leavesmc/leaves/command/NoBlockUpdateCommand.java
new file mode 100644
index 0000000000000000000000000000000000000000..0eacacf05033289ad2dec9f759d359c956321798
index 0000000000000000000000000000000000000000..d4b0edc241c45f14c2ce339bb70c62b2d65ac74d
--- /dev/null
+++ b/src/main/java/top/leavesmc/leaves/command/NoBlockUpdateCommand.java
@@ -0,0 +1,37 @@
@@ -0,0 +1,38 @@
+package top.leavesmc.leaves.command;
+
+import org.bukkit.Bukkit;
+import org.bukkit.command.Command;
+import org.bukkit.command.CommandSender;
+import org.jetbrains.annotations.NotNull;
Expand Down Expand Up @@ -124,7 +150,7 @@ index 0000000000000000000000000000000000000000..0eacacf05033289ad2dec9f759d359c9
+ public boolean execute(@NotNull CommandSender sender, @NotNull String commandLabel, @NotNull String[] args) {
+ if (!testPermission(sender)) return true;
+ noBlockUpdate = !noBlockUpdate;
+ sender.sendMessage("Block update status: " + !noBlockUpdate);
+ Bukkit.broadcast("Block update status: " + !noBlockUpdate, "bukkit.command.blockupdate");
+ return true;
+ }
+
Expand Down

0 comments on commit 6326dde

Please sign in to comment.