Description
|
@Inject(method = "render", at = @At("HEAD")) |
|
private void onRenderStart(GuiGraphics context, int currentTick, int mouseX, int mouseY, boolean focused, CallbackInfo ci) { |
|
float displacement = calculateDisplacement(); |
|
context.pose().pushPose(); |
|
context.pose().translate(0f, displacement, 0f); |
|
} |
|
|
|
@Inject(method = "render", at = @At("TAIL")) |
|
private void onRenderEnd(GuiGraphics context, int currentTick, int mouseX, int mouseY, boolean focused, CallbackInfo ci) { |
|
context.pose().popPose(); |
|
} |
Here onRenderEnd injects into the TAIL of the method, and thus will not run when the chat is empty or hidden (see image below.)
Steps to Reproduce
- Install the mod on 1.20.1 or 1.21.1
- Run the game with
-Dmixin.debug.export=true
- Decompile the generated
net.minecraft.client.gui.components.ChatComponent class
- Observe that
onRenderEnd and onRenderStart do not match
Possible Solution
TAIL should be replace with RETURN. Alternatively, WrapMethod may be used. This makes sure the pop call is always run even when some mods call CallbackInfo#cancel in the middle of the method.
Related Issues
Possibly related to #24 and #25
Description
ChatAnimation/common/src/main/java/com/ezzenix/chatanimation/mixin/ChatComponentMixin.java
Lines 40 to 50 in 901b957
Here
onRenderEndinjects into theTAILof the method, and thus will not run when the chat is empty or hidden (see image below.)Steps to Reproduce
-Dmixin.debug.export=truenet.minecraft.client.gui.components.ChatComponentclassonRenderEndandonRenderStartdo not matchPossible Solution
TAILshould be replace withRETURN. Alternatively,WrapMethodmay be used. This makes sure the pop call is always run even when some mods callCallbackInfo#cancelin the middle of the method.Related Issues
Possibly related to #24 and #25