Skip to content

Commit

Permalink
Renamed advanced conjured block to mage block
Browse files Browse the repository at this point in the history
  • Loading branch information
miyucomics committed Mar 1, 2024
1 parent 529f5bc commit 0379e8b
Show file tree
Hide file tree
Showing 10 changed files with 46 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import net.minecraft.world.World
import net.minecraft.world.WorldAccess
import net.minecraft.world.event.GameEvent

class AdvancedConjuredBlock : BlockConjured(
class MageBlock : BlockConjured(
Settings.of(Material.ORGANIC_PRODUCT).
nonOpaque().
dropsNothing().
Expand All @@ -49,7 +49,7 @@ class AdvancedConjuredBlock : BlockConjured(
override fun onEntityLand(world: BlockView, entity: Entity) {
val pos = entity.blockPos.add(0, -1, 0)
val tile = world.getBlockEntity(pos)
if (tile !is AdvancedConjuredBlockEntity)
if (tile !is MageBlockEntity)
return
if (tile.properties["bouncy"]!!) {
val velocity = entity.velocity
Expand All @@ -65,7 +65,7 @@ class AdvancedConjuredBlock : BlockConjured(

override fun onUse(state: BlockState, world: World, pos: BlockPos, player: PlayerEntity, hand: Hand, hit: BlockHitResult): ActionResult {
val tile = world.getBlockEntity(pos)
if (tile !is AdvancedConjuredBlockEntity)
if (tile !is MageBlockEntity)
return ActionResult.PASS;
if (!tile.properties["replaceable"]!!)
return ActionResult.PASS;
Expand All @@ -82,7 +82,7 @@ class AdvancedConjuredBlock : BlockConjured(

override fun onBreak(world: World, position: BlockPos, state: BlockState, player: PlayerEntity?) {
val tile = world.getBlockEntity(position)
if (tile !is AdvancedConjuredBlockEntity)
if (tile !is MageBlockEntity)
return
world.playSound(position.x.toDouble(), position.y.toDouble(), position.z.toDouble(), SoundEvents.BLOCK_AMETHYST_BLOCK_BREAK, SoundCategory.BLOCKS, 1f, 1f, true)
world.emitGameEvent(GameEvent.BLOCK_DESTROY, position, GameEvent.Emitter.of(player, state))
Expand All @@ -93,22 +93,22 @@ class AdvancedConjuredBlock : BlockConjured(
val positionToTest = position.add(offset);
val otherState = world.getBlockState(positionToTest)
val block = otherState.block
if (block == HexicalBlocks.ADVANCED_CONJURED_BLOCK)
if (block == HexicalBlocks.MAGE_BLOCK)
block.onBreak(world, positionToTest, otherState, player)
}
}
}

override fun onSteppedOn(world: World, pos: BlockPos, state: BlockState, entity: Entity) {
val tile = world.getBlockEntity(pos)
if (tile !is AdvancedConjuredBlockEntity)
if (tile !is MageBlockEntity)
return
if (!tile.properties["invisible"]!!)
tile.walkParticle(entity)
}

override fun createBlockEntity(pos: BlockPos, state: BlockState): BlockEntity {
return AdvancedConjuredBlockEntity(pos, state)
return MageBlockEntity(pos, state)
}

override fun <T : BlockEntity?> getTicker(pworld: World, pstate: BlockState, type: BlockEntityType<T>): BlockEntityTicker<T> {
Expand All @@ -117,26 +117,26 @@ class AdvancedConjuredBlock : BlockConjured(

companion object {
fun <T> tick(world: World, position: BlockPos, state: BlockState, blockEntity: T) {
if (blockEntity !is AdvancedConjuredBlockEntity)
if (blockEntity !is MageBlockEntity)
return
if (!blockEntity.properties["invisible"]!!)
blockEntity.particleEffect()
if (blockEntity.properties["ephemeral"]!!) {
blockEntity.lifespan--
if (blockEntity.lifespan <= 0)
HexicalBlocks.ADVANCED_CONJURED_BLOCK.onBreak(world, position, state, null)
HexicalBlocks.MAGE_BLOCK.onBreak(world, position, state, null)
}
}

fun setProperty(world: WorldAccess, pos: BlockPos, property: String, args: List<Iota>) {
val blockEntity = world.getBlockEntity(pos)
if (blockEntity is AdvancedConjuredBlockEntity)
if (blockEntity is MageBlockEntity)
blockEntity.setProperty(property, args)
}

fun setColor(world: WorldAccess, pos: BlockPos, colorizer: FrozenColorizer) {
val blockEntity = world.getBlockEntity(pos)
if (blockEntity is AdvancedConjuredBlockEntity)
if (blockEntity is MageBlockEntity)
blockEntity.setColorizer(colorizer)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import net.minecraft.util.math.BlockPos
import net.minecraft.util.math.Vec3d
import java.util.*

class AdvancedConjuredBlockEntity(pos: BlockPos?, state: BlockState?) : HexBlockEntity(HexicalBlocks.ADVANCED_CONJURED_BLOCK_ENTITY, pos, state) {
class MageBlockEntity(pos: BlockPos?, state: BlockState?) : HexBlockEntity(HexicalBlocks.MAGE_BLOCK_ENTITY, pos, state) {
private val random = Random()
private var colorizer: FrozenColorizer = FrozenColorizer.DEFAULT.get()
var properties: MutableMap<String, Boolean> = mutableMapOf(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ 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.mishaps.MishapBadBlock
import miyucomics.hexical.blocks.AdvancedConjuredBlock
import miyucomics.hexical.blocks.MageBlock
import net.minecraft.util.math.BlockPos
import net.minecraft.util.math.Vec3d

class OpConfigureAdvancedBlock(private val property: String, arguments: Int = 0) : SpellAction {
class OpConfigureMageBlock(private val property: String, arguments: Int = 0) : SpellAction {
override val argc = arguments + 1

override fun execute(args: List<Iota>, ctx: CastingContext): Triple<RenderedSpell, Int, List<ParticleSpray>> {
val pos = args.getBlockPos(0, argc)
ctx.assertVecInRange(pos)
if (ctx.world.getBlockState(pos).block !is AdvancedConjuredBlock)
if (ctx.world.getBlockState(pos).block !is MageBlock)
throw MishapBadBlock.of(pos, "advanced_conjured_block")
if (property == "ephemeral")
args.getPositiveInt(1, argc)
Expand All @@ -23,7 +23,7 @@ class OpConfigureAdvancedBlock(private val property: String, arguments: Int = 0)

private data class Spell(val pos: BlockPos, val property: String, val args: List<Iota>) : RenderedSpell {
override fun cast(ctx: CastingContext) {
AdvancedConjuredBlock.setProperty(ctx.world, pos, property, args)
MageBlock.setProperty(ctx.world, pos, property, args)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,28 @@ import at.petrak.hexcasting.api.spell.getBlockPos
import at.petrak.hexcasting.api.spell.iota.Iota
import at.petrak.hexcasting.api.spell.mishaps.MishapBadBlock
import at.petrak.hexcasting.xplat.IXplatAbstractions
import miyucomics.hexical.blocks.AdvancedConjuredBlock
import miyucomics.hexical.blocks.MageBlock
import miyucomics.hexical.registry.HexicalBlocks
import net.minecraft.util.math.BlockPos
import net.minecraft.util.math.Vec3d

class OpConjureAdvancedBlock : SpellAction {
class OpConjureMageBlock : SpellAction {
override val argc = 1

override fun execute(args: List<Iota>, ctx: CastingContext): Triple<RenderedSpell, Int, List<ParticleSpray>> {
val pos = args.getBlockPos(0, argc)
ctx.assertVecInRange(pos)
if (!ctx.world.getBlockState(pos).material.isReplaceable)
throw MishapBadBlock.of(pos, "replaceable")
return Triple(Spell(pos), MediaConstants.DUST_UNIT, listOf(ParticleSpray.cloud(Vec3d.ofCenter(pos), 1.0)))
return Triple(Spell(pos), MediaConstants.DUST_UNIT * 3, listOf(ParticleSpray.cloud(Vec3d.ofCenter(pos), 1.0)))
}

private data class Spell(val pos: BlockPos) : RenderedSpell {
override fun cast(ctx: CastingContext) {
if (!ctx.canEditBlockAt(pos))
return
ctx.world.setBlockState(pos, HexicalBlocks.ADVANCED_CONJURED_BLOCK.defaultState, 5)
AdvancedConjuredBlock.setColor(ctx.world, pos, IXplatAbstractions.INSTANCE.getColorizer(ctx.caster))
ctx.world.setBlockState(pos, HexicalBlocks.MAGE_BLOCK.defaultState, 5)
MageBlock.setColor(ctx.world, pos, IXplatAbstractions.INSTANCE.getColorizer(ctx.caster))
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package miyucomics.hexical.registry

import dev.architectury.registry.registries.DeferredRegister
import miyucomics.hexical.Hexical
import miyucomics.hexical.blocks.AdvancedConjuredBlock
import miyucomics.hexical.blocks.AdvancedConjuredBlockEntity
import miyucomics.hexical.blocks.MageBlock
import miyucomics.hexical.blocks.MageBlockEntity
import net.minecraft.block.Block
import net.minecraft.block.entity.BlockEntityType
import net.minecraft.util.registry.Registry
Expand All @@ -12,13 +12,13 @@ object HexicalBlocks {
private val BLOCKS: DeferredRegister<Block> = DeferredRegister.create(Hexical.MOD_ID, Registry.BLOCK_KEY)
private val BLOCK_ENTITIES: DeferredRegister<BlockEntityType<*>> = DeferredRegister.create(Hexical.MOD_ID, Registry.BLOCK_ENTITY_TYPE_KEY)

val ADVANCED_CONJURED_BLOCK: AdvancedConjuredBlock = AdvancedConjuredBlock()
val ADVANCED_CONJURED_BLOCK_ENTITY: BlockEntityType<AdvancedConjuredBlockEntity> = BlockEntityType.Builder.create(::AdvancedConjuredBlockEntity, ADVANCED_CONJURED_BLOCK).build(null)
val MAGE_BLOCK: MageBlock = MageBlock()
val MAGE_BLOCK_ENTITY: BlockEntityType<MageBlockEntity> = BlockEntityType.Builder.create(::MageBlockEntity, MAGE_BLOCK).build(null)

@JvmStatic
fun init() {
BLOCKS.register("advanced_conjured_block") { ADVANCED_CONJURED_BLOCK }
BLOCK_ENTITIES.register("advanced_conjured_block") { ADVANCED_CONJURED_BLOCK_ENTITY }
BLOCKS.register("mage_block") { MAGE_BLOCK }
BLOCK_ENTITIES.register("mage_block") { MAGE_BLOCK_ENTITY }
BLOCKS.register()
BLOCK_ENTITIES.register()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ object HexicalItems {
ITEMS.register("lamp") { LAMP_ITEM }
ITEMS.register("arch_lamp") { ARCH_LAMP_ITEM }
ITEMS.register("conjured_staff") { CONJURED_STAFF_ITEM }
ITEMS.register("advanced_conjured_block") { BlockItem(HexicalBlocks.ADVANCED_CONJURED_BLOCK, Item.Settings()) }
ITEMS.register("mage_block") { BlockItem(HexicalBlocks.MAGE_BLOCK, Item.Settings()) }
ITEMS.register()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ object HexicalPatterns {

var NEPHTHYS_GAMBIT = register(HexPattern.fromAngles("deaqqdq", HexDir.SOUTH_EAST), "nephthys", OpNephthys);

var CONJURE_ADVANCED_BLOCK: HexPattern = register(HexPattern.fromAngles("dee", HexDir.NORTH_WEST), "conjure_advanced_block", OpConjureAdvancedBlock())
var CONFIGURE_BLOCK_BOUNCY: HexPattern = register(HexPattern.fromAngles("deeqa", HexDir.NORTH_WEST), "modify_block_bouncy", OpConfigureAdvancedBlock("bouncy"))
var CONFIGURE_BLOCK_EPHEMERAL: HexPattern = register(HexPattern.fromAngles("deewwaawd", HexDir.NORTH_WEST), "modify_block_ephemeral", OpConfigureAdvancedBlock("ephemeral", 1))
var CONFIGURE_BLOCK_INVISIBLE: HexPattern = register(HexPattern.fromAngles("deeqedeaqqqwqqq", HexDir.NORTH_WEST), "modify_block_invisible", OpConfigureAdvancedBlock("invisible"))
var CONFIGURE_BLOCK_REPLACEABLE: HexPattern = register(HexPattern.fromAngles("deewqaqqqqq", HexDir.NORTH_WEST), "modify_block_replaceable", OpConfigureAdvancedBlock("replaceable"))
var CONFIGURE_BLOCK_VOLATILE: HexPattern = register(HexPattern.fromAngles("deewedeeeee", HexDir.NORTH_WEST), "modify_block_volatile", OpConfigureAdvancedBlock("volatile"))
var CONJURE_ADVANCED_BLOCK: HexPattern = register(HexPattern.fromAngles("dee", HexDir.NORTH_WEST), "conjure_mage_block", OpConjureMageBlock())
var CONFIGURE_BLOCK_BOUNCY: HexPattern = register(HexPattern.fromAngles("deeqa", HexDir.NORTH_WEST), "modify_block_bouncy", OpConfigureMageBlock("bouncy"))
var CONFIGURE_BLOCK_EPHEMERAL: HexPattern = register(HexPattern.fromAngles("deewwaawd", HexDir.NORTH_WEST), "modify_block_ephemeral", OpConfigureMageBlock("ephemeral", 1))
var CONFIGURE_BLOCK_INVISIBLE: HexPattern = register(HexPattern.fromAngles("deeqedeaqqqwqqq", HexDir.NORTH_WEST), "modify_block_invisible", OpConfigureMageBlock("invisible"))
var CONFIGURE_BLOCK_REPLACEABLE: HexPattern = register(HexPattern.fromAngles("deewqaqqqqq", HexDir.NORTH_WEST), "modify_block_replaceable", OpConfigureMageBlock("replaceable"))
var CONFIGURE_BLOCK_VOLATILE: HexPattern = register(HexPattern.fromAngles("deewedeeeee", HexDir.NORTH_WEST), "modify_block_volatile", OpConfigureMageBlock("volatile"))

var CHORUS_BLINK: HexPattern = register(HexPattern.fromAngles("aawqqqq", HexDir.SOUTH_EAST), "chorus_blink", OpChorusBlink())
var PROGRAM_LAMP: HexPattern = register(HexPattern.fromAngles("wwqqqqq", HexDir.EAST), "program_lamp", OpProgramLamp())
Expand Down
14 changes: 7 additions & 7 deletions common/src/main/resources/assets/hexical/lang/en_us.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"item.hexical.lamp": "Genieless Lamp",
"item.hexical.arch_lamp": "Arch Genieless Lamp",
"item.hexical.lamp": "Genie Lamp",
"item.hexical.arch_lamp": "Archgenie Lamp",
"item.hexical.conjured_staff": "Conjured Staff",
"block.hexical.advanced_conjured_block": "Advanced Conjured Block",
"block.hexical.mage_block": "Mage Block",

"subtitles.hexical.lamp_activate": "Lamp activates",
"subtitles.hexical.lamp_deactivate": "Lamp deactivates",
Expand All @@ -21,8 +21,8 @@
"hexcasting.spell.hexical:is_using_lamp": "Archgenie Purification",
"hexcasting.spell.hexical:terminate_arch_lamp": "Archgenie Termination",
"hexcasting.spell.hexical:chorus_blink": "Chorus Blink",
"hexcasting.spell.hexical:conjure_advanced_block": "Conjure Advanced Block",
"hexcasting.spell.hexical:conjure_staff": "Conjure Staff",
"hexcasting.spell.hexical:conjure_mage_block": "Conjure Mage Block",
"hexcasting.spell.hexical:modify_block_bouncy": "Modify Block: Bouncy",
"hexcasting.spell.hexical:modify_block_ephemeral": "Modify Block: Ephemeral",
"hexcasting.spell.hexical:modify_block_invisible": "Modify Block: Invisible",
Expand Down Expand Up @@ -78,9 +78,9 @@
"hexical.page.nephthys.0": "Pops a pattern list and a number from the stack and dives down n iota to casts the pattern list. Useful for surgery-like operations.",
"hexical.page.nephthys.1": "It's extremely versatile and I can mend almost any error in my stack using Bookkeeper's Gambit, pushing iota after a dive, and transforming surfaced iota. It was named after a goddess of mourning and rivers, lending to how it buries/dives down into the stack.",

"hexical.page.advanced_conjuration.title": "Advanced Conjuration",
"hexical.page.advanced_conjuration": "While Conjure Block is an interesting spell, it has multiple shortcomings. The blocks stay around forever, are a mess to clean up, and don't have many interesting properties.",
"hexical.page.conjure_advanced_block": "Luckily, Nature offers an elegant and flexible solution. These advanced blocks come with a suite of $(o)modifiers$(). I could even stack multiple modifiers on one block.",
"hexical.page.mage_block.title": "Mage Blocks",
"hexical.page.mage_block": "While interesting, Conjure Block has multiple shortcomings. The blocks last forever, are consequently a pain to clean up, and lack interesting properties. Luckily, Nature offers an elegant and flexible solution. These mage blocks come with a suite of $(o)modifiers$(). I could even stack multiple modifiers on one block.",
"hexical.page.conjure_mage_block": "Conjures a generic mage block at the location. Costs three dust.",
"hexical.page.modify_block_bouncy": "This modifier makes the block delightfully fun to bounce on! It returns more force to me than regular slime blocks and I notice even if I sneak, the block bounces me regardless.",
"hexical.page.modify_block_ephemeral": "This modifier takes in a number as well as a position and makes the block destroy itself after the number in twentieths of a second has passed. No more messy floating blocks!",
"hexical.page.modify_block_invisible": "This modifier prevents the block from emiting the telltale particles, even when being stood on.",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
{
"name": "hexical.page.advanced_conjuration.title",
"name": "hexical.page.mage_block.title",
"icon": "minecraft:glass",
"category": "hexcasting:patterns/spells",
"pages": [
{
"type": "patchouli:text",
"text": "hexical.page.advanced_conjuration"
"text": "hexical.page.mage_block"
},
{
"type": "hexcasting:pattern",
"op_id": "hexical:conjure_advanced_block",
"anchor": "hexical:conjure_advanced_block",
"op_id": "hexical:conjure_mage_block",
"anchor": "hexical:conjure_mage_block",
"input": "vec",
"output": "",
"text": "hexical.page.conjure_advanced_block"
"text": "hexical.page.conjure_mage_block"
},
{
"type": "hexcasting:pattern",
Expand Down

0 comments on commit 0379e8b

Please sign in to comment.