Jump to content

Recommended Posts

Posted

I think ill have to use EntityAdditionalspawndate fore thevehicleloading before entities are rendered, but still i can't render them out - why? here is my renderer:

 

 

package itsamysterious.mods.reallifemod.core.rendering.Entities;

 

import java.util.HashMap;

import java.util.Map;

 

import org.lwjgl.opengl.GL11;

 

import itsamysterious.mods.reallifemod.client.forgeobjmodelported.AdvancedModelLoader;

import itsamysterious.mods.reallifemod.client.forgeobjmodelported.IModelCustom;

import itsamysterious.mods.reallifemod.core.vehicles.EntityVehicle;

import itsamysterious.mods.reallifemod.core.vehicles.VehicleFile;

import itsamysterious.mods.reallifemod.init.Reference;

import net.minecraft.client.Minecraft;

import net.minecraft.client.renderer.entity.Render;

import net.minecraft.client.renderer.entity.RenderManager;

import net.minecraft.entity.Entity;

import net.minecraft.util.ResourceLocation;

 

public class RenderVehicle extends Render{

private Class<?extends EntityVehicle> entityClass;

private static Map <String,IModelCustom> models = new HashMap<String, IModelCustom>();

private static Map <String,ResourceLocation> textures = new HashMap<String, ResourceLocation>();

VehicleFile f = null;

 

public RenderVehicle(RenderManager renderManager) {

super(renderManager);

shadowSize=1;

}

 

public void doRender(Entity entity, double x, double y, double z, float p_76986_8_, float partialTicks) {

if(entity.getClass().isInstance(EntityVehicle.class)){

renderVehicle((EntityVehicle)entity, x, y, z, p_76986_8_, partialTicks);

}

};

 

private void renderVehicle(EntityVehicle entity, double x, double y, double z, float p_76986_8_,

float partialTicks) {

if(f==null){

f=entity.file;

return;

}

if(f==null) entity.setDead();

//Minecraft.getMinecraft().renderEngine.bindTexture(getEntityTexture(entity));

GL11.glPushMatrix();

GL11.glTranslated(x, y, z);

GL11.glRotated(entity.rotationYaw, 0, 1, 0);

GL11.glRotated(entity.rotationPitch, 1, 0, 0);

GL11.glPushMatrix();

getmodel(f).renderPart(f.modelName);

GL11.glPopMatrix();

//Rearaxis

GL11.glPushMatrix();

GL11.glRotated(entity.backWheelRotation, 1, 0, 0);

GL11.glTranslated(f.wheelPosBack.x+f.wheelPosLeft.x, f.wheelPosBack.y, f.wheelPosBack.z);

getmodel(f).renderPart(f.wheelsName);

GL11.glPopMatrix();

 

//Frontwheel L

GL11.glPushMatrix();

GL11.glRotated(entity.wheelRotL, 1, 0, 0);

GL11.glTranslated(f.wheelPosLeft.x, f.wheelPosLeft.y, f.wheelPosLeft.z);

getmodel(f).renderPart(f.wheelsName);

GL11.glPopMatrix();

 

//Frontwheel R

GL11.glPushMatrix();

GL11.glRotated(entity.wheelRotL, 1, 0, 0);

GL11.glTranslated(f.wheelPosLeft.x, f.wheelPosLeft.y, f.wheelPosLeft.z);

getmodel(f).renderPart(f.wheelsName);

GL11.glPopMatrix();

 

//

GL11.glPopMatrix();

}

 

private IModelCustom getmodel(VehicleFile f) {

return models.get(f.vehicleName);

}

 

@Override

protected ResourceLocation getEntityTexture(Entity entity) {

if(entity instanceof EntityVehicle){

VehicleFile f = ((EntityVehicle)entity).file;

if(f==null){

return null;

}

return textures.get(f.vehicleName);

}else

return null;

}

 

public static void registerModel(VehicleFile f){

models.put(f.vehicleName, AdvancedModelLoader.loadModel(new ResourceLocation("reallifemod:models/vehicle/"+f.fileName+".obj")));

textures.put(f.vehicleName, new ResourceLocation("reallifemod:textures/vehicle/"+f.textureName+".png"));

}

 

}

 

 

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.