Skip to content

Instantly share code, notes, and snippets.

@apple502j
Last active February 12, 2023 16:16
Show Gist options
  • Save apple502j/1e9812a6acfcdfd0840fe272405da8e6 to your computer and use it in GitHub Desktop.
Save apple502j/1e9812a6acfcdfd0840fe272405da8e6 to your computer and use it in GitHub Desktop.

23w06a: Damage Update

It's been a year since the first post of the Snapshot Document Series! This will continue for the foreseeable future. Anyway, it's another frogging week and a snapshot update!

Fabric Changes

Fabric Loader 0.14.14 was released last week, fixing a bug where mod initializers were run a little bit later.

Fabric API for 23w06a, version 0.73.5, contains breaking changes to Item Group API, Indigo, Rendering API (v1), and Transitive Access Wideners.

Minecraft Changes

Damages

Damages can now be defined using dynamic registry, with data packs. This also removed the constant DamageSources. DamageSources class holds several methods to get the instances of DamageSource:

- targetEntity.damage(DamageSource.MAGIC, 4.0F);
- anotherEntity.damage(DamageSource.anvil(attacker), 1.0F);
+ targetEntity.damage(world.getDamageSources().magic(), 4.0F);
+ anotherEntity.damage(world.getDamageSources().fallingAnvil(attacker), 1.0F);

getDamageSources method also exists in Entity as a shortcut.

To check if a damage is of a certain type, tags should be used. Several predicates related to damages have changed to reflect this. See the slicedlime video.

Game Events

This snapshot fixed bugs related to game events not firing. Some methods now take the entity that caused the action, for use when emitting a game event. These are usually marked as @Nullable.

Rendering

DrawableHelper received some renames:

  • drawCenteredText -> drawCenteredTextWithShadow
  • drawStringWithShadow/drawWithShadow -> drawTextWithShadow

ModelTransformation.Mode is replaced with ModelTransformationMode (notice the lack of dot). This is the only breaking change to Rendering API and Indigo.

Item Groups

ItemGroup.Builder#entries now expects a callback taking two arguments: DisplayContext, a new record, and ItemGroup.Entries.

private static final ItemGroup ITEM_GROUP = FabricItemGroup.builder(new Identifier(MOD_ID, "test_group"))
    .icon(() -> new ItemStack(Items.DIAMOND))
-    .entries((enabledFeatures, entries, operatorEnabled) -> {
+    .entries((context, entries) -> {
       entries.add(TEST_ITEM);
    })
    .build();

The context can also be obtained from FabricItemGroupEntries#getContext.

Renames

  • References to "scoreboard tag" (/tag) are now renamed to "command tag".
  • ClientWorld#getStarBrightness is renamed to getSkyBrightness.
  • Vec3d#withBias is renamed to offset.
  • Wearable is renamed to Equipment. Equipments must now also implement getSlotType method.
  • Enchantment#type is renamed to target.

Additions

  • EntityType.Builder#disableTicking to make the entity untickable like markers. (Fabric API version also received this change.)
  • EntityDamageS2CPacket that is sent to the clients when an entity is damaged.
  • PacketByteBuf#writeVector3f and writeQuaternionf to write a vector or a quaternion.
  • SummonCommand#summon to summon an entity.
  • MathHelper#lerp overload with float, int, int.
  • ColorHelper.Argb#lerp that interpolates the color.
  • Codecs#QUATERNIONF, MATRIX4F, and AXIS_ANGLE4F to serialize these objects using codecs.
  • Nullables that deals with nullable values.
  • Util#cachedMapper that wraps a mapper function with cache.

Changes

  • VehicleInventory no longer aggros the piglins by default.
  • Entity#addPassenger no longer returns a boolean.
  • Util#map and mapOrElse has moved to Nullables.
@AnnoyedUser420
Copy link

Thank you!

@Ohponopono
Copy link

awesome

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