当前位置: 首页>>代码示例>>Java>>正文


Java Block.getBlockById方法代码示例

本文整理汇总了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;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:22,代码来源:EntityFishHook.java

示例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();
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:21,代码来源:ConnectedParser.java

示例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"));
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:9,代码来源:StructureVillagePieces.java

示例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();
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:33,代码来源:EntityFireball.java

示例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);
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:11,代码来源:S24PacketBlockAction.java

示例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);
    }
}
 
开发者ID:OCDiary,项目名称:TheOink,代码行数:35,代码来源:OinkBacon.java

示例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);
}
 
开发者ID:NSExceptional,项目名称:Zombe-Modpack,代码行数:6,代码来源:ZWrapper.java

示例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");
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:45,代码来源:EntityMinecart.java

示例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"));
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:7,代码来源:StructureVillagePieces.java

示例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"));
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:7,代码来源:StructureVillagePieces.java

示例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));
}
 
开发者ID:ternsip,项目名称:StructPro,代码行数:9,代码来源:UBlock.java


注:本文中的net.minecraft.block.Block.getBlockById方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。