55 lines
2.2 KiB
Java
55 lines
2.2 KiB
Java
/*
|
|
* Decompiled with CFR 0.152.
|
|
*/
|
|
package net.minecraft.client.renderer.entity;
|
|
|
|
import net.minecraft.client.model.BeeModel;
|
|
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.BeeRenderState;
|
|
import net.minecraft.resources.Identifier;
|
|
import net.minecraft.world.entity.animal.Bee;
|
|
|
|
public class BeeRenderer
|
|
extends AgeableMobRenderer<Bee, BeeRenderState, BeeModel> {
|
|
private static final Identifier ANGRY_BEE_TEXTURE = Identifier.withDefaultNamespace("textures/entity/bee/bee_angry.png");
|
|
private static final Identifier ANGRY_NECTAR_BEE_TEXTURE = Identifier.withDefaultNamespace("textures/entity/bee/bee_angry_nectar.png");
|
|
private static final Identifier BEE_TEXTURE = Identifier.withDefaultNamespace("textures/entity/bee/bee.png");
|
|
private static final Identifier NECTAR_BEE_TEXTURE = Identifier.withDefaultNamespace("textures/entity/bee/bee_nectar.png");
|
|
|
|
public BeeRenderer(EntityRendererProvider.Context context) {
|
|
super(context, new BeeModel(context.bakeLayer(ModelLayers.BEE)), new BeeModel(context.bakeLayer(ModelLayers.BEE_BABY)), 0.4f);
|
|
}
|
|
|
|
@Override
|
|
public Identifier getTextureLocation(BeeRenderState state) {
|
|
if (state.isAngry) {
|
|
if (state.hasNectar) {
|
|
return ANGRY_NECTAR_BEE_TEXTURE;
|
|
}
|
|
return ANGRY_BEE_TEXTURE;
|
|
}
|
|
if (state.hasNectar) {
|
|
return NECTAR_BEE_TEXTURE;
|
|
}
|
|
return BEE_TEXTURE;
|
|
}
|
|
|
|
@Override
|
|
public BeeRenderState createRenderState() {
|
|
return new BeeRenderState();
|
|
}
|
|
|
|
@Override
|
|
public void extractRenderState(Bee entity, BeeRenderState state, float partialTicks) {
|
|
super.extractRenderState(entity, state, partialTicks);
|
|
state.rollAmount = entity.getRollAmount(partialTicks);
|
|
state.hasStinger = !entity.hasStung();
|
|
state.isOnGround = entity.onGround() && entity.getDeltaMovement().lengthSqr() < 1.0E-7;
|
|
state.isAngry = entity.isAngry();
|
|
state.hasNectar = entity.hasNectar();
|
|
}
|
|
}
|
|
|