Skip to content

Commit

Permalink
Added invisible modifier
Browse files Browse the repository at this point in the history
  • Loading branch information
miyucomics committed Feb 23, 2024
1 parent a191efd commit eb96948
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ class AdvancedConjuredBlock : BlockConjured(

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

Expand All @@ -88,13 +90,14 @@ class AdvancedConjuredBlock : BlockConjured(

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ class AdvancedConjuredBlockEntity(pos: BlockPos?, state: BlockState?) : HexBlock
private var colorizer: FrozenColorizer = FrozenColorizer.DEFAULT.get()
var bouncy: Boolean = false
var ephemeral: Boolean = false
var lifespan: Int = 0
var invisible: Boolean = false
var volatile: Boolean = false
var lifespan: Int = 0

fun walkParticle(entity: Entity) {
for (i in 0..2) {
Expand Down Expand Up @@ -61,6 +62,7 @@ class AdvancedConjuredBlockEntity(pos: BlockPos?, state: BlockState?) : HexBlock
tag.put("colorizer", colorizer.serializeToNBT())
tag.putBoolean("bouncy", this.bouncy)
tag.putBoolean("ephemeral", this.ephemeral)
tag.putBoolean("invisible", this.invisible)
tag.putBoolean("volatile", this.volatile)
tag.putInt("lifespan", this.lifespan)
}
Expand All @@ -69,6 +71,7 @@ class AdvancedConjuredBlockEntity(pos: BlockPos?, state: BlockState?) : HexBlock
this.colorizer = FrozenColorizer.fromNBT(tag.getCompound("colorizer"))
this.bouncy = tag.getBoolean("bouncy")
this.ephemeral = tag.getBoolean("ephemeral")
this.invisible = tag.getBoolean("invisible")
this.volatile = tag.getBoolean("volatile")
this.lifespan = tag.getInt("lifespan")
}
Expand All @@ -80,6 +83,7 @@ class AdvancedConjuredBlockEntity(pos: BlockPos?, state: BlockState?) : HexBlock
this.ephemeral = true
this.lifespan = args.getPositiveInt(0, args.size)
}
"invisible" -> this.invisible = true
"volatile" -> this.volatile = true
}
this.sync()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ object HexicalPatterns {
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", OpConfigureBlock("bouncy"))
var CONFIGURE_BLOCK_EPHEMERAL: HexPattern = register(HexPattern.fromAngles("deewwaawd", HexDir.NORTH_WEST), "modify_block_ephemeral", OpConfigureBlock("ephemeral", 1))
var CONFIGURE_BLOCK_INVISIBLE: HexPattern = register(HexPattern.fromAngles("deeqedeaqqqwqqq", HexDir.NORTH_WEST), "modify_block_invisible", OpConfigureBlock("invisible"))
var CONFIGURE_BLOCK_VOLATILE: HexPattern = register(HexPattern.fromAngles("deewedeeeee", HexDir.NORTH_WEST), "modify_block_volatile", OpConfigureBlock("volatile"))

var CHORUS_BLINK: HexPattern = register(HexPattern.fromAngles("aawqqqq", HexDir.SOUTH_EAST), "chorus_blink", OpChorusBlink())
Expand Down
2 changes: 2 additions & 0 deletions common/src/main/resources/assets/hexical/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"hexcasting.spell.hexical:conjure_advanced_block": "Conjure Advanced 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",
"hexcasting.spell.hexical:modify_block_volatile": "Modify Block: Volatile",
"hexcasting.spell.hexical:surveil_sentinel": "Surveil Sentinel",
"hexcasting.spell.hexical:nephthys": "Nephthys Gambit",
Expand Down Expand Up @@ -49,6 +50,7 @@
"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.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.",
"hexical.page.modify_block_volatile": "This modifier makes the block break other conjured blocks it's touching. Notably, if it breaks another volatile block, the chain continues down until every volatile block shatters.",

"hexical.page.chorus_blink.1": "Between Blink, Greater Teleport, ender pearls, and chorus fruit, this spell serves a harmonious midpoint for safe, precise, and cheap teleportation.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@
"output": "",
"text": "hexical.page.modify_block_ephemeral"
},
{
"type": "hexcasting:pattern",
"op_id": "hexical:modify_block_invisible",
"anchor": "hexical:modify_block_invisible",
"input": "vec",
"output": "",
"text": "hexical.page.modify_block_invisible"
},
{
"type": "hexcasting:pattern",
"op_id": "hexical:modify_block_volatile",
Expand Down

0 comments on commit eb96948

Please sign in to comment.