use of icbm.classic.client.mapper.BlockModelMapperExplosive in project ICBM-Classic by BuiltBrokenModding.
the class ClientReg method registerExBlockRenders.
protected static void registerExBlockRenders() {
for (// TODO run loop once for all 4 content types
IExplosiveData data : // TODO run loop once for all 4 content types
ICBMClassicAPI.EX_BLOCK_REGISTRY.getExplosives()) {
// Add block state
final HashMap<EnumFacing, ModelResourceLocation> facingModelMap = new HashMap<>();
final String resourcePath = data.getRegistryName().getNamespace() + ":explosives/" + data.getRegistryName().getPath();
for (EnumFacing facing : EnumFacing.VALUES) {
facingModelMap.put(facing, new ModelResourceLocation(resourcePath, "explosive=" + data.getRegistryName().toString().replace(":", "_") + ",rotation=" + facing));
}
blockModelMap.put(data, facingModelMap);
// Add item state
// IBlockState state = BlockReg.blockExplosive.getDefaultState().withProperty(BlockICBM.ROTATION_PROP, EnumFacing.UP);
// String properties_string = getPropertyString(state.getProperties());
itemBlockModelMap.put(data, new ModelResourceLocation(resourcePath, "inventory"));
}
// Block state mapper
ModelLoader.setCustomStateMapper(BlockReg.blockExplosive, new BlockModelMapperExplosive(blockModelMap, blockModelMap.get(ICBMExplosives.CONDENSED).get(EnumFacing.UP)));
// Item state mapper
ModelLoader.setCustomMeshDefinition(Item.getItemFromBlock(BlockReg.blockExplosive), new ItemModelMapperExplosive(itemBlockModelMap, itemBlockModelMap.get(ICBMExplosives.CONDENSED)));
ModelBakery.registerItemVariants(Item.getItemFromBlock(BlockReg.blockExplosive), itemBlockModelMap.values().stream().map(mrl -> new ResourceLocation(mrl.getNamespace(), mrl.getPath())).collect(Collectors.toList()).toArray(new ResourceLocation[itemBlockModelMap.values().size()]));
}
Aggregations