Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

SOLVED [1.17.1] Custom player layer not rendering.


UserMC123
 Share

Recommended Posts

I've made a custom layer for the player but its not showing in game.

Here is my model class

Spoiler

    public static final ModelLayerLocation LAYER_LOCATION = new ModelLayerLocation(new ResourceLocation("test", "basic_suit"), "basic_suit");
    private final ModelPart LeftLeg;
    private final ModelPart RightLeg;
    private final ModelPart LeftArm;
    private final ModelPart RightArm;
    private final ModelPart Body;

    public BasicSuitModel(ModelPart root) {
        this.LeftLeg = root.getChild("left_leg");
        this.RightLeg = root.getChild("right_leg");
        this.LeftArm = root.getChild("left_arm");
        this.RightArm = root.getChild("right_arm");
        this.Body = root.getChild("body");
    }

    public static LayerDefinition createBodyLayer() {
        MeshDefinition meshdefinition = new MeshDefinition();
        PartDefinition partdefinition = meshdefinition.getRoot();

        PartDefinition LeftLeg = partdefinition.addOrReplaceChild("left_leg", CubeListBuilder.create().texOffs(0, 38).addBox(-3.0F, 0.0F, -3.0F, 6.0F, 12.0F, 6.0F, new CubeDeformation(0.0F)).texOffs(0, 48).addBox(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.25F)), PartPose.offset(1.9F, 12.0F, 0.0F));

        PartDefinition RightLeg = partdefinition.addOrReplaceChild("right_leg", CubeListBuilder.create().texOffs(32, 0).addBox(-3.0F, 0.0F, -3.0F, 6.0F, 12.0F, 6.0F, new CubeDeformation(0.0F)).texOffs(0, 32).addBox(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.25F)), PartPose.offset(-1.9F, 12.0F, 0.0F));

        PartDefinition LeftArm = partdefinition.addOrReplaceChild("left_arm", CubeListBuilder.create().texOffs(1, 19).addBox(-1.0F, -2.0F, -3.0F, 5.0F, 12.0F, 6.0F, new CubeDeformation(0.0F)).texOffs(48, 48).addBox(-1.0F, -2.0F, -2.0F, 3.0F, 12.0F, 4.0F, new CubeDeformation(0.25F)), PartPose.offsetAndRotation(5.0F, 2.0F, 0.0F, -0.7854F, 0.0F, 0.0F));

        PartDefinition RightArm = partdefinition.addOrReplaceChild("right_arm", CubeListBuilder.create().texOffs(24, 19).addBox(-3.0F, -2.0F, -3.0F, 5.0F, 13.0F, 6.0F, new CubeDeformation(0.0F)).texOffs(40, 32).addBox(-3.0F, -2.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.25F)), PartPose.offsetAndRotation(-5.0F, 2.0F, 0.0F, -0.7854F, 0.0F, 0.0F));

        PartDefinition Body = partdefinition.addOrReplaceChild("body", CubeListBuilder.create().texOffs(0, 0).addBox(-5.0F, 0.0F, -3.0F, 10.0F, 12.0F, 6.0F, new CubeDeformation(0.0F)).texOffs(16, 32).addBox(-4.0F, 0.0F, -2.0F, 8.0F, 12.0F, 4.0F, new CubeDeformation(0.25F)), PartPose.offset(0.0F, 0.0F, 0.0F));

        return LayerDefinition.create(meshdefinition, 64, 64);
    }

    @Override
    public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) {

    }

    @Override
    public void renderToBuffer(PoseStack poseStack, VertexConsumer buffer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha) {
        LeftLeg.render(poseStack, buffer, packedLight, packedOverlay);
        RightLeg.render(poseStack, buffer, packedLight, packedOverlay);
        LeftArm.render(poseStack, buffer, packedLight, packedOverlay);
        RightArm.render(poseStack, buffer, packedLight, packedOverlay);
        Body.render(poseStack, buffer, packedLight, packedOverlay);
    }

    @Override
    protected Iterable<ModelPart> headParts() {
        return null;
    }
    protected Iterable<ModelPart> bodyParts() {
        return ImmutableList.of(this.Body);
    }

Here is my Layer class

Spoiler

 private static final ResourceLocation SUIT_TEX = new ResourceLocation("test","textures/entity/suits/basic/suit_main.png");
    private final BasicSuitModel<T> suitModel;

    public BasicSuitModelRenderer(RenderLayerParent<T, M> parent, EntityModelSet modelSet) {
        super(parent);
        this.suitModel = new BasicSuitModel<>(modelSet.bakeLayer(BasicSuitModel.LAYER_LOCATION));
    }

    @Override
    public void render(PoseStack p_116951_, MultiBufferSource p_116952_, int p_116953_, T p_116954_, float p_116955_, float p_116956_, float p_116957_, float p_116958_, float p_116959_, float p_116960_) {
        ItemStack itemstack = p_116954_.getItemBySlot(EquipmentSlot.CHEST);
        if (true) {
            ResourceLocation resourcelocation = getTexture( p_116954_);
            p_116951_.pushPose();
            p_116951_.translate(0.0D, 0.0D, 0.125D);
            this.getParentModel().copyPropertiesTo(this.suitModel);
            this.suitModel.setupAnim(p_116954_, p_116955_, p_116956_, p_116958_, p_116959_, p_116960_);
            VertexConsumer vertexconsumer = ItemRenderer.getArmorFoilBuffer(p_116952_, RenderType.armorCutoutNoCull(resourcelocation), false, itemstack.hasFoil());
            this.suitModel.renderToBuffer(p_116951_, vertexconsumer, p_116953_, OverlayTexture.NO_OVERLAY, 1.0F, 1.0F, 1.0F, 1.0F);
            p_116951_.popPose();
        }
    }

    public ResourceLocation getTexture(T entity) {
        return SUIT_TEX;
    }

