Direwolf20-MC / JustDireThings

Just some things Direwolf20 wants to have.
MIT License
40 stars 14 forks source link

Item Collector Rendering Particles crashes game when competing for items #213

Closed zperk13 closed 2 weeks ago

zperk13 commented 3 weeks ago

Just Dire Things version

1.4.2

Minecraft Version

1.21

(Neo)Forge Version

21.1.61

Modpack & Version

ftb-presents-direwolf20-11 - 1.2.1

Do you have optifine or Rubidium installed?

No

Describe the issue

If an item collector tries to "delete" an item from the world at the same time as something else, the game crashes due to the item collector trying to render particles for an item that no longer exists

Steps to reproduce

  1. Recreate the setup shown in the screenshots
  2. Put a polymorphic catalyst and blaze ember in the dropper

(if you want to do it again, just place a block where the liquid fuel is then break that block)

Expected behaviour

If the item no longer exists, particles should no longer try to render, which would stop the game from crashing

Screenshots

Where the item collector is targeting: image

Where the sensor and dropper are targeting image

Dropper Configuration: image

Sensor Configuration: image

Item Collector Configuration: image

Log files

latest.log debug.log

Additional information

I first discovered this bug and reported it to https://github.com/FTBTeam/FTB-Modpack-Issues/issues/5922 A few hours later a second similar bug report came up https://github.com/FTBTeam/FTB-Modpack-Issues/issues/5923

They both have the same disconnect message: Connection Lost Internal Exception: io.netty.handler.codec.EncoderException: Failed to encode packet 'clientbount/minecraft:level_particles'

After talking with the author of the 2nd bug post and reading the code, I've narrowed down the issue to the doParticles function in ItemCollectorBE.java, I compiled a custom version of the mod with line 105 commented out, making it so that Item Collectors would not try to render particles (Item Collectors are the only thing that call that specific function) and it seems to stop the game from crashing for me (I put seems because there is randomness but before it would always crash within 10 seconds and the game ran for several minutes with no issues with the patched version).

This is not an ideal fix for the bug, it's just to prove that is where the issue is.

My current theory is that the item collector tries to pick up the item at the same time the fluid deletes it (because the item is converting the fluid). While the item handling stuff seems to be smart enough to handle this situation and not duplicate the item, the renderer tries to make particles that look similar to an item that no longer exists. Fuel making is not the only situation where this can happen as the author of the 2nd issue I mentioned had it happening with their Geore harvester.

zperk13 commented 3 weeks ago

Note: This setup may not show you the io.netty.handler.codec.EncoderException: Failed to encode packet 'clientbount/minecraft:level_particles' thing and might just say "disconnected", but you will see that error in the logs. If it helps, search for io.netty.handler.codec.EncoderException: Failed to encode packet 'clientbound/minecraft:level_particles' in your latest.log

zperk13 commented 3 weeks ago

My "patch" of disabling the rendering of particles for Item Collectors seems to have stop the crashes for the author of the 2nd issue as well (mostlygizzards, I don't want to bother them with an @) , further confirming the location of the issue. Again, this is not an ideal fix, it's just to confirm where the issue is.

mostlygizzards commented 3 weeks ago

Great catch, and thank you again.

Direwolf20-MC commented 2 weeks ago

This has been resolved going forward - thanks for the heads up! :)