Set API version to a build property, and add in some prelim logging of what mods set what values when in the energy value registry

This commit is contained in:
Pahimar 2015-05-07 14:47:54 -04:00
parent a46b8db610
commit a653c47a72
14 changed files with 82 additions and 12 deletions

View File

@ -50,10 +50,31 @@ minecraft {
version = config.minecraft_version + "-" + config.forge_version
replaceIn "reference/Reference.java"
replace "@VERSION@", "${config.mod_version}.${System.getenv("BUILD_NUMBER") ?: 0}"
replace "@MOD_VERSION@", "${config.mod_version}.${System.getenv("BUILD_NUMBER") ?: 0}"
if (project.hasProperty("ee3_sha1_signature")) {
replace "@FINGERPRINT@", project.ee3_sha1_signature
}
replaceIn "api/package-info.java"
replace "@API_VERSION@", config.api_version
replaceIn "api/array/package-info.java"
replace "@API_VERSION@", config.api_version
replaceIn "api/event/package-info.java"
replace "@API_VERSION@", config.api_version
replaceIn "api/exchange/package-info.java"
replace "@API_VERSION@", config.api_version
replaceIn "api/knowledge/package-info.java"
replace "@API_VERSION@", config.api_version
replaceIn "api/recipe/package-info.java"
replace "@API_VERSION@", config.api_version
replaceIn "api/util/package-info.java"
replace "@API_VERSION@", config.api_version
}
version = "${config.minecraft_version}-${config.mod_version}.${System.getenv("BUILD_NUMBER") ?: 0}"

View File

@ -3,4 +3,5 @@
minecraft_version = 1.7.10
forge_version = 10.13.3.1399-1.7.10
mod_version = 0.3
api_version = 1.2
release_type = beta

View File

@ -30,7 +30,7 @@ import cpw.mods.fml.common.registry.GameRegistry;
import java.io.File;
@Mod(modid = Reference.MOD_ID, name = Reference.MOD_NAME, certificateFingerprint = Reference.FINGERPRINT, version = Reference.VERSION, dependencies = Reference.DEPENDENCIES, guiFactory = Reference.GUI_FACTORY_CLASS)
@Mod(modid = Reference.MOD_ID, name = Reference.MOD_NAME, certificateFingerprint = Reference.FINGERPRINT, version = Reference.MOD_VERSION, dependencies = Reference.DEPENDENCIES, guiFactory = Reference.GUI_FACTORY_CLASS)
public class EquivalentExchange3
{
@Instance(Reference.MOD_ID)

View File

@ -1,3 +1,3 @@
@API(owner = "EE3", apiVersion = "1.2", provides = "EE3-API|array") package com.pahimar.ee3.api.array;
@API(owner = "EE3", apiVersion = "@API_VERSION@", provides = "EE3-API|array") package com.pahimar.ee3.api.array;
import cpw.mods.fml.common.API;

View File

@ -1,3 +1,3 @@
@API(owner = "EE3", apiVersion = "1.2", provides = "EE3-API|event") package com.pahimar.ee3.api.event;
@API(owner = "EE3", apiVersion = "@API_VERSION@", provides = "EE3-API|event") package com.pahimar.ee3.api.event;
import cpw.mods.fml.common.API;

View File

@ -1,3 +1,3 @@
@API(owner = "EE3", apiVersion = "1.2", provides = "EE3-API|exchange") package com.pahimar.ee3.api.exchange;
@API(owner = "EE3", apiVersion = "@API_VERSION@", provides = "EE3-API|exchange") package com.pahimar.ee3.api.exchange;
import cpw.mods.fml.common.API;

View File

@ -1,3 +1,3 @@
@API(owner = "EE3", apiVersion = "1.2", provides = "EE3-API|knowledge") package com.pahimar.ee3.api.knowledge;
@API(owner = "EE3", apiVersion = "@API_VERSION@", provides = "EE3-API|knowledge") package com.pahimar.ee3.api.knowledge;
import cpw.mods.fml.common.API;

View File

@ -1,3 +1,3 @@
@API(owner = "EE3", apiVersion = "1.2", provides = "EE3-API|core") package com.pahimar.ee3.api;
@API(owner = "EE3", apiVersion = "@API_VERSION@", provides = "EE3-API|core") package com.pahimar.ee3.api;
import cpw.mods.fml.common.API;

View File

@ -1,3 +1,3 @@
@API(owner = "EE3", apiVersion = "1.2", provides = "EE3-API|recipe") package com.pahimar.ee3.api.recipe;
@API(owner = "EE3", apiVersion = "@API_VERSION@", provides = "EE3-API|recipe") package com.pahimar.ee3.api.recipe;
import cpw.mods.fml.common.API;

View File

@ -1,3 +1,3 @@
@API(owner = "EE3", apiVersion = "1.2", provides = "EE3-API|util") package com.pahimar.ee3.api.util;
@API(owner = "EE3", apiVersion = "@API_VERSION@", provides = "EE3-API|util") package com.pahimar.ee3.api.util;
import cpw.mods.fml.common.API;

View File

@ -11,9 +11,11 @@ import com.pahimar.ee3.reference.Files;
import com.pahimar.ee3.reference.Reference;
import com.pahimar.ee3.reference.Settings;
import com.pahimar.ee3.util.EnergyValueHelper;
import com.pahimar.ee3.util.LoaderHelper;
import com.pahimar.ee3.util.LogHelper;
import com.pahimar.ee3.util.SerializationHelper;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Loader;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
@ -74,11 +76,13 @@ public class EnergyValueRegistry implements JsonSerializer<EnergyValueRegistry>,
{
if (factoredEnergyValue.compareTo(preAssignedMappings.get(factoredWrappedStack)) < 0)
{
LogHelper.trace(String.format("Mod with ID '%s' added a pre-assignment energy value of %s for object %s during %s", Loader.instance().activeModContainer().getModId(), energyValue, wrappedStack, LoaderHelper.getLoaderState())); // TODO Localize?
preAssignedMappings.put(factoredWrappedStack, factoredEnergyValue);
}
}
else
{
LogHelper.trace(String.format("Mod with ID '%s' added a pre-assignment energy value of %s for object %s during %s", Loader.instance().activeModContainer().getModId(), energyValue, wrappedStack, LoaderHelper.getLoaderState())); // TODO Localize?
preAssignedMappings.put(factoredWrappedStack, factoredEnergyValue);
}
}
@ -106,7 +110,8 @@ public class EnergyValueRegistry implements JsonSerializer<EnergyValueRegistry>,
WrappedStack factoredWrappedStack = WrappedStack.wrap(wrappedStack, 1);
EnergyValue factoredEnergyValue = EnergyValueHelper.factorEnergyValue(energyValue, wrappedStack.getStackSize());
postAssignedMappings.put(factoredWrappedStack, factoredEnergyValue);
LogHelper.trace(String.format("Mod with ID '%s' added a post-assignment energy value of %s for object %s during %s", Loader.instance().activeModContainer().getModId(), energyValue, wrappedStack, LoaderHelper.getLoaderState()));
postAssignedMappings.put(factoredWrappedStack, factoredEnergyValue); // TODO Localize?
}
}
}