And the registry in the main class 

Spoiler

    @SubscribeEvent(priority = EventPriority.LOW)
    public void renderPlayer(final EntityRenderersEvent.AddLayers event) {
        LivingEntityRenderer<Player, PlayerModel<Player>> renderer = event.getRenderer(EntityType.PLAYER);
        BasicSuitModelRenderer<Player, PlayerModel<Player>> layer = new BasicSuitModelRenderer<>(renderer, event.getEntityModels());
        renderer.addLayer(layer);
    }
    @SubscribeEvent
    public void registerLayers(final EntityRenderersEvent.RegisterLayerDefinitions event){
        event.registerLayerDefinition(BasicSuitModel.LAYER_LOCATION, BasicSuitModel::createBodyLayer);
    }

 

What have I done wrong?

Link to comment
Share on other sites

Update: I found one issue. I was not registering to ModEventBus but now I get:

Spoiler

Caused by: java.lang.NullPointerException: Cannot invoke "net.minecraft.client.renderer.entity.LivingEntityRenderer.addLayer(net.minecraft.client.renderer.entity.layers.RenderLayer)" because "renderer" is null

What do I do about this?

Link to comment
Share on other sites

Ok so I need getParentModel().copyPropertiesTo(suitModel);

And I ran to game to see no change.

 

looking back at the armor layer code I saw the copyPropertiesTo was in HumanoidModel

So I made my model extend HumanoidModel instead of AgeableListModel and I added:

Spoiler

    @Override
    protected Iterable<ModelPart> headParts() {
        return super.headParts();
    }

    @Override
    protected Iterable<ModelPart> bodyParts() {
        return super.bodyParts();
    }

but now the game won't run and I'm getting

Description: Rendering overlay

net.minecraftforge.fml.ModLoadingException: TestMod (test) encountered an error during the done event phase
§7java.util.NoSuchElementException: Can't find part head

 

What have I done wrong?

Link to comment
Share on other sites

I assume by the stacktrace you mean this:

Spoiler

---- Minecraft Crash Report ----
// Shall we play a game?

Time: 11/29/21, 9:07 AM
Description: Rendering entity in world

