From 86c23c990d6e99d53b76214977c8acf38cc91cc5 Mon Sep 17 00:00:00 2001 From: shojo <108219349+Jimby1234@users.noreply.github.com> Date: Mon, 18 May 2026 20:25:54 +0100 Subject: [PATCH 1/3] I have added nodes to concat to get block position and to get block rotation --- gradle.properties | 2 +- .../computed/content/ComputedNodes.java | 19 +++++--- .../nodes/vanilla/BlockLocationNode.java | 42 ++++++++++++++++++ .../nodes/vanilla/BlockRotationNode.java | 43 +++++++++++++++++++ .../nodes/vanilla/ConcatenateTextNode.java | 27 ++++++++++++ 5 files changed, 127 insertions(+), 6 deletions(-) create mode 100644 src/main/java/dev/propulsionteam/computed/content/nodes/vanilla/BlockLocationNode.java create mode 100644 src/main/java/dev/propulsionteam/computed/content/nodes/vanilla/BlockRotationNode.java create mode 100644 src/main/java/dev/propulsionteam/computed/content/nodes/vanilla/ConcatenateTextNode.java diff --git a/gradle.properties b/gradle.properties index e5e4d49..ec7ac38 100644 --- a/gradle.properties +++ b/gradle.properties @@ -39,4 +39,4 @@ mod_version=1.0.0 # The group ID for the mod. It is only important when publishing as an artifact to a Maven repository. # This should match the base package used for the mod sources. # See https://maven.apache.org/guides/mini/guide-naming-conventions.html -mod_group_id=dev.propulsionteam.computed +mod_group_id=dev.propulsionteam.computed \ No newline at end of file diff --git a/src/main/java/dev/propulsionteam/computed/content/ComputedNodes.java b/src/main/java/dev/propulsionteam/computed/content/ComputedNodes.java index a074f40..6a5e327 100644 --- a/src/main/java/dev/propulsionteam/computed/content/ComputedNodes.java +++ b/src/main/java/dev/propulsionteam/computed/content/ComputedNodes.java @@ -5,11 +5,7 @@ import dev.propulsionteam.computed.Computed; import dev.propulsionteam.computed.content.nodes.create.CreateRedstoneLinkReceiverNode; import dev.propulsionteam.computed.content.nodes.create.CreateRedstoneLinkSenderNode; -import dev.propulsionteam.computed.content.nodes.vanilla.BlockPresenceNode; -import dev.propulsionteam.computed.content.nodes.vanilla.ComparatorReadNode; -import dev.propulsionteam.computed.content.nodes.vanilla.RedstoneInputNode; -import dev.propulsionteam.computed.content.nodes.vanilla.RedstonePortNode; -import dev.propulsionteam.computed.content.nodes.vanilla.WorldTimeNode; +import dev.propulsionteam.computed.content.nodes.vanilla.*; import dev.propulsionteam.computed.content.nodes.widgets.ButtonWidgetNode; import dev.propulsionteam.computed.content.nodes.widgets.ClockWidgetNode; import dev.propulsionteam.computed.content.nodes.widgets.ColorSourceNode; @@ -74,6 +70,18 @@ public static void register() { NodeMenuRegistry.addNodeEntry( MENU_VANILLA, BlockPresenceNode.TYPE_ID, Component.literal("Block Presence")); + NodeRegistry.register(BlockLocationNode.TYPE_ID, BlockLocationNode::new); + NodeMenuRegistry.addNodeEntry( + MENU_VANILLA, BlockLocationNode.TYPE_ID, Component.literal("Block Location")); + + NodeRegistry.register(ConcatenateTextNode.TYPE_ID, ConcatenateTextNode::new); + NodeMenuRegistry.addNodeEntry( + MENU_VANILLA, ConcatenateTextNode.TYPE_ID, Component.literal("Concatenate Strings")); + + NodeRegistry.register(BlockRotationNode.TYPE_ID, BlockRotationNode::new); + NodeMenuRegistry.addNodeEntry( + MENU_VANILLA, BlockRotationNode.TYPE_ID, Component.literal("Block Rotation")); + NodeMenuRegistry.registerCategory(MENU_WIDGETS, Component.literal("Widgets"), NodeMenuRegistry.ROOT); NodeMenuRegistry.registerCategory(MENU_PERIPHERALS, Component.literal("Peripherals"), NodeMenuRegistry.ROOT); @@ -100,5 +108,6 @@ public static void register() { NodeRegistry.register(WidgetNodeIds.PROGRESS_BAR_WIDGET, ProgressBarWidgetNode::new); NodeMenuRegistry.addNodeEntry(MENU_WIDGETS, WidgetNodeIds.PROGRESS_BAR_WIDGET, Component.literal("Progress Bar Widget")); + } } diff --git a/src/main/java/dev/propulsionteam/computed/content/nodes/vanilla/BlockLocationNode.java b/src/main/java/dev/propulsionteam/computed/content/nodes/vanilla/BlockLocationNode.java new file mode 100644 index 0000000..f8967c8 --- /dev/null +++ b/src/main/java/dev/propulsionteam/computed/content/nodes/vanilla/BlockLocationNode.java @@ -0,0 +1,42 @@ +package dev.propulsionteam.computed.content.nodes.vanilla; + +import dev.devce.websnodelib.api.WNode; +import dev.devce.websnodelib.api.elements.WLabel; +import dev.propulsionteam.computed.Computed; +import dev.propulsionteam.computed.content.blocks.ComputedGraphExecution; +import dev.propulsionteam.computed.content.blocks.ComputerBlockEntity; +import dev.ryanhcode.sable.companion.SableCompanion; +import net.minecraft.core.BlockPos; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.phys.Vec3; + +public final class BlockLocationNode extends WNode { + + public static final ResourceLocation TYPE_ID = + ResourceLocation.fromNamespaceAndPath(Computed.MODID, "block_location"); + + public BlockLocationNode(int x, int y) { + super(TYPE_ID, "Block Location", x, y); + addOutput("X", 0xFFFF0000); + addOutput("Y", 0xFF00FF00); + addOutput("Z", 0xFF0000FF); + + addElement(new WLabel("Position of this computer")); + + setEvaluator(n -> { + ComputerBlockEntity host = ComputedGraphExecution.hostOrNull(); + if (host == null) return; + + BlockPos pos = host.getBlockPos(); + + Vec3 worldPos = SableCompanion.INSTANCE.projectOutOfSubLevel( + host.getLevel(), + (net.minecraft.core.Position) Vec3.atCenterOf(pos) + ); + + n.getOutputs().get(0).setValue(worldPos.x); + n.getOutputs().get(1).setValue(worldPos.y); + n.getOutputs().get(2).setValue(worldPos.z); + }); + } +} \ No newline at end of file diff --git a/src/main/java/dev/propulsionteam/computed/content/nodes/vanilla/BlockRotationNode.java b/src/main/java/dev/propulsionteam/computed/content/nodes/vanilla/BlockRotationNode.java new file mode 100644 index 0000000..5c7a557 --- /dev/null +++ b/src/main/java/dev/propulsionteam/computed/content/nodes/vanilla/BlockRotationNode.java @@ -0,0 +1,43 @@ +package dev.propulsionteam.computed.content.nodes.vanilla; + +import dev.devce.websnodelib.api.WNode; +import dev.devce.websnodelib.api.elements.WLabel; +import dev.propulsionteam.computed.Computed; +import dev.propulsionteam.computed.content.blocks.ComputedGraphExecution; +import dev.propulsionteam.computed.content.blocks.ComputerBlockEntity; +import dev.ryanhcode.sable.companion.SableCompanion; +import dev.ryanhcode.sable.companion.SubLevelAccess; +import net.minecraft.resources.ResourceLocation; +import org.joml.Vector3d; + +public final class BlockRotationNode extends WNode { + + public static final ResourceLocation TYPE_ID = + ResourceLocation.fromNamespaceAndPath(Computed.MODID, "block_rotation"); + + public BlockRotationNode(int x, int y) { + super(TYPE_ID, "Block Rotation", x, y); + addOutput("Yaw", 0xFFFF0000); + addOutput("Pitch", 0xFF00FF00); + addOutput("Roll", 0xFF0000FF); + + addElement(new WLabel("rotation of this computer")); + + setEvaluator(n -> { + ComputerBlockEntity host = ComputedGraphExecution.hostOrNull(); + if (host == null) return; + + SableCompanion sable = SableCompanion.INSTANCE; + + SubLevelAccess subLevel = sable.getContaining(host); + if (subLevel == null) return; + + Vector3d euler = new Vector3d(); + subLevel.logicalPose().orientation().getEulerAnglesXYZ(euler); + + n.getOutputs().get(0).setValue(Math.toDegrees(euler.y)); + n.getOutputs().get(1).setValue(Math.toDegrees(euler.x)); + n.getOutputs().get(2).setValue(Math.toDegrees(euler.z)); + }); + } +} \ No newline at end of file diff --git a/src/main/java/dev/propulsionteam/computed/content/nodes/vanilla/ConcatenateTextNode.java b/src/main/java/dev/propulsionteam/computed/content/nodes/vanilla/ConcatenateTextNode.java new file mode 100644 index 0000000..f11b046 --- /dev/null +++ b/src/main/java/dev/propulsionteam/computed/content/nodes/vanilla/ConcatenateTextNode.java @@ -0,0 +1,27 @@ +package dev.propulsionteam.computed.content.nodes.vanilla; + +import dev.devce.websnodelib.api.WNode; +import dev.devce.websnodelib.api.WPin; +import dev.devce.websnodelib.api.elements.WLabel; +import dev.propulsionteam.computed.Computed; +import net.minecraft.resources.ResourceLocation; + +public final class ConcatenateTextNode extends WNode { + + public static final ResourceLocation TYPE_ID = + ResourceLocation.fromNamespaceAndPath(Computed.MODID, "concatenate_strings"); + + public ConcatenateTextNode(int x, int y) { + super(TYPE_ID, "Concatenate", x, y); + addInput("A", WPin.DataType.STRING, 0xFFFF0000); + addInput("B", WPin.DataType.STRING, 0xFF0000FF); + addOutput("text",WPin.DataType.STRING ,0xFF00FF00); + + addElement(new WLabel("A + B = AB")); + + setEvaluator(n -> { + String concatedString = n.getInputs().get(0).getStringValue() + n.getInputs().get(1).getStringValue(); + n.getOutputs().get(0).setStringValue(concatedString); + }); + } +} \ No newline at end of file From e4e23ec77ba40a9108a9e9ddbefd5d4a617da1af Mon Sep 17 00:00:00 2001 From: shojo <108219349+Jimby1234@users.noreply.github.com> Date: Mon, 18 May 2026 22:08:51 +0100 Subject: [PATCH 2/3] Update ComputedNodes.java --- .../propulsionteam/computed/content/ComputedNodes.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/dev/propulsionteam/computed/content/ComputedNodes.java b/src/main/java/dev/propulsionteam/computed/content/ComputedNodes.java index 6a5e327..8d6e463 100644 --- a/src/main/java/dev/propulsionteam/computed/content/ComputedNodes.java +++ b/src/main/java/dev/propulsionteam/computed/content/ComputedNodes.java @@ -5,7 +5,14 @@ import dev.propulsionteam.computed.Computed; import dev.propulsionteam.computed.content.nodes.create.CreateRedstoneLinkReceiverNode; import dev.propulsionteam.computed.content.nodes.create.CreateRedstoneLinkSenderNode; -import dev.propulsionteam.computed.content.nodes.vanilla.*; +import dev.propulsionteam.computed.content.nodes.vanilla.BlockPresenceNode; +import dev.propulsionteam.computed.content.nodes.vanilla.ComparatorReadNode; +import dev.propulsionteam.computed.content.nodes.vanilla.RedstoneInputNode; +import dev.propulsionteam.computed.content.nodes.vanilla.RedstonePortNode; +import dev.propulsionteam.computed.content.nodes.vanilla.WorldTimeNode; +import dev.propulsionteam.computed.content.nodes.vanilla.BlockLocationNode; +import dev.propulsionteam.computed.content.nodes.vanilla.BlockRotationNode; +import dev.propulsionteam.computed.content.nodes.vanilla.ConcatenateTextNode; import dev.propulsionteam.computed.content.nodes.widgets.ButtonWidgetNode; import dev.propulsionteam.computed.content.nodes.widgets.ClockWidgetNode; import dev.propulsionteam.computed.content.nodes.widgets.ColorSourceNode; From 7a4ee1552f3357b01956c8e5e5b59add07265631 Mon Sep 17 00:00:00 2001 From: shojo <108219349+Jimby1234@users.noreply.github.com> Date: Mon, 18 May 2026 22:32:13 +0100 Subject: [PATCH 3/3] Update BlockRotationNode.java --- .../computed/content/nodes/vanilla/BlockRotationNode.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/dev/propulsionteam/computed/content/nodes/vanilla/BlockRotationNode.java b/src/main/java/dev/propulsionteam/computed/content/nodes/vanilla/BlockRotationNode.java index 5c7a557..daa18eb 100644 --- a/src/main/java/dev/propulsionteam/computed/content/nodes/vanilla/BlockRotationNode.java +++ b/src/main/java/dev/propulsionteam/computed/content/nodes/vanilla/BlockRotationNode.java @@ -33,7 +33,7 @@ public BlockRotationNode(int x, int y) { if (subLevel == null) return; Vector3d euler = new Vector3d(); - subLevel.logicalPose().orientation().getEulerAnglesXYZ(euler); + subLevel.logicalPose().orientation().getEulerAnglesYXZ(euler); n.getOutputs().get(0).setValue(Math.toDegrees(euler.y)); n.getOutputs().get(1).setValue(Math.toDegrees(euler.x));