Skip to content

Commit

Permalink
Fixed ( Ted80-Minecraft-Mods#2 ), Added config, Optimized CellNoise, …
Browse files Browse the repository at this point in the history
…Added event, Bug fixes
  • Loading branch information
Adahel committed May 8, 2023
1 parent 1cd1aa1 commit cb3501c
Show file tree
Hide file tree
Showing 19 changed files with 140 additions and 212 deletions.
16 changes: 13 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,16 @@ Features:
12. Start your server.

## CHANGELOG ##
Version 1.0.9 '08-05-2023'
- Fixed biome grass and foliage colors (https://github.com/Ted80-Minecraft-Mods/Old-World-Gen/issues/2)
- Added config for biome placement by makamys (https://github.com/makamys/Fun-World-Gen/commit/01b846752e4780e78fb432d471af1564b01ea349)
- Optimized CellNoise
- Reload config on world reload by makamys (https://github.com/makamys/Fun-World-Gen/commit/264c20ea3f28041ff73c6916323c30b2806e8280)
- Removed ocean biome if deep ocean biome is enabled
- Fixed ocean monuments to be more suitable for the terrain generated
- Fixed big oak tree now appears in alpha 1.1.0
- Removed dead code

Version 1.0.8 '12-10-2019'
- Endless rain on snow worlds (indev, infdev and alpha 1.1)
- Changed end sky dungeon spawner to silverfish
Expand All @@ -49,14 +59,14 @@ Features:
- Added new caves option: original caves, vanilla caves
- Minor changes in chunk generators
- Removed some useless code

Version 1.0.7 (Private Release) '08-10-2019'
- Revised lang files

Version 1.0.6 '31-05-2019'
- Fixed torches bug from Indev House
- Added y emulator. Thanks Nicholai
- Added Deepen Ocean. Thanks Nicholai
- Added Deep Ocean. Thanks Nicholai
- Added Ocean Monument generator
- Added new biomes: Ocean, Beach, (Gravel Beach (Biomes O' Plenty only))
- Added new lang files
Expand Down
12 changes: 10 additions & 2 deletions owg/OWG.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.event.FMLServerAboutToStartEvent;
import net.minecraftforge.fml.relauncher.Side;
import owg.biomes.BiomeList;
import owg.config.ConfigOWG;
Expand All @@ -18,12 +19,13 @@
import owg.support.Support;
import owg.world.WorldTypeOWG;

@SuppressWarnings("deprecation")
@Mod(modid = OWG.MODID, version = OWG.VERSION, acceptedMinecraftVersions = "[1.8.9]")
public class OWG
{
public static final String MODID = "OWG";
public static final String NAME = "Old World Gen";
public static final String VERSION = "1.0.8";
public static final String VERSION = "1.0.9";

@Instance(MODID)
public static OWG instance;
Expand All @@ -45,7 +47,7 @@ public void preInit(FMLPreInitializationEvent event)
metadata.logoFile = MODID + ".png";

OWGLanguage.init();
ConfigOWG.init(event);
ConfigOWG.load();
BiomeList.init();
}

Expand All @@ -64,4 +66,10 @@ public void postInit(FMLPostInitializationEvent event)
{
Support.init();
}

@EventHandler
public void onServerAboutToStart(FMLServerAboutToStartEvent event)
{
ConfigOWG.load();
}
}
12 changes: 6 additions & 6 deletions owg/biomes/BiomeBeta.java
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,12 @@ public int getGrassColorAtPos(BlockPos pos)
}
else if (this.id == 7)
{
return ColorizerFoliage.getFoliageColor(0.8F, 0.2F);
return ColorizerGrass.getGrassColor(0.9F, 0.1F);
}
else
{
double d = MathHelper.clamp_float(this.getFloatTemperature(pos), 0.0F, 1.0F);
double d1 = MathHelper.clamp_float(this.getFloatRainfall(), 0.0F, 1.0F);
double d = MathHelper.clamp_float(this.getFloatTemperature(pos) + 0.3F, 0.0F, 1.0F);
double d1 = MathHelper.clamp_float(this.getFloatRainfall() + 0.1F, 0.0F, 1.0F);
return ColorizerGrass.getGrassColor(d, d1);
}
}
Expand All @@ -131,12 +131,12 @@ public int getFoliageColorAtPos(BlockPos pos)
}
else if (this.id == 7)
{
return ColorizerFoliage.getFoliageColor(0.8F, 0.2F);
return ColorizerFoliage.getFoliageColor(0.9F, 0.1F);
}
else
{
double d = MathHelper.clamp_float(this.getFloatTemperature(pos), 0.0F, 1.0F);
double d1 = MathHelper.clamp_float(this.getFloatRainfall(), 0.0F, 1.0F);
double d = MathHelper.clamp_float(this.getFloatTemperature(pos) + 0.3F, 0.0F, 1.0F);
double d1 = MathHelper.clamp_float(this.getFloatRainfall() + 0.1F, 0.0F, 1.0F);
return ColorizerFoliage.getFoliageColor(d, d1);
}
}
Expand Down
6 changes: 3 additions & 3 deletions owg/biomes/BiomeList.java
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ public int getSkyColorByTemp(float p_76731_1_)
}

