Package net.minecraft.block

Examples of net.minecraft.block.Block


      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) == reqStack.getItem() && meta == reqStack.getItemDamage()) {
        current += ItemBlockTalisman.getBlockCount(talisman);
View Full Code Here


  public static ChunkCoordinates[] getBlocksToPlace(ItemStack stack, EntityPlayer player) {
    List<ChunkCoordinates> coords = new ArrayList();
    MovingObjectPosition pos = ToolHandler.raytraceFromEntity(player.worldObj, player, true, 5);
    if (pos != null) {
      Block block = player.worldObj.getBlock(pos.blockX, pos.blockY, pos.blockZ);
      if (block != null && block.isReplaceable(player.worldObj, pos.blockX, pos.blockY, pos.blockZ))
        pos.blockY--;

      ForgeDirection dir = ForgeDirection.getOrientation(pos.sideHit);
      int rotation = MathHelper.floor_double(player.rotationYaw * 4F / 360F + 0.5D) & 3;
      int range = (getSize(stack) ^ 1) / 2;

      boolean topOrBottom = dir == ForgeDirection.UP || dir == ForgeDirection.DOWN;

      int xOff = !(dir == ForgeDirection.WEST || dir == ForgeDirection.EAST) ? topOrBottom ? player.rotationPitch > 75 || (rotation & 1) == 0 ? range : 0 : range : 0;
      int yOff = topOrBottom ? player.rotationPitch > 75 ? 0 : range : range;
      int zOff = !(dir == ForgeDirection.SOUTH || dir == ForgeDirection.NORTH) ? topOrBottom ? player.rotationPitch > 75 || (rotation & 1) == 1 ? range : 0 : range : 0;

      for (int x = -xOff; x < xOff + 1; x++)
        for (int y = 0; y < yOff * 2 + 1; y++) {
          for (int z = -zOff; z < zOff + 1; z++) {
            int xp = pos.blockX + x + dir.offsetX;
            int yp = pos.blockY + y + dir.offsetY;
            int zp = pos.blockZ + z + dir.offsetZ;

            Block block1 = player.worldObj.getBlock(xp, yp, zp);
            if (block1 == null || block1.isAir(player.worldObj, xp, yp, zp) || block1.isReplaceable(player.worldObj, xp, yp, zp))
              coords.add(new ChunkCoordinates(xp, yp, zp));
          }
        }

    }
View Full Code Here

  public static int getBlockID(ItemStack stack) {
    return ItemNBTHelper.getInt(stack, TAG_BLOCK_ID, 0);
  }

  public static Block getBlock(ItemStack stack) {
    Block block = Block.getBlockFromName(getBlockName(stack));
    if (block == Blocks.air)
      block = Block.getBlockById(getBlockID(stack));

    return block;
  }
View Full Code Here

  }

  @Override
  @SideOnly(Side.CLIENT)
  public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
    Block block = getBlock(par1ItemStack);
    int size = getSize(par1ItemStack);

    par3List.add(size + " x " + size);
    if (block != null && block != Blocks.air)
      par3List.add(StatCollector.translateToLocal(new ItemStack(block, 1, getBlockMeta(par1ItemStack)).getUnlocalizedName() + ".name"));
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);
    if (block == ThaumicTinkerer.registry.getFirstBlockFromClass(BlockWarpGate.class) && !isAttuned(par1ItemStack)) {
      setValues(par1ItemStack, par4, par5, par6, par2EntityPlayer.dimension);
      par3World.playSoundAtEntity(par2EntityPlayer, "random.orb", 0.3F, 0.1F);
    }
View Full Code Here

    return par1ItemStack;
  }

  @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);
    boolean set = setBlock(par1ItemStack, block, meta);

    if (!set) {
      Block bBlock = getBlock(par1ItemStack);
      int bmeta = getBlockMeta(par1ItemStack);

      TileEntity tile = par3World.getTileEntity(par4, par5, par6);
      if (tile != null && tile instanceof IInventory) {
        IInventory inv = (IInventory) tile;
View Full Code Here

  public static String getBlockName(ItemStack stack) {
    return ItemNBTHelper.getString(stack, TAG_BLOCK_NAME, "");
  }

  public static Block getBlock(ItemStack stack) {
    Block block = Block.getBlockFromName(getBlockName(stack));
    if (block == Blocks.air)
      block = Block.getBlockById(getBlockID(stack));

    return block;
  }
View Full Code Here

  }

  @Override
  @SideOnly(Side.CLIENT)
  public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
    Block block = getBlock(par1ItemStack);
    if (block != null && block != Blocks.air) {
      int count = getBlockCount(par1ItemStack);
      par3List.add(StatCollector.translateToLocal(new ItemStack(block, 1, getBlockMeta(par1ItemStack)).getUnlocalizedName() + ".name") + " (x" + count + ")");
    }
View Full Code Here

    return BaubleType.RING;
  }

  @Override
  public void onWornTick(ItemStack itemstack, EntityLivingBase entity) {
    Block block = getBlock(itemstack);
    if (!entity.worldObj.isRemote && itemstack.getItemDamage() == 1 && block != Blocks.air && entity instanceof EntityPlayer) {
      EntityPlayer player = (EntityPlayer) entity;
      int meta = getBlockMeta(itemstack);

      int highest = -1;
View Full Code Here

    TileEntity tile = world.getTileEntity(x, y, z);
    int meta = world.getBlockMetadata(x, y, z);

    if (tile instanceof TileCamo) {
      TileCamo camo = (TileCamo) tile;
      Block block = camo.camo;
      if (block != null && isValidRenderType(block.getRenderType()))
        return block.getIcon(side, camo.camoMeta);
    }

    return getIconFromSideAfterCheck(tile, meta, side);
  }
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.