本文整理汇总了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);
}
示例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);
}
示例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];
}
}
示例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];
}
}
示例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);
}
}
示例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);
}
});
}
示例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();
}
示例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();
}
示例9: getBlockId
import net.minecraft.block.Block; //导入方法依赖的package包/类
public int getBlockId()
{
if (this.blockId < 0)
{
this.blockId = Block.getIdFromBlock(this.getBlock());
}
return this.blockId;
}
示例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);
}
示例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;
}
}
示例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;
}
}
}
示例13: toString
import net.minecraft.block.Block; //导入方法依赖的package包/类
public String toString()
{
return Block.getIdFromBlock(this.block) + ": " + this.position + ", " + this.scheduledTime + ", " + this.priority + ", " + this.tickEntryID;
}
示例14: getBlockStats
import net.minecraft.block.Block; //导入方法依赖的package包/类
@Nullable
public static StatBase getBlockStats(Block blockIn)
{
return BLOCKS_STATS[Block.getIdFromBlock(blockIn)];
}
示例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;
}
}
}
}