2

I've been playing with new designs for a stone generator, playing with how fast I can get it running.

I'm trying a redstone clock / pulse shortener this time.

Is the rate that lava flows in to water fixed? If so how many ticks does it take?

1 Answer 1

4

Let's take a look at the source code of Minecraft 1.8:

 public boolean checkForMixing(World paramWorld, BlockPos paramBlockPos, IBlockState paramIBlockState) {
    if (this.blockMaterial == Material.lava) {
      int i = 0;
      for (EnumFacing localEnumFacing : EnumFacing.values()) {
        if ((localEnumFacing != EnumFacing.DOWN) && (paramWorld.getBlockState(paramBlockPos.offset(localEnumFacing)).getBlock().getMaterial() == Material.water)) {
          i = 1;
          break;
        }
      }
      if (i != 0) {
        ??? = (Integer)paramIBlockState.getValue(LEVEL);
        if (((Integer)???).intValue() == 0) {
          paramWorld.setBlockState(paramBlockPos, Blocks.obsidian.getDefaultState());
          triggerMixEffects(paramWorld, paramBlockPos);
          return true; }
        if (((Integer)???).intValue() <= 4) {
          paramWorld.setBlockState(paramBlockPos, Blocks.cobblestone.getDefaultState());
          triggerMixEffects(paramWorld, paramBlockPos);
          return true;
        }
      }
    }

    return false;
  }

This function determines whether it should create cobblestone or obsidian or nothing. It is called by two other functions, namely onBlockAdded and onNeighborBlockChange.

  • onBlockAdded seems rather self-explanatory, it is called whenever a block has been added and simply calls checkForMixing on the block that has been added (e.g. by using a bucket or because it is flowing and creating new block).
  • onNeighborBlockChange is somewhat more interesting. It is called whenever a neighbouring block has been changed or better whenever it is ticking/updating (there is nothing that needs to change, just calling an update is enough). the problem with your contraption is, water and lava are set to setTickRandomly(true);, so you can't know when they are changing.

There are plenty of automatic (cobble)stone generators that feature a block detection and push forward the generated block, so they don't need to rely on a constant redstone clock.

1
  • What does setTickRandomly do?
    – Some Guy
    May 19, 2022 at 19:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .