Dampened

Dampened

Mod

A library for Palladium that adds various interactions for power dampening.

Client and server EquipmentGame MechanicsLibraryManagementUtility

1,113 downloads
4 followers
Follow Save
90% of ad revenue goes to creators. Go ad-free while supporting creators with Modrinth Plus. Subscribe today!

Image

A Palladium addon adding items and effects related to power dampening.

Dampened is an addon for Palladium that adds blocks, effects, and interactions that will allow addonpack developers to allow for cross-pack power dampening. The hope is to make the process of dampening powers to be as streamlined as possible with this addon.

Instructions for how to properly add compatibility with Dampened to your addon, or integrate Dampened into your addon will be coming soon!

Originally built for Arrzee's Enhanced SMP. Watch now!

Features

Dampening Blocks

  • Dampener Block (Dark Matter)
  • EMP Jammer (Technology)
  • Magic Rune (Magic)
  • Creative Dampening Block

Targeted Dampening

  • Dampening Handcuffs (Dark Matter)
  • Kryptonite-Gold Handcuffs
  • Magic-Dampening Handcuffs
  • Tech-Dampening Belt
  • Dampening Collar (Mutant)

Compatibility

Option 1: Optional Dependency

If you'd like Dampened to be an OPTIONAL dependency for your addon, then take the following steps.

Part 1: Custom Condition

To add Dampened compatibility to your addon, first you need to add a custom power condition. This can be done by placing the following contents into a file located at addon/<YOUR_NAMESPACE>/kubejs_scripts/safe_player_has_effect.js.

ATTENTION: Replace <YOUR_NAMESPACE> with your mod's namespace!

/*
    @author Hertz
    @version 1.0
*/

var BuiltInRegistries = Java.loadClass("net.minecraft.core.registries.BuiltInRegistries")

function resolveAllegedBooleanFromObject(thing) {
    if (thing.toString() == 'true') { return true; }
    if (thing.toString() == 'false') { return false; }
    return null
}

StartupEvents.registry('palladium:condition_serializer', (event) => {

    event.create('<YOUR_NAMESPACE>:safe_player_has_effect')
    .addProperty("effect", "string", "minecraft:health_boost", "Effect to search for")
    .test((entity, props) => {
        let targetEffect = props.get("effect")
        var toReturn = false
        
        if (entity.activeEffects.size() > 0) {
            entity.activeEffects.toArray().forEach((iteratedEffect) => {
                if (toReturn) return
                var currentEffectPath = BuiltInRegistries.MOB_EFFECT.getKey(iteratedEffect.effect).toString()
                if (currentEffectPath == targetEffect) {
                    toReturn = true
                }
            })
        }
        return toReturn
    })
});

Part 2: Implementation

Adding the custom condition is as simple as slotting it into a power's unlocking condition. However, to use powers you want to make sure you are not being dampened, so you need to wrap your custom safe_player_has_effect in a palladium:not condition. Below is a snippet of the power JSON file.

"conditions": {
  "unlocking": [
    {
      "type": "palladium:not",
      "conditions": [
        {
          "type": "<YOUR_NAMESPACE>:safe_player_has_effect",
          "effect": "dampened:genetic"
        }
      ]
    }
  ]
}

Feel free to switch out the effect that dampens your powers, and you're good to go!

Option 2: Required Dependency

If you'd like Dampened to be a required dependency for your addon (as it is with Arrzee's Multiverse), you can use Palladium's built in palladium:has_effect condition in place of the custom condition.

"conditions": {
  "unlocking": [
    {
      "type": "palladium:not",
      "conditions": [
        {
          "type": "palladium:has_effect",
          "effect": "dampened:genetic"
        }
      ]
    }
  ]
}

You'll want to reflect Dampened as a dependency in your addon's pack.mcmeta or mod's META_INF/mods.toml.


Project members

hashbeep

Author

Details

Licensed ARR
Published 2 months ago
Updated 14 days ago