Skip to content

Commit a8a6dda

Browse files
authored
Merge pull request #777 from FTBTeam/dev
Dev
2 parents 67879bd + 11c11b4 commit a8a6dda

File tree

8 files changed

+55
-20
lines changed

8 files changed

+55
-20
lines changed

CHANGELOG.md

+11
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,17 @@ 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.8]
8+
9+
### Added
10+
* If all tasks in a quest are marked optional, now require at least one to be completed to complete the quest
11+
* Previously quest would just auto-complete, which is less useful (if that behaviour is really needed, use a quest with no tasks at all)
12+
* This allows for quests with a choice of two or more tasks, where completing any of the tasks will complete the quest
13+
14+
### Fixed
15+
* Hotfix: fix player login exception related to exclusive quest branching feature added in 2101.1.7
16+
* Tooltip on optional tasks now reads "Optional Task" instead of "Optional Quest"
17+
718
## [2101.1.7]
819

920
### Added

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

+4-7
Original file line numberDiff line numberDiff line change
@@ -469,13 +469,10 @@ public boolean keyPressed(Key key) {
469469
List<Chapter> visibleChapters = file.getVisibleChapters(file.selfTeamData);
470470

471471
if (key.is(GLFW.GLFW_KEY_TAB)) {
472-
if (selectedChapter != null && file.getVisibleChapters(file.selfTeamData).size() > 1) {
473-
474-
if (!visibleChapters.isEmpty()) {
475-
selectChapter(visibleChapters.get(MathUtils.mod(visibleChapters.indexOf(selectedChapter) + (isShiftKeyDown() ? -1 : 1), visibleChapters.size())));
476-
selectedChapter.getAutofocus().ifPresent(this::scrollTo);
477-
}
478-
}
472+
if (selectedChapter != null && visibleChapters.size() > 1) {
473+
selectChapter(visibleChapters.get(MathUtils.mod(visibleChapters.indexOf(selectedChapter) + (isShiftKeyDown() ? -1 : 1), visibleChapters.size())));
474+
selectedChapter.getAutofocus().ifPresent(this::scrollTo);
475+
}
479476

480477
return true;
481478
}

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

+9-5
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,14 @@ public boolean mousePressed(MouseButton button) {
6060
@Override
6161
public void onClicked(MouseButton button) {
6262
if (button.isLeft()) {
63-
boolean canClick = task.isValid()
64-
&& questScreen.file.selfTeamData.canStartTasks(task.getQuest())
65-
&& !questScreen.file.selfTeamData.isCompleted(task);
66-
task.onButtonClicked(this, canClick);
63+
if (task.getQuestFile().canEdit() && ScreenWrapper.hasAltDown()) {
64+
task.onEditButtonClicked(questScreen);
65+
} else {
66+
boolean canClick = task.isValid()
67+
&& questScreen.file.selfTeamData.canStartTasks(task.getQuest())
68+
&& !questScreen.file.selfTeamData.isCompleted(task);
69+
task.onButtonClicked(this, canClick);
70+
}
6771
} else if (button.isRight() && questScreen.file.canEdit()) {
6872
playClickSound();
6973

@@ -168,7 +172,7 @@ public void addMouseOverText(TooltipList list) {
168172
}
169173

170174
if (task.isOptionalForProgression()) {
171-
list.add(Component.translatable("ftbquests.quest.misc.optional").withStyle(ChatFormatting.GRAY));
175+
list.add(Component.translatable("ftbquests.quest.misc.optional_task").withStyle(ChatFormatting.GRAY));
172176
}
173177

174178
task.addMouseOverText(list, questScreen.file.selfTeamData);

common/src/main/java/dev/ftb/mods/ftbquests/quest/QuestObject.java

+14-3
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,23 @@ public Collection<? extends QuestObject> getChildren() {
126126
}
127127

128128
public boolean isCompletedRaw(TeamData data) {
129+
int nOptional = 0;
130+
int nCompleted = 0;
129131
for (QuestObject child : getChildren()) {
130-
if (!child.isOptionalForProgression() && !data.isExcludedByOtherQuestline(child) && !data.isCompleted(child)) {
131-
return false;
132+
boolean uncompleted = !data.isCompleted(child) && !data.isExcludedByOtherQuestline(child);
133+
if (uncompleted) {
134+
if (child.isOptionalForProgression()) {
135+
nOptional++;
136+
} else {
137+
return false;
138+
}
139+
} else {
140+
nCompleted++;
132141
}
133142
}
134-
return true;
143+
// if there are no children at all, it's auto-completed (degenerate case)
144+
// if ALL children are optional, require at least one to be completed (e.g. quests with either/or tasks)
145+
return getChildren().isEmpty() || nOptional < getChildren().size() || nCompleted > 0;
135146
}
136147

137148
public boolean isOptionalForProgression() {

common/src/main/java/dev/ftb/mods/ftbquests/quest/TeamData.java

+14-3
Original file line numberDiff line numberDiff line change
@@ -547,8 +547,8 @@ public boolean areDependenciesVisible(Quest quest) {
547547
}
548548

549549
public boolean canStartTasks(Quest quest) {
550-
return !isExcludedByOtherQuestline(quest) &&
551-
(quest.getProgressionMode() == ProgressionMode.FLEXIBLE || areDependenciesComplete(quest));
550+
return (quest.getProgressionMode() == ProgressionMode.FLEXIBLE || areDependenciesComplete(quest))
551+
&& !isExcludedByOtherQuestline(quest);
552552
}
553553

554554
public void claimReward(ServerPlayer player, Reward reward, boolean notify) {
@@ -778,7 +778,18 @@ public LongSet getPinnedQuestIds(Player player) {
778778
}
779779

780780
public boolean isExcludedByOtherQuestline(QuestObject qo) {
781-
return qo instanceof Excludable e && exclusionCache.computeIfAbsent(e.getId(), k -> e.isQuestObjectExcluded(this));
781+
if (qo instanceof Excludable e) {
782+
// note: computeIfAbsent() won't work well here due to indirect recursion
783+
// (can throw exception with both standard and fastutil maps)
784+
if (exclusionCache.containsKey(e.getId())) {
785+
return exclusionCache.get(e.getId());
786+
}
787+
boolean excluded = e.isQuestObjectExcluded(this);
788+
exclusionCache.put(e.getId(), excluded);
789+
return excluded;
790+
791+
}
792+
return false;
782793
}
783794

784795
private static class PerPlayerData {

common/src/main/java/dev/ftb/mods/ftbquests/quest/task/Task.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ public void readNetData(RegistryFriendlyByteBuf buffer) {
337337
public void fillConfigGroup(ConfigGroup config) {
338338
super.fillConfigGroup(config);
339339

340-
config.addBool("optional_task", optionalTask, v -> optionalTask = v, false).setNameKey("ftbquests.quest.misc.optional");
340+
config.addBool("optional_task", optionalTask, v -> optionalTask = v, false).setNameKey("ftbquests.quest.misc.optional_task");
341341
}
342342

343343
protected ResourceLocation safeResourceLocation(String str, ResourceLocation fallback) {

common/src/main/resources/assets/ftbquests/lang/en_us.json

+1
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@
216216
"ftbquests.quest.visibility.hide_lock_icon.tooltip": "Hide the lock icon that is normally shown when quest is locked due to a dependency",
217217
"ftbquests.quest.misc.disable_jei": "Disable JEI Recipe",
218218
"ftbquests.quest.misc.optional": "Optional Quest",
219+
"ftbquests.quest.misc.optional_task": "Optional Task",
219220
"ftbquests.quest.locked": "Locked: uncompleted dependencies",
220221
"ftbquests.quest.appearance.min_width": "Min Opened Quest Window Width",
221222
"ftbquests.quest.misc.ignore_reward_blocking": "Ignore reward blocking",

gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ maven_group=dev.ftb.mods
99
mod_author=FTB Team
1010

1111
# Build time
12-
mod_version=2101.1.7
12+
mod_version=2101.1.8
1313
minecraft_version=1.21.1
1414

1515
# Cross env

0 commit comments

Comments
 (0)