Skip to content

Commit

Permalink
Merge pull request #13 from FTBTeam/feature/unified-creative-tab
Browse files Browse the repository at this point in the history
feat: unified creative tab
  • Loading branch information
desht authored Jul 31, 2024
2 parents cf43769 + 1c777a8 commit 7c7b13d
Show file tree
Hide file tree
Showing 11 changed files with 54 additions and 23 deletions.
8 changes: 7 additions & 1 deletion 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).

## [21.0.2]

### Changed
* Filter items are now registered to the `FTB Suite` creative tab instead of it's own tab
* FTB Filter System now requires FTB Library to be installed

## [21.0.1]

### Changed
Expand Down Expand Up @@ -38,4 +44,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [1.0.0]

* Initial version
* Initial version
22 changes: 22 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,30 @@ allprojects {

// needs to be done AFTER version is set
apply from: "https://raw.githubusercontent.com/FTBTeam/mods-meta/main/gradle/publishing.gradle"
// apply from: "https://raw.githubusercontent.com/FTBTeam/mods-meta/main/gradle/extra-local-mods.gradle"

repositories {
mavenLocal()
maven {
url "https://maven.architectury.dev/"
}

maven {
url "https://maven.saps.dev/releases"
content {
includeGroup "dev.latvian.mods"
includeGroup "dev.ftb.mods"
}
}

maven {
url "https://maven.saps.dev/snapshots"
content {
includeGroup "dev.latvian.mods"
includeGroup "dev.ftb.mods"
}
}

maven {
url "https://maven.blamejared.com"
content {
Expand Down
1 change: 1 addition & 0 deletions common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ dependencies {
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}"
modApi("dev.ftb.mods:ftb-library:${rootProject.ftb_library_version}") { transitive false }

modCompileOnly("mezz.jei:jei-${rootProject.minecraft_version}-common-api:${rootProject.jei_version}")
modRuntimeOnly("mezz.jei:jei-${rootProject.minecraft_version}-common:${rootProject.jei_version}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import dev.ftb.mods.ftbfiltersystem.registry.FilterRegistry;
import dev.ftb.mods.ftbfiltersystem.registry.ModDataComponents;
import dev.ftb.mods.ftbfiltersystem.registry.ModItems;
import dev.ftb.mods.ftblibrary.FTBLibrary;
import net.minecraft.server.MinecraftServer;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
Expand All @@ -38,8 +39,8 @@ public FTBFilterSystem() {

FilterRegistrationEvent.REGISTER.register(this::registerBuiltinFilters);
ModDataComponents.COMPONENT_TYPES.register();
ModItems.TABS.register();
ModItems.ITEMS.register();
ModItems.init();

EnvExecutor.runInEnv(Env.CLIENT, () -> FTBFilterSystemClient.INSTANCE::init);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import dev.architectury.registry.registries.RegistrySupplier;
import dev.ftb.mods.ftbfiltersystem.api.FTBFilterSystemAPI;
import dev.ftb.mods.ftbfiltersystem.registry.item.SmartFilterItem;
import dev.ftb.mods.ftblibrary.FTBLibrary;
import net.minecraft.core.registries.Registries;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
Expand All @@ -17,19 +18,11 @@ public class ModItems {
public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(FTBFilterSystemAPI.MOD_ID, Registries.ITEM);
public static final RegistrySupplier<Item> SMART_FILTER = ITEMS.register("smart_filter", SmartFilterItem::new);

public static final DeferredRegister<CreativeModeTab> TABS = DeferredRegister.create(FTBFilterSystemAPI.MOD_ID, Registries.CREATIVE_MODE_TAB);
public static final RegistrySupplier<CreativeModeTab> CREATIVE_TAB = RegistrarManager.get(FTBFilterSystemAPI.MOD_ID)
.get(Registries.CREATIVE_MODE_TAB)
.register(FTBFilterSystemAPI.rl("default"), ModItems::buildDefaultTab);
public static void init() {
CreativeTabRegistry.appendStack(FTBLibrary.getCreativeModeTab(), () -> new ItemStack(SMART_FILTER.get()));
}

public static Item.Properties defaultProps() {
return new Item.Properties();
}

private static CreativeModeTab buildDefaultTab() {
return CreativeTabRegistry.create(builder -> builder.title(Component.translatable(FTBFilterSystemAPI.MOD_ID))
.icon(() -> new ItemStack(ModItems.SMART_FILTER.get()))
.displayItems((params, output) -> output.accept(new ItemStack(ModItems.SMART_FILTER.get())))
);
}
}
4 changes: 2 additions & 2 deletions fabric/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@ configurations {
dependencies {
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
modApi "net.fabricmc.fabric-api:fabric-api:${rootProject.fabric_api_version}"

// Remove the next line if you don't want to depend on the API
modApi "dev.architectury:architectury-fabric:${rootProject.architectury_version}"
modApi ("dev.ftb.mods:ftb-library-fabric:${rootProject.ftb_library_version}") { transitive false }

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

common(project(path: ":common", configuration: "namedElements")) { transitive false }
shadowCommon(project(path: ":common", configuration: "transformProductionFabric")) { transitive false }
}

apply from: "https://raw.githubusercontent.com/FTBTeam/mods-meta/main/gradle/extra-local-mods.gradle"

processResources {
inputs.property "version", project.version

Expand Down
5 changes: 3 additions & 2 deletions fabric/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@
"depends": {
"fabric": "*",
"minecraft": ">=1.20.1",
"architectury": ">=9.1.12"
"architectury": ">=9.1.12",
"ftblibrary": ">=2100.1.4"
},
"breaks": {
"jei": "<19.5.0.40"
}
}
}
2 changes: 0 additions & 2 deletions forge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ dependencies {
shadowCommon(project(path: ":common", configuration: "transformProductionForge")) { transitive = false }
}

apply from: "https://raw.githubusercontent.com/FTBTeam/mods-meta/main/gradle/extra-local-mods.gradle"

processResources {
inputs.property "version", project.version

Expand Down
4 changes: 3 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@ archives_base_name=ftb-filter-system
readable_name=FTB Filter System
maven_group=dev.ftb.mods

mod_version=21.0.1
mod_version=21.0.2

minecraft_version=1.21
architectury_version=13.0.2

fabric_loader_version=0.15.11
fabric_api_version=0.100.1+1.21

ftb_library_version=2100.1.4

#forge_version=49.0.31

neoforge_version=21.0.133-beta
Expand Down
4 changes: 2 additions & 2 deletions neoforge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ dependencies {
modCompileOnly("mezz.jei:jei-${rootProject.minecraft_version}-neoforge-api:${rootProject.jei_version}")
modRuntimeOnly("mezz.jei:jei-${rootProject.minecraft_version}-neoforge:${rootProject.jei_version}")

modApi ("dev.ftb.mods:ftb-library-neoforge:${rootProject.ftb_library_version}") { transitive false }

common(project(path: ":common", configuration: "namedElements")) { transitive false }
shadowCommon(project(path: ":common", configuration: "transformProductionNeoForge")) { transitive = false }
}

apply from: "https://raw.githubusercontent.com/FTBTeam/mods-meta/main/gradle/extra-local-mods.gradle"

processResources {
inputs.property "version", project.version

Expand Down
9 changes: 8 additions & 1 deletion neoforge/src/main/resources/META-INF/neoforge.mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,16 @@ versionRange = "[${archversion},)"
ordering = "AFTER"
side = "BOTH"

[[dependencies.ftbfiltersystem]]
modId = "ftblibrary"
type = "required"
versionRange = "[${ftb_library_version},)"
ordering = "AFTER"
side = "BOTH"

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

0 comments on commit 7c7b13d

Please sign in to comment.