From 7e75325dad299e3b72b48447d20dce4b4f422bd8 Mon Sep 17 00:00:00 2001 From: Goldenfield192 <1437356849@qq.com> Date: Mon, 2 Mar 2026 20:35:40 +0800 Subject: [PATCH] feat: add method to access strong redstone power directly --- src/main/java/cam72cam/mod/world/World.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/main/java/cam72cam/mod/world/World.java b/src/main/java/cam72cam/mod/world/World.java index b08595f0..d9fcb40d 100644 --- a/src/main/java/cam72cam/mod/world/World.java +++ b/src/main/java/cam72cam/mod/world/World.java @@ -569,7 +569,7 @@ public float getBlockHardness(Vec3i pos) { return internal.getBlockState(pos.internal()).getBlockHardness(internal, pos.internal()); } - /** Get max redstone power surrounding this block */ + /** Get max redstone power (strong and weak) surrounding this block */ public int getRedstone(Vec3i pos) { int power = 0; for (Facing facing : Facing.values()) { @@ -578,6 +578,19 @@ public int getRedstone(Vec3i pos) { return power; } + /** + * Get max strong redstone power surrounding this block + *

+ * Sometimes attempts to get weak power may trap us into infinite loop, use this in that circumstance + * */ + public int getRedstoneDirect(Vec3i pos) { + int power = 0; + for (Facing facing : Facing.values()) { + power = Math.max(power, internal.getStrongPower(pos.offset(facing).internal(), facing.internal)); + } + return power; + } + /** If the sky is visible at this position */ public boolean canSeeSky(Vec3i position) { return internal.canSeeSky(position.internal());