Skip to content

Instantly share code, notes, and snippets.

View apple502j's full-sized avatar
🍎
Eaten

apple502j apple502j

🍎
Eaten
View GitHub Profile

22w19a docs

Known Issues

  • Crash when warden gets angry at multiple mobs MC-251641

Changes

Note that for convenience, the following will use proposed Yarn names that are not yet merged.

Chat and Networking

Chat Preview was added, allowing server-side decorated messages to be signed. Basically this works like this:

  1. Server enables chat preview (with server.properties)

22w18a docs

Known Bugs

Changes

More Chat Refactor

The big chat refactor continues; this time, they introduced "signed command arguments". This is used by MessageArgumentType and TextArgumentType. The client parses the commands and signs each argument. (see ArgumentSignatures) This also means the packets for commands are now separate from the chat message packet. (see CommandExecutionC2SPacket) Note that you can still use ClientPlayerEntity#sendChatMessage(String) with /-prefixed string to execute commands.

New classes:

22w17a docs

Known issues

  • Loading singleplayer world can sometimes crash the game (potentially related to use of Mojang account) - MC-250974
  • Goat horn appears everywhere in Creative inventory - MC-250926
  • Player gets assigned a new UUID in singleplayer, causing skins, previously saved advancements, etc to not load - MC-250954

Changes

Chat Refactor

Chat is completely re-written. Here is how this works:

@apple502j
apple502j / fabric-chat-api-proposal.md
Created April 28, 2022 10:22
Fabric chat API proposal (22w17a)

Fabric Chat API Proposal

Now that Mojang has decided to refactor chat, it'll be a good time to add an API for that. I had some designs (including one made in 1.18 that I put on GitHub), however I think there are better changes.

Note on Compatibility

I expect the new API to be 1.19+ exclusive, however it's not impossible to backport most (if not all). One of the biggest 17a changes was that chat messages are no longer "wrapped" in chat.type.text and sender/message info were completely split. In 1.18 depending on the injection point it required us to "parse" the text to get the original message, however with this change it is no longer necessary.

Design Idea (Server Side)

Basic concept

This API should handle the following messages:

22w16b docs

Known issues

  • Game can crash while ticking some mobs (parrots, allays, etc). MC-250321

Changes

Loader/Loom update required

Minecraft now uses LWJGL version 3.3.1, which contains Java 19-compiled class files. While you do not need Java 19 to play or build mods, this means Fabric Loader needs to be updated to version 0.14.0 (currently beta), and the same goes to Loom (refresh dependencies). The new Fabric Loader also contains some new features and improvements; the most significant one being ability to mixin into libraries like authlib.

Big Text refactor

Texts were split into text contents and structures. "Text contents" include what was previously called LiteralText, TranslatableText, etc (which no longer subclass or implement Text), and "text structure" is Text/MutableText (now a class with implementation). Text contents implement class_7417/TextContent. Various NBT text implementations have now been changed to "data so

22w15a docs

Known Issues

No crashes or similar important bugs have been discovered.

Fixed Bugs

  • Crashes introduced in the previous version (Random multithreading issue and UUID issue) were fixed.
  • This release fixes the crash when beds in custom dimension. This issue was previously patched via Fabric API.

Changes

Random Stuff

@apple502j
apple502j / 22w14a-docs.md
Last active April 8, 2022 09:32
22w14a documentation for modders

22w14a docs

Known issues

  • Game can randomly crash due to atomic operation failure. (MC-249933)
  • You cannot launch the game without authenticating/in offline mode; add --uuid=123 run arg to fix.

Changes

Random replaced with AbstractRandom

java.util.Random has been replaced with AbstractRandom in most of the code. This interface, previously under net.minecraft.world.gen.random package and now under net.minecraft.util.math.random, provides most of the operations Random supports. There are 3 vanilla implementations based on Java Random:

  • SimpleRandom: Not thread safe at all.
@apple502j
apple502j / dot-two-update.md
Last active April 17, 2022 04:04
1.18.2 update guide for Fabric modders

1.18.2 Update Info

Please contact apple502j for any corrections, suggestions etc! (available on Fabricord https://fabricmc.net/discuss/)

TLDR

Mods will be broken, especially if it adds new contents.

Major Changes

  • 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 need TagKey. However, if you're just using isOf call with a vanilla tag, there should be no refactor. To understand TagKey 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.

Tag Extension API in 1.18.2

Tag Extension API for Fabric has been removed in 1.18.2. Here are some vanilla replacements:

FabricDataGeneratorTagBuilder

Vanilla ObjectBuilder contains addOptional (corresponding to addOptionalObject in FAPI) and addOptionalTag. They both return the builder itself, unlike FAPI provided ones that do not have return values. The arguments are the same, all taking one Identifier.

TagFactory

There is a generic method TagKey#of which can be used to create TagKey for any registries (blocks, items, biomes, villager professions, custom registry items, etc). You can also use BlockTags#register, etc provided you use accessor or access widener to make it public.

One thing to note is that Tag.Identified has become TagKey. TagKey, like RegistryKey, does not hold the value(s) itself - you have to query the values from the registry. For example, Registry.BLOCK.iterateEntries(tagKey) will return an iterable of RegistryEntry. The following code in 1.18.1:

TLDR, 22w06a

TLDR the TLDR

  • Tag is now TagKey
  • Registry entries have associated RegistryEntry
  • RegistryEntryList is a list of RegistryEntry, supports directly referencing items and referencing using tags
  • Registries are frozen unless you use Fabric API: to add custom entries to a registry, you need to add Fabric API as an dependency!
  • Instances of Block/Item/etc must be ALWAYS registered otherwise it'll crash.

TagKey

TagKey, like RegistryKey, is a key/identifier for a tag. Many methods that took Tag will now take TagKey instead, such as BlockState#isIn. Built-in TagKeys are still available in BlockTags class, etc.