Skip to content

Commit

Permalink
Update to 1.20.4
Browse files Browse the repository at this point in the history
- Use NeoForge instead of forge
  • Loading branch information
Dragon-Seeker committed Dec 28, 2023
1 parent a61b00c commit b3cea88
Show file tree
Hide file tree
Showing 26 changed files with 313 additions and 28 deletions.
4 changes: 1 addition & 3 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
plugins {
id "architectury-plugin" version "3.4-SNAPSHOT"
id "dev.architectury.loom" version "1.3-SNAPSHOT" apply false
id 'io.github.juuxel.loom-vineflower' version '1.11.0' apply false
id "dev.architectury.loom" version "1.4-SNAPSHOT" apply false
}

architectury {
Expand All @@ -10,7 +9,6 @@ architectury {

subprojects {
apply plugin: "dev.architectury.loom"
apply plugin: "io.github.juuxel.loom-vineflower"

loom {
silentMojangMappingsLicense()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ public class SeamlessLoadingScreenConfig {
.appendGsonBuilder(builder -> builder.setPrettyPrinting()
.disableHtmlEscaping()
.serializeNulls()
.registerTypeHierarchyAdapter(Text.class, new Text.Serializer())
.registerTypeHierarchyAdapter(Style.class, new Style.Serializer())
.registerTypeHierarchyAdapter(Color.class, colorAdapter))
.setPath(PlatformFunctions.getConfigDirectory().resolve("seamless_loading_screen.json"))
.build()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.minenash.seamless_loading_screen.ScreenshotLoader;
import com.minenash.seamless_loading_screen.ServerInfoExtension;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.ConnectScreen;
import net.minecraft.client.gui.screen.multiplayer.ConnectScreen;
import net.minecraft.client.network.ServerAddress;
import net.minecraft.client.network.ServerInfo;
import org.spongepowered.asm.mixin.Mixin;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.minenash.seamless_loading_screen.mixin;

import net.minecraft.client.gui.screen.LevelLoadingScreen;
import net.minecraft.client.gui.screen.world.LevelLoadingScreen;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.text.Text;
import org.spongepowered.asm.mixin.Mixin;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.minenash.seamless_loading_screen.mixin.custom_screenshots;

import com.minenash.seamless_loading_screen.ServerInfoExtension;
import net.minecraft.client.gui.screen.AddServerScreen;
import net.minecraft.client.gui.screen.multiplayer.AddServerScreen;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.client.network.ServerInfo;
Expand Down
4 changes: 2 additions & 2 deletions fabric/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ dependencies {

modCompileOnly("maven.modrinth:bedrockify:${rootProject.bedrockify_version}")

modImplementation "dev.isxander.yacl:yet-another-config-lib-fabric:${rootProject.yacl_version}"
include "dev.isxander.yacl:yet-another-config-lib-fabric:${rootProject.yacl_version}"
modImplementation ("dev.isxander.yacl:yet-another-config-lib-fabric:${rootProject.yacl_version}")
//include "dev.isxander.yacl:yet-another-config-lib-fabric:${rootProject.yacl_version}"

//modLocalRuntime ("maven.modrinth:fastload:3.4.0")

Expand Down
3 changes: 2 additions & 1 deletion fabric/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
"depends": {
"fabricloader": "*",
"fabric": "*",
"minecraft": ">=1.20.2"
"minecraft": ">=1.20.2",
"yet_another_config_lib_v3": "*"
},
"conflicts": {
"wynntils": "*"
Expand Down
2 changes: 1 addition & 1 deletion forge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ dependencies {
//modCompileOnly ("maven.modrinth:rubidium:0.7.0a")

modImplementation "dev.isxander.yacl:yet-another-config-lib-forge:${rootProject.yacl_version}"
include "dev.isxander.yacl:yet-another-config-lib-forge:${rootProject.yacl_version}"
//include "dev.isxander.yacl:yet-another-config-lib-forge:${rootProject.yacl_version}"

common(project(path: ":common", configuration: "namedElements")) { transitive false }
shadowCommon(project(path: ":common", configuration: "transformProductionForge")) { transitive = false }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.minenash.seamless_loading_screen.forge;
package com.minenash.seamless_loading_screen.neoforge;

import com.minenash.seamless_loading_screen.PlatformFunctions;
import net.minecraftforge.fml.loading.FMLLoader;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.minenash.seamless_loading_screen.forge;
package com.minenash.seamless_loading_screen.neoforge;

import com.minenash.seamless_loading_screen.SeamlessLoadingScreen;
import com.minenash.seamless_loading_screen.config.SeamlessLoadingScreenConfig;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.minenash.seamless_loading_screen.forge;
package com.minenash.seamless_loading_screen.neoforge;

import com.minenash.seamless_loading_screen.SeamlessLoadingScreen;
import net.minecraftforge.api.distmarker.Dist;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.minenash.seamless_loading_screen.forge;
package com.minenash.seamless_loading_screen.neoforge;

import com.minenash.seamless_loading_screen.SeamlessLoadingScreen;
import com.mojang.logging.LogUtils;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"required": true,
"package": "com.minenash.seamless_loading_screen.forge.mixin",
"package": "com.minenash.seamless_loading_screen.neoforge.mixin",
"compatibilityLevel": "JAVA_17",
"minVersion": "0.8",
"client": [
Expand Down
24 changes: 15 additions & 9 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
# Done to increase the memory available to gradle.
org.gradle.jvmargs=-Xmx4G
# Mod Properties
mod_version=2.1.1+1.20.2
mod_version=2.1.1+1.20.4
maven_group=com.minenash
archives_base_name=seamless-loading-screen
# Common Properties
minecraft_version=1.20.2
enabled_platforms=fabric,forge
yarn_mappings=1.20.2+build.4
yacl_version=3.2.1+1.20.2
minecraft_version=1.20.4
enabled_platforms=fabric,neoforge
yarn_mappings=1.20.4+build.3
yacl_version=3.3.1+1.20.4

# Fabric
fabric_loader_version=0.14.23
fabric_api_version=0.90.0+1.20.2
modmenu_version=8.0.0
fabric_loader_version=0.15.3
fabric_api_version=0.92.0+1.20.4

modmenu_version=9.0.0
bedrockify_version=1.9.1+mc1.20.2

# NeoForge
neoforge_version=20.4.46-beta

# Forge
forge_version=1.20.2-48.0.13
forge_version=1.20.4-49.0.12

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-8.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
102 changes: 102 additions & 0 deletions neoforge/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
plugins {
id "com.github.johnrengelman.shadow" version "7.1.2"
}

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

architectury {
platformSetupLoomIde()
neoForge()
}

loom {
accessWidenerPath = project(":common").loom.accessWidenerPath

neoForge {
// convertAccessWideners = true
// extraAccessWideners.add loom.accessWidenerPath.get().asFile.name
//
// mixinConfig "seamless_loading_screen-common.mixins.json"
// mixinConfig "seamless_loading_screen-neoForge.mixins.json"
}
}

configurations {
common
shadowCommon // Don't use shadow from the shadow plugin since it *excludes* files.
compileClasspath.extendsFrom common
runtimeClasspath.extendsFrom common
developmentNeoForge.extendsFrom common
}

dependencies {
neoForge "net.neoforged:neoforge:${rootProject.neoforge_version}"

//modLocalRuntime ("maven.modrinth:fastload:mc1.20.1-3.4.0")
//modLocalRuntime ("maven.modrinth:rubidium:0.7.0a")
//modCompileOnly ("maven.modrinth:rubidium:0.7.0a")

modImplementation("dev.isxander.yacl:yet-another-config-lib-neoforge:${rootProject.yacl_version}"){
transitive = false
}
//include "dev.isxander.yacl:yet-another-config-lib-neoforge:${rootProject.yacl_version}"

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

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

filesMatching("META-INF/mods.toml") {
expand "version": project.version
}
}

shadowJar {
exclude "fabric.mod.json"
exclude "architectury.common.json"

configurations = [project.configurations.shadowCommon]
archiveClassifier.set "dev-shadow"
}

remapJar {
input.set shadowJar.archiveFile
dependsOn shadowJar
archiveClassifier.set "neoforge"

atAccessWideners.add(loom.accessWidenerPath.get().asFile.name)//atAccessWideners.add('my_mod.accesswidener')
}

jar {
archiveClassifier.set "dev"
}

sourcesJar {
def commonSources = project(":common").sourcesJar
dependsOn commonSources
from commonSources.archiveFile.map { zipTree(it) }
}

components.java {
withVariantsFromConfiguration(project.configurations.shadowRuntimeElements) {
skip()
}
}

publishing {
publications {
mavenForge(MavenPublication) {
artifactId = rootProject.archives_base_name + "-" + project.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.
}
}
1 change: 1 addition & 0 deletions neoforge/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
loom.platform=neoforge
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package com.minenash.seamless_loading_screen.neoforge;

import com.minenash.seamless_loading_screen.PlatformFunctions;
import net.neoforged.fml.loading.FMLLoader;
import net.neoforged.fml.loading.FMLPaths;

import java.nio.file.Path;

public class PlatformFunctionsImpl {

/**
* This is our actual method to {@link PlatformFunctions#getConfigDirectory()}.
*/
public static Path getConfigDirectory() {
return FMLPaths.CONFIGDIR.get();
}

public static boolean isClientEnv() {
return FMLLoader.getDist().isClient();
}

//--

public static Path getGameDir() {
return FMLLoader.getGamePath();
}

public static boolean isDevEnv() {
return !FMLLoader.isProduction();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.minenash.seamless_loading_screen.neoforge;

import com.minenash.seamless_loading_screen.SeamlessLoadingScreen;
import com.minenash.seamless_loading_screen.config.SeamlessLoadingScreenConfig;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.bus.api.SubscribeEvent;
import net.neoforged.fml.ModList;
import net.neoforged.fml.common.Mod;
import net.neoforged.fml.event.lifecycle.FMLClientSetupEvent;
import net.neoforged.neoforge.client.ConfigScreenHandler;

@Mod.EventBusSubscriber(modid = SeamlessLoadingScreen.MODID, bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT)
public class SeamlessLoadingScreenClientEvents {

@SubscribeEvent
public static void onPostInit(FMLClientSetupEvent event) {
ModList.get().getModContainerById(SeamlessLoadingScreen.MODID).ifPresent(modContainer -> {
modContainer.registerExtensionPoint(ConfigScreenHandler.ConfigScreenFactory.class, () ->
new ConfigScreenHandler.ConfigScreenFactory((client, parent) -> SeamlessLoadingScreenConfig.getInstance().generateScreen(parent)));
});
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.minenash.seamless_loading_screen.neoforge;

import com.minenash.seamless_loading_screen.SeamlessLoadingScreen;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.bus.api.IEventBus;
import net.neoforged.fml.IExtensionPoint;
import net.neoforged.fml.ModLoadingContext;
import net.neoforged.fml.common.Mod;


@Mod(SeamlessLoadingScreen.MODID)
public class SeamlessLoadingScreenForge {

public SeamlessLoadingScreenForge(IEventBus modEventBus, Dist dist) {
//Is this needed?
ModLoadingContext.get()
.registerExtensionPoint(
IExtensionPoint.DisplayTest.class,
() -> new IExtensionPoint.DisplayTest(() -> IExtensionPoint.DisplayTest.IGNORESERVERONLY, (remote, server) -> true)
);

if(dist.isClient()){
SeamlessLoadingScreen.onInitializeClient();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package com.minenash.seamless_loading_screen.neoforge;

import com.minenash.seamless_loading_screen.SeamlessLoadingScreen;
import com.mojang.logging.LogUtils;
import net.minecraft.client.gl.ShaderProgram;
import net.minecraft.client.render.VertexFormats;
import net.minecraft.util.Identifier;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.bus.api.SubscribeEvent;
import net.neoforged.fml.common.Mod;
import net.neoforged.neoforge.client.event.RegisterShadersEvent;
import org.slf4j.Logger;

import java.io.IOException;

@Mod.EventBusSubscriber(modid = SeamlessLoadingScreen.MODID, value = Dist.CLIENT, bus = Mod.EventBusSubscriber.Bus.MOD)
public class SeamlessLoadingScreenShaderInit {

public static Logger LOGGER = LogUtils.getLogger();

// public static void init(IEventBus bus){
// bus.addListener(SeamlessLoadingScreenShaderInit::registerShaders);
// }

@SubscribeEvent
public static void registerShaders(RegisterShadersEvent event) {
try {
event.registerShader(new ShaderProgram(event.getResourceProvider(), new Identifier(SeamlessLoadingScreen.MODID, "blur"), VertexFormats.POSITION), (shaderProgram) -> {
SeamlessLoadingScreen.BLUR_PROGRAM.load(shaderProgram);
});
} catch (IOException e) {
LOGGER.error("[SeamlessLoadingScreenShaderInit] An issue with loading the needed shader files has failed, blur will not be working!", e);
}
}
}
Loading

0 comments on commit b3cea88

Please sign in to comment.