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


Java Block.getIdFromBlock方法代碼示例

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


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

示例1: initMiningStats

import net.minecraft.block.Block; //導入方法依賴的package包/類
private static void initMiningStats()
{
    for (Block block : Block.blockRegistry)
    {
        Item item = Item.getItemFromBlock(block);

        if (item != null)
        {
            int i = Block.getIdFromBlock(block);
            String s = func_180204_a(item);

            if (s != null && block.getEnableStats())
            {
                mineBlockStatArray[i] = (new StatCrafting("stat.mineBlock.", s, new ChatComponentTranslation("stat.mineBlock", new Object[] {(new ItemStack(block)).getChatComponent()}), item)).registerStat();
                objectMineStats.add((StatCrafting)mineBlockStatArray[i]);
            }
        }
    }

    replaceAllSimilarBlocks(mineBlockStatArray);
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:22,代碼來源:StatList.java

示例2: initMiningStats

import net.minecraft.block.Block; //導入方法依賴的package包/類
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,代碼行數:22,代碼來源:StatList.java

示例3: mergeStatBases

import net.minecraft.block.Block; //導入方法依賴的package包/類
/**
 * Merge {@link StatBase} object references for similar blocks
 */
private static void mergeStatBases(StatBase[] statBaseIn, Block block1, Block block2)
{
    int i = Block.getIdFromBlock(block1);
    int j = Block.getIdFromBlock(block2);

    if (statBaseIn[i] != null && statBaseIn[j] == null)
    {
        statBaseIn[j] = statBaseIn[i];
    }
    else
    {
        ALL_STATS.remove(statBaseIn[i]);
        MINE_BLOCK_STATS.remove(statBaseIn[i]);
        BASIC_STATS.remove(statBaseIn[i]);
        statBaseIn[i] = statBaseIn[j];
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:21,代碼來源:StatList.java

示例4: mergeStatBases

import net.minecraft.block.Block; //導入方法依賴的package包/類
/**
 * Merge {@link StatBase} object references for similar blocks
 */
private static void mergeStatBases(StatBase[] statBaseIn, Block p_151180_1_, Block p_151180_2_)
{
    int i = Block.getIdFromBlock(p_151180_1_);
    int j = Block.getIdFromBlock(p_151180_2_);

    if (statBaseIn[i] != null && statBaseIn[j] == null)
    {
        statBaseIn[j] = statBaseIn[i];
    }
    else
    {
        allStats.remove(statBaseIn[i]);
        objectMineStats.remove(statBaseIn[i]);
        generalStats.remove(statBaseIn[i]);
        statBaseIn[i] = statBaseIn[j];
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:21,代碼來源:StatList.java

示例5: setBlockEntityId

import net.minecraft.block.Block; //導入方法依賴的package包/類
public static void setBlockEntityId(TileEntity tileEntity)
{
    if (isRenderingWorld && !isShadowPass && uniformBlockEntityId.isDefined())
    {
        Block block = tileEntity.getBlockType();
        int i = Block.getIdFromBlock(block);
        uniformBlockEntityId.setValue(i);
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:10,代碼來源:Shaders.java

示例6: addBlockInfo

import net.minecraft.block.Block; //導入方法依賴的package包/類
public static void addBlockInfo(CrashReportCategory category, final BlockPos pos, final Block blockIn, final int blockData)
{
    final int i = Block.getIdFromBlock(blockIn);
    category.addCrashSectionCallable("Block type", new Callable<String>()
    {
        public String call() throws Exception
        {
            try
            {
                return String.format("ID #%d (%s // %s)", new Object[] {Integer.valueOf(i), blockIn.getUnlocalizedName(), blockIn.getClass().getCanonicalName()});
            }
            catch (Throwable var2)
            {
                return "ID #" + i;
            }
        }
    });
    category.addCrashSectionCallable("Block data value", new Callable<String>()
    {
        public String call() throws Exception
        {
            if (blockData < 0)
            {
                return "Unknown? (Got " + blockData + ")";
            }
            else
            {
                String s = String.format("%4s", new Object[] {Integer.toBinaryString(blockData)}).replace(" ", "0");
                return String.format("%1$d / 0x%1$X / 0b%2$s", new Object[] {Integer.valueOf(blockData), s});
            }
        }
    });
    category.addCrashSectionCallable("Block location", new Callable<String>()
    {
        public String call() throws Exception
        {
            return CrashReportCategory.getCoordinateInfo(pos);
        }
    });
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:41,代碼來源:CrashReportCategory.java

示例7: call

import net.minecraft.block.Block; //導入方法依賴的package包/類
@Override
public void call(String[] args) throws CmdException
{
	if(args.length == 0)
	{
		wurst.mods.ghostHandMod.toggle();
		ChatUtils.message("GhostHand turned "
			+ (wurst.mods.ghostHandMod.isEnabled() ? "on" : "off") + ".");
	}else if(args.length == 2)
	{
		if(args[0].equalsIgnoreCase("id") && MiscUtils.isInteger(args[1]))
		{
			wurst.options.ghostHandID = Integer.valueOf(args[1]);
			ConfigFiles.OPTIONS.save();
			ChatUtils.message("GhostHand ID set to " + args[1] + ".");
		}else if(args[0].equalsIgnoreCase("name"))
		{
			int newID =
				Block.getIdFromBlock(Block.getBlockFromName(args[1]));
			if(newID == -1)
			{
				ChatUtils.message(
					"The block \"" + args[1] + "\" could not be found.");
				return;
			}
			wurst.options.ghostHandID = newID;
			ConfigFiles.OPTIONS.save();
			ChatUtils.message(
				"GhostHand ID set to " + newID + " (" + args[1] + ").");
		}else
			throw new CmdSyntaxError();
	}else
		throw new CmdSyntaxError();
}
 
開發者ID:Wurst-Imperium,項目名稱:Wurst-MC-1.12,代碼行數:35,代碼來源:GhostHandCmd.java

示例8: call

import net.minecraft.block.Block; //導入方法依賴的package包/類
@Override
public void call(String[] args) throws CmdException
{
	if(args.length == 0)
	{
		wurst.mods.searchMod.toggle();
		ChatUtils.message("Search turned "
			+ (wurst.mods.searchMod.isEnabled() == true ? "on" : "off")
			+ ".");
	}else if(args.length == 2)
	{
		if(args[0].toLowerCase().equals("id"))
		{
			if(MiscUtils.isInteger(args[1]))
				wurst.options.searchID = Integer.valueOf(args[1]);
			else
				throw new CmdSyntaxError("ID must be a number.");
			ConfigFiles.OPTIONS.save();
			wurst.mods.searchMod.notify = true;
			ChatUtils.message("Search ID set to " + args[1] + ".");
		}else if(args[0].equalsIgnoreCase("name"))
		{
			int newID =
				Block.getIdFromBlock(Block.getBlockFromName(args[1]));
			if(newID == -1)
				throw new CmdError(
					"Block \"" + args[1] + "\" could not be found.");
			wurst.options.searchID = Integer.valueOf(newID);
			ConfigFiles.OPTIONS.save();
			wurst.mods.searchMod.notify = true;
			ChatUtils.message(
				"Search ID set to " + newID + " (" + args[1] + ").");
		}
	}else
		throw new CmdSyntaxError();
}
 
開發者ID:Wurst-Imperium,項目名稱:Wurst-MC-1.12,代碼行數:37,代碼來源:SearchCmd.java

示例9: getBlockId

import net.minecraft.block.Block; //導入方法依賴的package包/類
public int getBlockId()
{
    if (this.blockId < 0)
    {
        this.blockId = Block.getIdFromBlock(this.getBlock());
    }

    return this.blockId;
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:10,代碼來源:BlockStateBase.java

示例10: pushEntity

import net.minecraft.block.Block; //導入方法依賴的package包/類
public static void pushEntity(IBlockState blockState, BlockPos blockPos, IBlockAccess blockAccess, WorldRenderer wrr)
{
    Block block = blockState.getBlock();
    int i = Block.getIdFromBlock(block);
    int j = block.getRenderType();
    int k = block.getMetaFromState(blockState);
    int l = ((j & 65535) << 16) + (i & 65535);
    int i1 = k & 65535;
    wrr.sVertexBuilder.pushEntity(((long)i1 << 32) + (long)l);
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:11,代碼來源:SVertexBuilder.java

示例11: detectMatchBlocks

import net.minecraft.block.Block; //導入方法依賴的package包/類
private MatchBlock[] detectMatchBlocks()
{
    Block block = Block.getBlockFromName(this.name);

    if (block != null)
    {
        return new MatchBlock[] {new MatchBlock(Block.getIdFromBlock(block))};
    }
    else
    {
        Pattern pattern = Pattern.compile("^block([0-9]+).*$");
        Matcher matcher = pattern.matcher(this.name);

        if (matcher.matches())
        {
            String s = matcher.group(1);
            int i = Config.parseInt(s, -1);

            if (i >= 0)
            {
                return new MatchBlock[] {new MatchBlock(i)};
            }
        }

        ConnectedParser connectedparser = new ConnectedParser("Colormap");
        MatchBlock[] amatchblock = connectedparser.parseMatchBlock(this.name);
        return amatchblock != null ? amatchblock : null;
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:30,代碼來源:CustomColormap.java

示例12: parseMatchBlock

import net.minecraft.block.Block; //導入方法依賴的package包/類
public MatchBlock[] parseMatchBlock(String p_parseMatchBlock_1_)
{
    if (p_parseMatchBlock_1_ == null)
    {
        return null;
    }
    else
    {
        p_parseMatchBlock_1_ = p_parseMatchBlock_1_.trim();

        if (p_parseMatchBlock_1_.length() <= 0)
        {
            return null;
        }
        else
        {
            String[] astring = Config.tokenize(p_parseMatchBlock_1_, ":");
            String s = "minecraft";
            int i = 0;

            if (astring.length > 1 && this.isFullBlockName(astring))
            {
                s = astring[0];
                i = 1;
            }
            else
            {
                s = "minecraft";
                i = 0;
            }

            String s1 = astring[i];
            String[] astring1 = (String[])Arrays.copyOfRange(astring, i + 1, astring.length);
            Block[] ablock = this.parseBlockPart(s, s1);
            MatchBlock[] amatchblock = new MatchBlock[ablock.length];

            for (int j = 0; j < ablock.length; ++j)
            {
                Block block = ablock[j];
                int k = Block.getIdFromBlock(block);
                int[] aint = this.parseBlockMetadatas(block, astring1);
                MatchBlock matchblock = new MatchBlock(k, aint);
                amatchblock[j] = matchblock;
            }

            return amatchblock;
        }
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:50,代碼來源:ConnectedParser.java

示例13: toString

import net.minecraft.block.Block; //導入方法依賴的package包/類
public String toString()
{
    return Block.getIdFromBlock(this.block) + ": " + this.position + ", " + this.scheduledTime + ", " + this.priority + ", " + this.tickEntryID;
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:5,代碼來源:NextTickListEntry.java

示例14: getBlockStats

import net.minecraft.block.Block; //導入方法依賴的package包/類
@Nullable
public static StatBase getBlockStats(Block blockIn)
{
    return BLOCKS_STATS[Block.getIdFromBlock(blockIn)];
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:6,代碼來源:StatList.java

示例15: parseMatchBlock

import net.minecraft.block.Block; //導入方法依賴的package包/類
public MatchBlock[] parseMatchBlock(String p_parseMatchBlock_1_)
{
    if (p_parseMatchBlock_1_ == null)
    {
        return null;
    }
    else
    {
        p_parseMatchBlock_1_ = p_parseMatchBlock_1_.trim();

        if (p_parseMatchBlock_1_.length() <= 0)
        {
            return null;
        }
        else
        {
            String[] astring = Config.tokenize(p_parseMatchBlock_1_, ":");
            String s = "minecraft";
            int i = 0;

            if (astring.length > 1 && this.isFullBlockName(astring))
            {
                s = astring[0];
                i = 1;
            }
            else
            {
                s = "minecraft";
                i = 0;
            }

            String s1 = astring[i];
            String[] astring1 = (String[])Arrays.copyOfRange(astring, i + 1, astring.length);
            Block[] ablock = this.parseBlockPart(s, s1);

            if (ablock == null)
            {
                return null;
            }
            else
            {
                MatchBlock[] amatchblock = new MatchBlock[ablock.length];

                for (int j = 0; j < ablock.length; ++j)
                {
                    Block block = ablock[j];
                    int k = Block.getIdFromBlock(block);
                    int[] aint = null;

                    if (astring1.length > 0)
                    {
                        aint = this.parseBlockMetadatas(block, astring1);

                        if (aint == null)
                        {
                            return null;
                        }
                    }

                    MatchBlock matchblock = new MatchBlock(k, aint);
                    amatchblock[j] = matchblock;
                }

                return amatchblock;
            }
        }
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:69,代碼來源:ConnectedParser.java


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