Skip to content

Commit c928d81

Browse files
authored
Merge pull request #770 from FTBTeam/1.20.1/dev
1.20.1/dev
2 parents 4d01f25 + 86395d5 commit c928d81

File tree

8 files changed

+42
-25
lines changed

8 files changed

+42
-25
lines changed

CHANGELOG.md

+9
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,15 @@ 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+
## [2001.4.12]
8+
9+
### Fixed
10+
* Fixed `/ftbquests import_reward_table_from_chest` command not correctly updating quest book id mappings for new reward table
11+
* Fixed some quest button alignment issues depending on the zoom level of the quest panel* Fixed autoclaim rewards being given to entire team even when marked as team reward
12+
* Also added tooltip to team reward setting in the reward properties GUI to clarify: team reward means one reward for the whole team
13+
* Fixed multiline quest editor "L" (insert link) button sometimes inserting a spurious comma, depending on current text selection
14+
* Leading/trailing whitespace is now silently trimmed from command text in command rewards (trailing whitespace could cause confusing failures to execute commands)
15+
716
## [2001.4.11]
817

918
### Fixed

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();

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

+8-8
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ public void alignWidgets() {
149149

150150
double x = (qx - questMinX - qw / 2D) * (bs + bp) + bp / 2D + bp * (qw - 1D) / 2D;
151151
double y = (qy - questMinY - qh / 2D) * (bs + bp) + bp / 2D + bp * (qh - 1D) / 2D;
152-
w.setPosAndSize((int) x, (int) y, (int) (bs * qw), (int) (bs * qh));
152+
w.setPosAndSize((int) Math.round(x), (int) Math.round(y), (int) Math.round(bs * qw), (int) Math.round(bs * qh));
153153
}
154154
}
155155

@@ -249,10 +249,10 @@ public void drawOffsetBackground(GuiGraphics graphics, Theme theme, int x, int y
249249
}
250250

251251
private void renderConnection(Widget widget, QuestButton button, PoseStack poseStack, BufferBuilder buffer, float s, int r, int g, int b, int a, int a1, float mu, Tesselator tesselator) {
252-
int sx = widget.getX() + widget.width / 2;
253-
int sy = widget.getY() + widget.height / 2;
254-
int ex = button.getX() + button.width / 2;
255-
int ey = button.getY() + button.height / 2;
252+
double sx = widget.getX() + widget.width / 2.0;
253+
double sy = widget.getY() + widget.height / 2.0;
254+
double ex = button.getX() + button.width / 2.0;
255+
double ey = button.getY() + button.height / 2.0;
256256
float len = (float) MathUtils.dist(sx, sy, ex, ey);
257257

258258
poseStack.pushPose();
@@ -340,7 +340,7 @@ public void draw(GuiGraphics graphics, Theme theme, int x, int y, int w, int h)
340340

341341
poseStack.pushPose();
342342
poseStack.translate(0, 0, 200);
343-
GuiHelper.drawHollowRect(graphics, (int) boxX, (int) boxY, (int) boxW, (int) boxH, Color4I.WHITE.withAlpha(30), false);
343+
GuiHelper.drawHollowRect(graphics, (int) Math.round(boxX), (int) Math.round(boxY), (int) Math.round(boxW), (int) Math.round(boxH), Color4I.WHITE.withAlpha(30), false);
344344
poseStack.popPose();
345345
}
346346
} else if (!questScreen.isViewingQuest() || !questScreen.viewQuestPanel.isMouseOver()) {
@@ -361,9 +361,9 @@ public void draw(GuiGraphics graphics, Theme theme, int x, int y, int w, int h)
361361
if (QuestScreen.grid && !questScreen.isViewingQuest()) {
362362
poseStack.pushPose();
363363
poseStack.translate(0, 0, 1000);
364-
Color4I.WHITE.draw(graphics, (int) sx, (int) sy, 1, 1);
364+
Color4I.WHITE.draw(graphics, (int) Math.round(sx), (int) Math.round(sy), 1, 1);
365365
Color4I.WHITE.withAlpha(30).draw(graphics, getX(), (int) sy, width, 1);
366-
Color4I.WHITE.withAlpha(30).draw(graphics, (int) sx, getY(), 1, height);
366+
Color4I.WHITE.withAlpha(30).draw(graphics, (int) Math.round(sx), getY(), 1, height);
367367
poseStack.popPose();
368368
}
369369
}

