mojira.dev
MC-10369

Server side particle spawning does not create particles for client

The bug

Particle creation triggered for the server does not send a particle packets to the client.

Affected situations

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.

Iron and snow Golem creation
  • Affected method: net.minecraft.block.BlockPumpkin.trySpawnGolem(World, BlockPos)

  • Suggested fix: See comment

Wither boss creation
  • Affected method: net.minecraft.block.BlockSkull.checkWitherSpawn(World, BlockPos, TileEntitySkull)

  • Suggested fix: See comment

Water and lava colliding
  • Affected method: net.minecraft.block.BlockLiquid.triggerMixEffects(World, BlockPos)

  • Suggested fix: See comment

Redstone torch burning out
  • Affected method: net.minecraft.block.BlockRedstoneTorch.updateTick(World, BlockPos, IBlockState, Random)

  • Suggested fix: See comment

Armor breaking on mob
  • Affected method: net.minecraft.entity.EntityLivingBase.renderBrokenItemStack(ItemStack)

  • How to reproduce: See description of MC-96974

Placing eye of ender in end portal frame
  • Affected method: net.minecraft.item.ItemEnderEye.onItemUse(ItemStack, EntityPlayer, World, BlockPos, EnumHand, EnumFacing, float, float, float)

  • Suggested fix: See comment

Animal being born
  • Affected method: net.minecraft.entity.ai.EntityAIMate.spawnBaby()

Ender dragon destroying blocks
  • Affected method: net.minecraft.entity.boss.EntityDragon.destroyBlocksInAABB(AxisAlignedBB)

Explosion particles for EntityLiving spawned by spawner
  • Affected method: net.minecraft.tileentity.MobSpawnerBaseLogic.updateSpawner()

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 is happening is because the abstract method net.minecraft.world.IWorldEventListener.spawnParticle(int, boolean, double, double, double, double, double, double, int...) is called for particle creation. Calling this method calls for the client the net.minecraft.client.renderer.RenderGlobal.spawnParticle(int, boolean, double, double, double, double, double, double, int...) method which creates the particle. However, for the server it calls the net.minecraft.world.WorldManager.spawnParticle(int, boolean, double, double, double, double, double, double, int...) method which does nothing. The change of using an integrated server for the client might have caused this bug.
It is probably not a good decision to fix this by having the net.minecraft.world.WorldManager class sending particle packets every time the method is called because this method does not support a count parameter, which means that for example for the creation of an iron or snow golem 120 packets are being sent. Instead the method net.minecraft.world.WorldServer.spawnParticle(EnumParticleTypes, double, double, double, int, double, double, double, double, int...) should be used which has a particle count parameter and uses the value for creating the particle packet.

Comparing with old behaviour

If you would like to test how it was in 1.2.5, you can download the 1.2.5 jar file from here:

http://www.minecraftwiki.net/wiki/Version_history/Development_versions#Minecraft_1.2_Snapshots_.26_Pre-releases
Or you can create a new profile in the launcher with the version "release 1.2.5"
Replace your current jar file with the 1.2.5 one and spawn each Golem to see the particles.

Related issues

Attachments

Comments

migrated
[media][media][media][media][media]
kumasasa

Chumbanotz, did you test every single issue against 13w09c in 2 minutes or do you blindly bulk-setting the version ?

Tails

Confirmed.

HJS

you don't have to download the minecraft.jar for MC 1.2.5 you can use the launcher.

Sonicwave

Confirmed for 1.8/1.8.1-pre2.

Swekob

Affects 15w47c & 1.8.8

marcono1234

Confirmed for

  • 16w06a

marcono1234

Please link to this comment in the description

The following is based on decompiled version of Minecraft 1.8 using MCP. All method and class names are the names used in the decompiled version.

The reason for this seems to be that the methods spawning the Snowman, VillagerGolem and WitherBoss (yes, a WitherBoss should – based on the code – also create particles) are only called server side, however the methods they are calling to create the particles are client side. This is a little bit complicated because they are calling the method for all net.minecraft.world.IWorldAccess. While for the client the net.minecraft.client.renderer.RenderGlobal (which creates the particles) is in this list, for the server only net.minecraft.world.WorldManager are in this list. The problem is their method for creating particles is simply doing nothing. This bug would be more obvious if there would be base, client and server classes for entities, blocks... and if the particle spawning method of the net.minecraft.client.renderer.RenderGlobal would be directly called.

