diff options
| author | Martin Robertz <dream-master@gmx.net> | 2021-12-15 16:11:54 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-12-15 16:11:54 +0100 |
| commit | 128c74faa99dfef8d056c1d82c6e4388b9d470e8 (patch) | |
| tree | 2c84162154ba681232f86dffd4106db530236814 /src/main/java/gtPlusPlus/australia | |
| parent | 47ce336f288a45aa3244c8ae1177499fa5080942 (diff) | |
| parent | ff4b8c7068c2ea7d654e9beda00646d23e62b314 (diff) | |
| download | GT5-Unofficial-128c74faa99dfef8d056c1d82c6e4388b9d470e8.tar.gz GT5-Unofficial-128c74faa99dfef8d056c1d82c6e4388b9d470e8.tar.bz2 GT5-Unofficial-128c74faa99dfef8d056c1d82c6e4388b9d470e8.zip | |
Merge pull request #65 from GTNewHorizons/unified-build-script2
Move sources and resources
Diffstat (limited to 'src/main/java/gtPlusPlus/australia')
51 files changed, 9799 insertions, 0 deletions
diff --git a/src/main/java/gtPlusPlus/australia/GTplusplus_Australia.java b/src/main/java/gtPlusPlus/australia/GTplusplus_Australia.java new file mode 100644 index 0000000000..9a16ad1785 --- /dev/null +++ b/src/main/java/gtPlusPlus/australia/GTplusplus_Australia.java @@ -0,0 +1,158 @@ +package gtPlusPlus.australia; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.io.File; + +import cpw.mods.fml.common.Mod; +import cpw.mods.fml.common.Mod.EventHandler; +import cpw.mods.fml.common.event.FMLInitializationEvent; +import cpw.mods.fml.common.event.FMLPostInitializationEvent; +import cpw.mods.fml.common.event.FMLPreInitializationEvent; +import cpw.mods.fml.common.event.FMLServerStartingEvent; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.IFMLLoadingPlugin.MCVersion; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.australia.biome.type.Biome_AustralianDesert_Ex; +import gtPlusPlus.australia.biome.type.Biome_AustralianForest; +import gtPlusPlus.australia.biome.type.Biome_AustralianOcean; +import gtPlusPlus.australia.biome.type.Biome_AustralianOutback; +import gtPlusPlus.australia.biome.type.Biome_AustralianPlains; +import gtPlusPlus.australia.block.AustraliaContentLoader; +import gtPlusPlus.australia.dimension.Dimension_Australia; +import gtPlusPlus.australia.gen.gt.WorldGen_Australia_Ores; +import gtPlusPlus.australia.gen.gt.WorldGen_GT_Australia_Base; +import gtPlusPlus.australia.gen.map.structure.StructureManager; +import gtPlusPlus.australia.world.AustraliaWorldGenerator; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.lib.CORE.Australia; +import gtPlusPlus.preloader.CORE_Preloader; +import gtPlusPlus.xmod.gregtech.api.util.GTPP_Config; +import net.minecraftforge.common.DimensionManager; +import net.minecraftforge.common.config.Configuration; + +@MCVersion(value = "1.7.10") +@Mod(modid = Australia.MODID, name = Australia.NAME, version = Australia.VERSION, dependencies = "required-after:Forge; after:dreamcraft; after:IC2; after:ihl; required-after:gregtech; required-after:miscutils;") +public class GTplusplus_Australia implements ActionListener { + + //Mod Instance + @Mod.Instance(Australia.MODID) + public static GTplusplus_Australia instance; + public static GTPP_Config sCustomWorldgenFile = null; + + // Dark World Handler + //protected static volatile Biome_AustralianDesert Australian_Desert_Biome_1; + //protected static volatile Biome_AustralianDesert2 Australian_Desert_Biome_2; + + public static volatile Biome_AustralianDesert_Ex Australian_Desert_Biome_3; + public static volatile Biome_AustralianForest Australian_Forest_Biome; + public static volatile Biome_AustralianOcean Australian_Ocean_Biome; + public static volatile Biome_AustralianOutback Australian_Outback_Biome; + public static volatile Biome_AustralianPlains Australian_Plains_Biome; + + public static volatile Dimension_Australia Australia_Dimension; + public static AustraliaWorldGenerator Australia_World_Generator; + public static int globalAustraliaPortalSpawnTimer = 0; + + // Pre-Init + @Mod.EventHandler + public void preInit(final FMLPreInitializationEvent event) { + Logger.INFO("Loading " + Australia.MODID + " V" + Australia.VERSION); + + //Setup + setVars(event); + + Australia_Dimension = new Dimension_Australia(); + Australia_Dimension.instance = instance; + + //Australian_Desert_Biome_1 = (new Biome_AustralianDesert()); + //Australian_Desert_Biome_2 = (new Biome_AustralianDesert2()); + //Australian_Desert_Biome_1.instance = instance; + //Australian_Desert_Biome_2.instance = instance; + //Australian_Desert_Biome_1.preInit(event); + //Australian_Desert_Biome_2.preInit(event); + + + Australian_Desert_Biome_3 = (Biome_AustralianDesert_Ex.biome); + Australian_Forest_Biome = (Biome_AustralianForest.biome); + Australian_Ocean_Biome = (Biome_AustralianOcean.biome); + Australian_Outback_Biome = (Biome_AustralianOutback.biome); + Australian_Plains_Biome = Biome_AustralianPlains.biome; + + //Load Villages + StructureManager.registerVillageComponents(); + + setupWorldGenerator(); + + //Load/Set Custom Ore Gen + sCustomWorldgenFile = new GTPP_Config(new Configuration(new File(new File(event.getModConfigurationDirectory(), "GTplusplus"), "Australia.cfg"))); + + } + + @EventHandler + public void load(final FMLInitializationEvent e) { + Logger.INFO("Begin resource allocation for " + Australia.MODID + " V" +Australia.VERSION); + + //Load World and Biome + GameRegistry.registerWorldGenerator(new WorldGen_GT_Australia_Base(), Short.MAX_VALUE); + + //Australian_Desert_Biome_1.load(); + //Australian_Desert_Biome_2.load(); + Australian_Desert_Biome_3.load(); + Australian_Forest_Biome.load(); + Australian_Ocean_Biome.load(); + Australian_Outback_Biome.load(); + Australian_Plains_Biome.load(); + + Australia_Dimension.load(); + + } + + public static synchronized void GenerateOreMaterials() { + + } + + protected synchronized void setVars(FMLPreInitializationEvent event){ + + sCustomWorldgenFile = new GTPP_Config(new Configuration(new File(new File(event.getModConfigurationDirectory(), "GTplusplus"), "Australia.cfg"))); + + if (DimensionManager.isDimensionRegistered(Dimension_Australia.DIMID)){ + Dimension_Australia.DIMID = DimensionManager.getNextFreeDimId(); + } + + /* + * Set World Generation Values + */ + WorldGen_Australia_Ores.generateValidOreVeins(); + WorldGen_GT_Australia_Base.oreveinPercentage = 16; + WorldGen_GT_Australia_Base.oreveinAttempts = 16; + WorldGen_GT_Australia_Base.oreveinMaxPlacementAttempts = 2; + if (CORE_Preloader.DEBUG_MODE || CORE.DEVENV){ + WorldGen_GT_Australia_Base.debugWorldGen = true; + } + AustraliaContentLoader.run(); + } + + @EventHandler + public void serverLoad(FMLServerStartingEvent event) { + Australia_World_Generator.initiate(); + } + + @EventHandler + public static void postInit(final FMLPostInitializationEvent e) { + Logger.INFO("Finished loading Australia plugin for GT++."); + } + + @Override + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + + } + + private void setupWorldGenerator() { + Logger.INFO("Registering World Generator for Australia."); + Australia_World_Generator = new AustraliaWorldGenerator(); + GameRegistry.registerWorldGenerator(Australia_World_Generator, 0); + } + +} diff --git a/src/main/java/gtPlusPlus/australia/biome/CustomDecorator.java b/src/main/java/gtPlusPlus/australia/biome/CustomDecorator.java new file mode 100644 index 0000000000..2d9b335d52 --- /dev/null +++ b/src/main/java/gtPlusPlus/australia/biome/CustomDecorator.java @@ -0,0 +1,355 @@ +package gtPlusPlus.australia.biome; + +import java.util.Random; + +import gtPlusPlus.api.interfaces.IGeneratorWorld; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.australia.GTplusplus_Australia; +import gtPlusPlus.australia.gen.world.WorldGenAustralianOre; +import net.minecraft.block.BlockFlower; +import net.minecraft.block.material.Material; +import net.minecraft.init.Blocks; +import net.minecraft.world.World; +import net.minecraft.world.biome.BiomeDecorator; +import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.gen.feature.WorldGenAbstractTree; +import net.minecraft.world.gen.feature.WorldGenBigMushroom; +import net.minecraft.world.gen.feature.WorldGenCactus; +import net.minecraft.world.gen.feature.WorldGenDeadBush; +import net.minecraft.world.gen.feature.WorldGenFlowers; +import net.minecraft.world.gen.feature.WorldGenLiquids; +import net.minecraft.world.gen.feature.WorldGenMinable; +import net.minecraft.world.gen.feature.WorldGenPumpkin; +import net.minecraft.world.gen.feature.WorldGenReed; +import net.minecraft.world.gen.feature.WorldGenSand; +import net.minecraft.world.gen.feature.WorldGenWaterlily; +import net.minecraft.world.gen.feature.WorldGenerator; + +import static net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.*; +import static net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.*; +import net.minecraftforge.common.*; +import net.minecraftforge.event.terraingen.*; + +public class CustomDecorator extends BiomeDecorator { + + + public CustomDecorator() { + this.sandGen = new WorldGenSand(Blocks.sand, 10); + this.gravelAsSandGen = new WorldGenSand(Blocks.gravel, 6); + this.dirtGen = new WorldGenMinable(Blocks.dirt, 16); + this.gravelGen = new WorldGenMinable(Blocks.gravel, 16); + + this.coalGen = new WorldGenAustralianOre(Blocks.coal_ore, 4); + this.ironGen = new WorldGenAustralianOre(Blocks.clay, 4); + this.goldGen = new WorldGenAustralianOre(Blocks.soul_sand, 20); + this.redstoneGen = new WorldGenAustralianOre(Blocks.bedrock, 8); + this.diamondGen = new WorldGenAustralianOre(Blocks.diamond_ore, 1); + this.lapisGen = new WorldGenAustralianOre(Blocks.lava, 16); + + this.yellowFlowerGen = new WorldGenFlowers(Blocks.yellow_flower); + this.mushroomBrownGen = new WorldGenFlowers(Blocks.brown_mushroom); + this.mushroomRedGen = new WorldGenFlowers(Blocks.red_mushroom); + this.bigMushroomGen = new WorldGenBigMushroom(); + this.reedGen = new WorldGenReed(); + this.cactusGen = new WorldGenCactus(); + this.waterlilyGen = new WorldGenWaterlily(); + this.flowersPerChunk = 2; + this.grassPerChunk = 1; + this.sandPerChunk = 1; + this.sandPerChunk2 = 3; + this.clayPerChunk = 2; + this.generateLakes = true; + } + + int mDecoratorTimeout = 0; + + public void decorateChunk(World aWorld, Random aRand, BiomeGenBase aGen, int aX, int aZ) { + if (this.currentWorld != null && this.chunk_X == aX && this.chunk_Z == aZ) { + try { + while (this.currentWorld != null) { + if (mDecoratorTimeout % 1000 == 0) { + Logger.WORLD("Waiting for chunk @ "+aX+", "+aZ+" to generate. Waited "+mDecoratorTimeout+"ms already."); + } + if (this.currentWorld == null) { + break; + } + if (mDecoratorTimeout >= 5000) { + throw new RuntimeException("Already decorating!!"); + } + mDecoratorTimeout++; + } + } + catch (Throwable t) { + t.printStackTrace(); + throw new RuntimeException("Already decorating!!"); + } + } + if (this.currentWorld == null) { + this.currentWorld = aWorld; + this.randomGenerator = aRand; + this.chunk_X = aX; + this.chunk_Z = aZ; + this.genDecorations(aGen); + this.currentWorld = null; + this.randomGenerator = null; + } + } + + protected void genDecorations(BiomeGenBase p_150513_1_) { + MinecraftForge.EVENT_BUS.post(new DecorateBiomeEvent.Pre(currentWorld, randomGenerator, chunk_X, chunk_Z)); + this.generateOres(); + int i; + int j; + int k; + + boolean doGen = TerrainGen.decorate(currentWorld, randomGenerator, chunk_X, chunk_Z, SAND); + for (i = 0; doGen && i < this.sandPerChunk2; ++i) { + j = this.chunk_X + this.randomGenerator.nextInt(16) + 8; + k = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; + this.sandGen.generate(this.currentWorld, this.randomGenerator, j, + this.currentWorld.getTopSolidOrLiquidBlock(j, k), k); + } + + doGen = TerrainGen.decorate(currentWorld, randomGenerator, chunk_X, chunk_Z, CLAY); + for (i = 0; doGen && i < this.clayPerChunk; ++i) { + j = this.chunk_X + this.randomGenerator.nextInt(16) + 8; + k = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; + this.clayGen.generate(this.currentWorld, this.randomGenerator, j, + this.currentWorld.getTopSolidOrLiquidBlock(j, k), k); + } + + doGen = TerrainGen.decorate(currentWorld, randomGenerator, chunk_X, chunk_Z, SAND_PASS2); + for (i = 0; doGen && i < this.sandPerChunk; ++i) { + j = this.chunk_X + this.randomGenerator.nextInt(16) + 8; + k = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; + this.gravelAsSandGen.generate(this.currentWorld, this.randomGenerator, j, + this.currentWorld.getTopSolidOrLiquidBlock(j, k), k); + } + + i = this.treesPerChunk; + + if (this.randomGenerator.nextInt(10) == 0) { + ++i; + } + + int l; + int i1; + + doGen = TerrainGen.decorate(currentWorld, randomGenerator, chunk_X, chunk_Z, TREE); + for (j = 0; doGen && j < i; ++j) { + k = this.chunk_X + this.randomGenerator.nextInt(16) + 8; + l = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; + i1 = this.currentWorld.getHeightValue(k, l); + WorldGenAbstractTree worldgenabstracttree = p_150513_1_.func_150567_a(this.randomGenerator); + worldgenabstracttree.setScale(1.0D, 1.0D, 1.0D); + + if (worldgenabstracttree.generate(this.currentWorld, this.randomGenerator, k, i1, l)) { + worldgenabstracttree.func_150524_b(this.currentWorld, this.randomGenerator, k, i1, l); + } + } + + doGen = TerrainGen.decorate(currentWorld, randomGenerator, chunk_X, chunk_Z, BIG_SHROOM); + for (j = 0; doGen && j < this.bigMushroomsPerChunk; ++j) { + k = this.chunk_X + this.randomGenerator.nextInt(16) + 8; + l = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; + this.bigMushroomGen.generate(this.currentWorld, this.randomGenerator, k, + this.currentWorld.getHeightValue(k, l), l); + } + + doGen = TerrainGen.decorate(currentWorld, randomGenerator, chunk_X, chunk_Z, FLOWERS); + for (j = 0; doGen && j < this.flowersPerChunk; ++j) { + k = this.chunk_X + this.randomGenerator.nextInt(16) + 8; + l = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; + i1 = nextInt(this.currentWorld.getHeightValue(k, l) + 32); + String s = p_150513_1_.func_150572_a(this.randomGenerator, k, i1, l); + BlockFlower blockflower = BlockFlower.func_149857_e(s); + + if (blockflower.getMaterial() != Material.air) { + this.yellowFlowerGen.func_150550_a(blockflower, BlockFlower.func_149856_f(s)); + this.yellowFlowerGen.generate(this.currentWorld, this.randomGenerator, k, i1, l); + } + } + + doGen = TerrainGen.decorate(currentWorld, randomGenerator, chunk_X, chunk_Z, GRASS); + for (j = 0; doGen && j < this.grassPerChunk; ++j) { + k = this.chunk_X + this.randomGenerator.nextInt(16) + 8; + l = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; + i1 = nextInt(this.currentWorld.getHeightValue(k, l) * 2); + WorldGenerator worldgenerator = p_150513_1_.getRandomWorldGenForGrass(this.randomGenerator); + worldgenerator.generate(this.currentWorld, this.randomGenerator, k, i1, l); + } + + doGen = TerrainGen.decorate(currentWorld, randomGenerator, chunk_X, chunk_Z, DEAD_BUSH); + for (j = 0; doGen && j < this.deadBushPerChunk; ++j) { + k = this.chunk_X + this.randomGenerator.nextInt(16) + 8; + l = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; + i1 = nextInt(this.currentWorld.getHeightValue(k, l) * 2); + (new WorldGenDeadBush(Blocks.deadbush)).generate(this.currentWorld, this.randomGenerator, k, i1, l); + } + + doGen = TerrainGen.decorate(currentWorld, randomGenerator, chunk_X, chunk_Z, LILYPAD); + for (j = 0; doGen && j < this.waterlilyPerChunk; ++j) { + k = this.chunk_X + this.randomGenerator.nextInt(16) + 8; + l = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; + + for (i1 = nextInt(this.currentWorld.getHeightValue(k, l) * 2); i1 > 0 + && this.currentWorld.isAirBlock(k, i1 - 1, l); --i1) { + ; + } + + this.waterlilyGen.generate(this.currentWorld, this.randomGenerator, k, i1, l); + } + + doGen = TerrainGen.decorate(currentWorld, randomGenerator, chunk_X, chunk_Z, SHROOM); + for (j = 0; doGen && j < this.mushroomsPerChunk; ++j) { + if (this.randomGenerator.nextInt(4) == 0) { + k = this.chunk_X + this.randomGenerator.nextInt(16) + 8; + l = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; + i1 = this.currentWorld.getHeightValue(k, l); + this.mushroomBrownGen.generate(this.currentWorld, this.randomGenerator, k, i1, l); + } + + if (this.randomGenerator.nextInt(8) == 0) { + k = this.chunk_X + this.randomGenerator.nextInt(16) + 8; + l = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; + i1 = nextInt(this.currentWorld.getHeightValue(k, l) * 2); + this.mushroomRedGen.generate(this.currentWorld, this.randomGenerator, k, i1, l); + } + } + + if (doGen && this.randomGenerator.nextInt(4) == 0) { + j = this.chunk_X + this.randomGenerator.nextInt(16) + 8; + k = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; + l = nextInt(this.currentWorld.getHeightValue(j, k) * 2); + this.mushroomBrownGen.generate(this.currentWorld, this.randomGenerator, j, l, k); + } + + if (doGen && this.randomGenerator.nextInt(8) == 0) { + j = this.chunk_X + this.randomGenerator.nextInt(16) + 8; + k = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; + l = nextInt(this.currentWorld.getHeightValue(j, k) * 2); + this.mushroomRedGen.generate(this.currentWorld, this.randomGenerator, j, l, k); + } + + doGen = TerrainGen.decorate(currentWorld, randomGenerator, chunk_X, chunk_Z, REED); + for (j = 0; doGen && j < this.reedsPerChunk; ++j) { + k = this.chunk_X + this.randomGenerator.nextInt(16) + 8; + l = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; + i1 = nextInt(this.currentWorld.getHeightValue(k, l) * 2); + this.reedGen.generate(this.currentWorld, this.randomGenerator, k, i1, l); + } + + for (j = 0; doGen && j < 10; ++j) { + k = this.chunk_X + this.randomGenerator.nextInt(16) + 8; + l = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; + i1 = nextInt(this.currentWorld.getHeightValue(k, l) * 2); + this.reedGen.generate(this.currentWorld, this.randomGenerator, k, i1, l); + } + + doGen = TerrainGen.decorate(currentWorld, randomGenerator, chunk_X, chunk_Z, PUMPKIN); + if (doGen && this.randomGenerator.nextInt(32) == 0) { + j = this.chunk_X + this.randomGenerator.nextInt(16) + 8; + k = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; + l = nextInt(this.currentWorld.getHeightValue(j, k) * 2); + (new WorldGenPumpkin()).generate(this.currentWorld, this.randomGenerator, j, l, k); + } + + doGen = TerrainGen.decorate(currentWorld, randomGenerator, chunk_X, chunk_Z, CACTUS); + for (j = 0; doGen && j < this.cactiPerChunk; ++j) { + k = this.chunk_X + this.randomGenerator.nextInt(16) + 8; + l = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; + i1 = nextInt(this.currentWorld.getHeightValue(k, l) * 2); + this.cactusGen.generate(this.currentWorld, this.randomGenerator, k, i1, l); + } + + try { + int midX = Math.max(0, 7 / 2); + int midZ = Math.max(0, 7 / 2); + int mCurrentBiomeID = Integer.valueOf(currentWorld.getBiomeGenForCoords(chunk_X+midX, chunk_Z+midZ).biomeID); + + if (mCurrentBiomeID == GTplusplus_Australia.Australian_Outback_Biome.biomeID) { + this.generateLakes = false; + } + + if (mCurrentBiomeID != GTplusplus_Australia.Australian_Outback_Biome.biomeID) { + doGen = TerrainGen.decorate(currentWorld, randomGenerator, chunk_X, chunk_Z, LAKE); + if (doGen && this.generateLakes) { + for (j = 0; j < 50; ++j) { + k = this.chunk_X + this.randomGenerator.nextInt(16) + 8; + l = this.randomGenerator.nextInt(this.randomGenerator.nextInt(248) + 8); + i1 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; + (new WorldGenLiquids(Blocks.flowing_water)).generate(this.currentWorld, this.randomGenerator, k, l, i1); + } + + for (j = 0; j < 20; ++j) { + k = this.chunk_X + this.randomGenerator.nextInt(16) + 8; + l = this.randomGenerator + .nextInt(this.randomGenerator.nextInt(this.randomGenerator.nextInt(240) + 8) + 8); + i1 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; + (new WorldGenLiquids(Blocks.flowing_lava)).generate(this.currentWorld, this.randomGenerator, k, l, i1); + } + } + } + } + catch (Throwable t) { + + } + + MinecraftForge.EVENT_BUS.post(new DecorateBiomeEvent.Post(currentWorld, randomGenerator, chunk_X, chunk_Z)); + } + + /** + * Standard ore generation helper. Generates most ores. + */ + protected void genStandardOre1(int aAmount, WorldGenerator aOreGenerator, int p_76795_3_, int p_76795_4_) { + for (int l = 0; l < aAmount; ++l) { + int i1 = this.chunk_X + this.randomGenerator.nextInt(16); + int j1 = this.randomGenerator.nextInt(p_76795_4_ - p_76795_3_) + p_76795_3_; + int k1 = this.chunk_Z + this.randomGenerator.nextInt(16); + aOreGenerator.generate(this.currentWorld, this.randomGenerator, i1, j1, k1); + } + } + + /** + * S |
