IndustrialWires/src/main/java/malte0811/industrialWires/controlpanel/IConfigurableComponent.java
malte0811 0c52514b15 Glowing components like the indicator light actuall glow in the dark now
Some bugfixes
Complete code reformatting

(Cherry-picked)

# Conflicts:
#	src/main/java/malte0811/industrialWires/IndustrialWires.java
#	src/main/java/malte0811/industrialWires/blocks/BlockIWBase.java
#	src/main/java/malte0811/industrialWires/blocks/EnergyAdapter.java
#	src/main/java/malte0811/industrialWires/blocks/ItemBlockIW.java
#	src/main/java/malte0811/industrialWires/blocks/TileEntityJacobsLadder.java
#	src/main/java/malte0811/industrialWires/blocks/controlpanel/BlockPanel.java
#	src/main/java/malte0811/industrialWires/blocks/controlpanel/TileEntityPanel.java
#	src/main/java/malte0811/industrialWires/blocks/controlpanel/TileEntityPanelCreator.java
#	src/main/java/malte0811/industrialWires/blocks/controlpanel/TileEntityRSPanelConn.java
#	src/main/java/malte0811/industrialWires/blocks/converter/BlockMechanicalConverter.java
#	src/main/java/malte0811/industrialWires/blocks/converter/TileEntityIEMotor.java
#	src/main/java/malte0811/industrialWires/blocks/converter/TileEntityMechICtoIE.java
#	src/main/java/malte0811/industrialWires/blocks/converter/TileEntityMechIEtoIC.java
#	src/main/java/malte0811/industrialWires/blocks/wire/BlockIC2Connector.java
#	src/main/java/malte0811/industrialWires/blocks/wire/TileEntityIC2ConnectorTin.java
#	src/main/java/malte0811/industrialWires/client/ClientEventHandler.java
#	src/main/java/malte0811/industrialWires/client/gui/GuiPanelComponent.java
#	src/main/java/malte0811/industrialWires/client/gui/GuiPanelCreator.java
#	src/main/java/malte0811/industrialWires/client/gui/elements/GuiIntChooser.java
#	src/main/java/malte0811/industrialWires/containers/ContainerPanelCreator.java
#	src/main/java/malte0811/industrialWires/containers/ContainerRSPanelConn.java
#	src/main/java/malte0811/industrialWires/controlpanel/CoveredToggleSwitch.java
#	src/main/java/malte0811/industrialWires/controlpanel/LightedButton.java
#	src/main/java/malte0811/industrialWires/controlpanel/PanelComponent.java
#	src/main/java/malte0811/industrialWires/controlpanel/PanelUtils.java
#	src/main/java/malte0811/industrialWires/controlpanel/Slider.java
#	src/main/java/malte0811/industrialWires/crafting/RecipeCoilLength.java
#	src/main/java/malte0811/industrialWires/items/ItemIC2Coil.java
#	src/main/java/malte0811/industrialWires/items/ItemPanelComponent.java
#	src/main/java/malte0811/industrialWires/network/MessageGUIInteract.java
#	src/main/java/malte0811/industrialWires/network/MessagePanelInteract.java
#	src/main/java/malte0811/industrialWires/util/MiscUtils.java
2017-05-26 13:11:15 +02:00

126 lines
3.2 KiB
Java

/*
* 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;
import javax.annotation.Nullable;
//Based on IConfigurableTool in the IE API
public interface IConfigurableComponent {
/**
* Apply and store the config option on the given stack
*/
void applyConfigOption(ConfigType type, int id, NBTBase value);
/**
* @return a TRANSLATED name for the config option. Try to keep this short.
*/
@Nullable
String fomatConfigName(ConfigType type, int id);
/**
* @return a TRANSLATED name for the config option, displayed when hovering over it
*/
@Nullable
String fomatConfigDescription(ConfigType type, int id);
default StringConfig[] getStringOptions() {
return new StringConfig[0];
}
default RSChannelConfig[] getRSChannelOptions() {
return new RSChannelConfig[0];
}
default IntConfig[] getIntegerOptions() {
return new IntConfig[0];
}
default BoolConfig[] getBooleanOptions() {
return new BoolConfig[0];
}
default FloatConfig[] getFloatOptions() {
return new FloatConfig[0];
}
class UniversalConfig<T> extends ToolConfig {
public T value;
protected UniversalConfig(String name, int x, int y, T value) {
super(name, x, y);
this.value = value;
}
}
class BoolConfig extends UniversalConfig<Boolean> {
public BoolConfig(String name, int x, int y, Boolean value) {
super(name, x, y, value);
}
}
class StringConfig extends UniversalConfig<String> {
public StringConfig(String name, int x, int y, String value) {
super(name, x, y, value);
}
}
class RSChannelConfig extends UniversalConfig<Byte> {
public boolean small;
public RSChannelConfig(String name, int x, int y, Byte value) {
this(name, x, y, value, false);
}
public RSChannelConfig(String name, int x, int y, Byte value, boolean small) {
super(name, x, y, value);
this.small = small;
}
}
class IntConfig extends UniversalConfig<Integer> {
public int digits;
public boolean allowNegative;
public IntConfig(String name, int x, int y, Integer value, int digits, boolean allowNegative) {
super(name, x, y, value);
this.digits = digits;
this.allowNegative = allowNegative;
}
}
class FloatConfig extends UniversalConfig<Float> {
public int width;
public FloatConfig(String name, int x, int y, Float value, int width) {
super(name, x, y, value);
this.width = width;
}
}
enum ConfigType {
BOOL,
STRING,
RS_CHANNEL,
INT,
FLOAT;
}
}