mojira.dev
MC-65065

Content of Minecart with Spawner is not sent to the client

The bug

The mob inside a minecart with spawner is never rendered, even if the spawner is customized.

How to reproduce

Summon a minecart with spawner that spawns mobs. The steps below show how to do this without hardcoding any spawner data.

  1. /setblock ~2 ~2 ~ spawner
  2. /summon minecraft:spawner_minecart ~2 ~ ~
  3. /give @s minecraft:blaze_spawn_egg
  4. /tick freeze
  5. Right-click the spawner with the spawn egg (you cannot do the same to the minecart due to MC-110427)

  6. /data modify entity @n[type=minecraft:spawner_minecart] {} merge from block ~2 ~2 ~
  7. Break the floating spawner block

  8. /tick unfreeze

    ❌ Observe that despite the complete absence of visual indication that the spawner minecart is doing anything, it will (after a significant delay) spawn blazes as expected

Note

Note that since 15w33a, no miniature is rendered at all; prior to this verison, a pig was rendered. The attached screenshot is from before 15w33a.

Code analysis

Code analysis by @unknown can be found in this comment.

Linked issues

Attachments

Comments

Anon Ymus

Please add steps to reproduce.

Qwert225

I spawned this minecart with spawner using summon command. It spawns mobs correctly, but mob miniature is incorrect (pig instead of skeleton). Effect of this bug is only visual, it does not affect spawning.

Bug affects all minecarts with spawner in 1.7.2. Tested with 5 types of mobs, always the same result (pig miniature inside the spawner).

onnowhere

I can confirm this for 14w32d, though the pig is also off centered now

onnowhere

Still in pre2

Qwert225

Confirmed for 1.8

marcono1234

Confirmed for

  • 1.8.5

  • 1.8.6

The rotation also doesn't stop if the player gets out of range

onnowhere

In the latest snapshots, not sure which one, the entity seems to have disappeared completely?

tatsu

Confirmed for 15w47c

marcono1234

Confirmed for

  • 15w50a No entity is displayed at all, probably because of the "fix" of MC-66894

The reason for that is, that the func_151260_c() method in the /Client/src/net/minecraft/entity/EntityTrackerEntry.java class (MCP 1.8 names) sends a S0EPacketSpawnObject packet for minecarts. This packet is only able to store one additional integer for special information. However for minecarts this integer is used to represent the minecart type. This means the client does not get the information about which mob is visible.

private Packet func_151260_c()
{
	if (this.trackedEntity instanceof EntityItem)
	{
		//...
	}
	
	//...
	
	else if (this.trackedEntity instanceof EntityMinecart)
	{
		EntityMinecart var9 = (EntityMinecart)this.trackedEntity;
		return new S0EPacketSpawnObject(this.trackedEntity, 10, var9.func_180456_s().func_180039_a());
	}
	
	//...
}

One way to "fix" this would be to override the method NBTTagCompound func_174819_aU() in the /Client/src/net/minecraft/entity/ai/EntityMinecartMobSpawner.java class to either return all NBT data or only the entity to spawn. As updating packets are not send every tick, it might be better to send all the data to make sure the displayed mob changes at the right point for the client. This would also require to add code to the func_174834_g(NBTTagCompound p_174834_1_) method in the /Client/src/net/minecraft/entity/Entity.java class to just call the readEntityFromNBT(NBTTagCompound tagCompund) method. Or adding a data watcher for these fields might work as well, but I am not too familiar with how they work.

SunCat

There is no entity in spawner minecart for 1.9-pre2

bob

Is this still an issue in the latest snapshot 16w44a? If so please update the affected versions.

This is an automated comment on any open or reopened issue with out-of-date affected versions.

wobst.michael

Currently this cannot be reproduced due to being blocked by MC-110426.

pokechu22

After some more investigation, I've decided that MC-110426 should be merged into this ticket. The actual difference that caused the mob to stop rendering is mundane: Mojang removed the call to TileEntityMobSpawnerRenderer.renderMob(minecart.func_98039_d(), minecart.posX, minecart.posY, minecart.posZ, partialTicks) in RenderMinecartMobSpawner in 15w33a (for 1.9; it exists in 15w32c). The underlying issue of the mob inside not being sent to the client still exists, and could be fixed nowadays with NBT entity metadata (as is done with parrots on players). Were the rendering to be re-enabled without fixing the syncing, the pig issue would resurface. This ticket already listed versions where the mob didn't render for a few versions, so it is bit more confusing to try to keep them separate.

pulpetti

In 1.16.1 and 20w29a

Avoma

Can confirm in 21w03a.

Avoma

Can confirm in 21w05b.

Avoma

Can confirm in 21w06a.

Avoma

Can confirm in 21w07a.

Avoma

Can confirm in 21w11a.

Avoma

Can confirm in 1.16.5 and 21w14a.

Avoma

Can confirm in 21w17a.

Marty McFly

Affects 1.17

Avoma

Can confirm in 1.17.1.

Marty McFly

Affects 21w40a

Avoma

Can confirm in 1.18.1

Avoma

Can confirm in 1.18.2.

Avoma

Can confirm in 1.19.

Avoma

Can confirm in 1.19.2.

Qwert225

anthony cicinelli

(Unassigned)

Confirmed

Platform

Low

Minecart, Networking

spawner_minecart

Minecraft 1.7.10, Minecraft 14w32a, Minecraft 14w32b, Minecraft 14w32c, Minecraft 14w32d, ..., 1.19, 1.19.2, 1.19.4, 24w34a, 1.21.5 Pre-Release 3

Retrieved