9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-26 18:39:23 +00:00
Files
Leaf/leaf-server/minecraft-patches/features/0254-Rail-Optimization-optimized-PoweredRailBlock-logic.patch
Dreeam 3c25377465 Drop some unused patches
ClassInstanceMultiMap belongs to Minecraft vanilla entity storage.
And is unused, since replaced by spottedleaf's entity storage (rewrite chunk system).
However these patches might be useful for vanilla entity storage if is used.
2025-07-09 04:20:02 +08:00

31 lines
1.7 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Dreeam <61569423+Dreeam-qwq@users.noreply.github.com>
Date: Sat, 17 Feb 2024 17:57:08 -0500
Subject: [PATCH] Rail Optimization: optimized PoweredRailBlock logic
Original project: https://github.com/FxMorin/RailOptimization
Full Rewrite of the powered rail iteration logic
that makes powered/activator rails turning on/off up to 4x faster.
This rewrite brings a massive performance boost while keeping the vanilla order. This is achieved by running all the
powered rail logic from a single rail instead of each block iterating separately. Which was not only very
expensive but also completely unnecessary and with a lot of massive overhead
diff --git a/net/minecraft/world/level/block/PoweredRailBlock.java b/net/minecraft/world/level/block/PoweredRailBlock.java
index ebc0df13fc204472742a611b25f1ffd34478b042..1e2f6ef1db365747621d9814ffe3d63fe3e143d8 100644
--- a/net/minecraft/world/level/block/PoweredRailBlock.java
+++ b/net/minecraft/world/level/block/PoweredRailBlock.java
@@ -122,6 +122,12 @@ public class PoweredRailBlock extends BaseRailBlock {
@Override
protected void updateState(BlockState state, Level level, BlockPos pos, Block block) {
+ // Leaf start - Rail Optimization
+ if (org.dreeam.leaf.config.modules.opt.OptimizedPoweredRails.enabled) {
+ org.dreeam.leaf.world.block.OptimizedPoweredRails.updateState(this, state, level, pos);
+ return;
+ }
+ // Leaf end - Rail Optimization
boolean poweredValue = state.getValue(POWERED);
boolean flag = level.hasNeighborSignal(pos)
|| this.findPoweredRailSignal(level, pos, state, true, 0)