Skip to content

Instantly share code, notes, and snippets.

@apple502j
Last active February 24, 2023 21:08
Show Gist options
  • Save apple502j/48883911bffc4b10bc2975335f2fd5d5 to your computer and use it in GitHub Desktop.
Save apple502j/48883911bffc4b10bc2975335f2fd5d5 to your computer and use it in GitHub Desktop.

1.19.4-pre1: Pre-tty Good Update

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.

Fabric Update

This past week was Fabric Toolchain Week. Fabric Loader, Fabric API, and libraries like Mixin have received many updates.

Fabric Loader 0.14.15

Note: this version is unstable and has several Mixin-related bugs, along with log display errors on MultiMC. Update is not recommended yet.

JUnit Testing

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");
   }
}

Build Crash Note

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
}

Misc updates

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.

Mixin 0.12.3

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 @Uniqued 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!

Fabric API 0.75.1

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 in FluidStorage and ItemStorage, meaning full inventory without side restriction.
  • Breaking: exactView method with transaction parameter, deprecated for removal, is removed. Use the transactionless method instead.
  • Breaking: SignTypeRegistry is renamed to WoodTypeRegistry. 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.

Minecraft Changes

And now we can finally enter MC changes section.

Entity Changes

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 call SaddledComponent#tickBoost here.
  • travelControlled, from ItemSteerable#travel.
  • getControlledMovementSpeed, which calculates the velocity from the user input.
  • getSaddledSpeed, which calculates the velocity of the entity. Multiply the value with SaddledComponent#getSpeed and return here.

Additionally, LivingEntity#getOffGroundSpeed was added. This controls the entity velocity when it is falling or flying.

BlockPos changes

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.

Rendering and GUI

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

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.

Removals

  • IconButtonWidget no longer extends TexturedButtonWidget.
  • PlayerPositionLookS2CPacket no longer has shouldDismount boolean field.
  • Util#getBootstrapExecutor is removed, because its only use was off-thread DFU optimization (which is no longer off-thread). Use getMainWorkerExecutor instead.

Changes

  • 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.

Additions

  • ConfirmLinkScreen#open and opener to open link confirmation screen or make a button to open such screen.
  • Screen#onDisplayed that is called before init or initTabNavigation.
  • 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 and disable to enable or disable certain packs without reloading resources.
@DJtheRedstoner
Copy link

refmap=false should be remap=false

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment