Fixed another goofy tab in SoundHandler. Should be all of them now.
Added initial stab at Configuration. Further refinement is necessary. Added initial stab at a float based, two value EMC system. Further refinement is highly likely.
This commit is contained in:
parent
aaa72c2946
commit
ff3f2ff7fd
|
@ -30,6 +30,6 @@ public class SoundHandler implements ISoundHandler {
|
|||
@Override public SoundPoolEntry onPlayBackgroundMusic(SoundManager soundManager, SoundPoolEntry entry) { return entry; }
|
||||
@Override public SoundPoolEntry onPlayStreaming(SoundManager soundManager, SoundPoolEntry entry, String soundName, float x, float y, float z) { return entry; }
|
||||
@Override public SoundPoolEntry onPlaySound(SoundManager soundManager, SoundPoolEntry entry, String soundName, float x, float y, float z, float volume, float pitch) { return entry; }
|
||||
@Override public SoundPoolEntry onPlaySoundEffect(SoundManager soundManager, SoundPoolEntry entry, String soundName, float volume, float pitch) { return entry; }
|
||||
@Override public SoundPoolEntry onPlaySoundEffect(SoundManager soundManager, SoundPoolEntry entry, String soundName, float volume, float pitch) { return entry; }
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,54 @@
|
|||
package net.minecraft.src.ee3.core;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
|
||||
import net.minecraft.src.mod_EE3;
|
||||
import net.minecraft.src.forge.Configuration;
|
||||
import net.minecraft.src.forge.Property;
|
||||
|
||||
public class ConfigurationManager {
|
||||
|
||||
private String cfgFile;
|
||||
private static final String CATEGORY_KEYBIND = "keybinds";
|
||||
|
||||
public ConfigurationManager(String cfgFile) {
|
||||
this.cfgFile = "config/ee3/" + cfgFile;
|
||||
}
|
||||
|
||||
public void init() {
|
||||
Configuration config;
|
||||
try {
|
||||
File configFile = new File(mod_EE3.proxy.getMinecraftDir(), cfgFile);
|
||||
config = new Configuration(configFile);
|
||||
config.load();
|
||||
}
|
||||
catch(Exception e) {
|
||||
config = null;
|
||||
}
|
||||
|
||||
if (config != null) {
|
||||
Property prop;
|
||||
|
||||
/* General Configs */
|
||||
prop = config.getOrCreateBooleanProperty("autoResolve", Configuration.CATEGORY_GENERAL, false);
|
||||
prop = config.getOrCreateBooleanProperty("enableSounds", Configuration.CATEGORY_GENERAL, true);
|
||||
|
||||
/* Block Ids */
|
||||
prop = config.getOrCreateBlockIdProperty("stone", 175);
|
||||
prop = config.getOrCreateBlockIdProperty("pedestal", 176);
|
||||
prop = config.getOrCreateBlockIdProperty("chest", 177);
|
||||
prop = config.getOrCreateBlockIdProperty("torch", 178);
|
||||
prop = config.getOrCreateBlockIdProperty("device", 179);
|
||||
|
||||
/* Keybinds */
|
||||
prop = config.getOrCreateIntProperty("key.extra", CATEGORY_KEYBIND, 46);
|
||||
prop = config.getOrCreateIntProperty("key.charge", CATEGORY_KEYBIND, 47);
|
||||
prop = config.getOrCreateIntProperty("key.toggle", CATEGORY_KEYBIND, 34);
|
||||
prop = config.getOrCreateIntProperty("key.release", CATEGORY_KEYBIND, 19);
|
||||
|
||||
/* Write */
|
||||
config.save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,34 +2,34 @@ package net.minecraft.src.ee3.core;
|
|||
|
||||
public class EMCMapping {
|
||||
|
||||
private int cost;
|
||||
private int recovery;
|
||||
private float cost;
|
||||
private float recovery;
|
||||
|
||||
public EMCMapping() { }
|
||||
|
||||
public EMCMapping(int cost) {
|
||||
public EMCMapping(float cost) {
|
||||
this.cost = cost;
|
||||
recovery = cost;
|
||||
}
|
||||
|
||||
public EMCMapping(int cost, int recovery) {
|
||||
public EMCMapping(float cost, float recovery) {
|
||||
this.cost = cost;
|
||||
this.recovery = recovery;
|
||||
}
|
||||
|
||||
public int getCostEMC() {
|
||||
public float getCostEMC() {
|
||||
return cost;
|
||||
}
|
||||
|
||||
public int getRecoveryEMC() {
|
||||
public float getRecoveryEMC() {
|
||||
return recovery;
|
||||
}
|
||||
|
||||
public void setCostEMC(int cost) {
|
||||
public void setCostEMC(float cost) {
|
||||
this.cost = cost;
|
||||
}
|
||||
|
||||
public void setRecoveryEMC(int recovery) {
|
||||
public void setRecoveryEMC(float recovery) {
|
||||
this.recovery = recovery;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import net.minecraft.src.ModLoader;
|
||||
import net.minecraft.src.ee3.core.ConfigurationManager;
|
||||
import net.minecraft.src.ee3.core.IProxy;
|
||||
import net.minecraft.src.ee3.core.ServerClientProxy;
|
||||
import net.minecraft.src.ee3.core.Version;
|
||||
|
@ -16,6 +17,7 @@ public class mod_EE3 extends NetworkMod {
|
|||
public static mod_EE3 instance;
|
||||
public static IProxy proxy;
|
||||
public static final String CHANNEL_NAME = "EE3";
|
||||
public static ConfigurationManager config = new ConfigurationManager("EE3.cfg");
|
||||
|
||||
public mod_EE3() {
|
||||
instance = this;
|
||||
|
@ -38,6 +40,9 @@ public class mod_EE3 extends NetworkMod {
|
|||
|
||||
// Bind Sound Handler
|
||||
this.proxy.registerSoundHandler();
|
||||
|
||||
// Initialise the configuration settings from file
|
||||
config.init();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue