Jump to content

Recommended Posts

Posted

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.

Posted

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.