diff --git a/common/biomesoplenty/BiomesOPlenty.java b/common/biomesoplenty/BiomesOPlenty.java index 70ac28761..d918be173 100644 --- a/common/biomesoplenty/BiomesOPlenty.java +++ b/common/biomesoplenty/BiomesOPlenty.java @@ -1,11 +1,5 @@ package biomesoplenty; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -import static argo.jdom.JsonNodeBuilders.aStringBuilder; - import net.minecraft.crash.CallableMinecraftVersion; import net.minecraft.creativetab.CreativeTabs; import net.minecraftforge.common.DimensionManager; @@ -34,10 +28,9 @@ import biomesoplenty.handlers.SoundHandler; import biomesoplenty.handlers.TickHandlerClient; import biomesoplenty.handlers.TickHandlerServer; import biomesoplenty.handlers.VillageMaterialEventHandler; -import biomesoplenty.handlers.versionhandlers.BOPForgeVersionHandler; -import biomesoplenty.handlers.versionhandlers.BOPModVersionHandler; import biomesoplenty.helpers.AchievementHelper; import biomesoplenty.helpers.CreativeTabsBOP; +import biomesoplenty.helpers.Version; import biomesoplenty.integration.BOPCrossIntegration; import biomesoplenty.world.WorldProviderPromised; import biomesoplenty.world.WorldTypeSize; @@ -51,11 +44,9 @@ import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.network.NetworkMod; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.TickRegistry; -import cpw.mods.fml.common.versioning.ArtifactVersion; -import cpw.mods.fml.common.versioning.VersionParser; import cpw.mods.fml.relauncher.Side; -@Mod(modid="BiomesOPlenty", name="Biomes O' Plenty", version=BOPModVersionHandler.VERSION) +@Mod(modid="BiomesOPlenty", name="Biomes O' Plenty", version=Version.VERSION, dependencies="after:Natura; required-after:Forge@[1.42.666.42.1,)") @NetworkMod(clientSideRequired=true, serverSideRequired=false) public class BiomesOPlenty { @@ -74,12 +65,7 @@ public class BiomesOPlenty configPath = event.getModConfigurationDirectory() + "/biomesoplenty/"; BOPConfiguration.init(configPath); - BOPForgeVersionHandler.check(); - - String dependancies = "after:Natura;required-after:Forge@[" + BOPForgeVersionHandler.recommendedVersion + ",)"; - event.getModMetadata().dependencies.add(VersionParser.parseVersionReference(dependancies)); - - BOPModVersionHandler.check(); + Version.check(); tabBiomesOPlenty = new CreativeTabsBOP(CreativeTabs.getNextID(),"tabBiomesOPlenty"); @@ -147,27 +133,4 @@ public class BiomesOPlenty TickRegistry.registerTickHandler(new TickHandlerClient(), Side.CLIENT); TickRegistry.registerTickHandler(new TickHandlerServer(), Side.SERVER); } - - public > T processReferences(Object refs, Class retType) - { - T res = null; - try - { - res = retType.newInstance(); - } - catch (Exception e) - { - // unpossible - } - - if (refs == null) - { - return res; - } - for (String ref : ((List)refs)) - { - res.add(VersionParser.parseVersionReference(ref)); - } - return res; - } } \ No newline at end of file diff --git a/common/biomesoplenty/api/BlockReferences.java b/common/biomesoplenty/api/BlockReferences.java index beb515775..ac1e86637 100644 --- a/common/biomesoplenty/api/BlockReferences.java +++ b/common/biomesoplenty/api/BlockReferences.java @@ -176,11 +176,7 @@ public class BlockReferences { deathbloom (Blocks.flowers, 2), glowFlower (Blocks.flowers, 3), hydrangea (Blocks.flowers, 4), - @Deprecated - daisy (Blocks.flowers, 5), cosmos (Blocks.flowers, 5), - @Deprecated - tulip (Blocks.flowers, 6), daffodil (Blocks.flowers, 6), wildFlower (Blocks.flowers, 7), violet (Blocks.flowers, 8), diff --git a/common/biomesoplenty/handlers/TickHandlerClient.java b/common/biomesoplenty/handlers/TickHandlerClient.java index 1992dc214..16994ab3f 100644 --- a/common/biomesoplenty/handlers/TickHandlerClient.java +++ b/common/biomesoplenty/handlers/TickHandlerClient.java @@ -3,7 +3,7 @@ package biomesoplenty.handlers; import java.util.EnumSet; import net.minecraft.entity.player.EntityPlayer; -import biomesoplenty.handlers.versionhandlers.BOPModVersionHandler; +import biomesoplenty.helpers.Version; import cpw.mods.fml.common.ITickHandler; import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.TickType; @@ -25,14 +25,14 @@ public class TickHandlerClient implements ITickHandler EntityPlayer player = (EntityPlayer) tickData[0]; - if (BOPModVersionHandler.needsBOPWorldtypeAndMarkAsSeen(player.worldObj)) + if (Version.needsBOPWorldtypeAndMarkAsSeen(player.worldObj)) { player.addChatMessage(String.format("\u00A7cThe Biomes O Plenty world type must be used in order for the new biomes to generate. This message will only display once.")); } - if (BOPModVersionHandler.needsUpdateNoticeAndMarkAsSeen()) + if (Version.needsUpdateNoticeAndMarkAsSeen()) { - player.addChatMessage(String.format("\u00A7cA new version of Biomes O Plenty is available: v%s for Minecraft %s", BOPModVersionHandler.getRecommendedVersion(), Loader.instance().getMinecraftModContainer().getVersion())); + player.addChatMessage(String.format("\u00A7cA new version of Biomes O Plenty is available: v%s for Minecraft %s", Version.getRecommendedVersion(), Loader.instance().getMinecraftModContainer().getVersion())); } nagged = true; diff --git a/common/biomesoplenty/handlers/versionhandlers/BOPForgeVersionHandler.java b/common/biomesoplenty/handlers/versionhandlers/BOPForgeVersionHandler.java deleted file mode 100644 index 2694af6f5..000000000 --- a/common/biomesoplenty/handlers/versionhandlers/BOPForgeVersionHandler.java +++ /dev/null @@ -1,90 +0,0 @@ -package biomesoplenty.handlers.versionhandlers; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.lang.reflect.Field; -import java.lang.reflect.Modifier; -import java.net.HttpURLConnection; -import java.net.URL; -import java.util.logging.Level; - -import net.minecraft.world.World; -import net.minecraft.world.WorldType; -import net.minecraftforge.common.ForgeVersion; -import net.minecraftforge.common.Property; -import biomesoplenty.configuration.configfile.BOPConfigurationMain; -import biomesoplenty.world.WorldTypeBOP; -import cpw.mods.fml.common.FMLCommonHandler; -import cpw.mods.fml.common.Loader; - -public class BOPForgeVersionHandler implements Runnable -{ - private static BOPForgeVersionHandler instance = new BOPForgeVersionHandler(); - - private static final String REMOTE_VERSION_FILE = "https://raw.github.com/Glitchfiend/BiomesOPlenty/master/forgeversion.txt"; - - private static boolean hasFailed = false; - - public static String recommendedVersion = "1.42.666.42.1"; - - public static void versionCheck() - { - try - { - String location = REMOTE_VERSION_FILE; - HttpURLConnection conn = null; - while (location != null && !location.isEmpty()) { - URL url = new URL(location); - conn = (HttpURLConnection) url.openConnection(); - conn.setRequestProperty( - "User-Agent", - "Mozilla/5.0 (Windows; U; Windows NT 6.0; ru; rv:1.9.0.11) Gecko/2009060215 Firefox/3.0.11 (.NET CLR 3.5.30729)"); - conn.connect(); - location = conn.getHeaderField("Location"); - } - - BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream())); - - String line = null; - String mcVersion = Loader.instance().getMinecraftModContainer().getVersion(); - - while ((line = reader.readLine()) != null) - { - if (line.startsWith(mcVersion)) { - if (line.contains("BiomesOPlenty")) - { - String[] tokens = line.split(":"); - - recommendedVersion = tokens[2]; - } - } - } - - } - catch (Exception e) - { - FMLCommonHandler.instance().getFMLLogger().log(Level.WARNING, "[BiomesOPlenty] Unable to read from remote version authority."); - FMLCommonHandler.instance().getFMLLogger().log(Level.WARNING, e.toString()); - - hasFailed = true; - } - } - - @Override - public void run() - { - FMLCommonHandler.instance().getFMLLogger().log(Level.INFO, "[BiomesOPlenty] Beginning Forge version check"); - - versionCheck(); - - if (hasFailed) - { - FMLCommonHandler.instance().getFMLLogger().log(Level.INFO, "[BiomesOPlenty] Version check failed"); - } - } - - public static void check() - { - new Thread(instance).start(); - } -} diff --git a/common/biomesoplenty/handlers/versionhandlers/BOPModVersionHandler.java b/common/biomesoplenty/helpers/Version.java similarity index 94% rename from common/biomesoplenty/handlers/versionhandlers/BOPModVersionHandler.java rename to common/biomesoplenty/helpers/Version.java index 8cba1c753..832b9c36f 100644 --- a/common/biomesoplenty/handlers/versionhandlers/BOPModVersionHandler.java +++ b/common/biomesoplenty/helpers/Version.java @@ -1,4 +1,4 @@ -package biomesoplenty.handlers.versionhandlers; +package biomesoplenty.helpers; import java.io.BufferedReader; import java.io.InputStreamReader; @@ -14,8 +14,8 @@ import biomesoplenty.world.WorldTypeBOP; import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.Loader; -public class BOPModVersionHandler implements Runnable { - private static BOPModVersionHandler instance = new BOPModVersionHandler(); +public class Version implements Runnable { + private static Version instance = new Version(); public enum EnumUpdateState { @@ -23,8 +23,8 @@ public class BOPModVersionHandler implements Runnable { } public static final String VERSION = "@VERSION@"; - private static final String REMOTE_VERSION_FILE = "https://raw.github.com/Glitchfiend/BiomesOPlenty/master/version.txt"; - private static final String REMOTE_CHANGELOG_ROOT = "https://raw.github.com/Glitchfiend/BiomesOPlenty/master/changelog/"; + private static final String REMOTE_VERSION_FILE = "https://raw.github.com/BiomesOPlenty/BiomesOPlenty/master/version.txt"; + private static final String REMOTE_CHANGELOG_ROOT = "https://raw.github.com/BiomesOPlenty/BiomesOPlenty/master/changelog/"; public static EnumUpdateState currentVersion = EnumUpdateState.CURRENT; diff --git a/forgeversion.txt b/forgeversion.txt deleted file mode 100644 index 1bf0c4950..000000000 --- a/forgeversion.txt +++ /dev/null @@ -1,2 +0,0 @@ -1.6.2:BiomesOPlenty:1.1.2 -1.6.4:BiomesOPlenty:9.10.1.895