Please contact apple502j for any corrections, suggestions etc! (available on Fabricord https://fabricmc.net/discuss/)
Mods will be broken, especially if it adds new contents.
- Registry modification/adding custom content to registry now requires Fabric API due to the addition of "frozen registry". Either add Fabric API or
fabric-registry-sync-v0as an dependency. - Tags and Registries Update.
Tagis gone and you needTagKey. However, if you're just usingisOfcall with a vanilla tag, there should be no refactor. To understandTagKeyand other new classes, I've prepared a separate TLDR document. - Several Fabric API modules removed, mostly deprecated ones. This includes Tag Extension API which has a separate migration guide. Unless you are using tag replacement stuff, vanilla code should be used.
- Structures need to be registered to
StructuresToConfiguredStructuresFixto allow world upgrade, since the save files will now store configured structure features instead of structures. - Mojang migrates to SLF4J, so you should too. (see below)
- Loader 0.13 is out, which supports SLF4J, fixes Mixin bugs, etc. Required for newer Fabric API.
- Loom 0.11 is out as well, supporting interface injection (injecting mod's interfaces to vanilla classes to be implemented using Mixin) and server-only option (can avoid accidental usage of client-side code).
Import these:
import com.mojang.logging.LogUtils;
import org.slf4j.Logger;Replace LOGGER = LogManager.getLogger(); with LOGGER = LogUtils.getLogger();. For logging itself, Logger#fatal is not supported in SLF4J and needs to be replaced with error and LogUtils.FATAL_MARKER:
LOGGER.error(LogUtils.FATAL_MARKER, "Fatal error! I don't know what's causing this but who cares!");Also, you should always pass a string (or FATAL marker) as the first argument. To log an object, pass "{}".
LOGGER.error("Exception while admiring a tater: {}", exc);There are too many changes to cover here. Watch a slicedlime video. Check out the gist on custom structures using datapacks. Note that the bugfix mixin for using worldgen datapacks in dedicated server is missing from Fabric API for now.
Resource loading has changed significantly.
The previously called ServerResourceManager is no longer a ResourceManager, instead it simply holds data pack loaders (FunctionLoader, ServerAdvancementLoader, etc). The class has been renamed to DataPackContents.
To get a ResourceManager for a server, call MinecraftServer#getResourceManager(). To get DataPackContents, you need to use accessor to access MinecraftServer#resourceManagerHolder, use an access widener to make MinecraftServer$ResourceManagerHolder public, and finally call dataPackContents() - however in most cases there are shortcut methods in MinecraftServer. (See the javadoc)
START_DATA_PACK_RELOAD/END_DATA_PACK_RELOAD events in Fabric API is also changed to pass LifecycledResourceManager instead. Should not affect people who use these hooks for configuration reload, though.
BlockPos#getSquaredDistancewas previously incorrectly adding 0.5 to X and Z positions when comparing coordinates. This has been changed to use the normal Euclidean distance. To keep the result (for compatibility reasons) usegetSquaredDistanceFromCenter.- Packets related to entity status effect now store the effect as an integer, instead of a byte.
- New command argument types:
RegistryKeyArgumentType(used in/placefeatureand/attribute) andRegistryPredicateArgumentType(used in/locateand/locatebiome). Predicate argument type allows tags to be used. Check vanilla usage and refactor code usingIdentifierArgumentTypeas needed.
WarningScreenfor a generic warning screen with a checkbox (seeRealms32BitWarningScreen)PressableTextWidgetfor a button that renders like a normal text (used in copyright notice/credits button)ConfiguredStructureFeatureTagsandBiomeTagsSaveLoaderwhich is responsible for loading data packs,level.dat, etcTagPacketSerializerto serialize and load tag packetsRegistryLoaderwhich is a wrapper ofEntryLoader.RegistryLoader.LoaderAccessis a record of the loader andDynamicRegistryManager.RegistryCodecsfor various registry-related codec utilsPeriodicNotificationManagerfor handling periodic notifications, such as South Korean health messageLifecycledResourceManagerandLifecycledResourceManagerImpl. This resource manager can be used until it isclose()d.PowderSnowJumpGoalwhich is a goal for jumping out of powder snow used by powder snow walkable mobsFogShapewhich is an enum of fog shapes (sphere or cylinder)ExclusiveNbtCollectorto collect all NBT objects except for specified ones
DrawableHelper#fillBackgroundto fill background to render textEnchantingTableBlock#canAccessBookshelfto see if an bookshelf is accessible from a tableClientPlayNetworkHandler#loadTagsto load tags from packetsEntity#getHandPosOffsetto get the offset of the hand that the item is held by (used by fireworks)ServerLoginNetworkHandler#isValidNameto validate usernames. Vanilla implementation will return false for ASCII control characters or non-ASCII letters.SimpleResourceReload#startto start a reload of resourcesEntity#shouldEscapePowderSnowwhich returnstrueif the entity is not immune to freezing but is inside powder snowPointedDripstoneBlock#canDripThroughwhich returnstrueif the block cannot obstruct stalagmites' growth or fluids dripping to cauldronsFontStorage#getEmptyGlyphwhich returns pre-existing empty glyphs for certain characters andOptional.empty()for othersScreen#hidewhich hides certain widgets from the screenWorldRenderer#isRenderingReadywhich returnstrueifposis ready to be renderedFallingBlockEntity#spawnFromBlockwhich spawns a falling block from the given position and replaces the block there with the fluid (e.g. water for falling waterloggd stalactite)NbtIo#scanCompressedfor scanning Gzip-compressed NBT using a scannerPacketListener#shouldCrashOnExceptionwhich returnstrueif fatal error in main thread-executed code should crash instead of log error.truein client,falsein server. Does not affect Fabric Networking API.LevelStorage#loadCompactLevelDatato quickly loadlevel.dat, without player or worldgen info
java.lang.IllegalStateException: Some intrusive holders were not added to registry: [Reference{null=Block{minecraft:air}}]
You forgot to (or deliterately didn't) register a block, an item, etc. Registration is now a hard requirement in 1.18.2. If you do not want it to crash, register it. For conditional adding of stuff, the instance creation should be conditional as well.