Attachments are not synced on player creation
Nobody has claimed this yet.
Assessment
This issue has not been assessed yet.
Description
Minecraft version
1.21.1
Describe the bug
When a new player is created, e.g. upon join, dimension change, or respawn, attachments are not synced. Attachments do sync properly when setAttached/removeAttached is called.
Steps to reproduce
- Create a fabric mod with the following mod initializer
@SuppressWarnings("UnstableApiUsage")
public class BugDemo implements ModInitializer {
public static final String MOD_ID = "bugdemo";
public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);
public static final AttachmentType<Unit> TEST = AttachmentRegistry.create(ResourceLocation.fromNamespaceAndPath(MOD_ID, "test"), builder -> builder
.persistent(Unit.CODEC)
.syncWith(StreamCodec.unit(Unit.INSTANCE), AttachmentSyncPredicate.targetOnly())
.copyOnDeath()
);
@Override
public void onInitialize() {
UseItemCallback.EVENT.register((player, world, hand) -> {
var stack = player.getItemInHand(hand);
if (stack.is(Items.BLAZE_ROD)) {
if (world.isClientSide()) return InteractionResultHolder.success(stack);
player.setAttached(TEST, Unit.INSTANCE);
return InteractionResultHolder.success(stack);
}
if (stack.is(Items.STICK)) {
LOGGER.info(
"{} {} attachment",
world.isClientSide() ? "client" : "server",
player.hasAttached(TEST) ? "has" : "does not have"
);
return InteractionResultHolder.success(stack);
}
return InteractionResultHolder.pass(stack);
});
}
}
- Run the mod on fabric.
- Use the blaze rod to set the attachment.
- Recreate the player by relogging, respawning, or changing dimensions.
- Use the stick. The log will show
[17:06:29] [Render thread/INFO] (bugdemo) client has attachment
[17:06:29] [Server thread/INFO] (bugdemo) server has attachment
- Run the mod on neoforge with connector & ffapi.
- Repeat steps 3-5. The log will show
[17:13:56] [Render thread/INFO] [bugdemo/]: client does not have attachment
[17:13:56] [Server thread/INFO] [bugdemo/]: server has attachment
- Use the blaze rod to re-set the attachment, then use the stick. The log will show
[17:18:53] [Render thread/INFO] [bugdemo/]: client has attachment
[17:18:53] [Server thread/INFO] [bugdemo/]: server has attachment
The expected behavior is that when the player is recreated, the server and client will both see the attachment.
Logs
No response
Additional context
Possibly related to FFAPI 2.2.0 using neoforge api for attachment sync.
- Dominant language
- Java
- Stars
- 181
- Forks
- 41
- Avg merge
- 19d 17h
- Merged PRs (30d)
- 1
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Sinytra/ForgifiedFabricAPI
-
Fabric mods cannot query `isEyeInFluid`Possibly taken @cassiancc claimed this 1 day ago. Openbug
Difficulty 4/5 3-5 days Newbie friendliness 15/100
Sinytra/ForgifiedFabricAPI#299 ·
-
Missing mixin in fabric-registry-sync-v0 suspected to break modded registry loadingMay be free again @Su5eD claimed this 88 days ago, and no pull request is open. Open26.1.x bug
Sinytra/ForgifiedFabricAPI#280 · 6 comments · 1 assignee ·
-
1.21.x bug
Sinytra/ForgifiedFabricAPI#276 ·
-
1.21.x bug
Sinytra/ForgifiedFabricAPI#269 ·
-
1.21.x bug
Sinytra/ForgifiedFabricAPI#267 ·
All issues in Sinytra/ForgifiedFabricAPI
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
objectionary/eo-graphs#80 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
enhancement good first issue
Difficulty 2/5 Half a day Newbie friendliness 66/100
apache/fineract-consumer-facing#175 ·
Maintainers usually reply within 1 day
-
[BUG] 订单:会员凭订单号即可取消其他会员的待付款订单(取消接口不校验订单归属)Possibly taken @dadiyang claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
macrozheng/mall#1016 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100