Added editing GUI's for the other components
fixed a potential component dupe bug
This commit is contained in:
parent
1d83fa7579
commit
0327322198
|
@ -61,7 +61,7 @@ public class TileEntityPanel extends TileEntityIWBase implements IDirectionalTil
|
|||
{
|
||||
for (int i = 2; i < 14; i++) {
|
||||
int color = EnumDyeColor.byMetadata(i - 2).getMapColor().colorValue;
|
||||
IndicatorLight ind = new IndicatorLight(0, i - 2, color);
|
||||
IndicatorLight ind = new IndicatorLight(0, (byte) (i - 2), color);
|
||||
LightedButton btn = new LightedButton(color, false, true, 1, i - 2);
|
||||
Label lbl = new Label("->", color);
|
||||
ind.setX(0);
|
||||
|
|
|
@ -101,11 +101,13 @@ public class TileEntityPanelCreator extends TileEntityIWBase implements IIEInven
|
|||
int type = nbt.getInteger("type");
|
||||
switch (MessageType.values()[type]) {
|
||||
case ADD:
|
||||
PanelComponent pc = PanelComponent.read(nbt.getCompoundTag("component"));
|
||||
ItemStack curr = p.inventory.getItemStack();
|
||||
PanelComponent pc = IndustrialWires.panelComponent.componentFromStack(curr);
|
||||
if (pc!=null) {
|
||||
pc.setX(nbt.getFloat("x"));
|
||||
pc.setY(nbt.getFloat("y"));
|
||||
pc.setPanelHeight(height);
|
||||
components.add(pc);
|
||||
ItemStack curr = p.inventory.getItemStack();
|
||||
if (curr!=null) {
|
||||
curr.stackSize--;
|
||||
if (curr.stackSize<=0) {
|
||||
|
@ -120,15 +122,6 @@ public class TileEntityPanelCreator extends TileEntityIWBase implements IIEInven
|
|||
case REMOVE:
|
||||
components.remove(nbt.getInteger("id"));
|
||||
break;
|
||||
case CHANGE:
|
||||
pc = PanelComponent.read(nbt.getCompoundTag("component"));
|
||||
if (pc!=null) {
|
||||
pc.setPanelHeight(height);
|
||||
components.set(nbt.getInteger("id"), pc);
|
||||
} else {
|
||||
IELogger.info("(IndustrialWires) Failed to load panel component send by "+p.getDisplayNameString());
|
||||
}
|
||||
break;
|
||||
case CREATE_PANEL:
|
||||
if (ApiUtils.compareToOreName(inv[0], "plateIron")) {
|
||||
NBTTagCompound panelNBT = new NBTTagCompound();
|
||||
|
|
|
@ -8,12 +8,13 @@ import malte0811.industrialWires.IndustrialWires;
|
|||
import malte0811.industrialWires.client.gui.elements.GuiChannelPicker;
|
||||
import malte0811.industrialWires.client.gui.elements.GuiIntChooser;
|
||||
import malte0811.industrialWires.containers.ContainerPanelComponent;
|
||||
import malte0811.industrialWires.controlpanel.IConfigurableComponent;
|
||||
import malte0811.industrialWires.controlpanel.PanelComponent;
|
||||
import malte0811.industrialWires.controlpanel.properties.IConfigurableComponent;
|
||||
import malte0811.industrialWires.network.MessageComponentSync;
|
||||
import net.minecraft.client.gui.GuiTextField;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.util.EnumHand;
|
||||
|
@ -56,7 +57,9 @@ public class GuiPanelComponent extends GuiContainer {
|
|||
IConfigurableComponent.StringConfig[] strings = confComp.getStringOptions();
|
||||
stringTexts.clear();
|
||||
for (IConfigurableComponent.StringConfig sc : strings) {
|
||||
stringTexts.add(new GuiTextField(0, mc.fontRendererObj, guiLeft + sc.x, guiTop + sc.y, 58, 12));
|
||||
GuiTextField toAdd = new GuiTextField(0, mc.fontRendererObj, guiLeft + sc.x, guiTop + sc.y, 58, 12);
|
||||
toAdd.setText(sc.value);
|
||||
stringTexts.add(toAdd);
|
||||
}
|
||||
IConfigurableComponent.RSChannelConfig[] rs = confComp.getRSChannelOptions();
|
||||
rsChannelChoosers.clear();
|
||||
|
@ -150,6 +153,18 @@ public class GuiPanelComponent extends GuiContainer {
|
|||
GuiSliderIE slider = floatSliders.get(i);
|
||||
double oldV = slider.getValue();
|
||||
slider.mousePressed(mc, mouseX, mouseY);
|
||||
if (oldV!=slider.getValue()) {
|
||||
sync(i, (float) slider.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseReleased(int mouseX, int mouseY, int state) {
|
||||
super.mouseReleased(mouseX, mouseY, state);
|
||||
for (int i = 0;i<floatSliders.size();i++) {
|
||||
GuiSliderIE slider = floatSliders.get(i);
|
||||
double oldV = slider.getValue();
|
||||
slider.mouseReleased(mouseX, mouseY);
|
||||
if (oldV!=slider.getValue()) {
|
||||
sync(i, (float) slider.getValue());
|
||||
|
@ -161,9 +176,25 @@ public class GuiPanelComponent extends GuiContainer {
|
|||
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
|
||||
super.drawScreen(mouseX, mouseY, partialTicks);
|
||||
GlStateManager.color(1, 1, 1, 1);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
for (GuiChannelPicker pick : rsChannelChoosers) {
|
||||
pick.drawButton(mc, mouseX, mouseY);
|
||||
}
|
||||
for (GuiButtonCheckbox box : boolButtons) {
|
||||
box.drawButton(mc, mouseX, mouseY);
|
||||
}
|
||||
for (GuiTextField field : stringTexts) {
|
||||
field.drawTextBox();
|
||||
}
|
||||
for (GuiIntChooser choose : intChoosers) {
|
||||
choose.drawChooser();
|
||||
}
|
||||
for (GuiSliderIE choose : floatSliders) {
|
||||
choose.drawButton(mc, mouseX, mouseY);
|
||||
}
|
||||
//TOOLTIPS
|
||||
for (int i = 0;i<rsChannelChoosers.size();i++) {
|
||||
GuiChannelPicker pick = rsChannelChoosers.get(i);
|
||||
pick.drawButton(mc, mouseX, mouseY);
|
||||
String tooltip = confComp.fomatConfigDescription(IConfigurableComponent.ConfigType.RS_CHANNEL, i);
|
||||
if (tooltip!=null&&pick.isHovered()) {
|
||||
ClientUtils.drawHoveringText(ImmutableList.of(tooltip), mouseX, mouseY, mc.fontRendererObj);
|
||||
|
@ -171,7 +202,6 @@ public class GuiPanelComponent extends GuiContainer {
|
|||
}
|
||||
for (int i = 0;i<boolButtons.size();i++) {
|
||||
GuiButtonCheckbox box = boolButtons.get(i);
|
||||
box.drawButton(mc, mouseX, mouseY);
|
||||
String tooltip = confComp.fomatConfigDescription(IConfigurableComponent.ConfigType.BOOL, i);
|
||||
if (tooltip!=null&&box.isMouseOver()) {
|
||||
ClientUtils.drawHoveringText(ImmutableList.of(tooltip), mouseX, mouseY, mc.fontRendererObj);
|
||||
|
@ -179,7 +209,6 @@ public class GuiPanelComponent extends GuiContainer {
|
|||
}
|
||||
for (int i = 0;i<stringTexts.size();i++) {
|
||||
GuiTextField field = stringTexts.get(i);
|
||||
field.drawTextBox();
|
||||
String tooltip = confComp.fomatConfigDescription(IConfigurableComponent.ConfigType.STRING, i);
|
||||
if (tooltip!=null&&mouseX>=field.xPosition&&mouseX<field.xPosition+field.width&&
|
||||
mouseY>=field.yPosition&&mouseY<field.yPosition+field.height) {
|
||||
|
@ -188,7 +217,6 @@ public class GuiPanelComponent extends GuiContainer {
|
|||
}
|
||||
for (int i = 0;i<intChoosers.size();i++) {
|
||||
GuiIntChooser choose = intChoosers.get(i);
|
||||
choose.drawChooser();
|
||||
String tooltip = confComp.fomatConfigDescription(IConfigurableComponent.ConfigType.INT, i);
|
||||
if (tooltip!=null&&choose.isMouseOver(mouseX, mouseY)) {
|
||||
ClientUtils.drawHoveringText(ImmutableList.of(tooltip), mouseX, mouseY, mc.fontRendererObj);
|
||||
|
@ -196,7 +224,6 @@ public class GuiPanelComponent extends GuiContainer {
|
|||
}
|
||||
for (int i = 0;i<floatSliders.size();i++) {
|
||||
GuiSliderIE choose = floatSliders.get(i);
|
||||
choose.drawButton(mc, mouseX, mouseY);
|
||||
String tooltip = confComp.fomatConfigDescription(IConfigurableComponent.ConfigType.INT, i);
|
||||
if (tooltip!=null&&choose.isMouseOver()) {
|
||||
ClientUtils.drawHoveringText(ImmutableList.of(tooltip), mouseX, mouseY, mc.fontRendererObj);
|
||||
|
|
|
@ -69,13 +69,13 @@ public class GuiPanelCreator extends GuiContainer {
|
|||
xRel = (int) Math.floor(xRel*16/panelSize)*panelSize/16;
|
||||
yRel = (int) Math.floor(yRel*16/panelSize)*panelSize/16;
|
||||
}
|
||||
for (PanelComponent pc : container.tile.components) {
|
||||
drawPanelComponent(pc, -1, -1);
|
||||
}
|
||||
PanelComponent curr = getFloatingPC();
|
||||
if (curr!=null && 0 <= xRel && xRel <= panelSize && 0 <= yRel && yRel <= panelSize) {
|
||||
drawPanelComponent(curr, xRel, yRel);
|
||||
}
|
||||
for (PanelComponent pc : container.tile.components) {
|
||||
drawPanelComponent(pc, -1, -1);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -152,8 +152,8 @@ public class GuiPanelCreator extends GuiContainer {
|
|||
if (curr != null && 0 <= xRel && xRel <= panelSize && 0 <= yRel && yRel <= panelSize) {
|
||||
if (curr.isValidPos()) {
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
nbt.setTag("component", new NBTTagCompound());
|
||||
curr.writeToNBT(nbt.getCompoundTag("component"), true);
|
||||
nbt.setFloat("x", curr.getX());
|
||||
nbt.setFloat("y", curr.getY());
|
||||
nbt.setInteger("type", MessageType.ADD.ordinal());
|
||||
IndustrialWires.packetHandler.sendToServer(new MessageGUIInteract(container.tile, nbt));
|
||||
container.tile.components.add(curr.copyOf());
|
||||
|
|
|
@ -18,21 +18,33 @@
|
|||
|
||||
package malte0811.industrialWires.containers;
|
||||
|
||||
import blusunrize.immersiveengineering.api.ApiUtils;
|
||||
import blusunrize.immersiveengineering.common.gui.ContainerIEBase;
|
||||
import malte0811.industrialWires.blocks.controlpanel.TileEntityPanelCreator;
|
||||
import malte0811.industrialWires.controlpanel.PanelComponent;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
//TODO remove dependency on core IE
|
||||
public class ContainerPanelCreator extends ContainerIEBase<TileEntityPanelCreator> {
|
||||
public PanelComponent toPlace = null;
|
||||
public ContainerPanelCreator(InventoryPlayer inventoryPlayer, TileEntityPanelCreator tile) {
|
||||
super(inventoryPlayer, tile);
|
||||
int slotH = 150;
|
||||
int slotX = 14;
|
||||
slotCount = 1;
|
||||
addSlotToContainer(new Slot(inv, 0, 7, 37));
|
||||
addSlotToContainer(new Slot(inv, 0, 7, 37) {
|
||||
@Override
|
||||
public int getSlotStackLimit() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValid(@Nullable ItemStack stack) {
|
||||
return ApiUtils.compareToOreName(stack, "plateIron");
|
||||
}
|
||||
});
|
||||
for (int i = 0; i < 3; i++)
|
||||
for (int j = 0; j < 9; j++)
|
||||
addSlotToContainer(new Slot(inventoryPlayer, j+i*9+9, slotX+j*18, slotH+i*18));
|
||||
|
|
|
@ -1,4 +1,22 @@
|
|||
package malte0811.industrialWires.controlpanel.properties;
|
||||
/*
|
||||
* This file is part of Industrial Wires.
|
||||
* Copyright (C) 2016-2017 malte0811
|
||||
*
|
||||
* Industrial Wires is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Industrial Wires is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Industrial Wires. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package malte0811.industrialWires.controlpanel;
|
||||
|
||||
import blusunrize.immersiveengineering.api.tool.IConfigurableTool.ToolConfig;
|
||||
import net.minecraft.nbt.NBTBase;
|
|
@ -18,10 +18,15 @@
|
|||
|
||||
package malte0811.industrialWires.controlpanel;
|
||||
|
||||
import malte0811.industrialWires.IndustrialWires;
|
||||
import malte0811.industrialWires.blocks.controlpanel.TileEntityPanel;
|
||||
import malte0811.industrialWires.client.RawQuad;
|
||||
import malte0811.industrialWires.client.gui.GuiPanelCreator;
|
||||
import malte0811.industrialWires.blocks.controlpanel.TileEntityPanel;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTTagByte;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagInt;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
@ -33,15 +38,15 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class IndicatorLight extends PanelComponent {
|
||||
public class IndicatorLight extends PanelComponent implements IConfigurableComponent {
|
||||
private int rsInputId;
|
||||
private int rsInputChannel;
|
||||
private byte rsInputChannel;
|
||||
private int colorA = 0xff00;
|
||||
private byte rsInput;
|
||||
public IndicatorLight() {
|
||||
super("indicator_light");
|
||||
}
|
||||
public IndicatorLight(int rsId, int rsChannel, int color) {
|
||||
public IndicatorLight(int rsId, byte rsChannel, int color) {
|
||||
this();
|
||||
colorA = color;
|
||||
rsInputChannel = rsChannel;
|
||||
|
@ -51,7 +56,7 @@ public class IndicatorLight extends PanelComponent {
|
|||
@Override
|
||||
protected void writeCustomNBT(NBTTagCompound nbt, boolean toItem) {
|
||||
nbt.setInteger(RS_ID, rsInputId);
|
||||
nbt.setInteger(RS_CHANNEL, rsInputChannel);
|
||||
nbt.setByte(RS_CHANNEL, rsInputChannel);
|
||||
nbt.setInteger(COLOR, colorA);
|
||||
if (!toItem) {
|
||||
nbt.setInteger("rsInput", rsInput);
|
||||
|
@ -61,7 +66,7 @@ public class IndicatorLight extends PanelComponent {
|
|||
@Override
|
||||
protected void readCustomNBT(NBTTagCompound nbt) {
|
||||
rsInputId = nbt.getInteger(RS_ID);
|
||||
rsInputChannel = nbt.getInteger(RS_CHANNEL);
|
||||
rsInputChannel = nbt.getByte(RS_CHANNEL);
|
||||
colorA = nbt.getInteger(COLOR);
|
||||
rsInput = nbt.getByte("rsInput");
|
||||
}
|
||||
|
@ -156,4 +161,71 @@ public class IndicatorLight extends PanelComponent {
|
|||
public void renderInGUI(GuiPanelCreator gui) {
|
||||
renderInGUIDefault(gui, colorA);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyConfigOption(ConfigType type, int id, NBTBase value) {
|
||||
switch (type) {
|
||||
case RS_CHANNEL:
|
||||
rsInputChannel = ((NBTTagByte)value).getByte();
|
||||
break;
|
||||
case INT:
|
||||
rsInputId = ((NBTTagInt)value).getInt();
|
||||
break;
|
||||
case FLOAT:
|
||||
colorA = PanelUtils.setColor(colorA, id, value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public String fomatConfigName(ConfigType type, int id) {
|
||||
switch (type) {
|
||||
case FLOAT:
|
||||
return I18n.format(IndustrialWires.MODID+".desc."+(id==0?"red":(id==1?"green":"blue")));
|
||||
case RS_CHANNEL:
|
||||
case INT:
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public String fomatConfigDescription(ConfigType type, int id) {
|
||||
switch (type) {
|
||||
case FLOAT:
|
||||
return null;
|
||||
case RS_CHANNEL:
|
||||
return I18n.format(IndustrialWires.MODID+".desc.rschannel_info");
|
||||
case INT:
|
||||
return I18n.format(IndustrialWires.MODID+".desc.rsid_info");
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public RSChannelConfig[] getRSChannelOptions() {
|
||||
return new RSChannelConfig[] {
|
||||
new RSChannelConfig("channel", 0, 0, rsInputChannel)
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public IntConfig[] getIntegerOptions() {
|
||||
return new IntConfig[] {
|
||||
new IntConfig("rsId", 0, 45, rsInputId, 3, false)
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public FloatConfig[] getFloatOptions() {
|
||||
float[] color = PanelUtils.getFloatColor(true, this.colorA);
|
||||
return new FloatConfig[]{
|
||||
new FloatConfig("red", 0, 70, color[0], 60),
|
||||
new FloatConfig("green", 0, 90, color[1], 60),
|
||||
new FloatConfig("blue", 0, 110, color[2], 60)
|
||||
};
|
||||
}
|
||||
}
|
|
@ -18,20 +18,25 @@
|
|||
|
||||
package malte0811.industrialWires.controlpanel;
|
||||
|
||||
import malte0811.industrialWires.IndustrialWires;
|
||||
import malte0811.industrialWires.blocks.controlpanel.TileEntityPanel;
|
||||
import malte0811.industrialWires.client.RawQuad;
|
||||
import malte0811.industrialWires.client.gui.GuiPanelCreator;
|
||||
import malte0811.industrialWires.client.panelmodel.RawModelFontRenderer;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagString;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
public class Label extends PanelComponent {
|
||||
public class Label extends PanelComponent implements IConfigurableComponent {
|
||||
private static final ResourceLocation font = new ResourceLocation("minecraft", "textures/font/ascii.png");
|
||||
String text = "Test";
|
||||
RawModelFontRenderer renderer;
|
||||
|
@ -116,4 +121,55 @@ public class Label extends PanelComponent {
|
|||
int top = (int) (gui.getY0()+getY()*gui.panelSize);
|
||||
gui.mc.fontRendererObj.drawString(text, left, top, 0xff000000|color);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyConfigOption(ConfigType type, int id, NBTBase value) {
|
||||
switch (type) {
|
||||
case STRING:
|
||||
text = ((NBTTagString)value).getString();
|
||||
break;
|
||||
case FLOAT:
|
||||
color = PanelUtils.setColor(color, id, value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public String fomatConfigName(ConfigType type, int id) {
|
||||
switch (type) {
|
||||
case FLOAT:
|
||||
return I18n.format(IndustrialWires.MODID+".desc."+(id==0?"red":(id==1?"green":"blue")));
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public String fomatConfigDescription(ConfigType type, int id) {
|
||||
switch (type) {
|
||||
case STRING:
|
||||
return I18n.format(IndustrialWires.MODID+".desc.label_text");
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public StringConfig[] getStringOptions() {
|
||||
return new StringConfig[]{
|
||||
new StringConfig("text", 0, 0, text)
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public FloatConfig[] getFloatOptions() {
|
||||
float[] color = PanelUtils.getFloatColor(true, this.color);
|
||||
return new FloatConfig[]{
|
||||
new FloatConfig("red", 0, 20, color[0], 60),
|
||||
new FloatConfig("green", 0, 40, color[1], 60),
|
||||
new FloatConfig("blue", 0, 60, color[2], 60)
|
||||
};
|
||||
}
|
||||
}
|
|
@ -18,11 +18,15 @@
|
|||
|
||||
package malte0811.industrialWires.controlpanel;
|
||||
|
||||
import malte0811.industrialWires.IndustrialWires;
|
||||
import malte0811.industrialWires.blocks.controlpanel.TileEntityPanel;
|
||||
import malte0811.industrialWires.client.RawQuad;
|
||||
import malte0811.industrialWires.client.gui.GuiPanelCreator;
|
||||
import malte0811.industrialWires.controlpanel.properties.IConfigurableComponent;
|
||||
import net.minecraft.nbt.*;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTTagByte;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagInt;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import org.lwjgl.util.vector.Vector3f;
|
||||
|
@ -78,14 +82,12 @@ public class LightedButton extends PanelComponent implements IConfigurableCompon
|
|||
private final static float size = .0625F;
|
||||
@Override
|
||||
public List<RawQuad> getQuads() {
|
||||
float[] color = getFloatColor(active);
|
||||
float[] color = PanelUtils.getFloatColor(active, this.color);
|
||||
List<RawQuad> ret = new ArrayList<>(5);
|
||||
PanelUtils.addColoredBox(color, GRAY, null, new Vector3f(0, 0, 0), new Vector3f(size, size/2, size), ret, false);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
public PanelComponent copyOf() {
|
||||
|
@ -210,8 +212,7 @@ public class LightedButton extends PanelComponent implements IConfigurableCompon
|
|||
}
|
||||
break;
|
||||
case FLOAT:
|
||||
color &= ~(0xff<<(8*id));
|
||||
color |= (int)(255*(((NBTTagFloat)value).getFloat()))<<(8*id);
|
||||
color = PanelUtils.setColor(color, id, value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -220,12 +221,12 @@ public class LightedButton extends PanelComponent implements IConfigurableCompon
|
|||
public String fomatConfigName(ConfigType type, int id) {
|
||||
switch (type) {
|
||||
case BOOL:
|
||||
return "Latching";
|
||||
return I18n.format(IndustrialWires.MODID+".desc.latching");
|
||||
case RS_CHANNEL:
|
||||
case INT:
|
||||
return null;
|
||||
case FLOAT:
|
||||
return id==0?"Red":(id==1?"Green":"Blue");
|
||||
return I18n.format(IndustrialWires.MODID+".desc."+(id==0?"red":(id==1?"green":"blue")));
|
||||
default:
|
||||
return "INVALID";
|
||||
}
|
||||
|
@ -233,14 +234,13 @@ public class LightedButton extends PanelComponent implements IConfigurableCompon
|
|||
|
||||
@Override
|
||||
public String fomatConfigDescription(ConfigType type, int id) {
|
||||
//TODO localize
|
||||
switch (type) {
|
||||
case BOOL:
|
||||
return "Does this button stay on indefinitely?";
|
||||
return I18n.format(IndustrialWires.MODID+".desc.latching_info");
|
||||
case RS_CHANNEL:
|
||||
return "The RS channel to output on";
|
||||
return I18n.format(IndustrialWires.MODID+".desc.rschannel_info");
|
||||
case INT:
|
||||
return "The RS connector output ID";
|
||||
return I18n.format(IndustrialWires.MODID+".desc.rsid_info");
|
||||
case FLOAT:
|
||||
return null;
|
||||
default:
|
||||
|
@ -265,20 +265,11 @@ public class LightedButton extends PanelComponent implements IConfigurableCompon
|
|||
|
||||
@Override
|
||||
public FloatConfig[] getFloatOptions() {
|
||||
float[] color = getFloatColor(true);
|
||||
float[] color = PanelUtils.getFloatColor(true, this.color);
|
||||
return new FloatConfig[]{
|
||||
new FloatConfig("red", 0, 100, color[0], 60),
|
||||
new FloatConfig("green", 0, 120, color[1], 60),
|
||||
new FloatConfig("blue", 0, 140, color[2], 60)
|
||||
};
|
||||
}
|
||||
|
||||
public float[] getFloatColor(boolean active) {
|
||||
float[] ret = new float[4];
|
||||
ret[3] = 1;
|
||||
for (int i = 0;i<3;i++) {
|
||||
ret[i] = ((color>>(8*(2-i)))&255)/255F*(active?1:.5F);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
}
|
|
@ -21,7 +21,6 @@ package malte0811.industrialWires.controlpanel;
|
|||
public enum MessageType {
|
||||
ADD,
|
||||
REMOVE,
|
||||
CHANGE,
|
||||
CREATE_PANEL,
|
||||
REMOVE_ALL;
|
||||
}
|
||||
|
|
|
@ -31,7 +31,9 @@ import net.minecraft.client.renderer.vertex.VertexFormat;
|
|||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.item.EnumDyeColor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagFloat;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.Vec3i;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
|
@ -46,21 +48,23 @@ import static malte0811.industrialWires.controlpanel.PanelComponent.*;
|
|||
|
||||
public final class PanelUtils {
|
||||
public static TextureAtlasSprite PANEL_TEXTURE;
|
||||
private PanelUtils() {}
|
||||
|
||||
private PanelUtils() {
|
||||
}
|
||||
|
||||
public static List<BakedQuad> generateQuads(PropertyComponents.PanelRenderProperties components) {
|
||||
if (PANEL_TEXTURE==null) {
|
||||
PANEL_TEXTURE = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(IndustrialWires.MODID+":blocks/control_panel");
|
||||
if (PANEL_TEXTURE == null) {
|
||||
PANEL_TEXTURE = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(IndustrialWires.MODID + ":blocks/control_panel");
|
||||
}
|
||||
List<BakedQuad> ret = new ArrayList<>();
|
||||
Matrix4 m4 = components.getPanelTopTransform();
|
||||
Matrix4 m4RotOnly = m4.copy();
|
||||
m4RotOnly.invert();
|
||||
m4RotOnly.transpose();
|
||||
for (PanelComponent pc:components) {
|
||||
for (PanelComponent pc : components) {
|
||||
Matrix4 m4Here = m4.copy().translate(pc.getX(), 0, pc.getY());
|
||||
List<RawQuad> compQuads = pc.getQuads();
|
||||
for (RawQuad bq:compQuads) {
|
||||
for (RawQuad bq : compQuads) {
|
||||
ret.add(bakeQuad(bq, m4Here, m4RotOnly, false));
|
||||
}
|
||||
}
|
||||
|
@ -71,7 +75,7 @@ public final class PanelUtils {
|
|||
|
||||
List<RawQuad> rawOut = new ArrayList<>();
|
||||
//addTexturedBox(new Vector3f(0, 0, 0), new Vector3f(1, components.height, 1), rawOut, UV_FULL, PANEL_TEXTURE);
|
||||
float vMax = 16*components.height;
|
||||
float vMax = 16 * components.height;
|
||||
addQuad(rawOut, new Vector3f(0, components.height, 0), new Vector3f(0, components.height, 1),
|
||||
new Vector3f(1, components.height, 1), new Vector3f(1, components.height, 0),
|
||||
EnumFacing.UP, WHITE, PANEL_TEXTURE, UV_FULL);
|
||||
|
@ -90,8 +94,8 @@ public final class PanelUtils {
|
|||
addQuad(rawOut, new Vector3f(0, 0, 1), new Vector3f(1, 0, 1),
|
||||
new Vector3f(1, components.height, 1), new Vector3f(0, components.height, 1),
|
||||
EnumFacing.SOUTH, WHITE, PANEL_TEXTURE, new float[]{0, vMax, 16, 0});
|
||||
for (RawQuad bq:rawOut) {
|
||||
ret.add(bakeQuad(bq, baseTrans, baseNorm, bq.facing!=EnumFacing.EAST&&bq.facing!=EnumFacing.UP));//flip south and west
|
||||
for (RawQuad bq : rawOut) {
|
||||
ret.add(bakeQuad(bq, baseTrans, baseNorm, bq.facing != EnumFacing.EAST && bq.facing != EnumFacing.UP));//flip south and west
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -108,20 +112,19 @@ public final class PanelUtils {
|
|||
OBJModel.Normal faceNormal = new OBJModel.Normal(normal.x, normal.y, normal.z);
|
||||
putVertexData(format, builder, transform.apply(vertices[0]), faceNormal, uvs[0], uvs[1], raw.tex,
|
||||
raw.colorA);
|
||||
putVertexData(format, builder, transform.apply(vertices[1]), faceNormal, uvs[flip?2:0], uvs[flip?1:3], raw.tex,
|
||||
putVertexData(format, builder, transform.apply(vertices[1]), faceNormal, uvs[flip ? 2 : 0], uvs[flip ? 1 : 3], raw.tex,
|
||||
raw.colorA);
|
||||
putVertexData(format, builder, transform.apply(vertices[2]), faceNormal, uvs[2], uvs[3], raw.tex,
|
||||
raw.colorA);
|
||||
putVertexData(format, builder, transform.apply(vertices[3]), faceNormal, uvs[flip?0:2], uvs[flip?3:1], raw.tex,
|
||||
putVertexData(format, builder, transform.apply(vertices[3]), faceNormal, uvs[flip ? 0 : 2], uvs[flip ? 3 : 1], raw.tex,
|
||||
raw.colorA);
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
//mostly copied from IE's ClientUtils, it has protected access there...
|
||||
public static void putVertexData(VertexFormat format, UnpackedBakedQuad.Builder builder, Vector3f pos, OBJModel.Normal faceNormal, double u, double v, TextureAtlasSprite sprite, float[] colorA)
|
||||
{
|
||||
for(int e = 0; e < format.getElementCount(); e++)
|
||||
switch(format.getElement(e).getUsage())
|
||||
{
|
||||
public static void putVertexData(VertexFormat format, UnpackedBakedQuad.Builder builder, Vector3f pos, OBJModel.Normal faceNormal, double u, double v, TextureAtlasSprite sprite, float[] colorA) {
|
||||
for (int e = 0; e < format.getElementCount(); e++)
|
||||
switch (format.getElement(e).getUsage()) {
|
||||
case POSITION:
|
||||
builder.put(e, pos.getX(), pos.getY(), pos.getZ(), 0);
|
||||
break;
|
||||
|
@ -129,7 +132,7 @@ public final class PanelUtils {
|
|||
builder.put(e, colorA[0], colorA[1], colorA[2], colorA[3]);
|
||||
break;
|
||||
case UV:
|
||||
if(sprite == null)//Double Safety. I have no idea how it even happens, but it somehow did .-.
|
||||
if (sprite == null)//Double Safety. I have no idea how it even happens, but it somehow did .-.
|
||||
sprite = Minecraft.getMinecraft().getTextureMapBlocks().getMissingSprite();
|
||||
builder.put(e,
|
||||
sprite.getInterpolatedU(u),
|
||||
|
@ -143,36 +146,41 @@ public final class PanelUtils {
|
|||
builder.put(e);
|
||||
}
|
||||
}
|
||||
|
||||
private static final float[] UV_FULL = {0, 0, 16, 16};
|
||||
private static final float[] WHITE = {1, 1, 1, 1};
|
||||
|
||||
public static void addTexturedBox(Vector3f min, Vector3f size, List<RawQuad> out, float[] uvs, TextureAtlasSprite tex) {
|
||||
addBox(WHITE, WHITE, WHITE, min, size, out, true, uvs, tex);
|
||||
}
|
||||
|
||||
public static void addColoredBox(float[] colorTop, float[] colorSides, float[] colorBottom, Vector3f min, Vector3f size, List<RawQuad> out, boolean doBottom) {
|
||||
addBox(colorTop, colorSides, colorBottom, min, size, out, doBottom, UV_FULL, ModelLoader.White.INSTANCE);
|
||||
}
|
||||
|
||||
public static void addBox(float[] colorTop, float[] colorSides, float[] colorBottom, Vector3f min, Vector3f size, List<RawQuad> out, boolean doBottom, float[] uvs, TextureAtlasSprite tex) {
|
||||
addQuad(out, new Vector3f(min.x, min.y+size.y, min.z), new Vector3f(min.x, min.y+size.y, min.z+size.z),
|
||||
new Vector3f(min.x+size.x, min.y+size.y, min.z+size.z), new Vector3f(min.x+size.x, min.y+size.y, min.z),
|
||||
addQuad(out, new Vector3f(min.x, min.y + size.y, min.z), new Vector3f(min.x, min.y + size.y, min.z + size.z),
|
||||
new Vector3f(min.x + size.x, min.y + size.y, min.z + size.z), new Vector3f(min.x + size.x, min.y + size.y, min.z),
|
||||
EnumFacing.UP, colorTop, tex, uvs);
|
||||
if (doBottom) {
|
||||
addQuad(out, new Vector3f(min.x, min.y, min.z), new Vector3f(min.x+size.x, min.y, min.z),
|
||||
new Vector3f(min.x+size.x, min.y, min.z+size.z), new Vector3f(min.x, min.y, min.z+size.z),
|
||||
addQuad(out, new Vector3f(min.x, min.y, min.z), new Vector3f(min.x + size.x, min.y, min.z),
|
||||
new Vector3f(min.x + size.x, min.y, min.z + size.z), new Vector3f(min.x, min.y, min.z + size.z),
|
||||
EnumFacing.UP, colorBottom, tex, uvs);
|
||||
}
|
||||
addQuad(out, new Vector3f(min.x, min.y, min.z), new Vector3f(min.x, min.y, min.z+size.z),
|
||||
new Vector3f(min.x, min.y+size.y, min.z+size.z), new Vector3f(min.x, min.y+size.y, min.z),
|
||||
addQuad(out, new Vector3f(min.x, min.y, min.z), new Vector3f(min.x, min.y, min.z + size.z),
|
||||
new Vector3f(min.x, min.y + size.y, min.z + size.z), new Vector3f(min.x, min.y + size.y, min.z),
|
||||
EnumFacing.WEST, colorSides, tex, uvs);
|
||||
addQuad(out, new Vector3f(min.x+size.x, min.y, min.z), new Vector3f(min.x+size.x, min.y+size.y, min.z),
|
||||
new Vector3f(min.x+size.x, min.y+size.y, min.z+size.z), new Vector3f(min.x+size.x, min.y, min.z+size.z),
|
||||
addQuad(out, new Vector3f(min.x + size.x, min.y, min.z), new Vector3f(min.x + size.x, min.y + size.y, min.z),
|
||||
new Vector3f(min.x + size.x, min.y + size.y, min.z + size.z), new Vector3f(min.x + size.x, min.y, min.z + size.z),
|
||||
EnumFacing.EAST, colorSides, tex, uvs);
|
||||
addQuad(out, new Vector3f(min.x, min.y, min.z), new Vector3f(min.x, min.y+size.y, min.z),
|
||||
new Vector3f(min.x+size.x, min.y+size.y, min.z), new Vector3f(min.x+size.x, min.y, min.z),
|
||||
addQuad(out, new Vector3f(min.x, min.y, min.z), new Vector3f(min.x, min.y + size.y, min.z),
|
||||
new Vector3f(min.x + size.x, min.y + size.y, min.z), new Vector3f(min.x + size.x, min.y, min.z),
|
||||
EnumFacing.NORTH, colorSides, tex, uvs);
|
||||
addQuad(out, new Vector3f(min.x, min.y, min.z+size.z), new Vector3f(min.x+size.x, min.y, min.z+size.z),
|
||||
new Vector3f(min.x+size.x, min.y+size.y, min.z+size.z), new Vector3f(min.x, min.y+size.y, min.z+size.z),
|
||||
addQuad(out, new Vector3f(min.x, min.y, min.z + size.z), new Vector3f(min.x + size.x, min.y, min.z + size.z),
|
||||
new Vector3f(min.x + size.x, min.y + size.y, min.z + size.z), new Vector3f(min.x, min.y + size.y, min.z + size.z),
|
||||
EnumFacing.SOUTH, colorSides, tex, uvs);
|
||||
}
|
||||
|
||||
public static void addColoredQuad(List<RawQuad> out, Vector3f v0, Vector3f v1, Vector3f v2, Vector3f v3, EnumFacing dir, float[] color) {
|
||||
addQuad(out, v0, v1, v2, v3, dir, color, Minecraft.getMinecraft().getTextureMapBlocks().getTextureExtry(ModelLoader.White.LOCATION.toString()), UV_FULL);
|
||||
}
|
||||
|
@ -188,12 +196,12 @@ public final class PanelUtils {
|
|||
case 0: //button
|
||||
addCommonInfo(data, list, true, true);
|
||||
if (data.hasKey(LATCHING)) {
|
||||
list.add(I18n.format(IndustrialWires.MODID+".desc."+(data.getBoolean(LATCHING)?"latching":"instantaneous")));
|
||||
list.add(I18n.format(IndustrialWires.MODID + ".tooltip." + (data.getBoolean(LATCHING) ? "latching" : "instantaneous")));
|
||||
}
|
||||
break;
|
||||
case 1: //label
|
||||
if (data.hasKey(TEXT)) {
|
||||
list.add(I18n.format(IndustrialWires.MODID+".desc.text", data.getString(TEXT)));
|
||||
list.add(I18n.format(IndustrialWires.MODID + ".tooltip.text", data.getString(TEXT)));
|
||||
}
|
||||
addCommonInfo(data, list, true, false);
|
||||
break;
|
||||
|
@ -203,24 +211,44 @@ public final class PanelUtils {
|
|||
case 3: //slider
|
||||
addCommonInfo(data, list, true, true);
|
||||
if (data.hasKey(HORIZONTAL)) {
|
||||
list.add(I18n.format(IndustrialWires.MODID+".desc."+(data.getBoolean(HORIZONTAL)?"horizontal":"vertical")));
|
||||
list.add(I18n.format(IndustrialWires.MODID + ".tooltip." + (data.getBoolean(HORIZONTAL) ? "horizontal" : "vertical")));
|
||||
}
|
||||
if (data.hasKey(LENGTH)) {
|
||||
list.add(I18n.format(IndustrialWires.MODID + ".tooltip.length", data.getFloat(LENGTH)));
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public static void addCommonInfo(NBTTagCompound data, List<String> list, boolean color, boolean rs) {
|
||||
if (color&&data.hasKey(COLOR)) {
|
||||
String hexCol = String.format("%6s", Integer.toHexString(data.getInteger(COLOR))).replace(' ', '0');
|
||||
list.add(I18n.format(Lib.DESC_INFO+"colour", "<hexcol="+hexCol+":#"+hexCol+">"));
|
||||
if (color && data.hasKey(COLOR)) {
|
||||
String hexCol = String.format("%6s", Integer.toHexString(data.getInteger(COLOR)&0xffffff)).replace(' ', '0');
|
||||
list.add(I18n.format(Lib.DESC_INFO + "colour", "<hexcol=" + hexCol + ":#" + hexCol + ">"));
|
||||
}
|
||||
if (rs&&data.hasKey(RS_CHANNEL)) {
|
||||
if (rs && data.hasKey(RS_CHANNEL)) {
|
||||
EnumDyeColor channColor = EnumDyeColor.byMetadata(data.getInteger(RS_CHANNEL));
|
||||
String hexCol = Integer.toHexString(channColor.getMapColor().colorValue);
|
||||
list.add(I18n.format("desc.immersiveengineering.info.redstoneChannel", "<hexcol="+hexCol+":"+channColor.getUnlocalizedName()+">"));
|
||||
list.add(I18n.format("desc.immersiveengineering.info.redstoneChannel", "<hexcol=" + hexCol + ":" + channColor.getUnlocalizedName() + ">"));
|
||||
}
|
||||
if (rs&&data.hasKey(RS_ID)) {
|
||||
list.add(I18n.format(IndustrialWires.MODID+".desc.rsId", data.getInteger(RS_ID)));
|
||||
if (rs && data.hasKey(RS_ID)) {
|
||||
list.add(I18n.format(IndustrialWires.MODID + ".tooltip.rsId", data.getInteger(RS_ID)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static int setColor(int color, int id, NBTBase value) {
|
||||
id = 2-id;
|
||||
color &= ~(0xff << (8 * id));
|
||||
color |= (int) (2.55 * (((NBTTagFloat) value).getFloat())) << (8 * id);
|
||||
return color;
|
||||
}
|
||||
|
||||
public static float[] getFloatColor(boolean active, int color) {
|
||||
float[] ret = new float[4];
|
||||
ret[3] = 1;
|
||||
for (int i = 0; i < 3; i++) {
|
||||
ret[i] = ((color >> (8 * (2 - i))) & 255) / 255F * (active ? 1 : .5F);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
}
|
|
@ -18,11 +18,13 @@
|
|||
|
||||
package malte0811.industrialWires.controlpanel;
|
||||
|
||||
import malte0811.industrialWires.IndustrialWires;
|
||||
import malte0811.industrialWires.blocks.controlpanel.TileEntityPanel;
|
||||
import malte0811.industrialWires.client.RawQuad;
|
||||
import malte0811.industrialWires.client.gui.GuiPanelCreator;
|
||||
import net.minecraft.client.gui.Gui;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.nbt.*;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
@ -35,7 +37,7 @@ import java.util.List;
|
|||
import java.util.Set;
|
||||
import java.util.function.BiConsumer;
|
||||
|
||||
public class Slider extends PanelComponent {
|
||||
public class Slider extends PanelComponent implements IConfigurableComponent {
|
||||
private static final float WIDTH = .0625F;
|
||||
private float length = .5F;
|
||||
private int color = 0xffff00;
|
||||
|
@ -208,4 +210,91 @@ public class Slider extends PanelComponent {
|
|||
result = 31 * result + rsId;
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyConfigOption(ConfigType type, int id, NBTBase value) {
|
||||
switch (type) {
|
||||
case BOOL:
|
||||
horizontal = ((NBTTagByte)value).getByte()!=0;
|
||||
break;
|
||||
case RS_CHANNEL:
|
||||
rsChannel = ((NBTTagByte)value).getByte();
|
||||
break;
|
||||
case INT:
|
||||
rsId = ((NBTTagInt)value).getInt();
|
||||
break;
|
||||
case FLOAT:
|
||||
if (id<3) {
|
||||
color = PanelUtils.setColor(color, id, value);
|
||||
} else {
|
||||
length = ((NBTTagFloat)value).getFloat()/100;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String fomatConfigName(ConfigType type, int id) {
|
||||
switch (type) {
|
||||
case BOOL:
|
||||
return I18n.format(IndustrialWires.MODID+".tooltip.horizontal");
|
||||
case RS_CHANNEL:
|
||||
case INT:
|
||||
return null;
|
||||
case FLOAT:
|
||||
return I18n.format(IndustrialWires.MODID+".desc."+(id==0?"red":(id==1?"green":id==2?"blue":"length")));
|
||||
default:
|
||||
return "INVALID";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String fomatConfigDescription(ConfigType type, int id) {
|
||||
switch (type) {
|
||||
case BOOL:
|
||||
return null;
|
||||
case RS_CHANNEL:
|
||||
return I18n.format(IndustrialWires.MODID+".desc.rschannel_info");
|
||||
case INT:
|
||||
return I18n.format(IndustrialWires.MODID+".desc.rsid_info");
|
||||
case FLOAT:
|
||||
return null;
|
||||
default:
|
||||
return "INVALID?";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public RSChannelConfig[] getRSChannelOptions() {
|
||||
return new RSChannelConfig[] {
|
||||
new RSChannelConfig("channel", 0, 0, rsChannel)
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public IntConfig[] getIntegerOptions() {
|
||||
return new IntConfig[] {
|
||||
new IntConfig("rsId", 0, 50, rsId, 3, false)
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public BoolConfig[] getBooleanOptions() {
|
||||
return new BoolConfig[] {
|
||||
new BoolConfig("horizontal", 0, 70, horizontal)
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public FloatConfig[] getFloatOptions() {
|
||||
float[] color = PanelUtils.getFloatColor(true, this.color);
|
||||
int x = 70;
|
||||
int yOffset = 10;
|
||||
return new FloatConfig[]{
|
||||
new FloatConfig("red", x, yOffset+20, color[0], 60),
|
||||
new FloatConfig("green", x, yOffset+40, color[1], 60),
|
||||
new FloatConfig("blue", x, yOffset+60, color[2], 60),
|
||||
new FloatConfig("length", x, yOffset, length, 60)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -134,6 +134,7 @@ public class ItemPanelComponent extends Item {
|
|||
written.removeTag("x");
|
||||
written.removeTag("y");
|
||||
written.removeTag("type");
|
||||
written.removeTag("panelHeight");
|
||||
nbt.setTag("data", written);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,10 +18,11 @@
|
|||
|
||||
package malte0811.industrialWires.network;
|
||||
|
||||
import blusunrize.immersiveengineering.api.ApiUtils;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import malte0811.industrialWires.IndustrialWires;
|
||||
import malte0811.industrialWires.controlpanel.IConfigurableComponent;
|
||||
import malte0811.industrialWires.controlpanel.PanelComponent;
|
||||
import malte0811.industrialWires.controlpanel.properties.IConfigurableComponent;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
@ -80,7 +81,7 @@ public class MessageComponentSync implements IMessage {
|
|||
x.printStackTrace();
|
||||
}
|
||||
}
|
||||
ItemStack newCmp = IndustrialWires.panelComponent.stackFromComponent(old);
|
||||
ItemStack newCmp = ApiUtils.copyStackWithAmount(IndustrialWires.panelComponent.stackFromComponent(old), held.stackSize);
|
||||
player.setHeldItem(msg.hand, newCmp);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,16 +31,27 @@ item.industrialwires.panel_component.slider.name=Slider
|
|||
|
||||
industrialwires.desc.wireLength=Wire length: %1s block(s)
|
||||
industrialwires.desc.recipe=Please check the Engineer's manual for recipe details
|
||||
industrialwires.desc.horizontal=Horizontal
|
||||
industrialwires.desc.vertical=Vertical
|
||||
industrialwires.desc.rsId=Redstone Connector ID: %1s
|
||||
industrialwires.desc.text=Text: %1s
|
||||
industrialwires.desc.latching=Stays on indefinitely
|
||||
industrialwires.desc.instantaneous=Turns off after half a second
|
||||
industrialwires.desc.remove_all=Remove all components from this panel
|
||||
industrialwires.desc.create_panel=Create a new control panel
|
||||
industrialwires.desc.enable_snap=Snap new components to the 16*16 grid
|
||||
industrialwires.desc.disable_snap=Allow free placing of components
|
||||
industrialwires.desc.latching=Latching
|
||||
industrialwires.desc.latching_info=Does this button stay on indefinitely?
|
||||
industrialwires.desc.rschannel_info=The channel/color to output a signal to
|
||||
industrialwires.desc.rsid_info=The ID of the panel connector to output a signal to
|
||||
industrialwires.desc.label_text=The text in this label
|
||||
industrialwires.desc.red=Red
|
||||
industrialwires.desc.green=Green
|
||||
industrialwires.desc.blue=Blue
|
||||
industrialwires.desc.length=Length
|
||||
|
||||
industrialwires.tooltip.horizontal=Horizontal
|
||||
industrialwires.tooltip.vertical=Vertical
|
||||
industrialwires.tooltip.rsId=Redstone Connector ID: %1s
|
||||
industrialwires.tooltip.text=Text: %1s
|
||||
industrialwires.tooltip.latching=Stays on indefinitely
|
||||
industrialwires.tooltip.instantaneous=Turns off after half a second
|
||||
industrialwires.tooltip.length=Length: %1s
|
||||
|
||||
industrialwires.chat.tooLong=This coil does not contain enough wire for this connection
|
||||
industrialwires.chat.stackSize=Linking is only possible with a stack of size 1
|
||||
|
|
Loading…
Reference in a new issue