[SOLVED]Changing model size no longer works in 1.17.1

Started by vGravity on

Topic category: Help with Minecraft modding (Java Edition)

Joined Dec 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
[SOLVED]Changing model size no longer works in 1.17.1
Thu, 12/16/2021 - 20:32 (edited)

So, in 1.16.5 I used this guide to change the size of an entity in-game. The render code for models however changed in 1.17.1. Does anybody know how to change the render size of a model in 1.17.1?

In case anybody is also looking for how to rescale an entity model in the renderer in 1.17, here is the solution I found.

Instead of typing

"@Override
        public void render(MatrixStack matrixStack, IVertexBuilder buffer, int packedLight, int packedOverlay, float red, float green, float blue,
                float alpha) {
            matrixStack.push();
            matrixStack.translate(0f, 1.5f - 0.5 * 1.5f, 0f);
            matrixStack.scale(0.5f, 0.5f, 0.5f);
            main.render(matrixStack, buffer, packedLight, packedOverlay);
            matrixStack.pop();"

Type

"@Override
    public void renderToBuffer(PoseStack poseStack, VertexConsumer buffer, int packedLight, int packedOverlay,
            float red, float green, float blue, float alpha) {
            poseStack.pushPose();
            poseStack.translate(0f, 1.5f - 0.5 * 1.5f, 0f);
            poseStack.scale(0.5f, 0.5f, 0.5f);
        main.render(poseStack, buffer, packedLight, packedOverlay);
            poseStack.popPose();"

Edited by vGravity on Thu, 12/16/2021 - 20:32
Joined Feb 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Where do we put this?
Wed, 12/22/2021 - 22:09

Where do we put this?

Joined Feb 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Does not work   C:\Users…
Sun, 12/26/2021 - 02:05

Does not work

 

C:\Users\VuFlub\MCreatorWorkspaces\addons\src\main\java\net\mcreator\addons\client\renderer\TestRenderer.java:21: error: cannot find symbol
    public void renderToBuffer(PoseStack poseStack, VertexConsumer buffer, int packedLight, int packedOverlay,
                               ^
  symbol:   class PoseStack
  location: class TestRenderer
C:\Users\VuFlub\MCreatorWorkspaces\addons\src\main\java\net\mcreator\addons\client\renderer\TestRenderer.java:21: error: cannot find symbol
    public void renderToBuffer(PoseStack poseStack, VertexConsumer buffer, int packedLight, int packedOverlay,
                                                    ^
  symbol:   class VertexConsumer
  location: class TestRenderer
C:\Users\VuFlub\MCreatorWorkspaces\addons\src\main\java\net\mcreator\addons\client\renderer\TestRenderer.java:20: error: method does not override or implement a method from a supertype
   @Override
   ^
C:\Users\VuFlub\MCreatorWorkspaces\addons\src\main\java\net\mcreator\addons\client\renderer\TestRenderer.java:26: error: cannot find symbol
        main.render(poseStack, buffer, packedLight, packedOverlay);
        ^
  symbol:   variable main
  location: class TestRenderer
4 errors
FAILURE: Build failed with an exception.

Joined Dec 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
What version of Minecraft is…
Sun, 12/26/2021 - 06:35

What version of Minecraft is your mod for? Could you send a screenshot of the code you put please? 

 

I use this exact code on 1.17.1 to rescale my model in game.

Joined Dec 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Sorry, I forgot that the…
Mon, 12/27/2021 - 02:06

Sorry, I forgot that the file where you put the code at is different in 1.17.1 than it is in 1.16.5. your code is correct except that it is in the wrong file and don't believe you change the model parts to be the same model parts as yours.

 

The "main.render' part only applies to my model. "Main' is the name of my model's cube. For you, it'll be "(name of your cube).render" and you'll likely have multiple cubes.

Go to your (name of entity).Java file, it's the same .Java file that you upload when you're uploading a model, and replace the line of code that says this. Here is an image that shows how to get to this file

https://imgur.com/a/KT3sgIC

 "@Override
    public void renderToBuffer(PoseStack poseStack, VertexConsumer buffer, int packedLight, int packedOverlay,"

With "@Override

    public void renderToBuffer(PoseStack poseStack, VertexConsumer buffer, int packedLight, int packedOverlay,

            float red, float green, float blue, float alpha) {

            poseStack.pushPose();

            poseStack.translate(0f, 1.5f - 0.5 * 1.5f, 0f);

            poseStack.scale(0.5f, 0.5f, 0.5f);"

After the (part name).render stuff, copy and paste this

            "poseStack.popPose();"

Should look similar to this image (the "main.render" to "back_left_left.render" part will be different for you. It'll have the names of your entity models cubes.

https://imgur.com/a/gZKjtM6

Joined Feb 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Oh ok thanks, I was confused…
Mon, 12/27/2021 - 03:01

Oh ok thanks, I was confused where to put it.

Joined Dec 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Could one of you guys post…
Mon, 01/17/2022 - 02:41

Could one of you guys post your finished codes? I'm a bit confused on where to copy and paste certain things lol

Joined Dec 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Okay, nevermind. I figured…
Mon, 01/17/2022 - 03:16

Okay, nevermind. I figured out where to paste the code...

@Override
    public void renderToBuffer(PoseStack poseStack, VertexConsumer buffer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha) {
            poseStack.pushPose();
            poseStack.translate(0f, 1.5f - 0.5 * 1.5f, 0f);
            poseStack.scale(4.0f, 4.0f, 4.0);
        Head.render(poseStack, buffer, packedLight, packedOverlay);
        Tail.render(poseStack, buffer, packedLight, packedOverlay);
        Arm1.render(poseStack, buffer, packedLight, packedOverlay);
        Leg1.render(poseStack, buffer, packedLight, packedOverlay);
        Leg2.render(poseStack, buffer, packedLight, packedOverlay);
        Arm2.render(poseStack, buffer, packedLight, packedOverlay);
        bb_main.render(poseStack, buffer, packedLight, packedOverlay);
        poseStack.popPose();

But, whenever I save and load my world, nothing happens. Is there another step or?

 

Joined Dec 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
@phillipw1954 Make sure the…
Mon, 01/17/2022 - 22:18

@phillipw1954 Make sure the file is locked or else the code you put won't be saved and any changes you made to the code will be reverted back to default.

I'm not sure which model you changed this for. If you haven't already, you make sure you spawn in the model you're changing the scale of. For instance, if you changed a baby model, spawn in the baby model to see if it's size is different.

Also, some of your parts you started capitalized and then the last part "bb_main.render" isn't capitalized. Is your naming scheme just not consistent or is that a typo? Also, I've never used capitalized part names before, so I'm not 100% sure if that'd mess anything up.