java.util.NoSuchElementException: Can't find part LeftLeg
    at net.minecraft.client.model.geom.ModelPart.getChild(ModelPart.java:60) ~[forge-1.17.1-37.0.126_mapped_official_1.17.1-recomp.jar%2375!:?] {re:classloading,pl:runtimedistcleaner:A}
    at com.Twins730.SolarisSpace.client.Entity.Model.Suit.Basic.BasicSuitModel.<init>(BasicSuitModel.java:30) ~[%2379!:?] {re:classloading}
    at com.Twins730.SolarisSpace.client.Entity.Renderer.Suits.Basic.BasicSuitModelRenderer.render(BasicSuitModelRenderer.java:28) ~[%2379!:?] {re:classloading}
    at com.Twins730.SolarisSpace.client.Entity.Renderer.Suits.Basic.BasicSuitModelRenderer.render(BasicSuitModelRenderer.java:16) ~[%2379!:?] {re:classloading}
    at net.minecraft.client.renderer.entity.LivingEntityRenderer.render(LivingEntityRenderer.java:126) ~[forge-1.17.1-37.0.126_mapped_official_1.17.1-recomp.jar%2375!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.renderer.entity.player.PlayerRenderer.render(PlayerRenderer.java:62) ~[forge-1.17.1-37.0.126_mapped_official_1.17.1-recomp.jar%2375!:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.client.renderer.entity.player.PlayerRenderer.render(PlayerRenderer.java:43) ~[forge-1.17.1-37.0.126_mapped_official_1.17.1-recomp.jar%2375!:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.client.renderer.entity.EntityRenderDispatcher.render(EntityRenderDispatcher.java:129) ~[forge-1.17.1-37.0.126_mapped_official_1.17.1-recomp.jar%2375!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.renderer.LevelRenderer.renderEntity(LevelRenderer.java:1280) ~[forge-1.17.1-37.0.126_mapped_official_1.17.1-recomp.jar%2375!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.renderer.LevelRenderer.renderLevel(LevelRenderer.java:1076) ~[forge-1.17.1-37.0.126_mapped_official_1.17.1-recomp.jar%2375!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.renderer.GameRenderer.renderLevel(GameRenderer.java:1050) ~[forge-1.17.1-37.0.126_mapped_official_1.17.1-recomp.jar%2375!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.renderer.GameRenderer.render(GameRenderer.java:830) ~[forge-1.17.1-37.0.126_mapped_official_1.17.1-recomp.jar%2375!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.Minecraft.runTick(Minecraft.java:1039) ~[forge-1.17.1-37.0.126_mapped_official_1.17.1-recomp.jar%2375!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.Minecraft.run(Minecraft.java:659) ~[forge-1.17.1-37.0.126_mapped_official_1.17.1-recomp.jar%2375!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.main.Main.main(Main.java:186) ~[forge-1.17.1-37.0.126_mapped_official_1.17.1-recomp.jar%2375!:?] {re:classloading,pl:runtimedistcleaner:A}
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] {}
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78) ~[?:?] {}
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] {}
    at java.lang.reflect.Method.invoke(Method.java:567) ~[?:?] {}
    at net.minecraftforge.fml.loading.targets.ForgeClientUserdevLaunchHandler.lambda$launchService$0(ForgeClientUserdevLaunchHandler.java:38) ~[fmlloader-1.17.1-37.0.126.jar%233!:?] {}
    at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-9.0.7.jar%238!:?] {}
    at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) [modlauncher-9.0.7.jar%238!:?] {}
    at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) [modlauncher-9.0.7.jar%238!:?] {}
    at cpw.mods.modlauncher.Launcher.run(Launcher.java:106) [modlauncher-9.0.7.jar%238!:?] {}
    at cpw.mods.modlauncher.Launcher.main(Launcher.java:77) [modlauncher-9.0.7.jar%238!:?] {}
    at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) [modlauncher-9.0.7.jar%238!:?] {}
    at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) [modlauncher-9.0.7.jar%238!:?] {}
    at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:90) [bootstraplauncher-0.1.17.jar:?] {}


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- Head --
Thread: Render thread
Stacktrace:
    at net.minecraft.client.model.geom.ModelPart.getChild(ModelPart.java:60) ~[forge-1.17.1-37.0.126_mapped_official_1.17.1-recomp.jar%2375!:?] {re:classloading,pl:runtimedistcleaner:A}
    at com.Twins730.SolarisSpace.client.Entity.Model.Suit.Basic.BasicSuitModel.<init>(BasicSuitModel.java:30) ~[%2379!:?] {re:classloading}
    at com.Twins730.SolarisSpace.client.Entity.Renderer.Suits.Basic.BasicSuitModelRenderer.render(BasicSuitModelRenderer.java:28) ~[%2379!:?] {re:classloading}
    at com.Twins730.SolarisSpace.client.Entity.Renderer.Suits.Basic.BasicSuitModelRenderer.render(BasicSuitModelRenderer.java:16) ~[%2379!:?] {re:classloading}
    at net.minecraft.client.renderer.entity.LivingEntityRenderer.render(LivingEntityRenderer.java:126) ~[forge-1.17.1-37.0.126_mapped_official_1.17.1-recomp.jar%2375!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.renderer.entity.player.PlayerRenderer.render(PlayerRenderer.java:62) ~[forge-1.17.1-37.0.126_mapped_official_1.17.1-recomp.jar%2375!:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.client.renderer.entity.player.PlayerRenderer.render(PlayerRenderer.java:43) ~[forge-1.17.1-37.0.126_mapped_official_1.17.1-recomp.jar%2375!:?] {re:classloading,pl:runtimedistcleaner:A}
-- Entity being rendered --
Details:
    Entity Type: minecraft:player (net.minecraft.client.player.LocalPlayer)
    Entity ID: 199
    Entity Name: Dev
    Entity's Exact location: 300.65, 75.00, 104.99
    Entity's Block location: World: (300,75,104), Section: (at 12,11,8 in 18,4,6; chunk contains blocks 288,0,96 to 303,255,111), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511)
    Entity's Momentum: 0.00, -0.08, 0.00
    Entity's Passengers: []
    Entity's Vehicle: null

-- Renderer details --
Details:
    Assigned renderer: net.minecraft.client.renderer.entity.player.PlayerRenderer@387c5d79
    Location: 0.83,-5.49,-0.57 - World: (0,-6,-1), Section: (at 0,10,15 in 0,-1,-1; chunk contains blocks 0,0,-16 to 15,255,-1), Region: (0,-1; contains chunks 0,-32 to 31,-1, blocks 0,0,-512 to 511,255,-1)
    Rotation: -124.3446
    Delta: 0.54000616
Stacktrace:
    at net.minecraft.client.renderer.entity.EntityRenderDispatcher.render(EntityRenderDispatcher.java:129) ~[forge-1.17.1-37.0.126_mapped_official_1.17.1-recomp.jar%2375!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.renderer.LevelRenderer.renderEntity(LevelRenderer.java:1280) ~[forge-1.17.1-37.0.126_mapped_official_1.17.1-recomp.jar%2375!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.renderer.LevelRenderer.renderLevel(LevelRenderer.java:1076) ~[forge-1.17.1-37.0.126_mapped_official_1.17.1-recomp.jar%2375!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.renderer.GameRenderer.renderLevel(GameRenderer.java:1050) ~[forge-1.17.1-37.0.126_mapped_official_1.17.1-recomp.jar%2375!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}


-- Affected level --
Details:
    All players: 1 total; [LocalPlayer['Dev'/199, l='ClientLevel', x=300.65, y=75.00, z=104.99]]
    Chunk stats: 441, 236
    Level dimension: minecraft:overworld
    Level spawn location: World: (32,66,-64), Section: (at 0,2,0 in 2,4,-4; chunk contains blocks 32,0,-64 to 47,255,-49), Region: (0,-1; contains chunks 0,-32 to 31,-1, blocks 0,0,-512 to 511,255,-1)
    Level time: 85016 game time, 20965 day time
    Server brand: forge
    Server type: Integrated singleplayer server
Stacktrace:
    at net.minecraft.client.multiplayer.ClientLevel.fillReportDetails(ClientLevel.java:364) ~[forge-1.17.1-37.0.126_mapped_official_1.17.1-recomp.jar%2375!:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.client.Minecraft.fillReport(Minecraft.java:2245) ~[forge-1.17.1-37.0.126_mapped_official_1.17.1-recomp.jar%2375!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.Minecraft.run(Minecraft.java:676) ~[forge-1.17.1-37.0.126_mapped_official_1.17.1-recomp.jar%2375!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.main.Main.main(Main.java:186) ~[forge-1.17.1-37.0.126_mapped_official_1.17.1-recomp.jar%2375!:?] {re:classloading,pl:runtimedistcleaner:A}
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] {}
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78) ~[?:?] {}
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] {}
    at java.lang.reflect.Method.invoke(Method.java:567) ~[?:?] {}
    at net.minecraftforge.fml.loading.targets.ForgeClientUserdevLaunchHandler.lambda$launchService$0(ForgeClientUserdevLaunchHandler.java:38) ~[fmlloader-1.17.1-37.0.126.jar%233!:?] {}
    at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-9.0.7.jar%238!:?] {}
    at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) [modlauncher-9.0.7.jar%238!:?] {}
    at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) [modlauncher-9.0.7.jar%238!:?] {}
    at cpw.mods.modlauncher.Launcher.run(Launcher.java:106) [modlauncher-9.0.7.jar%238!:?] {}
    at cpw.mods.modlauncher.Launcher.main(Launcher.java:77) [modlauncher-9.0.7.jar%238!:?] {}
    at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) [modlauncher-9.0.7.jar%238!:?] {}
    at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) [modlauncher-9.0.7.jar%238!:?] {}
    at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:90) [bootstraplauncher-0.1.17.jar:?] {}


 

