Class ClusterBlock

java.lang.Object
net.minecraft.src.Block
api.block.blocks.ClusterBlock
Direct Known Subclasses:
CandleBlock, PlacedStoneBlock

public class ClusterBlock extends Block
A block that represents multiple of an item.

Can support up to four items by default, with two bits left for other data

  • Field Details

    • clusterBitmask

      protected int clusterBitmask
      Cluster bitmask
  • Constructor Details

    • ClusterBlock

      public ClusterBlock(int id, Material material)
  • Method Details

    • onBlockActivated

      public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ)
      Description copied from class: Block
      Called upon block activation (right click on the block.)
      Overrides:
      onBlockActivated in class Block
    • onNeighborBlockChange

      public void onNeighborBlockChange(World world, int x, int y, int z, int neighborBlockID)
      Description copied from class: Block
      Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are their own) Args: x, y, z, neighbor blockID // +++START EDIT+++ FCNOTE: Only called on server // ---END EDIT---
      Overrides:
      onNeighborBlockChange in class Block
    • onNeighborDisrupted

      public void onNeighborDisrupted(World world, int x, int y, int z, int toFacing)
      Overrides:
      onNeighborDisrupted in class Block
    • convertBlock

      public boolean convertBlock(ItemStack stack, World world, int x, int y, int z, int fromSide)
      Description copied from class: Block
      Returns false if the block has not been replaced with another, and should be removed
      Overrides:
      convertBlock in class Block
    • dropBlockAsItemWithChance

      public void dropBlockAsItemWithChance(World world, int x, int y, int z, int metadata, float chance, int fortuneModifier)
      Description copied from class: Block
      Drops the block items with a specified chance of dropping the specified items
      Overrides:
      dropBlockAsItemWithChance in class Block
    • getStackRetrievedByBlockDispenser

      public ItemStack getStackRetrievedByBlockDispenser(World world, int i, int j, int k)
      Description copied from class: Block
      If the stack returned is null, the block will not be retrieved
      Overrides:
      getStackRetrievedByBlockDispenser in class Block
    • canConvertBlock

      public boolean canConvertBlock(ItemStack stack, World world, int x, int y, int z)
      Overrides:
      canConvertBlock in class Block
    • isOpaqueCube

      public boolean isOpaqueCube()
      Description copied from class: Block
      // +++START EDIT+++ // ---END EDIT--- Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block.
      Overrides:
      isOpaqueCube in class Block
    • renderAsNormalBlock

      public boolean renderAsNormalBlock()
      Description copied from class: Block
      If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc)
      Overrides:
      renderAsNormalBlock in class Block
    • isBlockRestingOnThatBelow

      public boolean isBlockRestingOnThatBelow(IBlockAccess blockAccess, int x, int y, int z)
      Description copied from class: Block
      returns true if the block is sitting on the one below, like a torch resting on the ground
      Overrides:
      isBlockRestingOnThatBelow in class Block
    • getPreventsFluidFlow

      public boolean getPreventsFluidFlow(World world, int x, int y, int z, Block fluidBlock)
      Overrides:
      getPreventsFluidFlow in class Block
    • canBeCrushedByFallingEntity

      public boolean canBeCrushedByFallingEntity(World world, int i, int j, int k, EntityFallingSand entity)
      Overrides:
      canBeCrushedByFallingEntity in class Block
    • getCollisionBoundingBoxFromPool

      public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z)
      Overrides:
      getCollisionBoundingBoxFromPool in class Block
    • shouldSideBeRendered

      @Environment(CLIENT) public boolean shouldSideBeRendered(IBlockAccess blockAccess, int iNeighborI, int iNeighborJ, int iNeighborK, int iSide)
      Overrides:
      shouldSideBeRendered in class Block
    • attemptToCombineWithBlock

      public boolean attemptToCombineWithBlock(ItemStack itemStack, World world, int i, int j, int k, int facing, float clickX, float clickY, float clickZ)
      true if the incoming ItemStack has successfully combined with this cluster block. Facing and click data are provided for granular interaction.

      Hook for ClusterBlockItem

    • onSuccessfulCombination

      public void onSuccessfulCombination(World world, int i, int j, int k)
      Called upon a successful item -> cluster block combination.
    • canCombineWithBlock

      public boolean canCombineWithBlock(ItemStack stack, World world, int i, int j, int k, int itemDamage)
      true if the incoming ItemStack is valid for combining with this block.
    • getClusterCount

      public int getClusterCount(IBlockAccess blockAccess, int i, int j, int k)
      Returns:
      The current count of items represented in this block
    • getClusterCount

      public int getClusterCount(int metadata)
      Returns:
      The current count of items represented in this block
    • setClusterCount

      public void setClusterCount(World world, int i, int j, int k, int count)
      Sets the current count of items represented in this block
    • incrementClusterCount

      public boolean incrementClusterCount(World world, int i, int j, int k)
      Increments the cluster count
    • decrementClusterCount

      public boolean decrementClusterCount(World world, int i, int j, int k)
      Decrements the cluster count
    • getClusterMax

      public int getClusterMax()
      Gets the maximum cluster count in this block
    • setClusterBitmask

      public ClusterBlock setClusterBitmask(int bitmask)
      Sets the maximum cluster count in this block

      Should follow bit values (2, 4, 8, 16)

    • idPicked

      @Environment(CLIENT) public int idPicked(World world, int x, int y, int z)
      Description copied from class: Block
      only called by clickMiddleMouseButton , and passed to inventory.setCurrentItem (along with isCreative) // +++START EDIT+++ FCNOTE: Client only // ---END EDIT---
      Overrides:
      idPicked in class Block