View File

@ -17,7 +17,7 @@ public class NEIConfig implements IConfigureNEI
@Override
public String getVersion()
{
return Reference.VERSION;
return Reference.MOD_VERSION;
}
@Override

View File

@ -6,7 +6,7 @@ public class Reference
public static final String LOWERCASE_MOD_ID = MOD_ID.toLowerCase();
public static final String MOD_NAME = "Equivalent Exchange 3";
public static final String FINGERPRINT = "@FINGERPRINT@";
public static final String VERSION = "@VERSION@";
public static final String MOD_VERSION = "@MOD_VERSION@";
public static final String DEPENDENCIES = "required-after:Forge@[10.13.3,)";
public static final String SERVER_PROXY_CLASS = "com.pahimar.ee3.proxy.ServerProxy";
public static final String CLIENT_PROXY_CLASS = "com.pahimar.ee3.proxy.ClientProxy";

View File

@ -0,0 +1,43 @@
package com.pahimar.ee3.util;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.LoaderState;
public class LoaderHelper
{
public static LoaderState getLoaderState()
{
if (Loader.instance().isInState(LoaderState.SERVER_STARTED))
{
return LoaderState.SERVER_STARTED;
}
else if (Loader.instance().isInState(LoaderState.SERVER_STARTING))
{
return LoaderState.SERVER_STARTING;
}
else if (Loader.instance().isInState(LoaderState.SERVER_ABOUT_TO_START))
{
return LoaderState.SERVER_ABOUT_TO_START;
}
else if (Loader.instance().isInState(LoaderState.AVAILABLE))
{
return LoaderState.AVAILABLE;
}
else if (Loader.instance().isInState(LoaderState.POSTINITIALIZATION))
{
return LoaderState.POSTINITIALIZATION;
}
else if (Loader.instance().isInState(LoaderState.INITIALIZATION))
{
return LoaderState.INITIALIZATION;
}
else if (Loader.instance().isInState(LoaderState.PREINITIALIZATION))
{
return LoaderState.PREINITIALIZATION;
}
else
{
return null;
}
}
}