Class OperatorLPElementRenderPattern
java.lang.Object
org.cyclops.integrateddynamics.core.client.gui.subgui.SubGuiBox
org.cyclops.integrateddynamics.core.logicprogrammer.client.RenderPattern<OperatorLPElement, ContainerScreenLogicProgrammerBase, ContainerLogicProgrammerBase>
org.cyclops.integrateddynamics.core.logicprogrammer.client.OperatorLPElementRenderPattern
- All Implemented Interfaces:
ISubGui, ISubGuiBox, IRenderPatternValueTypeTooltip
public class OperatorLPElementRenderPattern
extends RenderPattern<OperatorLPElement, ContainerScreenLogicProgrammerBase, ContainerLogicProgrammerBase>
implements IRenderPatternValueTypeTooltip
Render pattern for operator elements, which edits the expression of the element in the slots and in the expression panel.
The parts of the panel are in
ExpressionParameterChips, ExpressionTextController,
ExpressionBreadcrumb and ExpressionValueEditor.-
Nested Class Summary
Nested classes/interfaces inherited from class SubGuiBox
SubGuiBox.Base, SubGuiBox.BoxNested classes/interfaces inherited from interface ISubGui
ISubGui.SubGuiComparator -
Field Summary
Fields inherited from class RenderPattern
container, element, gui, textureFields inherited from class SubGuiBox
buttonList, subGuiHolder, TEXTURE -
Constructor Summary
ConstructorsConstructorDescriptionOperatorLPElementRenderPattern(OperatorLPElement element, int baseX, int baseY, int maxWidth, int maxHeight, ContainerScreenLogicProgrammerBase gui, ContainerLogicProgrammerBase container) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidAdd a parameter, to the typed text while it is not applied yet, as applying it would undo the parameter otherwise.voidApply typed text that is not applied yet, such as when the gui closes.protected voidarmParameter(int index) booleanStop typing, or cancel the selected slot or parameter.booleancharTyped(net.minecraft.client.input.CharacterEvent evt) Char type eventvoiddrawGuiContainerForegroundLayer(net.minecraft.client.gui.GuiGraphicsExtractor guiGraphics, int guiLeft, int guiTop, net.minecraft.client.renderer.texture.TextureManager textureManager, net.minecraft.client.gui.Font fontRenderer, int mouseX, int mouseY) protected ExpressionEditorprotected Stringprotected intgetSlotAt(double mouseX, double mouseY) protected ExpressionTextFieldprotected static int[]getTokenPathAt(List<ExpressionPrinter.Token> tokens, int index) voidinit(int guiLeft, int guiTop) protected booleanisInTextBox(double mouseX, double mouseY) booleanbooleankeyPressed(net.minecraft.client.input.KeyEvent evt) Key press eventbooleanmouseClicked(net.minecraft.client.input.MouseButtonEvent evt, boolean isDoubleClick) booleanmouseDragged(double mouseX, double mouseY, int button, double dragX, double dragY) booleanmouseReleased(double mouseX, double mouseY, int button) Drop a dragged parameter into the slot under the mouse, or cancel when it is not over a slot.booleanmouseScrolled(double mouseX, double mouseY, double scrollX, double scrollY) protected voidOpen the node of the character under the cursor in the slots, as when clicking a part of the expression.booleanonOperatorPicked(IOperator operator) Called by the gui when an operator was picked from the list while a slot is selected.protected voidonSlotClicked(ExpressionEditor editor, int slot) Put the selected parameter in the slot, or open the nested operator in it when it is clicked twice, or select it.voidrenderBg(net.minecraft.client.gui.GuiGraphicsExtractor guiGraphics, int guiLeft, int guiTop, net.minecraft.client.renderer.texture.TextureManager textureManager, net.minecraft.client.gui.Font fontRenderer, float partialTicks, int mouseX, int mouseY) protected voidrenderSlots(net.minecraft.client.gui.GuiGraphicsExtractor guiGraphics, int guiLeft, int guiTop, net.minecraft.client.gui.Font font, ExpressionEditor editor, ExpressionTypeChecker.Result result, int mouseX, int mouseY) Draw the contents of the slots that are not items: nested operators, values, and parameters.protected voidrenderTextField(net.minecraft.client.gui.GuiGraphicsExtractor guiGraphics, int guiLeft, int guiTop, ExpressionEditor editor, ExpressionTypeChecker.Result result, int[] hoveredPath, int mouseX, int mouseY) Draw the text of the expression, which can be edited in place.protected voidselectSlot(int slot) protected voidsendAction(net.minecraft.nbt.CompoundTag action) voidsetRenderTooltip(boolean renderTooltip) protected static booleanstartsWith(int[] path, int[] prefix) voidtickText()Apply typed text once typing pauses.protected voidShow the buttons that apply to the current state, before they are rendered or clicked.protected voidMethods inherited from class RenderPattern
drawRenderPattern, drawSlot, getContainer, getElement, getHeight, getWidth, getX, getY, sendValueToServer, tickMethods inherited from class SubGuiBox
actionPerformed, drawScreen, isDrawBackgroundMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface IRenderPatternValueTypeTooltip
drawTooltipForeground, getValueTypeTooltip
-
Constructor Details
-
OperatorLPElementRenderPattern
public OperatorLPElementRenderPattern(OperatorLPElement element, int baseX, int baseY, int maxWidth, int maxHeight, ContainerScreenLogicProgrammerBase gui, ContainerLogicProgrammerBase container)
-
-
Method Details
-
init
public void init(int guiLeft, int guiTop) - Specified by:
initin interfaceISubGui- Overrides:
initin classRenderPattern<OperatorLPElement, ContainerScreenLogicProgrammerBase, ContainerLogicProgrammerBase>
-
updateButtons
protected void updateButtons()Show the buttons that apply to the current state, before they are rendered or clicked. -
addParameter
protected void addParameter()Add a parameter, to the typed text while it is not applied yet, as applying it would undo the parameter otherwise. -
getRenderSymbol
- Overrides:
getRenderSymbolin classRenderPattern<OperatorLPElement, ContainerScreenLogicProgrammerBase, ContainerLogicProgrammerBase>- Returns:
- The symbol to render in the pattern.
-
getEditor
-
sendAction
protected void sendAction(net.minecraft.nbt.CompoundTag action) -
getTextField
-
selectSlot
protected void selectSlot(int slot) -
armParameter
protected void armParameter(int index) -
updateEditor
protected void updateEditor() -
cancelSelection
public boolean cancelSelection()Stop typing, or cancel the selected slot or parameter.- Returns:
- If something was stopped or cancelled.
-
onOperatorPicked
Called by the gui when an operator was picked from the list while a slot is selected.- Parameters:
operator- The operator.- Returns:
- If the operator was nested.
-
tickText
public void tickText()Apply typed text once typing pauses. Called each tick, outside of rendering. -
applyPendingText
public void applyPendingText()Apply typed text that is not applied yet, such as when the gui closes. -
getDraftError
- Returns:
- Why typed text can not be applied, which keeps the card from being written, or null if there is none.
-
getTokenPathAt
-
isInTextBox
protected boolean isInTextBox(double mouseX, double mouseY) -
getSlotAt
protected int getSlotAt(double mouseX, double mouseY) -
mouseClicked
public boolean mouseClicked(net.minecraft.client.input.MouseButtonEvent evt, boolean isDoubleClick) - Specified by:
mouseClickedin interfaceISubGui- Overrides:
mouseClickedin classSubGuiBox
-
onSlotClicked
Put the selected parameter in the slot, or open the nested operator in it when it is clicked twice, or select it. -
mouseDragged
public boolean mouseDragged(double mouseX, double mouseY, int button, double dragX, double dragY) -
mouseReleased
public boolean mouseReleased(double mouseX, double mouseY, int button) Drop a dragged parameter into the slot under the mouse, or cancel when it is not over a slot. -
mouseScrolled
public boolean mouseScrolled(double mouseX, double mouseY, double scrollX, double scrollY) -
charTyped
public boolean charTyped(net.minecraft.client.input.CharacterEvent evt) Description copied from interface:ISubGuiChar type event -
keyPressed
public boolean keyPressed(net.minecraft.client.input.KeyEvent evt) Description copied from interface:ISubGuiKey press event- Specified by:
keyPressedin interfaceISubGui- Overrides:
keyPressedin classSubGuiBox- Parameters:
evt- The key event- Returns:
- True if all next actions should be skipped
-
renderBg
public void renderBg(net.minecraft.client.gui.GuiGraphicsExtractor guiGraphics, int guiLeft, int guiTop, net.minecraft.client.renderer.texture.TextureManager textureManager, net.minecraft.client.gui.Font fontRenderer, float partialTicks, int mouseX, int mouseY) - Specified by:
renderBgin interfaceISubGui- Overrides:
renderBgin classRenderPattern<OperatorLPElement, ContainerScreenLogicProgrammerBase, ContainerLogicProgrammerBase>
-
renderSlots
protected void renderSlots(net.minecraft.client.gui.GuiGraphicsExtractor guiGraphics, int guiLeft, int guiTop, net.minecraft.client.gui.Font font, ExpressionEditor editor, ExpressionTypeChecker.Result result, int mouseX, int mouseY) Draw the contents of the slots that are not items: nested operators, values, and parameters. -
startsWith
protected static boolean startsWith(int[] path, int[] prefix) -
renderTextField
protected void renderTextField(net.minecraft.client.gui.GuiGraphicsExtractor guiGraphics, int guiLeft, int guiTop, ExpressionEditor editor, ExpressionTypeChecker.Result result, @Nullable int[] hoveredPath, int mouseX, int mouseY) Draw the text of the expression, which can be edited in place. It is colored like the slots: the edited operator, errors, empty slots, and the part of a hovered slot. -
drawGuiContainerForegroundLayer
public void drawGuiContainerForegroundLayer(net.minecraft.client.gui.GuiGraphicsExtractor guiGraphics, int guiLeft, int guiTop, net.minecraft.client.renderer.texture.TextureManager textureManager, net.minecraft.client.gui.Font fontRenderer, int mouseX, int mouseY) - Specified by:
drawGuiContainerForegroundLayerin interfaceISubGui- Overrides:
drawGuiContainerForegroundLayerin classSubGuiBox
-
isRenderTooltip
public boolean isRenderTooltip()- Specified by:
isRenderTooltipin interfaceIRenderPatternValueTypeTooltip
-
setRenderTooltip
public void setRenderTooltip(boolean renderTooltip) - Specified by:
setRenderTooltipin interfaceIRenderPatternValueTypeTooltip
-