Back to mods
ForgeAttachment project artwork

CurseForge · Minecraft mod

ForgeAttachment

Port of the NeoForge 1.21.1 data attachment system to Forge 1.20.1

Choose a version Pick your version below, then grab the matching file.

Quick answer

Which ForgeAttachment release should I use?

Updated today
beta file forgeattachment-0.0.1-1.12.2
Game version 1.12.2
Loader Forge

forgeattachment-0.0.1-1.12.2 targets 1.12.2 with Forge. The project page does not say whether this file belongs on the client, dedicated server, or both. No extra mods listed for this file.

Where it goes

Is ForgeAttachment required on the client, server, or both?

The project page does not say whether this file belongs on the client, dedicated server, or both.

Client Source doesn’t say
Dedicated server Source doesn’t say
Loader for this release Forge
Required install it here Optional supported, not mandatory Not supported do not install here Source doesn’t say do not assume

The source does not explicitly classify this release as client-only or server-only.

What else does forgeattachment-0.0.1-1.12.2 need?

forgeattachment-0.0.1-1.12.2. Change the file and its required mods may change too.

No extra mods listed for this file

This file does not list any required mods. Do not add a library just because a different file uses it.

This file does not list any required or optional mods.

Before you install it

Add ForgeAttachment without breaking your instance.

Built for forgeattachment-0.0.1-1.12.2. Pick another file and the loader, install side or required mods may change.

  1. 01

    Stick to this file

    Use forgeattachment-0.0.1-1.12.2. It targets 1.12.2 with Forge; another release may have different loader, side or dependency requirements.

  2. 02

    Bring the mods it needs

    This file does not list any required mods. Do not add a library just because a different file uses it.

  3. 03

    Put it on the correct side

    The project page does not say whether this file belongs on the client, dedicated server, or both.

  4. 04

    Pick the file you checked

    Use the “Get this file” button beside forgeattachment-0.0.1-1.12.2. It opens that exact file at the source.

About this project

What does ForgeAttachment add?

ForgeAttachment ports the NeoForge 1.21.1 data attachment system to Forge 1.20.1 and exposes it to other mods as a stable API.

Original project: NeoForge — https://github.com/neoforged/NeoForge

This is an unofficial port, not affiliated with or endorsed by the NeoForge team.

Data attachments let a mod store extra data on existing game objects (entities, block entities) without editing their classes or maintaining a separate map keyed by object identity. Register an AttachmentType, then read and write it on any object that supports attachments.

Features

  • Register your own attachment types with default values, serializers and copy-on-death behaviour
  • Attach data to entities and block entities
  • Automatic client synchronization, opt-in per attachment type
  • Both serialization paths from 1.21.1: Codec for saved data and StreamCodec for network
  • Lifecycle events for attach, detach and sync
  • Pure library: no items, blocks or world content of its own

For developers

public static final AttachmentType<ExampleData> EXAMPLE = AttachmentType
        .builder(() -> new ExampleData("", 0))
        .serialize(ExampleData.CODEC)
        .copyOnDeath()
        .sync(ExampleData.STREAM_CODEC)
        .build();

ExampleData data = ForgeAttachmentApi.getData(entity, EXAMPLE);
ForgeAttachmentApi.setData(entity, EXAMPLE, data);

A complete registration example ships in the example package of the source tree.

Requirements

  • Minecraft 1.20.1
  • Forge 47.x
  • Java 17

Source

https://github.com/Zershyan/forgeattachment

Credits

API design ported from NeoForge 1.21.1's attachment system; thanks to the NeoForge team for the original design.


ForgeAttachment 把 NeoForge 1.21.1 的数据附件(Data Attachment)系统移植到 Forge 1.20.1,并以稳定的 API 开放给其他模组使用。

原项目: NeoForge — https://github.com/neoforged/NeoForge

本项目为非官方移植,与 NeoForge 团队无隶属关系,也未获其背书。

数据附件允许模组把额外数据直接挂在已有的游戏对象上(实体、方块实体),既不用改动原类,也不用自己维护一张以对象为键的映射表。注册一个 AttachmentType 之后,就能在任意支持附件的对象上读写它。

特性

  • 自定义附件类型注册:默认值、序列化器与死亡复制行为
  • 实体与方块实体均可挂载附件
  • 自动客户端同步,可按附件类型单独开启
  • 完整保留 1.21.1 的两条序列化路径:Codec(存档)与 StreamCodec(网络)
  • 附件挂载、移除与同步的生命周期事件
  • 纯库模组:不包含任何物品、方块或世界内容

面向开发者

public static final AttachmentType<ExampleData> EXAMPLE = AttachmentType
        .builder(() -> new ExampleData("", 0))
        .serialize(ExampleData.CODEC)
        .copyOnDeath()
        .sync(ExampleData.STREAM_CODEC)
        .build();

ExampleData data = ForgeAttachmentApi.getData(entity, EXAMPLE);
ForgeAttachmentApi.setData(entity, EXAMPLE, data);

源码 example 包内含完整的注册示例。

环境要求

  • Minecraft 1.20.1
  • Forge 47.x
  • Java 17

源码

https://github.com/Zershyan/forgeattachment

鸣谢

API 设计移植自 NeoForge 1.21.1 的附件系统,感谢 NeoForge 团队的原始设计。

Project description from CurseForge.

Pick your setup

ForgeAttachment by Minecraft version and loader

Choose the version and loader you play, then open the matching release.

2 available setups

Check the dependencies, then try the file in a copied instance before changing a world you care about.

Recent files

ForgeAttachment versions and loaders

2 of 2 releases match

Looking for an older file? The official CurseForge project page is in Resources.