[Tutorial] Render Scaling Up-Down for you entities with MatrixStack (make your mob bigger/smaller)

Started by minheragon12345 on

Topic category: User side tutorials

Last seen on 09:48, 26. Sep 2022
Joined Jun 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
[Tutorial] Render Scaling Up-Down for you entities with MatrixStack (make your mob bigger/smaller)
Wed, 04/28/2021 - 11:43 (edited)

Hey you! Yes, you! Have you ever made a model for your entity, added them to your mod, and then found out that the mob is smaller or bigger than you wanted? If true, this is WHAT you're looking for!
Sample

First of all, this is where I first reached to MatrixStack, and from that, I explore more then make this tutorial.

https://mcreator.net/forum/62190/scale-mob-code?page=0

Now let's get into it!

Step 1: You need to lock your element (of course), then choose to edit the code:
render
- If you're in 1.15, choose YourEntityEntity.java (in my case is NormalEntity.java)

- If you're in 1.16, choose YourEntityRender.java (mine is NormalRender.java)

Step 2: You'll need to scroll down and find the Render part (both 1.15 and 1.16), like this (my model is direwolf so it says Direwolf)
direwolf

Step 3: You need to replace entire thing (from "@Override" to "packedOverlay);" ) with this:
        @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 - t * 1.5f, 0f);
            matrixStack.scale(xf, yf, zf);
            Direwolf.render(matrixStack, buffer, packedLight, packedOverlay);
            matrixStack.pop();

Then you'll have this:
xyzt

Step 4: Now all you need is to change the x y z t variable: (by default, originally from your model, every variable is 1)
You can see some examples from the first image from step 1, the middle one is the default, everything is 1. Any variable that is smaller than 1 makes the entity small, greater than 1 makes it bigger.
- z = front to back [The perfect example is number 1]
- x = sideway [number 2]
- y = height [number 3]

Note: when you're changing the y variable, you need to change the t variable too, change it so t = y. If not you're entity will be underground.

With that in mind: [number 4] is what I made by changing every variable to 1.5 (x=y=z=t=1.5), the entity has turned from chicken-side to wolf-side.

Another example is this, when you place a x=y=z=t=0.5 wolf next to a x=y=z=t=3 wolf. 
Sample

Personally, I really do want this to be added to Mcreator (so I won't need to lock and relock the code every time I want to edit the mobs), I photoshoped this: 
Photoshop

Edited by minheragon12345 on Wed, 04/28/2021 - 11:43
Last seen on 09:48, 26. Sep 2022
Joined Jun 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I fixed it, will you…
Wed, 04/28/2021 - 11:46

I fixed it, will you consider adding this to Mcreator? Having it would be so convenient.

Last seen on 09:51, 14. May 2021
Joined May 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I don't understand the…
Fri, 05/07/2021 - 19:58

I don't understand the change the x y z t variable bit. I'm not that smart but if you could show simple picture where it is that would be helpful

Last seen on 05:48, 11. May 2021
Joined Apr 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Whis matrix iAds stax? I…
Fri, 05/07/2021 - 20:36

Whis matrix iAds stax? I want to impkement a matrix stonk and how do i do do this? Sorry for english language my

Last seen on 09:48, 26. Sep 2022
Joined Jun 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I have the code for x y z t…
Sun, 05/09/2021 - 04:44

I have the code for x y z t in Step 3, You can just replace x, y, z, t with anynumber you want.

Last seen on 09:48, 26. Sep 2022
Joined Jun 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Popka983, bruh, this forum…
Sun, 05/09/2021 - 04:46

Popka983, bruh, this forum is literally how to do it

Last seen on 17:39, 15. Jan 2024
Joined Feb 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Could this be used to change…
Wed, 05/26/2021 - 13:22

Could this be used to change the baby model of the entities?

Last seen on 18:20, 16. Jan 2022
Joined Apr 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I use a  geckolib animated…
Wed, 05/26/2021 - 20:02

I use a  geckolib animated model from blockbench 3.6.6 and geckolib plugin for mcreator.

But ther is no render part . Can i make it my self ? 

If so , how can i do it ?

 

Last seen on 09:48, 26. Sep 2022
Joined Jun 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You should have Render part…
Thu, 06/10/2021 - 03:55

You should have Render part in Step 1 if you're using latest version of Mcreator

Last seen on 04:38, 27. Aug 2021
Joined Jun 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Okay so am I in…
Tue, 06/29/2021 - 16:43

Okay so am I in understanding that this is what it should look like before and after? My issue is I see you have Direwolf.render but mine displays head, body, arms...

Before...
        @Override
        public void render(MatrixStack matrixStack, IVertexBuilder buffer, int packedLight, int packedOverlay, float red, float green, float blue,
                float alpha) {
            Head.render(matrixStack, buffer, packedLight, packedOverlay);
            Body.render(matrixStack, buffer, packedLight, packedOverlay);
            RightUpperArm.render(matrixStack, buffer, packedLight, packedOverlay);
            RightLeg.render(matrixStack, buffer, packedLight, packedOverlay);
            LeftArm.render(matrixStack, buffer, packedLight, packedOverlay);
            LeftLeg.render(matrixStack, buffer, packedLight, packedOverlay);
        }

After...

        @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 - 1.75 * 1.5f, 0f);
            matrixStack.scale(1.75f, 1.75f, 1.75f);
            Head.render(matrixStack, buffer, packedLight, packedOverlay);
            Body.render(matrixStack, buffer, packedLight, packedOverlay);
            RightUpperArm.render(matrixStack, buffer, packedLight, packedOverlay);
            RightLeg.render(matrixStack, buffer, packedLight, packedOverlay);
            LeftArm.render(matrixStack, buffer, packedLight, packedOverlay);
            LeftLeg.render(matrixStack, buffer, packedLight, packedOverlay);
            matrixStack.pop();

Last seen on 02:51, 19. Feb 2022
Joined Dec 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
In 1.17 MatrixStack changed…
Thu, 12/16/2021 - 20:26

In 1.17 MatrixStack changed to PoseStack. 
For anybody trying to update their mod from 1.16.5 or below to 1.17 or for anybody trying to make a mod for 1.17, you would instead type this

@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();
    }

Last seen on 03:52, 28. Jul 2023
Joined Feb 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
@Vgravity cool but where do…
Wed, 12/22/2021 - 21:54

@Vgravity cool but where do we put it?

Last seen on 19:15, 25. Apr 2023
Joined Aug 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
it says cannot find symbol…
Tue, 12/28/2021 - 08:09

it says cannot find symbol at the place where render is, i also changed it from direwolf to my entity but i keep getting a error

Last seen on 18:19, 28. Feb 2022
Joined Jan 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Got these errors after…
Sat, 01/08/2022 - 15:15

Got these errors after adding the updated 1.17 function to the entity script (it's supposed to go there right??). Yall got a clue whats broken? Im not 100% sure that im calling the correct object in the last error, how do I know what namespace is the correct one?

 

https://drive.google.com/file/d/1eVvFvU02WjnzTSipzweGHVdvrVPBzDA8/view?usp=sharing