当前位置: 首页>>代码示例>>Java>>正文


Java Block.getRegistryName方法代码示例

本文整理汇总了Java中net.minecraft.block.Block.getRegistryName方法的典型用法代码示例。如果您正苦于以下问题:Java Block.getRegistryName方法的具体用法?Java Block.getRegistryName怎么用?Java Block.getRegistryName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.block.Block的用法示例。


在下文中一共展示了Block.getRegistryName方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: registerItemModel

import net.minecraft.block.Block; //导入方法依赖的package包/类
@Override
public void registerItemModel(Item item) {
    if(item instanceof IItemColored)
        COLOR_ITEMS.add((IItemColored) item);
    if(item instanceof ItemBlock)
    {
        ItemBlock itemBlock = (ItemBlock) item;
        Block block = itemBlock.getBlock();
        ResourceLocation resloc = block.getRegistryName();
        if(block instanceof IBlockVariants) {
            for (IBlockState state : ((IBlockVariants) block).getValidStates()) {
                ModelLoader.setCustomModelResourceLocation(item, block.getMetaFromState(state), new ModelResourceLocation(resloc, ((IBlockVariants) block).getBlockStateName(state)));
            }
        }
        else
            ModelLoader.setCustomModelResourceLocation(item,0,new ModelResourceLocation(resloc, "inventory"));
    }
    else
        ModelLoader.setCustomModelResourceLocation(item,0,new ModelResourceLocation(item.getRegistryName(), "inventory"));

}
 
开发者ID:DaedalusGame,项目名称:Soot,代码行数:22,代码来源:ClientProxy.java

示例2: registerBlock

import net.minecraft.block.Block; //导入方法依赖的package包/类
/**
 * Registers the given block.
 * Also adds the respective TileEntity if the block has one.
 * 
 * @param registerItemBlock - {@code true} to also register the block as item.
 */
private static void registerBlock(Block block, boolean registerItemBlock) {//TODO REGISTRY - Register block names with "oft." -prefix to avoid name clash between mods.

	/* Determine block's unlocalised name. */
	String name = block.getClass().getSimpleName().toLowerCase().substring(5);

	/* Register block (and its TileEntity, if existent). */
	if (block.getRegistryName() == null) {
		GameRegistry.register(block.setRegistryName(name).setUnlocalizedName(name));

		if(block instanceof ITileEntityProvider){
			Class<? extends TileEntity> tileEntityClass = ((ITileEntityProvider) block).createNewTileEntity(null, 0).getClass();
			GameRegistry.registerTileEntity(tileEntityClass, tileEntityClass.getSimpleName());
		}
	}

	/* Register block's item if required. */
	if (registerItemBlock && Item.getItemFromBlock(block) == null) {
		GameRegistry.register(new ItemBlock(block).setRegistryName(name));
	}
}
 
开发者ID:DonBruce64,项目名称:OpenFlexiTrack,代码行数:27,代码来源:OFTRegistry.java

示例3: applyModifiers

import net.minecraft.block.Block; //导入方法依赖的package包/类
private static boolean applyModifiers(BlockEvent.CreateFluidSourceEvent event)
{
    Block block = event.getState().getBlock();

    for (FluidModifier modifier : FluidModifier.getModifiers())
    {
        if (block.getRegistryName() != null && block.getRegistryName().equals(modifier.block))
        {
            if (modifier.canCreateSource != null)
            {
                event.setResult(modifier.canCreateSource ? Event.Result.ALLOW : Event.Result.DENY);
                return true;
            }
        }
    }

    return false;
}
 
开发者ID:cubex2,项目名称:customstuff4,代码行数:19,代码来源:EventHandler.java

示例4: testIfLegit

import net.minecraft.block.Block; //导入方法依赖的package包/类
@Override
protected boolean testIfLegit(Block componant) {
	boolean legit = componant.getRegistryName() != null;
	if(!legit)
		new NullPointerException("Tried to config a Item with no registry name. Item: " + componant.getClass());
	return super.testIfLegit(componant);
}
 
开发者ID:kenijey,项目名称:harshencastle,代码行数:8,代码来源:BlocksEnabled.java

示例5: registerBlock

import net.minecraft.block.Block; //导入方法依赖的package包/类
/**
 * Use {@link #register(IForgeRegistryEntry)} instead
 */
@Deprecated
public static Block registerBlock(Block block, String name)
{
    if (block.getRegistryName() == null && Strings.isNullOrEmpty(name))
        throw new IllegalArgumentException("Attempted to register a Block with no name: " + block);
    if (block.getRegistryName() != null && !block.getRegistryName().toString().equals(name))
        throw new IllegalArgumentException("Attempted to register a Block with conflicting names. Old: " + block.getRegistryName() + " New: " + name);
    return registerBlock(block.getRegistryName() != null ? block : block.setRegistryName(name));
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:13,代码来源:GameRegistry.java

示例6: registerBlockColorHandler

import net.minecraft.block.Block; //导入方法依赖的package包/类
public void registerBlockColorHandler(IBlockColor blockColor, Block... blocksIn)
{
    for (Block block : blocksIn)
    {
        if (block == null) throw new IllegalArgumentException("Block registered to block color handler cannot be null!");
        if (block.getRegistryName() == null) throw new IllegalArgumentException("Block must be registered before assigning color handler.");
        this.blockColorMap.put(block.delegate, blockColor);
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:10,代码来源:BlockColors.java

示例7: registerItemColorHandler

import net.minecraft.block.Block; //导入方法依赖的package包/类
public void registerItemColorHandler(IItemColor itemColor, Block... blocksIn)
{
    for (Block block : blocksIn)
    {
        if (block == null) throw new IllegalArgumentException("Block registered to item color handler cannot be null!");
        if (block.getRegistryName() == null) throw new IllegalArgumentException("Block must be registered before assigning color handler.");
        this.itemColorMap.put(Item.getItemFromBlock(block).delegate, itemColor);
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:10,代码来源:ItemColors.java

示例8: registerRender

import net.minecraft.block.Block; //导入方法依赖的package包/类
@SideOnly(Side.CLIENT)
private static void registerRender(Block block, int meta, String name) {
	ModelResourceLocation model = new ModelResourceLocation(block.getRegistryName(), "inventory");
	ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(block), meta, model);
}
 
开发者ID:PorPit,项目名称:MineCamera,代码行数:6,代码来源:BlockLoader.java

示例9: registerRender

import net.minecraft.block.Block; //导入方法依赖的package包/类
@SideOnly(Side.CLIENT)
private static void registerRender(Block block) {
	ModelResourceLocation model = new ModelResourceLocation(block.getRegistryName(), "inventory");
	ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(block), 0, model);
}
 
开发者ID:YoungGT,项目名称:EasyCraft,代码行数:6,代码来源:BlockLoader.java


注:本文中的net.minecraft.block.Block.getRegistryName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。