@Override
public List getSpawnableList(EnumCreatureType creatureType)
public List<BiomeGenBase.SpawnListEntry> getSpawnableList(EnumCreatureType creatureType)
{
return super.getSpawnableList(creatureType);
}
Expand All @@ -201,9 +201,9 @@ public boolean getEnableSnow()
}

@Override
public boolean canSpawnLightningBolt()
public boolean canRain()
{
return super.canSpawnLightningBolt();
return super.canRain();
}

@Override
Expand Down
27 changes: 24 additions & 3 deletions owg/config/ConfigOWG.java
Original file line number Diff line number Diff line change
@@ -1,18 +1,26 @@
package owg.config;

import java.io.File;

import net.minecraft.launchwrapper.Launch;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import owg.generatortype.GeneratorType;

public class ConfigOWG
{
private static final File CONFIG_FILE = new File(Launch.minecraftHome, "config/owg.cfg");
public static Configuration config;
public static int[] biomeIDs = new int[12];
public static float biomeScaleTemperatureRegion;
public static float biomeScaleSmallRegion;
public static float biomeScale;
public static boolean oneBiomePerSmallRegion;
public static float smallRegionProbability;
public static String defaultGen;

public static void init(FMLPreInitializationEvent event)
public static void load()
{
config = new Configuration(event.getSuggestedConfigurationFile());
config = new Configuration(CONFIG_FILE);

for (int c = 0; c < biomeIDs.length; c++)
{
Expand All @@ -39,6 +47,19 @@ public static void init(FMLPreInitializationEvent event)
biomeIDs[10] = config.get("2 - Infdev & Indev", "Classic", 198).getInt();
biomeIDs[11] = config.get("2 - Infdev & Indev", "ClassicSnow", 199).getInt();

config.getCategory("biomes").setComment("The biome placement algorithm works in the following way:\n"
+ "The world is divided into random small regions scaled by `biomeScaleSmallRegion`. Some of these regions will be chosen to contain \"small\" biomes, like Thaumcraft's magical biomes. The probability of this is determined by `smallRegionProbability`.\n"
+ "If `oneBiomePerSmallRegion` is set, a single biome will be used for the entire small region. Otherwise, a small region may contain multiple \"small\" biomes, the size of which are determined by `biomeScale`.\n"
+ "The world is also separately divided into large temperature regions scaled by `biomeScaleTemperatureRegion`. Each region may be of 4 different types: \"snow\", \"hot\", \"cold\" and \"wet\". These determine the set of biomes that can be placed in the region.\n"
+ "Finally, each temperature region is divided into biome regions. The size of these are determined by `biomeScale`.");
biomeScaleTemperatureRegion = config.getFloat("biomeScaleTemperatureRegion", "biomes", 1000F, 1, Float.POSITIVE_INFINITY,
"Scale of biome temperature regions. Larger is larger, scales linearly.");
biomeScaleSmallRegion = config.getFloat("biomeScaleSmallRegion", "biomes", 140F, 1, Float.POSITIVE_INFINITY,
"Scale of small biome regions. Larger is larger, scales linearly.");
biomeScale = config.getFloat("biomeScale", "biomes", 180F, 1, Float.POSITIVE_INFINITY, "Scale of biomes. Larger is larger, scales linearly.");
smallRegionProbability = config.getFloat("smallRegionProbability", "biomes", 0.08F, 0, 1, "Probability of small region placement.");
oneBiomePerSmallRegion = config.getBoolean("oneBiomePerSmallRegion", "biomes", false, "Choose a single biome to use for each small region.");

defaultGen = config.get("Generator", "default-setting", "BETA173#").getString();

// if setting doesn't exists set to default
Expand Down
2 changes: 1 addition & 1 deletion owg/deco/OldGenBigTree.java
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ void func_523_a(int i, int j, int k, float f, byte byte0, IBlockState l)
0, 0, 0
};
int j1 = -i1;
int k1 = -i1;
ai1[byte0] = ai[byte0];
for (; j1 <= i1; j1++)
{
Expand Down Expand Up @@ -436,6 +435,7 @@ boolean func_519_e()
}
}

@Override
public void setScale(double d, double d1, double d2)
{
this.field_870_m = (int) (d * 12D);
Expand Down
30 changes: 0 additions & 30 deletions owg/deco/OldGenDungeons.java
Original file line number Diff line number Diff line change
Expand Up @@ -184,36 +184,6 @@ public boolean generate(World worldIn, Random rand, int x, int y, int z)

private ItemStack pickCheckLootItem(Random random)
{
// fix for world gen seed
int i = random.nextInt(11), r = 0;
if (i == 1)
{
r = random.nextInt(4) + 1;
}
else if (i == 3)
{
r = random.nextInt(4) + 1;
}
else if (i == 4)
{
r = random.nextInt(4) + 1;
}
else if (i == 5)
{
r = random.nextInt(4) + 1;
}
else if (i == 7 && random.nextInt(100) == 0)
{
}
else if (i == 8 && random.nextInt(2) == 0)
{
r = random.nextInt(4) + 1;
}
else if (i == 9 && random.nextInt(10) == 0)
{
r = random.nextInt(2);
}

// getting item from DungeonLoot array
return DungeonLoot.pickItem();
}
Expand Down
4 changes: 2 additions & 2 deletions owg/deco/WorldGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

public abstract class WorldGenerator
{
public abstract boolean generate(World var1, Random var2, int var3, int var4, int var5);
public abstract boolean generate(World world, Random random, int i, int j, int k);

public void func_517_a(double var1, double var3, double var5)
public void setScale(double d, double d1, double d2)
{
}
}
6 changes: 3 additions & 3 deletions owg/generator/ChunkGeneratorAlpha.java
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ public void populate(IChunkProvider ichunkprovider, int i, int j)
{
int i13 = k + this.field_913_j.nextInt(16) + 8;
int l15 = l + this.field_913_j.nextInt(16) + 8;
((WorldGenerator) (obj)).func_517_a(1.0D, 1.0D, 1.0D);
((WorldGenerator) (obj)).setScale(1.0D, 1.0D, 1.0D);
((WorldGenerator) (obj)).generate(this.worldObj_16, this.field_913_j, i13, OWGGenHelper.getHeightValue(this.worldObj_16, i13, l15), l15);
}

Expand Down Expand Up @@ -700,7 +700,7 @@ public void populate(IChunkProvider ichunkprovider, int i, int j)
}

@Override
public boolean func_177460_a(IChunkProvider ichunkprovider, Chunk chunkIn, int i, int j)
public boolean populateChunk(IChunkProvider ichunkprovider, Chunk chunkIn, int i, int j)
{
return false;
}
Expand Down Expand Up @@ -730,7 +730,7 @@ public String makeString()
}

