Java 类net.minecraft.block.Block 实例源码

项目:connor41-etfuturum2    文件:ChorusFlower.java   
public static boolean canPlantStay(World world, int x, int y, int z) {
    Block block = world.getBlock(x, y - 1, z);
    if (block != ModBlocks.chorus_plant && block != Blocks.end_stone) {
        if (block.isAir(world, x, y - 1, z)) {
            int adjecentCount = 0;
            for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
                Block adjecentBlock = world.getBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ);
                if (adjecentBlock == ModBlocks.chorus_plant)
                    adjecentCount++;
                else if (!adjecentBlock.isAir(world, x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ))
                    return false;
            }
            return adjecentCount == 1;
        } else
            return false;
    } else
        return true;
}
项目:Technical    文件:TileEntityMachine.java   
public static int getItemBurnTimeElectrical(ItemStack itemStack) {
    if(itemStack == null) {
        return 0;
    } else {
        Item item = itemStack.getItem();

        if(item instanceof ItemBlock && Block.getBlockFromItem(item) != Blocks.air) {

            @SuppressWarnings("unused")
            Block block = Block.getBlockFromItem(item);

        }
        if(item == TechnicalItem.Battery1)
            return 2560;

        return 0;
    }
}
项目:CustomWorldGen    文件:EntityLivingBase.java   
/**
 * returns true if this entity is by a ladder, false otherwise
 */
public boolean isOnLadder()
{
    int i = MathHelper.floor_double(this.posX);
    int j = MathHelper.floor_double(this.getEntityBoundingBox().minY);
    int k = MathHelper.floor_double(this.posZ);

    if (this instanceof EntityPlayer && ((EntityPlayer)this).isSpectator())
    {
        return false;
    }
    else
    {
        BlockPos blockpos = new BlockPos(i, j, k);
        IBlockState iblockstate = this.worldObj.getBlockState(blockpos);
        Block block = iblockstate.getBlock();
        return net.minecraftforge.common.ForgeHooks.isLivingOnLadder(iblockstate, worldObj, new BlockPos(i, j, k), this);
    }
}
项目:Backmemed    文件:SVertexBuilder.java   
public static void pushEntity(IBlockState blockState, BlockPos blockPos, IBlockAccess blockAccess, VertexBuffer wrr)
{
    Block block = blockState.getBlock();
    int i;
    int j;

    if (blockState instanceof BlockStateBase)
    {
        BlockStateBase blockstatebase = (BlockStateBase)blockState;
        i = blockstatebase.getBlockId();
        j = blockstatebase.getMetadata();
    }
    else
    {
        i = Block.getIdFromBlock(block);
        j = block.getMetaFromState(blockState);
    }

    i = BlockAliases.getMappedBlockId(i, j);
    int i1 = block.getRenderType(blockState).ordinal();
    int k = ((i1 & 65535) << 16) + (i & 65535);
    int l = j & 65535;
    wrr.sVertexBuilder.pushEntity(((long)l << 32) + (long)k);
}
项目:uniquecrops    文件:ItemGeneric.java   
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {

    if (stack.getItemDamage() == EnumItems.TIMEMEAL.ordinal() && player.canPlayerEdit(pos, facing, stack)) {
        Block crops = world.getBlockState(pos).getBlock();
        if (crops != null && crops instanceof BlockCrops) {
            if (crops != UCBlocks.cropMerlinia)
                world.setBlockState(pos, ((BlockCrops)crops).withAge(0), 2);
            else if (crops == UCBlocks.cropMerlinia)
                ((Merlinia)crops).merliniaGrowth(world, pos, world.rand.nextInt(1) + 1);
            else if (crops instanceof BlockNetherWart)
                ((BlockNetherWart)crops).updateTick(world, pos, world.getBlockState(pos), world.rand);
            if (!player.capabilities.isCreativeMode && !player.worldObj.isRemote)
                stack.stackSize--;
            UCPacketHandler.sendToNearbyPlayers(world, pos, new PacketUCEffect(EnumParticleTypes.VILLAGER_HAPPY, pos.getX() - 0.5D, pos.getY(), pos.getZ() - 0.5D, 6));
            return EnumActionResult.SUCCESS;
        }
    }
    return super.onItemUse(stack, player, world, pos, hand, facing, hitX, hitY, hitZ);
}
项目:BaseClient    文件:StatList.java   
/**
 * 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];
    }
}
项目:DecompiledMinecraft    文件:EntityEnderman.java   
/**
 * (abstract) Protected helper method to read subclass entity data from NBT.
 */