Anyways to solve this problem the method sending the particles packet to the client should be called: public void func_175739_a(EnumParticleTypes p_175739_1_, double p_175739_2_, double p_175739_4_, double p_175739_6_, int p_175739_8_, double p_175739_9_, double p_175739_11_, double p_175739_13_, double p_175739_15_, int ... p_175739_17_) of the net.minecraft.world.WorldServer class

How to fix the bug

Instead of having the for loops to create the particles, the following could / should be used:

Snowman
  • Affected class: net.minecraft.block.BlockPumpkin

  • Affected method: private void createGolem(World worldIn, BlockPos p_180673_2_)

  • New code:
    var11 - The BlockPos at which the Snowman gets created
    var9 - The Snowman

    ((WorldServer) worldIn).func_175739_a(EnumParticleTypes.SNOW_SHOVEL, (double)var11.getX() + 0.5D, (double)var11.getY() + var9.height / 2, (double)var11.getZ() + 0.5D, 120, var9.width / 4, var9.height / 4, var9.width / 4, 0D, new int[0]);
VillagerGolem
  • Affected class: net.minecraft.block.BlockPumpkin

  • Affected method: private void createGolem(World worldIn, BlockPos p_180673_2_)

  • New code:
    var10 - The BlockPos at which the VillagerGolem gets created
    var13 - The VillagerGolem

    ((WorldServer) worldIn).func_175739_a(EnumParticleTypes.SNOWBALL, (double)var10.getX() + 0.5D, (double)var10.getY() + var13.height / 2, (double)var10.getZ() + 0.5D, 120, var13.width / 4, var13.height / 4, var13.width / 4, 0D, new int[0]);
WitherBoss
  • Affected class: net.minecraft.block.BlockSkull

  • Affected method: public void func_180679_a(World worldIn, BlockPos p_180679_2_, TileEntitySkull p_180679_3_)

  • New code:
    var12 - The BlockPos at which the WitherBoss gets created
    var14 - The WitherBoss

    ((WorldServer) worldIn).func_175739_a(EnumParticleTypes.SNOWBALL, (double)var12.getX() + 0.5D, (double)var12.getY() + var14.height / 2, (double)var12.getZ() + 0.5D, 120, var14.width / 4, var14.height / 4, var14.width / 4, 0D, new int[0]);

Note: In my opinion the particles should also be adjusted, so the VillagerGolem creates iron block breaking particles and the WitherBoss soul sand breaking particles.

[Mod]Les3awe

Reporter seems inactive.
Recommendation Mod giving ticket to Marcono1234.

marcono1234

Can someone of the mods please mark all reports currently marked as "relates to" as duplicate?
I will update the report after that accordingly

shufboyardee

Affects version 1.9 and 1.9.1-pre3.

tryashtar

Snow golem particles seem to be back in 17w47b, maybe earlier, though it's possible it's just a side effect of the snow blocks breaking.

EDIT: yes it is, see MC-123338.

KaptainWutax

So, a new item got added to the list in 1.9 : chorus fruit. When eaten, it calls Item#onItemUseFinish(ItemStack stack, World worldIn, EntityLivingBase entityLiving). That method then performs a !world.isRemote check and proceeds to call EntityLivingBase#attemptTeleport(double x, double y, double z) a couple of times. In the latter, the code generates PORTAL particles using the client-side spawnParticles method. But because of the server-side check earlier, nothing happens on the client and no packet is sent.

tryashtar

Which of the examples are still an issue in 1.15.2?

Chumbanotz

marcono1234

boq

Confirmed

(Unassigned)

12w18a, iron_golem, particles, snow_golem, villager_golem

Snapshot 13w09a, Snapshot 13w09b, Snapshot 13w09c, Snapshot 13w10a, Snapshot 13w10b, ..., Minecraft 18w08b, Minecraft 18w11a, Minecraft 1.13-pre1, Minecraft 1.13-pre6, Minecraft 1.13.1

Minecraft 19w14a

Retrieved