mojira.dev
MC-66894

Spawner minecarts displayed mob/particle is offset

The bug

The pig and particles within the minecart spawner is offset from the center of the displayed spawner, showing as rotating about an axis located at a corner of the displayed spawner.

To Reproduce:

  1. Run 

    /execute align xyz run summon minecraft:spawner_minecart ~0.5 ~1.9 ~ {SpawnData:{entity:{id:"minecraft:bat"}},NoGravity:1b}
  1. Notice the particles are offset.

Code analysis

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

Related issues

Attachments

Comments

migrated
[media][media][media][media][media][media]
onnowhere

This is also in regards to the offset mob display...............

onnowhere

There, I changed it so that it is no longer related to the pig displayed instead focused on the offset, which was what I was more intending to address.

migrated

Not the same bug as MC-65065, this one addresses the offset.

marcono1234

Confirmed for

  • 1.8.5

  • 1.8.6

The entity has also a shadow (which is unintended, which is also to far down) and the flame particles are centered on the block instead of on the spawner minecart

onnowhere

No entity seems to be displaying at all anymore (15w45a)

migrated

Confirmed "fixed".

onnowhere

Not sure if the mob not displaying is a bug or not, but perhaps if it renders again, the mob might still be in the wrong place...but can't tell that for now

marcono1234

Relates to:

The problem for the mob to be offset is that the values for the translate(float p_179109_0_, float p_179109_1_, float p_179109_2_) method of the /Client/src/net/minecraft/client/renderer/GlStateManager.java (MCP 1.8 names) need to be offset when called for a mob spawner in the /Client/src/net/minecraft/client/renderer/tileentity/TileEntityMobSpawnerRenderer.java class by the func_147517_a(MobSpawnerBaseLogic p_147517_0_, double p_147517_1_, double p_147517_3_, double p_147517_5_, float p_147517_7_) method, because apparently setting position and rotation of the entity has no effect. So this "fix" might not actually fix the main problem behind this.

public static void func_147517_a(MobSpawnerBaseLogic p_147517_0_, double p_147517_1_, double p_147517_3_, double p_147517_5_, float p_147517_7_)
{
	Entity var8 = p_147517_0_.func_180612_a(p_147517_0_.getSpawnerWorld());

	if (var8 != null)
	{
		float var9 = 0.4375F;
		// This would work for spawner blocks
		GlStateManager.translate(0.0F, 0.4F, 0.0F);
		// This would work for MinecartSpawners
		GlStateManager.translate(0.5F, 0.4F, -0.5F);
		
		GlStateManager.rotate((float)(p_147517_0_.func_177223_e() + (p_147517_0_.func_177222_d() - p_147517_0_.func_177223_e()) * (double)p_147517_7_) * 10.0F, 0.0F, 1.0F, 0.0F);
		GlStateManager.rotate(-30.0F, 1.0F, 0.0F, 0.0F);
		GlStateManager.translate(0.0F, -0.4F, 0.0F);
		
		GlStateManager.scale(var9, var9, var9);
		var8.setLocationAndAngles(p_147517_1_, p_147517_3_, p_147517_5_, 0.0F, 0.0F);
		Minecraft.getMinecraft().getRenderManager().renderEntityWithPosYaw(var8, 0.0D, 0.0D, 0.0D, 0.0F, p_147517_7_);
	}
}
marcono1234

The reason why the particles are always at a block position is that this is done by the updateSpawner() method of the net.minecraft.tileentity.MobSpawnerBaseLogic class. However as position it takes a BlockPos. This works for the spawner block, but not for the minecart.

public void updateSpawner()
{
	if (this.isActivated())
	{
		BlockPos var1 = this.func_177221_b();
		double var6;

		if (this.getSpawnerWorld().isRemote)
		{
			double var2 = (double)((float)var1.getX() + this.getSpawnerWorld().rand.nextFloat());
			double var4 = (double)((float)var1.getY() + this.getSpawnerWorld().rand.nextFloat());
			var6 = (double)((float)var1.getZ() + this.getSpawnerWorld().rand.nextFloat());
			this.getSpawnerWorld().spawnParticle(EnumParticleTypes.SMOKE_NORMAL, var2, var4, var6, 0.0D, 0.0D, 0.0D, new int[0]);
			this.getSpawnerWorld().spawnParticle(EnumParticleTypes.FLAME, var2, var4, var6, 0.0D, 0.0D, 0.0D, new int[0]);
			
			//...
		
		}
		
		//...
		
	}
}
marcono1234

Could you please include the second comment as well?

Confirmed for

  • 15w50a The particles are still offset

migrated

Done. Read over that last comment, you forgot to put class and method name 😉

marcono1234

Whoops you are right, thank you for that 🙂
And could you please reopen the report?

migrated

Reopened. Please explicitly ask for reports to be reopened in the future. When we see "confirmed for X" we just add the new affected version.

migrated

Confirmed for 1.10-pre1.

migrated

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.

migrated

Affects 1.13 and 18w31a

muzikbike

Seems fixed in pre4, can anyone confirm?

TheBoy358

It's not fixed in 1.15-pre4.

muzikbike

It was definitely fixed for me, weird

onnowhere

I'm staring right at it and it's not fixed
I updated the report with an example command to demonstrate.

marcono1234

@@unknown, there is sadly a Jira bug which can cause links to get removed when switching between visual and text editor and editing in both (if I recall correctly). This happened with the links of the report, I re-added them now. Please be careful when switching the editor modes.

Irbis

20w06a affected

migrated

Affects 1.16.1

migrated

Affects 20w45a

pulpetti

In 20w49a

 

Avoma

Can confirm in 20w51a.

Avoma

Can confirm in 21w03a.

Avoma

Can confirm in 21w05b.

Avoma

Can confirm in 21w06a.

Avoma

Can confirm in 21w07a. Video attached.

Avoma

Can confirm in 21w11a.

Avoma

Can confirm in 21w14a.

Avoma

Can confirm in 21w17a.

migrated

Affects 1.17

Avoma

Can confirm in 1.17.1.

Avoma

Can confirm in 1.18.1.

Avoma

Can confirm in 1.18.2.

muzikbike

Relates to MC-165971, MC-167889

Avoma

Can confirm in 1.19.

NBG-bootmgr

Can confirm in 1.19.1-pre2.

Avoma

Can confirm in 1.19.2.

Brain81505

Can confirm in 1.19.3 and 23w06a

onnowhere

(Unassigned)

Confirmed

Platform

Low

Particles

offset, particles, spawner_minecart

Minecraft 14w32d, Minecraft 14w33c, Minecraft 14w34a, Minecraft 14w34b, Minecraft 1.8-pre1, ..., 1.18.2, 1.19, 1.19.2, 1.19.3, 23w06a

Minecraft 15w45a

Retrieved