Interface ICustomBlockInteract


public interface ICustomBlockInteract
Implement this and register it with IDroneRegistry.registerCustomBlockInteractor(RegistryEvent.Register, ICustomBlockInteract). This will add a puzzle piece that has only an Area white- and blacklist parameter (similar to a Goto piece). This could be used to create custom energy import/export widgets, for example.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    doInteract(net.minecraft.core.BlockPos pos, IDrone drone, IBlockInteractHandler interactHandler, boolean simulate)
    The actual interaction.
    net.minecraft.world.item.DyeColor
    Used for crafting, categorizes the puzzle piece.
    net.minecraft.resources.ResourceLocation
    Get a unique name for this puzzle piece.
    net.minecraft.resources.ResourceLocation
    Get the puzzle piece texture.
  • Method Details

    • getID

      net.minecraft.resources.ResourceLocation getID()
      Get a unique name for this puzzle piece. This is a Forge Registry entry so make it unique, and namespaced with your mod's ID.
      Returns:
      a unique ID
    • getTexture

      net.minecraft.resources.ResourceLocation getTexture()
      Get the puzzle piece texture. Should be a multiple of 80x64 (width x height). I'd recommend starting out by copying the Go To widget texture
      Returns:
      a resource location for the texture to be used
    • doInteract

      boolean doInteract(net.minecraft.core.BlockPos pos, IDrone drone, IBlockInteractHandler interactHandler, boolean simulate)
      The actual interaction.

      For each blockpos in the specified area, the drone will visit that block (ordered from closest to furthest). It will call this method with simulate = true. If this method returns true, the drone will navigate to this location, and call this method again with simulate = false. It will keep doing this until this method returns false.

      In the puzzle piece GUI, players can specify a 'use count' and fill in the maximum count they want to use. When IBlockInteractHandler.useCount() returns true, and simulate is false, you must only import/export up to IBlockInteractHandler.getRemainingCount(), and you must notify the transferred amount by doing IBlockInteractHandler.decreaseCount(int).

      Parameters:
      pos - current visited location
      drone - a reference to the drone object
      interactHandler - object you can use to use to get accessible sides and give feedback about counts.
      simulate - true when trying to figure out whether or not the drone should navigate to this block, false when next to this block.
      Returns:
      true if the interaction was (would be) successful
    • getColor

      net.minecraft.world.item.DyeColor getColor()
      Used for crafting, categorizes the puzzle piece.
      Returns:
      a color