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
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionvoidaddErrors(List<net.minecraft.network.chat.Component> curInfo, List<IProgWidget> widgets) voidaddWarnings(List<net.minecraft.network.chat.Component> curInfo, List<IProgWidget> widgets) booleancanBeRunByComputers(IDroneBase drone, IProgWidget widget) booleancanSetParameter(int index) copy()static IProgWidgetcreate(ProgWidgetType<?> type) Cast from the API interface to our internal interface.default booleannet.minecraft.world.item.DyeColorgetColor()List<net.minecraft.network.chat.Component>intgetMaxUV()Get the next widget in the program; the widget attached to the bottom of this one.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.List<ProgWidgetType<?>>Get the types of the widgets which connect to this widget on the right, in order (top to bottom).net.minecraft.resources.ResourceLocationvoidgetTooltip(List<net.minecraft.network.chat.Component> curTooltip) default StringgetType()net.minecraft.resources.ResourceLocationnet.minecraft.world.entity.ai.goal.GoalgetWidgetAI(IDroneBase drone, IProgWidget widget) Get the AI for this progwidgetnet.minecraft.world.entity.ai.goal.GoalgetWidgetTargetAI(IDroneBase drone, IProgWidget widget) Get the targeting AI for this progwidgetintgetWidth()intgetX()intgetY()booleanCan this widget connect to a widget above?booleanCan another widget be connected below this widget?booleanIs this widget currently available in this world? i.e.default booleanisDifficultyOK(IProgWidget.WidgetDifficulty difficulty) voidreadFromNBT(net.minecraft.nbt.CompoundTag tag) voidreadFromPacket(net.minecraft.network.FriendlyByteBuf buf) For parameter widgets that are added onto the left or right of another widget, get the type of the widget being connected to.voidsetOutputWidget(IProgWidget widget) Set the output widget for this widget, i.e.voidsetParameter(int index, IProgWidget parm) voidsetParent(IProgWidget widget) voidsetX(int x) voidsetY(int y) voidwriteToNBT(net.minecraft.nbt.CompoundTag tag) At least dotag.putString("name", getTypeID().toString());voidwriteToPacket(net.minecraft.network.FriendlyByteBuf buf)
-
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
-
getTooltip
-
addWarnings
-
addErrors
-
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
Get the AI for this progwidget- Parameters:
drone- the dronewidget- will be 'this' most of the time, but not when controlled externally (e.g. ComputerCraft)- Returns:
- widget AI
-
getWidgetTargetAI
Get the targeting AI for this progwidget- Parameters:
drone- the dronewidget- Will be 'this' most of the time, but not when controlled externally (e.g. ComputerCraft)- Returns:
- widget targeting AI
-
setOutputWidget
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
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 droneallWidgets- 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
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 bygetConnectedParameters()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
-
canSetParameter
boolean canSetParameter(int index) -
getConnectedParameters
IProgWidget[] getConnectedParameters() -
setParent
-
getParent
IProgWidget getParent() -
getTypeID
net.minecraft.resources.ResourceLocation getTypeID() -
getTranslationKey
-
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 dotag.putString("name", getTypeID().toString());Note that the base implementation
ProgWidgetdoes this.- Parameters:
tag- NBT tag to write to
-
readFromNBT
void readFromNBT(net.minecraft.nbt.CompoundTag tag) -
copy
IProgWidget copy() -
canBeRunByComputers
-
isDifficultyOK
-
getDifficulty
IProgWidget.WidgetDifficulty getDifficulty() -
getType
ProgWidgetType<?> getType() -
readFromPacket
void readFromPacket(net.minecraft.network.FriendlyByteBuf buf) -
writeToPacket
void writeToPacket(net.minecraft.network.FriendlyByteBuf buf) -
getExtraStringInfo
-
create
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
-