You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The way this is updating dialogX/dialogY is presuming that the offset between drawX/drawY will appear stable to subsequent calls of movePosition, but in the smoke bomb case, updateEscapeAnimation updates drawX without making corresponding updates to dialogX.
Some options for patching this in a backwards compatible way:
patch AbstractPlayer.updateEscapeAnimation to update dialogX along with drawX (either directly or by replacing the mutation of drawX with calls to movePostition)
update CustomPlayer to calculate and persist the dialogOffsets in a field early during play (possibly "the first time movePosition is called) and have subsequent calls to movePosition use that rather than re-calculating
The latter would be more resilient to cases other mods might add that move drawX around; the former would be friendlier to mods that for some reason move dialogX/dialogY dynamically (maybe a character with a shapeshifting mechanic that changes size dynamically, etc). I'd probably go with the latter.
Workaround
Individual mods looking to work around the issue can override movePosition in each of their characters as follows:
// These should be the values you're probably using in your constructor,// assuming you followed StS-TheDefaultMod's exampleprivatestaticfinalfloatDIALOG_OFFSET_X = 0.0F * Settings.scale;
privatestaticfinalfloatDIALOG_OFFSET_Y = 220.0F * Settings.scale;
@OverridepublicvoidmovePostition(floatx, floaty) {
super.movePosition(x, y);
dialogX = x + DIALOG_OFFSET_X;
dialogY = y + DIALOG_OFFSET_Y;
}
The text was updated successfully, but these errors were encountered:
Repro steps:
CustomPlayer
that does not overridemovePosition
draw 6
potion 0 SmokeBomb
draw 6
Root cause
I think the underlying issue is with BaseMod's implementation of
CustomPlayer.movePosition
. Notable parts:The way this is updating
dialogX
/dialogY
is presuming that the offset betweendrawX
/drawY
will appear stable to subsequent calls ofmovePosition
, but in the smoke bomb case,updateEscapeAnimation
updatesdrawX
without making corresponding updates todialogX
.Some options for patching this in a backwards compatible way:
AbstractPlayer.updateEscapeAnimation
to updatedialogX
along withdrawX
(either directly or by replacing the mutation ofdrawX
with calls tomovePostition
)CustomPlayer
to calculate and persist thedialogOffset
s in a field early during play (possibly "the first timemovePosition
is called) and have subsequent calls tomovePosition
use that rather than re-calculatingThe latter would be more resilient to cases other mods might add that move drawX around; the former would be friendlier to mods that for some reason move dialogX/dialogY dynamically (maybe a character with a shapeshifting mechanic that changes size dynamically, etc). I'd probably go with the latter.
Workaround
Individual mods looking to work around the issue can override
movePosition
in each of their characters as follows:The text was updated successfully, but these errors were encountered: