Skip to content

Commit

Permalink
Merge pull request #1093 from Team-RTG/1.10.2-dev
Browse files Browse the repository at this point in the history
Merge dev into master (4.1.2.1)
  • Loading branch information
whichonespink44 authored Dec 27, 2016
2 parents 05e6bdf + 1597c0e commit 0019b45
Show file tree
Hide file tree
Showing 230 changed files with 6,187 additions and 3,328 deletions.
2 changes: 1 addition & 1 deletion build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,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=4.1.2.0
mod_version=4.1.2.1
mc_version=1.10.2
mod_url=https://github.com/Team-RTG/Realistic-Terrain-Generation
mod_author="Team RTG"
Expand Down
2 changes: 1 addition & 1 deletion etc/config/RTG/rtg.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ strongholds {
B:"Generate Strongholds"=true

# This setting is the number of strongholds that exist per world.
# HIGHER values = MORE strongholds & MORE lag. (3 = Vanilla)
# HIGHER values = MORE strongholds & MORE lag. (128 = Vanilla)
# [range: 1 ~ 2147483647, default: 128]
I:"Stronghold Count"=128

Expand Down
1 change: 1 addition & 0 deletions mod_deps.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ bopver=1.10.2-5.0.0.2085
acver=1.10.2-1.9.2.9
depstring=after:BiomesOPlenty@[5.0.0.2085,);\
after:AbyssalCraftAPI@[1.8.1,);\
after:arsmagica2@[1.5.012,);\
after:betteragriculture@[0.16,);\
after:BiomesYouGo@[4.0.0,);\
after:CookingPlus@[0.8.7,);\
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/rtg/RTG.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import rtg.world.WorldTypeRTG;
import rtg.world.biome.realistic.abyssalcraft.RealisticBiomeACBase;
import rtg.world.biome.realistic.agriculturalrevolution.RealisticBiomeARBase;
import rtg.world.biome.realistic.arsmagica.RealisticBiomeAMBase;
import rtg.world.biome.realistic.betteragriculture.RealisticBiomeBABase;
import rtg.world.biome.realistic.biomesoplenty.RealisticBiomeBOPBase;
import rtg.world.biome.realistic.biomesyougo.RealisticBiomeBYGBase;
Expand Down Expand Up @@ -96,6 +97,7 @@ public void initPost(FMLPostInitializationEvent event) {
RealisticBiomeVanillaBase.addBiomes();

RealisticBiomeACBase.addBiomes();
RealisticBiomeAMBase.addBiomes();
RealisticBiomeARBase.addBiomes();
RealisticBiomeBABase.addBiomes();
RealisticBiomeBOPBase.addBiomes();
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/rtg/api/config/RTGConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -1048,7 +1048,7 @@ public RTGConfig() {
"Strongholds",
"This setting is the number of strongholds that exist per world."
+ Configuration.NEW_LINE +
"HIGHER values = MORE strongholds & MORE lag. (3 = Vanilla)",
"HIGHER values = MORE strongholds & MORE lag. (128 = Vanilla)",
128, 1, Integer.MAX_VALUE
);
this.addProperty(STRONGHOLD_COUNT);
Expand Down
48 changes: 31 additions & 17 deletions src/main/java/rtg/event/EventManagerRTG.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import rtg.world.WorldTypeRTG;
import rtg.world.biome.BiomeProviderRTG;
import rtg.world.biome.realistic.RealisticBiomeBase;
import rtg.world.biome.realistic.RealisticBiomePatcher;
import rtg.world.gen.feature.tree.rtg.TreeRTG;
import rtg.world.gen.genlayer.RiverRemover;

Expand Down Expand Up @@ -87,75 +86,91 @@ public void generateMinableRTG(OreGenEvent.GenerateMinable event) {
return;
}

String eventName = null;
OreGenEvent.GenerateMinable.EventType eventType = event.getType();

// No switch statements allowed! - Pink

if (eventType == ANDESITE) {
eventName = "ANDESITE";
if (!rtgConfig.GENERATE_ORE_ANDESITE.get()) {
event.setResult(Event.Result.DENY);
}
}
else if (eventType == COAL) {
eventName = "COAL";
if (!rtgConfig.GENERATE_ORE_COAL.get()) {
event.setResult(Event.Result.DENY);
}
}
else if (eventType == DIAMOND) {
eventName = "DIAMOND";
if (!rtgConfig.GENERATE_ORE_DIAMOND.get()) {
event.setResult(Event.Result.DENY);
}
}
else if (eventType == DIORITE) {
eventName = "DIORITE";
if (!rtgConfig.GENERATE_ORE_DIORITE.get()) {
event.setResult(Event.Result.DENY);
}
}
else if (eventType == DIRT) {
eventName = "DIRT";
if (!rtgConfig.GENERATE_ORE_DIRT.get()) {
event.setResult(Event.Result.DENY);
}
}
else if (eventType == EMERALD) {
eventName = "EMERALD";
if (!rtgConfig.GENERATE_ORE_EMERALD.get()) {
event.setResult(Event.Result.DENY);
}
}
else if (eventType == GOLD) {
eventName = "GOLD";
if (!rtgConfig.GENERATE_ORE_GOLD.get()) {
event.setResult(Event.Result.DENY);
}
}
else if (eventType == GRANITE) {
eventName = "GRANITE";
if (!rtgConfig.GENERATE_ORE_GRANITE.get()) {
event.setResult(Event.Result.DENY);
}
}
else if (eventType == GRAVEL) {
eventName = "GRAVEL";
if (!rtgConfig.GENERATE_ORE_GRAVEL.get()) {
event.setResult(Event.Result.DENY);
}
}
else if (eventType == IRON) {
eventName = "IRON";
if (!rtgConfig.GENERATE_ORE_IRON.get()) {
event.setResult(Event.Result.DENY);
}
}
else if (eventType == LAPIS) {
eventName = "LAPIS";
if (!rtgConfig.GENERATE_ORE_LAPIS.get()) {
event.setResult(Event.Result.DENY);
}
}
else if (eventType == REDSTONE) {
eventName = "REDSTONE";
if (!rtgConfig.GENERATE_ORE_REDSTONE.get()) {
event.setResult(Event.Result.DENY);
}
}
else if (eventType == SILVERFISH) {
eventName = "SILVERFISH";
if (!rtgConfig.GENERATE_ORE_SILVERFISH.get()) {
event.setResult(Event.Result.DENY);
}
}

//Logger.debug("%s EVENT @ %d %d %d (%d %d)", eventName, event.getPos().getX(), event.getPos().getY(), event.getPos().getZ(), (event.getPos().getX() / 16), (event.getPos().getZ() / 16));
}
}

Expand Down Expand Up @@ -220,11 +235,10 @@ public void saplingGrowTreeRTG(SaplingGrowTreeEvent event) {
Biome bgg = event.getWorld().getBiome(event.getPos());
RealisticBiomeBase rb = RealisticBiomeBase.getBiome(Biome.getIdForBiome(bgg));

// Do we need to patch the biome?
// Instead of patching the biome, we should just return early here to allow vanilla logic to kick in.
if (rb == null) {
RealisticBiomePatcher biomePatcher = new RealisticBiomePatcher();
rb = biomePatcher.getPatchedRealisticBiome(
"NULL biome (" + Biome.getIdForBiome(bgg) + ") found when growing an RTG sapling.");
Logger.debug("NULL biome (%d) found when trying to grow an RTG tree from a sapling.", Biome.getIdForBiome(bgg));
return;
}

ArrayList<TreeRTG> biomeTrees = rb.rtgTrees;
Expand All @@ -242,12 +256,12 @@ public void saplingGrowTreeRTG(SaplingGrowTreeEvent event) {
for (int i = 0; i < biomeTrees.size(); i++) {

Logger.debug("Biome Tree #%d = %s", i, biomeTrees.get(i).getClass().getName());
Logger.debug("Biome Tree #%d Sapling Block = %s", i, biomeTrees.get(i).saplingBlock.getBlock().getLocalizedName());
Logger.debug("Biome Tree #%d Sapling Meta = %d", i, SaplingUtil.getMetaFromState(biomeTrees.get(i).saplingBlock));
Logger.debug("Biome Tree #%d Sapling Block = %s", i, biomeTrees.get(i).getSaplingBlock().getBlock().getLocalizedName());
Logger.debug("Biome Tree #%d Sapling Meta = %d", i, SaplingUtil.getMetaFromState(biomeTrees.get(i).getSaplingBlock()));

if (saplingBlock.getBlock() == biomeTrees.get(i).saplingBlock.getBlock()) {
if (saplingBlock.getBlock() == biomeTrees.get(i).getSaplingBlock().getBlock()) {

if (SaplingUtil.getMetaFromState(saplingBlock) == SaplingUtil.getMetaFromState(biomeTrees.get(i).saplingBlock)) {
if (SaplingUtil.getMetaFromState(saplingBlock) == SaplingUtil.getMetaFromState(biomeTrees.get(i).getSaplingBlock())) {

validTrees.add(biomeTrees.get(i));
Logger.debug("Valid tree found!");
Expand All @@ -267,18 +281,18 @@ public void saplingGrowTreeRTG(SaplingGrowTreeEvent event) {
Logger.debug("Tree = %s", tree.getClass().getName());

// Set the trunk size if min/max values have been set.
if (tree.minTrunkSize > 0 && tree.maxTrunkSize > tree.minTrunkSize) {
if (tree.getMinTrunkSize() > 0 && tree.getMaxTrunkSize() > tree.getMinTrunkSize()) {

tree.trunkSize = RandomUtil.getRandomInt(event.getRand(), tree.minTrunkSize, tree.maxTrunkSize);
tree.setTrunkSize(RandomUtil.getRandomInt(event.getRand(), tree.getMinTrunkSize(), tree.getMaxTrunkSize()));
}

// Set the crown size if min/max values have been set.
if (tree.minCrownSize > 0 && tree.maxCrownSize > tree.minCrownSize) {
if (tree.getMinCrownSize() > 0 && tree.getMaxCrownSize() > tree.getMinCrownSize()) {

tree.crownSize = RandomUtil.getRandomInt(event.getRand(), tree.minCrownSize, tree.maxCrownSize);
tree.setCrownSize(RandomUtil.getRandomInt(event.getRand(), tree.getMinCrownSize(), tree.getMaxCrownSize()));
}

int treeHeight = tree.trunkSize + tree.crownSize;
int treeHeight = tree.getTrunkSize() + tree.getCrownSize();
if (treeHeight < 1) {
Logger.debug("Unable to grow RTG tree with no height.");
return;
Expand All @@ -295,10 +309,10 @@ public void saplingGrowTreeRTG(SaplingGrowTreeEvent event) {
*
* TODO: Does this affect the generation of normal RTG trees? - Pink
*/
int oldFlag = tree.generateFlag;
tree.generateFlag = 3;
int oldFlag = tree.getGenerateFlag();
tree.setGenerateFlag(3);
boolean generated = tree.generate(event.getWorld(), event.getRand(), event.getPos());
tree.generateFlag = oldFlag;
tree.setGenerateFlag(oldFlag);

if (generated) {

Expand Down
9 changes: 3 additions & 6 deletions src/main/java/rtg/util/Logger.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package rtg.util;

import net.minecraft.crash.CrashReport;

import net.minecraftforge.fml.common.FMLLog;

import org.apache.logging.log4j.Level;
Expand All @@ -14,7 +12,7 @@ public class Logger {
public static void debug(String format, Object... data) {

if (RTGAPI.config().ENABLE_DEBUGGING.get()) {
FMLLog.log(Level.INFO, "[RTG-DEBUG] " + format, data);
FMLLog.log(Level.WARN, "[RTG-DEBUG] " + format, data);
}
}

Expand All @@ -33,9 +31,8 @@ public static void error(String format, Object... data) {
FMLLog.log(Level.ERROR, "[RTG-ERROR] " + format, data);
}

public static void fatal(String message, Throwable throwable, Object... data) {
public static void fatal(String format, Object... data) {

CrashReport crashreport = CrashReport.makeCrashReport(throwable, message);
FMLLog.bigWarning("[RTG-FATAL] " + crashreport.getCompleteReport(), data);
FMLLog.log(Level.FATAL, "[RTG-FATAL] " + format, data);
}
}
38 changes: 22 additions & 16 deletions src/main/java/rtg/world/biome/deco/DecoAbyssalCraftTree.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*/
public class DecoAbyssalCraftTree extends DecoTree {

public TreeType treeType;
private TreeType treeType;

public DecoAbyssalCraftTree() {

Expand All @@ -30,21 +30,21 @@ public DecoAbyssalCraftTree() {
* Default values.
* These can be overridden when configuring the Deco object in the realistic biome.
*/
this.loops = 1;
this.strengthFactorForLoops = 0f;
this.strengthNoiseFactorForLoops = false;
this.strengthNoiseFactorXForLoops = false;
this.treeType = TreeType.DARKWOOD;
this.distribution = new DecoTree.Distribution(100f, 5f, 0.8f);
this.treeCondition = TreeCondition.NOISE_GREATER_AND_RANDOM_CHANCE;
this.treeConditionNoise = 0f;
this.treeConditionChance = 1;
this.minY = 63; // No underwater trees by default.
this.maxY = 230; // Sensible upper height limit by default.
this.logBlock = Blocks.LOG.getDefaultState();
this.leavesBlock = Blocks.LEAVES.getDefaultState();
this.minSize = 2;
this.maxSize = 4;
this.setLoops(1);
this.setStrengthFactorForLoops(0f);
this.setStrengthNoiseFactorForLoops(false);
this.setStrengthNoiseFactorXForLoops(false);
this.setTreeType(TreeType.DARKWOOD);
this.setDistribution(new DecoTree.Distribution(100f, 5f, 0.8f));
this.setTreeCondition(TreeCondition.NOISE_GREATER_AND_RANDOM_CHANCE);
this.setTreeConditionNoise(0f);
this.setTreeConditionChance(1);
this.setMinY(63); // No underwater trees by default.
this.setMaxY(230); // Sensible upper height limit by default.
this.setLogBlock(Blocks.LOG.getDefaultState());
this.setLeavesBlock(Blocks.LEAVES.getDefaultState());
this.setMinSize(2);
this.setMaxSize(4);

this.addDecoTypes(DecoType.TREE);
}
Expand Down Expand Up @@ -96,4 +96,10 @@ public void generate(RealisticBiomeBase biome, RTGWorld rtgWorld, Random rand, i
public enum TreeType {
DARKWOOD;
}

public DecoAbyssalCraftTree setTreeType(TreeType treeType) {

this.treeType = treeType;
return this;
}
}
Loading

0 comments on commit 0019b45

Please sign in to comment.