use of gregtech.client.model.modelfactories.BakedModelHandler in project GregTech by GregTechCEu.
the class MetaBlocks method registerStateMappers.
@SideOnly(Side.CLIENT)
public static void registerStateMappers() {
ModelLoader.setCustomStateMapper(MACHINE, new SimpleStateMapper(MetaTileEntityRenderer.MODEL_LOCATION));
IStateMapper normalStateMapper = new SimpleStateMapper(CableRenderer.INSTANCE.getModelLocation());
for (BlockCable cable : CABLES) {
ModelLoader.setCustomStateMapper(cable, normalStateMapper);
}
normalStateMapper = new SimpleStateMapper(FluidPipeRenderer.INSTANCE.getModelLocation());
for (BlockFluidPipe pipe : FLUID_PIPES) {
ModelLoader.setCustomStateMapper(pipe, normalStateMapper);
}
normalStateMapper = new SimpleStateMapper(ItemPipeRenderer.INSTANCE.getModelLocation());
for (BlockItemPipe pipe : ITEM_PIPES) {
ModelLoader.setCustomStateMapper(pipe, normalStateMapper);
}
normalStateMapper = new SimpleStateMapper(BlockSurfaceRock.MODEL_LOCATION);
for (BlockSurfaceRock surfaceRock : new HashSet<>(SURFACE_ROCK.values())) {
ModelLoader.setCustomStateMapper(surfaceRock, normalStateMapper);
}
normalStateMapper = new StateMapperBase() {
@Nonnull
@Override
protected ModelResourceLocation getModelResourceLocation(@Nonnull IBlockState state) {
return new ModelResourceLocation(Block.REGISTRY.getNameForObject(state.getBlock()), "normal");
}
};
ModelLoader.setCustomStateMapper(FOAM, normalStateMapper);
ModelLoader.setCustomStateMapper(REINFORCED_FOAM, normalStateMapper);
ModelLoader.setCustomStateMapper(PETRIFIED_FOAM, normalStateMapper);
ModelLoader.setCustomStateMapper(REINFORCED_PETRIFIED_FOAM, normalStateMapper);
BakedModelHandler modelHandler = new BakedModelHandler();
MinecraftForge.EVENT_BUS.register(modelHandler);
FLUID_BLOCKS.forEach(modelHandler::addFluidBlock);
ClientRegistry.bindTileEntitySpecialRenderer(MetaTileEntityHolder.class, new MetaTileEntityTESR());
}
Aggregations