├── jitpack.yml ├── src └── main │ ├── resources │ ├── assets │ │ └── rwg │ │ │ └── lang │ │ │ ├── zh_CN.lang │ │ │ ├── fr_FR.lang │ │ │ ├── it_IT.lang │ │ │ ├── ru_RU.lang │ │ │ ├── ko_KR.lang │ │ │ ├── pt_PT.lang │ │ │ └── en_US.lang │ └── mcmod.info │ └── java │ └── rwg │ ├── deco │ ├── ruins │ │ ├── DecoRuinsAdventure.java │ │ └── DecoRuinsAncient.java │ ├── DecoCacti.java │ ├── DecoWildWheat.java │ ├── trees │ │ ├── DecoDeadDesertTrees.java │ │ ├── DecoSmallCocoa.java │ │ ├── DecoSmallJungle.java │ │ ├── DecoEuroPine.java │ │ ├── DecoShrub.java │ │ ├── DecoSmallSpruce.java │ │ ├── DecoRedWood.java │ │ ├── DecoPalm.java │ │ ├── DecoBirch.java │ │ └── DecoSmallPine.java │ ├── DecoJungleCane.java │ ├── DecoGrass.java │ ├── DecoFlowers.java │ ├── DecoBlob.java │ ├── DecoWaterGrass.java │ └── DecoClay.java │ ├── util │ ├── NoiseImplementation.java │ ├── CanyonColor.java │ ├── SnowheightCalculator.java │ ├── TerrainMath.java │ ├── NoiseSelector.java │ ├── NoiseGeneratorWrapper.java │ ├── NoiseGenerator.java │ └── CliffCalculator.java │ ├── biomes │ ├── base │ │ ├── BaseBiomeTropicalIsland.java │ │ ├── BaseBiomeSnowDesert.java │ │ ├── BaseBiomePlains.java │ │ ├── BaseBiomeColdForest.java │ │ ├── BaseBiomeJungle.java │ │ ├── BaseBiomeSnowForest.java │ │ ├── BaseBiomeTemperateForest.java │ │ ├── BaseBiomeRedwood.java │ │ ├── BaseBiomeColdPlains.java │ │ ├── BaseBiomeHotDesert.java │ │ ├── BaseBiomeOcean.java │ │ ├── BaseBiomeRiver.java │ │ ├── BaseBiomeHotForest.java │ │ └── BaseBiomeHotPlains.java │ └── realistic │ │ ├── coast │ │ ├── RealisticBiomeCoastColdCliff.java │ │ └── RealisticBiomeCoastIce.java │ │ ├── ocean │ │ ├── RealisticBiomeIslandTundra.java │ │ └── RealisticBiomeOceanTest.java │ │ └── land │ │ ├── RealisticBiomeHighRainforest.java │ │ ├── RealisticBiomePolar.java │ │ ├── RealisticBiomeTestRiver.java │ │ ├── RealisticBiomeJungleCanyon.java │ │ └── RealisticBiomeJungleHills.java │ ├── terrain │ ├── TerrainBase.java │ ├── TerrainFlatLakes.java │ ├── TerrainSmallSupport.java │ ├── TerrainPolar.java │ ├── TerrainSwampRiver.java │ ├── TerrainMarsh.java │ ├── TerrainDuneValley.java │ ├── TerrainGrasslandFlats.java │ ├── TerrainDunes.java │ ├── TerrainGrasslandMountains.java │ ├── TerrainMountain.java │ ├── TerrainMountainSpikes.java │ ├── TerrainHighland.java │ ├── TerrainMesa.java │ ├── TerrainMountainRiver.java │ ├── TerrainSwampMountain.java │ ├── TerrainHilly.java │ ├── TerrainGrasslandHills.java │ └── TerrainCanyon.java │ ├── support │ ├── edit │ │ ├── EditBase.java │ │ └── EditRiverOasis.java │ ├── SupportCC.java │ ├── Support.java │ ├── RealisticBiomeSupport.java │ └── SupportTC.java │ ├── surface │ ├── SurfaceBase.java │ ├── SurfaceMountainPolar.java │ ├── river │ │ └── SurfaceRiverOasis.java │ ├── SurfaceGrassland.java │ ├── SurfaceMarshFix.java │ ├── SurfaceDesert.java │ ├── SurfaceRedDesert.java │ ├── SurfacePolar.java │ ├── SurfaceGrassCanyon.java │ ├── SurfaceGrasslandMix1.java │ ├── SurfaceDuneValley.java │ ├── SurfaceGrasslandMixBig.java │ ├── SurfaceDesertOasis.java │ ├── SurfaceTundra.java │ └── SurfaceIslandMountainStone.java │ ├── world │ ├── WorldTypeRealistic.java │ └── RwgWorldSavedData.java │ ├── handlers │ └── LoginHandler.java │ ├── data │ ├── VillageMaterialData.java │ ├── TreeReplacement.java │ └── VillageMaterials.java │ ├── map │ ├── old │ │ └── MapGenSmallRiver.java │ ├── MapAncientRuins.java │ └── MapVolcano.java │ ├── commands │ ├── RwgBugInfoCommand.java │ └── RwgNoiseCommand.java │ ├── api │ └── RWGBiomes.java │ └── RWG.java ├── .git-blame-ignore-revs ├── CODEOWNERS ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .github ├── workflows │ ├── release-tags.yml │ └── build-and-test.yml └── scripts │ └── test-no-error-reports.sh ├── repositories.gradle ├── .gitignore ├── settings.gradle ├── dependencies.gradle ├── README.md ├── .gitattributes └── gradlew.bat /jitpack.yml: -------------------------------------------------------------------------------- 1 | before_install: 2 | - ./gradlew setupCIWorkspace -------------------------------------------------------------------------------- /src/main/resources/assets/rwg/lang/zh_CN.lang: -------------------------------------------------------------------------------- 1 | generator.RWG=真实世界生成初版 2 | -------------------------------------------------------------------------------- /src/main/resources/assets/rwg/lang/fr_FR.lang: -------------------------------------------------------------------------------- 1 | generator.RWG=Réaliste (alpha) 2 | -------------------------------------------------------------------------------- /src/main/resources/assets/rwg/lang/it_IT.lang: -------------------------------------------------------------------------------- 1 | generator.RWG=Realistico (Alfa) 2 | -------------------------------------------------------------------------------- /src/main/resources/assets/rwg/lang/ru_RU.lang: -------------------------------------------------------------------------------- 1 | generator.RWG=Реалистичный (Альфа) 2 | -------------------------------------------------------------------------------- /src/main/resources/assets/rwg/lang/ko_KR.lang: -------------------------------------------------------------------------------- 1 | generator.RWG=현실적인 바이옴[Realistic Alpha] 2 | -------------------------------------------------------------------------------- /src/main/resources/assets/rwg/lang/pt_PT.lang: -------------------------------------------------------------------------------- 1 | generator.RWG=Realístico (versão Alpha) 2 | -------------------------------------------------------------------------------- /.git-blame-ignore-revs: -------------------------------------------------------------------------------- 1 | # Ignore spotlessApply reformat 2 | 7c8e20c522b4d2f3aa89a86913e562c09603adab 3 | -------------------------------------------------------------------------------- /CODEOWNERS: -------------------------------------------------------------------------------- 1 | # Any Github changes require admin approval 2 | /.github/** @GTNewHorizons/admin 3 | 4 | -------------------------------------------------------------------------------- /src/main/java/rwg/deco/ruins/DecoRuinsAdventure.java: -------------------------------------------------------------------------------- 1 | package rwg.deco.ruins; 2 | 3 | public class DecoRuinsAdventure { 4 | } 5 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GTNewHorizons/Realistic-World-Gen/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /src/main/java/rwg/util/NoiseImplementation.java: -------------------------------------------------------------------------------- 1 | package rwg.util; 2 | 3 | public enum NoiseImplementation { 4 | UNKNOWN, 5 | PERLIN, 6 | OPENSIMPLEX, 7 | DYNAMICPERLIN, 8 | DYNAMICOPENSIMPLEX 9 | } 10 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /.github/workflows/release-tags.yml: -------------------------------------------------------------------------------- 1 | 2 | name: Release tagged build 3 | 4 | on: 5 | push: 6 | tags: [ '*' ] 7 | 8 | permissions: 9 | contents: write 10 | 11 | jobs: 12 | release-tags: 13 | uses: GTNewHorizons/GTNH-Actions-Workflows/.github/workflows/release-tags.yml@master 14 | secrets: inherit 15 | -------------------------------------------------------------------------------- /.github/workflows/build-and-test.yml: -------------------------------------------------------------------------------- 1 | 2 | name: Build and test 3 | 4 | on: 5 | pull_request: 6 | branches: [ master, main ] 7 | push: 8 | branches: [ master, main ] 9 | 10 | jobs: 11 | build-and-test: 12 | uses: GTNewHorizons/GTNH-Actions-Workflows/.github/workflows/build-and-test.yml@master 13 | secrets: inherit 14 | -------------------------------------------------------------------------------- /src/main/java/rwg/biomes/base/BaseBiomeTropicalIsland.java: -------------------------------------------------------------------------------- 1 | package rwg.biomes.base; 2 | 3 | import net.minecraft.world.biome.BiomeGenBase; 4 | 5 | public class BaseBiomeTropicalIsland extends BiomeGenBase { 6 | 7 | public BaseBiomeTropicalIsland(int id, String bn) { 8 | super(id); 9 | setTemperatureRainfall(0.8f, 0.8f); 10 | setBiomeName(bn); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/rwg/terrain/TerrainBase.java: -------------------------------------------------------------------------------- 1 | package rwg.terrain; 2 | 3 | import rwg.util.CellNoise; 4 | import rwg.util.NoiseGenerator; 5 | 6 | public class TerrainBase { 7 | 8 | public TerrainBase() {} 9 | 10 | public float generateNoise(NoiseGenerator perlin, CellNoise cell, int x, int y, float ocean, float border, 11 | float river) { 12 | return 70f; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/resources/mcmod.info: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "modid": "${modId}", 4 | "name": "${modName}", 5 | "description": "Adds a new realistic worldtype", 6 | "version": "${modVersion}", 7 | "mcversion": "${minecraftVersion}", 8 | "url": "", 9 | "updateUrl": "", 10 | "authorList": ["ted80"], 11 | "credits": "", 12 | "logoFile": "", 13 | "screenshots": [], 14 | "dependencies": [] 15 | } 16 | ] 17 | -------------------------------------------------------------------------------- /repositories.gradle: -------------------------------------------------------------------------------- 1 | // Add any additional repositories for your dependencies here 2 | 3 | repositories { 4 | mavenCentral() 5 | maven { 6 | name 'GTNH Maven' 7 | url 'http://jenkins.usrv.eu:8081/nexus/content/groups/public/' 8 | } 9 | maven { 10 | url 'https://cursemaven.com' 11 | content { 12 | includeGroup 'curse.maven' 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/rwg/biomes/base/BaseBiomeSnowDesert.java: -------------------------------------------------------------------------------- 1 | package rwg.biomes.base; 2 | 3 | import net.minecraft.world.biome.BiomeGenBase; 4 | 5 | public class BaseBiomeSnowDesert extends BiomeGenBase { 6 | 7 | public BaseBiomeSnowDesert(int id, String bn) { 8 | super(id); 9 | setTemperatureRainfall(0.0f, 0.1f); 10 | setBiomeName(bn); 11 | spawnableCreatureList.clear(); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/rwg/support/edit/EditBase.java: -------------------------------------------------------------------------------- 1 | package rwg.support.edit; 2 | 3 | import java.util.Random; 4 | 5 | import net.minecraft.world.World; 6 | 7 | import rwg.util.CellNoise; 8 | import rwg.util.NoiseGenerator; 9 | 10 | public class EditBase { 11 | 12 | public EditBase() {} 13 | 14 | public void decorate(World world, Random rand, int chunkX, int chunkY, NoiseGenerator perlin, CellNoise cell, 15 | float strength, float river) {} 16 | } 17 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | .settings 3 | /.idea/ 4 | /.vscode/ 5 | /run/ 6 | /build/ 7 | /eclipse/ 8 | .classpath 9 | .project 10 | /bin/ 11 | /config/ 12 | /crash-reports/ 13 | /logs/ 14 | options.txt 15 | /saves/ 16 | usernamecache.json 17 | banned-ips.json 18 | banned-players.json 19 | eula.txt 20 | ops.json 21 | server.properties 22 | servers.dat 23 | usercache.json 24 | whitelist.json 25 | /out/ 26 | *.iml 27 | *.ipr 28 | *.iws 29 | src/main/resources/mixins.*.json 30 | *.bat 31 | *.DS_Store 32 | !gradlew.bat 33 | -------------------------------------------------------------------------------- /src/main/java/rwg/biomes/base/BaseBiomePlains.java: -------------------------------------------------------------------------------- 1 | package rwg.biomes.base; 2 | 3 | import net.minecraft.entity.passive.EntityHorse; 4 | import net.minecraft.world.biome.BiomeGenBase; 5 | 6 | public class BaseBiomePlains extends BiomeGenBase { 7 | 8 | public BaseBiomePlains(int id, String bn) { 9 | super(id); 10 | setTemperatureRainfall(0.6f, 0.4f); 11 | setBiomeName(bn); 12 | spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityHorse.class, 3, 2, 3)); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/rwg/biomes/base/BaseBiomeColdForest.java: -------------------------------------------------------------------------------- 1 | package rwg.biomes.base; 2 | 3 | import net.minecraft.entity.passive.EntityWolf; 4 | import net.minecraft.world.biome.BiomeGenBase; 5 | 6 | public class BaseBiomeColdForest extends BiomeGenBase { 7 | 8 | public BaseBiomeColdForest(int id, String bn) { 9 | super(id); 10 | setTemperatureRainfall(0.5f, 0.4f); 11 | setBiomeName(bn); 12 | spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityWolf.class, 8, 1, 2)); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/rwg/biomes/base/BaseBiomeJungle.java: -------------------------------------------------------------------------------- 1 | package rwg.biomes.base; 2 | 3 | import net.minecraft.entity.passive.EntityOcelot; 4 | import net.minecraft.world.biome.BiomeGenBase; 5 | 6 | public class BaseBiomeJungle extends BiomeGenBase { 7 | 8 | public BaseBiomeJungle(int id, String bn) { 9 | super(id); 10 | setTemperatureRainfall(0.9f, 0.9f); 11 | setBiomeName(bn); 12 | 13 | spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityOcelot.class, 2, 1, 1)); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/rwg/biomes/base/BaseBiomeSnowForest.java: -------------------------------------------------------------------------------- 1 | package rwg.biomes.base; 2 | 3 | import net.minecraft.entity.passive.EntityWolf; 4 | import net.minecraft.world.biome.BiomeGenBase; 5 | 6 | public class BaseBiomeSnowForest extends BiomeGenBase { 7 | 8 | public BaseBiomeSnowForest(int id, String bn) { 9 | super(id); 10 | setTemperatureRainfall(0.0f, 0.1f); 11 | setBiomeName(bn); 12 | spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityWolf.class, 8, 4, 4)); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/rwg/biomes/base/BaseBiomeTemperateForest.java: -------------------------------------------------------------------------------- 1 | package rwg.biomes.base; 2 | 3 | import net.minecraft.entity.passive.EntityWolf; 4 | import net.minecraft.world.biome.BiomeGenBase; 5 | 6 | public class BaseBiomeTemperateForest extends BiomeGenBase { 7 | 8 | public BaseBiomeTemperateForest(int id, String bn) { 9 | super(id); 10 | setTemperatureRainfall(0.8f, 0.6f); 11 | setBiomeName(bn); 12 | spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityWolf.class, 8, 1, 2)); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | 2 | pluginManagement { 3 | repositories { 4 | maven { 5 | // RetroFuturaGradle 6 | name "GTNH Maven" 7 | url "https://nexus.gtnewhorizons.com/repository/public/" 8 | mavenContent { 9 | includeGroup("com.gtnewhorizons") 10 | includeGroupByRegex("com\\.gtnewhorizons\\..+") 11 | } 12 | } 13 | gradlePluginPortal() 14 | mavenCentral() 15 | mavenLocal() 16 | } 17 | } 18 | 19 | plugins { 20 | id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.22' 21 | } 22 | 23 | 24 | -------------------------------------------------------------------------------- /dependencies.gradle: -------------------------------------------------------------------------------- 1 | // Add your dependencies here 2 | 3 | dependencies { 4 | runtimeOnlyNonPublishable("curse.maven:journeymap-32274:4500658") 5 | compile("com.github.GTNewHorizons:NotEnoughItems:2.5.27-GTNH:dev") 6 | 7 | devOnlyNonPublishable('curse.maven:biomes-o-plenty-220318:2499612') 8 | compileOnly('curse.maven:extrabiomesxl-60041:2273301') 9 | 10 | //runtimeOnlyNonPublishable('com.github.GTNewHorizons:Climate-Control:0.9.1-GTNH:dev') 11 | devOnlyNonPublishable('com.github.GTNewHorizons:CodeChickenCore:1.2.1:dev') 12 | runtimeOnlyNonPublishable("curse.maven:chunkpregenerator-267193:3790102") 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/rwg/biomes/base/BaseBiomeRedwood.java: -------------------------------------------------------------------------------- 1 | package rwg.biomes.base; 2 | 3 | import net.minecraft.entity.passive.EntityHorse; 4 | import net.minecraft.entity.passive.EntityWolf; 5 | import net.minecraft.world.biome.BiomeGenBase; 6 | 7 | public class BaseBiomeRedwood extends BiomeGenBase { 8 | 9 | public BaseBiomeRedwood(int id, String bn) { 10 | super(id); 11 | setTemperatureRainfall(0.7f, 0.6f); 12 | setBiomeName(bn); 13 | spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityWolf.class, 8, 1, 2)); 14 | spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityHorse.class, 3, 2, 3)); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/rwg/biomes/base/BaseBiomeColdPlains.java: -------------------------------------------------------------------------------- 1 | package rwg.biomes.base; 2 | 3 | import net.minecraft.entity.passive.EntityHorse; 4 | import net.minecraft.entity.passive.EntityWolf; 5 | import net.minecraft.world.biome.BiomeGenBase; 6 | 7 | public class BaseBiomeColdPlains extends BiomeGenBase { 8 | 9 | public BaseBiomeColdPlains(int id, String bn) { 10 | super(id); 11 | setTemperatureRainfall(0.2f, 0.2f); 12 | setBiomeName(bn); 13 | spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityWolf.class, 5, 2, 3)); 14 | spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityHorse.class, 5, 2, 3)); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/rwg/terrain/TerrainFlatLakes.java: -------------------------------------------------------------------------------- 1 | package rwg.terrain; 2 | 3 | import rwg.util.CellNoise; 4 | import rwg.util.NoiseGenerator; 5 | 6 | public class TerrainFlatLakes extends TerrainBase { 7 | 8 | public TerrainFlatLakes() {} 9 | 10 | public float generateNoise(NoiseGenerator perlin, CellNoise cell, int x, int y, float ocean, float border, 11 | float river) { 12 | float h = perlin.noise2(x / 300f, y / 300f) * 40f * river; 13 | h = h > 3f ? 3f : h; 14 | h += perlin.noise2(x / 50f, y / 50f) * (12f - h) * 0.4f; 15 | h += perlin.noise2(x / 15f, y / 15f) * (12f - h) * 0.15f; 16 | 17 | return 62f + h; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/rwg/terrain/TerrainSmallSupport.java: -------------------------------------------------------------------------------- 1 | package rwg.terrain; 2 | 3 | import rwg.util.CellNoise; 4 | import rwg.util.NoiseGenerator; 5 | 6 | public class TerrainSmallSupport extends TerrainBase { 7 | 8 | public TerrainSmallSupport() {} 9 | 10 | @Override 11 | public float generateNoise(NoiseGenerator perlin, CellNoise cell, int x, int y, float ocean, float border, 12 | float river) { 13 | float h = perlin.noise2(x / 100f, y / 100f) * 8; 14 | h += perlin.noise2(x / 30f, y / 30f) * 4; 15 | h += perlin.noise2(x / 15f, y / 15f) * 2; 16 | h += perlin.noise2(x / 7f, y / 7f); 17 | 18 | return 70f + (20f * river) + h; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/rwg/terrain/TerrainPolar.java: -------------------------------------------------------------------------------- 1 | package rwg.terrain; 2 | 3 | import rwg.util.CellNoise; 4 | import rwg.util.NoiseGenerator; 5 | 6 | public class TerrainPolar extends TerrainBase { 7 | 8 | public TerrainPolar() {} 9 | 10 | @Override 11 | public float generateNoise(NoiseGenerator perlin, CellNoise cell, int x, int y, float ocean, float border, 12 | float river) { 13 | float st = (perlin.noise2(x / 160f, y / 160f) + 0.38f) * 35f * river; 14 | st = st < 0.2f ? 0.2f : st; 15 | 16 | float h = perlin.noise2(x / 60f, y / 60f) * st * 2f; 17 | h = h > 0f ? -h : h; 18 | h += st; 19 | h *= h / 50f; 20 | h += st; 21 | 22 | return 70f + h; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/rwg/util/CanyonColor.java: -------------------------------------------------------------------------------- 1 | package rwg.util; 2 | 3 | public class CanyonColor { 4 | 5 | private static byte[] claycolor = new byte[256]; 6 | 7 | public static void init(long l) { 8 | int[] c = new int[] { 0, 1, 8, 14, 1, 8 }; 9 | NoiseGenerator perlin = NoiseSelector.createNoiseGenerator(l); 10 | 11 | float n; 12 | for (int i = 0; i < 256; i++) { 13 | n = 3f + perlin.noise1(i / 10f) * 8; 14 | n = n < 0f ? 0f : n > 5.9f ? 5.9f : n; 15 | claycolor[i] = (byte) c[(int) n]; 16 | } 17 | } 18 | 19 | public static byte getColorForHeight(int height) { 20 | height = height < 0 ? 0 : height > 255 ? 255 : height; 21 | return claycolor[height]; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/rwg/terrain/TerrainSwampRiver.java: -------------------------------------------------------------------------------- 1 | package rwg.terrain; 2 | 3 | import rwg.util.CellNoise; 4 | import rwg.util.NoiseGenerator; 5 | 6 | public class TerrainSwampRiver extends TerrainBase { 7 | 8 | public TerrainSwampRiver() {} 9 | 10 | @Override 11 | public float generateNoise(NoiseGenerator perlin, CellNoise cell, int x, int y, float ocean, float border, 12 | float river) { 13 | float h = perlin.noise2(x / 180f, y / 180f) * 40f * river; 14 | h *= h / 35f; 15 | 16 | if (h < 1f) { 17 | h = 1f; 18 | } 19 | 20 | if (h < 4f) { 21 | h += (perlin.noise2(x / 50f, y / 50f) + perlin.noise2(x / 15f, y / 15f)) * (4f - h); 22 | } 23 | 24 | return 60f + h; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/rwg/surface/SurfaceBase.java: -------------------------------------------------------------------------------- 1 | package rwg.surface; 2 | 3 | import java.util.Random; 4 | 5 | import net.minecraft.block.Block; 6 | import net.minecraft.world.World; 7 | import net.minecraft.world.biome.BiomeGenBase; 8 | 9 | import rwg.util.CellNoise; 10 | import rwg.util.NoiseGenerator; 11 | 12 | public class SurfaceBase { 13 | 14 | protected Block topBlock; 15 | protected Block fillerBlock; 16 | 17 | public SurfaceBase(Block top, Block fill) { 18 | topBlock = top; 19 | fillerBlock = fill; 20 | } 21 | 22 | public void paintTerrain(Block[] blocks, byte[] metadata, int i, int j, int x, int y, int depth, World world, 23 | Random rand, NoiseGenerator perlin, CellNoise cell, float[] noise, float river, BiomeGenBase[] base) {} 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/rwg/terrain/TerrainMarsh.java: -------------------------------------------------------------------------------- 1 | package rwg.terrain; 2 | 3 | import rwg.util.CellNoise; 4 | import rwg.util.NoiseGenerator; 5 | 6 | public class TerrainMarsh extends TerrainBase { 7 | 8 | public TerrainMarsh() {} 9 | 10 | @Override 11 | public float generateNoise(NoiseGenerator perlin, CellNoise cell, int x, int y, float ocean, float border, 12 | float river) { 13 | float h = perlin.noise2(x / 130f, y / 130f) * 30f; 14 | 15 | h += perlin.noise2(x / 12f, y / 12f) * 2f; 16 | h += perlin.noise2(x / 18f, y / 18f) * 4f; 17 | 18 | h = h < 4f ? 0f : h - 4f; 19 | 20 | if (h == 0f) { 21 | h += perlin.noise2(x / 20f, y / 20f) + perlin.noise2(x / 5f, y / 5f); 22 | } 23 | 24 | return 62f + h; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/rwg/world/WorldTypeRealistic.java: -------------------------------------------------------------------------------- 1 | package rwg.world; 2 | 3 | import net.minecraft.world.World; 4 | import net.minecraft.world.WorldType; 5 | import net.minecraft.world.biome.WorldChunkManager; 6 | import net.minecraft.world.chunk.IChunkProvider; 7 | 8 | public class WorldTypeRealistic extends WorldType { 9 | 10 | public WorldTypeRealistic(String name) { 11 | super(name); 12 | } 13 | 14 | public WorldChunkManager getChunkManager(World world) { 15 | return new ChunkManagerRealistic(world); 16 | } 17 | 18 | public IChunkProvider getChunkGenerator(World world, String generatorOptions) { 19 | return new ChunkGeneratorRealistic(world, world.getSeed()); 20 | } 21 | 22 | public float getCloudHeight() { 23 | return 256F; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /.github/scripts/test-no-error-reports.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | RUNDIR="run" 4 | CRASH="crash-reports" 5 | SERVERLOG="server.log" 6 | 7 | if [[ -d $RUNDIR/$CRASH ]]; then 8 | echo "Crash reports detected:" 9 | cat $RUNDIR/$CRASH/crash*.txt 10 | exit 1 11 | fi 12 | 13 | if grep --quiet "Fatal errors were detected" $SERVERLOG; then 14 | echo "Fatal errors detected:" 15 | cat server.log 16 | exit 1 17 | fi 18 | 19 | if grep --quiet "The state engine was in incorrect state ERRORED and forced into state SERVER_STOPPED" $SERVERLOG; then 20 | echo "Server force stopped:" 21 | cat server.log 22 | exit 1 23 | fi 24 | 25 | if ! grep --quiet -Po '.+Done \(.+\)\! For help, type "help" or "\?"' $SERVERLOG; then 26 | echo "Server didn't finish startup:" 27 | cat server.log 28 | exit 1 29 | fi 30 | 31 | echo "No crash reports detected" 32 | exit 0 33 | 34 | -------------------------------------------------------------------------------- /src/main/java/rwg/util/SnowheightCalculator.java: -------------------------------------------------------------------------------- 1 | package rwg.util; 2 | 3 | import net.minecraft.block.Block; 4 | import net.minecraft.init.Blocks; 5 | 6 | public class SnowheightCalculator { 7 | 8 | public static void calc(int x, int y, int k, Block[] blocks, byte[] metadata, float[] noise) { 9 | if (k < 254) { 10 | byte h = (byte) ((noise[y * 16 + x] - ((int) noise[y * 16 + x])) * 8); 11 | 12 | if (h > 7) { 13 | blocks[(y * 16 + x) * 256 + k + 2] = Blocks.snow_layer; 14 | blocks[(y * 16 + x) * 256 + k + 1] = Blocks.snow_layer; 15 | metadata[(y * 16 + x) * 256 + k + 1] = 7; 16 | } else { 17 | blocks[(y * 16 + x) * 256 + k + 1] = Blocks.snow_layer; 18 | metadata[(y * 16 + x) * 256 + k + 1] = h; 19 | } 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/rwg/terrain/TerrainDuneValley.java: -------------------------------------------------------------------------------- 1 | package rwg.terrain; 2 | 3 | import rwg.util.CellNoise; 4 | import rwg.util.NoiseGenerator; 5 | 6 | public class TerrainDuneValley extends TerrainBase { 7 | 8 | private float valley; 9 | 10 | public TerrainDuneValley(float valleySize) { 11 | valley = valleySize; 12 | } 13 | 14 | @Override 15 | public float generateNoise(NoiseGenerator perlin, CellNoise cell, int x, int y, float ocean, float border, 16 | float river) { 17 | float h = (perlin.noise2(x / valley, y / valley) + 0.25f) * 65f * river; 18 | h = h < 1f ? 1f : h; 19 | 20 | float r = cell.noise(x / 50D, y / 50D, 1D) * h * 2; 21 | h += r; 22 | 23 | h += perlin.noise2(x / 40f, y / 40f) * 8; 24 | h += perlin.noise2(x / 14f, y / 14f) * 2; 25 | 26 | return 70f + h; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/rwg/handlers/LoginHandler.java: -------------------------------------------------------------------------------- 1 | package rwg.handlers; 2 | 3 | import cpw.mods.fml.common.eventhandler.SubscribeEvent; 4 | import cpw.mods.fml.common.gameevent.PlayerEvent; 5 | 6 | public class LoginHandler { 7 | 8 | @SuppressWarnings("unused") 9 | @SubscribeEvent 10 | public void onPlayerLogin(PlayerEvent.PlayerLoggedInEvent event) { 11 | // TODO: Figure out how to save&detect a brand new world vs. an upgraded world, and display a message 12 | // conditional on that: 13 | 14 | /* 15 | * if (RwgWorldSavedData.getNoiseImplementation() == NoiseImplementation.UNKNOWN) { 16 | * event.player.addChatMessage(new ChatComponentText(RED + 17 | * "WARNING: Unable to detect worldgen version for this world. This can cause chunk border mismatch if not corrected. Please run " 18 | * + GOLD + "/rwg_buginfo" + WHITE + " for info on how to fix.")); } 19 | */ 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/rwg/data/VillageMaterialData.java: -------------------------------------------------------------------------------- 1 | package rwg.data; 2 | 3 | import net.minecraft.block.Block; 4 | import net.minecraft.init.Blocks; 5 | import net.minecraft.world.biome.BiomeGenBase; 6 | 7 | public class VillageMaterialData { 8 | 9 | public int biomeID; 10 | 11 | public Block logBlock = Blocks.log; 12 | public Block cobbleBlock = Blocks.cobblestone; 13 | public Block plankBlock = Blocks.planks; 14 | public Block pathBlock = Blocks.cobblestone; 15 | public Block stairsWoodBlock = Blocks.oak_stairs; 16 | public Block stairsStoneBlock = Blocks.stone_stairs; 17 | public Block slabsBlock = Blocks.stone_slab; 18 | 19 | public int logBlockMeta = 0; 20 | public int cobbleBlockMeta = 0; 21 | public int plankBlockMeta = 0; 22 | public int pathBlockMeta = 0; 23 | public int slabsBlockMeta = 0; 24 | 25 | public VillageMaterialData(BiomeGenBase biome) { 26 | biomeID = biome.biomeID; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/rwg/terrain/TerrainGrasslandFlats.java: -------------------------------------------------------------------------------- 1 | package rwg.terrain; 2 | 3 | import rwg.util.CellNoise; 4 | import rwg.util.NoiseGenerator; 5 | 6 | public class TerrainGrasslandFlats extends TerrainBase { 7 | 8 | public TerrainGrasslandFlats() {} 9 | 10 | @Override 11 | public float generateNoise(NoiseGenerator perlin, CellNoise cell, int x, int y, float ocean, float border, 12 | float river) { 13 | float h = perlin.noise2(x / 100f, y / 100f) * 7; 14 | h += perlin.noise2(x / 20f, y / 20f) * 2; 15 | 16 | float m = perlin.noise2(x / 180f, y / 180f) * 70f * river; 17 | m *= m / 40f; 18 | 19 | float sm = perlin.noise2(x / 30f, y / 30f) * 8f; 20 | sm *= m / 20f > 3.75f ? 3.75f : m / 20f; 21 | m += sm; 22 | 23 | float l = perlin.noise2(x / 260f, y / 260f) * 38f; 24 | l *= l / 25f; 25 | l = l < -8f ? -8f : l; 26 | 27 | return 68f + h + m - l; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/rwg/surface/SurfaceMountainPolar.java: -------------------------------------------------------------------------------- 1 | package rwg.surface; 2 | 3 | import java.util.Random; 4 | 5 | import net.minecraft.block.Block; 6 | import net.minecraft.world.World; 7 | import net.minecraft.world.biome.BiomeGenBase; 8 | 9 | import rwg.util.CellNoise; 10 | import rwg.util.NoiseGenerator; 11 | 12 | public class SurfaceMountainPolar extends SurfaceBase { 13 | 14 | private boolean beach; 15 | private Block beachBlock; 16 | private float min; 17 | 18 | public SurfaceMountainPolar(Block top, Block fill, boolean genBeach, Block genBeachBlock, float minCliff) { 19 | super(top, fill); 20 | beach = genBeach; 21 | beachBlock = genBeachBlock; 22 | min = minCliff; 23 | } 24 | 25 | @Override 26 | public void paintTerrain(Block[] blocks, byte[] metadata, int i, int j, int x, int y, int depth, World world, 27 | Random rand, NoiseGenerator perlin, CellNoise cell, float[] noise, float river, BiomeGenBase[] base) {} 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/rwg/terrain/TerrainDunes.java: -------------------------------------------------------------------------------- 1 | package rwg.terrain; 2 | 3 | import rwg.util.CellNoise; 4 | import rwg.util.NoiseGenerator; 5 | 6 | public class TerrainDunes extends TerrainBase { 7 | 8 | public TerrainDunes() {} 9 | 10 | public float generateNoise(NoiseGenerator perlin, CellNoise cell, int x, int y, float ocean, float border, 11 | float river) { 12 | float st = (perlin.noise2(x / 160f, y / 160f) + 0.38f) * 35f; 13 | st = st < 0.2f ? 0.2f : st; 14 | 15 | float h = perlin.noise2(x / 60f, y / 60f) * st * 2f; 16 | h = h > 0f ? -h : h; 17 | h += st; 18 | h *= h / 50f; 19 | h += st; 20 | 21 | if (h < 10f) { 22 | float d = (h - 10f) / 2f; 23 | d = d > 4f ? 4f : d; 24 | h += cell.noise(x / 25D, y / 25D, 1D) * d; 25 | h += perlin.noise2(x / 30f, y / 30f) * d; 26 | h += perlin.noise2(x / 14f, y / 14f) * d * 0.5f; 27 | } 28 | 29 | return 70f + (h * river); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/rwg/biomes/base/BaseBiomeHotDesert.java: -------------------------------------------------------------------------------- 1 | package rwg.biomes.base; 2 | 3 | import net.minecraft.init.Blocks; 4 | import net.minecraft.world.biome.BiomeGenBase; 5 | 6 | import rwg.data.VillageMaterialData; 7 | import rwg.data.VillageMaterials; 8 | 9 | public class BaseBiomeHotDesert extends BiomeGenBase { 10 | 11 | public BaseBiomeHotDesert(int id, String bn) { 12 | super(id); 13 | setTemperatureRainfall(1f, 0f); 14 | setBiomeName(bn); 15 | setDisableRain(); 16 | spawnableCreatureList.clear(); 17 | 18 | VillageMaterialData vmd = new VillageMaterialData(this); 19 | vmd.plankBlock = Blocks.sandstone; 20 | vmd.plankBlockMeta = 0; 21 | vmd.logBlock = Blocks.sandstone; 22 | vmd.logBlockMeta = 0; 23 | vmd.pathBlock = Blocks.sandstone; 24 | vmd.stairsWoodBlock = Blocks.sandstone_stairs; 25 | vmd.slabsBlock = Blocks.fence; 26 | vmd.cobbleBlock = Blocks.sandstone; 27 | VillageMaterials.registerVillageMaterial(vmd); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/rwg/util/TerrainMath.java: -------------------------------------------------------------------------------- 1 | package rwg.util; 2 | 3 | public class TerrainMath { 4 | 5 | public static double nextX(double x, double d, double s) { 6 | return x + (s * Math.cos(d * Math.PI / 180.0)); 7 | } 8 | 9 | public static double nextY(double y, double d, double s) { 10 | return y + (s * Math.sin(d * Math.PI / 180.0)); 11 | } 12 | 13 | public static double dis1(double n1, double n2) { 14 | return Math.sqrt((n1 - n2) * (n1 - n2)); 15 | } 16 | 17 | public static double dis2(double x1, double y1, double x2, double y2) { 18 | return Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)); 19 | } 20 | 21 | public static double dis3(double x1, double y1, double z1, double x2, double y2, double z2) { 22 | return Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2) + (z1 - z2) * (z1 - z2)); 23 | } 24 | 25 | public static double dirToPoint2(double x1, double y1, double x2, double y2) { 26 | return Math.atan2((y2 - y1), (x2 - x1)) * 180 / Math.PI; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/rwg/util/NoiseSelector.java: -------------------------------------------------------------------------------- 1 | package rwg.util; 2 | 3 | import rwg.world.RwgWorldSavedData; 4 | 5 | public class NoiseSelector { 6 | 7 | public static NoiseGenerator createNoiseGenerator(long seed) { 8 | 9 | NoiseImplementation noiseImplementation = RwgWorldSavedData.getNoiseImplementation(); 10 | 11 | switch (noiseImplementation) { 12 | case UNKNOWN: 13 | case DYNAMICPERLIN: 14 | NoiseGeneratorWrapper.useOpenSimplex = false; 15 | return new NoiseGeneratorWrapper(seed); 16 | case PERLIN: 17 | NoiseGeneratorWrapper.useOpenSimplex = false; 18 | return new PerlinNoise(seed); 19 | case OPENSIMPLEX: 20 | NoiseGeneratorWrapper.useOpenSimplex = true; 21 | return new OpenSimplexNoise(seed); 22 | case DYNAMICOPENSIMPLEX: 23 | NoiseGeneratorWrapper.useOpenSimplex = true; 24 | return new NoiseGeneratorWrapper(seed); 25 | } 26 | 27 | return new NoiseGeneratorWrapper(seed); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/rwg/terrain/TerrainGrasslandMountains.java: -------------------------------------------------------------------------------- 1 | package rwg.terrain; 2 | 3 | import rwg.util.CellNoise; 4 | import rwg.util.NoiseGenerator; 5 | 6 | public class TerrainGrasslandMountains extends TerrainBase { 7 | 8 | public TerrainGrasslandMountains() {} 9 | 10 | @Override 11 | public float generateNoise(NoiseGenerator perlin, CellNoise cell, int x, int y, float ocean, float border, 12 | float river) { 13 | float h = perlin.noise2(x / 100f, y / 100f) * 7; 14 | h += perlin.noise2(x / 20f, y / 20f) * 2; 15 | 16 | float m = perlin.noise2(x / 230f, y / 230f) * 120f * river; 17 | m *= m / 35f; 18 | m = m > 70f ? 70f + (m - 70f) / 2.5f : m; 19 | 20 | float c = cell.noise(x / 30f, y / 30f, 1D) * (m * 0.30f); 21 | 22 | float sm = perlin.noise2(x / 30f, y / 30f) * 8f + perlin.noise2(x / 8f, y / 8f); 23 | sm *= m / 20f > 2.5f ? 2.5f : m / 20f; 24 | m += sm; 25 | 26 | m += c; 27 | 28 | float l = perlin.noise2(x / 260f, y / 260f) * 38f; 29 | l *= l / 25f; 30 | l = l < -8f ? -8f : l; 31 | 32 | return 68f + h + m - l; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/rwg/terrain/TerrainMountain.java: -------------------------------------------------------------------------------- 1 | package rwg.terrain; 2 | 3 | import rwg.util.CellNoise; 4 | import rwg.util.NoiseGenerator; 5 | 6 | public class TerrainMountain extends TerrainBase { 7 | 8 | public TerrainMountain() {} 9 | 10 | @Override 11 | public float generateNoise(NoiseGenerator perlin, CellNoise cell, int x, int y, float ocean, float border, 12 | float river) { 13 | float h = perlin.noise2(x / 300f, y / 300f) * 135f * river; 14 | h *= h / 32f; 15 | h = h > 150f ? 150f : h; 16 | 17 | if (h > 10f) { 18 | float d = (h - 10f) / 2f > 8f ? 8f : (h - 10f) / 2f; 19 | h += perlin.noise2(x / 35f, y / 35f) * d; 20 | h += perlin.noise2(x / 60f, y / 60f) * d * 0.5f; 21 | 22 | if (h > 35f) { 23 | float d2 = (h - 35f) / 1.5f > 30f ? 30f : (h - 35f) / 1.5f; 24 | h += cell.noise(x / 25D, y / 25D, 1D) * d2; 25 | } 26 | } 27 | 28 | h += perlin.noise2(x / 28f, y / 28f) * 4; 29 | h += perlin.noise2(x / 18f, y / 18f) * 2; 30 | h += perlin.noise2(x / 8f, y / 8f) * 2; 31 | 32 | return h + 67f; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## REALISTIC WORLD GEN ## 2 | 3 | http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/1281910-teds-world-gen-mods-realistic-world-gen-alpha-1-3 4 | 5 | ## CHANGELOG ## 6 | 7 | Version Alpha 1.3 '03-01-2015' 8 | - Added rivers 9 | - Fixed animals spawing in deserts 10 | - Fixed ore gen events 11 | 12 | Version Alpha 1.2.02 '31-12-2014' 13 | - Fixed decorate event bugs 14 | 15 | Version Alpha 1.2.01 '30-12-2014' 16 | - Added populate and decorate events 17 | 18 | Version Alpha 1.2 '30-12-2014' 19 | - Added biomes 'o plenty support 20 | - Enabled all biomes 21 | - Added new biomes 22 | - Changed biome names 23 | - Fixed rain in warm biomes 24 | - Fixed some grass color issues in biomes transitions 25 | - Added vanilla bedrock spawning 26 | - Added new events for compatibility 27 | - Fixed biome transitions in canyon and mesa biomes 28 | 29 | Version Alpha 1.1 '15-10-2014' 30 | - Added new biome placement system 31 | - Improved biome dictionary 32 | - Added redwood test biome 33 | -------------------------------------------------------------------------------- /src/main/java/rwg/terrain/TerrainMountainSpikes.java: -------------------------------------------------------------------------------- 1 | package rwg.terrain; 2 | 3 | import rwg.util.CellNoise; 4 | import rwg.util.NoiseGenerator; 5 | 6 | public class TerrainMountainSpikes extends TerrainBase { 7 | 8 | public TerrainMountainSpikes() {} 9 | 10 | @Override 11 | public float generateNoise(NoiseGenerator perlin, CellNoise cell, int x, int y, float ocean, float border, 12 | float river) { 13 | float b = (12f + (perlin.noise2(x / 300f, y / 300f) * 6f)); 14 | float h = cell.noise(x / 200D, y / 200D, 1D) * b * river; 15 | h *= h * 1.5f; 16 | h = h > 155f ? 155f : h; 17 | 18 | if (h > 2f) { 19 | float d = (h - 2f) / 2f > 8f ? 8f : (h - 2f) / 2f; 20 | h += perlin.noise2(x / 30f, y / 30f) * d; 21 | h += perlin.noise2(x / 50f, y / 50f) * d * 0.5f; 22 | 23 | if (h > 35f) { 24 | float d2 = (h - 35f) / 1.5f > 30f ? 30f : (h - 35f) / 1.5f; 25 | h += cell.noise(x / 25D, y / 25D, 1D) * d2; 26 | } 27 | } 28 | 29 | h += perlin.noise2(x / 18f, y / 18f) * 3; 30 | h += perlin.noise2(x / 8f, y / 8f) * 2; 31 | 32 | return 45f + h + (b * 2); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/rwg/util/NoiseGeneratorWrapper.java: -------------------------------------------------------------------------------- 1 | package rwg.util; 2 | 3 | public class NoiseGeneratorWrapper implements NoiseGenerator { 4 | 5 | NoiseGenerator innerPerlin, innerOpenSimplex; 6 | public static boolean useOpenSimplex; 7 | 8 | public NoiseGeneratorWrapper(long seed) { 9 | innerPerlin = new PerlinNoise(seed); 10 | innerOpenSimplex = new OpenSimplexNoise(seed); 11 | } 12 | 13 | @Override 14 | public double improvedNoise(double x, double y, double z) { 15 | if (useOpenSimplex) return innerOpenSimplex.improvedNoise(x, y, z); 16 | return innerPerlin.improvedNoise(x, y, z); 17 | } 18 | 19 | @Override 20 | public float noise1(float x) { 21 | if (useOpenSimplex) return innerOpenSimplex.noise1(x); 22 | return innerPerlin.noise1(x); 23 | } 24 | 25 | @Override 26 | public float noise2(float x, float y) { 27 | if (useOpenSimplex) return innerOpenSimplex.noise2(x, y); 28 | return innerPerlin.noise2(x, y); 29 | } 30 | 31 | @Override 32 | public float noise3(float x, float y, float z) { 33 | if (useOpenSimplex) return innerOpenSimplex.noise3(x, y, z); 34 | return innerPerlin.noise3(x, y, z); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/rwg/terrain/TerrainHighland.java: -------------------------------------------------------------------------------- 1 | package rwg.terrain; 2 | 3 | import rwg.util.CellNoise; 4 | import rwg.util.NoiseGenerator; 5 | 6 | public class TerrainHighland extends TerrainBase { 7 | 8 | private float start; 9 | private float height; 10 | private float base; 11 | private float width; 12 | 13 | public TerrainHighland(float hillStart, float landHeight, float baseHeight, float hillWidth) { 14 | start = hillStart; 15 | height = landHeight; 16 | base = baseHeight; 17 | width = hillWidth; 18 | } 19 | 20 | @Override 21 | public float generateNoise(NoiseGenerator perlin, CellNoise cell, int x, int y, float ocean, float border, 22 | float river) { 23 | float h = perlin.noise2(x / width, y / width) * height * river; 24 | h = h < start ? start + ((h - start) / 4.5f) : h; 25 | 26 | if (h > 0f) { 27 | float st = h * 1.5f > 15f ? 15f : h * 1.5f; 28 | h += cell.noise(x / 70D, y / 70D, 1D) * st; 29 | } 30 | 31 | h += perlin.noise2(x / 20f, y / 20f) * 5f; 32 | h += perlin.noise2(x / 12f, y / 12f) * 3f; 33 | h += perlin.noise2(x / 5f, y / 5f) * 1.5f; 34 | 35 | return base + h; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/resources/assets/rwg/lang/en_US.lang: -------------------------------------------------------------------------------- 1 | generator.RWG=Realistic Alpha 2 | rwg.buginfo.line1=A bug in the RWG version shipped with GTNH 2.2.0.0 caused the world to be generated differently than previous versions. 3 | rwg.buginfo.line2=The bug has since been fixed, reverting future generation to pre-2.2.0.0 style. 4 | rwg.buginfo.line3=Unfortunately, what version was used when this world was created can't be automatically detected. 5 | rwg.buginfo.line4=To allow players from both versions to continue playing on their world without making new ugly chunk borders, 6 | rwg.buginfo.line5=this version of RWG supports both but requires you to select which one to use when upgrading worlds. 7 | rwg.buginfo.perlin= is the version used in all versions except 2.2.0.0 8 | rwg.buginfo.opensimplex= is the version used in 2.2.0.0 9 | 10 | rwg.noise.current_type=Current noise type is %s 11 | rwg.noise.unchanged=Noise type unchanged. 12 | rwg.noise.was_set_to.unknown=Noise type was set to UNKNOWN, which will default to Perlin. 13 | rwg.noise.was_set_to.generic=Noise type was set to %s 14 | rwg.noise.instant_new_chunks=All new chunks will instantly be generated with the selected algorithm. 15 | rwg.noise.needs_restart=World must be reloaded (server restarted or single player relog) for changes to take effect. -------------------------------------------------------------------------------- /src/main/java/rwg/util/NoiseGenerator.java: -------------------------------------------------------------------------------- 1 | package rwg.util; 2 | 3 | public interface NoiseGenerator { 4 | 5 | /** 6 | * Computes noise function for three dimensions at the point (x,y,z). 7 | * 8 | * @param x x dimension parameter 9 | * @param y y dimension parameter 10 | * @param z z dimension parameter 11 | * @return the noise value at the point (x, y, z) 12 | */ 13 | double improvedNoise(double x, double y, double z); 14 | 15 | /** 16 | * 1-D noise generation function. 17 | * 18 | * @param x Seed for the noise function 19 | * @return The noisy output 20 | */ 21 | float noise1(float x); 22 | 23 | /** 24 | * Create noise in a 2D space. 25 | * 26 | * @param x The X coordinate of the location to sample 27 | * @param y The Y coordinate of the location to sample 28 | * @return A noisy value at the given position 29 | */ 30 | float noise2(float x, float y); 31 | 32 | /** 33 | * Create noise in a 3D space. 34 | * 35 | * @param x The X coordinate of the location to sample 36 | * @param y The Y coordinate of the location to sample 37 | * @param z The Z coordinate of the location to sample 38 | * @return A noisy value at the given position 39 | */ 40 | float noise3(float x, float y, float z); 41 | } 42 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text eol=lf 2 | 3 | *.[jJ][aA][rR] binary 4 | 5 | *.[pP][nN][gG] binary 6 | *.[jJ][pP][gG] binary 7 | *.[jJ][pP][eE][gG] binary 8 | *.[gG][iI][fF] binary 9 | *.[tT][iI][fF] binary 10 | *.[tT][iI][fF][fF] binary 11 | *.[iI][cC][oO] binary 12 | *.[sS][vV][gG] text 13 | *.[eE][pP][sS] binary 14 | *.[xX][cC][fF] binary 15 | 16 | *.[kK][aA][rR] binary 17 | *.[mM]4[aA] binary 18 | *.[mM][iI][dD] binary 19 | *.[mM][iI][dD][iI] binary 20 | *.[mM][pP]3 binary 21 | *.[oO][gG][gG] binary 22 | *.[rR][aA] binary 23 | 24 | *.7[zZ] binary 25 | *.[gG][zZ] binary 26 | *.[tT][aA][rR] binary 27 | *.[tT][gG][zZ] binary 28 | *.[zZ][iI][pP] binary 29 | 30 | *.[tT][cC][nN] binary 31 | *.[sS][oO] binary 32 | *.[dD][lL][lL] binary 33 | *.[dD][yY][lL][iI][bB] binary 34 | *.[pP][sS][dD] binary 35 | *.[tT][tT][fF] binary 36 | *.[oO][tT][fF] binary 37 | 38 | *.[pP][aA][tT][cC][hH] -text 39 | 40 | *.[bB][aA][tT] text eol=crlf 41 | *.[cC][mM][dD] text eol=crlf 42 | *.[pP][sS]1 text eol=crlf 43 | 44 | *[aA][uU][tT][oO][gG][eE][nN][eE][rR][aA][tT][eE][dD]* binary 45 | -------------------------------------------------------------------------------- /src/main/java/rwg/data/TreeReplacement.java: -------------------------------------------------------------------------------- 1 | package rwg.data; 2 | 3 | import net.minecraft.init.Blocks; 4 | import net.minecraftforge.event.terraingen.SaplingGrowTreeEvent; 5 | 6 | import cpw.mods.fml.common.eventhandler.SubscribeEvent; 7 | import rwg.RWG; 8 | import rwg.deco.trees.DecoSavannah; 9 | import rwg.deco.trees.DecoSmallPine; 10 | 11 | public class TreeReplacement { 12 | /* 13 | * Missing a check for air and its extremely buggy :( 14 | */ 15 | 16 | @SubscribeEvent 17 | public boolean saplingGrowTree(SaplingGrowTreeEvent e) { 18 | System.out.println("Zwieber nie gaan stele nu he"); 19 | if (e.world.getWorldInfo().getTerrainType() == RWG.worldtype) { 20 | int type = e.world.getBlockMetadata(e.x, e.y, e.z); 21 | System.out.println("tiepe: " + type); 22 | if (type == 9) { 23 | e.world.setBlock(e.x, e.y, e.z, Blocks.air); 24 | (new DecoSmallPine(3 + e.rand.nextInt(3), 5 + e.rand.nextInt(5))) 25 | .generate(e.world, e.rand, e.x, e.y, e.z); 26 | return true; 27 | } 28 | if (type == 12) { 29 | e.world.setBlock(e.x, e.y, e.z, Blocks.air); 30 | (new DecoSavannah(1)).generate(e.world, e.rand, e.x, e.y, e.z); 31 | return true; 32 | } 33 | } 34 | return false; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/rwg/biomes/base/BaseBiomeOcean.java: -------------------------------------------------------------------------------- 1 | package rwg.biomes.base; 2 | 3 | import net.minecraft.entity.passive.EntityOcelot; 4 | import net.minecraft.entity.passive.EntityWolf; 5 | import net.minecraft.world.biome.BiomeGenBase; 6 | 7 | public class BaseBiomeOcean extends BiomeGenBase { 8 | 9 | public BaseBiomeOcean(int id, int subID, String bn) { 10 | super(id); 11 | 12 | if (subID == 0) // ICE 13 | { 14 | setTemperatureRainfall(0.0f, 0.1f); 15 | spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityWolf.class, 8, 4, 4)); 16 | } else if (subID == 1) // COLD 17 | { 18 | setTemperatureRainfall(0.5f, 0.4f); 19 | spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityWolf.class, 8, 1, 2)); 20 | } else if (subID == 2) // TEMPERATE 21 | { 22 | setTemperatureRainfall(0.8f, 0.6f); 23 | } else if (subID == 3) // HOT 24 | { 25 | setTemperatureRainfall(0.8f, 0.2f); 26 | setDisableRain(); 27 | } else if (subID == 4) // WET 28 | { 29 | setTemperatureRainfall(0.9f, 0.9f); 30 | spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityOcelot.class, 2, 1, 1)); 31 | } else if (subID == 5) // OASIS 32 | { 33 | setTemperatureRainfall(0.9f, 0.9f); 34 | } 35 | 36 | setBiomeName(bn); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/rwg/biomes/base/BaseBiomeRiver.java: -------------------------------------------------------------------------------- 1 | package rwg.biomes.base; 2 | 3 | import net.minecraft.entity.passive.EntityOcelot; 4 | import net.minecraft.entity.passive.EntityWolf; 5 | import net.minecraft.world.biome.BiomeGenBase; 6 | 7 | public class BaseBiomeRiver extends BiomeGenBase { 8 | 9 | public BaseBiomeRiver(int id, int subID, String bn) { 10 | super(id); 11 | 12 | if (subID == 0) // ICE 13 | { 14 | setTemperatureRainfall(0.0f, 0.1f); 15 | spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityWolf.class, 8, 4, 4)); 16 | } else if (subID == 1) // COLD 17 | { 18 | setTemperatureRainfall(0.5f, 0.4f); 19 | spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityWolf.class, 8, 1, 2)); 20 | } else if (subID == 2) // TEMPERATE 21 | { 22 | setTemperatureRainfall(0.8f, 0.6f); 23 | } else if (subID == 3) // HOT 24 | { 25 | setTemperatureRainfall(0.8f, 0.2f); 26 | setDisableRain(); 27 | } else if (subID == 4) // WET 28 | { 29 | setTemperatureRainfall(0.9f, 0.9f); 30 | spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityOcelot.class, 2, 1, 1)); 31 | } else if (subID == 5) // OASIS 32 | { 33 | setTemperatureRainfall(0.9f, 0.9f); 34 | } 35 | 36 | setBiomeName(bn); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/rwg/biomes/base/BaseBiomeHotForest.java: -------------------------------------------------------------------------------- 1 | package rwg.biomes.base; 2 | 3 | import net.minecraft.init.Blocks; 4 | import net.minecraft.world.ColorizerFoliage; 5 | import net.minecraft.world.ColorizerGrass; 6 | import net.minecraft.world.biome.BiomeGenBase; 7 | 8 | import cpw.mods.fml.relauncher.Side; 9 | import cpw.mods.fml.relauncher.SideOnly; 10 | import rwg.data.VillageMaterialData; 11 | import rwg.data.VillageMaterials; 12 | 13 | public class BaseBiomeHotForest extends BiomeGenBase { 14 | 15 | public BaseBiomeHotForest(int id, String bn) { 16 | super(id); 17 | setTemperatureRainfall(0.8f, 0.2f); 18 | setBiomeName(bn); 19 | setDisableRain(); 20 | 21 | VillageMaterialData vmd = new VillageMaterialData(this); 22 | vmd.plankBlock = Blocks.planks; 23 | vmd.plankBlockMeta = 4; 24 | vmd.logBlock = Blocks.log2; 25 | vmd.logBlockMeta = 0; 26 | vmd.pathBlock = Blocks.cobblestone; 27 | vmd.stairsWoodBlock = Blocks.acacia_stairs; 28 | vmd.slabsBlock = Blocks.fence; 29 | VillageMaterials.registerVillageMaterial(vmd); 30 | } 31 | 32 | @SideOnly(Side.CLIENT) 33 | public int getBiomeGrassColor(int i, int dont, int care) { 34 | return ColorizerGrass.getGrassColor(1f, 0f); 35 | } 36 | 37 | @SideOnly(Side.CLIENT) 38 | public int getBiomeFoliageColor(int i, int dont, int care) { 39 | return ColorizerFoliage.getFoliageColor(0.8f, 0.2f); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/rwg/terrain/TerrainMesa.java: -------------------------------------------------------------------------------- 1 | package rwg.terrain; 2 | 3 | import rwg.util.CellNoise; 4 | import rwg.util.NoiseGenerator; 5 | 6 | public class TerrainMesa extends TerrainBase { 7 | 8 | public TerrainMesa() {} 9 | 10 | @Override 11 | public float generateNoise(NoiseGenerator perlin, CellNoise cell, int x, int y, float ocean, float border, 12 | float river) { 13 | float b = perlin.noise2(x / 130f, y / 130f) * 50f * river; 14 | b *= b / 40f; 15 | 16 | float hn = perlin.noise2(x / 12f, y / 12f); 17 | 18 | float sb = 0f; 19 | if (b > 2f) { 20 | sb = (b - 2f) / 2f; 21 | sb = sb < 0f ? 0f : sb > 5.5f ? 5.5f : sb; 22 | sb = hn * sb; 23 | } 24 | b += sb; 25 | 26 | b = b < 0.1f ? 0.1f : b; 27 | 28 | float c1 = 0f; 29 | if (b > 1f) { 30 | c1 = b > 5.5f ? 4.5f : b - 1f; 31 | c1 *= 3; 32 | } 33 | 34 | float c2 = 0f; 35 | if (b > 5.5f && border > 0.95f + hn * 0.09f) { 36 | c2 = b > 6f ? 0.5f : b - 5.5f; 37 | c2 *= 35; 38 | } 39 | 40 | float bn = 0f; 41 | if (b < 7f) { 42 | float bnh = 5f - b; 43 | bn += perlin.noise2(x / 70f, y / 70f) * (bnh * 0.4f); 44 | bn += perlin.noise2(x / 20f, y / 20f) * (bnh * 0.3f); 45 | } 46 | 47 | float w = perlin.noise2(x / 80f, y / 80f) * 25f; 48 | w *= w / 25f; 49 | 50 | b += c1 + c2 + bn - w; 51 | 52 | return 74f + b; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/rwg/surface/river/SurfaceRiverOasis.java: -------------------------------------------------------------------------------- 1 | package rwg.surface.river; 2 | 3 | import java.util.Random; 4 | 5 | import net.minecraft.block.Block; 6 | import net.minecraft.init.Blocks; 7 | import net.minecraft.world.World; 8 | import net.minecraft.world.biome.BiomeGenBase; 9 | 10 | import rwg.surface.SurfaceBase; 11 | import rwg.util.CellNoise; 12 | import rwg.util.NoiseGenerator; 13 | 14 | public class SurfaceRiverOasis extends SurfaceBase { 15 | 16 | public SurfaceRiverOasis() { 17 | super(Blocks.grass, Blocks.dirt); 18 | } 19 | 20 | @Override 21 | public void paintTerrain(Block[] blocks, byte[] metadata, int i, int j, int x, int y, int depth, World world, 22 | Random rand, NoiseGenerator perlin, CellNoise cell, float[] noise, float river, BiomeGenBase[] base) { 23 | if (river > 0.05f && river + (perlin.noise2(i / 10f, j / 10f) * 0.15f) > 0.8f) { 24 | Block b; 25 | for (int k = 255; k > -1; k--) { 26 | b = blocks[(y * 16 + x) * 256 + k]; 27 | if (b == Blocks.air) { 28 | depth = -1; 29 | } else if (b != Blocks.water) { 30 | depth++; 31 | 32 | if (depth == 0 && k > 61) { 33 | blocks[(y * 16 + x) * 256 + k] = Blocks.grass; 34 | } else if (depth < 4) { 35 | blocks[(y * 16 + x) * 256 + k] = Blocks.dirt; 36 | } else if (depth > 4) { 37 | return; 38 | } 39 | } 40 | } 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/rwg/biomes/realistic/coast/RealisticBiomeCoastColdCliff.java: -------------------------------------------------------------------------------- 1 | package rwg.biomes.realistic.coast; 2 | 3 | import java.util.Random; 4 | 5 | import net.minecraft.block.Block; 6 | import net.minecraft.world.World; 7 | import net.minecraft.world.biome.BiomeGenBase; 8 | 9 | import rwg.api.RWGBiomes; 10 | import rwg.biomes.realistic.RealisticBiomeBase; 11 | import rwg.util.CellNoise; 12 | import rwg.util.NoiseGenerator; 13 | 14 | public class RealisticBiomeCoastColdCliff extends RealisticBiomeBase { 15 | 16 | public RealisticBiomeCoastColdCliff() { 17 | super(0, RWGBiomes.baseOceanTemperate); 18 | } 19 | 20 | @Override 21 | public void rDecorate(World world, Random rand, int chunkX, int chunkY, NoiseGenerator perlin, CellNoise cell, 22 | float strength, float river) {} 23 | 24 | @Override 25 | public float rNoise(NoiseGenerator perlin, CellNoise cell, int x, int y, float ocean, float border, float river) { 26 | river = river > 0.5f ? 1f : river * 2f; 27 | 28 | float h = ocean < 0.5f ? ocean * 14f : 7f; 29 | 30 | if (ocean < 1.9f) { 31 | float st = (1.9f - ocean) * 20f; 32 | st = st > 1f ? 1f : st; 33 | 34 | h += perlin.noise2(x / 12f, y / 12f) * 1.5f; 35 | h += perlin.noise2(x / 20f, y / 20f) * 3f; 36 | } 37 | 38 | return 55f + h; 39 | } 40 | 41 | @Override 42 | public void rReplace(Block[] blocks, byte[] metadata, int i, int j, int x, int y, int depth, World world, 43 | Random rand, NoiseGenerator perlin, CellNoise cell, float[] noise, float river, BiomeGenBase[] base) {} 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/rwg/biomes/base/BaseBiomeHotPlains.java: -------------------------------------------------------------------------------- 1 | package rwg.biomes.base; 2 | 3 | import net.minecraft.entity.passive.EntityHorse; 4 | import net.minecraft.init.Blocks; 5 | import net.minecraft.world.ColorizerFoliage; 6 | import net.minecraft.world.ColorizerGrass; 7 | import net.minecraft.world.biome.BiomeGenBase; 8 | 9 | import cpw.mods.fml.relauncher.Side; 10 | import cpw.mods.fml.relauncher.SideOnly; 11 | import rwg.data.VillageMaterialData; 12 | import rwg.data.VillageMaterials; 13 | 14 | public class BaseBiomeHotPlains extends BiomeGenBase { 15 | 16 | public BaseBiomeHotPlains(int id, String bn) { 17 | super(id); 18 | setTemperatureRainfall(0.9f, 0.1f); 19 | setBiomeName(bn); 20 | setDisableRain(); 21 | spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityHorse.class, 5, 2, 3)); 22 | 23 | VillageMaterialData vmd = new VillageMaterialData(this); 24 | vmd.plankBlock = Blocks.planks; 25 | vmd.plankBlockMeta = 4; 26 | vmd.logBlock = Blocks.log2; 27 | vmd.logBlockMeta = 0; 28 | vmd.pathBlock = Blocks.cobblestone; 29 | vmd.stairsWoodBlock = Blocks.acacia_stairs; 30 | vmd.slabsBlock = Blocks.fence; 31 | VillageMaterials.registerVillageMaterial(vmd); 32 | } 33 | 34 | @SideOnly(Side.CLIENT) 35 | public int getBiomeGrassColor(int i, int dont, int care) { 36 | return ColorizerGrass.getGrassColor(1f, 0f); 37 | } 38 | 39 | @SideOnly(Side.CLIENT) 40 | public int getBiomeFoliageColor(int i, int dont, int care) { 41 | return ColorizerFoliage.getFoliageColor(0.9f, 0.1f); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/rwg/terrain/TerrainMountainRiver.java: -------------------------------------------------------------------------------- 1 | package rwg.terrain; 2 | 3 | import rwg.util.CellNoise; 4 | import rwg.util.NoiseGenerator; 5 | 6 | public class TerrainMountainRiver extends TerrainBase { 7 | 8 | public TerrainMountainRiver() {} 9 | 10 | @Override 11 | public float generateNoise(NoiseGenerator perlin, CellNoise cell, int x, int y, float ocean, float border, 12 | float river) { 13 | float h = perlin.noise2(x / 300f, y / 300f) * 135f * river; 14 | h *= h / 32f; 15 | h = h > 150f ? 150f : h; 16 | 17 | /* 18 | * float bn = 0f; if(h < 1f) { bn = 1f - h; for(int i = 0; i < 3; i++) { bn *= bn * 1.25f; } bn = bn > 3f ? 3f : 19 | * bn; } 20 | */ 21 | 22 | if (h < 10f) { 23 | h += perlin.noise2(x / 14f, y / 14f) * (10f - h) * 0.2f; 24 | } 25 | 26 | if (h > 10f) { 27 | float d = (h - 10f) / 2f > 8f ? 8f : (h - 10f) / 2f; 28 | h += perlin.noise2(x / 35f, y / 35f) * d; 29 | h += perlin.noise2(x / 60f, y / 60f) * d * 0.5f; 30 | 31 | if (h > 35f) { 32 | float d2 = (h - 35f) / 1.5f > 30f ? 30f : (h - 35f) / 1.5f; 33 | h += cell.noise(x / 25D, y / 25D, 1D) * d2; 34 | } 35 | } 36 | 37 | if (h > 2f) { 38 | float d = (h - 2f) / 2f > 4f ? 4f : (h - 2f) / 2f; 39 | h += perlin.noise2(x / 28f, y / 28f) * d; 40 | h += perlin.noise2(x / 18f, y / 18f) * (d / 2f); 41 | h += perlin.noise2(x / 8f, y / 8f) * (d / 2f); 42 | } 43 | 44 | return h + 67f; // - bn; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/rwg/util/CliffCalculator.java: -------------------------------------------------------------------------------- 1 | package rwg.util; 2 | 3 | import java.util.Random; 4 | 5 | public class CliffCalculator { 6 | 7 | public static float calc(int x, int y, float[] noise) { 8 | float cliff = 0f; 9 | if (x > 0) { 10 | cliff = test(cliff, Math.abs(noise[y * 16 + x] - noise[y * 16 + x - 1])); 11 | } 12 | if (y > 0) { 13 | cliff = test(cliff, Math.abs(noise[y * 16 + x] - noise[(y - 1) * 16 + x])); 14 | } 15 | if (x < 15) { 16 | cliff = test(cliff, Math.abs(noise[y * 16 + x] - noise[y * 16 + x + 1])); 17 | } 18 | if (y < 15) { 19 | cliff = test(cliff, Math.abs(noise[y * 16 + x] - noise[(y + 1) * 16 + x])); 20 | } 21 | return cliff; 22 | } 23 | 24 | public static float calcNoise(int x, int y, float[] noise, Random rand, float randomNoise) { 25 | float cliff = 0f; 26 | if (x > 0) { 27 | cliff = test(cliff, Math.abs(noise[y * 16 + x] - noise[y * 16 + x - 1])); 28 | } 29 | if (y > 0) { 30 | cliff = test(cliff, Math.abs(noise[y * 16 + x] - noise[(y - 1) * 16 + x])); 31 | } 32 | if (x < 15) { 33 | cliff = test(cliff, Math.abs(noise[y * 16 + x] - noise[y * 16 + x + 1])); 34 | } 35 | if (y < 15) { 36 | cliff = test(cliff, Math.abs(noise[y * 16 + x] - noise[(y + 1) * 16 + x])); 37 | } 38 | return cliff - randomNoise + rand.nextFloat() * randomNoise * 2; 39 | } 40 | 41 | private static float test(float cliff, float value) { 42 | if (value > cliff) { 43 | return value; 44 | } 45 | return cliff; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/rwg/terrain/TerrainSwampMountain.java: -------------------------------------------------------------------------------- 1 | package rwg.terrain; 2 | 3 | import rwg.util.CellNoise; 4 | import rwg.util.NoiseGenerator; 5 | 6 | public class TerrainSwampMountain extends TerrainBase { 7 | 8 | private float heigth; 9 | private float width; 10 | 11 | public TerrainSwampMountain(float mountainHeight, float mountainWidth) { 12 | heigth = mountainHeight; 13 | width = mountainWidth; 14 | } 15 | 16 | @Override 17 | public float generateNoise(NoiseGenerator perlin, CellNoise cell, int x, int y, float ocean, float border, 18 | float river) { 19 | float h = perlin.noise2(x / width, y / width) * heigth * river; 20 | h *= h / 32f; 21 | h = h > 150f ? 150f : h; 22 | 23 | if (h < 14f) { 24 | h += perlin.noise2(x / 25f, y / 25f) * (14f - h) * 0.8f; 25 | } 26 | 27 | if (h < 6) { 28 | h = 6f - ((6f - h) * 0.07f) + perlin.noise2(x / 20f, y / 20f) + perlin.noise2(x / 5f, y / 5f); 29 | } 30 | 31 | if (h > 10f) { 32 | float d = (h - 10f) / 2f > 8f ? 8f : (h - 10f) / 2f; 33 | h += perlin.noise2(x / 35f, y / 35f) * d; 34 | h += perlin.noise2(x / 60f, y / 60f) * d * 0.5f; 35 | 36 | if (h > 35f) { 37 | float d2 = (h - 35f) / 1.5f > 30f ? 30f : (h - 35f) / 1.5f; 38 | h += cell.noise(x / 25D, y / 25D, 1D) * d2; 39 | } 40 | } 41 | 42 | if (h > 2f) { 43 | float d = (h - 2f) / 2f > 4f ? 4f : (h - 2f) / 2f; 44 | h += perlin.noise2(x / 28f, y / 28f) * d; 45 | h += perlin.noise2(x / 18f, y / 18f) * (d / 2f); 46 | h += perlin.noise2(x / 8f, y / 8f) * (d / 2f); 47 | } 48 | 49 | return h + 56f; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/rwg/biomes/realistic/ocean/RealisticBiomeIslandTundra.java: -------------------------------------------------------------------------------- 1 | package rwg.biomes.realistic.ocean; 2 | 3 | import java.util.Random; 4 | 5 | import net.minecraft.block.Block; 6 | import net.minecraft.init.Blocks; 7 | import net.minecraft.world.World; 8 | import net.minecraft.world.biome.BiomeGenBase; 9 | 10 | import rwg.api.RWGBiomes; 11 | import rwg.biomes.realistic.RealisticBiomeBase; 12 | import rwg.surface.SurfaceBase; 13 | import rwg.surface.SurfaceIslandMountainStone; 14 | import rwg.util.CellNoise; 15 | import rwg.util.NoiseGenerator; 16 | 17 | public class RealisticBiomeIslandTundra extends RealisticBiomeBase { 18 | 19 | private SurfaceBase surface; 20 | 21 | public RealisticBiomeIslandTundra() { 22 | super(0, RWGBiomes.baseOceanCold); 23 | 24 | surface = new SurfaceIslandMountainStone(Blocks.grass, Blocks.dirt, 67, Blocks.sand, 0f); 25 | } 26 | 27 | @Override 28 | public void rDecorate(World world, Random rand, int chunkX, int chunkY, NoiseGenerator perlin, CellNoise cell, 29 | float strength, float river) {} 30 | 31 | @Override 32 | public float rNoise(NoiseGenerator perlin, CellNoise cell, int x, int y, float ocean, float border, float river) { 33 | float h = 0f; 34 | 35 | if (border > 0.9f) { 36 | h = (border - 0.9f) * (150f + perlin.noise2(x / 45f, y / 45f) * 50f); 37 | } 38 | 39 | return 66f + h; 40 | } 41 | 42 | @Override 43 | public void rReplace(Block[] blocks, byte[] metadata, int i, int j, int x, int y, int depth, World world, 44 | Random rand, NoiseGenerator perlin, CellNoise cell, float[] noise, float river, BiomeGenBase[] base) { 45 | surface.paintTerrain(blocks, metadata, i, j, x, y, depth, world, rand, perlin, cell, noise, river, base); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/rwg/deco/DecoCacti.java: -------------------------------------------------------------------------------- 1 | package rwg.deco; 2 | 3 | import java.util.Random; 4 | 5 | import net.minecraft.block.Block; 6 | import net.minecraft.init.Blocks; 7 | import net.minecraft.world.World; 8 | import net.minecraft.world.gen.feature.WorldGenerator; 9 | 10 | public class DecoCacti extends WorldGenerator { 11 | 12 | private boolean sand; 13 | private int eHeight; 14 | 15 | public DecoCacti(boolean sandOnly) { 16 | this(sandOnly, 0); 17 | } 18 | 19 | public DecoCacti(boolean sandOnly, int extraHeight) { 20 | sand = sandOnly; 21 | eHeight = extraHeight; 22 | } 23 | 24 | public boolean generate(World world, Random rand, int x, int y, int z) { 25 | Block b; 26 | for (int l = 0; l < 10; ++l) { 27 | int i1 = x + rand.nextInt(8) - rand.nextInt(8); 28 | int j1 = y + rand.nextInt(4) - rand.nextInt(4); 29 | int k1 = z + rand.nextInt(8) - rand.nextInt(8); 30 | 31 | if (world.isAirBlock(i1, j1, k1)) { 32 | b = world.getBlock(i1, j1 - 1, k1); 33 | if (b == Blocks.sand || (!sand && (b == Blocks.grass || b == Blocks.dirt))) { 34 | int l1 = 1 + rand.nextInt(rand.nextInt(3) + 1); 35 | if (b == Blocks.grass || b == Blocks.dirt) { 36 | world.setBlock(i1, j1 - 1, k1, Blocks.sand, 0, 2); 37 | } 38 | 39 | for (int i2 = 0; i2 < l1 + eHeight; ++i2) { 40 | if (Blocks.cactus.canBlockStay(world, i1, j1 + i2, k1)) { 41 | world.setBlock(i1, j1 + i2, k1, Blocks.cactus, 0, 2); 42 | } 43 | } 44 | } 45 | } 46 | } 47 | 48 | return true; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/rwg/map/old/MapGenSmallRiver.java: -------------------------------------------------------------------------------- 1 | package rwg.map.old; 2 | 3 | import java.util.Random; 4 | 5 | import net.minecraft.block.Block; 6 | import net.minecraft.world.World; 7 | import net.minecraft.world.chunk.IChunkProvider; 8 | 9 | public class MapGenSmallRiver { 10 | 11 | private Random rand; 12 | 13 | public MapGenSmallRiver() { 14 | rand = new Random(); 15 | } 16 | 17 | public void generate(IChunkProvider provider, World world, int chunkX, int chunkY, Block[] blocks) { 18 | int range = 3; 19 | rand.setSeed(world.getSeed()); 20 | long i1 = this.rand.nextLong() / 2L * 2L + 1L; 21 | long j1 = this.rand.nextLong() / 2L * 2L + 1L; 22 | 23 | for (int i = chunkX - range; i <= chunkX + range; i++) { 24 | for (int j = chunkY - range; j <= chunkY + range; j++) { 25 | rand.setSeed((long) i * i1 + (long) j * j1 ^ world.getSeed()); 26 | if (recursiveGenerate(world, i, j, chunkX, chunkY, blocks)) { 27 | return; 28 | } 29 | } 30 | } 31 | } 32 | 33 | public boolean recursiveGenerate(World world, int baseX, int baseY, int chunkX, int chunkY, Block[] block) { 34 | if (rand.nextInt(2) == 0) { 35 | long i1 = this.rand.nextLong() / 2L * 2L + 1L; 36 | long j1 = this.rand.nextLong() / 2L * 2L + 1L; 37 | rand.setSeed((long) chunkX * i1 + (long) chunkY * j1 ^ world.getSeed()); 38 | 39 | build(world, block, Math.max(Math.abs(baseX - chunkX), Math.abs(baseY - chunkY))); 40 | return true; 41 | } 42 | return false; 43 | } 44 | 45 | public void build(World world, Block[] block, int dis) {} 46 | 47 | public int coordstoArray(int x, int y, int z) { 48 | return (z * 16 + x) * 256 + y; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/rwg/terrain/TerrainHilly.java: -------------------------------------------------------------------------------- 1 | package rwg.terrain; 2 | 3 | import rwg.util.CellNoise; 4 | import rwg.util.NoiseGenerator; 5 | 6 | public class TerrainHilly extends TerrainBase { 7 | 8 | private float width; 9 | private float strength; 10 | private float lakeDepth; 11 | private float lakeWidth; 12 | private float terrainHeight; 13 | 14 | /* 15 | * width = 230f strength = 120f lake = 50f; 230f, 120f, 50f 16 | */ 17 | 18 | public TerrainHilly(float mountainWidth, float mountainStrength, float depthLake) { 19 | this(mountainWidth, mountainStrength, depthLake, 260f, 68f); 20 | } 21 | 22 | public TerrainHilly(float mountainWidth, float mountainStrength, float depthLake, float widthLake, float height) { 23 | width = mountainWidth; 24 | strength = mountainStrength; 25 | lakeDepth = depthLake; 26 | lakeWidth = widthLake; 27 | terrainHeight = height; 28 | } 29 | 30 | @Override 31 | public float generateNoise(NoiseGenerator perlin, CellNoise cell, int x, int y, float ocean, float border, 32 | float river) { 33 | float h = perlin.noise2(x / 20f, y / 20f) * 2; 34 | h += perlin.noise2(x / 7f, y / 7f) * 0.8f; 35 | 36 | float m = perlin.noise2(x / width, y / width) * strength * river; 37 | m *= m / 35f; 38 | m = m > 70f ? 70f + (m - 70f) / 2.5f : m; 39 | 40 | float st = m * 0.7f; 41 | st = st > 20f ? 20f : st; 42 | float c = cell.noise(x / 30f, y / 30f, 1D) * (5f + st); 43 | 44 | float sm = perlin.noise2(x / 30f, y / 30f) * 8f + perlin.noise2(x / 8f, y / 8f); 45 | sm *= (m + 10f) / 20f > 2.5f ? 2.5f : (m + 10f) / 20f; 46 | m += sm; 47 | 48 | m += c; 49 | 50 | float l = perlin.noise2(x / lakeWidth, y / lakeWidth) * lakeDepth; 51 | l *= l / 25f; 52 | l = l < -8f ? -8f : l; 53 | 54 | return terrainHeight + h + m - l; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/main/java/rwg/biomes/realistic/ocean/RealisticBiomeOceanTest.java: -------------------------------------------------------------------------------- 1 | package rwg.biomes.realistic.ocean; 2 | 3 | import java.util.Random; 4 | 5 | import net.minecraft.block.Block; 6 | import net.minecraft.init.Blocks; 7 | import net.minecraft.world.World; 8 | import net.minecraft.world.biome.BiomeGenBase; 9 | 10 | import rwg.api.RWGBiomes; 11 | import rwg.biomes.realistic.RealisticBiomeBase; 12 | import rwg.util.CellNoise; 13 | import rwg.util.NoiseGenerator; 14 | 15 | public class RealisticBiomeOceanTest extends RealisticBiomeBase { 16 | 17 | public RealisticBiomeOceanTest() { 18 | super(0, RWGBiomes.baseColdPlains); 19 | } 20 | 21 | @Override 22 | public void rDecorate(World world, Random rand, int chunkX, int chunkY, NoiseGenerator perlin, CellNoise cell, 23 | float strength, float river) {} 24 | 25 | @Override 26 | public float rNoise(NoiseGenerator perlin, CellNoise cell, int x, int y, float ocean, float border, float river) { 27 | return 45f; 28 | } 29 | 30 | @Override 31 | public void rReplace(Block[] blocks, byte[] metadata, int i, int j, int x, int y, int depth, World world, 32 | Random rand, NoiseGenerator perlin, CellNoise cell, float[] noise, float river, BiomeGenBase[] base) { 33 | Block b; 34 | for (int k = 255; k > -1; k--) { 35 | b = blocks[(y * 16 + x) * 256 + k]; 36 | if (b == Blocks.air) { 37 | depth = -1; 38 | } else if (b == Blocks.stone) { 39 | depth++; 40 | 41 | if (depth == 0) { 42 | if (k < 62) { 43 | blocks[(y * 16 + x) * 256 + k] = Blocks.sand; 44 | } else { 45 | blocks[(y * 16 + x) * 256 + k] = Blocks.sand; 46 | } 47 | } else if (depth < 6) { 48 | blocks[(y * 16 + x) * 256 + k] = Blocks.sand; 49 | } 50 | } 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/rwg/commands/RwgBugInfoCommand.java: -------------------------------------------------------------------------------- 1 | package rwg.commands; 2 | 3 | import net.minecraft.command.CommandBase; 4 | import net.minecraft.command.ICommandSender; 5 | import net.minecraft.util.ChatComponentText; 6 | import net.minecraft.util.ChatComponentTranslation; 7 | import net.minecraft.util.ChatStyle; 8 | import net.minecraft.util.EnumChatFormatting; 9 | 10 | public class RwgBugInfoCommand extends CommandBase { 11 | 12 | @Override 13 | public String getCommandName() { 14 | return "rwg_buginfo"; 15 | } 16 | 17 | @Override 18 | public String getCommandUsage(ICommandSender iCommandSender) { 19 | return "/rwg_buginfo"; 20 | } 21 | 22 | @Override 23 | public void processCommand(ICommandSender iCommandSender, String[] strings) { 24 | for (int line = 1; line <= 5; line++) { 25 | iCommandSender.addChatMessage(new ChatComponentTranslation("rwg.buginfo.line" + line)); 26 | } 27 | 28 | iCommandSender.addChatMessage( 29 | new ChatComponentText("/rwg_noise perlin") 30 | .setChatStyle(new ChatStyle().setColor(EnumChatFormatting.GOLD)).appendSibling( 31 | new ChatComponentTranslation("rwg.buginfo.perlin") 32 | .setChatStyle(new ChatStyle().setColor(EnumChatFormatting.RESET)))); 33 | iCommandSender.addChatMessage( 34 | new ChatComponentText("/rwg_noise opensimplex") 35 | .setChatStyle(new ChatStyle().setColor(EnumChatFormatting.GOLD)).appendSibling( 36 | new ChatComponentTranslation("rwg.buginfo.opensimplex") 37 | .setChatStyle(new ChatStyle().setColor(EnumChatFormatting.RESET)))); 38 | } 39 | 40 | @Override 41 | public int getRequiredPermissionLevel() { 42 | return 0; 43 | } 44 | 45 | @Override 46 | public boolean canCommandSenderUseCommand(ICommandSender sender) { 47 | return true; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/rwg/surface/SurfaceGrassland.java: -------------------------------------------------------------------------------- 1 | package rwg.surface; 2 | 3 | import java.util.Random; 4 | 5 | import net.minecraft.block.Block; 6 | import net.minecraft.init.Blocks; 7 | import net.minecraft.world.World; 8 | import net.minecraft.world.biome.BiomeGenBase; 9 | 10 | import rwg.util.CellNoise; 11 | import rwg.util.CliffCalculator; 12 | import rwg.util.NoiseGenerator; 13 | 14 | public class SurfaceGrassland extends SurfaceBase { 15 | 16 | private Block cliffBlock1; 17 | private Block cliffBlock2; 18 | 19 | public SurfaceGrassland(Block top, Block filler, Block cliff1, Block cliff2) { 20 | super(top, filler); 21 | 22 | cliffBlock1 = cliff1; 23 | cliffBlock2 = cliff2; 24 | } 25 | 26 | @Override 27 | public void paintTerrain(Block[] blocks, byte[] metadata, int i, int j, int x, int y, int depth, World world, 28 | Random rand, NoiseGenerator perlin, CellNoise cell, float[] noise, float river, BiomeGenBase[] base) { 29 | float c = CliffCalculator.calc(x, y, noise); 30 | boolean cliff = c > 1.4f ? true : false; 31 | 32 | for (int k = 255; k > -1; k--) { 33 | Block b = blocks[(y * 16 + x) * 256 + k]; 34 | if (b == Blocks.air) { 35 | depth = -1; 36 | } else if (b == Blocks.stone) { 37 | depth++; 38 | 39 | if (cliff) { 40 | if (depth > -1 && depth < 2) { 41 | blocks[(y * 16 + x) * 256 + k] = rand.nextInt(3) == 0 ? cliffBlock2 : cliffBlock1; 42 | } else if (depth < 10) { 43 | blocks[(y * 16 + x) * 256 + k] = cliffBlock1; 44 | } 45 | } else { 46 | if (depth == 0 && k > 61) { 47 | blocks[(y * 16 + x) * 256 + k] = topBlock; 48 | } else if (depth < 4) { 49 | blocks[(y * 16 + x) * 256 + k] = fillerBlock; 50 | } 51 | } 52 | } 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/rwg/terrain/TerrainGrasslandHills.java: -------------------------------------------------------------------------------- 1 | package rwg.terrain; 2 | 3 | import rwg.util.CellNoise; 4 | import rwg.util.NoiseGenerator; 5 | 6 | public class TerrainGrasslandHills extends TerrainBase { 7 | 8 | private float hHeight; 9 | private float hWidth; 10 | private float vHeight; 11 | private float vWidth; 12 | private float lHeight; 13 | private float lWidth; 14 | private float bHeight; 15 | 16 | /* 17 | * hillHeight = 70f hillWidth = 180f varHeight = 7f varWidth = 100f lakeHeigth = 38f lakeWidth = 260f baseHeight = 18 | * 68f 70f, 180f, 7f, 100f, 38f, 260f, 68f 19 | */ 20 | public TerrainGrasslandHills(float hillHeight, float hillWidth, float varHeight, float varWidth, float lakeHeight, 21 | float lakeWidth, float baseHeight) { 22 | hHeight = hillHeight; 23 | hWidth = hillWidth; 24 | 25 | vHeight = varHeight; 26 | vWidth = varWidth; 27 | 28 | lHeight = lakeHeight; 29 | lWidth = lakeWidth; 30 | 31 | bHeight = baseHeight; 32 | } 33 | 34 | @Override 35 | public float generateNoise(NoiseGenerator perlin, CellNoise cell, int x, int y, float ocean, float border, 36 | float river) { 37 | float h = perlin.noise2(x / vWidth, y / vWidth) * vHeight * river; 38 | h += perlin.noise2(x / 20f, y / 20f) * 2; 39 | 40 | float m = perlin.noise2(x / hWidth, y / hWidth) * hHeight * river; 41 | m *= m / 40f; 42 | 43 | float sm = perlin.noise2(x / 30f, y / 30f) * 8f; 44 | sm *= m / 20f > 3.75f ? 3.75f : m / 20f; 45 | m += sm; 46 | 47 | float cm = cell.noise(x / 25D, y / 25D, 1D) * 12f; 48 | cm *= m / 20f > 3.75f ? 3.75f : m / 20f; 49 | m += cm; 50 | 51 | float l = perlin.noise2(x / lWidth, y / lWidth) * lHeight; 52 | l *= l / 25f; 53 | l = l < 8f ? 8f : l; 54 | 55 | h += perlin.noise2(x / 12f, y / 12f) * 3f; 56 | h += perlin.noise2(x / 5f, y / 5f) * 1.5f; 57 | 58 | return bHeight + h + m - l; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/main/java/rwg/surface/SurfaceMarshFix.java: -------------------------------------------------------------------------------- 1 | package rwg.surface; 2 | 3 | import java.util.Random; 4 | 5 | import net.minecraft.block.Block; 6 | import net.minecraft.init.Blocks; 7 | import net.minecraft.world.World; 8 | import net.minecraft.world.biome.BiomeGenBase; 9 | 10 | import rwg.util.CellNoise; 11 | import rwg.util.CliffCalculator; 12 | import rwg.util.NoiseGenerator; 13 | 14 | public class SurfaceMarshFix extends SurfaceBase { 15 | 16 | private Block cliffBlock1; 17 | private Block cliffBlock2; 18 | 19 | public SurfaceMarshFix(Block top, Block filler, Block cliff1, Block cliff2) { 20 | super(top, filler); 21 | 22 | cliffBlock1 = cliff1; 23 | cliffBlock2 = cliff2; 24 | } 25 | 26 | @Override 27 | public void paintTerrain(Block[] blocks, byte[] metadata, int i, int j, int x, int y, int depth, World world, 28 | Random rand, NoiseGenerator perlin, CellNoise cell, float[] noise, float river, BiomeGenBase[] base) { 29 | float c = CliffCalculator.calc(x, y, noise); 30 | boolean cliff = c > 1.4f ? true : false; 31 | 32 | for (int k = 255; k > -1; k--) { 33 | Block b = blocks[(y * 16 + x) * 256 + k]; 34 | if (b == Blocks.air) { 35 | depth = -1; 36 | } else if (b == Blocks.stone) { 37 | depth++; 38 | 39 | if (cliff && k > 64) { 40 | if (depth > -1 && depth < 2) { 41 | blocks[(y * 16 + x) * 256 + k] = rand.nextInt(3) == 0 ? cliffBlock2 : cliffBlock1; 42 | } else if (depth < 10) { 43 | blocks[(y * 16 + x) * 256 + k] = cliffBlock1; 44 | } 45 | } else { 46 | if (depth == 0 && k > 61) { 47 | blocks[(y * 16 + x) * 256 + k] = topBlock; 48 | } else if (depth < 4) { 49 | blocks[(y * 16 + x) * 256 + k] = fillerBlock; 50 | } 51 | } 52 | } 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/rwg/api/RWGBiomes.java: -------------------------------------------------------------------------------- 1 | package rwg.api; 2 | 3 | import net.minecraft.world.biome.BiomeGenBase; 4 | 5 | public class RWGBiomes { 6 | 7 | /* 8 | * These biomes are used for grass/foliage color and entity spawning 9 | */ 10 | public static BiomeGenBase baseRiverIce; 11 | public static BiomeGenBase baseRiverCold; 12 | public static BiomeGenBase baseRiverTemperate; 13 | public static BiomeGenBase baseRiverHot; 14 | public static BiomeGenBase baseRiverWet; 15 | public static BiomeGenBase baseRiverOasis; 16 | 17 | public static BiomeGenBase baseOceanIce; 18 | public static BiomeGenBase baseOceanCold; 19 | public static BiomeGenBase baseOceanTemperate; 20 | public static BiomeGenBase baseOceanHot; 21 | public static BiomeGenBase baseOceanWet; 22 | public static BiomeGenBase baseOceanOasis; 23 | 24 | public static BiomeGenBase baseSnowDesert; 25 | public static BiomeGenBase baseSnowForest; 26 | public static BiomeGenBase baseColdPlains; 27 | public static BiomeGenBase baseColdForest; 28 | public static BiomeGenBase baseHotPlains; 29 | public static BiomeGenBase baseHotForest; 30 | public static BiomeGenBase baseHotDesert; 31 | public static BiomeGenBase basePlains; 32 | public static BiomeGenBase baseTropicalIsland; 33 | public static BiomeGenBase baseRedwood; 34 | public static BiomeGenBase baseJungle; 35 | public static BiomeGenBase baseOasis; 36 | public static BiomeGenBase baseTemperateForest; 37 | 38 | /* 39 | * This function will never break. use this instead of the above. 40 | */ 41 | public static BiomeGenBase[] getAllBaseBiomes() { 42 | return new BiomeGenBase[] { baseRiverIce, baseRiverCold, baseRiverTemperate, baseRiverHot, baseRiverWet, 43 | baseRiverOasis, baseOceanIce, baseOceanCold, baseOceanTemperate, baseOceanHot, baseOceanWet, 44 | baseSnowDesert, baseSnowForest, baseColdPlains, baseColdForest, baseHotPlains, baseHotForest, 45 | baseHotDesert, basePlains, baseTropicalIsland, baseRedwood, baseJungle, baseOasis }; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/rwg/deco/DecoWildWheat.java: -------------------------------------------------------------------------------- 1 | package rwg.deco; 2 | 3 | import java.util.Random; 4 | 5 | import net.minecraft.block.Block; 6 | import net.minecraft.block.material.Material; 7 | import net.minecraft.init.Blocks; 8 | import net.minecraft.world.World; 9 | import net.minecraft.world.gen.feature.WorldGenerator; 10 | 11 | public class DecoWildWheat extends WorldGenerator { 12 | 13 | private Block farmtype; 14 | 15 | /** 16 | * 17 | * 0 = potatoes, 1 = carrots, 2 = wheat 18 | * 19 | */ 20 | public DecoWildWheat(int type) { 21 | farmtype = type == 0 ? Blocks.potatoes : type == 1 ? Blocks.carrots : Blocks.wheat; 22 | } 23 | 24 | public boolean generate(World world, Random rand, int x, int y, int z) { 25 | Block b; 26 | while (y > 0) { 27 | b = world.getBlock(x, y, z); 28 | if (!world.isAirBlock(x, y, z) || b.isLeaves(world, x, y, z)) { 29 | break; 30 | } 31 | y--; 32 | } 33 | 34 | b = world.getBlock(x, y, z); 35 | if (b != Blocks.grass && b != Blocks.dirt) { 36 | return false; 37 | } 38 | 39 | for (int j = 0; j < 4; j++) { 40 | b = world.getBlock(j == 0 ? x - 1 : j == 1 ? x + 1 : x, y, j == 2 ? z - 1 : j == 3 ? z + 1 : z); 41 | if (b.getMaterial() != Material.ground && b.getMaterial() != Material.grass) { 42 | return false; 43 | } 44 | } 45 | 46 | int rx, ry, rz; 47 | for (int i = 0; i < 30; i++) { 48 | rx = rand.nextInt(5) - 2; 49 | ry = rand.nextInt(2) - 1; 50 | rz = rand.nextInt(5) - 2; 51 | b = world.getBlock(x + rx, y + ry, z + rz); 52 | 53 | if ((b == Blocks.grass || b == Blocks.dirt) && world.isAirBlock(x + rx, y + ry + 1, z + rz)) { 54 | world.setBlock(x + rx, y + ry, z + rz, Blocks.farmland, rand.nextInt(4) + 4, 0); 55 | world.setBlock(x + rx, y + ry + 1, z + rz, farmtype, rand.nextInt(4) + 4, 0); 56 | } 57 | } 58 | 59 | world.setBlock(x, y, z, Blocks.water); 60 | return true; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/main/java/rwg/deco/trees/DecoDeadDesertTrees.java: -------------------------------------------------------------------------------- 1 | package rwg.deco.trees; 2 | 3 | import java.util.Random; 4 | 5 | import net.minecraft.block.Block; 6 | import net.minecraft.init.Blocks; 7 | import net.minecraft.world.World; 8 | import net.minecraft.world.gen.feature.WorldGenerator; 9 | 10 | public class DecoDeadDesertTrees extends WorldGenerator { 11 | 12 | private int type; 13 | 14 | public DecoDeadDesertTrees(int t) { 15 | type = t; 16 | } 17 | 18 | public boolean generate(World world, Random rand, int x, int y, int z) { 19 | Block g = world.getBlock(x, y - 1, z); 20 | if (g != Blocks.grass && g != Blocks.dirt && g != Blocks.sand) { 21 | return false; 22 | } 23 | 24 | if (type == 0) { 25 | int i, h = 8; 26 | 27 | for (i = 0; i < h; i++) { 28 | world.setBlock(x, y + i, z, Blocks.log2, 0, 0); 29 | } 30 | 31 | int branches = 2 + rand.nextInt(3); 32 | float dir, xd, yd, zd, l, c, sk = (360f / branches); 33 | 34 | for (i = 0; i < branches; i++) { 35 | dir = i * sk + rand.nextFloat() * sk; 36 | xd = (float) Math.cos(dir * Math.PI / 180f); 37 | zd = (float) Math.sin(dir * Math.PI / 180f); 38 | l = 1f + rand.nextFloat() * 3f; 39 | c = 1f; 40 | 41 | while (c < l) { 42 | world.setBlock(x + (int) (xd * c), y + h + (int) c, z + (int) (zd * c), Blocks.log2, 12, 0); 43 | c += 1f; 44 | } 45 | } 46 | } else { 47 | int h = rand.nextInt(3) + 2; 48 | for (int i = 0; i < h; i++) { 49 | world.setBlock(x, y + i, z, Blocks.log2, 0, 0); 50 | } 51 | 52 | h--; 53 | world.setBlock(x + 1, y + h, z, Blocks.leaves2, 0, 0); 54 | world.setBlock(x - 1, y + h, z, Blocks.leaves2, 0, 0); 55 | world.setBlock(x, y + h, z + 1, Blocks.leaves2, 0, 0); 56 | world.setBlock(x, y + h, z - 1, Blocks.leaves2, 0, 0); 57 | world.setBlock(x, y + h + 1, z, Blocks.leaves2, 0, 0); 58 | } 59 | 60 | return true; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/main/java/rwg/deco/DecoJungleCane.java: -------------------------------------------------------------------------------- 1 | package rwg.deco; 2 | 3 | import java.util.Random; 4 | 5 | import net.minecraft.block.Block; 6 | import net.minecraft.block.material.Material; 7 | import net.minecraft.init.Blocks; 8 | import net.minecraft.world.World; 9 | import net.minecraft.world.gen.feature.WorldGenerator; 10 | 11 | public class DecoJungleCane extends WorldGenerator { 12 | 13 | private int height; 14 | 15 | public DecoJungleCane(int h) { 16 | height = h; 17 | } 18 | 19 | @Override 20 | public boolean generate(World world, Random rand, int x, int y, int z) { 21 | Block b; 22 | while (y > 0) { 23 | b = world.getBlock(x, y, z); 24 | if (!world.isAirBlock(x, y, z) || b.isLeaves(world, x, y, z)) { 25 | break; 26 | } 27 | y--; 28 | } 29 | 30 | b = world.getBlock(x, y, z); 31 | if (b != Blocks.grass && b != Blocks.dirt) { 32 | return false; 33 | } 34 | 35 | int j, sx, sz, ra; 36 | for (j = 0; j < 4; j++) { 37 | b = world.getBlock(j == 0 ? x - 1 : j == 1 ? x + 1 : x, y, j == 2 ? z - 1 : j == 3 ? z + 1 : z); 38 | if (b.getMaterial() != Material.ground && b.getMaterial() != Material.grass) { 39 | return false; 40 | } 41 | } 42 | 43 | for (j = 0; j < 4; j++) { 44 | sx = j == 0 ? x - 1 : j == 1 ? x + 1 : x; 45 | sz = j == 2 ? z - 1 : j == 3 ? z + 1 : z; 46 | ra = rand.nextInt(height * 2 + 1) + height; 47 | 48 | b = world.getBlock(sx, y + 1, sz); 49 | if (b.getMaterial() == Material.air || b.getMaterial() == Material.vine) { 50 | for (int k = 0; k < ra; k++) { 51 | b = world.getBlock(sx, y + 1 + k, sz); 52 | if (b.getMaterial() == Material.air || b.getMaterial() == Material.vine) { 53 | world.setBlock(sx, y + 1 + k, sz, Blocks.reeds, 0, 2); 54 | } else { 55 | break; 56 | } 57 | } 58 | } 59 | } 60 | 61 | world.setBlock(x, y, z, Blocks.water); 62 | 63 | return true; 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/main/java/rwg/surface/SurfaceDesert.java: -------------------------------------------------------------------------------- 1 | package rwg.surface; 2 | 3 | import java.util.Random; 4 | 5 | import net.minecraft.block.Block; 6 | import net.minecraft.init.Blocks; 7 | import net.minecraft.world.World; 8 | import net.minecraft.world.biome.BiomeGenBase; 9 | 10 | import rwg.util.CellNoise; 11 | import rwg.util.CliffCalculator; 12 | import rwg.util.NoiseGenerator; 13 | 14 | public class SurfaceDesert extends SurfaceBase { 15 | 16 | private Block cliffBlock1; 17 | private Block cliffBlock2; 18 | private Block bottomBlock; 19 | 20 | public SurfaceDesert(Block top, Block filler, Block bottom, Block cliff1, Block cliff2) { 21 | super(top, filler); 22 | 23 | bottomBlock = bottom; 24 | cliffBlock1 = cliff1; 25 | cliffBlock2 = cliff2; 26 | } 27 | 28 | @Override 29 | public void paintTerrain(Block[] blocks, byte[] metadata, int i, int j, int x, int y, int depth, World world, 30 | Random rand, NoiseGenerator perlin, CellNoise cell, float[] noise, float river, BiomeGenBase[] base) { 31 | float c = CliffCalculator.calc(x, y, noise); 32 | boolean cliff = c > 2.8f ? true : false; 33 | 34 | for (int k = 255; k > -1; k--) { 35 | Block b = blocks[(y * 16 + x) * 256 + k]; 36 | if (b == Blocks.air) { 37 | depth = -1; 38 | } else if (b == Blocks.stone) { 39 | depth++; 40 | 41 | if (cliff) { 42 | if (depth > -1 && depth < 2) { 43 | blocks[(y * 16 + x) * 256 + k] = rand.nextInt(3) == 0 ? cliffBlock2 : cliffBlock1; 44 | } else if (depth < 10) { 45 | blocks[(y * 16 + x) * 256 + k] = cliffBlock1; 46 | } 47 | } else if (depth < 6) { 48 | if (depth == 0 && k > 61) { 49 | blocks[(y * 16 + x) * 256 + k] = topBlock; 50 | } else if (depth < 4) { 51 | blocks[(y * 16 + x) * 256 + k] = fillerBlock; 52 | } else { 53 | blocks[(y * 16 + x) * 256 + k] = bottomBlock; 54 | } 55 | } 56 | } 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/rwg/surface/SurfaceRedDesert.java: -------------------------------------------------------------------------------- 1 | package rwg.surface; 2 | 3 | import java.util.Random; 4 | 5 | import net.minecraft.block.Block; 6 | import net.minecraft.init.Blocks; 7 | import net.minecraft.world.World; 8 | import net.minecraft.world.biome.BiomeGenBase; 9 | 10 | import rwg.util.CellNoise; 11 | import rwg.util.CliffCalculator; 12 | import rwg.util.NoiseGenerator; 13 | 14 | public class SurfaceRedDesert extends SurfaceBase { 15 | 16 | private Block cliffBlock1; 17 | private Block cliffBlock2; 18 | private Block bottomBlock; 19 | 20 | public SurfaceRedDesert() { 21 | super(Blocks.sand, Blocks.sand); 22 | 23 | bottomBlock = Blocks.sandstone; 24 | cliffBlock1 = Blocks.stained_hardened_clay; 25 | } 26 | 27 | @Override 28 | public void paintTerrain(Block[] blocks, byte[] metadata, int i, int j, int x, int y, int depth, World world, 29 | Random rand, NoiseGenerator perlin, CellNoise cell, float[] noise, float river, BiomeGenBase[] base) { 30 | float c = CliffCalculator.calc(x, y, noise); 31 | boolean cliff = c > 1.4f ? true : false; 32 | 33 | for (int k = 255; k > -1; k--) { 34 | Block b = blocks[(y * 16 + x) * 256 + k]; 35 | if (b == Blocks.air) { 36 | depth = -1; 37 | } else if (b == Blocks.stone) { 38 | depth++; 39 | 40 | if (cliff) { 41 | if (depth < 6) { 42 | blocks[(y * 16 + x) * 256 + k] = cliffBlock1; 43 | metadata[(y * 16 + x) * 256 + k] = (byte) 14; 44 | } 45 | } else if (depth < 6) { 46 | if (depth == 0 && k > 61) { 47 | blocks[(y * 16 + x) * 256 + k] = topBlock; 48 | metadata[(y * 16 + x) * 256 + k] = (byte) 1; 49 | } else if (depth < 4) { 50 | blocks[(y * 16 + x) * 256 + k] = fillerBlock; 51 | metadata[(y * 16 + x) * 256 + k] = (byte) 1; 52 | } else { 53 | blocks[(y * 16 + x) * 256 + k] = bottomBlock; 54 | } 55 | } 56 | } 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/rwg/surface/SurfacePolar.java: -------------------------------------------------------------------------------- 1 | package rwg.surface; 2 | 3 | import java.util.Random; 4 | 5 | import net.minecraft.block.Block; 6 | import net.minecraft.init.Blocks; 7 | import net.minecraft.world.World; 8 | import net.minecraft.world.biome.BiomeGenBase; 9 | 10 | import rwg.util.CellNoise; 11 | import rwg.util.NoiseGenerator; 12 | import rwg.util.SnowheightCalculator; 13 | 14 | public class SurfacePolar extends SurfaceBase { 15 | 16 | public SurfacePolar(Block top, Block fill) { 17 | super(top, fill); 18 | } 19 | 20 | @Override 21 | public void paintTerrain(Block[] blocks, byte[] metadata, int i, int j, int x, int y, int depth, World world, 22 | Random rand, NoiseGenerator perlin, CellNoise cell, float[] noise, float river, BiomeGenBase[] base) { 23 | boolean water = false; 24 | boolean riverPaint = false; 25 | boolean grass = false; 26 | 27 | if (river > 0.05f && river + (perlin.noise2(i / 10f, j / 10f) * 0.1f) > 0.86f) { 28 | riverPaint = true; 29 | 30 | if (perlin.noise2(i / 12f, j / 12f) > 0.25f) { 31 | grass = true; 32 | } 33 | } 34 | 35 | Block b; 36 | for (int k = 255; k > -1; k--) { 37 | b = blocks[(y * 16 + x) * 256 + k]; 38 | if (b == Blocks.air) { 39 | depth = -1; 40 | } else if (b == Blocks.stone) { 41 | depth++; 42 | 43 | if (riverPaint) { 44 | if (grass && depth < 4) { 45 | blocks[(y * 16 + x) * 256 + k] = Blocks.dirt; 46 | } else if (depth == 0) { 47 | blocks[(y * 16 + x) * 256 + k] = rand.nextInt(2) == 0 ? Blocks.stone : Blocks.cobblestone; 48 | } 49 | } else if (depth > -1 && depth < 9) { 50 | blocks[(y * 16 + x) * 256 + k] = Blocks.snow; 51 | if (depth == 0 && k > 61 && k < 254) { 52 | SnowheightCalculator.calc(x, y, k, blocks, metadata, noise); 53 | } 54 | } 55 | } else if (!water && b == Blocks.water) { 56 | blocks[(y * 16 + x) * 256 + k] = Blocks.ice; 57 | water = true; 58 | } 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/rwg/support/SupportCC.java: -------------------------------------------------------------------------------- 1 | package rwg.support; 2 | 3 | import net.minecraft.init.Blocks; 4 | import net.minecraft.world.biome.BiomeGenBase; 5 | 6 | import rwg.api.RWGBiomes; 7 | import rwg.support.Support.BiomeCategory; 8 | import rwg.surface.SurfaceGrassland; 9 | import rwg.terrain.TerrainHighland; 10 | import rwg.terrain.TerrainHilly; 11 | 12 | public class SupportCC { 13 | /* 14 | * ChromatiCraft BIOMES 46: "Ender Forest" 47: "Rainbow Forest" 48: "Luminous Cliffs" 49: "Luminous Cliffs Edge" 15 | */ 16 | 17 | public static void init() { 18 | BiomeGenBase[] b = BiomeGenBase.getBiomeGenArray(); 19 | 20 | for (int i = 0; i < 256; i++) { 21 | if (b[i] != null) { 22 | if (b[i].biomeName == "Ender Forest" || b[i].biomeName == "Rainbow Forest") { 23 | Support.addBiome( 24 | new RealisticBiomeSupport( 25 | b[i], 26 | RWGBiomes.baseTemperateForest, 27 | new TerrainHighland(6f, 120f, 65f, 150f), 28 | new SurfaceGrassland( 29 | b[i].topBlock, 30 | b[i].fillerBlock, 31 | Blocks.stone, 32 | Blocks.cobblestone)), 33 | BiomeCategory.HOT); 34 | } 35 | 36 | if (b[i].biomeName == "Luminous Cliffs" || b[i].biomeName == "Luminous Cliffs Shores") { 37 | Support.addBiome( 38 | new RealisticBiomeSupport( 39 | b[i], 40 | RWGBiomes.baseOceanTemperate, 41 | new TerrainHilly(100f, 120f, 0f), 42 | new SurfaceGrassland( 43 | b[i].topBlock, 44 | b[i].fillerBlock, 45 | Blocks.stone, 46 | Blocks.cobblestone)), 47 | BiomeCategory.HOT); 48 | } 49 | } 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/rwg/RWG.java: -------------------------------------------------------------------------------- 1 | package rwg; 2 | 3 | import net.minecraft.command.ICommandManager; 4 | import net.minecraft.command.ServerCommandManager; 5 | import net.minecraft.server.MinecraftServer; 6 | import net.minecraftforge.common.MinecraftForge; 7 | 8 | import cpw.mods.fml.common.FMLCommonHandler; 9 | import cpw.mods.fml.common.Mod; 10 | import cpw.mods.fml.common.Mod.EventHandler; 11 | import cpw.mods.fml.common.Mod.Instance; 12 | import cpw.mods.fml.common.event.FMLInitializationEvent; 13 | import cpw.mods.fml.common.event.FMLPostInitializationEvent; 14 | import cpw.mods.fml.common.event.FMLPreInitializationEvent; 15 | import cpw.mods.fml.common.event.FMLServerStartingEvent; 16 | import rwg.biomes.base.BaseBiomes; 17 | import rwg.commands.RwgBugInfoCommand; 18 | import rwg.commands.RwgNoiseCommand; 19 | import rwg.config.ConfigRWG; 20 | import rwg.data.VillageMaterials; 21 | import rwg.handlers.LoginHandler; 22 | import rwg.support.Support; 23 | import rwg.world.WorldTypeRealistic; 24 | 25 | @Mod(modid = "RWG", name = "RealisticWorldGen", version = "GRADLETOKEN_VERSION", acceptableRemoteVersions = "*") 26 | public class RWG { 27 | 28 | @Instance("RWG") 29 | public static RWG instance; 30 | 31 | public static final WorldTypeRealistic worldtype = (new WorldTypeRealistic("RWG")); 32 | 33 | @EventHandler 34 | public void preInit(FMLPreInitializationEvent event) { 35 | instance = this; 36 | 37 | ConfigRWG.init(event); 38 | BaseBiomes.load(); 39 | 40 | MinecraftForge.TERRAIN_GEN_BUS.register(new VillageMaterials()); 41 | 42 | FMLCommonHandler.instance().bus().register(new LoginHandler()); 43 | // MinecraftForge.TERRAIN_GEN_BUS.register(new TreeReplacement()); 44 | } 45 | 46 | @EventHandler 47 | public void Init(FMLInitializationEvent event) {} 48 | 49 | @EventHandler 50 | public void postInit(FMLPostInitializationEvent event) { 51 | Support.init(); 52 | } 53 | 54 | @EventHandler 55 | public void serverStart(FMLServerStartingEvent event) { 56 | MinecraftServer server = event.getServer(); 57 | ICommandManager command = server.getCommandManager(); 58 | ServerCommandManager manager = (ServerCommandManager) command; 59 | 60 | manager.registerCommand(new RwgNoiseCommand()); 61 | manager.registerCommand(new RwgBugInfoCommand()); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/rwg/surface/SurfaceGrassCanyon.java: -------------------------------------------------------------------------------- 1 | package rwg.surface; 2 | 3 | import java.util.Random; 4 | 5 | import net.minecraft.block.Block; 6 | import net.minecraft.init.Blocks; 7 | import net.minecraft.world.World; 8 | import net.minecraft.world.biome.BiomeGenBase; 9 | 10 | import rwg.util.CellNoise; 11 | import rwg.util.CliffCalculator; 12 | import rwg.util.NoiseGenerator; 13 | 14 | public class SurfaceGrassCanyon extends SurfaceBase { 15 | 16 | private byte claycolor; 17 | 18 | public SurfaceGrassCanyon(Block top, Block fill, byte b) { 19 | super(top, fill); 20 | claycolor = b; 21 | } 22 | 23 | @Override 24 | public void paintTerrain(Block[] blocks, byte[] metadata, int i, int j, int x, int y, int depth, World world, 25 | Random rand, NoiseGenerator perlin, CellNoise cell, float[] noise, float river, BiomeGenBase[] base) { 26 | float c = CliffCalculator.calc(x, y, noise); 27 | boolean cliff = c > 1.3f ? true : false; 28 | 29 | for (int k = 255; k > -1; k--) { 30 | Block b = blocks[(y * 16 + x) * 256 + k]; 31 | if (b == Blocks.air) { 32 | depth = -1; 33 | } else if (b == Blocks.stone) { 34 | depth++; 35 | 36 | if (depth > -1 && depth < 12) { 37 | if (cliff) { 38 | blocks[(y * 16 + x) * 256 + k] = Blocks.stained_hardened_clay; 39 | metadata[(y * 16 + x) * 256 + k] = claycolor; 40 | } else { 41 | if (depth > 4) { 42 | blocks[(y * 16 + x) * 256 + k] = Blocks.stained_hardened_clay; 43 | metadata[(y * 16 + x) * 256 + k] = claycolor; 44 | } else { 45 | if (depth == 0) { 46 | blocks[(y * 16 + x) * 256 + k] = topBlock; 47 | } else { 48 | blocks[(y * 16 + x) * 256 + k] = fillerBlock; 49 | } 50 | } 51 | } 52 | } else if (k > 63) { 53 | blocks[(y * 16 + x) * 256 + k] = Blocks.stained_hardened_clay; 54 | metadata[(y * 16 + x) * 256 + k] = claycolor; 55 | } 56 | } 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/rwg/deco/DecoGrass.java: -------------------------------------------------------------------------------- 1 | package rwg.deco; 2 | 3 | import java.util.Random; 4 | 5 | import net.minecraft.block.Block; 6 | import net.minecraft.init.Blocks; 7 | import net.minecraft.world.World; 8 | import net.minecraft.world.gen.feature.WorldGenerator; 9 | 10 | public class DecoGrass extends WorldGenerator { 11 | 12 | private Block block; 13 | private int metadata; 14 | 15 | public DecoGrass(Block b, int m) { 16 | block = b; 17 | metadata = m; 18 | } 19 | 20 | public boolean generate(World world, Random rand, int x, int y, int z) { 21 | while (y > 0) { 22 | if (!world.isAirBlock(x, y, z) || world.getBlock(x, y, z).isLeaves(world, x, y, z)) { 23 | break; 24 | } 25 | y--; 26 | } 27 | 28 | if (block == Blocks.double_plant) { 29 | for (int l = 0; l < 64; ++l) { 30 | int i1 = x + rand.nextInt(8) - rand.nextInt(8); 31 | int j1 = y + rand.nextInt(4) - rand.nextInt(4); 32 | int k1 = z + rand.nextInt(8) - rand.nextInt(8); 33 | 34 | if (world.isAirBlock(i1, j1, k1) && j1 < 254 35 | && Blocks.double_plant.canPlaceBlockAt(world, i1, j1, k1)) { 36 | Blocks.double_plant.func_149889_c(world, i1, j1, k1, metadata, 0); 37 | } 38 | } 39 | } else if (block == Blocks.leaves) { 40 | for (int l = 0; l < 64; ++l) { 41 | int i1 = x + rand.nextInt(8) - rand.nextInt(8); 42 | int j1 = y + rand.nextInt(4) - rand.nextInt(4); 43 | int k1 = z + rand.nextInt(8) - rand.nextInt(8); 44 | 45 | if (world.isAirBlock(i1, j1, k1) && world.getBlock(i1, j1 - 1, k1) == Blocks.grass) { 46 | world.setBlock(i1, j1, k1, block, metadata, 0); 47 | } 48 | } 49 | } else { 50 | for (int l = 0; l < 128; ++l) { 51 | int i1 = x + rand.nextInt(8) - rand.nextInt(8); 52 | int j1 = y + rand.nextInt(4) - rand.nextInt(4); 53 | int k1 = z + rand.nextInt(8) - rand.nextInt(8); 54 | 55 | if (world.isAirBlock(i1, j1, k1) && block.canBlockStay(world, i1, j1, k1)) { 56 | world.setBlock(i1, j1, k1, block, metadata, 0); 57 | } 58 | } 59 | } 60 | return true; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/main/java/rwg/support/Support.java: -------------------------------------------------------------------------------- 1 | package rwg.support; 2 | 3 | import java.util.ArrayList; 4 | 5 | import cpw.mods.fml.common.Loader; 6 | import rwg.biomes.realistic.RealisticBiomeBase; 7 | 8 | public class Support { 9 | 10 | public static ArrayList biomes_snow; 11 | public static ArrayList biomes_cold; 12 | public static ArrayList biomes_hot; 13 | public static ArrayList biomes_wet; 14 | public static ArrayList biomes_small; 15 | public static ArrayList biomes_test; 16 | 17 | public enum BiomeCategory { 18 | SNOW, 19 | COLD, 20 | HOT, 21 | WET, 22 | SMALL, 23 | TEST 24 | } 25 | 26 | public static void init() { 27 | biomes_snow = new ArrayList(); 28 | biomes_cold = new ArrayList(); 29 | biomes_hot = new ArrayList(); 30 | biomes_wet = new ArrayList(); 31 | biomes_small = new ArrayList(); 32 | biomes_test = new ArrayList(); 33 | 34 | if (Loader.isModLoaded("BiomesOPlenty")) { 35 | SupportBOP.init(); 36 | } 37 | 38 | if (Loader.isModLoaded("ExtrabiomesXL")) { 39 | SupportEBXL.init(); 40 | } 41 | 42 | if (Loader.isModLoaded("Thaumcraft")) { 43 | SupportTC.init(); 44 | } 45 | if (Loader.isModLoaded("ChromatiCraft")) { 46 | SupportCC.init(); 47 | } 48 | /** ChromatiCraft is non-supported content. if this ever errors out in some way feel free to remove this. */ 49 | } 50 | 51 | public static void addBiome(RealisticBiomeSupport b, BiomeCategory cat) { 52 | try { 53 | switch (cat) { 54 | case SNOW: 55 | biomes_snow.add(b); 56 | case COLD: 57 | biomes_cold.add(b); 58 | case HOT: 59 | biomes_hot.add(b); 60 | case WET: 61 | biomes_wet.add(b); 62 | case SMALL: 63 | biomes_small.add(b); 64 | case TEST: 65 | biomes_test.add(b); 66 | } 67 | } catch (Error e) { 68 | System.out.println("RWG Support: failed to add biome"); 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /src/main/java/rwg/surface/SurfaceGrasslandMix1.java: -------------------------------------------------------------------------------- 1 | package rwg.surface; 2 | 3 | import java.util.Random; 4 | 5 | import net.minecraft.block.Block; 6 | import net.minecraft.init.Blocks; 7 | import net.minecraft.world.World; 8 | import net.minecraft.world.biome.BiomeGenBase; 9 | 10 | import rwg.util.CellNoise; 11 | import rwg.util.CliffCalculator; 12 | import rwg.util.NoiseGenerator; 13 | 14 | public class SurfaceGrasslandMix1 extends SurfaceBase { 15 | 16 | private Block mixBlock; 17 | private Block cliffBlock1; 18 | private Block cliffBlock2; 19 | private float width; 20 | private float height; 21 | 22 | public SurfaceGrasslandMix1(Block top, Block filler, Block mix, Block cliff1, Block cliff2, float mixWidth, 23 | float mixHeight) { 24 | super(top, filler); 25 | 26 | mixBlock = mix; 27 | cliffBlock1 = cliff1; 28 | cliffBlock2 = cliff2; 29 | 30 | width = mixWidth; 31 | height = mixHeight; 32 | } 33 | 34 | @Override 35 | public void paintTerrain(Block[] blocks, byte[] metadata, int i, int j, int x, int y, int depth, World world, 36 | Random rand, NoiseGenerator perlin, CellNoise cell, float[] noise, float river, BiomeGenBase[] base) { 37 | float c = CliffCalculator.calc(x, y, noise); 38 | boolean cliff = c > 1.4f ? true : false; 39 | 40 | for (int k = 255; k > -1; k--) { 41 | Block b = blocks[(y * 16 + x) * 256 + k]; 42 | if (b == Blocks.air) { 43 | depth = -1; 44 | } else if (b == Blocks.stone) { 45 | depth++; 46 | 47 | if (cliff) { 48 | if (depth > -1 && depth < 2) { 49 | blocks[(y * 16 + x) * 256 + k] = rand.nextInt(3) == 0 ? cliffBlock2 : cliffBlock1; 50 | } else if (depth < 10) { 51 | blocks[(y * 16 + x) * 256 + k] = cliffBlock1; 52 | } 53 | } else { 54 | if (depth == 0 && k > 61) { 55 | if (perlin.noise2(i / width, j / width) > height) // > 0.27f, i / 12f 56 | { 57 | blocks[(y * 16 + x) * 256 + k] = mixBlock; 58 | } else { 59 | blocks[(y * 16 + x) * 256 + k] = topBlock; 60 | } 61 | } else if (depth < 4) { 62 | blocks[(y * 16 + x) * 256 + k] = fillerBlock; 63 | } 64 | } 65 | } 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /src/main/java/rwg/deco/trees/DecoSmallCocoa.java: -------------------------------------------------------------------------------- 1 | package rwg.deco.trees; 2 | 3 | import java.util.Random; 4 | 5 | import net.minecraft.block.Block; 6 | import net.minecraft.block.material.Material; 7 | import net.minecraft.init.Blocks; 8 | import net.minecraft.world.World; 9 | import net.minecraft.world.gen.feature.WorldGenerator; 10 | 11 | public class DecoSmallCocoa extends WorldGenerator { 12 | 13 | private static int[] cocoas = new int[] { 2, 0, -2, 1, 1, 1, -2, 0, 0, 0, -2, -1, 3, -1, -2, 0 }; 14 | 15 | public DecoSmallCocoa() {} 16 | 17 | @Override 18 | public boolean generate(World world, Random rand, int x, int y, int z) { 19 | Block b = world.getBlock(x, y - 1, z); 20 | if (b != Blocks.grass && b != Blocks.dirt && b != Blocks.sand) { 21 | return false; 22 | } 23 | 24 | Material m = world.getBlock(x, y, z).getMaterial(); 25 | if (m != Material.air && m != Material.vine) { 26 | return false; 27 | } 28 | 29 | int h = y + 2 + rand.nextInt(3); 30 | for (; y < h; y++) { 31 | world.setBlock(x, y, z, Blocks.log, 3, 0); 32 | } 33 | 34 | for (int i = -2; i <= 2; i++) { 35 | for (int j = -2; j <= 2; j++) { 36 | if (Math.abs(i) + Math.abs(j) < 3) { 37 | buildBlock(world, x + i, y - 1, z + j, Blocks.leaves, 3, 0); 38 | } 39 | } 40 | } 41 | 42 | world.setBlock(x, y - 1, z, Blocks.log, 3, 0); 43 | buildBlock(world, x + 1, y, z, Blocks.leaves, 3, 0); 44 | buildBlock(world, x - 1, y, z, Blocks.leaves, 3, 0); 45 | buildBlock(world, x, y, z, Blocks.leaves, 3, 0); 46 | buildBlock(world, x, y, z + 1, Blocks.leaves, 3, 0); 47 | buildBlock(world, x, y, z - 1, Blocks.leaves, 3, 0); 48 | 49 | for (int k = 0; k < 16; k += 4) { 50 | if (rand.nextInt(20) == 0) { 51 | buildBlock( 52 | world, 53 | x + cocoas[k + 1], 54 | y + cocoas[k + 2], 55 | z + cocoas[k + 3], 56 | Blocks.cocoa, 57 | cocoas[k + 0] + 8, 58 | 0); 59 | } 60 | } 61 | 62 | return true; 63 | } 64 | 65 | private void buildBlock(World w, int x, int y, int z, Block b, int m, int u) { 66 | Material ma = w.getBlock(x, y, z).getMaterial(); 67 | 68 | if (ma == Material.air || ma == Material.vine) { 69 | w.setBlock(x, y, z, b, m, u); 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /src/main/java/rwg/surface/SurfaceDuneValley.java: -------------------------------------------------------------------------------- 1 | package rwg.surface; 2 | 3 | import java.util.Random; 4 | 5 | import net.minecraft.block.Block; 6 | import net.minecraft.init.Blocks; 7 | import net.minecraft.world.World; 8 | import net.minecraft.world.biome.BiomeGenBase; 9 | 10 | import rwg.api.RWGBiomes; 11 | import rwg.util.CellNoise; 12 | import rwg.util.NoiseGenerator; 13 | 14 | public class SurfaceDuneValley extends SurfaceBase { 15 | 16 | private float valley; 17 | private boolean dirt; 18 | private boolean mix; 19 | 20 | public SurfaceDuneValley(Block top, Block fill, float valleySize, boolean d, boolean m) { 21 | super(top, fill); 22 | 23 | valley = valleySize; 24 | dirt = d; 25 | mix = m; 26 | } 27 | 28 | @Override 29 | public void paintTerrain(Block[] blocks, byte[] metadata, int i, int j, int x, int y, int depth, World world, 30 | Random rand, NoiseGenerator perlin, CellNoise cell, float[] noise, float river, BiomeGenBase[] base) { 31 | float h = (perlin.noise2(i / valley, j / valley) + 0.25f) * 65f; 32 | h = h < 1f ? 1f : h; 33 | float m = perlin.noise2(i / 12f, j / 12f); 34 | boolean sand = false; 35 | 36 | Block b; 37 | for (int k = 255; k > -1; k--) { 38 | b = blocks[(y * 16 + x) * 256 + k]; 39 | if (b == Blocks.air) { 40 | depth = -1; 41 | } else if (b == Blocks.stone) { 42 | depth++; 43 | 44 | if (depth == 0) { 45 | if (k > 90f + perlin.noise2(i / 24f, j / 24f) * 10f - h || (m < -0.28f && mix)) { 46 | blocks[(y * 16 + x) * 256 + k] = Blocks.sand; 47 | base[x * 16 + y] = RWGBiomes.baseHotDesert; 48 | sand = true; 49 | } else if (dirt && m < 0.22f || k < 62) { 50 | blocks[(y * 16 + x) * 256 + k] = Blocks.dirt; 51 | metadata[(y * 16 + x) * 256 + k] = 1; 52 | } else { 53 | blocks[(y * 16 + x) * 256 + k] = topBlock; 54 | } 55 | } else if (depth < 6) { 56 | if (sand) { 57 | if (depth < 4) { 58 | blocks[(y * 16 + x) * 256 + k] = Blocks.sand; 59 | } else { 60 | blocks[(y * 16 + x) * 256 + k] = Blocks.sandstone; 61 | } 62 | } else { 63 | blocks[(y * 16 + x) * 256 + k] = fillerBlock; 64 | } 65 | } 66 | } 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /src/main/java/rwg/biomes/realistic/land/RealisticBiomeHighRainforest.java: -------------------------------------------------------------------------------- 1 | package rwg.biomes.realistic.land; 2 | 3 | import java.util.Random; 4 | 5 | import net.minecraft.block.Block; 6 | import net.minecraft.init.Blocks; 7 | import net.minecraft.world.World; 8 | import net.minecraft.world.biome.BiomeGenBase; 9 | import net.minecraft.world.gen.feature.WorldGenerator; 10 | 11 | import rwg.api.RWGBiomes; 12 | import rwg.biomes.realistic.RealisticBiomeBase; 13 | import rwg.deco.trees.DecoJungleFat; 14 | import rwg.surface.SurfaceBase; 15 | import rwg.surface.SurfaceGrassland; 16 | import rwg.terrain.TerrainBase; 17 | import rwg.terrain.TerrainHighland; 18 | import rwg.util.CellNoise; 19 | import rwg.util.NoiseGenerator; 20 | 21 | public class RealisticBiomeHighRainforest extends RealisticBiomeBase { 22 | 23 | private TerrainBase terrain; 24 | private SurfaceBase surface; 25 | 26 | public RealisticBiomeHighRainforest() { 27 | super(0, RWGBiomes.baseJungle); 28 | 29 | terrain = new TerrainHighland(0f, 140f, 68f, 200f); 30 | surface = new SurfaceGrassland(Blocks.grass, Blocks.dirt, Blocks.stone, Blocks.cobblestone); 31 | } 32 | 33 | public void rDecorate(World world, Random rand, int chunkX, int chunkY, NoiseGenerator perlin, CellNoise cell, 34 | float strength, float river) { 35 | if (rand.nextInt((int) (1f / strength)) == 0) { 36 | int j6 = chunkX + 8; // 12 + rand.nextInt(8); 37 | int k10 = chunkY + 8; // 12 + rand.nextInt(8); 38 | int z52 = world.getHeightValue(j6, k10); 39 | 40 | WorldGenerator worldgenerator = new DecoJungleFat( 41 | Blocks.log, 42 | 3, 43 | Blocks.sponge, 44 | 7, 45 | 15 + rand.nextInt(15), 46 | 4 + rand.nextInt(2), 47 | 14f, 48 | 3, 49 | 0.2f, 50 | 0.25f); 51 | worldgenerator.setScale(1.0D, 1.0D, 1.0D); 52 | worldgenerator.generate(world, rand, j6, z52, k10); 53 | } 54 | } 55 | 56 | public float rNoise(NoiseGenerator perlin, CellNoise cell, int x, int y, float ocean, float border, float river) { 57 | return terrain.generateNoise(perlin, cell, x, y, ocean, border, river); 58 | } 59 | 60 | public void rReplace(Block[] blocks, byte[] metadata, int i, int j, int x, int y, int depth, World world, 61 | Random rand, NoiseGenerator perlin, CellNoise cell, float[] noise, float river, BiomeGenBase[] base) { 62 | surface.paintTerrain(blocks, metadata, i, j, x, y, depth, world, rand, perlin, cell, noise, river, base); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src/main/java/rwg/deco/DecoFlowers.java: -------------------------------------------------------------------------------- 1 | package rwg.deco; 2 | 3 | import java.util.Random; 4 | 5 | import net.minecraft.init.Blocks; 6 | import net.minecraft.world.World; 7 | import net.minecraft.world.gen.feature.WorldGenerator; 8 | 9 | public class DecoFlowers extends WorldGenerator { 10 | 11 | private int[] flowers; 12 | 13 | /** 14 | * FLOWER LIST: 15 | * 16 | * 0 Rose - 1 Blue Orchid - 2 Allium - 3 Azure Bluet - 4 Red Tulip - 5 Orange Tulip - 6 White Tulip - 7 Pink Tulip - 17 | * 8 Oxeye Daisy - 18 | * 19 | * 9 yellow Flower - 20 | * 21 | * 10 Sunflower - 11 Lilac - 12 Double Tallgrass - 13 Large Fern - 14 Rose Bush - 15 Peony 22 | * 23 | */ 24 | public DecoFlowers(int[] f) { 25 | flowers = f; 26 | } 27 | 28 | public boolean generate(World world, Random rand, int x, int y, int z) { 29 | int randomFlower = flowers[rand.nextInt(flowers.length)]; 30 | 31 | if (randomFlower > 9) { 32 | for (int l = 0; l < 64; ++l) { 33 | int i1 = x + rand.nextInt(8) - rand.nextInt(8); 34 | int j1 = y + rand.nextInt(4) - rand.nextInt(4); 35 | int k1 = z + rand.nextInt(8) - rand.nextInt(8); 36 | 37 | if (world.isAirBlock(i1, j1, k1) && (!world.provider.hasNoSky || j1 < 254) 38 | && Blocks.double_plant.canPlaceBlockAt(world, i1, j1, k1)) { 39 | Blocks.double_plant.func_149889_c(world, i1, j1, k1, randomFlower - 10, 0); 40 | } 41 | } 42 | } else if (randomFlower == 9) { 43 | for (int l = 0; l < 64; ++l) { 44 | int i1 = x + rand.nextInt(8) - rand.nextInt(8); 45 | int j1 = y + rand.nextInt(4) - rand.nextInt(4); 46 | int k1 = z + rand.nextInt(8) - rand.nextInt(8); 47 | 48 | if (world.isAirBlock(i1, j1, k1) && (!world.provider.hasNoSky || j1 < 255) 49 | && Blocks.yellow_flower.canBlockStay(world, i1, j1, k1)) { 50 | world.setBlock(i1, j1, k1, Blocks.yellow_flower, 0, 0); 51 | } 52 | } 53 | } else { 54 | for (int l = 0; l < 64; ++l) { 55 | int i1 = x + rand.nextInt(8) - rand.nextInt(8); 56 | int j1 = y + rand.nextInt(4) - rand.nextInt(4); 57 | int k1 = z + rand.nextInt(8) - rand.nextInt(8); 58 | 59 | if (world.isAirBlock(i1, j1, k1) && (!world.provider.hasNoSky || j1 < 255) 60 | && Blocks.red_flower.canBlockStay(world, i1, j1, k1)) { 61 | world.setBlock(i1, j1, k1, Blocks.red_flower, randomFlower, 0); 62 | } 63 | } 64 | } 65 | 66 | return true; 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /src/main/java/rwg/map/MapAncientRuins.java: -------------------------------------------------------------------------------- 1 | package rwg.map; 2 | 3 | import java.util.Random; 4 | 5 | import net.minecraft.block.Block; 6 | import net.minecraft.init.Blocks; 7 | import net.minecraft.world.World; 8 | 9 | import rwg.util.CellNoise; 10 | import rwg.util.NoiseGenerator; 11 | 12 | public class MapAncientRuins { 13 | 14 | public static void build(Block[] blocks, byte[] metadata, World world, Random mapRand, int chunkX, int chunkY, 15 | int baseX, int baseY, NoiseGenerator perlin, CellNoise cell, int dis) { 16 | int y = 120; 17 | for (; y > 49; y--) { 18 | if (blocks[coordstoArray(8, y - 1, 8)] != Blocks.air) { 19 | if (y > 118) { 20 | return; 21 | } 22 | break; 23 | } 24 | 25 | if (y < 51) { 26 | return; 27 | } 28 | } 29 | 30 | int sizeX = mapRand.nextInt(5) + 10 - (dis * 2); 31 | int sizeZ = mapRand.nextInt(5) + 10 - (dis * 2); 32 | int startX = mapRand.nextInt(2) + dis; 33 | int startZ = mapRand.nextInt(2) + dis; 34 | int i, j, height; 35 | 36 | for (i = startX; i < startX + sizeX; i++) { 37 | if (blocks[coordstoArray(startX + i, y - 2, startZ)] != Blocks.air) { 38 | height = mapRand.nextInt(4); 39 | for (j = 0; j < height; j++) { 40 | blocks[coordstoArray(startX + i, y + j - 1, startZ)] = Blocks.mossy_cobblestone; 41 | } 42 | } 43 | 44 | if (blocks[coordstoArray(startX + i, y - 2, startZ + sizeZ)] != Blocks.air) { 45 | height = mapRand.nextInt(4); 46 | for (j = 0; j < height; j++) { 47 | blocks[coordstoArray(startX + i, y + j - 1, startZ + sizeZ)] = Blocks.mossy_cobblestone; 48 | } 49 | } 50 | } 51 | 52 | for (i = startZ + 1; i < startZ + sizeZ - 1; i++) { 53 | if (blocks[coordstoArray(startX, y - 2, startZ + i)] != Blocks.air) { 54 | height = mapRand.nextInt(4); 55 | for (j = 0; j < height; j++) { 56 | blocks[coordstoArray(startX, y + j - 1, startZ + i)] = Blocks.mossy_cobblestone; 57 | } 58 | } 59 | 60 | if (blocks[coordstoArray(startX + sizeX, y - 2, startZ + i)] != Blocks.air) { 61 | height = mapRand.nextInt(4); 62 | for (j = 0; j < height; j++) { 63 | blocks[coordstoArray(startX + sizeX, y + j - 1, startZ + i)] = Blocks.mossy_cobblestone; 64 | } 65 | } 66 | } 67 | } 68 | 69 | public static int coordstoArray(int x, int y, int z) { 70 | return (z * 16 + x) * 256 + y; 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /src/main/java/rwg/biomes/realistic/land/RealisticBiomePolar.java: -------------------------------------------------------------------------------- 1 | package rwg.biomes.realistic.land; 2 | 3 | import java.util.Random; 4 | 5 | import net.minecraft.block.Block; 6 | import net.minecraft.init.Blocks; 7 | import net.minecraft.world.World; 8 | import net.minecraft.world.biome.BiomeGenBase; 9 | import net.minecraft.world.gen.feature.WorldGenerator; 10 | 11 | import rwg.api.RWGBiomes; 12 | import rwg.biomes.realistic.RealisticBiomeBase; 13 | import rwg.deco.DecoBlob; 14 | import rwg.deco.trees.DecoSmallSpruce; 15 | import rwg.surface.SurfaceBase; 16 | import rwg.surface.SurfacePolar; 17 | import rwg.terrain.TerrainBase; 18 | import rwg.terrain.TerrainPolar; 19 | import rwg.util.CellNoise; 20 | import rwg.util.NoiseGenerator; 21 | 22 | public class RealisticBiomePolar extends RealisticBiomeBase { 23 | 24 | private TerrainBase terrain; 25 | private SurfaceBase surface; 26 | 27 | public RealisticBiomePolar() { 28 | super(0, RWGBiomes.baseSnowDesert, RealisticBiomeBase.coastIce, RWGBiomes.baseRiverIce); 29 | terrain = new TerrainPolar(); 30 | surface = new SurfacePolar(Blocks.snow, Blocks.snow); 31 | } 32 | 33 | @Override 34 | public void rDecorate(World world, Random rand, int chunkX, int chunkY, NoiseGenerator perlin, CellNoise cell, 35 | float strength, float river) { 36 | if (river > 0.86f) { 37 | for (int j = 0; j < 5f * strength; j++) { 38 | int i1 = chunkX + rand.nextInt(16) + 8; 39 | int j1 = chunkY + rand.nextInt(16) + 8; 40 | int k1 = world.getHeightValue(i1, j1); 41 | if (k1 < 64) { 42 | (new DecoBlob(Blocks.packed_ice, 0)).generate(world, rand, i1, k1, j1); 43 | } 44 | } 45 | 46 | if (rand.nextInt((int) (2f / strength)) == 0) { 47 | int j6 = chunkX + rand.nextInt(16) + 8; 48 | int k10 = chunkY + rand.nextInt(16) + 8; 49 | int z52 = world.getHeightValue(j6, k10); 50 | 51 | WorldGenerator worldgenerator = new DecoSmallSpruce(rand.nextInt(2)); 52 | worldgenerator.setScale(1.0D, 1.0D, 1.0D); 53 | worldgenerator.generate(world, rand, j6, z52, k10); 54 | } 55 | } 56 | } 57 | 58 | public float rNoise(NoiseGenerator perlin, CellNoise cell, int x, int y, float ocean, float border, float river) { 59 | return terrain.generateNoise(perlin, cell, x, y, ocean, border, river); 60 | } 61 | 62 | public void rReplace(Block[] blocks, byte[] metadata, int i, int j, int x, int y, int depth, World world, 63 | Random rand, NoiseGenerator perlin, CellNoise cell, float[] noise, float river, BiomeGenBase[] base) { 64 | surface.paintTerrain(blocks, metadata, i, j, x, y, depth, world, rand, perlin, cell, noise, river, base); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/main/java/rwg/support/RealisticBiomeSupport.java: -------------------------------------------------------------------------------- 1 | package rwg.support; 2 | 3 | import java.util.Random; 4 | 5 | import net.minecraft.block.Block; 6 | import net.minecraft.world.World; 7 | import net.minecraft.world.biome.BiomeGenBase; 8 | 9 | import rwg.biomes.realistic.RealisticBiomeBase; 10 | import rwg.support.edit.EditBase; 11 | import rwg.surface.SurfaceBase; 12 | import rwg.terrain.TerrainBase; 13 | import rwg.util.CellNoise; 14 | import rwg.util.NoiseGenerator; 15 | 16 | public class RealisticBiomeSupport extends RealisticBiomeBase { 17 | 18 | public BiomeGenBase customBiome; 19 | public TerrainBase terrain; 20 | 21 | public SurfaceBase[] surfaces; 22 | public int surfacesLength; 23 | 24 | public EditBase[] edits; 25 | public int editLength; 26 | 27 | public RealisticBiomeSupport(BiomeGenBase b, BiomeGenBase riverbiome, TerrainBase t, SurfaceBase[] s, 28 | EditBase[] e) { 29 | super(0, b, RealisticBiomeBase.coastDunes, riverbiome); 30 | customBiome = b; 31 | terrain = t; 32 | 33 | surfaces = s; 34 | surfacesLength = s.length; 35 | 36 | if (e != null) { 37 | edits = e; 38 | editLength = e.length; 39 | } else { 40 | editLength = 0; 41 | } 42 | } 43 | 44 | public RealisticBiomeSupport(BiomeGenBase b, BiomeGenBase riverbiome, TerrainBase t, SurfaceBase s, EditBase e) { 45 | this(b, riverbiome, t, new SurfaceBase[] { s }, e != null ? new EditBase[] { e } : null); 46 | } 47 | 48 | public RealisticBiomeSupport(BiomeGenBase b, BiomeGenBase riverbiome, TerrainBase t, SurfaceBase s) { 49 | this(b, riverbiome, t, s, null); 50 | } 51 | 52 | @Override 53 | public void rDecorate(World world, Random rand, int chunkX, int chunkY, NoiseGenerator perlin, CellNoise cell, 54 | float strength, float river) { 55 | if (strength > 0.3f) { 56 | customBiome.decorate(world, rand, chunkX, chunkY); 57 | } 58 | 59 | for (int e = 0; e < editLength; e++) { 60 | edits[e].decorate(world, rand, chunkX, chunkY, perlin, cell, strength, river); 61 | } 62 | } 63 | 64 | @Override 65 | public float rNoise(NoiseGenerator perlin, CellNoise cell, int x, int y, float ocean, float border, float river) { 66 | return terrain.generateNoise(perlin, cell, x, y, ocean, border, river); 67 | } 68 | 69 | @Override 70 | public void rReplace(Block[] blocks, byte[] metadata, int i, int j, int x, int y, int depth, World world, 71 | Random rand, NoiseGenerator perlin, CellNoise cell, float[] noise, float river, BiomeGenBase[] base) { 72 | for (int s = 0; s < surfacesLength; s++) { 73 | surfaces[s] 74 | .paintTerrain(blocks, metadata, i, j, x, y, depth, world, rand, perlin, cell, noise, river, base); 75 | } 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /src/main/java/rwg/deco/trees/DecoSmallJungle.java: -------------------------------------------------------------------------------- 1 | package rwg.deco.trees; 2 | 3 | import java.util.Random; 4 | 5 | import net.minecraft.block.Block; 6 | import net.minecraft.block.material.Material; 7 | import net.minecraft.init.Blocks; 8 | import net.minecraft.world.World; 9 | import net.minecraft.world.gen.feature.WorldGenerator; 10 | 11 | public class DecoSmallJungle extends WorldGenerator { 12 | 13 | public DecoSmallJungle() {} 14 | 15 | @Override 16 | public boolean generate(World world, Random rand, int x, int y, int z) { 17 | int size = 3; 18 | 19 | Block b = world.getBlock(x, y - 1, z); 20 | if (b != Blocks.grass && b != Blocks.dirt && b != Blocks.sand) { 21 | return false; 22 | } 23 | 24 | Material m = world.getBlock(x, y, z).getMaterial(); 25 | if (m != Material.air && m != Material.vine) { 26 | return false; 27 | } 28 | 29 | int i = 0, j, dx, dz, l, s, h = (size * 2) + rand.nextInt(size); 30 | for (; i < h; i++) { 31 | world.setBlock(x, y + i, z, Blocks.log, 3, 0); 32 | } 33 | buildLeaves(world, rand, x, y + h - 1, z); 34 | 35 | if (size > 1) { 36 | for (i = 0; i < size + 1; i++) { 37 | dx = rand.nextInt(3) - 1; 38 | dz = rand.nextInt(3) - 1; 39 | if (dx == 0 && dz == 0) { 40 | dx = rand.nextInt(3) - 1; 41 | dz = rand.nextInt(3) - 1; 42 | } 43 | 44 | l = (size - 1) + (Math.abs(dx) + Math.abs(dz) == 1 ? rand.nextInt(size - 1) : 0); 45 | 46 | s = h - size - rand.nextInt(size); 47 | for (j = 1; j <= l; j++) { 48 | world.setBlock(x + (dx * j), y + s + j, z + (dz * j), Blocks.log, 3, 0); 49 | } 50 | j--; 51 | buildLeaves(world, rand, x + (dx * j), y + s + j, z + (dz * j)); 52 | } 53 | } 54 | 55 | return true; 56 | } 57 | 58 | private void buildLeaves(World w, Random rand, int x, int y, int z) { 59 | int i, j; 60 | for (i = -1; i <= 1; i++) { 61 | for (j = -1; j <= 1; j++) { 62 | buildBlock(w, x + i, y, z + j, Blocks.leaves, 3, 0); 63 | } 64 | } 65 | 66 | for (i = -1; i < 2; i += 2) { 67 | buildBlock(w, x + 1, y + i, z, Blocks.leaves, 3, 0); 68 | buildBlock(w, x - 1, y + i, z, Blocks.leaves, 3, 0); 69 | buildBlock(w, x, y + i, z + 1, Blocks.leaves, 3, 0); 70 | buildBlock(w, x, y + i, z - 1, Blocks.leaves, 3, 0); 71 | buildBlock(w, x, y + i, z, Blocks.leaves, 3, 0); 72 | } 73 | } 74 | 75 | private void buildBlock(World w, int x, int y, int z, Block b, int m, int u) { 76 | Material ma = w.getBlock(x, y, z).getMaterial(); 77 | 78 | if (ma == Material.air || ma == Material.vine) { 79 | w.setBlock(x, y, z, b, m, u); 80 | } 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /src/main/java/rwg/deco/ruins/DecoRuinsAncient.java: -------------------------------------------------------------------------------- 1 | package rwg.deco.ruins; 2 | 3 | import java.util.Random; 4 | 5 | import net.minecraft.block.Block; 6 | import net.minecraft.block.material.Material; 7 | import net.minecraft.world.World; 8 | 9 | public class DecoRuinsAncient { 10 | 11 | private Block block; 12 | 13 | public DecoRuinsAncient(Block b) { 14 | block = b; 15 | } 16 | 17 | public boolean generate(World world, Random rand, int x, int y, int z) { 18 | int type = rand.nextInt(2); 19 | 20 | Block g = world.getBlock(x, y - 1, z); 21 | if (g.getMaterial() != Material.ground && g.getMaterial() != Material.grass 22 | && g.getMaterial() != Material.sand 23 | && g.getMaterial() != Material.rock) { 24 | return false; 25 | } 26 | 27 | int high = y; 28 | int low = y; 29 | for (int cX = -6; cX <= 6; cX += 12) { 30 | for (int cZ = -6; cZ <= 6; cZ += 12) { 31 | for (int cY = y + 10; cY > 40; cY--) { 32 | Block b = world.getBlock(x + cX, cY, z + cZ); 33 | if (b.getMaterial() == Material.ground || b.getMaterial() == Material.grass 34 | || b.getMaterial() == Material.sand 35 | || b.getMaterial() == Material.rock) { 36 | high = cY > high ? cY : high; 37 | low = cY < low ? cY : low; 38 | 39 | break; 40 | } 41 | } 42 | } 43 | } 44 | 45 | if (high - low > 6) { 46 | return false; 47 | } 48 | 49 | if (type == 0) // pillars 50 | { 51 | for (int a = rand.nextInt(4) + 3; a > -1; a--) { 52 | int sX = x - 4 + rand.nextInt(9); 53 | int sZ = z - 4 + rand.nextInt(9); 54 | int sY = y + 10; 55 | 56 | for (; sY > 50; sY--) { 57 | Block b = world.getBlock(sX, sY - 1, sZ); 58 | if (b.getMaterial() == Material.ground || b.getMaterial() == Material.grass 59 | || b.getMaterial() == Material.sand 60 | || b.getMaterial() == Material.rock) { 61 | break; 62 | } 63 | } 64 | 65 | int h = rand.nextInt(3) + 2 - rand.nextInt(2); 66 | for (int i = 0; i < h; i++) { 67 | world.setBlock(sX, sY + i, sZ, block, 0, 0); 68 | } 69 | } 70 | } else if (type == 1) // big pillar 71 | { 72 | for (int i = -1; i <= 1; i++) { 73 | for (int j = -1; j <= 1; j++) { 74 | int h = rand.nextInt(4) + (i == 0 && j == 0 ? 3 : 1); 75 | for (int k = -2; k < h; k++) { 76 | world.setBlock(x + i, y + k, z + j, block, 0, 0); 77 | } 78 | } 79 | } 80 | } 81 | 82 | return true; 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /src/main/java/rwg/terrain/TerrainCanyon.java: -------------------------------------------------------------------------------- 1 | package rwg.terrain; 2 | 3 | import rwg.util.CellNoise; 4 | import rwg.util.NoiseGenerator; 5 | 6 | public class TerrainCanyon extends TerrainBase { 7 | 8 | private boolean smallRiver; 9 | private float[] height; 10 | private int heightLength; 11 | private float strength; 12 | private float cWidth; 13 | private float cHeigth; 14 | private float cStrength; 15 | private float base; 16 | 17 | /* 18 | * Example parameters: allowed to generate rivers? riverGen = true canyon jump heights heightArray = new 19 | * float[]{2.0f, 0.5f, 6.5f, 0.5f, 14.0f, 0.5f, 19.0f, 0.5f} strength of canyon jump heights heightStrength = 35f 20 | * canyon width (cliff to cliff) canyonWidth = 160f canyon heigth (total heigth) canyonHeight = 60f canyon strength 21 | * canyonStrength = 40f 22 | */ 23 | public TerrainCanyon(boolean riverGen, float heightStrength, float canyonWidth, float canyonHeight, 24 | float canyonStrength, float baseHeight) { 25 | smallRiver = riverGen; 26 | height = new float[] { 5.0f, 0.5f, 12.5f, 0.5f, 18.0f, 0.5f }; 27 | strength = heightStrength; 28 | heightLength = height.length; 29 | cWidth = canyonWidth; 30 | cHeigth = canyonHeight; 31 | cStrength = canyonStrength; 32 | base = baseHeight; 33 | } 34 | 35 | @Override 36 | public float generateNoise(NoiseGenerator perlin, CellNoise cell, int x, int y, float ocean, float border, 37 | float river) { 38 | // float b = perlin.noise2(x / cWidth, y / cWidth) * cHeigth * river; 39 | // b *= b / cStrength; 40 | river *= 1.3f; 41 | river = river > 1f ? 1f : river; 42 | float r = perlin.noise2(x / 100f, y / 100f) * 50f; 43 | r = r < -7.4f ? -7.4f : r > 7.4f ? 7.4f : r; 44 | float b = (17f + r) * river; 45 | 46 | float hn = perlin.noise2(x / 12f, y / 12f) * 0.5f; 47 | float sb = 0f; 48 | if (b > 0f) { 49 | sb = b; 50 | sb = sb < 0f ? 0f : sb > 7f ? 7f : sb; 51 | sb = hn * sb; 52 | } 53 | b += sb; 54 | 55 | float cTotal = 0f; 56 | float cTemp = 0f; 57 | 58 | for (int i = 0; i < heightLength; i += 2) { 59 | cTemp = 0; 60 | if (b > height[i] && border > 0.6f + (height[i] * 0.015f) + hn * 0.2f) { 61 | cTemp = b > height[i] + height[i + 1] ? height[i + 1] : b - height[i]; 62 | cTemp *= strength; 63 | } 64 | cTotal += cTemp; 65 | } 66 | 67 | float bn = 0f; 68 | if (smallRiver) { 69 | if (b < 5f) { 70 | bn = 5f - b; 71 | for (int i = 0; i < 3; i++) { 72 | bn *= bn / 4.5f; 73 | } 74 | } 75 | } else if (b < 5f) { 76 | bn = (perlin.noise2(x / 7f, y / 7f) * 1.3f + perlin.noise2(x / 15f, y / 15f) * 2f) * (5f - b) * 0.2f; 77 | } 78 | 79 | b += cTotal - bn; 80 | 81 | return base + b; 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /src/main/java/rwg/biomes/realistic/land/RealisticBiomeTestRiver.java: -------------------------------------------------------------------------------- 1 | package rwg.biomes.realistic.land; 2 | 3 | import java.util.Random; 4 | 5 | import net.minecraft.init.Blocks; 6 | import net.minecraft.world.World; 7 | 8 | import rwg.api.RWGBiomes; 9 | import rwg.biomes.realistic.RealisticBiomeBase; 10 | import rwg.surface.SurfaceBase; 11 | import rwg.surface.SurfaceMountainStoneMix1; 12 | import rwg.terrain.TerrainBase; 13 | import rwg.terrain.TerrainHilly; 14 | import rwg.util.CellNoise; 15 | import rwg.util.NoiseGenerator; 16 | 17 | public class RealisticBiomeTestRiver extends RealisticBiomeBase { 18 | 19 | private CellNoise celltest; 20 | private TerrainBase terrain; 21 | private SurfaceBase surface; 22 | 23 | public RealisticBiomeTestRiver() { 24 | super(0, RWGBiomes.baseHotPlains); 25 | 26 | celltest = new CellNoise(0, (short) 0); 27 | // celltest.setUseDistance(true); 28 | 29 | terrain = new TerrainHilly(230f, 120f, 0f); 30 | surface = new SurfaceMountainStoneMix1( 31 | Blocks.grass, 32 | Blocks.dirt, 33 | false, 34 | null, 35 | 0f, 36 | 1.5f, 37 | 60f, 38 | 65f, 39 | 1.5f, 40 | Blocks.stone, 41 | 0.08f); 42 | } 43 | 44 | @Override 45 | public void rDecorate(World world, Random rand, int chunkX, int chunkY, NoiseGenerator perlin, CellNoise cell, 46 | float strength, float river) {} 47 | 48 | @Override 49 | public float rNoise(NoiseGenerator perlin, CellNoise cell, int x, int y, float ocean, float border, float river) { 50 | /* 51 | * float pX = x + (perlin.noise1(y / 240f) * 220f); float pY = y + (perlin.noise1(x / 240f) * 220f); float p = 52 | * cell.border(pX / 1250D, pY / 1250D, 50D / 2300D, 1f); float st = cell.border(pX / 1250D, pY / 1250D, 50D / 53 | * 400D, 1f); return ((generateNoise(perlin, cell, x, y, st + 1f)) * (p + 1f)) + ((57f + perlin.noise2(x / 15f, 54 | * y / 15f) * 3f + perlin.noise2(x / 8f, y / 8f) * 1.5f) * (-p)); 55 | */ 56 | return 64.1f; 57 | } 58 | 59 | public float generateNoise(NoiseGenerator perlin, CellNoise cell, int x, int y, float river) { 60 | float h = perlin.noise2(x / 20f, y / 20f) * 2; 61 | h += perlin.noise2(x / 7f, y / 7f) * 0.8f; 62 | 63 | float m = perlin.noise2(x / 230f, y / 230f) * 120f * river; 64 | m *= m / 35f; 65 | m = m > 70f ? 70f + (m - 70f) / 2.5f : m; 66 | 67 | float st = m * 0.7f; 68 | st = st > 20f ? 20f : st; 69 | float c = cell.noise(x / 30f, y / 30f, 1D) * (5f + st); 70 | 71 | float sm = perlin.noise2(x / 30f, y / 30f) * 8f + perlin.noise2(x / 8f, y / 8f); 72 | sm *= (m + 10f) / 20f > 2.5f ? 2.5f : (m + 10f) / 20f; 73 | m += sm; 74 | 75 | m += c; 76 | 77 | float l = perlin.noise2(x / 260f, y / 260f) * 0f; 78 | l *= l / 25f; 79 | l = l < -8f ? -8f : l; 80 | 81 | return 67f + h + m - l; 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /src/main/java/rwg/support/SupportTC.java: -------------------------------------------------------------------------------- 1 | package rwg.support; 2 | 3 | import net.minecraft.init.Blocks; 4 | import net.minecraft.world.biome.BiomeGenBase; 5 | 6 | import rwg.api.RWGBiomes; 7 | import rwg.config.ConfigRWG; 8 | import rwg.support.Support.BiomeCategory; 9 | import rwg.surface.SurfaceGrassland; 10 | import rwg.terrain.TerrainHighland; 11 | import rwg.terrain.TerrainSmallSupport; 12 | 13 | public class SupportTC { 14 | /* 15 | * THAUMCRAFT BIOMES 118: "Tainted Land" 119: "Magical Forest" 16 | */ 17 | 18 | public static void init() { 19 | BiomeGenBase[] b = BiomeGenBase.getBiomeGenArray(); 20 | 21 | for (int i = 0; i < 256; i++) { 22 | if (b[i] != null) { 23 | if (b[i].biomeName == "Tainted Land") { 24 | Support.addBiome( 25 | new RealisticBiomeSupport( 26 | b[i], 27 | RWGBiomes.baseRiverTemperate, 28 | new TerrainSmallSupport(), 29 | new SurfaceGrassland( 30 | b[i].topBlock, 31 | b[i].fillerBlock, 32 | Blocks.stone, 33 | Blocks.cobblestone)), 34 | BiomeCategory.SMALL); 35 | } 36 | 37 | if (b[i].biomeName == "Magical Forest") { 38 | if (ConfigRWG.generateLargeThaumcraftBiomes) { 39 | Support.addBiome( 40 | new RealisticBiomeSupport( 41 | b[i], 42 | RWGBiomes.baseTemperateForest, 43 | new TerrainHighland(6f, 120f, 65f, 150f), 44 | new SurfaceGrassland( 45 | b[i].topBlock, 46 | b[i].fillerBlock, 47 | Blocks.stone, 48 | Blocks.cobblestone)), 49 | BiomeCategory.WET); 50 | } else { 51 | Support.addBiome( 52 | new RealisticBiomeSupport( 53 | b[i], 54 | RWGBiomes.baseRiverTemperate, 55 | new TerrainSmallSupport(), 56 | new SurfaceGrassland( 57 | b[i].topBlock, 58 | b[i].fillerBlock, 59 | Blocks.stone, 60 | Blocks.cobblestone)), 61 | BiomeCategory.SMALL); 62 | } 63 | } 64 | } 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /src/main/java/rwg/deco/trees/DecoEuroPine.java: -------------------------------------------------------------------------------- 1 | package rwg.deco.trees; 2 | 3 | import java.util.Random; 4 | 5 | import net.minecraft.block.Block; 6 | import net.minecraft.init.Blocks; 7 | import net.minecraft.world.World; 8 | import net.minecraft.world.gen.feature.WorldGenerator; 9 | 10 | public class DecoEuroPine extends WorldGenerator { 11 | 12 | public DecoEuroPine() {} 13 | 14 | public boolean generate(World world, Random rand, int x, int y, int z) { 15 | Block g = world.getBlock(x, y - 1, z); 16 | if (g != Blocks.grass && g != Blocks.dirt) { 17 | return false; 18 | } 19 | 20 | int height = 18 + rand.nextInt(10); 21 | int leafheight = 7 + rand.nextInt(4); 22 | float branchIncrease = 0.25f; 23 | 24 | for (int i = 0; i <= height; i++) { 25 | world.setBlock(x, y + i, z, Blocks.log, 0, 0); 26 | } 27 | createRandomLeaves(world, rand, x, y + height, z, 2); 28 | createTrunk(world, rand, x, y, z); 29 | 30 | int dir = 0, b; 31 | float xd, yd, bl = 1f; 32 | for (int j = height; j >= height - leafheight; j--) { 33 | bl += branchIncrease; 34 | dir += rand.nextInt(180) + 90; 35 | dir -= dir > 360 ? 360 : 0; 36 | xd = (float) Math.cos(dir * Math.PI / 180f); 37 | yd = (float) Math.sin(dir * Math.PI / 180f); 38 | 39 | for (b = 0; b <= bl; b++) { 40 | world.setBlock(x + (int) (b * xd), y + j, z + (int) (b * yd), Blocks.log, 12, 0); 41 | } 42 | createRandomLeaves(world, rand, x, y + j, z, 2); 43 | createRandomLeaves(world, rand, x + (int) (b * xd), y + j, z + (int) (b * yd), 2); 44 | } 45 | 46 | return true; 47 | } 48 | 49 | private void createRandomLeaves(World world, Random rand, int x, int y, int z, int size) { 50 | int l; 51 | int t = (int) Math.pow(size, 2); 52 | for (int i = -size; i <= size; i++) { 53 | for (int j = -size; j <= size; j++) { 54 | for (int k = -size; k <= size; k++) { 55 | l = i * i + j * j + k * k; 56 | if (l <= t) { 57 | if (world.isAirBlock(x + i, y + j, z + k) && (l < t / 2 || rand.nextBoolean())) { 58 | world.setBlock(x + i, y + j, z + k, Blocks.leaves, 4, 0); 59 | } 60 | } 61 | } 62 | } 63 | } 64 | } 65 | 66 | private void createTrunk(World world, Random rand, int x, int y, int z) { 67 | int[] pos = new int[] { 0, 0, 1, 0, 0, 1, -1, 0, 0, -1 }; 68 | int sh; 69 | for (int t = 0; t < 5; t++) { 70 | sh = rand.nextInt(3) + y; 71 | while (sh > y - 3) { 72 | if (world.getBlock(x + pos[t * 2], sh, z + pos[t * 2 + 1]) == Blocks.dirt) { 73 | break; 74 | } 75 | world.setBlock(x + pos[t * 2], sh, z + pos[t * 2 + 1], Blocks.log, 12, 0); 76 | sh--; 77 | } 78 | } 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /src/main/java/rwg/world/RwgWorldSavedData.java: -------------------------------------------------------------------------------- 1 | package rwg.world; 2 | 3 | import net.minecraft.nbt.NBTTagCompound; 4 | import net.minecraft.world.WorldSavedData; 5 | import net.minecraft.world.WorldServer; 6 | import net.minecraft.world.storage.MapStorage; 7 | import net.minecraftforge.common.DimensionManager; 8 | 9 | import rwg.util.NoiseImplementation; 10 | 11 | public class RwgWorldSavedData extends WorldSavedData { 12 | 13 | private static RwgWorldSavedData INSTANCE = null; 14 | private static final String DATA_NAME = "rwg_data"; 15 | private NoiseImplementation noiseImplementation = rwg.util.NoiseImplementation.UNKNOWN; 16 | 17 | public RwgWorldSavedData() { 18 | super(DATA_NAME); 19 | } 20 | 21 | public RwgWorldSavedData(String s) { 22 | super(s); 23 | } 24 | 25 | @Override 26 | public void readFromNBT(NBTTagCompound nbtTagCompound) { 27 | String noiseImplementation = nbtTagCompound.getString("noiseImplementation"); 28 | 29 | System.out.println("RWG LOADING DATA - NOISE STRING: " + noiseImplementation); 30 | try { 31 | this.noiseImplementation = NoiseImplementation.valueOf(noiseImplementation); 32 | } catch (IllegalArgumentException e) { 33 | System.out.println("RWG ERROR LOADING DATA - NOISE IS: " + this.noiseImplementation); 34 | } 35 | } 36 | 37 | @Override 38 | public void writeToNBT(NBTTagCompound nbtTagCompound) { 39 | String noiseString = noiseImplementation.toString(); 40 | 41 | System.out.println("RWG SAVING DATA DATA - NOISE: " + noiseImplementation); 42 | System.out.println("RWG SAVING DATA DATA - NOISE: " + noiseString); 43 | try { 44 | nbtTagCompound.setString("noiseImplementation", noiseString); 45 | } catch (Exception e) { 46 | System.out.println("RWG ERROR SAVING DATA - NOISE IS: " + this.noiseImplementation); 47 | } 48 | } 49 | 50 | static void loadInstance() { 51 | if (INSTANCE == null) { 52 | WorldServer world = DimensionManager.getWorld(0); 53 | if (world == null) return; 54 | 55 | MapStorage storage = world.mapStorage; 56 | if (storage == null) return; 57 | 58 | INSTANCE = (RwgWorldSavedData) storage.loadData(RwgWorldSavedData.class, DATA_NAME); 59 | if (INSTANCE == null) { 60 | INSTANCE = new RwgWorldSavedData(); 61 | storage.setData(DATA_NAME, INSTANCE); 62 | } 63 | } 64 | INSTANCE.markDirty(); 65 | } 66 | 67 | public static void setNoiseImplementation(NoiseImplementation ni) { 68 | loadInstance(); 69 | 70 | System.out.println("RWG SETTING NOISE: " + ni); 71 | INSTANCE.noiseImplementation = ni; 72 | } 73 | 74 | public static NoiseImplementation getNoiseImplementation() { 75 | loadInstance(); 76 | if (INSTANCE == null) { 77 | System.out.println("RWG COULD NOT LOAD GENERATION DATA - RETURNING UNKNOWN"); 78 | return NoiseImplementation.UNKNOWN; 79 | } 80 | 81 | return INSTANCE.noiseImplementation; 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /src/main/java/rwg/biomes/realistic/land/RealisticBiomeJungleCanyon.java: -------------------------------------------------------------------------------- 1 | package rwg.biomes.realistic.land; 2 | 3 | import java.util.Random; 4 | 5 | import net.minecraft.block.Block; 6 | import net.minecraft.init.Blocks; 7 | import net.minecraft.world.World; 8 | import net.minecraft.world.biome.BiomeGenBase; 9 | import net.minecraft.world.gen.feature.WorldGenBlockBlob; 10 | import net.minecraft.world.gen.feature.WorldGenerator; 11 | 12 | import rwg.api.RWGBiomes; 13 | import rwg.biomes.realistic.RealisticBiomeBase; 14 | import rwg.deco.trees.DecoJungleSmall; 15 | import rwg.surface.SurfaceBase; 16 | import rwg.surface.SurfaceGrassCanyon; 17 | import rwg.terrain.TerrainBase; 18 | import rwg.terrain.TerrainCanyon; 19 | import rwg.util.CellNoise; 20 | import rwg.util.NoiseGenerator; 21 | 22 | public class RealisticBiomeJungleCanyon extends RealisticBiomeBase { 23 | 24 | private TerrainBase terrain; 25 | private SurfaceBase surface; 26 | 27 | public RealisticBiomeJungleCanyon() { 28 | super(0, RWGBiomes.baseHotForest); 29 | 30 | terrain = new TerrainCanyon(true, 35f, 160f, 60f, 40f, 69f); 31 | surface = new SurfaceGrassCanyon(Blocks.grass, Blocks.dirt, (byte) 0); 32 | } 33 | 34 | @Override 35 | public void rDecorate(World world, Random rand, int chunkX, int chunkY, NoiseGenerator perlin, CellNoise cell, 36 | float strength, float river) { 37 | for (int l = 0; l < 1f * strength; ++l) { 38 | int i1 = chunkX + rand.nextInt(16) + 8; 39 | int j1 = chunkY + rand.nextInt(16) + 8; 40 | int k1 = world.getHeightValue(i1, j1); 41 | if (k1 < 70) { 42 | (new WorldGenBlockBlob(Blocks.mossy_cobblestone, 0)).generate(world, rand, i1, k1, j1); 43 | } 44 | } 45 | 46 | for (int a = 0; a < 5f * strength; a++) { 47 | int j6 = chunkX + rand.nextInt(16) + 8; 48 | int k10 = chunkY + rand.nextInt(16) + 8; 49 | int z52 = world.getHeightValue(j6, k10); 50 | 51 | WorldGenerator worldgenerator = new DecoJungleSmall( 52 | Blocks.log, 53 | 3, 54 | Blocks.leaves, 55 | 3, 56 | 1 + rand.nextInt(4), 57 | 0, 58 | 5f, 59 | 2, 60 | 0.32f, 61 | 0.14f); 62 | worldgenerator.setScale(1.0D, 1.0D, 1.0D); 63 | worldgenerator.generate(world, rand, j6, z52, k10); 64 | } 65 | } 66 | 67 | @Override 68 | public float rNoise(NoiseGenerator perlin, CellNoise cell, int x, int y, float ocean, float border, float river) { 69 | return terrain.generateNoise(perlin, cell, x, y, ocean, border, river); 70 | } 71 | 72 | @Override 73 | public void rReplace(Block[] blocks, byte[] metadata, int i, int j, int x, int y, int depth, World world, 74 | Random rand, NoiseGenerator perlin, CellNoise cell, float[] noise, float river, BiomeGenBase[] base) { 75 | surface.paintTerrain(blocks, metadata, i, j, x, y, depth, world, rand, perlin, cell, noise, river, base); 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /src/main/java/rwg/surface/SurfaceGrasslandMixBig.java: -------------------------------------------------------------------------------- 1 | package rwg.surface; 2 | 3 | import java.util.Random; 4 | 5 | import net.minecraft.block.Block; 6 | import net.minecraft.init.Blocks; 7 | import net.minecraft.world.World; 8 | import net.minecraft.world.biome.BiomeGenBase; 9 | 10 | import rwg.util.CellNoise; 11 | import rwg.util.CliffCalculator; 12 | import rwg.util.NoiseGenerator; 13 | 14 | public class SurfaceGrasslandMixBig extends SurfaceBase { 15 | 16 | private Block mixBlockTop; 17 | private Block mixBlockFill; 18 | private Block cliffBlock1; 19 | private Block cliffBlock2; 20 | private float width; 21 | private float height; 22 | private float smallW; 23 | private float smallS; 24 | 25 | public SurfaceGrasslandMixBig(Block top, Block filler, Block mixTop, Block mixFill, Block cliff1, Block cliff2, 26 | float mixWidth, float mixHeight, float smallWidth, float smallStrength) { 27 | super(top, filler); 28 | 29 | mixBlockTop = mixTop; 30 | mixBlockFill = mixFill; 31 | cliffBlock1 = cliff1; 32 | cliffBlock2 = cliff2; 33 | 34 | width = mixWidth; 35 | height = mixHeight; 36 | smallW = smallWidth; 37 | smallS = smallStrength; 38 | } 39 | 40 | @Override 41 | public void paintTerrain(Block[] blocks, byte[] metadata, int i, int j, int x, int y, int depth, World world, 42 | Random rand, NoiseGenerator perlin, CellNoise cell, float[] noise, float river, BiomeGenBase[] base) { 43 | float c = CliffCalculator.calc(x, y, noise); 44 | boolean cliff = c > 1.4f ? true : false; 45 | boolean mix = false; 46 | 47 | for (int k = 255; k > -1; k--) { 48 | Block b = blocks[(y * 16 + x) * 256 + k]; 49 | if (b == Blocks.air) { 50 | depth = -1; 51 | } else if (b == Blocks.stone) { 52 | depth++; 53 | 54 | if (cliff) { 55 | if (depth > -1 && depth < 2) { 56 | blocks[(y * 16 + x) * 256 + k] = rand.nextInt(3) == 0 ? cliffBlock2 : cliffBlock1; 57 | } else if (depth < 10) { 58 | blocks[(y * 16 + x) * 256 + k] = cliffBlock1; 59 | } 60 | } else { 61 | if (depth == 0 && k > 61) { 62 | if (perlin.noise2(i / width, j / width) + perlin.noise2(i / smallW, j / smallW) * smallS 63 | > height) { 64 | blocks[(y * 16 + x) * 256 + k] = mixBlockTop; 65 | mix = true; 66 | } else { 67 | blocks[(y * 16 + x) * 256 + k] = topBlock; 68 | } 69 | } else if (depth < 4) { 70 | if (mix) { 71 | blocks[(y * 16 + x) * 256 + k] = mixBlockFill; 72 | } else { 73 | blocks[(y * 16 + x) * 256 + k] = fillerBlock; 74 | } 75 | } 76 | } 77 | } 78 | } 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /src/main/java/rwg/deco/trees/DecoShrub.java: -------------------------------------------------------------------------------- 1 | package rwg.deco.trees; 2 | 3 | import java.util.Random; 4 | 5 | import net.minecraft.block.Block; 6 | import net.minecraft.block.material.Material; 7 | import net.minecraft.init.Blocks; 8 | import net.minecraft.world.World; 9 | import net.minecraft.world.gen.feature.WorldGenerator; 10 | 11 | public class DecoShrub extends WorldGenerator { 12 | 13 | private int size; 14 | private Block logBlock; 15 | private int logMeta; 16 | private Block leaveBlock; 17 | private int leaveMeta; 18 | private boolean sand; 19 | 20 | public DecoShrub(int s, int log, int leav) { 21 | this(s, log, leav, false); 22 | } 23 | 24 | public DecoShrub(int s, int log, int leav, boolean sa) { 25 | size = s; 26 | sand = sa; 27 | 28 | logBlock = log < 3 ? Blocks.log : Blocks.log2; 29 | logMeta = log > 2 ? log - 3 : log; 30 | 31 | leaveBlock = leav < 4 ? Blocks.leaves : Blocks.leaves2; 32 | leaveMeta = leav > 3 ? leav - 4 : leav; 33 | } 34 | 35 | @Override 36 | public boolean generate(World world, Random rand, int x, int y, int z) { 37 | int width = size > 6 ? 6 : size; 38 | int height = size > 3 ? 2 : 1; 39 | 40 | for (int i = 0; i < size; i++) { 41 | int rX = rand.nextInt(width * 2) - width; 42 | int rY = rand.nextInt(height); 43 | int rZ = rand.nextInt(width * 2) - width; 44 | 45 | if (i == 0 && size > 4) { 46 | buildLeaves(world, x + rX, y, z + rZ, 3); 47 | } else if (i == 1 && size > 2) { 48 | buildLeaves(world, x + rX, y, z + rZ, 2); 49 | } else { 50 | buildLeaves(world, x + rX, y + rY, z + rZ, 1); 51 | } 52 | } 53 | return true; 54 | } 55 | 56 | public void buildLeaves(World world, int x, int y, int z, int size) { 57 | Block b = world.getBlock(x, y - 2, z); 58 | if (b.getMaterial() == Material.grass || b.getMaterial() == Material.ground 59 | || (sand && b.getMaterial() == Material.sand)) { 60 | if (world.getBlock(x, y - 1, z) != Blocks.water) { 61 | for (int i = -size; i <= size; i++) { 62 | for (int j = -1; j <= 1; j++) { 63 | for (int k = -size; k <= size; k++) { 64 | if (Math.abs(i) + Math.abs(j) + Math.abs(k) <= size) { 65 | buildBlock(world, x + i, y + j, z + k, leaveBlock, leaveMeta); 66 | } 67 | } 68 | } 69 | } 70 | world.setBlock(x, y - 1, z, logBlock, logMeta, 0); 71 | } 72 | } 73 | } 74 | 75 | public void buildBlock(World world, int x, int y, int z, Block block, int meta) { 76 | Block b = world.getBlock(x, y, z); 77 | if (b.getMaterial() == Material.air || b.getMaterial() == Material.vine 78 | || b.getMaterial() == Material.plants 79 | || b == Blocks.snow_layer) { 80 | world.setBlock(x, y, z, block, meta, 0); 81 | } 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /src/main/java/rwg/map/MapVolcano.java: -------------------------------------------------------------------------------- 1 | package rwg.map; 2 | 3 | import java.util.Random; 4 | 5 | import net.minecraft.block.Block; 6 | import net.minecraft.init.Blocks; 7 | import net.minecraft.world.World; 8 | 9 | import rwg.util.CellNoise; 10 | import rwg.util.NoiseGenerator; 11 | import rwg.util.TerrainMath; 12 | 13 | public class MapVolcano { 14 | 15 | public static void build(Block[] blocks, byte[] metadata, World world, Random mapRand, int baseX, int baseY, 16 | int chunkX, int chunkY, NoiseGenerator perlin, CellNoise cell, float[] noise) { 17 | int i, j; 18 | float distance, height, obsidian; 19 | Block b; 20 | 21 | for (int x = 0; x < 16; x++) { 22 | for (int z = 0; z < 16; z++) { 23 | i = (chunkX * 16) + x; 24 | j = (chunkY * 16) + z; 25 | 26 | distance = (float) TerrainMath.dis2(i, j, baseX * 16, baseY * 16); 27 | obsidian = 140f + distance + perlin.noise2(i / 16f, j / 16f) * 15f; 28 | 29 | if (distance < 10 + perlin.noise2(i / 3f, j / 3f) * 1.5f) { 30 | height = perlin.noise2(i / 5f, j / 5f) * 2f; 31 | for (int y = 255; y > -1; y--) { 32 | if (y > 165) { 33 | if (blocks[cta(x, y, z)] != Blocks.air) { 34 | blocks[cta(x, y, z)] = Blocks.air; 35 | } 36 | } else if (y > obsidian && y < 156 + height) { 37 | blocks[cta(x, y, z)] = Blocks.obsidian; 38 | } else if (y < 166) { 39 | blocks[cta(x, y, z)] = Blocks.lava; 40 | } else if (y < obsidian + 1) { 41 | if (blocks[cta(x, y, z)] == Blocks.air) { 42 | blocks[cta(x, y, z)] = Blocks.stone; 43 | } else { 44 | break; 45 | } 46 | } 47 | } 48 | } else { 49 | height = 190f - (distance + perlin.noise2(i / 12f, j / 12f) * 5f) * 1.7f; 50 | if (height > noise[x * 16 + z]) { 51 | noise[x * 16 + z] = height; 52 | } 53 | 54 | for (int y = 255; y > -1; y--) { 55 | if (y <= height) { 56 | b = blocks[cta(x, y, z)]; 57 | if (b == Blocks.air) { 58 | if (y > obsidian) { 59 | b = Blocks.obsidian; 60 | } else { 61 | b = Blocks.stone; 62 | } 63 | } else { 64 | break; 65 | } 66 | blocks[cta(x, y, z)] = b; 67 | } 68 | } 69 | } 70 | } 71 | } 72 | } 73 | 74 | public static int cta(int x, int y, int z) { 75 | return (x * 16 + z) * 256 + y; 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /src/main/java/rwg/deco/DecoBlob.java: -------------------------------------------------------------------------------- 1 | package rwg.deco; 2 | 3 | import java.util.Random; 4 | 5 | import net.minecraft.block.Block; 6 | import net.minecraft.init.Blocks; 7 | import net.minecraft.world.World; 8 | import net.minecraft.world.gen.feature.WorldGenerator; 9 | 10 | import rwg.config.ConfigRWG; 11 | 12 | public class DecoBlob extends WorldGenerator { 13 | 14 | private Block field_150545_a; 15 | private int field_150544_b; 16 | 17 | public DecoBlob(Block p_i45450_1_, int p_i45450_2_) { 18 | super(false); 19 | this.field_150545_a = p_i45450_1_; 20 | this.field_150544_b = p_i45450_2_; 21 | } 22 | 23 | public boolean generate(World p_76484_1_, Random p_76484_2_, int p_76484_3_, int p_76484_4_, int p_76484_5_) { 24 | if ((field_150545_a == Blocks.mossy_cobblestone || field_150545_a == Blocks.cobblestone) 25 | && !ConfigRWG.enableCobblestoneBoulders) { 26 | return false; 27 | } 28 | 29 | while (true) { 30 | if (p_76484_4_ > 3) { 31 | label63: { 32 | if (!p_76484_1_.isAirBlock(p_76484_3_, p_76484_4_ - 1, p_76484_5_)) { 33 | Block block = p_76484_1_.getBlock(p_76484_3_, p_76484_4_ - 1, p_76484_5_); 34 | 35 | if (block == Blocks.grass || block == Blocks.dirt 36 | || block == Blocks.stone 37 | || block == Blocks.gravel 38 | || block == Blocks.sand) { 39 | break label63; 40 | } 41 | } 42 | 43 | --p_76484_4_; 44 | continue; 45 | } 46 | } 47 | 48 | if (p_76484_4_ <= 3) { 49 | return false; 50 | } 51 | 52 | int k2 = this.field_150544_b; 53 | 54 | for (int l = 0; k2 >= 0 && l < 3; ++l) { 55 | int i1 = k2 + p_76484_2_.nextInt(2); 56 | int j1 = k2 + p_76484_2_.nextInt(2); 57 | int k1 = k2 + p_76484_2_.nextInt(2); 58 | float f = (float) (i1 + j1 + k1) * 0.333F + 0.5F; 59 | 60 | for (int l1 = p_76484_3_ - i1; l1 <= p_76484_3_ + i1; ++l1) { 61 | for (int i2 = p_76484_5_ - k1; i2 <= p_76484_5_ + k1; ++i2) { 62 | for (int j2 = p_76484_4_ - j1; j2 <= p_76484_4_ + j1; ++j2) { 63 | float f1 = (float) (l1 - p_76484_3_); 64 | float f2 = (float) (i2 - p_76484_5_); 65 | float f3 = (float) (j2 - p_76484_4_); 66 | 67 | if (f1 * f1 + f2 * f2 + f3 * f3 <= f * f) { 68 | p_76484_1_.setBlock(l1, j2, i2, this.field_150545_a, 0, 4); 69 | } 70 | } 71 | } 72 | } 73 | 74 | p_76484_3_ += -(k2 + 1) + p_76484_2_.nextInt(2 + k2 * 2); 75 | p_76484_5_ += -(k2 + 1) + p_76484_2_.nextInt(2 + k2 * 2); 76 | p_76484_4_ += 0 - p_76484_2_.nextInt(2); 77 | } 78 | 79 | return true; 80 | } 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%"=="" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%"=="" set DIRNAME=. 29 | @rem This is normally unused 30 | set APP_BASE_NAME=%~n0 31 | set APP_HOME=%DIRNAME% 32 | 33 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 34 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 35 | 36 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 37 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 38 | 39 | @rem Find java.exe 40 | if defined JAVA_HOME goto findJavaFromJavaHome 41 | 42 | set JAVA_EXE=java.exe 43 | %JAVA_EXE% -version >NUL 2>&1 44 | if %ERRORLEVEL% equ 0 goto execute 45 | 46 | echo. 1>&2 47 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 48 | echo. 1>&2 49 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 50 | echo location of your Java installation. 1>&2 51 | 52 | goto fail 53 | 54 | :findJavaFromJavaHome 55 | set JAVA_HOME=%JAVA_HOME:"=% 56 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 57 | 58 | if exist "%JAVA_EXE%" goto execute 59 | 60 | echo. 1>&2 61 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 62 | echo. 1>&2 63 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 64 | echo location of your Java installation. 1>&2 65 | 66 | goto fail 67 | 68 | :execute 69 | @rem Setup the command line 70 | 71 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 72 | 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if %ERRORLEVEL% equ 0 goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | set EXIT_CODE=%ERRORLEVEL% 85 | if %EXIT_CODE% equ 0 set EXIT_CODE=1 86 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% 87 | exit /b %EXIT_CODE% 88 | 89 | :mainEnd 90 | if "%OS%"=="Windows_NT" endlocal 91 | 92 | :omega 93 | -------------------------------------------------------------------------------- /src/main/java/rwg/biomes/realistic/land/RealisticBiomeJungleHills.java: -------------------------------------------------------------------------------- 1 | package rwg.biomes.realistic.land; 2 | 3 | import java.util.Random; 4 | 5 | import net.minecraft.block.Block; 6 | import net.minecraft.init.Blocks; 7 | import net.minecraft.world.World; 8 | import net.minecraft.world.biome.BiomeGenBase; 9 | import net.minecraft.world.gen.feature.WorldGenMegaJungle; 10 | import net.minecraft.world.gen.feature.WorldGenShrub; 11 | import net.minecraft.world.gen.feature.WorldGenTrees; 12 | import net.minecraft.world.gen.feature.WorldGenerator; 13 | 14 | import rwg.api.RWGBiomes; 15 | import rwg.biomes.realistic.RealisticBiomeBase; 16 | import rwg.deco.DecoGrass; 17 | import rwg.surface.SurfaceBase; 18 | import rwg.surface.SurfaceMountainStone; 19 | import rwg.terrain.TerrainBase; 20 | import rwg.terrain.TerrainHilly; 21 | import rwg.util.CellNoise; 22 | import rwg.util.NoiseGenerator; 23 | 24 | public class RealisticBiomeJungleHills extends RealisticBiomeBase { 25 | 26 | private TerrainBase terrain; 27 | private SurfaceBase surface; 28 | 29 | public RealisticBiomeJungleHills() { 30 | super(0, RWGBiomes.baseJungle); 31 | terrain = new TerrainHilly(230f, 120f, 50f); 32 | surface = new SurfaceMountainStone(Blocks.grass, Blocks.dirt, false, null, 1f, 1.5f, 60f, 65f, 1.5f); 33 | } 34 | 35 | @Override 36 | public void rDecorate(World world, Random rand, int chunkX, int chunkY, NoiseGenerator perlin, CellNoise cell, 37 | float strength, float river) { 38 | for (int b33 = 0; b33 < 2; b33++) { 39 | int j6 = chunkX + rand.nextInt(16) + 8; 40 | int k10 = chunkY + rand.nextInt(16) + 8; 41 | int z52 = world.getHeightValue(j6, k10); 42 | 43 | if (z52 < 100 || rand.nextInt(3) == 0) { 44 | WorldGenerator worldgenerator = rand.nextInt(5) == 0 ? new WorldGenShrub(0, 0) 45 | : rand.nextInt(3) == 0 ? new WorldGenMegaJungle(false, 5, 10, 3, 3) 46 | : new WorldGenTrees(false, 3 + rand.nextInt(5), 3, 3, true); 47 | worldgenerator.setScale(1.0D, 1.0D, 1.0D); 48 | worldgenerator.generate(world, rand, j6, z52, k10); 49 | } 50 | } 51 | 52 | for (int l14 = 0; l14 < 15; l14++) { 53 | int l19 = chunkX + rand.nextInt(16) + 8; 54 | int k22 = rand.nextInt(128); 55 | int j24 = chunkY + rand.nextInt(16) + 8; 56 | 57 | if (rand.nextInt(6) == 0) { 58 | (new DecoGrass(Blocks.double_plant, 2)).generate(world, rand, l19, k22, j24); 59 | } else { 60 | (new DecoGrass(Blocks.tallgrass, 1)).generate(world, rand, l19, k22, j24); 61 | } 62 | } 63 | } 64 | 65 | public float rNoise(NoiseGenerator perlin, CellNoise cell, int x, int y, float ocean, float border, float river) { 66 | return terrain.generateNoise(perlin, cell, x, y, ocean, border, river); 67 | } 68 | 69 | public void rReplace(Block[] blocks, byte[] metadata, int i, int j, int x, int y, int depth, World world, 70 | Random rand, NoiseGenerator perlin, CellNoise cell, float[] noise, float river, BiomeGenBase[] base) { 71 | surface.paintTerrain(blocks, metadata, i, j, x, y, depth, world, rand, perlin, cell, noise, river, base); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /src/main/java/rwg/surface/SurfaceDesertOasis.java: -------------------------------------------------------------------------------- 1 | package rwg.surface; 2 | 3 | import java.util.Random; 4 | 5 | import net.minecraft.block.Block; 6 | import net.minecraft.init.Blocks; 7 | import net.minecraft.world.World; 8 | import net.minecraft.world.biome.BiomeGenBase; 9 | 10 | import rwg.util.CellNoise; 11 | import rwg.util.CliffCalculator; 12 | import rwg.util.NoiseGenerator; 13 | 14 | public class SurfaceDesertOasis extends SurfaceBase { 15 | 16 | private Block cliffBlock1; 17 | private Block cliffBlock2; 18 | private byte sandMetadata; 19 | private int cliffType; 20 | 21 | public SurfaceDesertOasis(Block top, Block filler, Block cliff1, Block cliff2, byte metadata, int cliff) { 22 | super(top, filler); 23 | 24 | cliffBlock1 = cliff1; 25 | cliffBlock2 = cliff2; 26 | sandMetadata = metadata; 27 | cliffType = cliff; 28 | } 29 | 30 | @Override 31 | public void paintTerrain(Block[] blocks, byte[] metadata, int i, int j, int x, int y, int depth, World world, 32 | Random rand, NoiseGenerator perlin, CellNoise cell, float[] noise, float river, BiomeGenBase[] base) { 33 | float c = CliffCalculator.calc(x, y, noise); 34 | boolean cliff = c > 1.3f ? true : false; 35 | boolean dirt = false; 36 | 37 | for (int k = 255; k > -1; k--) { 38 | Block b = blocks[(y * 16 + x) * 256 + k]; 39 | if (b == Blocks.air) { 40 | depth = -1; 41 | } else if (b == Blocks.stone) { 42 | depth++; 43 | 44 | if (cliff) { 45 | if (cliffType == 1) { 46 | if (depth < 6) { 47 | blocks[(y * 16 + x) * 256 + k] = cliffBlock1; 48 | metadata[(y * 16 + x) * 256 + k] = 14; 49 | } 50 | } else { 51 | if (depth > -1 && depth < 2) { 52 | blocks[(y * 16 + x) * 256 + k] = rand.nextInt(3) == 0 ? cliffBlock2 : cliffBlock1; 53 | } else if (depth < 10) { 54 | blocks[(y * 16 + x) * 256 + k] = cliffBlock1; 55 | } 56 | } 57 | } else if (depth < 6) { 58 | if (depth == 0 && k > 61) { 59 | if (perlin.noise2(i / 12f, j / 12f) > -0.3f + ((k - 61f) / 15f)) { 60 | dirt = true; 61 | blocks[(y * 16 + x) * 256 + k] = topBlock; 62 | } else { 63 | blocks[(y * 16 + x) * 256 + k] = Blocks.sand; 64 | metadata[(y * 16 + x) * 256 + k] = sandMetadata; 65 | } 66 | } else if (depth < 4) { 67 | if (dirt) { 68 | blocks[(y * 16 + x) * 256 + k] = fillerBlock; 69 | } else { 70 | blocks[(y * 16 + x) * 256 + k] = Blocks.sand; 71 | metadata[(y * 16 + x) * 256 + k] = sandMetadata; 72 | } 73 | } else if (!dirt) { 74 | blocks[(y * 16 + x) * 256 + k] = Blocks.sandstone; 75 | } 76 | } 77 | } 78 | } 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /src/main/java/rwg/deco/trees/DecoSmallSpruce.java: -------------------------------------------------------------------------------- 1 | package rwg.deco.trees; 2 | 3 | import java.util.Random; 4 | 5 | import net.minecraft.block.Block; 6 | import net.minecraft.init.Blocks; 7 | import net.minecraft.world.World; 8 | import net.minecraft.world.gen.feature.WorldGenerator; 9 | 10 | public class DecoSmallSpruce extends WorldGenerator { 11 | 12 | private int treeSize; 13 | 14 | public DecoSmallSpruce(int s) { 15 | treeSize = s; 16 | } 17 | 18 | public boolean generate(World world, Random rand, int x, int y, int z) { 19 | Block g = world.getBlock(x, y - 1, z); 20 | if (g != Blocks.grass && g != Blocks.dirt) { 21 | return false; 22 | } 23 | 24 | int leavesMeta = rand.nextInt(2); 25 | 26 | int start = 1; 27 | int small = 2; 28 | int large = 0; 29 | if (treeSize == 1) { 30 | small = 2; 31 | large = 2; 32 | } else if (treeSize == 2) { 33 | start = 1 + rand.nextInt(2); 34 | small = 3; 35 | large = 3; 36 | } 37 | 38 | int i, j, k; 39 | for (i = 0; i < start; i++) { 40 | world.setBlock(x, y, z, Blocks.log, 0, 0); 41 | y++; 42 | } 43 | 44 | for (i = 0; i < large; i++) { 45 | for (j = -2; j <= 2; j++) { 46 | for (k = -2; k <= 2; k++) { 47 | if (Math.abs(j) + Math.abs(k) != 4 48 | && ((j > -2 && k > -2 && j < 2 && k < 2) || rand.nextInt(4) != 0)) { 49 | world.setBlock(x + j, y, z + k, Blocks.leaves, leavesMeta, 0); 50 | } 51 | } 52 | } 53 | world.setBlock(x, y, z, Blocks.log, 0, 0); 54 | y++; 55 | } 56 | 57 | for (i = 0; i < small; i++) { 58 | for (j = -1; j <= 1; j++) { 59 | for (k = -1; k <= 1; k++) { 60 | if (Math.abs(j) + Math.abs(k) < 2 || (rand.nextInt(4) != 0)) { 61 | world.setBlock(x + j, y, z + k, Blocks.leaves, leavesMeta, 0); 62 | } 63 | } 64 | } 65 | 66 | if (i == 0) { 67 | world.setBlock(x + 1, y, z, Blocks.leaves, leavesMeta, 0); 68 | world.setBlock(x - 1, y, z, Blocks.leaves, leavesMeta, 0); 69 | world.setBlock(x, y, z + 1, Blocks.leaves, leavesMeta, 0); 70 | world.setBlock(x, y, z - 1, Blocks.leaves, leavesMeta, 0); 71 | world.setBlock(x + 2, y, z, Blocks.leaves, leavesMeta, 0); 72 | world.setBlock(x - 2, y, z, Blocks.leaves, leavesMeta, 0); 73 | world.setBlock(x, y, z + 2, Blocks.leaves, leavesMeta, 0); 74 | world.setBlock(x, y, z - 2, Blocks.leaves, leavesMeta, 0); 75 | } 76 | 77 | world.setBlock(x, y, z, Blocks.log, 0, 0); 78 | y++; 79 | } 80 | 81 | world.setBlock(x, y, z, Blocks.log, 0, 0); 82 | world.setBlock(x + 1, y, z, Blocks.leaves, leavesMeta, 0); 83 | world.setBlock(x - 1, y, z, Blocks.leaves, leavesMeta, 0); 84 | world.setBlock(x, y, z + 1, Blocks.leaves, leavesMeta, 0); 85 | world.setBlock(x, y, z - 1, Blocks.leaves, leavesMeta, 0); 86 | 87 | world.setBlock(x, y + 1, z, Blocks.leaves, leavesMeta, 0); 88 | world.setBlock(x, y + 2, z, Blocks.leaves, leavesMeta, 0); 89 | return true; 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /src/main/java/rwg/surface/SurfaceTundra.java: -------------------------------------------------------------------------------- 1 | package rwg.surface; 2 | 3 | import java.util.Random; 4 | 5 | import net.minecraft.block.Block; 6 | import net.minecraft.init.Blocks; 7 | import net.minecraft.world.World; 8 | import net.minecraft.world.biome.BiomeGenBase; 9 | 10 | import rwg.util.CellNoise; 11 | import rwg.util.CliffCalculator; 12 | import rwg.util.NoiseGenerator; 13 | 14 | public class SurfaceTundra extends SurfaceBase { 15 | 16 | public SurfaceTundra(Block top, Block fill) { 17 | super(top, fill); 18 | } 19 | 20 | @Override 21 | public void paintTerrain(Block[] blocks, byte[] metadata, int i, int j, int x, int y, int depth, World world, 22 | Random rand, NoiseGenerator perlin, CellNoise cell, float[] noise, float river, BiomeGenBase[] base) { 23 | float p = perlin.noise2(i / 8f, j / 8f) * 0.5f; 24 | float c = CliffCalculator.calc(x, y, noise); 25 | int cliff = 0; 26 | boolean gravel = false; 27 | 28 | Block b; 29 | for (int k = 255; k > -1; k--) { 30 | b = blocks[(y * 16 + x) * 256 + k]; 31 | if (b == Blocks.air) { 32 | depth = -1; 33 | } else if (b == Blocks.stone) { 34 | depth++; 35 | 36 | if (depth == 0) { 37 | if (k < 63) { 38 | gravel = true; 39 | } 40 | 41 | if (c > 0.45f && c > 1.5f - ((k - 60f) / 65f) + p) { 42 | cliff = 1; 43 | } 44 | if (c > 1.5f) { 45 | cliff = 2; 46 | } 47 | if (k > 110 + (p * 4) && c < 0.3f + ((k - 100f) / 50f) + p) { 48 | cliff = 3; 49 | } 50 | 51 | if (cliff == 1) { 52 | blocks[(y * 16 + x) * 256 + k] = rand.nextInt(3) == 0 ? Blocks.cobblestone : Blocks.stone; 53 | } else if (cliff == 2) { 54 | blocks[(y * 16 + x) * 256 + k] = Blocks.stained_hardened_clay; 55 | metadata[(y * 16 + x) * 256 + k] = 9; 56 | } else if (cliff == 3) { 57 | blocks[(y * 16 + x) * 256 + k] = Blocks.snow; 58 | } else if (perlin.noise2(i / 50f, j / 50f) + p * 0.6f > 0.24f) { 59 | blocks[(y * 16 + x) * 256 + k] = Blocks.dirt; 60 | metadata[(y * 16 + x) * 256 + k] = 2; 61 | } else if (k < 63) { 62 | blocks[(y * 16 + x) * 256 + k] = Blocks.gravel; 63 | gravel = true; 64 | } else { 65 | blocks[(y * 16 + x) * 256 + k] = Blocks.grass; 66 | } 67 | } else if (depth < 6) { 68 | if (cliff == 1) { 69 | blocks[(y * 16 + x) * 256 + k] = Blocks.stone; 70 | } else if (cliff == 2) { 71 | blocks[(y * 16 + x) * 256 + k] = Blocks.stained_hardened_clay; 72 | metadata[(y * 16 + x) * 256 + k] = 9; 73 | } else if (cliff == 3) { 74 | blocks[(y * 16 + x) * 256 + k] = Blocks.snow; 75 | } else if (gravel) { 76 | blocks[(y * 16 + x) * 256 + k] = Blocks.gravel; 77 | } else { 78 | blocks[(y * 16 + x) * 256 + k] = Blocks.dirt; 79 | } 80 | } 81 | } 82 | } 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /src/main/java/rwg/biomes/realistic/coast/RealisticBiomeCoastIce.java: -------------------------------------------------------------------------------- 1 | package rwg.biomes.realistic.coast; 2 | 3 | import java.util.Random; 4 | 5 | import net.minecraft.block.Block; 6 | import net.minecraft.init.Blocks; 7 | import net.minecraft.world.World; 8 | import net.minecraft.world.biome.BiomeGenBase; 9 | 10 | import rwg.api.RWGBiomes; 11 | import rwg.biomes.realistic.RealisticBiomeBase; 12 | import rwg.surface.SurfaceBase; 13 | import rwg.surface.SurfaceGrassland; 14 | import rwg.util.CellNoise; 15 | import rwg.util.CliffCalculator; 16 | import rwg.util.NoiseGenerator; 17 | import rwg.util.SnowheightCalculator; 18 | 19 | public class RealisticBiomeCoastIce extends RealisticBiomeBase { 20 | 21 | private SurfaceBase surface; 22 | 23 | public RealisticBiomeCoastIce() { 24 | super(0, RWGBiomes.baseSnowDesert); 25 | 26 | surface = new SurfaceGrassland(Blocks.packed_ice, Blocks.packed_ice, Blocks.packed_ice, Blocks.ice); 27 | } 28 | 29 | @Override 30 | public void rDecorate(World world, Random rand, int chunkX, int chunkY, NoiseGenerator perlin, CellNoise cell, 31 | float strength, float river) {} 32 | 33 | @Override 34 | public float rNoise(NoiseGenerator perlin, CellNoise cell, int x, int y, float ocean, float border, float river) { 35 | river = river > 0.5f ? 1f : river * 2f; 36 | 37 | float start = (perlin.noise2(x / 90f, y / 90f) * 1f) + (perlin.noise2(x / 40f, y / 40f) * 0.15f) 38 | + (perlin.noise2(x / 9f, y / 9f) * 0.07f); 39 | 40 | float h = 0f; 41 | float c = 0f; 42 | if (ocean + start > 1.4f) { 43 | c = ocean + start > 1.5f ? 0.1f : (ocean + start) - 1.4f; 44 | c *= 250 + perlin.noise2(x / 50f, y / 50f) * 25f; 45 | } 46 | 47 | if (ocean < 1.3f) { 48 | float st = (1.3f - ocean) * 20f; 49 | st = st > 1f ? 1f : st; 50 | 51 | h += perlin.noise2(x / 12f, y / 12f); 52 | h += perlin.noise2(x / 20f, y / 20f) * 2; 53 | } 54 | 55 | return 55f + h + (c * river); 56 | } 57 | 58 | @Override 59 | public void rReplace(Block[] blocks, byte[] metadata, int i, int j, int x, int y, int depth, World world, 60 | Random rand, NoiseGenerator perlin, CellNoise cell, float[] noise, float river, BiomeGenBase[] base) { 61 | float c = CliffCalculator.calc(x, y, noise); 62 | boolean cliff = c > 1.4f ? true : false; 63 | int type = 0; 64 | 65 | for (int k = 255; k > -1; k--) { 66 | Block b = blocks[(y * 16 + x) * 256 + k]; 67 | if (b == Blocks.air) { 68 | depth = -1; 69 | } else if (b == Blocks.stone) { 70 | depth++; 71 | 72 | if (cliff) { 73 | if (depth == 0) { 74 | type = perlin.noise2(i / 5f, j / 5f) > 0f ? 1 : 0; 75 | } 76 | 77 | if (depth < 10) { 78 | blocks[(y * 16 + x) * 256 + k] = type == 0 ? Blocks.packed_ice : Blocks.ice; 79 | } 80 | } else { 81 | if (depth < 5 && k > 61) { 82 | blocks[(y * 16 + x) * 256 + k] = Blocks.snow; 83 | if (depth == 0 && k > 61 && k < 254) { 84 | SnowheightCalculator.calc(x, y, k, blocks, metadata, noise); 85 | } 86 | } else if (depth < 3) { 87 | blocks[(y * 16 + x) * 256 + k] = Blocks.gravel; 88 | } 89 | } 90 | } 91 | } 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /src/main/java/rwg/deco/trees/DecoRedWood.java: -------------------------------------------------------------------------------- 1 | package rwg.deco.trees; 2 | 3 | import java.util.Random; 4 | 5 | import net.minecraft.block.Block; 6 | import net.minecraft.init.Blocks; 7 | import net.minecraft.world.World; 8 | import net.minecraft.world.gen.feature.WorldGenerator; 9 | 10 | public class DecoRedWood extends WorldGenerator { 11 | 12 | private int height; 13 | private int leaves; 14 | private int trunk; 15 | private int metadata; 16 | 17 | public DecoRedWood(int h, int l, int t, int m) { 18 | height = h; 19 | leaves = l; 20 | trunk = t; 21 | metadata = m; 22 | } 23 | 24 | public boolean generate(World world, Random rand, int x, int y, int z) { 25 | Block g = world.getBlock(x, y - 1, z); 26 | if (g != Blocks.grass && g != Blocks.dirt && g != Blocks.sand) { 27 | return false; 28 | } 29 | 30 | for (int l1 = 0; l1 < 5; l1++) { 31 | genLeaves(world, rand, x - 1 + rand.nextInt(3), y + height - l1, z - 1 + rand.nextInt(3), 1); 32 | genLeaves(world, rand, x - 1 + rand.nextInt(3), y + height - l1, z - 1 + rand.nextInt(3), 1); 33 | } 34 | for (int l2 = 5; l2 < leaves; l2++) { 35 | genLeaves(world, rand, x - 2 + rand.nextInt(5), y + height - l2, z - 2 + rand.nextInt(5), 2); 36 | if (rand.nextBoolean()) { 37 | genLeaves(world, rand, x - 2 + rand.nextInt(5), y + height - l2, z - 2 + rand.nextInt(5), 2); 38 | } 39 | } 40 | 41 | for (int i = 0; i < height; i++) { 42 | world.setBlock(x, y + i, z, Blocks.log, 0, 0); 43 | } 44 | world.setBlock(x, y + height, z, Blocks.leaves, metadata, 0); 45 | createTrunk(world, rand, x, y, z); 46 | 47 | return true; 48 | } 49 | 50 | public void genLeaves(World world, Random rand, int x, int y, int z, int size) { 51 | int i; 52 | int j; 53 | int dis; 54 | for (i = -1; i <= 1; i++) { 55 | for (j = -1; j <= 1; j++) { 56 | dis = Math.abs(i) + Math.abs(j); 57 | if (world.isAirBlock(x + i, y + 1, z + j) && (dis < size - 1 || (dis < size && rand.nextBoolean()))) { 58 | world.setBlock(x + i, y + 1, z + j, Blocks.leaves, metadata, 0); 59 | } 60 | } 61 | } 62 | 63 | for (i = -2; i <= 2; i++) { 64 | for (j = -2; j <= 2; j++) { 65 | dis = Math.abs(i) + Math.abs(j); 66 | if (world.isAirBlock(x + i, y, z + j) 67 | && (dis < size * 2 - 1 || (dis < size * 2 && rand.nextBoolean()))) { 68 | world.setBlock(x + i, y, z + j, Blocks.leaves, metadata, 0); 69 | } 70 | } 71 | } 72 | 73 | if (size > 1) { 74 | world.setBlock(x, y, z, Blocks.log, 12, 0); 75 | } 76 | } 77 | 78 | private void createTrunk(World world, Random rand, int x, int y, int z) { 79 | int[] pos = new int[] { 0, 0, 1, 0, 0, 1, -1, 0, 0, -1, 1, 1, 1, -1, -1, 1, -1, -1 }; 80 | int sh; 81 | Block b; 82 | for (int t = 0; t < 9; t++) { 83 | sh = pos[t * 2] == 0 || pos[t * 2 + 1] == 0 ? rand.nextInt(trunk * 2) + y + trunk 84 | : rand.nextInt(trunk) + y - 1; 85 | while (sh > y - 2) { 86 | if (world.getBlock(x + pos[t * 2], sh, z + pos[t * 2 + 1]) == Blocks.grass) { 87 | break; 88 | } 89 | world.setBlock(x + pos[t * 2], sh, z + pos[t * 2 + 1], Blocks.log, 12, 0); 90 | sh--; 91 | } 92 | } 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /src/main/java/rwg/commands/RwgNoiseCommand.java: -------------------------------------------------------------------------------- 1 | package rwg.commands; 2 | 3 | import java.util.Locale; 4 | 5 | import net.minecraft.command.CommandBase; 6 | import net.minecraft.command.ICommandSender; 7 | import net.minecraft.command.WrongUsageException; 8 | import net.minecraft.util.ChatComponentTranslation; 9 | 10 | import rwg.util.NoiseGeneratorWrapper; 11 | import rwg.util.NoiseImplementation; 12 | import rwg.world.RwgWorldSavedData; 13 | 14 | public class RwgNoiseCommand extends CommandBase { 15 | 16 | @Override 17 | public String getCommandName() { 18 | return "rwg_noise"; 19 | } 20 | 21 | @Override 22 | public String getCommandUsage(ICommandSender sender) { 23 | return "/rwg_noise get|opensimplex|perlin"; 24 | } 25 | 26 | @Override 27 | public void processCommand(ICommandSender sender, String[] args) { 28 | 29 | if (args.length < 1) { 30 | throw new WrongUsageException(this.getCommandUsage(sender)); 31 | } 32 | 33 | NoiseImplementation current = RwgWorldSavedData.getNoiseImplementation(); 34 | 35 | if (args[0].equals("get")) { 36 | sender.addChatMessage(new ChatComponentTranslation("rwg.noise.current_type", current)); 37 | return; 38 | } 39 | 40 | NoiseImplementation noiseImplementation = NoiseImplementation.valueOf(args[0].toUpperCase(Locale.ROOT)); 41 | final boolean wasDynamic; 42 | switch (current) { 43 | case UNKNOWN: 44 | case DYNAMICPERLIN: 45 | case DYNAMICOPENSIMPLEX: 46 | wasDynamic = true; 47 | break; 48 | case PERLIN: 49 | case OPENSIMPLEX: 50 | wasDynamic = false; 51 | break; 52 | default: 53 | throw new IllegalStateException( 54 | "Invalid current noise implementation value: " + noiseImplementation.toString()); 55 | } 56 | 57 | if (current != noiseImplementation) { 58 | switch (noiseImplementation) { 59 | case UNKNOWN: 60 | NoiseGeneratorWrapper.useOpenSimplex = false; 61 | sender.addChatMessage(new ChatComponentTranslation("rwg.noise.was_set_to.unknown")); 62 | break; 63 | case DYNAMICPERLIN: 64 | case PERLIN: 65 | NoiseGeneratorWrapper.useOpenSimplex = false; 66 | sender.addChatMessage( 67 | new ChatComponentTranslation( 68 | "rwg.noise.was_set_to.generic", 69 | noiseImplementation.toString())); 70 | break; 71 | case DYNAMICOPENSIMPLEX: 72 | case OPENSIMPLEX: 73 | NoiseGeneratorWrapper.useOpenSimplex = true; 74 | sender.addChatMessage( 75 | new ChatComponentTranslation( 76 | "rwg.noise.was_set_to.generic", 77 | noiseImplementation.toString())); 78 | break; 79 | } 80 | if (wasDynamic) { 81 | sender.addChatMessage(new ChatComponentTranslation("rwg.noise.instant_new_chunks")); 82 | } else { 83 | sender.addChatMessage(new ChatComponentTranslation("rwg.noise.needs_restart")); 84 | } 85 | } else { 86 | sender.addChatMessage(new ChatComponentTranslation("rwg.noise.unchanged")); 87 | } 88 | 89 | RwgWorldSavedData.setNoiseImplementation(noiseImplementation); 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /src/main/java/rwg/support/edit/EditRiverOasis.java: -------------------------------------------------------------------------------- 1 | package rwg.support.edit; 2 | 3 | import java.util.Random; 4 | 5 | import net.minecraft.init.Blocks; 6 | import net.minecraft.world.World; 7 | import net.minecraft.world.gen.feature.WorldGenPumpkin; 8 | import net.minecraft.world.gen.feature.WorldGenReed; 9 | import net.minecraft.world.gen.feature.WorldGenShrub; 10 | import net.minecraft.world.gen.feature.WorldGenerator; 11 | 12 | import rwg.deco.DecoCacti; 13 | import rwg.deco.DecoFlowers; 14 | import rwg.deco.DecoGrass; 15 | import rwg.deco.trees.DecoSavannah; 16 | import rwg.util.CellNoise; 17 | import rwg.util.NoiseGenerator; 18 | 19 | public class EditRiverOasis extends EditBase { 20 | 21 | public EditRiverOasis() {} 22 | 23 | @Override 24 | public void decorate(World world, Random rand, int chunkX, int chunkY, NoiseGenerator perlin, CellNoise cell, 25 | float strength, float river) { 26 | if (river > 0.7f) { 27 | if (river > 0.86f) { 28 | for (int b33 = 0; b33 < 10f * strength; b33++) { 29 | int j6 = chunkX + rand.nextInt(16) + 8; 30 | int k10 = chunkY + rand.nextInt(16) + 8; 31 | int z52 = world.getHeightValue(j6, k10); 32 | 33 | if (z52 < 100f || (z52 < 120f && rand.nextInt(10) == 0)) { 34 | WorldGenerator worldgenerator = rand.nextInt(4) != 0 ? new WorldGenShrub(0, 0) 35 | : new DecoSavannah(1); 36 | worldgenerator.setScale(1.0D, 1.0D, 1.0D); 37 | worldgenerator.generate(world, rand, j6, z52, k10); 38 | } 39 | } 40 | } 41 | 42 | for (int k18 = 0; k18 < 12f * strength; k18++) { 43 | int k21 = chunkX + rand.nextInt(16) + 8; 44 | int j23 = rand.nextInt(160); 45 | int k24 = chunkY + rand.nextInt(16) + 8; 46 | if (j23 < 120f) { 47 | (new DecoCacti(false)).generate(world, rand, k21, j23, k24); 48 | } 49 | } 50 | 51 | for (int f25 = 0; f25 < 2f * strength; f25++) { 52 | int i18 = chunkX + rand.nextInt(16) + 8; 53 | int i23 = chunkY + rand.nextInt(16) + 8; 54 | (new WorldGenReed()).generate(world, rand, i18, 60 + rand.nextInt(8), i23); 55 | } 56 | 57 | if (rand.nextInt(28) == 0) { 58 | int j16 = chunkX + rand.nextInt(16) + 8; 59 | int j18 = rand.nextInt(128); 60 | int j21 = chunkY + rand.nextInt(16) + 8; 61 | (new WorldGenPumpkin()).generate(world, rand, j16, j18, j21); 62 | } 63 | 64 | for (int f23 = 0; f23 < 3; f23++) { 65 | int j15 = chunkX + rand.nextInt(16) + 8; 66 | int j17 = rand.nextInt(128); 67 | int j20 = chunkY + rand.nextInt(16) + 8; 68 | (new DecoFlowers(new int[] { 9, 9, 9, 9, 3, 3, 3, 3, 3, 2, 2, 2, 11, 11, 11 })) 69 | .generate(world, rand, j15, j17, j20); 70 | } 71 | 72 | for (int l14 = 0; l14 < 15; l14++) { 73 | int l19 = chunkX + rand.nextInt(16) + 8; 74 | int k22 = rand.nextInt(128); 75 | int j24 = chunkY + rand.nextInt(16) + 8; 76 | 77 | if (rand.nextInt(6) == 0) { 78 | (new DecoGrass(Blocks.double_plant, 2)).generate(world, rand, l19, k22, j24); 79 | } else { 80 | (new DecoGrass(Blocks.tallgrass, 1)).generate(world, rand, l19, k22, j24); 81 | } 82 | } 83 | } 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /src/main/java/rwg/deco/trees/DecoPalm.java: -------------------------------------------------------------------------------- 1 | package rwg.deco.trees; 2 | 3 | import java.util.Random; 4 | 5 | import net.minecraft.block.Block; 6 | import net.minecraft.init.Blocks; 7 | import net.minecraft.world.World; 8 | import net.minecraft.world.gen.feature.WorldGenerator; 9 | 10 | public class DecoPalm extends WorldGenerator { 11 | 12 | private static int leavesLength = 133; 13 | private static int[] leaves = new int[] { 1, 0, 0, 2, 0, 0, 3, -1, 0, 3, -2, 0, -1, 0, 0, -2, 0, 0, -3, -1, 0, -3, 14 | -2, 0, 0, 0, 1, 0, 0, 2, 0, -1, 3, 0, -2, 3, 0, 0, -1, 0, 0, -2, 0, -1, -3, 0, -2, -3, 0, 1, 0, 1, 1, 1, -1, 15 | 1, -1, -1, 1, 1, 1, 1, -1, 1, 2, 0, -1, 2, 0, 0, 2, 1, 0, 2, -1, 2, 3, 0, 3, 3, 0, 4, 2, 0, -2, 3, 0, -3, 3, 16 | 0, -4, 2, 0, 0, 3, 2, 0, 3, 3, 0, 2, 4, 0, 3, -2, 0, 3, -3, 0, 2, -4, 2, 2, -2, -2, 2, 2, -2, 2, -2, 2, 2, 17 | 2, 3, 2, -3, -3, 2, 3, -3, 2, -3, 3, 2, 3 }; 18 | 19 | private static int cocoasLength = 16; 20 | private static int[] cocoas = new int[] { 2, 0, -2, 1, 1, 1, -2, 0, 0, 0, -2, -1, 3, -1, -2, 0 }; 21 | 22 | public DecoPalm() {} 23 | 24 | @Override 25 | public boolean generate(World world, Random rand, int x, int y, int z) { 26 | Block b = world.getBlock(x, y - 1, z); 27 | if (b != Blocks.grass && b != Blocks.dirt && b != Blocks.sand) { 28 | return false; 29 | } 30 | 31 | double horDir = getRandomDir(rand); 32 | float verDir = 0.3f + rand.nextFloat() * 0.4f, length = 15f, posX = (float) x, posY = (float) y, 33 | posZ = (float) z, c = 0f, loss = 0f; 34 | 35 | if (verDir < 0f) { 36 | verDir = -verDir; 37 | } 38 | 39 | float velY = 1f - verDir; 40 | 41 | if (verDir > 1f) { 42 | verDir = 1f - (verDir - 1f); 43 | } 44 | 45 | float velX = (float) Math.cos(horDir * Math.PI / 180D) * verDir; 46 | float velZ = (float) Math.sin(horDir * Math.PI / 180D) * verDir; 47 | 48 | while (c < length) { 49 | world.setBlock((int) posX, (int) posY, (int) posZ, Blocks.log, 15, 2); 50 | 51 | if (c < length - 3) { 52 | loss = Math.abs(velX) + Math.abs(velZ); 53 | posX += velX *= 0.9f; 54 | posZ += velZ *= 0.9f; 55 | loss = loss - (Math.abs(velX) + Math.abs(velZ)); 56 | posY += velY += loss; 57 | } else { 58 | posY += velY; 59 | } 60 | 61 | c += 1f; 62 | } 63 | 64 | x = (int) posX; 65 | y = (int) posY - 1; 66 | z = (int) posZ; 67 | 68 | for (int j = 0; j < leavesLength; j += 3) { 69 | world.setBlock(x + leaves[j], y + leaves[j + 1], z + leaves[j + 2], Blocks.leaves, 3, 2); 70 | } 71 | 72 | for (int k = 0; k < cocoasLength; k += 4) { 73 | if (rand.nextInt(20) == 0) { 74 | world.setBlock( 75 | x + cocoas[k + 1], 76 | y + cocoas[k + 2], 77 | z + cocoas[k + 3], 78 | Blocks.cocoa, 79 | cocoas[k + 0] + 8, 80 | 2); 81 | } 82 | } 83 | 84 | return true; 85 | } 86 | 87 | public double getRandomDir(Random rand) { 88 | switch (rand.nextInt(4)) { 89 | case 0: 90 | return -180D; 91 | case 1: 92 | return -90D; 93 | case 2: 94 | return 0D; 95 | case 3: 96 | return 90D; 97 | } 98 | return 0D; 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /src/main/java/rwg/deco/DecoWaterGrass.java: -------------------------------------------------------------------------------- 1 | package rwg.deco; 2 | 3 | import java.util.Random; 4 | 5 | import net.minecraft.block.Block; 6 | import net.minecraft.init.Blocks; 7 | import net.minecraft.world.World; 8 | import net.minecraft.world.gen.feature.WorldGenerator; 9 | 10 | public class DecoWaterGrass extends WorldGenerator { 11 | 12 | private Block block; 13 | private int metadata; 14 | private int minHeight; 15 | 16 | public DecoWaterGrass(Block b, int m) { 17 | this(b, m, 10); 18 | } 19 | 20 | public DecoWaterGrass(Block b, int m, int mh) { 21 | block = b; 22 | metadata = m; 23 | minHeight = mh; 24 | } 25 | 26 | public boolean generate(World world, Random rand, int x, int y, int z) { 27 | while (y > 0) { 28 | if (!world.isAirBlock(x, y, z) || world.getBlock(x, y, z).isLeaves(world, x, y, z)) { 29 | break; 30 | } 31 | 32 | if (y < minHeight) { 33 | return false; 34 | } 35 | y--; 36 | } 37 | 38 | Block b; 39 | if (block == Blocks.double_plant) { 40 | int i1, j1, k1; 41 | for (int l = 0; l < 32; ++l) { 42 | i1 = x + rand.nextInt(8) - rand.nextInt(8); 43 | j1 = y + rand.nextInt(2) - rand.nextInt(2); 44 | k1 = z + rand.nextInt(8) - rand.nextInt(8); 45 | 46 | b = world.getBlock(i1, j1 - 1, k1); 47 | if (((b == Blocks.water && world.getBlock(i1, j1 - 2, k1) == Blocks.sand) || b == Blocks.sand) 48 | && world.getBlock(i1, j1, k1) == Blocks.air) { 49 | world.setBlock(i1, j1 - 1, k1, Blocks.grass, 0, 0); 50 | } 51 | 52 | if (world.isAirBlock(i1, j1, k1) && j1 < 254 53 | && Blocks.double_plant.canPlaceBlockAt(world, i1, j1, k1)) { 54 | Blocks.double_plant.func_149889_c(world, i1, j1, k1, metadata, 0); 55 | } 56 | } 57 | } else if (block == Blocks.leaves) { 58 | for (int l = 0; l < 64; ++l) { 59 | int i1 = x + rand.nextInt(8) - rand.nextInt(8); 60 | int j1 = y + rand.nextInt(4) - rand.nextInt(4); 61 | int k1 = z + rand.nextInt(8) - rand.nextInt(8); 62 | 63 | b = world.getBlock(i1, j1 - 1, k1); 64 | if (((b == Blocks.water && world.getBlock(i1, j1 - 2, k1) == Blocks.sand) || b == Blocks.sand) 65 | && world.getBlock(i1, j1, k1) == Blocks.air) { 66 | world.setBlock(i1, j1 - 1, k1, Blocks.grass, 0, 0); 67 | } 68 | 69 | if (world.isAirBlock(i1, j1, k1) && world.getBlock(i1, j1 - 1, k1) == Blocks.grass) { 70 | world.setBlock(i1, j1, k1, block, metadata, 0); 71 | } 72 | } 73 | } else { 74 | for (int l = 0; l < 128; ++l) { 75 | int i1 = x + rand.nextInt(8) - rand.nextInt(8); 76 | int j1 = y + rand.nextInt(4) - rand.nextInt(4); 77 | int k1 = z + rand.nextInt(8) - rand.nextInt(8); 78 | 79 | b = world.getBlock(i1, j1 - 1, k1); 80 | if (((b == Blocks.water && world.getBlock(i1, j1 - 2, k1) == Blocks.sand) || b == Blocks.sand) 81 | && world.getBlock(i1, j1, k1) == Blocks.air) { 82 | world.setBlock(i1, j1 - 1, k1, Blocks.grass, 0, 0); 83 | } 84 | 85 | if (world.isAirBlock(i1, j1, k1) && block.canBlockStay(world, i1, j1, k1)) { 86 | world.setBlock(i1, j1, k1, block, metadata, 0); 87 | } 88 | } 89 | } 90 | return true; 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /src/main/java/rwg/deco/DecoClay.java: -------------------------------------------------------------------------------- 1 | package rwg.deco; 2 | 3 | import java.util.Random; 4 | 5 | import net.minecraft.block.Block; 6 | import net.minecraft.init.Blocks; 7 | import net.minecraft.util.MathHelper; 8 | import net.minecraft.world.World; 9 | import net.minecraft.world.gen.feature.WorldGenerator; 10 | 11 | public class DecoClay extends WorldGenerator { 12 | 13 | private Block field_150519_a; 14 | private int numberOfBlocks; 15 | private int mineableBlockMeta; 16 | 17 | public DecoClay(Block block, int metadata, int amount) { 18 | field_150519_a = block; 19 | mineableBlockMeta = metadata; 20 | numberOfBlocks = amount; 21 | } 22 | 23 | public boolean generate(World p_76484_1_, Random p_76484_2_, int p_76484_3_, int p_76484_4_, int p_76484_5_) { 24 | float f = p_76484_2_.nextFloat() * (float) Math.PI; 25 | double d0 = (double) ((float) (p_76484_3_ + 8) + MathHelper.sin(f) * (float) this.numberOfBlocks / 8.0F); 26 | double d1 = (double) ((float) (p_76484_3_ + 8) - MathHelper.sin(f) * (float) this.numberOfBlocks / 8.0F); 27 | double d2 = (double) ((float) (p_76484_5_ + 8) + MathHelper.cos(f) * (float) this.numberOfBlocks / 8.0F); 28 | double d3 = (double) ((float) (p_76484_5_ + 8) - MathHelper.cos(f) * (float) this.numberOfBlocks / 8.0F); 29 | double d4 = (double) (p_76484_4_ + p_76484_2_.nextInt(3) - 2); 30 | double d5 = (double) (p_76484_4_ + p_76484_2_.nextInt(3) - 2); 31 | Block b; 32 | 33 | for (int l = 0; l <= this.numberOfBlocks; ++l) { 34 | double d6 = d0 + (d1 - d0) * (double) l / (double) this.numberOfBlocks; 35 | double d7 = d4 + (d5 - d4) * (double) l / (double) this.numberOfBlocks; 36 | double d8 = d2 + (d3 - d2) * (double) l / (double) this.numberOfBlocks; 37 | double d9 = p_76484_2_.nextDouble() * (double) this.numberOfBlocks / 16.0D; 38 | double d10 = (double) (MathHelper.sin((float) l * (float) Math.PI / (float) this.numberOfBlocks) + 1.0F) 39 | * d9 + 1.0D; 40 | double d11 = (double) (MathHelper.sin((float) l * (float) Math.PI / (float) this.numberOfBlocks) + 1.0F) 41 | * d9 + 1.0D; 42 | int i1 = MathHelper.floor_double(d6 - d10 / 2.0D); 43 | int j1 = MathHelper.floor_double(d7 - d11 / 2.0D); 44 | int k1 = MathHelper.floor_double(d8 - d10 / 2.0D); 45 | int l1 = MathHelper.floor_double(d6 + d10 / 2.0D); 46 | int i2 = MathHelper.floor_double(d7 + d11 / 2.0D); 47 | int j2 = MathHelper.floor_double(d8 + d10 / 2.0D); 48 | 49 | for (int k2 = i1; k2 <= l1; ++k2) { 50 | double d12 = ((double) k2 + 0.5D - d6) / (d10 / 2.0D); 51 | 52 | if (d12 * d12 < 1.0D) { 53 | for (int l2 = j1; l2 <= i2; ++l2) { 54 | double d13 = ((double) l2 + 0.5D - d7) / (d11 / 2.0D); 55 | 56 | if (d12 * d12 + d13 * d13 < 1.0D) { 57 | for (int i3 = k1; i3 <= j2; ++i3) { 58 | double d14 = ((double) i3 + 0.5D - d8) / (d10 / 2.0D); 59 | b = p_76484_1_.getBlock(k2, l2, i3); 60 | 61 | if (d12 * d12 + d13 * d13 + d14 * d14 < 1.0D && (b == Blocks.grass || b == Blocks.dirt 62 | || b == Blocks.sand 63 | || b == Blocks.gravel)) { 64 | p_76484_1_.setBlock(k2, l2, i3, this.field_150519_a, mineableBlockMeta, 2); 65 | } 66 | } 67 | } 68 | } 69 | } 70 | } 71 | } 72 | 73 | return true; 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /src/main/java/rwg/deco/trees/DecoBirch.java: -------------------------------------------------------------------------------- 1 | package rwg.deco.trees; 2 | 3 | import java.util.Random; 4 | 5 | import net.minecraft.block.Block; 6 | import net.minecraft.block.material.Material; 7 | import net.minecraft.init.Blocks; 8 | import net.minecraft.world.World; 9 | import net.minecraft.world.gen.feature.WorldGenerator; 10 | 11 | public class DecoBirch extends WorldGenerator { 12 | 13 | private int startHeight; 14 | private int treeSize; 15 | 16 | public DecoBirch(int start, int s) { 17 | startHeight = start; 18 | treeSize = s; 19 | } 20 | 21 | public boolean generate(World world, Random rand, int x, int y, int z) { 22 | Block g = world.getBlock(x, y - 1, z); 23 | if (g != Blocks.grass && g != Blocks.dirt) { 24 | return false; 25 | } 26 | 27 | int i; 28 | for (i = 0; i < startHeight; i++) { 29 | world.setBlock(x, y, z, Blocks.log, 2, 0); 30 | y++; 31 | } 32 | 33 | int pX = 0; 34 | int pZ = 0; 35 | for (i = 0; i < treeSize; i++) { 36 | if (rand.nextInt(1) == 0 && i < treeSize - 2) { 37 | int dX = -1 + rand.nextInt(3); 38 | int dZ = -1 + rand.nextInt(3); 39 | 40 | if (dX == 0 && dZ == 0) { 41 | dX = -1 + rand.nextInt(3); 42 | dZ = -1 + rand.nextInt(3); 43 | } 44 | 45 | if (pX == dX && rand.nextBoolean()) { 46 | dX = -dX; 47 | } 48 | if (pZ == dZ && rand.nextBoolean()) { 49 | dZ = -dZ; 50 | } 51 | 52 | pX = dX; 53 | pZ = dZ; 54 | 55 | buildBranch(world, rand, x, y, z, dX, dZ, 1, i < treeSize - 2 ? 2 : 1); // i < treeSize - 4 ? 2 : 1 56 | } 57 | world.setBlock(x, y, z, Blocks.log, 2, 0); 58 | 59 | if (i < treeSize - 2) { 60 | if (rand.nextBoolean()) { 61 | buildLeaves(world, x, y, z + 1); 62 | } 63 | if (rand.nextBoolean()) { 64 | buildLeaves(world, x, y, z - 1); 65 | } 66 | if (rand.nextBoolean()) { 67 | buildLeaves(world, x + 1, y, z); 68 | } 69 | if (rand.nextBoolean()) { 70 | buildLeaves(world, x - 1, y, z); 71 | } 72 | } 73 | 74 | y++; 75 | } 76 | 77 | buildLeaves(world, x, y - 1, z + 1); 78 | buildLeaves(world, x, y - 1, z - 1); 79 | buildLeaves(world, x + 1, y - 1, z); 80 | buildLeaves(world, x - 1, y - 1, z); 81 | buildLeaves(world, x, y, z); 82 | 83 | return true; 84 | } 85 | 86 | public void buildBranch(World world, Random rand, int x, int y, int z, int dX, int dZ, int logLength, 87 | int leaveSize) { 88 | for (int i = -1; i <= 1; i++) { 89 | for (int j = -1; j <= 1; j++) { 90 | for (int k = 0; k < 2; k++) { 91 | if (Math.abs(i) + Math.abs(j) + Math.abs(k) < leaveSize + 1) { 92 | buildLeaves(world, x + i + (dX * logLength), y + k, z + j + (dZ * logLength)); 93 | } 94 | } 95 | } 96 | } 97 | 98 | for (int m = 1; m <= logLength; m++) { 99 | world.setBlock(x + (dX * m), y, z + (dZ * m), Blocks.log, 2, 0); 100 | } 101 | } 102 | 103 | public void buildLeaves(World world, int x, int y, int z) { 104 | Block b = world.getBlock(x, y, z); 105 | if (b.getMaterial() == Material.air) { 106 | world.setBlock(x, y, z, Blocks.leaves, 2, 0); 107 | } 108 | } 109 | } 110 | -------------------------------------------------------------------------------- /src/main/java/rwg/surface/SurfaceIslandMountainStone.java: -------------------------------------------------------------------------------- 1 | package rwg.surface; 2 | 3 | import java.util.Random; 4 | 5 | import net.minecraft.block.Block; 6 | import net.minecraft.init.Blocks; 7 | import net.minecraft.world.World; 8 | import net.minecraft.world.biome.BiomeGenBase; 9 | 10 | import rwg.util.CellNoise; 11 | import rwg.util.CliffCalculator; 12 | import rwg.util.NoiseGenerator; 13 | 14 | public class SurfaceIslandMountainStone extends SurfaceBase { 15 | 16 | private int beach; 17 | private Block beachBlock; 18 | private float min; 19 | 20 | private float sCliff = 1.5f; 21 | private float sHeight = 60f; 22 | private float sStrength = 65f; 23 | private float cCliff = 1.5f; 24 | 25 | public SurfaceIslandMountainStone(Block top, Block fill, int beachHeight, Block genBeachBlock, float minCliff) { 26 | super(top, fill); 27 | beach = beachHeight; 28 | beachBlock = genBeachBlock; 29 | min = minCliff; 30 | } 31 | 32 | public SurfaceIslandMountainStone(Block top, Block fill, int beachHeight, Block genBeachBlock, float minCliff, 33 | float stoneCliff, float stoneHeight, float stoneStrength, float clayCliff) { 34 | this(top, fill, beachHeight, genBeachBlock, minCliff); 35 | 36 | sCliff = stoneCliff; 37 | sHeight = stoneHeight; 38 | sStrength = stoneStrength; 39 | cCliff = clayCliff; 40 | } 41 | 42 | @Override 43 | public void paintTerrain(Block[] blocks, byte[] metadata, int i, int j, int x, int y, int depth, World world, 44 | Random rand, NoiseGenerator perlin, CellNoise cell, float[] noise, float river, BiomeGenBase[] base) { 45 | float c = CliffCalculator.calc(x, y, noise); 46 | int cliff = 0; 47 | boolean gravel = false; 48 | 49 | Block b; 50 | for (int k = 255; k > -1; k--) { 51 | b = blocks[(y * 16 + x) * 256 + k]; 52 | if (b == Blocks.air) { 53 | depth = -1; 54 | } else if (b == Blocks.stone) { 55 | depth++; 56 | 57 | if (depth == 0) { 58 | if (k < beach) { 59 | gravel = true; 60 | } 61 | 62 | float p = perlin.noise3(i / 8f, j / 8f, k / 8f) * 0.5f; 63 | if (c > min && c > sCliff - ((k - sHeight) / sStrength) + p) { 64 | cliff = 1; 65 | } 66 | if (c > cCliff) { 67 | cliff = 2; 68 | } 69 | 70 | if (cliff == 1) { 71 | blocks[(y * 16 + x) * 256 + k] = rand.nextInt(3) == 0 ? Blocks.cobblestone : Blocks.stone; 72 | } else if (cliff == 2) { 73 | blocks[(y * 16 + x) * 256 + k] = Blocks.stained_hardened_clay; 74 | metadata[(y * 16 + x) * 256 + k] = 9; 75 | } else if (k < beach) { 76 | blocks[(y * 16 + x) * 256 + k] = beachBlock; 77 | gravel = true; 78 | } else { 79 | blocks[(y * 16 + x) * 256 + k] = topBlock; 80 | } 81 | } else if (depth < 6) { 82 | if (cliff == 1) { 83 | blocks[(y * 16 + x) * 256 + k] = Blocks.stone; 84 | } else if (cliff == 2) { 85 | blocks[(y * 16 + x) * 256 + k] = Blocks.stained_hardened_clay; 86 | metadata[(y * 16 + x) * 256 + k] = 9; 87 | } else if (gravel) { 88 | blocks[(y * 16 + x) * 256 + k] = beachBlock; 89 | } else { 90 | blocks[(y * 16 + x) * 256 + k] = fillerBlock; 91 | } 92 | } 93 | } 94 | } 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /src/main/java/rwg/data/VillageMaterials.java: -------------------------------------------------------------------------------- 1 | package rwg.data; 2 | 3 | import net.minecraft.init.Blocks; 4 | import net.minecraftforge.event.terraingen.BiomeEvent; 5 | 6 | import cpw.mods.fml.common.eventhandler.Event.Result; 7 | import cpw.mods.fml.common.eventhandler.SubscribeEvent; 8 | 9 | public class VillageMaterials { 10 | 11 | private static VillageMaterialData[] dataList = new VillageMaterialData[256]; 12 | 13 | public static void registerVillageMaterial(VillageMaterialData data) { 14 | dataList[data.biomeID] = data; 15 | } 16 | 17 | @SubscribeEvent 18 | public void getVillageBlockID(BiomeEvent.GetVillageBlockID event) { 19 | if (event.biome != null) { 20 | VillageMaterialData vmd = this.dataList[event.biome.biomeID]; 21 | 22 | if (vmd != null) { 23 | if (event.original == Blocks.log) { 24 | event.replacement = vmd.logBlock; 25 | event.setResult(Result.DENY); 26 | return; 27 | } 28 | if (event.original == Blocks.cobblestone) { 29 | event.replacement = vmd.cobbleBlock; 30 | event.setResult(Result.DENY); 31 | return; 32 | } 33 | if (event.original == Blocks.planks) { 34 | event.replacement = vmd.plankBlock; 35 | event.setResult(Result.DENY); 36 | return; 37 | } 38 | if (event.original == Blocks.gravel) { 39 | event.replacement = vmd.pathBlock; 40 | event.setResult(Result.DENY); 41 | return; 42 | } 43 | if (event.original == Blocks.oak_stairs) { 44 | event.replacement = vmd.stairsWoodBlock; 45 | event.setResult(Result.DENY); 46 | return; 47 | } 48 | if (event.original == Blocks.stone_stairs) { 49 | event.replacement = vmd.stairsStoneBlock; 50 | event.setResult(Result.DENY); 51 | return; 52 | } 53 | if (event.original == Blocks.stone_slab) { 54 | event.replacement = vmd.slabsBlock; 55 | event.setResult(Result.DENY); 56 | return; 57 | } 58 | } 59 | } 60 | } 61 | 62 | @SubscribeEvent 63 | public void getVillageBlockMeta(BiomeEvent.GetVillageBlockMeta event) { 64 | if (event.biome != null) { 65 | VillageMaterialData vmd = this.dataList[event.biome.biomeID]; 66 | 67 | if (vmd != null) { 68 | if (event.original == Blocks.log) { 69 | event.replacement = vmd.logBlockMeta; 70 | event.setResult(Result.DENY); 71 | return; 72 | } 73 | if (event.original == Blocks.cobblestone) { 74 | event.replacement = vmd.cobbleBlockMeta; 75 | event.setResult(Result.DENY); 76 | return; 77 | } 78 | if (event.original == Blocks.planks) { 79 | event.replacement = vmd.plankBlockMeta; 80 | event.setResult(Result.DENY); 81 | return; 82 | } 83 | if (event.original == Blocks.gravel) { 84 | event.replacement = vmd.pathBlockMeta; 85 | event.setResult(Result.DENY); 86 | return; 87 | } 88 | if (event.original == Blocks.stone_slab) { 89 | event.replacement = vmd.slabsBlockMeta; 90 | event.setResult(Result.DENY); 91 | return; 92 | } 93 | } 94 | } 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /src/main/java/rwg/deco/trees/DecoSmallPine.java: -------------------------------------------------------------------------------- 1 | package rwg.deco.trees; 2 | 3 | import java.util.Random; 4 | 5 | import net.minecraft.block.Block; 6 | import net.minecraft.block.material.Material; 7 | import net.minecraft.init.Blocks; 8 | import net.minecraft.world.World; 9 | import net.minecraft.world.gen.feature.WorldGenerator; 10 | 11 | public class DecoSmallPine extends WorldGenerator { 12 | 13 | private int startHeight; 14 | private int treeSize; 15 | private int metadata; 16 | 17 | public DecoSmallPine(int start, int s) { 18 | this(start, s, 1); 19 | } 20 | 21 | public DecoSmallPine(int start, int s, int m) { 22 | startHeight = start; 23 | treeSize = s; 24 | metadata = m; 25 | } 26 | 27 | public boolean generate(World world, Random rand, int x, int y, int z) { 28 | Block g = world.getBlock(x, y - 1, z); 29 | if (g != Blocks.grass && g != Blocks.dirt) { 30 | return false; 31 | } 32 | 33 | int i; 34 | for (i = 0; i < startHeight; i++) { 35 | world.setBlock(x, y, z, Blocks.log, metadata, 0); 36 | y++; 37 | } 38 | 39 | int pX = 0; 40 | int pZ = 0; 41 | for (i = 0; i < treeSize; i++) { 42 | if (rand.nextInt(1) == 0 && i < treeSize - 2) { 43 | int dX = -1 + rand.nextInt(3); 44 | int dZ = -1 + rand.nextInt(3); 45 | 46 | if (dX == 0 && dZ == 0) { 47 | dX = -1 + rand.nextInt(3); 48 | dZ = -1 + rand.nextInt(3); 49 | } 50 | 51 | if (pX == dX && rand.nextBoolean()) { 52 | dX = -dX; 53 | } 54 | if (pZ == dZ && rand.nextBoolean()) { 55 | dZ = -dZ; 56 | } 57 | 58 | pX = dX; 59 | pZ = dZ; 60 | 61 | buildBranch(world, rand, x, y, z, dX, dZ, i < treeSize - 10 ? 2 : 1, i < treeSize - 6 ? 2 : 1); 62 | } 63 | world.setBlock(x, y, z, Blocks.log, metadata, 0); 64 | 65 | if (i < treeSize - 2) { 66 | if (rand.nextBoolean()) { 67 | buildLeaves(world, x, y, z + 1); 68 | } 69 | if (rand.nextBoolean()) { 70 | buildLeaves(world, x, y, z - 1); 71 | } 72 | if (rand.nextBoolean()) { 73 | buildLeaves(world, x + 1, y, z); 74 | } 75 | if (rand.nextBoolean()) { 76 | buildLeaves(world, x - 1, y, z); 77 | } 78 | } 79 | 80 | y++; 81 | } 82 | 83 | buildLeaves(world, x, y - 1, z + 1); 84 | buildLeaves(world, x, y - 1, z - 1); 85 | buildLeaves(world, x + 1, y - 1, z); 86 | buildLeaves(world, x - 1, y - 1, z); 87 | buildLeaves(world, x, y, z); 88 | 89 | return true; 90 | } 91 | 92 | public void buildBranch(World world, Random rand, int x, int y, int z, int dX, int dZ, int logLength, 93 | int leaveSize) { 94 | for (int i = -1; i <= 1; i++) { 95 | for (int j = -1; j <= 1; j++) { 96 | for (int k = 0; k < 2; k++) { 97 | if (Math.abs(i) + Math.abs(j) + Math.abs(k) < leaveSize + 1) { 98 | buildLeaves(world, x + i + (dX * logLength), y + k, z + j + (dZ * logLength)); 99 | } 100 | } 101 | } 102 | } 103 | 104 | for (int m = 1; m <= logLength; m++) { 105 | world.setBlock(x + (dX * m), y, z + (dZ * m), Blocks.log, metadata, 0); 106 | } 107 | } 108 | 109 | public void buildLeaves(World world, int x, int y, int z) { 110 | Block b = world.getBlock(x, y, z); 111 | if (b.getMaterial() == Material.air) { 112 | world.setBlock(x, y, z, Blocks.leaves, metadata, 0); 113 | } 114 | } 115 | } 116 | --------------------------------------------------------------------------------