Magic

Magic

190k Downloads

CheckBlock & ModifyBlock Block States parameters?

NightScythe1 opened this issue ยท 5 comments

commented

I'm making some ritualistic spells that check and modify the surrounding environment. One of which, I'm trying to make it check around the Player if there are Lit Candles and if so, extinguish them. However, the most I can do is check for any candles and remove/replace them. I'm not sure if it's possible already, but would it be possible to allow use of Block States in these actions. E.G.

    - class: CheckBlock
      allowed: amethyst_block
      blockstates:
         - lit: true
         - candles: 4

and the possibility of modifying a block's state without changing the block itself would be perfect as well. For example-

    - class: ModifyBlock
      blockstates:
         - lit: false

apologies if this is impossible or already available, as i'm having a hard time figuring it out. thanks!

commented

Thank you! I'll absorb it and give the blockstate a try and get back to you on if it works!

commented

Hmmm that does sound cool! I am wondering if you could use the blockstate syntax in both cases- I am honestly not sure if it'd work and can't check presently.

... and I don't even know what that blockstate would look like so I'm really being less than helpful here. It'd be akin to black_candle[lit: true] ... the easiest way to tell is to Absorb one and then /mage describe brushes to see what it looks like (I think)

I can probably help out more with this later, I think it would be very nice to have if it's not doable already.

commented

I absorbed a candle and the candle was described as "candle?minecraft:candle[candles=4,lit=true,waterlogged=false]" when I used Describe Brush. So I implemented the following into the spell in place of "allowed: candle" =
allowed: candle?minecraft:candle[candles=4,lit=true,waterlogged=false]
however, this still simply checked for any candle, no matter the blockstate, and passes it as a success. I then tried:
allowed: candle[candles=4,lit=true,waterlogged=false]
but this did the opposite, giving everything as a failure and not succeeding with or without any type of candles

commented

Darn, I was hoping it's just work :(

Well I will take a look, I may have to add a special feature to CheckBlock to check block state.

I am certain that ModifyBlock can handle it as a brush though.

commented

Thanks! I'll drop my current spell here in case you'd like to try it-

ritual:
  name: Ritual
  icon: stick
  variables:
    - "candle_count"
    - "lantern_count"
    - "skull_count"
    - "rose_count"
    - "banner_count"
    - "wool_count"
    - "amethyst_count"
    - "total_count"
    - "time_count"
    - "moon_count"
  actions:
    cast:
    - class: CheckBlock
      allowed: amethyst_block
      fail:
        - class: Stop
    - class: AreaOfEffect
      radius: 20
      target_source: true
      actions:
        - class: PotionEffect
          duration: 20000
          add_effects:
            blindness: 0
    - class: Sphere
      radius: 5
      actions:
        - class: CheckRequirements
          requirement:
            time:
              min: 17500
              max: 18500
          actions:
            - class: ModifyVariable
              variable: "time_count"
              value: "1"
        - class: CheckRequirements
          requirement:
            moon:
              value: 0
          actions:
            - class: ModifyVariable
              variable: "moon_count"
              value: "1"
        - class: CheckBlock
          allowed: candle
          actions:
            - class: ModifyVariable
              variable: "candle_count"
              value: "1"
        - class: CheckBlock
          allowed: soul_lantern
          actions:
            - class: ModifyVariable
              variable: "lantern_count"
              value: "1"
        - class: CheckBlock
          allowed: skeleton_skull
          actions:
            - class: ModifyVariable
              variable: "skull_count"
              value: "1"
        - class: CheckBlock
          allowed: potted_wither_rose
          actions:
            - class: ModifyVariable
              variable: "rose_count"
              value: "1"
        - class: CheckBlock
          allowed: black_wall_banner
          actions:
            - class: ModifyVariable
              variable: "banner_count"
              value: "1"
        - class: CheckBlock
          allowed: red_wool
          actions:
            - class: ModifyVariable
              variable: "wool_count"
              value: "1"
        - class: CheckBlock
          allowed: amethyst_block
          actions:
            - class: ModifyVariable
              variable: "amethyst_count"
              value: "1"
    - class: ModifyVariable
      variable: "total_count"
      value: "candle_count + lantern_count + skull_count + rose_count + banner_count + wool_count + amethyst_count + time_count + moon_count"
    - class: CheckRequirements
      requirements:
        - variables:
          - variable: "total_count"
            value: 9
      actions:
        - class: PlayEffects
          effects: conjure
        - class: Delay
          delay: 8000
        - class: Lightning
          effect_only: true
        - class: Delay
          delay: 2000
        - class: SpawnEntity
          type: conjured_demon
          on_block: true



  effects:
     conjure:
     - location: target
       source_location: feet
       target_location: feet
       target_offset: 0,1.5,0
       sound: block_end_portal_spawn
       sound_pitch: -2
       sound_volume: 3
     - location: target
       sound: ambient_cave
       sound_pitch: -2
       sound_volume: 3
       source_location: block_center
       target_location: block_center
       effectlib:
          class: AnimatedBall
          duration: 12000
          size: 3.5
          particle: smoke_large
          particle_count: 20
          iterations: 50
     - location: target
       source_location: block_center
       target_location: block_center
       effectlib:
          class: Modified
          duration: 8000
          parameters:
              radius: "(t/i) * 2 + 0.01"
          effect:
              class: Helix
              particle: small_flame
              strands: 7
              curve: 1
              particles: 20
              update_locations: false
              offset: 0,0.6,0
     - location: target
       sound: entity_ender_dragon_growl
       sound_volume: 3
       sound_pitch: -2
       delay: 7000
       source_location: block_center
       target_location: block_center
       effectlib:
          class: Modified
          duration: 3000
          parameters:
              radius: "(t/i) * 2 + 0.01"
          effect:
              class: Sphere
              particle: soul
              particles: 30
              update_locations: false
              offset: 0,0.8,0
     - location: target
       sound: entity_ravager_roar
       sound_volume: 3
       sound_pitch: -2
       delay: 8500
       source_location: block_center
       target_location: block_center
       effectlib:
          class: Modified
          duration: 3000
          parameters:
              radius: "(t/i) * 2 + 0.01"
          effect:
              class: Sphere
              particle: soul
              particles: 30
              update_locations: false
              offset: 0,1.4,0
     - location: target
       delay: 7000
       sound: entity_wolf_growl
       sound_volume: 3
       sound_pitch: -2
       source_location: block_center
       target_location: block_center
       effectlib:
          class: Modified
          duration: 2000
          parameters:
              radius: "(t/i) * 3 + 0.01"
          effect:
              class: Helix
              particle: soul_fire_flame
              strands: 7
              curve: 1
              particles: 20
              update_locations: false
              offset: 0,0.6,0
     - location: target
       delay: 9000
       sound: block_portal_ambient
       sound_volume: 3
       sound_pitch: -2
       source_location: block_center
       target_location: block_center
       effectlib:
          class: Particle
          duration: 5000
          particle: squid_ink
          particle_count: 80
          particle_offset_x: 0.5
          particle_offset_y: 1.7
          particle_offset_z: 0.5
  parameters:
    range: 5
    cooldown: 600000

It's designed to be cast at the amethyst at this Altar, at Midnight, on a Full Moon. (Only the blocks checked for in the spell actually matter)
2022-10-16_22 41 05