Skip to content

Commit 54cab10

Browse files
committed
Update to 1.21.11-pre1
1 parent 8e136c1 commit 54cab10

16 files changed

+93
-46
lines changed

settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
"1.21.8-fabric",
3636
"1.21.10-forge",
3737
"1.21.10-neoforge",
38-
"1.21.10-fabric"
38+
"1.21.10-fabric",
39+
"1.21.11-fabric"
3940
]
4041
}

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

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import net.minecraft.client.Minecraft;
2020
import net.minecraft.client.renderer.texture.AbstractTexture;
2121
import net.minecraft.client.renderer.texture.DynamicTexture;
22-
import net.minecraft.resources.ResourceLocation;
22+
import net.minecraft.resources.*;
2323
import net.minecraft.server.packs.resources.Resource;
2424

2525
public class SkinUtil {
@@ -38,7 +38,9 @@ public void onRemoval(RemovalNotification<AbstractTexture, NativeImage> notifica
3838
}
3939
}).build();
4040

41-
public static NativeImage getTexture(ResourceLocation resourceLocation, SkullSettings settings) {
41+
public static NativeImage getTexture(
42+
/*? >= 1.21.11 {*/ Identifier /*?} else {*//* ResourceLocation *//*?}*/ resourceLocation,
43+
SkullSettings settings) {
4244
if (resourceLocation == null) {
4345
return null;
4446
}
@@ -122,7 +124,7 @@ public static boolean setup3dLayers(
122124
net.minecraft.client.player.AbstractClientPlayer abstractClientPlayerEntity,
123125
*///? }
124126
PlayerSettings settings, boolean thinArms) {
125-
ResourceLocation skinLocation = PlayerUtil.getPlayerSkin(abstractClientPlayerEntity);
127+
var skinLocation = PlayerUtil.getPlayerSkin(abstractClientPlayerEntity);
126128
if (skinLocation == null) {
127129
return false;// this *should* never happen, but just to be sure
128130
}
@@ -163,7 +165,7 @@ public static boolean setup3dLayers(GameProfile gameprofile, SkullSettings setti
163165
if (gameprofile == null) {
164166
return false; // no gameprofile
165167
}
166-
ResourceLocation playerSkin = PlayerUtil.getPlayerSkin(gameprofile);
168+
var playerSkin = PlayerUtil.getPlayerSkin(gameprofile);
167169
if (playerSkin == null) {
168170
return false; // no skin
169171
}
@@ -176,7 +178,9 @@ public static boolean setup3dLayers(GameProfile gameprofile, SkullSettings setti
176178
return true;
177179
}
178180

179-
public static boolean setup3dLayers(ResourceLocation playerSkin, SkullSettings settings) {
181+
public static boolean setup3dLayers(
182+
/*? >= 1.21.11 {*/ Identifier /*?} else {*//* ResourceLocation *//*?}*/ playerSkin,
183+
SkullSettings settings) {
180184
if (playerSkin == null) {
181185
return false; // no skin
182186
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import dev.tr7zw.skinlayers.accessor.SkullSettings;
66
import dev.tr7zw.skinlayers.api.Mesh;
7-
import net.minecraft.resources.ResourceLocation;
7+
import net.minecraft.resources.*;
88
//? if >= 1.21.4 {
99

1010
import com.mojang.authlib.GameProfile;
@@ -51,13 +51,13 @@ public void setInitialized(boolean initialized) {
5151
}
5252

5353
@Override
54-
public void setLastTexture(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 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: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import dev.tr7zw.skinlayers.api.Mesh;
44
import dev.tr7zw.skinlayers.api.PlayerData;
5-
import net.minecraft.resources.ResourceLocation;
5+
import net.minecraft.resources.*;
66

77
public interface PlayerSettings extends PlayerData {
88

@@ -18,9 +18,9 @@ public interface PlayerSettings extends PlayerData {
1818

1919
public void setRightLegMesh(Mesh box);
2020

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

23-
public void setCurrentSkin(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: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import dev.tr7zw.skinlayers.api.Mesh;
44
import dev.tr7zw.skinlayers.api.SkullData;
5-
import net.minecraft.resources.ResourceLocation;
5+
import net.minecraft.resources.*;
66

77
public interface SkullSettings extends SkullData {
88

@@ -14,9 +14,9 @@ public interface SkullSettings extends SkullData {
1414

1515
public void setInitialized(boolean initialized);
1616

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

19-
public 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: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,15 @@
2222
import net.minecraft.client.model.EntityModel;
2323
import net.minecraft.client.model.HeadedModel;
2424
import net.minecraft.client.renderer.MultiBufferSource;
25-
import net.minecraft.client.renderer.RenderType;
25+
import net.minecraft.client.renderer.*;
2626
import net.minecraft.client.renderer.entity.layers.CustomHeadLayer;
2727
import net.minecraft.world.entity.LivingEntity;
2828

29+
//? if >= 1.21.11 {
30+
31+
import net.minecraft.client.renderer.rendertype.*;
32+
//? }
33+
2934
//? if < 1.21.4 {
3035
/*
3136
import com.mojang.authlib.GameProfile;
@@ -48,7 +53,8 @@ public class CustomHeadLayerMixin<T extends LivingEntity, M extends EntityModel
4853
private void resolveSkullRenderType(
4954
net.minecraft.client.renderer.entity.state.LivingEntityRenderState livingEntityRenderState,
5055
net.minecraft.world.level.block.SkullBlock.Type type, CallbackInfoReturnable<RenderType> ci) {
51-
if (Minecraft.getInstance().player != null && Minecraft.getInstance().gameRenderer.getMainCamera().getPosition()
56+
if (Minecraft.getInstance().player != null && Minecraft.getInstance().gameRenderer.getMainCamera()
57+
/*? >= 1.21.11 {*/ .position() /*?} else {*//* .getPosition() *//*?}*/
5258
.distanceToSqr(livingEntityRenderState.x, livingEntityRenderState.y,
5359
livingEntityRenderState.z) > SkinLayersModBase.config.renderDistanceLOD
5460
* SkinLayersModBase.config.renderDistanceLOD) {

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,16 @@
99

1010
import dev.tr7zw.skinlayers.accessor.PlayerEntityModelAccessor;
1111
import net.minecraft.client.model.HumanoidModel;
12-
import net.minecraft.client.model.PlayerModel;
12+
import net.minecraft.client.model.*;
1313
import net.minecraft.client.model.geom.*;
1414
import net.minecraft.client.renderer.entity.RenderLayerParent;
1515
import net.minecraft.client.renderer.entity.layers.*;
1616

17+
//? if >= 1.21.11 {
18+
19+
import net.minecraft.client.model.player.*;
20+
//? }
21+
1722
@Mixin(Deadmau5EarsLayer.class)
1823
public class Deadmau5EarsLayerMixin {
1924

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
import dev.tr7zw.skinlayers.accessor.PlayerSettings;
88
import dev.tr7zw.skinlayers.api.Mesh;
9-
import net.minecraft.resources.ResourceLocation;
9+
import net.minecraft.resources.*;
1010
import net.minecraft.world.entity.EntityType;
1111
import net.minecraft.world.entity.LivingEntity;
1212
import net.minecraft.world.level.Level;
@@ -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 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 ResourceLocation getCurrentSkin() {
104+
public /*? >= 1.21.11 {*/ Identifier /*?} else {*//* ResourceLocation *//*?}*/ getCurrentSkin() {
105105
return currentSkin;
106106
}
107107

108108
@Override
109-
public void setCurrentSkin(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: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,11 @@
1515
import dev.tr7zw.skinlayers.api.OffsetProvider;
1616
import dev.tr7zw.transition.mc.entitywrapper.EntityRenderStateExtender;
1717
import net.minecraft.client.Minecraft;
18-
import net.minecraft.client.model.HumanoidModel;
19-
import net.minecraft.client.model.PlayerModel;
18+
//? if >= 1.21.11 {
19+
20+
import net.minecraft.client.model.player.*;
21+
//? }
22+
import net.minecraft.client.model.*;
2023
import net.minecraft.client.model.geom.ModelPart;
2124
import net.minecraft.world.entity.EquipmentSlot;
2225
import net.minecraft.world.entity.LivingEntity;
@@ -68,7 +71,7 @@ public void setupAnim(net.minecraft.client.renderer.entity.state.AvatarRenderSta
6871
net.minecraft.world.entity.Avatar abstractClientPlayer = null;
6972
if (ignored)
7073
return;
71-
if (!((Object) this instanceof net.minecraft.client.model.PlayerCapeModel)
74+
if (!((Object) this instanceof PlayerCapeModel)
7275
&& playerRenderState instanceof EntityRenderStateExtender extender
7376
&& extender.getTransitionEntity() instanceof net.minecraft.world.entity.Avatar entity) {
7477
abstractClientPlayer = entity;
@@ -96,10 +99,10 @@ public void setupAnim(
9699
((ModelPartInjector) (Object) rightSleeve).setInjectedMesh(null, null);
97100
((ModelPartInjector) (Object) leftPants).setInjectedMesh(null, null);
98101
((ModelPartInjector) (Object) rightPants).setInjectedMesh(null, null);
99-
if (Minecraft.getInstance().player == null
100-
|| abstractClientPlayer.distanceToSqr(Minecraft.getInstance().gameRenderer.getMainCamera()
101-
.getPosition()) > SkinLayersModBase.config.renderDistanceLOD
102-
* SkinLayersModBase.config.renderDistanceLOD) {
102+
if (Minecraft.getInstance().player == null || abstractClientPlayer.distanceToSqr(Minecraft
103+
.getInstance().gameRenderer.getMainCamera()
104+
/*? >= 1.21.11 {*/ .position() /*?} else {*//* .getPosition() *//*?}*/) > SkinLayersModBase.config.renderDistanceLOD
105+
* SkinLayersModBase.config.renderDistanceLOD) {
103106
return;
104107
}
105108
if (!SkinUtil.setup3dLayers(abstractClientPlayer, settings, slim)) {

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

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,13 @@
1515
import dev.tr7zw.skinlayers.accessor.PlayerSettings;
1616
import dev.tr7zw.skinlayers.api.OffsetProvider;
1717
import net.minecraft.client.Minecraft;
18-
import net.minecraft.client.model.PlayerModel;
18+
//? if >= 1.21.11 {
19+
20+
import net.minecraft.client.model.player.*;
21+
//? } else {
22+
/*
23+
import net.minecraft.client.model.*;
24+
*///? }
1925
import net.minecraft.client.model.geom.ModelPart;
2026
import net.minecraft.client.player.AbstractClientPlayer;
2127
//? if < 1.21.9 {
@@ -53,7 +59,7 @@
5359
/*
5460
import net.minecraft.client.renderer.entity.player.PlayerRenderer;
5561
*///? }
56-
import net.minecraft.resources.ResourceLocation;
62+
import net.minecraft.resources.*;
5763

5864
//? if >= 1.21.9 {
5965

@@ -179,7 +185,8 @@ private void renderHandStart(PoseStack poseStack,
179185
/*
180186
MultiBufferSource multiBufferSource,
181187
*///? }
182-
int i, ResourceLocation resourceLocation, ModelPart arm, boolean bl, CallbackInfo info) {
188+
int i, /*? >= 1.21.11 {*/ Identifier /*?} else {*//* ResourceLocation *//*?}*/ resourceLocation,
189+
ModelPart arm, boolean bl, CallbackInfo info) {
183190
// TODO
184191
AbstractClientPlayer abstractClientPlayer = Minecraft.getInstance().player;// hacky, but 1.21.2 happened
185192
ModelPart sleeve;
@@ -216,7 +223,7 @@ private void renderHandStart(PoseStack poseStack, MultiBufferSource multiBufferS
216223

217224
//? if >= 1.21.9 {
218225

219-
@WrapOperation(method = "method_72996", at = @At(value = "NEW", target = "(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;" *//*?}*/))
220227
private static PlayerModel markArmorModelAsIgnored(ModelPart modelPart, boolean slim,
221228
Operation<PlayerModel> original) {
222229
PlayerModel call = original.call(modelPart, slim);

0 commit comments

Comments
 (0)