mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-26 15:03:07 +00:00
Merge branch 'master' into 1.6.4
This commit is contained in:
commit
85c45f7fb9
22 files changed
+200
-178
No files matched your search
@@ -22,8 +22,8 @@ import crazypants.enderio.conduit.liquid.ILiquidConduit;
|
||||
import crazypants.enderio.conduit.power.IPowerConduit;
|
||||
import crazypants.enderio.conduit.redstone.IInsulatedRedstoneConduit;
|
||||
import crazypants.enderio.conduit.redstone.IRedstoneConduit;
|
||||
import crazypants.enderio.conduit.redstone.SignalColor;
|
||||
import crazypants.enderio.machine.RedstoneControlMode;
|
||||
import crazypants.util.DyeColor;
|
||||
|
||||
public class ConduitPacketHandler implements IPacketProcessor {
|
||||
|
||||
@@ -80,7 +80,7 @@ public class ConduitPacketHandler implements IPacketProcessor {
|
||||
}
|
||||
}
|
||||
|
||||
public static Packet createItemChannelPacket(IItemConduit itemConduit, ForgeDirection dir, SignalColor col, boolean input) {
|
||||
public static Packet createItemChannelPacket(IItemConduit itemConduit, ForgeDirection dir, DyeColor col, boolean input) {
|
||||
ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
||||
DataOutputStream dos = new DataOutputStream(bos);
|
||||
IConduitBundle bundle = itemConduit.getBundle();
|
||||
@@ -121,7 +121,7 @@ public class ConduitPacketHandler implements IPacketProcessor {
|
||||
return;
|
||||
}
|
||||
|
||||
SignalColor col = SignalColor.values()[data.readShort()];
|
||||
DyeColor col = DyeColor.values()[data.readShort()];
|
||||
boolean isInput = data.readBoolean();
|
||||
if(isInput) {
|
||||
con.setInputColor(dir, col);
|
||||
@@ -319,7 +319,7 @@ public class ConduitPacketHandler implements IPacketProcessor {
|
||||
|
||||
}
|
||||
|
||||
public static Packet createSignalColorPacket(IConduit conduit, ForgeDirection dir, SignalColor color) {
|
||||
public static Packet createSignalColorPacket(IConduit conduit, ForgeDirection dir, DyeColor color) {
|
||||
ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
||||
DataOutputStream dos = new DataOutputStream(bos);
|
||||
try {
|
||||
@@ -356,7 +356,7 @@ public class ConduitPacketHandler implements IPacketProcessor {
|
||||
return;
|
||||
}
|
||||
ForgeDirection dir = ForgeDirection.values()[data.readShort()];
|
||||
SignalColor col = SignalColor.values()[data.readShort()];
|
||||
DyeColor col = DyeColor.values()[data.readShort()];
|
||||
|
||||
ConTypeEnum type = ConTypeEnum.values()[data.readShort()];
|
||||
IConduit con = conBun.getConduit(type.baseType);
|
||||
|
||||
@@ -33,9 +33,9 @@ import crazypants.enderio.conduit.redstone.IInsulatedRedstoneConduit;
|
||||
import crazypants.enderio.conduit.redstone.IRedstoneConduit;
|
||||
import crazypants.enderio.conduit.redstone.RedstoneConduitNetwork;
|
||||
import crazypants.enderio.conduit.redstone.Signal;
|
||||
import crazypants.enderio.conduit.redstone.SignalColor;
|
||||
import crazypants.enderio.machine.RedstoneControlMode;
|
||||
import crazypants.util.BlockCoord;
|
||||
import crazypants.util.DyeColor;
|
||||
|
||||
public class ConduitUtil {
|
||||
|
||||
@@ -301,7 +301,7 @@ public class ConduitUtil {
|
||||
|
||||
}
|
||||
|
||||
public static boolean isRedstoneControlModeMet(IConduitBundle bundle, RedstoneControlMode mode, SignalColor col) {
|
||||
public static boolean isRedstoneControlModeMet(IConduitBundle bundle, RedstoneControlMode mode, DyeColor col) {
|
||||
|
||||
if(mode == RedstoneControlMode.IGNORE) {
|
||||
return true;
|
||||
@@ -310,7 +310,7 @@ public class ConduitUtil {
|
||||
}
|
||||
|
||||
int signalStrength = getInternalSignalForColor(bundle, col);
|
||||
if(signalStrength < 15 && SignalColor.RED == col && bundle != null && bundle.getEntity() != null) {
|
||||
if(signalStrength < 15 && DyeColor.RED == col && bundle != null && bundle.getEntity() != null) {
|
||||
TileEntity te = bundle.getEntity();
|
||||
signalStrength = Math.max(signalStrength, te.worldObj.getStrongestIndirectPower(te.xCoord, te.yCoord, te.zCoord));
|
||||
}
|
||||
@@ -318,7 +318,7 @@ public class ConduitUtil {
|
||||
}
|
||||
|
||||
|
||||
public static int getInternalSignalForColor(IConduitBundle bundle, SignalColor col) {
|
||||
public static int getInternalSignalForColor(IConduitBundle bundle, DyeColor col) {
|
||||
int signalStrength = 0;
|
||||
IRedstoneConduit rsCon = bundle.getConduit(IRedstoneConduit.class);
|
||||
if(rsCon != null) {
|
||||
|
||||
@@ -12,7 +12,6 @@ import crazypants.enderio.conduit.ConnectionMode;
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
import crazypants.enderio.conduit.item.IItemConduit;
|
||||
import crazypants.enderio.conduit.item.ItemFilter;
|
||||
import crazypants.enderio.conduit.redstone.SignalColor;
|
||||
import crazypants.enderio.gui.ColorButton;
|
||||
import crazypants.enderio.gui.IconButtonEIO;
|
||||
import crazypants.enderio.gui.IconEIO;
|
||||
@@ -22,6 +21,7 @@ import crazypants.enderio.machine.IRedstoneModeControlable;
|
||||
import crazypants.enderio.machine.RedstoneControlMode;
|
||||
import crazypants.render.ColorUtil;
|
||||
import crazypants.render.RenderUtil;
|
||||
import crazypants.util.DyeColor;
|
||||
|
||||
public class ItemSettings extends BaseSettingsPanel {
|
||||
|
||||
@@ -99,7 +99,7 @@ public class ItemSettings extends BaseSettingsPanel {
|
||||
x += rsB.getWidth() + gap;
|
||||
colorB = new ColorButton(gui, ID_COLOR_BUTTON, x, y);
|
||||
colorB.setColorIndex(itemConduit.getExtractionSignalColor(gui.dir).ordinal());
|
||||
colorB.setToolTipPrefix("Signal Color");
|
||||
colorB.setToolTipHeading("Signal Color");
|
||||
|
||||
x = 112;
|
||||
y = 66;
|
||||
@@ -123,7 +123,7 @@ public class ItemSettings extends BaseSettingsPanel {
|
||||
|
||||
channelB = new ColorButton(gui, ID_CHANNEL, x, y);
|
||||
channelB.setColorIndex(0);
|
||||
channelB.setToolTipPrefix("Channel");
|
||||
channelB.setToolTipHeading("Channel");
|
||||
|
||||
x += 20;
|
||||
useNbtB = new ToggleButtonEIO(gui, ID_NBT, x, y, IconEIO.FILTER_NBT_OFF, IconEIO.FILTER_NBT);
|
||||
@@ -296,7 +296,7 @@ public class ItemSettings extends BaseSettingsPanel {
|
||||
activeFilter.setBlacklist(!activeFilter.isBlacklist());
|
||||
sendFilterChange();
|
||||
} else if(guiButton.id == ID_COLOR_BUTTON) {
|
||||
Packet pkt = ConduitPacketHandler.createSignalColorPacket(itemConduit, gui.dir, SignalColor.values()[colorB.getColorIndex()]);
|
||||
Packet pkt = ConduitPacketHandler.createSignalColorPacket(itemConduit, gui.dir, DyeColor.values()[colorB.getColorIndex()]);
|
||||
PacketDispatcher.sendPacketToServer(pkt);
|
||||
} else if(guiButton.id == ID_LOOP) {
|
||||
itemConduit.setSelfFeedEnabled(gui.dir, !itemConduit.isSelfFeedEnabled(gui.dir));
|
||||
@@ -309,14 +309,14 @@ public class ItemSettings extends BaseSettingsPanel {
|
||||
mode = inOutShowIn ? ConnectionMode.INPUT : ConnectionMode.OUTPUT;
|
||||
}
|
||||
|
||||
SignalColor col = SignalColor.values()[channelB.getColorIndex()];
|
||||
DyeColor col = DyeColor.values()[channelB.getColorIndex()];
|
||||
boolean input;
|
||||
if(mode == ConnectionMode.INPUT) {
|
||||
col = SignalColor.values()[channelB.getColorIndex()];
|
||||
col = DyeColor.values()[channelB.getColorIndex()];
|
||||
itemConduit.setInputColor(gui.dir, col);
|
||||
input = true;
|
||||
} else if(mode == ConnectionMode.OUTPUT) {
|
||||
itemConduit.setOutputColor(gui.dir, SignalColor.values()[channelB.getColorIndex()]);
|
||||
itemConduit.setOutputColor(gui.dir, DyeColor.values()[channelB.getColorIndex()]);
|
||||
input = false;
|
||||
} else {
|
||||
return;
|
||||
|
||||
@@ -10,13 +10,13 @@ import crazypants.enderio.conduit.ConduitPacketHandler;
|
||||
import crazypants.enderio.conduit.ConnectionMode;
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
import crazypants.enderio.conduit.liquid.ILiquidConduit;
|
||||
import crazypants.enderio.conduit.redstone.SignalColor;
|
||||
import crazypants.enderio.gui.ColorButton;
|
||||
import crazypants.enderio.gui.IconEIO;
|
||||
import crazypants.enderio.gui.RedstoneModeButton;
|
||||
import crazypants.enderio.machine.IRedstoneModeControlable;
|
||||
import crazypants.enderio.machine.RedstoneControlMode;
|
||||
import crazypants.render.ColorUtil;
|
||||
import crazypants.util.DyeColor;
|
||||
|
||||
public class LiquidSettings extends BaseSettingsPanel {
|
||||
|
||||
@@ -68,7 +68,7 @@ public class LiquidSettings extends BaseSettingsPanel {
|
||||
public void actionPerformed(GuiButton guiButton) {
|
||||
super.actionPerformed(guiButton);
|
||||
if(guiButton.id == ID_COLOR_BUTTON) {
|
||||
Packet pkt = ConduitPacketHandler.createSignalColorPacket(conduit, gui.dir, SignalColor.values()[colorB.getColorIndex()]);
|
||||
Packet pkt = ConduitPacketHandler.createSignalColorPacket(conduit, gui.dir, DyeColor.values()[colorB.getColorIndex()]);
|
||||
PacketDispatcher.sendPacketToServer(pkt);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,10 +9,10 @@ import crazypants.enderio.ModObject;
|
||||
import crazypants.enderio.conduit.ConduitPacketHandler;
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
import crazypants.enderio.conduit.redstone.IInsulatedRedstoneConduit;
|
||||
import crazypants.enderio.conduit.redstone.SignalColor;
|
||||
import crazypants.enderio.gui.ColorButton;
|
||||
import crazypants.enderio.gui.IconEIO;
|
||||
import crazypants.render.ColorUtil;
|
||||
import crazypants.util.DyeColor;
|
||||
|
||||
public class RedstoneSettings extends BaseSettingsPanel {
|
||||
|
||||
@@ -28,9 +28,10 @@ public class RedstoneSettings extends BaseSettingsPanel {
|
||||
int x = gap + gui.getFontRenderer().getStringWidth(signalColorStr) + gap + 2;
|
||||
int y = customTop;
|
||||
cb = new ColorButton(gui, ID_COLOR_BUTTON, x, y);
|
||||
cb.setToolTipHeading("Signal Color");
|
||||
if(con instanceof IInsulatedRedstoneConduit) {
|
||||
insCon = (IInsulatedRedstoneConduit) con;
|
||||
SignalColor sigCol = insCon.getSignalColor(gui.dir);
|
||||
DyeColor sigCol = insCon.getSignalColor(gui.dir);
|
||||
cb.setColorIndex(sigCol.ordinal());
|
||||
}
|
||||
}
|
||||
@@ -39,7 +40,7 @@ public class RedstoneSettings extends BaseSettingsPanel {
|
||||
public void actionPerformed(GuiButton guiButton) {
|
||||
super.actionPerformed(guiButton);
|
||||
if(guiButton.id == ID_COLOR_BUTTON) {
|
||||
Packet pkt = ConduitPacketHandler.createSignalColorPacket(insCon, gui.dir, SignalColor.values()[cb.getColorIndex()]);
|
||||
Packet pkt = ConduitPacketHandler.createSignalColorPacket(insCon, gui.dir, DyeColor.values()[cb.getColorIndex()]);
|
||||
PacketDispatcher.sendPacketToServer(pkt);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,8 +4,8 @@ import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
import crazypants.enderio.conduit.redstone.SignalColor;
|
||||
import crazypants.enderio.machine.RedstoneControlMode;
|
||||
import crazypants.util.DyeColor;
|
||||
|
||||
public interface IItemConduit extends IConduit, cofh.api.transport.IItemConduit {
|
||||
|
||||
@@ -41,9 +41,9 @@ public interface IItemConduit extends IConduit, cofh.api.transport.IItemConduit
|
||||
|
||||
RedstoneControlMode getExtractioRedstoneMode(ForgeDirection dir);
|
||||
|
||||
void setExtractionSignalColor(ForgeDirection dir, SignalColor col);
|
||||
void setExtractionSignalColor(ForgeDirection dir, DyeColor col);
|
||||
|
||||
SignalColor getExtractionSignalColor(ForgeDirection dir);
|
||||
DyeColor getExtractionSignalColor(ForgeDirection dir);
|
||||
|
||||
boolean isExtractionRedstoneConditionMet(ForgeDirection dir);
|
||||
|
||||
@@ -51,12 +51,12 @@ public interface IItemConduit extends IConduit, cofh.api.transport.IItemConduit
|
||||
|
||||
void setSelfFeedEnabled(ForgeDirection dir, boolean enabled);
|
||||
|
||||
SignalColor getInputColor(ForgeDirection dir);
|
||||
DyeColor getInputColor(ForgeDirection dir);
|
||||
|
||||
SignalColor getOutputColor(ForgeDirection dir);
|
||||
DyeColor getOutputColor(ForgeDirection dir);
|
||||
|
||||
void setInputColor(ForgeDirection dir, SignalColor col);
|
||||
void setInputColor(ForgeDirection dir, DyeColor col);
|
||||
|
||||
void setOutputColor(ForgeDirection dir, SignalColor col);
|
||||
void setOutputColor(ForgeDirection dir, DyeColor col);
|
||||
|
||||
}
|
||||
@@ -24,10 +24,10 @@ import crazypants.enderio.conduit.IConduit;
|
||||
import crazypants.enderio.conduit.IConduitBundle;
|
||||
import crazypants.enderio.conduit.RaytraceResult;
|
||||
import crazypants.enderio.conduit.geom.CollidableComponent;
|
||||
import crazypants.enderio.conduit.redstone.SignalColor;
|
||||
import crazypants.enderio.machine.RedstoneControlMode;
|
||||
import crazypants.render.IconUtil;
|
||||
import crazypants.util.BlockCoord;
|
||||
import crazypants.util.DyeColor;
|
||||
|
||||
public class ItemConduit extends AbstractConduit implements IItemConduit {
|
||||
|
||||
@@ -83,15 +83,15 @@ public class ItemConduit extends AbstractConduit implements IItemConduit {
|
||||
float extractRatePerTick = maxExtractedOnTick / 20f;
|
||||
|
||||
protected final EnumMap<ForgeDirection, RedstoneControlMode> extractionModes = new EnumMap<ForgeDirection, RedstoneControlMode>(ForgeDirection.class);
|
||||
protected final EnumMap<ForgeDirection, SignalColor> extractionColors = new EnumMap<ForgeDirection, SignalColor>(ForgeDirection.class);
|
||||
protected final EnumMap<ForgeDirection, DyeColor> extractionColors = new EnumMap<ForgeDirection, DyeColor>(ForgeDirection.class);
|
||||
|
||||
protected final EnumMap<ForgeDirection, ItemFilter> outputFilters = new EnumMap<ForgeDirection, ItemFilter>(ForgeDirection.class);
|
||||
protected final EnumMap<ForgeDirection, ItemFilter> inputFilters = new EnumMap<ForgeDirection, ItemFilter>(ForgeDirection.class);
|
||||
|
||||
protected final EnumMap<ForgeDirection, Boolean> selfFeed = new EnumMap<ForgeDirection, Boolean>(ForgeDirection.class);
|
||||
|
||||
protected final EnumMap<ForgeDirection, SignalColor> outputColors = new EnumMap<ForgeDirection, SignalColor>(ForgeDirection.class);
|
||||
protected final EnumMap<ForgeDirection, SignalColor> inputColors = new EnumMap<ForgeDirection, SignalColor>(ForgeDirection.class);
|
||||
protected final EnumMap<ForgeDirection, DyeColor> outputColors = new EnumMap<ForgeDirection, DyeColor>(ForgeDirection.class);
|
||||
protected final EnumMap<ForgeDirection, DyeColor> inputColors = new EnumMap<ForgeDirection, DyeColor>(ForgeDirection.class);
|
||||
|
||||
private int metaData;
|
||||
|
||||
@@ -213,15 +213,15 @@ public class ItemConduit extends AbstractConduit implements IItemConduit {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setExtractionSignalColor(ForgeDirection dir, SignalColor col) {
|
||||
public void setExtractionSignalColor(ForgeDirection dir, DyeColor col) {
|
||||
extractionColors.put(dir, col);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SignalColor getExtractionSignalColor(ForgeDirection dir) {
|
||||
SignalColor result = extractionColors.get(dir);
|
||||
public DyeColor getExtractionSignalColor(ForgeDirection dir) {
|
||||
DyeColor result = extractionColors.get(dir);
|
||||
if(result == null) {
|
||||
return SignalColor.RED;
|
||||
return DyeColor.RED;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -236,25 +236,25 @@ public class ItemConduit extends AbstractConduit implements IItemConduit {
|
||||
}
|
||||
|
||||
@Override
|
||||
public SignalColor getInputColor(ForgeDirection dir) {
|
||||
SignalColor result = inputColors.get(dir);
|
||||
public DyeColor getInputColor(ForgeDirection dir) {
|
||||
DyeColor result = inputColors.get(dir);
|
||||
if(result == null) {
|
||||
return SignalColor.GREEN;
|
||||
return DyeColor.GREEN;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SignalColor getOutputColor(ForgeDirection dir) {
|
||||
SignalColor result = outputColors.get(dir);
|
||||
public DyeColor getOutputColor(ForgeDirection dir) {
|
||||
DyeColor result = outputColors.get(dir);
|
||||
if(result == null) {
|
||||
return SignalColor.GREEN;
|
||||
return DyeColor.GREEN;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInputColor(ForgeDirection dir, SignalColor col) {
|
||||
public void setInputColor(ForgeDirection dir, DyeColor col) {
|
||||
inputColors.put(dir, col);
|
||||
if(network != null) {
|
||||
network.routesChanged();
|
||||
@@ -264,7 +264,7 @@ public class ItemConduit extends AbstractConduit implements IItemConduit {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOutputColor(ForgeDirection dir, SignalColor col) {
|
||||
public void setOutputColor(ForgeDirection dir, DyeColor col) {
|
||||
outputColors.put(dir, col);
|
||||
if(network != null) {
|
||||
network.routesChanged();
|
||||
@@ -461,7 +461,7 @@ public class ItemConduit extends AbstractConduit implements IItemConduit {
|
||||
}
|
||||
}
|
||||
|
||||
for (Entry<ForgeDirection, SignalColor> entry : extractionColors.entrySet()) {
|
||||
for (Entry<ForgeDirection, DyeColor> entry : extractionColors.entrySet()) {
|
||||
if(entry.getValue() != null) {
|
||||
short ord = (short) entry.getValue().ordinal();
|
||||
nbtRoot.setShort("extSC." + entry.getKey().name(), ord);
|
||||
@@ -474,14 +474,14 @@ public class ItemConduit extends AbstractConduit implements IItemConduit {
|
||||
}
|
||||
}
|
||||
|
||||
for (Entry<ForgeDirection, SignalColor> entry : inputColors.entrySet()) {
|
||||
for (Entry<ForgeDirection, DyeColor> entry : inputColors.entrySet()) {
|
||||
if(entry.getValue() != null) {
|
||||
short ord = (short) entry.getValue().ordinal();
|
||||
nbtRoot.setShort("inSC." + entry.getKey().name(), ord);
|
||||
}
|
||||
}
|
||||
|
||||
for (Entry<ForgeDirection, SignalColor> entry : outputColors.entrySet()) {
|
||||
for (Entry<ForgeDirection, DyeColor> entry : outputColors.entrySet()) {
|
||||
if(entry.getValue() != null) {
|
||||
short ord = (short) entry.getValue().ordinal();
|
||||
nbtRoot.setShort("outSC." + entry.getKey().name(), ord);
|
||||
@@ -522,8 +522,8 @@ public class ItemConduit extends AbstractConduit implements IItemConduit {
|
||||
key = "extSC." + dir.name();
|
||||
if(nbtRoot.hasKey(key)) {
|
||||
short ord = nbtRoot.getShort(key);
|
||||
if(ord >= 0 && ord < SignalColor.values().length) {
|
||||
extractionColors.put(dir, SignalColor.values()[ord]);
|
||||
if(ord >= 0 && ord < DyeColor.values().length) {
|
||||
extractionColors.put(dir, DyeColor.values()[ord]);
|
||||
}
|
||||
}
|
||||
key = "selfFeed." + dir.name();
|
||||
@@ -535,16 +535,16 @@ public class ItemConduit extends AbstractConduit implements IItemConduit {
|
||||
key = "inSC." + dir.name();
|
||||
if(nbtRoot.hasKey(key)) {
|
||||
short ord = nbtRoot.getShort(key);
|
||||
if(ord >= 0 && ord < SignalColor.values().length) {
|
||||
inputColors.put(dir, SignalColor.values()[ord]);
|
||||
if(ord >= 0 && ord < DyeColor.values().length) {
|
||||
inputColors.put(dir, DyeColor.values()[ord]);
|
||||
}
|
||||
}
|
||||
|
||||
key = "outSC." + dir.name();
|
||||
if(nbtRoot.hasKey(key)) {
|
||||
short ord = nbtRoot.getShort(key);
|
||||
if(ord >= 0 && ord < SignalColor.values().length) {
|
||||
outputColors.put(dir, SignalColor.values()[ord]);
|
||||
if(ord >= 0 && ord < DyeColor.values().length) {
|
||||
outputColors.put(dir, DyeColor.values()[ord]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,9 +8,9 @@ import crazypants.enderio.conduit.IConduit;
|
||||
import crazypants.enderio.conduit.IConduitBundle;
|
||||
import crazypants.enderio.conduit.geom.ConnectionModeGeometry;
|
||||
import crazypants.enderio.conduit.geom.Offset;
|
||||
import crazypants.enderio.conduit.redstone.SignalColor;
|
||||
import crazypants.enderio.conduit.render.ConduitBundleRenderer;
|
||||
import crazypants.enderio.conduit.render.DefaultConduitRenderer;
|
||||
import crazypants.util.DyeColor;
|
||||
|
||||
public class ItemConduitRenderer extends DefaultConduitRenderer {
|
||||
|
||||
@@ -29,8 +29,8 @@ public class ItemConduitRenderer extends DefaultConduitRenderer {
|
||||
|
||||
IItemConduit pc = (IItemConduit) conduit;
|
||||
for (ForgeDirection dir : conduit.getExternalConnections()) {
|
||||
SignalColor inChannel = null;
|
||||
SignalColor outChannel = null;
|
||||
DyeColor inChannel = null;
|
||||
DyeColor outChannel = null;
|
||||
Icon inTex = null;
|
||||
Icon outTex = null;
|
||||
boolean render = true;
|
||||
|
||||
@@ -5,8 +5,8 @@ import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
import crazypants.enderio.conduit.redstone.SignalColor;
|
||||
import crazypants.enderio.machine.RedstoneControlMode;
|
||||
import crazypants.util.DyeColor;
|
||||
|
||||
public interface ILiquidConduit extends IConduit, IFluidHandler {
|
||||
|
||||
@@ -36,9 +36,9 @@ public interface ILiquidConduit extends IConduit, IFluidHandler {
|
||||
|
||||
RedstoneControlMode getExtractioRedstoneMode(ForgeDirection dir);
|
||||
|
||||
void setExtractionSignalColor(ForgeDirection dir, SignalColor col);
|
||||
void setExtractionSignalColor(ForgeDirection dir, DyeColor col);
|
||||
|
||||
SignalColor getExtractionSignalColor(ForgeDirection dir);
|
||||
DyeColor getExtractionSignalColor(ForgeDirection dir);
|
||||
|
||||
int fill(ForgeDirection from, FluidStack resource, boolean doFill, boolean doPush, int pushToken);
|
||||
|
||||
|
||||
@@ -37,11 +37,11 @@ import crazypants.enderio.conduit.IConduit;
|
||||
import crazypants.enderio.conduit.IConduitBundle;
|
||||
import crazypants.enderio.conduit.RaytraceResult;
|
||||
import crazypants.enderio.conduit.geom.CollidableComponent;
|
||||
import crazypants.enderio.conduit.redstone.SignalColor;
|
||||
import crazypants.enderio.machine.RedstoneControlMode;
|
||||
import crazypants.enderio.machine.reservoir.TileReservoir;
|
||||
import crazypants.render.IconUtil;
|
||||
import crazypants.util.BlockCoord;
|
||||
import crazypants.util.DyeColor;
|
||||
|
||||
public class LiquidConduit extends AbstractConduit implements ILiquidConduit {
|
||||
|
||||
@@ -92,7 +92,7 @@ public class LiquidConduit extends AbstractConduit implements ILiquidConduit {
|
||||
private final Set<BlockCoord> filledFromThisTick = new HashSet<BlockCoord>();
|
||||
|
||||
protected final EnumMap<ForgeDirection, RedstoneControlMode> extractionModes = new EnumMap<ForgeDirection, RedstoneControlMode>(ForgeDirection.class);
|
||||
protected final EnumMap<ForgeDirection, SignalColor> extractionColors = new EnumMap<ForgeDirection, SignalColor>(ForgeDirection.class);
|
||||
protected final EnumMap<ForgeDirection, DyeColor> extractionColors = new EnumMap<ForgeDirection, DyeColor>(ForgeDirection.class);
|
||||
|
||||
private final Map<ForgeDirection, Integer> externalRedstoneSignals = new HashMap<ForgeDirection, Integer>();
|
||||
private boolean redstoneStateDirty = true;
|
||||
@@ -220,15 +220,15 @@ public class LiquidConduit extends AbstractConduit implements ILiquidConduit {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setExtractionSignalColor(ForgeDirection dir, SignalColor col) {
|
||||
public void setExtractionSignalColor(ForgeDirection dir, DyeColor col) {
|
||||
extractionColors.put(dir, col);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SignalColor getExtractionSignalColor(ForgeDirection dir) {
|
||||
SignalColor result = extractionColors.get(dir);
|
||||
public DyeColor getExtractionSignalColor(ForgeDirection dir) {
|
||||
DyeColor result = extractionColors.get(dir);
|
||||
if(result == null) {
|
||||
return SignalColor.RED;
|
||||
return DyeColor.RED;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -287,14 +287,14 @@ public class LiquidConduit extends AbstractConduit implements ILiquidConduit {
|
||||
redstoneStateDirty = false;
|
||||
}
|
||||
|
||||
SignalColor col = getExtractionSignalColor(dir);
|
||||
DyeColor col = getExtractionSignalColor(dir);
|
||||
int signal = ConduitUtil.getInternalSignalForColor(getBundle(), col);
|
||||
if(mode.isConditionMet(mode, signal)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
int externalSignal = 0;
|
||||
if(col == SignalColor.RED) {
|
||||
if(col == DyeColor.RED) {
|
||||
Integer val = externalRedstoneSignals.get(dir);
|
||||
if(val == null) {
|
||||
TileEntity te = getBundle().getEntity();
|
||||
@@ -541,7 +541,7 @@ public class LiquidConduit extends AbstractConduit implements ILiquidConduit {
|
||||
}
|
||||
}
|
||||
|
||||
for (Entry<ForgeDirection, SignalColor> entry : extractionColors.entrySet()) {
|
||||
for (Entry<ForgeDirection, DyeColor> entry : extractionColors.entrySet()) {
|
||||
if(entry.getValue() != null) {
|
||||
short ord = (short) entry.getValue().ordinal();
|
||||
nbtRoot.setShort("extSC." + entry.getKey().name(), ord);
|
||||
@@ -568,8 +568,8 @@ public class LiquidConduit extends AbstractConduit implements ILiquidConduit {
|
||||
key = "extSC." + dir.name();
|
||||
if(nbtRoot.hasKey(key)) {
|
||||
short ord = nbtRoot.getShort(key);
|
||||
if(ord >= 0 && ord < SignalColor.values().length) {
|
||||
extractionColors.put(dir, SignalColor.values()[ord]);
|
||||
if(ord >= 0 && ord < DyeColor.values().length) {
|
||||
extractionColors.put(dir, DyeColor.values()[ord]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package crazypants.enderio.conduit.redstone;
|
||||
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import crazypants.enderio.conduit.ConnectionMode;
|
||||
import crazypants.util.DyeColor;
|
||||
|
||||
public interface IInsulatedRedstoneConduit extends IRedstoneConduit {
|
||||
|
||||
@@ -18,6 +19,6 @@ public interface IInsulatedRedstoneConduit extends IRedstoneConduit {
|
||||
|
||||
public void forceConnectionMode(ForgeDirection dir, ConnectionMode mode);
|
||||
|
||||
void setSignalColor(ForgeDirection dir, SignalColor col);
|
||||
void setSignalColor(ForgeDirection dir, DyeColor col);
|
||||
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import java.util.Set;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
import crazypants.util.DyeColor;
|
||||
|
||||
public interface IRedstoneConduit extends IConduit {
|
||||
|
||||
@@ -13,25 +14,6 @@ public interface IRedstoneConduit extends IConduit {
|
||||
public static final String KEY_CORE_OFF_ICON = "enderio:redstoneConduitCoreOff";
|
||||
public static final String KEY_CORE_ON_ICON = "enderio:redstoneConduitCoreOn";
|
||||
|
||||
public static final String[] DYE_ORE_NAMES = {
|
||||
"dyeBlack",
|
||||
"dyeRed",
|
||||
"dyeGreen",
|
||||
"dyeBrown",
|
||||
"dyeBlue",
|
||||
"dyePurple",
|
||||
"dyeCyan",
|
||||
"dyeLightGray",
|
||||
"dyeGray",
|
||||
"dyePink",
|
||||
"dyeLime",
|
||||
"dyeYellow",
|
||||
"dyeLightBlue",
|
||||
"dyeMagenta",
|
||||
"dyeOrange",
|
||||
"dyeWhite"
|
||||
};
|
||||
|
||||
// External redstone interface
|
||||
|
||||
int isProvidingStrongPower(ForgeDirection toDirection);
|
||||
@@ -44,7 +26,7 @@ public interface IRedstoneConduit extends IConduit {
|
||||
|
||||
Set<Signal> getNetworkOutputs(ForgeDirection side);
|
||||
|
||||
SignalColor getSignalColor(ForgeDirection dir);
|
||||
DyeColor getSignalColor(ForgeDirection dir);
|
||||
|
||||
void updateNetwork();
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import powercrystals.minefactoryreloaded.api.rednet.IConnectableRedNet;
|
||||
import powercrystals.minefactoryreloaded.api.rednet.IRedNetNoConnection;
|
||||
import powercrystals.minefactoryreloaded.api.rednet.RedNetConnectionType;
|
||||
@@ -39,6 +38,7 @@ import crazypants.enderio.conduit.geom.ConduitGeometryUtil;
|
||||
import crazypants.render.BoundingBox;
|
||||
import crazypants.render.IconUtil;
|
||||
import crazypants.util.BlockCoord;
|
||||
import crazypants.util.DyeColor;
|
||||
|
||||
public class InsulatedRedstoneConduit extends RedstoneConduit implements IInsulatedRedstoneConduit {
|
||||
|
||||
@@ -70,7 +70,7 @@ public class InsulatedRedstoneConduit extends RedstoneConduit implements IInsula
|
||||
|
||||
private Map<ForgeDirection, ConnectionMode> forcedConnections = new HashMap<ForgeDirection, ConnectionMode>();
|
||||
|
||||
private Map<ForgeDirection, SignalColor> signalColors = new HashMap<ForgeDirection, SignalColor>();
|
||||
private Map<ForgeDirection, DyeColor> signalColors = new HashMap<ForgeDirection, DyeColor>();
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(EntityPlayer player, RaytraceResult res, List<RaytraceResult> all) {
|
||||
@@ -78,7 +78,7 @@ public class InsulatedRedstoneConduit extends RedstoneConduit implements IInsula
|
||||
World world = getBundle().getEntity().worldObj;
|
||||
if(!world.isRemote) {
|
||||
|
||||
SignalColor col = getSignalColorFromEquippedItem(player.getCurrentEquippedItem());
|
||||
DyeColor col = DyeColor.getColorFromDye(player.getCurrentEquippedItem());
|
||||
if(col != null && res.component != null) {
|
||||
setSignalColor(res.component.dir, col);
|
||||
return true;
|
||||
@@ -98,7 +98,7 @@ public class InsulatedRedstoneConduit extends RedstoneConduit implements IInsula
|
||||
}
|
||||
|
||||
if(colorHit) {
|
||||
setSignalColor(connDir, SignalColor.getNext(getSignalColor(connDir)));
|
||||
setSignalColor(connDir, DyeColor.getNext(getSignalColor(connDir)));
|
||||
return true;
|
||||
|
||||
} else if(connDir == ForgeDirection.UNKNOWN || connDir == faceHit) {
|
||||
@@ -212,34 +212,17 @@ public class InsulatedRedstoneConduit extends RedstoneConduit implements IInsula
|
||||
//System.out.println("InsulatedRedstoneConduit.onInputChanged: ");
|
||||
}
|
||||
|
||||
private SignalColor getSignalColorFromEquippedItem(ItemStack currentEquippedItem) {
|
||||
if(currentEquippedItem == null) {
|
||||
return null;
|
||||
}
|
||||
int oreId = OreDictionary.getOreID(currentEquippedItem);
|
||||
if(oreId < 0) {
|
||||
return null;
|
||||
}
|
||||
for (int i = 0; i < DYE_ORE_NAMES.length; i++) {
|
||||
String dyeName = DYE_ORE_NAMES[i];
|
||||
if(OreDictionary.getOreID(dyeName) == oreId) {
|
||||
return SignalColor.values()[i];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SignalColor getSignalColor(ForgeDirection dir) {
|
||||
SignalColor res = signalColors.get(dir);
|
||||
public DyeColor getSignalColor(ForgeDirection dir) {
|
||||
DyeColor res = signalColors.get(dir);
|
||||
if(res == null) {
|
||||
return SignalColor.RED;
|
||||
return DyeColor.RED;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSignalColor(ForgeDirection dir, SignalColor col) {
|
||||
public void setSignalColor(ForgeDirection dir, DyeColor col) {
|
||||
Set<Signal> toRemove = getNetworkInputs(dir);
|
||||
signalColors.put(dir, col);
|
||||
Set<Signal> toAdd = getNetworkInputs(dir);
|
||||
@@ -344,7 +327,7 @@ public class InsulatedRedstoneConduit extends RedstoneConduit implements IInsula
|
||||
return allSigs;
|
||||
}
|
||||
|
||||
SignalColor col = getSignalColor(side);
|
||||
DyeColor col = getSignalColor(side);
|
||||
Set<Signal> result = new HashSet<Signal>();
|
||||
for (Signal signal : allSigs) {
|
||||
if(signal.color == col) {
|
||||
@@ -430,7 +413,7 @@ public class InsulatedRedstoneConduit extends RedstoneConduit implements IInsula
|
||||
byte[] modes = new byte[6];
|
||||
int i = 0;
|
||||
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||
SignalColor col = signalColors.get(dir);
|
||||
DyeColor col = signalColors.get(dir);
|
||||
if(col != null) {
|
||||
modes[i] = (byte) col.ordinal();
|
||||
} else {
|
||||
@@ -464,7 +447,7 @@ public class InsulatedRedstoneConduit extends RedstoneConduit implements IInsula
|
||||
int i = 0;
|
||||
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||
if(cols[i] >= 0) {
|
||||
signalColors.put(dir, SignalColor.values()[cols[i]]);
|
||||
signalColors.put(dir, DyeColor.values()[cols[i]]);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import crazypants.enderio.conduit.IConduit;
|
||||
import crazypants.enderio.conduit.geom.CollidableComponent;
|
||||
import crazypants.render.IconUtil;
|
||||
import crazypants.util.BlockCoord;
|
||||
import crazypants.util.DyeColor;
|
||||
|
||||
public class RedstoneConduit extends AbstractConduit implements IRedstoneConduit {
|
||||
|
||||
@@ -126,8 +127,8 @@ public class RedstoneConduit extends AbstractConduit implements IRedstoneConduit
|
||||
}
|
||||
|
||||
@Override
|
||||
public SignalColor getSignalColor(ForgeDirection dir) {
|
||||
return SignalColor.RED;
|
||||
public DyeColor getSignalColor(ForgeDirection dir) {
|
||||
return DyeColor.RED;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -18,6 +18,7 @@ import crazypants.enderio.conduit.geom.Offset;
|
||||
import crazypants.render.BoundingBox;
|
||||
import crazypants.render.IconUtil;
|
||||
import crazypants.util.BlockCoord;
|
||||
import crazypants.util.DyeColor;
|
||||
import crazypants.vecmath.Vector3d;
|
||||
|
||||
public class RedstoneSwitch extends RedstoneConduit {
|
||||
@@ -116,7 +117,7 @@ public class RedstoneSwitch extends RedstoneConduit {
|
||||
return;
|
||||
}
|
||||
TileEntity te = bundle.getEntity();
|
||||
Signal signal = new Signal(te.xCoord, te.yCoord, te.zCoord, ForgeDirection.UNKNOWN, 15, SignalColor.RED);
|
||||
Signal signal = new Signal(te.xCoord, te.yCoord, te.zCoord, ForgeDirection.UNKNOWN, 15, DyeColor.RED);
|
||||
if(isOn) {
|
||||
network.addSignal(signal);
|
||||
} else {
|
||||
@@ -129,7 +130,7 @@ public class RedstoneSwitch extends RedstoneConduit {
|
||||
Set<Signal> res = super.getNetworkInputs();
|
||||
if(isOn) {
|
||||
BlockCoord loc = getLocation();
|
||||
Signal signal = new Signal(loc.x, loc.y, loc.z, ForgeDirection.UNKNOWN, 15, SignalColor.RED);
|
||||
Signal signal = new Signal(loc.x, loc.y, loc.z, ForgeDirection.UNKNOWN, 15, DyeColor.RED);
|
||||
res.add(signal);
|
||||
}
|
||||
return res;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package crazypants.enderio.conduit.redstone;
|
||||
|
||||
import crazypants.util.DyeColor;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
public class Signal {
|
||||
@@ -9,9 +10,9 @@ public class Signal {
|
||||
public final int z;
|
||||
public final ForgeDirection dir;
|
||||
public final int strength;
|
||||
public final SignalColor color;
|
||||
public final DyeColor color;
|
||||
|
||||
public Signal(int x, int y, int z, ForgeDirection dir, int strength, SignalColor color) {
|
||||
public Signal(int x, int y, int z, ForgeDirection dir, int strength, DyeColor color) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
package crazypants.enderio.conduit.redstone;
|
||||
|
||||
import net.minecraft.item.ItemDye;
|
||||
|
||||
public enum SignalColor {
|
||||
BLACK,
|
||||
RED,
|
||||
GREEN,
|
||||
BROWN,
|
||||
BLUE,
|
||||
PURPLE,
|
||||
CYAN,
|
||||
SILVER,
|
||||
GRAY,
|
||||
PINK,
|
||||
LIME,
|
||||
YELLOW,
|
||||
LIGHT_BLUE,
|
||||
MAGENTA,
|
||||
ORANGE,
|
||||
WHITE;
|
||||
|
||||
public static SignalColor getNext(SignalColor mode) {
|
||||
int ord = mode.ordinal() + 1;
|
||||
if(ord >= SignalColor.values().length) {
|
||||
ord = 0;
|
||||
}
|
||||
return SignalColor.values()[ord];
|
||||
}
|
||||
|
||||
public static SignalColor fromIndex(int index) {
|
||||
return SignalColor.values()[index];
|
||||
}
|
||||
|
||||
private SignalColor() {
|
||||
}
|
||||
|
||||
public int getColor() {
|
||||
return ItemDye.dyeColors[ordinal()];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -32,7 +32,7 @@ public class ColorButton extends IconButtonEIO {
|
||||
return tooltipPrefix;
|
||||
}
|
||||
|
||||
public void setToolTipPrefix(String tooltipPrefix) {
|
||||
public void setToolTipHeading(String tooltipPrefix) {
|
||||
if(tooltipPrefix == null) {
|
||||
this.tooltipPrefix = "";
|
||||
} else {
|
||||
@@ -56,7 +56,11 @@ public class ColorButton extends IconButtonEIO {
|
||||
this.colorIndex = MathHelper.clamp_int(colorIndex, 0, ItemDye.dyeColors.length - 1);
|
||||
String colStr = ItemDye.dyeColorNames[colorIndex];
|
||||
colStr = colStr.substring(0, 1).toUpperCase() + colStr.substring(1);
|
||||
setToolTip(tooltipPrefix, colStr);
|
||||
if(tooltipPrefix != null && tooltipPrefix.length() > 0) {
|
||||
setToolTip(tooltipPrefix, colStr);
|
||||
} else {
|
||||
setToolTip(colStr);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -10,8 +10,8 @@ import powercrystals.minefactoryreloaded.api.rednet.RedNetConnectionType;
|
||||
import crazypants.enderio.GuiHandler;
|
||||
import crazypants.enderio.ModObject;
|
||||
import crazypants.enderio.PacketHandler;
|
||||
import crazypants.enderio.conduit.redstone.SignalColor;
|
||||
import crazypants.enderio.machine.AbstractMachineBlock;
|
||||
import crazypants.util.DyeColor;
|
||||
|
||||
public class BlockPowerMonitor extends AbstractMachineBlock<TilePowerMonitor> implements ITileEntityProvider {
|
||||
|
||||
@@ -63,7 +63,7 @@ public class BlockPowerMonitor extends AbstractMachineBlock<TilePowerMonitor> im
|
||||
TileEntity te = world.getBlockTileEntity(x, y, z);
|
||||
if(te instanceof TilePowerMonitor) {
|
||||
|
||||
return ((TilePowerMonitor) te).getRednetOutputValue(ForgeDirection.values()[side], SignalColor.RED.ordinal());
|
||||
return ((TilePowerMonitor) te).getRednetOutputValue(ForgeDirection.values()[side], DyeColor.RED.ordinal());
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ import cpw.mods.fml.common.network.Player;
|
||||
import crazypants.enderio.IPacketProcessor;
|
||||
import crazypants.enderio.Log;
|
||||
import crazypants.enderio.PacketHandler;
|
||||
import crazypants.enderio.conduit.redstone.SignalColor;
|
||||
import crazypants.util.DyeColor;
|
||||
|
||||
public class PowerMonitorPacketHandler implements IPacketProcessor {
|
||||
|
||||
@@ -79,7 +79,7 @@ public class PowerMonitorPacketHandler implements IPacketProcessor {
|
||||
pm.engineControlEnabled = data.readBoolean();
|
||||
pm.startLevel = data.readFloat();
|
||||
pm.stopLevel = data.readFloat();
|
||||
pm.signalColor = SignalColor.fromIndex(data.readShort());
|
||||
pm.signalColor = DyeColor.fromIndex(data.readShort());
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -13,11 +13,11 @@ import crazypants.enderio.conduit.power.NetworkPowerManager;
|
||||
import crazypants.enderio.conduit.power.PowerConduitNetwork;
|
||||
import crazypants.enderio.conduit.power.PowerTracker;
|
||||
import crazypants.enderio.conduit.redstone.Signal;
|
||||
import crazypants.enderio.conduit.redstone.SignalColor;
|
||||
import crazypants.enderio.machine.AbstractMachineEntity;
|
||||
import crazypants.enderio.machine.SlotDefinition;
|
||||
import crazypants.enderio.power.IInternalPowerReceptor;
|
||||
import crazypants.util.BlockCoord;
|
||||
import crazypants.util.DyeColor;
|
||||
import crazypants.util.Util;
|
||||
|
||||
public class TilePowerMonitor extends AbstractMachineEntity implements IInternalPowerReceptor {
|
||||
@@ -36,7 +36,7 @@ public class TilePowerMonitor extends AbstractMachineEntity implements IInternal
|
||||
boolean engineControlEnabled = false;
|
||||
float startLevel = 0.75f;
|
||||
float stopLevel = 0.99f;
|
||||
SignalColor signalColor = SignalColor.RED;
|
||||
DyeColor signalColor = DyeColor.RED;
|
||||
|
||||
Signal currentlyEmmittedSignal;
|
||||
|
||||
@@ -48,8 +48,8 @@ public class TilePowerMonitor extends AbstractMachineEntity implements IInternal
|
||||
if(currentlyEmmittedSignal == null) {
|
||||
return new int[16];
|
||||
}
|
||||
int[] res = new int[SignalColor.values().length];
|
||||
for (SignalColor col : SignalColor.values()) {
|
||||
int[] res = new int[DyeColor.values().length];
|
||||
for (DyeColor col : DyeColor.values()) {
|
||||
res[col.ordinal()] = currentlyEmmittedSignal.color == col ? 15 : 0;
|
||||
}
|
||||
return res;
|
||||
@@ -229,7 +229,7 @@ public class TilePowerMonitor extends AbstractMachineEntity implements IInternal
|
||||
engineControlEnabled = nbtRoot.getBoolean("engineControlEnabled");
|
||||
startLevel = nbtRoot.getFloat("startLevel");
|
||||
stopLevel = nbtRoot.getFloat("stopLevel");
|
||||
signalColor = SignalColor.fromIndex(nbtRoot.getShort("signalColor"));
|
||||
signalColor = DyeColor.fromIndex(nbtRoot.getShort("signalColor"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
package crazypants.util;
|
||||
|
||||
import net.minecraft.item.ItemDye;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
public enum DyeColor {
|
||||
|
||||
BLACK,
|
||||
RED,
|
||||
GREEN,
|
||||
BROWN,
|
||||
BLUE,
|
||||
PURPLE,
|
||||
CYAN,
|
||||
SILVER,
|
||||
GRAY,
|
||||
PINK,
|
||||
LIME,
|
||||
YELLOW,
|
||||
LIGHT_BLUE,
|
||||
MAGENTA,
|
||||
ORANGE,
|
||||
WHITE;
|
||||
|
||||
public static final String[] DYE_ORE_NAMES = {
|
||||
"dyeBlack",
|
||||
"dyeRed",
|
||||
"dyeGreen",
|
||||
"dyeBrown",
|
||||
"dyeBlue",
|
||||
"dyePurple",
|
||||
"dyeCyan",
|
||||
"dyeLightGray",
|
||||
"dyeGray",
|
||||
"dyePink",
|
||||
"dyeLime",
|
||||
"dyeYellow",
|
||||
"dyeLightBlue",
|
||||
"dyeMagenta",
|
||||
"dyeOrange",
|
||||
"dyeWhite"
|
||||
};
|
||||
|
||||
public static DyeColor getNext(DyeColor col) {
|
||||
int ord = col.ordinal() + 1;
|
||||
if(ord >= DyeColor.values().length) {
|
||||
ord = 0;
|
||||
}
|
||||
return DyeColor.values()[ord];
|
||||
}
|
||||
|
||||
public static DyeColor getColorFromDye(ItemStack dye) {
|
||||
if(dye == null) {
|
||||
return null;
|
||||
}
|
||||
int oreId = OreDictionary.getOreID(dye);
|
||||
if(oreId < 0) {
|
||||
return null;
|
||||
}
|
||||
for (int i = 0; i < DYE_ORE_NAMES.length; i++) {
|
||||
String dyeName = DYE_ORE_NAMES[i];
|
||||
if(OreDictionary.getOreID(dyeName) == oreId) {
|
||||
return DyeColor.values()[i];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static DyeColor fromIndex(int index) {
|
||||
return DyeColor.values()[index];
|
||||
}
|
||||
|
||||
private DyeColor() {
|
||||
}
|
||||
|
||||
public int getColor() {
|
||||
return ItemDye.dyeColors[ordinal()];
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return ItemDye.dyeColorNames[ordinal()];
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getName();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user