|
@Override |
|
protected double getCostModifier(PatternShapeMatch match) { |
|
ResourceLocation loc = actionKey(match); |
|
if (isOfTag(IXplatAbstractions.INSTANCE.getActionRegistry(), loc, HexTags.Actions.CANNOT_MODIFY_COST)) { |
|
return 1.0; |
|
} else { |
|
return this.caster.getAttributeValue(HexAttributes.MEDIA_CONSUMPTION_MODIFIER); |
|
} |
|
} |
|
@Nullable |
|
protected ResourceLocation actionKey(PatternShapeMatch match) { |
|
ResourceLocation key; |
|
if (match instanceof PatternShapeMatch.Normal normal) { |
|
key = normal.key.location(); |
|
} else if (match instanceof PatternShapeMatch.PerWorld perWorld) { |
|
key = perWorld.key.location(); |
|
} else if (match instanceof PatternShapeMatch.Special special) { |
|
key = special.key.location(); |
|
} else { |
|
key = null; |
|
} |
|
return key; |
|
} |
|
|
loc may null but there not check loc is null, result in throw a NullPointerException when draw an invaild pattern.

HexMod/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/env/PlayerBasedCastEnv.java
Lines 69 to 77 in 532fe9a
HexMod/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/CastingEnvironment.java
Lines 206 to 220 in 532fe9a
locmaynullbut there not checklocisnull, result in throw aNullPointerExceptionwhen draw an invaild pattern.