Skip to content

Commit

Permalink
NeoForge 1.20.2
Browse files Browse the repository at this point in the history
  • Loading branch information
jpenilla committed Nov 17, 2023
1 parent 249db9a commit 2a8ba51
Show file tree
Hide file tree
Showing 12 changed files with 77 additions and 52 deletions.
36 changes: 28 additions & 8 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
import net.fabricmc.loom.task.AbstractRunTask
import org.gradlex.javaecosystem.capabilities.rules.GuavaListenableFutureRule

plugins {
val indraVer = "3.0.1"
val indraVer = "3.1.3"
id("net.kyori.indra") version indraVer
id("net.kyori.indra.publishing") version indraVer
id("net.kyori.indra.publishing.sonatype") version indraVer
id("net.kyori.indra.license-header") version indraVer
id("dev.architectury.loom") version "1.2-SNAPSHOT"
id("dev.architectury.loom") version "1.4-SNAPSHOT"
}

repositories {
maven("https://maven.neoforged.net/releases/")
}

indra {
Expand All @@ -17,17 +22,32 @@ license {
header(file("HEADER"))
}

val transitiveInclude: Configuration by configurations.creating
val transitiveInclude: Configuration by configurations.creating {
exclude("org.checkerframework")
exclude("org.apiguardian")
}

loom.silentMojangMappingsLicense()

dependencies {
minecraft("com.mojang:minecraft:1.20")
components.withModule(GuavaListenableFutureRule.MODULES[0]) {
// Ad-hoc rule to revert the effect of 'GuavaListenableFutureRule' (NeoForge has broken dependencies)
allVariants {
withCapabilities {
removeCapability(GuavaListenableFutureRule.CAPABILITY_GROUP, GuavaListenableFutureRule.CAPABILITY_NAME)
}
}
}

minecraft("com.mojang:minecraft:1.20.2")
mappings(loom.officialMojangMappings())
forge("net.minecraftforge", "forge", "1.20-46.0.1")
api(transitiveInclude(forgeExtra(platform("cloud.commandframework:cloud-bom:1.8.4"))!!)!!)
api(transitiveInclude(forgeExtra("cloud.commandframework:cloud-core")!!)!!)
api(transitiveInclude(forgeExtra("cloud.commandframework:cloud-brigadier")!!)!!)
neoForge("net.neoforged", "neoforge", "20.2.54-beta")

listOf("api", transitiveInclude.name, "forgeExtra").forEach { c ->
c(platform("cloud.commandframework:cloud-bom:1.8.4"))
c("cloud.commandframework:cloud-core")
c("cloud.commandframework:cloud-brigadier")
}
}

java {
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
group=cloud.commandframework
version=1.0.0+1.20-SNAPSHOT
version=1.0.0+1.20.2-SNAPSHOT

loom.platform=forge
loom.platform=neoforge
org.gradle.jvmargs=-Xmx2G
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
22 changes: 13 additions & 9 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down Expand Up @@ -130,26 +131,29 @@ location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi

# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -198,11 +202,11 @@ fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.

set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
Expand Down
4 changes: 2 additions & 2 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ pluginManagement {
repositories {
gradlePluginPortal()
maven("https://maven.fabricmc.net/")
maven("https://maven.minecraftforge.net")
maven("https://maven.neoforged.net/releases/")
maven("https://maven.architectury.dev/")
}
}

rootProject.name = "cloud-forge"
rootProject.name = "cloud-neoforge"
Original file line number Diff line number Diff line change
Expand Up @@ -40,23 +40,23 @@
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.network.chat.Component;
import net.minecraft.server.level.ServerPlayer;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.server.ServerStartingEvent;
import net.minecraftforge.eventbus.api.EventPriority;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.server.permission.events.PermissionGatherEvent;
import net.minecraftforge.server.permission.nodes.PermissionDynamicContext;
import net.minecraftforge.server.permission.nodes.PermissionNode;
import net.minecraftforge.server.permission.nodes.PermissionTypes;
import net.neoforged.bus.api.EventPriority;
import net.neoforged.fml.common.Mod;
import net.neoforged.neoforge.common.NeoForge;
import net.neoforged.neoforge.event.server.ServerStartingEvent;
import net.neoforged.neoforge.server.permission.events.PermissionGatherEvent;
import net.neoforged.neoforge.server.permission.nodes.PermissionDynamicContext;
import net.neoforged.neoforge.server.permission.nodes.PermissionNode;
import net.neoforged.neoforge.server.permission.nodes.PermissionTypes;
import org.checkerframework.checker.nullness.qual.Nullable;

@Mod("cloud")
public final class CloudForgeEntrypoint {
private static boolean serverStartingCalled;

public CloudForgeEntrypoint() {
MinecraftForge.EVENT_BUS.addListener(EventPriority.HIGHEST, (ServerStartingEvent event) -> serverStartingCalled = true);
MinecraftForge.EVENT_BUS.addListener(EventPriority.LOW, CloudForgeEntrypoint::registerPermissions);
NeoForge.EVENT_BUS.addListener(EventPriority.HIGHEST, (ServerStartingEvent event) -> serverStartingCalled = true);
NeoForge.EVENT_BUS.addListener(EventPriority.LOW, CloudForgeEntrypoint::registerPermissions);

if (Boolean.getBoolean("cloud.test_commands")) {
testServerManager();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@
import net.minecraft.network.chat.Component;
import net.minecraft.world.phys.Vec2;
import net.minecraft.world.phys.Vec3;
import net.minecraftforge.client.ClientCommandSourceStack;
import net.neoforged.neoforge.client.ClientCommandSourceStack;
import org.checkerframework.checker.nullness.qual.NonNull;

/**
* A command manager for registering client-side commands.
*
* <p>All commands should be registered within mod initializers. Any registrations occurring after the first call to
* {@link net.minecraftforge.client.event.RegisterClientCommandsEvent} will be considered <em>unsafe</em>, and will only be permitted when the unsafe
* {@link net.neoforged.neoforge.client.event.RegisterClientCommandsEvent} will be considered <em>unsafe</em>, and will only be permitted when the unsafe
* registration manager option is enabled.</p>
*
* @param <C> the command sender type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@
import net.minecraft.commands.CommandBuildContext;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.Commands;
import net.minecraftforge.client.ClientCommandHandler;
import net.minecraftforge.client.event.ClientPlayerNetworkEvent;
import net.minecraftforge.client.event.RegisterClientCommandsEvent;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.RegisterCommandsEvent;
import net.neoforged.neoforge.client.ClientCommandHandler;
import net.neoforged.neoforge.client.event.ClientPlayerNetworkEvent;
import net.neoforged.neoforge.client.event.RegisterClientCommandsEvent;
import net.neoforged.neoforge.common.NeoForge;
import net.neoforged.neoforge.event.RegisterCommandsEvent;
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
import org.checkerframework.checker.nullness.qual.NonNull;

Expand Down Expand Up @@ -132,8 +132,8 @@ static class Client<C> extends ForgeCommandRegistrationHandler<C> {
@Override
void initialize(final ForgeCommandManager<C> manager) {
super.initialize(manager);
MinecraftForge.EVENT_BUS.addListener(this::registerCommands);
MinecraftForge.EVENT_BUS.addListener((ClientPlayerNetworkEvent.LoggingOut event) -> this.registerEventFired = false);
NeoForge.EVENT_BUS.addListener(this::registerCommands);
NeoForge.EVENT_BUS.addListener((ClientPlayerNetworkEvent.LoggingOut event) -> this.registerEventFired = false);
}

@Override
Expand Down Expand Up @@ -181,7 +181,7 @@ static class Server<C> extends ForgeCommandRegistrationHandler<C> {
@Override
void initialize(final ForgeCommandManager<C> manager) {
super.initialize(manager);
MinecraftForge.EVENT_BUS.addListener(this::registerAllCommands);
NeoForge.EVENT_BUS.addListener(this::registerAllCommands);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@
import net.minecraft.network.chat.Component;
import net.minecraft.world.phys.Vec2;
import net.minecraft.world.phys.Vec3;
import net.minecraftforge.server.permission.PermissionAPI;
import net.minecraftforge.server.permission.nodes.PermissionNode;
import net.minecraftforge.server.permission.nodes.PermissionTypes;
import net.neoforged.neoforge.server.permission.PermissionAPI;
import net.neoforged.neoforge.server.permission.nodes.PermissionNode;
import net.neoforged.neoforge.server.permission.nodes.PermissionTypes;

public final class ForgeServerCommandManager<C> extends ForgeCommandManager<C> {

Expand Down Expand Up @@ -81,7 +81,7 @@ public ForgeServerCommandManager(
);

if (CloudForgeEntrypoint.hasServerAlreadyStarted()) {
throw new IllegalStateException("ForgefabrServerCommandManager was created too late! Because command registration "
throw new IllegalStateException("ForgeServerCommandManager was created too late! Because command registration "
+ "occurs before the server instance is created, commands should be registered in mod initializers.");
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/META-INF/accesstransformer.cfg
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
public net.minecraft.commands.Commands$CommandSelection f_82144_
public net.minecraft.commands.Commands$CommandSelection f_82145_
public net.minecraft.commands.Commands$CommandSelection includeIntegrated
public net.minecraft.commands.Commands$CommandSelection includeDedicated
8 changes: 4 additions & 4 deletions src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
modLoader = "javafml"
loaderVersion = "[46,)"
loaderVersion = "[1,)"
license = "MIT"
issueTrackerURL = "https://github.com/Incendo/cloud-forge/issues"
showAsResourcePack = false
Expand All @@ -14,15 +14,15 @@ description = "Cloud Command Framework on Forge"
displayTest = "IGNORE_ALL_VERSION"

[[dependencies.cloud]]
modId = "forge"
modId = "neoforge"
mandatory = true
versionRange = "[46,)"
versionRange = "[20.2,)"
ordering = "NONE"
side = "BOTH"

[[dependencies.cloud]]
modId = "minecraft"
mandatory = true
versionRange = "[1.20,1.21)"
versionRange = "[1.20.2,1.21)"
ordering = "NONE"
side = "BOTH"

0 comments on commit 2a8ba51

Please sign in to comment.