- 461
- 13
- 37
Всем привет. Не работает генерация руды
Класс, унаследовавший IWorldGenerator
Регистрация в CommonProxy:
Класс, унаследовавший IWorldGenerator
Java:
@Override
public void generate(Random rand, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) {
generateOverworld(rand, chunkX, chunkZ, world);
generateNether(rand, chunkX, chunkZ, world);
generateEnd(rand, chunkX, chunkZ, world);
}
private void generateOverworld(Random rand, int chunkX, int chunkZ, World world) { generateOverworld(world, rand, chunkX * 16, chunkZ * 16); }
private void generateNether(Random rand, int chunkX, int chunkZ, World world) { generateNether(world, rand, chunkX * 16, chunkZ * 16); }
private void generateEnd(Random rand, int chunkX, int chunkZ, World world) { generateEnd(world, rand, chunkX * 16, chunkZ * 16); }
public void generateOverworld(World world, Random rand, int blockXPos, int blockZPos) {
addOreSpawn(StorageBlocks.coinblock, Blocks.stone, world, rand, blockXPos, blockZPos, 16, 16, 1, 2, 1, 1, 10, 5, 6);
}
public void generateNether(World world, Random rand, int blockXPos, int blockZPos) { }
public void generateEnd(World world, Random rand, int blockXPos, int blockZPos) { }
public static void addOreSpawn(Block ore, Block replace, World world, Random rand, int blockXPos, int blockZPos, int maxX, int maxZ, int minVeinSize, int maxVeinSize, int minVeinsPerChunk, int maxVeinsPerChunk, int chanceToSpawn, int minY, int maxY) {
if (rand.nextInt(101) < (100 - chanceToSpawn)) return;
int veins = rand.nextInt(maxVeinsPerChunk - minVeinsPerChunk + 1) + minVeinsPerChunk;
for (int i = 0; i < veins; i++) {
int posX = blockXPos + rand.nextInt(maxX);
int posY = minY + rand.nextInt(maxY - minY);
int posZ = blockZPos + rand.nextInt(maxZ);
(new WorldGenMinable(ore, minVeinSize + rand.nextInt(maxVeinSize - minVeinSize + 1), replace)).generate(world, rand, posX, posY, posZ);
}
}
}
Регистрация в CommonProxy:
Java:
public void preInit(FMLPreInitializationEvent event) {
StorageItems.registerItems();
StorageBlocks.registerBlocks();
GameRegistry.registerWorldGenerator(customGeneration, 0);
}