- Reordered and grouped import statements in various files for better readability. - Removed unnecessary imports and cleaned up unused code. - Simplified constructors and methods in several classes to enhance clarity. - Standardized formatting and spacing for consistency throughout the codebase. - Ensured that all necessary imports are included where required, particularly in structure-related classes.
55 lines
1.8 KiB
Java
55 lines
1.8 KiB
Java
package net.Chipperfluff.chipi.client.entity;
|
|
|
|
import net.minecraft.client.network.AbstractClientPlayerEntity;
|
|
import net.minecraft.client.render.VertexConsumerProvider;
|
|
import net.minecraft.client.render.entity.BipedEntityRenderer;
|
|
import net.minecraft.client.render.entity.EntityRendererFactory;
|
|
import net.minecraft.client.render.entity.model.BipedEntityModel;
|
|
import net.minecraft.client.render.entity.model.EntityModelLayers;
|
|
import net.minecraft.client.util.DefaultSkinHelper;
|
|
import net.minecraft.client.util.math.MatrixStack;
|
|
import net.minecraft.util.Identifier;
|
|
|
|
import net.Chipperfluff.chipi.entity.PlayerJrEntity;
|
|
|
|
public class PlayerJrRenderer
|
|
extends BipedEntityRenderer<PlayerJrEntity, BipedEntityModel<PlayerJrEntity>> {
|
|
|
|
public PlayerJrRenderer(EntityRendererFactory.Context ctx) {
|
|
super(ctx, new BipedEntityModel<>(ctx.getPart(EntityModelLayers.PLAYER)), 0.3f);
|
|
}
|
|
|
|
@Override
|
|
public void render(
|
|
PlayerJrEntity entity,
|
|
float yaw,
|
|
float tickDelta,
|
|
MatrixStack matrices,
|
|
VertexConsumerProvider vertices,
|
|
int light
|
|
) {
|
|
matrices.scale(0.5f, 0.5f, 0.5f);
|
|
super.render(entity, yaw, tickDelta, matrices, vertices, light);
|
|
}
|
|
|
|
@Override
|
|
public Identifier getTexture(PlayerJrEntity entity) {
|
|
String dadName = entity.getDadName();
|
|
|
|
if (dadName == null || dadName.isBlank()) {
|
|
return DefaultSkinHelper.getTexture();
|
|
}
|
|
|
|
/*
|
|
* THIS is how vanilla + mods do it:
|
|
* - stable Identifier
|
|
* - async skin download
|
|
* - cached by SkinProvider
|
|
*/
|
|
Identifier skin = AbstractClientPlayerEntity.getSkinId(dadName);
|
|
AbstractClientPlayerEntity.loadSkin(skin, dadName);
|
|
|
|
return skin;
|
|
}
|
|
}
|