Skip to content

Commit

Permalink
Fixed ( Ted80-Minecraft-Mods#2 ), Bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Adahel committed May 7, 2023
1 parent 1cd1aa1 commit ef97293
Show file tree
Hide file tree
Showing 11 changed files with 92 additions and 129 deletions.
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ Features:
12. Start your server.

## CHANGELOG ##
Version 1.0.9 '07-05-2023'
- Fixed biome grass and foliage colors (https://github.com/Ted80-Minecraft-Mods/Old-World-Gen/issues/2)
- Removed ocean biome if deep ocean biome is enabled
- Fixed ocean monuments to be more suitable for the terrain generated
- Removed some useless 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,10 +55,10 @@ 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
Expand Down
2 changes: 1 addition & 1 deletion owg/OWG.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ 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 Down
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
4 changes: 2 additions & 2 deletions owg/biomes/BiomeList.java
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,9 @@ public boolean getEnableSnow()
}

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

@Override
Expand Down
2 changes: 1 addition & 1 deletion owg/generator/ChunkGeneratorAlpha.java
Original file line number Diff line number Diff line change
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
5 changes: 3 additions & 2 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 @@ -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 @@ -1175,7 +1176,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
2 changes: 1 addition & 1 deletion owg/generator/ChunkGeneratorIndev.java
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,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
2 changes: 1 addition & 1 deletion owg/generator/ChunkGeneratorInfdev.java
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,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
58 changes: 29 additions & 29 deletions owg/gui/GuiGeneratorSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ public void initGui()
{
this.createList();

for (int i = 0; i < this.generators.size(); i++)
for (GuiGeneratorButton element : this.generators)
{
this.generators.get(i).button.enabled = true;
if (this.generators.get(i).generatorID == this.generatorSelected)
element.button.enabled = true;
if (element.generatorID == this.generatorSelected)
{
this.generators.get(i).button.enabled = false;
element.button.enabled = false;
}
}
this.selectGenerator();
Expand All @@ -95,24 +95,24 @@ else if (button.id == 2) // COPY SETTINGS
}
else if (button.id >= 10 && button.id < 20)
{
for (int i = 0; i < this.generators.size(); i++)
for (GuiGeneratorButton element : this.generators)
{
this.generators.get(i).button.enabled = true;
if (this.generators.get(i).button.id == button.id)
element.button.enabled = true;
if (element.button.id == button.id)
{
this.generators.get(i).button.enabled = false;
this.generatorSelected = this.generators.get(i).generatorID;
element.button.enabled = false;
this.generatorSelected = element.generatorID;
}
}
this.selectGenerator();
}
else if (button.id >= 20 && button.id < 30)
{
for (int i = 0; i < this.settings.size(); i++)
for (GuiSettingsButton element : this.settings)
{
if (this.settings.get(i).button.id == button.id)
if (element.button.id == button.id)
{
this.settings.get(i).click();
element.click();
}
}
this.dependencies();
Expand Down Expand Up @@ -148,9 +148,9 @@ public void createList()
{
if (this.generators != null)
{
for (int i = 0; i < this.generators.size(); i++)
for (GuiGeneratorButton element : this.generators)
{
this.buttonList.remove(this.generators.get(i).button);
this.buttonList.remove(element.button);
}
}

Expand All @@ -170,17 +170,17 @@ public void createList()

public void dependencies()
{
for (int i = 0; i < this.settings.size(); i++)
for (GuiSettingsButton element : this.settings)
{
if (this.settings.get(i).dependencie > -1)
if (element.dependencie > -1)
{
this.settings.get(i).button.visible = false;
for (int depvalue : this.settings.get(i).depvalues)
element.button.visible = false;
for (int depvalue : element.depvalues)
{
if (this.settings.get(this.settings.get(i).dependencie - 20).button.visible
&& this.settings.get(this.settings.get(i).dependencie - 20).selected == depvalue)
if (this.settings.get(element.dependencie - 20).button.visible
&& this.settings.get(element.dependencie - 20).selected == depvalue)
{
this.settings.get(i).button.visible = true;
element.button.visible = true;
}
}
}
Expand All @@ -200,9 +200,9 @@ public void selectGenerator()

if (this.settings != null)
{
for (int i = 0; i < this.settings.size(); i++)
for (GuiSettingsButton element : this.settings)
{
this.buttonList.remove(this.settings.get(i).button);
this.buttonList.remove(element.button);
}
}
this.settings = new ArrayList<GuiSettingsButton>();
Expand All @@ -212,9 +212,9 @@ public void selectGenerator()
this.hasSettings = GeneratorType.generatortypes[this.generatorSelected].getSettings(this);
}

for (int s = 0; s < this.settings.size(); s++)
for (GuiSettingsButton element : this.settings)
{
this.buttonList.add(this.settings.get(s).button);
this.buttonList.add(element.button);
}

this.dependencies();
Expand Down Expand Up @@ -248,12 +248,12 @@ public void decodeString(String decodestring)
this.createList();
this.generatorSelected = n;

for (int i = 0; i < this.generators.size(); i++)
for (GuiGeneratorButton element : this.generators)
{
this.generators.get(i).button.enabled = true;
if (this.generators.get(i).generatorID == this.generatorSelected)
element.button.enabled = true;
if (element.generatorID == this.generatorSelected)
{
this.generators.get(i).button.enabled = false;
element.button.enabled = false;
}
}
this.selectGenerator();
Expand Down
44 changes: 11 additions & 33 deletions owg/simulator/ChunkSimulatorBeta.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class ChunkSimulatorBeta
double field_4181_h[];
private final ManagerOWG managerOWG;

private HashMap<ChunkCoordIntPair, Pair<Integer, Boolean>> cacheOceanHash = Maps.<ChunkCoordIntPair, Pair<Integer, Boolean>> newHashMap();
private HashMap<ChunkCoordIntPair, Integer> cacheOceanHash = Maps.<ChunkCoordIntPair, Integer> newHashMap();
private HashMap<ChunkCoordIntPair, Pair<boolean[][], Boolean>> cacheBeachHash = Maps.<ChunkCoordIntPair, Pair<boolean[][], Boolean>> newHashMap();
private HashMap<ChunkCoordIntPair, Pair<boolean[][], Boolean>> cacheGravelHash = Maps.<ChunkCoordIntPair, Pair<boolean[][], Boolean>> newHashMap();

Expand Down Expand Up @@ -161,7 +161,7 @@ else if (d12 > 1.0D)
return ad;
}

private Pair<int[][], Boolean> simulateTerrain(ChunkCoordIntPair chunkcoordintpair)
private int[][] simulateTerrain(ChunkCoordIntPair chunkcoordintpair)
{
int[][] list = new int[4][4];
byte byte0 = 4;
Expand Down Expand Up @@ -196,15 +196,15 @@ private Pair<int[][], Boolean> simulateTerrain(ChunkCoordIntPair chunkcoordintpa

}

return Pair.of(list, this.landAboveSeaLevel(list));
return list;
}

private Pair<Integer, Boolean> simulateYTerrain(ChunkCoordIntPair chunkCoordIntPairIn)
private int simulateYTerrain(ChunkCoordIntPair chunkCoordIntPairIn)
{
Pair<int[][], Boolean> pair = this.simulateTerrain(chunkCoordIntPairIn);
int[][] list = this.simulateTerrain(chunkCoordIntPairIn);
int i = 0;
int j = 0;
for (int[] aint : pair.getLeft())
for (int[] aint : list)
{
for (int k : aint)
{
Expand All @@ -214,10 +214,10 @@ private Pair<Integer, Boolean> simulateYTerrain(ChunkCoordIntPair chunkCoordIntP
}
int l = Math.floorDiv(i, j);

return Pair.of(l, pair.getRight());
return l;
}

public Pair<Integer, Boolean> getSimulatedTerrain(BlockPos blockpos)
public int getSimulatedTerrain(BlockPos blockpos)
{
ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(blockpos.getX() >> 4, blockpos.getZ() >> 4);
if (this.cacheOceanHash.containsKey(chunkcoordintpair))
Expand All @@ -229,24 +229,17 @@ public Pair<Integer, Boolean> getSimulatedTerrain(BlockPos blockpos)
int i = 0;
int j = 0;
int k = 1;
boolean flag = false;
for (int l = chunkcoordintpair.chunkXPos - k; l <= chunkcoordintpair.chunkXPos + k; l++)
{
for (int i1 = chunkcoordintpair.chunkZPos - k; i1 <= chunkcoordintpair.chunkZPos + k; i1++)
{
Pair<Integer, Boolean> pair = this.simulateYTerrain(new ChunkCoordIntPair(l, i1));
i += pair.getLeft();
if (pair.getRight())
{
flag = true;
}
i += this.simulateYTerrain(new ChunkCoordIntPair(l, i1));
j++;
}
}
int j1 = Math.floorDiv(i, j) + 1;
Pair<Integer, Boolean> pair = Pair.of(j1, flag);
this.cacheOceanHash.put(chunkcoordintpair, pair);
return pair;
this.cacheOceanHash.put(chunkcoordintpair, j1);
return j1;
}
}

Expand Down Expand Up @@ -322,21 +315,6 @@ private Pair<boolean[][], Boolean> simulateGravel(ChunkCoordIntPair chunkCoordIn
return pair;
}

private boolean landAboveSeaLevel(int[][] list)
{
for (int[] aint : list)
{
for (int i : aint)
{
if (i >= 60)
{
return true;
}
}
}
return false;
}

private boolean isBeachBlock(boolean[][] list)
{
for (boolean[] aflag : list)
Expand Down
Loading

0 comments on commit ef97293

Please sign in to comment.