Some starter work on keybindings and config files

This commit is contained in:
Pahimar 2014-05-02 16:06:56 -04:00
parent 26d3a5dd11
commit 8ee4fa0147
6 changed files with 94 additions and 0 deletions

View file

@ -1,5 +1,6 @@
package com.pahimar.ee3;
import com.pahimar.ee3.configuration.ConfigurationHandler;
import com.pahimar.ee3.handler.CraftingHandler;
import com.pahimar.ee3.handler.FuelHandler;
import com.pahimar.ee3.handler.GuiHandler;
@ -23,6 +24,8 @@ import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.init.Items;
import net.minecraftforge.common.MinecraftForge;
import java.io.File;
@Mod(modid = Reference.MOD_ID, name = Reference.MOD_NAME, certificateFingerprint = Reference.FINGERPRINT, version = "0.2")
public class EquivalentExchange3
{
@ -47,6 +50,9 @@ public class EquivalentExchange3
@EventHandler
public void preInit(FMLPreInitializationEvent event)
{
// Initialize the configuration
ConfigurationHandler.init(event.getModConfigurationDirectory().getAbsolutePath() + File.separator + Reference.MOD_ID.toLowerCase() + File.separator);
// Initialize mod items
ModItems.init();

View file

@ -0,0 +1,20 @@
package com.pahimar.ee3.client.handler;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.InputEvent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class KeyInputEventHandler
{
@SubscribeEvent
public void handleKeyInputEvent(InputEvent.KeyInputEvent event)
{
if (FMLClientHandler.instance().getClient().inGameHasFocus)
{
}
}
}

View file

@ -0,0 +1,14 @@
package com.pahimar.ee3.client.settings;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.settings.KeyBinding;
@SideOnly(Side.CLIENT)
public class Keybindings
{
public static KeyBinding charge;
public static KeyBinding extra;
public static KeyBinding release;
public static KeyBinding toggle;
}

View file

@ -0,0 +1,34 @@
package com.pahimar.ee3.configuration;
import com.pahimar.ee3.reference.Reference;
import com.pahimar.ee3.util.LogHelper;
import net.minecraftforge.common.config.Configuration;
import java.io.File;
public class ClientConfiguration
{
public static final String CATEGORY_KEYBIND = "keybindings";
private static Configuration configuration;
protected static void init(File configFile)
{
configuration = new Configuration(configFile);
try
{
configuration.load();
/* KeyBindings */
configuration.addCustomCategoryComment(CATEGORY_KEYBIND, "Keybindings for Equivalent Exchange 3. See http://www.minecraftwiki.net/wiki/Key_codes for mapping of key codes to keyboard keys");
}
catch (Exception e)
{
LogHelper.error(Reference.MOD_NAME + " has had a problem loading its general configuration");
}
finally
{
configuration.save();
}
}
}

View file

@ -0,0 +1,11 @@
package com.pahimar.ee3.configuration;
import java.io.File;
public class ConfigurationHandler
{
public static void init(String configPath)
{
ClientConfiguration.init(new File(configPath + "client.properties"));
}
}

View file

@ -0,0 +1,9 @@
package com.pahimar.ee3.item;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
public interface IKeyBound
{
public abstract void doKeyBindingAction(EntityPlayer entityPlayer, ItemStack itemStack, String keyBinding);
}