Finish up the RGB indicator component, closes #71

This commit is contained in:
malte0811 2019-01-25 18:14:59 +01:00
parent 5aea1281ca
commit f9fe9de715
4 changed files with 69 additions and 6 deletions

View file

@ -227,7 +227,8 @@ public class ClientProxy extends CommonProxy {
new ManualPages.CraftingMulti(m, "industrialwires.lock", new ItemStack(IndustrialWires.panelComponent, 1, 7), new ItemStack(IndustrialWires.key)), new ManualPages.CraftingMulti(m, "industrialwires.lock", new ItemStack(IndustrialWires.panelComponent, 1, 7), new ItemStack(IndustrialWires.key)),
new ManualPages.Crafting(m, "industrialwires.lock1", new ItemStack(IndustrialWires.key, 1, 2)), new ManualPages.Crafting(m, "industrialwires.lock1", new ItemStack(IndustrialWires.key, 1, 2)),
new ManualPages.Crafting(m, "industrialwires.panel_meter", new ItemStack(IndustrialWires.panelComponent, 1, 8)), new ManualPages.Crafting(m, "industrialwires.panel_meter", new ItemStack(IndustrialWires.panelComponent, 1, 8)),
new ManualPages.Crafting(m, "industrialwires.7seg", new ItemStack(IndustrialWires.panelComponent, 1, 9)) new ManualPages.Crafting(m, "industrialwires.7seg", new ItemStack(IndustrialWires.panelComponent, 1, 9)),
new ManualPages.Crafting(m, "industrialwires.rgb_led", new ItemStack(IndustrialWires.panelComponent, 1, 10))
); );
List<MarxOreHandler.OreInfo> ores = MarxOreHandler.getRecipes(); List<MarxOreHandler.OreInfo> ores = MarxOreHandler.getRecipes();
text = I18n.format("ie.manual.entry.industrialwires.marx"); text = I18n.format("ie.manual.entry.industrialwires.marx");

View file

@ -19,6 +19,7 @@ import malte0811.industrialwires.IndustrialWires;
import malte0811.industrialwires.client.RawQuad; import malte0811.industrialwires.client.RawQuad;
import malte0811.industrialwires.client.gui.GuiPanelCreator; import malte0811.industrialwires.client.gui.GuiPanelCreator;
import malte0811.industrialwires.controlpanel.ControlPanelNetwork.RSChannel; import malte0811.industrialwires.controlpanel.ControlPanelNetwork.RSChannel;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.resources.I18n; import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTBase;
@ -177,7 +178,24 @@ public class RGBIndicator extends PanelComponent implements IConfigurableCompone
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void renderInGUI(GuiPanelCreator gui) { public void renderInGUI(GuiPanelCreator gui) {
renderInGUIDefault(gui, 0xffffff); AxisAlignedBB aabb = getBlockRelativeAABB();
int left = (int) (gui.getX0() + aabb.minX * gui.panelSize);
int top = (int) (gui.getY0() + aabb.minZ * gui.panelSize);
int right = (int) (gui.getX0() + aabb.maxX * gui.panelSize);
int bottom = (int) (gui.getY0() + aabb.maxZ * gui.panelSize);
int width = right - left;
int height = bottom - top;
for (int colorId = 0; colorId < 3; ++colorId) {
int color = (0xff << (colorId * 8)) | 0xff000000;
for (int row = 0; row < 3; ++row) {
int col = (row * (row + 1) + colorId) % 3;
Gui.drawRect(Math.round(left + width * col / 3.0F),
Math.round(top + height * row / 3.0F),
Math.round(left + width * (col + 1) / 3.0F),
Math.round(top + height * (row + 1) / 3.0F),
color);
}
}
} }
@Override @Override
@ -210,14 +228,25 @@ public class RGBIndicator extends PanelComponent implements IConfigurableCompone
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public String fomatConfigDescription(ConfigType type, int id) { public String fomatConfigDescription(ConfigType type, int id) {
//TODO String color = null;
switch (id) {
case 0:
color = "red";
break;
case 1:
color = "green";
break;
case 2:
color = "blue";
break;
}
switch (type) { switch (type) {
case FLOAT: case FLOAT:
return null; return null;
case RS_CHANNEL: case RS_CHANNEL:
return I18n.format(IndustrialWires.MODID + ".desc.rschannel_info"); return I18n.format(IndustrialWires.MODID + ".desc.rschannel_" + color);
case INT: case INT:
return I18n.format(IndustrialWires.MODID + ".desc.rsid_info"); return I18n.format(IndustrialWires.MODID + ".desc.rsid_" + color);
default: default:
return null; return null;
} }

View file

@ -45,6 +45,7 @@ item.industrialwires.panel_component.toggle_switch_covered.name=Covered Toggle S
item.industrialwires.panel_component.lock.name=Lock Switch item.industrialwires.panel_component.lock.name=Lock Switch
item.industrialwires.panel_component.panel_meter.name=Panel Meter item.industrialwires.panel_component.panel_meter.name=Panel Meter
item.industrialwires.panel_component.7seg.name=7-Segment Display item.industrialwires.panel_component.7seg.name=7-Segment Display
item.industrialwires.panel_component.rgb_led.name=RGB Indicator
item.industrialwires.key.key.name=Key item.industrialwires.key.key.name=Key
item.industrialwires.key.key_named.name=Key for item.industrialwires.key.key_named.name=Key for
item.industrialwires.key.blank_key.name=Blank Key item.industrialwires.key.blank_key.name=Blank Key
@ -82,6 +83,12 @@ industrialwires.desc.rsid_info=The ID of the redstone wire controller to interac
industrialwires.desc.rschannel_info=The color of the channel to use industrialwires.desc.rschannel_info=The color of the channel to use
industrialwires.desc.rsid_info2=The ID of the redstone wire controller for the second signal. -1 to disable. industrialwires.desc.rsid_info2=The ID of the redstone wire controller for the second signal. -1 to disable.
industrialwires.desc.rschannel_info2=The color of the channel to use for the second signal industrialwires.desc.rschannel_info2=The color of the channel to use for the second signal
industrialwires.desc.rschannel_red=The color of the channel to use for the red signal
industrialwires.desc.rschannel_green=The color of the channel to use for the green signal
industrialwires.desc.rschannel_blue=The color of the channel to use for the blue signal
industrialwires.desc.rsid_red=The ID of the redstone wire controller for the red signal
industrialwires.desc.rsid_green=The ID of the redstone wire controller for the green signal
industrialwires.desc.rsid_blue=The ID of the redstone wire controller for the blue signal
industrialwires.desc.label_text=The text in this label industrialwires.desc.label_text=The text in this label
industrialwires.desc.red=Red industrialwires.desc.red=Red
industrialwires.desc.green=Green industrialwires.desc.green=Green
@ -192,4 +199,5 @@ ie.manual.entry.industrialwires.variac=A Variac® is a variable autotransformer.
ie.manual.entry.industrialwires.lock=A lock switch activates a redstone signal when a key is inserted and turned. A newly crafted lock will have a unique key configuration. By placing a blank key and a lock in a crafting table a key for the lock can be created. Multiple locks fitting the same key can be created using component copying (see page 1). Keys can be named in a GUI opened by right-clicking with them. ie.manual.entry.industrialwires.lock=A lock switch activates a redstone signal when a key is inserted and turned. A newly crafted lock will have a unique key configuration. By placing a blank key and a lock in a crafting table a key for the lock can be created. Multiple locks fitting the same key can be created using component copying (see page 1). Keys can be named in a GUI opened by right-clicking with them.
ie.manual.entry.industrialwires.lock1=Up to <config;I;iwKeysOnRing> can be combined on a key ring. Keys are added to the ring by placing both in a crafting table. Shift-right-click the key ring to cycle through the keys on the ring. The selected key can be removed from the ring by placing the ring in a crafting table. The key ring will work just as the selected key would on lock switches. ie.manual.entry.industrialwires.lock1=Up to <config;I;iwKeysOnRing> can be combined on a key ring. Keys are added to the ring by placing both in a crafting table. Shift-right-click the key ring to cycle through the keys on the ring. The selected key can be removed from the ring by placing the ring in a crafting table. The key ring will work just as the selected key would on lock switches.
ie.manual.entry.industrialwires.panel_meter=A panel meter can be used to show display analog redstone signals with some accuracy. Panel meters are available in two different formats, wide and narrow. The difference between the formats is purely visual. ie.manual.entry.industrialwires.panel_meter=A panel meter can be used to show display analog redstone signals with some accuracy. Panel meters are available in two different formats, wide and narrow. The difference between the formats is purely visual.
ie.manual.entry.industrialwires.7seg=Seven-Segment Displays are a way of displaying analog redstone signals precisely. Signal strengths 0-9 are displayed as one would expect, levels 10-15 are represented by the letters A-E. Some of the letters are lower-case to differentiate them from digits (e.g. 8 vs B). ie.manual.entry.industrialwires.7seg=Seven-Segment Displays are a way of displaying analog redstone signals precisely. Signal strengths 0-9 are displayed as one would expect, levels 10-15 are represented by the letters A-E. Some of the letters are lower-case to differentiate them from digits (e.g. 8 vs B).
ie.manual.entry.industrialwires.rgb_led=RGB Indicators consist of 3 indicator lights placed close together: one is red, one green and one blue. They can be controlled independently, allowing for many different colors to be shown without having to disassemble and recreate the panel.

View file

@ -0,0 +1,25 @@
{
"result": {
"item": "industrialwires:panel_component",
"data": 10
},
"ingredients": [
{
"type": "forge:ore_dict",
"ore": "dustRedstone"
},
{
"item": "industrialwires:panel_component",
"data": 2
},
{
"item": "industrialwires:panel_component",
"data": 2
},
{
"item": "industrialwires:panel_component",
"data": 2
}
],
"type": "forge:ore_shapeless"
}