-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Optimized networking channels, akashic utils
- Loading branch information
1 parent
bd653f7
commit 4af8ae0
Showing
17 changed files
with
139 additions
and
38 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
src/main/java/miyucomics/hexical/casting/patterns/akashic/OpReadAkashicShelf.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,24 @@ | ||
package miyucomics.hexical.casting.patterns.akashic | ||
|
||
import at.petrak.hexcasting.api.spell.ConstMediaAction | ||
import at.petrak.hexcasting.api.spell.casting.CastingContext | ||
import at.petrak.hexcasting.api.spell.getBlockPos | ||
import at.petrak.hexcasting.api.spell.iota.Iota | ||
import at.petrak.hexcasting.api.spell.iota.NullIota | ||
import at.petrak.hexcasting.api.spell.mishaps.MishapBadBlock | ||
import at.petrak.hexcasting.common.blocks.akashic.BlockEntityAkashicBookshelf | ||
import at.petrak.hexcasting.common.lib.HexBlocks | ||
import at.petrak.hexcasting.common.lib.hex.HexIotaTypes | ||
|
||
class OpReadAkashicShelf : ConstMediaAction { | ||
override val argc = 1 | ||
override fun execute(args: List<Iota>, ctx: CastingContext): List<Iota> { | ||
val position = args.getBlockPos(0, argc) | ||
ctx.assertVecInRange(position) | ||
val block = ctx.world.getBlockState(position) | ||
if (!block.isOf(HexBlocks.AKASHIC_BOOKSHELF)) | ||
throw MishapBadBlock.of(position, "akashic_bookshelf") | ||
val nbt = (ctx.world.getBlockEntity(position) as BlockEntityAkashicBookshelf).iotaTag?: return listOf(NullIota()) | ||
return listOf(HexIotaTypes.deserialize(nbt, ctx.world)) | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
src/main/java/miyucomics/hexical/casting/patterns/akashic/OpWriteAkashicShelf.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,37 @@ | ||
package miyucomics.hexical.casting.patterns.akashic | ||
|
||
import at.petrak.hexcasting.api.spell.* | ||
import at.petrak.hexcasting.api.spell.casting.CastingContext | ||
import at.petrak.hexcasting.api.spell.iota.Iota | ||
import at.petrak.hexcasting.api.spell.math.HexPattern | ||
import at.petrak.hexcasting.api.spell.mishaps.MishapBadBlock | ||
import at.petrak.hexcasting.api.spell.mishaps.MishapOthersName | ||
import at.petrak.hexcasting.common.blocks.akashic.BlockEntityAkashicBookshelf | ||
import at.petrak.hexcasting.common.lib.HexBlocks | ||
import net.minecraft.util.math.BlockPos | ||
|
||
class OpWriteAkashicShelf : SpellAction { | ||
override val argc = 3 | ||
override fun execute(args: List<Iota>, ctx: CastingContext): Triple<RenderedSpell, Int, List<ParticleSpray>> { | ||
val position = args.getBlockPos(0, argc) | ||
ctx.assertVecInRange(position) | ||
val block = ctx.world.getBlockState(position) | ||
if (!block.isOf(HexBlocks.AKASHIC_BOOKSHELF)) | ||
throw MishapBadBlock.of(position, "akashic_bookshelf") | ||
val pattern = args.getPattern(1, argc) | ||
val iota = args[2] | ||
val trueName = MishapOthersName.getTrueNameFromDatum(iota, ctx.caster) | ||
if (trueName != null) | ||
throw MishapOthersName(trueName) | ||
return Triple(Spell(position, pattern, iota), 0, listOf()) | ||
} | ||
|
||
private data class Spell(val position: BlockPos, val pattern: HexPattern, val iota: Iota) : RenderedSpell { | ||
override fun cast(ctx: CastingContext) { | ||
val shelf = ctx.world.getBlockEntity(position)!! as BlockEntityAkashicBookshelf | ||
shelf.clearIota() | ||
shelf.setNewMapping(pattern, iota) | ||
shelf.markDirty() | ||
} | ||
} | ||
} |
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
Binary file modified
BIN
+13 Bytes
(110%)
src/main/resources/assets/hexical/textures/block/hex_candle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+53 Bytes
(130%)
src/main/resources/assets/hexical/textures/block/hex_candle_lit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+56 Bytes
(120%)
src/main/resources/assets/hexical/textures/item/hex_candle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 29 additions & 0 deletions
29
src/main/resources/data/hexical/patchouli_books/hexicalbook/en_us/entries/akashic_utils.json
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,29 @@ | ||
{ | ||
"name": "hexical.page.akashic_utils.title", | ||
"icon": "hexcasting:akashic_bookshelf", | ||
"category": "hexcasting:greatwork", | ||
"advancement": "hexcasting:enlightenment", | ||
"sortnum": 5, | ||
"pages": [ | ||
{ | ||
"type": "patchouli:text", | ||
"text": "hexical.page.akashic_utils.0" | ||
}, | ||
{ | ||
"type": "hexcasting:pattern", | ||
"op_id": "hexical:read_shelf", | ||
"anchor": "hexical:read_shelf", | ||
"input": "vector", | ||
"output": "any", | ||
"text": "hexical.page.read_shelf.summary" | ||
}, | ||
{ | ||
"type": "hexcasting:pattern", | ||
"op_id": "hexical:write_shelf", | ||
"anchor": "hexical:write_shelf", | ||
"input": "vector, pattern, any", | ||
"output": "", | ||
"text": "hexical.page.write_shelf.summary" | ||
} | ||
] | ||
} |
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