public void readEntityFromNBT(NBTTagCompound tagCompund)
{
    super.readEntityFromNBT(tagCompund);
    IBlockState iblockstate;

    if (tagCompund.hasKey("carried", 8))
    {
        iblockstate = Block.getBlockFromName(tagCompund.getString("carried")).getStateFromMeta(tagCompund.getShort("carriedData") & 65535);
    }
    else
    {
        iblockstate = Block.getBlockById(tagCompund.getShort("carried")).getStateFromMeta(tagCompund.getShort("carriedData") & 65535);
    }

    this.setHeldBlockState(iblockstate);
}
项目:Technical    文件:BlockBaryteOre.java   
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockAccess p_149646_1_, int p_149646_2_, int p_149646_3_, int p_149646_4_, int p_149646_5_) {
    Block block = p_149646_1_.getBlock(p_149646_2_, p_149646_3_, p_149646_4_);
    if (p_149646_1_.getBlockMetadata(p_149646_2_, p_149646_3_, p_149646_4_) != p_149646_1_.getBlockMetadata(p_149646_2_ - Facing.offsetsXForSide[p_149646_5_], p_149646_3_ - Facing.offsetsYForSide[p_149646_5_], p_149646_4_ - Facing.offsetsZForSide[p_149646_5_])) {
        return true;
    }

    if (block == this) {
        return false;
    }
    return true;
}
项目:customstuff4    文件:StateMetaMapper.java   
@SuppressWarnings("unchecked")
static <T extends Block> StateMetaMapper<T> create(Collection<IProperty<?>> properties)
{
    if (properties.size() == 0)
        return new EmptyStateMetaMapper<>();
    else if (properties.size() == 1)
        return new SimpleStateMetaMapper(properties.iterator().next());
    else
        return new BitStateMetaMapper<>(properties);
}
项目:CustomWorldGen    文件:ExtendedBlockStorage.java   
public void set(int x, int y, int z, IBlockState state)
{
    if (state instanceof net.minecraftforge.common.property.IExtendedBlockState)
        state = ((net.minecraftforge.common.property.IExtendedBlockState) state).getClean();
    IBlockState iblockstate = this.get(x, y, z);
    Block block = iblockstate.getBlock();
    Block block1 = state.getBlock();

    if (block != Blocks.AIR)
    {
        --this.blockRefCount;

        if (block.getTickRandomly())
        {
            --this.tickRefCount;
        }
    }

    if (block1 != Blocks.AIR)
    {
        ++this.blockRefCount;

        if (block1.getTickRandomly())
        {
            ++this.tickRefCount;
        }
    }

    this.data.set(x, y, z, state);
}
项目:DecompiledMinecraft    文件:ItemSword.java   
/**
 * Called when a Block is destroyed using this Item. Return true to trigger the "Use Item" statistic.
 */
public boolean onBlockDestroyed(ItemStack stack, World worldIn, Block blockIn, BlockPos pos, EntityLivingBase playerIn)
{
    if ((double)blockIn.getBlockHardness(worldIn, pos) != 0.0D)
    {
        stack.damageItem(2, playerIn);
    }

    return true;
}
项目:Backmemed    文件:World.java   
public void notifyNeighborsRespectDebug(BlockPos pos, Block blockType, boolean p_175722_3_)
{
    if (this.worldInfo.getTerrainType() != WorldType.DEBUG_WORLD)
    {
        this.notifyNeighborsOfStateChange(pos, blockType, p_175722_3_);
    }
}
项目:Backmemed    文件:ItemTool.java   
protected ItemTool(float attackDamageIn, float attackSpeedIn, Item.ToolMaterial materialIn, Set<Block> effectiveBlocksIn)
{
    this.efficiencyOnProperMaterial = 4.0F;
    this.toolMaterial = materialIn;
    this.effectiveBlocks = effectiveBlocksIn;
    this.maxStackSize = 1;
    this.setMaxDamage(materialIn.getMaxUses());
    this.efficiencyOnProperMaterial = materialIn.getEfficiencyOnProperMaterial();
    this.damageVsEntity = attackDamageIn + materialIn.getDamageVsEntity();
    this.attackSpeed = attackSpeedIn;
    this.setCreativeTab(CreativeTabs.TOOLS);
}
项目:CustomWorldGen    文件:NBTUtil.java   
/**
 * Writes the given blockstate to the given tag.
 *  
 * @param tag The tag to write to
 * @param state The blockstate to be written
 */
