How do I change a spawner's type in Minecraft?

  • I want to change the type of my mob spawners on my server. My server is a vanilla server, as it has no mods. Is there a way I can edit it without mods? If not, is there a mod I can get to change them?

  • aytimothy

    aytimothy Correct answer

    6 years ago

    Method 1: Programs and whatnots

    (Please refer to MBraedley's answer for the main points. This is just an add-on to it/repeating what he said.

    The Program MCEdit has a mob spawner editing function. Simply left click the spawner with your mouse released.

    The Essentials Bukkit plugin allows the changing a spawner type. Just point your cursor at the spawner and use /spawner [new mob type].

    The NotEnoughItems (NEI) mod allows the spawning of mob spawners with pre-existing metadata. Just spawn one in from the side menu and place it down. (Note: Does not work without the NEI mod)

    Method 2: Vanilla Minecraft

    With the introduction of the /setblock command, and it allowing the choosing of NBT tags...

    /setblock <x> <y> <z> <block_id> <block_damage> <old_block_handling> <tile_entity_data>
    /setblock ~ ~ ~ minecraft:mob_spawner 0 replace {EntityId:<ENTITY ID>,SpawnData:{<MOB NBT TAGS>}}
    

    The EntityId tag within the mob spawner's Tile Entity allows the player to define what entity it spawns. However, if the SpawnProtentials tag is defined (and is compounded with entries within it), the EntityId tag will have its value changed based on the weights within the SpawnProtentials tag.

    Not defining one (a SpawnProtentials tag) will result in the mob that you have defined to indefinitely spawn.

    The EntityData tag can be added (is optional) and is used to define the entity it spawns. For example, adding EntityData:{NoAI:true} would make everything it spawn not have any AI.

    Not defining one will default to the default NBT values for the entity you've defined.

    See the Command Blocks NBT section of the wiki to see the other tags.
    Also note that the data value of the spawner does nothing.


    You can modify blocks (as pointed out by MBraedley with the /blockdata command.

    Simply look for a spawner and use the following command:

    /blockdata <x> <y> <z> <new_data>
    /blockdata <x> <y> <z> {EntityId:[New Entity to spawn],SpawnData:{[Any mob NBT Info}}
    

    All NBT tags found on the wiki can be used here too. Just note that existing NBT tags (that you have not defined) when using this command will not get overridden or removed.
    /blockdata only creates new or changes existing NBT data. It does not delete any.

    So, a (let's say Zombie) with {customName:"Creeper",NoAI:1} had the command /entitydata @e[type=Zombie,r=3] {customName:"Zombie",IsBaby:1} executed on him.
    The resulting mob will still have the NoAI tag. (Results in: {customName: "Zombie",IsBaby:1,NoAI:1}.
    The same principle occurs for /blockdata.


    Without further ado, try:
    And then place a redstone torch/block/whatever beside/behind/on top/underneath/whatever it..

    /setblock ~ ~ ~ minecraft:mob_spawner 0 replace {EntityId:Item,Delay:1,SpawnData:{Item:{id:"diamond",Count:1},PickupDelay:1}}
    

    Moar Diamonds!

    /setblock ~ ~ ~ minecraft:mob_spawner 0 replace {EntityId:Zombie,Delay:1,SpawnData:{IsBaby:1,Riding:{id:Chicken}}
    

    Or something from this little short.


    Alternatively, https://gaming.stackexchange.com/a/197633/75275 (scroll down)

    The `blockdata` command can also be used to modify existing spawners.

    @MBraedley Noted and added.

    1.13 changed the syntax of all of these commands: 1. the `/setblock` commads are now written as `/setblock ~ ~ ~ minecraft:mob_spawner{...}` instead of `/setblock ~ ~ ~ minecraft:mob_spawner 0 replace ...` 2: `/blockdata` (and `/entitydata`, which you use for comparison) were merge into `/data merge (block|entity)`. 3: entity IDs are now in lowercase. 4: Entities riding other entities are now specified in a different order: `{EntityID:"chicken",SpawnData:{Passengers:[{id:"zombie",IsBaby:1}]}}` for the chicken jockey example

    Feel free to edit, or create a new answer.

License under CC-BY-SA with attribution


Content dated before 6/26/2020 9:53 AM