From ef9729359453a4275127008459b615d25e13716f Mon Sep 17 00:00:00 2001 From: Adahel Date: Sun, 7 May 2023 19:12:05 -0300 Subject: [PATCH] Fixed ( #2 ), Bug fixes --- README.md | 10 +++- owg/OWG.java | 2 +- owg/biomes/BiomeBeta.java | 12 ++-- owg/biomes/BiomeList.java | 4 +- owg/generator/ChunkGeneratorAlpha.java | 2 +- owg/generator/ChunkGeneratorBeta.java | 5 +- owg/generator/ChunkGeneratorIndev.java | 2 +- owg/generator/ChunkGeneratorInfdev.java | 2 +- owg/gui/GuiGeneratorSettings.java | 58 +++++++++--------- owg/simulator/ChunkSimulatorBeta.java | 44 ++++---------- owg/world/ManagerOWG.java | 80 +++++++++---------------- 11 files changed, 92 insertions(+), 129 deletions(-) diff --git a/README.md b/README.md index 943917f..673d46f 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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 diff --git a/owg/OWG.java b/owg/OWG.java index 1439478..76dc45b 100644 --- a/owg/OWG.java +++ b/owg/OWG.java @@ -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; diff --git a/owg/biomes/BiomeBeta.java b/owg/biomes/BiomeBeta.java index 79a9bbc..575196c 100644 --- a/owg/biomes/BiomeBeta.java +++ b/owg/biomes/BiomeBeta.java @@ -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); } } @@ -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); } } diff --git a/owg/biomes/BiomeList.java b/owg/biomes/BiomeList.java index fb01963..9eb6191 100644 --- a/owg/biomes/BiomeList.java +++ b/owg/biomes/BiomeList.java @@ -201,9 +201,9 @@ public boolean getEnableSnow() } @Override - public boolean canSpawnLightningBolt() + public boolean canRain() { - return super.canSpawnLightningBolt(); + return super.canRain(); } @Override diff --git a/owg/generator/ChunkGeneratorAlpha.java b/owg/generator/ChunkGeneratorAlpha.java index a332d9e..6ff3c97 100644 --- a/owg/generator/ChunkGeneratorAlpha.java +++ b/owg/generator/ChunkGeneratorAlpha.java @@ -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; } diff --git a/owg/generator/ChunkGeneratorBeta.java b/owg/generator/ChunkGeneratorBeta.java index 9cfbd22..25b5d26 100644 --- a/owg/generator/ChunkGeneratorBeta.java +++ b/owg/generator/ChunkGeneratorBeta.java @@ -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); } @@ -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(); } @@ -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; diff --git a/owg/generator/ChunkGeneratorIndev.java b/owg/generator/ChunkGeneratorIndev.java index 79c5021..1efff3a 100644 --- a/owg/generator/ChunkGeneratorIndev.java +++ b/owg/generator/ChunkGeneratorIndev.java @@ -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; } diff --git a/owg/generator/ChunkGeneratorInfdev.java b/owg/generator/ChunkGeneratorInfdev.java index fd712ed..f0b66d5 100644 --- a/owg/generator/ChunkGeneratorInfdev.java +++ b/owg/generator/ChunkGeneratorInfdev.java @@ -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; } diff --git a/owg/gui/GuiGeneratorSettings.java b/owg/gui/GuiGeneratorSettings.java index 2924e3e..22d9513 100644 --- a/owg/gui/GuiGeneratorSettings.java +++ b/owg/gui/GuiGeneratorSettings.java @@ -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(); @@ -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(); @@ -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); } } @@ -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; } } } @@ -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(); @@ -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(); @@ -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(); diff --git a/owg/simulator/ChunkSimulatorBeta.java b/owg/simulator/ChunkSimulatorBeta.java index 72ffd3a..563c095 100644 --- a/owg/simulator/ChunkSimulatorBeta.java +++ b/owg/simulator/ChunkSimulatorBeta.java @@ -34,7 +34,7 @@ public class ChunkSimulatorBeta double field_4181_h[]; private final ManagerOWG managerOWG; - private HashMap> cacheOceanHash = Maps.> newHashMap(); + private HashMap cacheOceanHash = Maps. newHashMap(); private HashMap> cacheBeachHash = Maps.> newHashMap(); private HashMap> cacheGravelHash = Maps.> newHashMap(); @@ -161,7 +161,7 @@ else if (d12 > 1.0D) return ad; } - private Pair simulateTerrain(ChunkCoordIntPair chunkcoordintpair) + private int[][] simulateTerrain(ChunkCoordIntPair chunkcoordintpair) { int[][] list = new int[4][4]; byte byte0 = 4; @@ -196,15 +196,15 @@ private Pair simulateTerrain(ChunkCoordIntPair chunkcoordintpa } - return Pair.of(list, this.landAboveSeaLevel(list)); + return list; } - private Pair simulateYTerrain(ChunkCoordIntPair chunkCoordIntPairIn) + private int simulateYTerrain(ChunkCoordIntPair chunkCoordIntPairIn) { - Pair 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) { @@ -214,10 +214,10 @@ private Pair simulateYTerrain(ChunkCoordIntPair chunkCoordIntP } int l = Math.floorDiv(i, j); - return Pair.of(l, pair.getRight()); + return l; } - public Pair getSimulatedTerrain(BlockPos blockpos) + public int getSimulatedTerrain(BlockPos blockpos) { ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(blockpos.getX() >> 4, blockpos.getZ() >> 4); if (this.cacheOceanHash.containsKey(chunkcoordintpair)) @@ -229,24 +229,17 @@ public Pair 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 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 pair = Pair.of(j1, flag); - this.cacheOceanHash.put(chunkcoordintpair, pair); - return pair; + this.cacheOceanHash.put(chunkcoordintpair, j1); + return j1; } } @@ -322,21 +315,6 @@ private Pair 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) diff --git a/owg/world/ManagerOWG.java b/owg/world/ManagerOWG.java index 4f3791b..b7be5c4 100644 --- a/owg/world/ManagerOWG.java +++ b/owg/world/ManagerOWG.java @@ -6,7 +6,6 @@ import java.util.Set; import org.apache.commons.lang3.ArrayUtils; -import org.apache.commons.lang3.tuple.Pair; import com.google.common.collect.Lists; import com.google.common.collect.Sets; @@ -63,6 +62,7 @@ public class ManagerOWG extends WorldChunkManager public int biomeListSmallLength; public int biomeSetting; public boolean isSmallEnabled; + public boolean isDeepOceanEnabled; public boolean isGravelBeachEnabled; private PerlinNoise perlin; @@ -178,7 +178,7 @@ else if (biomes == 2) } } - public int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight, boolean useDeepOcean) + public int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight) { int[] aint = IntCache.getIntCache(areaWidth * areaHeight); @@ -235,6 +235,7 @@ public int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight, boolea float h; float c; int k11; + int i1 = 0; int i2 = 0; float offX, offY; ChunkSimulatorBeta chunksimulatorbeta = new ChunkSimulatorBeta(this, this.worldObj.getSeed()); @@ -289,78 +290,55 @@ else if (c < 0.75f) aint[i2] = this.biomeList_wet.get((int) (h)).biomeID; } - Pair pair = chunksimulatorbeta.getSimulatedTerrain(blockpos); - if (useDeepOcean) + i1 = chunksimulatorbeta.getSimulatedTerrain(blockpos); + if (i1 < 63) { - if (pair.getLeft() < 59) + for (BiomeGenBase biomegenbase : this.biomeList_snow) { - if (!pair.getRight()) + if (aint[i2] == biomegenbase.biomeID) { - aint[i2] = BiomeGenBase.deepOcean.biomeID; + aint[i2] = BiomeGenBase.frozenOcean.biomeID; } - else + } + for (BiomeGenBase biomegenbase : list) + { + if (aint[i2] == biomegenbase.biomeID) { - for (BiomeGenBase biomegenbase : this.biomeList_snow) + if (this.isDeepOceanEnabled) { - if (aint[i2] == biomegenbase.biomeID) - { - aint[i2] = BiomeGenBase.frozenOcean.biomeID; - } + aint[i2] = BiomeGenBase.deepOcean.biomeID; } - for (BiomeGenBase biomegenbase : list) + else { - if (aint[i2] == biomegenbase.biomeID) - { - aint[i2] = BiomeGenBase.ocean.biomeID; - } + aint[i2] = BiomeGenBase.ocean.biomeID; } } } } - else + else if (i1 >= 63 && i1 <= 65) { - if (pair.getLeft() < 63) + if (chunksimulatorbeta.getSimulatedBeach(blockpos)) { for (BiomeGenBase biomegenbase : this.biomeList_snow) { if (aint[i2] == biomegenbase.biomeID) { - aint[i2] = BiomeGenBase.frozenOcean.biomeID; + aint[i2] = BiomeGenBase.coldBeach.biomeID; } } for (BiomeGenBase biomegenbase : list) { if (aint[i2] == biomegenbase.biomeID) { - aint[i2] = BiomeGenBase.ocean.biomeID; + aint[i2] = BiomeGenBase.beach.biomeID; } } } - else if (pair.getLeft() >= 63 && pair.getLeft() <= 65) + if (this.isGravelBeachEnabled && i1 > 63) { - if (chunksimulatorbeta.getSimulatedBeach(blockpos)) + if (chunksimulatorbeta.getSimulatedGravel(blockpos)) { - for (BiomeGenBase biomegenbase : this.biomeList_snow) - { - if (aint[i2] == biomegenbase.biomeID) - { - aint[i2] = BiomeGenBase.coldBeach.biomeID; - } - } - for (BiomeGenBase biomegenbase : list) - { - if (aint[i2] == biomegenbase.biomeID) - { - aint[i2] = BiomeGenBase.beach.biomeID; - } - } - } - if (this.isGravelBeachEnabled && pair.getLeft() > 63) - { - if (chunksimulatorbeta.getSimulatedGravel(blockpos)) - { - aint[i2] = this.gravelBeach.biomeID; - } + aint[i2] = this.gravelBeach.biomeID; } } } @@ -452,7 +430,7 @@ public float[] getRainfall(float[] listToReuse, int i, int j, int width, int len listToReuse = new float[width * length]; } - int[] aint = this.genBiomes.getInts(i, j, width, length, false); + int[] aint = this.genBiomes.getInts(i, j, width, length); for (int k = 0; k < width * length; ++k) { @@ -507,7 +485,7 @@ public BiomeGenBase[] getBiomesForGeneration(BiomeGenBase[] biomes, int i, int j biomes = new BiomeGenBase[width * height]; } - int[] aint = this.genBiomes.getInts(i, j, width, height, false); + int[] aint = this.genBiomes.getInts(i, j, width, height); try { @@ -562,7 +540,7 @@ public BiomeGenBase[] getBiomeGenAt(BiomeGenBase[] listToReuse, int i, int j, in } else { - int[] aint = this.genBiomes.getInts(i, j, width, length, false); + int[] aint = this.genBiomes.getInts(i, j, width, length); for (int k = 0; k < width * length; ++k) { @@ -581,7 +559,7 @@ public boolean areBiomesViable(int i, int j, int radius, List allo { IntCache.resetIntCache(); Set set = Sets. newHashSet(); - Collections.addAll(set, ArrayUtils.toObject(this.genBiomes.getInts(i, j, radius, radius, false))); + Collections.addAll(set, ArrayUtils.toObject(this.genBiomes.getInts(i, j, radius, radius))); try { @@ -612,7 +590,7 @@ public boolean areViableOceanMonumentBiomes(int i, int j, int radius, List set = Sets. newHashSet(); - Collections.addAll(set, ArrayUtils.toObject(this.genBiomes.getInts(i, j, radius, radius, true))); + Collections.addAll(set, ArrayUtils.toObject(this.genBiomes.getInts(i, j, radius, radius))); try { @@ -644,7 +622,7 @@ public BlockPos findBiomePosition(int i, int j, int range, List bi { IntCache.resetIntCache(); Set set = Sets. newHashSet(); - Collections.addAll(set, ArrayUtils.toObject(this.genBiomes.getInts(i, j, range, range, false))); + Collections.addAll(set, ArrayUtils.toObject(this.genBiomes.getInts(i, j, range, range))); BlockPos blockpos = null; for (BiomeGenBase biomegenbase : biomes)