Доброй всем ночи, делал генерацию руды по туториалам Bedrock Miner'а, руда генерируется, но есть проблемы.
Мод добавляет 4 новые руды, медь, олово, серебро и титан. Медь и олово имеет шанс спавна 20% и может быть в кучке до 8ми штук, с ними проблем нет. Серебро имеет шанс спавна 10% и может быть найдено до 6ти штук в кучке. Титан использует точечную генерацию и имеет шанс спавна 5%.
Проблем с медью и оловом нет, они спавнятся везде и как положено, но серебро и титан почему-то спавнятся только вдоль одной линии, никаким образом не возникая в любых других частях карты.
Прошу помощи.
class ModWorldGen
[font=helvetica, arial, sans-serif][/font]
[merge_posts_bbcode]Добавлено: 30.10.2015 04:31:54[/merge_posts_bbcode]
Почему-то покрашилась шапка темы
ModWorldGen
WorldGenSingleMinable
Мод добавляет 4 новые руды, медь, олово, серебро и титан. Медь и олово имеет шанс спавна 20% и может быть в кучке до 8ми штук, с ними проблем нет. Серебро имеет шанс спавна 10% и может быть найдено до 6ти штук в кучке. Титан использует точечную генерацию и имеет шанс спавна 5%.
Проблем с медью и оловом нет, они спавнятся везде и как положено, но серебро и титан почему-то спавнятся только вдоль одной линии, никаким образом не возникая в любых других частях карты.
Прошу помощи.
class ModWorldGen
[font=helvetica, arial, sans-serif][/font]
[merge_posts_bbcode]Добавлено: 30.10.2015 04:31:54[/merge_posts_bbcode]
Почему-то покрашилась шапка темы
ModWorldGen
Код:
package com.CAJlO.CAJlOs_server.world;
import java.util.Random;
import com.CAJlO.CAJlOs_server.block.ModBlocks;
import net.minecraft.init.Blocks;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.feature.WorldGenMinable;
import net.minecraft.world.gen.feature.WorldGenerator;
import cpw.mods.fml.common.IWorldGenerator;
public class ModWorldGen implements IWorldGenerator {
//private WorldGenerator gen_tutorial_ore; //Generates Tutorial Ore (used in Overworld)
//private WorldGenerator gen_multi_ore; //Generates Multi Ore (used in Overworld)
//private WorldGenerator gen_cobblestone; //Generates Cobblestone (used in End)
private WorldGenerator gen_oreCopper;
private WorldGenerator gen_oreSilver;
private WorldGenerator gen_oreTin;
private WorldGenerator gen_oreTitanium;
public ModWorldGen() {
//this.gen_tutorial_ore = new WorldGenMinable(ModBlocks.oreTin, 8); //до 8 кусков в одной куче
//this.gen_multi_ore = new WorldGenSingleMinable(ModBlocks.oreTitanium);
//this.gen_cobblestone = new WorldGenMinable(Blocks.cobblestone, 16, Blocks.end_stone);
this.gen_oreCopper = new WorldGenMinable(ModBlocks.oreCopper, 8);
this.gen_oreSilver = new WorldGenMinable(ModBlocks.oreSilver, 6);
this.gen_oreTin = new WorldGenMinable(ModBlocks.oreTin, 8);
this.gen_oreTitanium = new WorldGenSingleMinable(ModBlocks.oreTitanium);
}
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) {
switch (world.provider.dimensionId) {
case 0: //Overworld
//this.runGenerator(this.gen_tutorial_ore, world, random, chunkX, chunkZ, 20, 0, 64);
//this.runGenerator(this.gen_multi_ore, world, random, chunkX, chunkX, 20, 0, 16);
this.runGenerator(this.gen_oreCopper, world, random, chunkX, chunkZ, 20, 36, 108);
this.runGenerator(this.gen_oreSilver, world, random, chunkX, chunkX, 10, 1, 48);
this.runGenerator(this.gen_oreTin, world, random, chunkX, chunkZ, 20, 36, 108);
this.runGenerator(this.gen_oreTitanium, world, random, chunkX, chunkX, 5, 1, 64);
break;
case -1: //Nether
break;
case 1: //End
//this.runGenerator(this.gen_cobblestone, world, random, chunkX, chunkZ, 10, 0, 80);
break;
}
}
private void runGenerator(WorldGenerator generator, World world, Random rand, int chunk_X, int chunk_Z, int chancesToSpawn, int minHeight, int maxHeight) {
if (minHeight < 0 || maxHeight > 256 || minHeight > maxHeight)
throw new IllegalArgumentException("Illegal Height Arguments for WorldGenerator");
int heightDiff = maxHeight - minHeight + 1;
for (int i = 0; i < chancesToSpawn; i ++) {
int x = chunk_X * 16 + rand.nextInt(16);
int y = minHeight + rand.nextInt(heightDiff);
int z = chunk_Z * 16 + rand.nextInt(16);
generator.generate(world, rand, x, y, z);
}
}
}
WorldGenSingleMinable
Код:
package com.CAJlO.CAJlOs_server.world;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenerator;
public class WorldGenSingleMinable extends WorldGenerator {
private Block block;
private int blockmeta;
private Block target;
public WorldGenSingleMinable(Block block, int meta, Block target) {
this.block = block;
this.blockmeta = meta;
this.target = target;
}
public WorldGenSingleMinable(Block block, Block target) {
this(block, 0, target);
}
public WorldGenSingleMinable(Block block) {
this(block, Blocks.stone);
}
@Override
public boolean generate(World world, Random random, int x, int y, int z) {
if (world.getBlock(x, y, z).isReplaceableOreGen(world, x, y, z, this.target))
world.setBlock(x, y, z, this.block, this.blockmeta, 2);
return true;
}
}