Class BlocklyBlockUtil

java.lang.Object
net.mcreator.blockly.BlocklyBlockUtil

public class BlocklyBlockUtil extends Object
  • Constructor Details

    • BlocklyBlockUtil

      public BlocklyBlockUtil()
  • Method Details

    • getStartBlock

      public static Element getStartBlock(Document document, String typeBlockName)
      Returns the start block (trigger block) for the given XML document
      Parameters:
      document - XML document to look in
      Returns:
      Start block XML element or null if not found
    • getBlockProcedureStartingWithBlock

      public static List<Element> getBlockProcedureStartingWithBlock(Element start_block)
    • getBlockProcedureStartingWithNext

      public static List<Element> getBlockProcedureStartingWithNext(Element start_block)
      Returns the list of blocks that are directly arranged in the procedural order for the given start block under which to look for next elements

      NOTE: The first element under given start_block must be "next" in order for this method to work.

      Parameters:
      start_block - The block under which to look for elements
      Returns:
      List of blocks under given block in execute order
    • getBlockColorFromHUE

      public static Color getBlockColorFromHUE(int hue)
      Calculates block's full color out of its hue value.
      Parameters:
      hue - The block's hue number
      Returns:
      Block's render number
    • getInputBlockType

      public static String getInputBlockType(Element input)
      Returns the type of the block attached to an input element
      Parameters:
      input - The input node of the block
      Returns:
      The type of the block attached to the input, or null if no block is attached