Skip to content

Instantly share code, notes, and snippets.

@apple502j
Created October 28, 2022 18:57
Show Gist options
  • Save apple502j/54619d0072ed7ba7eb1e9246133431fe to your computer and use it in GitHub Desktop.
Save apple502j/54619d0072ed7ba7eb1e9246133431fe to your computer and use it in GitHub Desktop.
22w43a update info

22w43a: The Future is a DataGen Update

It's 22w43a - where future awaits in the DataGen, literally.

Fabric API

fabric-data-generation-api-v1 received breaking changes, of course.

Changes

DataGen refactor again

Data generators now have to create a "pack" and add providers to the pack. (It's like a resource pack - the provider generates a resource for a specific pack.) This can be done with FabricDataGenerator#createPack (or create, depending on FAPI version).

FabricDataGenerator.Pack pack = dataGenerator.createPack();
pack.addProvider(YourProvider::new);

There is another big refactor: DataProvider#run is now CompletableFuture-ified. This shouldn't affect FAPI-based datagen (as they don't expose this), but keep in mind in case some weird code uses thread-unsafe access. The DataCache class is refactored to add an intermediary cache layer with concurrent write support.

Finally, a breaking change on FAPI side: providers now take FabricDataOutput instead of FabricDataGenerator, following the 22w42a change and some discussions. This means that providers can no longer access the data generator instance.

GUI refactor

There's a new builder class for building widgets (such as buttons), which are now used in various places.

JOML Transition

Vec3f (mutable float vec3) is replaced with a new library, JOML. Apparently this benefits performance. Vec3d (immutable double vec3) and Vec3i (immutable* int vec3) are not affected and do still exist. Additionally, quaternion and matrices implementations are now also from JOML. Note, JOML classes are all mutable.

// Old code
Vec3f vec = new Vec3f(0.0f, 0.0f, 0.0f);
float x = vec.getX();

// New code
Vector3f vec = new Vector3f(0.0f, 0.0f, 0.0f);
float x = vec.x();

New stuff

  • Codecs received new codecs for JsonElement, Text, Vector3f, BitSet, and three authlib classes: GameProfile, PropertyMap, and Property.
  • Entity#extinguishWithSound, which extinguishes fire and plays the extinguish sound.
  • DamageSource methods to replace static fields, including fallingBlock, anvil, and fallingStalactite.
  • PositionedDamageSource, which is a non-entity damage source coming from a certain position (such as bed exploding).
  • Explosion#getEntity, which returns the entity that caused the explosion (or null).
  • PlayerSessionC2SPacket, which is a packet sent by a client to refresh its player session.
  • InventoryOwner#readInventory and writeInventory to properly deserialize and serialize entity inventory data to NBT.
  • BlockPos#toCenterPos, which returns the Vec3d representing the block position's center.
  • Vec3d#toVector3f, which converts Vec3d to JOML Vector3f.
  • World#createExplosion overload that takes a Vec3d.
  • PointOfInterestTypes#isPointOfInterest, which returns whether a given block state is a POI.

Renames

  • ItemGroups.NATURE is renamed to NATURAL.
  • JumpingMount#getDashCooldown is renamed to getJumpCooldown. Guess this is not a DashingMount.
  • ProfileKeys code is moved to ProfileKeysImpl. ProfileKeys is now an interface.

Other stuff

  • Library updates: Gson is now 2.9.1 (from 2.8.9), OSHI is now 6.2.2 (from 5.8.5), Guava is now 31.1 (from 31.0.1), ICU4J is now 71.1 (from 70.1), Mojang Logging is now 1.1.1 (from 1.0.0), Netty is now 4.1.82 (from 4.1.77), fastutil is now 8.5.9 (from 8.5.6), JNA is now 5.12.1 (from 5.10.0), HTTPCore is now 4.4.15 (from 4.4.14), Log4J is now 2.19.0 (from 2.17.0), and SLF4J is now 2.0.1 (from 1.8.0-beta4).
  • Data tracker syncing has been optimized.
Copy link

ghost commented Oct 29, 2022

Matrix4f is now in JOML lib and so is Vec4f -> Vector4d

@Earthcomputer
Copy link

Might be worth mentioning that there are read-only views of all JOML types in the form of interfaces. For example, a read-only Vec3f is Vec3fc.

Copy link

ghost commented Oct 30, 2022

is there a way to make a PR to a gist?

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