If I am incorrect just tell me.

Also I have made changes to my code.

Link to comment
Share on other sites

Ok Here is the Updated Code:

The Model Class:

Spoiler

public class BasicSuitModel extends HumanoidModel<AbstractClientPlayer> {

    public static final ModelLayerLocation LAYER_LOCATION = new ModelLayerLocation(new ResourceLocation(SolarisSpace.MOD_ID, "basic_suit"), "basic_suit_wearable");
    private final ModelPart LeftLeg;
    private final ModelPart RightLeg;
    private final ModelPart LeftArm;
    private final ModelPart RightArm;
    private final ModelPart Body;

    public BasicSuitModel(ModelPart p_170821_) {
        super(p_170821_);
        this.LeftLeg = p_170821_.getChild("LeftLeg");
        this.RightLeg = p_170821_.getChild("RightLeg");
        this.LeftArm = p_170821_.getChild("LeftArm");
        this.RightArm = p_170821_.getChild("RightArm");
        this.Body = p_170821_.getChild("Body");
    }


    public void setupAngles(PlayerModel model) {
        this.Body.copyFrom(model.body);
        this.LeftArm.copyFrom(model.leftArm);
        this.RightArm.copyFrom(model.rightArm);
        this.LeftLeg.copyFrom(model.leftLeg);
        this.RightLeg.copyFrom(model.rightLeg);
    }

    public static LayerDefinition createBodyLayer() {
        MeshDefinition meshdefinition = new MeshDefinition();
        PartDefinition partdefinition = meshdefinition.getRoot();

        CubeDeformation cube = CubeDeformation.NONE;
        meshdefinition = HumanoidModel.createMesh(cube, 0.0F);
        partdefinition = meshdefinition.getRoot().getChild("body");

        PartDefinition LeftLeg = partdefinition.addOrReplaceChild("LeftLeg", CubeListBuilder.create().texOffs(0, 38).addBox(-3.0F, 0.0F, -3.0F, 6.0F, 12.0F, 6.0F, new CubeDeformation(0.0F)).texOffs(0, 48).addBox(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.25F)), PartPose.offset(1.9F, 12.0F, 0.0F));
        PartDefinition RightLeg = partdefinition.addOrReplaceChild("RightLeg", CubeListBuilder.create().texOffs(32, 0).addBox(-3.0F, 0.0F, -3.0F, 6.0F, 12.0F, 6.0F, new CubeDeformation(0.0F)).texOffs(0, 32).addBox(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.25F)), PartPose.offset(-1.9F, 12.0F, 0.0F));
        PartDefinition LeftArm = partdefinition.addOrReplaceChild("LeftArm", CubeListBuilder.create().texOffs(0, 19).addBox(-1.0F, -3.0F, -3.0F, 6.0F, 13.0F, 6.0F, new CubeDeformation(0.0F)).texOffs(48, 48).addBox(-1.0F, -2.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.25F)), PartPose.offset(5.0F, 2.0F, 0.0F));
        PartDefinition RightArm = partdefinition.addOrReplaceChild("RightArm", CubeListBuilder.create().texOffs(22, 19).addBox(-4.0F, -3.0F, -3.0F, 6.0F, 13.0F, 6.0F, new CubeDeformation(0.0F)).texOffs(40, 32).addBox(-3.0F, -2.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.25F)), PartPose.offset(-5.0F, 2.0F, 0.0F));
        PartDefinition Body = partdefinition.addOrReplaceChild("Body", CubeListBuilder.create().texOffs(0, 0).addBox(-5.0F, -1.0F, -3.0F, 10.0F, 13.0F, 6.0F, new CubeDeformation(0.0F)).texOffs(16, 32).addBox(-4.0F, 0.0F, -2.0F, 8.0F, 12.0F, 4.0F, new CubeDeformation(0.25F)), PartPose.offset(0.0F, 0.0F, 0.0F));

        return LayerDefinition.create(meshdefinition, 64, 64);
    }

    @Override
    public void renderToBuffer(PoseStack poseStack, VertexConsumer buffer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha) {
        LeftLeg.render(poseStack, buffer, packedLight, packedOverlay);
        RightLeg.render(poseStack, buffer, packedLight, packedOverlay);
        LeftArm.render(poseStack, buffer, packedLight, packedOverlay);
        RightArm.render(poseStack, buffer, packedLight, packedOverlay);
        Body.render(poseStack, buffer, packedLight, packedOverlay);
    }

    @Override
    protected Iterable<ModelPart> headParts() {
        return ImmutableList.of(this.head);
    }

    @Override
    protected Iterable<ModelPart> bodyParts() {
        return ImmutableList.of(this.body, this.rightArm, this.leftArm, this.rightLeg, this.leftLeg, this.hat);
    }
}

