use of net.minecraft.client.model.ModelMinecart 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();
}
}
}
Aggregations