use of buildcraft.api.gates.IGateExpansion in project BuildCraft by BuildCraft.
the class GatePluggable method writeToNBT.
@Override
public void writeToNBT(NBTTagCompound nbt) {
nbt.setByte(ItemGate.NBT_TAG_MAT, (byte) material.ordinal());
nbt.setByte(ItemGate.NBT_TAG_LOGIC, (byte) logic.ordinal());
NBTTagList expansionsList = nbt.getTagList(ItemGate.NBT_TAG_EX, Constants.NBT.TAG_STRING);
for (IGateExpansion expansion : expansions) {
expansionsList.appendTag(new NBTTagString(expansion.getUniqueIdentifier()));
}
nbt.setTag(ItemGate.NBT_TAG_EX, expansionsList);
}
use of buildcraft.api.gates.IGateExpansion in project BuildCraft by BuildCraft.
the class GatePluggable method writeData.
@Override
public void writeData(ByteBuf buf) {
isLit = realGate != null ? realGate.isGateActive() : false;
isPulsing = realGate != null ? realGate.isGatePulsing() : false;
buf.writeByte(material.ordinal());
buf.writeByte(logic.ordinal());
buf.writeBoolean(isLit);
buf.writeBoolean(isPulsing);
final int expansionsSize = expansions.length;
buf.writeShort(expansionsSize);
for (IGateExpansion expansion : expansions) {
buf.writeShort(GateExpansions.getExpansionID(expansion));
}
}
use of buildcraft.api.gates.IGateExpansion in project BuildCraft by BuildCraft.
the class TileGenericPipe method syncGateExpansions.
private void syncGateExpansions() {
resyncGateExpansions = false;
for (int i = 0; i < EnumFacing.VALUES.length; i++) {
Gate gate = pipe.gates[i];
if (gate == null) {
continue;
}
GatePluggable gatePluggable = (GatePluggable) sideProperties.pluggables[i];
if (gatePluggable.getExpansions().length > 0) {
for (IGateExpansion expansion : gatePluggable.getExpansions()) {
if (expansion != null) {
if (!gate.expansions.containsKey(expansion)) {
gate.addGateExpansion(expansion);
}
} else {
resyncGateExpansions = true;
}
}
}
}
}
Aggregations