Skip to content

Commit

Permalink
Merge pull request #730 from FTBTeam/1.20.4/dev
Browse files Browse the repository at this point in the history
1.20.4/dev
  • Loading branch information
desht authored Jun 7, 2024
2 parents 1c6e678 + b0f0cd2 commit f664e62
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ 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).

# [2004.2.2]

### Added
* Fluids in fluid tasks can now be shift-clicked to show recipes for the fluid in JEI or REI
* Added a tooltip to fluid tasks when viewing quests to mention this

# [2004.2.1]

### Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import dev.ftb.mods.ftbquests.quest.theme.ThemeLoader;
import net.minecraft.client.KeyMapping;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.block.model.BakedQuad;
Expand Down Expand Up @@ -163,4 +164,8 @@ public static Optional<RegistryAccess> registryAccess() {
public static void copyToClipboard(QuestObjectBase qo) {
Widget.setClipboardString(qo.getCodeString());
}

public static boolean isShiftPressed() {
return Screen.hasShiftDown();
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package dev.ftb.mods.ftbquests.integration;

import dev.architectury.fluid.FluidStack;
import dev.ftb.mods.ftbquests.quest.QuestObjectBase;
import net.minecraft.world.item.ItemStack;

Expand All @@ -13,6 +14,8 @@ public interface RecipeModHelper {

void showRecipes(ItemStack object);

void showRecipes(FluidStack object);

default boolean isRecipeModAvailable() {
return false;
}
Expand Down Expand Up @@ -45,6 +48,10 @@ public void refreshRecipes(QuestObjectBase object) {
public void showRecipes(ItemStack object) {
}

@Override
public void showRecipes(FluidStack object) {
}

@Override
public String getHelperName() {
return "NO-OP";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,18 @@
import dev.ftb.mods.ftblibrary.config.ConfigGroup;
import dev.ftb.mods.ftblibrary.icon.Color4I;
import dev.ftb.mods.ftblibrary.icon.Icon;
import dev.ftb.mods.ftblibrary.ui.Button;
import dev.ftb.mods.ftblibrary.ui.Widget;
import dev.ftb.mods.ftblibrary.util.StringUtils;
import dev.ftb.mods.ftblibrary.util.TooltipList;
import dev.ftb.mods.ftblibrary.util.client.ClientUtils;
import dev.ftb.mods.ftblibrary.util.client.PositionedIngredient;
import dev.ftb.mods.ftbquests.FTBQuests;
import dev.ftb.mods.ftbquests.api.FTBQuestsAPI;
import dev.ftb.mods.ftbquests.client.FTBQuestsClient;
import dev.ftb.mods.ftbquests.quest.Quest;
import dev.ftb.mods.ftbquests.quest.TeamData;
import net.minecraft.ChatFormatting;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.chat.Component;
Expand Down Expand Up @@ -70,6 +75,25 @@ public boolean consumesResources() {
return true;
}

@Override
public void addMouseOverText(TooltipList list, TeamData teamData) {
super.addMouseOverText(list, teamData);

if (FTBQuests.getRecipeModHelper().isRecipeModAvailable()) {
list.blankLine();
list.add(Component.translatable("ftbquests.task.ftbquests.item.shift_click_recipe").withStyle(ChatFormatting.YELLOW, ChatFormatting.UNDERLINE));
}
}

@Override
public void onButtonClicked(Button button, boolean canClick) {
if (FTBQuestsClient.isShiftPressed() && FTBQuests.getRecipeModHelper().isRecipeModAvailable()) {
FTBQuests.getRecipeModHelper().showRecipes(fluidStack);
} else {
super.onButtonClicked(button, canClick);
}
}

@Override
public void writeData(CompoundTag nbt) {
super.writeData(nbt);
Expand Down
1 change: 1 addition & 0 deletions common/src/main/resources/assets/ftbquests/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@
"ftbquests.task.ftbquests.item.view_items": "Click to view valid items",
"ftbquests.task.ftbquests.item.valid_for": "Valid items for %s",
"ftbquests.task.ftbquests.item.click_recipe": "Click to view recipe(s)",
"ftbquests.task.ftbquests.item.shift_click_recipe": "Shift-Click to view recipe(s)",
"ftbquests.task.ftbquests.item.convert_tag": "Convert to '%s' Tag Filter",
"ftbquests.task.ftbquests.item.select_tag": "Select an Item Tag",
"ftbquests.task.ftbquests.item.only_from_crafting": "Only Detect From Crafting",
Expand Down
1 change: 1 addition & 0 deletions fabric/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@
"ftbteams": ">=2001.1.4-build.1"
},
"breaks": {
"ftbxmodcompat": "<3.0.4"
}
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ fabric_api_version=0.96.4+1.20.4
fabric_loader_version=0.15.7
architectury_version=11.1.17

ftb_library_version=2004.2.2
ftb_library_version=2004.2.4
ftb_teams_version=2004.1.2

# Optional deps
Expand Down
7 changes: 7 additions & 0 deletions neoforge/src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,10 @@ type = "required"
versionRange = "[${ftbteamsversion},)"
ordering = "AFTER"
side = "BOTH"

[[dependencies.ftbquests]]
modId = "ftbxmodcompat"
type = "optional"
versionRange = ">=3.0.4"
ordering = "BEFORE"
side = "BOTH"

0 comments on commit f664e62

Please sign in to comment.