Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
f1f5a41
fix: issue with names sometimes not shown in signalbox
Uhutown Feb 6, 2026
e8f0aca
maby fix: issues with signal states not been shown
Uhutown Feb 9, 2026
4afbb6d
Revert "maby fix: issues with signal states not been shown"
Uhutown Feb 9, 2026
7d074ca
ref: revert the revert, added debug output
Uhutown Feb 9, 2026
916fab3
ref: changed debug output
Uhutown Feb 9, 2026
3391db7
ref: changed debug output
Uhutown Feb 9, 2026
2edb373
ref: added new method to maby fix issue with missing data
Uhutown Feb 9, 2026
88b87b1
ref: removed debug output; hopefully fix: issues with names and state…
Uhutown Feb 9, 2026
8f75a87
feat: first try for new networking
Uhutown Jan 16, 2026
39d784c
ref: changed networking system for signal box
Uhutown Jan 19, 2026
4002db5
ref: removed unused
Uhutown Jan 19, 2026
d8af6d3
fix: new network issues, ref: better code performance
Uhutown Jan 20, 2026
4e1785b
ref: added tests for network; ref: removed old tests
Uhutown Jan 27, 2026
bde6e1c
ref: better network performance; fix: issues with Pathways
Uhutown Jan 27, 2026
cedebda
ref: removed unused debug
Uhutown Jan 27, 2026
9132fdb
ref: better networking performance
Uhutown Jan 27, 2026
aaa5aba
fix: issues with manuell output
Uhutown Jan 27, 2026
bd888c9
ref: better code performance
Uhutown Jan 27, 2026
b416635
fix: issues with saved pw not removed
Uhutown Feb 3, 2026
043e5e8
fix: no pathway reset when block is destroyed
Uhutown Feb 4, 2026
16047a4
ref: changed SIGNAL IDs to hash of the name
Uhutown Feb 4, 2026
93021fd
ref: changed system, when client animations get updated
Uhutown Feb 4, 2026
8a12f3b
ref: added default entry for better networking and testing
Uhutown Feb 5, 2026
9c0b4c2
fix: issue with presignals not resetting
Uhutown Feb 5, 2026
33b16e6
ref: removed try-catch in Grid
Uhutown Feb 5, 2026
a782404
ref: added null check
Uhutown Feb 5, 2026
4462fc7
ref: better code performance ContainerPlacementtool
Uhutown Feb 5, 2026
acb07f7
ref: removed unnesissary data save
Uhutown Feb 9, 2026
91ce963
fix: problems with not saveing pws
Uhutown Feb 9, 2026
ffb8be2
fix: version specific issues
Uhutown Feb 10, 2026
6cb5697
fix: issues with animation and UI
Uhutown Feb 10, 2026
2f2e3bb
ref: better handling of reset protectionway
Uhutown Feb 10, 2026
e6f5859
fix: issues with null-world and no names & properties
Uhutown Feb 10, 2026
fe6f435
ref: better code performance; fix: issue with client side
Uhutown Feb 10, 2026
5a04e96
fix: no try of next pws when protection way is rested
Uhutown Feb 10, 2026
d16216a
ref: better save of names and states
Uhutown Feb 10, 2026
3e30f14
fix: issues with RS can't be added to saver
Uhutown Feb 14, 2026
c08850f
fix: subsidiary signal not turns off, when changeing to EDITOR mode
Uhutown Feb 19, 2026
57ae961
fix: pathway can't be set with activated subsidiary
Uhutown Feb 19, 2026
8ef4149
ref: added debug
Uhutown Feb 19, 2026
5bf0420
ref: changed Debug
Uhutown Feb 19, 2026
f61531c
ref: added more debug
Uhutown Feb 19, 2026
382f5b4
ref: changed debug output
Uhutown Feb 19, 2026
90c31a3
ref: changed debug
Uhutown Feb 20, 2026
d65308c
ref: added automatic unlink when signals are not equal
Uhutown Feb 20, 2026
66db903
ref: better output; ref: removed debug
Uhutown Feb 20, 2026
6652166
fix: issue with 2 players in signal box
Uhutown Feb 23, 2026
9496c37
fix: protection way was not required when next pathway was present
Uhutown Feb 23, 2026
c5ab80e
ref: added debug
Uhutown Feb 23, 2026
afec5b7
ref: added more debug output
Uhutown Feb 24, 2026
224c926
ref: new debug
Uhutown Feb 24, 2026
5e483cd
ref: changed debug
Uhutown Feb 24, 2026
c98eb59
ref; changed debug
Uhutown Feb 24, 2026
4f738d7
ref: hopefully fixed issue with missing signals
Uhutown Feb 24, 2026
a8bfabc
ref: removed debug
Uhutown Feb 24, 2026
44f3d0e
feat: added config option for blocking of RS path with activated input
Uhutown Feb 26, 2026
9cb2c75
Update mast_lamp
Skywalkervalle Feb 11, 2026
19de0fc
fix Zs8 for Hl-Signalsytem
Skywalkervalle Feb 13, 2026
4d509be
fix upper UV at ks_mast -> now green and not any more transparent
Skywalkervalle Feb 15, 2026
0b1eafc
chore: update version and changelog
Jeronimo97 Mar 3, 2026
5221041
ref: better test performance
Uhutown Mar 5, 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.12.2 - 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.12.2 - 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 @@ -117,11 +117,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(tile.getBlockType(), properties);
if (firstLoad) {
if (loadToFinalState) {
updateToFinalizedAnimations(wrapper);
} else {
updateAnimations(wrapper);
Expand Down Expand Up @@ -169,8 +170,8 @@ public void updateAnimationListFromBlock() {
map.forEach((entry, animations) -> {
final IBakedModel model = SignalCustomModel.getModelFromLocation(
new ResourceLocation(OpenSignalsMain.MODID, entry.getKey()));
final ModelTranslation translation = new ModelTranslation(VectorWrapper.ZERO,
QuaternionWrapper.ONE);
final ModelTranslation translation =
new ModelTranslation(VectorWrapper.ZERO, QuaternionWrapper.ONE);
translation.setModelTranslation(entry.getValue().copy());
final BufferBuilder buffer = getBufferFromModel(model, entry.getValue().copy());
animationPerModel.put(Maps.immutableEntry(model, buffer),
Expand Down
36 changes: 19 additions & 17 deletions src/main/java/com/troblecodings/signals/blocks/Signal.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import com.troblecodings.signals.core.StateInfo;
import com.troblecodings.signals.core.TileEntitySupplierWrapper;
import com.troblecodings.signals.enums.ChangeableStage;
import com.troblecodings.signals.enums.ChangedState;
import com.troblecodings.signals.handler.ClientSignalStateHandler;
import com.troblecodings.signals.handler.NameHandler;
import com.troblecodings.signals.handler.SignalBoxHandler;
Expand Down Expand Up @@ -71,9 +72,9 @@ 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 PropertyEnum<SignalAngel> ANGEL = PropertyEnum.create("angel",
SignalAngel.class);
public static final Map<Integer, Signal> SIGNAL_IDS = new HashMap<>();
public static final PropertyEnum<SignalAngel> ANGEL =
PropertyEnum.create("angel", SignalAngel.class);
public static final SEProperty CUSTOMNAME = new SEProperty("customname", JsonEnum.BOOLEAN,
"false", ChangeableStage.AUTOMATICSTAGE, t -> true, 0);
public static final TileEntitySupplierWrapper SUPPLIER = SignalTileEntity::new;
Expand All @@ -83,11 +84,15 @@ 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(Material.ROCK);
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);
this.setDefaultState(getDefaultState().withProperty(ANGEL, SignalAngel.ANGEL0));
prop.placementtool.addSignal(this);
for (int i = 0; i < signalProperties.size(); i++) {
Expand Down Expand Up @@ -157,8 +162,8 @@ public ItemStack getPickBlock(final IBlockState state, final RayTraceResult targ
public IBlockState getStateForPlacement(final World world, final BlockPos pos,
final EnumFacing facing, final float hitX, final float hitY, final float hitZ,
final int meta, final EntityLivingBase placer, final EnumHand hand) {
final int index = 15
- (MathHelper.floor(placer.getRotationYawHead() * 16.0F / 360.0F - 0.5D) & 15);
final int index =
15 - (MathHelper.floor(placer.getRotationYawHead() * 16.0F / 360.0F - 0.5D) & 15);
return getDefaultState().withProperty(ANGEL, SignalAngel.values()[index]);
}

Expand Down Expand Up @@ -206,6 +211,7 @@ public IBlockState getExtendedState(final IBlockState state, final IBlockAccess
} else {
OpenSignalsMain.getLogger().error("Tried to set invalid SEProperty [" + property
+ "] on [" + this + "]. Rejected!");
OpenSignalsMain.getLogger().error("Properties on [" + pos + "]=" + properties);
}
});
return blockState.get();
Expand Down Expand Up @@ -263,7 +269,7 @@ public void breakBlock(final World worldIn, final BlockPos pos, final IBlockStat
}, block -> block instanceof GhostBlock);
if (!worldIn.isRemote) {
final SignalStateInfo info = new SignalStateInfo(worldIn, pos, this);
SignalStateHandler.sendRemoved(info);
SignalStateHandler.sendRemoved(info, ChangedState.REMOVED_FROM_FILE);
NameHandler.sendRemoved(new StateInfo(worldIn, pos));
new Thread(() -> {
SignalStateHandler.setRemoved(new SignalStateInfo(worldIn, pos, this));
Expand Down Expand Up @@ -502,14 +508,10 @@ public void getUpdate(final World world, final BlockPos pos) {

if (sound.duration == 1) {
world.playSound(null, pos, sound.state, SoundCategory.BLOCKS, 1.0F, 1.0F);
} else {
if (world.isUpdateScheduled(pos, this))
return;
else {
if (sound.predicate.test(properties)) {
world.scheduleUpdate(pos, this, 1);
}
}
} else if (world.isUpdateScheduled(pos, this))
return;
else if (sound.predicate.test(properties)) {
world.scheduleUpdate(pos, this, 1);
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ public void onBlockPlacedBy(final World worldIn, final BlockPos pos, final IBloc
@Override
public void breakBlock(final World worldIn, final BlockPos pos, final IBlockState state) {
if (!worldIn.isRemote) {
((SignalBoxTileEntity) worldIn.getTileEntity(pos)).unlink();
final SignalBoxTileEntity tile = (SignalBoxTileEntity) worldIn.getTileEntity(pos);
tile.unlink();
tile.getSignalBoxGrid().resetAllPathways();
SignalBoxHandler.removeSignalBox(new StateInfo(worldIn, pos));
SignalBoxHandler.onPosRemove(new StateInfo(worldIn, pos));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,13 @@ private ConfigHandler() {
public static int lightEmission = 1;

@Name("canAddRSPathToSaver")
@Comment("ShuntingPaths can be added to PathwaySaver.")
@Comment("ShuntingPaths can be added to PathwaySaver. Default: false")
public static boolean canAddRSPathToSaver = false;

@Name("canInputBlockShuntingPath")
@Comment("Choose wether a blocking input can prevent setting a shunting path. Default: false")
public static boolean canInputBlockShuntingPath = false;

@Name("Signalbox background color")
@Comment("Change the background color of the signalbox gui. Default: -7631989")
public static int signalboxBackgroundColor = 0xFF8B8B8B;
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 @@ -71,9 +73,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 @@ -84,7 +84,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 @@ -43,20 +44,25 @@ private void sendItemProperties(final EntityPlayer 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 @@ -94,16 +100,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.getHeldItemMainhand().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