Plaigon Posted April 21, 2017 Posted April 21, 2017 Hello everyone, first i'd like to say i come from France, so it can explain why my english could seem really bad. But it's not my problem today, because i started a mod a few moment ago, in which i'm trying to generate my pyramid only once per world. Then to do it, i thought to use a counter in my IWorldGenerator subclass. Here is my code : public class MCAWGenerator implements IWorldGenerator { private byte counter = 0; public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) { if(world.provider.getDimension() == 0) { this.generateSurface(world, random, chunkX * 16, chunkZ * 16); } } private void generateSurface(World world, Random random, int i, int j) { if(world.isRemote) return; int x1 = i + random.nextInt(16); int y1 = 70; int z1 = j + random.nextInt(16); if(world.getBiome(new BlockPos(x1, y1, z1)) == Biomes.DESERT && counter == 0) { if((new CREEPSWorldGenPyramid()).generate(world, random, new BlockPos(x1, y1, z1))); { System.out.println("xCoord = " + x1); System.out.println("zCoord = " + z1); counter = 1; System.out.println("counter : " + counter); } } } } I normally register this class in my init function from main class. But i don't understand the logs, why does the world generate too much while i placed a limit ? Output console : [16:33:38] [Server thread/INFO] [STDOUT/]: [fr.plaigon.morecreepsandweirdos.common.worldgen.CREEPSWorldGenPyramid:generate:36]: yCoord = 70 [16:33:38] [Server thread/INFO] [STDOUT/]: [fr.plaigon.morecreepsandweirdos.common.worldgen.CREEPSWorldGenPyramid:generate:42]: minYCoord = 63 [16:33:38] [Server thread/INFO] [STDOUT/]: [fr.plaigon.morecreepsandweirdos.common.worldgen.CREEPSWorldGenPyramid:generate:42]: minYCoord = 62 [16:33:38] [Server thread/INFO] [STDOUT/]: [fr.plaigon.morecreepsandweirdos.common.worldgen.CREEPSWorldGenPyramid:generate:42]: minYCoord = 61 [16:33:38] [Server thread/INFO] [STDOUT/]: [fr.plaigon.morecreepsandweirdos.common.worldgen.CREEPSWorldGenPyramid:generate:36]: yCoord = 70 [16:33:38] [Server thread/INFO] [STDOUT/]: [fr.plaigon.morecreepsandweirdos.common.worldgen.CREEPSWorldGenPyramid:generate:42]: minYCoord = 69 [16:33:38] [Server thread/INFO] [STDOUT/]: [fr.plaigon.morecreepsandweirdos.common.worldgen.CREEPSWorldGenPyramid:generate:42]: minYCoord = 68 [16:33:38] [Server thread/INFO] [STDOUT/]: [fr.plaigon.morecreepsandweirdos.common.worldgen.CREEPSWorldGenPyramid:generate:42]: minYCoord = 67 [16:33:38] [Server thread/INFO] [STDOUT/]: [fr.plaigon.morecreepsandweirdos.common.worldgen.CREEPSWorldGenPyramid:generate:42]: minYCoord = 66 [16:33:38] [Server thread/INFO] [STDOUT/]: [fr.plaigon.morecreepsandweirdos.common.worldgen.CREEPSWorldGenPyramid:generate:36]: yCoord = 70 [16:33:38] [Server thread/INFO] [STDOUT/]: [fr.plaigon.morecreepsandweirdos.common.worldgen.CREEPSWorldGenPyramid:generate:42]: minYCoord = 70 [16:33:38] [Server thread/INFO] [STDOUT/]: [fr.plaigon.morecreepsandweirdos.common.worldgen.CREEPSWorldGenPyramid:generate:36]: yCoord = 70 [16:33:38] [Server thread/INFO] [STDOUT/]: [fr.plaigon.morecreepsandweirdos.common.worldgen.CREEPSWorldGenPyramid:generate:42]: minYCoord = 69 [16:33:38] [Server thread/INFO] [STDOUT/]: [fr.plaigon.morecreepsandweirdos.common.worldgen.CREEPSWorldGenPyramid:generate:36]: yCoord = 70 [16:33:38] [Server thread/INFO] [STDOUT/]: [fr.plaigon.morecreepsandweirdos.common.worldgen.CREEPSWorldGenPyramid:generate:42]: minYCoord = 70 [16:33:38] [Server thread/INFO] [STDOUT/]: [fr.plaigon.morecreepsandweirdos.common.worldgen.MCAWGenerator:generateSurface:38]: xCoord = -233 [16:33:38] [Server thread/INFO] [STDOUT/]: [fr.plaigon.morecreepsandweirdos.common.worldgen.MCAWGenerator:generateSurface:40]: zCoord = -149 [16:33:38] [Server thread/INFO] [STDOUT/]: [fr.plaigon.morecreepsandweirdos.common.worldgen.MCAWGenerator:generateSurface:43]: counter : 1 [16:33:38] [Server thread/INFO] [STDOUT/]: [fr.plaigon.morecreepsandweirdos.common.worldgen.MCAWGenerator:generateSurface:38]: xCoord = -235 [16:33:38] [Server thread/INFO] [STDOUT/]: [fr.plaigon.morecreepsandweirdos.common.worldgen.MCAWGenerator:generateSurface:40]: zCoord = -132 [16:33:38] [Server thread/INFO] [STDOUT/]: [fr.plaigon.morecreepsandweirdos.common.worldgen.MCAWGenerator:generateSurface:43]: counter : 1 [16:33:38] [Server thread/INFO] [STDOUT/]: [fr.plaigon.morecreepsandweirdos.common.worldgen.MCAWGenerator:generateSurface:38]: xCoord = -242 [16:33:38] [Server thread/INFO] [STDOUT/]: [fr.plaigon.morecreepsandweirdos.common.worldgen.MCAWGenerator:generateSurface:40]: zCoord = -141 [16:33:38] [Server thread/INFO] [STDOUT/]: [fr.plaigon.morecreepsandweirdos.common.worldgen.MCAWGenerator:generateSurface:43]: counter : 1 [16:33:38] [Server thread/INFO] [STDOUT/]: [fr.plaigon.morecreepsandweirdos.common.worldgen.MCAWGenerator:generateSurface:38]: xCoord = -254 [16:33:38] [Server thread/INFO] [STDOUT/]: [fr.plaigon.morecreepsandweirdos.common.worldgen.MCAWGenerator:generateSurface:40]: zCoord = -121 [16:33:38] [Server thread/INFO] [STDOUT/]: [fr.plaigon.morecreepsandweirdos.common.worldgen.MCAWGenerator:generateSurface:43]: counter : 1 [16:33:38] [Server thread/INFO] [STDOUT/]: [fr.plaigon.morecreepsandweirdos.common.worldgen.MCAWGenerator:generateSurface:38]: xCoord = -245 [16:33:38] [Server thread/INFO] [STDOUT/]: [fr.plaigon.morecreepsandweirdos.common.worldgen.MCAWGenerator:generateSurface:40]: zCoord = -100 [16:33:38] [Server thread/INFO] [STDOUT/]: [fr.plaigon.morecreepsandweirdos.common.worldgen.MCAWGenerator:generateSurface:43]: counter : 1 Thanks you in advance ! Quote
Matryoshika Posted April 21, 2017 Posted April 21, 2017 It generates, because during worldgen, the code creates a new MCAWGenerator at the suitable location. Move your counter out of that class, and put it somewhere that can be easily accessed, like your main class, for example. Quote Also previously known as eAndPi. "Pi, is there a station coming up where we can board your train of thought?" -Kronnn Published Mods: Underworld Handy links: Vic_'s Forge events Own WIP Tutorials.
Plaigon Posted April 24, 2017 Author Posted April 24, 2017 Hello, thanks for your answer, but it didn't solve my isssue. I changed my structure class, and moved out my counter to my main class. Here are my classes : IWorldGenerator : public class MCAWGenerator implements IWorldGenerator { public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) { if(world.provider.getDimension() == 0) { this.generateSurface(world, random, chunkX * 16, chunkZ * 16); } } private void generateSurface(World world, Random random, int i, int j) { if(world.isRemote) return; int x1 = i + random.nextInt(16); int y1 = 70; int z1 = j + random.nextInt(16); if(world.getBiome(new BlockPos(x1, y1, z1)) == Biomes.DESERT && MoreCreepsAndWeirdosMod.instance.pyramidsCounter == 0)// && worldSavedData.pyramidsCounter <= 5) { if((new CREEPSWorldGenPyramid()).generate(world, random, new BlockPos(x1, y1, z1))); { System.out.println("xCoord = " + x1); //Normalement yCoord = 70; System.out.println("zCoord = " + z1); MoreCreepsAndWeirdosMod.instance.pyramidsCounter = 1; System.out.println("counter : " + MoreCreepsAndWeirdosMod.instance.pyramidsCounter); } } } } My WorldGenerator : public class CREEPSWorldGenPyramid extends WorldGenerator { public static Random rand = new Random(); public boolean chunky; public boolean sandy; private int count; private int pyramids; public int rows; public int columns; public int maze[][]; public static int backgroundCode; public static int wallCode; public static int pathCode; public static int emptyCode; public static int visitedCode; public TileEntityChest chest; public int maxObstruct; public CREEPSWorldGenPyramid() { } public boolean blockExists(World parWorld, int x, int y, int z) { IBlockState state = parWorld.getBlockState(new BlockPos(x, y, z)); if (state != null) { return true; } else { return false; } } public boolean generate(World world, Random random, int i, int j, int k) { pyramids = 298; rows = 35; columns = 35; backgroundCode = 0; wallCode = 7; pathCode = 15; emptyCode = 0; visitedCode = 4; maze = new int[rows + 1][columns + 1]; maxObstruct = 100; int l = 0; int i1 = 0; label0: do { if (i1 >= 20) { break; } for (int j3 = -2 + i1; j3 < (rows - i1) + 2; j3 += 2) { for (int j6 = -2 + i1; j6 < (columns - i1) + 2; j6 += 2) { if (world.getBlockState(new BlockPos(i + j3, j + i1, k + j6)) != Blocks.AIR.getDefaultState()) { l++; } if (l > maxObstruct) { break label0; } } } i1 += 2; } while (true); chunky = false; sandy = false; if (world.getBlockState(new BlockPos(i + random.nextInt(16), j - 1, k + random.nextInt(16))).getBlock() == Blocks.SAND) { sandy = true; } if (blockExists(world, i, j, k) && blockExists(world, i + 35, j, k) && blockExists(world, i, j, k + 35) && blockExists(world, i + 35, j, k + 35)) { chunky = true; } if (sandy && chunky && l < maxObstruct) { makeMaze(); for (int j1 = 0; j1 < 3; j1++) { for (int k3 = 0; k3 < 3; k3++) { maze[33 - j1][33 - k3] = 0; } } for (int k1 = -2; k1 < 21; k1++) { for (int l3 = -2 + k1; l3 < (rows - k1) + 2; l3++) { for (int k6 = -2 + k1; k6 < (columns - k1) + 2; k6++) { world.setBlockState(new BlockPos(i + l3, j + k1, k + k6), Blocks.SANDSTONE.getDefaultState()); } } } for (int l1 = 0; l1 < rows; l1++) { for (int i4 = 0; i4 < columns; i4++) { world.setBlockState(new BlockPos(i + l1, j, k + i4), Blocks.DIAMOND_BLOCK.getDefaultState()); world.setBlockState(new BlockPos(i + l1, j - 1, k + i4), Blocks.EMERALD_BLOCK.getDefaultState()); world.setBlockState(new BlockPos(i + l1, j - 2, k + i4), Blocks.BEDROCK.getDefaultState()); } } for (int i2 = 0; i2 < 30; i2++) { int j4 = rand.nextInt(rows - 6) + 3; int l6 = rand.nextInt(columns - 6) + 3; if (maze[j4][l6] == 7) { world.setBlockState(new BlockPos(i + j4, j, k + l6), Blocks.GLASS.getDefaultState()); } } for (int j2 = 0; j2 < 15; j2++) { int k4 = rand.nextInt(rows - 6) + 3; int i7 = rand.nextInt(columns - 6) + 3; if (maze[k4][i7] == 7) { world.setBlockState(new BlockPos(i + k4, j - 1, k + i7), Blocks.SANDSTONE.getDefaultState()); world.setBlockState(new BlockPos(i + k4, j, k + i7), Blocks.SANDSTONE.getDefaultState()); } } for (int k2 = 0; k2 < 20; k2++) { int l4 = rand.nextInt(rows - 3) + 3; int j7 = rand.nextInt(columns - 3) + 3; if (maze[l4][j7] != 0) { continue; } world.setBlockState(new BlockPos(i + l4, j - 1, k + j7), Block.getBlockById(30).getDefaultState()); if (rand.nextInt(4) == 0) { world.setBlockState(new BlockPos(i + l4, j, k + j7), Blocks.WEB.getDefaultState()); } } for (int l2 = 0; l2 < 30; l2++) { int i5 = rand.nextInt(rows - 6) + 3; int k7 = rand.nextInt(columns - 6) + 3; if (maze[i5][k7] == 7) { world.setBlockState(new BlockPos(i + i5, j, k + k7), Blocks.TORCH.getDefaultState()); } } int i3 = 0; do { if (i3 >= 6) { break; } int j5 = rand.nextInt(rows - 3); int l7 = rand.nextInt(columns - 3); j5++; l7++; if (maze[j5][l7] == wallCode) { i3++; world.setBlockToAir(new BlockPos(i + j5, j - 1, k + l7)); world.setBlockToAir(new BlockPos(i + j5, j, k + l7)); world.setBlockState(new BlockPos(i + j5, j - 1, k + l7), Blocks.MOB_SPAWNER.getDefaultState()); TileEntityMobSpawner tileentitymobspawner = new TileEntityMobSpawner(); world.setTileEntity(new BlockPos(i + j5, j - 1, k + l7), tileentitymobspawner); int i8 = rand.nextInt(5); if (i8 == 0) { tileentitymobspawner.getSpawnerBaseLogic().setEntityName("BlackSoul"); } if (i8 == 1) { tileentitymobspawner.getSpawnerBaseLogic().setEntityName("BabyMummy"); } if (i8 > 1) { tileentitymobspawner.getSpawnerBaseLogic().setEntityName("Mummy"); } } } while (true); world.setBlockToAir(new BlockPos(i + 1, j - 1, k)); world.setBlockToAir(new BlockPos(i + 1, j, k)); for (int k5 = 0; k5 < 5; k5++) { world.setBlockToAir(new BlockPos(i + 1, j - 1, k - k5)); world.setBlockToAir(new BlockPos(i + 1, j, k - k5)); world.setBlockState(new BlockPos(i + 1, j, k - k5), Blocks.TORCH.getDefaultState()); } world.setBlockState(new BlockPos(i - 1, j, k - 5), Blocks.TORCH.getDefaultState()); world.setBlockState(new BlockPos(i + 1, j, k - 5), Blocks.TORCH.getDefaultState()); world.setBlockState(new BlockPos(i, j, k - 5), Blocks.TORCH.getDefaultState()); for (int l5 = 1; l5 < 25; l5++) { world.setBlockToAir(new BlockPos(i - 1, j + l5, k - 5)); world.setBlockToAir(new BlockPos(i + 1, j + l5, k - 5)); world.setBlockToAir(new BlockPos(i, j + l5, k - 5)); } world.setBlockState(new BlockPos(i, j + 26, k - 5), Blocks.TORCH.getDefaultState()); Item i6 = Items.BONE; float f = 0.7F; double d = (double)(world.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; double d1 = (double)(world.rand.nextFloat() * f) + (double)(1.0F - f) * 0.20000000000000001D + 0.59999999999999998D; double d2 = (double)(world.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; EntityItem entityitem = new EntityItem(world, ((double)i + d) - 2D, (double)j + d1, ((double)k + d2) - 2D, new ItemStack(i6, 5, 0)); world.spawnEntityInWorld(entityitem); world.setBlockState(new BlockPos((i + rows) - 2, j - 1, (k + columns) - 2), Block.getBlockById(54).getDefaultState()); TileEntityChest tileentitychest = new TileEntityChest(); world.setTileEntity(new BlockPos((i + rows) - 2, j - 1, (k + columns) - 2), tileentitychest); for (int j8 = 1; j8 < tileentitychest.getSizeInventory(); j8++) { int k8 = rand.nextInt(50); if (k8 == 0) { tileentitychest.setInventorySlotContents(j8, new ItemStack(ItemHandler.gooDonut, rand.nextInt(15) + 1, 0)); } if (k8 == 1) { tileentitychest.setInventorySlotContents(j8, new ItemStack(ItemHandler.bandAid, rand.nextInt(15) + 1, 0)); } if (k8 == 2) { tileentitychest.setInventorySlotContents(j8, new ItemStack(ItemHandler.rayGun, 1, 0)); } if (k8 == 3) { tileentitychest.setInventorySlotContents(j8, new ItemStack(ItemHandler.money, rand.nextInt(15) + 1, 0)); } if (k8 == 4) { tileentitychest.setInventorySlotContents(j8, new ItemStack(ItemHandler.blorpCola, rand.nextInt(10) + 5, 0)); } if (k8 == 5) { tileentitychest.setInventorySlotContents(j8, new ItemStack(Items.BREAD, 1, 0)); } if (k8 == 6) { tileentitychest.setInventorySlotContents(j8, new ItemStack(Items.GOLDEN_APPLE, 1, 0)); } if (k8 == 7) { tileentitychest.setInventorySlotContents(j8, new ItemStack(Items.GOLD_INGOT, rand.nextInt(3) + 2, 0)); } if (k8 == 8) { tileentitychest.setInventorySlotContents(j8, new ItemStack(Items.IRON_INGOT, rand.nextInt(5) + 2, 0)); } if (k8 == 9) { tileentitychest.setInventorySlotContents(j8, new ItemStack(Items.GUNPOWDER, rand.nextInt(4) + 2, 0)); } if (k8 == 10) { tileentitychest.setInventorySlotContents(j8, new ItemStack(Items.EGG, rand.nextInt(3) + 1, 0)); } if (k8 == 11) { tileentitychest.setInventorySlotContents(j8, new ItemStack(Items.WHEAT, rand.nextInt(12) + 2, 0)); } if (k8 == 12) { tileentitychest.setInventorySlotContents(j8, new ItemStack(ItemHandler.evilEgg, rand.nextInt(15) + 1, 0)); } if (k8 == 13) { tileentitychest.setInventorySlotContents(j8, new ItemStack(Items.DIAMOND, rand.nextInt(2) + 1, 0)); } if (k8 == 14) { tileentitychest.setInventorySlotContents(j8, new ItemStack(Items.IRON_SWORD, 1, 0)); } if (k8 == 15) { tileentitychest.setInventorySlotContents(j8, new ItemStack(Items.DIAMOND_SWORD, 1, 0)); } if (k8 == 16) { tileentitychest.setInventorySlotContents(j8, new ItemStack(Items.BOW, 1, 0)); } if (k8 == 17) { tileentitychest.setInventorySlotContents(j8, new ItemStack(Items.ARROW, rand.nextInt(30) + 10, 0)); } if (k8 == 18) { tileentitychest.setInventorySlotContents(j8, new ItemStack(Items.STICK, 1, 0)); } if (k8 == 19) { tileentitychest.setInventorySlotContents(j8, new ItemStack(Items.MILK_BUCKET, 1, 0)); } if (k8 == 20) { tileentitychest.setInventorySlotContents(j8, new ItemStack(Items.REEDS, rand.nextInt(6) + 6, 0)); } if (k8 == 21) { tileentitychest.setInventorySlotContents(j8, new ItemStack(Items.PAPER, rand.nextInt(16) + 6, 0)); } if (k8 == 22) { tileentitychest.setInventorySlotContents(j8, new ItemStack(Items.BOOK, 1, 0)); } if (k8 == 23) { tileentitychest.setInventorySlotContents(j8, new ItemStack(Items.COOKIE, rand.nextInt(6) + 6, 0)); } if (k8 == 24) { tileentitychest.setInventorySlotContents(j8, new ItemStack(Items.CAKE, rand.nextInt(6) + 6, 0)); } if (k8 == 25) { tileentitychest.setInventorySlotContents(j8, new ItemStack(Items.BUCKET, rand.nextInt(6) + 6, 0)); } if (k8 == 26) { tileentitychest.setInventorySlotContents(j8, new ItemStack(ItemHandler.evilEgg, rand.nextInt(40) + 1, 0)); } if (k8 == 16) { tileentitychest.setInventorySlotContents(j8, new ItemStack(Items.BONE, 1, 0)); } } // CREEPSEntityPyramidGuardian creepsentitypyramidguardian = new CREEPSEntityPyramidGuardian(world); // creepsentitypyramidguardian.setLocationAndAngles((i + rows) - 2, j - 1, (k + columns) - 3, 300F, 0.0F); // creepsentitypyramidguardian.motionX = 0.0D; // creepsentitypyramidguardian.motionY = 0.0D; // creepsentitypyramidguardian.motionZ = 0.0D; // world.spawnEntityInWorld(creepsentitypyramidguardian); for (int l8 = 0; l8 < rows; l8++) { for (int i9 = 0; i9 < columns; i9++) { world.setBlockState(new BlockPos(i + l8, j + 1, k + i9), Block.getBlockById(7).getDefaultState()); } } pyramids = 0; return true; } else { return true; } } public void makeMaze() { int l1 = 0; int i2 = 0; int ai[] = new int[(rows * columns) / 2]; int ai1[] = new int[(rows * columns) / 2]; for (int i = 0; i < rows; i++) { for (int i1 = 0; i1 < columns; i1++) { maze[i][i1] = wallCode; } } for (int j = 1; j < rows - 1; j += 2) { for (int j1 = 1; j1 < columns - 1; j1 += 2) { l1++; maze[j][j1] = -l1; if (j < rows - 2) { ai[i2] = j + 1; ai1[i2] = j1; i2++; } if (j1 < columns - 2) { ai[i2] = j; ai1[i2] = j1 + 1; i2++; } } } for (int k = i2 - 1; k > 0; k--) { int j2 = (int)(Math.random() * (double)k); if (ai[j2] % 2 == 1 && maze[ai[j2]][ai1[j2] - 1] != maze[ai[j2]][ai1[j2] + 1]) { fill(ai[j2], ai1[j2] - 1, maze[ai[j2]][ai1[j2] - 1], maze[ai[j2]][ai1[j2] + 1]); maze[ai[j2]][ai1[j2]] = maze[ai[j2]][ai1[j2] + 1]; } else if (ai[j2] % 2 == 0 && maze[ai[j2] - 1][ai1[j2]] != maze[ai[j2] + 1][ai1[j2]]) { fill(ai[j2] - 1, ai1[j2], maze[ai[j2] - 1][ai1[j2]], maze[ai[j2] + 1][ai1[j2]]); maze[ai[j2]][ai1[j2]] = maze[ai[j2] + 1][ai1[j2]]; } ai[j2] = ai[k]; ai1[j2] = ai1[k]; } for (int l = 1; l < rows - 1; l++) { for (int k1 = 1; k1 < columns - 1; k1++) { if (maze[l][k1] < 0) { maze[l][k1] = emptyCode; } } } } public void tearDown(int i, int j) { if (i % 2 == 1 && maze[i][j - 1] != maze[i][j + 1]) { fill(i, j - 1, maze[i][j - 1], maze[i][j + 1]); maze[i][j] = maze[i][j + 1]; } else if (i % 2 == 0 && maze[i - 1][j] != maze[i + 1][j]) { fill(i - 1, j, maze[i - 1][j], maze[i + 1][j]); maze[i][j] = maze[i + 1][j]; } } public void fill(int i, int j, int k, int l) { if (i < 0) { i = 0; } if (j < 0) { i = 0; } if (i > rows) { i = rows; } if (j > columns) { j = columns; } if (maze[i][j] == k) { maze[i][j] = l; fill(i + 1, j, k, l); fill(i - 1, j, k, l); fill(i, j + 1, k, l); fill(i, j - 1, k, l); } } @Override public boolean generate(World worldIn, Random p_180709_2_, BlockPos bp) { return generate(worldIn, p_180709_2_, bp.getX(), bp.getY(), bp.getZ()); } } And my main class : @Mod(modid = "morecreepsandweirdosmod", name = "More Creeps And Weirdos Mod", version = "1.0 RE") public class MoreCreepsAndWeirdosMod { @SidedProxy(clientSide = "fr.plaigon.morecreepsandweirdos.client.core.ClientProxy", serverSide = "fr.plaigon.morecreepsandweirdos.common.core.CommonProxy") public static CommonProxy proxy; @Instance("morecreepsandweirdosmod") public static MoreCreepsAndWeirdosMod instance; public static SimpleNetworkWrapper network; public static final String MODID = "morecreepsandweirdosmod"; public static final MCAWGenerator GENERATOR = new MCAWGenerator(); public int pyramidsCounter = 0; public CreativeTabs creepsTab = new CreativeTabs("CreepsTab") { @SideOnly(Side.CLIENT) public Item getTabIconItem() { return ItemHandler.blorpCola; } }; @EventHandler public void preInit(FMLPreInitializationEvent event) { network = NetworkRegistry.INSTANCE.newSimpleChannel("mcawchannel"); network.registerMessage(PacketPlaySoundGuineaPig.Handler.class, PacketPlaySoundGuineaPig.class, 0, Side.SERVER); } @EventHandler public void init(FMLInitializationEvent event) { if(event.getSide() == Side.CLIENT) { MinecraftForge.EVENT_BUS.register(new WelcomeMessageEventHandler()); } MinecraftForge.EVENT_BUS.register(new EntityLootsEventHandler()); MinecraftForge.EVENT_BUS.register(this); ItemHandler.initItems(); // if(event.getSide() == Side.CLIENT) // AchievementHandler.initAchievements(); EntityHandler.initEntities(); MCAWSoundEvent.registerSounds(); proxy.registerEntityRenderer(); proxy.registerBlockRenderer(); proxy.registerItemRenderer(); GameRegistry.registerWorldGenerator(GENERATOR, 0); // MinecraftForge.EVENT_BUS.register(new MCAWGenEventHandler()); } @EventHandler public void postInit(FMLPostInitializationEvent event) { } } Thanks you in advance ! Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.