Posted May 6, 201411 yr I'm trying to spawn mob spawners that are not pigs and I am following the guide on this page: http://www.minecraftforge.net/wiki/Mob_Spawners but getSpawnerLogic This is my code, I know I need to add one more line "zombies.getSpawnerLogic().setMobID(someEntityID);" but i get errors when I use those 2 functions world.setBlock(xPos+x, yPos+y, zPos+z,Blocks.mob_spawner); TileEntityMobSpawner zombies = (TileEntityMobSpawner)world.getTileEntity(xPos, yPos, zPos); Any help would be appreciated.
May 7, 201411 yr I was hoping someone would show up to give you a better system then mine...because mine is horrible to code, but since it's been a day and no one has, I'll give you mine. But please, someone who has a better system, please help this guy out! Mine only lets me do minor default things, and I know there's a way to code more advanced things! Anyway... TileEntityMobSpawner ttsnimspawner = (TileEntityMobSpawner)world.getTileEntity(i + 6, j + 11, k + 6); if (ttsnimspawner == null) { System.err.printf("TTSnimSpawner is null!?!\n"); } else { ttsnimspawner.func_145881_a().setEntityName("Skeleton"); } The main thing you'll want is to use that if statement, cause if, for some reason, the spawner isn't at the location you specified (maybe terrain grew over it or something) then it will bug out and crash the mod. The if statement prevents that from happening. Unfortunately, this only works for default standard mob spawners... I'd love to know how to code something like...baby zombie spawners with armor or something like that, though (seriously, I know there's a way!)
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.