Some rework on configs (where they are stored/etc)

This commit is contained in:
pahimar 2012-12-05 14:33:03 -05:00
parent d95ab7473a
commit 8b059dfd0c
8 changed files with 179 additions and 92 deletions

View file

@ -25,8 +25,12 @@ import static net.minecraftforge.common.Configuration.*;
*/
public class ConfigurationHandler {
private static final String CATEGORY_KEYBIND = "keybinds";
private static final String CATEGORY_KEYBIND = "keybindings";
private static final String CATEGORY_GRAPHICS = "graphics";
private static final String CATEGORY_TRANSMUTATION = "transmutation";
private static final String CATEGORY_BLOCK_PROPERTIES = Configuration.CATEGORY_BLOCK + Configuration.CATEGORY_SPLITTER + "properties";
private static final String CATEGORY_RED_WATER_PROPERTIES = CATEGORY_BLOCK_PROPERTIES + Configuration.CATEGORY_SPLITTER + "red_water";
private static final String CATEGORY_DURABILITY = Configuration.CATEGORY_ITEM + Configuration.CATEGORY_SPLITTER + "durability";
public static void init(File configFile) {
Configuration configuration = new Configuration(configFile);
@ -34,21 +38,15 @@ public class ConfigurationHandler {
try {
configuration.load();
/* General Configs */
/* General configs */
ConfigurationSettings.ENABLE_VERSION_CHECK = configuration
.get(CATEGORY_GENERAL, ConfigurationSettings.ENABLE_VERSION_CHECK_CONFIGNAME, ConfigurationSettings.ENABLE_VERSION_CHECK_DEFAULT)
.getBoolean(ConfigurationSettings.ENABLE_VERSION_CHECK_DEFAULT);
ConfigurationSettings.ENABLE_SOUNDS = configuration
.get(CATEGORY_GENERAL, ConfigurationSettings.ENABLE_SOUNDS_CONFIGNAME, ConfigurationSettings.ENABLE_SOUNDS_DEFAULT)
.getBoolean(ConfigurationSettings.ENABLE_SOUNDS_DEFAULT);
ConfigurationSettings.MINIUM_STONE_TRANSMUTE_COST = configuration
.get(CATEGORY_GENERAL, ConfigurationSettings.MINIUM_STONE_TRANSMUTE_COST_CONFIGNAME, ConfigurationSettings.MINIUM_STONE_TRANSMUTE_COST_DEFAULT)
.getInt(ConfigurationSettings.MINIUM_STONE_TRANSMUTE_COST_DEFAULT);
ConfigurationSettings.MINIUM_STONE_MAX_DURABILITY = configuration
.get(CATEGORY_GENERAL, ConfigurationSettings.MINIUM_STONE_MAX_DURABILITY_CONFIGNAME, ConfigurationSettings.MINIUM_STONE_MAX_DURABILITY_DEFAULT)
.getInt(ConfigurationSettings.MINIUM_STONE_MAX_DURABILITY_DEFAULT);
/* Graphics/Rendering Configs */
/* Graphic configs */
ConfigurationSettings.ENABLE_PARTICLE_FX = configuration
.get(CATEGORY_GRAPHICS, ConfigurationSettings.ENABLE_PARTICLE_FX_CONFIGNAME, ConfigurationSettings.ENABLE_PARTICLE_FX_DEFAULT)
.getBoolean(ConfigurationSettings.ENABLE_PARTICLE_FX_DEFAULT);
@ -56,10 +54,7 @@ public class ConfigurationHandler {
.get(CATEGORY_GRAPHICS, ConfigurationSettings.ENABLE_OVERLAY_WORLD_TRANSMUTATION_CONFIGNAME, ConfigurationSettings.ENABLE_OVERLAY_WORLD_TRANSMUTATION_DEFAULT)
.getBoolean(ConfigurationSettings.ENABLE_OVERLAY_WORLD_TRANSMUTATION_DEFAULT);
/* Block Configs */
ConfigurationSettings.AUTO_RESOLVE_BLOCK_IDS = configuration
.get(CATEGORY_BLOCK, ConfigurationSettings.AUTO_RESOLVE_BLOCK_IDS_CONFIGNAME, ConfigurationSettings.AUTO_RESOLVE_BLOCK_IDS_DEFAULT)
.getBoolean(ConfigurationSettings.AUTO_RESOLVE_BLOCK_IDS_DEFAULT);
/* Block configs */
BlockIds.CALCINATOR = configuration
.getBlock(Strings.CALCINATOR_NAME, BlockIds.CALCINATOR_DEFAULT)
.getInt(BlockIds.CALCINATOR_DEFAULT);
@ -67,7 +62,26 @@ public class ConfigurationHandler {
.getBlock(Strings.RED_WATER_STILL_NAME, BlockIds.RED_WATER_STILL_DEFAULT)
.getInt(BlockIds.RED_WATER_STILL_DEFAULT);
/* Item Configs */
/* Block property configs */
configuration.addCustomCategoryComment(CATEGORY_BLOCK_PROPERTIES, "Custom block properties");
/* Red Water configs */
configuration.addCustomCategoryComment(CATEGORY_RED_WATER_PROPERTIES, "Configuration settings for various properties of Red Water");
ConfigurationSettings.RED_WATER_DURATION_BASE = configuration
.get(CATEGORY_RED_WATER_PROPERTIES, ConfigurationSettings.RED_WATER_DURATION_BASE_CONFIGNAME, ConfigurationSettings.RED_WATER_DURATION_BASE_DEFAULT)
.getInt(ConfigurationSettings.RED_WATER_DURATION_BASE_DEFAULT);
ConfigurationSettings.RED_WATER_DURATION_MODIFIER = configuration
.get(CATEGORY_RED_WATER_PROPERTIES, ConfigurationSettings.RED_WATER_DURATION_MODIFIER_CONFIGNAME, ConfigurationSettings.RED_WATER_DURATION_MODIFIER_DEFAULT)
.getInt(ConfigurationSettings.RED_WATER_DURATION_MODIFIER_DEFAULT);
ConfigurationSettings.RED_WATER_RANGE_BASE = configuration
.get(CATEGORY_RED_WATER_PROPERTIES, ConfigurationSettings.RED_WATER_RANGE_BASE_CONFIGNAME, ConfigurationSettings.RED_WATER_RANGE_BASE_DEFAULT)
.getInt(ConfigurationSettings.RED_WATER_RANGE_BASE_DEFAULT);
ConfigurationSettings.RED_WATER_RANGE_MODIFIER = configuration
.get(CATEGORY_RED_WATER_PROPERTIES, ConfigurationSettings.RED_WATER_RANGE_MODIFIER_CONFIGNAME, ConfigurationSettings.RED_WATER_RANGE_MODIFIER_DEFAULT)
.getInt(ConfigurationSettings.RED_WATER_RANGE_MODIFIER_DEFAULT);
/* Item configs */
ItemIds.MINIUM_SHARD = configuration
.getItem(Strings.MINIUM_SHARD_NAME, ItemIds.MINIUM_SHARD_DEFAULT)
.getInt(ItemIds.MINIUM_SHARD_DEFAULT);
@ -87,20 +101,39 @@ public class ConfigurationHandler {
.getItem(Strings.ALCHEMY_BAG_NAME, ItemIds.ALCHEMY_BAG_DEFAULT)
.getInt(ItemIds.ALCHEMY_BAG_DEFAULT);
/* KeyBinding Configs */
configuration.addCustomCategoryComment(CATEGORY_KEYBIND, "");
EquivalentExchange3.proxy.setKeyBinding(Reference.KEYBINDING_EXTRA, configuration
.get(CATEGORY_KEYBIND, Reference.KEYBINDING_EXTRA, Reference.KEYBINDING_EXTRA_DEFAULT)
.getInt(Reference.KEYBINDING_EXTRA_DEFAULT));
EquivalentExchange3.proxy.setKeyBinding(Reference.KEYBINDING_CHARGE, configuration
.get(CATEGORY_KEYBIND, Reference.KEYBINDING_CHARGE, Reference.KEYBINDING_CHARGE_DEFAULT)
.getInt(Reference.KEYBINDING_CHARGE_DEFAULT));
EquivalentExchange3.proxy.setKeyBinding(Reference.KEYBINDING_TOGGLE, configuration
.get(CATEGORY_KEYBIND, Reference.KEYBINDING_TOGGLE, Reference.KEYBINDING_TOGGLE_DEFAULT)
.getInt(Reference.KEYBINDING_TOGGLE_DEFAULT));
EquivalentExchange3.proxy.setKeyBinding(Reference.KEYBINDING_RELEASE, configuration
.get(CATEGORY_KEYBIND, Reference.KEYBINDING_RELEASE, Reference.KEYBINDING_RELEASE_DEFAULT)
.getInt(Reference.KEYBINDING_RELEASE_DEFAULT));
/* Item durability configs */
ConfigurationSettings.MINIUM_STONE_MAX_DURABILITY = configuration
.get(CATEGORY_DURABILITY, ConfigurationSettings.MINIUM_STONE_MAX_DURABILITY_CONFIGNAME, ConfigurationSettings.MINIUM_STONE_MAX_DURABILITY_DEFAULT)
.getInt(ConfigurationSettings.MINIUM_STONE_MAX_DURABILITY_DEFAULT);
ConfigurationSettings.PHILOSOPHERS_STONE_MAX_DURABILITY = configuration
.get(CATEGORY_DURABILITY, ConfigurationSettings.PHILOSOPHERS_STONE_MAX_DURABILITY_CONFIGNAME, ConfigurationSettings.PHILOSOPHERS_STONE_MAX_DURABILITY_DEFAULT)
.getInt(ConfigurationSettings.PHILOSOPHERS_STONE_MAX_DURABILITY_DEFAULT);
/* KeyBinding configs */
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");
EquivalentExchange3.proxy.setKeyBinding(ConfigurationSettings.KEYBINDING_EXTRA, configuration
.get(CATEGORY_KEYBIND, ConfigurationSettings.KEYBINDING_EXTRA, ConfigurationSettings.KEYBINDING_EXTRA_DEFAULT)
.getInt(ConfigurationSettings.KEYBINDING_EXTRA_DEFAULT));
EquivalentExchange3.proxy.setKeyBinding(ConfigurationSettings.KEYBINDING_CHARGE, configuration
.get(CATEGORY_KEYBIND, ConfigurationSettings.KEYBINDING_CHARGE, ConfigurationSettings.KEYBINDING_CHARGE_DEFAULT)
.getInt(ConfigurationSettings.KEYBINDING_CHARGE_DEFAULT));
EquivalentExchange3.proxy.setKeyBinding(ConfigurationSettings.KEYBINDING_TOGGLE, configuration
.get(CATEGORY_KEYBIND, ConfigurationSettings.KEYBINDING_TOGGLE, ConfigurationSettings.KEYBINDING_TOGGLE_DEFAULT)
.getInt(ConfigurationSettings.KEYBINDING_TOGGLE_DEFAULT));
EquivalentExchange3.proxy.setKeyBinding(ConfigurationSettings.KEYBINDING_RELEASE, configuration
.get(CATEGORY_KEYBIND, ConfigurationSettings.KEYBINDING_RELEASE, ConfigurationSettings.KEYBINDING_RELEASE_DEFAULT)
.getInt(ConfigurationSettings.KEYBINDING_RELEASE_DEFAULT));
/* Transmutation configs */
ConfigurationSettings.TRANSMUTE_COST_ITEM = configuration
.get(CATEGORY_TRANSMUTATION, ConfigurationSettings.TRANSMUTE_COST_ITEM_CONFIGNAME, ConfigurationSettings.TRANSMUTE_COST_ITEM_DEFAULT)
.getInt(ConfigurationSettings.TRANSMUTE_COST_ITEM_DEFAULT);
ConfigurationSettings.TRANSMUTE_COST_BLOCK = configuration
.get(CATEGORY_TRANSMUTATION, ConfigurationSettings.TRANSMUTE_COST_BLOCK_CONFIGNAME, ConfigurationSettings.TRANSMUTE_COST_BLOCK_DEFAULT)
.getInt(ConfigurationSettings.TRANSMUTE_COST_BLOCK_DEFAULT);
ConfigurationSettings.TRANSMUTE_COST_MOB = configuration
.get(CATEGORY_TRANSMUTATION, ConfigurationSettings.TRANSMUTE_COST_MOB_CONFIGNAME, ConfigurationSettings.TRANSMUTE_COST_MOB_DEFAULT)
.getInt(ConfigurationSettings.TRANSMUTE_COST_MOB_DEFAULT);
}
catch (Exception e) {
FMLLog.log(Level.SEVERE, e, Reference.MOD_NAME + " has had a problem loading its configuration");

View file

@ -1,7 +1,7 @@
package ee3.common.core.helper;
import ee3.common.block.ModBlocks;
import ee3.common.lib.Reference;
import ee3.common.lib.ConfigurationSettings;
import net.minecraft.src.AxisAlignedBB;
import net.minecraft.src.Block;
import net.minecraft.src.EntityLiving;
@ -24,12 +24,12 @@ public class RedWaterHelper {
}
public static boolean isBlockInBB(World world, AxisAlignedBB par1AxisAlignedBB, Block block) {
int minX = MathHelper.floor_double(par1AxisAlignedBB.minX - Reference.BLOCK_RED_WATER_RANGE_BASE * Reference.BLOCK_RED_WATER_RANGE_MODIFIER * 1.0D);
int maxX = MathHelper.floor_double(par1AxisAlignedBB.maxX + Reference.BLOCK_RED_WATER_RANGE_BASE * Reference.BLOCK_RED_WATER_RANGE_MODIFIER * 1.0D);
int minY = MathHelper.floor_double(par1AxisAlignedBB.minY - Reference.BLOCK_RED_WATER_RANGE_BASE * Reference.BLOCK_RED_WATER_RANGE_MODIFIER * 1.0D);
int maxY = MathHelper.floor_double(par1AxisAlignedBB.maxY + Reference.BLOCK_RED_WATER_RANGE_BASE * Reference.BLOCK_RED_WATER_RANGE_MODIFIER * 1.0D);
int minZ = MathHelper.floor_double(par1AxisAlignedBB.minZ - Reference.BLOCK_RED_WATER_RANGE_BASE * Reference.BLOCK_RED_WATER_RANGE_MODIFIER * 1.0D);
int maxZ = MathHelper.floor_double(par1AxisAlignedBB.maxZ + Reference.BLOCK_RED_WATER_RANGE_BASE * Reference.BLOCK_RED_WATER_RANGE_MODIFIER * 1.0D);
int minX = MathHelper.floor_double(par1AxisAlignedBB.minX - ConfigurationSettings.RED_WATER_RANGE_BASE * ConfigurationSettings.RED_WATER_RANGE_MODIFIER * 1.0D);
int maxX = MathHelper.floor_double(par1AxisAlignedBB.maxX + ConfigurationSettings.RED_WATER_RANGE_BASE * ConfigurationSettings.RED_WATER_RANGE_MODIFIER * 1.0D);
int minY = MathHelper.floor_double(par1AxisAlignedBB.minY - ConfigurationSettings.RED_WATER_RANGE_BASE * ConfigurationSettings.RED_WATER_RANGE_MODIFIER * 1.0D);
int maxY = MathHelper.floor_double(par1AxisAlignedBB.maxY + ConfigurationSettings.RED_WATER_RANGE_BASE * ConfigurationSettings.RED_WATER_RANGE_MODIFIER * 1.0D);
int minZ = MathHelper.floor_double(par1AxisAlignedBB.minZ - ConfigurationSettings.RED_WATER_RANGE_BASE * ConfigurationSettings.RED_WATER_RANGE_MODIFIER * 1.0D);
int maxZ = MathHelper.floor_double(par1AxisAlignedBB.maxZ + ConfigurationSettings.RED_WATER_RANGE_BASE * ConfigurationSettings.RED_WATER_RANGE_MODIFIER * 1.0D);
for (int i = minX; i < maxX; ++i) {
for (int j = minY; j < maxY; ++j) {

View file

@ -93,7 +93,7 @@ public class ItemMiniumStone extends ItemEE
@Override
public void doKeyBindingAction(EntityPlayer thePlayer, ItemStack itemStack, String keyBinding) {
if (keyBinding.equals(Reference.KEYBINDING_EXTRA)) {
if (keyBinding.equals(ConfigurationSettings.KEYBINDING_EXTRA)) {
openPortableCrafting(thePlayer);
}

View file

@ -7,6 +7,7 @@ import cpw.mods.fml.common.network.PacketDispatcher;
import ee3.common.EquivalentExchange3;
import ee3.common.core.helper.NBTHelper;
import ee3.common.core.helper.TransmutationHelper;
import ee3.common.lib.ConfigurationSettings;
import ee3.common.lib.CustomItemRarity;
import ee3.common.lib.GuiIds;
import ee3.common.lib.Reference;
@ -39,6 +40,7 @@ public class ItemPhilosopherStone extends ItemEE
this.setIconCoord(2, 0);
this.setItemName(Strings.PHILOSOPHER_STONE_NAME);
this.setCreativeTab(EquivalentExchange3.tabsEE3);
this.setMaxDamage(ConfigurationSettings.PHILOSOPHERS_STONE_MAX_DURABILITY - 1);
this.maxChargeLevel = 3;
}
@ -66,10 +68,24 @@ public class ItemPhilosopherStone extends ItemEE
return true;
}
@Override
public ItemStack getContainerItemStack(ItemStack itemStack) {
itemStack.setItemDamage(itemStack.getItemDamage() + 1);
return itemStack;
}
@Override
public boolean onItemUse(ItemStack itemStack, EntityPlayer entityPlayer, World world, int x, int y, int z, int l, float f1, float f2, float f3) {
return TransmutationHelper.transmuteInWorld(world, entityPlayer, itemStack, x, y, z);
boolean result = TransmutationHelper.transmuteInWorld(world, entityPlayer, itemStack, x, y, z);
if (result) {
itemStack.damageItem(1, entityPlayer);
}
return result;
}
@Override
@ -81,40 +97,40 @@ public class ItemPhilosopherStone extends ItemEE
@Override
public short getCharge(ItemStack stack) {
return NBTHelper.getShort(stack, Strings.NBT_CHARGE_LEVEL_KEY);
return NBTHelper.getShort(stack, Strings.NBT_ITEM_CHARGE_LEVEL_KEY);
}
@Override
public void setCharge(ItemStack stack, short charge) {
if (charge <= maxChargeLevel) {
NBTHelper.setShort(stack, Strings.NBT_CHARGE_LEVEL_KEY, charge);
NBTHelper.setShort(stack, Strings.NBT_ITEM_CHARGE_LEVEL_KEY, charge);
}
}
@Override
public void increaseCharge(ItemStack stack) {
if (NBTHelper.getShort(stack, Strings.NBT_CHARGE_LEVEL_KEY) < maxChargeLevel) {
NBTHelper.setShort(stack, Strings.NBT_CHARGE_LEVEL_KEY, (short) (NBTHelper.getShort(stack, Strings.NBT_CHARGE_LEVEL_KEY) + 1));
if (NBTHelper.getShort(stack, Strings.NBT_ITEM_CHARGE_LEVEL_KEY) < maxChargeLevel) {
NBTHelper.setShort(stack, Strings.NBT_ITEM_CHARGE_LEVEL_KEY, (short) (NBTHelper.getShort(stack, Strings.NBT_ITEM_CHARGE_LEVEL_KEY) + 1));
}
}
@Override
public void decreaseCharge(ItemStack stack) {
if (NBTHelper.getShort(stack, Strings.NBT_CHARGE_LEVEL_KEY) > 0) {
NBTHelper.setShort(stack, Strings.NBT_CHARGE_LEVEL_KEY, (short) (NBTHelper.getShort(stack, Strings.NBT_CHARGE_LEVEL_KEY) - 1));
if (NBTHelper.getShort(stack, Strings.NBT_ITEM_CHARGE_LEVEL_KEY) > 0) {
NBTHelper.setShort(stack, Strings.NBT_ITEM_CHARGE_LEVEL_KEY, (short) (NBTHelper.getShort(stack, Strings.NBT_ITEM_CHARGE_LEVEL_KEY) - 1));
}
}
@Override
public void doKeyBindingAction(EntityPlayer thePlayer, ItemStack itemStack, String keyBinding) {
if (keyBinding.equals(Reference.KEYBINDING_EXTRA)) {
if (keyBinding.equals(ConfigurationSettings.KEYBINDING_EXTRA)) {
openPortableCrafting(thePlayer);
}
else if (keyBinding.equals(Reference.KEYBINDING_CHARGE)) {
else if (keyBinding.equals(ConfigurationSettings.KEYBINDING_CHARGE)) {
if (!thePlayer.isSneaking()) {
increaseCharge(itemStack);
thePlayer.worldObj.playSoundAtEntity(thePlayer, Sounds.CHARGE_UP, 0.5F, 0.5F + (0.5F * (getCharge(itemStack) * 1.0F / maxChargeLevel)));

View file

@ -1,5 +1,6 @@
package ee3.common.lib;
import net.minecraftforge.common.Configuration;
import ee3.common.item.ModItems;
/**
@ -16,49 +17,96 @@ public class ConfigurationSettings {
/*
* General configuration settings
*/
// Whether or not automatic block id resolution for EE3 is turned on or off
public static boolean AUTO_RESOLVE_BLOCK_IDS;
public static final String ENABLE_VERSION_CHECK_CONFIGNAME = "enable_version_check";
public static final boolean AUTO_RESOLVE_BLOCK_IDS_DEFAULT = false;
// Whether or not EE3 sounds are enabled
public static boolean ENABLE_SOUNDS;
public static final String ENABLE_SOUNDS_CONFIGNAME = "enable_sounds";
public static final String ENABLE_SOUNDS_CONFIGNAME = "sounds.enabled";
public static final boolean ENABLE_SOUNDS_DEFAULT = true;
// Whether or not EE3 will do a version check when loaded
public static boolean ENABLE_VERSION_CHECK;
public static final String AUTO_RESOLVE_BLOCK_IDS_CONFIGNAME = "auto_resolve_block_ids";
public static final String ENABLE_VERSION_CHECK_CONFIGNAME = "version_check.enabled";
public static final boolean ENABLE_VERSION_CHECK_DEFAULT = true;
/*
* Render config settings
* Graphic config settings
*/
// Whether or not EE3 particle fx are enabled
public static boolean ENABLE_PARTICLE_FX;
public static final String ENABLE_PARTICLE_FX_CONFIGNAME = "enable_particle_fx";
public static final String ENABLE_PARTICLE_FX_CONFIGNAME = "particle_fx.enabled";
public static final boolean ENABLE_PARTICLE_FX_DEFAULT = true;
// Whether or not the in world transmutation overlay is enabled
public static boolean ENABLE_OVERLAY_WORLD_TRANSMUTATION;
public static final String ENABLE_OVERLAY_WORLD_TRANSMUTATION_CONFIGNAME = "enable_world_transmutation_overlay";
public static final String ENABLE_OVERLAY_WORLD_TRANSMUTATION_CONFIGNAME = "world_transmutation_overlay.enabled";
public static final boolean ENABLE_OVERLAY_WORLD_TRANSMUTATION_DEFAULT = true;
/*
* Minium stone config settings
* Block related config settings
*/
// The durability cost for each transmute with the Minium Stone
public static int MINIUM_STONE_TRANSMUTE_COST;
public static final String MINIUM_STONE_TRANSMUTE_COST_CONFIGNAME = Strings.MINIUM_STONE_NAME + ".transmuteCost";
public static final int MINIUM_STONE_TRANSMUTE_COST_DEFAULT = 1;
public static int RED_WATER_DURATION_BASE;
public static String RED_WATER_DURATION_BASE_CONFIGNAME = "duration.base";
public static final int RED_WATER_DURATION_BASE_DEFAULT = 5;
public static int RED_WATER_DURATION_MODIFIER;
public static String RED_WATER_DURATION_MODIFIER_CONFIGNAME = "duration.modifier";
public static final int RED_WATER_DURATION_MODIFIER_DEFAULT = 2;
public static int RED_WATER_RANGE_BASE;
public static String RED_WATER_RANGE_BASE_CONFIGNAME = "range.base";
public static final int RED_WATER_RANGE_BASE_DEFAULT = 1;
public static int RED_WATER_RANGE_MODIFIER;
public static String RED_WATER_RANGE_MODIFIER_CONFIGNAME = "range.modifier";
public static final int RED_WATER_RANGE_MODIFIER_DEFAULT = 3;
/*
* Item related config settings
*/
// The maximum durability for the Minium Stone
public static int MINIUM_STONE_MAX_DURABILITY;
public static final String MINIUM_STONE_MAX_DURABILITY_CONFIGNAME = Strings.MINIUM_STONE_NAME + ".maxDurability";
public static final String MINIUM_STONE_MAX_DURABILITY_CONFIGNAME = Strings.MINIUM_STONE_NAME;
public static final int MINIUM_STONE_MAX_DURABILITY_DEFAULT = 1521;
// The maximum durability for the Philosophers Stone
public static int PHILOSOPHERS_STONE_MAX_DURABILITY;
public static final String PHILOSOPHERS_STONE_MAX_DURABILITY_CONFIGNAME = Strings.PHILOSOPHER_STONE_NAME + ".maxDurability";
public static final String PHILOSOPHERS_STONE_MAX_DURABILITY_CONFIGNAME = Strings.PHILOSOPHER_STONE_NAME;
public static final int PHILOSOPHERS_STONE_MAX_DURABILITY_DEFAULT = 10001;
/*
* Keybinding related config settings
*/
// Extra key
public static final String KEYBINDING_EXTRA = "key.extra";
public static final int KEYBINDING_EXTRA_DEFAULT = 46;
// Release key
public static final String KEYBINDING_RELEASE = "key.release";
public static final int KEYBINDING_RELEASE_DEFAULT = 19;
// Toggle key
public static final String KEYBINDING_TOGGLE = "key.toggle";
public static final int KEYBINDING_TOGGLE_DEFAULT = 34;
// Charge key
public static final String KEYBINDING_CHARGE = "key.charge";
public static final int KEYBINDING_CHARGE_DEFAULT = 47;
/*
* Transmutation related config settings
*/
// The durability cost for each item transmutation
public static int TRANSMUTE_COST_ITEM;
public static final String TRANSMUTE_COST_ITEM_CONFIGNAME = Strings.TRANSMUTATION_COST_ITEM;
public static final int TRANSMUTE_COST_ITEM_DEFAULT = 1;
// The durability cost for each block transmutation
public static int TRANSMUTE_COST_BLOCK;
public static final String TRANSMUTE_COST_BLOCK_CONFIGNAME = Strings.TRANSMUTATION_COST_BLOCK;
public static final int TRANSMUTE_COST_BLOCK_DEFAULT = 1;
// The durability cost for each block transmutation
public static int TRANSMUTE_COST_MOB;
public static final String TRANSMUTE_COST_MOB_CONFIGNAME = Strings.TRANSMUTATION_COST_MOB;
public static final int TRANSMUTE_COST_MOB_DEFAULT = 1;
}

View file

@ -24,25 +24,4 @@ public class Reference {
public static final String SERVER_PROXY_CLASS = "ee3.common.core.CommonProxy";
public static final String CLIENT_PROXY_CLASS = "ee3.client.core.ClientProxy";
/* KeyBinding related constants */
public static final String KEYBINDING_EXTRA = "key.extra";
public static final int KEYBINDING_EXTRA_DEFAULT = 46;
public static final String KEYBINDING_RELEASE = "key.release";
public static final int KEYBINDING_RELEASE_DEFAULT = 19;
public static final String KEYBINDING_TOGGLE = "key.toggle";
public static final int KEYBINDING_TOGGLE_DEFAULT = 34;
public static final String KEYBINDING_CHARGE = "key.charge";
public static final int KEYBINDING_CHARGE_DEFAULT = 47;
/* General Tile Entity related constants */
public static final String TE_GEN_OWNER_NBT_TAG_LABEL = "owner";
public static final String TE_GEN_STATE_NBT_TAG_LABEL = "state";
public static final String TE_GEN_DIRECTION_NBT_TAG_LABEL = "direction";
// TODO: Find a better spot for these
public static final int BLOCK_RED_WATER_EFFECT_DURATION_BASE = 5;
public static final int BLOCK_RED_WATER_EFFECT_DURATION_MODIFIER = 2;
public static final int BLOCK_RED_WATER_RANGE_BASE = 1;
public static final int BLOCK_RED_WATER_RANGE_MODIFIER = 3;
}

View file

@ -2,7 +2,7 @@ package ee3.common.lib;
public class Strings {
/* General text keys */
/* General keys */
/* Version check related constants */
public static final String VERSION_CHECK_DISABLED = "version.check_disabled";
@ -16,7 +16,11 @@ public class Strings {
public static final String GUI_CALCINATOR_NAME = "gui.calcinator.name";
/* NBT related constants */
public static final String NBT_CHARGE_LEVEL_KEY = "chargeLevel";
public static final String NBT_ITEM_CHARGE_LEVEL_KEY = "itemChargeLevel";
public static final String NBT_ITEM_MODE_KEY = "itemMode";
public static final String NBT_TE_OWNER_KEY = "teOwner";
public static final String NBT_TE_STATE_KEY = "teState";
public static final String NBT_TE_DIRECTION_KEY = "teDirection";
/* Block name constants */
public static final String CALCINATOR_NAME = "calcinator";
@ -34,4 +38,10 @@ public class Strings {
/* TileEntity name constants */
public static final String TE_CALCINATOR_NAME = "tileCalcinator";
/* Transmutation cost related constants */
public static final String TRANSMUTATION_COST = "_cost";
public static final String TRANSMUTATION_COST_ITEM = "item" + TRANSMUTATION_COST;
public static final String TRANSMUTATION_COST_BLOCK = "block" + TRANSMUTATION_COST;
public static final String TRANSMUTATION_COST_MOB = "mob" + TRANSMUTATION_COST;
}

View file

@ -1,6 +1,7 @@
package ee3.common.tile;
import ee3.common.lib.Reference;
import ee3.common.lib.Strings;
import net.minecraft.src.EntityPlayer;
import net.minecraft.src.NBTTagCompound;
import net.minecraft.src.TileEntity;
@ -51,18 +52,18 @@ public class TileEE extends TileEntity {
public void readFromNBT(NBTTagCompound nbtTagCompound) {
super.readFromNBT(nbtTagCompound);
direction = nbtTagCompound.getByte(Reference.TE_GEN_DIRECTION_NBT_TAG_LABEL);
state = nbtTagCompound.getShort(Reference.TE_GEN_STATE_NBT_TAG_LABEL);
owner = nbtTagCompound.getString(Reference.TE_GEN_OWNER_NBT_TAG_LABEL);
direction = nbtTagCompound.getByte(Strings.NBT_TE_DIRECTION_KEY);
state = nbtTagCompound.getShort(Strings.NBT_TE_STATE_KEY);
owner = nbtTagCompound.getString(Strings.NBT_TE_OWNER_KEY);
}
public void writeToNBT(NBTTagCompound nbtTagCompound) {
super.writeToNBT(nbtTagCompound);
nbtTagCompound.setByte(Reference.TE_GEN_DIRECTION_NBT_TAG_LABEL, direction);
nbtTagCompound.setShort(Reference.TE_GEN_STATE_NBT_TAG_LABEL, state);
nbtTagCompound.setByte(Strings.NBT_TE_DIRECTION_KEY, direction);
nbtTagCompound.setShort(Strings.NBT_TE_STATE_KEY, state);
if(owner != null && owner != "") {
nbtTagCompound.setString(Reference.TE_GEN_OWNER_NBT_TAG_LABEL, owner);
nbtTagCompound.setString(Strings.NBT_TE_OWNER_KEY, owner);
}
}