Hey everyone
I've got a small problem with rendering cubes. I have a RenderShot that should render a shot for an EntityShot, and it basically just renders one cube with varying size. Or at least it should.
Here's the code for the renderer:
public class RenderShot extends Render{
private ModelBase model = new ModelBase(){};
private ModelRenderer cubeShot;
public RenderShot(){
model.textureHeight = 32;
model.textureWidth = 64;
cubeShot = new ModelRenderer(model);
cubeShot.addBox(-2F, -2F, -8F, 4, 4, 16);;
cubeShot.setTextureSize(64, 32);
}
@Override
public void doRender(Entity entity, double x, double y, double z, float yaw, float partialTickTime) {
EntityShot shot = (EntityShot)entity;
GL11.glPushMatrix();
GL11.glTranslatef((float)x, (float)y, (float)z);
GL11.glScalef(-1F, -1F, 1F);
Minecraft.getMinecraft().getTextureManager().bindTexture(Textures.Model.ENERGY_SHOT);
//rotation works
cubeShot.rotateAngleX = shot.getRenderPitch();
cubeShot.rotateAngleY = shot.getRenderYaw() - (float)Math.PI * 0.5f;
//also correctly calculated
float scale = 0.0625F * shot.getSizeFactor();
LogHelper.info(scale);
cubeShot.render(scale);
GL11.glPopMatrix();
}
@Override
protected ResourceLocation getEntityTexture(Entity entity) {
return Textures.Model.ENERGY_SHOT;
}
}
The problem is that it doesn't vary the size even though the scale calculation clearly works (I know cause I print it out). It always renders all shots the same size, either max scale(wich is a scale of 0.0625) or min scale (wich is about 0.015). It might switch from min to max or the other way around when I restart the game, but it always renders every shot the same size.
Does anyone have an idea what could cause that?