feat: use config instead of hacky worldtype check
This commit is contained in:
parent
e7bf699fe5
commit
b873e2129e
|
@ -24,7 +24,7 @@ apply from: './gradle/scripts/mixins.gradle'
|
|||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
|
||||
version = "1.3.0"
|
||||
version = "1.4.0"
|
||||
group= "dev.tilera.modding"
|
||||
archivesBaseName = "cwg"
|
||||
|
||||
|
|
|
@ -17,7 +17,6 @@ import net.minecraftforge.event.terraingen.InitMapGenEvent;
|
|||
public class ClassicWorldgen {
|
||||
|
||||
public static final WorldType CLASSIC = new WorldTypeClassic("onesix");
|
||||
public static WorldType USED = null;
|
||||
public static BiomeGenBase[] biomeCache = new BiomeGenBase[256];
|
||||
|
||||
@Mod.Instance
|
||||
|
@ -37,14 +36,13 @@ public class ClassicWorldgen {
|
|||
|
||||
@SubscribeEvent
|
||||
public void onInitMapGen(InitMapGenEvent event) {
|
||||
if (event.type == InitMapGenEvent.EventType.CAVE && (Config.enableSwissCheeseCaves || USED == CLASSIC)) {
|
||||
if (event.type == InitMapGenEvent.EventType.CAVE && Config.enableSwissCheeseCaves) {
|
||||
event.newGen = new MapGenCavesSwiss();
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onServerLoad(FMLServerStartingEvent event) {
|
||||
USED = event.getServer().getEntityWorld().getWorldInfo().getTerrainType();
|
||||
if (Config.changeWorldTypeCommand)
|
||||
event.registerServerCommand(new CommandChangeWorld());
|
||||
}
|
||||
|
|
|
@ -12,6 +12,9 @@ public class Config {
|
|||
public static boolean blockNewVanillaBiomes = true;
|
||||
public static boolean addNewVanillaBiomes = false;
|
||||
public static boolean changeWorldTypeCommand = false;
|
||||
public static boolean disableNewFlowers = false;
|
||||
public static boolean classicExtremeHills = false;
|
||||
public static boolean disableHeightTemperature = false;
|
||||
|
||||
public static void initConfig() {
|
||||
conf = new Configuration(new File(Loader.instance().getConfigDir(), "ClassicWorldgen.cfg"));
|
||||
|
@ -19,6 +22,9 @@ public class Config {
|
|||
enableSwissCheeseCaves = conf.getBoolean("enableSwissCheeseCaves", "caves", enableSwissCheeseCaves, "enable classic (1.6) cavegen");
|
||||
blockNewVanillaBiomes = conf.getBoolean("blockNewVanillaBiomes", "worldgen", blockNewVanillaBiomes, "prevent new 1.7 vanilla biomes from generating with classic/1.6 WorldType");
|
||||
addNewVanillaBiomes = conf.getBoolean("addNewVanillaBiomes", "worldgen", addNewVanillaBiomes, "generate new 1.7 vanilla biomes with classic/1.6 WorldType");
|
||||
disableNewFlowers = conf.getBoolean("disableNewFlowers", "tweaks", disableNewFlowers, "prevent new 1.7 flowers from generating in swamps and plains");
|
||||
classicExtremeHills = conf.getBoolean("classicExtremeHills", "tweaks", classicExtremeHills, "generate 1.6 extreme hills instead of 1.7");
|
||||
disableHeightTemperature = conf.getBoolean("disableHeightTemperature", "tweaks", disableHeightTemperature, "disable snow on mountains");
|
||||
changeWorldTypeCommand = conf.getBoolean("changeTypeCommand", "commands", changeWorldTypeCommand, "enable command to change the WorldType");
|
||||
conf.save();
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|||
import org.spongepowered.asm.mixin.injection.At;
|
||||
|
||||
import dev.tilera.cwg.ClassicWorldgen;
|
||||
import dev.tilera.cwg.Config;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import net.minecraft.world.gen.NoiseGeneratorPerlin;
|
||||
|
||||
|
@ -41,7 +42,7 @@ public abstract class MixinBiomeGenBase {
|
|||
*/
|
||||
@Overwrite
|
||||
public final float getFloatTemperature(int p_150564_1_, int p_150564_2_, int p_150564_3_) {
|
||||
if (p_150564_2_ > 64 && ClassicWorldgen.USED != ClassicWorldgen.CLASSIC) {
|
||||
if (p_150564_2_ > 64 && !Config.disableHeightTemperature) {
|
||||
float f = (float)temperatureNoise.func_151601_a((double)p_150564_1_ * 1.0D / 8.0D, (double)p_150564_3_ * 1.0D / 8.0D) * 4.0F;
|
||||
return this.temperature - (f + (float)p_150564_2_ - 64.0F) * 0.05F / 30.0F;
|
||||
} else {
|
||||
|
|
|
@ -7,6 +7,7 @@ import org.spongepowered.asm.mixin.Overwrite;
|
|||
import org.spongepowered.asm.mixin.Shadow;
|
||||
|
||||
import dev.tilera.cwg.ClassicWorldgen;
|
||||
import dev.tilera.cwg.Config;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -37,7 +38,7 @@ public abstract class MixinBiomeGenHills extends BiomeGenBase {
|
|||
*/
|
||||
@Overwrite(remap = false)
|
||||
public WorldGenAbstractTree func_150567_a(Random p_150567_1_) {
|
||||
if (ClassicWorldgen.USED == ClassicWorldgen.CLASSIC)
|
||||
if (Config.classicExtremeHills)
|
||||
return super.func_150567_a(p_150567_1_);
|
||||
else
|
||||
return (WorldGenAbstractTree)(p_150567_1_.nextInt(3) > 0 ? this.field_150634_aD : super.func_150567_a(p_150567_1_));
|
||||
|
@ -49,7 +50,7 @@ public abstract class MixinBiomeGenHills extends BiomeGenBase {
|
|||
*/
|
||||
@Overwrite(remap = false)
|
||||
public void genTerrainBlocks(World p_150573_1_, Random p_150573_2_, Block[] p_150573_3_, byte[] p_150573_4_, int p_150573_5_, int p_150573_6_, double p_150573_7_) {
|
||||
if (p_150573_1_.getWorldInfo().getTerrainType() == ClassicWorldgen.CLASSIC) {
|
||||
if (p_150573_1_.getWorldInfo().getTerrainType() == ClassicWorldgen.CLASSIC || Config.classicExtremeHills) {
|
||||
super.genTerrainBlocks(p_150573_1_, p_150573_2_, p_150573_3_, p_150573_4_, p_150573_5_, p_150573_6_, p_150573_7_);
|
||||
} else {
|
||||
this.topBlock = Blocks.grass;
|
||||
|
|
|
@ -5,7 +5,7 @@ import java.util.Random;
|
|||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Overwrite;
|
||||
|
||||
import dev.tilera.cwg.ClassicWorldgen;
|
||||
import dev.tilera.cwg.Config;
|
||||
import net.minecraft.block.BlockFlower;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import net.minecraft.world.biome.BiomeGenPlains;
|
||||
|
@ -23,7 +23,7 @@ public abstract class MixinBiomeGenPlains extends BiomeGenBase {
|
|||
*/
|
||||
@Overwrite(remap = false)
|
||||
public String func_150572_a(Random p_150572_1_, int p_150572_2_, int p_150572_3_, int p_150572_4_) {
|
||||
if (ClassicWorldgen.USED != ClassicWorldgen.CLASSIC) {
|
||||
if (!Config.disableNewFlowers) {
|
||||
double d0 = plantNoise.func_151601_a((double)p_150572_2_ / 200.0D, (double)p_150572_4_ / 200.0D);
|
||||
int l;
|
||||
if (d0 < -0.8D) {
|
||||
|
|
|
@ -5,7 +5,7 @@ import java.util.Random;
|
|||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Overwrite;
|
||||
|
||||
import dev.tilera.cwg.ClassicWorldgen;
|
||||
import dev.tilera.cwg.Config;
|
||||
import net.minecraft.block.BlockFlower;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import net.minecraft.world.biome.BiomeGenSwamp;
|
||||
|
@ -23,7 +23,7 @@ public abstract class MixinBiomeGenSwamp extends BiomeGenBase {
|
|||
*/
|
||||
@Overwrite(remap = false)
|
||||
public String func_150572_a(Random p_150572_1_, int p_150572_2_, int p_150572_3_, int p_150572_4_) {
|
||||
if (ClassicWorldgen.USED != ClassicWorldgen.CLASSIC) {
|
||||
if (!Config.disableNewFlowers) {
|
||||
return BlockFlower.field_149859_a[1];
|
||||
}
|
||||
return super.func_150572_a(p_150572_1_, p_150572_2_, p_150572_3_, p_150572_4_);
|
||||
|
|
Loading…
Reference in a new issue