|
9 | 9 | import net.minecraft.client.model.geom.ModelLayers;
|
10 | 10 | import net.minecraft.client.renderer.entity.EntityRendererProvider;
|
11 | 11 | import net.minecraft.client.renderer.entity.MobRenderer;
|
| 12 | +import net.minecraft.client.resources.PlayerSkin; |
12 | 13 | import net.minecraft.resources.ResourceLocation;
|
13 | 14 | import org.apache.commons.lang3.tuple.Pair;
|
14 | 15 | import org.jetbrains.annotations.NotNull;
|
|
19 | 20 |
|
20 | 21 | public class HumanWerewolfRenderer extends DualBipedRenderer<HumanWerewolfEntity, PlayerModel<HumanWerewolfEntity>> {
|
21 | 22 |
|
22 |
| - private final Pair<ResourceLocation, PlayerModelType>[] textures; |
| 23 | + private final PlayerSkin[] textures; |
23 | 24 |
|
24 | 25 | public HumanWerewolfRenderer(EntityRendererProvider.Context context) {
|
25 | 26 | super(context, new PlayerModel<>(context.bakeLayer(ModelLayers.PLAYER), false), new PlayerModel<>(context.bakeLayer(ModelLayers.PLAYER_SLIM), true),0.5f);
|
26 | 27 | this.textures = gatherTextures("textures/entity/human", true);
|
27 | 28 | }
|
28 | 29 |
|
29 | 30 | @Override
|
30 |
| - protected Pair<ResourceLocation, PlayerModelType> determineTextureAndModel(HumanWerewolfEntity entity) { |
| 31 | + protected PlayerSkin determineTextureAndModel(HumanWerewolfEntity entity) { |
31 | 32 | return textures[entity.getSkinType() % textures.length];
|
32 | 33 | }
|
33 | 34 |
|
34 |
| - protected Pair<ResourceLocation, PlayerModelType> @NotNull [] gatherTextures(@NotNull String dirPath, boolean required) { |
| 35 | + protected PlayerSkin @NotNull [] gatherTextures(@NotNull String dirPath, boolean required) { |
35 | 36 | Collection<ResourceLocation> hunterTextures = new ArrayList<>(Minecraft.getInstance().getResourceManager().listResources(dirPath, s -> s.getPath().endsWith(".png")).keySet());
|
36 |
| - Pair<ResourceLocation, PlayerModelType>[] textures = separateSlimTextures(hunterTextures.stream().filter(r -> REFERENCE.MODID.equals(r.getNamespace()))); |
| 37 | + PlayerSkin[] textures = separateSlimTextures(hunterTextures.stream().filter(r -> REFERENCE.MODID.equals(r.getNamespace()))); |
37 | 38 | if (textures.length == 0 && required) {
|
38 | 39 | throw new IllegalStateException("Must have at least one hunter texture: " + REFERENCE.MODID + ":" + dirPath + "/texture.png");
|
39 | 40 | }
|
|
0 commit comments