Hello all, I'm new to entities, modelling, and rendering (though I do know how to mod blocks and items and have a good knowledge of Java). I read about five different tutorials on how to mod custom entities in 1.7 (I'm not going with 1.8 because it's too much hassle for me), but for some reason I simply can't get my entity to render properly. My entity has its own class, it's registered, and it even appeared as a white block before I wrote the rendering class. I made a model in Techne, exported it as Java and a texturemap, put the texturemap under src/main/resources/assets/rendertestmod/textures/entity/drill.png, and fixed up the Java file the way other tutorials said to do it. Then I wrote the rendering class the way the tutorials said, but whenever I summon my entity, I now get an extremely strange pattern of textures floating in the air, that seem to follow me, and definitely don't conform to the shape of the model I made. I'll put the code below.
package com.example.rendertestmod;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
public class ModelDrill extends ModelBase
{
ModelRenderer Base;
ModelRenderer Bit;
public ModelDrill()
{
textureWidth = 64;
textureHeight = 64;
Base = new ModelRenderer(this, 0, 0);
Base.addBox(0F, 0F, 0F, 16, 8, ;
Base.setRotationPoint(-8F, 0F, -4F);
Base.setTextureSize(64, 64);
Base.mirror = true;
setRotation(Base, 0F, 0F, 0F);
Bit = new ModelRenderer(this, 0, 16);
Bit.addBox(-8F, -2F, -2F, 8, 4, 4);
Bit.setRotationPoint(-8F, 4F, 0F);
Bit.setTextureSize(64, 64);
Bit.mirror = true;
setRotation(Bit, 0F, 0F, 0F);
}
public void render(float f5)
{
Base.render(f5);
Bit.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, Entity e)
{
super.setRotationAngles(f, f1, f2, f3, f4, f5, e);
}
}
package com.example.rendertestmod;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;
public class RenderDrill extends Render {
static ModelDrill drill = new ModelDrill();
public RenderDrill() {
// TODO Auto-generated constructor stub
}
@Override
public void doRender(Entity e, double f1,
double f2, double f3, float f4,
float f5) {
GL11.glPushMatrix();
drill.render(.0625F);
GL11.glPopMatrix();
}
@Override
protected ResourceLocation getEntityTexture(Entity p_110775_1_) {
// TODO Auto-generated method stub
return new ResourceLocation("rendertestmod:textures/entity/drill.png");
}
}
package com.example.rendertestmod;
import net.minecraft.entity.Entity;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
public class EntityDrill extends Entity {
public EntityDrill(World w) {
super(w);
// TODO Auto-generated constructor stub
}
@Override
protected void entityInit() {
// TODO Auto-generated method stub
}
@Override
protected void readEntityFromNBT(NBTTagCompound p_70037_1_) {
// TODO Auto-generated method stub
}
@Override
protected void writeEntityToNBT(NBTTagCompound p_70014_1_) {
// TODO Auto-generated method stub
}
}
About the rendering class: I used render(.0625F) because that's what I saw in another code file in another mod. I have no idea what that float argument means. Also, there were no errors during startup even when I changed the texture name to gibberish, so I feel like I might be doing something wrong about the location of the texture, but I don't know what. Sorry if this sounds like a noobish question, and sorry if I wasn't supposed to ask questions about such basic topics on this forum, but the tutorials are not very helpful. I'll post screenshots of my Eclipse setup if you need to see those.
Also, bear in mind that this is just an experiment for me to find out the basics of rendering entities. That's why the entity does nothing except sit there and display its textures to me.