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

Dev #12

Merged
merged 3 commits into from
Jul 26, 2024
Merged

Dev #12

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
49 changes: 21 additions & 28 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import me.modmuss50.mpp.ReleaseType

plugins {
id "architectury-plugin" version "3.4-SNAPSHOT"
id "dev.architectury.loom" version "1.6-SNAPSHOT" apply false
id "dev.architectury.loom" version "1.7-SNAPSHOT" apply false
id "me.modmuss50.mod-publish-plugin" version "0.5.1"
}

Expand Down Expand Up @@ -84,24 +84,27 @@ subprojects {
}
}


// 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_KEY").getOrNull() == null
changelog = providers.environmentVariable("CHANGELOG").orElse("")
version = mod_version
type = releaseTypeToPublishType(ftbPublishing.relType)

def curseOptions = curseforgeOptions {
def tag = providers.environmentVariable("TAG").getOrElse("release")
type = tag.endsWith("-beta") ? BETA : (tag.endsWith("-alpha") ? ALPHA : STABLE)

def createOptions = (String projectName) -> {
publishOptions {
file = project.provider { project(":$projectName").tasks.remapJar }.flatMap { it.archiveFile }
displayName = "[${projectName.toUpperCase()}][${minecraft_version}] ${readable_name} ${mod_version}"
modLoaders.add(projectName.toLowerCase())
}
}

def fabricOptions = createOptions("fabric")
def neoForgeOptions = createOptions("neoforge")
// def forgeOptions = createOptions("forge")

def curseForgeOptions = curseforgeOptions {
accessToken = providers.environmentVariable("CURSEFORGE_KEY")
projectId = project.curseforge_id
minecraftVersions.add(rootProject.minecraft_version)
Expand All @@ -112,31 +115,21 @@ publishMods {
}

// curseforge("forge") {
// from curseOptions
// modLoaders.add("forge")
// file = project(":forge").tasks.remapJar.archiveFile
// displayName = "[FORGE] FTB Filter System ${mod_version} MC ${minecraft_version}"
// from (curseForgeOptions, forgeOptions)
// }

curseforge("neoforge") {
from curseOptions
modLoaders.add("neoforge")
file = project(":neoforge").tasks.remapJar.archiveFile
displayName = "[NEOFORGE] FTB Filter System ${mod_version} MC ${minecraft_version}"
from (curseForgeOptions, neoForgeOptions)
}

curseforge("fabric") {
from curseOptions
modLoaders.add("fabric")
file = project(":fabric").tasks.remapJar.archiveFile
displayName = "[FABRIC] FTB Filter System ${mod_version} MC ${minecraft_version}"

from (curseForgeOptions, fabricOptions)
requires {
slug = "fabric-api"
}
}

// TODO uncomment this one day but will need to redo how our publishing workflow happens
// TODO uncomment this one day but we need to redo how our publishing workflow happens
// github {
// repository = "ftbteam/ftb-filter-system"
// accessToken = providers.environmentVariable("GITHUB_TOKEN")
Expand Down
1 change: 1 addition & 0 deletions common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ dependencies {
modApi "dev.architectury:architectury:${rootProject.architectury_version}"

modCompileOnly("mezz.jei:jei-${rootProject.minecraft_version}-common-api:${rootProject.jei_version}")
modRuntimeOnly("mezz.jei:jei-${rootProject.minecraft_version}-common:${rootProject.jei_version}")
}

tasks.register("buildApi", Jar) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ public Rect2i getGhostDropRegion() {
return new Rect2i(editBox.getX(), editBox.getY(), editBox.getWidth(), editBox.getHeight());
}

@SuppressWarnings("UnreachableCode")
@Override
public void receiveGhostDrop(ItemStack stack) {
if (PlatformUtil.hasComponentPatch(stack)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,37 +14,37 @@ class FFSScreenHandler<T extends AbstractFilterConfigScreen<?>> implements IScre

private record GuiProps(AbstractFilterConfigScreen<?> guiScreen) implements IGuiProperties {
@Override
public Class<? extends Screen> getScreenClass() {
public Class<? extends Screen> screenClass() {
return guiScreen.getClass();
}

@Override
public int getGuiLeft() {
public int guiLeft() {
return guiScreen.getGuiBounds().getX();
}

@Override
public int getGuiTop() {
public int guiTop() {
return guiScreen.getGuiBounds().getY();
}

@Override
public int getGuiXSize() {
public int guiXSize() {
return guiScreen.getGuiBounds().getWidth();
}

@Override
public int getGuiYSize() {
public int guiYSize() {
return guiScreen.getGuiBounds().getHeight();
}

@Override
public int getScreenWidth() {
public int screenWidth() {
return guiScreen.width;
}

@Override
public int getScreenHeight() {
public int screenHeight() {
return guiScreen.height;
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,33 +1,32 @@
//package dev.ftb.mods.ftbfiltersystem.integration.jei;
//
//import dev.ftb.mods.ftbfiltersystem.api.FTBFilterSystemAPI;
//import dev.ftb.mods.ftbfiltersystem.client.gui.ComponentConfigScreen;
//import dev.ftb.mods.ftbfiltersystem.client.gui.ItemConfigScreen;
//import dev.ftb.mods.ftbfiltersystem.client.gui.ModConfigScreen;
//import mezz.jei.api.IModPlugin;
//import mezz.jei.api.JeiPlugin;
//import mezz.jei.api.registration.IGuiHandlerRegistration;
//import net.minecraft.resources.ResourceLocation;
//
//@JeiPlugin
//public class JEIIntegration implements IModPlugin {
// private final ResourceLocation ID = FTBFilterSystemAPI.rl("default");
//
// @Override
// public ResourceLocation getPluginUid() {
// return ID;
// }
//
// @Override
// public void registerGuiHandlers(IGuiHandlerRegistration registration) {
// registration.addGuiScreenHandler(ItemConfigScreen.class, new FFSScreenHandler<>());
// registration.addGhostIngredientHandler(ItemConfigScreen.class, new FFSGhostHandler<>());
//
// registration.addGuiScreenHandler(ComponentConfigScreen.class, new FFSScreenHandler<>());
//// registration.addGhostIngredientHandler(NBTConfigScreen.class, new FFSGhostHandler<>(ItemStack::hasTag));
// registration.addGhostIngredientHandler(ComponentConfigScreen.class, new FFSGhostHandler<>(s -> false));
//
// registration.addGuiScreenHandler(ModConfigScreen.class, new FFSScreenHandler<>());
// registration.addGhostIngredientHandler(ModConfigScreen.class, new FFSGhostHandler<>());
// }
//}
package dev.ftb.mods.ftbfiltersystem.integration.jei;

import dev.ftb.mods.ftbfiltersystem.api.FTBFilterSystemAPI;
import dev.ftb.mods.ftbfiltersystem.client.gui.ComponentConfigScreen;
import dev.ftb.mods.ftbfiltersystem.client.gui.ItemConfigScreen;
import dev.ftb.mods.ftbfiltersystem.client.gui.ModConfigScreen;
import mezz.jei.api.IModPlugin;
import mezz.jei.api.JeiPlugin;
import mezz.jei.api.registration.IGuiHandlerRegistration;
import net.minecraft.resources.ResourceLocation;

@JeiPlugin
public class JEIIntegration implements IModPlugin {
private final ResourceLocation ID = FTBFilterSystemAPI.rl("default");

@Override
public ResourceLocation getPluginUid() {
return ID;
}

@Override
public void registerGuiHandlers(IGuiHandlerRegistration registration) {
registration.addGuiScreenHandler(ItemConfigScreen.class, new FFSScreenHandler<>());
registration.addGhostIngredientHandler(ItemConfigScreen.class, new FFSGhostHandler<>());

registration.addGuiScreenHandler(ComponentConfigScreen.class, new FFSScreenHandler<>());
registration.addGhostIngredientHandler(ComponentConfigScreen.class, new FFSGhostHandler<>(s -> false));

registration.addGuiScreenHandler(ModConfigScreen.class, new FFSScreenHandler<>());
registration.addGhostIngredientHandler(ModConfigScreen.class, new FFSGhostHandler<>());
}
}
3 changes: 3 additions & 0 deletions fabric/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,8 @@
"fabric": "*",
"minecraft": ">=1.20.1",
"architectury": ">=9.1.12"
},
"breaks": {
"jei": "<19.5.0.40"
}
}
9 changes: 4 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,20 @@ archives_base_name=ftb-filter-system
readable_name=FTB Filter System
maven_group=dev.ftb.mods

# TODO: Should we move this over to the neo format of 21.0.0
mod_version=3.0.0
mod_version=21.0.1

minecraft_version=1.21
architectury_version=13.0.1
architectury_version=13.0.2

fabric_loader_version=0.15.11
fabric_api_version=0.100.1+1.21

#forge_version=49.0.31

neoforge_version=21.0.10-beta
neoforge_version=21.0.133-beta
# https://maven.neoforged.net/#/releases/net/neoforged/fancymodloader/loader
neoforge_loader_version=4

jei_version=19.0.0.3
jei_version=19.5.0.61

curseforge_id=943925
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
1 change: 1 addition & 0 deletions neoforge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ dependencies {
modApi "dev.architectury:architectury-neoforge:${rootProject.architectury_version}"

modCompileOnly("mezz.jei:jei-${rootProject.minecraft_version}-neoforge-api:${rootProject.jei_version}")
modRuntimeOnly("mezz.jei:jei-${rootProject.minecraft_version}-neoforge:${rootProject.jei_version}")

common(project(path: ":common", configuration: "namedElements")) { transitive false }
shadowCommon(project(path: ":common", configuration: "transformProductionNeoForge")) { transitive = false }
Expand Down
7 changes: 7 additions & 0 deletions neoforge/src/main/resources/META-INF/neoforge.mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,11 @@ modId = "architectury"
type = "required"
versionRange = "[${archversion},)"
ordering = "AFTER"
side = "BOTH"

[[dependencies.ftbfiltersystem]]
modId = "jei"
type = "optional"
versionRange = "[19.5.0.40,)"
ordering = "AFTER"
side = "BOTH"
Loading