started work on better pipe signal actions, for #1877

This commit is contained in:
SpaceToad 2014-06-15 00:19:30 +02:00
parent 31cc8b6438
commit 40268062db
4 changed files with 26 additions and 7 deletions

View file

@ -288,7 +288,12 @@ public class ClassMapping extends ClassSerializer {
}
for (Field f : enumFields) {
data.writeByte(((Enum) f.get(obj)).ordinal());
if (f.get(obj) == null) {
data.writeBoolean(false);
} else {
data.writeBoolean(true);
data.writeByte(((Enum) f.get(obj)).ordinal());
}
}
for (Field f : floatFields) {
@ -358,7 +363,9 @@ public class ClassMapping extends ClassSerializer {
}
for (Field f : enumFields) {
f.set(obj, ((Class) f.getGenericType()).getEnumConstants()[data.readByte()]);
if (data.readBoolean()) {
f.set(obj, ((Class) f.getGenericType()).getEnumConstants()[data.readByte()]);
}
}
for (Field f : floatFields) {

View file

@ -73,7 +73,7 @@ public abstract class BCStatement implements IStatement {
}
@Override
public final ITriggerParameter createParameter(int index) {
public ITriggerParameter createParameter(int index) {
return new TriggerParameter();
}

View file

@ -22,10 +22,18 @@ import buildcraft.core.triggers.StatementIconProvider;
public class TriggerParameterSignal implements ITriggerParameter {
@NetworkData
boolean active;
private boolean active;
@NetworkData
PipeWire color;
private PipeWire color = PipeWire.RED;
public TriggerParameterSignal() {
}
public TriggerParameterSignal(TriggerPipeSignal trigger) {
}
@Override
public ItemStack getItemStackToDraw() {
@ -87,6 +95,4 @@ public class TriggerParameterSignal implements ITriggerParameter {
@Override
public void readFromNBT(NBTTagCompound compound) {
}
}

View file

@ -76,6 +76,7 @@ public class TriggerPipeSignal extends BCTrigger {
return StatementIconProvider.Trigger_PipeSignal_Yellow_Inactive;
}
}
return -1;
}
@ -83,4 +84,9 @@ public class TriggerPipeSignal extends BCTrigger {
public ITrigger rotateLeft() {
return this;
}
@Override
public ITriggerParameter createParameter(int index) {
return new TriggerParameterSignal(this);
}
}