Spawner ignoring provided Rotation tag
The bug
Spawners ignore the Rotation tag of the entity to spawn and instead give them a random rotation.
How to reproduce
Use the following command
/setblock ~ ~1 ~ minecraft:spawner{SpawnData:{entity:{id:"minecraft:armor_stand",Rotation:[180f,0f]}},MinSpawnDelay:10s,MaxSpawnDelay:10s,SpawnCount:1,SpawnRange:5}
You will see that the armor stands spawn with a random rotation
The reason
The following is based on decompiled version of Minecraft 1.9 using MCP 9.24 beta. All method and class names are the names used in the decompiled version.
The reason why this happens is because the method net.minecraft.tileentity.MobSpawnerBaseLogic.updateSpawner() always uses a random yaw value and 0f as pitch value.
public void updateSpawner() { if (!this.isActivated()) { this.prevMobRotation = this.mobRotation; } else { BlockPos blockpos = this.getSpawnerPosition(); if (this.getSpawnerWorld().isRemote) { //... } else { //... for (int i = 0; i < this.spawnCount; ++i) { NBTTagCompound nbttagcompound = this.randomEntity.func_185277_b(); NBTTagList nbttaglist = nbttagcompound.getTagList("Pos", 6); World world = this.getSpawnerWorld(); int j = nbttaglist.tagCount(); double d0 = j >= 1 ? nbttaglist.getDoubleAt(0) : (double)blockpos.getX() + (world.rand.nextDouble() - world.rand.nextDouble()) * (double)this.spawnRange + 0.5D; double d1 = j >= 2 ? nbttaglist.getDoubleAt(1) : (double)(blockpos.getY() + world.rand.nextInt(3) - 1); double d2 = j >= 3 ? nbttaglist.getDoubleAt(2) : (double)blockpos.getZ() + (world.rand.nextDouble() - world.rand.nextDouble()) * (double)this.spawnRange + 0.5D; Entity entity = AnvilChunkLoader.func_186054_a(nbttagcompound, world, d0, d1, d2, false); if (entity == null) { return; } int k = world.getEntitiesWithinAABB(entity.getClass(), (new AxisAlignedBB((double)blockpos.getX(), (double)blockpos.getY(), (double)blockpos.getZ(), (double)(blockpos.getX() + 1), (double)(blockpos.getY() + 1), (double)(blockpos.getZ() + 1))).func_186662_g((double)this.spawnRange)).size(); if (k >= this.maxNearbyEntities) { this.resetTimer(); return; } EntityLiving entityliving = entity instanceof EntityLiving ? (EntityLiving)entity : null; // Replaced this //entity.setLocationAndAngles(entity.posX, entity.posY, entity.posZ, world.rand.nextFloat() * 360.0F, 0.0F); NBTTagList nbtRotation = nbttagcompound.getTagList("Rotation", 5); int nbtRotationTagCount = nbtRotation.tagCount(); float yaw = nbtRotationTagCount >= 1 ? nbtRotation.getFloatAt(0) : world.rand.nextFloat() * 360.0F; float pitch = nbtRotationTagCount >= 2 ? nbtRotation.getFloatAt(1) : 0.0F; entity.setLocationAndAngles(entity.posX, entity.posY, entity.posZ, yaw, pitch); //... } if (flag) { this.resetTimer(); } } } }
- Invalid
Marcono1234- 11
- 9
- Confirmed
- (Unassigned)
- NBT Rotation spawner
1.9-pre2 - 21w39a
1.9-pre2 1.9-pre3 1.9 1.9.1 1.9.2 1.9.4 1.10-pre1 1.10.2 16w32b 16w40a 1.11.2 1.12.2 18w06a 1.13.1 1.13.2 19w05a 19w06a 19w07a 1.14.4 19w46b 1.15.2 20w12a 1.16.2 1.16.3-rc1 1.16.3 1.16.4-pre1 1.16.4-pre2 1.16.4 20w45a 20w46a 20w48a 20w49a 20w51a 21w03a 1.16.5 21w05a 21w05b 21w06a 21w15a 21w16a 21w17a 21w18a 21w19a 21w20a 1.17-pre1 1.17-pre4 1.17 1.17.1-pre1 1.17.1 21w37a 21w39a
Created Issue:
Spawner ignoring provided Rotation tag
Relates to
MC-90101
Partwise duplicated byMC-15511The bug
Spawners ignore the Rotation tag of the entity to spawn and instead give them a random rotation.
How to reproduce
- Go to 0 ~ 0 (/tp 0 ~ 0) (because of
MC-97491)- Use the following command
/setblock ~ ~1 ~ mob_spawner 0 replace {SpawnData:{id:"ArmorStand",Pos:[0d,60d,0d],Rotation:[180f,0f]},MinSpawnDelay:10s,MaxSpawnDelay:10s,SpawnCount:1,SpawnRange:5}You will see that the ArmorStands spawn with a random rotation
Relates to
MC-90101
Partwise duplicated byMC-15511The bug
Spawners ignore the Rotation tag of the entity to spawn and instead give them a random rotation.
How to reproduce
- Go to 0 ~ 0 (/tp 0 ~ 0) (because of
MC-97491)- Use the following command
/setblock ~ ~1 ~ mob_spawner 0 replace {SpawnData:{id:"ArmorStand",Pos:[0d,60d,0d],Rotation:[180f,0f]},MinSpawnDelay:10s,MaxSpawnDelay:10s,SpawnCount:1,SpawnRange:5}You will see that the ArmorStands spawn with a random rotation
The bug
Spawners ignore the Rotation tag of the entity to spawn and instead give them a random rotation.
How to reproduce
- Go to 0 ~ 0 (/tp 0 ~ 0) (because of
MC-97491)- Use the following command
/setblock ~ ~1 ~ mob_spawner 0 replace {SpawnData:{id:"ArmorStand",Pos:[0d,60d,0d],Rotation:[180f,0f]},MinSpawnDelay:10s,MaxSpawnDelay:10s,SpawnCount:1,SpawnRange:5}You will see that the ArmorStands spawn with a random rotation
The bug
Spawners ignore the Rotation tag of the entity to spawn and instead give them a random rotation.
How to reproduce
Use the following command
/setblock ~ ~1 ~ mob_spawner 0 replace {SpawnData:{id:"ArmorStand",Rotation:[180f,0f]},MinSpawnDelay:10s,MaxSpawnDelay:10s,SpawnCount:1,SpawnRange:5}You will see that the ArmorStands spawn with a random rotation
The bug
Spawners ignore the Rotation tag of the entity to spawn and instead give them a random rotation.
How to reproduce
Use the following command
/setblock ~ ~1 ~ mob_spawner 0 replace {SpawnData:{id:"ArmorStand",Rotation:[180f,0f]},MinSpawnDelay:10s,MaxSpawnDelay:10s,SpawnCount:1,SpawnRange:5}You will see that the ArmorStands spawn with a random rotation
The reason
The following is based on decompiled version of Minecraft 1.9 using MCP 9.24 beta. All method and class names are the names used in the decompiled version.
The reason why this happens is because the method net.minecraft.tileentity.MobSpawnerBaseLogic.updateSpawner() always uses a random yaw value and 0f as pitch value.
public void updateSpawner() { if (!this.isActivated()) { this.prevMobRotation = this.mobRotation; } else { BlockPos blockpos = this.getSpawnerPosition(); if (this.getSpawnerWorld().isRemote) { //... } else { //... for (int i = 0; i < this.spawnCount; ++i) { NBTTagCompound nbttagcompound = this.randomEntity.func_185277_b(); NBTTagList nbttaglist = nbttagcompound.getTagList("Pos", 6); World world = this.getSpawnerWorld(); int j = nbttaglist.tagCount(); double d0 = j >= 1 ? nbttaglist.getDoubleAt(0) : (double)blockpos.getX() + (world.rand.nextDouble() - world.rand.nextDouble()) * (double)this.spawnRange + 0.5D; double d1 = j >= 2 ? nbttaglist.getDoubleAt(1) : (double)(blockpos.getY() + world.rand.nextInt(3) - 1); double d2 = j >= 3 ? nbttaglist.getDoubleAt(2) : (double)blockpos.getZ() + (world.rand.nextDouble() - world.rand.nextDouble()) * (double)this.spawnRange + 0.5D; Entity entity = AnvilChunkLoader.func_186054_a(nbttagcompound, world, d0, d1, d2, false); if (entity == null) { return; } int k = world.getEntitiesWithinAABB(entity.getClass(), (new AxisAlignedBB((double)blockpos.getX(), (double)blockpos.getY(), (double)blockpos.getZ(), (double)(blockpos.getX() + 1), (double)(blockpos.getY() + 1), (double)(blockpos.getZ() + 1))).func_186662_g((double)this.spawnRange)).size(); if (k >= this.maxNearbyEntities) { this.resetTimer(); return; } EntityLiving entityliving = entity instanceof EntityLiving ? (EntityLiving)entity : null; // Replaced this //entity.setLocationAndAngles(entity.posX, entity.posY, entity.posZ, world.rand.nextFloat() * 360.0F, 0.0F); NBTTagList nbtRotation = nbttagcompound.getTagList("Rotation", 5); // TODO TYPE int nbtRotationTagCount = nbtRotation.tagCount(); float yaw = nbtRotationTagCount >= 1 ? nbtRotation.getFloatAt(0) : world.rand.nextFloat() * 360.0F; float pitch = nbtRotationTagCount >= 2 ? nbtRotation.getFloatAt(1) : 0.0F; entity.setLocationAndAngles(entity.posX, entity.posY, entity.posZ, yaw, pitch); //... } if (flag) { this.resetTimer(); } } } }
The bug
Spawners ignore the Rotation tag of the entity to spawn and instead give them a random rotation.
How to reproduce
Use the following command
/setblock ~ ~1 ~ mob_spawner 0 replace {SpawnData:{id:"ArmorStand",Rotation:[180f,0f]},MinSpawnDelay:10s,MaxSpawnDelay:10s,SpawnCount:1,SpawnRange:5}You will see that the ArmorStands spawn with a random rotation
The reason
The following is based on decompiled version of Minecraft 1.9 using MCP 9.24 beta. All method and class names are the names used in the decompiled version.
The reason why this happens is because the method net.minecraft.tileentity.MobSpawnerBaseLogic.updateSpawner() always uses a random yaw value and 0f as pitch value.
public void updateSpawner() { if (!this.isActivated()) { this.prevMobRotation = this.mobRotation; } else { BlockPos blockpos = this.getSpawnerPosition(); if (this.getSpawnerWorld().isRemote) { //... } else { //... for (int i = 0; i < this.spawnCount; ++i) { NBTTagCompound nbttagcompound = this.randomEntity.func_185277_b(); NBTTagList nbttaglist = nbttagcompound.getTagList("Pos", 6); World world = this.getSpawnerWorld(); int j = nbttaglist.tagCount(); double d0 = j >= 1 ? nbttaglist.getDoubleAt(0) : (double)blockpos.getX() + (world.rand.nextDouble() - world.rand.nextDouble()) * (double)this.spawnRange + 0.5D; double d1 = j >= 2 ? nbttaglist.getDoubleAt(1) : (double)(blockpos.getY() + world.rand.nextInt(3) - 1); double d2 = j >= 3 ? nbttaglist.getDoubleAt(2) : (double)blockpos.getZ() + (world.rand.nextDouble() - world.rand.nextDouble()) * (double)this.spawnRange + 0.5D; Entity entity = AnvilChunkLoader.func_186054_a(nbttagcompound, world, d0, d1, d2, false); if (entity == null) { return; } int k = world.getEntitiesWithinAABB(entity.getClass(), (new AxisAlignedBB((double)blockpos.getX(), (double)blockpos.getY(), (double)blockpos.getZ(), (double)(blockpos.getX() + 1), (double)(blockpos.getY() + 1), (double)(blockpos.getZ() + 1))).func_186662_g((double)this.spawnRange)).size(); if (k >= this.maxNearbyEntities) { this.resetTimer(); return; } EntityLiving entityliving = entity instanceof EntityLiving ? (EntityLiving)entity : null; // Replaced this //entity.setLocationAndAngles(entity.posX, entity.posY, entity.posZ, world.rand.nextFloat() * 360.0F, 0.0F); NBTTagList nbtRotation = nbttagcompound.getTagList("Rotation", 5);// TODO TYPEint nbtRotationTagCount = nbtRotation.tagCount(); float yaw = nbtRotationTagCount >= 1 ? nbtRotation.getFloatAt(0) : world.rand.nextFloat() * 360.0F; float pitch = nbtRotationTagCount >= 2 ? nbtRotation.getFloatAt(1) : 0.0F; entity.setLocationAndAngles(entity.posX, entity.posY, entity.posZ, yaw, pitch); //... } if (flag) { this.resetTimer(); } } } }The bug
Spawners ignore the Rotation tag of the entity to spawn and instead give them a random rotation.
How to reproduce
Use the following command
/setblock ~ ~1 ~ mob_spawner 0 replace {SpawnData:{id:"ArmorStand",Rotation:[180f,0f]},MinSpawnDelay:10s,MaxSpawnDelay:10s,SpawnCount:1,SpawnRange:5}You will see that the ArmorStands spawn with a random rotation
The reason
The following is based on decompiled version of Minecraft 1.9 using MCP 9.24 beta. All method and class names are the names used in the decompiled version.
The reason why this happens is because the method net.minecraft.tileentity.MobSpawnerBaseLogic.updateSpawner() always uses a random yaw value and 0f as pitch value.
public void updateSpawner() { if (!this.isActivated()) { this.prevMobRotation = this.mobRotation; } else { BlockPos blockpos = this.getSpawnerPosition(); if (this.getSpawnerWorld().isRemote) { //... } else { //... for (int i = 0; i < this.spawnCount; ++i) { NBTTagCompound nbttagcompound = this.randomEntity.func_185277_b(); NBTTagList nbttaglist = nbttagcompound.getTagList("Pos", 6); World world = this.getSpawnerWorld(); int j = nbttaglist.tagCount(); double d0 = j >= 1 ? nbttaglist.getDoubleAt(0) : (double)blockpos.getX() + (world.rand.nextDouble() - world.rand.nextDouble()) * (double)this.spawnRange + 0.5D; double d1 = j >= 2 ? nbttaglist.getDoubleAt(1) : (double)(blockpos.getY() + world.rand.nextInt(3) - 1); double d2 = j >= 3 ? nbttaglist.getDoubleAt(2) : (double)blockpos.getZ() + (world.rand.nextDouble() - world.rand.nextDouble()) * (double)this.spawnRange + 0.5D; Entity entity = AnvilChunkLoader.func_186054_a(nbttagcompound, world, d0, d1, d2, false); if (entity == null) { return; } int k = world.getEntitiesWithinAABB(entity.getClass(), (new AxisAlignedBB((double)blockpos.getX(), (double)blockpos.getY(), (double)blockpos.getZ(), (double)(blockpos.getX() + 1), (double)(blockpos.getY() + 1), (double)(blockpos.getZ() + 1))).func_186662_g((double)this.spawnRange)).size(); if (k >= this.maxNearbyEntities) { this.resetTimer(); return; } EntityLiving entityliving = entity instanceof EntityLiving ? (EntityLiving)entity : null; // Replaced this //entity.setLocationAndAngles(entity.posX, entity.posY, entity.posZ, world.rand.nextFloat() * 360.0F, 0.0F); NBTTagList nbtRotation = nbttagcompound.getTagList("Rotation", 5); int nbtRotationTagCount = nbtRotation.tagCount(); float yaw = nbtRotationTagCount >= 1 ? nbtRotation.getFloatAt(0) : world.rand.nextFloat() * 360.0F; float pitch = nbtRotationTagCount >= 2 ? nbtRotation.getFloatAt(1) : 0.0F; entity.setLocationAndAngles(entity.posX, entity.posY, entity.posZ, yaw, pitch); //... } if (flag) { this.resetTimer(); } } } }
The bug
Spawners ignore the Rotation tag of the entity to spawn and instead give them a random rotation.
How to reproduce
Use the following command
/setblock ~ ~1 ~ mob_spawner 0 replace {SpawnData:{id:"ArmorStand",Rotation:[180f,0f]},MinSpawnDelay:10s,MaxSpawnDelay:10s,SpawnCount:1,SpawnRange:5}You will see that the ArmorStands spawn with a random rotation
The reason
The following is based on decompiled version of Minecraft 1.9 using MCP 9.24 beta. All method and class names are the names used in the decompiled version.
The reason why this happens is because the method net.minecraft.tileentity.MobSpawnerBaseLogic.updateSpawner() always uses a random yaw value and 0f as pitch value.
public void updateSpawner() { if (!this.isActivated()) { this.prevMobRotation = this.mobRotation; } else { BlockPos blockpos = this.getSpawnerPosition(); if (this.getSpawnerWorld().isRemote) { //... } else { //... for (int i = 0; i < this.spawnCount; ++i) { NBTTagCompound nbttagcompound = this.randomEntity.func_185277_b(); NBTTagList nbttaglist = nbttagcompound.getTagList("Pos", 6); World world = this.getSpawnerWorld(); int j = nbttaglist.tagCount(); double d0 = j >= 1 ? nbttaglist.getDoubleAt(0) : (double)blockpos.getX() + (world.rand.nextDouble() - world.rand.nextDouble()) * (double)this.spawnRange + 0.5D; double d1 = j >= 2 ? nbttaglist.getDoubleAt(1) : (double)(blockpos.getY() + world.rand.nextInt(3) - 1); double d2 = j >= 3 ? nbttaglist.getDoubleAt(2) : (double)blockpos.getZ() + (world.rand.nextDouble() - world.rand.nextDouble()) * (double)this.spawnRange + 0.5D; Entity entity = AnvilChunkLoader.func_186054_a(nbttagcompound, world, d0, d1, d2, false); if (entity == null) { return; } int k = world.getEntitiesWithinAABB(entity.getClass(), (new AxisAlignedBB((double)blockpos.getX(), (double)blockpos.getY(), (double)blockpos.getZ(), (double)(blockpos.getX() + 1), (double)(blockpos.getY() + 1), (double)(blockpos.getZ() + 1))).func_186662_g((double)this.spawnRange)).size(); if (k >= this.maxNearbyEntities) { this.resetTimer(); return; } EntityLiving entityliving = entity instanceof EntityLiving ? (EntityLiving)entity : null; // Replaced this //entity.setLocationAndAngles(entity.posX, entity.posY, entity.posZ, world.rand.nextFloat() * 360.0F, 0.0F); NBTTagList nbtRotation = nbttagcompound.getTagList("Rotation", 5); int nbtRotationTagCount = nbtRotation.tagCount(); float yaw = nbtRotationTagCount >= 1 ? nbtRotation.getFloatAt(0) : world.rand.nextFloat() * 360.0F; float pitch = nbtRotationTagCount >= 2 ? nbtRotation.getFloatAt(1) : 0.0F; entity.setLocationAndAngles(entity.posX, entity.posY, entity.posZ, yaw, pitch); //... } if (flag) { this.resetTimer(); } } } }The bug
Spawners ignore the Rotation tag of the entity to spawn and instead give them a random rotation.
How to reproduce
Use the following command
/setblock ~ ~1 ~ mob_spawner 0 replace {SpawnData:{id:"minecraft:armor_stand",Rotation:[180f,0f]},MinSpawnDelay:10s,MaxSpawnDelay:10s,SpawnCount:1,SpawnRange:5}You will see that the ArmorStands spawn with a random rotation
The reason
The following is based on decompiled version of Minecraft 1.9 using MCP 9.24 beta. All method and class names are the names used in the decompiled version.
The reason why this happens is because the method net.minecraft.tileentity.MobSpawnerBaseLogic.updateSpawner() always uses a random yaw value and 0f as pitch value.
public void updateSpawner() { if (!this.isActivated()) { this.prevMobRotation = this.mobRotation; } else { BlockPos blockpos = this.getSpawnerPosition(); if (this.getSpawnerWorld().isRemote) { //... } else { //... for (int i = 0; i < this.spawnCount; ++i) { NBTTagCompound nbttagcompound = this.randomEntity.func_185277_b(); NBTTagList nbttaglist = nbttagcompound.getTagList("Pos", 6); World world = this.getSpawnerWorld(); int j = nbttaglist.tagCount(); double d0 = j >= 1 ? nbttaglist.getDoubleAt(0) : (double)blockpos.getX() + (world.rand.nextDouble() - world.rand.nextDouble()) * (double)this.spawnRange + 0.5D; double d1 = j >= 2 ? nbttaglist.getDoubleAt(1) : (double)(blockpos.getY() + world.rand.nextInt(3) - 1); double d2 = j >= 3 ? nbttaglist.getDoubleAt(2) : (double)blockpos.getZ() + (world.rand.nextDouble() - world.rand.nextDouble()) * (double)this.spawnRange + 0.5D; Entity entity = AnvilChunkLoader.func_186054_a(nbttagcompound, world, d0, d1, d2, false); if (entity == null) { return; } int k = world.getEntitiesWithinAABB(entity.getClass(), (new AxisAlignedBB((double)blockpos.getX(), (double)blockpos.getY(), (double)blockpos.getZ(), (double)(blockpos.getX() + 1), (double)(blockpos.getY() + 1), (double)(blockpos.getZ() + 1))).func_186662_g((double)this.spawnRange)).size(); if (k >= this.maxNearbyEntities) { this.resetTimer(); return; } EntityLiving entityliving = entity instanceof EntityLiving ? (EntityLiving)entity : null; // Replaced this //entity.setLocationAndAngles(entity.posX, entity.posY, entity.posZ, world.rand.nextFloat() * 360.0F, 0.0F); NBTTagList nbtRotation = nbttagcompound.getTagList("Rotation", 5); int nbtRotationTagCount = nbtRotation.tagCount(); float yaw = nbtRotationTagCount >= 1 ? nbtRotation.getFloatAt(0) : world.rand.nextFloat() * 360.0F; float pitch = nbtRotationTagCount >= 2 ? nbtRotation.getFloatAt(1) : 0.0F; entity.setLocationAndAngles(entity.posX, entity.posY, entity.posZ, yaw, pitch); //... } if (flag) { this.resetTimer(); } } } }
Confirmed for 1.11.2
Confirmed for 1.9.2
Confirmed for 1.10-pre1.
Confirmed for 16w32b
The bug
Spawners ignore the Rotation tag of the entity to spawn and instead give them a random rotation.
How to reproduce
Use the following command
/setblock ~ ~1 ~ mob_spawner 0 replace{SpawnData:{id:"minecraft:armor_stand",Rotation:[180f,0f]},MinSpawnDelay:10s,MaxSpawnDelay:10s,SpawnCount:1,SpawnRange:5}You will see that the ArmorStands spawn with a random rotation
The reason
The following is based on decompiled version of Minecraft 1.9 using MCP 9.24 beta. All method and class names are the names used in the decompiled version.
The reason why this happens is because the method net.minecraft.tileentity.MobSpawnerBaseLogic.updateSpawner() always uses a random yaw value and 0f as pitch value.
public void updateSpawner() { if (!this.isActivated()) { this.prevMobRotation = this.mobRotation; } else { BlockPos blockpos = this.getSpawnerPosition(); if (this.getSpawnerWorld().isRemote) { //... } else { //... for (int i = 0; i < this.spawnCount; ++i) { NBTTagCompound nbttagcompound = this.randomEntity.func_185277_b(); NBTTagList nbttaglist = nbttagcompound.getTagList("Pos", 6); World world = this.getSpawnerWorld(); int j = nbttaglist.tagCount(); double d0 = j >= 1 ? nbttaglist.getDoubleAt(0) : (double)blockpos.getX() + (world.rand.nextDouble() - world.rand.nextDouble()) * (double)this.spawnRange + 0.5D; double d1 = j >= 2 ? nbttaglist.getDoubleAt(1) : (double)(blockpos.getY() + world.rand.nextInt(3) - 1); double d2 = j >= 3 ? nbttaglist.getDoubleAt(2) : (double)blockpos.getZ() + (world.rand.nextDouble() - world.rand.nextDouble()) * (double)this.spawnRange + 0.5D; Entity entity = AnvilChunkLoader.func_186054_a(nbttagcompound, world, d0, d1, d2, false); if (entity == null) { return; } int k = world.getEntitiesWithinAABB(entity.getClass(), (new AxisAlignedBB((double)blockpos.getX(), (double)blockpos.getY(), (double)blockpos.getZ(), (double)(blockpos.getX() + 1), (double)(blockpos.getY() + 1), (double)(blockpos.getZ() + 1))).func_186662_g((double)this.spawnRange)).size(); if (k >= this.maxNearbyEntities) { this.resetTimer(); return; } EntityLiving entityliving = entity instanceof EntityLiving ? (EntityLiving)entity : null; // Replaced this //entity.setLocationAndAngles(entity.posX, entity.posY, entity.posZ, world.rand.nextFloat() * 360.0F, 0.0F); NBTTagList nbtRotation = nbttagcompound.getTagList("Rotation", 5); int nbtRotationTagCount = nbtRotation.tagCount(); float yaw = nbtRotationTagCount >= 1 ? nbtRotation.getFloatAt(0) : world.rand.nextFloat() * 360.0F; float pitch = nbtRotationTagCount >= 2 ? nbtRotation.getFloatAt(1) : 0.0F; entity.setLocationAndAngles(entity.posX, entity.posY, entity.posZ, yaw, pitch); //... } if (flag) { this.resetTimer(); } } } }The bug
Spawners ignore the Rotation tag of the entity to spawn and instead give them a random rotation.
How to reproduce
Use the following command
/setblock ~ ~1 ~ minecraft:spawner{SpawnData:{id:"minecraft:armor_stand",Rotation:[180f,0f]},MinSpawnDelay:10s,MaxSpawnDelay:10s,SpawnCount:1,SpawnRange:5}You will see that the ArmorStands spawn with a random rotation
The reason
The following is based on decompiled version of Minecraft 1.9 using MCP 9.24 beta. All method and class names are the names used in the decompiled version.
The reason why this happens is because the method net.minecraft.tileentity.MobSpawnerBaseLogic.updateSpawner() always uses a random yaw value and 0f as pitch value.
public void updateSpawner() { if (!this.isActivated()) { this.prevMobRotation = this.mobRotation; } else { BlockPos blockpos = this.getSpawnerPosition(); if (this.getSpawnerWorld().isRemote) { //... } else { //... for (int i = 0; i < this.spawnCount; ++i) { NBTTagCompound nbttagcompound = this.randomEntity.func_185277_b(); NBTTagList nbttaglist = nbttagcompound.getTagList("Pos", 6); World world = this.getSpawnerWorld(); int j = nbttaglist.tagCount(); double d0 = j >= 1 ? nbttaglist.getDoubleAt(0) : (double)blockpos.getX() + (world.rand.nextDouble() - world.rand.nextDouble()) * (double)this.spawnRange + 0.5D; double d1 = j >= 2 ? nbttaglist.getDoubleAt(1) : (double)(blockpos.getY() + world.rand.nextInt(3) - 1); double d2 = j >= 3 ? nbttaglist.getDoubleAt(2) : (double)blockpos.getZ() + (world.rand.nextDouble() - world.rand.nextDouble()) * (double)this.spawnRange + 0.5D; Entity entity = AnvilChunkLoader.func_186054_a(nbttagcompound, world, d0, d1, d2, false); if (entity == null) { return; } int k = world.getEntitiesWithinAABB(entity.getClass(), (new AxisAlignedBB((double)blockpos.getX(), (double)blockpos.getY(), (double)blockpos.getZ(), (double)(blockpos.getX() + 1), (double)(blockpos.getY() + 1), (double)(blockpos.getZ() + 1))).func_186662_g((double)this.spawnRange)).size(); if (k >= this.maxNearbyEntities) { this.resetTimer(); return; } EntityLiving entityliving = entity instanceof EntityLiving ? (EntityLiving)entity : null; // Replaced this //entity.setLocationAndAngles(entity.posX, entity.posY, entity.posZ, world.rand.nextFloat() * 360.0F, 0.0F); NBTTagList nbtRotation = nbttagcompound.getTagList("Rotation", 5); int nbtRotationTagCount = nbtRotation.tagCount(); float yaw = nbtRotationTagCount >= 1 ? nbtRotation.getFloatAt(0) : world.rand.nextFloat() * 360.0F; float pitch = nbtRotationTagCount >= 2 ? nbtRotation.getFloatAt(1) : 0.0F; entity.setLocationAndAngles(entity.posX, entity.posY, entity.posZ, yaw, pitch); //... } if (flag) { this.resetTimer(); } } } }
The bug
Spawners ignore the Rotation tag of the entity to spawn and instead give them a random rotation.
How to reproduce
Use the following command
/setblock ~ ~1 ~ minecraft:spawner{SpawnData:{id:"minecraft:armor_stand",Rotation:[180f,0f]},MinSpawnDelay:10s,MaxSpawnDelay:10s,SpawnCount:1,SpawnRange:5}You will see that the
ArmorStands spawn with a random rotationThe reason
The following is based on decompiled version of Minecraft 1.9 using MCP 9.24 beta. All method and class names are the names used in the decompiled version.
The reason why this happens is because the method net.minecraft.tileentity.MobSpawnerBaseLogic.updateSpawner() always uses a random yaw value and 0f as pitch value.
public void updateSpawner() { if (!this.isActivated()) { this.prevMobRotation = this.mobRotation; } else { BlockPos blockpos = this.getSpawnerPosition(); if (this.getSpawnerWorld().isRemote) { //... } else { //... for (int i = 0; i < this.spawnCount; ++i) { NBTTagCompound nbttagcompound = this.randomEntity.func_185277_b(); NBTTagList nbttaglist = nbttagcompound.getTagList("Pos", 6); World world = this.getSpawnerWorld(); int j = nbttaglist.tagCount(); double d0 = j >= 1 ? nbttaglist.getDoubleAt(0) : (double)blockpos.getX() + (world.rand.nextDouble() - world.rand.nextDouble()) * (double)this.spawnRange + 0.5D; double d1 = j >= 2 ? nbttaglist.getDoubleAt(1) : (double)(blockpos.getY() + world.rand.nextInt(3) - 1); double d2 = j >= 3 ? nbttaglist.getDoubleAt(2) : (double)blockpos.getZ() + (world.rand.nextDouble() - world.rand.nextDouble()) * (double)this.spawnRange + 0.5D; Entity entity = AnvilChunkLoader.func_186054_a(nbttagcompound, world, d0, d1, d2, false); if (entity == null) { return; } int k = world.getEntitiesWithinAABB(entity.getClass(), (new AxisAlignedBB((double)blockpos.getX(), (double)blockpos.getY(), (double)blockpos.getZ(), (double)(blockpos.getX() + 1), (double)(blockpos.getY() + 1), (double)(blockpos.getZ() + 1))).func_186662_g((double)this.spawnRange)).size(); if (k >= this.maxNearbyEntities) { this.resetTimer(); return; } EntityLiving entityliving = entity instanceof EntityLiving ? (EntityLiving)entity : null; // Replaced this //entity.setLocationAndAngles(entity.posX, entity.posY, entity.posZ, world.rand.nextFloat() * 360.0F, 0.0F); NBTTagList nbtRotation = nbttagcompound.getTagList("Rotation", 5); int nbtRotationTagCount = nbtRotation.tagCount(); float yaw = nbtRotationTagCount >= 1 ? nbtRotation.getFloatAt(0) : world.rand.nextFloat() * 360.0F; float pitch = nbtRotationTagCount >= 2 ? nbtRotation.getFloatAt(1) : 0.0F; entity.setLocationAndAngles(entity.posX, entity.posY, entity.posZ, yaw, pitch); //... } if (flag) { this.resetTimer(); } } } }The bug
Spawners ignore the Rotation tag of the entity to spawn and instead give them a random rotation.
How to reproduce
Use the following command
/setblock ~ ~1 ~ minecraft:spawner{SpawnData:{id:"minecraft:armor_stand",Rotation:[180f,0f]},MinSpawnDelay:10s,MaxSpawnDelay:10s,SpawnCount:1,SpawnRange:5}You will see that the armor stands spawn with a random rotation
The reason
The following is based on decompiled version of Minecraft 1.9 using MCP 9.24 beta. All method and class names are the names used in the decompiled version.
The reason why this happens is because the method net.minecraft.tileentity.MobSpawnerBaseLogic.updateSpawner() always uses a random yaw value and 0f as pitch value.
public void updateSpawner() { if (!this.isActivated()) { this.prevMobRotation = this.mobRotation; } else { BlockPos blockpos = this.getSpawnerPosition(); if (this.getSpawnerWorld().isRemote) { //... } else { //... for (int i = 0; i < this.spawnCount; ++i) { NBTTagCompound nbttagcompound = this.randomEntity.func_185277_b(); NBTTagList nbttaglist = nbttagcompound.getTagList("Pos", 6); World world = this.getSpawnerWorld(); int j = nbttaglist.tagCount(); double d0 = j >= 1 ? nbttaglist.getDoubleAt(0) : (double)blockpos.getX() + (world.rand.nextDouble() - world.rand.nextDouble()) * (double)this.spawnRange + 0.5D; double d1 = j >= 2 ? nbttaglist.getDoubleAt(1) : (double)(blockpos.getY() + world.rand.nextInt(3) - 1); double d2 = j >= 3 ? nbttaglist.getDoubleAt(2) : (double)blockpos.getZ() + (world.rand.nextDouble() - world.rand.nextDouble()) * (double)this.spawnRange + 0.5D; Entity entity = AnvilChunkLoader.func_186054_a(nbttagcompound, world, d0, d1, d2, false); if (entity == null) { return; } int k = world.getEntitiesWithinAABB(entity.getClass(), (new AxisAlignedBB((double)blockpos.getX(), (double)blockpos.getY(), (double)blockpos.getZ(), (double)(blockpos.getX() + 1), (double)(blockpos.getY() + 1), (double)(blockpos.getZ() + 1))).func_186662_g((double)this.spawnRange)).size(); if (k >= this.maxNearbyEntities) { this.resetTimer(); return; } EntityLiving entityliving = entity instanceof EntityLiving ? (EntityLiving)entity : null; // Replaced this //entity.setLocationAndAngles(entity.posX, entity.posY, entity.posZ, world.rand.nextFloat() * 360.0F, 0.0F); NBTTagList nbtRotation = nbttagcompound.getTagList("Rotation", 5); int nbtRotationTagCount = nbtRotation.tagCount(); float yaw = nbtRotationTagCount >= 1 ? nbtRotation.getFloatAt(0) : world.rand.nextFloat() * 360.0F; float pitch = nbtRotationTagCount >= 2 ? nbtRotation.getFloatAt(1) : 0.0F; entity.setLocationAndAngles(entity.posX, entity.posY, entity.posZ, yaw, pitch); //... } if (flag) { this.resetTimer(); } } } }
Confirmed for 1.15.2. Fixing this nasty bug in upcoming 1.16 would've been pretty nice.
relates to
The bug
Spawners ignore the Rotation tag of the entity to spawn and instead give them a random rotation.
How to reproduce
Use the following command
/setblock ~ ~1 ~ minecraft:spawner{SpawnData:{entity:{id:"minecraft:armor_stand",Rotation:[180f,0f]}},MinSpawnDelay:10s,MaxSpawnDelay:10s,SpawnCount:1,SpawnRange:5}You will see that the armor stands spawn with a random rotation
The reason
The following is based on decompiled version of Minecraft 1.9 using MCP 9.24 beta. All method and class names are the names used in the decompiled version.
The reason why this happens is because the method net.minecraft.tileentity.MobSpawnerBaseLogic.updateSpawner() always uses a random yaw value and 0f as pitch value.
public void updateSpawner() { if (!this.isActivated()) { this.prevMobRotation = this.mobRotation; } else { BlockPos blockpos = this.getSpawnerPosition(); if (this.getSpawnerWorld().isRemote) { //... } else { //... for (int i = 0; i < this.spawnCount; ++i) { NBTTagCompound nbttagcompound = this.randomEntity.func_185277_b(); NBTTagList nbttaglist = nbttagcompound.getTagList("Pos", 6); World world = this.getSpawnerWorld(); int j = nbttaglist.tagCount(); double d0 = j >= 1 ? nbttaglist.getDoubleAt(0) : (double)blockpos.getX() + (world.rand.nextDouble() - world.rand.nextDouble()) * (double)this.spawnRange + 0.5D; double d1 = j >= 2 ? nbttaglist.getDoubleAt(1) : (double)(blockpos.getY() + world.rand.nextInt(3) - 1); double d2 = j >= 3 ? nbttaglist.getDoubleAt(2) : (double)blockpos.getZ() + (world.rand.nextDouble() - world.rand.nextDouble()) * (double)this.spawnRange + 0.5D; Entity entity = AnvilChunkLoader.func_186054_a(nbttagcompound, world, d0, d1, d2, false); if (entity == null) { return; } int k = world.getEntitiesWithinAABB(entity.getClass(), (new AxisAlignedBB((double)blockpos.getX(), (double)blockpos.getY(), (double)blockpos.getZ(), (double)(blockpos.getX() + 1), (double)(blockpos.getY() + 1), (double)(blockpos.getZ() + 1))).func_186662_g((double)this.spawnRange)).size(); if (k >= this.maxNearbyEntities) { this.resetTimer(); return; } EntityLiving entityliving = entity instanceof EntityLiving ? (EntityLiving)entity : null; // Replaced this //entity.setLocationAndAngles(entity.posX, entity.posY, entity.posZ, world.rand.nextFloat() * 360.0F, 0.0F); NBTTagList nbtRotation = nbttagcompound.getTagList("Rotation", 5); int nbtRotationTagCount = nbtRotation.tagCount(); float yaw = nbtRotationTagCount >= 1 ? nbtRotation.getFloatAt(0) : world.rand.nextFloat() * 360.0F; float pitch = nbtRotationTagCount >= 2 ? nbtRotation.getFloatAt(1) : 0.0F; entity.setLocationAndAngles(entity.posX, entity.posY, entity.posZ, yaw, pitch); //... } if (flag) { this.resetTimer(); } } } }

I've not tried, but it sounds like specifying rotation did work in 1.8.9? (So this is a regression, not a feature request, right?)
I do not know if it worked in 1.8.9 and in my opinion it does not matter. There is very likely a reason why someone provides the Rotation tag
Haven't thought about this one. Would be nice to see this fixed with Pos tag. How about linking this bug to
MC-97491as "relates to"? Both are about spawners and position/rotation of spawned entity.This one here is rather a general problem that (probably) existed before
MC-97491came upConfirmed for 1.9
Confirmed for 16w40a
Confirmed for 1.13.1.
1.13.1 command: /setblock ~ ~1 ~ minecraft:spawner{SpawnData:{id:"minecraft:armor_stand",Rotation:[180f,0f]},MinSpawnDelay:10s,MaxSpawnDelay:10s,SpawnCount:1,SpawnRange:5}Confirmed for 1.15.2. Fixing this nasty bug in upcoming 1.16 would've been pretty nice.
Can confirm in 21w05b.
This is a feature request.