Class ResearchLine
java.lang.Object
com.portingdeadmods.researchd.client.screens.research.graph.lines.ResearchLine
- All Implemented Interfaces:
net.minecraft.client.gui.components.Renderable
-
Method Summary
Modifier and TypeMethodDescriptionstatic ResearchLineconnectNodes(Point outputPoint, Point inputPoint, boolean verticalFirst) Builds a connection between input and output points of research nodes with an L-shaped path.static ResearchLinecreateLConnection(ResearchHead start, ResearchHead end, boolean verticalFirst) static ResearchLinecreateLConnection(Point start, Point end, boolean verticalFirst) Builds a simple L-shaped connection between two points.static ResearchLinecreateSConnection(ResearchHead start, ResearchHead end, int verticalOffset) static ResearchLinecreateSConnection(Point start, Point end, int verticalOffset) The same as the L connection but with a vertical offset.static ResearchLinedirect(ResearchHead start, ResearchHead end) Creates a direct connection between two research heads.intgetColor()getEnd()Returns the end point of this line@Nullable ResearchHeadgetOverlaps(ResearchLine other) Finds all intersections/overlaps between this line and another linestatic Set<PotentialOverlap> getOverlaps(ResearchLine line1, ResearchLine line2) Finds all intersections/overlaps between two research linesGets all points in this linegetStart()Returns the start point of this line@Nullable ResearchHeadhorizontal(int dx) Adds a relative horizontal line segmentvoidrender(@NotNull net.minecraft.client.gui.GuiGraphics guiGraphics) voidrender(net.minecraft.client.gui.GuiGraphics guiGraphics, int i, int i1, float v) voidsetColor(int color) setEndHead(@NotNull ResearchHead endHead) setStartHead(@NotNull ResearchHead startHead) shift(int index, int delta) Shifts the index'th line by the given delta.shiftAndCreate(int index, int delta) Shifts the index'th line by the given delta.static ResearchLinestart(int x, int y) Creates a new line builder starting at the given coordinatesstatic ResearchLinestart(ResearchHead start) Creates a new line builder starting at the given research headstatic ResearchLineCreates a new line builder starting at the given pointthen(int x, int y) Adds a point to the line path using coordinatesAdds a point to the line pathtranslate(int dx, int dy) Translates all points in this line by the given amountsvertical(int dy) Adds a relative vertical line segment
-
Method Details
-
start
Creates a new line builder starting at the given point -
start
Creates a new line builder starting at the given research head -
start
Creates a new line builder starting at the given coordinates -
setEndHead
-
setStartHead
-
getStartHead
-
getEndHead
-
then
Adds a point to the line path -
then
Adds a point to the line path using coordinates -
horizontal
Adds a relative horizontal line segment -
vertical
Adds a relative vertical line segment -
shift
Shifts the index'th line by the given delta.
If the line is vertical, it will shift it horizontally (x += delta).
If the line is horizontal, it will shift it vertically (y += delta).
This method keeps continuity of the line intact.
This method DOES NOT create any other points.- Parameters:
index- The line indexdelta- The amount of shifting- Returns:
- self
- Throws:
IndexOutOfBoundsException- if the index is out of boundsIllegalArgumentException- if the index is 0 or the last index (if the line is linked to a ResearchHead)- See Also:
-
shiftAndCreate
Shifts the index'th line by the given delta.
If the line is vertical, it will shift it horizontally (x += delta).
If the line is horizontal, it will shift it vertically (y += delta).
This method keeps continuity of the line intact.
If a bent gets created, the original points will be duplicated to create a bend.- Parameters:
index- The line indexdelta- The amount of shifting- Returns:
- self
- Throws:
IndexOutOfBoundsException- if the index is out of bounds
-
createLConnection
Builds a simple L-shaped connection between two points. Goes vertical first, then horizontal. -
createLConnection
public static ResearchLine createLConnection(ResearchHead start, ResearchHead end, boolean verticalFirst) -
createSConnection
The same as the L connection but with a vertical offset. Goes vertical first (verticalOffset), then horizontal, then the remaining vertical distance. -
createSConnection
public static ResearchLine createSConnection(ResearchHead start, ResearchHead end, int verticalOffset) -
direct
Creates a direct connection between two research heads. This will not create any bends or curves, just a straight line. At the condition that either the X or the Y coordinate of the start and end points are the same. -
connectNodes
Builds a connection between input and output points of research nodes with an L-shaped path. -
render
public void render(@NotNull @NotNull net.minecraft.client.gui.GuiGraphics guiGraphics) -
render
public void render(net.minecraft.client.gui.GuiGraphics guiGraphics, int i, int i1, float v) - Specified by:
renderin interfacenet.minecraft.client.gui.components.Renderable
-
getPoints
Gets all points in this line -
translate
Translates all points in this line by the given amounts -
getStart
Returns the start point of this line -
getEnd
Returns the end point of this line -
getOverlaps
Finds all intersections/overlaps between this line and another line- Parameters:
other- The other ResearchLine to check against- Returns:
- Set of PotentialOverlaps where the lines intersect or overlap
-
getOverlaps
Finds all intersections/overlaps between two research lines- Parameters:
line1- First ResearchLineline2- Second ResearchLine- Returns:
- Set of PotentialOverlaps where the lines intersect or overlap
-
getColor
public int getColor() -
setColor
public void setColor(int color)
-