mirror of
https://github.com/LeavesMC/Leaves.git
synced 2025-12-19 14:59:32 +00:00
94 lines
6.5 KiB
Diff
94 lines
6.5 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: violetc <58360096+s-yh-china@users.noreply.github.com>
|
|
Date: Mon, 3 Feb 2025 19:16:16 +0800
|
|
Subject: [PATCH] No block update command
|
|
|
|
|
|
diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
|
|
index 30a543de1d8b454ffec0c6cd668aad3504cdf95d..0ea8b6c844f85226081408847781f5ccea461bc3 100644
|
|
--- a/net/minecraft/server/level/ServerLevel.java
|
|
+++ b/net/minecraft/server/level/ServerLevel.java
|
|
@@ -2386,6 +2386,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
|
|
|
@Override
|
|
public void blockUpdated(BlockPos pos, Block block) {
|
|
+ if (org.leavesmc.leaves.command.NoBlockUpdateCommand.isNoBlockUpdate()) return; // Leaves - no block update
|
|
if (!this.isDebug()) {
|
|
// CraftBukkit start
|
|
if (this.populating) {
|
|
diff --git a/net/minecraft/world/item/ItemStack.java b/net/minecraft/world/item/ItemStack.java
|
|
index 889a947cec81683cb7caa447dbf28b701fb38d0b..e1351c55d1b50c0f28a4c225400ade1d626d840c 100644
|
|
--- a/net/minecraft/world/item/ItemStack.java
|
|
+++ b/net/minecraft/world/item/ItemStack.java
|
|
@@ -487,7 +487,7 @@ public final class ItemStack implements DataComponentHolder {
|
|
net.minecraft.world.level.block.state.BlockState block = serverLevel.getBlockState(newPos);
|
|
|
|
if (!(block.getBlock() instanceof net.minecraft.world.level.block.BaseEntityBlock)) { // Containers get placed automatically
|
|
- block.onPlace(serverLevel, newPos, oldBlock, true, context);
|
|
+ if (!org.leavesmc.leaves.command.NoBlockUpdateCommand.isNoBlockUpdate()) block.onPlace(serverLevel, newPos, oldBlock, true, context); // Leaves - no block update
|
|
}
|
|
|
|
serverLevel.notifyAndUpdatePhysics(newPos, null, oldBlock, block, serverLevel.getBlockState(newPos), updateFlag, net.minecraft.world.level.block.Block.UPDATE_LIMIT); // send null chunk as chunk.k() returns false by this point
|
|
diff --git a/net/minecraft/world/level/chunk/LevelChunk.java b/net/minecraft/world/level/chunk/LevelChunk.java
|
|
index 1776b79309ffd9a8a52f27a144606ed9a441251e..1e4e1a3236fc6b9aa515f2025cdef5a901c64d58 100644
|
|
--- a/net/minecraft/world/level/chunk/LevelChunk.java
|
|
+++ b/net/minecraft/world/level/chunk/LevelChunk.java
|
|
@@ -405,7 +405,7 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
|
|
return null;
|
|
} else {
|
|
if (!this.level.isClientSide && doPlace && (!this.level.captureBlockStates || block instanceof net.minecraft.world.level.block.BaseEntityBlock)) { // CraftBukkit - Don't place while processing the BlockPlaceEvent, unless it's a BlockContainer. Prevents blocks such as TNT from activating when cancelled.
|
|
- state.onPlace(this.level, pos, blockState, isMoving);
|
|
+ if (!org.leavesmc.leaves.command.NoBlockUpdateCommand.isNoBlockUpdate()) state.onPlace(this.level, pos, blockState, isMoving); // Leaves - no block update
|
|
}
|
|
|
|
if (state.hasBlockEntity()) {
|
|
diff --git a/net/minecraft/world/level/material/FlowingFluid.java b/net/minecraft/world/level/material/FlowingFluid.java
|
|
index e30499bdcd6600e5c9d4a755c1182fb6dff3735f..ce3a74860f4a6b65e6eb1cf422f71ec1f844ecd2 100644
|
|
--- a/net/minecraft/world/level/material/FlowingFluid.java
|
|
+++ b/net/minecraft/world/level/material/FlowingFluid.java
|
|
@@ -475,6 +475,7 @@ public abstract class FlowingFluid extends Fluid {
|
|
|
|
@Override
|
|
public void tick(ServerLevel level, BlockPos pos, BlockState blockState, FluidState fluidState) {
|
|
+ if (org.leavesmc.leaves.command.NoBlockUpdateCommand.isNoBlockUpdate()) return; // Leaves - no block update
|
|
if (!fluidState.isSource()) {
|
|
FluidState newLiquid = this.getNewLiquid(level, pos, level.getBlockState(pos));
|
|
int spreadDelay = this.getSpreadDelay(level, pos, fluidState, newLiquid);
|
|
diff --git a/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java b/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java
|
|
index 028eae2f9a459b60e92f3344091083aa93b54485..63684402f7c89c7c5d71902db4bfb23132b1d28d 100644
|
|
--- a/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java
|
|
+++ b/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java
|
|
@@ -47,6 +47,7 @@ public class CollectingNeighborUpdater implements NeighborUpdater {
|
|
}
|
|
|
|
private void addAndRun(BlockPos pos, CollectingNeighborUpdater.NeighborUpdates updates) {
|
|
+ if (org.leavesmc.leaves.command.NoBlockUpdateCommand.isNoBlockUpdate()) return; // Leaves - no block update
|
|
boolean flag = this.count > 0;
|
|
boolean flag1 = this.maxChainedNeighborUpdates >= 0 && this.count >= this.maxChainedNeighborUpdates;
|
|
this.count++;
|
|
diff --git a/net/minecraft/world/level/redstone/InstantNeighborUpdater.java b/net/minecraft/world/level/redstone/InstantNeighborUpdater.java
|
|
index d0da64e325f83ab073221a3fa7284e42b6a88534..32e10dccde3e80969641ba1fb67479b5a0bada06 100644
|
|
--- a/net/minecraft/world/level/redstone/InstantNeighborUpdater.java
|
|
+++ b/net/minecraft/world/level/redstone/InstantNeighborUpdater.java
|
|
@@ -16,17 +16,20 @@ public class InstantNeighborUpdater implements NeighborUpdater {
|
|
|
|
@Override
|
|
public void shapeUpdate(Direction direction, BlockState state, BlockPos pos, BlockPos neighborPos, int flags, int recursionLevel) {
|
|
+ if (org.leavesmc.leaves.command.NoBlockUpdateCommand.isNoBlockUpdate()) return; // Leaves - no block update
|
|
NeighborUpdater.executeShapeUpdate(this.level, direction, pos, neighborPos, state, flags, recursionLevel - 1);
|
|
}
|
|
|
|
@Override
|
|
public void neighborChanged(BlockPos pos, Block neighborBlock, @Nullable Orientation orientation) {
|
|
+ if (org.leavesmc.leaves.command.NoBlockUpdateCommand.isNoBlockUpdate()) return; // Leaves - no block update
|
|
BlockState blockState = this.level.getBlockState(pos);
|
|
this.neighborChanged(blockState, pos, neighborBlock, orientation, false);
|
|
}
|
|
|
|
@Override
|
|
public void neighborChanged(BlockState state, BlockPos pos, Block neighborBlock, @Nullable Orientation orientation, boolean movedByPiston) {
|
|
+ if (org.leavesmc.leaves.command.NoBlockUpdateCommand.isNoBlockUpdate()) return; // Leaves - no block update
|
|
NeighborUpdater.executeUpdate(this.level, state, pos, neighborBlock, orientation, movedByPiston);
|
|
}
|
|
}
|