use of net.minecraft.client.renderer.block.statemap.IStateMapper in project MinecraftForge by MinecraftForge.
the class ForgeBlockStatesLoaderDebug method preInitClient.
@SideOnly(Side.CLIENT)
public void preInitClient(FMLPreInitializationEvent event) {
//ModelLoader.setCustomStateMapper(blockCustom, new StateMap.Builder().withName(CustomMappedBlock.VARIANT).build());
ModelLoader.setCustomStateMapper(BLOCKS.custom_wall, new IStateMapper() {
StateMap stateMap = new StateMap.Builder().withName(BlockWall.VARIANT).withSuffix("_wall").build();
@Override
public Map<IBlockState, ModelResourceLocation> putStateModelLocations(Block block) {
Map<IBlockState, ModelResourceLocation> map = (Map<IBlockState, ModelResourceLocation>) stateMap.putStateModelLocations(block);
Map<IBlockState, ModelResourceLocation> newMap = Maps.newHashMap();
for (Entry<IBlockState, ModelResourceLocation> e : map.entrySet()) {
ModelResourceLocation loc = e.getValue();
newMap.put(e.getKey(), new ModelResourceLocation(ASSETS + loc.getResourcePath(), loc.getVariant()));
}
return newMap;
}
});
ModelLoader.setCustomModelResourceLocation(ITEMS.custom_wall, 0, new ModelResourceLocation(ASSETS + "cobblestone_wall", "inventory"));
ModelLoader.setCustomModelResourceLocation(ITEMS.custom_wall, 1, new ModelResourceLocation(ASSETS + "mossy_cobblestone_wall", "inventory"));
}
use of net.minecraft.client.renderer.block.statemap.IStateMapper in project BiomesOPlenty by Glitchfiend.
the class ClientProxy method registerBlockSided.
@Override
public void registerBlockSided(Block block) {
if (block instanceof IBOPBlock) {
IBOPBlock bopBlock = (IBOPBlock) block;
// Register non-rendering properties
IProperty[] nonRenderingProperties = bopBlock.getNonRenderingProperties();
if (nonRenderingProperties != null) {
// use a custom state mapper which will ignore the properties specified in the block as being non-rendering
IStateMapper custom_mapper = (new StateMap.Builder()).ignore(nonRenderingProperties).build();
ModelLoader.setCustomStateMapper(block, custom_mapper);
}
// Register colour handlers
if (bopBlock.getBlockColor() != null || bopBlock.getItemColor() != null) {
blocksToColour.add(block);
}
}
}
Aggregations