timrwood / roost

A Minecraft mod that gives chickens a place to rest
https://minecraft.curseforge.com/projects/roost
MIT License
13 stars 15 forks source link

Looking at Chicken 2D sprites in JEI is causing RAM/GC to spike #55

Open LukewarmYeti opened 5 years ago

LukewarmYeti commented 5 years ago

If you hit F3 for the debug overlay, then look at either @roost or looking at "breeding chickens" or "roosting chickens", the ram usage speed in the top right-hand corner increases by like 200%.

By RAM I mean when the ram usage is going up and then gets reset by garbage collection. When viewing these sprites the usage increase triples and it goes crazy. Note this doesn't happen with the chicken's mod JEI (their own breeding JEI etc.)

This seems to only be a problem with Roost. Furthermore, the chickens in the actual roost are fine, and don't show any issues. Seems to be a conflict with roost and JEI.

Using: Roost: 1.12.2-1.3.0 JEI: 1.12.2-4.14.4.264

Edit: note that this occurs regardless of chickens and more chickens version

triffman33 commented 5 years ago

FPS also drops significantly.

Examples of this shown here: https://github.com/FTBTeam/FTB-Presents-Stoneblock-2/issues/233

And here: https://www.youtube.com/watch?v=PnxGVx3fydI&feature=youtu.be

Not really a massive issue for me but for people with less powerful machines and less ram, it could cause a crash.

LukewarmYeti commented 5 years ago

@triffman33 Thanks for the video, it probably would be hard to convey otherwise!

Yeh, I've never seen a bug like this before which causes ram to spike like this, I'm pretty sure it's not supposed to be happening, even if it doesn't negatively affect some people with better pcs/ram.

Edit: Just noticed in the video that the spikes occur when looking at the chickens in storage using The One Probe, so the issue isn't restricted to JEI. It's where ever the roost chickens are visible.

timrwood commented 5 years ago

This is probably due to how item textures work for chickens. Instead of having a different item for each chicken, they all share a single item, and use NBT data to determine what type of chicken they are. The item then uses that NBT data to look up the correct texture for the item, the same way bows are the same item, but have different textures based on how far they are drawn back.

https://github.com/timrwood/roost/blob/master/src/main/java/com/timwoodcreates/roost/item/ItemChicken.java#L90-L99

I plan to make each chicken a different item in 1.13, which should probably solve this. I'd like to do that sooner, but I don't think there is a way to migrate items in an existing world to a new item (roost:chicken[Type=log] to roost:log_chicken for example)

triffman33 commented 5 years ago

Ahh I see, well hopefully forge won't take too much longer to rewrite so we can have the non laggy chickens xD ty for letting us know!