Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
2f03620
fix: issue with names sometimes not shown in signalbox
Uhutown Feb 6, 2026
551cb1e
feat: first try for new networking
Uhutown Jan 16, 2026
c69e93e
ref: changed networking system for signal box
Uhutown Jan 19, 2026
35f011f
ref: removed unused
Uhutown Jan 19, 2026
e058da5
fix: new network issues, ref: better code performance
Uhutown Jan 20, 2026
4226528
ref: added tests for network; ref: removed old tests
Uhutown Jan 27, 2026
1510e48
ref: better network performance; fix: issues with Pathways
Uhutown Jan 27, 2026
50e0312
ref: removed unused debug
Uhutown Jan 27, 2026
87b424d
ref: better networking performance
Uhutown Jan 27, 2026
40f9530
fix: issues with manuell output
Uhutown Jan 27, 2026
56c1c23
ref: better code performance
Uhutown Jan 27, 2026
76e5dea
fix: issues with saved pw not removed
Uhutown Feb 3, 2026
53d4b0d
fix: no pathway reset when block is destroyed
Uhutown Feb 4, 2026
4e5744b
ref: changed SIGNAL IDs to hash of the name
Uhutown Feb 4, 2026
75155d3
ref: changed system, when client animations get updated
Uhutown Feb 4, 2026
3b1a3d6
ref: added default entry for better networking and testing
Uhutown Feb 5, 2026
7b3a2d0
fix: issue with presignals not resetting
Uhutown Feb 5, 2026
da8dd4e
ref: removed try-catch in Grid
Uhutown Feb 5, 2026
5b5a5cc
ref: added null check
Uhutown Feb 5, 2026
7e0188b
ref: better code performance ContainerPlacementtool
Uhutown Feb 5, 2026
d8dc9de
ref: removed unnesissary data save
Uhutown Feb 9, 2026
0007863
fix: problems with not saveing pws
Uhutown Feb 9, 2026
78782fe
fix: version specific issues
Uhutown Feb 10, 2026
5bb1490
fix: issues with animation and UI
Uhutown Feb 10, 2026
2cb4488
ref: better handling of reset protectionway
Uhutown Feb 10, 2026
cc1d40c
fix: issues with null-world and no names & properties
Uhutown Feb 10, 2026
1623969
ref: better code performance; fix: issue with client side
Uhutown Feb 10, 2026
a6afd9b
ref: fixed version specific issues
Uhutown Feb 10, 2026
8135d9a
fix: problems with opening signal box UI
Uhutown Feb 10, 2026
06f57bc
fix: semaphore signal animation
Jeronimo97 Feb 16, 2026
77f0c3e
fix: issue with shunting path an pw saver
Uhutown Feb 17, 2026
b83fb0b
Merge branch '1.16-ref/network' of https://github.com/MrTroble/Open-S…
Uhutown Feb 17, 2026
a9b0203
fix: subsidiary signal not turns off, when changeing to EDITOR mode
Uhutown Feb 19, 2026
3f26538
fix: pathway can't be set with activated subsidiary
Uhutown Feb 19, 2026
f905039
ref: added lang entries
Uhutown Feb 19, 2026
4d86ff7
ref: fixed issues with wrong signal data in SignalController
Uhutown Feb 20, 2026
1d1e113
fix: issue with 2 players in signal box
Uhutown Feb 23, 2026
6b975a2
fix: protection way was not required when next pathway was present
Uhutown Feb 23, 2026
9425056
fix: class nameing
Uhutown Feb 23, 2026
cafe09a
ref: hopefully fixed issue with missing signals
Uhutown Feb 24, 2026
6051817
feat: added config option for blocking of RS path with activated input
Uhutown Feb 26, 2026
3afb74d
fix: issue with loading problems
Uhutown Mar 2, 2026
83e8e09
Update mast_lamp
Skywalkervalle Feb 11, 2026
c996b96
fix Zs8 for Hl-Signalsytem
Skywalkervalle Feb 13, 2026
65daf25
fix upper UV at ks_mast -> now green and not any more transparent
Skywalkervalle Feb 15, 2026
bd8a150
chore: update version and changelog
Jeronimo97 Mar 3, 2026
d119cf1
ref: better test performance
Uhutown Mar 5, 2026
87ccf07
fix: issue with ClassCastException in Signal
Uhutown Mar 31, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
if: endswith(github.ref_name, 'master') && github.ref_protected && github.ref_type == 'branch'
runs-on: ubuntu-latest
env:
APPVEYOR_BUILD_VERSION: '3.8.1'
APPVEYOR_BUILD_VERSION: '3.8.2'
CURSETOKEN: ${{ secrets.CURSETOKEN }}
steps:
- uses: actions/checkout@v3
Expand Down
14 changes: 14 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Changelog

