Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.19/dev #686

Merged
merged 8 commits into from
Jul 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@ 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).

## [1902.5.2]

### Fixed
* Grid snapping now works better for scaled quest buttons
* E.g. quests with a size of 0.5 also have grid snap size of half as much
* When multiple quests with different sizes are selected, size of smallest button is used
* Fixed occasional client NPE when drawing view quest panel
* Fixed mouse pointer left ungrabbed when trying to open a locked quest book from the sidebar button
* Ctrl+F now works outside edit mode to search for quests/chapters/quest links
* If outside edit mode, only quests normally visible to the player will show up in quest search list

## [1902.5.1]

### Fixed
Expand Down
4 changes: 2 additions & 2 deletions common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ publishing {
repositories {
if (ENV.FTB_MAVEN_TOKEN) {
maven {
url "https://maven.ftb.dev/release"
url "https://maven.ftb.dev/releases"
credentials {
username = "ftb"
password = "${ENV.FTB_MAVEN_TOKEN}"
Expand All @@ -35,7 +35,7 @@ publishing {

if (ENV.SAPS_TOKEN) {
maven {
url "https://maven.saps.dev/minecraft"
url "https://maven.saps.dev/releases"
credentials {
username = "ftb"
password = "${ENV.SAPS_TOKEN}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,9 @@ private EventResult onCustomClick(CustomClickEvent event) {
double mx = Minecraft.getInstance().mouseHandler.xpos();
double my = Minecraft.getInstance().mouseHandler.ypos();
Minecraft.getInstance().setScreen(null);
ClientQuestFile.openGui();
InputConstants.grabOrReleaseMouse(Minecraft.getInstance().getWindow().getWindow(), GLFW.GLFW_CURSOR_NORMAL, mx, my);
if (ClientQuestFile.openGui() != null) {
InputConstants.grabOrReleaseMouse(Minecraft.getInstance().getWindow().getWindow(), GLFW.GLFW_CURSOR_NORMAL, mx, my);
}
return EventResult.interruptFalse();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@
import dev.ftb.mods.ftblibrary.ui.misc.ButtonListBaseScreen;
import dev.ftb.mods.ftblibrary.util.TooltipList;
import dev.ftb.mods.ftbquests.client.ClientQuestFile;
import dev.ftb.mods.ftbquests.quest.Quest;
import dev.ftb.mods.ftbquests.quest.QuestLink;
import dev.ftb.mods.ftbquests.quest.QuestObjectBase;
import dev.ftb.mods.ftbquests.quest.QuestObjectType;
import dev.ftb.mods.ftbquests.quest.*;
import dev.ftb.mods.ftbquests.quest.loot.RewardTable;
import dev.ftb.mods.ftbquests.quest.reward.Reward;
import dev.ftb.mods.ftbquests.quest.task.Task;
Expand Down Expand Up @@ -65,8 +62,9 @@ public boolean onClosedByKey(Key key) {
public void addButtons(Panel panel) {
List<T> list = new ArrayList<>();

for (QuestObjectBase objectBase : ClientQuestFile.INSTANCE.getAllObjects()) {
if (config.predicate.test(objectBase)) {
ClientQuestFile file = ClientQuestFile.INSTANCE;
for (QuestObjectBase objectBase : file.getAllObjects()) {
if (config.predicate.test(objectBase) && (file.canEdit() || (!(objectBase instanceof QuestObject qo) || qo.isVisible(file.self)))) {
list.add((T) objectBase);
}
}
Expand Down Expand Up @@ -127,7 +125,6 @@ public void addMouseOverText(TooltipList list) {
} else if (object instanceof QuestLink link) {
link.getQuest().ifPresent(quest -> {
addObject(list, link.getChapter());
list.add(Component.empty());
list.add(Component.translatable("ftbquests.gui.linked_quest_id", Component.literal(quest.getCodeString()).withStyle(ChatFormatting.DARK_GRAY)).withStyle(ChatFormatting.GRAY));
addObject(list, quest.chapter);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,14 +300,15 @@ public void draw(PoseStack matrixStack, Theme theme, int x, int y, int w, int h)
if (isShiftKeyDown()) {
questX = qx;
questY = qy;
} else if (questScreen.selectedObjects.size() == 1 && questScreen.selectedObjects.get(0) instanceof Quest q) {
double s = (1D / questScreen.file.gridScale) / q.size;
questX = Mth.floor(qx * s + 0.5D) / s;
questY = Mth.floor(qy * s + 0.5D) / s;
} else {
double s = 1D / questScreen.file.gridScale;
questX = Mth.floor(qx * s + 0.5D) / s;
questY = Mth.floor(qy * s + 0.5D) / s;
// grid-snapping size is based on the smallest selected item
double minSize = questScreen.selectedObjects.stream()
.map(Movable::getWidth)
.min(Double::compare)
.orElse(1d);
double snap = 1D / (questScreen.file.gridScale * minSize);
questX = Mth.floor(qx * snap + 0.5D) / snap;
questY = Mth.floor(qy * snap + 0.5D) / snap;
}

if (questScreen.file.canEdit()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,16 @@ public boolean keyPressed(Key key) {
return true;
}

if (key.is(GLFW.GLFW_KEY_F) && key.modifiers.onlyControl()) {
openQuestSelectionGUI();
return true;
}

if (key.is(GLFW.GLFW_KEY_0)) {
addZoom((16 - zoom) / 4.0);
return true;
}

if (key.keyCode >= GLFW.GLFW_KEY_1 && key.keyCode <= GLFW.GLFW_KEY_9) {
int i = key.keyCode - GLFW.GLFW_KEY_1;

Expand Down Expand Up @@ -369,14 +379,6 @@ public boolean keyPressed(Key key) {
case GLFW.GLFW_KEY_RIGHT -> {
return moveSelectedQuests(step, 0D);
}
case GLFW.GLFW_KEY_0 -> {
addZoom((16 - zoom) / 4.0);
return true;
}
case GLFW.GLFW_KEY_F -> {
openQuestSelectionGUI();
return true;
}
}
}

Expand All @@ -393,11 +395,13 @@ private void openQuestSelectionGUI() {
zoom = 20;
selectChapter(quest.chapter);
viewQuestPanel.hidePanel = false;
questPanel.scrollTo(quest.x, quest.y);
viewQuest(quest);
} else if (c.value instanceof QuestLink link) {
zoom = 20;
selectChapter(link.getChapter());
viewQuestPanel.hidePanel = false;
questPanel.scrollTo(link.getX(), link.getY());
link.getQuest().ifPresent(this::viewQuest);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -797,8 +797,10 @@ public void drawBackground(PoseStack matrixStack, Theme theme, int x, int y, int
Color4I.DARK_GRAY.withAlpha(120).draw(matrixStack, questScreen.getX(), questScreen.getY(), questScreen.width, questScreen.height);
Icon background = ThemeProperties.QUEST_VIEW_BACKGROUND.get();
background.draw(matrixStack, x, y, w, h);
int iconSize = Math.min(16, titleField.height + 2);
icon.draw(matrixStack, x + 4, y + 4, iconSize, iconSize);
if (titleField != null) {
int iconSize = Math.min(16, titleField.height + 2);
icon.draw(matrixStack, x + 4, y + 4, iconSize, iconSize);
}
borderColor.draw(matrixStack, x + 1, panelContent.getY(), w - 2, 1);
}

Expand Down
4 changes: 2 additions & 2 deletions fabric/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ publishing {
repositories {
if (ENV.FTB_MAVEN_TOKEN) {
maven {
url "https://maven.ftb.dev/release"
url "https://maven.ftb.dev/releases"
credentials {
username = "ftb"
password = "${ENV.FTB_MAVEN_TOKEN}"
Expand All @@ -117,7 +117,7 @@ publishing {

if (ENV.SAPS_TOKEN) {
maven {
url "https://maven.saps.dev/minecraft"
url "https://maven.saps.dev/releases"
credentials {
username = "ftb"
password = "${ENV.SAPS_TOKEN}"
Expand Down
4 changes: 2 additions & 2 deletions forge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ publishing {
repositories {
if (ENV.FTB_MAVEN_TOKEN) {
maven {
url "https://maven.ftb.dev/release"
url "https://maven.ftb.dev/releases"
credentials {
username = "ftb"
password = "${ENV.FTB_MAVEN_TOKEN}"
Expand All @@ -141,7 +141,7 @@ publishing {

if (ENV.SAPS_TOKEN) {
maven {
url "https://maven.saps.dev/minecraft"
url "https://maven.saps.dev/releases"
credentials {
username = "ftb"
password = "${ENV.SAPS_TOKEN}"
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ mod_id=ftbquests
archives_base_name=ftb-quests
minecraft_version=1.19.2
# Build time
mod_version=1902.5.1
mod_version=1902.5.2
maven_group=dev.ftb.mods
mod_author=FTB Team
# Curse release
Expand Down