Class GhostBlocks

java.lang.Object
net.ixdarklord.coolcatcanvas.api.client.vfx.GhostBlocks

public final class GhostBlocks extends Object
Blocks drawn as ghosts: their real models (block entities' too, a chest as a chest), drawn by the game's own renderers with the player's camera into a picture of their own, then laid over the world at one opacity and tint. As one picture, a ghost shows only its outside, as the real block would, never its inside or far faces through its near ones; and it is in perspective from every side.

Call draw(java.util.Collection<net.ixdarklord.coolcatcanvas.api.client.vfx.GhostBlocks.Placed>, int, net.ixdarklord.coolcatcanvas.api.client.vfx.GhostBlocks.Show, boolean) right after the level is drawn, while its depth is still there. Each call draws one group in one colour; call it once for each.


 GhostBlocks.draw(List.of(new GhostBlocks.Placed(pos, Blocks.CHEST.defaultBlockState())), 0x80FFFFFF,
         GhostBlocks.Show.THROUGH_WALLS, false);
 
  • Method Details

    • draw

      public static void draw(Collection<GhostBlocks.Placed> blocks, int argb, GhostBlocks.Show show, boolean shaded)
      Draws blocks as ghosts in argb: its colour tints them, its alpha is their opacity.
      Parameters:
      shaded - lit as blocks are in the world, each face its own shade; false for every face full bright (so they stand out, through walls say)
    • clearModels

      public static void clearModels()
      Forgets the block models made so far: call after the game's models are reloaded, so new ones are drawn.