From e68d3d6f6bec202ba6b854748aded484f61c4890 Mon Sep 17 00:00:00 2001 From: srs-bsns Date: Sat, 30 Sep 2017 19:44:04 -0400 Subject: [PATCH] Update and clean-up - Moved everything into a single class - Added a GUI Config for changing the biome without having to restart Minecraft. - General clean-up --- .gitattributes | 1 - .gitignore | 62 +++-- build.gradle | 87 ++----- build.properties | 20 -- etc/config/lonelybiome.cfg | 16 -- gradle.properties | 13 ++ mod_deps.properties | 2 - settings.gradle | 2 +- .../java/teamrtg/lonelybiome/LonelyBiome.java | 218 +++++++++++------- .../lonelybiome/config/ConfigManager.java | 24 -- .../config/lonelybiome/ConfigLB.java | 52 ----- .../lonelybiome/event/EventManager.java | 26 --- .../lonelybiome/proxy/ClientProxy.java | 23 -- .../lonelybiome/proxy/CommonProxy.java | 23 -- .../lonelybiome/reference/ModInfo.java | 15 -- .../java/teamrtg/lonelybiome/util/Logger.java | 30 --- .../world/gen/genlayer/GenLayerConstant.java | 32 --- .../assets/lonelybiome/lang/en_US.lang | 5 + src/main/resources/mcmod.info | 12 +- 19 files changed, 222 insertions(+), 441 deletions(-) delete mode 100644 .gitattributes delete mode 100644 build.properties delete mode 100644 etc/config/lonelybiome.cfg create mode 100644 gradle.properties delete mode 100644 mod_deps.properties delete mode 100644 src/main/java/teamrtg/lonelybiome/config/ConfigManager.java delete mode 100644 src/main/java/teamrtg/lonelybiome/config/lonelybiome/ConfigLB.java delete mode 100644 src/main/java/teamrtg/lonelybiome/event/EventManager.java delete mode 100644 src/main/java/teamrtg/lonelybiome/proxy/ClientProxy.java delete mode 100644 src/main/java/teamrtg/lonelybiome/proxy/CommonProxy.java delete mode 100644 src/main/java/teamrtg/lonelybiome/reference/ModInfo.java delete mode 100644 src/main/java/teamrtg/lonelybiome/util/Logger.java delete mode 100644 src/main/java/teamrtg/lonelybiome/world/gen/genlayer/GenLayerConstant.java diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 756b5d9..0000000 --- a/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -* text=auto diff --git a/.gitignore b/.gitignore index 5c10f5c..4c381b7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,24 +1,38 @@ -# eclipse -*.launch -.settings -.metadata -.classpath -.project -bin -eclipse - -# idea -*.ipr -*.iws -*.iml -.idea -out - -# gradle -build -.gradle -run - -libs/*.jar -gradlew-*.bat -.DS_Store +# Ignore everything... + +/* + +# Except... + +# Repo files +!.github/ +!.gitattributes +!.gitignore +!.gitmodules + +# Project files +!src/ +!docs/ +!LICENSE/ +!LICENSE.* +!README* + +# Third-party libraries +!lib/ + +# Gradle +!gradle/ +!gradlew +!gradlew.bat +!?*.gradle +!*.properties +!gradle.* +!build.* + +# Integrations +!codeformat/ +!.travis.yml + +# Other +!publish/ +publish/releases/*changelog* diff --git a/build.gradle b/build.gradle index 981d04c..d7f5c7d 100644 --- a/build.gradle +++ b/build.gradle @@ -1,10 +1,7 @@ buildscript { repositories { jcenter() - maven { - name = "forge" - url = "http://files.minecraftforge.net/maven" - } + maven { url = "http://files.minecraftforge.net/maven" } } dependencies { classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT' @@ -14,78 +11,32 @@ apply plugin: 'net.minecraftforge.gradle.forge' sourceCompatibility = targetCompatibility = 1.8 -def parseprops(File cfg) { - cfg.withReader { - def prop = new Properties() - prop.load(it) - return (new ConfigSlurper().parse(prop)) - } -} - -ext.ref = parseprops(file('build.properties')) -ext.ref.mod_deps = parseprops(file('mod_deps.properties')) - -group = ref.package_base + '.' + ref.mod_id -archivesBaseName = 'Lonely-Biome-' + (ref.mc_version as String) -version = ref.mod_version - -//repositories { -// maven { url "http://files.minecraftforge.net/maven" } //BiomesOPlenty -// maven { url 'https://dl.bintray.com/shinoow/maven/' } //AbyssalCraft -//} - -dependencies { - provided fileTree(dir: 'libs', include: '*.jar') -} +group = project.package_base +archivesBaseName = project.name + "-" + (project.mc_version as String) +version = project.mod_version minecraft { - version = (ref.mcf_suffix!='') ? ref.mcf_version + '-' + ref.mcf_suffix : ref.mcf_version - mappings = ref.mcp_mappings - runDir = ref.run_dir + version = project.mcf_version + mappings = project.mcp_mappings makeObfSourceJar = false - replace '@MOD_VERSION@', project.version - replace '0.0-MCF+MINVER', ref.mcf_minver - replace '9001.0-MCF+MAXVER', ref.mcf_maxver - if (ref.mod_deps!="") replace ';after:MODDEPS', ";" + (ref.mod_deps.depstring as String) - else replace ';after:MODDEPS', '' - replaceIn 'ModInfo.java' + setRunDir "run" + replace '@MOD_VERSION@', project.version + replace '0.0-MCF+MINVER', project.mcf_minver + replace '9001.0-MCF+MAXVER', project.mcf_maxver + replace ';after:MODDEPS', (!project.hasProperty("mod_depstring")) ? "" : project.mod_depstring + replaceIn 'LonelyBiome.java' } processResources { from(sourceSets.main.resources.srcDirs) { include 'mcmod.info' - expand ([ - 'modid':ref.mod_id, - 'name':ref.mod_name, - 'description':ref.mod_desc, - 'version':ref.mod_version, - 'mcversion':ref.mc_version, - 'url':ref.mod_url, - 'authorList':ref.mod_author, - 'credits':ref.mod_creds, - 'logoFile':ref.mod_logo, - ]) - } - from(sourceSets.main.resources.srcDirs) {exclude 'mcmod.info'} -} - -sourceJar {classifier = 'src'} - -// For a debugging session used 'gradle -DEBUG [runClient|runServer]' -allprojects { - tasks.withType(JavaExec) { -// disabled to possibly alleviate testing issues on cumputers with low memory -// jvmArgs '-Xms2G', '-Xmx4G' - if (System.getProperty("EBUG")!=null) - jvmArgs '-agentlib:jdwp=transport=dt_socket,address=localhost:5005,server=y,suspend=y' + expand ([ + 'modid':project.mod_id, + 'name':project.mod_name, + 'version':project.mod_version, + 'mcversion':project.mc_version, + ]) } + from(sourceSets.main.resources.srcDirs) {exclude 'mcmod.info'} } -// use -Dwarn|-Dwarnall CLI arguement for verbose compiler warnings -// -Dwarn covers the 3 most common warnings only -tasks.withType(JavaCompile) { - if (System.getProperty("warn") != null) - options.compilerArgs << "-Xlint:unchecked" << "-Xlint:rawtypes" << "-Xlint:deprecation" - if (System.getProperty("warnall") != null) - options.compilerArgs << "-Xlint:all" -} diff --git a/build.properties b/build.properties deleted file mode 100644 index 13c5850..0000000 --- a/build.properties +++ /dev/null @@ -1,20 +0,0 @@ -# TODO: should maybe find a way to update mod_version automatically in the future (perhaps from git), but not neccessary. -# mod_author has to be in ""'s (and comma-separated, ie: "","",""), because array[] -mod_id=lonelybiome -mod_name=Lonely Biome -mod_desc=Minecraft mod that allows you generate single-biome worlds. -mod_version=1.0 -mc_version=1.10.2 -mod_url=https://github.com/Team-RTG/Lonely-Biome -mod_author="Team RTG" -mod_creds=Halloween graphic by Freepik -mod_logo=assets/lonelybiome/logo.png -mcf_version=12.18.2.2099 -mcf_minver=12.18.1.2011 -mcf_maxver= -# mcf_suffix is the branch suffix (without '-') on the Forge version when it's not the default branch in the Forge repo -# This may be the same as mc_version, eg Non-default: 1.9.4-12.18.2.2099-1.9.4, Default: 1.9.4-12.18.2.2099 -mcf_suffix= -mcp_mappings=snapshot_nodoc_20161027 -run_dir=run -package_base=org.teamrtg diff --git a/etc/config/lonelybiome.cfg b/etc/config/lonelybiome.cfg deleted file mode 100644 index bfefb70..0000000 --- a/etc/config/lonelybiome.cfg +++ /dev/null @@ -1,16 +0,0 @@ -# Configuration file - -general { - # Logs helpful debug messages to the console. - # [default: false] - B:"Enable Debugging"=false - - # If you enter a biome ID here, the whole world will consist of only that biome. - # Set to -1 to generate the world normally. - # Vanilla biome IDs can be found here: http://goo.gl/WqlAfV - # For modded biome IDs, use NEI and go [Options] > [Tools] > [Data Dumps] > Biomes > [Dump], and then refer to the 'biome.csv' file which can be found in your '/.minecraft/dumps' folder. - # [range: -1 ~ 255, default: -1] - I:"Lonely Biome ID"=-1 -} - - diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..129efb5 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,13 @@ +mod_id=lonelybiome +mod_name=LonelyBiome +mod_version=2.0.0 +mod_depstring=;after:RTG@[4.1.1.2,) + +mc_version=1.10.2 +mcf_version=12.18.3.2488 +mcf_minver=12.18.1.2099 +mcf_maxver= +mcp_mappings=stable_29 + +run_dir=run +package_base=org.teamrtg diff --git a/mod_deps.properties b/mod_deps.properties deleted file mode 100644 index 4a0e4d3..0000000 --- a/mod_deps.properties +++ /dev/null @@ -1,2 +0,0 @@ -# mod_deps should be 'after:' (unquoted, semicolon-separated, \escaped for newline, see example below) -depstring=after:RTG@[4.1.1.2,) \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index d43539e..609069a 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1 +1 @@ -rootProject.name = 'Lonely Biome' +rootProject.name = "LonelyBiome" diff --git a/src/main/java/teamrtg/lonelybiome/LonelyBiome.java b/src/main/java/teamrtg/lonelybiome/LonelyBiome.java index 7d9b347..18a6233 100644 --- a/src/main/java/teamrtg/lonelybiome/LonelyBiome.java +++ b/src/main/java/teamrtg/lonelybiome/LonelyBiome.java @@ -1,101 +1,165 @@ package teamrtg.lonelybiome; -import java.util.ArrayList; +import javax.annotation.Nonnull; +import java.io.File; +import java.util.Arrays; +import java.util.List; +import java.util.Set; +import com.google.common.collect.Lists; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.resources.I18n; +import net.minecraft.init.Biomes; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.math.MathHelper; +import net.minecraft.world.biome.Biome; +import net.minecraft.world.gen.layer.GenLayer; +import net.minecraft.world.gen.layer.IntCache; import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.common.config.ConfigElement; +import net.minecraftforge.common.config.Configuration; +import net.minecraftforge.common.config.Property; +import net.minecraftforge.event.terraingen.WorldTypeEvent; +import net.minecraftforge.fml.client.IModGuiFactory; +import net.minecraftforge.fml.client.config.GuiConfig; +import net.minecraftforge.fml.client.config.IConfigElement; import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.common.Mod.EventHandler; -import net.minecraftforge.fml.common.Mod.Instance; import net.minecraftforge.fml.common.SidedProxy; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; -import net.minecraftforge.fml.common.event.FMLServerAboutToStartEvent; -import net.minecraftforge.fml.common.event.FMLServerStartedEvent; -import net.minecraftforge.fml.common.event.FMLServerStartingEvent; -import net.minecraftforge.fml.common.event.FMLServerStoppedEvent; -import net.minecraftforge.fml.common.event.FMLServerStoppingEvent; -import teamrtg.lonelybiome.config.ConfigManager; -import teamrtg.lonelybiome.event.EventManager; -import teamrtg.lonelybiome.proxy.CommonProxy; -import teamrtg.lonelybiome.reference.ModInfo; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; -@Mod(modid = ModInfo.MOD_ID, name = ModInfo.MOD_NAME, version = ModInfo.MOD_VERSION, acceptableRemoteVersions = "*") -public class LonelyBiome { - - @Instance("lonelybiome") - public static LonelyBiome instance; - public static String configPath; - public static EventManager eventMgr; - - @SidedProxy(serverSide = ModInfo.PROXY_COMMON, clientSide = ModInfo.PROXY_CLIENT) - public static CommonProxy proxy; +@SuppressWarnings("unused") +@Mod( + modid = LonelyBiome.MOD_ID, + name = LonelyBiome.MOD_NAME, + version = LonelyBiome.MOD_VERSION, + guiFactory = "teamrtg.lonelybiome.LonelyBiome$LBGuiConfigFactory", + dependencies = "required-after:Forge@[" + LonelyBiome.MCF_MINVER + "," + LonelyBiome.MCF_MAXVER + ")" + LonelyBiome.MOD_DEPS, + acceptableRemoteVersions = "*" +) +public final class LonelyBiome +{ + static final String MOD_ID = "lonelybiome"; + static final String MOD_NAME = "Lonely Biome"; + static final String MOD_VERSION = "@MOD_VERSION@"; + static final String MCF_MINVER = "0.0-MCF+MINVER"; + static final String MCF_MAXVER = "9001.0-MCF+MAXVER"; + static final String MOD_DEPS = ";after:MODDEPS"; + private static final Logger LOGGER = LogManager.getLogger(MOD_ID); - private ConfigManager configManager = new ConfigManager(); - - public ConfigManager configManager(int dimension) { - return configManager; - } - - @EventHandler - public void fmlLifeCycleEvent(FMLPreInitializationEvent event) - { - instance = this; - - eventMgr = new EventManager(); - MinecraftForge.TERRAIN_GEN_BUS.register(eventMgr); - - configPath = event.getModConfigurationDirectory() + "/"; - ConfigManager.init(configPath); - } - - @EventHandler - public void fmlLifeCycleEvent(FMLInitializationEvent event) - { - - } - - @EventHandler - public void fmlLifeCycle(FMLPostInitializationEvent event) - { + @Mod.Instance(MOD_ID) private static LonelyBiome instance; + @Mod.EventHandler void initPre (FMLPreInitializationEvent event) { proxy.preInit (event); } + @Mod.EventHandler void init (FMLInitializationEvent event) { proxy.init (event); } + @Mod.EventHandler void postInit(FMLPostInitializationEvent event) { proxy.postInit(event); } + @SidedProxy private static CommonProxy proxy; + private static abstract class CommonProxy { + void preInit(FMLPreInitializationEvent event) { + LBconfig.init(event); + LOGGER.debug("Registering InitBiomeGens event handler"); + MinecraftForge.TERRAIN_GEN_BUS.register(this); + } + void init(FMLInitializationEvent event) { } + void postInit(FMLPostInitializationEvent event) { LBconfig.sync(); } + @SubscribeEvent void onInitBiomeGens(WorldTypeEvent.InitBiomeGens event) { + if (LBconfig.isEnabled()) { + GenLayer layer = new GenLayerSingle(LBconfig.biome); + event.setNewBiomeGens(new GenLayer[]{layer,layer}); + LOGGER.info("Setting up new single-biome GenLayer using Biome: {}, with Id: {}, Registry name: {}", LBconfig.biome, LBconfig.biomeId, LBconfig.resLoc); + } + } } - - @EventHandler - public void fmlLifeCycle(FMLServerAboutToStartEvent event) - { - + public static class ClientProxy extends CommonProxy { + @Override public void preInit (FMLPreInitializationEvent event) { super.preInit (event); } + @Override public void init (FMLInitializationEvent event) { super.init (event); } + @Override public void postInit(FMLPostInitializationEvent event) { super.postInit(event); } } - - @EventHandler - public void fmlLifeCycle(FMLServerStartingEvent event) - { - + public static class ServerProxy extends CommonProxy { + @Override public void preInit (FMLPreInitializationEvent event) { super.preInit (event); } + @Override public void init (FMLInitializationEvent event) { super.init (event); } + @Override public void postInit(FMLPostInitializationEvent event) { super.postInit(event); } } - - @EventHandler - public void fmlLifeCycle(FMLServerStartedEvent event) - { + private static final class GenLayerSingle extends GenLayer { + private final int biomeId; + GenLayerSingle(@Nonnull Biome biome) { + super(0L); + this.biomeId = Biome.getIdForBiome(biome); + LOGGER.debug("Created new GenLayerSingle for Biome: {}, with Id: {}, Registry name: {} ", biome.getBiomeName(), biomeId, biome.getRegistryName()); + } + @Override @Nonnull + public int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight) { + int[] ids = IntCache.getIntCache(areaWidth * areaHeight); + Arrays.fill(ids, biomeId); + return ids; + } } - @EventHandler - public void fmlLifeCycle(FMLServerStoppingEvent event) - { + private static final class LBconfig { + private LBconfig() {} + private static final Biome DEFAULT_BIOME = Biomes.PLAINS; + private static final int DEFAULT_BIOME_ID = Biome.getIdForBiome(Biomes.PLAINS); + private static Biome biome; + private static int biomeId; + private static ResourceLocation resLoc; + private static File configFile; + private static Configuration config; + private static Property configBiome; + private static Property enabled; + private static boolean isEnabled() { return enabled.getBoolean(); } + private static void init(FMLPreInitializationEvent event) { + if (configFile == null) { configFile = event.getSuggestedConfigurationFile(); } + if (config == null) { config = new Configuration(configFile); } + configBiome = config.get(LonelyBiome.MOD_ID, "biome", "minecraft:plains", "The biome to generate the world with." + Configuration.NEW_LINE + + "Enter the Registry name for a biome (eg. minecraft:plains), or a numeric Biome Id." + Configuration.NEW_LINE + "A Registry name is more " + + "reliable as biome IDs can change with different configurations.").setLanguageKey(LonelyBiome.MOD_ID+".config.biome"); + enabled = config.get(LonelyBiome.MOD_ID, "enabled", true, "Set this to false to disable LonelyBiome.").setLanguageKey(LonelyBiome.MOD_ID + ".config.enabled"); + if (config.hasChanged()) { config.save(); } + } + private static void sync() { + if (configBiome.getString().contains(":")) { + resLoc = new ResourceLocation(configBiome.getString()); + biome = Biome.REGISTRY.getObject(resLoc); + if (biome == null) { biome = DEFAULT_BIOME; } + } + else { + biomeId = MathHelper.getInt(configBiome.getString(), DEFAULT_BIOME_ID); + biome = Biome.getBiome(biomeId, DEFAULT_BIOME); + } + biomeId = Biome.getIdForBiome(biome); + resLoc = biome.getRegistryName(); - } + LOGGER.info("LonelyBiome configured with Biome: {}, Id: {}, Registry name: {}", biome.getBiomeName(), biomeId, resLoc); - public void runOnServerClose(Runnable action) { - serverCloseActions.add(action); + if (config.hasChanged()) { config.save(); } + } } - - private ArrayList serverCloseActions = new ArrayList(); - @EventHandler - public void fmlLifeCycle(FMLServerStoppedEvent event) - { - for (Runnable action: serverCloseActions) { - action.run(); + public static final class LBGuiConfig extends GuiConfig { + public LBGuiConfig(GuiScreen parent) { super(parent, getConfigElements(), MOD_ID, false, false, I18n.format(LonelyBiome.MOD_ID+".config.maintitle")); } + private static List getConfigElements() { + List ret = Lists.newArrayList(); + LBconfig.config.getCategory(MOD_ID).values().forEach(e -> { + e.setComment(I18n.format(e.getLanguageKey()+".comment")); + ret.add(new ConfigElement(e)); + }); + return ret; } - + @Override public void onGuiClosed() { + super.onGuiClosed(); + if (LBconfig.config.hasChanged()) { LBconfig.config.save(); } + LBconfig.sync(); + } + } + public static final class LBGuiConfigFactory implements IModGuiFactory { + @Override public void initialize(Minecraft mc) {} + @Override public Class mainConfigGuiClass() { return LBGuiConfig.class; } + @Override public Set runtimeGuiCategories() { return null; } + @SuppressWarnings("deprecation") + @Override public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element) { return null; } } } diff --git a/src/main/java/teamrtg/lonelybiome/config/ConfigManager.java b/src/main/java/teamrtg/lonelybiome/config/ConfigManager.java deleted file mode 100644 index ef5ce34..0000000 --- a/src/main/java/teamrtg/lonelybiome/config/ConfigManager.java +++ /dev/null @@ -1,24 +0,0 @@ -package teamrtg.lonelybiome.config; - -import java.io.File; - -import teamrtg.lonelybiome.config.lonelybiome.ConfigLB; - -public class ConfigManager -{ - - public static File lbConfigFile; - - private ConfigLB configLB = new ConfigLB(); - public ConfigLB rtg() { - return configLB; - } - - public static void init(String configpath) - { - - lbConfigFile = new File(configpath + "lonelybiome.cfg"); - - ConfigLB.init(lbConfigFile); - } -} diff --git a/src/main/java/teamrtg/lonelybiome/config/lonelybiome/ConfigLB.java b/src/main/java/teamrtg/lonelybiome/config/lonelybiome/ConfigLB.java deleted file mode 100644 index 217850f..0000000 --- a/src/main/java/teamrtg/lonelybiome/config/lonelybiome/ConfigLB.java +++ /dev/null @@ -1,52 +0,0 @@ -package teamrtg.lonelybiome.config.lonelybiome; - -import java.io.File; - -import net.minecraftforge.common.config.Configuration; -import teamrtg.lonelybiome.util.Logger; - -public class ConfigLB -{ - public static Configuration config; - - public static int singleBiomeId = -1; - public static boolean enableDebugging = false; - - public static void init(File configFile) - { - config = new Configuration(configFile); - - try - { - config.load(); - - singleBiomeId = config.getInt( - "Lonely Biome ID", - "General", - singleBiomeId, - -1, 255, - "If you enter a biome ID here, the whole world will consist of only that biome." + - Configuration.NEW_LINE + - "Set to -1 to generate the world normally." + - Configuration.NEW_LINE + - "Vanilla biome IDs can be found here: http://goo.gl/WqlAfV" + - Configuration.NEW_LINE + - "For modded biome IDs, use NEI and go [Options] > [Tools] > [Data Dumps] > Biomes > [Dump], and then refer to the 'biome.csv' file which can be found in your '/.minecraft/dumps' folder." + - Configuration.NEW_LINE - ); - - enableDebugging = config.getBoolean("Enable Debugging", "General", enableDebugging, "Logs helpful debug messages to the console." + Configuration.NEW_LINE); - } - catch (Exception e) - { - Logger.error("Lonely Biome has had a problem loading its configuration."); - } - finally - { - if (config.hasChanged()) - { - config.save(); - } - } - } -} \ No newline at end of file diff --git a/src/main/java/teamrtg/lonelybiome/event/EventManager.java b/src/main/java/teamrtg/lonelybiome/event/EventManager.java deleted file mode 100644 index 3803b00..0000000 --- a/src/main/java/teamrtg/lonelybiome/event/EventManager.java +++ /dev/null @@ -1,26 +0,0 @@ -package teamrtg.lonelybiome.event; - -import net.minecraft.world.gen.layer.GenLayer; -import net.minecraftforge.event.terraingen.WorldTypeEvent; -import net.minecraftforge.fml.common.eventhandler.EventPriority; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import teamrtg.lonelybiome.config.lonelybiome.ConfigLB; -import teamrtg.lonelybiome.world.gen.genlayer.GenLayerConstant; - -public class EventManager -{ - - public EventManager() - { - - } - - @SubscribeEvent(priority = EventPriority.LOWEST) - public void onBiomeGenInit(WorldTypeEvent.InitBiomeGens event) { - if (ConfigLB.singleBiomeId == -1) return; - GenLayer[] replacement = new GenLayer[2]; - replacement[0] = new GenLayerConstant(ConfigLB.singleBiomeId); - replacement[1] = replacement[0]; - event.setNewBiomeGens(replacement); - } -} \ No newline at end of file diff --git a/src/main/java/teamrtg/lonelybiome/proxy/ClientProxy.java b/src/main/java/teamrtg/lonelybiome/proxy/ClientProxy.java deleted file mode 100644 index f3e721a..0000000 --- a/src/main/java/teamrtg/lonelybiome/proxy/ClientProxy.java +++ /dev/null @@ -1,23 +0,0 @@ -package teamrtg.lonelybiome.proxy; - -import net.minecraftforge.fml.common.event.FMLInitializationEvent; -import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; -import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; - -public class ClientProxy extends CommonProxy -{ - @Override - public void preInit(FMLPreInitializationEvent event) { - super.preInit(event); - } - - @Override - public void init(FMLInitializationEvent event) { - super.init(event); - } - - @Override - public void postInit(FMLPostInitializationEvent event) { - super.postInit(event); - } -} diff --git a/src/main/java/teamrtg/lonelybiome/proxy/CommonProxy.java b/src/main/java/teamrtg/lonelybiome/proxy/CommonProxy.java deleted file mode 100644 index 78e0db2..0000000 --- a/src/main/java/teamrtg/lonelybiome/proxy/CommonProxy.java +++ /dev/null @@ -1,23 +0,0 @@ -package teamrtg.lonelybiome.proxy; - -import net.minecraftforge.fml.common.event.FMLInitializationEvent; -import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; -import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; - -public class CommonProxy { - - public void preInit(FMLPreInitializationEvent event) - { - - } - - public void init(FMLInitializationEvent event) - { - - } - - public void postInit(FMLPostInitializationEvent event) - { - - } -} \ No newline at end of file diff --git a/src/main/java/teamrtg/lonelybiome/reference/ModInfo.java b/src/main/java/teamrtg/lonelybiome/reference/ModInfo.java deleted file mode 100644 index 2e3a3ca..0000000 --- a/src/main/java/teamrtg/lonelybiome/reference/ModInfo.java +++ /dev/null @@ -1,15 +0,0 @@ -package teamrtg.lonelybiome.reference; - - -public class ModInfo -{ - public static final String MOD_ID = "lonelybiome"; - public static final String MOD_NAME = "Lonely Biome"; - public static final String MOD_VERSION = "@MOD_VERSION@"; - public static final String MCF_MINVER = "0.0-MCF+MINVER"; - public static final String MCF_MAXVER = "9001.0-MCF+MAXVER"; - public static final String MOD_DEPS = ";after:MODDEPS"; - public static final String CONFIG_DIRECTORY = MOD_ID; - public static final String PROXY_COMMON = "teamrtg.lonelybiome.proxy.CommonProxy"; - public static final String PROXY_CLIENT = "teamrtg.lonelybiome.proxy.ClientProxy"; -} diff --git a/src/main/java/teamrtg/lonelybiome/util/Logger.java b/src/main/java/teamrtg/lonelybiome/util/Logger.java deleted file mode 100644 index 9b4d36c..0000000 --- a/src/main/java/teamrtg/lonelybiome/util/Logger.java +++ /dev/null @@ -1,30 +0,0 @@ -package teamrtg.lonelybiome.util; - -import net.minecraftforge.fml.common.FMLLog; - -import org.apache.logging.log4j.Level; - -import teamrtg.lonelybiome.config.lonelybiome.ConfigLB; - -public class Logger { - - public static void debug(String format, Object... data) { - if (ConfigLB.enableDebugging) FMLLog.log(Level.DEBUG, "[LonelyBiome-DEBUG] " + format, data); - } - - public static void info(String format, Object... data) { - FMLLog.log(Level.INFO, "[LonelyBiome-INFO] " + format, data); - } - - public static void warn(String format, Object... data) { - FMLLog.log(Level.WARN, "[LonelyBiome-WARN] " + format, data); - } - - public static void error(String format, Object... data) { - FMLLog.log(Level.ERROR, "[LonelyBiome-ERROR] " + format, data); - } - - public static void fatal(String format, Object... data) { - FMLLog.log(Level.FATAL, "[LonelyBiome-FATAL] " + format, data); - } -} \ No newline at end of file diff --git a/src/main/java/teamrtg/lonelybiome/world/gen/genlayer/GenLayerConstant.java b/src/main/java/teamrtg/lonelybiome/world/gen/genlayer/GenLayerConstant.java deleted file mode 100644 index ed39a77..0000000 --- a/src/main/java/teamrtg/lonelybiome/world/gen/genlayer/GenLayerConstant.java +++ /dev/null @@ -1,32 +0,0 @@ - -package teamrtg.lonelybiome.world.gen.genlayer; - -import net.minecraft.world.gen.layer.GenLayer; -import net.minecraft.world.gen.layer.IntCache; - -/** - * @author Zeno410 - */ -public class GenLayerConstant extends GenLayer -{ - private final int value; - - public GenLayerConstant(int value) - { - super(0L); - this.value = value; - } - - @Override - public int[] getInts(int par1, int par2, int par3, int par4){ - - int[] aint2 = IntCache.getIntCache(par3 * par4); - - for (int i = 0; i < aint2.length; i++) { - - aint2[i] = value; - } - - return aint2; - } -} diff --git a/src/main/resources/assets/lonelybiome/lang/en_US.lang b/src/main/resources/assets/lonelybiome/lang/en_US.lang index e69de29..5aef5f2 100644 --- a/src/main/resources/assets/lonelybiome/lang/en_US.lang +++ b/src/main/resources/assets/lonelybiome/lang/en_US.lang @@ -0,0 +1,5 @@ +lonelybiome.config.maintitle=LonelyBiome Configuration +lonelybiome.config.biome=Biome +lonelybiome.config.biome.comment=The Biome to generate the world with. +lonelybiome.config.enabled=Enabled +lonelybiome.config.enabled.comment=Set this to false to disable LonelyBiome. diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info index 72502a4..6e5d474 100644 --- a/src/main/resources/mcmod.info +++ b/src/main/resources/mcmod.info @@ -1,14 +1,12 @@ [{ "modid": "${modid}", "name": "${name}", - "description": "${description}", + "description": "A Minecraft mod that allows you generate single-biome worlds.", "version": "${version}", "mcversion": "${mcversion}", - "url": "${url}", + "url": "https://github.com/Team-RTG/Lonely-Biome", "updateUrl": "", - "authorList": [${authorList}], - "credits": "${credits}", - "logoFile": "${logoFile}", - "screenshots": [], - "dependencies": [] + "authorList": ["Team RTG"], + "credits": "Halloween graphic by Freepik", + "logoFile": "assets/lonelybiome/logo.png" }]