People have been asking for a tutorial for custom mob modeling, so I decided to make one. Though first off I would like to say that making costum mob models is quite hard and it will probably take you a while to be able to do it right. So I am now going to explain (at the best I can) how to make custom mob models so bear with me through this tutorial.
[size=large]Starting[/size]
First you have to create a function for the costum model like this:
function addMobToRenderer(renderer) {
}
Then you have to put this inside the function:
var model = renderer.getModel();
That gets the model.
So now what you have is this:
function addMobToRenderer(renderer) {
var model = renderer.getModel();
}
[size=large]Model Parts[/size]
Next you get the model parts of the model and turn them into variables. The current model parts are: head, body, rightArm, LeftArm, rightLeg and leftLeg. So we would have this:
function addMobToRenderer(renderer) {
var model = renderer.getModel();
var bipedBody = model.getPart("body");
var bipedLeg = model.getPart("rightLeg");
var bipedLeg2 = model.getPart("leftLeg");
var bipedhead = model.getPart("head");
var bipedarm = model.getPart("rightArm");
var bipedarm2 = model.getPart("leftArm");
}
Then you can delete/clear a body part by putting a .clear() at the end of getting the body part so if you cleared all the body parts it would look like this:
function addMobToRenderer(renderer) {
var model = renderer.getModel();
var bipedBody = model.getPart("body").clear();
var bipedLeg = model.getPart("rightLeg").clear();
var bipedLeg2 = model.getPart("leftLeg").clear();
var bipedhead = model.getPart("head").clear();
var bipedarm = model.getPart("rightArm").clear();
var bipedarm2 = model.getPart("leftArm").clear();
}
[size=large]Add Box[/size]
Next to create your model, you need to add boxes. boxes are squares or rectangels that you can add to the model at any size or location on the model to any body part.
to add boxes put the variable for a body part then put .addBox(x, y, z, x, y, z, scale);. The paremeters for the first x, y, z is the location of where the box is on the model. So changing x will move the box side to side(adding will make it go to the left and subtracting will make it go to the right I think), changing y will move it up and down(adding will make it go down and subracting will make it go up), and z will move it front and back(adding will make it go back and subtracting will make it go foward). The other x, y, z is for the size of the box. x will make the length longer or shorter, y will make the height longer or shorter and z will make the width longer or shorter. moving the location or increasing the size of a box is measured in minecraft pixels. If you want to move your box or increase your boxes size by less than a pixel, than just use decimels after the number. The last paremeter is the scale, which to be honest I have no idea what it does so if you want my advice just put 0 there or do not add that paremeter at all. Here is a example of adding a box:
bipedBody.addBox(1.0, -4.5, -3.0, 15, 10, 15, 0);
What I just did there was add a box to the body,move it 1 pixel to the right, 4.5 pixels up, and 3 pixels foward. The sixe of the box was 15 pixels for the length, 10 pixels for the height, and 15 pixels for the width. The box is at a scale of 0.
[size=large]SetTextureOffset[/size]
Next is .setTextureOffset(x, y); What this does is set the part of the texture used which a model part will use. x will move the part of the texture used from side to side. y will move the part of the texture used up and down. This image shows where the box we added before will get its texture from without doing anything with the texture offset(sorry the image is small):
(T=top, B=bottom, L=left, R=right, F=front, B2=back)
But by adding this:
bipedBody.setTextureOffset(7, 4);
Will make the box get its texture from here:
Normaly, when using setTextureOffset, it would set the texture offset for all the boxes in the model part. But if you want to set a different texture offset for a box you can set the texture offset after the box before the box you wanted a different texture offset for. E.g. lets say you have this:
This will only make the texture offset of the first box (35, 5); and make the second one (12, 7);. You set the texture offset for any boxes in any model part.
[size=large]SetRotationPoint[/size]
.setRotatationPoint(x, y, z); sets the the anchor point of the model part/box. This can be used so that boxes do not move around irregularly when the mob moves them. x, y, z is where the rotation point is in the model. Again when moving the rotation point, it will be moved in minecraft pixels. An example of using .setRotationPoint:
bipedLeg.setRotationPoint(1.0, 0.5, 2.0);
This sets the rotation point 1 pixel to the right, 0.5 pixels back and 2 pixels foward. The same method used to set the texture offset of a indvisual box rather than the whole model part can also be used with the rotation point. You can set the rotation point for any boxes in any model part, but I doubt it would affect much when used on the body.
[size=large]SetTextureSize[/size]
.setTextureSize(length, height); is bugged and should not be used.
[size=large]Model Base[/size]
After you have created your model function you have to create a variable that equals a base model. Currently the only usable base model is the humanoid/player model so you have to do(outside of the function):
var Renderer = Renderer.createHumanoidRenderer();
Then you have to merge that variable with the function you made so if your function was called addMobToRenderer you would do:
var Renderer = Renderer.createHumanoidRenderer();
addMobToRenderer(Renderer);
Spawning
[size=medium]When you spawn the mob you have to use Entity.setRenderType(entity, render); You put the entity in the entity paremeter and in the render paremeter you put the variable you made before plus .renderType after it so for a example:[/size]
[size=large]Example[/size]
Now for the example. I made a model of a mob I made up called the "Demon Golem" heres what it looks like:
And heres the code(To get the spawn egg type in the chat "/DemonGolem spawner":
ModPE.setItem(397, "spawn_egg", 0, "Spawn Demon Golem");//sets a item
ModPE.overrideTexture("images/mob/DemonGolem.png"," http://i.imgur.com/hbbsosz.png");//downloads the texture
var DemonGolem;//a global variable
function addDemonGolemToRenderer(renderer) {//the model function
var model = renderer.getModel();//creates a new variable to get the model
var bipedBody = model.getPart("body").clear();//a variable gets the body and clears it
bipedBody.setTextureOffset(3, 6);//sets the texture offset for the body
bipedBody.addBox(-5.0, -3.0, 0.0, 15, 18, 8, 0);//the body
bipedBody.setTextureOffset(1, 1);//sets the texture offset for the head(I made the head part of the body)
bipedBody.addBox(-1.0, -1.0, -4.0, 7, 8, 4, 0);//the head
bipedBody.setTextureOffset(59, 0);//set the texture offset for the horns
//the bottom part of the horns
bipedBody.addBox(0.0, -4.0, -3.0, 1, 3, 1);
bipedBody.addBox(3.0, -4.0, -3.0, 1, 3, 1);
//the middle part of the horns
bipedBody.addBox(-1.0, -6.0, -3.0, 1, 3, 1);
bipedBody.addBox(4.0, -6.0, -3.0, 1, 3, 1);
//the top part of the horns
bipedBody.addBox(0.0, -8.0, -3.0, 1, 3, 1);
bipedBody.addBox(3.0, -8.0, -3.0, 1, 3, 1);
var bipedLeg = model.getPart("rightLeg").clear();//a variable that gets the right leg and clears it
bipedLeg.setRotationPoint(-2.0, 2.0, 1.5);//sets the rotation point for the right leg at where the right leg and body meet
bipedLeg.setTextureOffset(45, 16);//sets the texture offset for the right leg
bipedLeg.addBox(-2.0, 2.0, 1.5, 5, 10, 5, 0);//the right leg
var bipedLeg2 = model.getPart("leftLeg").clear();//a variable that gets the left leg and clears it
bipedLeg2.setRotationPoint(2.0, 2.0, 1.5);//sets the rotation point for the left leg at where the left leg and body meet
bipedLeg2.setTextureOffset(45, 16);//sets the texture offset for the left leg
bipedLeg2.addBox(2.0, 2.0, 1.5, 5, 10, 5, 0);//the left leg
var bipedhead = model.getPart("head").clear();//a variable that gets the head and clears it
var bipedarm = model.getPart("rightArm").clear();//a variable that gets the right arm and clears it
bipedarm.setRotationPoint(-4.0, -2.0, 1.5);//sets the rotation point at the top of the right arm
bipedarm.setTextureOffset(40, 0);//sets the texture offset for the right arm
bipedarm.addBox(-4.0, -2.0, 1.5, 4, 26, 4, 0);//the right arm
var bipedarm2 = model.getPart("leftArm").clear();//a variable that gets the left arm and clears it
bipedarm2.setRotationPoint(4.0, -2.0, 1.5);//sets the rotation point at the top of the left arm
bipedarm2.setTextureOffset(40, 0);//sets the texture offset for the left arm
bipedarm2.addBox(4.0, -2.0, 1.5, 4, 26, 4, 0);//the left arm
}
var DemonGolemRenderer = Renderer.createHumanoidRenderer();//creates a variable that equals a humanoid model
addDemonGolemToRenderer(DemonGolemRenderer);//merges the variable with the model function
function useItem(x, y, z, i, b, s){//when a block is tapped
if(i==397){//with item 397
DemonGolem = Level.spawnMob(x, y+1, z,32,"mob/DemonGolem.png");//a variable equals spawning zombie at the location of where the block was tapped with the GolemDemon skin
Entity.setRenderType(DemonGolem, DemonGolemRenderer.renderType);//sets the model of the mob spawned to the custom model
Entity.setNameTag(DemonGolem, "Demon Golem");//gives the mob a nametag cause #yolo
Entity.setHealth(DemonGolem, 70);//sets the mobs health to 70
}
}
function attackHook(a, v){//when something attacks
if(Entity.getMobSkin(v)=="mob/DemonGolem.png"){//if the victim has that mob skin
Level.playSoundEnt(v, "mob.zombiepig.zpigangry", 100, 30);//plays a zpigman sound
}
}
function deathHook(a, v){//when a mob dies
if (Entity.getMobSkin(v)=="mob/DemonGolem.png"){//if the mob has that mob skin
Level.dropItem(Entity.getX(v),Entity.getY(v),Entity.getZ(v),1,10,2);//drops some fire and lava
Level.dropItem(Entity.getX(v),Entity.getY(v),Entity.getZ(v),1,51,2);
}
}
function modTick(){//every 1/20 of a second
//makes the paricles appear
Level.addParticle(ParticleType.lava, Entity.getX(DemonGolem)-0.2 , Entity.getY(DemonGolem)+1, Entity.getZ(DemonGolem), 0, 0, 0, 2);
Level.addParticle(ParticleType.lava, Entity.getX(DemonGolem) , Entity.getY(DemonGolem), Entity.getZ(DemonGolem), 0, 0, 0, 2);
Level.addParticle(ParticleType.lava, Entity.getX(DemonGolem)+0.2 , Entity.getY(DemonGolem)+1, Entity.getZ(DemonGolem), 0, 0, 0, 2);
}
function procCmd(c)//when a command is put in
{
var cmd = c.split(" ");
if(cmd[0]=="DemonGolem" && cmd[1]=="spawner")//the player types "/GolemDemon spawner
{
//give you the spawner
Player.addItemInventory(397,1);
clientMessage("You were given a Demon Golem spawn egg!");
}
}
I would have put more functionality to the mob, but I am teaching you guys how to model mobs, not create thier AI.
[size=large]End[/size]
This is the end of the tutorial. If you have any questions feel free to ask them. If I made any mistakes tell me. If this helped you please press the green button on the side to support me thank you!
Awesome! +1 This will help alot of people (and reduce the amount sending me PM's for help :P)
Im going to be putting up a video of a custom mob model tutorial ^-^
Awesome! +1 This will help alot of people (and reduce the amount sending me PM's for help )
Im going to be putting up a video of a custom mob model tutorial ^-^
Yeah I made the tut because a bunch of people asked me too. Good luck on the video!
The whole thing XD.
Not what you put, just the API in general. But, before I knew Javascript I would look at it and say "what the heck is this" and now it's second nature. I will get used to the API but it might take a while. This will make it *that* much easier.
Rollback Post to RevisionRollBack
Willing to work on Android apps or multi-platform games, see profile bio for information.
The whole thing XD.
Not what you put, just the API in general. But, before I knew Javascript I would look at it and say "what the heck is this" and now it's second nature. I will get used to the API but it might take a while. This will make it *that* much easier.
The whole thing XD.
Not what you put, just the API in general. But, before I knew Javascript I would look at it and say "what the heck is this" and now it's second nature. I will get used to the API but it might take a while. This will make it *that* much easier.
I agree. This thing is very confusing to me. +1 for letting me know whats new
Make sure you follow me on twitter! @DarkDiaMiner IF I post a mod download it and give me a +1 if you appreciate.
Make sure you give me a suggestion at my WIP topic darkPE
Make sure you click on that +1 button if I help you! ---------------->
I got it all except I'm pretty sure setRotationPoint doesnt work. I have the right syntax but it doesn't seem to change anythingAlso this is a great tutorial
People have been asking for a tutorial for custom mob modeling, so I decided to make one. Though first off I would like to say that making costum mob models is quite hard and it will probably take you a while to be able to do it right. So I am now going to explain (at the best I can) how to make custom mob models so bear with me through this tutorial.
[size=large]Starting[/size]
First you have to create a function for the costum model like this:
Then you have to put this inside the function:
That gets the model.
So now what you have is this:
[size=large]Model Parts[/size]
Next you get the model parts of the model and turn them into variables. The current model parts are: head, body, rightArm, LeftArm, rightLeg and leftLeg. So we would have this:
Then you can delete/clear a body part by putting a .clear() at the end of getting the body part so if you cleared all the body parts it would look like this:
[size=large]Add Box[/size]
Next to create your model, you need to add boxes. boxes are squares or rectangels that you can add to the model at any size or location on the model to any body part.
to add boxes put the variable for a body part then put .addBox(x, y, z, x, y, z, scale);. The paremeters for the first x, y, z is the location of where the box is on the model. So changing x will move the box side to side(adding will make it go to the left and subtracting will make it go to the right I think), changing y will move it up and down(adding will make it go down and subracting will make it go up), and z will move it front and back(adding will make it go back and subtracting will make it go foward). The other x, y, z is for the size of the box. x will make the length longer or shorter, y will make the height longer or shorter and z will make the width longer or shorter. moving the location or increasing the size of a box is measured in minecraft pixels. If you want to move your box or increase your boxes size by less than a pixel, than just use decimels after the number. The last paremeter is the scale, which to be honest I have no idea what it does so if you want my advice just put 0 there or do not add that paremeter at all. Here is a example of adding a box:
What I just did there was add a box to the body,move it 1 pixel to the right, 4.5 pixels up, and 3 pixels foward. The sixe of the box was 15 pixels for the length, 10 pixels for the height, and 15 pixels for the width. The box is at a scale of 0.
[size=large]SetTextureOffset[/size]
Next is .setTextureOffset(x, y); What this does is set the part of the texture used which a model part will use. x will move the part of the texture used from side to side. y will move the part of the texture used up and down. This image shows where the box we added before will get its texture from without doing anything with the texture offset(sorry the image is small):
(T=top, B=bottom, L=left, R=right, F=front, B2=back)
But by adding this:
Will make the box get its texture from here:
Normaly, when using setTextureOffset, it would set the texture offset for all the boxes in the model part. But if you want to set a different texture offset for a box you can set the texture offset after the box before the box you wanted a different texture offset for. E.g. lets say you have this:
And you wanted the second box added to have a texture offset of (12, 7); instead of (32, 5); then you do this:
This will only make the texture offset of the first box (35, 5); and make the second one (12, 7);. You set the texture offset for any boxes in any model part.
[size=large]SetRotationPoint[/size]
.setRotatationPoint(x, y, z); sets the the anchor point of the model part/box. This can be used so that boxes do not move around irregularly when the mob moves them. x, y, z is where the rotation point is in the model. Again when moving the rotation point, it will be moved in minecraft pixels. An example of using .setRotationPoint:
This sets the rotation point 1 pixel to the right, 0.5 pixels back and 2 pixels foward. The same method used to set the texture offset of a indvisual box rather than the whole model part can also be used with the rotation point. You can set the rotation point for any boxes in any model part, but I doubt it would affect much when used on the body.
[size=large]SetTextureSize[/size]
.setTextureSize(length, height); is bugged and should not be used.
[size=large]Model Base[/size]
After you have created your model function you have to create a variable that equals a base model. Currently the only usable base model is the humanoid/player model so you have to do(outside of the function):
Then you have to merge that variable with the function you made so if your function was called addMobToRenderer you would do:
Spawning
[size=medium]When you spawn the mob you have to use Entity.setRenderType(entity, render); You put the entity in the entity paremeter and in the render paremeter you put the variable you made before plus .renderType after it so for a example:[/size]
[/size]
[size=large]Example[/size]
Now for the example. I made a model of a mob I made up called the "Demon Golem" heres what it looks like:
And heres the code(To get the spawn egg type in the chat "/DemonGolem spawner":
[size=large]End[/size]
This is the end of the tutorial. If you have any questions feel free to ask them. If I made any mistakes tell me. If this helped you please press the green button on the side to support me thank you!
Link:
http://www.minecraft.../#entry29816329
Awesome! +1 This will help alot of people (and reduce the amount sending me PM's for help :P)
Im going to be putting up a video of a custom mob model tutorial ^-^
Check out my game! It's an open-world, sandbox text adventure.
Follow @hexdro_
Hexdro © 2012-2015
Yeah I made the tut because a bunch of people asked me too. Good luck on the video!
Link:
http://www.minecraft.../#entry29816329
Willing to work on Android apps or multi-platform games, see profile bio for information.
Founder and CEO of Temena Development
Twitter: @TemenaPE
Instagram: @ItsLiterallyMath
Thank you! Does anything seem confusing?
Link:
http://www.minecraft.../#entry29816329
The whole thing XD.
Not what you put, just the API in general. But, before I knew Javascript I would look at it and say "what the heck is this" and now it's second nature. I will get used to the API but it might take a while. This will make it *that* much easier.
Willing to work on Android apps or multi-platform games, see profile bio for information.
Founder and CEO of Temena Development
Twitter: @TemenaPE
Instagram: @ItsLiterallyMath
Ok then ask any questions if you have any
Link:
http://www.minecraft.../#entry29816329
Thanks
Link:
http://www.minecraft.../#entry29816329
I agree. This thing is very confusing to me. +1 for letting me know whats new
IF I post a mod download it and give me a +1 if you appreciate.
Make sure you give me a suggestion at my WIP topic darkPE
Make sure you click on that +1 button if I help you! ---------------->
I dont know. Maybe it could be a new mod?
That has nothing to do with models
Dang it I tried my best to make it simplified! This isnt that hard!
Link:
http://www.minecraft.../#entry29816329
Thanks and setRotationPoint doesnt work properly for me sometimes too so I guess 500ise has to gix it up a bit.
Link:
http://www.minecraft.../#entry29816329
Create a texture, name it, put it in a texturepack, when spawning a mob set its skin it to that skin.
Link:
http://www.minecraft.../#entry29816329
Yeah
I think he means the API. I could be wrong but I am pretty sure that's what he means. The tutorial is good.
Willing to work on Android apps or multi-platform games, see profile bio for information.
Founder and CEO of Temena Development
Twitter: @TemenaPE
Instagram: @ItsLiterallyMath
Oh I see. yeah the API should have been a little easier to use.
Link:
http://www.minecraft.../#entry29816329
Yeah, but programming is programming. Not all of it can be easy.
Willing to work on Android apps or multi-platform games, see profile bio for information.
Founder and CEO of Temena Development
Twitter: @TemenaPE
Instagram: @ItsLiterallyMath