Package net.minecraft.item

Examples of net.minecraft.item.ItemBlock


    ItemStack stck;
    //if(block instanceof BlockReed)
    //{
    //   stck=new ItemStack(Items.reeds,1,meta);
    //}
    stck = new ItemStack(new ItemBlock(block), 1, meta);
    return stck;
  }
View Full Code Here


        {
          IAEItemStack request = Util.createItemStack(Util.getCellRegistry().getHandlerForCell(itemstack).getAvailableItems().getItems().get(0).copy());
          ItemStack block = request.getItemStack();
          if (block.getItem() instanceof ItemBlock)
          {
            ItemBlock itemblock = (ItemBlock) request.getItem();
            if (world.getBlockId(x, y, z) != 7)
            {
              switch (itemstack.getTagCompound().getInteger("mode"))
              {
              case 0:
                request.setStackSize(1);
                itemblock.onItemUseFirst(request.getItemStack(), player, world, x, y, z, side, xOffset, yOffset, zOffset);
                itemblock.onItemUse(request.getItemStack(), player, world, x, y, z, side, xOffset, yOffset, zOffset);
                Util.getCellRegistry().getHandlerForCell(itemstack).extractItems(request);
                break;
              case 1:
                request.setStackSize(1);
                world.destroyBlock(x, y, z, true);
View Full Code Here

    }
  }

  public void placeBlock(ItemStack itemstack, World world, EntityPlayer player, int x, int y, int z, int side, float xOffset, float yOffset, float zOffset)
  {
    ItemBlock itemblock = (ItemBlock) itemstack.getItem();
    switch (ForgeDirection.getOrientation(side))
    {
    case DOWN:
      itemblock.onItemUseFirst(itemstack, player, world, x, y++, z, side, xOffset, yOffset, zOffset);
      itemblock.onItemUse(itemstack, player, world, x, y++, z, side, xOffset, yOffset, zOffset);
      break;
    case EAST:
      itemblock.onItemUseFirst(itemstack, player, world, x--, y, z, side, xOffset, yOffset, zOffset);
      itemblock.onItemUse(itemstack, player, world, x--, y, z, side, xOffset, yOffset, zOffset);
      break;
    case NORTH:
      itemblock.onItemUseFirst(itemstack, player, world, x, y, z++, side, xOffset, yOffset, zOffset);
      itemblock.onItemUse(itemstack, player, world, x, y, z++, side, xOffset, yOffset, zOffset);
      break;
    case SOUTH:
      itemblock.onItemUseFirst(itemstack, player, world, x, y, z--, side, xOffset, yOffset, zOffset);
      itemblock.onItemUse(itemstack, player, world, x, y, z--, side, xOffset, yOffset, zOffset);
      break;
    case UNKNOWN:
      break;
    case UP:
      itemblock.onItemUseFirst(itemstack, player, world, x, y--, z, side, xOffset, yOffset, zOffset);
      itemblock.onItemUse(itemstack, player, world, x, y--, z, side, xOffset, yOffset, zOffset);
      break;
    case WEST:
      itemblock.onItemUseFirst(itemstack, player, world, x++, y, z, side, xOffset, yOffset, zOffset);
      itemblock.onItemUse(itemstack, player, world, x++, y, z, side, xOffset, yOffset, zOffset);
      break;
    default:
      break;

    }
View Full Code Here

    }

    protected boolean worksWith(final Block referenceBlock, final int referenceMetadata) {
        for (ItemStack stack : blocks) {
            if (stack != null && stack.getItem() instanceof ItemBlock) {
                final ItemBlock item = (ItemBlock) stack.getItem();
                final Block supportedBlock = item.field_150939_a;
                final int supportedMetadata = item.getMetadata(stack.getItemDamage());
                if (referenceBlock == supportedBlock && (referenceMetadata == supportedMetadata || stack.getItemDamage() == OreDictionary.WILDCARD_VALUE)) {
                    return true;
                }
            }
        }
View Full Code Here

            return;
        }

        var1.addChatMessage(new ChatComponentTranslation("denseores.commandIdentify.start", item.toString()));

        ItemBlock itemBlock = (ItemBlock) item.getItem();
        Block b = itemBlock.field_150939_a;
        int metadata = itemBlock.getMetadata(item.getItemDamage());


        boolean isUnusual = b.getRenderType() != 0;

        var1.addChatMessage(new ChatComponentTranslation("S:baseBlock=%s", GameData.getBlockRegistry().getNameForObject(b)));
View Full Code Here

        if ( randomItem != null )
        {
          if ( randomItem.getItem() instanceof ItemBlock )
          {
            ItemBlock ib = (ItemBlock) randomItem.getItem();
            Block blk = Block.getBlockFromItem( ib );

            if ( AEApi.instance().partHelper().getCableRenderMode().transparentFacades )
            {
              if ( rbw != null )
                rbw.opacity = 0.3f;
              instance.renderForPass( 1 );
            }
            else
            {
              if ( blk.canRenderInPass( 1 ) )
              {
                instance.renderForPass( 1 );
              }
            }

            int color = 0xffffff;

            try
            {
              color = ib.getColorFromItemStack( randomItem, 0 );
            }
            catch (Throwable ignored)
            {
            }

            renderer.uvRotateBottom = renderer.uvRotateEast = renderer.uvRotateNorth = renderer.uvRotateSouth = renderer.uvRotateTop = renderer.uvRotateWest = 0;
            instance.setBounds( 0, 0, 16 - getFacadeThickness(), 16, 16, 16 );
            instance.prepareBounds( renderer );

            if ( rbw != null )
            {
              rbw.isFacade = true;

              rbw.calculations = true;
              rbw.faces = EnumSet.noneOf( ForgeDirection.class );

              if ( prevLight != null && rbw.similarLighting( blk, rbw.blockAccess, x, y, z, prevLight ) )
                rbw.populate( prevLight );
              else
              {
                instance.setRenderColor( color );
                rbw.renderStandardBlock( instance.getBlock(), x, y, z );
                instance.setRenderColor( 0xffffff );
                prevLight = rbw.getLightingCache();
              }

              rbw.calculations = false;
              rbw.faces = calculateFaceOpenFaces( rbw.blockAccess, fc, x, y, z, side );

              ((RenderBlocksWorkaround) renderer).setTexture(
                  blk.getIcon( ForgeDirection.DOWN.ordinal(), ib.getMetadata( randomItem.getItemDamage() ) ),
                  blk.getIcon( ForgeDirection.UP.ordinal(), ib.getMetadata( randomItem.getItemDamage() ) ),
                  blk.getIcon( ForgeDirection.NORTH.ordinal(), ib.getMetadata( randomItem.getItemDamage() ) ),
                  blk.getIcon( ForgeDirection.SOUTH.ordinal(), ib.getMetadata( randomItem.getItemDamage() ) ),
                  blk.getIcon( ForgeDirection.WEST.ordinal(), ib.getMetadata( randomItem.getItemDamage() ) ),
                  blk.getIcon( ForgeDirection.EAST.ordinal(), ib.getMetadata( randomItem.getItemDamage() ) ) );
            }
            else
            {
              instance.setTexture( blk.getIcon( ForgeDirection.DOWN.ordinal(), ib.getMetadata( randomItem.getItemDamage() ) ),
                  blk.getIcon( ForgeDirection.UP.ordinal(), ib.getMetadata( randomItem.getItemDamage() ) ),
                  blk.getIcon( ForgeDirection.NORTH.ordinal(), ib.getMetadata( randomItem.getItemDamage() ) ),
                  blk.getIcon( ForgeDirection.SOUTH.ordinal(), ib.getMetadata( randomItem.getItemDamage() ) ),
                  blk.getIcon( ForgeDirection.WEST.ordinal(), ib.getMetadata( randomItem.getItemDamage() ) ),
                  blk.getIcon( ForgeDirection.EAST.ordinal(), ib.getMetadata( randomItem.getItemDamage() ) ) );
            }

            if ( busBounds == null )
            {
              if ( side == ForgeDirection.UP || side == ForgeDirection.DOWN )
View Full Code Here

        if ( randomItem != null )
        {
          if ( randomItem.getItem() instanceof ItemBlock )
          {
            ItemBlock ib = (ItemBlock) randomItem.getItem();
            Block blk = Block.getBlockFromItem( ib );

            try
            {
              int color = ib.getColorFromItemStack( randomItem, 0 );
              GL11.glColor4f( 1.0f, 1.0f, 1.0f, 1.0F );
              instance.setInvColor( color );
            }
            catch (Throwable error)
            {
              GL11.glColor4f( 1.0f, 1.0f, 1.0f, 1.0F );
              instance.setInvColor( 0xffffff );
            }

            Tessellator.instance.setBrightness( 15 << 20 | 15 << 4 );
            Tessellator.instance.setColorOpaque_F( 1, 1, 1 );
            instance.setTexture( blk.getIcon( side.ordinal(), ib.getMetadata( randomItem.getItemDamage() ) ) );

            instance.setBounds( 0, 0, 14, 16, 16, 16 );
            instance.renderInventoryBox( renderer );

            instance.setTexture( null );
View Full Code Here

            return;

        if (safeToReplace(x, y, z, stock)) {
            Block stockBlock = InvTools.getBlockFromStack(stock);
            List<ItemStack> drops = blockToReplace.getDrops(worldObj, x, y, z, oldMeta, 0);
            ItemBlock item = (ItemBlock) stock.getItem();
            int newMeta = 0;
            if (item.getHasSubtypes())
                newMeta = item.getMetadata(stock.getItemDamage());
            if (worldObj.setBlock(x, y, z, stockBlock, newMeta, 3)) {
                SoundHelper.playBlockSound(worldObj, x, y, z, stockBlock.stepSound.func_150496_b(), (1f + 1.0F) / 2.0F, 1f * 0.8F, stockBlock, newMeta);
                decrStackSize(slotStock, 1);
                for (ItemStack stack : drops) {
                    CartTools.offerOrDropItem(this, stack);
View Full Code Here

    private boolean blockMatches(Block block, int meta, ItemStack stack) {
        if (stack == null)
            return true;

        if (stack.getItem() instanceof ItemBlock) {
            ItemBlock existItem = (ItemBlock) stack.getItem();
            int existMeta = OreDictionary.WILDCARD_VALUE;
            if (existItem.getHasSubtypes())
                existMeta = existItem.getMetadata(stack.getItemDamage());
            Block stackBlock = InvTools.getBlockFromStack(stack);
            return (stackBlock == block && (existMeta == OreDictionary.WILDCARD_VALUE || meta == existMeta)) || (stackBlock == Blocks.dirt && stackBlock == Blocks.grass);
        }
        return false;
    }
View Full Code Here

    int te_z = z;

    if ( host == null && pass == PlaceType.PLACE_ITEM )
    {
      ItemStack is = AEApi.instance().blocks().blockMultiPart.stack( 1 );
      ItemBlock ib = (ItemBlock) is.getItem();
      ForgeDirection offset = ForgeDirection.UNKNOWN;

      Block blkID = world.getBlock( x, y, z );
      if ( blkID != null && !blkID.isReplaceable( world, x, y, z ) )
      {
        offset = side;
        if ( Platform.isServer() )
          side = side.getOpposite();
      }

      te_x = x + offset.offsetX;
      te_y = y + offset.offsetY;
      te_z = z + offset.offsetZ;

      tile = world.getTileEntity( te_x, te_y, te_z );
      if ( tile instanceof IPartHost )
        host = (IPartHost) tile;

      if ( host == null && tile != null && AppEng.instance.isIntegrationEnabled( IntegrationType.FMP ) )
        host = ((IFMP) AppEng.instance.getIntegration( IntegrationType.FMP )).getOrCreateHost( tile );

      if ( host == null && tile != null && AppEng.instance.isIntegrationEnabled( IntegrationType.ImmibisMicroblocks ) )
        host = ((IImmibisMicroblocks) AppEng.instance.getIntegration( IntegrationType.ImmibisMicroblocks )).getOrCreateHost( player, face, tile );

      if ( host == null && AEApi.instance().blocks().blockMultiPart.block().canPlaceBlockAt( world, te_x, te_y, te_z )
          && ib.placeBlockAt( is, player, world, te_x, te_y, te_z, side.ordinal(), 0.5f, 0.5f, 0.5f, 0 ) )
      {
        if ( !world.isRemote )
        {
          tile = world.getTileEntity( te_x, te_y, te_z );
View Full Code Here

TOP

Related Classes of net.minecraft.item.ItemBlock

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.