Architectury API (Fabric/Forge/NeoForge)

Architectury API (Fabric/Forge/NeoForge)

158M Downloads

Different result between forge and fabric when trying to register a block to replace vanila one.

qyl27 opened this issue ยท 5 comments

commented

When I tried to register a block with id "minecraft:dandelion" (accroding to forge doc and fabricmc reddit), I found different result between architectury api forge and fabric version.
In forge, it will replace the vanilla one.
In fabric, it will shows Attempted to register ID ResourceKey[minecraft:block / minecraft:dandelion] at different raw IDs (147, 1003)! If you're trying to override an item, use .set(), not .register()!, and then game crash.

My project code repo

commented

ah, you are right.
I have updated it. commit

commented

The code is still incorrect, now it checks if that entry has been registered instead of whether that id is already taken.

commented

I have not noticed about contains(ResourceLocation) yet, is it correct that I use contains(id)?

commented

I found a solution after my attempt, in my fork repo. Should I PR it? Or maybe better solution?

commented

This is an intentional feature of Fabric API to prevent people from accidentally modifying registered content - replacement has to be explicit.

I also feel that hardcoding the minecraft namespace is problematic, a more proper solution would simply check if the content has already been registered.