Skip to content

Commit

Permalink
Port to 1.18.2
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredlll08 committed May 18, 2023
1 parent 15d0c06 commit 9ed4756
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 25 deletions.
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

                   
[![GitHub issues](https://img.shields.io/github/issues/jaredlll08/searchables?style=flat-square)](https://github.com/jaredlll08/searchables/issues)
[![GitHub license](https://img.shields.io/github/license/jaredlll08/searchables?color=0690ff&style=flat-square)](https://github.com/jaredlll08/searchables/blob/1.19.1/LICENSE)
[![Jenkins](https://img.shields.io/jenkins/build?jobUrl=https%3A%2F%2Fci.blamejared.com%2Fjob%2FJared%2Fjob%2FMinecraft%2520Mods%2Fjob%2FSearchables%2Fjob%2F1.19.1%2F&style=flat-square)](https://ci.blamejared.com/job/Jared/job/Minecraft%20Mods/job/Searchables/job/1.19.1/)
[![GitHub license](https://img.shields.io/github/license/jaredlll08/searchables?color=0690ff&style=flat-square)](https://github.com/jaredlll08/searchables/blob/1.18.2/LICENSE)
[![Jenkins](https://img.shields.io/jenkins/build?jobUrl=https%3A%2F%2Fci.blamejared.com%2Fjob%2FJared%2Fjob%2FMinecraft%2520Mods%2Fjob%2FSearchables%2Fjob%2F1.18.2%2F&style=flat-square)](https://ci.blamejared.com/job/Jared/job/Minecraft%20Mods/job/Searchables/job/1.18.2/)
[![Discord](https://img.shields.io/badge/Discord-%237289DA?style=flat-square&logo=Discord&logoColor=white)](https://discord.blamejared.com/)
[![](http://cf.way2muchnoise.eu/searchables.svg?badge_style=flat)](https://minecraft.curseforge.com/projects/searchables)

Expand Down Expand Up @@ -108,7 +108,7 @@ If you're running into a bug or have a feature request, please don't be afraid t

## License

Distributed under the MIT License. See the [LICENSE](https://github.com/jaredlll08/searchables/blob/1.19.1/LICENSE) file for more information.
Distributed under the MIT License. See the [LICENSE](https://github.com/jaredlll08/searchables/blob/1.18.2/LICENSE) file for more information.

## Setup

Expand Down Expand Up @@ -144,35 +144,35 @@ repositories {

Then, depending on what modloader you are using, you can use the following snippets, just replace `[VERSION]` with the latest version for each artifact.

### Fabric [![Maven](https://img.shields.io/maven-metadata/v?color=C71A36&label=Latest%20version&logo=Latest%20version&metadataUrl=https%3A%2F%2Fmaven.blamejared.com%2Fcom%2Fblamejared%2Fsearchables%2FSearchables-fabric-1.19.1%2Fmaven-metadata.xml&style=flat-square)](https://maven.blamejared.com/com/blamejared/searchables/Searchables-fabric-1.19.1/)
### Fabric [![Maven](https://img.shields.io/maven-metadata/v?color=C71A36&label=Latest%20version&logo=Latest%20version&metadataUrl=https%3A%2F%2Fmaven.blamejared.com%2Fcom%2Fblamejared%2Fsearchables%2FSearchables-fabric-1.18.2%2Fmaven-metadata.xml&style=flat-square)](https://maven.blamejared.com/com/blamejared/searchables/Searchables-fabric-1.18.2/)

```kotlin
dependencies {
modImplementation("com.blamejared.searchables:Searchables-fabric-1.19.1:[VERSION]")
modImplementation("com.blamejared.searchables:Searchables-fabric-1.18.2:[VERSION]")
// Example:
// modImplementation("com.blamejared.searchables:Searchables-fabric-1.19.1:1.0.0")
// modImplementation("com.blamejared.searchables:Searchables-fabric-1.18.2:1.0.0")
}
```

### Forge [![Maven](https://img.shields.io/maven-metadata/v?color=C71A36&label=Latest%20version&logo=Latest%20version&metadataUrl=https%3A%2F%2Fmaven.blamejared.com%2Fcom%2Fblamejared%2Fsearchables%2FSearchables-forge-1.19.1%2Fmaven-metadata.xml&style=flat-square)](https://maven.blamejared.com/com/blamejared/searchables/Searchables-forge-1.19.1/)
### Forge [![Maven](https://img.shields.io/maven-metadata/v?color=C71A36&label=Latest%20version&logo=Latest%20version&metadataUrl=https%3A%2F%2Fmaven.blamejared.com%2Fcom%2Fblamejared%2Fsearchables%2FSearchables-forge-1.18.2%2Fmaven-metadata.xml&style=flat-square)](https://maven.blamejared.com/com/blamejared/searchables/Searchables-forge-1.18.2/)


```kotlin
dependencies {
compileOnly(fg.deobf("com.blamejared.searchables:Searchables-forge-1.19.1:[VERSION]"))
compileOnly(fg.deobf("com.blamejared.searchables:Searchables-forge-1.18.2:[VERSION]"))
// Example:
// implementation(fg.deobf("com.blamejared.searchables:Searchables-forge-1.19.1:1.0.0"))
// implementation(fg.deobf("com.blamejared.searchables:Searchables-forge-1.18.2:1.0.0"))
}
```

### Common [![Maven](https://img.shields.io/maven-metadata/v?color=C71A36&label=Latest%20version&logo=Latest%20version&metadataUrl=https%3A%2F%2Fmaven.blamejared.com%2Fcom%2Fblamejared%2Fsearchables%2FSearchables-common-1.19.1%2Fmaven-metadata.xml&style=flat-square)](https://maven.blamejared.com/com/blamejared/searchables/Searchables-common-1.19.1/)
### Common [![Maven](https://img.shields.io/maven-metadata/v?color=C71A36&label=Latest%20version&logo=Latest%20version&metadataUrl=https%3A%2F%2Fmaven.blamejared.com%2Fcom%2Fblamejared%2Fsearchables%2FSearchables-common-1.18.2%2Fmaven-metadata.xml&style=flat-square)](https://maven.blamejared.com/com/blamejared/searchables/Searchables-common-1.18.2/)

If you are in a multi-modloader environment (Such as [MultiLoader](https://github.com/jaredlll08/MultiLoader-Template)), you can bring the Common artifact (code that does not depend on any specific mod loader but rather just the vanilla game) into your Common project like so:

```kotlin
dependencies {
compileOnly("com.blamejared.searchables:Searchables-common-1.19.1:[VERSION]")
compileOnly("com.blamejared.searchables:Searchables-common-1.18.2:[VERSION]")
// Example:
// compileOnly("com.blamejared.searchables:Searchables-common-1.19.1:1.0.0")
// compileOnly("com.blamejared.searchables:Searchables-common-1.18.2:1.0.0")
}
```
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package com.blamejared.searchables.gradle
object Versions {
const val MOD = "1.0"
const val JAVA = "17"
const val MINECRAFT = "1.19.1"
const val FORGE = "42.0.9"
const val FABRIC = "0.58.5+1.19.1"
const val MINECRAFT = "1.18.2"
const val FORGE = "40.2.4"
const val FABRIC = "0.76.0+1.18.2"
const val FABRIC_LOADER = "0.14.19"
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.google.common.base.CharMatcher;
import com.google.common.collect.ImmutableMap;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import org.apache.commons.lang3.StringUtils;
import org.jetbrains.annotations.Nullable;

Expand Down Expand Up @@ -75,7 +76,7 @@ public List<CompletionSuggestion> getSuggestionsForComponent(final String compon
.stream()
.filter(s -> StringUtils.startsWithIgnoreCase(s, componentName))
.sorted(Comparator.naturalOrder())
.map(s -> new CompletionSuggestion(s, Component.literal(s), ":", replacementRange))
.map(s -> new CompletionSuggestion(s, new TextComponent(s), ":", replacementRange))
.distinct()
.collect(Collectors.toList());
}
Expand All @@ -94,7 +95,7 @@ public List<CompletionSuggestion> getSuggestionsForTerm(final List<T> entries, f
.filter(s -> StringUtils.startsWithIgnoreCase(s, termString))
.sorted(Comparator.naturalOrder())
.map(SearchablesConstants.QUOTE)
.map(s -> new CompletionSuggestion(componentName + ":" + s, Component.literal(s), " ", replacementRange))
.map(s -> new CompletionSuggestion(componentName + ":" + s, new TextComponent(s), " ", replacementRange))
.distinct()
.collect(Collectors.toList());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import net.minecraft.Util;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.resources.ResourceLocation;
import org.apache.commons.lang3.StringUtils;

Expand All @@ -13,7 +14,7 @@ public class SearchablesConstants {
public static final String MOD_ID = "searchables";
public static final String STRING_CHARACTERS = "'\"`";

public static final Component COMPONENT_SEARCH = Component.translatable("options.search");
public static final Component COMPONENT_SEARCH = new TranslatableComponent("options.search");

// A user can't search for a term that contains at-least one of each string character,
// as it will be impossible to tokenize as the engine doesn't have escaped quotes (yet), so lets filter them out.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.components.AbstractWidget;
import net.minecraft.client.gui.narration.NarrationElementOutput;
import net.minecraft.network.chat.CommonComponents;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.util.Mth;

import java.util.*;
Expand Down Expand Up @@ -62,7 +64,7 @@ public AutoComplete(SearchableType<T> type, AutoCompletingEditBox<T> editBox, Su
*/
public AutoComplete(SearchableType<T> type, AutoCompletingEditBox<T> editBox, Supplier<List<T>> entries, int x, int y, int width, int suggestionHeight, int maxSuggestions) {

super(x, y, width, suggestionHeight * maxSuggestions, Component.empty());
super(x, y, width, suggestionHeight * maxSuggestions, new TextComponent(""));
this.type = type;
this.editBox = editBox;
this.entries = entries;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.blamejared.searchables.api.autcomplete.CompletionVisitor;
import com.blamejared.searchables.lang.StringSearcher;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import org.junit.jupiter.api.Test;

import java.util.List;
Expand Down Expand Up @@ -330,7 +331,7 @@ public void testStringsTerm() {

private CompletionSuggestion suggestion(String suggestion, String display, String suffix, int rangeStart, int rangeEnd) {

return new CompletionSuggestion(suggestion, Component.literal(display), suffix, TokenRange.between(rangeStart, rangeEnd));
return new CompletionSuggestion(suggestion, new TextComponent(display), suffix, TokenRange.between(rangeStart, rangeEnd));
}

}
2 changes: 1 addition & 1 deletion fabric/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"depends": {
"fabricloader": ">=0.14",
"java": ">=17",
"minecraft": "1.19.x"
"minecraft": "1.18.x"
},
"recommends": {
"fabric": "*"
Expand Down
8 changes: 4 additions & 4 deletions forge/src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
modLoader = "javafml"
loaderVersion = "[41,)"
loaderVersion = "[40,)"
issueTrackerURL = "https://github.com/jaredlll08/searchables/issues"
license = "MIT"

[[mods]]
modId = "searchables"
updateJSONURL = "https://updates.blamejared.com/get?n=searchables&gv=1.19.1"
updateJSONURL = "https://updates.blamejared.com/get?n=searchables&gv=1.18.2"
version = "${file.jarVersion}"
displayName = "Searchables"
displayURL = "https://minecraft.curseforge.com/projects/searchables"
Expand All @@ -18,10 +18,10 @@ itemIcon = "minecraft:compass"
[[dependencies.searchables]]
modId = "forge"
mandatory = true
versionRange = "[41,)"
versionRange = "[40,)"
ordering = "NONE"
[[dependencies.searchables]]
modId = "minecraft"
mandatory = true
versionRange = "[1.19,)"
versionRange = "[1.18,)"
ordering = "NONE"

0 comments on commit 9ed4756

Please sign in to comment.