跳到正文

OPAC – Create: Big Canons Compat / Bridge

作者:agent772

这个模组是一个桥梁:它将 CBC 的破坏通过 OPAC 的保护 API 路由,以便 OPAC 现有的按领地选项决定发生什么。

收藏

介绍

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

OPAC-Create-Big-Canons-Compat

An Open Parties and Claims (OPAC)
addon for Create: Big Cannons (CBC).

Create: Big Cannons destroys blocks and damages entities through its own projectile
impact code, which bypasses the normal block-break / explosion events that OPAC
listens to. As a result, plain OPAC never sees cannon fire and cannot protect claims
from it. This mod is a bridge: it routes CBC’s destruction through OPAC’s
protection API so that OPAC’s existing per-claim options decide what happens.

Disclaimer: Yes this Mod was made using AI, as this Description too. AI was used for the code, specs and tests where done by me. Security audit was done by AI.

How it works

This mod has no config of its own. Simply installing it activates the bridge:
CBC block destruction and entity damage are routed through OPAC. All of the
granular control lives in OPAC itself — the per-claim block/entity protection
toggles, the wilderness / server-claim / expired-claim settings, and admin-defined
exception groups (see the Recommended OPAC server config
section below). If you previously turned the bridge off through this mod’s config,
that is no longer possible; uninstall the mod instead.

Fired projectiles are tagged with the player who fired them (CBC leaves them
anonymous), so OPAC’s party/ally exceptions and owner redirection apply to cannon
fire the same way they do to any other player action.

CBC’s damage sources are wrapped the same way. OPAC independently re-checks
every entity hurt on the server (its LivingIncomingDamageEvent handler) using
the entities carried by the damage source — and CBC’s CannonDamageSource
carries none, so that final check used to see every cannon hurt as anonymous and
block it in any protected claim, no matter what the claim’s options or the
bridge’s own checks said. The bridge wraps CBC’s damage sources so they carry
the projectile (and its owner, when attributed), which makes OPAC’s final check
consult the same exception groups and owner redirection as the rest of the
bridge. Armor-bypass behaviour of the original CBC source is preserved.

Recommended OPAC server config

To let cannons fire freely inside your own claim while still protecting other
players’ claims, add CBC’s entities to OPAC’s exception groups in
serverconfig/openpartiesandclaims-server.toml:

blockAccessEntityGroups = [ "CBC{createbigcannons:*}" ]
entityAccessEntityGroups = [ "CBC{createbigcannons:*}" ]

With the projectile owner attributed, OPAC treats a cannon shot like an action by
its firer, so these groups grant the firer’s own claim access while everyone else’s
claims stay protected.

These two lists create per-claim options that appear in the claim config UI as:

  • "Blocks (CBC)" – from blockAccessEntityGroups: which players’ CBC
    projectiles may break blocks in the claim.
  • "Entities By (CBC)" – from entityAccessEntityGroups: which players’ CBC
    projectiles may damage entities in the claim.

The lists take entity IDs. Take care not to put the entry into
blockExceptionGroups instead — that list takes block IDs and creates a
"Blocks (CBC)" option, which controls who may break CBC’s own blocks (cannon
parts) in the claim and has no effect on what cannon fire can destroy.

These group options are checked in addition to OPAC’s general exception
options. Because projectiles are redirected to their firing player, the general
"Allow Blocks By Players" / "Allow Entities By Players" options also
apply to cannon fire: if one of those is set to Everyone, cannon damage is
allowed regardless of the CBC group options. The CBC options only grant extra
access
(e.g. "Mine (CBC): Everyone" lets anyone’s cannons break blocks even
while "Allow Blocks By Players" is Nobody); they cannot revoke access granted by
a general option.

Note that adding a group to the server config only creates the per-claim
option — its value still defaults to Nobody. After a restart, open the
claim config and set "Block (CBC)" / "Entity By (CBC)" to the players you want
to allow.

By default the new options are grayed out in the claim config UI, meaning
players cannot change them. To let claim owners toggle them, add the option
IDs to the playerConfigurablePlayerConfigOptions list in the same file:

playerConfigurablePlayerConfigOptions = [
    # ... existing entries ...
    "claims.protection.exceptions.groups.entity.blockAccess.CBC", 
    "claims.protection.exceptions.groups.entity.entityAccess.CBC"
]

常见问题

OPAC – Create: Big Canons Compat / Bridge 支持哪些 Minecraft 版本?

OPAC – Create: Big Canons Compat / Bridge 支持 Minecraft Java 版 1.21.1,可用的加载器:NeoForge。下载时注意选择和你游戏版本一致的文件。

OPAC – Create: Big Canons Compat / Bridge 怎么安装?

先用 PCL2 或 HMCL 启动器安装对应版本的 NeoForge,再把下载的 .jar 文件放进游戏目录的 mods 文件夹,重新启动游戏即可。开启了版本隔离的,mods 文件夹在 versions/版本名 下面。

评论

登录后评论和评分

agent772 的其他作品

查看全部 →