Interface ICustomBlockInteract
public interface ICustomBlockInteract
Implement this and register it with
IDroneRegistry.registerCustomBlockInteractor(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 TypeMethodDescriptionbooleandoInteract(net.minecraft.core.BlockPos pos, IDrone drone, IBlockInteractHandler interactHandler, boolean simulate) The actual interaction.net.minecraft.world.item.DyeColorgetColor()Used for crafting, categorizes the puzzle piece.getID()Get a unique name for this puzzle piece.net.minecraft.resources.ResourceLocationGet the puzzle piece texture.
-
Method Details
-
getID
String getID()Get a unique name for this puzzle piece. This will be an ID in the "pneumaticcraft:" namespace so it's recommended to prefix the string with your mod ID, or some other unique string, to avoid clashes.- 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 withsimulate= 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, andsimulateis false, you must only import/export up toIBlockInteractHandler.getRemainingCount(), and you must notify the transferred amount by doingIBlockInteractHandler.decreaseCount(int).- Parameters:
pos- current visited locationdrone- a reference to the drone objectinteractHandler- object you can use to get accessible sides and give feedback about countssimulate- true when determining whether 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
-