common/src/main/java/dev/ftb/mods/ftbquests/command/FTBQuestsCommands.java

+7-4
Original file line numberDiff line numberDiff line change
@@ -256,15 +256,15 @@ private static int importRewards(CommandSourceStack source, String name, BlockPo
256256
pos = BlockPos.containing(player.pick(10, 1F, false).getLocation());
257257
}
258258

259-
RewardTable table = new RewardTable(file.newID(), file);
260-
table.setRawTitle(name);
261-
table.setRawIcon(Items.CHEST.getDefaultInstance());
262-
263259
BlockEntity be = level.getBlockEntity(pos);
264260
if (!(be instanceof BaseContainerBlockEntity container)) {
265261
throw NO_INVENTORY.create();
266262
}
267263

264+
RewardTable table = new RewardTable(file.newID(), file);
265+
table.setRawTitle(name);
266+
table.setRawIcon(Items.CHEST.getDefaultInstance());
267+
268268
for (int i = 0; i < container.getContainerSize(); i++) {
269269
ItemStack stack = container.getItem(i);
270270
if (!stack.isEmpty()) {
@@ -273,6 +273,9 @@ private static int importRewards(CommandSourceStack source, String name, BlockPo
273273
}
274274

275275
file.addRewardTable(table);
276+
file.refreshIDMap();
277+
file.clearCachedData();
278+
file.markDirty();
276279

277280
new CreateObjectResponseMessage(table, null).sendToAll(level.getServer());
278281

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

+13-9
Original file line numberDiff line numberDiff line change
@@ -559,16 +559,20 @@ public void checkAutoCompletion(Quest quest) {
559559
RewardAutoClaim auto = reward.getAutoClaimType();
560560

561561
if (auto != RewardAutoClaim.DISABLED) {
562-
if (online == null) {
563-
online = getOnlineMembers();
564-
565-
if (online.isEmpty()) {
566-
return;
562+
if (reward.isTeamReward() && ServerQuestFile.INSTANCE.getCurrentPlayer() != null) {
563+
// only the submitting player gets the reward if it's a team reward
564+
// (assuming it's possible to determine who the submitting player is)
565+
claimReward(ServerQuestFile.INSTANCE.getCurrentPlayer(), reward, auto == RewardAutoClaim.ENABLED);
566+
} else {
567+
if (online == null) {
568+
online = getOnlineMembers();
569+
if (online.isEmpty()) {
570+
return;
571+
}
572+
}
573+
for (ServerPlayer player : online) {
574+
claimReward(player, reward, auto == RewardAutoClaim.ENABLED);
567575
}
568-
}
569-
570-
for (ServerPlayer player : online) {
571-
claimReward(player, reward, auto == RewardAutoClaim.ENABLED);
572576
}
573577
}
574578
}

common/src/main/java/dev/ftb/mods/ftbquests/quest/reward/CommandReward.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public void claim(ServerPlayer player, boolean notify) {
105105
overrides.put("online_member_count", team.getOnlineMembers().size());
106106
});
107107

108-
String cmd = format(command, overrides);
108+
String cmd = format(command.trim(), overrides);
109109

110110
CommandSourceStack source = player.createCommandSourceStack();
111111
if (elevatePerms) source = source.withPermission(2);

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

+1
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,7 @@
415415
"ftbquests.reward": "Reward",
416416
"ftbquests.rewards": "Rewards",
417417
"ftbquests.reward.team_reward": "Team Reward",
418+
"ftbquests.reward.team_reward.tooltip": "When true, this is one reward for the whole team; only the submitting player receives it\nWhen false, all online players receive the reward",
418419
"ftbquests.reward.blocked": "%d reward(s) blocked for team '%s'",
419420
"ftbquests.reward.this_blocked": "Reward blocked for team '%s'",
420421
"ftbquests.reward.emergency": "Emergency Item",

gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ mod_id=ftbquests
55
archives_base_name=ftb-quests
66
minecraft_version=1.20.1
77
# Build time
8-
mod_version=2001.4.11
8+
mod_version=2001.4.12
99
maven_group=dev.ftb.mods
1010
mod_author=FTB Team
1111
# Curse release

0 commit comments

Comments
 (0)