use of com.tom.cpm.client.ModelTexture in project CustomPlayerModels by tom5454.
the class CapeFeatureRendererMixin method onRender.
@Inject(at = @At("HEAD"), method = "render" + "(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I" + "Lnet/minecraft/client/network/AbstractClientPlayerEntity;FFFFFF)V", cancellable = true)
public void onRender(MatrixStack matrixStackIn, VertexConsumerProvider bufferIn, int packedLightIn, AbstractClientPlayerEntity entitylivingbaseIn, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, CallbackInfo cbi) {
Player<?> pl = CustomPlayerModelsClient.INSTANCE.manager.getBoundPlayer();
if (pl != null) {
ModelDefinition def = pl.getModelDefinition();
if (def != null && def.hasRoot(RootModelType.CAPE)) {
ItemStack chestplate = entitylivingbaseIn.getEquippedStack(EquipmentSlot.CHEST);
if (!entitylivingbaseIn.isInvisible() && entitylivingbaseIn.isPartVisible(PlayerModelPart.CAPE) && chestplate.getItem() != Items.ELYTRA) {
Identifier defLoc = entitylivingbaseIn.getCapeTexture();
if (defLoc == null)
defLoc = CustomPlayerModelsClient.DEFAULT_CAPE;
ModelTexture mt = new ModelTexture(defLoc);
CustomPlayerModelsClient.mc.getPlayerRenderManager().rebindModel(getContextModel());
CustomPlayerModelsClient.mc.getPlayerRenderManager().bindSkin(getContextModel(), mt, TextureSheetType.CAPE);
if (mt.getTexture() != null) {
VertexConsumer buffer = bufferIn.getBuffer(mt.getRenderType());
CustomPlayerModelsClient.renderCape(matrixStackIn, buffer, packedLightIn, entitylivingbaseIn, partialTicks, getContextModel(), def);
}
}
cbi.cancel();
}
}
}
use of com.tom.cpm.client.ModelTexture in project CustomPlayerModels by tom5454.
the class SkullBlockEntityRendererMixin method onGetRenderTypeNoSkin.
@Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/RenderLayer;getEntityCutoutNoCull(" + "Lnet/minecraft/util/Identifier;)Lnet/minecraft/client/render/RenderLayer;"), method = "getRenderLayer(Lnet/minecraft/block/SkullBlock$SkullType;Lcom/mojang/authlib/GameProfile;)" + "Lnet/minecraft/client/render/RenderLayer;")
private static RenderLayer onGetRenderTypeNoSkin(Identifier resLoc, SkullBlock.SkullType skullType, GameProfile gameProfileIn) {
if (RefHolder.CPM_MODELS == null)
return RenderLayer.getEntityCutoutNoCull(resLoc);
SkullBlockEntityModel model = RefHolder.CPM_MODELS.get(skullType);
RefHolder.CPM_MODELS = null;
ModelTexture mt = new ModelTexture(resLoc);
CustomPlayerModelsClient.mc.getPlayerRenderManager().bindSkin(model, mt, TextureSheetType.SKIN);
return mt.getRenderType();
}
use of com.tom.cpm.client.ModelTexture in project CustomPlayerModels by tom5454.
the class CPMASMClientHooks method onGetEntityTexture.
public static ResourceLocation onGetEntityTexture(ResourceLocation rl, PlayerRenderer model) {
ModelTexture tex = new ModelTexture(rl);
ClientProxy.mc.getPlayerRenderManager().bindSkin(model.getModel(), tex, TextureSheetType.SKIN);
return tex.getTexture();
}
use of com.tom.cpm.client.ModelTexture in project CustomPlayerModels by tom5454.
the class CapeLayerMixin method onRender.
@Inject(at = @At("HEAD"), method = "render" + "(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;I" + "Lnet/minecraft/client/player/AbstractClientPlayer;FFFFFF)V", cancellable = true)
public void onRender(PoseStack matrixStackIn, MultiBufferSource bufferIn, int packedLightIn, AbstractClientPlayer entitylivingbaseIn, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, CallbackInfo cbi) {
Player<?> pl = ClientProxy.INSTANCE.manager.getBoundPlayer();
if (pl != null) {
ModelDefinition def = pl.getModelDefinition();
if (def != null && def.hasRoot(RootModelType.CAPE)) {
ItemStack chestplate = entitylivingbaseIn.getItemBySlot(EquipmentSlot.CHEST);
if (!entitylivingbaseIn.isInvisible() && entitylivingbaseIn.isModelPartShown(PlayerModelPart.CAPE) && chestplate.getItem() != Items.ELYTRA) {
ResourceLocation defLoc = entitylivingbaseIn.getCloakTextureLocation();
if (defLoc == null)
defLoc = ClientProxy.DEFAULT_CAPE;
ModelTexture mt = new ModelTexture(defLoc);
ClientProxy.mc.getPlayerRenderManager().rebindModel(getParentModel());
ClientProxy.mc.getPlayerRenderManager().bindSkin(getParentModel(), mt, TextureSheetType.CAPE);
if (mt.getTexture() != null) {
VertexConsumer buffer = bufferIn.getBuffer(mt.getRenderType());
ClientProxy.renderCape(matrixStackIn, buffer, packedLightIn, entitylivingbaseIn, partialTicks, getParentModel(), def);
}
}
cbi.cancel();
}
}
}
use of com.tom.cpm.client.ModelTexture in project CustomPlayerModels by tom5454.
the class ElytraLayerMixin method onGetRenderTypeNoSkin.
@Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/RenderType;armorCutoutNoCull(" + "Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/RenderType;", ordinal = 0), method = "render(Lcom/mojang/blaze3d/matrix/MatrixStack;Lnet/minecraft/client/renderer/IRenderTypeBuffer;I" + "Lnet/minecraft/entity/LivingEntity;FFFFFF)V")
private RenderType onGetRenderTypeNoSkin(ResourceLocation resLoc, MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int packedLightIn, LivingEntity entitylivingbaseIn, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch) {
if (getParentModel() instanceof BipedModel) {
ModelTexture mt = new ModelTexture(resLoc, PlayerRenderManager.armor);
ClientProxy.mc.getPlayerRenderManager().bindSkin(elytraModel, mt, TextureSheetType.ELYTRA);
return mt.getRenderType();
}
return RenderType.armorCutoutNoCull(resLoc);
}
Aggregations