Bump to 1.20.4

This commit is contained in:
Linnea Gräf
2024-01-21 14:06:34 +01:00
parent 18ebd21cb0
commit 3e1f75e322
11 changed files with 47 additions and 39 deletions

View File

@@ -3,30 +3,30 @@
# SPDX-License-Identifier: CC0-1.0 # SPDX-License-Identifier: CC0-1.0
[versions] [versions]
minecraft = "1.20.2" minecraft = "1.20.4"
fabric_loader = "0.14.22" fabric_loader = "0.15.6"
fabric_api = "0.89.2+1.20.2" fabric_api = "0.95.0+1.20.4"
fabric_kotlin = "1.9.4+kotlin.1.8.21" fabric_kotlin = "1.9.4+kotlin.1.8.21"
yarn = "1.20.2+build.1" yarn = "1.20.4+build.3"
libgui = "8.1.0+1.20.2" libgui = "9.2.2+1.20.2"
rei = "13.0.655" rei = "14.0.688"
devauth = "1.0.0" devauth = "1.0.0"
modmenu = "8.0.0" modmenu = "9.0.0"
ktor = "2.3.0" ktor = "2.3.0"
dbus_java = "4.2.1" dbus_java = "4.2.1"
architectury = "10.0.7" architectury = "11.0.11"
neurepoparser = "1.4.0" neurepoparser = "1.4.0"
qolify = "1.3.0-1.20.2" qolify = "1.3.0-1.20.2"
citresewn = "1.1.3+1.20" citresewn = "1.1.3+1.20"
hotswap_agent = "1.4.2-SNAPSHOT" hotswap_agent = "1.4.2-SNAPSHOT"
sodium = "mc1.20.2-0.5.3" sodium = "mc1.20.3-0.5.5"
freecammod = "1.2.0-mc1.20" freecammod = "1.2.0-mc1.20"
ncr = "Fabric-1.20-v2.2.0" ncr = "Fabric-1.20.4-v2.5.0"
mixinextras = "0.2.0-rc.5" mixinextras = "0.3.5"
jarvis = "1.1.1" jarvis = "1.1.1"
nealisp = "1.0.0" nealisp = "1.0.0"
explosiveenhancement = "1.2.1-1.20.x" explosiveenhancement = "1.2.2-1.20.x"
moulconfig = "3.0.0-beta.2" moulconfig = "3.0.0-beta.3"
[libraries] [libraries]

View File

