mrbuilder1961 / ChatPatches

A Minecraft client-side mod that touches up Minecraft's mundane chat, with configurability in mind!
GNU Lesser General Public License v3.0
48 stars 19 forks source link

issues with smoothscroll-1.8.2 #139

Closed SmajloSlovakian closed 9 months ago

SmajloSlovakian commented 9 months ago

Description

smoothscroll is a mod made by me... recently, an issue was reported to me with this and my mod's compatibility... there are two issues:

  1. my mod doesn't know about the shifting of the chat position and incorrectly applies rendering mask - you can see that by counting the visible line count or by looking at the lowest lines while scrolling.
  2. when opening/focusing chat, it somehow instantly scrolls up and then smoothly scrolls down. video: https://github.com/SmajloSlovakian/Minecraft-Smooth-Scrolling/assets/135575164/5e6be236-5cca-44e6-abf6-bd46ea9e91b4

Specs and Details

Required information:

Additional context

i already fixed the first issue on my and on your end on my machine and i will make a pull request now... but i don't know how to fix the second issue

mrbuilder1961 commented 9 months ago

i'm not super familiar with rendering and animations yet, so to be honest idk what the issue is either. i can look in a few days but idk about any of this to be honest...

also please move the request to the 1.20.4 branch if you can, i need to review both changes and a lot of things have changed between the two versions so i'm not 100% sure the fix will apply to both simultaneously. thanks for the super detailed report!

SmajloSlovakian commented 9 months ago

so basically my mod works just by having a scrolloffset value. i hijack some methods, which change the scrolledlines value and add the change into the offset and cancel the scrolledelines change. every frame, i divide the scrolloffset by a number in the head of the render method and i also change the scrolledlines value so it aligns with the offset and then i change it back in the tail. i also change the y position of every line by a number corresponding to the offset... this isn't a perfect explanation but it will do... so what you have somewhere is that you somehow change the scrolledlines value to maximum (as if it was scrolled all the way up) without my mod noticing and then you change it back to 0 with my mod noticing...

to that pull request, it should work fine but i will do as you say...

mrbuilder1961 commented 9 months ago

okay cool, thanks for the explanation! according to my memory, the only changes i make to the scrolled lines are from my config's shiftChat option, and when the game loads the chat log for the first time it changes their received time (so it doesn't look like you just got a ton of messages). maybe those are messing it up somehow?

SmajloSlovakian commented 9 months ago

hmm... it seems that when i open chat, it calls addmessage some amount of times... when addmessage is called, my mod doesn't instantly scroll down, instead it smoothly scrolls down (for every line it adds 9 pixels to the offset and leaves the scrolledlines untouched)... so that means that there's the issue somewhere... there also appears that resetscroll gets called 2 times (not at the same time but at the same frame - when opening chat)

SmajloSlovakian commented 9 months ago

ok so i fixed it in my mod by not changing the offset when refresh is called...

mrbuilder1961 commented 9 months ago

awesome! i seriously appreciate all the work you've been doing to fix this 😁

SmajloSlovakian commented 9 months ago

it wasn't very hard to fix... it was just hard to find the cause :)