Jump to content

Mob Spawner IDs?


NigNog420

Recommended Posts

Hi,

 

I wanted to create a mod with crafting recipes for mob spawners, so I created a new block and added an event for zombies to, additionally to their standard loot, be able to drop their spawn eggs at a low rate because the recipe includes the new block and the spawn egg. Almost everything works fine, the zombies drop the new loot, but the crafting recipe doesn't work the way I want it to because I can only get pig spawners out of my new recipe. So, my question is: How do you specify mob spawner IDs?

 

My crafting recipe line:

GameRegistry.addShapedRecipe(new ItemStack(Blocks.mob_spawner, 1, 54),
			new Object[] { "SSS", "SZS", "SSS", 'S',
					new ItemStack(NewOres.spawnerBars, 1), 'Z',
					new ItemStack(Items.spawn_egg, 1, 54) });

As you can see, I tried to specify the mob spawner with the metadata ID of zombie spawn eggs, but that doesn't work.

Link to comment
Share on other sites

Hi,

 

I wanted to create a mod with crafting recipes for mob spawners, so I created a new block and added an event for zombies to, additionally to their standard loot, be able to drop their spawn eggs at a low rate because the recipe includes the new block and the spawn egg. Almost everything works fine, the zombies drop the new loot, but the crafting recipe doesn't work the way I want it to because I can only get pig spawners out of my new recipe. So, my question is: How do you specify mob spawner IDs?

 

My crafting recipe line:

GameRegistry.addShapedRecipe(new ItemStack(Blocks.mob_spawner, 1, 54),
			new Object[] { "SSS", "SZS", "SSS", 'S',
					new ItemStack(NewOres.spawnerBars, 1), 'Z',
					new ItemStack(Items.spawn_egg, 1, 54) });

As you can see, I tried to specify the mob spawner with the metadata ID of zombie spawn eggs, but that doesn't work.

 

GameRegistry.addShapedRecipe(new ItemStack(YourMod.YourItem), "SSS", "SZS", "SZS", 'S', YourMod.YourItem, 'Z', Items.spawn_egg, 1, 54);

you need to set it yo be zombie spawn egg like this

 

Proud mod developer of:

 

Mob Armor mod

Block monster mod

Clay Living Dolls mod

Much More Spiders mod

Elemental cows reborn

Mr gorilla mod

Link to comment
Share on other sites

Hi,

 

I wanted to create a mod with crafting recipes for mob spawners, so I created a new block and added an event for zombies to, additionally to their standard loot, be able to drop their spawn eggs at a low rate because the recipe includes the new block and the spawn egg. Almost everything works fine, the zombies drop the new loot, but the crafting recipe doesn't work the way I want it to because I can only get pig spawners out of my new recipe. So, my question is: How do you specify mob spawner IDs?

 

My crafting recipe line:

GameRegistry.addShapedRecipe(new ItemStack(Blocks.mob_spawner, 1, 54),
			new Object[] { "SSS", "SZS", "SSS", 'S',
					new ItemStack(NewOres.spawnerBars, 1), 'Z',
					new ItemStack(Items.spawn_egg, 1, 54) });

As you can see, I tried to specify the mob spawner with the metadata ID of zombie spawn eggs, but that doesn't work.

 

GameRegistry.addShapedRecipe(new ItemStack(YourMod.YourItem), "SSS", "SZS", "SZS", 'S', YourMod.YourItem, 'Z', Items.spawn_egg, 1, 54);

you need to set it yo be zombie spawn egg like this

It is, you don't see it well, but after new ItemStack(NewOres.spawnerBars, 1), there is the 'Z', but then the new line starts, which made it harder to see.

Link to comment
Share on other sites

Hi,

 

I wanted to create a mod with crafting recipes for mob spawners, so I created a new block and added an event for zombies to, additionally to their standard loot, be able to drop their spawn eggs at a low rate because the recipe includes the new block and the spawn egg. Almost everything works fine, the zombies drop the new loot, but the crafting recipe doesn't work the way I want it to because I can only get pig spawners out of my new recipe. So, my question is: How do you specify mob spawner IDs?

 

 

don't do new object

 

do recipe just like this

 

GameRegistry.addShapedRecipe(new ItemStack(YourMod.YourItem), "SSS", "SZS", "SZS", 'S', YourMod.YourItem, 'Z', Items.spawn_egg, 1, 54);

 

it will always work , for blocks and items

My crafting recipe line:

GameRegistry.addShapedRecipe(new ItemStack(Blocks.mob_spawner, 1, 54),
			new Object[] { "SSS", "SZS", "SSS", 'S',
					new ItemStack(NewOres.spawnerBars, 1), 'Z',
					new ItemStack(Items.spawn_egg, 1, 54) });

As you can see, I tried to specify the mob spawner with the metadata ID of zombie spawn eggs, but that doesn't work.

 

GameRegistry.addShapedRecipe(new ItemStack(YourMod.YourItem), "SSS", "SZS", "SZS", 'S', YourMod.YourItem, 'Z', Items.spawn_egg, 1, 54);

you need to set it yo be zombie spawn egg like this

It is, you don't see it well, but after new ItemStack(NewOres.spawnerBars, 1), there is the 'Z', but then the new line starts, which made it harder to see.

Proud mod developer of:

 

Mob Armor mod

Block monster mod

Clay Living Dolls mod

Much More Spiders mod

Elemental cows reborn

Mr gorilla mod

Link to comment
Share on other sites

Hi,

 

I wanted to create a mod with crafting recipes for mob spawners, so I created a new block and added an event for zombies to, additionally to their standard loot, be able to drop their spawn eggs at a low rate because the recipe includes the new block and the spawn egg. Almost everything works fine, the zombies drop the new loot, but the crafting recipe doesn't work the way I want it to because I can only get pig spawners out of my new recipe. So, my question is: How do you specify mob spawner IDs?

 

 

don't do new object

 

do recipe just like this

 

GameRegistry.addShapedRecipe(new ItemStack(YourMod.YourItem), "SSS", "SZS", "SZS", 'S', YourMod.YourItem, 'Z', Items.spawn_egg, 1, 54);

 

it will always work , for blocks and items

My crafting recipe line:

GameRegistry.addShapedRecipe(new ItemStack(Blocks.mob_spawner, 1, 54),
			new Object[] { "SSS", "SZS", "SSS", 'S',
					new ItemStack(NewOres.spawnerBars, 1), 'Z',
					new ItemStack(Items.spawn_egg, 1, 54) });

As you can see, I tried to specify the mob spawner with the metadata ID of zombie spawn eggs, but that doesn't work.

 

GameRegistry.addShapedRecipe(new ItemStack(YourMod.YourItem), "SSS", "SZS", "SZS", 'S', YourMod.YourItem, 'Z', Items.spawn_egg, 1, 54);

you need to set it yo be zombie spawn egg like this

It is, you don't see it well, but after new ItemStack(NewOres.spawnerBars, 1), there is the 'Z', but then the new line starts, which made it harder to see.

I tried without new Object[], but it just works the same way. No zombie spawner, I get a pig spawner, instead.

Link to comment
Share on other sites

You can't create an Item for a ZombieSpawner. The mob being spawned is TileEntity data, and Mojang added a way to include that only in the 1.8 snapshots so you can't use it yet. You need to make your own Item.

Alright, thanks for the clarification. Guess I'll have to wait, then.

Link to comment
Share on other sites

You dont have to wait i think what diesieben07 was saying is you just have to create a custom item that places a vanilla mob spawner of the type you want.

e.g.

@Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int par7, float par8, float par9, float par10) {
world.setBlock(x, y+1, z, Blocks.mob_spawner);
TileEntityMobSpawner spawner = (TileEntityMobSpawner)world.getTileEntity(x, y+1, z);
spawner.func_145881_a().setEntityName("Zombie");
player.inventory.consumeInventoryItem(player.getCurrentEquippedItem().getItem());
return true;
}

That will place a spawner above the block you click set its type to Zombie then consume the item.

I am the author of Draconic Evolution

Link to comment
Share on other sites

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.