net.minecraft.world.gen.feature.WorldGenMinable Java Examples
The following examples show how to use
net.minecraft.world.gen.feature.WorldGenMinable.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: OreGenerator.java From EmergingTechnology with MIT License | 6 votes |
public void addOreSpawn(Block block, byte blockMeta, Block targetBlock, World world, Random random, int blockXPos, int blockZPos, int minVeinSize, int maxVeinSize, int chancesToSpawn, int minY, int maxY, boolean restrictBiome) { WorldGenMinable minable = new WorldGenMinable(block.getStateFromMeta(blockMeta), (minVeinSize + random.nextInt(maxVeinSize - minVeinSize + 1)), BlockStateMatcher.forBlock(targetBlock)); for (int i = 0; i < chancesToSpawn; i++) { int posX = blockXPos + random.nextInt(16); int posY = minY + random.nextInt(maxY - minY); int posZ = blockZPos + random.nextInt(16); BlockPos plannedPosition = new BlockPos(posX, posY, posZ); Biome blockBiome = world.getBiome(plannedPosition); for (Biome biome : validBiomes) { if (biome == blockBiome || !restrictBiome) { minable.generate(world, random, new BlockPos(posX, posY, posZ)); break; } } } }
Example #2
Source File: CustomizableOreGen.java From AdvancedRocketry with MIT License | 6 votes |
@Override public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) { Predicate<IBlockState> predicate = null; if(DimensionManager.getInstance().isDimensionCreated(world.provider.getDimension())) { IBlockState state = ((DimensionProperties)DimensionManager.getInstance().getDimensionProperties(world.provider.getDimension())).getStoneBlock(); if(state != null) predicate = new CustomPredicate(state); } for(int i = 0; i < numPerChunk; i++) { int coordX = 16*chunkX + random.nextInt(16); int coordY = heightLevel + random.nextInt(difference); int coordZ = 16*chunkZ + random.nextInt(16); if(predicate != null) new WorldGenMinable(oreToGen, clumpSize, predicate).generate(world, random, new BlockPos(coordX, coordY, coordZ)); else new WorldGenMinable(oreToGen, clumpSize).generate(world, random, new BlockPos(coordX, coordY, coordZ)); } }
Example #3
Source File: GTOreGenerator.java From GT-Classic with GNU Lesser General Public License v3.0 | 6 votes |
/** rare ore generator **/ public static void generateRareVein(Block block, boolean generate, int blockAmount, int chancesToSpawn, int minHeight, int maxHeight, Block blockToReplace, World world, Random rand, int chunkX, int chunkZ) { if (generate) { WorldGenMinable generator = new WorldGenMinable(block.getDefaultState(), blockAmount, BlockMatcher.forBlock(blockToReplace)); int heightdiff = maxHeight - minHeight + 1; for (int i = 0; i < chancesToSpawn; i++) { int var1 = rand.nextInt(1024); if (var1 == 0) { int x = chunkX * 16 + rand.nextInt(16); int y = minHeight + rand.nextInt(heightdiff); int z = chunkZ * 16 + rand.nextInt(16); generator.generate(world, rand, new BlockPos(x, y, z)); } } } }
Example #4
Source File: ValkyrienSkiesWorldGen.java From Valkyrien-Skies with Apache License 2.0 | 6 votes |
@Override public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) { if (ValkyrienSkiesWorld.OREGEN_ENABLED && VSConfig.valkyriumSpawnRate > 0) { if (this.genValkyriumOre == null) { this.genValkyriumOre = new WorldGenMinable( ValkyrienSkiesWorld.INSTANCE.valkyriumOre.getDefaultState(), 8); } switch (world.provider.getDimension()) { case 0: //Overworld this.runValkyriumGenerator(this.genValkyriumOre, world, random, chunkX, chunkZ, VSConfig.valkyriumSpawnRate, 0, 25); // runDungeonGenerator(world, random, chunkX, chunkZ, 1); break; case -1: //Nvalkyrium break; case 1: //End break; } } }
Example #5
Source File: WorldGenLoader.java From Sakura_mod with MIT License | 5 votes |
@SubscribeEvent public void onOreGen(OreGenEvent.Post event) { World worldIn = event.getWorld(); int genY = 10 + event.getRand().nextInt(24); if (SakuraConfig.every_where_sakura_diamond||(worldIn.getBiome(new BlockPos(event.getPos().getX(), 0, event.getPos().getZ())) == SakuraBiomes.BAMBOOFOREST || worldIn.getBiome(new BlockPos(event.getPos().getX(), 0, event.getPos().getZ())) == SakuraBiomes.MAPLEFOREST)) { BlockPos pos=new BlockPos(event.getPos().getX(),genY, event.getPos().getZ()); for (int i = 0; i < 2; i++) { new WorldGenMinable(BlockLoader.SAKURA_DIAMOND_ORE.getDefaultState(),3 + event.getRand().nextInt(5)).generate(worldIn, event.getRand(), pos); } } }
Example #6
Source File: GeneratorChisel.java From Chisel-2 with GNU General Public License v2.0 | 5 votes |
protected void genStandardOre(WorldGenMinable gen, WorldGenInfo info, World world, Random random, int x, int z) { for (int l = 0; l < info.amount; ++l) { if (random.nextDouble() < info.chance) { int avgX = x + random.nextInt(16); int avgY = info.minY + random.nextInt(info.maxY - info.minY) + 1; int avgZ = z + random.nextInt(16); gen.generate(world, random, avgX, avgY, avgZ); } } }
Example #7
Source File: OreGenerator.java From AdvancedRocketry with MIT License | 5 votes |
@Override public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) { OreGenEvent event = new OreGenEvent.GenerateMinable(world, random, this, new BlockPos(chunkX,0,chunkZ), EventType.CUSTOM); MinecraftForge.ORE_GEN_BUS.post(event); if(event.getResult() != Result.DENY) { if(Configuration.generateCopper) { generate(world, MaterialRegistry.getMaterialFromName("Copper"), Configuration.copperPerChunk, Configuration.copperClumpSize, chunkX, chunkZ, random); } if(Configuration.generateTin) { generate(world, MaterialRegistry.getMaterialFromName("Tin"), Configuration.tinPerChunk, Configuration.tinClumpSize, chunkX, chunkZ, random); } if(Configuration.generateRutile) { generate(world, MaterialRegistry.getMaterialFromName("Rutile"), Configuration.rutilePerChunk, Configuration.rutileClumpSize, chunkX, chunkZ, random); } if(Configuration.generateAluminum) { generate(world, MaterialRegistry.getMaterialFromName("Aluminum"), Configuration.aluminumPerChunk, Configuration.aluminumClumpSize, chunkX, chunkZ, random); } if(Configuration.generateIridium) { generate(world, MaterialRegistry.getMaterialFromName("Iridium"), Configuration.IridiumPerChunk, Configuration.IridiumClumpSize, chunkX, chunkZ, random); } if(Configuration.generateDilithium) { int dilithiumChance = Configuration.dilithiumPerChunk; if(world.provider instanceof WorldProviderPlanet) { dilithiumChance = DimensionProperties.AtmosphereTypes.getAtmosphereTypeFromValue(DimensionManager.getInstance().getDimensionProperties(world.provider.getDimension()).getAtmosphereDensity()) == DimensionProperties.AtmosphereTypes.NONE ? Configuration.dilithiumPerChunkMoon : Configuration.dilithiumPerChunk;; } for(int i = 0; i < dilithiumChance; i++) { int coordX = 16*chunkX + random.nextInt(16); int coordY = random.nextInt(64); int coordZ = 16*chunkZ + random.nextInt(16); new WorldGenMinable(MaterialRegistry.getMaterialFromName("Dilithium").getBlock().getDefaultState(), Configuration.dilithiumClumpSize).generate(world, random, new BlockPos(coordX, coordY, coordZ)); } } } }
Example #8
Source File: OreGenerator.java From AdvancedRocketry with MIT License | 5 votes |
private void generate(World world, Material material, int numPerChunk,int clumpSize, int chunkX, int chunkZ, Random random) { for(int i = 0; i < numPerChunk; i++) { int coordX = 16*chunkX + random.nextInt(16); int coordY = random.nextInt(64); int coordZ = 16*chunkZ + random.nextInt(16); Block block = Block.getBlockFromItem(material.getProduct(AllowedProducts.getProductByName("ORE")).getItem()); new WorldGenMinable(block.getStateFromMeta(material.getMeta()), clumpSize).generate(world, random, new BlockPos(coordX, coordY, coordZ)); } }
Example #9
Source File: PLWorldGen.java From Production-Line with MIT License | 5 votes |
private void generateOre(World world, Random rand, int chunkX, int chunkZ) { for (int k = 0; k < TICKET; k++) { int x = chunkX * 16 + rand.nextInt(16); int y = rand.nextInt(MAX_HEIGHT); int z = chunkZ * 16 + rand.nextInt(16); new WorldGenMinable(GEN_BLOCK, GEN_SIZE).generate(world, rand, new BlockPos(x, y, z)); } }
Example #10
Source File: LPWorldGen.java From Logistics-Pipes-2 with MIT License | 5 votes |
public OreGen(String name, IBlockState state, int maxVeinSize, Block replaceTarget, int minY, int maxY, int chunkOccurence, int weight) { this.name = name; this.ore = new WorldGenMinable(state, maxVeinSize, BlockMatcher.forBlock(replaceTarget)); this.minY = minY; this.maxY = maxY; this.chunkOccurence = chunkOccurence; this. weight = weight; }
Example #11
Source File: OreGenerator.java From YouTubeModdingTutorial with MIT License | 5 votes |
public void addOreSpawn(Block block, byte blockMeta, Block targetBlock, World world, Random random, int blockXPos, int blockZPos, int minVeinSize, int maxVeinSize, int chancesToSpawn, int minY, int maxY) { WorldGenMinable minable = new WorldGenMinable(block.getStateFromMeta(blockMeta), (minVeinSize + random.nextInt(maxVeinSize - minVeinSize + 1)), BlockMatcher.forBlock(targetBlock)); for (int i = 0 ; i < chancesToSpawn ; i++) { int posX = blockXPos + random.nextInt(16); int posY = minY + random.nextInt(maxY - minY); int posZ = blockZPos + random.nextInt(16); minable.generate(world, random, new BlockPos(posX, posY, posZ)); } }
Example #12
Source File: GTOreGenerator.java From GT-Classic with GNU Lesser General Public License v3.0 | 5 votes |
/** default ore generator **/ public static void generateBasicVein(Block block, boolean generate, int blockAmount, int chancesToSpawn, int minHeight, int maxHeight, Block blockToReplace, World world, Random rand, int chunkX, int chunkZ) { if (generate) { WorldGenMinable generator = new WorldGenMinable(block.getDefaultState(), blockAmount, BlockMatcher.forBlock(blockToReplace)); int heightdiff = maxHeight - minHeight + 1; for (int i = 0; i < chancesToSpawn; i++) { int x = chunkX * 16 + rand.nextInt(16); int y = minHeight + rand.nextInt(heightdiff); int z = chunkZ * 16 + rand.nextInt(16); generator.generate(world, rand, new BlockPos(x, y, z)); } } }
Example #13
Source File: TofuOreGenerator.java From TofuCraftReload with MIT License | 5 votes |
private void generateOre(World world, Random random, int x, int z) { if (world.provider instanceof WorldProviderSurface) { for (int i = 0; i < 9; i++) { int genX = x + random.nextInt(16); int genY = 10 + random.nextInt(60); int genZ = z + random.nextInt(16); new WorldGenMinable( BlockLoader.TOFUGEM_ORE.getDefaultState(), 3 + random.nextInt(6)).generate(world, random, new BlockPos(genX, genY, genZ)); } } }
Example #14
Source File: QuantumOreGenerator.java From qcraft-mod with Apache License 2.0 | 4 votes |
public QuantumOreGenerator() { m_oreGen = new WorldGenMinable( QCraft.Blocks.quantumOre, 5 ); }
Example #15
Source File: EtFuturumWorldGenerator.java From Et-Futurum with The Unlicense | 4 votes |
public EtFuturumWorldGenerator() { generators.add(new WorldGenMinable(ModBlocks.stone, 1, EtFuturum.maxStonesPerCluster, Blocks.stone)); generators.add(new WorldGenMinable(ModBlocks.stone, 3, EtFuturum.maxStonesPerCluster, Blocks.stone)); generators.add(new WorldGenMinable(ModBlocks.stone, 5, EtFuturum.maxStonesPerCluster, Blocks.stone)); }
Example #16
Source File: GeneratorChisel.java From Chisel-2 with GNU General Public License v2.0 | 4 votes |
public void addFeature(Block block, int count, int amount, int minY, int maxY, double chance) { map.put(new WorldGenMinable(block, count), new WorldGenInfo(amount, minY, maxY, chance)); }
Example #17
Source File: GeneratorChisel.java From Chisel-2 with GNU General Public License v2.0 | 4 votes |
@Override public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) { for (WorldGenMinable gen : map.keySet()) { genStandardOre(gen, map.get(gen), world, random, chunkX * 16, chunkZ * 16); } }
Example #18
Source File: GeneratorLimestone.java From Chisel with GNU General Public License v2.0 | 4 votes |
public GeneratorLimestone(Block block, int count, int am) { gen = new WorldGenMinable(block, count); amount = am; }
Example #19
Source File: GeneratorMarble.java From Chisel with GNU General Public License v2.0 | 4 votes |
public GeneratorMarble(Block block, int count, int am) { gen = new WorldGenMinable(block, count); amount = am; }