mojira.dev
MC-1530

Entity Spawners spawn items and other entities inside blocks

unlike mobs, other entities don't seem to have any limitation to where they can spawn using a modified monster spawner. so if i have a spawner underground that spawns swords, the swords will appear inside the blocks near the spawner.
this is a problem because this means that these spawners can't be shut down, like regular mob spawners.
this is more of a suggestion, but i think non-mob entities should have a 1x1 block spawning requirement, so that these spawners can be turned off using a piston.

Comments

migrated

Possibly fixed along with MC-15?

If not, related to the spawning-in-sign thing I described over there.

Ezekiel

To shut down a spawner you need to make it so that the conditions for that entity to spawn are not met. In the case of a creeper, thats a solid block with light level 7<. An item drop has no such requirements.

migrated

yes, i know item drops have no spawning requirements, because they couldn't spawn before. but now they can, using custom spawners. so i see this as an issue - if the game has an option to spawn in a sort of entities, it shouldn't spawn them inside solid blocks, because that is not correct behavior.

Ezekiel

Ahh gotcha

migrated

I think that the actual Mod you are using should be making the spawn requirements.

migrated

It's not a mod, it's vanilla Minecraft behavior...

migrated

He's using a mod to make the other entities spawn.
The mod that alters the Spawners to be configured and spawn those entities should make the requirements themselves. Mojang shouldn't take their jolly own time to patch something for mods, when the mods should do so themselves.

migrated

No. I am indeed using a tool to tell the spawners what to do, but the only thing that tool does is opening and editing the game files. This is a feature of the game, you can use maps with these modifications on every client. Also, this isn't tricking the game, this was only added recently for people to use.

migrated

These entities you are trying to add (Like swords) were never intended to be implemented into the game, so mojang never needed to add boundaries for these to be spawned.

migrated

Tell me. If they weren't intended to be implemented, then why were they implemented?

migrated

It was designed spawn any entities, because it's faster than making new blocks to allow to spawn a Zombie, then a Skellie, then a Spider, then a cave spider, etc. This works for Mob Eggs too, you can "spawn swords", but the swords disappear before you see them. It's easier to make one egg, that can spawn any of the current entity list, than to make 20 eggs individually. Same with the Spawners. Better to make one Spawner, that can spawn any of the current entity list, than to make ~6 spawners individually.

migrated

those are nice thoughts. the problem is, that spawners didn't always support non-mob entities. this was a new feature somewhere around 1.3.

migrated

Mojang added the ability to make extremely customized spawners intentionally for map makers in 1.3+, this is a FEATURE OF THE GAME that is BUGGED. If you don't even know half the features of the vanilla game you shouldn't be telling people what is and isn't a vanilla feature on this issue tracker.

migrated

Alright. Stop insulting people indirectly.
I'm pretty sure adding a sword entity to the game is NOT a feature of the game. If it is, where can I find it without mods / third party editors?

migrated

http://www.minecraftwiki.net/wiki/Version_history#1.3.1
"Monster Spawners

  • Added NBT tags to further customize spawned mobs.

  • Only changeable using map editors or mods.":yellow_star:

http://www.minecraftwiki.net/wiki/Version_history#1.4.2
"Mob Spawners

  • Added a few NBT tags to change a few key spawning rules

  • Range can now be changed

  • Maximum amount of spawned entities within spawning range can now be changed

  • Horizontal spawning radius can now be changed

  • Spawned mobs can wear and carry any items and blocks as well as have a custom drop rate of held items

  • Added an NBT tag for mobs to decide whether they can despawn

  • Added an NBT tag for mobs to decide whether they are invincible"

:yellow_star: If you're going to be pedantic and say "oh well it requires using external tools or mods to edit the NBT data thus it's irrelevant to vanilla minecraft", then why did they bother to even do this? Mojang aren't the ones using these added NBT tags, map makers are, and that's who they did it for. This is a feature of vanilla Minecraft that Mojang added, and if there are bugs in it they should fix them.

Edit: remove bullet point where it shouldn't be

migrated

Wait you can spawn entities in I had no clue u could do this how can u do this please tell me

migrated

Custom spawners are, in fact, a feature of the game, and should be properly implemented now that their capabilities have been expanded in vanilla. This update has been almost entirely dedicated to giving map makers much broader tools to work with – it seems like this is quite an issue for anyone who wants to have randomized loot drops in their maps!

bugi74

Potential fix
.. or at least a start for one..

Add the method getCanSpawnHere() all the way into Entity-class. Thus the EntityLiving merely overrides it. The default implementation would then handle any non-living entity. Effect entities need to be able to spawn about anywhere, so EntityFX would override it, too. Note that currently no other piece of code than the spawner would call those methods.

Entity

/**
     * By default, entities can not spawn inside blocks that block movement. This is a bit
     * crude check, but then again, it is just the default base implementation.
     */
    public boolean getCanSpawnHere() {
        int x = (int) Math.floor(this.posX);
        int y = (int) Math.floor(this.posY);
        int z = (int) Math.floor(this.posZ);
        int blockId = this.worldObj.getBlockId(x, y, z);
        if (Block.blocksList[blockId].getBlocksMovement(worldObj, x, y, z))
            return false;
        return true;
    }

EntityFX

/**
     * By default, all effect entities can spawn anywhere.
     */
    public boolean getCanSpawnHere() {
        return true;
    }

TileEntityMonsterSpawner.updateEntity()

...
            //if (var11 == null || var11.getCanSpawnHere()) {
            if (tobeSpawnedEntity.getCanSpawnHere()) {  // FIX: Simply let the entity decide in all cases
                this.writeNBTTagsTo(tobeSpawnedEntity);
                this.worldObj.spawnEntityInWorld(tobeSpawnedEntity);
                this.worldObj.playAuxSFX(2004, this.xCoord, this.yCoord, this.zCoord, 0);
                ...

NOT TESTED. I only checked on 1.4.7 that at least pig-spawner still spawned the pigs. (That is, it did not break spawning living entities). Did not check what it would do to spawning non-living entities.

migrated

Confirmed in 1.6.2.

galaxy_2alex

Is this still a concern in the current Minecraft version? If so, please update the affected versions in order to best aid Mojang ensuring bugs are still valid in the latest releases/pre-releases. If this has been done, we can reopen the issue.

Keep in mind that the "Resolved"-Status on this ticket just means "Answered", and that we are waiting for further information on whether this issue still exists or not. We will reopen it as soon as the requested information has been deliviered.

SunCat

Still in 16w05b
For further tests:

/setblock ~ ~ ~ minecraft:mob_spawner 0 replace {SpawnData:{id:ArmorStand,NoGravity:1}}
migrated

How can you confirm this bug while MC-97491 is in effect?

SunCat

Still in 1.9-pre3

SunCat

Still in 1.9-pre4

SunCat

Still in 1.9.1-pre1

SunCat

Still in 1.9.1-pre3

SunCat

Still in 1.9.3-pre2

FaRo1

Confirmed for 1.10.

FaRo1

Confirmed for 1.10.1.

migrated

Unable to reproduce with items as of 20w07a.

FaRo1

Then it's "fixed" and not CR.

wobst.michael

Tickets that haven't been reproduced quite some time ago get resolved as CR by us.

migrated

(Unassigned)

Confirmed

Entities, Mob spawning

entities, item, spawner

Minecraft 1.4.2, Minecraft 1.4.5, Minecraft 1.4.6, Snapshot 13w09c, Minecraft 1.6.1, ..., Minecraft 16w35a, Minecraft 16w40a, Minecraft 16w41a, Minecraft 16w44a, Minecraft 1.11 Pre-Release 1

Retrieved