@Override
public List getPossibleCreatures(EnumCreatureType creatureType, BlockPos pos)
public List<BiomeGenBase.SpawnListEntry> getPossibleCreatures(EnumCreatureType creatureType, BlockPos pos)
{
return this.worldObj_16.getBiomeGenForCoords(pos).getSpawnableList(creatureType);
}
Expand Down
10 changes: 5 additions & 5 deletions owg/generator/ChunkGeneratorBeta.java
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ public ChunkGeneratorBeta(World world, long l, int bSettings, int bStrongholds,
this.mobSpawnerNoise = new NoiseOctavesBeta(this.rand, 8);
this.field_147430_m = new NoiseGeneratorPerlin(this.rand, 4);
this.chunkManager = (ManagerOWG) this.worldObj.getWorldChunkManager();
this.chunkManager.isDeepOceanEnabled = this.deepOcean == 0;

DungeonLoot.init(l);
}
Expand Down Expand Up @@ -355,7 +356,7 @@ public int getLoadedChunkCount()
}

@Override
public List getPossibleCreatures(EnumCreatureType creatureType, BlockPos pos)
public List<BiomeGenBase.SpawnListEntry> getPossibleCreatures(EnumCreatureType creatureType, BlockPos pos)
{
if (this.biomeSettings == 0)
{
Expand All @@ -371,7 +372,7 @@ public List getPossibleCreatures(EnumCreatureType creatureType, BlockPos pos)
}

if (creatureType == EnumCreatureType.MONSTER && this.deepOcean == 0 && this.monuments == 0
&& this.oceanMonumentGenerator.func_175796_a(this.worldObj, pos))
&& this.oceanMonumentGenerator.isPositionInStructure(this.worldObj, pos))
{
return this.oceanMonumentGenerator.getScatteredFeatureSpawnList();
}
Expand Down Expand Up @@ -563,7 +564,7 @@ public void populate(IChunkProvider ichunkprovider, int i, int j)
int l13 = k + this.rand.nextInt(16) + 8;
int j14 = l + this.rand.nextInt(16) + 8;
WorldGenerator worldgenerator = biomegenbase.getRandomWorldGenForTrees(this.rand);
worldgenerator.func_517_a(1.0D, 1.0D, 1.0D);
worldgenerator.setScale(1.0D, 1.0D, 1.0D);
worldgenerator.generate(this.worldObj, this.rand, l13, OWGGenHelper.getHeightValue(this.worldObj, l13, j14), j14);
}