## [1.16.5 - 3.8.2]
* feat: added config option to block shunting path with active redstone input
* feat/fix: pathway can't be set with active subsidiary
* fix: signal name not loaded in signalbox
* fix: semaphore signal animation
* fix: issue with wrong signal data in SignalController
* fix: client signal property (network) loading
* fix: mast_lamps glowing lamps and ks signal mast model
* fix: hl subsidiary config
* fix: minor fixes
* ref/fix: client-server signalsystem mismatch
* ref: new signalbox networking system
* ref: client animation update trigger

## [1.16.5 - 3.8.1]
* fix: issues with loading NBT data of signal box
* fix: issues with setting pathway with a overlap nearby
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,12 @@ private void updateAnimation(final ModelTranslation translation, final float tic
translation.setUpNewTranslation(animation.getModelTranslation());
}

public void updateStates(final Map<SEProperty, String> properties, final boolean firstLoad) {
public void updateStates(final Map<SEProperty, String> properties,
final boolean loadToFinalState) {
if (properties == null || properties.isEmpty())
return;
final ModelInfoWrapper wrapper = new ModelInfoWrapper(properties);
if (firstLoad) {
if (loadToFinalState) {
updateToFinalizedAnimations(wrapper);
} else {
updateAnimations(wrapper);
Expand Down
19 changes: 12 additions & 7 deletions src/main/java/com/troblecodings/signals/blocks/Signal.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import net.minecraft.item.ItemStack;
import net.minecraft.state.EnumProperty;
import net.minecraft.state.StateContainer.Builder;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
Expand All @@ -68,7 +69,7 @@ public class Signal extends BasicBlock {
};

public static final Map<String, Signal> SIGNALS = new HashMap<>();
public static final List<Signal> SIGNAL_IDS = new ArrayList<>();
public static final Map<Integer, Signal> SIGNAL_IDS = new HashMap<>();
public static final EnumProperty<SignalAngel> ANGEL =
EnumProperty.create("angel", SignalAngel.class);
public static final SEProperty CUSTOMNAME = new SEProperty("customname", JsonEnum.BOOLEAN,
Expand All @@ -80,13 +81,17 @@ public class Signal extends BasicBlock {
private List<SEProperty> signalProperties;
private final Map<SEProperty, Integer> signalPropertiesToInt = new HashMap<>();

public Signal(final SignalProperties prop) {
public Signal(final SignalProperties prop, final String name) {
super(Properties.of(Material.STONE).noOcclusion()
.lightLevel(u -> ConfigHandler.GENERAL.lightEmission.get())
.isRedstoneConductor((_u1, _u2, _u3) -> false));
this.prop = prop;
this.id = SIGNAL_IDS.size();
SIGNAL_IDS.add(this);
this.id = name.hashCode();
if (SIGNAL_IDS.containsKey(this.id)) {
OpenSignalsMain.exitMinecraftWithMessage("Hash [" + this.id + "] already exists for ["
+ name + "]! Need to choose an other name!");
}
SIGNAL_IDS.put(this.id, this);
registerDefaultState(defaultBlockState().setValue(ANGEL, SignalAngel.ANGEL0));
prop.placementtool.addSignal(this);
for (int i = 0; i < signalProperties.size(); i++) {
Expand Down Expand Up @@ -140,14 +145,14 @@ public int getIDFromProperty(final SEProperty property) {
@Override
public VoxelShape getShape(final BlockState state, final IBlockReader source,
final BlockPos pos, final ISelectionContext context) {
final SignalTileEntity te = (SignalTileEntity) source.getBlockEntity(pos);
if (te == null)
final TileEntity te = source.getBlockEntity(pos);
if (te == null || (!te instanceof SignalTileEntity))
return VoxelShapes.block();
final World world = te.getLevel();
final SignalStateInfo info = new SignalStateInfo(world, pos, this);
final Map<SEProperty, String> properties = world.isClientSide
? ClientSignalStateHandler.getClientStates(new StateInfo(info.world, info.pos))
: te.getProperties();
: ((SignalTileEntity) te).getProperties();
return VoxelShapes
.create(VoxelShapes.block().bounds().expandTowards(0, getHeight(properties), 0));
}
Expand Down
7 changes: 5 additions & 2 deletions src/main/java/com/troblecodings/signals/blocks/SignalBox.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,19 @@ public Optional<String> getSupplierWrapperName() {
public void playerWillDestroy(final World world, final BlockPos pos, final BlockState state,
final PlayerEntity player) {
if (!world.isClientSide) {
((SignalBoxTileEntity) world.getBlockEntity(pos)).unlink();
final SignalBoxTileEntity tile = (SignalBoxTileEntity) world.getBlockEntity(pos);
tile.unlink();
tile.getSignalBoxGrid().resetAllPathways();
SignalBoxHandler.removeSignalBox(new StateInfo(world, pos));
SignalBoxHandler.onPosRemove(new StateInfo(world, pos));
}
super.playerWillDestroy(world, pos, state, player);
}

@Override
public void onPlace(final BlockState state, final World world, final BlockPos pos,
final BlockState state2, final boolean bool) {
SignalBoxHandler.relinkAllRedstoneIOs(new StateInfo(world, pos));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public static class General {
public final ConfigValue<Integer> lightEmission;
public final ConfigValue<Boolean> debugMode;
public final ConfigValue<Boolean> canAddRSPathToSaver;
public final ConfigValue<Boolean> canInputBlockShuntingPath;

public General(final ForgeConfigSpec.Builder builder) {
String desc;
Expand All @@ -38,9 +39,13 @@ public General(final ForgeConfigSpec.Builder builder) {
desc = "Toggle debug mode.";
debugMode = builder.comment(desc).define("Debug Mode", false);

desc = "ShuntingPaths can be added to PathwaySaver.";
desc = "ShuntingPaths can be added to PathwaySaver. Default: false";
canAddRSPathToSaver = builder.comment(desc).define("canAddRSPathToSaver", false);

desc = "Choose wether a blocking input can prevent setting a shunting path. Default: false";
canInputBlockShuntingPath =
builder.comment(desc).define("canInputBlockShuntingPath", false);

builder.pop();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ public class SignalSystemParser {
private static final Gson GSON = new Gson();

public static Map<String, SignalSystemParser> getAllSignals() {
final List<Entry<String, String>> systems = OpenSignalsMain.contentPacks
.getFiles("signalsystems");
final List<Entry<String, String>> systems =
OpenSignalsMain.contentPacks.getFiles("signalsystems");
final Map<String, SignalSystemParser> properties = new HashMap<>();
systems.forEach(entry -> {
properties.put(entry.getKey(),
Expand Down Expand Up @@ -55,6 +55,6 @@ public Signal createSignalSystem(final String fileName) {
Signal.nextConsumer = list -> {
list.addAll(properties);
};
return new Signal(systemProperties.build(info));
return new Signal(systemProperties.build(info), name);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.troblecodings.core.WriteBuffer;
import com.troblecodings.signals.SEProperty;
import com.troblecodings.signals.blocks.Signal;
import com.troblecodings.signals.network.SignalBoxNetworkHandler;
import com.troblecodings.signals.signalbox.Point;
import com.troblecodings.signals.signalbox.SignalBoxNode;
import com.troblecodings.signals.signalbox.entrys.PathEntryType;
Expand All @@ -33,14 +34,17 @@ public static BiConsumer<WriteBuffer, SEProperty> getSEPropertyConsumer(final Si
public static final Function<ReadBuffer, PathEntryType<?>> PATHENTRYTYPE_FUNCTION = buf -> PathEntryType.ALL_ENTRIES
.get(buf.getByteToUnsignedInt());

public static Function<ReadBuffer, SignalBoxNode> getSignalBoxNodeFunc() {
public static Function<ReadBuffer, SignalBoxNode> getSignalBoxNodeFunc(
final SignalBoxNetworkHandler network) {
return buffer -> getSignalBoxNodeFunc(
ReadBuffer.getINetworkSaveableFunction(Point.class).apply(buffer)).apply(buffer);
ReadBuffer.getINetworkSaveableFunction(Point.class).apply(buffer), network)
.apply(buffer);
}

public static Function<ReadBuffer, SignalBoxNode> getSignalBoxNodeFunc(final Point point) {
public static Function<ReadBuffer, SignalBoxNode> getSignalBoxNodeFunc(final Point point,
final SignalBoxNetworkHandler network) {
return buffer -> {
final SignalBoxNode node = new SignalBoxNode(point);
final SignalBoxNode node = new SignalBoxNode(point, network);
node.readNetwork(buffer);
return node;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@

public class PathwayRequestResult {

private static final Map<PathwayRequestMode, PathwayRequestResult> MODE_TO_RESULT = new HashMap<>();
private static final Map<PathwayRequestMode, PathwayRequestResult> MODE_TO_RESULT =
new HashMap<>();

static {
for (final PathwayRequestMode mode : PathwayRequestMode.values()) {
if (mode == PathwayRequestMode.PASS)
if (mode == PathwayRequestMode.PASS) {
continue;
}
MODE_TO_RESULT.put(mode, new PathwayRequestResult(mode));
}
}
Expand Down Expand Up @@ -74,9 +76,7 @@ public int hashCode() {
public boolean equals(final Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
if ((obj == null) || (getClass() != obj.getClass()))
return false;
final PathwayRequestResult other = (PathwayRequestResult) obj;
return Objects.equals(data, other.data) && mode == other.mode;
Expand All @@ -87,7 +87,8 @@ public enum PathwayRequestMode {
NO_EQUAL_PATH_TYPE("no_equal_path_type"), NOT_IN_GRID("not_in_grid"),
ALREADY_USED("already_used"), OVERSTEPPING("overstepping"),
INPUT_BLOCKING("input_blocking"), NO_PATH("no_path"),
NO_INTERSIGNALBOX_SELECTED("no_intersignalbox_selected"), PASS("pass");
NO_INTERSIGNALBOX_SELECTED("no_intersignalbox_selected"),
SUBISIDIARY_ENABLED("subsidiary_enabled"), PASS("pass");

private final String name;

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

import com.troblecodings.core.NBTWrapper;
import com.troblecodings.core.ReadBuffer;
Expand Down Expand Up @@ -42,20 +43,25 @@ private void sendItemProperties(final PlayerEntity player) {
final NBTWrapper wrapper = NBTWrapper.getOrCreateWrapper(stack);
final int signalID = wrapper.getInteger(Placementtool.BLOCK_TYPE_ID);
signal = tool.getObjFromID(signalID);
final List<SEProperty> properites = signal.getProperties();
final List<SEProperty> properties = signal.getProperties().stream()
.filter(property -> wrapper.contains(property.getName()))
.collect(Collectors.toList());
final WriteBuffer buffer = new WriteBuffer();
final List<Byte> propertiesToSend = new ArrayList<>();
for (int i = 0; i < properites.size(); i++) {
final SEProperty property = properites.get(i);
for (int i = 0; i < properties.size(); i++) {
final SEProperty property = properties.get(i);
if (wrapper.contains(property.getName())) {
propertiesToSend.add((byte) i);
final String value = wrapper.getString(property.getName());
propertiesToSend.add((byte) property.getParent().getIDFromValue(value));
}
}
final WriteBuffer buffer = new WriteBuffer();
buffer.putInt(signalID);
buffer.putByte((byte) propertiesToSend.size());
propertiesToSend.forEach(buffer::putByte);
buffer.putList(properties, (buf, prop) -> {
buffer.putByte((byte) signal.getIDFromProperty(prop));
final String value = wrapper.getString(prop.getName());
buffer.putByte((byte) prop.getParent().getIDFromValue(value));
});
final String signalName = wrapper.getString(SIGNAL_NAME);
buffer.putString(signalName);
OpenSignalsMain.network.sendTo(player, buffer);
Expand Down Expand Up @@ -93,16 +99,16 @@ public void deserializeServer(final ReadBuffer buffer) {
@Override
public void deserializeClient(final ReadBuffer buffer) {
signalID = buffer.getInt();
final int size = buffer.getByteToUnsignedInt();
final Placementtool tool = (Placementtool) info.player.getMainHandItem().getItem();
final Signal signal = tool.getObjFromID(signalID);
final List<SEProperty> signalProperties = signal.getProperties();
properties.clear();
for (int i = 0; i < size / 2; i++) {
final SEProperty property = signalProperties.get(buffer.getByteToUnsignedInt());
final int value = buffer.getByteToUnsignedInt();
properties.put(property, value);
}
buffer.getList(buf -> {
final SEProperty prop = signalProperties.get(buf.getByteToUnsignedInt());
final int value = buf.getByteToUnsignedInt();
properties.put(prop, value);
return prop;
});
signalName = buffer.getString();
signalProperties.forEach(property -> {
if (!properties.containsKey(property)) {
Expand Down
Loading
Loading