public static NBTTagCompound writeBlockState(NBTTagCompound tag, IBlockState state)
{
    tag.setString("Name", ((ResourceLocation)Block.REGISTRY.getNameForObject(state.getBlock())).toString());

    if (!state.getProperties().isEmpty())
    {
        NBTTagCompound nbttagcompound = new NBTTagCompound();

        for (Entry < IProperty<?>, Comparable<? >> entry : state.getProperties().entrySet())
        {
            IProperty<?> iproperty = (IProperty)entry.getKey();
            nbttagcompound.setString(iproperty.getName(), getName(iproperty, (Comparable)entry.getValue()));
        }

        tag.setTag("Properties", nbttagcompound);
    }

    return tag;
}
项目:CustomWorldGen    文件:TileEntity.java   
/**
 * Gets the block type at the location of this entity (client-only).
 */
public Block getBlockType()
{
    if (this.blockType == null && this.worldObj != null)
    {
        this.blockType = this.worldObj.getBlockState(this.pos).getBlock();
    }

    return this.blockType;
}
项目:IceMod    文件:IceLands.java   
public IceLands(int par1)
{
    super(par1);

    this.setBiomeName("Icelands");

    this.topBlock = (byte)IceMod.IcyOre.blockID;
    this.fillerBlock = (byte)Block.ice.blockID;

    this.theBiomeDecorator.bigMushroomsPerChunk = 10;
    this.theBiomeDecorator.treesPerChunk = 5;
    this.theBiomeDecorator.clayPerChunk  = 3;
    this.theBiomeDecorator.reedsPerChunk = 1;

    this.spawnableMonsterList.add(new SpawnListEntry(EntitySnowman.class, 25, 4, 8));
    this.spawnableCreatureList.add(new SpawnListEntry(EntityCow.class, 25, 4, 8));
    this.spawnableMonsterList.add(new SpawnListEntry(EntityDragon.class, 1, 1, 1));
    this.spawnableMonsterList.add(new SpawnListEntry(EntityIronGolem.class, 1, 1, 1));

    this.setMinMaxHeight(0.1F, 0.5F);
    //mnmx
    this.setTemperatureRainfall(0.7F, 0.2F);

}
项目:UniversalRemote    文件:UniversalRemoteConfiguration.java   
public static boolean isBlockBlacklisted(Block block)
{
    ResourceLocation loc = Block.REGISTRY.getNameForObject(block);
    String[] blackList = UniversalRemoteConfiguration.blacklist.blacklist.split(",");

    for (String entry : blackList)
    {
        String[] parts = entry.split(":");

        if (loc.toString().equals(entry))
        {
            return true;
        }

        // bad entry?
        if (parts.length != 2) continue;

        if (parts[1].equals("*") && loc.getResourceDomain().equals(parts[0]))
        {
            return true;
        }
    }

    return false;
}
项目:CustomWorldGen    文件:BlockColors.java   
public void registerBlockColorHandler(IBlockColor blockColor, Block... blocksIn)
{
    for (Block block : blocksIn)
    {
        if (block == null) throw new IllegalArgumentException("Block registered to block color handler cannot be null!");
        if (block.getRegistryName() == null) throw new IllegalArgumentException("Block must be registered before assigning color handler.");
        this.blockColorMap.put(block.delegate, blockColor);
    }
}
项目:BaseClient    文件:EntityAIOcelotSit.java   
/**
 * Return true to set given position as destination
 */
