diff --git a/src/main/java/vazkii/psi/api/spell/SpellPiece.java b/src/main/java/vazkii/psi/api/spell/SpellPiece.java index 27bbd1b25..c23d20a2f 100644 --- a/src/main/java/vazkii/psi/api/spell/SpellPiece.java +++ b/src/main/java/vazkii/psi/api/spell/SpellPiece.java @@ -142,6 +142,14 @@ public void addParam(SpellParam param) { paramSides.put(param, SpellParam.Side.OFF); } + /** + * Checks whether the piece accepts an input on the given side. + * Used by connectors to display output lines. + */ + public boolean isInputSide(SpellParam.Side side) { + return paramSides.containsValue(side); + } + /** * Defaulted version of getParamValue * Should be used for optional params diff --git a/src/main/java/vazkii/psi/common/spell/other/PieceConnector.java b/src/main/java/vazkii/psi/common/spell/other/PieceConnector.java index 809ca5a65..f8cced583 100644 --- a/src/main/java/vazkii/psi/common/spell/other/PieceConnector.java +++ b/src/main/java/vazkii/psi/common/spell/other/PieceConnector.java @@ -61,14 +61,8 @@ public void drawAdditional(MatrixStack ms, IRenderTypeBuffer buffers, int light) for (SpellParam.Side side : SpellParam.Side.class.getEnumConstants()) { if (side.isEnabled()) { SpellPiece piece = spell.grid.getPieceAtSideSafely(x, y, side); - if (piece != null) { - for (SpellParam param : piece.paramSides.keySet()) { - SpellParam.Side paramSide = piece.paramSides.get(param); - if (paramSide.getOpposite() == side) { - drawSide(ms, buffers, light, side); - break; - } - } + if (piece != null && piece.isInputSide(side.getOpposite())) { + drawSide(ms, buffers, light, side); } } } diff --git a/src/main/java/vazkii/psi/common/spell/other/PieceCrossConnector.java b/src/main/java/vazkii/psi/common/spell/other/PieceCrossConnector.java index 88c9c0fa6..ae8d06691 100644 --- a/src/main/java/vazkii/psi/common/spell/other/PieceCrossConnector.java +++ b/src/main/java/vazkii/psi/common/spell/other/PieceCrossConnector.java @@ -57,6 +57,11 @@ public void initParams() { addParam(out2 = new ParamAny(SpellParam.CONNECTOR_NAME_TO2, LINE_TWO, false)); } + @Override + public boolean isInputSide(SpellParam.Side side) { + return paramSides.get(in1) == side || paramSides.get(in2) == side; + } + @Override public String getSortingName() { return "00000000000";