Skip to content

Commit 1a91dab

Browse files
authored
Merge pull request #769 from FTBTeam/dev
Dev
2 parents 319d62c + efd42ed commit 1a91dab

25 files changed

+417
-184
lines changed

CHANGELOG.md

+41
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,47 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [2101.1.6]
8+
9+
### Added
10+
* New hotkeys when hovering quests:
11+
* Left-Alt & Left-Mouse opens directly to quest properties
12+
* Right-Alt & Left-Mouse copies the quest
13+
* Added `/ftbquests change_progress <player> reset-all` and `... complete-all` commands
14+
* These are equivalent to the existing `/ftbquests change_progress <player> reset 1` and `... complete 1` but are clearer, avoiding the use of the magic "1" id which represents the whole quest book
15+
* Added `/ftbquests reload quests` and `/ftbquests reload team_progress` variants to the existing `/ftbquests reload` command
16+
* Reload just the quest book data or the team progression data
17+
* Added new quest theme property `"dependency_line_unavailable_color` to color lines drawn from currently locked quests to their dependents
18+
* Default colour is a slightly faded version of the `dependency_line_uncompleted_color` property
19+
* Backspace key now actually moves back to previously viewed quest when pressed on the quest view panel (previously operated as Escape and just closed the panel)
20+
* Can be disabled in client config to get old behaviour back, but why would you want to?
21+
* The "click_event" -> "change_page" action in json text components in quest description text can now jump to a specific subpage of a quest if it has multiple pages
22+
* Example syntax: `[ { "text": "click me", "underlined": true, "clickEvent": { "action": "change_page", "value": "74D53BE3AB369184/2" } } ]` jumps to page 2 of the quest (note the `/2` on the end of the quest ID)
23+
24+
### Changed
25+
* Now using the FTB Library 2101.1.10 config system
26+
* **IMPORTANT** the client config file `local/ftbquests/client-config.snbt` is now `config/ftbquests-client.snbt`
27+
* Existing configs are auto-migrated; players do not need to take any action
28+
* Command rewards: replaced boolean "Run with Elevated Permission" with integer "Permission Level"
29+
* Permission level may be anything between 0 and 4 inclusive; see https://minecraft.wiki/w/Permission_level
30+
* Previous data is migrated; true value of "Run with Elevated Permission" maps to permission level 2
31+
* Kill Entity task now has "Entity Type" and "Entity Name" properties
32+
* "Entity Type" is renamed from the old "Entity Name"
33+
* "Entity Name" can be used to require that the entity have a custom name (either a player name or a name from a name tag for non-player entities)
34+
* Players no longer need to be in edit mode to do `/ftbquests reload` (but still must have editor permission, of course)
35+
36+
### Fixed
37+
* Fixed chapter panel always starting open (and sliding shut) even if not pinned
38+
* Fixed `/ftbquests import_reward_table_from_chest` command not correctly updating quest book id mappings for new reward table
39+
* Quest view panel now uses the "quest_view_border" theme property from `ftb_quests_theme.txt` consistently now
40+
* Previously a mixture of "quest_view_border" and "widget_border" were used to draw the border lines for the view panel
41+
* Fixed some quest button alignment issues depending on the zoom level of the quest panel
42+
* Fixed autoclaim rewards being given to entire team even when marked as team reward
43+
* Also added tooltip to team reward setting in the reward properties GUI to clarify: team reward means one reward for the whole team
44+
* Fixed multiline quest editor "L" (insert link) button sometimes inserting a spurious comma, depending on current text selection
45+
* Leading/trailing whitespace is now silently trimmed from command text in command rewards (trailing whitespace could cause confusing failures to execute commands)
46+
* Fixed "Disable in JEI" quest property not being correctly saved or sync'd to clients
47+
748
## [2101.1.5]
849

950
### Changed

common/src/main/java/dev/ftb/mods/ftbquests/FTBQuests.java