Expand Down Expand Up @@ -742,7 +743,6 @@ public void populate(IChunkProvider ichunkprovider, int i, int j)
long l1 = (this.rand.nextLong() / 2L) * 2L + 1L;
long l2 = (this.rand.nextLong() / 2L) * 2L + 1L;
this.rand.setSeed((long) i * l1 + (long) j * l2 ^ this.worldObj.getSeed());
double d = 0.25D;
boolean flag = false;
ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(i, j);

Expand Down Expand Up @@ -1175,7 +1175,7 @@ private int getSolidBlockHeight(int i, int j, ChunkPrimer chunk)
}

@Override
public boolean func_177460_a(IChunkProvider ichunkprovider, Chunk chunkIn, int i, int j)
public boolean populateChunk(IChunkProvider ichunkprovider, Chunk chunkIn, int i, int j)
{
boolean flag = false;

Expand Down
12 changes: 2 additions & 10 deletions owg/generator/ChunkGeneratorIndev.java
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,6 @@ public void generateSkylands(int i, int j, ChunkPrimer chunk)
int x = i << 4;
int z = j << 4;
int jj = 0;
int lx = 0;
int lz = 0;

if (i > -this.size && i < this.size && j > -this.size && j < this.size)
{
Expand Down Expand Up @@ -314,13 +312,10 @@ public void generateTerrain(int i, int j, ChunkPrimer chunk)
this.worldObj.getWorldInfo().setSpawn(new BlockPos(0, 256, 0));
}

int height = 128;
int seaLevel = 64;
int x = i << 4;
int z = j << 4;
int jj = 0;
int lx = 0;
int lz = 0;

for (int k = x; k < x + 16; k++)
{
Expand Down Expand Up @@ -381,7 +376,6 @@ else if (this.themeHELL || this.themeWOODS)
for (int i3 = 0; i3 < 256; i3++)
{
Block i4 = Blocks.air;
int i4m = 0;
int beachHeight = seaLevel + 1;
if (this.themePARADISE)
{
Expand All @@ -400,7 +394,6 @@ else if ((i3 == i2) && i2 >= beachHeight)
if (this.themeHELL)
{
i4 = Blocks.dirt;
i4m = 1;
}
else
{
Expand Down Expand Up @@ -591,7 +584,6 @@ public void populate(IChunkProvider ichunkrovider, int i, int j)
BlockFalling.fallInstantly = true;
int var4 = i * 16;
int var5 = j * 16;
BiomeGenBase var6 = this.chunkManager.getBiomeGenAt(var4 + 16, var5 + 16);
this.rand.setSeed(this.worldObj.getSeed());
long var7 = this.rand.nextLong() / 2L * 2L + 1L;
long var9 = this.rand.nextLong() / 2L * 2L + 1L;
Expand Down Expand Up @@ -841,7 +833,7 @@ else if (this.typeIsland)
}

@Override
public boolean func_177460_a(IChunkProvider ichunkprovider, Chunk chunkIn, int i, int j)
public boolean populateChunk(IChunkProvider ichunkprovider, Chunk chunkIn, int i, int j)
{
return false;
}
Expand Down Expand Up @@ -871,7 +863,7 @@ public String makeString()
}

@Override
public List getPossibleCreatures(EnumCreatureType creatureType, BlockPos pos)
public List<BiomeGenBase.SpawnListEntry> getPossibleCreatures(EnumCreatureType creatureType, BlockPos pos)
{
return this.worldObj.getBiomeGenForCoords(pos).getSpawnableList(creatureType);
}
Expand Down
Loading

0 comments on commit cb3501c

Please sign in to comment.