Merge pull request #930 from nornagon/extraconfig-1.11

Make some noise params from vanilla configurable
This commit is contained in:
Adubbz 2017-01-01 11:09:19 +11:00 committed by GitHub
commit 6c6a71aae5
3 changed files with 87 additions and 17 deletions

View file

@ -192,7 +192,14 @@ public class GuiBOPConfigureWorld extends GuiScreen implements GuiSlider.FormatH
GENERATE_HOT_SPRINGS (123),
GENERATE_NETHER_HIVES (124),
GENERATE_NETHER_PLANTS (125),
GENERATE_END_FEATURES (126);
GENERATE_END_FEATURES (126),
MAIN_NOISE_SCALE_X (127),
MAIN_NOISE_SCALE_Y (128),
MAIN_NOISE_SCALE_Z (129),
COORDINATE_SCALE (130),
HEIGHT_SCALE (131),
UPPER_LIMIT_SCALE (132),
LOWER_LIMIT_SCALE (133);
private int id;
@ -229,7 +236,14 @@ public class GuiBOPConfigureWorld extends GuiScreen implements GuiSlider.FormatH
new GuiBOPPageList.GuiEnumButtonEntry<LandMassScheme>(GuiEntries.LAND_SCHEME.getId(), "Land Mass: %s", true, this.settings.landScheme),
new GuiBOPPageList.GuiEnumButtonEntry<TemperatureVariationScheme>(GuiEntries.TEMP_SCHEME.getId(), "Temperature: %s", true, this.settings.tempScheme),
new GuiBOPPageList.GuiEnumButtonEntry<RainfallVariationScheme>(GuiEntries.RAIN_SCHEME.getId(), "Rainfall: %s", true, this.settings.rainScheme),
new GuiBOPPageList.GuiSlideEntry(GuiEntries.AMPLITUDE.getId(), "Amplitude", true, this, 0.2F, 3.0F, this.settings.amplitude)
new GuiBOPPageList.GuiSlideEntry(GuiEntries.AMPLITUDE.getId(), "Amplitude", true, this, 0.2F, 3.0F, this.settings.amplitude),
new GuiBOPPageList.GuiSlideEntry(GuiEntries.MAIN_NOISE_SCALE_X.getId(), "Main Noise Scale X", true, this, 1.0F, 5000.0F, this.settings.mainNoiseScaleX),
new GuiBOPPageList.GuiSlideEntry(GuiEntries.MAIN_NOISE_SCALE_Y.getId(), "Main Noise Scale Y", true, this, 1.0F, 5000.0F, this.settings.mainNoiseScaleY),
new GuiBOPPageList.GuiSlideEntry(GuiEntries.MAIN_NOISE_SCALE_Z.getId(), "Main Noise Scale Z", true, this, 1.0F, 5000.0F, this.settings.mainNoiseScaleZ),
new GuiBOPPageList.GuiSlideEntry(GuiEntries.COORDINATE_SCALE.getId(), "Coordinate Scale", true, this, 1.0F, 6000.0F, this.settings.coordinateScale),
new GuiBOPPageList.GuiSlideEntry(GuiEntries.HEIGHT_SCALE.getId(), "Height Scale", true, this, 1.0F, 6000.0F, this.settings.heightScale),
new GuiBOPPageList.GuiSlideEntry(GuiEntries.UPPER_LIMIT_SCALE.getId(), "Upper Limit Scale", true, this, 1.0F, 5000.0F, this.settings.upperLimitScale),
new GuiBOPPageList.GuiSlideEntry(GuiEntries.LOWER_LIMIT_SCALE.getId(), "Lower Limit Scale", true, this, 1.0F, 5000.0F, this.settings.lowerLimitScale),
};
this.pageNames[1] = "Biome Settings";
@ -301,6 +315,13 @@ public class GuiBOPConfigureWorld extends GuiScreen implements GuiSlider.FormatH
switch (entry)
{
case AMPLITUDE:
case MAIN_NOISE_SCALE_X:
case MAIN_NOISE_SCALE_Y:
case MAIN_NOISE_SCALE_Z:
case COORDINATE_SCALE:
case HEIGHT_SCALE:
case UPPER_LIMIT_SCALE:
case LOWER_LIMIT_SCALE:
return String.format("%5.3f", new Object[] {Float.valueOf(value)});
default:
return "";
@ -430,6 +451,27 @@ public class GuiBOPConfigureWorld extends GuiScreen implements GuiSlider.FormatH
case AMPLITUDE:
this.settings.amplitude = value;
break;
case MAIN_NOISE_SCALE_X:
this.settings.mainNoiseScaleX = value;
break;
case MAIN_NOISE_SCALE_Y:
this.settings.mainNoiseScaleY = value;
break;
case MAIN_NOISE_SCALE_Z:
this.settings.mainNoiseScaleZ = value;
break;
case COORDINATE_SCALE:
this.settings.coordinateScale = value;
break;
case HEIGHT_SCALE:
this.settings.heightScale = value;
break;
case UPPER_LIMIT_SCALE:
this.settings.upperLimitScale = value;
break;
case LOWER_LIMIT_SCALE:
this.settings.lowerLimitScale = value;
break;
default:
break;
}