+4
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@
44
import dev.architectury.utils.Env;
55
import dev.architectury.utils.EnvExecutor;
66
import dev.architectury.utils.GameInstance;
7+
import dev.ftb.mods.ftblibrary.config.manager.ConfigManager;
78
import dev.ftb.mods.ftbquests.api.FTBQuestsAPI;
89
import dev.ftb.mods.ftbquests.client.FTBQClientProxy;
910
import dev.ftb.mods.ftbquests.client.FTBQuestsClient;
11+
import dev.ftb.mods.ftbquests.client.FTBQuestsClientConfig;
1012
import dev.ftb.mods.ftbquests.integration.RecipeModHelper;
1113
import dev.ftb.mods.ftbquests.net.ClearDisplayCacheMessage;
1214
import dev.ftb.mods.ftbquests.net.FTBQuestsNetHandler;
@@ -37,6 +39,8 @@ public class FTBQuests {
3739
public FTBQuests() {
3840
FTBQuestsAPI._init(FTBQuestsAPIImpl.INSTANCE);
3941

42+
ConfigManager.getInstance().registerClientConfig(FTBQuestsClientConfig.CONFIG, FTBQuestsAPI.MOD_ID);
43+
4044
PROXY = EnvExecutor.getEnvSpecific(() -> FTBQClientProxy::new, () -> FTBQServerProxy::new);
4145

4246
TaskTypes.init();

common/src/main/java/dev/ftb/mods/ftbquests/FTBQuestsEventHandler.java

+6-4
Original file line numberDiff line numberDiff line change
@@ -188,11 +188,13 @@ private void cloned(ServerPlayer oldPlayer, ServerPlayer newPlayer, boolean wonG
188188
return;
189189
}
190190

191-
for (int i = 0; i < oldPlayer.getInventory().items.size(); i++) {
192-
ItemStack stack = oldPlayer.getInventory().items.get(i);
191+
if (!ServerQuestFile.INSTANCE.dropBookOnDeath()) {
192+
for (int i = 0; i < oldPlayer.getInventory().items.size(); i++) {
193+
ItemStack stack = oldPlayer.getInventory().items.get(i);
193194

194-
if (stack.getItem() == ModItems.BOOK.get() && newPlayer.addItem(stack)) {
195-
oldPlayer.getInventory().items.set(i, ItemStack.EMPTY);
195+
if (stack.getItem() == ModItems.BOOK.get() && newPlayer.addItem(stack)) {
196+
oldPlayer.getInventory().items.set(i, ItemStack.EMPTY);
197+
}
196198
}
197199
}
198200
}

common/src/main/java/dev/ftb/mods/ftbquests/client/FTBQuestsClient.java

+20-3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import com.mojang.blaze3d.platform.InputConstants;
44
import dev.architectury.event.events.client.ClientLifecycleEvent;
55
import dev.architectury.networking.NetworkManager;
6+
import dev.architectury.platform.Platform;
67
import dev.architectury.registry.ReloadListenerRegistry;
78
import dev.architectury.registry.client.keymappings.KeyMappingRegistry;
89
import dev.architectury.registry.client.rendering.RenderTypeRegistry;
@@ -20,7 +21,6 @@
2021
import dev.ftb.mods.ftbquests.quest.TeamData;
2122
import dev.ftb.mods.ftbquests.quest.theme.ThemeLoader;
2223
import dev.ftb.mods.ftbquests.registry.ModBlocks;
23-
import dev.ftb.mods.ftbquests.registry.ModItems;
2424
import net.minecraft.client.KeyMapping;
2525
import net.minecraft.client.Minecraft;
2626
import net.minecraft.client.player.LocalPlayer;
@@ -31,7 +31,6 @@
3131
import net.minecraft.core.BlockPos;
3232
import net.minecraft.core.Direction;
3333
import net.minecraft.core.HolderLookup;
34-
import net.minecraft.core.RegistryAccess;
3534
import net.minecraft.server.packs.PackType;
3635
import net.minecraft.util.RandomSource;
3736
import net.minecraft.world.InteractionHand;
@@ -42,14 +41,17 @@
4241
import net.minecraft.world.level.block.state.BlockState;
4342
import org.jetbrains.annotations.Nullable;
4443

44+
import java.io.IOException;
45+
import java.nio.file.Files;
46+
import java.nio.file.Path;
4547
import java.util.List;
4648
import java.util.Optional;
4749

4850
public class FTBQuestsClient {
4951
public static KeyMapping KEY_QUESTS;
5052

5153
public static void init() {
52-
FTBQuestsClientConfig.init();
54+
maybeMigrateClientConfig();
5355

5456
ClientLifecycleEvent.CLIENT_SETUP.register(FTBQuestsClient::onClientSetup);
5557
ReloadListenerRegistry.register(PackType.CLIENT_RESOURCES, new QuestFileCacheReloader());
@@ -59,6 +61,21 @@ public static void init() {
5961
new FTBQuestsClientEventHandler().init();
6062
}
6163

64+
private static void maybeMigrateClientConfig() {
65+
// TODO delete in 1.22
66+
Path oldConfig = Platform.getGameFolder().resolve("local/ftbquests/client-config.snbt");
67+
Path newConfig = Platform.getConfigFolder().resolve("ftbquests-client.snbt");
68+
69+
if (Files.exists(oldConfig) && !Files.exists(newConfig)) {
70+
try {
71+
Files.move(oldConfig, newConfig);
72+
FTBQuests.LOGGER.info("migrated {} to {}", oldConfig, newConfig);
73+
} catch (IOException e) {
74+
FTBQuests.LOGGER.error("can't migrate {} to {}: {}", oldConfig, newConfig, e.getMessage());
75+
}
76+
}
77+
}
78+
6279
private static void onClientSetup(Minecraft minecraft) {
6380
RenderTypeRegistry.register(RenderType.translucent(), ModBlocks.BARRIER.get());
6481
RenderTypeRegistry.register(RenderType.translucent(), ModBlocks.STAGE_BARRIER.get());
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,32 @@
11
package dev.ftb.mods.ftbquests.client;
22

3-
import dev.architectury.networking.NetworkManager;
4-
import dev.ftb.mods.ftblibrary.config.ConfigGroup;
5-
import dev.ftb.mods.ftblibrary.config.ui.EditConfigScreen;
3+
import dev.ftb.mods.ftblibrary.config.manager.ConfigManager;
64
import dev.ftb.mods.ftblibrary.snbt.config.*;
75
import dev.ftb.mods.ftblibrary.util.PanelPositioning;
86
import dev.ftb.mods.ftbquests.api.FTBQuestsAPI;
97
import dev.ftb.mods.ftbquests.client.config.LocaleValue;
10-
import dev.ftb.mods.ftbquests.net.RequestTranslationTableMessage;
11-
import net.minecraft.client.Minecraft;
12-
import net.minecraft.client.gui.screens.Screen;
13-
14-
import static dev.ftb.mods.ftblibrary.snbt.config.ConfigUtil.LOCAL_DIR;
15-
import static dev.ftb.mods.ftblibrary.snbt.config.ConfigUtil.loadDefaulted;
8+
import dev.ftb.mods.ftbquests.client.gui.QuestsClientConfigScreen;
169

1710
public interface FTBQuestsClientConfig {
18-
SNBTConfig CONFIG = SNBTConfig.create(FTBQuestsAPI.MOD_ID + "-client");
19-
String CLIENT_CONFIG = "client-config.snbt";
11+
String KEY = FTBQuestsAPI.MOD_ID + "-client";
12+
SNBTConfig CONFIG = SNBTConfig.create(KEY);
2013

2114
SNBTConfig UI = CONFIG.addGroup("ui", 0);
2215
BooleanValue OLD_SCROLL_WHEEL = UI.addBoolean("old_scroll_wheel", false);
2316
EnumValue<PanelPositioning> PINNED_QUESTS_POS = UI.addEnum("pinned_quests_pos", PanelPositioning.NAME_MAP, PanelPositioning.RIGHT);
2417
IntValue PINNED_QUESTS_INSET_X = UI.addInt("pinned_quests_inset_x", 2);
2518
IntValue PINNED_QUESTS_INSET_Y = UI.addInt("pinned_quests_inset_y", 2);
2619
BooleanValue SHOW_LOCK_ICON = UI.addBoolean("show_lock_icon", true);
20+
BooleanValue BACKSPACE_HISTORY = UI.addBoolean("backspace_history", true);
2721

2822
SNBTConfig XLATE = CONFIG.addGroup("xlate", 1);
2923
StringValue EDITING_LOCALE = XLATE.add(new LocaleValue(XLATE,"editing_locale", ""));
3024
BooleanValue HILITE_MISSING = XLATE.addBoolean("hilite_missing", true);
3125

3226
// TODO migrate chapter-pinned and pinned-quests data out of per-player team data into here
3327

34-
static void openSettings(Screen screen) {
35-
String prevLocale = EDITING_LOCALE.get();
36-
37-
ConfigGroup group = new ConfigGroup("ftbquests", accepted -> {
38-
if (accepted) {
39-
saveConfig();
40-
if (!prevLocale.equals(EDITING_LOCALE.get()) && ClientQuestFile.INSTANCE != null) {
41-
NetworkManager.sendToServer(new RequestTranslationTableMessage(ClientQuestFile.INSTANCE.getLocale()));
42-
ClientQuestFile.INSTANCE.clearCachedData();
43-
}
44-
}
45-
Minecraft.getInstance().setScreen(screen);
46-
});
47-
CONFIG.createClientConfig(group);
48-
EditConfigScreen gui = new EditConfigScreen(group) {
49-
@Override
50-
public boolean doesGuiPauseGame() {
51-
return screen.isPauseScreen();
52-
}
53-
};
54-
55-
gui.openGui();
56-
}
57-
58-
static void init() {
59-
loadDefaulted(CONFIG, LOCAL_DIR.resolve(FTBQuestsAPI.MOD_ID), FTBQuestsAPI.MOD_ID, CLIENT_CONFIG);
60-
}
61-
62-
static void saveConfig() {
63-
CONFIG.save(LOCAL_DIR.resolve(FTBQuestsAPI.MOD_ID).resolve(CLIENT_CONFIG));
28+
static void openSettings(boolean pauseGame) {
29+
ConfigManager.getInstance().createConfigGroup(KEY)
30+
.ifPresent(group -> new QuestsClientConfigScreen(group, pauseGame).openGui());
6431
}
6532
}

common/src/main/java/dev/ftb/mods/ftbquests/client/gui/MultilineTextEditorScreen.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,8 @@ private void doLinkInsertion(long questID) {
219219

220220
StringBuilder builder = new StringBuilder("[ ");
221221
if (!parts.get(0).isEmpty()) builder.append("\"").append(parts.get(0)).append("\", ");
222-
builder.append(String.format(LINK_TEXT_TEMPLATE, parts.get(1), questID)).append(", ");
223-
if (!parts.get(2).isEmpty()) builder.append("\"").append(parts.get(2)).append("\"");
222+
builder.append(String.format(LINK_TEXT_TEMPLATE, parts.get(1), questID));
223+
if (!parts.get(2).isEmpty()) builder.append(", ").append("\"").append(parts.get(2)).append("\"");
224224
builder.append(" ]");
225225

226226
textBox.selectCurrentLine();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package dev.ftb.mods.ftbquests.client.gui;
2+
3+
import dev.architectury.networking.NetworkManager;
4+
import dev.ftb.mods.ftblibrary.config.ConfigGroup;
5+
import dev.ftb.mods.ftblibrary.config.ui.EditConfigScreen;
6+
import dev.ftb.mods.ftbquests.client.ClientQuestFile;
7+
import dev.ftb.mods.ftbquests.net.RequestTranslationTableMessage;
8+
9+
public class QuestsClientConfigScreen extends EditConfigScreen {
10+
private final String prevLocale;
11+
private final boolean pause;
12+
13+
public QuestsClientConfigScreen(ConfigGroup group, boolean pause) {
14+
super(group);
15+
16+
this.pause = pause;
17+
this.prevLocale = ClientQuestFile.INSTANCE.getLocale();
18+
19+
setAutoclose(true);
20+
}
21+
22+
@Override
23+
public boolean doesGuiPauseGame() {
24+
return pause;
25+
}
26+
27+
@Override
28+
protected void doAccept() {
29+
super.doAccept();
30+
31+
ClientQuestFile file = ClientQuestFile.INSTANCE;
32+
if (file != null && !prevLocale.equals(file.getLocale())) {
33+
NetworkManager.sendToServer(new RequestTranslationTableMessage(file.getLocale()));
34+
file.clearCachedData();
35+
}
36+
}
37+
}

common/src/main/java/dev/ftb/mods/ftbquests/client/gui/quests/ChapterPanel.java

+13-14
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ public class ChapterPanel extends Panel {
4747

4848
private final QuestScreen questScreen;
4949
boolean expanded = isPinned();
50-
int curX = expanded ? 0 : -width;
51-
int prevX = curX;
50+
int curX;
51+
int prevX;
5252

5353
public ChapterPanel(Panel panel) {
5454
super(panel);
@@ -59,24 +59,12 @@ public ChapterPanel(Panel panel) {
5959
public void addWidgets() {
6060
add(new ModpackButton(this, questScreen.file));
6161

62-
/*
63-
if (Platform.isModLoaded("ftbmoney")) {
64-
add(new OpenShopButton(this));
65-
Color4I borderColor = ThemeProperties.WIDGET_BORDER.get(treeGui.selectedChapter);
66-
add(new ColorWidget(this, borderColor, null).setPosAndSize(1, 0, width - 2, 1));
67-
}
68-
*/
69-
7062
boolean canEdit = questScreen.file.canEdit();
7163

7264
for (Chapter chapter : questScreen.file.getDefaultChapterGroup().getVisibleChapters(questScreen.file.selfTeamData)) {
7365
add(new ChapterButton(this, chapter));
7466
}
7567

76-
if (canEdit) {
77-
//add(new AddChapterButton(this, questScreen.file.defaultChapterGroup));
78-
}
79-
8068
questScreen.file.forAllChapterGroups(group -> {
8169
if (!group.isDefaultGroup()) {
8270
ChapterGroupButton button = new ChapterGroupButton(this, group);
@@ -109,6 +97,8 @@ public void alignWidgets() {
10997
if (getContentHeight() <= height) {
11098
setScrollY(0);
11199
}
100+
101+
curX = expanded ? 0 : -width;
112102
}
113103

114104
@Override
@@ -147,6 +137,15 @@ public void drawBackground(GuiGraphics graphics, Theme theme, int x, int y, int
147137
ThemeProperties.CHAPTER_PANEL_BACKGROUND.get().draw(graphics, x, y, w, h);
148138
}
149139

140+
@Override
141+
public void onClosed() {
142+
super.onClosed();
143+
144+
if (!isPinned()) {
145+
curX = -width;
146+
}
147+
}
148+
150149
@Override
151150
public void draw(GuiGraphics graphics, Theme theme, int x, int y, int w, int h) {
152151
graphics.pose().pushPose();

common/src/main/java/dev/ftb/mods/ftbquests/client/gui/quests/OtherButtonsPanelBottom.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import dev.ftb.mods.ftblibrary.icon.Icons;
55
import dev.ftb.mods.ftblibrary.ui.ContextMenuItem;
66
import dev.ftb.mods.ftblibrary.ui.Panel;
7-
import dev.ftb.mods.ftblibrary.ui.ScreenWrapper;
87
import dev.ftb.mods.ftblibrary.ui.WidgetLayout;
98
import dev.ftb.mods.ftblibrary.ui.input.MouseButton;
109
import dev.ftb.mods.ftbquests.client.ClientQuestFile;
@@ -89,7 +88,7 @@ public EditPlayerPrefsButton(OtherButtonsPanelBottom panel) {
8988

9089
@Override
9190
public void onClicked(MouseButton button) {
92-
FTBQuestsClientConfig.openSettings(new ScreenWrapper(questScreen));
91+
FTBQuestsClientConfig.openSettings(questScreen.doesGuiPauseGame());
9392
}
9493
}
9594

0 commit comments

Comments
 (0)