protected boolean shouldMoveTo(World worldIn, BlockPos pos)
{
    if (!worldIn.isAirBlock(pos.up()))
    {
        return false;
    }
    else
    {
        IBlockState iblockstate = worldIn.getBlockState(pos);
        Block block = iblockstate.getBlock();

        if (block == Blocks.chest)
        {
            TileEntity tileentity = worldIn.getTileEntity(pos);

            if (tileentity instanceof TileEntityChest && ((TileEntityChest)tileentity).numPlayersUsing < 1)
            {
                return true;
            }
        }
        else
        {
            if (block == Blocks.lit_furnace)
            {
                return true;
            }

            if (block == Blocks.bed && iblockstate.getValue(BlockBed.PART) != BlockBed.EnumPartType.HEAD)
            {
                return true;
            }
        }

        return false;
    }
}
项目:DecompiledMinecraft    文件:EntityArmorStand.java   
private void dropContents()
{
    for (int i = 0; i < this.contents.length; ++i)
    {
        if (this.contents[i] != null && this.contents[i].stackSize > 0)
        {
            if (this.contents[i] != null)
            {
                Block.spawnAsEntity(this.worldObj, (new BlockPos(this)).up(), this.contents[i]);
            }

            this.contents[i] = null;
        }
    }
}
项目:DecompiledMinecraft    文件:TileEntityPiston.java   
public void writeToNBT(NBTTagCompound compound)
{
    super.writeToNBT(compound);
    compound.setInteger("blockId", Block.getIdFromBlock(this.pistonState.getBlock()));
    compound.setInteger("blockData", this.pistonState.getBlock().getMetaFromState(this.pistonState));
    compound.setInteger("facing", this.pistonFacing.getIndex());
    compound.setFloat("progress", this.lastProgress);
    compound.setBoolean("extending", this.extending);
}
项目:ExPetrum    文件:BlockCoralPlant.java   
@SuppressWarnings("deprecation")
@Override
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos)
{
    super.neighborChanged(state, worldIn, pos, blockIn, fromPos);
    this.onNeighborChange(worldIn, pos, fromPos);
}
项目:BaseClient    文件:ExtendedBlockStorage.java   
public void set(int x, int y, int z, IBlockState state)
{
    IBlockState iblockstate = this.get(x, y, z);
    Block block = iblockstate.getBlock();
    Block block1 = state.getBlock();

    if (block != Blocks.air)
    {
        --this.blockRefCount;

        if (block.getTickRandomly())
        {
            --this.tickRefCount;
        }
    }

    if (block1 != Blocks.air)
    {
        ++this.blockRefCount;

        if (block1.getTickRandomly())
        {
            ++this.tickRefCount;
        }
    }

    this.data[y << 8 | z << 4 | x] = (char)Block.BLOCK_STATE_IDS.get(state);
}
项目:modName    文件:ModRegistry.java   
@SubscribeEvent
public void onItemRegistry(RegistryEvent.Register<Item> e) 
{
    e.getRegistry().registerAll(Ref.ITEMS.toArray(new Item[0]));
    for (Block block : Ref.BLOCKS)
        e.getRegistry().register(new ItemBlock(block).setRegistryName(block.getRegistryName()));
}
项目:BaseClient    文件:StructureVillagePieces.java   
protected void writeStructureToNBT(NBTTagCompound tagCompound)
{
    super.writeStructureToNBT(tagCompound);
    tagCompound.setInteger("CA", Block.blockRegistry.getIDForObject(this.cropTypeA));
    tagCompound.setInteger("CB", Block.blockRegistry.getIDForObject(this.cropTypeB));
    tagCompound.setInteger("CC", Block.blockRegistry.getIDForObject(this.cropTypeC));
    tagCompound.setInteger("CD", Block.blockRegistry.getIDForObject(this.cropTypeD));
}
项目:AdvancedCombat    文件:RegistryHelper.java   
/** Register the block correctly */
public static void registerBlock(IBlockAdvanced regBlock) {
    Block block = (Block)regBlock;
    ItemBlock item;

    // register the block by itself first
       BLOCKS_TO_REGISTER.add(block.setUnlocalizedName(block.getRegistryName().toString()));

    // try to get the ItemBlock
       if(regBlock.getItemClass() != null) {
        try {
            Class<?>[] ctorArgClasses = new Class[regBlock.getItemClassArgs().length + 1];
            ctorArgClasses[0] = Block.class; // start with the block
            for (int idx = 1; idx < ctorArgClasses.length; idx++) {
                ctorArgClasses[idx] = regBlock.getItemClassArgs()[idx - 1].getClass();
            }
            Constructor<? extends ItemBlock> itemCtor = regBlock.getItemClass().getConstructor(ctorArgClasses);
            item = itemCtor.newInstance(ObjectArrays.concat(regBlock, regBlock.getItemClassArgs()));
        } catch (Exception e) {
            Log.logger.error("Unable to register block " + block.getRegistryName());
            return;
        }

        // register the ItemBlock if there are no errors
        ITEMS_TO_REGISTER.add(item.setRegistryName(block.getRegistryName()));
       }
}
项目:MeeCreeps    文件:HarvestActionFactory.java   
@Override
public boolean isPossibleSecondary(World world, BlockPos pos, EnumFacing side) {
    if (!InventoryTools.isInventory(world, pos)) {
        return false;
    }

    // @todo config for harvest area
    AxisAlignedBB box = new AxisAlignedBB(pos.add(-10, -5, -10), pos.add(10, 5, 10));

    for (double x = box.minX ; x <= box.maxX ; x++) {
        for (double y = box.minY ; y <= box.maxY ; y++) {
            for (double z = box.minZ ; z <= box.maxZ ; z++) {
                BlockPos p = new BlockPos(x, y, z);
                IBlockState state = world.getBlockState(p);
                if (state.getBlock() == Blocks.FARMLAND) {
                    IBlockState cropState = world.getBlockState(p.up());
                    Block cropBlock = cropState.getBlock();
                    boolean hasCrops = cropBlock instanceof IPlantable && state.getBlock().canSustainPlant(world.getBlockState(p), world, p, EnumFacing.UP, (IPlantable) cropBlock);
                    if (hasCrops) {
                        return true;
                    }
                }
            }
        }
    }

    return false;
}
项目:harshencastle    文件:BasePontusResourceBiome.java   
public Block getMergerBlock(boolean isLevelDown)
{
    if(isLevelDown)
        return getMergerBlockDownLevel();
    else
        return getMergerBlockUpLevel();
}
项目:ExSartagine    文件:BlockSmelter.java   
@Override
public boolean canPlaceBlockAt(World world, BlockPos pos) {
    Block blockDown = world.getBlockState(pos.down()).getBlock();
    if(blockDown == Blocks.LIT_FURNACE ||blockDown == Blocks.FURNACE || blockDown == ExSartagineBlock.range_extension){
                return true;
    }
    return false;
}
项目:Adventurers-Toolbox    文件:ItemATMace.java   
@Override
public float getDestroySpeed(ItemStack stack, IBlockState state) {
    Block block = state.getBlock();

    if (block == Blocks.WEB) {
        return 15.0F;
    } else {
        Material material = state.getMaterial();
        return material != Material.PLANTS && material != Material.VINE && material != Material.CORAL
                && material != Material.LEAVES && material != Material.GOURD ? 1.0F : 1.5F;
    }
}
项目:customstuff4    文件:ItemSlab.java   
public ItemSlab(Block block, ContentBlockSlab content)
{
    super(block, content);
    singleSlab = block;
    singleSlabCS = (CSBlock) block;

    this.content = content;
}
项目:minecraft-territorialdealings    文件:ValueTable.java   
static int getValueFromBlock(Block block)
{
    if (block == null) { return 0; }

    if (block == Blocks.EMERALD_BLOCK) { return emeraldValue * 9; }
    else if (block == Blocks.DIAMOND_BLOCK) { return diamondValue * 9; }
    else if (block == Blocks.GOLD_BLOCK) { return goldValue * 9; }

    return 0;
}
项目:Backmemed    文件:Shaders.java   
public static void setBlockEntityId(TileEntity tileEntity)
{
    if (isRenderingWorld && !isShadowPass && uniformBlockEntityId.isDefined())
    {
        Block block = tileEntity.getBlockType();
        int i = Block.getIdFromBlock(block);
        uniformBlockEntityId.setValue(i);
    }
}
项目:pnc-repressurized    文件:DroneAIDig.java   
@Nonnull
private static ItemStack getSilkTouchBlock(Block block, IBlockState state) {
    Item item = Item.getItemFromBlock(block);
    if (item == Items.AIR) {
        return ItemStack.EMPTY;
    } else {
        return new ItemStack(item, 1, block.getMetaFromState(state));
    }
}
项目:Bewitchment    文件:FlawlessRecipe.java   
public FlawlessRecipe(ItemStack result, Object... inputs) {
    this.result = result;

    final List<Object> stackedList = Arrays.stream(inputs).map(obj -> {
        if (obj instanceof Item) return new ItemStack((Item) obj);
        else if (obj instanceof Block) return new ItemStack((Block) obj);
        else return obj;
    }).collect(Collectors.toList());

    neededItems = ImmutableList.copyOf(stackedList);
}
项目:DecompiledMinecraft    文件:BlockState.java   
public <T extends Comparable<T>, V extends T> IBlockState withProperty(IProperty<T> property, V value)
{
    if (!this.properties.containsKey(property))
    {
        throw new IllegalArgumentException("Cannot set property " + property + " as it does not exist in " + this.block.getBlockState());
    }
    else if (!property.getAllowedValues().contains(value))
    {
        throw new IllegalArgumentException("Cannot set property " + property + " to " + value + " on block " + Block.blockRegistry.getNameForObject(this.block) + ", it is not an allowed value");
    }
    else
    {
        return (IBlockState)(this.properties.get(property) == value ? this : (IBlockState)this.propertyValueTable.get(property, value));
    }
}
项目:interactionwheel    文件:DefaultWheelActionProvider.java   
@Override
    public void updateWheelActions(@Nonnull Set<String> actions, @Nonnull EntityPlayer player, World world, @Nullable BlockPos pos) {
        ItemStack heldItem = player.getHeldItem(EnumHand.MAIN_HAND);
        if (ItemStackTools.isValid(heldItem)) {
            actions.add(StandardWheelActions.ID_SEARCH);
        }
        if (pos != null) {
            actions.add(StandardWheelActions.ID_ROTATE);
            Block block = world.getBlockState(pos).getBlock();
            TileEntity te = world.getTileEntity(pos);
            if (te instanceof IInventory || (te != null && te.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null))) {
                actions.add(StandardWheelActions.ID_DUMP);
                actions.add(StandardWheelActions.ID_EXTRACT);
                actions.add(StandardWheelActions.ID_DUMPORES);
                actions.add(StandardWheelActions.ID_DUMPBLOCKS);
                actions.add(StandardWheelActions.ID_DUMPSIMILARINV);
                if (ItemStackTools.isValid(heldItem)) {
                    actions.add(StandardWheelActions.ID_DUMP1);
                    actions.add(StandardWheelActions.ID_DUMPSIMILAR);
                }
            }
            actions.add(StandardWheelActions.ID_PICKTOOL);

            if (block instanceof IWheelBlockSupport) {
                ((IWheelBlockSupport) block).updateWheelActions(actions);
            }
        }
