跳到正文

Dampened

作者:h_rtz

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

收藏

截图

介绍

中文介绍正在准备中,下面暂时显示原文。

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 with your mod’s namespace!

/*
    @author Hertz
    @version 2.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>:dampened_by')
    .addProperty("effect", "string", "minecraft:health_boost", "Effect to search for")
    .test((entity, props) => {
        let targetEffect = props.get("effect")
        var toReturn = false
        
        try {
            var fetchedEffect = BuiltInRegistries.MOB_EFFECT.get(targetEffect)
            if (fetchedEffect == null) {
                // throw new Error(`Target effect ${targetEffect} not found!`)
                toReturn = false
            } else {
                toReturn = entity.hasEffect(targetEffect)
            }
        } catch (err) {
            console.log(err)
        }
        
        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": "<YOUR_NAMESPACE>:dampened_by",
      "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: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.

常见问题

Dampened 支持哪些 Minecraft 版本?

Dampened 支持 Minecraft Java 版 1.20.1,可用的加载器:Forge。下载时注意选择和你游戏版本一致的文件。

Dampened 怎么安装?

先用 PCL2 或 HMCL 启动器安装对应版本的 Forge,再把下载的 .jar 文件放进游戏目录的 mods 文件夹,重新启动游戏即可。开启了版本隔离的,mods 文件夹在 versions/版本名 下面。运行环境:客户端和服务端都要装。

评论

登录后评论和评分

h_rtz 的其他作品

查看全部 →