My Renderer class:

Spoiler

public class BasicSuitModelRenderer extends RenderLayer<AbstractClientPlayer, PlayerModel<AbstractClientPlayer>> {

    private static final ResourceLocation SUIT_TEX = new ResourceLocation(SolarisSpace.MOD_ID,"textures/entity/suits/basic/suit_main.png");
    private BasicSuitModel suitModel;

    public BasicSuitModelRenderer(RenderLayerParent<AbstractClientPlayer, PlayerModel<AbstractClientPlayer>> renderer) {
        super(renderer);
    }


    @Override
    public void render(PoseStack poseStack, MultiBufferSource p_116952_, int p_116953_, AbstractClientPlayer p_116954_, float p_116955_, float p_116956_, float p_116957_, float p_116958_, float p_116959_, float p_116960_) {
        suitModel = new BasicSuitModel(BasicSuitModel.createBodyLayer().bakeRoot());
        if (true) {
            poseStack.pushPose();
            ((PlayerModel)this.getParentModel()).copyPropertiesTo(this.suitModel);
            this.suitModel.setupAngles((PlayerModel)this.getParentModel());
            poseStack.translate(0.0D, 0.0D, 0.0D);
            this.suitModel.setupAnim(p_116954_, p_116955_, p_116956_, p_116958_, p_116959_, p_116960_);
            VertexConsumer vertexConsumer = p_116952_.getBuffer(RenderType.entityCutoutNoCull(SUIT_TEX));
            this.suitModel.renderToBuffer(poseStack, vertexConsumer, p_116953_, OverlayTexture.NO_OVERLAY, 1,1,1, 1.0F);
            poseStack.popPose();
        }
    }

}

And the updated Main Class:

Spoiler


    @SubscribeEvent
    public void layerDefinitions(EntityRenderersEvent.RegisterLayerDefinitions event) {
      event.registerLayerDefinition(BasicSuitModel.LAYER_LOCATION, () -> {
            return BasicSuitModel.createBodyLayer();
        });
    }

    @SubscribeEvent
    public void addLayers(EntityRenderersEvent.AddLayers evt) {
        addPlayerLayer(evt, "default");
        addPlayerLayer(evt, "slim");
    }

    private void addPlayerLayer(EntityRenderersEvent.AddLayers evt, String skin) {
        EntityRenderer<? extends Player> renderer = evt.getSkin(skin);
        if (renderer instanceof LivingEntityRenderer) {
            LivingEntityRenderer livingRenderer = (LivingEntityRenderer)renderer;
            livingRenderer.addLayer(new BasicSuitModelRenderer(livingRenderer));
        }

    }

Also, I realized that the Main Class Events shouldn't be static and now the game runs but the model isn't rendering.

