| 1 | package net.minecraft.client.renderer.entity.layers;
|
| 2 |
|
| 3 | import com.mojang.blaze3d.vertex.PoseStack;
|
| 4 | import net.fabricmc.api.EnvType;
|
| 5 | import net.fabricmc.api.Environment;
|
| 6 | import net.minecraft.client.model.EntityModel;
|
| 7 | import net.minecraft.client.model.animal.fish.TropicalFishLargeModel;
|
| 8 | import net.minecraft.client.model.animal.fish.TropicalFishSmallModel;
|
| 9 | import net.minecraft.client.model.geom.EntityModelSet;
|
| 10 | import net.minecraft.client.model.geom.ModelLayers;
|
| 11 | import net.minecraft.client.renderer.SubmitNodeCollector;
|
| 12 | import net.minecraft.client.renderer.entity.RenderLayerParent;
|
| 13 | import net.minecraft.client.renderer.entity.state.TropicalFishRenderState;
|
| 14 | import net.minecraft.resources.Identifier;
|
| 15 | import net.minecraft.world.entity.animal.fish.TropicalFish.Pattern;
|
| 16 |
|
| 17 | @Environment(EnvType.CLIENT)
|
| 18 | public class TropicalFishPatternLayer extends RenderLayer<TropicalFishRenderState, EntityModel<TropicalFishRenderState>> {
|
| 19 | private static final Identifier KOB_TEXTURE = Identifier.withDefaultNamespace("textures/entity/fish/tropical_a_pattern_1.png");
|
| 20 | private static final Identifier SUNSTREAK_TEXTURE = Identifier.withDefaultNamespace("textures/entity/fish/tropical_a_pattern_2.png");
|
| 21 | private static final Identifier SNOOPER_TEXTURE = Identifier.withDefaultNamespace("textures/entity/fish/tropical_a_pattern_3.png");
|
| 22 | private static final Identifier DASHER_TEXTURE = Identifier.withDefaultNamespace("textures/entity/fish/tropical_a_pattern_4.png");
|
| 23 | private static final Identifier BRINELY_TEXTURE = Identifier.withDefaultNamespace("textures/entity/fish/tropical_a_pattern_5.png");
|
| 24 | private static final Identifier SPOTTY_TEXTURE = Identifier.withDefaultNamespace("textures/entity/fish/tropical_a_pattern_6.png");
|
| 25 | private static final Identifier FLOPPER_TEXTURE = Identifier.withDefaultNamespace("textures/entity/fish/tropical_b_pattern_1.png");
|
| 26 | private static final Identifier STRIPEY_TEXTURE = Identifier.withDefaultNamespace("textures/entity/fish/tropical_b_pattern_2.png");
|
| 27 | private static final Identifier GLITTER_TEXTURE = Identifier.withDefaultNamespace("textures/entity/fish/tropical_b_pattern_3.png");
|
| 28 | private static final Identifier BLOCKFISH_TEXTURE = Identifier.withDefaultNamespace("textures/entity/fish/tropical_b_pattern_4.png");
|
| 29 | private static final Identifier BETTY_TEXTURE = Identifier.withDefaultNamespace("textures/entity/fish/tropical_b_pattern_5.png");
|
| 30 | private static final Identifier CLAYFISH_TEXTURE = Identifier.withDefaultNamespace("textures/entity/fish/tropical_b_pattern_6.png");
|
| 31 | private final TropicalFishSmallModel modelSmall;
|
| 32 | private final TropicalFishLargeModel modelLarge;
|
| 33 |
|
| 34 | public TropicalFishPatternLayer(final RenderLayerParent<TropicalFishRenderState, EntityModel<TropicalFishRenderState>> renderer, final EntityModelSet modelSet) {
|
| 35 | super(renderer);
|
| 36 | this.modelSmall = new TropicalFishSmallModel(modelSet.bakeLayer(ModelLayers.TROPICAL_FISH_SMALL_PATTERN));
|
| 37 | this.modelLarge = new TropicalFishLargeModel(modelSet.bakeLayer(ModelLayers.TROPICAL_FISH_LARGE_PATTERN));
|
| 38 | }
|
| 39 |
|
| 40 | public void submit(
|
| 41 | final PoseStack poseStack,
|
| 42 | final SubmitNodeCollector submitNodeCollector,
|
| 43 | final int lightCoords,
|
| 44 | final TropicalFishRenderState state,
|
| 45 | final float yRot,
|
| 46 | final float xRot
|
| 47 | ) {
|
| 48 | Pattern variant = state.pattern;
|
| 49 |
|
| 50 | EntityModel<TropicalFishRenderState> model = switch (variant.base()) {
|
| 51 | case SMALL -> this.modelSmall;
|
| 52 | case LARGE -> this.modelLarge;
|
| 53 | };
|
| 54 |
|
| 55 | Identifier patternTexture = switch (variant) {
|
| 56 | case KOB -> KOB_TEXTURE;
|
| 57 | case SUNSTREAK -> SUNSTREAK_TEXTURE;
|
| 58 | case SNOOPER -> SNOOPER_TEXTURE;
|
| 59 | case DASHER -> DASHER_TEXTURE;
|
| 60 | case BRINELY -> BRINELY_TEXTURE;
|
| 61 | case SPOTTY -> SPOTTY_TEXTURE;
|
| 62 | case FLOPPER -> FLOPPER_TEXTURE;
|
| 63 | case STRIPEY -> STRIPEY_TEXTURE;
|
| 64 | case GLITTER -> GLITTER_TEXTURE;
|
| 65 | case BLOCKFISH -> BLOCKFISH_TEXTURE;
|
| 66 | case BETTY -> BETTY_TEXTURE;
|
| 67 | case CLAYFISH -> CLAYFISH_TEXTURE;
|
| 68 | };
|
| 69 | coloredCutoutModelCopyLayerRender(model, patternTexture, poseStack, submitNodeCollector, lightCoords, state, state.patternColor, 1);
|
| 70 | }
|
| 71 | }
|
| 72 |
|