mirror of
https://github.com/LeavesMC/Leaves.git
synced 2025-12-23 17:09:26 +00:00
Update no block update command
This commit is contained in:
@@ -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
|
||||
@@ -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
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
+ }
|
||||
+
|
||||
|
||||
Reference in New Issue
Block a user