Package net.minecraft.block

Examples of net.minecraft.block.Block


        Constants.NBT.TAG_COMPOUND);

    for (int i = 0; i < blocksMapping.tagCount(); ++i) {
      NBTTagCompound sub = blocksMapping.getCompoundTagAt(i);
      String name = sub.getString("name");
      Block b = (Block) Block.blockRegistry.getObject(name);
      registerBlock (b);
    }

    NBTTagList itemsMapping = nbt.getTagList("itemsMapping",
        Constants.NBT.TAG_COMPOUND);
View Full Code Here


  @Override
  public ItemStack onFocusRightClick(ItemStack itemstack, World world, EntityPlayer player, MovingObjectPosition mop) {
    if (mop == null)
      return itemstack;

    Block block = world.getBlock(mop.blockX, mop.blockY, mop.blockZ);
    int meta = world.getBlockMetadata(mop.blockX, mop.blockY, mop.blockZ);
        TileEntity tile = world.getTileEntity(mop.blockX, mop.blockY, mop.blockZ);
    ItemWandCasting wand = (ItemWandCasting) itemstack.getItem();

    if (player.canPlayerEdit(mop.blockX, mop.blockY, mop.blockZ, mop.sideHit, itemstack)) {
      ItemStack stack = getPickedBlock(itemstack);
      if (stack != null) {
        if (mop.sideHit == 0)
          --mop.blockY;
        if (mop.sideHit == 1)
          ++mop.blockY;
        if (mop.sideHit == 2)
          --mop.blockZ;
        if (mop.sideHit == 3)
          ++mop.blockZ;
        if (mop.sideHit == 4)
          --mop.blockX;
        if (mop.sideHit == 5)
          ++mop.blockX;

        if (block.canPlaceBlockOnSide(world, mop.blockX, mop.blockY, mop.blockZ, mop.sideHit)) {
          if (!world.isRemote) {
            world.setBlock(mop.blockX, mop.blockY, mop.blockZ, ((ItemBlock) stack.getItem()).field_150939_a, stack.getItemDamage(), 1 | 2);
            block.onBlockPlacedBy(world, mop.blockX, mop.blockY, mop.blockZ, player, itemstack);
            NBTTagCompound tileCmp = getStackTileEntity(itemstack);
            if (tileCmp != null && !tileCmp.hasNoTags()) {
              TileEntity tile1 = TileEntity.createAndLoadEntity(tileCmp);
              tile1.xCoord = mop.blockX;
              tile1.yCoord = mop.blockY;
              tile1.zCoord = mop.blockZ;
              world.setTileEntity(mop.blockX, mop.blockY, mop.blockZ, tile1);
            }
          } else player.swingItem();
          clearPickedBlock(itemstack);

          for (int i = 0; i < 8; i++) {
            float x = (float) (mop.blockX + Math.random());
            float y = (float) (mop.blockY + Math.random()) + 0.65F;
            float z = (float) (mop.blockZ + Math.random());
            ThaumicTinkerer.tcProxy.burst(world, x, y, z, 0.2F);
          }
          world.playSoundAtEntity(player, "thaumcraft:wand", 0.5F, 1F);
        }
      } else if (!blacklist.contains(block) && !ThaumcraftApi.portableHoleBlackList.contains(block) && block != null && block.getBlockHardness(world, mop.blockX, mop.blockY, mop.blockZ) != -1F && wand.consumeAllVis(itemstack, player, getCost(tile), true, false)) {
        if (!world.isRemote) {
          world.removeTileEntity(mop.blockX, mop.blockY, mop.blockZ);
          world.setBlock(mop.blockX, mop.blockY, mop.blockZ, Blocks.air, 0, 1 | 2);
          storePickedBlock(itemstack, block, (short) meta, tile);
        }
View Full Code Here

      focus = wand.getFocusItem(stack);
    } else {
      focus = stack;
    }
    String name = ItemNBTHelper.getString(focus, TAG_BLOCK_NAME, "");
    Block block = Block.getBlockFromName(name);
    if (block == Blocks.air) {
      int id = ItemNBTHelper.getInt(focus, TAG_BLOCK_ID, 0);
      block = Block.getBlockById(id);
    }
    int meta = ItemNBTHelper.getInt(focus, TAG_BLOCK_META, 0);
View Full Code Here

      int zs = (int) par3EntityPlayer.posZ;

      for (int x = xs - 3; x < xs + 3; x++)
        for (int y = ys - 3; y < ys + 3; y++)
          for (int z = zs - 3; z < zs + 3; z++) {
            Block block = par2World.getBlock(x, y, z);
            if (block != null && block instanceof BlockGas) {
              BlockGas gas = (BlockGas) block;
              gas.placeParticle(par2World, x, y, z);
              par2World.setBlock(x, y, z, Blocks.air, 0, 1 | 2);
            }
View Full Code Here

            return;

        MovingObjectPosition pos = BlockUtils.getTargetBlock(p.worldObj, p, false);

        if (pos != null) {
            Block block = p.worldObj.getBlock(pos.blockX, pos.blockY, pos.blockZ);
            int meta = p.worldObj.getBlockMetadata(pos.blockX, pos.blockY, pos.blockZ);

            ItemStack blockStack = new ItemStack(block, 1, meta);
            ItemStack result = FurnaceRecipes.smelting().getSmeltingResult(blockStack);
View Full Code Here

  public void preInit() {
    registerClasses();
    for (Class clazz : blockClasses) {
      try {
        Block newBlock = (Block) clazz.newInstance();
        if (((ITTinkererBlock) newBlock).shouldRegister()) {
          newBlock.setBlockName(((ITTinkererBlock) newBlock).getBlockName());
          ArrayList<Block> blockList = new ArrayList<Block>();
          blockList.add(newBlock);

          if (newBlock == null) {
                        ThaumicTinkerer.log.debug(clazz.getName() + " Returned a null block upon registration");
            continue;
          }

          if (((ITTinkererBlock) newBlock).getSpecialParameters() != null) {
            for (Object param : ((ITTinkererBlock) newBlock).getSpecialParameters()) {

              for (Constructor constructor : clazz.getConstructors()) {
                if (constructor.getParameterTypes().length > 0 && constructor.getParameterTypes()[0].isAssignableFrom(param.getClass())) {
                  Block nextBlock = (Block) clazz.getConstructor(param.getClass()).newInstance(param);
                  nextBlock.setBlockName(((ITTinkererBlock) nextBlock).getBlockName());
                  blockList.add(nextBlock);
                  break;
                }
              }
            }
View Full Code Here

        return Lists.newArrayList(block);
    }

    @Override
    public TMultiPart convert(World world, BlockCoord pos) {
        Block blockInQuestion = world.getBlock(pos.x, pos.y, pos.z);
        int meta = world.getBlockMetadata(pos.x, pos.y, pos.z);
        if (blockInQuestion == block) {
            try {
                if (part.getName().equals("vazkii.tinkerer.common.block.multipart.PartNitor") && meta != 1)
                    return null;
View Full Code Here

    MovingObjectPosition pos = ToolHandler.raytraceFromEntity(par2World, par3Entity, true, 4.5F);
    String typeToFind = "";

    if (player.isSwingInProgress && pos != null) {
      Block block = par2World.getBlock(pos.blockX, pos.blockY, pos.blockZ);

      if (block != null) {
        Material mat = block.getMaterial();
        if (ToolHandler.isRightMaterial(mat, ToolHandler.materialsPick))
          typeToFind = "pick";
        else if (ToolHandler.isRightMaterial(mat, ToolHandler.materialsShovel))
          typeToFind = "shovel";
        else if (ToolHandler.isRightMaterial(mat, ToolHandler.materialsAxe))
View Full Code Here

    setMaxStackSize(1);
  }

  @Override
  public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) {
    Block block = par3World.getBlock(par4, par5, par6);
    int meta = par3World.getBlockMetadata(par4, par5, par6);

    if (par2EntityPlayer.isSneaking()) {
      if (block != null && block.getRenderType() == 0)
        setBlock(par1ItemStack, block, meta);
    } else placeAllBlocks(par1ItemStack, par2EntityPlayer);

    return true;
  }
View Full Code Here

      if (stackInSlot != null && stackInSlot.getItem() == ThaumicTinkerer.registry.getFirstItemFromClass(ItemBlockTalisman.class))
        talismansToCheck.add(stackInSlot);
    }

    for (ItemStack talisman : talismansToCheck) {
      Block block = ItemBlockTalisman.getBlock(talisman);
      int meta = ItemBlockTalisman.getBlockMeta(talisman);

      if (Item.getItemFromBlock(block) == blockToPlace.getItem() && meta == blockToPlace.getItemDamage()) {
        ItemBlockTalisman.remove(talisman, 1);
        return;
View Full Code Here

TOP

Related Classes of net.minecraft.block.Block

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.