@@ -21,7 +21,7 @@ import java.util.Objects;
@Mixin(ClientPlayNetworkHandler.class) @Mixin(ClientPlayNetworkHandler.class)
public class DisableCommonPacketWarnings { public class DisableCommonPacketWarnings {
@Inject(method = "method_52801", at = @At("HEAD"), cancellable = true) @Inject(method = "warnOnUnknownPayload", at = @At("HEAD"), cancellable = true)
public void onCustomPacketError(CustomPayload customPayload, CallbackInfo ci) { public void onCustomPacketError(CustomPayload customPayload, CallbackInfo ci) {
if (Objects.equals(customPayload.id(), Identifier.of("badlion", "mods"))) { if (Objects.equals(customPayload.id(), Identifier.of("badlion", "mods"))) {
ci.cancel(); ci.cancel();
@@ -38,8 +38,8 @@ public class DisableCommonPacketWarnings {
// Ignore data for unknown teams, since HyPixel just sends a lot of invalid team data. // Ignore data for unknown teams, since HyPixel just sends a lot of invalid team data.
} }
@Redirect(method = "onPlayerList", at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;warn(Ljava/lang/String;Ljava/lang/Object;)V", remap = false)) @Redirect(method = "onPlayerList", at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;warn(Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)V", remap = false))
public void onOnPlayerList(Logger instance, String s, Object o) { public void onOnPlayerList(Logger instance, String s, Object o, Object o2) {
// Ignore invalid player info, since HyPixel just sends a lot of invalid player info // Ignore invalid player info, since HyPixel just sends a lot of invalid player info
} }

View File

@@ -21,6 +21,7 @@ import net.minecraft.nbt.NbtIo
import net.minecraft.nbt.NbtList import net.minecraft.nbt.NbtList
import java.io.ByteArrayInputStream import java.io.ByteArrayInputStream
import java.io.ByteArrayOutputStream import java.io.ByteArrayOutputStream
import net.minecraft.nbt.NbtSizeTracker
@Serializable(with = VirtualInventory.Serializer::class) @Serializable(with = VirtualInventory.Serializer::class)
data class VirtualInventory( data class VirtualInventory(
@@ -41,7 +42,7 @@ data class VirtualInventory(
override fun deserialize(decoder: Decoder): VirtualInventory { override fun deserialize(decoder: Decoder): VirtualInventory {
val s = decoder.decodeString() val s = decoder.decodeString()
val n = NbtIo.readCompressed(ByteArrayInputStream(s.decodeBase64Bytes())) val n = NbtIo.readCompressed(ByteArrayInputStream(s.decodeBase64Bytes()), NbtSizeTracker.of(100_000_000))
val items = n.getList(INVENTORY, NbtCompound.COMPOUND_TYPE.toInt()) val items = n.getList(INVENTORY, NbtCompound.COMPOUND_TYPE.toInt())
return VirtualInventory(items.map { ItemStack.fromNbt(it as NbtCompound) }) return VirtualInventory(items.map { ItemStack.fromNbt(it as NbtCompound) })
} }

View File

@@ -20,6 +20,7 @@ import moe.nea.firmament.events.TickEvent
import moe.nea.firmament.features.FirmamentFeature import moe.nea.firmament.features.FirmamentFeature
import moe.nea.firmament.gui.config.ManagedConfig import moe.nea.firmament.gui.config.ManagedConfig
import moe.nea.firmament.util.IdentityCharacteristics import moe.nea.firmament.util.IdentityCharacteristics
import moe.nea.firmament.util.MC
import moe.nea.firmament.util.item.decodeProfileTextureProperty import moe.nea.firmament.util.item.decodeProfileTextureProperty
import moe.nea.firmament.util.skyBlockId import moe.nea.firmament.util.skyBlockId
@@ -53,10 +54,9 @@ object CustomSkyBlockTextures : FirmamentFeature {
private val skullTextureCache = mutableMapOf<IdentityCharacteristics<GameProfile>, Any>() private val skullTextureCache = mutableMapOf<IdentityCharacteristics<GameProfile>, Any>()
private val sentinelPresentInvalid = Object() private val sentinelPresentInvalid = Object()
val mcUrlRegex = "https?://textures.minecraft.net/texture/([a-fA-F0-9]+)".toRegex() private val mcUrlRegex = "https?://textures.minecraft.net/texture/([a-fA-F0-9]+)".toRegex()
fun getSkullId(profile: GameProfile): String? { fun getSkullId(profile: GameProfile): String? {
val textures = profile.properties.get(PlayerSkinProvider.TEXTURES) val textureProperty = MC.instance.sessionService.getPackedTextures(profile) ?: return null
val textureProperty = textures.singleOrNull() ?: return null
val texture = decodeProfileTextureProperty(textureProperty) ?: return null val texture = decodeProfileTextureProperty(textureProperty) ?: return null
val textureUrl = val textureUrl =
texture.textures[MinecraftProfileTexture.Type.SKIN]?.url ?: return null texture.textures[MinecraftProfileTexture.Type.SKIN]?.url ?: return null

View File

@@ -116,8 +116,8 @@ object ItemCache : IReloadable {
lore.forEach { lore.forEach {
newLore.add( newLore.add(
NbtString.of( NbtString.of(
Text.Serializer.toJson( Text.Serialization.toJsonString(
Text.Serializer.fromJson(it.asString())!!.applyLoreReplacements(loreReplacements) Text.Serialization.fromJson(it.asString())!!.applyLoreReplacements(loreReplacements)
) )
) )
) )

View File

@@ -17,17 +17,17 @@ fun ItemStack.appendLore(args: List<Text>) {
val compoundTag = getOrCreateSubNbt("display") val compoundTag = getOrCreateSubNbt("display")
val loreList = compoundTag.getOrCreateList("Lore", NbtString.STRING_TYPE) val loreList = compoundTag.getOrCreateList("Lore", NbtString.STRING_TYPE)
for (arg in args) { for (arg in args) {
loreList.add(NbtString.of(Text.Serializer.toJson(arg))) loreList.add(NbtString.of(Text.Serialization.toJsonString(arg)))
} }
} }
fun ItemStack.modifyLore(update: (List<Text>) -> List<Text>) { fun ItemStack.modifyLore(update: (List<Text>) -> List<Text>) {
val compoundTag = getOrCreateSubNbt("display") val compoundTag = getOrCreateSubNbt("display")
val loreList = compoundTag.getOrCreateList("Lore", NbtString.STRING_TYPE) val loreList = compoundTag.getOrCreateList("Lore", NbtString.STRING_TYPE)
val parsed = loreList.map { Text.Serializer.fromJson(it.asString())!! } val parsed = loreList.map { Text.Serialization.fromJson(it.asString())!! }
val updated = update(parsed) val updated = update(parsed)
loreList.clear() loreList.clear()
loreList.addAll(updated.map { NbtString.of(Text.Serializer.toJson(it)) }) loreList.addAll(updated.map { NbtString.of(Text.Serialization.toJsonString(it)) })
} }

View File

@@ -6,7 +6,8 @@
package moe.nea.firmament.util package moe.nea.firmament.util
import java.util.Optional import java.util.*
import net.minecraft.client.gui.hud.InGameHud
import net.minecraft.scoreboard.ScoreboardDisplaySlot import net.minecraft.scoreboard.ScoreboardDisplaySlot
import net.minecraft.scoreboard.Team import net.minecraft.scoreboard.Team
import net.minecraft.text.StringVisitable import net.minecraft.text.StringVisitable
@@ -17,9 +18,13 @@ import net.minecraft.util.Formatting
fun getScoreboardLines(): List<Text> { fun getScoreboardLines(): List<Text> {
val scoreboard = MC.player?.scoreboard ?: return listOf() val scoreboard = MC.player?.scoreboard ?: return listOf()
val activeObjective = scoreboard.getObjectiveForSlot(ScoreboardDisplaySlot.SIDEBAR) ?: return listOf() val activeObjective = scoreboard.getObjectiveForSlot(ScoreboardDisplaySlot.SIDEBAR) ?: return listOf()
return scoreboard.getAllPlayerScores(activeObjective).reversed().take(15).map { return scoreboard.getScoreboardEntries(activeObjective)
val team = scoreboard.getPlayerTeam(it.playerName) .filter { !it.hidden() }
Team.decorateName(team, Text.literal(it.playerName)) .sortedWith(InGameHud.SCOREBOARD_ENTRY_COMPARATOR)
.take(15).map {
val team = scoreboard.getScoreHolderTeam(it.owner)
val text = it.name()
Team.decorateName(team, text)
} }
} }

View File

@@ -17,12 +17,12 @@ fun textFromNbt() {
val ItemStack.loreAccordingToNbt val ItemStack.loreAccordingToNbt
get() = getOrCreateSubNbt(ItemStack.DISPLAY_KEY).getList(ItemStack.LORE_KEY, NbtElement.STRING_TYPE.toInt()) get() = getOrCreateSubNbt(ItemStack.DISPLAY_KEY).getList(ItemStack.LORE_KEY, NbtElement.STRING_TYPE.toInt())
.map { lazy(LazyThreadSafetyMode.NONE) { Text.Serializer.fromJson((it as NbtString).asString()) } } .map { lazy(LazyThreadSafetyMode.NONE) { Text.Serialization.fromJson((it as NbtString).asString()) } }
val ItemStack.displayNameAccordingToNbt val ItemStack.displayNameAccordingToNbt
get() = getOrCreateSubNbt(ItemStack.DISPLAY_KEY).let { get() = getOrCreateSubNbt(ItemStack.DISPLAY_KEY).let {
if (it.contains(ItemStack.NAME_KEY, NbtElement.STRING_TYPE.toInt())) if (it.contains(ItemStack.NAME_KEY, NbtElement.STRING_TYPE.toInt()))
Text.Serializer.fromJson(it.getString(ItemStack.NAME_KEY)) Text.Serialization.fromJson(it.getString(ItemStack.NAME_KEY))
else else
null null
} }

View File

@@ -42,11 +42,13 @@ data class MinecraftTexturesPayloadKt(
fun GameProfile.setTextures(textures: MinecraftTexturesPayloadKt) { fun GameProfile.setTextures(textures: MinecraftTexturesPayloadKt) {
val json = Firmament.json.encodeToString(textures) val json = Firmament.json.encodeToString(textures)
val encoded = java.util.Base64.getEncoder().encodeToString(json.encodeToByteArray()) val encoded = java.util.Base64.getEncoder().encodeToString(json.encodeToByteArray())
properties.put(PlayerSkinProvider.TEXTURES, Property(PlayerSkinProvider.TEXTURES, encoded)) properties.put(propertyTextures, Property(propertyTextures, encoded))
} }
private val propertyTextures = "textures"
fun decodeProfileTextureProperty(property: Property): MinecraftTexturesPayloadKt? { fun decodeProfileTextureProperty(property: Property): MinecraftTexturesPayloadKt? {
assertTrueOr(property.name == PlayerSkinProvider.TEXTURES) { return null } assertTrueOr(property.name == propertyTextures) { return null }
return try { return try {
var encodedF: String = property.value var encodedF: String = property.value
while (encodedF.length % 4 != 0 && encodedF.last() == '=') { while (encodedF.length % 4 != 0 && encodedF.last() == '=') {

View File

@@ -6,9 +6,8 @@
package moe.nea.firmament.util package moe.nea.firmament.util
import net.minecraft.text.LiteralTextContent import net.minecraft.text.PlainTextContent
import net.minecraft.text.Text import net.minecraft.text.Text
import net.minecraft.text.TextContent
import net.minecraft.text.TranslatableTextContent import net.minecraft.text.TranslatableTextContent
import moe.nea.firmament.Firmament import moe.nea.firmament.Firmament
@@ -33,8 +32,7 @@ class TextMatcher(text: Text) {
state.offset = 0 state.offset = 0
state.currentText = firstOrNull state.currentText = firstOrNull
state.textContent = when (val content = firstOrNull.content) { state.textContent = when (val content = firstOrNull.content) {
is LiteralTextContent -> content.string is PlainTextContent.Literal -> content.string
TextContent.EMPTY -> ""
else -> { else -> {
Firmament.logger.warn("TextContent of type ${content.javaClass} not understood.") Firmament.logger.warn("TextContent of type ${content.javaClass} not understood.")
return false return false

View File

@@ -4,5 +4,7 @@ accessible class net/minecraft/client/render/RenderLayer$MultiPhaseParameters
accessible class net/minecraft/client/font/TextRenderer$Drawer accessible class net/minecraft/client/font/TextRenderer$Drawer
accessible class net/minecraft/client/render/model/ModelLoader$BakerImpl accessible class net/minecraft/client/render/model/ModelLoader$BakerImpl
accessible method net/minecraft/client/render/model/ModelLoader$BakerImpl <init> (Lnet/minecraft/client/render/model/ModelLoader;Ljava/util/function/BiFunction;Lnet/minecraft/util/Identifier;)V accessible method net/minecraft/client/render/model/ModelLoader$BakerImpl <init> (Lnet/minecraft/client/render/model/ModelLoader;Ljava/util/function/BiFunction;Lnet/minecraft/util/Identifier;)V
accessible field net/minecraft/client/texture/PlayerSkinProvider TEXTURES Ljava/lang/String; #accessible field net/minecraft/client/texture/PlayerSkinProvider TEXTURES Ljava/lang/String;
accessible field net/minecraft/client/network/ClientPlayNetworkHandler lastSeenMessagesCollector Lnet/minecraft/network/message/LastSeenMessagesCollector; accessible field net/minecraft/client/network/ClientPlayNetworkHandler lastSeenMessagesCollector Lnet/minecraft/network/message/LastSeenMessagesCollector;
accessible field net/minecraft/client/gui/hud/InGameHud SCOREBOARD_ENTRY_COMPARATOR Ljava/util/Comparator;