Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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.

what is that z in the middle?

Proud mod developer of:

 

Mob Armor mod

Block monster mod

Clay Living Dolls mod

Much More Spiders mod

Elemental cows reborn

Mr gorilla mod

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

  • Author

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.

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

  • Author

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.

idk then lol

Proud mod developer of:

 

Mob Armor mod

Block monster mod

Clay Living Dolls mod

Much More Spiders mod

Elemental cows reborn

Mr gorilla mod

  • Author

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.

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

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.