Interface IProgWidget

All Superinterfaces:
IProgWidgetBase
All Known Implementing Classes:
ProgWidget, ProgWidgetArea, ProgWidgetAreaItemBase, ProgWidgetBlockCondition, ProgWidgetBlockRightClick, ProgWidgetCC, ProgWidgetComment, ProgWidgetCondition, ProgWidgetConditionBase, ProgWidgetCoordinate, ProgWidgetCoordinateCondition, ProgWidgetCoordinateOperator, ProgWidgetCrafting, ProgWidgetCustomBlockInteract, ProgWidgetDig, ProgWidgetDigAndPlace, ProgWidgetDroneCondition, ProgWidgetDroneConditionEnergy, ProgWidgetDroneConditionEntity, ProgWidgetDroneConditionFluid, ProgWidgetDroneConditionItem, ProgWidgetDroneConditionPressure, ProgWidgetDroneConditionUpgrades, ProgWidgetDropItem, ProgWidgetEditSign, ProgWidgetEmitRedstone, ProgWidgetEnergyCondition, ProgWidgetEnergyExport, ProgWidgetEnergyImport, ProgWidgetEntityAttack, ProgWidgetEntityCondition, ProgWidgetEntityExport, ProgWidgetEntityImport, ProgWidgetEntityRightClick, ProgWidgetExternalProgram, ProgWidgetForEachCoordinate, ProgWidgetForEachItem, ProgWidgetGoToLocation, ProgWidgetHarvest, ProgWidgetInventoryBase, ProgWidgetInventoryExport, ProgWidgetInventoryImport, ProgWidgetItemAssign, ProgWidgetItemCondition, ProgWidgetItemFilter, ProgWidgetItemInventoryCondition, ProgWidgetJump, ProgWidgetLabel, ProgWidgetLightCondition, ProgWidgetLiquidExport, ProgWidgetLiquidFilter, ProgWidgetLiquidImport, ProgWidgetLiquidInventoryCondition, ProgWidgetLogistics, ProgWidgetPickupItem, ProgWidgetPlace, ProgWidgetPressureCondition, ProgWidgetRedstoneCondition, ProgWidgetRename, ProgWidgetStandby, ProgWidgetStart, ProgWidgetSuicide, ProgWidgetTeleport, ProgWidgetText, ProgWidgetVoidItem, ProgWidgetVoidLiquid, ProgWidgetWait

public interface IProgWidget extends IProgWidgetBase
  • Method Details

    • getX

      int getX()
    • getY

      int getY()
    • setX

      void setX(int x)
    • setY

      void setY(int y)
    • getWidth

      int getWidth()
    • getHeight

      int getHeight()
    • getTexture

      net.minecraft.resources.ResourceLocation getTexture()
    • getMaxUV

      org.apache.commons.lang3.tuple.Pair<Float,Float> getMaxUV()
    • getTooltip

      void getTooltip(List<net.minecraft.network.chat.Component> curTooltip)
    • addWarnings

      void addWarnings(List<net.minecraft.network.chat.Component> curInfo, List<IProgWidget> widgets)
    • addErrors

      void addErrors(List<net.minecraft.network.chat.Component> curInfo, List<IProgWidget> widgets)
    • hasStepInput

      boolean hasStepInput()
      Can this widget connect to a widget above?
      Returns:
      true if it can, false otherwise
    • hasStepOutput

      boolean hasStepOutput()
      Can another widget be connected below this widget?
      Returns:
      true if it can, false otherwise
    • freeToUse

      default boolean freeToUse()
    • getWidgetAI

      net.minecraft.world.entity.ai.goal.Goal getWidgetAI(IDroneBase drone, IProgWidget widget)
      Get the AI for this progwidget
      Parameters:
      drone - the drone
      widget - will be 'this' most of the time, but not when controlled externally (e.g. ComputerCraft)
      Returns:
      widget AI
    • getWidgetTargetAI

      net.minecraft.world.entity.ai.goal.Goal getWidgetTargetAI(IDroneBase drone, IProgWidget widget)
      Get the targeting AI for this progwidget
      Parameters:
      drone - the drone
      widget - Will be 'this' most of the time, but not when controlled externally (e.g. ComputerCraft)
      Returns:
      widget targeting AI
    • setOutputWidget

      void setOutputWidget(IProgWidget widget)
      Set the output widget for this widget, i.e. next in the program. Called when building the program.
      Parameters:
      widget - the next widget in the program
    • getOutputWidget

      IProgWidget getOutputWidget()
      Get the next widget in the program; the widget attached to the bottom of this one.
      Returns:
      the next widget to run
    • getOutputWidget

      IProgWidget getOutputWidget(IDroneBase drone, List<IProgWidget> allWidgets)
      Get the next widget in the program, which may or may not be the widget attached to the bottom of this one. This method variant is called when running in a live program, and has access to the drone context and a view of the full program so it can deal with special conditions like jumps etc.
      Parameters:
      drone - the drone
      allWidgets - a list of widgets
      Returns:
      the next widget to run
    • returnType

      ProgWidgetType<?> returnType()
      For parameter widgets that are added onto the left or right of another widget, get the type of the widget being connected to.
      Returns:
      the widget being connected to, or null if this widget isn't a parameter widget.
    • getParameters

      @Nonnull List<ProgWidgetType<?>> getParameters()
      Get the types of the widgets which connect to this widget on the right, in order (top to bottom). Note that the length of the widget array returned by getConnectedParameters() will be double the length of this list, since these widgets can be added on both the right (whitelist) and left (blacklist) sides.
      Returns:
      a list of widget types, or an empty list if no widgets can be added to the side of this widget
    • setParameter

      void setParameter(int index, IProgWidget parm)
    • canSetParameter

      boolean canSetParameter(int index)
    • getConnectedParameters

      IProgWidget[] getConnectedParameters()
    • setParent

      void setParent(IProgWidget widget)
    • getParent

      IProgWidget getParent()
    • getTypeID

      net.minecraft.resources.ResourceLocation getTypeID()
    • getTranslationKey

      default String getTranslationKey()
      Specified by:
      getTranslationKey in interface IProgWidgetBase
    • getColor

      net.minecraft.world.item.DyeColor getColor()
    • isAvailable

      boolean isAvailable()
      Is this widget currently available in this world? i.e. make sure it's not blacklisted by server admin, and any mod dependencies are loaded
      Returns:
      true if the widget is available for use by players
    • writeToNBT

      void writeToNBT(net.minecraft.nbt.CompoundTag tag)
      At least do tag.putString("name", getTypeID().toString());

      Note that the base implementation ProgWidget does this.

      Parameters:
      tag - NBT tag to write to
    • readFromNBT

      void readFromNBT(net.minecraft.nbt.CompoundTag tag)
    • copy

      IProgWidget copy()
    • canBeRunByComputers

      boolean canBeRunByComputers(IDroneBase drone, IProgWidget widget)
    • isDifficultyOK

      default boolean isDifficultyOK(IProgWidget.WidgetDifficulty difficulty)
    • getDifficulty

    • getType

      ProgWidgetType<?> getType()
    • readFromPacket

      void readFromPacket(net.minecraft.network.FriendlyByteBuf buf)
    • writeToPacket

      void writeToPacket(net.minecraft.network.FriendlyByteBuf buf)
    • getExtraStringInfo

      @Nonnull List<net.minecraft.network.chat.Component> getExtraStringInfo()
    • create

      static IProgWidget create(ProgWidgetType<?> type)
      Cast from the API interface to our internal interface. Should always succeed!
      Parameters:
      type - type of the progwidget
      Returns:
      the internal non-API progwidget type