-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 1e88d0c
Showing
101 changed files
with
5,482 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: Java CI - Build on Push | ||
|
||
on: | ||
push: | ||
branches: [ main, dev, "1.*" ] | ||
workflow_dispatch: | ||
inputs: | ||
skip_maven_publish: | ||
description: 'Skip Maven publishing' | ||
required: true | ||
default: 'false' | ||
|
||
jobs: | ||
build: | ||
if: | | ||
!contains(github.event.head_commit.message, '[ciskip]') | ||
uses: FTBTeam/mods-meta/.github/workflows/standard-release.yml@main | ||
with: | ||
curse-publish-task: "" | ||
maven-snapshots: true | ||
secrets: | ||
ftb-maven-token: ${{ secrets.FTB_MAVEN_TOKEN }} | ||
saps-token: ${{ secrets.SAPS_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: Java CI - Build Release | ||
|
||
on: | ||
release: | ||
types: [ published ] | ||
|
||
jobs: | ||
build: | ||
if: | | ||
!contains(github.event.head_commit.message, '[ciskip]') | ||
uses: FTBTeam/mods-meta/.github/workflows/standard-release.yml@main | ||
with: | ||
curse-publish-task: curseforge | ||
secrets: | ||
ftb-maven-token: ${{ secrets.FTB_MAVEN_TOKEN }} | ||
saps-token: ${{ secrets.SAPS_TOKEN }} | ||
curse-token: ${{ secrets.CURSEFORGE_KEY }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# eclipse | ||
bin | ||
*.launch | ||
.settings | ||
.metadata | ||
.classpath | ||
.project | ||
|
||
# idea | ||
out | ||
*.ipr | ||
*.iws | ||
*.iml | ||
.idea | ||
|
||
# gradle | ||
build | ||
.gradle | ||
logs | ||
|
||
# other | ||
eclipse | ||
run | ||
.vscode | ||
custom.gradle | ||
.architectury-transformer/debug.log | ||
common/src/generated/.cache/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# FTB Filter System |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,159 @@ | ||
import me.modmuss50.mpp.ReleaseType | ||
|
||
plugins { | ||
id "architectury-plugin" version "3.4-SNAPSHOT" | ||
id "dev.architectury.loom" version "1.3-SNAPSHOT" apply false | ||
id "me.modmuss50.mod-publish-plugin" version "0.4.5" | ||
} | ||
|
||
architectury { | ||
minecraft = rootProject.minecraft_version | ||
} | ||
|
||
subprojects { | ||
apply plugin: "dev.architectury.loom" | ||
|
||
loom { | ||
silentMojangMappingsLicense() | ||
} | ||
|
||
dependencies { | ||
minecraft "com.mojang:minecraft:${rootProject.minecraft_version}" | ||
// The following line declares the mojmap mappings, you may use other mappings as well | ||
mappings loom.officialMojangMappings() | ||
// The following line declares the yarn mappings you may select this one as well. | ||
// mappings "net.fabricmc:yarn:1.20.1+build.10:v2" | ||
} | ||
} | ||
|
||
allprojects { | ||
apply plugin: "java" | ||
apply plugin: "architectury-plugin" | ||
apply plugin: "maven-publish" | ||
|
||
base { | ||
archivesName = rootProject.archives_base_name | ||
} | ||
|
||
version = rootProject.mod_version | ||
group = rootProject.maven_group | ||
|
||
// needs to be done AFTER version is set | ||
apply from: "https://raw.githubusercontent.com/FTBTeam/mods-meta/main/gradle/publishing.gradle" | ||
|
||
repositories { | ||
// Add repositories to retrieve artifacts from in here. | ||
// You should only use this when depending on other mods because | ||
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically. | ||
// See https://docs.gradle.org/current/userguide/declaring_repositories.html | ||
// for more information about repositories. | ||
} | ||
|
||
tasks.withType(JavaCompile) { | ||
options.encoding = "UTF-8" | ||
options.release = 17 | ||
} | ||
|
||
java { | ||
withSourcesJar() | ||
} | ||
} | ||
|
||
subprojects { | ||
apply plugin: "dev.architectury.loom" | ||
apply plugin: "maven-publish" | ||
|
||
loom { | ||
silentMojangMappingsLicense() | ||
} | ||
|
||
dependencies { | ||
minecraft "com.mojang:minecraft:${rootProject.minecraft_version}" | ||
mappings loom.officialMojangMappings() | ||
} | ||
|
||
publishing { | ||
repositories { | ||
if (ftbPublishing.ftbToken) { | ||
maven { | ||
url ftbPublishing.ftbURL | ||
credentials { | ||
username = ftbPublishing.ftbUser | ||
password = ftbPublishing.ftbToken | ||
} | ||
} | ||
} | ||
|
||
if (ftbPublishing.sapsToken) { | ||
maven { | ||
url ftbPublishing.sapsURL | ||
credentials { | ||
username = ftbPublishing.sapsUser | ||
password = ftbPublishing.sapsToken | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
// TODO: Move this to a common location? | ||
Closure<ReleaseType> releaseTypeToPublishType = { type -> | ||
switch(type) { | ||
case "release": return ReleaseType.STABLE | ||
case "beta": return ReleaseType.BETA | ||
case "alpha": return ReleaseType.ALPHA | ||
default: return ReleaseType.STABLE | ||
} | ||
} | ||
|
||
publishMods { | ||
dryRun = providers.environmentVariable("CURSEFORGE_TOKEN").getOrNull() == null | ||
changelog = providers.environmentVariable("CHANGELOG").orElse("") | ||
version = mod_version | ||
type = releaseTypeToPublishType(ftbPublishing.relType) | ||
|
||
def curseOptions = curseforgeOptions { | ||
accessToken = providers.environmentVariable("CURSEFORGE_TOKEN") | ||
projectId = project.curseforge_id | ||
minecraftVersions.add(rootProject.minecraft_version) | ||
|
||
requires { | ||
slug = 'architectury-api' | ||
} | ||
} | ||
|
||
curseforge("forge") { | ||
from curseOptions | ||
modLoaders.add("neoforge") | ||
modLoaders.add("forge") | ||
file = project(":forge").tasks.remapJar.archiveFile | ||
|
||
requires { | ||
slug = 'ftb-library-forge' | ||
slug = 'architectury-api' | ||
} | ||
} | ||
|
||
curseforge("fabric") { | ||
from curseOptions | ||
|
||
file = project(":fabric").tasks.remapJar.archiveFile | ||
modLoaders.add("fabric") | ||
|
||
requires { | ||
slug = "fabric-api" | ||
slug = 'ftb-library-fabric' | ||
} | ||
} | ||
|
||
github { | ||
repository = "ftbteam/ftb-economy" | ||
accessToken = providers.environmentVariable("GITHUB_TOKEN") | ||
commitish = providers.environmentVariable("GITHUB_SHA").orElse("dryRun") | ||
tagName = providers.environmentVariable("GITHUB_REF_NAME").orElse("dryRun") | ||
|
||
// Gradle doesn't like accessing the buildApi task directly so we need to use the provider | ||
file = project.provider { project(":common").tasks.buildApi }.flatMap { it.archiveFile } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
architectury { | ||
common(rootProject.enabled_platforms.split(",")) | ||
} | ||
|
||
loom { | ||
accessWidenerPath = file("src/main/resources/ftbfiltersystem.accesswidener") | ||
} | ||
|
||
dependencies { | ||
// We depend on fabric loader here to use the fabric @Environment annotations and get the mixin dependencies | ||
// Do NOT use other classes from fabric loader | ||
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}" | ||
// Remove the next line if you don't want to depend on the API | ||
modApi "dev.architectury:architectury:${rootProject.architectury_version}" | ||
} | ||
|
||
publishing { | ||
publications { | ||
mavenCommon(MavenPublication) { | ||
artifactId = rootProject.archives_base_name | ||
from components.java | ||
} | ||
} | ||
|
||
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing. | ||
repositories { | ||
// Add repositories to publish to here. | ||
} | ||
} |
74 changes: 74 additions & 0 deletions
74
common/src/main/java/dev/ftb/mods/ftbfiltersystem/FTBFilterSystem.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
package dev.ftb.mods.ftbfiltersystem; | ||
|
||
import dev.architectury.event.events.common.CommandRegistrationEvent; | ||
import dev.architectury.event.events.common.LifecycleEvent; | ||
import dev.architectury.utils.Env; | ||
import dev.architectury.utils.EnvExecutor; | ||
import dev.ftb.mods.ftbfiltersystem.api.FTBFilterSystemAPI; | ||
import dev.ftb.mods.ftbfiltersystem.api.FTBFilterSystemRegistry; | ||
import dev.ftb.mods.ftbfiltersystem.api.event.FilterRegistrationEvent; | ||
import dev.ftb.mods.ftbfiltersystem.client.FTBFilterSystemClient; | ||
import dev.ftb.mods.ftbfiltersystem.filter.*; | ||
import dev.ftb.mods.ftbfiltersystem.filter.compound.AndFilter; | ||
import dev.ftb.mods.ftbfiltersystem.filter.compound.NotFilter; | ||
import dev.ftb.mods.ftbfiltersystem.filter.compound.OnlyOneFilter; | ||
import dev.ftb.mods.ftbfiltersystem.filter.compound.OrFilter; | ||
import dev.ftb.mods.ftbfiltersystem.network.FTBFilterSystemNet; | ||
import dev.ftb.mods.ftbfiltersystem.registry.FilterRegistry; | ||
import dev.ftb.mods.ftbfiltersystem.registry.ModItems; | ||
import net.minecraft.server.MinecraftServer; | ||
import org.apache.logging.log4j.LogManager; | ||
import org.apache.logging.log4j.Logger; | ||
|
||
public class FTBFilterSystem { | ||
public static FTBFilterSystem instance; | ||
|
||
public static final Logger LOGGER = LogManager.getLogger(); | ||
|
||
public FTBFilterSystem() { | ||
instance = this; | ||
|
||
FTBFilterSystemAPI._init(FilterSystemAPIImpl.INSTANCE); | ||
|
||
LifecycleEvent.SETUP.register(this::onSetup); | ||
LifecycleEvent.SERVER_STARTED.register(this::serverStarted); | ||
|
||
CommandRegistrationEvent.EVENT.register(FilterSystemCommands::registerCommands); | ||
|
||
FilterRegistrationEvent.REGISTER.register(this::registerBuiltinFilters); | ||
ModItems.TABS.register(); | ||
ModItems.ITEMS.register(); | ||
|
||
EnvExecutor.runInEnv(Env.CLIENT, () -> FTBFilterSystemClient.INSTANCE::init); | ||
|
||
FTBFilterSystemNet.init(); | ||
} | ||
|
||
private void onSetup() { | ||
FilterRegistrationEvent.REGISTER.invoker().registerFilters(FTBFilterSystemAPI.api().getRegistry()); | ||
} | ||
|
||
private void serverStarted(MinecraftServer minecraftServer) { | ||
FilterRegistry.INSTANCE.freeze(); | ||
} | ||
|
||
private void registerBuiltinFilters(FTBFilterSystemRegistry reg) { | ||
reg.register(BlockFilter.ID, BlockFilter::fromString, BlockFilter::new); | ||
reg.register(CustomFilter.ID, CustomFilter::fromString, CustomFilter::new); | ||
reg.register(DurabilityFilter.ID, DurabilityFilter::fromString, DurabilityFilter::new); | ||
reg.register(FilterStackFilter.ID, FilterStackFilter::fromString, FilterStackFilter::new); | ||
reg.register(FoodValueFilter.ID, FoodValueFilter::fromString, FoodValueFilter::new); | ||
reg.register(FuzzyNbtFilter.ID, FuzzyNbtFilter::fromString, FuzzyNbtFilter::new); | ||
reg.register(ItemFilter.ID, ItemFilter::fromString, ItemFilter::new); | ||
reg.register(ItemTagFilter.ID, ItemTagFilter::fromString, ItemTagFilter::new); | ||
reg.register(MaxStackSizeFilter.ID, MaxStackSizeFilter::fromString, MaxStackSizeFilter::new); | ||
reg.register(ModFilter.ID, ModFilter::fromString, ModFilter::new); | ||
reg.register(NbtFilter.ID, NbtFilter::fromString, NbtFilter::new); | ||
reg.register(StackSizeFilter.ID, StackSizeFilter::fromString, StackSizeFilter::new); | ||
|
||
reg.register(AndFilter.ID, AndFilter::fromString, AndFilter::new); | ||
reg.register(OrFilter.ID, OrFilter::fromString, OrFilter::new); | ||
reg.register(NotFilter.ID, NotFilter::fromString, NotFilter::new); | ||
reg.register(OnlyOneFilter.ID, OnlyOneFilter::fromString, OnlyOneFilter::new); | ||
} | ||
} |
Oops, something went wrong.