-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make out of media a mishap and kill SideEffect earlyExit (#776)
- Loading branch information
Showing
11 changed files
with
76 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapNotEnoughMedia.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package at.petrak.hexcasting.api.casting.mishaps | ||
|
||
import at.petrak.hexcasting.api.casting.eval.CastingEnvironment | ||
import at.petrak.hexcasting.api.casting.eval.ResolvedPatternType | ||
import at.petrak.hexcasting.api.casting.iota.Iota | ||
import at.petrak.hexcasting.api.pigment.FrozenPigment | ||
import at.petrak.hexcasting.api.utils.asTranslatedComponent | ||
import net.minecraft.world.item.DyeColor | ||
|
||
class MishapNotEnoughMedia(private val cost: Long) : Mishap() { | ||
override fun accentColor(ctx: CastingEnvironment, errorCtx: Context): FrozenPigment = | ||
dyeColor(DyeColor.RED) | ||
|
||
override fun resolutionType(ctx: CastingEnvironment) = ResolvedPatternType.ERRORED | ||
|
||
override fun execute(env: CastingEnvironment, errorCtx: Context, stack: MutableList<Iota>) { | ||
env.extractMedia(cost, false) | ||
} | ||
|
||
override fun errorMessage(ctx: CastingEnvironment, errorCtx: Context) = "hexcasting.message.cant_overcast".asTranslatedComponent | ||
} |