use of net.minecraft.client.model.ModelBase in project ImmersiveEngineering by BluSunrize.
the class RailcraftHelper method postInit.
@Override
public void postInit() {
if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT) {
try {
Class c_CartModelManager = Class.forName("mods.railcraft.client.render.carts.CartModelManager");
Field f_modelMinecart = c_CartModelManager.getDeclaredField("modelMinecart");
f_modelMinecart.setAccessible(true);
Field modifiersField = Field.class.getDeclaredField("modifiers");
modifiersField.setAccessible(true);
modifiersField.set(f_modelMinecart, f_modelMinecart.getModifiers() & ~Modifier.FINAL);
ModelMinecart wrapped = (ModelMinecart) f_modelMinecart.get(null);
f_modelMinecart.set(null, new ModelShaderMinecart(wrapped));
modifiersField.set(f_modelMinecart, f_modelMinecart.getModifiers() | Modifier.FINAL);
Field f_modelsCore = c_CartModelManager.getDeclaredField("modelsCore");
Map<Class, ModelBase> modelMap = (Map<Class, ModelBase>) f_modelsCore.get(null);
for (Map.Entry<Class, ModelBase> e : modelMap.entrySet()) if (e.getValue().getClass().getName().endsWith("ModelLowSidesMinecart"))
e.setValue(new ModelShaderLowSidesMinecart());
ShaderCaseMinecart.invalidMinecartClasses.add((Class<? extends EntityMinecart>) Class.forName("mods.railcraft.common.carts.EntityLocomotive"));
ShaderCaseMinecart.invalidMinecartClasses.add((Class<? extends EntityMinecart>) Class.forName("mods.railcraft.common.carts.EntityTunnelBore"));
} catch (Exception e) {
e.printStackTrace();
}
}
}
use of net.minecraft.client.model.ModelBase in project Railcraft by Railcraft.
the class CartModelManager method getCoreModel.
public static ModelBase getCoreModel(Class eClass) {
ModelBase render = modelsCore.get(eClass);
if (render == null && eClass != EntityMinecart.class) {
render = getCoreModel(eClass.getSuperclass());
modelsCore.put(eClass, render);
}
return render != null ? render : modelMinecart;
}
use of net.minecraft.client.model.ModelBase in project Railcraft by Railcraft.
the class CartModelRenderer method render.
public boolean render(ICartRenderer renderer, EntityMinecart cart, float light, float time) {
OpenGL.glPushMatrix();
OpenGL.glScalef(-1F, -1F, 1.0F);
renderer.bindTex(cart);
ModelBase core = CartModelManager.getCoreModel(cart.getClass());
core.render(cart, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
OpenGL.glPopMatrix();
return true;
}
Aggregations