Skip to content

Instantly share code, notes, and snippets.

View apple502j's full-sized avatar
🍎
Eaten

apple502j apple502j

🍎
Eaten
View GitHub Profile
@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.
@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.

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

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

@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:

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:

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:

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)

1.19-pre1 docs

Known Issues

  • Armor equipping sound plays when they shouldn't (e.g. villagers holding trades, armors getting damaged, using /item)
  • Leading slash causes commands from books to fail (MC-251890)

Changes

Note: this references Yarn names that are subject to changes before merging.

Chat & Networking

Yet another networking changes.

Chat API test cases

Assumptions

  • No mods add a command taking multiple message arguments. (Implicitly enforced by the game.)

Test cases

  • Sending a chat message through: Chat, /say, /msg
  • Chat preview: integrated (no preview), disabled, enabled
  • Execution delay: instant, 500ms (does not trigger re-preview), 2000ms (triggers re-preview)
  • Signing: no (missing key/dev env), no (does not have preview), yes
  • Command executor: none (command block), single (player-sent), others (/execute on other player), entities (/execute on non-player), multiple (/execute with multiple entities)