Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions src/main/java/mcjty/xnet/apiimpl/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,15 @@ public class Constants {
public static final String TAG_RS_COUNTER = "RSCounter";
public static final String TAG_RS_TIMER = "RSTimer";
public static final String TAG_RS_COUNTING_HOLDER = "RSCountingHolder";
public static final String TAG_RS_COUNTING_CURRENT = "RSCountingCurrent";
public static final String TAG_RS_TICKS_HOLDER = "RSTicksHolder";
public static final String TAG_RS_TICKS_CURRENT = "RSTicksCurrent";
public static final String TAG_IMPULSE = "impulse";
public static final String TAG_IMPULSE_DUR = "impulseDuration";
public static final String TAG_IMPULSE_REM = "impulseRemaining";
public static final String TAG_RS_FLIP_FLAP = "RSFlipFlapState";
public static final String TAG_RS_LAST_INPUT = "RSLastInputTrue";


public static final String TAG_TOOLTIP = "tooltip";
public static final String TAG_WORLDS = "worlds";
Expand Down
14 changes: 14 additions & 0 deletions src/main/java/mcjty/xnet/apiimpl/logic/RSOutput.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,12 @@
import static mcjty.xnet.apiimpl.Constants.TAG_RS_CHANNEL_1;
import static mcjty.xnet.apiimpl.Constants.TAG_RS_CHANNEL_2;
import static mcjty.xnet.apiimpl.Constants.TAG_RS_COUNTER;
import static mcjty.xnet.apiimpl.Constants.TAG_RS_COUNTING_CURRENT;
import static mcjty.xnet.apiimpl.Constants.TAG_RS_COUNTING_HOLDER;
import static mcjty.xnet.apiimpl.Constants.TAG_RS_FILTER;
import static mcjty.xnet.apiimpl.Constants.TAG_RS_FLIP_FLAP;
import static mcjty.xnet.apiimpl.Constants.TAG_RS_LAST_INPUT;
import static mcjty.xnet.apiimpl.Constants.TAG_RS_TICKS_CURRENT;
import static mcjty.xnet.apiimpl.Constants.TAG_RS_TICKS_HOLDER;
import static mcjty.xnet.apiimpl.Constants.TAG_RS_TIMER;
import static mcjty.xnet.utils.I18nConstants.LOGIC_INPUT_CHANNEL_TOOLTIP;
Expand Down Expand Up @@ -199,6 +203,7 @@ public void update(Map<String, Object> data) {
impulse = CastTools.safeBoolean(data.get(TAG_IMPULSE));
impulseDuration = CastTools.safeIntOrValue(data.get(TAG_IMPULSE_DUR), 1);
impulseRemaining = CastTools.safeInt(data.get(TAG_IMPULSE_REM));

}

public boolean isEnabled(String tag) {
Expand All @@ -218,22 +223,31 @@ public void readFromNBT(CompoundTag tag) {
inputChannel1 = Color.values()[tag.getByte(TAG_RS_CHANNEL_1)];
inputChannel2 = Color.values()[tag.getByte(TAG_RS_CHANNEL_2)];
setCountingHolder(tag.getInt(TAG_RS_COUNTING_HOLDER));
setCountingCurrent(tag.getInt(TAG_RS_COUNTING_CURRENT));
setTicksHolder(tag.getInt(TAG_RS_TICKS_HOLDER));
setTicksCurrent(tag.getInt(TAG_RS_TICKS_CURRENT));
redstoneOut = tag.getInt(TAG_REDSTONE_OUT);
impulse = tag.getBoolean(TAG_IMPULSE);
impulseDuration = tag.getInt(TAG_IMPULSE_DUR);
impulseRemaining = tag.getInt(TAG_IMPULSE_REM);
flipFlapState = tag.getBoolean(TAG_RS_FLIP_FLAP);
lastInputTrue = tag.getBoolean(TAG_RS_LAST_INPUT);

}

public void writeToNBT(CompoundTag tag) {
tag.putByte(TAG_RS_FILTER, (byte) logicFilter.ordinal());
tag.putByte(TAG_RS_CHANNEL_1, (byte) inputChannel1.ordinal());
tag.putByte(TAG_RS_CHANNEL_2, (byte) inputChannel2.ordinal());
tag.putInt(TAG_RS_COUNTING_HOLDER, countingHolder);
tag.putInt(TAG_RS_COUNTING_CURRENT, countingCurrent);
tag.putInt(TAG_RS_TICKS_HOLDER, ticksHolder);
tag.putInt(TAG_RS_TICKS_CURRENT, ticksCurrent);
tag.putInt(TAG_REDSTONE_OUT, redstoneOut);
tag.putBoolean(TAG_IMPULSE, impulse);
tag.putInt(TAG_IMPULSE_DUR, impulseDuration);
tag.putInt(TAG_IMPULSE_REM, impulseRemaining);
tag.putBoolean(TAG_RS_FLIP_FLAP, flipFlapState);
tag.putBoolean(TAG_RS_LAST_INPUT, lastInputTrue);
}
}