From 05c78126859231a68e199dc34613689bd0978e2f Mon Sep 17 00:00:00 2001 From: Foghrye4 Date: Mon, 11 Apr 2016 19:44:54 +0300 Subject: Initial commit --- ihl/worldgen/WorldGenLiquidOre.java | 86 +++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 ihl/worldgen/WorldGenLiquidOre.java (limited to 'ihl/worldgen/WorldGenLiquidOre.java') diff --git a/ihl/worldgen/WorldGenLiquidOre.java b/ihl/worldgen/WorldGenLiquidOre.java new file mode 100644 index 0000000..f59fb2e --- /dev/null +++ b/ihl/worldgen/WorldGenLiquidOre.java @@ -0,0 +1,86 @@ +package ihl.worldgen; + +import java.util.Map; +import java.util.Random; +import java.util.Set; + +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.init.Blocks; +import net.minecraft.world.World; + +public class WorldGenLiquidOre extends WorldGenMinableMeta { + + public WorldGenLiquidOre(Set precalculatedChunkChache1,Map blockToOreCoordinates, Map> oreCoordinatesToChunkCoordinates, Block block, Block liquidBedBlock1, int meta, int numberOfBlocks1, int veinMinHeightLimit1, int veinMaxHeightLimit1, Block... replacedBlock1) + { + super(precalculatedChunkChache1,blockToOreCoordinates, oreCoordinatesToChunkCoordinates,block, liquidBedBlock1, meta, numberOfBlocks1, veinMinHeightLimit1, veinMaxHeightLimit1, replacedBlock1); + } + + @Override + public boolean generate(World world, Random random, int x, int y, int z) + { + if(replaceableBlocks.contains(world.getBlock(x, y, z))) + { + if(y<44 || world.getBlock(x, y+1, z).isAir(world, x, y+1, z) || world.getBlock(x, y+1, z).equals(Blocks.air)) + { + world.setBlock(x, y, z, mineableBlock, mineableBlockMeta, 2); + int x1,y1,z1; + int xyz[] = {0,0,1,0,0,-1,0,0}; + Block block; + for(int i=0;i<=5;i++) + { + x1=x+xyz[i]; + y1=y+xyz[i+1]; + z1=z+xyz[i+2]; + block = world.getBlock(x1,y1,z1); + if(block!=mineableBlock) + { + if(block.getMaterial()==Material.lava) + { + world.setBlock(x1, y1, z1, Blocks.obsidian, 0, 2); + } + else if(!block.isAir(world, x1, y1, z1) || xyz[i+1]<=0) + { + world.setBlock(x1, y1, z1, liquidBedBlock, 0, 2); + } + } + } + return true; + } + } + return false; + } + + @Override + public boolean generateNewVein(Random random, int chunkX1, int chunkZ1) + { + int chunkX = chunkX1; + int chunkZ = chunkZ1; + int x0=chunkX << 4; + int z0=chunkZ << 4; + long chunkKey = (chunkX<<16)+chunkZ; + for(int ix=x0-this.numberOfBlocks/2;ix>4; + chunkZ=z0>>4; + chunkKey = (chunkX<<16)+chunkZ; + updateOreCoordinatesToChunkCoordinates(chunkKey, oreCoordinatesArray); + this.blockToOreCoordinates.put(oreCoordinatesKey, this); + this.precalculatedChunkChache.add(chunkKey); + } + } + } + } + } + return true; + } +} -- cgit v1.2.3