Skip to content

Commit

Permalink
Merge pull request #740 from FTBTeam/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
desht authored Jun 28, 2024
2 parents ec11c57 + 86dc5b0 commit e151139
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 24 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

# [2100.1.2]

### Fixed
* Fixed raw json text in quest descriptions not always being recognised
* Fixed a packet sync error related to translation system when on dedicated server
* Chapter filenames are now again named after the chapter title (at the time of creation), as they used to be in 1.20 and earlier

# [2100.1.1]

### Fixed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,6 @@ public void addMouseOverText(TooltipList list) {
}
} else {
reward.addMouseOverText(list);

if (!list.shouldRender()) {
list.zOffset = 580;
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ public static void handle(ClearDisplayCacheMessage message, NetworkManager.Packe

public static void clearForAll(MinecraftServer server) {
if (server != null) {
ClearDisplayCacheMessage msg = new ClearDisplayCacheMessage();
NetworkHelper.sendToAll(server, msg);
NetworkHelper.sendToAll(server, ClearDisplayCacheMessage.INSTANCE);
}
}
}
28 changes: 14 additions & 14 deletions common/src/main/java/dev/ftb/mods/ftbquests/util/TextUtils.java
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
package dev.ftb.mods.ftbquests.util;

import com.google.gson.JsonParseException;
import com.google.gson.JsonParser;
import dev.ftb.mods.ftblibrary.util.client.ClientTextComponentUtils;
import net.minecraft.ChatFormatting;
import net.minecraft.core.HolderLookup;
import net.minecraft.nbt.ListTag;
import net.minecraft.nbt.Tag;
import net.minecraft.nbt.TagType;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;

import java.util.ArrayList;
import java.util.List;
import java.util.regex.Pattern;

public class TextUtils {
private static final Pattern JSON_TEXT_PATTERN = Pattern.compile("^[{\\[]\\s*\"");

/**
* Parse some rich text into a Component. Use vanilla-style raw JSON if possible, fall back to old-style FTB
* Parse some rich text into a Component. Use vanilla-style raw JSON if applicable, fall back to old-style FTB
* Quests rich text otherwise. (FTB Quests rich text is more concise, raw JSON is much more powerful)
*
* @param str the raw string to parse
* @return a component, which could be the error message if parsing failed
*/
public static Component parseRawText(String str, HolderLookup.Provider provider) {
return JSON_TEXT_PATTERN.matcher(str).find() ?
deserializeRawJsonText(str, provider) :
ClientTextComponentUtils.parse(str);
}
String str2 = str.trim();
if (str2.startsWith("[") && str2.endsWith("]") || str2.startsWith("{") && str2.endsWith("}")) {
// could be JSON raw text, but not for definite...
try {
MutableComponent res = Component.Serializer.fromJson(str2, provider);
if (res != null) {
return res;
}
} catch (JsonParseException ignored) {

private static Component deserializeRawJsonText(String raw, HolderLookup.Provider provider) {
try {
return Component.Serializer.fromJson(raw, provider);
} catch (JsonParseException e) {
return Component.literal("ERROR: " + e.getMessage()).withStyle(ChatFormatting.RED);
}
}
return ClientTextComponentUtils.parse(str);
}

public static List<String> fromListTag(ListTag tag) {
Expand Down
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@ maven_group=dev.ftb.mods
mod_author=FTB Team

# Build time
mod_version=2100.1.1
mod_version=2100.1.2
minecraft_version=1.21


# Cross env
#forge_version=50.0.9
#forge_loader_version=49
neoforge_version=21.0.21-beta
neoforge_version=21.0.40-beta
# https://maven.neoforged.net/#/releases/net/neoforged/fancymodloader/loader
neoforge_loader_version=4
fabric_loader_version=0.15.11
fabric_api_version=0.100.1+1.21
architectury_api_version=13.0.1
architectury_api_version=13.0.2

ftb_library_version=2100.1.1
ftb_library_version=2100.1.2
ftb_teams_version=2100.1.0

# Optional deps
Expand Down

0 comments on commit e151139

Please sign in to comment.