Topic category: User side tutorials
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!
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:
- 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)
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:
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.
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:
To fix the images on this page, check https://mcreator.net/wiki/how-post-images-website
I fixed it, will you consider adding this to Mcreator? Having it would be so convenient.
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
Whis matrix iAds stax? I want to impkement a matrix stonk and how do i do do this? Sorry for english language my
I have the code for x y z t in Step 3, You can just replace x, y, z, t with anynumber you want.
Popka983, bruh, this forum is literally how to do it
Could this be used to change the baby model of the entities?
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 ?
You should have Render part in Step 1 if you're using latest version of Mcreator
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();
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();
}
@Vgravity cool but where do we put it?
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
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