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

Support Forge 1.18.2 #101

Merged
merged 1 commit into from
Mar 13, 2022
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
4 changes: 2 additions & 2 deletions .github/workflows/gradle_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
uses: gradle/gradle-build-action@v2.1.3
env:
ORG_GRADLE_PROJECT_version: "${{ steps.get_release.outputs.name }}"
ORG_GRADLE_PROJECT_changelog: "[Changelog at ${{ steps.get_release.outputs.html_url }}](${{ steps.get_release.outputs.html_url }})"
ORG_GRADLE_PROJECT_changelog: "[Changelog at ${{ steps.get_release.outputs.html_url }}](${{ steps.get_release.outputs.html_url }})\n\n${{ steps.get_release.outputs.body }}"
ORG_GRADLE_PROJECT_forgeKeyStore: keystoreForgeMods.jks
ORG_GRADLE_PROJECT_forgeKeyStoreAlias: ${{ secrets.KEYSTORE_FORGE_MODS_ALIAS }}
ORG_GRADLE_PROJECT_forgeKeyStorePass: ${{ secrets.KEYSTORE_FORGE_MODS_STORE_PASS }}
Expand All @@ -55,7 +55,7 @@ jobs:
uses: gradle/gradle-build-action@v2.1.3
env:
ORG_GRADLE_PROJECT_version: "${{ steps.get_release.outputs.name }}"
ORG_GRADLE_PROJECT_changelog: "[Changelog at ${{ steps.get_release.outputs.html_url }}](${{ steps.get_release.outputs.html_url }})"
ORG_GRADLE_PROJECT_changelog: "[Changelog at ${{ steps.get_release.outputs.html_url }}](${{ steps.get_release.outputs.html_url }})\n\n${{ steps.get_release.outputs.body }}"
ORG_GRADLE_PROJECT_curseforgeApiKey: ${{ secrets.CURSEFORGE_API_KEY }}
ORG_GRADLE_PROJECT_modrinthToken: ${{ secrets.MODRINTH_TOKEN }}
ORG_GRADLE_PROJECT_forgeKeyStore: keystoreForgeMods.jks
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
package fr.raksrinana.editsign.forge;

import fr.raksrinana.editsign.forge.config.Config;
import net.minecraft.core.Holder;
import net.minecraft.core.Registry;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.ItemTags;
import net.minecraft.tags.Tag;
import net.minecraft.tags.TagKey;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.DyeItem;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import java.util.Collection;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Stream;
import static java.util.stream.Collectors.toSet;
Expand Down Expand Up @@ -55,15 +55,19 @@ public static Stream<Item> getItem(String name){
}
var resourceLocation = new ResourceLocation(name);
if(isTag){
return Optional.ofNullable(ItemTags.getAllTags().getTag(resourceLocation))
.map(Tag::getValues)
.stream()
.flatMap(Collection::stream);
var tag = TagKey.m_203882_(Registry.ITEM_REGISTRY, resourceLocation);
return getRegistryTagContent(Registry.ITEM, tag);
}
return Stream.of(ITEMS.getValue(resourceLocation));
}
catch(Exception e){
return empty();
}
}

@NotNull
private static <T> Stream<T> getRegistryTagContent(@NotNull Registry<T> registry, @NotNull TagKey<T> tag){
return registry.m_203431_(tag).stream()
.flatMap(a -> a.m_203614_().map(Holder::m_203334_));
}
}
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,13 +1,13 @@
modLoader = "javafml"
loaderVersion = "[39,)"
loaderVersion = "[40,)"
issueTrackerURL = "https://github.com/${repoUser}/${repoName}/issues"
license = "LGPL-3.0"

[[mods]] #mandatory
modId="${modId}"
version="${version}"
displayName = "${modName}"
updateJSONURL = "https://raw.githubusercontent.com/${repoUser}/${repoName}/${minecraft_version}/update.json"
updateJSONURL = "https://raw.githubusercontent.com/${repoUser}/${repoName}/${minecraftVersion}/update.json"
displayURL="https://www.curseforge.com/minecraft/mc-mods/edit-sign"
logoFile="logo.png"
authors = "RakSrinaNa"
Expand All @@ -16,13 +16,13 @@ description = '''Allow you to edit signs without breaking them.'''
[[dependencies.editsign]]
modId = "forge"
mandatory = true
versionRange = "[39,)"
versionRange = "[40,)"
ordering = "NONE"
side = "BOTH"
[[dependencies.editsign]]
modId = "minecraft"
mandatory = true
versionRange = "[${minecraft_version}]"
versionRange = "[${minecraftVersion}]"
ordering = "NONE"
side = "BOTH"
[[dependencies.editsign]]
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ modId=editsign
modName=EditSign
version=0.0.1-dev
includeFabric=true
includeForge=false
includeForge=true
# Repository
repoUser=RakSrinaNa
repoName=EditSign
Expand Down
8 changes: 4 additions & 4 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ gson-version = "2.8.9"
log4j2-version = "2.17.1"
minecraftVersion = "1.18.2"
fabric-loader-version = "0.13.3"
fabric-api-version = "0.47.8+1.18.2"
forge-version = "1.18.1-39.0.0"
modmenu-version = "3.0.1"
fabric-api-version = "0.47.10+1.18.2"
forge-version = "1.18.2-40.0.13"
modmenu-version = "3.1.0"
clothConfigVersion = "6.2.57"

fabric-loom-version = "0.11.29"
fabric-loom-version = "0.12.1"
forge-plugin-version = "5.1.27"
curse-version = "1.4.0"
modrinth-version = "1.2.1"
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists