LtxProgrammer / Changed-Minecraft-Mod

A Changed experience in the world of Minecraft.
MIT License
39 stars 39 forks source link

Some mods cause TransfurAnimator to fail to capture the player model properties. #1034

Closed cecnull1 closed 1 month ago

cecnull1 commented 2 months ago

crash-2024-09-14_21.28.05-client.txt

Trigger Condition: When using the Origin Module, if the player selects the Phantom race and undergoes metamorphosis, a Beastification event from another module may occur. This can result in a situation where the Pose value is null, leading to a NullPointerException subsequently. My temporary solution is to use early return, but this does not fundamentally solve the issue.

(Use Qwen for translation.)

cecnull1 commented 2 months ago

Moreover, this issue is not triggered by a single condition; any modification involving the player model could potentially lead to errors.

cecnull1 commented 2 months ago

目前已知会导致造成Pose = null而导致NullPointerException的问题有几个: 起源模组 - 幻化技能来隐身自己,然后在这种情况下被兽化 魔法模组 - 真实隐身来隐身自己,然后在这种情况下被兽化 本模组 - 修改版 - 在抓住目标情况下手动兽化目标(前提是注释掉 释放实体 逻辑) 对一个玩家实体进行乱七八糟的值修改也有可能引发此问题 其他

This issue, causing Pose to be set to null and leading to a NullPointerException, can arise from several known causes:

LtxProgrammer commented 2 months ago

My temporary solution is to use early return, but this does not fundamentally solve the issue.

There isn't a "fundamental fix" for this kind of issue. In both external mod cases, the player is invisible. The transfur animator is only capable of transitioning a HumanoidModel (Vanilla player model) into a AdvancedHumanoidModel (Changed entity model). Any other case would need to be omitted from rendering the transfurring player.

gengyoubo commented 1 month ago

Can't you set conditions for TF? Like 0 for normal, 1 for TF status, etc etc. Then set it on NBT then compare.

LtxProgrammer commented 1 month ago

Can't you set conditions for TF? Like 0 for normal, 1 for TF status, etc etc. Then set it on NBT then compare.

What is this supposed to mean? What's it for?

gengyoubo commented 1 month ago

First create the NBT and put the human form values in it. ` @Mixin(someclass.class) public class FormValueMixin {

@Unique
private static int HumanFormValue= 0;

public static int getHumanFormValue() {
    return HumanFormValue;
}

public static void setHumanFormValue(int newValue) {
    HumanFormValue = newValue;
}

`

gengyoubo commented 1 month ago

Then compare before TF ` int Value = FormValueMixin.getHumanFormValue(); if (Value == 0){

}//Assuming a human value of 0 `

gengyoubo commented 1 month ago

1045

The same applies to commands.

LtxProgrammer commented 1 month ago

What are you talking about? What is the point for any of this? You don't show at all what you mean by "setting it to NBT and comparing it."

If you're talking about a condition to allowing Transfur, I'm already aware of that (See ChangedCompatibility.isPlayerUsedByOtherMod()).

And just to let you know, mixin wont let you access public static methods and members in a mixin class. And just for future reference please make sure your comments are understandable, and that the quality of your presented code meets the repository's standards.

gengyoubo commented 1 month ago

Of course I know mixin doesn't have access to mixin. but that's beside the point. The code you wrote before only had the human and latex cases. If you count the case of other modules you have to categorize this case to prevent null values. Or even if there is a null value, use a “try-catch” to handle it.

LtxProgrammer commented 1 month ago

So you are suggesting to check if the player is being used by another mod? Kind of like ChangedCompatibility.isPlayerUsedByOtherMod()?

There's no need for the Changed mod to keep its own "case" value for what other mods modify the player for, that's redundant.

gengyoubo commented 1 month ago

That leaves try-catch, right?

gengyoubo commented 1 month ago

Ex: String str = null; try {

} catch (NullPointerException e) {

}

LtxProgrammer commented 1 month ago

Already added in bcde3a382281668d40bdf8cdf1986462c80eed84

gengyoubo commented 1 week ago

目前已知会导致造成Pose = null而导致NullPointerException的问题有几个: 起源模组 - 幻化技能来隐身自己,然后在这种情况下被兽化 魔法模组 - 真实隐身来隐身自己,然后在这种情况下被兽化 本模组 - 修改版 - 在抓住目标情况下手动兽化目标(前提是注释掉 释放实体 逻辑) 对一个玩家实体进行乱七八糟的值修改也有可能引发此问题 其他

This issue, causing Pose to be set to null and leading to a NullPointerException, can arise from several known causes:

  • Origin Mod: Using the polymorph skill to make oneself invisible, followed by being transformed (bestialized) in this state.
  • Magic Mod: Using true invisibility to become invisible, followed by being transformed (bestialized) in this state.
  • This Mod (modified version): Manually transforming the target while it is being held (assuming the 'release entity' logic has been commented out).
  • Arbitrary value modifications to a player entity may also trigger this problem.
  • Other factors.

我找不到魔法模组,你能给我个链接吗?

cecnull1 commented 6 days ago

我也不知道