Five snapshots and we enter into the pre-release phase! Remember, this is when you should start porting mods (More precisely, pre-release 2 is a bit better IMO) - unless you have the special power of porting your mod every week, of course.
This past week was Fabric Toolchain Week. Fabric Loader, Fabric API, and libraries like Mixin have received many updates.
Note: this version is unstable and has several Mixin-related bugs, along with log display errors on MultiMC. Update is not recommended yet.
Fabric Loader 0.14.15 adds JUnit testing, an experimental feature that allows Knot class loader to be used in unit test. This means we no longer have to spin up the dedicated server for testing the basic stuff. The test will load with Mixins applied, but mod initializers will not run by default.
This requires Gradle 8 and Loom 1.1. IDEs such as IntelliJ IDEA must be configured to run unittests via Gradle.
To start, add this to build.gradle
:
dependencies {
testImplementation "net.fabricmc:fabric-loader-junit:${project.loader_version}"
}
test {
useJUnitPlatform()
}
Like with other JUnit tests, the code goes to test
sourceset. Note that you must manually initialize the game registry.
public class ExampleTest {
@BeforeAll
public static void setup() {
SharedConstants.createGameVersion();
Bootstrap.initialize();
}
@Test
public void testItems() {
Identifier id = Registries.ITEM.getId(Items.DIAMOND);
assertEquals(id.toString(), "minecraft:diamond");
}
}
With this update, building may crash due to multiple Loader instances being on the classpath. To fix this, mark mod deps as transitive:
modLocalRuntime("com.terraformersmc:modmenu:5.0.2") {
transitive = false
}
Crash messages are translatable, and Japanese translation has been added. Note that most of the errors (such as Mixin ones) are still in English. The crash screen will be reworked sometime. This also fixes windows not closing on macOS, thread safety issues on very old versions of Minecraft (fix by ArtDev), and issues with specifying multiple icons in fabric.mod.json
(fix by haykam).
The most notable changes for users is that mod list is now printed as tree, like with Fabric API-inserted crash report. This is part of NebelNidas' Loader improvement plan. Note that this currently uses non-ASCII letters, which do not display well on MultiMC and its forks. An upcoming release will use ASCII letters.
Finally, building mods will now be slightly faster because Fabric Loader now opts out of remapping.
The Loader update also comes with a new version of Mixin, adding auto-prefixing and fixing bugs. Loader currently ships Mixin 0.12.3, which has confirmed bugs. A new Loader release will come with those fixes soon.
The most important change is that injected methods will now have a mod ID prefix internally, like handler$zza000$test_mod$onMethod
. This makes it much easier to debug crashes where Mixin code is involved. Additionally, you no longer have to worry about @Unique
d methods - no more manual prefixing! If the methods have prefixes added manually like modid$methodName
, like before, the code respects that decision and does not add another one.
Some other fixed bugs include:
@Unique
fields conflicting- Memory leak issues
- Mixin inheritance not working properly with package private methods
- Refmap sorting order being inconsistent
You might see build errors with the new Mixin version. This is probably due to missing refmap=false
in @At
annotation. When a Mixin targets library calls (such as Guava Maps#newHashMap
, Brigadier, or DFU), insert refmap=false
. See the Pull Request to Fabric API.
Thanks to Chocohead and LlamaLad for contributing!
This Fabric API update adds new APIs, deprecates some, and fixes bugs in Renderer API.
In Registry Sync, FabricRegistryBuilder
no longer requires the type class to be passed - just the registry key. The old methods were deprecated. Message API received client-side event support (PR by kevinthegreat1). Renderer API and Indigo received shade-related fixes by Pepper. In Block Render Layer API, BlockRenderLayerMap
's useless item-related methods were deprecated for removal.
The following changes only apply to 1.19.4 branch. Object Builder and Transfer API received breaking changes.
- Breaking: Transfer API's spec is changed to allow
null
directions inFluidStorage
andItemStorage
, meaning full inventory without side restriction. - Breaking:
exactView
method withtransaction
parameter, deprecated for removal, is removed. Use the transactionless method instead. - Breaking:
SignTypeRegistry
is renamed toWoodTypeRegistry
. This is used to register wood types, a new class in 1.19.4 holding sign and fence gate sounds. BlockSetTypeRegistry
is added. This is used to register block set types, a new class in 1.19.4 holding button, door, etc sounds.- Fabric API resource pack's description is now translated. (Fix by Madis0)
- Cherry Grove biome is added to
c:in_overworld
. - Conventional tool tags are now deprecated. Use vanilla tags, added in 23w07a, instead.
And now we can finally enter MC changes section.
Entities immune to fall damage must add themselves to #minecraft:fall_damage_immune
instead of overriding handleFallDamage
method. Entity#stepHeight
is now private. This must now be set using setStepHeight
. The getter getStepHeight
is added as well.
There were several changes related to vehicles. ItemSteerable
methods are moved to LivingEntity
, and SaddledComponent
fields are now private. The following methods were added to LivingEntity
:
tickControlled
, which is called every tick if the entity is being ridden and controlled by other entity. Set the entity rotation and callSaddledComponent#tickBoost
here.travelControlled
, fromItemSteerable#travel
.getControlledMovementSpeed
, which calculates the velocity from the user input.getSaddledSpeed
, which calculates the velocity of the entity. Multiply the value withSaddledComponent#getSpeed
and return here.
Additionally, LivingEntity#getOffGroundSpeed
was added. This controls the entity velocity when it is falling or flying.
Vec3i
and BlockPos
constructors that take double
or Position
(such as Vec3d
) are moved to ofFloored
method. This makes it clear which rounding mode is used.
- BlockPos pos = new BlockPos(3.14, 0.0, 3.14);
- BlockPos pos2 = new BlockPos(entity.getPos());
+ BlockPos pos = BlockPos.ofFloored(3.14, 0.0, 3.14);
+ BlockPos pos2 = BlockPos.ofFloored(entity.getPos());
Vec3i#add
overload that takes double
is also removed. Round yourself if necessary.
GUI code refactor continues. Most rendering methods now take MatrixStack
. With this, DrawableHelper#getZOffset
is now gone, and all DrawableHelper
methods turned into static methods. In addition, toasts are now rendered by GameRenderer
, not MinecraftClient
.
DataFixerUpper update brings a major performance improvement, both in startup and in update time. LazyDFU mod is no longer necessary. There is one change that potentially breaks mods: DataResult#error
now expects a Supplier<String>
, to lazy-evaluate the error message.
IconButtonWidget
no longer extendsTexturedButtonWidget
.PlayerPositionLookS2CPacket
no longer hasshouldDismount
boolean field.Util#getBootstrapExecutor
is removed, because its only use was off-thread DFU optimization (which is no longer off-thread). UsegetMainWorkerExecutor
instead.
- Biome code has changed to support the new multi noise biome source parameter list registry. Fabric Biome API continues to work without breaking changes.
SpawnSettings.SpawnDensity
is now a record.
ConfirmLinkScreen#open
andopener
to open link confirmation screen or make a button to open such screen.Screen#onDisplayed
that is called beforeinit
orinitTabNavigation
.ChunkBiomeDataS2CPacket
that transports the chunk biome data.EnumArgumentType#transformValueName
to transform the user input into the value.HeightmapArgumentType
, which is an argument type of heightmap types.ResourcePackManager#enable
anddisable
to enable or disable certain packs without reloading resources.
refmap=false
should beremap=false