本文整理汇总了Java中net.minecraft.block.Block.getBlockById方法的典型用法代码示例。如果您正苦于以下问题:Java Block.getBlockById方法的具体用法?Java Block.getBlockById怎么用?Java Block.getBlockById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.block.Block
的用法示例。
在下文中一共展示了Block.getBlockById方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: readEntityFromNBT
import net.minecraft.block.Block; //导入方法依赖的package包/类
/**
* (abstract) Protected helper method to read subclass entity data from NBT.
*/
public void readEntityFromNBT(NBTTagCompound tagCompund)
{
this.xTile = tagCompund.getShort("xTile");
this.yTile = tagCompund.getShort("yTile");
this.zTile = tagCompund.getShort("zTile");
if (tagCompund.hasKey("inTile", 8))
{
this.inTile = Block.getBlockFromName(tagCompund.getString("inTile"));
}
else
{
this.inTile = Block.getBlockById(tagCompund.getByte("inTile") & 255);
}
this.shake = tagCompund.getByte("shake") & 255;
this.inGround = tagCompund.getByte("inGround") == 1;
}
示例2: parseBlockState
import net.minecraft.block.Block; //导入方法依赖的package包/类
public IBlockState parseBlockState(String p_parseBlockState_1_, IBlockState p_parseBlockState_2_)
{
MatchBlock[] amatchblock = this.parseMatchBlock(p_parseBlockState_1_);
if (amatchblock == null)
{
return p_parseBlockState_2_;
}
else if (amatchblock.length != 1)
{
return p_parseBlockState_2_;
}
else
{
MatchBlock matchblock = amatchblock[0];
int i = matchblock.getBlockId();
Block block = Block.getBlockById(i);
return block.getDefaultState();
}
}
示例3: readStructureFromNBT
import net.minecraft.block.Block; //导入方法依赖的package包/类
protected void readStructureFromNBT(NBTTagCompound tagCompound)
{
super.readStructureFromNBT(tagCompound);
this.cropTypeA = Block.getBlockById(tagCompound.getInteger("CA"));
this.cropTypeB = Block.getBlockById(tagCompound.getInteger("CB"));
this.cropTypeC = Block.getBlockById(tagCompound.getInteger("CC"));
this.cropTypeD = Block.getBlockById(tagCompound.getInteger("CD"));
}
示例4: readEntityFromNBT
import net.minecraft.block.Block; //导入方法依赖的package包/类
/**
* (abstract) Protected helper method to read subclass entity data from NBT.
*/
public void readEntityFromNBT(NBTTagCompound tagCompund)
{
this.xTile = tagCompund.getShort("xTile");
this.yTile = tagCompund.getShort("yTile");
this.zTile = tagCompund.getShort("zTile");
if (tagCompund.hasKey("inTile", 8))
{
this.inTile = Block.getBlockFromName(tagCompund.getString("inTile"));
}
else
{
this.inTile = Block.getBlockById(tagCompund.getByte("inTile") & 255);
}
this.inGround = tagCompund.getByte("inGround") == 1;
if (tagCompund.hasKey("direction", 9))
{
NBTTagList nbttaglist = tagCompund.getTagList("direction", 6);
this.motionX = nbttaglist.getDoubleAt(0);
this.motionY = nbttaglist.getDoubleAt(1);
this.motionZ = nbttaglist.getDoubleAt(2);
}
else
{
this.setDead();
}
}
示例5: readPacketData
import net.minecraft.block.Block; //导入方法依赖的package包/类
/**
* Reads the raw packet data from the data stream.
*/
public void readPacketData(PacketBuffer buf) throws IOException
{
this.blockPosition = buf.readBlockPos();
this.instrument = buf.readUnsignedByte();
this.pitch = buf.readUnsignedByte();
this.block = Block.getBlockById(buf.readVarIntFromBuffer() & 4095);
}
示例6: onLivingUpdate
import net.minecraft.block.Block; //导入方法依赖的package包/类
@Override
public void onLivingUpdate() {
super.onLivingUpdate();
//Block stuff
List<Block> listBlocks = ImmutableList.copyOf(Block.REGISTRY);
int blockListSize = listBlocks.size();
int randomBlockInt = rand.nextInt(blockListSize);
Block block = Block.getBlockById(randomBlockInt);
Item itemBlock = Item.getItemFromBlock(block);
if(!this.world.isRemote && timeToDiamond == 0 || timeToDiamond == -1){
//I am creating a list of blocks I do not want the pig to drop from registy.
List<Item> blockedItems = new ArrayList<>();
blockedItems.add(Items.AIR);
if(!listBlocks.isEmpty()){
block = listBlocks.get(randomBlockInt);
}else if(blockedItems.contains(itemBlock)){
block = Blocks.DIRT;
}
this.playSound(SoundEvents.ENTITY_CHICKEN_EGG, 1.0F, (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F);
this.dropItem(itemBlock, 1);
this.timeToDiamond = this.rand.nextInt(6000) + 6000;
}
if(!world.isRemote && timeToDiamond > 0){
timeToDiamond--;
//System.out.println("BACON Time set to:" + timeToDiamond);
//System.out.println(itemBlock);
}
}
示例7: getBlock
import net.minecraft.block.Block; //导入方法依赖的package包/类
@Deprecated
public static Block getBlock(int id) {
//return Block.blocksList[id]; // < 1.8
return Block.getBlockById(id);
}
示例8: readEntityFromNBT
import net.minecraft.block.Block; //导入方法依赖的package包/类
/**
* (abstract) Protected helper method to read subclass entity data from NBT.
*/
protected void readEntityFromNBT(NBTTagCompound tagCompund)
{
if (tagCompund.getBoolean("CustomDisplayTile"))
{
int i = tagCompund.getInteger("DisplayData");
if (tagCompund.hasKey("DisplayTile", 8))
{
Block block = Block.getBlockFromName(tagCompund.getString("DisplayTile"));
if (block == null)
{
this.func_174899_a(Blocks.air.getDefaultState());
}
else
{
this.func_174899_a(block.getStateFromMeta(i));
}
}
else
{
Block block1 = Block.getBlockById(tagCompund.getInteger("DisplayTile"));
if (block1 == null)
{
this.func_174899_a(Blocks.air.getDefaultState());
}
else
{
this.func_174899_a(block1.getStateFromMeta(i));
}
}
this.setDisplayTileOffset(tagCompund.getInteger("DisplayOffset"));
}
if (tagCompund.hasKey("CustomName", 8) && tagCompund.getString("CustomName").length() > 0)
{
this.entityName = tagCompund.getString("CustomName");
}
}
示例9: readStructureFromNBT
import net.minecraft.block.Block; //导入方法依赖的package包/类
protected void readStructureFromNBT(NBTTagCompound tagCompound)
{
super.readStructureFromNBT(tagCompound);
this.cropTypeA = Block.getBlockById(tagCompound.getInteger("CA"));
this.cropTypeB = Block.getBlockById(tagCompound.getInteger("CB"));
}
示例10: readStructureFromNBT
import net.minecraft.block.Block; //导入方法依赖的package包/类
protected void readStructureFromNBT(NBTTagCompound tagCompound, TemplateManager p_143011_2_)
{
super.readStructureFromNBT(tagCompound, p_143011_2_);
this.cropTypeA = Block.getBlockById(tagCompound.getInteger("CA"));
this.cropTypeB = Block.getBlockById(tagCompound.getInteger("CB"));
}
示例11: getById
import net.minecraft.block.Block; //导入方法依赖的package包/类
/**
* Get block from block id
* @param blockID Block index
* @return Converted block
*/
public static UBlock getById(int blockID) {
return new UBlock(Block.getBlockById(blockID));
}