當前位置: 首頁>>代碼示例>>Java>>正文


Java Block.REGISTRY屬性代碼示例

本文整理匯總了Java中net.minecraft.block.Block.REGISTRY屬性的典型用法代碼示例。如果您正苦於以下問題:Java Block.REGISTRY屬性的具體用法?Java Block.REGISTRY怎麽用?Java Block.REGISTRY使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在net.minecraft.block.Block的用法示例。


在下文中一共展示了Block.REGISTRY屬性的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: initMiningStats

private static void initMiningStats()
{
    for (Block block : Block.REGISTRY)
    {
        Item item = Item.getItemFromBlock(block);

        if (item != Items.field_190931_a)
        {
            int i = Block.getIdFromBlock(block);
            String s = getItemName(item);

            if (s != null && block.getEnableStats())
            {
                BLOCKS_STATS[i] = (new StatCrafting("stat.mineBlock.", s, new TextComponentTranslation("stat.mineBlock", new Object[] {(new ItemStack(block)).getTextComponent()}), item)).registerStat();
                MINE_BLOCK_STATS.add((StatCrafting)BLOCKS_STATS[i]);
            }
        }
    }

    replaceAllSimilarBlocks(BLOCKS_STATS);
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:21,代碼來源:StatList.java

示例2: loadBlocks

protected void loadBlocks()
{
    BlockStateMapper blockstatemapper = this.blockModelShapes.getBlockStateMapper();

    for (Block block : Block.REGISTRY)
    {
        for (final ResourceLocation resourcelocation : blockstatemapper.getBlockstateLocations(block))
        {
            try
            {
                loadBlock(blockstatemapper, block, resourcelocation);
            }
            catch (Exception exception)
            {
                LOGGER.warn((String)("Unable to load definition " + resourcelocation), (Throwable)exception);
            }
        }
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:19,代碼來源:ModelBakery.java

示例3: registerModels

/**
 * Register all Item and Block models from the registry.
 */
public static void registerModels() {
	for (Block block : Block.REGISTRY) {
		if (block instanceof IModelRegister)
			((IModelRegister) block).registerModel();
	}

	for (Item item : Item.REGISTRY) {
		if (item instanceof IModelRegister)
			((IModelRegister) item).registerModel();
	}
}
 
開發者ID:Um-Mitternacht,項目名稱:Bewitchment,代碼行數:14,代碼來源:ModelHandler.java

示例4: registerModels

public static void registerModels() {
	for(Block block : Block.REGISTRY) {
		if(block instanceof IModel)
			((IModel) block).registerModel();
	}

	for(Item item : Item.REGISTRY) {
		if(item instanceof IModel)
			((IModel) item).registerModel();
	}
	Solar.LOG.info("[BAKING CHOCOLATE COOKIES!]");
}
 
開發者ID:ArekkuusuJerii,項目名稱:Solar,代碼行數:12,代碼來源:ModelHandler.java

示例5: putAllStateModelLocations

public Map<IBlockState, ModelResourceLocation> putAllStateModelLocations()
{
    Map<IBlockState, ModelResourceLocation> map = Maps.<IBlockState, ModelResourceLocation>newIdentityHashMap();

    for (Block block : Block.REGISTRY)
    {
        map.putAll(this.getVariants(block));
    }

    return map;
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:11,代碼來源:BlockStateMapper.java

示例6: loadBlocks

private void loadBlocks()
{
    BlockStateMapper blockstatemapper = this.blockModelShapes.getBlockStateMapper();

    for (Block block : Block.REGISTRY)
    {
        for (final ResourceLocation resourcelocation : blockstatemapper.getBlockstateLocations(block))
        {
            try
            {
                ModelBlockDefinition modelblockdefinition = this.getModelBlockDefinition(resourcelocation);
                Map<IBlockState, ModelResourceLocation> map = blockstatemapper.getVariants(block);

                if (modelblockdefinition.hasMultipartData())
                {
                    Collection<ModelResourceLocation> collection = Sets.newHashSet(map.values());
                    modelblockdefinition.getMultipartData().setStateContainer(block.getBlockState());
                    Collection<ModelResourceLocation> collection1 = (Collection)this.multipartVariantMap.get(modelblockdefinition);

                    if (collection1 == null)
                    {
                        collection1 = Lists.<ModelResourceLocation>newArrayList();
                        this.multipartVariantMap.put(modelblockdefinition, collection1);
                    }

                    collection1.addAll(Lists.newArrayList(Iterables.filter(collection, new Predicate<ModelResourceLocation>()
                    {
                        public boolean apply(@Nullable ModelResourceLocation p_apply_1_)
                        {
                            return resourcelocation.equals(p_apply_1_);
                        }
                    })));
                }

                for (Entry<IBlockState, ModelResourceLocation> entry : map.entrySet())
                {
                    ModelResourceLocation modelresourcelocation = (ModelResourceLocation)entry.getValue();

                    if (resourcelocation.equals(modelresourcelocation))
                    {
                        try
                        {
                            this.variants.put(modelresourcelocation, modelblockdefinition.getVariant(modelresourcelocation.getVariant()));
                        }
                        catch (RuntimeException var12)
                        {
                            if (!modelblockdefinition.hasMultipartData())
                            {
                                LOGGER.warn("Unable to load variant: {} from {}", new Object[] {modelresourcelocation.getVariant(), modelresourcelocation});
                            }
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                LOGGER.warn("Unable to load definition {}", new Object[] {resourcelocation, exception});
            }
        }
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:61,代碼來源:ModelBakery.java


注:本文中的net.minecraft.block.Block.REGISTRY屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。