Дело дошло до ген. Мира и всё вроде хорошо но есть одно НО. когда делаю новый мир. Майн крашится
Java:
package GlobalMod;
import GlobalMod.Blocks.Amber_Block;
import GlobalMod.CreativeTabs.CBlock;
import GlobalMod.World.BlockGenerator;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
@Mod(modid = "MyGlobalMod", name="Global mods", version = "1.0")
public class Main {
public static Block amber_Block;
public static CreativeTabs сblock = new CBlock("CookiesMods");
public static BlockGenerator blockgenerator = new BlockGenerator();
@Mod.EventHandler
public void preLoad(FMLPreInitializationEvent event)
{
ManagerRecipes.registerRecipes();
Ambers.registerItems();
amber_Block = new Amber_Block(Material.rock);
GameRegistry.registerBlock(amber_Block, "Amber_Block");
GameRegistry.registerWorldGenerator(new BlockGenerator(), 0);
}
}
BlockGenerator:
package GlobalMod.World;
import GlobalMod.Main;
import cpw.mods.fml.common.IWorldGenerator;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.feature.WorldGenMinable;
import java.util.Random;
public class BlockGenerator implements IWorldGenerator {
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) {
switch (world.provider.dimensionId)
{
case 1:
generateEnd(world, random, chunkX, chunkZ);
break;
case 0:
generateOverworld(world, random, chunkX, chunkZ);
break;
case -1:
generateNether(world, random, chunkX, chunkZ);
break;
}
}
public void generateEnd(World world, Random rand, int x, int z){
generateOre(Main.amber_Block, world, rand, x, z, 2, 10, 0, 100, Blocks.end_stone);
}
public void generateOverworld(World world, Random rand, int x, int z){
generateOre(Main.amber_Block, world, rand, x, z, 2, 10, 0, 100, Blocks.stone);
}
public void generateNether(World world, Random rand, int x, int z){
generateOre(Main.amber_Block, world, rand, x, z, 2, 10, 0, 100, Blocks.netherrack);
}
public void generateOre(Block block, World world, Random random, int chunkX, int chunkZ, int minViewSize, int maxViewSize, int minY, int maxY, Block generateIn){
int viewSize = minViewSize + random.nextInt(minViewSize - maxViewSize);
int heightRange = maxY - minY;
WorldGenMinable gen = new WorldGenMinable(block, viewSize,generateIn);
int xRand = chunkX * 16 + random.nextInt(16);
int yRand = random.nextInt(heightRange) + minY;
int zRand = chunkZ * 16 + random.nextInt(16);
gen.generate(world, random, xRand, yRand, zRand);
}
}