//        actions.add("std.dummy0");
//        actions.add("std.dummy1");
//        actions.add("std.dummy2");
//        actions.add("std.dummy3");
//        actions.add("std.dummy4");
//        actions.add("std.dummy5");
//        actions.add("std.dummy7");
//        actions.add("std.dummy8");
//        actions.add("std.dummy9");
//        actions.add("std.dummy10");
    }
项目:Backmemed    文件:CommandBase.java   
/**
 * Gets the Block specified by the given text string.  First checks the block registry, then tries by parsing the
 * string as an integer ID (deprecated).  Warns the sender if we matched by parsing the ID.  Throws if the block
 * wasn't found.  Returns the block if it was found.
 */
public static Block getBlockByText(ICommandSender sender, String id) throws NumberInvalidException
{
    ResourceLocation resourcelocation = new ResourceLocation(id);

    if (!Block.REGISTRY.containsKey(resourcelocation))
    {
        throw new NumberInvalidException("commands.give.block.notFound", new Object[] {resourcelocation});
    }
    else
    {
        return (Block)Block.REGISTRY.getObject(resourcelocation);
    }
}
项目:DecompiledMinecraft    文件:ItemSlab.java   
public ItemSlab(Block block, BlockSlab singleSlab, BlockSlab doubleSlab)
{
    super(block);
    this.singleSlab = singleSlab;
    this.doubleSlab = doubleSlab;
    this.setMaxDamage(0);
    this.setHasSubtypes(true);
}
项目:DecompiledMinecraft    文件:EntityFishHook.java   
/**
 * (abstract) Protected helper method to write subclass entity data to NBT.
 */
public void writeEntityToNBT(NBTTagCompound tagCompound)
{
    tagCompound.setShort("xTile", (short)this.xTile);
    tagCompound.setShort("yTile", (short)this.yTile);
    tagCompound.setShort("zTile", (short)this.zTile);
    ResourceLocation resourcelocation = (ResourceLocation)Block.blockRegistry.getNameForObject(this.inTile);
    tagCompound.setString("inTile", resourcelocation == null ? "" : resourcelocation.toString());
    tagCompound.setByte("shake", (byte)this.shake);
    tagCompound.setByte("inGround", (byte)(this.inGround ? 1 : 0));
}