Skip to content

Instantly share code, notes, and snippets.

@apple502j
Last active January 22, 2023 03:20
Show Gist options
  • Save apple502j/a6933cf554704b91f32ad1e6b7c86b02 to your computer and use it in GitHub Desktop.
Save apple502j/a6933cf554704b91f32ad1e6b7c86b02 to your computer and use it in GitHub Desktop.

It's been almost a year since the first "Snapshot Note" series! Anyway here's the 23w03a stuff info.

Fabric toolchain

Fabric Loader 0.14.13 should be used for this version.

Fabric API 0.72.1 is released for this version. Biome API received 1 breaking change; setPrecipitation method in BiomeModificationContext.WeatherContext now takes a boolean.

Minecraft Changes

Packet Bundling

Multiple S2C packets can now be bundled into a single packet, so that they are processed in the same client tick. The bundled packets are still sent separately, but is re-bundled in the client.

Example of bundling 2 CustomPayloadS2CPacket and 1 GameMessageS2CPacket:

List<Packet<ClientPlayPacketListener>> packets = List.of(
    ServerPlayNetworking.createS2CPacket(id, buf),
    ServerPlayNetworking.createS2CPacket(id2, buf2),
    new GameMessageS2CPacket(Text.of("Test"), false)
);
player.sendPacket(new BundleS2CPacket(packets));

On the client, the handlers are invoked for each packet in the same order.

Internally, an encoder on the Netty side splits the bundled packet and inserts BundleSplitterPacket, a marker packet. The client reassembles the packets and processes all at once after the last one is received. This is now used to send entity tracker updates.

Data fixers

Gegy is improving the performance of DataFixerUpper, but that PR hasn't been merged yet. That said, this snapshot contains some data fixer changes, possibly related to the improvement:

  • update methods in NbtHelper are moved to DataFixTypes.
  • There is now a method to update Dynamics that aren't NBT.
  • getDataVersion and putDataVersion methods were added to NbtHelper.

Texts

TranslatableTextContent now supports text fallbacks. To construct texts with fallbacks, use Text#translatableWithFallback. ScreenTexts received CONTINUE and SPACE predefined texts, as well as space method for chaining like space().append(text).

Similarly, Language#get now allows fallback to be passed.

Biome

Biome precipitation is now a boolean. Whether it rains or snows is now entirely dependent on temperature and is positional; if the temperature is below 0.15, it snows. Biome Modification API's setPrecipitation method now takes a boolean to reflect this, and Biome#getPrecipitation and hasPrecipitation methods were added to reflect this. Biome#isHot is removed and replaced with tags for specific usecases.

Biome JSON files should now have a boolean has_precipitation field, not enum precipitation field.

GUI

RenderSystem#enableTexture and disableTexture has been removed. They are no longer necessary. It is also no longer necessary to call setShaderColor before setShaderTexture.

GUI code has received changes to support new keyboard navigation. After each keyboard navigation, the game recalculates the focused element; it creates a tree of elements, making sure only one element is focused at a time. Screen implementations should call setInitialFocus within the init method.

Math

Several MathHelper methods unused or easily replaceable with java.lang.Math methods were removed. They are: fastFloor, average, packRgb, fastInverseSqrt, lerpAngle, fwrapDegrees, the long and byte overload of clamp, multiplyColors, murmurHash, parseDouble, parseInt, getCumulativeDistribution, absFloor, magnitude, and ceil.

lerpAngle can be replaced with lerpAngleDegrees. Note the argument order; lerpAngle(a, b, c)'s equivalent is lerpAngleDegrees(c, a, b).

Additions

  • DamageTiltS2CPacket that tilts the screen of the players that took damage.
  • BlockPosArgumentType#getLoadedBlockPos that grabs the block pos argument if the position is loaded.
  • Advancement#getRoot for getting the root advancement.
  • GameVersion received several methods, previously defined in JavaBridge.
  • TimeArgumentType#time with minimum parameter for setting the minimum value.
  • Codecs#string for a codec of length-validated string.
  • LogoDrawer for drawing the Minceraft (or Minecraft) logo.

Renames and Repackaging

  • PlayerPositionLookS2CPacket.Flag is now a separate class named PositionFlag.
  • Packet is moved to net.minecraft.network.packet.
  • BlockPosArgumentType#getBlockPos is renamed to getValidBlockPos.

Other Changes

  • JavaBridge is removed from dependencies.
  • PacketListener#getConnection is removed.
  • ResourceType#getPackVersion is replaced with GameVersion#getPackVersion.
  • World#hasHighHumidity is removed.
  • Entity#canUsePortals now checks for vehicles.
  • TestContext#useOnBlock now invokes Item#useOnBlock if Block#use fails.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment