Search in sources :

Example 1 with SimpleStateMapper

use of gregtech.client.model.SimpleStateMapper 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());
}
Also used : StateMapperBase(net.minecraft.client.renderer.block.statemap.StateMapperBase) SimpleStateMapper(gregtech.client.model.SimpleStateMapper) BlockItemPipe(gregtech.common.pipelike.itempipe.BlockItemPipe) IBlockState(net.minecraft.block.state.IBlockState) Nonnull(javax.annotation.Nonnull) BlockFluidPipe(gregtech.common.pipelike.fluidpipe.BlockFluidPipe) ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation) BakedModelHandler(gregtech.client.model.modelfactories.BakedModelHandler) IStateMapper(net.minecraft.client.renderer.block.statemap.IStateMapper) MetaTileEntityTESR(gregtech.client.renderer.handler.MetaTileEntityTESR) BlockCable(gregtech.common.pipelike.cable.BlockCable) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Aggregations

SimpleStateMapper (gregtech.client.model.SimpleStateMapper)1 BakedModelHandler (gregtech.client.model.modelfactories.BakedModelHandler)1 MetaTileEntityTESR (gregtech.client.renderer.handler.MetaTileEntityTESR)1 BlockCable (gregtech.common.pipelike.cable.BlockCable)1 BlockFluidPipe (gregtech.common.pipelike.fluidpipe.BlockFluidPipe)1 BlockItemPipe (gregtech.common.pipelike.itempipe.BlockItemPipe)1 Nonnull (javax.annotation.Nonnull)1 IBlockState (net.minecraft.block.state.IBlockState)1 ModelResourceLocation (net.minecraft.client.renderer.block.model.ModelResourceLocation)1 IStateMapper (net.minecraft.client.renderer.block.statemap.IStateMapper)1 StateMapperBase (net.minecraft.client.renderer.block.statemap.StateMapperBase)1 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)1