Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mixin Changes + Compatibility With my Mod #155

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 4 additions & 11 deletions src/main/java/dev/tr7zw/skinlayers/mixin/PlayerRendererMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,21 +51,14 @@ public PlayerRendererMixin(Context context, PlayerModel<AbstractClientPlayer> en
//#endif
// spotless:on

private boolean loaded = false;

// Somehow doing this in 1.16.5 is a bit unpredictable, only late adding layer works well. Not sure why
// @Inject(method = "<init>*", at = @At("RETURN"))
// public void onCreate(CallbackInfo info) {
// this.addLayer(new CustomLayerFeatureRenderer(this));
// }
@Inject(method = "<init>", at = @At("RETURN"))
public void onCreate(CallbackInfo info) {
this.addLayer(new CustomLayerFeatureRenderer(this));
}

@SuppressWarnings("resource")
@Inject(method = "setModelProperties", at = @At("RETURN"))
public void setModelProperties(AbstractClientPlayer abstractClientPlayer, CallbackInfo info) {
if (!loaded) {
this.addLayer(new CustomLayerFeatureRenderer(this));
loaded = true;
}
if (Minecraft.getInstance().player == null || Minecraft.getInstance().player
.distanceToSqr(abstractClientPlayer) > SkinLayersModBase.config.renderDistanceLOD
* SkinLayersModBase.config.renderDistanceLOD) {
Expand Down