Skip to content

Commit

Permalink
Merge pull request #879 from Team-RTG/1.7.10-dev
Browse files Browse the repository at this point in the history
Merge dev into master (1.7.10-1.1.1).
  • Loading branch information
whichonespink44 authored Jul 29, 2016
2 parents 3f8375c + 9103d96 commit aa88d98
Show file tree
Hide file tree
Showing 5 changed files with 146 additions and 106 deletions.
2 changes: 1 addition & 1 deletion build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
mod_id=RTG
mod_name=Realistic Terrain Generation
mod_desc=Adds a new world type which generates realistic terrain for Overworld biomes.
mod_version=1.1.0
mod_version=1.1.1
mc_version=1.7.10
mod_url=https://github.com/Team-RTG/Realistic-Terrain-Generation
mod_author="Team RTG"
Expand Down
5 changes: 5 additions & 0 deletions etc/config/RTG/rtg.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,11 @@ saplings {


"scattered features" {
# Must be set to TRUE for the other scattered feature settings to have any effect.
# If FALSE, RTG won't interfere with scattered feature generation at all.
# [default: true]
B:"Enable Scattered Feature Modifications"=true

# [default: true]
B:"Generate Scattered Features"=true

Expand Down
57 changes: 25 additions & 32 deletions src/main/java/rtg/RTG.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,19 @@

import net.minecraftforge.common.MinecraftForge;

import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.event.FMLServerStoppedEvent;

import rtg.api.event.BiomeConfigEvent;
import rtg.config.BiomeConfigManager;
import rtg.config.ConfigManager;
import rtg.event.EventManagerRTG;
import rtg.event.WorldTypeMessageEventHandler;
import rtg.reference.ModInfo;
import rtg.util.Logger;
import rtg.util.RealisticBiomePresenceTester;
import rtg.world.WorldTypeRTG;
import rtg.world.biome.realistic.abyssalcraft.RealisticBiomeACBase;
Expand All @@ -38,13 +44,6 @@
import rtg.world.gen.structure.MapGenScatteredFeatureRTG;
import rtg.world.gen.structure.MapGenVillageRTG;

import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.event.FMLServerStoppedEvent;


//@Mod(modid = "RTG", name = "Realistic Terrain Generaton", version = "0.8.0d", dependencies = "required-after:Forge@[10.13.4.1448,)", acceptableRemoteVersions = "*")
@Mod(modid = ModInfo.MOD_ID, name = ModInfo.MOD_NAME, version = ModInfo.MOD_VERSION, dependencies = "required-after:Forge@[" + ModInfo.FORGE_DEP + ",)" + ModInfo.MOD_DEPS, acceptableRemoteVersions = "*")
Expand All @@ -56,6 +55,9 @@ public class RTG {
public static WorldTypeRTG worldtype;
public static EventManagerRTG eventMgr;

private ArrayList<Runnable> oneShotServerCloseActions = new ArrayList<>();
private ArrayList<Runnable> serverCloseActions = new ArrayList<>();

private ConfigManager configManager = new ConfigManager();

public ConfigManager configManager(int dimension) {
Expand All @@ -64,36 +66,37 @@ public ConfigManager configManager(int dimension) {

@EventHandler
public void preInit(FMLPreInitializationEvent event)
{
{
instance = this;


worldtype = new WorldTypeRTG("RTG");

MapGenStructureIO.registerStructure(MapGenScatteredFeatureRTG.Start.class, "rtg_MapGenScatteredFeatureRTG");
MapGenStructureIO.registerStructure(MapGenVillageRTG.Start.class, "rtg_MapGenVillageRTG");

Logger.info("[FMLPreInitializationEvent] Creating RTG's EventManager");
eventMgr = new EventManagerRTG();
eventMgr.registerEventHandlers();

// This event handler unregisters itself, so it doesn't need to be a part of the event management system.
MinecraftForge.EVENT_BUS.register(WorldTypeMessageEventHandler.instance);

// Biome configs MUST get initialised before the main config.
MinecraftForge.EVENT_BUS.post(new BiomeConfigEvent.Pre());

// This MUST get called before the config is initialised.
BiomeConfigManager.initBiomeConfigs();

MinecraftForge.EVENT_BUS.post(new BiomeConfigEvent.Post());

configPath = event.getModConfigurationDirectory() + "/RTG/";
ConfigManager.init(configPath);

worldtype = new WorldTypeRTG("RTG");
}

// @EventHandler public void init(FMLInitializationEvent event) {}

/*
@EventHandler
public void init(FMLInitializationEvent event) {}
*/

@EventHandler
public void postInit(FMLPostInitializationEvent event)
{

RealisticBiomeVanillaBase.addBiomes();

RealisticBiomeBOPBase.addBiomes();
Expand All @@ -118,8 +121,8 @@ public void postInit(FMLPostInitializationEvent event)

RealisticBiomePresenceTester.doBiomeCheck();
}
/*

/*
@EventHandler
public void serverAboutToStart(FMLServerAboutToStartEvent event) {}
Expand All @@ -131,8 +134,7 @@ public void serverStarted(FMLServerStartedEvent event) {}
@EventHandler
public void serverStopping(FMLServerStoppingEvent event) {}
*/

*/

public void runOnServerClose(Runnable action) {
serverCloseActions.add(action);
Expand All @@ -142,8 +144,6 @@ public void runOnNextServerCloseOnly(Runnable action) {
serverCloseActions.add(action);
}

private ArrayList<Runnable> oneShotServerCloseActions = new ArrayList<>();
private ArrayList<Runnable> serverCloseActions = new ArrayList<>();
@EventHandler
public void serverStopped(FMLServerStoppedEvent event)
{
Expand All @@ -154,12 +154,5 @@ public void serverStopped(FMLServerStoppedEvent event)
action.run();
}
oneShotServerCloseActions.clear();

if (eventMgr.isRegistered()) {
Logger.info("Unregistering RTG's Terrain Event Handlers...");
RTG.eventMgr.unRegisterEventHandlers();
if (!eventMgr.isRegistered()) Logger.info("RTG's Terrain Event Handlers have been unregistered successfully.");
}

}
}
18 changes: 15 additions & 3 deletions src/main/java/rtg/config/rtg/ConfigRTG.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@

import net.minecraftforge.common.config.Configuration;

import cpw.mods.fml.common.Loader;

import org.apache.commons.lang3.ArrayUtils;

import rtg.util.Logger;
import rtg.util.ModPresenceTester;
import cpw.mods.fml.common.Loader;

public class ConfigRTG
{
Expand Down Expand Up @@ -113,7 +114,8 @@ public class ConfigRTG
public static int rtgTreeChance = 2;

/* ==================== Scattered Features ==================== */


public static boolean enableScatteredFeatureModifications = true;
public static boolean generateScatteredFeatures = true;
public static int minDistanceScatteredFeatures = 12; // Vanilla = 8
public static int maxDistanceScatteredFeatures = 48; // Vanilla = 32
Expand Down Expand Up @@ -417,7 +419,17 @@ public static void init(File configFile)
);

/* ==================== Scattered Features ==================== */


enableScatteredFeatureModifications = config.getBoolean(
"Enable Scattered Feature Modifications",
"Scattered Features",
enableScatteredFeatureModifications,
"Must be set to TRUE for the other scattered feature settings to have any effect."
+ Configuration.NEW_LINE +
"If FALSE, RTG won't interfere with scattered feature generation at all."
+ Configuration.NEW_LINE
);

generateScatteredFeatures = config.getBoolean("Generate Scattered Features", "Scattered Features", generateScatteredFeatures, "");

minDistanceScatteredFeatures = config.getInt("Minimum distance between scattered features", "Scattered Features", minDistanceScatteredFeatures, 1, Integer.MAX_VALUE, "Scattered features = desert temples, jungle temples, and witch huts; 8 = Vanilla" + Configuration.NEW_LINE);
Expand Down
Loading

0 comments on commit aa88d98

Please sign in to comment.