当前位置: 首页>>代码示例>>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;未经允许,请勿转载。