View file

@ -114,6 +114,13 @@ public class BOPWorldSettings implements IBOPWorldSettings
public int lavaLakeChance;
public boolean useLavaOceans;
public float coordinateScale;
public float heightScale;
public float upperLimitScale;
public float lowerLimitScale;
public float mainNoiseScaleX;
public float mainNoiseScaleY;
public float mainNoiseScaleZ;
public BOPWorldSettings()
{
@ -154,6 +161,13 @@ public class BOPWorldSettings implements IBOPWorldSettings
obj.addProperty("generateNetherHives", this.generateNetherHives);
obj.addProperty("generateNetherPlants", this.generateNetherPlants);
obj.addProperty("generateEndFeatures", this.generateEndFeatures);
obj.addProperty("mainNoiseScaleX", this.mainNoiseScaleX);
obj.addProperty("mainNoiseScaleY", this.mainNoiseScaleY);
obj.addProperty("mainNoiseScaleZ", this.mainNoiseScaleZ);
obj.addProperty("coordinateScale", this.coordinateScale);
obj.addProperty("heightScale", this.heightScale);
obj.addProperty("upperLimitScale", this.upperLimitScale);
obj.addProperty("lowerLimitScale", this.lowerLimitScale);
return serializer.toJson(obj);
}
@ -190,6 +204,13 @@ public class BOPWorldSettings implements IBOPWorldSettings
this.generateNetherHives = worldConfig.getBool("generateNetherHives", this.generateNetherHives);
this.generateNetherPlants = worldConfig.getBool("generateNetherPlants", this.generateNetherPlants);
this.generateEndFeatures = worldConfig.getBool("generateEndFeatures", this.generateEndFeatures);
this.mainNoiseScaleX = worldConfig.getFloat("mainNoiseScaleX", this.mainNoiseScaleX);
this.mainNoiseScaleY = worldConfig.getFloat("mainNoiseScaleY", this.mainNoiseScaleY);
this.mainNoiseScaleZ = worldConfig.getFloat("mainNoiseScaleZ", this.mainNoiseScaleZ);
this.coordinateScale = worldConfig.getFloat("coordinateScale", this.coordinateScale);
this.heightScale = worldConfig.getFloat("heightScale", this.heightScale);
this.upperLimitScale = worldConfig.getFloat("upperLimitScale", this.upperLimitScale);
this.lowerLimitScale = worldConfig.getFloat("lowerLimitScale", this.lowerLimitScale);
}
public void setDefault()
@ -239,6 +260,13 @@ public class BOPWorldSettings implements IBOPWorldSettings
this.lavaLakeChance = 80;
this.useLavaOceans = false;
this.mainNoiseScaleX = 80.0F;
this.mainNoiseScaleY = 160.0F;
this.mainNoiseScaleZ = 80.0F;
this.coordinateScale = 684.412F;
this.heightScale = 684.412F;
this.upperLimitScale = 512.0F;
this.lowerLimitScale = 512.0F;
// Allow defaults to be overridden from file
IConfigObj worldConfig = new BOPConfig.ConfigFileObj(new File(BiomesOPlenty.configDirectory, "world.json"));

View file

@ -379,13 +379,13 @@ public class ChunkProviderGenerateBOP implements IChunkGenerator
Biome[] biomes = this.worldObj.getBiomeProvider().getBiomesForGeneration(null, chunkX * 4 - 2, chunkZ * 4 - 2, 10, 10);
// values from vanilla
float coordinateScale = 684.412F;
float heightScale = 684.412F;
double upperLimitScale = 512.0D;
double lowerLimitScale = 512.0D;
float mainNoiseScaleX = 80.0F;
float mainNoiseScaleY = 160.0F;
float mainNoiseScaleZ = 80.0F;
float coordinateScale = this.settings.coordinateScale;
float heightScale = this.settings.heightScale;
double upperLimitScale = this.settings.upperLimitScale;
double lowerLimitScale = this.settings.lowerLimitScale;
float mainNoiseScaleX = this.settings.mainNoiseScaleX;
float mainNoiseScaleY = this.settings.mainNoiseScaleY;
float mainNoiseScaleZ = this.settings.mainNoiseScaleZ;
int subchunkX = chunkX * 4;
int subchunkY = 0;