From f4242810d3fdddbaa15186d5c5680cc724fd4cd6 Mon Sep 17 00:00:00 2001 From: GDavid Date: Fri, 8 Dec 2023 12:07:44 +0100 Subject: [PATCH 1/2] QoL changes pt. 1 - Fixed Operator: As Text and Operator: Hash throwing a NullPointerException in some cases - Output parameters are now displayed as output in tooltips - Changed Selector: Spell Name to output constant values --- .../phi/spell/operator/HashOperator.java | 2 ++ .../spell/operator/number/DivModOperator.java | 16 ++++++++++++ .../spell/operator/text/AsTextOperator.java | 5 +++- .../phi/spell/param/ReferenceParam.java | 7 ++++-- .../phi/spell/selector/SpellNameSelector.java | 6 +++++ .../java/gdavid/phi/util/ParamHelper.java | 25 +++++++++++++++++++ 6 files changed, 58 insertions(+), 3 deletions(-) diff --git a/src/main/java/gdavid/phi/spell/operator/HashOperator.java b/src/main/java/gdavid/phi/spell/operator/HashOperator.java index c7f73f9..ffffb68 100644 --- a/src/main/java/gdavid/phi/spell/operator/HashOperator.java +++ b/src/main/java/gdavid/phi/spell/operator/HashOperator.java @@ -1,5 +1,6 @@ package gdavid.phi.spell.operator; +import gdavid.phi.spell.Errors; import net.minecraft.entity.Entity; import vazkii.psi.api.spell.Spell; import vazkii.psi.api.spell.SpellContext; @@ -30,6 +31,7 @@ public Class getEvaluationType() { @Override public Object execute(SpellContext context) throws SpellRuntimeException { Object val = getRawParamValue(context, value); + if (val == null) Errors.runtime(SpellRuntimeException.NULL_TARGET); if (val instanceof Entity) return ((Entity) val).getUniqueID().hashCode(); // String, Number and Vector3 implement hashCode properly // TODO EntityListWrapper support diff --git a/src/main/java/gdavid/phi/spell/operator/number/DivModOperator.java b/src/main/java/gdavid/phi/spell/operator/number/DivModOperator.java index cf3a5db..42f655d 100644 --- a/src/main/java/gdavid/phi/spell/operator/number/DivModOperator.java +++ b/src/main/java/gdavid/phi/spell/operator/number/DivModOperator.java @@ -7,11 +7,16 @@ import gdavid.phi.spell.Param; import gdavid.phi.spell.param.ReferenceParam; import gdavid.phi.util.ISidedResult; +import gdavid.phi.util.ParamHelper; import gdavid.phi.util.RenderHelper; import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.model.RenderMaterial; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.vector.Matrix4f; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.StringTextComponent; +import net.minecraft.util.text.TextFormatting; +import net.minecraft.util.text.TranslationTextComponent; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import vazkii.psi.api.ClientPsiAPI; @@ -26,6 +31,11 @@ import vazkii.psi.api.spell.param.ParamNumber; import vazkii.psi.api.spell.piece.PieceOperator; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + public class DivModOperator extends PieceOperator { public static final ResourceLocation lineTexture = new ResourceLocation(Phi.modId, "spell/operator_div_mod_lines"); @@ -76,6 +86,12 @@ public void drawLine(MatrixStack ms, IRenderTypeBuffer buffers, int light, int c buffer.tex(minU, minV).lightmap(light).endVertex(); } + @Override + @OnlyIn(Dist.CLIENT) + public void addToTooltipAfterShift(List tooltip) { + ParamHelper.outputTooltip(this, super::addToTooltipAfterShift, tooltip); + } + @Override public Class getEvaluationType() { return Double.class; diff --git a/src/main/java/gdavid/phi/spell/operator/text/AsTextOperator.java b/src/main/java/gdavid/phi/spell/operator/text/AsTextOperator.java index d7e94b0..ce00298 100644 --- a/src/main/java/gdavid/phi/spell/operator/text/AsTextOperator.java +++ b/src/main/java/gdavid/phi/spell/operator/text/AsTextOperator.java @@ -1,5 +1,6 @@ package gdavid.phi.spell.operator.text; +import gdavid.phi.spell.Errors; import vazkii.psi.api.spell.Spell; import vazkii.psi.api.spell.SpellContext; import vazkii.psi.api.spell.SpellParam; @@ -28,7 +29,9 @@ public Class getEvaluationType() { @Override public Object execute(SpellContext context) throws SpellRuntimeException { - return getRawParamValue(context, value).toString(); + Object val = getRawParamValue(context, value); + if (val == null) Errors.runtime(SpellRuntimeException.NULL_TARGET); + return val.toString(); } } diff --git a/src/main/java/gdavid/phi/spell/param/ReferenceParam.java b/src/main/java/gdavid/phi/spell/param/ReferenceParam.java index e554b7e..0a5b3e8 100644 --- a/src/main/java/gdavid/phi/spell/param/ReferenceParam.java +++ b/src/main/java/gdavid/phi/spell/param/ReferenceParam.java @@ -9,13 +9,16 @@ public class ReferenceParam extends ParamAny { public boolean checkLoop = false; + public boolean isOutput = false; - public ReferenceParam(String name, int color, boolean canDisable) { + public ReferenceParam(String name, int color, boolean canDisable, boolean isOutput) { super(name, color, canDisable); + this.isOutput = isOutput; } - public ReferenceParam(String name, int color, boolean canDisable, ArrowType arrowType) { + public ReferenceParam(String name, int color, boolean canDisable, boolean isOutput, ArrowType arrowType) { super(name, color, canDisable, arrowType); + this.isOutput = isOutput; } /** diff --git a/src/main/java/gdavid/phi/spell/selector/SpellNameSelector.java b/src/main/java/gdavid/phi/spell/selector/SpellNameSelector.java index e669688..b0e7533 100644 --- a/src/main/java/gdavid/phi/spell/selector/SpellNameSelector.java +++ b/src/main/java/gdavid/phi/spell/selector/SpellNameSelector.java @@ -1,5 +1,6 @@ package gdavid.phi.spell.selector; +import vazkii.psi.api.spell.EnumPieceType; import vazkii.psi.api.spell.Spell; import vazkii.psi.api.spell.SpellContext; import vazkii.psi.api.spell.SpellRuntimeException; @@ -11,6 +12,11 @@ public SpellNameSelector(Spell spell) { super(spell); } + @Override + public EnumPieceType getPieceType() { + return EnumPieceType.CONSTANT; + } + @Override public Object execute(SpellContext context) throws SpellRuntimeException { return spell.name; diff --git a/src/main/java/gdavid/phi/util/ParamHelper.java b/src/main/java/gdavid/phi/util/ParamHelper.java index 35351fd..3ef3df8 100644 --- a/src/main/java/gdavid/phi/util/ParamHelper.java +++ b/src/main/java/gdavid/phi/util/ParamHelper.java @@ -1,7 +1,12 @@ package gdavid.phi.util; import gdavid.phi.spell.Errors; +import gdavid.phi.spell.param.ReferenceParam; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.StringTextComponent; +import net.minecraft.util.text.TextFormatting; +import net.minecraft.util.text.TranslationTextComponent; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import vazkii.psi.api.internal.Vector3; @@ -12,6 +17,11 @@ import vazkii.psi.api.spell.SpellPiece; import vazkii.psi.api.spell.SpellRuntimeException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.function.Consumer; + public class ParamHelper { public static double positiveOrZero(SpellPiece piece, SpellParam param) throws SpellCompilationException { @@ -51,4 +61,19 @@ public static int connectorColor(SpellPiece piece, Side side, int def) { return def; } + @OnlyIn(Dist.CLIENT) + public static void outputTooltip(SpellPiece piece, Consumer> superFn, List tooltip) { + Map, Side> paramSidesTmp = new HashMap<>(piece.paramSides); + piece.paramSides.entrySet().removeIf(e -> e instanceof ReferenceParam && ((ReferenceParam) e).isOutput); + superFn.accept(tooltip); + piece.paramSides.putAll(paramSidesTmp); + for (SpellParam param : piece.paramSides.keySet()) { + if (param instanceof ReferenceParam) { + ITextComponent name = new TranslationTextComponent(param.name).mergeStyle(TextFormatting.YELLOW); + ITextComponent type = new StringTextComponent(" [").append(param.getRequiredTypeString()).appendString("]").mergeStyle(TextFormatting.YELLOW); + tooltip.add((new StringTextComponent(param.canDisable ? "[Output] " : " Output ")).append(name).append(type)); + } + } + } + } From a7568c01b8b51277e5a865927d0f834bad7a0806 Mon Sep 17 00:00:00 2001 From: GDavid Date: Wed, 14 Feb 2024 14:26:18 +0100 Subject: [PATCH 2/2] QoL changes pt. 2 - Output parameters are now displayed as output in tooltips --- .../spell/operator/number/DivModOperator.java | 16 ++++++++-------- .../operator/text/SplitTextAtOperator.java | 17 +++++++++++++++-- .../operator/text/SplitTextOperator.java | 17 +++++++++++++++-- .../operator/vector/SplitVectorOperator.java | 19 ++++++++++++++++--- .../trick/evaluation/EarlyEvaluateTrick.java | 17 ++++++++++++++++- .../trick/evaluation/ReevaluateTrick.java | 17 ++++++++++++++++- .../java/gdavid/phi/util/ParamHelper.java | 4 ++-- 7 files changed, 88 insertions(+), 19 deletions(-) diff --git a/src/main/java/gdavid/phi/spell/operator/number/DivModOperator.java b/src/main/java/gdavid/phi/spell/operator/number/DivModOperator.java index 42f655d..caf7244 100644 --- a/src/main/java/gdavid/phi/spell/operator/number/DivModOperator.java +++ b/src/main/java/gdavid/phi/spell/operator/number/DivModOperator.java @@ -51,8 +51,14 @@ public DivModOperator(Spell spell) { public void initParams() { addParam(a = new ParamNumber(SpellParam.GENERIC_NAME_NUMBER1, SpellParam.RED, false, false)); addParam(b = new ParamNumber(SpellParam.GENERIC_NAME_NUMBER2, SpellParam.GREEN, false, false)); - addParam(div = new ReferenceParam(Param.div.name, SpellParam.RED, true, ArrowType.NONE)); - addParam(mod = new ReferenceParam(Param.mod.name, SpellParam.GREEN, true, ArrowType.NONE)); + addParam(div = new ReferenceParam(Param.div.name, SpellParam.RED, true, true, ArrowType.NONE)); + addParam(mod = new ReferenceParam(Param.mod.name, SpellParam.GREEN, true, true, ArrowType.NONE)); + } + + @Override + @OnlyIn(Dist.CLIENT) + public void addToTooltipAfterShift(List tooltip) { + ParamHelper.outputTooltip(this, super::addToTooltipAfterShift, tooltip); } @Override @@ -86,12 +92,6 @@ public void drawLine(MatrixStack ms, IRenderTypeBuffer buffers, int light, int c buffer.tex(minU, minV).lightmap(light).endVertex(); } - @Override - @OnlyIn(Dist.CLIENT) - public void addToTooltipAfterShift(List tooltip) { - ParamHelper.outputTooltip(this, super::addToTooltipAfterShift, tooltip); - } - @Override public Class getEvaluationType() { return Double.class; diff --git a/src/main/java/gdavid/phi/spell/operator/text/SplitTextAtOperator.java b/src/main/java/gdavid/phi/spell/operator/text/SplitTextAtOperator.java index a8607a1..1653035 100644 --- a/src/main/java/gdavid/phi/spell/operator/text/SplitTextAtOperator.java +++ b/src/main/java/gdavid/phi/spell/operator/text/SplitTextAtOperator.java @@ -8,11 +8,16 @@ import gdavid.phi.spell.param.ReferenceParam; import gdavid.phi.spell.param.TextParam; import gdavid.phi.util.ISidedResult; +import gdavid.phi.util.ParamHelper; import gdavid.phi.util.RenderHelper; import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.model.RenderMaterial; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.vector.Matrix4f; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.StringTextComponent; +import net.minecraft.util.text.TextFormatting; +import net.minecraft.util.text.TranslationTextComponent; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import vazkii.psi.api.ClientPsiAPI; @@ -26,6 +31,8 @@ import vazkii.psi.api.spell.SpellRuntimeException; import vazkii.psi.api.spell.piece.PieceOperator; +import java.util.List; + public class SplitTextAtOperator extends PieceOperator { public static final ResourceLocation lineTexture = new ResourceLocation(Phi.modId, @@ -42,8 +49,14 @@ public SplitTextAtOperator(Spell spell) { public void initParams() { addParam(text = new TextParam(Param.text.name, SpellParam.GRAY, false, false)); addParam(at = new TextParam(Param.at.name, SpellParam.BLUE, false, false)); - addParam(before = new ReferenceParam(Param.before.name, SpellParam.RED, true, ArrowType.NONE)); - addParam(after = new ReferenceParam(Param.after.name, SpellParam.GREEN, true, ArrowType.NONE)); + addParam(before = new ReferenceParam(Param.before.name, SpellParam.RED, true, true, ArrowType.NONE)); + addParam(after = new ReferenceParam(Param.after.name, SpellParam.GREEN, true, true, ArrowType.NONE)); + } + + @Override + @OnlyIn(Dist.CLIENT) + public void addToTooltipAfterShift(List tooltip) { + ParamHelper.outputTooltip(this, super::addToTooltipAfterShift, tooltip); } @Override diff --git a/src/main/java/gdavid/phi/spell/operator/text/SplitTextOperator.java b/src/main/java/gdavid/phi/spell/operator/text/SplitTextOperator.java index 5f48bab..d6a5f38 100644 --- a/src/main/java/gdavid/phi/spell/operator/text/SplitTextOperator.java +++ b/src/main/java/gdavid/phi/spell/operator/text/SplitTextOperator.java @@ -8,11 +8,16 @@ import gdavid.phi.spell.param.ReferenceParam; import gdavid.phi.spell.param.TextParam; import gdavid.phi.util.ISidedResult; +import gdavid.phi.util.ParamHelper; import gdavid.phi.util.RenderHelper; import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.model.RenderMaterial; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.vector.Matrix4f; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.StringTextComponent; +import net.minecraft.util.text.TextFormatting; +import net.minecraft.util.text.TranslationTextComponent; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import vazkii.psi.api.ClientPsiAPI; @@ -27,6 +32,8 @@ import vazkii.psi.api.spell.param.ParamNumber; import vazkii.psi.api.spell.piece.PieceOperator; +import java.util.List; + public class SplitTextOperator extends PieceOperator { public static final ResourceLocation lineTexture = new ResourceLocation(Phi.modId, @@ -44,8 +51,14 @@ public SplitTextOperator(Spell spell) { public void initParams() { addParam(text = new TextParam(Param.text.name, SpellParam.GRAY, false, false)); addParam(position = new ParamNumber(SpellParam.GENERIC_NAME_POSITION, SpellParam.BLUE, false, false)); - addParam(before = new ReferenceParam(Param.before.name, SpellParam.RED, true, ArrowType.NONE)); - addParam(after = new ReferenceParam(Param.after.name, SpellParam.GREEN, true, ArrowType.NONE)); + addParam(before = new ReferenceParam(Param.before.name, SpellParam.RED, true, true, ArrowType.NONE)); + addParam(after = new ReferenceParam(Param.after.name, SpellParam.GREEN, true, true, ArrowType.NONE)); + } + + @Override + @OnlyIn(Dist.CLIENT) + public void addToTooltipAfterShift(List tooltip) { + ParamHelper.outputTooltip(this, super::addToTooltipAfterShift, tooltip); } @Override diff --git a/src/main/java/gdavid/phi/spell/operator/vector/SplitVectorOperator.java b/src/main/java/gdavid/phi/spell/operator/vector/SplitVectorOperator.java index ce67f07..3756fc2 100644 --- a/src/main/java/gdavid/phi/spell/operator/vector/SplitVectorOperator.java +++ b/src/main/java/gdavid/phi/spell/operator/vector/SplitVectorOperator.java @@ -6,11 +6,16 @@ import gdavid.phi.spell.Errors; import gdavid.phi.spell.param.ReferenceParam; import gdavid.phi.util.ISidedResult; +import gdavid.phi.util.ParamHelper; import gdavid.phi.util.RenderHelper; import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.model.RenderMaterial; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.vector.Matrix4f; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.StringTextComponent; +import net.minecraft.util.text.TextFormatting; +import net.minecraft.util.text.TranslationTextComponent; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import vazkii.psi.api.ClientPsiAPI; @@ -28,6 +33,8 @@ import vazkii.psi.api.spell.SpellRuntimeException; import vazkii.psi.api.spell.param.ParamVector; +import java.util.List; + public class SplitVectorOperator extends SpellPiece { public static final ResourceLocation lineTexture = new ResourceLocation(Phi.modId, @@ -43,9 +50,15 @@ public SplitVectorOperator(Spell spell) { @Override public void initParams() { addParam(vector = new ParamVector(SpellParam.GENERIC_NAME_VECTOR, SpellParam.GRAY, false, false)); - addParam(outX = new ReferenceParam(SpellParam.GENERIC_NAME_X, SpellParam.RED, true, ArrowType.NONE)); - addParam(outY = new ReferenceParam(SpellParam.GENERIC_NAME_Y, SpellParam.GREEN, true, ArrowType.NONE)); - addParam(outZ = new ReferenceParam(SpellParam.GENERIC_NAME_Z, SpellParam.BLUE, true, ArrowType.NONE)); + addParam(outX = new ReferenceParam(SpellParam.GENERIC_NAME_X, SpellParam.RED, true, true, ArrowType.NONE)); + addParam(outY = new ReferenceParam(SpellParam.GENERIC_NAME_Y, SpellParam.GREEN, true, true, ArrowType.NONE)); + addParam(outZ = new ReferenceParam(SpellParam.GENERIC_NAME_Z, SpellParam.BLUE, true, true, ArrowType.NONE)); + } + + @Override + @OnlyIn(Dist.CLIENT) + public void addToTooltipAfterShift(List tooltip) { + ParamHelper.outputTooltip(this, super::addToTooltipAfterShift, tooltip); } @Override diff --git a/src/main/java/gdavid/phi/spell/trick/evaluation/EarlyEvaluateTrick.java b/src/main/java/gdavid/phi/spell/trick/evaluation/EarlyEvaluateTrick.java index 680f08c..e06470c 100644 --- a/src/main/java/gdavid/phi/spell/trick/evaluation/EarlyEvaluateTrick.java +++ b/src/main/java/gdavid/phi/spell/trick/evaluation/EarlyEvaluateTrick.java @@ -4,6 +4,7 @@ import gdavid.phi.spell.Param; import gdavid.phi.spell.param.ReferenceParam; import gdavid.phi.util.EvalHelper; +import gdavid.phi.util.ParamHelper; import vazkii.psi.api.spell.EnumSpellStat; import vazkii.psi.api.spell.Spell; import vazkii.psi.api.spell.SpellCompilationException; @@ -14,6 +15,14 @@ import vazkii.psi.api.spell.SpellRuntimeException; import vazkii.psi.api.spell.param.ParamNumber; import vazkii.psi.api.spell.piece.PieceTrick; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.StringTextComponent; +import net.minecraft.util.text.TextFormatting; +import net.minecraft.util.text.TranslationTextComponent; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; + +import java.util.List; public class EarlyEvaluateTrick extends PieceTrick { @@ -26,10 +35,16 @@ public EarlyEvaluateTrick(Spell spell) { @Override public void initParams() { - addParam(target = new ReferenceParam(SpellParam.GENERIC_NAME_TARGET, SpellParam.RED, false)); + addParam(target = new ReferenceParam(SpellParam.GENERIC_NAME_TARGET, SpellParam.RED, false, false)); addParam(condition = new ParamNumber(Param.condition.name, SpellParam.BLUE, false, false)); } + @Override + @OnlyIn(Dist.CLIENT) + public void addToTooltipAfterShift(List tooltip) { + ParamHelper.outputTooltip(this, super::addToTooltipAfterShift, tooltip); + } + @Override public void addToMetadata(SpellMetadata meta) throws SpellCompilationException { meta.addStat(EnumSpellStat.COMPLEXITY, 1); diff --git a/src/main/java/gdavid/phi/spell/trick/evaluation/ReevaluateTrick.java b/src/main/java/gdavid/phi/spell/trick/evaluation/ReevaluateTrick.java index ec4aa4a..ad834ab 100644 --- a/src/main/java/gdavid/phi/spell/trick/evaluation/ReevaluateTrick.java +++ b/src/main/java/gdavid/phi/spell/trick/evaluation/ReevaluateTrick.java @@ -4,6 +4,7 @@ import gdavid.phi.spell.Param; import gdavid.phi.spell.param.ReferenceParam; import gdavid.phi.util.EvalHelper; +import gdavid.phi.util.ParamHelper; import vazkii.psi.api.spell.EnumSpellStat; import vazkii.psi.api.spell.Spell; import vazkii.psi.api.spell.SpellCompilationException; @@ -14,6 +15,14 @@ import vazkii.psi.api.spell.SpellRuntimeException; import vazkii.psi.api.spell.param.ParamNumber; import vazkii.psi.api.spell.piece.PieceTrick; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.StringTextComponent; +import net.minecraft.util.text.TextFormatting; +import net.minecraft.util.text.TranslationTextComponent; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; + +import java.util.List; public class ReevaluateTrick extends PieceTrick { @@ -26,10 +35,16 @@ public ReevaluateTrick(Spell spell) { @Override public void initParams() { - addParam(target = new ReferenceParam(SpellParam.GENERIC_NAME_TARGET, SpellParam.RED, false).preventLoop()); + addParam(target = new ReferenceParam(SpellParam.GENERIC_NAME_TARGET, SpellParam.RED, false, false).preventLoop()); addParam(condition = new ParamNumber(Param.condition.name, SpellParam.BLUE, true, false)); } + @Override + @OnlyIn(Dist.CLIENT) + public void addToTooltipAfterShift(List tooltip) { + ParamHelper.outputTooltip(this, super::addToTooltipAfterShift, tooltip); + } + @Override public void addToMetadata(SpellMetadata meta) throws SpellCompilationException { meta.addStat(EnumSpellStat.COMPLEXITY, 1); diff --git a/src/main/java/gdavid/phi/util/ParamHelper.java b/src/main/java/gdavid/phi/util/ParamHelper.java index 3ef3df8..f418fd6 100644 --- a/src/main/java/gdavid/phi/util/ParamHelper.java +++ b/src/main/java/gdavid/phi/util/ParamHelper.java @@ -64,11 +64,11 @@ public static int connectorColor(SpellPiece piece, Side side, int def) { @OnlyIn(Dist.CLIENT) public static void outputTooltip(SpellPiece piece, Consumer> superFn, List tooltip) { Map, Side> paramSidesTmp = new HashMap<>(piece.paramSides); - piece.paramSides.entrySet().removeIf(e -> e instanceof ReferenceParam && ((ReferenceParam) e).isOutput); + piece.paramSides.keySet().removeIf(e -> e instanceof ReferenceParam && ((ReferenceParam) e).isOutput); superFn.accept(tooltip); piece.paramSides.putAll(paramSidesTmp); for (SpellParam param : piece.paramSides.keySet()) { - if (param instanceof ReferenceParam) { + if (param instanceof ReferenceParam && ((ReferenceParam) param).isOutput) { ITextComponent name = new TranslationTextComponent(param.name).mergeStyle(TextFormatting.YELLOW); ITextComponent type = new StringTextComponent(" [").append(param.getRequiredTypeString()).appendString("]").mergeStyle(TextFormatting.YELLOW); tooltip.add((new StringTextComponent(param.canDisable ? "[Output] " : " Output ")).append(name).append(type));