Skip to content

Commit 3ed14a2

Browse files
committed
Fix EMF mixin, format
1 parent 54cab10 commit 3ed14a2

File tree

11 files changed

+50
-49
lines changed

11 files changed

+50
-49
lines changed

src/main/java/dev/tr7zw/skinlayers/SkinUtil.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public void onRemoval(RemovalNotification<AbstractTexture, NativeImage> notifica
3939
}).build();
4040

4141
public static NativeImage getTexture(
42-
/*? >= 1.21.11 {*/ Identifier /*?} else {*//* ResourceLocation *//*?}*/ resourceLocation,
42+
/*? >= 1.21.11 {*/ Identifier /*?} else {*/ /*ResourceLocation *//*?}*/ resourceLocation,
4343
SkullSettings settings) {
4444
if (resourceLocation == null) {
4545
return null;
@@ -179,7 +179,7 @@ public static boolean setup3dLayers(GameProfile gameprofile, SkullSettings setti
179179
}
180180

181181
public static boolean setup3dLayers(
182-
/*? >= 1.21.11 {*/ Identifier /*?} else {*//* ResourceLocation *//*?}*/ playerSkin,
182+
/*? >= 1.21.11 {*/ Identifier /*?} else {*/ /*ResourceLocation *//*?}*/ playerSkin,
183183
SkullSettings settings) {
184184
if (playerSkin == null) {
185185
return false; // no skin

src/main/java/dev/tr7zw/skinlayers/SkullRendererCache.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,13 @@ public void setInitialized(boolean initialized) {
5151
}
5252

5353
@Override
54-
public void setLastTexture(/*? >= 1.21.11 {*/ Identifier /*?} else {*//* ResourceLocation *//*?}*/ texture) {
54+
public void setLastTexture(/*? >= 1.21.11 {*/ Identifier /*?} else {*/ /*ResourceLocation *//*?}*/ texture) {
5555
// TODO Auto-generated method stub
5656

5757
}
5858

5959
@Override
60-
public /*? >= 1.21.11 {*/ Identifier /*?} else {*//* ResourceLocation *//*?}*/ getLastTexture() {
60+
public /*? >= 1.21.11 {*/ Identifier /*?} else {*/ /*ResourceLocation *//*?}*/ getLastTexture() {
6161
// TODO Auto-generated method stub
6262
return null;
6363
}

src/main/java/dev/tr7zw/skinlayers/accessor/PlayerSettings.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ public interface PlayerSettings extends PlayerData {
1818

1919
public void setRightLegMesh(Mesh box);
2020

21-
public /*? >= 1.21.11 {*/ Identifier /*?} else {*//* ResourceLocation *//*?}*/ getCurrentSkin();
21+
public /*? >= 1.21.11 {*/ Identifier /*?} else {*/ /*ResourceLocation *//*?}*/ getCurrentSkin();
2222

23-
public void setCurrentSkin(/*? >= 1.21.11 {*/ Identifier /*?} else {*//* ResourceLocation *//*?}*/ skin);
23+
public void setCurrentSkin(/*? >= 1.21.11 {*/ Identifier /*?} else {*/ /*ResourceLocation *//*?}*/ skin);
2424

2525
public boolean hasThinArms();
2626

src/main/java/dev/tr7zw/skinlayers/accessor/SkullSettings.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ public interface SkullSettings extends SkullData {
1414

1515
public void setInitialized(boolean initialized);
1616

17-
public void setLastTexture(/*? >= 1.21.11 {*/ Identifier /*?} else {*//* ResourceLocation *//*?}*/ texture);
17+
public void setLastTexture(/*? >= 1.21.11 {*/ Identifier /*?} else {*/ /*ResourceLocation *//*?}*/ texture);
1818

19-
public /*? >= 1.21.11 {*/ Identifier /*?} else {*//* ResourceLocation *//*?}*/ getLastTexture();
19+
public /*? >= 1.21.11 {*/ Identifier /*?} else {*/ /*ResourceLocation *//*?}*/ getLastTexture();
2020

2121
@Override
2222
default Mesh getMesh() {

src/main/java/dev/tr7zw/skinlayers/mixin/CustomHeadLayerMixin.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ private void resolveSkullRenderType(
5454
net.minecraft.client.renderer.entity.state.LivingEntityRenderState livingEntityRenderState,
5555
net.minecraft.world.level.block.SkullBlock.Type type, CallbackInfoReturnable<RenderType> ci) {
5656
if (Minecraft.getInstance().player != null && Minecraft.getInstance().gameRenderer.getMainCamera()
57-
/*? >= 1.21.11 {*/ .position() /*?} else {*//* .getPosition() *//*?}*/
57+
/*? >= 1.21.11 {*/ .position() /*?} else {*/ /*.getPosition() *//*?}*/
5858
.distanceToSqr(livingEntityRenderState.x, livingEntityRenderState.y,
5959
livingEntityRenderState.z) > SkinLayersModBase.config.renderDistanceLOD
6060
* SkinLayersModBase.config.renderDistanceLOD) {

src/main/java/dev/tr7zw/skinlayers/mixin/EMFModelPartMixin.java

Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11

22
package dev.tr7zw.skinlayers.mixin;
33

4+
import net.minecraft.client.model.geom.*;
45
import org.spongepowered.asm.mixin.Mixin;
56
import org.spongepowered.asm.mixin.Pseudo;
67
import org.spongepowered.asm.mixin.injection.At;
@@ -18,36 +19,36 @@
1819
@Mixin(EMFModelPart.class)
1920
public abstract class EMFModelPartMixin implements ModelPartInjector {
2021

21-
// //? if >= 1.21.0 {
22-
23-
// // @Inject(method = "render(Lcom/mojang/blaze3d/vertex/PoseStack;Lcom/mojang/blaze3d/vertex/VertexConsumer;III)V", at = @At(value = "HEAD"), cancellable = true)
24-
// // public void render(PoseStack poseStack, VertexConsumer vertexConsumer, int light, int overlay, int color,
25-
// // CallbackInfo ci) {
26-
// // if (isVisible() && getInjectedMesh() != null) {
27-
// // poseStack.pushPose();
28-
// // prepareTranslateAndRotate(poseStack);
29-
// // getOffsetProvider().applyOffset(poseStack, getInjectedMesh());
30-
// // getInjectedMesh().render(null, poseStack, vertexConsumer, light, overlay, color);
31-
// // poseStack.popPose();
32-
// // ci.cancel();
33-
// // }
34-
// // }
35-
// //? } else {
36-
37-
// // @Inject(method = "render(Lcom/mojang/blaze3d/vertex/PoseStack;Lcom/mojang/blaze3d/vertex/VertexConsumer;IIFFFF)V", at = @At(value = "HEAD"), cancellable = true)
38-
// // public void render(PoseStack poseStack, VertexConsumer vertexConsumer, int light, int overlay, float red, float green, float blue, float alpha,
39-
// // CallbackInfo ci) {
40-
// // if (isVisible() && getInjectedMesh() != null) {
41-
// // poseStack.pushPose();
42-
// // prepareTranslateAndRotate(poseStack);
43-
// // getOffsetProvider().applyOffset(poseStack, getInjectedMesh());
44-
// // getInjectedMesh().render(null, poseStack, vertexConsumer, light, overlay, red, green, blue, alpha);
45-
// // poseStack.popPose();
46-
// // ci.cancel();
47-
// // }
48-
// // }
49-
// //
50-
// //? }
22+
//? if >= 1.21.0 {
23+
24+
@Inject(method = "render(Lcom/mojang/blaze3d/vertex/PoseStack;Lcom/mojang/blaze3d/vertex/VertexConsumer;III)V", at = @At(value = "HEAD"), cancellable = true)
25+
public void render(PoseStack poseStack, VertexConsumer vertexConsumer, int light, int overlay, int color,
26+
CallbackInfo ci) {
27+
if (isVisible() && getInjectedMesh() != null) {
28+
poseStack.pushPose();
29+
prepareTranslateAndRotate(poseStack);
30+
getOffsetProvider().applyOffset(poseStack, getInjectedMesh());
31+
getInjectedMesh().render((ModelPart) (Object) this, poseStack, vertexConsumer, light, overlay, color);
32+
poseStack.popPose();
33+
ci.cancel();
34+
}
35+
}
36+
//? } else {
37+
38+
// @Inject(method = "render(Lcom/mojang/blaze3d/vertex/PoseStack;Lcom/mojang/blaze3d/vertex/VertexConsumer;IIFFFF)V", at = @At(value = "HEAD"), cancellable = true)
39+
// public void render(PoseStack poseStack, VertexConsumer vertexConsumer, int light, int overlay, float red, float green, float blue, float alpha,
40+
// CallbackInfo ci) {
41+
// if (isVisible() && getInjectedMesh() != null) {
42+
// poseStack.pushPose();
43+
// prepareTranslateAndRotate(poseStack);
44+
// getOffsetProvider().applyOffset(poseStack, getInjectedMesh());
45+
// getInjectedMesh().render((ModelPart)(Object)this, poseStack, vertexConsumer, light, overlay, red, green, blue, alpha);
46+
// poseStack.popPose();
47+
// ci.cancel();
48+
// }
49+
// }
50+
//
51+
//? }
5152

5253
}
5354
//? } else {

src/main/java/dev/tr7zw/skinlayers/mixin/PlayerMixin.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ protected PlayerMixin(EntityType<? extends LivingEntity> entityType, Level world
3737
private Mesh rightArmMesh;
3838
private Mesh leftLegMesh;
3939
private Mesh rightLegMesh;
40-
private /*? >= 1.21.11 {*/ Identifier /*?} else {*//* ResourceLocation *//*?}*/ currentSkin = null;
40+
private /*? >= 1.21.11 {*/ Identifier /*?} else {*/ /*ResourceLocation *//*?}*/ currentSkin = null;
4141
private boolean thinarms = false;
4242

4343
@Override
@@ -101,12 +101,12 @@ public void setRightLegMesh(Mesh rightLegMesh) {
101101
}
102102

103103
@Override
104-
public /*? >= 1.21.11 {*/ Identifier /*?} else {*//* ResourceLocation *//*?}*/ getCurrentSkin() {
104+
public /*? >= 1.21.11 {*/ Identifier /*?} else {*/ /*ResourceLocation *//*?}*/ getCurrentSkin() {
105105
return currentSkin;
106106
}
107107

108108
@Override
109-
public void setCurrentSkin(/*? >= 1.21.11 {*/ Identifier /*?} else {*//* ResourceLocation *//*?}*/ skin) {
109+
public void setCurrentSkin(/*? >= 1.21.11 {*/ Identifier /*?} else {*/ /*ResourceLocation *//*?}*/ skin) {
110110
this.currentSkin = skin;
111111
}
112112

src/main/java/dev/tr7zw/skinlayers/mixin/PlayerModelMixin.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public void setupAnim(
101101
((ModelPartInjector) (Object) rightPants).setInjectedMesh(null, null);
102102
if (Minecraft.getInstance().player == null || abstractClientPlayer.distanceToSqr(Minecraft
103103
.getInstance().gameRenderer.getMainCamera()
104-
/*? >= 1.21.11 {*/ .position() /*?} else {*//* .getPosition() *//*?}*/) > SkinLayersModBase.config.renderDistanceLOD
104+
/*? >= 1.21.11 {*/ .position() /*?} else {*/ /*.getPosition() *//*?}*/) > SkinLayersModBase.config.renderDistanceLOD
105105
* SkinLayersModBase.config.renderDistanceLOD) {
106106
return;
107107
}

src/main/java/dev/tr7zw/skinlayers/mixin/PlayerRendererMixin.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ private void renderHandStart(PoseStack poseStack,
185185
/*
186186
MultiBufferSource multiBufferSource,
187187
*///? }
188-
int i, /*? >= 1.21.11 {*/ Identifier /*?} else {*//* ResourceLocation *//*?}*/ resourceLocation,
188+
int i, /*? >= 1.21.11 {*/ Identifier /*?} else {*/ /*ResourceLocation *//*?}*/ resourceLocation,
189189
ModelPart arm, boolean bl, CallbackInfo info) {
190190
// TODO
191191
AbstractClientPlayer abstractClientPlayer = Minecraft.getInstance().player;// hacky, but 1.21.2 happened
@@ -223,7 +223,7 @@ private void renderHandStart(PoseStack poseStack, MultiBufferSource multiBufferS
223223

224224
//? if >= 1.21.9 {
225225

226-
@WrapOperation(method = "method_72996", at = @At(value = "NEW", target = /*? >= 1.21.11 {*/ "(Lnet/minecraft/client/model/geom/ModelPart;Z)Lnet/minecraft/client/model/player/PlayerModel;" /*?} else {*//* "(Lnet/minecraft/client/model/geom/ModelPart;Z)Lnet/minecraft/client/model/PlayerModel;" *//*?}*/))
226+
@WrapOperation(method = "method_72996", at = @At(value = "NEW", target = /*? >= 1.21.11 {*/ "(Lnet/minecraft/client/model/geom/ModelPart;Z)Lnet/minecraft/client/model/player/PlayerModel;" /*?} else {*/ /*"(Lnet/minecraft/client/model/geom/ModelPart;Z)Lnet/minecraft/client/model/PlayerModel;" *//*?}*/))
227227
private static PlayerModel markArmorModelAsIgnored(ModelPart modelPart, boolean slim,
228228
Operation<PlayerModel> original) {
229229
PlayerModel call = original.call(modelPart, slim);

src/main/java/dev/tr7zw/skinlayers/mixin/SkullBlockEntityMixin.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public class SkullBlockEntityMixin implements SkullSettings {
1212

1313
private Mesh hatModel = null;
1414
private boolean initialized = false;
15-
private /*? >= 1.21.11 {*/ Identifier /*?} else {*//* ResourceLocation *//*?}*/ lastTexture = null;
15+
private /*? >= 1.21.11 {*/ Identifier /*?} else {*/ /*ResourceLocation *//*?}*/ lastTexture = null;
1616

1717
@Override
1818
public Mesh getHeadLayers() {
@@ -35,12 +35,12 @@ public void setInitialized(boolean initialized) {
3535
}
3636

3737
@Override
38-
public void setLastTexture(/*? >= 1.21.11 {*/ Identifier /*?} else {*//* ResourceLocation *//*?}*/ texture) {
38+
public void setLastTexture(/*? >= 1.21.11 {*/ Identifier /*?} else {*/ /*ResourceLocation *//*?}*/ texture) {
3939
this.lastTexture = texture;
4040
}
4141

4242
@Override
43-
public /*? >= 1.21.11 {*/ Identifier /*?} else {*//* ResourceLocation *//*?}*/ getLastTexture() {
43+
public /*? >= 1.21.11 {*/ Identifier /*?} else {*/ /*ResourceLocation *//*?}*/ getLastTexture() {
4444
return lastTexture;
4545
}
4646

0 commit comments

Comments
 (0)