54 lines
2.1 KiB
Java
54 lines
2.1 KiB
Java
/*
|
|
* Decompiled with CFR 0.152.
|
|
*
|
|
* Could not load the following classes:
|
|
* com.google.common.collect.Maps
|
|
*/
|
|
package net.minecraft.client.renderer.entity;
|
|
|
|
import com.google.common.collect.Maps;
|
|
import java.util.Locale;
|
|
import java.util.Map;
|
|
import net.minecraft.client.model.AxolotlModel;
|
|
import net.minecraft.client.model.geom.ModelLayers;
|
|
import net.minecraft.client.renderer.entity.AgeableMobRenderer;
|
|
import net.minecraft.client.renderer.entity.EntityRendererProvider;
|
|
import net.minecraft.client.renderer.entity.state.AxolotlRenderState;
|
|
import net.minecraft.resources.Identifier;
|
|
import net.minecraft.util.Util;
|
|
import net.minecraft.world.entity.animal.axolotl.Axolotl;
|
|
|
|
public class AxolotlRenderer
|
|
extends AgeableMobRenderer<Axolotl, AxolotlRenderState, AxolotlModel> {
|
|
private static final Map<Axolotl.Variant, Identifier> TEXTURE_BY_TYPE = Util.make(Maps.newHashMap(), map -> {
|
|
for (Axolotl.Variant variant : Axolotl.Variant.values()) {
|
|
map.put(variant, Identifier.withDefaultNamespace(String.format(Locale.ROOT, "textures/entity/axolotl/axolotl_%s.png", variant.getName())));
|
|
}
|
|
});
|
|
|
|
public AxolotlRenderer(EntityRendererProvider.Context context) {
|
|
super(context, new AxolotlModel(context.bakeLayer(ModelLayers.AXOLOTL)), new AxolotlModel(context.bakeLayer(ModelLayers.AXOLOTL_BABY)), 0.5f);
|
|
}
|
|
|
|
@Override
|
|
public Identifier getTextureLocation(AxolotlRenderState state) {
|
|
return TEXTURE_BY_TYPE.get(state.variant);
|
|
}
|
|
|
|
@Override
|
|
public AxolotlRenderState createRenderState() {
|
|
return new AxolotlRenderState();
|
|
}
|
|
|
|
@Override
|
|
public void extractRenderState(Axolotl entity, AxolotlRenderState state, float partialTicks) {
|
|
super.extractRenderState(entity, state, partialTicks);
|
|
state.variant = entity.getVariant();
|
|
state.playingDeadFactor = entity.playingDeadAnimator.getFactor(partialTicks);
|
|
state.inWaterFactor = entity.inWaterAnimator.getFactor(partialTicks);
|
|
state.onGroundFactor = entity.onGroundAnimator.getFactor(partialTicks);
|
|
state.movingFactor = entity.movingAnimator.getFactor(partialTicks);
|
|
}
|
|
}
|
|
|