ModInitializerClient.java 文件源码

java
阅读 23 收藏 0 点赞 0 评论 0

项目:CommonUtils 作者:
private void registerVariantBlocks(ProxyModBase proxy) {
    for (InfoBlock block : proxy.blocks) {
        if (!(block instanceof InfoBlockVariant))
            continue;
        InfoBlockVariant blockVar = (InfoBlockVariant) block;
        List<String> variants = Lists.newArrayList();
        for (Object metalObj : blockVar.getVariantProp().getAllowedValues()) {
            IStringSerializable value = (IStringSerializable) metalObj;
            String name = proxy.getModId() + ":" + value.getName() + blockVar.getVariantSuffix();
            variants.add(name);
        }
        ModelBakery.registerItemVariants(Item.getItemFromBlock(block.getBlock()),
                variants.stream().map(ResourceLocation::new).toArray(ResourceLocation[]::new));

        ModelLoader.setCustomStateMapper(block.getBlock(),
                (new StateMap.Builder()).withName(blockVar.getVariantProp())
                        .withSuffix(blockVar.getVariantSuffix())
                        .build());
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号