Link to comment
Share on other sites

  • 3 weeks later...
  • UserMC123 changed the title to SOLVED [1.17.1] Custom player layer not rendering.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • I've been trying for the past hour to get one of these Modpacks to work, and after running the Serverrun.bat it gets all the way through the process on both Modpacks before it gives me the following Error Message. Error: Could not find or load main class @libraries.net.minecraftforge.forge.1.18.1-39.0.22.win_args.txt Any help would be great!  
    • The game crashed while playing. please help I don't know how to. ---- Minecraft Crash Report ---- // Shall we play a game? Time: 1/29/22, 1:08 AM Description: Exception in server tick loop java.lang.NoSuchMethodError: 'net.minecraft.nbt.CompoundTag net.minecraft.world.level.block.entity.BlockEntity.save(net.minecraft.nbt.CompoundTag)'     at ht.treechop.common.block.ChoppedLogBlock$Entity.save(ChoppedLogBlock.java:291) ~[TreeChop-Mod-1.18.1.jar%2367!/:0.15.3] {re:classloading}     at ht.treechop.common.block.ChoppedLogBlock$Entity.m_5995_(ChoppedLogBlock.java:335) ~[TreeChop-Mod-1.18.1.jar%2367!/:0.15.3] {re:classloading}     at net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket.m_195642_(ClientboundBlockEntityDataPacket.java:21) ~[client-1.18.1-20211210.034407-srg.jar%2370!/:?] {re:classloading}     at net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket.m_195640_(ClientboundBlockEntityDataPacket.java:25) ~[client-1.18.1-20211210.034407-srg.jar%2370!/:?] {re:classloading}     at ht.treechop.common.block.ChoppedLogBlock$Entity.getUpdatePacket(ChoppedLogBlock.java:328) ~[TreeChop-Mod-1.18.1.jar%2367!/:0.15.3] {re:classloading}     at ht.treechop.common.block.ChoppedLogBlock$Entity.m_183216_(ChoppedLogBlock.java:260) ~[TreeChop-Mod-1.18.1.jar%2367!/:0.15.3] {re:classloading}     at net.minecraftforge.common.ForgeHooks.onBlockBreakEvent(ForgeHooks.java:562) ~[forge-1.18.1-39.0.62-universal.jar%2374!/:?] {re:classloading}     at net.minecraft.server.level.ServerPlayerGameMode.m_9280_(ServerPlayerGameMode.java:227) ~[client-1.18.1-20211210.034407-srg.jar%2370!/:?] {re:computing_frames,re:classloading}     at net.minecraft.server.level.ServerPlayerGameMode.m_9286_(ServerPlayerGameMode.java:217) ~[client-1.18.1-20211210.034407-srg.jar%2370!/:?] {re:computing_frames,re:classloading}     at net.minecraft.server.level.ServerPlayerGameMode.m_7391_(ServerPlayerGameMode.java:187) ~[client-1.18.1-20211210.034407-srg.jar%2370!/:?] {re:computing_frames,re:classloading}     at net.minecraft.server.network.ServerGamePacketListenerImpl.m_7502_(ServerGamePacketListenerImpl.java:945) ~[client-1.18.1-20211210.034407-srg.jar%2370!/:?] {re:classloading}     at net.minecraft.network.protocol.game.ServerboundPlayerActionPacket.m_5797_(ServerboundPlayerActionPacket.java:34) ~[client-1.18.1-20211210.034407-srg.jar%2370!/:?] {re:classloading}     at net.minecraft.network.protocol.game.ServerboundPlayerActionPacket.m_5797_(ServerboundPlayerActionPacket.java:8) ~[client-1.18.1-20211210.034407-srg.jar%2370!/:?] {re:classloading}     at net.minecraft.network.protocol.PacketUtils.m_131356_(PacketUtils.java:21) ~[client-1.18.1-20211210.034407-srg.jar%2370!/:?] {re:classloading}     at net.minecraft.server.TickTask.run(TickTask.java:18) ~[client-1.18.1-20211210.034407-srg.jar%2370!/:?] {re:classloading}     at net.minecraft.util.thread.BlockableEventLoop.m_6367_(BlockableEventLoop.java:151) ~[client-1.18.1-20211210.034407-srg.jar%2370!/:?] {re:mixin,pl:accesstransformer:B,re:computing_frames,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B}     at net.minecraft.util.thread.ReentrantBlockableEventLoop.m_6367_(ReentrantBlockableEventLoop.java:23) ~[client-1.18.1-20211210.034407-srg.jar%2370!/:?] {re:mixin,re:computing_frames,re:classloading}     at net.minecraft.server.MinecraftServer.m_6367_(MinecraftServer.java:765) ~[client-1.18.1-20211210.034407-srg.jar%2370!/:?] {re:mixin,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,pl:mixin:APP:byg.mixins.json:server.MixinMinecraftServer,pl:mixin:A}     at net.minecraft.server.MinecraftServer.m_6367_(MinecraftServer.java:161) ~[client-1.18.1-20211210.034407-srg.jar%2370!/:?] {re:mixin,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,pl:mixin:APP:byg.mixins.json:server.MixinMinecraftServer,pl:mixin:A}     at net.minecraft.util.thread.BlockableEventLoop.m_7245_(BlockableEventLoop.java:125) ~[client-1.18.1-20211210.034407-srg.jar%2370!/:?] {re:mixin,pl:accesstransformer:B,re:computing_frames,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B}     at net.minecraft.server.MinecraftServer.m_129961_(MinecraftServer.java:748) ~[client-1.18.1-20211210.034407-srg.jar%2370!/:?] {re:mixin,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,pl:mixin:APP:byg.mixins.json:server.MixinMinecraftServer,pl:mixin:A}     at net.minecraft.server.MinecraftServer.m_7245_(MinecraftServer.java:742) ~[client-1.18.1-20211210.034407-srg.jar%2370!/:?] {re:mixin,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,pl:mixin:APP:byg.mixins.json:server.MixinMinecraftServer,pl:mixin:A}     at net.minecraft.util.thread.BlockableEventLoop.m_18699_(BlockableEventLoop.java:110) ~[client-1.18.1-20211210.034407-srg.jar%2370!/:?] {re:mixin,pl:accesstransformer:B,re:computing_frames,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B}     at net.minecraft.server.MinecraftServer.m_130012_(MinecraftServer.java:727) ~[client-1.18.1-20211210.034407-srg.jar%2370!/:?] {re:mixin,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,pl:mixin:APP:byg.mixins.json:server.MixinMinecraftServer,pl:mixin:A}     at net.minecraft.server.MinecraftServer.m_130011_(MinecraftServer.java:672) ~[client-1.18.1-20211210.034407-srg.jar%2370!/:?] {re:mixin,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,pl:mixin:APP:byg.mixins.json:server.MixinMinecraftServer,pl:mixin:A}     at net.minecraft.server.MinecraftServer.m_177918_(MinecraftServer.java:258) ~[client-1.18.1-20211210.034407-srg.jar%2370!/:?] {re:mixin,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,pl:mixin:APP:byg.mixins.json:server.MixinMinecraftServer,pl:mixin:A}     at java.lang.Thread.run(Thread.java:833) [?:?] {re:mixin} A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- System Details -- Details:     Minecraft Version: 1.18.1     Minecraft Version ID: 1.18.1     Operating System: Windows 10 (amd64) version 10.0     Java Version: 17.0.1, Microsoft     Java VM Version: OpenJDK 64-Bit Server VM (mixed mode), Microsoft     Memory: 2163132464 bytes (2062 MiB) / 6643777536 bytes (6336 MiB) up to 8589934592 bytes (8192 MiB)     CPUs: 8     Processor Vendor: GenuineIntel     Processor Name: Intel(R) Core(TM) i7-8565U CPU @ 1.80GHz     Identifier: Intel64 Family 6 Model 142 Stepping 11     Microarchitecture: whiskey Lake     Frequency (GHz): 1.99     Number of physical packages: 1     Number of physical CPUs: 4     Number of logical CPUs: 8     Graphics card #0 name: Intel(R) UHD Graphics 620     Graphics card #0 vendor: Intel Corporation (0x8086)     Graphics card #0 VRAM (MB): 1024.00     Graphics card #0 deviceId: 0x3ea0     Graphics card #0 versionInfo: DriverVersion=26.20.100.7926     Memory slot #0 capacity (MB): 8192.00     Memory slot #0 clockSpeed (GHz): 2.40     Memory slot #0 type: DDR4     Memory slot #1 capacity (MB): 8192.00     Memory slot #1 clockSpeed (GHz): 2.40     Memory slot #1 type: DDR4     Virtual memory max (MB): 20670.30     Virtual memory used (MB): 17701.50     Swap memory total (MB): 4496.57     Swap memory used (MB): 717.27     JVM Flags: 9 total; -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump -Xss1M -Xmx8G -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC -XX:G1NewSizePercent=20 -XX:G1ReservePercent=20 -XX:MaxGCPauseMillis=50 -XX:G1HeapRegionSize=32M     Server Running: true     Player Count: 1 / 8; [ServerPlayer['rocio12barcenas'/187, l='ServerLevel[New World]', x=82.38, y=75.00, z=-249.35]]     Data Packs: vanilla, mod:forge, mod:sereneseasons (incompatible), mod:mna (incompatible), mod:treechop (incompatible), mod:terrablender, mod:apotheosis (incompatible), mod:cfm, mod:jei, mod:bumblecore, mod:byg (incompatible), mod:torohealth (incompatible), mod:curios, mod:xaerominimap, mod:geckolib3 (incompatible), mod:xaeroworldmap, mod:placebo (incompatible), mod:dramaticdoors, mod:travelersbackpack, mod:foodsicles     Type: Integrated Server (map_client.txt)     Is Modded: Definitely; Client brand changed to 'forge'; Server brand changed to 'forge'     ModLauncher: 9.1.0+9.1.0+main.6690ee51     ModLauncher launch target: forgeclient     ModLauncher naming: srg     ModLauncher services:           mixin PLUGINSERVICE           eventbus PLUGINSERVICE           object_holder_definalize PLUGINSERVICE           runtime_enum_extender PLUGINSERVICE           capability_token_subclass PLUGINSERVICE           accesstransformer PLUGINSERVICE           runtimedistcleaner PLUGINSERVICE           mixin TRANSFORMATIONSERVICE           fml TRANSFORMATIONSERVICE      FML Language Providers:          minecraft@1.0         javafml@null     Mod List:          client-1.18.1-20211210.034407-srg.jar             |Minecraft                     |minecraft                     |1.18.1              |DONE      |Manifest: a1:d4:5e:04:4f:d3:d6:e0:7b:37:97:cf:77:b0:de:ad:4a:47:ce:8c:96:49:5f:0a:cf:8c:ae:b2:6d:4b:8a:3f         Serene-Seasons-Mod-1.18.1.jar                     |Serene Seasons                |sereneseasons                 |1.18.1-6.0.0.11     |DONE      |Manifest: NOSIGNATURE         Mana-and-Artifice-Mod-1.18.1.jar                  |Mana and Artifice             |mna                           |1.7.0.2             |DONE      |Manifest: NOSIGNATURE         TreeChop-Mod-1.18.1.jar                           |HT's TreeChop                 |treechop                      |0.15.3              |DONE      |Manifest: NOSIGNATURE         TerraBlender-forge-1.18.1-1.1.0.73.jar            |TerraBlender                  |terrablender                  |1.18.1-1.1.0.73     |DONE      |Manifest: NOSIGNATURE         Apotheosis-Mod-1.18.1.jar                         |Apotheosis                    |apotheosis                    |5.2.0               |DONE      |Manifest: NOSIGNATURE         MrCrayfishs-Furniture-Mod-1.18.1.jar              |MrCrayfish's Furniture Mod    |cfm                           |7.0.0-pre28         |DONE      |Manifest: NOSIGNATURE         jei-1.18.1-9.2.3.82.jar                           |Just Enough Items             |jei                           |9.2.3.82            |DONE      |Manifest: NOSIGNATURE         bumblecore-1.18.1-1.0.4.jar                       |Bumblecore                    |bumblecore                    |1.18.1-1.0.4        |DONE      |Manifest: NOSIGNATURE         Oh+The+Biomes+You'll+Go-forge-1.18.1-1.3.5.8.jar  |Oh The Biomes You'll Go       |byg                           |1.3.5.8             |DONE      |Manifest: NOSIGNATURE         forge-1.18.1-39.0.62-universal.jar                |Forge                         |forge                         |39.0.62             |DONE      |Manifest: 84:ce:76:e8:45:35:e4:0e:63:86:df:47:59:80:0f:67:6c:c1:5f:6e:5f:4d:b3:54:47:1a:9f:7f:ed:5e:f2:90         torohealth-1.18-forge-2.jar                       |ToroHealth                    |torohealth                    |1.18-forge-2        |DONE      |Manifest: NOSIGNATURE         Curios-API-1.18.1.jar                             |Curios API                    |curios                        |1.18.1-5.0.6.0      |DONE      |Manifest: NOSIGNATURE         Xaeros_Minimap_22.1.0_Forge_1.18.jar              |Xaero's Minimap               |xaerominimap                  |22.1.0              |DONE      |Manifest: NOSIGNATURE         geckolib-1.18-forge-3.0.9.jar                     |GeckoLib                      |geckolib3                     |3.0.9               |DONE      |Manifest: NOSIGNATURE         XaerosWorldMap_1.20.0_Forge_1.18.jar              |Xaero's World Map             |xaeroworldmap                 |1.20.0              |DONE      |Manifest: NOSIGNATURE         Place2bo-1.18.1-6.0.5.jar                          |Placebo                       |placebo                       |6.0.5               |DONE      |Manifest: NOSIGNATURE         Dramatic-Doors-Mod-1.18.1.jar                     |Dramatic Doors                |dramaticdoors                 |1.18.1-1.5.0        |DONE      |Manifest: NOSIGNATURE         TravelersBackpack-1.18.1-7.0.1.jar                |Traveler's Backpack           |travelersbackpack             |7.0.1               |DONE      |Manifest: NOSIGNATURE         foodsicles-1.18.1-1.0.4.jar                       |Foodsicles                    |foodsicles                    |1.18.1-1.0.4        |DONE      |Manifest: NOSIGNATURE     Crash Report UUID: d060c158-744d-48bd-ba52-bf8d49f5f8d2     FML: 39.0     Forge: net.minecraftforge:39.0.6
    • Hi guys! I currently have a project that I've been developing in a 'vanilla' environment that I'm actually looking to transfer over to Forge, simply because of how much better the experience would be using Forge. Before starting on this Forge mod, I was planning ahead and was looking at options for proxies, of which I would greatly like to use Velocity. In their docs and by asking around their Discord, they don't support support versions of Forge of 1.13 or later because of changes in the "handshake protocol". But I also really don't want to use an unsupported version of Forge, such as 1.12.2, to be able to use a proxy. I was pointed in the direction of potentially making my own client-side mod to allow Forge to be compatible with an updated proxy, such as Velocity. When asking for a direction for achieving this, I was told to have a look at how the Forge server implements logins and that the discrepancy might be with how modified the handshake protocol is. This sounds like quite the challenge to me and I'm completely up for trying to accomplish it. So for the sake of planning ahead and having a rough idea of how I could accomplish that when the time comes to work on it, has anyone else had experience with trying to achieve this? I appreciate any help or direction offered! Thanks! 
    • Been trying to set up a server for myself and a few friends through BisectHosting. I ended up replicating the server on my own computer to see if the issue persisted (if it was on bisect's end) and it was still there. Every time a player tries to connect to the server they start connecting but after only around 2 seconds the player is disconnected with the error message Payload size exceeds 1048576 bytes.  Upon inspection of the server debug file, the player always disconnects while fmlhandshake ticking packet info is being sent, and I have repeatedly made sure the mods and their configs are identical. I tried to get RandomPatches to increase the max allowed byte size, as the default seems to be 32767, but either something is wrong with it or some other mod is limiting the packet size limit.     Server Debug: https://pastebin.com/xZLbtdQB (only includes portions from after the server launched as I couldn't upload the whole file) Server Log: https://pastebin.com/yrJ3tNaW (similarly only after server launched (hence the weird say commands) Client Log: https://pastebin.com/inSzZV96 (whole thing for once) Modlist: https://pastebin.com/Qvurg45j (All but Optifine and BetterFoliage are present on the server as they have caused issues during startup)   Honestly stumped on how to fix this, been working on it for 10 hours across two days to no avail.
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.