java.lang.Object
me.desht.pneumaticcraft.common.drone.progwidgets.ProgWidget
All Implemented Interfaces:
IProgWidgetBase, IProgWidget
Direct Known Subclasses:
ProgWidgetArea, ProgWidgetAreaItemBase, ProgWidgetConditionBase, ProgWidgetCoordinate, ProgWidgetCoordinateOperator, ProgWidgetCrafting, ProgWidgetEmitRedstone, ProgWidgetEntityAttack, ProgWidgetEntityImport, ProgWidgetEntityRightClick, ProgWidgetForEachItem, ProgWidgetGoToLocation, ProgWidgetItemAssign, ProgWidgetItemFilter, ProgWidgetJump, ProgWidgetJumpSub, ProgWidgetLabel, ProgWidgetLiquidFilter, ProgWidgetRename, ProgWidgetStandby, ProgWidgetStart, ProgWidgetSuicide, ProgWidgetText, ProgWidgetVoidItem, ProgWidgetVoidLiquid, ProgWidgetWait

public abstract class ProgWidget extends Object implements IProgWidget
  • Constructor Details

  • Method Details

    • getType

      public ProgWidgetType<?> getType()
      Specified by:
      getType in interface IProgWidget
    • getTypeID

      public net.minecraft.resources.ResourceLocation getTypeID()
      Specified by:
      getTypeID in interface IProgWidget
    • getTooltip

      public void getTooltip(List<net.minecraft.network.chat.Component> curTooltip)
      Specified by:
      getTooltip in interface IProgWidget
    • getExtraStringInfo

      public List<net.minecraft.network.chat.Component> getExtraStringInfo()
      Specified by:
      getExtraStringInfo in interface IProgWidget
    • addWarnings

      public void addWarnings(List<net.minecraft.network.chat.Component> curInfo, List<IProgWidget> widgets)
      Specified by:
      addWarnings in interface IProgWidget
    • addErrors

      public void addErrors(List<net.minecraft.network.chat.Component> curInfo, List<IProgWidget> widgets)
      Specified by:
      addErrors in interface IProgWidget
    • isAvailable

      public boolean isAvailable()
      Description copied from interface: IProgWidget
      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
      Specified by:
      isAvailable in interface IProgWidget
      Returns:
      true if the widget is available for use by players
    • getX

      public int getX()
      Specified by:
      getX in interface IProgWidget
    • getY

      public int getY()
      Specified by:
      getY in interface IProgWidget
    • setX

      public void setX(int x)
      Specified by:
      setX in interface IProgWidget
    • setY

      public void setY(int y)
      Specified by:
      setY in interface IProgWidget
    • getWidth

      public int getWidth()
      Specified by:
      getWidth in interface IProgWidget
    • getHeight

      public int getHeight()
      Specified by:
      getHeight in interface IProgWidget
    • setParent

      public void setParent(IProgWidget widget)
      Specified by:
      setParent in interface IProgWidget
    • getParent

      public IProgWidget getParent()
      Specified by:
      getParent in interface IProgWidget
    • getMaxUV

      public org.apache.commons.lang3.tuple.Pair<Float,Float> getMaxUV()
      Specified by:
      getMaxUV in interface IProgWidget
    • hasStepOutput

      public boolean hasStepOutput()
      Description copied from interface: IProgWidget
      Can another widget be connected below this widget?
      Specified by:
      hasStepOutput in interface IProgWidget
      Returns:
      true if it can, false otherwise
    • getWidgetTargetAI

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

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

      public void setParameter(int index, IProgWidget parm)
      Specified by:
      setParameter in interface IProgWidget
    • canSetParameter

      public boolean canSetParameter(int index)
      Specified by:
      canSetParameter in interface IProgWidget
    • hasBlacklist

      protected boolean hasBlacklist()
    • getConnectedParameters

      public IProgWidget[] getConnectedParameters()
      Specified by:
      getConnectedParameters in interface IProgWidget
    • setOutputWidget

      public void setOutputWidget(IProgWidget widget)
      Description copied from interface: IProgWidget
      Set the output widget for this widget, i.e. next in the program. Called when building the program.
      Specified by:
      setOutputWidget in interface IProgWidget
      Parameters:
      widget - the next widget in the program
    • getOutputWidget

      public IProgWidget getOutputWidget()
      Description copied from interface: IProgWidget
      Get the next widget in the program; the widget attached to the bottom of this one.
      Specified by:
      getOutputWidget in interface IProgWidget
      Returns:
      the next widget to run
    • getOutputWidget

      public IProgWidget getOutputWidget(IDroneBase drone, List<IProgWidget> allWidgets)
      Description copied from interface: IProgWidget
      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.
      Specified by:
      getOutputWidget in interface IProgWidget
      Parameters:
      drone - the drone
      allWidgets - a list of widgets
      Returns:
      the next widget to run
    • copy

      public IProgWidget copy()
      Specified by:
      copy in interface IProgWidget
    • writeToNBT

      public void writeToNBT(net.minecraft.nbt.CompoundTag tag)
      Description copied from interface: IProgWidget
      At least do tag.putString("name", getTypeID().toString());

      Note that the base implementation ProgWidget does this.

      Specified by:
      writeToNBT in interface IProgWidget
      Parameters:
      tag - NBT tag to write to
    • readFromNBT

      public void readFromNBT(net.minecraft.nbt.CompoundTag tag)
      Specified by:
      readFromNBT in interface IProgWidget
    • writeToPacket

      public void writeToPacket(net.minecraft.network.FriendlyByteBuf buf)
      Specified by:
      writeToPacket in interface IProgWidget
    • readFromPacket

      public void readFromPacket(net.minecraft.network.FriendlyByteBuf buf)
      Specified by:
      readFromPacket in interface IProgWidget
    • fromPacket

      public static IProgWidget fromPacket(net.minecraft.network.FriendlyByteBuf buf)
    • fromNBT

      public static IProgWidget fromNBT(net.minecraft.nbt.CompoundTag widgetTag)
    • canBeRunByComputers

      public boolean canBeRunByComputers(IDroneBase drone, IProgWidget widget)
      Specified by:
      canBeRunByComputers in interface IProgWidget