當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。