i have a couple of questions about techne, i have only just started using it.
Question 1:
how do you calculate the pixels X pixels coords for your mob, such as, this cube is X by Y pixels.
Question 2:
is there any way to generate the render**** class? as in RenderNameHere, techne didn't seem to generate it, and i have no idea how to handwrite it.
Rollback Post to RevisionRollBack
Free + Crabs + Ability to trample/suffocate opponents in Cortex Command = Free Bombs.
As useful as Techne is, it still leaves alot of work to be done. To top it off there seem to be alot of techne tutorials out there that show nothing helpful, and leave you with a stiff unanimated mob. I managed to figure it all out on my own, and can say for sure 9/10 people making techne tutorials DO NOT know how to make custom mobs. I will try to help you, as I know it can be frustrating.
1) The dimensions you specify for your cube say 2x2x2 will take the texture mapping you create, the actual pixel-to-size will depend on scaling and the size of your texture map. Best way to 'count' it would be to write down your cube dimensions, then open the texture map and count the pixels. Though I'm not sure why you want to. If you are trying to make your mob have more pixels, (HD of sorts) you simply use a large texture map and large cubes, then shrink both back down to the intended size using scaling. This will result in a small or normal size mob that has 2-3 times as many pixels, good for detailed mobs.
2) As for the render file, you can use a pre-existing one, I usually use RenderCow as it has what you need and nothing extra, just rename the renders to your entity's name.
Below is the render file I use for my custom-model mob, I have added Open GL functions to use for scaling the mob, although they are not required. Note: This code was last tested in MC v1.24, though I bet it will work in v1.25 or need only minimal changes.
Render Example
package net.minecraft.src;
import org.lwjgl.opengl.GL11;
public class RenderExampleH extends RenderLiving
{
/**
*
* Most of this file came from RenderCow.
* Added GL11 scaling functions at end, to allow scaling of the custom mob.
* Remember, if you scale your mob, you will also need to adjust the bounding box
* value to match. Look in the mob's Entity class for 'setSize'.
*
*/
public RenderExampleH(ModelBase par1ModelBase, float par2)
{
super(par1ModelBase, par2);
}
public void renderMyExample(EntityExampleH par1EntityExampleH, double par2, double par4, double par6, float par8, float par9)
{
super.doRenderLiving(par1EntityExampleH, par2, par4, par6, par8, par9);
}
public void doRenderLiving(EntityLiving par1EntityLiving, double par2, double par4, double par6, float par8, float par9)
{
renderMyExample((EntityExampleH)par1EntityLiving, par2, par4, par6, par8, par9);
}
public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
{
renderMyExample((EntityExampleH)par1Entity, par2, par4, par6, par8, par9);
}
// Added these two functions, to allow for scaling.
protected void preRenderScale(EntityExampleH par1EntityExampleH, float par2)
{
// These values are x,y,z scale. Where 1.0F = 100%
GL11.glScalef(1.0F, 1.0F, 1.0F);
}
protected void preRenderCallback(EntityLiving par1EntityLiving, float par2)
{
preRenderScale((EntityExampleH)par1EntityLiving, par2);
}
}
If you have any more techne questions, let me know and I'll try to help.
ok, thank you, i was worried that, my texturemap size was 64X128, and it would be too small/too big for my mob.
Rendering it is gonna be a pain, especially since i haven't set up eclipse properly so it doesn't actually have the lwgjl jars with it. Plus my mob has a trunk plus two ears (i know you've probably already figured out that it's an elephant), so i have no idea how that would come out as rendered.
Rollback Post to RevisionRollBack
Free + Crabs + Ability to trample/suffocate opponents in Cortex Command = Free Bombs.
ok, thank you, i was worried that, my texturemap size was 64X128, and it would be too small/too big for my mob.
Rendering it is gonna be a pain, especially since i haven't set up eclipse properly so it doesn't actually have the lwgjl jars with it. Plus my mob has a trunk plus two ears (i know you've probably already figured out that it's an elephant), so i have no idea how that would come out as rendered.
Doesnt matter with shape- errors there, if using the code give, would not put out model issues since the render file only calls for the renderliving super class to draw boxes based on the model file
The render file, does just that, it renders the mob model no real need to change anything for different mobs cows,elephant,human can all be rendered by RenderCow or the version I posted above. Simply rename the functions and model calls to names matching your entity.
The file that requires alot of work is the file that Techne creates, this is the Model file, which sets the dimensions/textures and animations that are rendered by the Render file. In the model file you will have to add and edit quite a bit of code, though like the render file you can use pre-existing Model code altered for your uses. If you are making an elephant, it will be using 'almost' identical code to that found in ModelQuadruped, which is used for the pig/sheep/cow.
Here is a working/finished example Model file, it should help you see what code you need to alter. This is for a human (well a robot) but it doesn't matter as you would be entering your own model parts anyways, the important thing is that is shows proper animation and rotation of 'new' parts not found in MC.
Example Model
package net.minecraft.src;
import org.lwjgl.opengl.GL11;
public class ModelExampleG extends ModelBase
{
/**
*
* This Custom Model extends the ModelBase, as it is a unique model.
* Added GL11 Child scaling methods found in ModelQuadruped, and
* customized it so child has proper sized head. (no big heads)
*
*/
ModelRenderer rightAntenna;
ModelRenderer leftAntenna;
ModelRenderer scanner;
ModelRenderer head;
ModelRenderer body;
ModelRenderer neck;
ModelRenderer rightShoulder;
ModelRenderer leftShoulder;
ModelRenderer rightArm;
ModelRenderer leftArm;
ModelRenderer waist;
ModelRenderer waist2;
ModelRenderer legAxle;
ModelRenderer rightLeg;
ModelRenderer leftLeg;
public ModelExampleG()
{
textureWidth = 64;
textureHeight = 32;
rightAntenna = new ModelRenderer(this, 18, 4);
rightAntenna.addBox(0.5F, -5F, 0F, 1, 2, 1);
rightAntenna.setRotationPoint(0F, -1.5F, 0F);
rightAntenna.mirror = true;
setRotation(rightAntenna, 0F, 0F, -0.6981317F); //-0.6981317F (-40 degrees)
leftAntenna = new ModelRenderer(this, 18, 4);
leftAntenna.addBox(-1.5F, -5F, 0F, 1, 2, 1);
leftAntenna.setRotationPoint(0F, -1.5F, 0F);
leftAntenna.mirror = true;
setRotation(leftAntenna, 0F, 0F, 0.6981317F); //0.6981317F (40 degrees)
scanner = new ModelRenderer(this, 27, 25);
scanner.addBox(-2.5F, -3F, -2.5F, 5, 1, 2);
scanner.setRotationPoint(0F, -1.5F, 0F);
scanner.mirror = true;
setRotation(scanner, 0F, 0F, 0F);
head = new ModelRenderer(this, 0, 0);
head.addBox(-2F, -4F, -2F, 4, 4, 4);
head.setRotationPoint(0F, -1.5F, 0F);
head.mirror = false;
setRotation(head, 0F, 0F, 0F);
body = new ModelRenderer(this, 0, 20);
body.addBox(-3F, 0F, -3F, 6, 6, 6);
body.setRotationPoint(0F, 0F, 0F);
body.mirror = false;
neck = new ModelRenderer(this, 0, 8);
neck.addBox(-1F, -2F, -1F, 2, 2, 2);
neck.setRotationPoint(0F, 0F, 0F);
neck.mirror = false;
rightShoulder = new ModelRenderer(this, 0, 13);
rightShoulder.addBox(-3F, -1F, -2F, 4, 2, 4);
rightShoulder.setRotationPoint(-3F, 0.5F, 0F);
rightShoulder.mirror = true;
setRotation(rightShoulder, 0F, 0F, -0.1396263F);
leftShoulder = new ModelRenderer(this, 0, 13);
leftShoulder.addBox(-1F, -1F, -2F, 4, 2, 4);
leftShoulder.setRotationPoint(3F, 0.5F, 0F);
leftShoulder.mirror = true;
setRotation(leftShoulder, 0F, 0F, 0.1396263F);
rightArm = new ModelRenderer(this, 46, 20);
rightArm.addBox(-1F, 0F, -1F, 2, 9, 2);
rightArm.setRotationPoint(-4.4F, 0.5F, 0F);
rightArm.mirror = true;
//setRotation(rightArm, 0F, 0F, 0F);
leftArm = new ModelRenderer(this, 46, 20);
leftArm.addBox(-1F, 0F, -1F, 2, 9, 2);
leftArm.setRotationPoint(4.4F, 0.5F, 0F);
leftArm.mirror = true;
//setRotation(leftArm, 0F, 0F, 0F);
waist = new ModelRenderer(this, 24, 0);
waist.addBox(-2.5F, 0F, -2.5F, 5, 4, 5);
waist.setRotationPoint(0F, 6F, 0F);
waist.mirror = false;
waist2 = new ModelRenderer(this, 27, 10);
waist2.addBox(-1.5F, 0F, -2F, 3, 4, 4);
waist2.setRotationPoint(0F, 10F, 0F);
waist2.mirror = false;
legAxle = new ModelRenderer(this, 28, 19);
legAxle.addBox(-2F, -1F, -1F, 4, 2, 2);
legAxle.setRotationPoint(0F, 12F, 0F);
legAxle.mirror = false;
rightLeg = new ModelRenderer(this, 55, 16);
rightLeg.addBox(-2F, -1F, -1F, 2, 13, 2);
rightLeg.setRotationPoint(-2F, 12F, 0F);
rightLeg.mirror = true;
//setRotation(rightLeg, 0F, 0F, 0F);
leftLeg = new ModelRenderer(this, 55, 16);
leftLeg.addBox(0F, -1F, -1F, 2, 13, 2);
leftLeg.setRotationPoint(2F, 12F, 0F);
leftLeg.mirror = true;
//setRotation(leftLeg, 0F, 0F, 0F);
}
// This render method was copied from ModelQuadruped, and modified to properly scale child.
public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7)
{
// NOTE: When rotating on Z axis set part render to renderWithRotation(par7), used in addition to rotateAngleX/Y.
setRotationAngles(par2, par3, par4, par5, par6, par7);
if (isChild)
{
float f = 2.0F;
GL11.glPushMatrix();
GL11.glScalef(1.0F / f, 1.0F / f, 1.0F / f);
GL11.glTranslatef(0.0F, 24F * par7, 0.0F);
rightAntenna.renderWithRotation(par7);
leftAntenna.renderWithRotation(par7);
scanner.render(par7);
head.render(par7);
body.render(par7);
neck.render(par7);
rightShoulder.render(par7);
leftShoulder.render(par7);
rightArm.render(par7);
leftArm.render(par7);
waist.render(par7);
waist2.render(par7);
legAxle.render(par7);
rightLeg.render(par7);
leftLeg.render(par7);
GL11.glPopMatrix();
}
else
{
rightAntenna.renderWithRotation(par7);
leftAntenna.renderWithRotation(par7);
scanner.render(par7);
head.render(par7);
body.render(par7);
neck.render(par7);
rightShoulder.render(par7);
leftShoulder.render(par7);
rightArm.render(par7);
leftArm.render(par7);
waist.render(par7);
waist2.render(par7);
legAxle.render(par7);
rightLeg.render(par7);
leftLeg.render(par7);
}
}
// Used to define (non animated) rotation of parts. Used for angling parts, like a cape.
private void setRotation(ModelRenderer model, float x, float y, float z)
{
model.rotateAngleX = x;
model.rotateAngleY = y;
model.rotateAngleZ = z;
}
// Defines the rotation of the moving parts of the model (head/arm/legs), and parts that should rotate with them (ears/hands/feet)
public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6)
{
super.setRotationAngles(par1, par2, par3, par4, par5, par6);
/**
* When attaching parts to rotating (animated) parts, they must share common rotateAnglesX/Y, as well as rotationPoint(x,y,x)
* rotateAngleX is forward/backward angle. Example: head looking up/down.
* rotateAngleY is circular rotation. Example: head turning left or right.
* rotateAngleZ is left/right angle. Example: head tilting to the left or right.
* NOTE: To use parts rotated on Z axis, you must set 'partnamehere.renderWithRotation(par7)' in the above render function.
*/
head.rotateAngleY = par4 / (180F / (float)Math.PI);
head.rotateAngleX = par5 / (180F / (float)Math.PI);
rightAntenna.rotateAngleX = head.rotateAngleX;
rightAntenna.rotateAngleY = head.rotateAngleY;
leftAntenna.rotateAngleX = head.rotateAngleX;
leftAntenna.rotateAngleY = head.rotateAngleY;
scanner.rotateAngleX = head.rotateAngleX;
scanner.rotateAngleY = head.rotateAngleY;
rightArm.rotateAngleX = MathHelper.cos(par1 * 0.6662F + (float)Math.PI) * 2.0F * par2 * 0.5F;
leftArm.rotateAngleX = MathHelper.cos(par1 * 0.6662F) * 2.0F * par2 * 0.5F;
rightArm.rotateAngleZ = 0.0F;
leftArm.rotateAngleZ = 0.0F;
rightLeg.rotateAngleX = MathHelper.cos(par1 * 0.6662F) * 1.4F * par2;
leftLeg.rotateAngleX = MathHelper.cos(par1 * 0.6662F + (float)Math.PI) * 1.4F * par2;
rightLeg.rotateAngleY = 0.0F;
leftLeg.rotateAngleY = 0.0F;
}
}
Question 1:
how do you calculate the pixels X pixels coords for your mob, such as, this cube is X by Y pixels.
Question 2:
is there any way to generate the render**** class? as in RenderNameHere, techne didn't seem to generate it, and i have no idea how to handwrite it.
Free + Crabs + Ability to trample/suffocate opponents in Cortex Command = Free Bombs.
1) The dimensions you specify for your cube say 2x2x2 will take the texture mapping you create, the actual pixel-to-size will depend on scaling and the size of your texture map. Best way to 'count' it would be to write down your cube dimensions, then open the texture map and count the pixels. Though I'm not sure why you want to. If you are trying to make your mob have more pixels, (HD of sorts) you simply use a large texture map and large cubes, then shrink both back down to the intended size using scaling. This will result in a small or normal size mob that has 2-3 times as many pixels, good for detailed mobs.
2) As for the render file, you can use a pre-existing one, I usually use RenderCow as it has what you need and nothing extra, just rename the renders to your entity's name.
Below is the render file I use for my custom-model mob, I have added Open GL functions to use for scaling the mob, although they are not required. Note: This code was last tested in MC v1.24, though I bet it will work in v1.25 or need only minimal changes.
Render Example
If you have any more techne questions, let me know and I'll try to help.
Rendering it is gonna be a pain, especially since i haven't set up eclipse properly so it doesn't actually have the lwgjl jars with it. Plus my mob has a trunk plus two ears (i know you've probably already figured out that it's an elephant), so i have no idea how that would come out as rendered.
Free + Crabs + Ability to trample/suffocate opponents in Cortex Command = Free Bombs.
Doesnt matter with shape- errors there, if using the code give, would not put out model issues since the render file only calls for the renderliving super class to draw boxes based on the model file
EDIT: in my ModelElephant code, i found this:
(FLLeg means Front Left Leg) would this help at all?
Free + Crabs + Ability to trample/suffocate opponents in Cortex Command = Free Bombs.
Basicallly the rendering has nothing to do with the model's shape. size and appearance- yes
and then what are you trying to do with the leg?
The file that requires alot of work is the file that Techne creates, this is the Model file, which sets the dimensions/textures and animations that are rendered by the Render file. In the model file you will have to add and edit quite a bit of code, though like the render file you can use pre-existing Model code altered for your uses. If you are making an elephant, it will be using 'almost' identical code to that found in ModelQuadruped, which is used for the pig/sheep/cow.
Here is a working/finished example Model file, it should help you see what code you need to alter. This is for a human (well a robot) but it doesn't matter as you would be entering your own model parts anyways, the important thing is that is shows proper animation and rotation of 'new' parts not found in MC.
Example Model
Screenshot of the mob this Model code creates:
Free + Crabs + Ability to trample/suffocate opponents in Cortex Command = Free Bombs.
{
super.renderFireDrone(entity, f, f1, f2, f3, f4, f5);
setRotationAngles(f, f1, f2, f3, f4, f5);
Head.render(f5);
Left_Foot.render(f5);
Right_Foot.render(f5);
Left_Toe.render(f5);
Right_Toe.render(f5);
Left_Leg.render(f5);
Biggieleft.render(f5);
pinkieleft.render(f5);
Biggieright.render(f5);
pinkieright.render(f5);
Right_Leg.render(f5);
Body.render(f5);
neck.render(f5);
Left_Arm.render(f5);
Right_Arm.render(f5);
Left_Hand.render(f5);
Right_Hand.render(f5);
finger1left.render(f5);
finger3left.render(f5);
finger3right.render(f5);
finger1right.render(f5);
finger2left.render(f5);
finger2right.render(f5);
}
private void setRotation(ModelRenderer model, float x, float y, float z)
{
model.rotateAngleX = x;
model.rotateAngleY = y;
model.rotateAngleZ = z;
}
public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5)
{
super.setRotationAngles(f, f1, f2, f3, f4, f5);
}
}
Also in the above bit of code, I have errors under "super.renderFireDrone" at the top and "super.setRotationAngles" at the bottom.