Added a color code to the memory card. (#3609)

Can be used to encode the stored content as a 4x2 grid of AEColors
Currently used to indicate the P2P frequency.
This commit is contained in:
yueh
2018-07-14 19:42:56 +02:00
committed by GitHub
parent 2891014cf6
commit fe4db2eb98
17 changed files with 462 additions and 77 deletions
@@ -45,6 +45,7 @@ import appeng.api.parts.IPartCollisionHelper;
import appeng.api.parts.IPartItem;
import appeng.api.parts.PartItemStack;
import appeng.api.util.AECableType;
import appeng.api.util.AEColor;
import appeng.api.util.AEPartLocation;
import appeng.core.AEConfig;
import appeng.me.GridAccessException;
@@ -363,6 +364,14 @@ public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicSt
p2pItem.writeToNBT( data );
data.setShort( "freq", this.getFrequency() );
final AEColor[] colors = Platform.p2p().toColors( this.getFrequency() );
final int[] colorCode = new int[] {
colors[0].ordinal(), colors[0].ordinal(), colors[1].ordinal(), colors[1].ordinal(),
colors[2].ordinal(), colors[2].ordinal(), colors[3].ordinal(), colors[3].ordinal(),
};
data.setIntArray( "colorCode", colorCode );
mc.setMemoryCardContents( is, type + ".name", data );
mc.notifyUser( player, MemoryCardMessages.SETTINGS_SAVED );
return true;