Search in sources :

Example 6 with BlockItemPipe

use of gregtech.common.pipelike.itempipe.BlockItemPipe 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

BlockCable (gregtech.common.pipelike.cable.BlockCable)6 BlockFluidPipe (gregtech.common.pipelike.fluidpipe.BlockFluidPipe)6 BlockItemPipe (gregtech.common.pipelike.itempipe.BlockItemPipe)6 Material (gregtech.api.unification.material.Material)4 StoneType (gregtech.api.unification.ore.StoneType)3 GTValues (gregtech.api.GTValues)2 GregTechAPI (gregtech.api.GregTechAPI)2 BlockMachine (gregtech.api.block.machines.BlockMachine)2 MachineItemBlock (gregtech.api.block.machines.MachineItemBlock)2 Materials (gregtech.api.unification.material.Materials)2 FluidPipeProperties (gregtech.api.unification.material.properties.FluidPipeProperties)2 PropertyKey (gregtech.api.unification.material.properties.PropertyKey)2 OrePrefix (gregtech.api.unification.ore.OrePrefix)2 SimpleStateMapper (gregtech.client.model.SimpleStateMapper)2 BakedModelHandler (gregtech.client.model.modelfactories.BakedModelHandler)2 MetaTileEntityTESR (gregtech.client.renderer.handler.MetaTileEntityTESR)2 BlockFoam (gregtech.common.blocks.foam.BlockFoam)2 BlockPetrifiedFoam (gregtech.common.blocks.foam.BlockPetrifiedFoam)2 BlockGregPlanks (gregtech.common.blocks.wood.BlockGregPlanks)2 BlockRubberLeaves (gregtech.common.blocks.wood.BlockRubberLeaves)2