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-v0
as an dependency. - Tags and Registries Update.
Tag
is gone and you needTagKey
. However, if you're just usingisOf
call with a vanilla tag, there should be no refactor. To understandTagKey
and 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
StructuresToConfiguredStructuresFix
to 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#getSquaredDistance
was 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/placefeature
and/attribute
) andRegistryPredicateArgumentType
(used in/locate
and/locatebiome
). Predicate argument type allows tags to be used. Check vanilla usage and refactor code usingIdentifierArgumentType
as needed.
WarningScreen
for a generic warning screen with a checkbox (seeRealms32BitWarningScreen
)PressableTextWidget
for a button that renders like a normal text (used in copyright notice/credits button)ConfiguredStructureFeatureTags
andBiomeTags
SaveLoader
which is responsible for loading data packs,level.dat
, etcTagPacketSerializer
to serialize and load tag packetsRegistryLoader
which is a wrapper ofEntryLoader
.RegistryLoader.LoaderAccess
is a record of the loader andDynamicRegistryManager
.RegistryCodecs
for various registry-related codec utilsPeriodicNotificationManager
for handling periodic notifications, such as South Korean health messageLifecycledResourceManager
andLifecycledResourceManagerImpl
. This resource manager can be used until it isclose()
d.PowderSnowJumpGoal
which is a goal for jumping out of powder snow used by powder snow walkable mobsFogShape
which is an enum of fog shapes (sphere or cylinder)ExclusiveNbtCollector
to collect all NBT objects except for specified ones
DrawableHelper#fillBackground
to fill background to render textEnchantingTableBlock#canAccessBookshelf
to see if an bookshelf is accessible from a tableClientPlayNetworkHandler#loadTags
to load tags from packetsEntity#getHandPosOffset
to get the offset of the hand that the item is held by (used by fireworks)ServerLoginNetworkHandler#isValidName
to validate usernames. Vanilla implementation will return false for ASCII control characters or non-ASCII letters.SimpleResourceReload#start
to start a reload of resourcesEntity#shouldEscapePowderSnow
which returnstrue
if the entity is not immune to freezing but is inside powder snowPointedDripstoneBlock#canDripThrough
which returnstrue
if the block cannot obstruct stalagmites' growth or fluids dripping to cauldronsFontStorage#getEmptyGlyph
which returns pre-existing empty glyphs for certain characters andOptional.empty()
for othersScreen#hide
which hides certain widgets from the screenWorldRenderer#isRenderingReady
which returnstrue
ifpos
is ready to be renderedFallingBlockEntity#spawnFromBlock
which spawns a falling block from the given position and replaces the block there with the fluid (e.g. water for falling waterloggd stalactite)NbtIo#scanCompressed
for scanning Gzip-compressed NBT using a scannerPacketListener#shouldCrashOnException
which returnstrue
if fatal error in main thread-executed code should crash instead of log error.true
in client,false
in server. Does not affect Fabric Networking API.LevelStorage#loadCompactLevelData
to 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.