Some (shaky) work on a configuration manager and a keybinding handler. Hopefully more tomorrow...
This commit is contained in:
parent
3d4fc7c885
commit
77cbbadb18
47
ee3_client/ee3/client/core/KeyBindingHandler.java
Normal file
47
ee3_client/ee3/client/core/KeyBindingHandler.java
Normal file
|
@ -0,0 +1,47 @@
|
|||
package ee3.client.core;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import net.minecraft.src.KeyBinding;
|
||||
import cpw.mods.fml.client.registry.KeyBindingRegistry;
|
||||
import cpw.mods.fml.common.Side;
|
||||
import cpw.mods.fml.common.TickType;
|
||||
import cpw.mods.fml.common.asm.SideOnly;
|
||||
|
||||
public class KeyBindingHandler extends KeyBindingRegistry.KeyHandler {
|
||||
|
||||
private static KeyBinding extra = new KeyBinding("ee3.mod.key.extra", Keyboard.KEY_C);
|
||||
private static KeyBinding[] keyBindings = {extra};
|
||||
private static boolean[] repeatings = {false};
|
||||
|
||||
public KeyBindingHandler() {
|
||||
super(keyBindings, repeatings);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLabel() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyDown(EnumSet<TickType> types, KeyBinding kb, boolean tickEnd, boolean isRepeat) {
|
||||
if (tickEnd) {
|
||||
System.out.println(types.toString());
|
||||
System.out.println(kb.keyDescription);
|
||||
System.out.println(tickEnd);
|
||||
System.out.println(isRepeat);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyUp(EnumSet<TickType> types, KeyBinding kb, boolean tickEnd) { }
|
||||
|
||||
@Override
|
||||
public EnumSet<TickType> ticks() {
|
||||
return EnumSet.of(TickType.CLIENT);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
package ee3;
|
||||
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.network.NetworkMod;
|
||||
import ee3.lib.Reference;
|
||||
import ee3.network.PacketHandler;
|
||||
|
||||
@Mod(modid = Reference.MOD_ID, name = Reference.MOD_NAME, version = Reference.VERSION)
|
||||
@NetworkMod(channels = { Reference.CHANNEL_NAME }, clientSideRequired = true, serverSideRequired = false, packetHandler = PacketHandler.class)
|
||||
public class EquivalentExchange3 {
|
||||
|
||||
}
|
45
ee3_common/ee3/common/EquivalentExchange3.java
Normal file
45
ee3_common/ee3/common/EquivalentExchange3.java
Normal file
|
@ -0,0 +1,45 @@
|
|||
package ee3.common;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import cpw.mods.fml.client.registry.KeyBindingRegistry;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.Mod.Init;
|
||||
import cpw.mods.fml.common.Mod.Instance;
|
||||
import cpw.mods.fml.common.Mod.PostInit;
|
||||
import cpw.mods.fml.common.Mod.PreInit;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import cpw.mods.fml.common.network.NetworkMod;
|
||||
import ee3.client.core.KeyBindingHandler;
|
||||
import ee3.common.core.ConfigurationManager;
|
||||
import ee3.common.lib.Reference;
|
||||
import ee3.common.network.PacketHandler;
|
||||
|
||||
@Mod(modid = Reference.MOD_ID, name = Reference.MOD_NAME, version = Reference.VERSION)
|
||||
@NetworkMod(channels = { Reference.CHANNEL_NAME }, clientSideRequired = true, serverSideRequired = false, packetHandler = PacketHandler.class)
|
||||
public class EquivalentExchange3 {
|
||||
|
||||
@Instance
|
||||
public static EquivalentExchange3 instance;
|
||||
|
||||
@PreInit
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
|
||||
// Initialize the configuration
|
||||
ConfigurationManager.init(event.getSuggestedConfigurationFile());
|
||||
|
||||
}
|
||||
|
||||
@Init
|
||||
public void load(FMLInitializationEvent event) {
|
||||
|
||||
// Initialize the KeyBinding handler
|
||||
KeyBindingRegistry.registerKeyBinding(new KeyBindingHandler());
|
||||
|
||||
}
|
||||
|
||||
@PostInit
|
||||
public void modsLoaded(FMLPostInitializationEvent event) { }
|
||||
}
|
56
ee3_common/ee3/common/core/ConfigurationManager.java
Normal file
56
ee3_common/ee3/common/core/ConfigurationManager.java
Normal file
|
@ -0,0 +1,56 @@
|
|||
package ee3.common.core;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import net.minecraftforge.common.Configuration;
|
||||
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
|
||||
import static net.minecraftforge.common.Configuration.*;
|
||||
|
||||
/**
|
||||
* TODO Class Description
|
||||
* @author pahimar
|
||||
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
|
||||
*
|
||||
*/
|
||||
public class ConfigurationManager {
|
||||
|
||||
private static final String CATEGORY_KEYBIND = "keybinds";
|
||||
|
||||
public static boolean AUTO_RESOLVE_IDS;
|
||||
public static boolean ENABLE_SOUNDS;
|
||||
public static boolean ENABLE_PARTICLES;
|
||||
|
||||
public static void init(File configFile) {
|
||||
Configuration configuration = new Configuration(configFile);
|
||||
|
||||
try {
|
||||
configuration.load();
|
||||
|
||||
/* General Configs */
|
||||
ENABLE_SOUNDS = configuration.getOrCreateBooleanProperty("enable_sounds", CATEGORY_GENERAL, true).getBoolean(false);
|
||||
ENABLE_PARTICLES = configuration.getOrCreateBooleanProperty("enable_particles", CATEGORY_GENERAL, true).getBoolean(false);
|
||||
|
||||
/* Block Configs */
|
||||
AUTO_RESOLVE_IDS = configuration.getOrCreateBooleanProperty("auto_resolve_ids", CATEGORY_BLOCK, false).getBoolean(false);
|
||||
|
||||
/* Item Configs */
|
||||
|
||||
/* Keybinding Configs */
|
||||
configuration.getOrCreateIntProperty("extra", CATEGORY_KEYBIND, Keyboard.KEY_C);
|
||||
configuration.getOrCreateIntProperty("charge", CATEGORY_KEYBIND, Keyboard.KEY_V);
|
||||
configuration.getOrCreateIntProperty("toggle", CATEGORY_KEYBIND, Keyboard.KEY_G);
|
||||
configuration.getOrCreateIntProperty("release", CATEGORY_KEYBIND, Keyboard.KEY_R);
|
||||
}
|
||||
catch (Exception e) {
|
||||
FMLLog.log(Level.SEVERE, e, "Equivalent Exchange 3 has had a problem loading its configuration");
|
||||
}
|
||||
finally {
|
||||
configuration.save();
|
||||
}
|
||||
}
|
||||
}
|
13
ee3_common/ee3/common/lib/BlockIds.java
Normal file
13
ee3_common/ee3/common/lib/BlockIds.java
Normal file
|
@ -0,0 +1,13 @@
|
|||
package ee3.common.lib;
|
||||
|
||||
/**
|
||||
* TODO Class Description
|
||||
* @author pahimar
|
||||
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
|
||||
*
|
||||
*/
|
||||
public class BlockIds {
|
||||
|
||||
public static int RED_WATER_STILL;
|
||||
|
||||
}
|
51
ee3_common/ee3/common/lib/CustomItemRarity.java
Normal file
51
ee3_common/ee3/common/lib/CustomItemRarity.java
Normal file
|
@ -0,0 +1,51 @@
|
|||
package ee3.common.lib;
|
||||
|
||||
/**
|
||||
* TODO Class Description
|
||||
* @author pahimar
|
||||
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
|
||||
*
|
||||
*/
|
||||
public class CustomItemRarity {
|
||||
|
||||
/**
|
||||
* Colour Value Guide
|
||||
*
|
||||
* 0 = Black
|
||||
* 1 = Dark Blue
|
||||
* 2 = Green
|
||||
* 3 = Cyan
|
||||
* 4 = Dark Red
|
||||
* 5 = Purple
|
||||
* 6 = Orange
|
||||
* 7 = Light Grey
|
||||
* 8 = Dark Grey
|
||||
* 9 = Blue
|
||||
* 10 = Light Green
|
||||
* 11 = Light Cyan
|
||||
* 12 = Light Red
|
||||
* 13 = Pink
|
||||
* 14 = Yellow
|
||||
* 15 = White
|
||||
*
|
||||
**/
|
||||
|
||||
public static final int COLOR_JUNK = 7;
|
||||
public static final int COLOR_NORMAL = 15;
|
||||
public static final int COLOR_MAGICAL = 9;
|
||||
public static final int COLOR_RARE = 14;
|
||||
public static final int COLOR_LEGENDARY = 6;
|
||||
|
||||
public static final String JUNK = "custom_junk";
|
||||
public static final String NORMAL = "custom_normal";
|
||||
public static final String MAGICAL = "custom_magical";
|
||||
public static final String RARE = "custom_rare";
|
||||
public static final String LEGENDARY = "custom_legendary";
|
||||
|
||||
public static final String DISPLAY_NAME_JUNK = "Junk";
|
||||
public static final String DISPLAY_NAME_NORMAL = "Normal";
|
||||
public static final String DISPLAY_NAME_MAGICAL = "Magical";
|
||||
public static final String DISPLAY_NAME_RARE = "Rare";
|
||||
public static final String DISPLAY_NAME_LEGENDARY = "Legendary";
|
||||
|
||||
}
|
15
ee3_common/ee3/common/lib/ItemIds.java
Normal file
15
ee3_common/ee3/common/lib/ItemIds.java
Normal file
|
@ -0,0 +1,15 @@
|
|||
package ee3.common.lib;
|
||||
|
||||
/**
|
||||
* TODO Class Description
|
||||
* @author pahimar
|
||||
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
|
||||
*
|
||||
*/
|
||||
public class ItemIds {
|
||||
|
||||
public static int MINIUM_SHARD;
|
||||
public static int MINIUM_STONE;
|
||||
public static int PHIL_STONE;
|
||||
|
||||
}
|
|
@ -1,9 +1,9 @@
|
|||
package ee3.lib;
|
||||
|
||||
public class Reference {
|
||||
|
||||
public static final String MOD_ID = "EE3";
|
||||
public static final String MOD_NAME = "Equivalent Exchange 3";
|
||||
public static final String VERSION = "1.0.0.0";
|
||||
public static final String CHANNEL_NAME = MOD_ID;
|
||||
}
|
||||
package ee3.common.lib;
|
||||
|
||||
public class Reference {
|
||||
|
||||
public static final String MOD_ID = "EE3";
|
||||
public static final String MOD_NAME = "Equivalent Exchange 3";
|
||||
public static final String VERSION = "1.0.0.0";
|
||||
public static final String CHANNEL_NAME = MOD_ID;
|
||||
}
|
|
@ -1,17 +1,17 @@
|
|||
package ee3.network;
|
||||
|
||||
import net.minecraft.src.NetworkManager;
|
||||
import net.minecraft.src.Packet250CustomPayload;
|
||||
import cpw.mods.fml.common.network.IPacketHandler;
|
||||
import cpw.mods.fml.common.network.Player;
|
||||
|
||||
public class PacketHandler implements IPacketHandler {
|
||||
|
||||
@Override
|
||||
public void onPacketData(NetworkManager manager,
|
||||
Packet250CustomPayload packet, Player player) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
package ee3.common.network;
|
||||
|
||||
import net.minecraft.src.NetworkManager;
|
||||
import net.minecraft.src.Packet250CustomPayload;
|
||||
import cpw.mods.fml.common.network.IPacketHandler;
|
||||
import cpw.mods.fml.common.network.Player;
|
||||
|
||||
public class PacketHandler implements IPacketHandler {
|
||||
|
||||
@Override
|
||||
public void onPacketData(NetworkManager manager,
|
||||
Packet250CustomPayload packet, Player player) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue