generated from tilera/1710mod
This commit is contained in:
parent
0c28acea1d
commit
7c128b580f
5 changed files with 42 additions and 4 deletions
|
@ -49,6 +49,7 @@ public class AuraCore {
|
|||
|
||||
@Mod.EventHandler
|
||||
public void preInit(FMLPreInitializationEvent e) {
|
||||
Config.load();
|
||||
Aspects.load();
|
||||
CHANNEL = NetworkRegistry.INSTANCE.newSimpleChannel("auracore");
|
||||
int pktID = 0;
|
||||
|
|
23
src/main/java/dev/tilera/auracore/Config.java
Normal file
23
src/main/java/dev/tilera/auracore/Config.java
Normal file
|
@ -0,0 +1,23 @@
|
|||
package dev.tilera.auracore;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
|
||||
public class Config {
|
||||
|
||||
private static Configuration config = new Configuration(new File(Loader.instance().getConfigDir(), "AuraCore.cfg"));
|
||||
public static int nodeRarity = 23;
|
||||
public static int specialNodeRarity = 75;
|
||||
public static boolean replaceSilverwood = true;
|
||||
|
||||
public static void load() {
|
||||
config.load();
|
||||
nodeRarity = config.get("worldgen", "nodeRarity", nodeRarity).getInt(nodeRarity);
|
||||
specialNodeRarity = config.get("worldgen", "specialNodeRarity", specialNodeRarity).getInt(specialNodeRarity);
|
||||
replaceSilverwood = config.getBoolean("replaceSilverwood", "worldgen", replaceSilverwood, "Replace Silverwood trees with TC3 Silverwood");
|
||||
config.save();
|
||||
}
|
||||
|
||||
}
|
|
@ -5,6 +5,7 @@ import java.util.Random;
|
|||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Overwrite;
|
||||
|
||||
import dev.tilera.auracore.Config;
|
||||
import dev.tilera.auracore.api.EnumNodeType;
|
||||
import dev.tilera.auracore.aura.AuraManager;
|
||||
import dev.tilera.auracore.world.WorldGenSilverwoodTreesOld;
|
||||
|
@ -12,6 +13,7 @@ import net.minecraft.block.BlockBush;
|
|||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.world.World;
|
||||
import thaumcraft.common.blocks.BlockCustomPlant;
|
||||
import thaumcraft.common.lib.world.WorldGenSilverwoodTrees;
|
||||
|
||||
@Mixin(BlockCustomPlant.class)
|
||||
public abstract class MixinBlockCustomPlant extends BlockBush {
|
||||
|
@ -22,9 +24,10 @@ public abstract class MixinBlockCustomPlant extends BlockBush {
|
|||
*/
|
||||
@Overwrite(remap = false)
|
||||
public void growSilverTree(World world, int i, int j, int k, Random random) {
|
||||
if (world == null || world.provider == null) {
|
||||
if (world == null || world.provider == null || world.isRemote) {
|
||||
return;
|
||||
}
|
||||
if (Config.replaceSilverwood) {
|
||||
world.setBlock(i, j, k, Blocks.air, 0, 3);
|
||||
WorldGenSilverwoodTreesOld obj = new WorldGenSilverwoodTreesOld(true);
|
||||
int value = random.nextInt(50) + 50;
|
||||
|
@ -40,6 +43,13 @@ public abstract class MixinBlockCustomPlant extends BlockBush {
|
|||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
world.setBlockToAir(i, j, k);
|
||||
WorldGenSilverwoodTrees obj = new WorldGenSilverwoodTrees(true, 7, 5);
|
||||
if (!obj.generate(world, random, i, j, k)) {
|
||||
world.setBlock(i, j, k, this, 1, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ import thaumcraft.api.aspects.Aspect;
|
|||
import thaumcraft.common.config.Config;
|
||||
import thaumcraft.common.config.ConfigBlocks;
|
||||
import thaumcraft.common.lib.world.ThaumcraftWorldGenerator;
|
||||
import thaumcraft.common.lib.world.WorldGenSilverwoodTrees;
|
||||
import thaumcraft.common.lib.world.biomes.BiomeHandler;
|
||||
|
||||
@Mixin(ThaumcraftWorldGenerator.class)
|
||||
|
@ -36,7 +37,7 @@ public abstract class MixinThaumcraftWorldGenerator {
|
|||
BiomeGenBase bio = world.getBiomeGenForCoords(x, z);
|
||||
if (bio.equals(ThaumcraftWorldGenerator.biomeMagicalForest) || bio.equals(ThaumcraftWorldGenerator.biomeTaint) || !BiomeDictionary.isBiomeOfType(bio, Type.MAGICAL) && bio.biomeID != BiomeGenBase.forestHills.biomeID && bio.biomeID != BiomeGenBase.birchForestHills.biomeID) {
|
||||
return false;
|
||||
} else {
|
||||
} else if (dev.tilera.auracore.Config.replaceSilverwood) {
|
||||
boolean t = (new WorldGenSilverwoodTreesOld(false)).generate(world, random, x, y, z);
|
||||
if (t) {
|
||||
int value = random.nextInt(200) + 200;
|
||||
|
@ -44,6 +45,8 @@ public abstract class MixinThaumcraftWorldGenerator {
|
|||
ThaumcraftWorldGenerator.generateFlowers(world, random, x, y, z, 2);
|
||||
}
|
||||
return t;
|
||||
} else {
|
||||
return (new WorldGenSilverwoodTrees(false, 7, 4)).generate(world, random, x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.util.HashMap;
|
|||
import java.util.Random;
|
||||
|
||||
import cpw.mods.fml.common.IWorldGenerator;
|
||||
import dev.tilera.auracore.Config;
|
||||
import dev.tilera.auracore.api.EnumNodeType;
|
||||
import dev.tilera.auracore.aura.AuraManager;
|
||||
import dev.tilera.auracore.aura.NodeIdStorage;
|
||||
|
@ -92,7 +93,7 @@ public class WorldGenerator implements IWorldGenerator {
|
|||
}
|
||||
|
||||
private boolean generateAura(World world, Random random, int chunkX, int chunkZ, boolean auraGen, boolean newGen) {
|
||||
if (random.nextInt(/*Config.nodeRarity*/23) == 0 && !auraGen) {
|
||||
if (random.nextInt(Config.nodeRarity) == 0 && !auraGen) {
|
||||
int y;
|
||||
int p;
|
||||
int z;
|
||||
|
@ -117,7 +118,7 @@ public class WorldGenerator implements IWorldGenerator {
|
|||
boolean bbase = false;
|
||||
int value = random.nextInt(/*BiomeHandler.getBiomeAura(bg)*/400 / 2) + /*BiomeHandler.getBiomeAura(bg)*/400 / 2;
|
||||
EnumNodeType type = EnumNodeType.NORMAL;
|
||||
if (random.nextInt(/*Config.specialNodeRarity*/75) == 0) {
|
||||
if (random.nextInt(Config.specialNodeRarity) == 0) {
|
||||
switch (random.nextInt(3)) {
|
||||
case 0: {
|
||||
type = EnumNodeType.PURE;
|
||||
|
|
Loading…
Reference in a new issue