Skip to content

Commit

Permalink
fix NF loading and add config screen
Browse files Browse the repository at this point in the history
  • Loading branch information
UpcraftLP committed Jan 13, 2024
1 parent 023e064 commit c0c3634
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 5 deletions.
2 changes: 1 addition & 1 deletion NeoForge/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
neogradle = "6.+"
mixingradle = "0.7-SNAPSHOT"

neoforge = "1.20.1-47.1.65"
neoforge = "1.20.1-47.1.85"

[libraries]
neoforge = { module = "net.neoforged:forge", version.ref = "neoforge" }
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package dev.cammiescorner.camsbackpacks.neoforge.entrypoints;

import com.teamresourceful.resourcefulconfig.client.ConfigScreen;
import dev.cammiescorner.camsbackpacks.CamsBackpacks;
import dev.cammiescorner.camsbackpacks.config.BackpacksConfig;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.client.ConfigScreenHandler;
import net.minecraftforge.fml.ModLoadingContext;

@OnlyIn(Dist.CLIENT)
public class Client {

public static void init() {
ModLoadingContext.get().registerExtensionPoint(ConfigScreenHandler.ConfigScreenFactory.class,
() -> new ConfigScreenHandler.ConfigScreenFactory(
(minecraft, parent) -> new ConfigScreen(parent, null, CamsBackpacks.CONFIGURATOR.getConfig(BackpacksConfig.class))
)
);
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
package dev.cammiescorner.camsbackpacks.neoforge;
package dev.cammiescorner.camsbackpacks.neoforge.entrypoints;

import dev.cammiescorner.camsbackpacks.CamsBackpacks;
import dev.cammiescorner.camsbackpacks.neoforge.services.NFRegistryHelper;
import dev.cammiescorner.camsbackpacks.util.platform.Services;
import net.minecraft.world.item.CreativeModeTabs;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.event.BuildCreativeModeTabContentsEvent;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.DistExecutor;
import net.minecraftforge.fml.ModList;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;

Expand All @@ -21,6 +24,8 @@ public Main() {
NFRegistryHelper.MENU_TYPES.register(bus);
bus.register(this);
CamsBackpacks.init();

DistExecutor.safeRunWhenOn(Dist.CLIENT, () -> Client::init);
}

@SubscribeEvent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import dev.cammiescorner.camsbackpacks.CamsBackpacks;
import dev.cammiescorner.camsbackpacks.util.platform.service.PlatformHelper;
import net.minecraftforge.fml.ModList;
import net.minecraftforge.fml.loading.moddiscovery.ModFileInfo;

public class NFPlatformHelper implements PlatformHelper {
@Override
Expand All @@ -12,6 +13,7 @@ public boolean isModLoaded(String modid) {

@Override
public String getIssuesUrl() {
return ModList.get().getModContainerById(CamsBackpacks.MOD_ID).orElseThrow().getModInfo().getOwningFile().getFileProperties().get("issueTrackerURL") instanceof String value ? value : CamsBackpacks.MOD_ID;
var file = ModList.get().getModContainerById(CamsBackpacks.MOD_ID).orElseThrow().getModInfo().getOwningFile();
return file instanceof ModFileInfo info ? info.getIssueURL().toString() : CamsBackpacks.MOD_ID;
}
}
8 changes: 8 additions & 0 deletions NeoForge/src/main/resources/pack.mcmeta
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"pack": {
"description": {
"text": "${mod_display_name} resources"
},
"pack_format": 15
}
}
9 changes: 7 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ def NOW = new Date();
def buildTime = ENV.BUILD_TIME ?: NOW.format('yyyyMMddHHmmss')

boolean isPreviewBuild = !ENV.TAG || ENV.TAG.matches(".+-.+")
def buildNumber = !ENV.TAG ? ("${ENV.BUILD_NUMBER ? "build.${ENV.BUILD_NUMBER}" : buildTime}-${libs.versions.minecraft.get()}") : ""
version = (ENV.TAG ?: "development") + ((isPreviewBuild && !ENV.TAG) ? "+${buildNumber}" : "")
def buildNumber = !ENV.TAG ? ("${ENV.BUILD_NUMBER ? "build.${ENV.BUILD_NUMBER}" : buildTime}") : ""
version = (ENV.TAG ?: "${libs.versions.minecraft.get()}-development") + ((isPreviewBuild && !ENV.TAG) ? "+${buildNumber}" : "")

def mod_name = rootProject.name.replaceAll("-", "_").toLowerCase(Locale.ROOT)

Expand Down Expand Up @@ -97,6 +97,11 @@ subprojects {
url = "https://maven.fabricmc.net"
}

maven {
name = 'NeoForge'
url = 'https://maven.neoforged.net/releases'
}

maven {
name = "Ladysnake"
url = "https://maven.ladysnake.org/releases"
Expand Down

0 comments on commit c0c3634

Please sign in to comment.