From 99452a8b45fc906c07ee8cf9b45bd71fd6b306a8 Mon Sep 17 00:00:00 2001 From: cpw Date: Sun, 13 Jan 2019 22:51:36 -0500 Subject: [PATCH] Update a bunch of libs, rename some of the mod events to more meaningful names. --- build.gradle | 19 +-- mods.toml | 17 +-- .../fml/language/ILifecycleEvent.java | 28 ----- .../fml/language/IModFileInfo.java | 39 ------ .../minecraftforge/fml/language/IModInfo.java | 117 ------------------ .../fml/language/IModLanguageProvider.java | 42 ------- .../fml/language/ModFileScanData.java | 109 ---------------- .../fml/loading/DefaultModInfos.java | 2 +- .../fml/loading/FMLEnvironment.java | 6 + .../minecraftforge/fml/loading/FMLLoader.java | 26 +--- .../fml/loading/FMLServiceProvider.java | 5 +- .../fml/loading/LanguageLoadingProvider.java | 2 +- .../fml/loading/MavenVersionAdapter.java | 42 ------- .../minecraftforge/fml/loading/ModSorter.java | 2 +- .../moddiscovery/BackgroundScanHandler.java | 2 +- .../fml/loading/moddiscovery/CoreModFile.java | 2 +- .../moddiscovery/InvalidModFileException.java | 2 +- .../loading/moddiscovery/ModAnnotation.java | 2 +- .../loading/moddiscovery/ModClassVisitor.java | 2 +- .../fml/loading/moddiscovery/ModFile.java | 8 +- .../fml/loading/moddiscovery/ModFileInfo.java | 6 +- .../loading/moddiscovery/ModFileParser.java | 2 +- .../fml/loading/moddiscovery/ModInfo.java | 2 +- .../fml/loading/moddiscovery/Scanner.java | 4 +- .../minecraftforge/common/ForgeConfig.java | 2 +- .../net/minecraftforge/common/ForgeMod.java | 14 +-- .../capabilities/CapabilityManager.java | 2 +- .../fml/AutomaticEventSubscriber.java | 2 +- .../fml/LifecycleEventProvider.java | 2 +- .../net/minecraftforge/fml/ModContainer.java | 2 +- .../java/net/minecraftforge/fml/ModList.java | 4 +- .../net/minecraftforge/fml/ModLoader.java | 2 +- .../fml/ModLoadingException.java | 2 +- .../minecraftforge/fml/ModLoadingStage.java | 12 +- .../fml/client/ClientHooks.java | 2 +- .../fml/client/gui/GuiModList.java | 2 +- .../net/minecraftforge/fml/common/Mod.java | 18 +-- ...ent.java => FMLPostResourceLoadEvent.java} | 7 +- ...vent.java => FMLPreregistrationEvent.java} | 6 +- .../event/FMLServerAboutToStartEvent.java | 4 +- ...nEvent.java => PostRegistrationEvent.java} | 6 +- .../FMLJavaModLanguageProvider.java | 8 +- .../fml/javafmlmod/FMLModContainer.java | 4 +- .../registries/ObjectHolderRegistry.java | 2 +- ...ge.forgespi.language.IModLanguageProvider} | 0 45 files changed, 98 insertions(+), 493 deletions(-) delete mode 100644 src/fmllauncher/java/net/minecraftforge/fml/language/ILifecycleEvent.java delete mode 100644 src/fmllauncher/java/net/minecraftforge/fml/language/IModFileInfo.java delete mode 100644 src/fmllauncher/java/net/minecraftforge/fml/language/IModInfo.java delete mode 100644 src/fmllauncher/java/net/minecraftforge/fml/language/IModLanguageProvider.java delete mode 100644 src/fmllauncher/java/net/minecraftforge/fml/language/ModFileScanData.java delete mode 100644 src/fmllauncher/java/net/minecraftforge/fml/loading/MavenVersionAdapter.java rename src/main/java/net/minecraftforge/fml/common/event/{FMLPostInitializationEvent.java => FMLPostResourceLoadEvent.java} (76%) rename src/main/java/net/minecraftforge/fml/common/event/{FMLPreInitializationEvent.java => FMLPreregistrationEvent.java} (88%) rename src/main/java/net/minecraftforge/fml/common/event/{FMLInitializationEvent.java => PostRegistrationEvent.java} (85%) rename src/main/resources/META-INF/services/{net.minecraftforge.fml.language.IModLanguageProvider => net.minecraftforge.forgespi.language.IModLanguageProvider} (100%) diff --git a/build.gradle b/build.gradle index 1cca2fd59..5d02a3323 100644 --- a/build.gradle +++ b/build.gradle @@ -30,6 +30,7 @@ plugins { id 'net.minecrell.licenser' version '0.4' id 'org.ajoberstar.grgit' version '2.3.0' id 'de.undercouch.download' version '3.3.0' + id "com.github.ben-manes.versions" version '0.20.0' } apply plugin: 'eclipse' @@ -257,16 +258,16 @@ project(':forge') { installer 'org.ow2.asm:asm:6.2' installer 'org.ow2.asm:asm-commons:6.2' installer 'org.ow2.asm:asm-tree:6.2' - installer 'cpw.mods:modlauncher:0.4.0' - installer 'net.minecraftforge:accesstransformers:0.10+:shadowed' - installer 'net.minecraftforge:eventbus:0.1+:service' - installer 'net.minecraftforge:forgespi:0.1+' - installer 'net.minecraftforge:coremods:0.1+' - installer 'com.electronwill.night-config:core:3.4.0' - installer 'com.electronwill.night-config:toml:3.4.0' + installer 'cpw.mods:modlauncher:0.6.0' + installer 'net.minecraftforge:accesstransformers:0.14.+:shadowed' + installer 'net.minecraftforge:eventbus:0.3.+:service' + installer 'net.minecraftforge:forgespi:0.2.+' + installer 'net.minecraftforge:coremods:0.2.+' + installer 'com.electronwill.night-config:core:3.4.2' + installer 'com.electronwill.night-config:toml:3.4.2' installer 'org.jline:jline:3.5.1' - installer 'org.apache.maven:maven-artifact:3.5.3' - installer 'net.jodah:typetools:0.5.0' + installer 'org.apache.maven:maven-artifact:3.6.0' + installer 'net.jodah:typetools:0.6.0' installer 'java3d:vecmath:1.5.2' installer 'org.apache.logging.log4j:log4j-api:2.11.1' installer 'org.apache.logging.log4j:log4j-core:2.11.1' diff --git a/mods.toml b/mods.toml index 0b77473fa..38978c67d 100644 --- a/mods.toml +++ b/mods.toml @@ -7,7 +7,7 @@ updateJSONURL="http://myurl.me/" # A URL to refer people to when problems occur with this mod issueTrackerURL="http://my.issue.tracker/" # Extra mod loader property -randomScalaProperty=fishy +randomScalaProperty="fishy" # Arbitrary key-value property pairs available to mods [properties] key="value" @@ -26,7 +26,7 @@ key="value" others, but this one is mine ''' # A random extra property for a mod loader - randomExtraProperty=somevalue + randomExtraProperty="somevalue" # Arbitrary key-value pairs [inventorysorter.properties] key="value" @@ -39,22 +39,23 @@ key="value" # The version range of the dependency versionRange="[14.23.2.0,)" # An ordering relationship for the dependency - BEFORE or AFTER required if the relationship is not mandatory - ordering=NONE + ordering="NONE" # Side this dependency is applied on - BOTH, CLIENT or SERVER - side=BOTH + side="BOTH" # Here's another dependency [[inventorysorter.dependencies]] modid="minecraft" mandatory=true versionRange="[1.12.2]" - ordering=NONE - side=BOTH + ordering="NONE" + side="BOTH" + # Here's another mod in this jar [[mods]] # Note that other mod types may want to add additional key-value pairs in here modId="inventorysortertoo" - # ${jarVersion} will read the Implementation-Version of the jar file - version="${jarVersion}" + # ${file.jarVersion} will read the Implementation-Version of the jar file + version="${file.jarVersion}" displayName="Inventory Sorter as well" description=''' This is also my mod, there may be diff --git a/src/fmllauncher/java/net/minecraftforge/fml/language/ILifecycleEvent.java b/src/fmllauncher/java/net/minecraftforge/fml/language/ILifecycleEvent.java deleted file mode 100644 index 975a1bbdd..000000000 --- a/src/fmllauncher/java/net/minecraftforge/fml/language/ILifecycleEvent.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Minecraft Forge - * Copyright (c) 2016-2018. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -package net.minecraftforge.fml.language; - -public interface ILifecycleEvent> { - @SuppressWarnings("unchecked") - default R concrete() { - return (R) this; - } -} - diff --git a/src/fmllauncher/java/net/minecraftforge/fml/language/IModFileInfo.java b/src/fmllauncher/java/net/minecraftforge/fml/language/IModFileInfo.java deleted file mode 100644 index bc5f5fe1a..000000000 --- a/src/fmllauncher/java/net/minecraftforge/fml/language/IModFileInfo.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Minecraft Forge - * Copyright (c) 2016-2018. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -package net.minecraftforge.fml.language; - -import com.electronwill.nightconfig.core.UnmodifiableConfig; -import org.apache.maven.artifact.versioning.VersionRange; - -import java.net.URL; -import java.util.List; - -public interface IModFileInfo -{ - List getMods(); - - UnmodifiableConfig getConfig(); - - URL getUpdateURL(IModFileInfo modFileInfo); - - String getModLoader(); - - VersionRange getModLoaderVersion(); -} diff --git a/src/fmllauncher/java/net/minecraftforge/fml/language/IModInfo.java b/src/fmllauncher/java/net/minecraftforge/fml/language/IModInfo.java deleted file mode 100644 index 5bd59459e..000000000 --- a/src/fmllauncher/java/net/minecraftforge/fml/language/IModInfo.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Minecraft Forge - * Copyright (c) 2016-2018. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -package net.minecraftforge.fml.language; - -import com.electronwill.nightconfig.core.UnmodifiableConfig; -import net.minecraftforge.fml.loading.MavenVersionAdapter; -import net.minecraftforge.fml.loading.FMLEnvironment; -import org.apache.maven.artifact.versioning.ArtifactVersion; -import org.apache.maven.artifact.versioning.VersionRange; - -import java.util.List; - -public interface IModInfo -{ - VersionRange UNBOUNDED = MavenVersionAdapter.createFromVersionSpec(""); - - IModFileInfo getOwningFile(); - - String getModId(); - - String getDisplayName(); - - String getDescription(); - - ArtifactVersion getVersion(); - - List getDependencies(); - - UnmodifiableConfig getModConfig(); - - enum Ordering { - BEFORE, AFTER, NONE - } - - enum DependencySide { - CLIENT, SERVER, BOTH; - - public boolean isCorrectSide() - { - return this == BOTH || FMLEnvironment.dist.name().equals(this.name()); - } - } - - class ModVersion { - private IModInfo owner; - private final String modId; - private final VersionRange versionRange; - private final boolean mandatory; - private final Ordering ordering; - private final DependencySide side; - - public ModVersion(final IModInfo owner, final UnmodifiableConfig config) { - this.owner = owner; - this.modId = config.get("modId"); - this.versionRange = config.getOptional("versionRange").map(String.class::cast). - map(MavenVersionAdapter::createFromVersionSpec).orElse(UNBOUNDED); - this.mandatory = config.get("mandatory"); - this.ordering = config.getOptional("ordering").map(String.class::cast). - map(Ordering::valueOf).orElse(Ordering.NONE); - this.side = config.getOptional("side").map(String.class::cast). - map(DependencySide::valueOf).orElse(DependencySide.BOTH); - } - - - public String getModId() - { - return modId; - } - - public VersionRange getVersionRange() - { - return versionRange; - } - - public boolean isMandatory() - { - return mandatory; - } - - public Ordering getOrdering() - { - return ordering; - } - - public DependencySide getSide() - { - return side; - } - - public void setOwner(final IModInfo owner) - { - this.owner = owner; - } - - public IModInfo getOwner() - { - return owner; - } - } -} diff --git a/src/fmllauncher/java/net/minecraftforge/fml/language/IModLanguageProvider.java b/src/fmllauncher/java/net/minecraftforge/fml/language/IModLanguageProvider.java deleted file mode 100644 index aa168ce9c..000000000 --- a/src/fmllauncher/java/net/minecraftforge/fml/language/IModLanguageProvider.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Minecraft Forge - * Copyright (c) 2016-2018. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -package net.minecraftforge.fml.language; - -import java.util.function.Consumer; -import java.util.function.Supplier; - -/** - * Loaded as a ServiceLoader, from the classpath. ExtensionPoint are loaded from - * the mods directory, with the FMLType META-INF of LANGPROVIDER. - * - * Version data is read from the manifest's implementation version. - */ -public interface IModLanguageProvider -{ - String name(); - - Consumer getFileVisitor(); - - > void consumeLifecycleEvent(Supplier consumeEvent); - - interface IModLanguageLoader { - T loadMod(IModInfo info, ClassLoader modClassLoader, ModFileScanData modFileScanResults); - } -} diff --git a/src/fmllauncher/java/net/minecraftforge/fml/language/ModFileScanData.java b/src/fmllauncher/java/net/minecraftforge/fml/language/ModFileScanData.java deleted file mode 100644 index 3a2accc63..000000000 --- a/src/fmllauncher/java/net/minecraftforge/fml/language/ModFileScanData.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Minecraft Forge - * Copyright (c) 2016-2018. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -package net.minecraftforge.fml.language; - - -import org.objectweb.asm.Type; - -import java.lang.annotation.ElementType; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.function.Predicate; - -public class ModFileScanData -{ - private final List annotations = new ArrayList<>(); - private final List classes = new ArrayList<>(); - private Map modTargets; - private Map functionalScanners; - - public static Predicate interestingAnnotations() { - return t->true; - } - - public List getClasses() { - return classes; - } - - public List getAnnotations() { - return annotations; - } - - public void addLanguageLoader(Map modTargetMap) - { - modTargets = modTargetMap; - } - - public Map getTargets() - { - return modTargets; - } - - public static class ClassData { - private final Type clazz; - private final Type parent; - private final Set interfaces; - - public ClassData(final Type clazz, final Type parent, final Set interfaces) { - this.clazz = clazz; - this.parent = parent; - this.interfaces = interfaces; - } - - } - public static class AnnotationData { - private final Type annotationType; - private final ElementType targetType; - private final Type clazz; - private final String memberName; - private final Map annotationData; - - - public AnnotationData(final Type annotationType, final ElementType targetType, final Type clazz, final String memberName, final Map annotationData) { - this.annotationType = annotationType; - this.targetType = targetType; - this.clazz = clazz; - this.memberName = memberName; - this.annotationData = annotationData; - } - - public Type getAnnotationType() { - return annotationType; - } - - public ElementType getTargetType() { - return targetType; - } - - public Type getClassType() { - return clazz; - } - - public String getMemberName() { - return memberName; - } - - public Map getAnnotationData() { - return annotationData; - } - } -} diff --git a/src/fmllauncher/java/net/minecraftforge/fml/loading/DefaultModInfos.java b/src/fmllauncher/java/net/minecraftforge/fml/loading/DefaultModInfos.java index f17e1bbb8..94553cc83 100644 --- a/src/fmllauncher/java/net/minecraftforge/fml/loading/DefaultModInfos.java +++ b/src/fmllauncher/java/net/minecraftforge/fml/loading/DefaultModInfos.java @@ -20,7 +20,7 @@ package net.minecraftforge.fml.loading; import com.electronwill.nightconfig.core.file.FileConfig; -import net.minecraftforge.fml.language.IModInfo; +import net.minecraftforge.forgespi.language.IModInfo; import net.minecraftforge.fml.loading.moddiscovery.ModInfo; import java.io.IOException; diff --git a/src/fmllauncher/java/net/minecraftforge/fml/loading/FMLEnvironment.java b/src/fmllauncher/java/net/minecraftforge/fml/loading/FMLEnvironment.java index ef35e8cf8..4ee84f22a 100644 --- a/src/fmllauncher/java/net/minecraftforge/fml/loading/FMLEnvironment.java +++ b/src/fmllauncher/java/net/minecraftforge/fml/loading/FMLEnvironment.java @@ -19,9 +19,15 @@ package net.minecraftforge.fml.loading; +import cpw.mods.modlauncher.api.IEnvironment; import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.forgespi.Environment; public class FMLEnvironment { public static final Dist dist = FMLLoader.getDist(); + + static void setupInteropEnvironment(IEnvironment environment) { + environment.computePropertyIfAbsent(Environment.Keys.DIST.get(), v->dist); + } } diff --git a/src/fmllauncher/java/net/minecraftforge/fml/loading/FMLLoader.java b/src/fmllauncher/java/net/minecraftforge/fml/loading/FMLLoader.java index 548d35f3a..6427ac9ac 100644 --- a/src/fmllauncher/java/net/minecraftforge/fml/loading/FMLLoader.java +++ b/src/fmllauncher/java/net/minecraftforge/fml/loading/FMLLoader.java @@ -30,19 +30,16 @@ import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.fml.loading.moddiscovery.BackgroundScanHandler; import net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer; import net.minecraftforge.fml.loading.moddiscovery.ModFile; -import net.minecraftforge.forgespi.ICoreModProvider; +import net.minecraftforge.forgespi.coremod.ICoreModProvider; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import java.net.URISyntaxException; import java.net.URL; -import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.*; import java.util.function.Predicate; import java.util.stream.Collectors; -import java.util.stream.Stream; import static net.minecraftforge.fml.loading.LogMarkers.CORE; import static net.minecraftforge.fml.loading.LogMarkers.SCAN; @@ -149,6 +146,7 @@ public class FMLLoader commonLaunchHandler.validatePaths(forgePath, mcPaths, forgeVersion, mcVersion, mcpVersion); commonLaunchHandler.setup(environment, arguments); classLoaderExclusions = commonLaunchHandler.getPackagePredicate(); + languageLoadingProvider = new LanguageLoadingProvider(); languageLoadingProvider.addForgeLanguage(forgePath); @@ -175,26 +173,6 @@ public class FMLLoader return modDiscoverer; } - public static void loadAccessTransformer() - { -/* - final URL resource = FMLLoader.class.getClassLoader().getResource("forge_at.cfg"); - if (resource == null) { - throw new RuntimeException("Missing forge_at.cfg file"); - } - try - { - LOGGER.debug(CORE, "Loading forge_at.cfg into access transformer"); - accessTransformer.addResource(Paths.get(resource.toURI()), "forge_at.cfg"); - } - catch (URISyntaxException e) - { - LOGGER.error("Error loading forge_at.cfg file", e); - throw new RuntimeException(e); - } -*/ - } - public static void addAccessTransformer(Path atPath, ModFile modName) { LOGGER.debug(SCAN, "Adding Access Transformer in {}", modName.getFilePath()); diff --git a/src/fmllauncher/java/net/minecraftforge/fml/loading/FMLServiceProvider.java b/src/fmllauncher/java/net/minecraftforge/fml/loading/FMLServiceProvider.java index 7ffe7ebbb..f7b094ec3 100644 --- a/src/fmllauncher/java/net/minecraftforge/fml/loading/FMLServiceProvider.java +++ b/src/fmllauncher/java/net/minecraftforge/fml/loading/FMLServiceProvider.java @@ -25,6 +25,7 @@ import cpw.mods.modlauncher.api.ITransformer; import cpw.mods.modlauncher.api.IncompatibleEnvironmentException; import joptsimple.ArgumentAcceptingOptionSpec; import joptsimple.OptionSpecBuilder; +import net.minecraftforge.forgespi.Environment; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -79,10 +80,10 @@ public class FMLServiceProvider implements ITransformationService arguments.put("mcpMappings", targetMcpMappings); LOGGER.debug(CORE, "Preparing launch handler"); FMLLoader.setupLaunchHandler(environment, arguments); + FMLEnvironment.setupInteropEnvironment(environment); + Environment.build(environment); LOGGER.debug(CORE,"Initiating mod scan"); FMLLoader.beginModScan(arguments); - LOGGER.debug(CORE, "Loading access transformers"); - FMLLoader.loadAccessTransformer(); } @Override diff --git a/src/fmllauncher/java/net/minecraftforge/fml/loading/LanguageLoadingProvider.java b/src/fmllauncher/java/net/minecraftforge/fml/loading/LanguageLoadingProvider.java index b76937ac5..dcea61977 100644 --- a/src/fmllauncher/java/net/minecraftforge/fml/loading/LanguageLoadingProvider.java +++ b/src/fmllauncher/java/net/minecraftforge/fml/loading/LanguageLoadingProvider.java @@ -20,7 +20,7 @@ package net.minecraftforge.fml.loading; import cpw.mods.modlauncher.ServiceLoaderStreamUtils; -import net.minecraftforge.fml.language.IModLanguageProvider; +import net.minecraftforge.forgespi.language.IModLanguageProvider; import net.minecraftforge.fml.loading.moddiscovery.ExplodedDirectoryLocator; import net.minecraftforge.fml.loading.moddiscovery.ModFile; import org.apache.logging.log4j.LogManager; diff --git a/src/fmllauncher/java/net/minecraftforge/fml/loading/MavenVersionAdapter.java b/src/fmllauncher/java/net/minecraftforge/fml/loading/MavenVersionAdapter.java deleted file mode 100644 index 6e4f294bd..000000000 --- a/src/fmllauncher/java/net/minecraftforge/fml/loading/MavenVersionAdapter.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Minecraft Forge - * Copyright (c) 2016-2018. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -package net.minecraftforge.fml.loading; - -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException; -import org.apache.maven.artifact.versioning.VersionRange; - -import static net.minecraftforge.fml.loading.LogMarkers.CORE; - -public final class MavenVersionAdapter { - private static final Logger LOGGER = LogManager.getLogger(); - private MavenVersionAdapter() {} - - public static VersionRange createFromVersionSpec(final String spec) { - try { - return VersionRange.createFromVersionSpec(spec); - } catch (InvalidVersionSpecificationException e) { - LOGGER.fatal(CORE, "Failed to parse version spec {}", spec, e); - throw new RuntimeException("Failed to parse spec", e); - } - } - -} diff --git a/src/fmllauncher/java/net/minecraftforge/fml/loading/ModSorter.java b/src/fmllauncher/java/net/minecraftforge/fml/loading/ModSorter.java index 789ce8f2e..d62261ab4 100644 --- a/src/fmllauncher/java/net/minecraftforge/fml/loading/ModSorter.java +++ b/src/fmllauncher/java/net/minecraftforge/fml/loading/ModSorter.java @@ -20,7 +20,7 @@ package net.minecraftforge.fml.loading; import net.minecraftforge.fml.loading.toposort.TopologicalSort; -import net.minecraftforge.fml.language.IModInfo; +import net.minecraftforge.forgespi.language.IModInfo; import net.minecraftforge.fml.loading.moddiscovery.ModFile; import net.minecraftforge.fml.loading.moddiscovery.ModFileInfo; import net.minecraftforge.fml.loading.moddiscovery.ModInfo; diff --git a/src/fmllauncher/java/net/minecraftforge/fml/loading/moddiscovery/BackgroundScanHandler.java b/src/fmllauncher/java/net/minecraftforge/fml/loading/moddiscovery/BackgroundScanHandler.java index 7a70d6495..ad64976a8 100644 --- a/src/fmllauncher/java/net/minecraftforge/fml/loading/moddiscovery/BackgroundScanHandler.java +++ b/src/fmllauncher/java/net/minecraftforge/fml/loading/moddiscovery/BackgroundScanHandler.java @@ -19,7 +19,7 @@ package net.minecraftforge.fml.loading.moddiscovery; -import net.minecraftforge.fml.language.ModFileScanData; +import net.minecraftforge.forgespi.language.ModFileScanData; import net.minecraftforge.fml.loading.LoadingModList; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/src/fmllauncher/java/net/minecraftforge/fml/loading/moddiscovery/CoreModFile.java b/src/fmllauncher/java/net/minecraftforge/fml/loading/moddiscovery/CoreModFile.java index b05718ce1..702ada7b4 100644 --- a/src/fmllauncher/java/net/minecraftforge/fml/loading/moddiscovery/CoreModFile.java +++ b/src/fmllauncher/java/net/minecraftforge/fml/loading/moddiscovery/CoreModFile.java @@ -19,7 +19,7 @@ package net.minecraftforge.fml.loading.moddiscovery; -import net.minecraftforge.forgespi.ICoreModFile; +import net.minecraftforge.forgespi.coremod.ICoreModFile; import java.io.IOException; import java.io.Reader; diff --git a/src/fmllauncher/java/net/minecraftforge/fml/loading/moddiscovery/InvalidModFileException.java b/src/fmllauncher/java/net/minecraftforge/fml/loading/moddiscovery/InvalidModFileException.java index ead0e4b8a..5515a23c0 100644 --- a/src/fmllauncher/java/net/minecraftforge/fml/loading/moddiscovery/InvalidModFileException.java +++ b/src/fmllauncher/java/net/minecraftforge/fml/loading/moddiscovery/InvalidModFileException.java @@ -19,7 +19,7 @@ package net.minecraftforge.fml.loading.moddiscovery; -import net.minecraftforge.fml.language.IModFileInfo; +import net.minecraftforge.forgespi.language.IModFileInfo; public class InvalidModFileException extends RuntimeException { diff --git a/src/fmllauncher/java/net/minecraftforge/fml/loading/moddiscovery/ModAnnotation.java b/src/fmllauncher/java/net/minecraftforge/fml/loading/moddiscovery/ModAnnotation.java index e0781b2b5..7f2a9d41a 100644 --- a/src/fmllauncher/java/net/minecraftforge/fml/loading/moddiscovery/ModAnnotation.java +++ b/src/fmllauncher/java/net/minecraftforge/fml/loading/moddiscovery/ModAnnotation.java @@ -23,7 +23,7 @@ import java.lang.annotation.ElementType; import java.util.ArrayList; import java.util.Map; -import net.minecraftforge.fml.language.ModFileScanData; +import net.minecraftforge.forgespi.language.ModFileScanData; import org.objectweb.asm.Type; import com.google.common.base.MoreObjects; diff --git a/src/fmllauncher/java/net/minecraftforge/fml/loading/moddiscovery/ModClassVisitor.java b/src/fmllauncher/java/net/minecraftforge/fml/loading/moddiscovery/ModClassVisitor.java index 011f5b3a2..d8b90c7f9 100644 --- a/src/fmllauncher/java/net/minecraftforge/fml/loading/moddiscovery/ModClassVisitor.java +++ b/src/fmllauncher/java/net/minecraftforge/fml/loading/moddiscovery/ModClassVisitor.java @@ -19,7 +19,7 @@ package net.minecraftforge.fml.loading.moddiscovery; -import net.minecraftforge.fml.language.ModFileScanData; +import net.minecraftforge.forgespi.language.ModFileScanData; import org.objectweb.asm.AnnotationVisitor; import org.objectweb.asm.ClassVisitor; import org.objectweb.asm.FieldVisitor; diff --git a/src/fmllauncher/java/net/minecraftforge/fml/loading/moddiscovery/ModFile.java b/src/fmllauncher/java/net/minecraftforge/fml/loading/moddiscovery/ModFile.java index a062d39fe..8dc3d4a08 100644 --- a/src/fmllauncher/java/net/minecraftforge/fml/loading/moddiscovery/ModFile.java +++ b/src/fmllauncher/java/net/minecraftforge/fml/loading/moddiscovery/ModFile.java @@ -20,11 +20,11 @@ package net.minecraftforge.fml.loading.moddiscovery; import com.google.common.collect.ImmutableMap; -import net.minecraftforge.fml.language.IModFileInfo; -import net.minecraftforge.fml.language.IModInfo; -import net.minecraftforge.fml.language.ModFileScanData; +import net.minecraftforge.forgespi.language.IModFileInfo; +import net.minecraftforge.forgespi.language.IModInfo; +import net.minecraftforge.forgespi.language.ModFileScanData; import net.minecraftforge.fml.loading.FMLLoader; -import net.minecraftforge.fml.language.IModLanguageProvider; +import net.minecraftforge.forgespi.language.IModLanguageProvider; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/src/fmllauncher/java/net/minecraftforge/fml/loading/moddiscovery/ModFileInfo.java b/src/fmllauncher/java/net/minecraftforge/fml/loading/moddiscovery/ModFileInfo.java index 8ce946fbb..c72ad458b 100644 --- a/src/fmllauncher/java/net/minecraftforge/fml/loading/moddiscovery/ModFileInfo.java +++ b/src/fmllauncher/java/net/minecraftforge/fml/loading/moddiscovery/ModFileInfo.java @@ -20,9 +20,9 @@ package net.minecraftforge.fml.loading.moddiscovery; import com.electronwill.nightconfig.core.UnmodifiableConfig; -import net.minecraftforge.fml.loading.MavenVersionAdapter; -import net.minecraftforge.fml.language.IModFileInfo; -import net.minecraftforge.fml.language.IModInfo; +import net.minecraftforge.forgespi.language.MavenVersionAdapter; +import net.minecraftforge.forgespi.language.IModFileInfo; +import net.minecraftforge.forgespi.language.IModInfo; import net.minecraftforge.fml.loading.StringUtils; import org.apache.maven.artifact.versioning.VersionRange; diff --git a/src/fmllauncher/java/net/minecraftforge/fml/loading/moddiscovery/ModFileParser.java b/src/fmllauncher/java/net/minecraftforge/fml/loading/moddiscovery/ModFileParser.java index aae0c5fdb..e471d3ce9 100644 --- a/src/fmllauncher/java/net/minecraftforge/fml/loading/moddiscovery/ModFileParser.java +++ b/src/fmllauncher/java/net/minecraftforge/fml/loading/moddiscovery/ModFileParser.java @@ -22,7 +22,7 @@ package net.minecraftforge.fml.loading.moddiscovery; import com.electronwill.nightconfig.core.file.FileConfig; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; -import net.minecraftforge.fml.language.IModFileInfo; +import net.minecraftforge.forgespi.language.IModFileInfo; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/src/fmllauncher/java/net/minecraftforge/fml/loading/moddiscovery/ModInfo.java b/src/fmllauncher/java/net/minecraftforge/fml/loading/moddiscovery/ModInfo.java index 19a082958..6030b5623 100644 --- a/src/fmllauncher/java/net/minecraftforge/fml/loading/moddiscovery/ModInfo.java +++ b/src/fmllauncher/java/net/minecraftforge/fml/loading/moddiscovery/ModInfo.java @@ -20,7 +20,7 @@ package net.minecraftforge.fml.loading.moddiscovery; import com.electronwill.nightconfig.core.UnmodifiableConfig; -import net.minecraftforge.fml.language.IModInfo; +import net.minecraftforge.forgespi.language.IModInfo; import net.minecraftforge.fml.loading.StringSubstitutor; import java.util.Arrays; diff --git a/src/fmllauncher/java/net/minecraftforge/fml/loading/moddiscovery/Scanner.java b/src/fmllauncher/java/net/minecraftforge/fml/loading/moddiscovery/Scanner.java index ba743a30a..7a9f4526c 100644 --- a/src/fmllauncher/java/net/minecraftforge/fml/loading/moddiscovery/Scanner.java +++ b/src/fmllauncher/java/net/minecraftforge/fml/loading/moddiscovery/Scanner.java @@ -19,8 +19,8 @@ package net.minecraftforge.fml.loading.moddiscovery; -import net.minecraftforge.fml.language.IModLanguageProvider; -import net.minecraftforge.fml.language.ModFileScanData; +import net.minecraftforge.forgespi.language.IModLanguageProvider; +import net.minecraftforge.forgespi.language.ModFileScanData; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.objectweb.asm.ClassReader; diff --git a/src/main/java/net/minecraftforge/common/ForgeConfig.java b/src/main/java/net/minecraftforge/common/ForgeConfig.java index 5b18a9e99..e0fe66ccc 100644 --- a/src/main/java/net/minecraftforge/common/ForgeConfig.java +++ b/src/main/java/net/minecraftforge/common/ForgeConfig.java @@ -354,7 +354,7 @@ public class ForgeConfig } @Subscribe - public void postInit(FMLPostInitializationEvent evt) + public void postInit(FMLPostResourceLoadEvent evt) { ForgeChunkManager.loadConfiguration(); } diff --git a/src/main/java/net/minecraftforge/common/ForgeMod.java b/src/main/java/net/minecraftforge/common/ForgeMod.java index 57b615fb7..5eb09b6bc 100644 --- a/src/main/java/net/minecraftforge/common/ForgeMod.java +++ b/src/main/java/net/minecraftforge/common/ForgeMod.java @@ -22,7 +22,12 @@ package net.minecraftforge.common; import net.minecraftforge.fml.FMLWorldPersistenceHook; import net.minecraftforge.fml.VersionChecker; import net.minecraftforge.fml.WorldPersistenceHooks; +import net.minecraftforge.fml.common.event.FMLLoadCompleteEvent; +import net.minecraftforge.fml.common.event.FMLModIdMappingEvent; +import net.minecraftforge.fml.common.event.FMLPostResourceLoadEvent; +import net.minecraftforge.fml.common.event.FMLPreregistrationEvent; import net.minecraftforge.fml.common.event.FMLServerStartingEvent; +import net.minecraftforge.fml.common.event.FMLServerStoppingEvent; import net.minecraftforge.fml.javafmlmod.FMLModLoadingContext; import net.minecraftforge.server.command.ForgeCommand; import net.minecraftforge.versions.forge.ForgeVersion; @@ -39,11 +44,6 @@ import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.fluids.UniversalBucket; import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.common.event.FMLLoadCompleteEvent; -import net.minecraftforge.fml.common.event.FMLModIdMappingEvent; -import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; -import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; -import net.minecraftforge.fml.common.event.FMLServerStoppingEvent; import net.minecraftforge.fml.common.gameevent.PlayerEvent; import org.apache.logging.log4j.Marker; import org.apache.logging.log4j.MarkerManager; @@ -107,7 +107,7 @@ public class ForgeMod implements WorldPersistenceHooks.WorldPersistenceHook } - public void preInit(FMLPreInitializationEvent evt) + public void preInit(FMLPreregistrationEvent evt) { CapabilityItemHandler.register(); CapabilityFluidHandler.register(); @@ -136,7 +136,7 @@ public class ForgeMod implements WorldPersistenceHooks.WorldPersistenceHook } */ - public void postInit(FMLPostInitializationEvent evt) + public void postInit(FMLPostResourceLoadEvent evt) { registerAllBiomesAndGenerateEvents(); //ForgeChunkManager.loadConfiguration(); diff --git a/src/main/java/net/minecraftforge/common/capabilities/CapabilityManager.java b/src/main/java/net/minecraftforge/common/capabilities/CapabilityManager.java index 1466d954a..fedd4a494 100644 --- a/src/main/java/net/minecraftforge/common/capabilities/CapabilityManager.java +++ b/src/main/java/net/minecraftforge/common/capabilities/CapabilityManager.java @@ -30,7 +30,7 @@ import java.util.List; import java.util.Objects; import java.util.concurrent.Callable; -import net.minecraftforge.fml.language.ModFileScanData; +import net.minecraftforge.forgespi.language.ModFileScanData; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.objectweb.asm.Type; diff --git a/src/main/java/net/minecraftforge/fml/AutomaticEventSubscriber.java b/src/main/java/net/minecraftforge/fml/AutomaticEventSubscriber.java index 2621914bf..bbb8dcb22 100644 --- a/src/main/java/net/minecraftforge/fml/AutomaticEventSubscriber.java +++ b/src/main/java/net/minecraftforge/fml/AutomaticEventSubscriber.java @@ -22,7 +22,7 @@ package net.minecraftforge.fml; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.language.ModFileScanData; +import net.minecraftforge.forgespi.language.ModFileScanData; import net.minecraftforge.fml.loading.FMLEnvironment; import net.minecraftforge.fml.loading.moddiscovery.ModAnnotation; import org.apache.logging.log4j.LogManager; diff --git a/src/main/java/net/minecraftforge/fml/LifecycleEventProvider.java b/src/main/java/net/minecraftforge/fml/LifecycleEventProvider.java index aab6b2375..b2885bd0d 100644 --- a/src/main/java/net/minecraftforge/fml/LifecycleEventProvider.java +++ b/src/main/java/net/minecraftforge/fml/LifecycleEventProvider.java @@ -21,7 +21,7 @@ package net.minecraftforge.fml; import net.minecraftforge.fml.common.event.ModLifecycleEvent; import net.minecraftforge.fml.javafmlmod.FMLModContainer; -import net.minecraftforge.fml.language.ILifecycleEvent; +import net.minecraftforge.forgespi.language.ILifecycleEvent; import java.util.List; import java.util.function.Consumer; diff --git a/src/main/java/net/minecraftforge/fml/ModContainer.java b/src/main/java/net/minecraftforge/fml/ModContainer.java index 2d89596f4..09c4de080 100644 --- a/src/main/java/net/minecraftforge/fml/ModContainer.java +++ b/src/main/java/net/minecraftforge/fml/ModContainer.java @@ -19,7 +19,7 @@ package net.minecraftforge.fml; -import net.minecraftforge.fml.language.IModInfo; +import net.minecraftforge.forgespi.language.IModInfo; import java.util.Collections; import java.util.HashMap; diff --git a/src/main/java/net/minecraftforge/fml/ModList.java b/src/main/java/net/minecraftforge/fml/ModList.java index d7d99fd29..e5aa1e851 100644 --- a/src/main/java/net/minecraftforge/fml/ModList.java +++ b/src/main/java/net/minecraftforge/fml/ModList.java @@ -19,9 +19,7 @@ package net.minecraftforge.fml; -import com.google.common.collect.Streams; -import net.minecraftforge.fml.language.ModFileScanData; -import net.minecraftforge.fml.loading.DefaultModInfos; +import net.minecraftforge.forgespi.language.ModFileScanData; import net.minecraftforge.fml.loading.FMLLoader; import net.minecraftforge.fml.loading.moddiscovery.ModFile; import net.minecraftforge.fml.loading.moddiscovery.ModFileInfo; diff --git a/src/main/java/net/minecraftforge/fml/ModLoader.java b/src/main/java/net/minecraftforge/fml/ModLoader.java index 12c8f90fc..a7d58347c 100644 --- a/src/main/java/net/minecraftforge/fml/ModLoader.java +++ b/src/main/java/net/minecraftforge/fml/ModLoader.java @@ -24,7 +24,7 @@ import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.client.event.ModelRegistryEvent; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.capabilities.CapabilityManager; -import net.minecraftforge.fml.language.IModInfo; +import net.minecraftforge.forgespi.language.IModInfo; import net.minecraftforge.fml.loading.FMLLoader; import net.minecraftforge.fml.loading.LoadingModList; import net.minecraftforge.fml.loading.moddiscovery.ModFile; diff --git a/src/main/java/net/minecraftforge/fml/ModLoadingException.java b/src/main/java/net/minecraftforge/fml/ModLoadingException.java index 7ebbdfa49..6458df027 100644 --- a/src/main/java/net/minecraftforge/fml/ModLoadingException.java +++ b/src/main/java/net/minecraftforge/fml/ModLoadingException.java @@ -20,7 +20,7 @@ package net.minecraftforge.fml; import com.google.common.collect.Streams; -import net.minecraftforge.fml.language.IModInfo; +import net.minecraftforge.forgespi.language.IModInfo; import net.minecraftforge.fml.loading.EarlyLoadingException; import java.util.Arrays; diff --git a/src/main/java/net/minecraftforge/fml/ModLoadingStage.java b/src/main/java/net/minecraftforge/fml/ModLoadingStage.java index 7b9494a8d..8d1ce28e1 100644 --- a/src/main/java/net/minecraftforge/fml/ModLoadingStage.java +++ b/src/main/java/net/minecraftforge/fml/ModLoadingStage.java @@ -19,10 +19,10 @@ package net.minecraftforge.fml; -import net.minecraftforge.fml.common.event.FMLInitializationEvent; +import net.minecraftforge.fml.common.event.PostRegistrationEvent; import net.minecraftforge.fml.common.event.FMLLoadCompleteEvent; -import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; -import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; +import net.minecraftforge.fml.common.event.FMLPostResourceLoadEvent; +import net.minecraftforge.fml.common.event.FMLPreregistrationEvent; import net.minecraftforge.fml.common.event.ModLifecycleEvent; import java.util.function.Function; @@ -33,10 +33,10 @@ public enum ModLoadingStage ERROR(null), VALIDATE(null), CONSTRUCT(null), - PREINIT(()->FMLPreInitializationEvent::new), + PREINIT(()-> FMLPreregistrationEvent::new), SIDEDINIT(SidedProvider.SIDEDINIT::get), - INIT(()->FMLInitializationEvent::new), - POSTINIT(()->FMLPostInitializationEvent::new), + INIT(()-> PostRegistrationEvent::new), + POSTINIT(()-> FMLPostResourceLoadEvent::new), COMPLETE(()->FMLLoadCompleteEvent::new), DONE(null); diff --git a/src/main/java/net/minecraftforge/fml/client/ClientHooks.java b/src/main/java/net/minecraftforge/fml/client/ClientHooks.java index 0d33a94cb..f2601258d 100644 --- a/src/main/java/net/minecraftforge/fml/client/ClientHooks.java +++ b/src/main/java/net/minecraftforge/fml/client/ClientHooks.java @@ -62,7 +62,7 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.world.storage.WorldSummary; import net.minecraftforge.fml.StartupQuery; import net.minecraftforge.fml.client.gui.GuiAccessDenied; -import net.minecraftforge.fml.language.IModInfo; +import net.minecraftforge.forgespi.language.IModInfo; import net.minecraftforge.fml.packs.ModFileResourcePack; import net.minecraftforge.registries.GameData; diff --git a/src/main/java/net/minecraftforge/fml/client/gui/GuiModList.java b/src/main/java/net/minecraftforge/fml/client/gui/GuiModList.java index 48357e375..a53070f8a 100644 --- a/src/main/java/net/minecraftforge/fml/client/gui/GuiModList.java +++ b/src/main/java/net/minecraftforge/fml/client/gui/GuiModList.java @@ -40,7 +40,7 @@ import net.minecraftforge.common.ForgeHooks; import net.minecraftforge.fml.*; import net.minecraftforge.fml.client.ConfigGuiHandler; import net.minecraftforge.fml.packs.ResourcePackLoader; -import net.minecraftforge.fml.language.IModInfo; +import net.minecraftforge.forgespi.language.IModInfo; import net.minecraftforge.fml.loading.StringUtils; import net.minecraftforge.fml.loading.moddiscovery.ModInfo; import org.apache.commons.lang3.tuple.Pair; diff --git a/src/main/java/net/minecraftforge/fml/common/Mod.java b/src/main/java/net/minecraftforge/fml/common/Mod.java index be2c903bd..d73a8bc0f 100644 --- a/src/main/java/net/minecraftforge/fml/common/Mod.java +++ b/src/main/java/net/minecraftforge/fml/common/Mod.java @@ -25,16 +25,16 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.fml.common.event.ModLifecycleEvent; import net.minecraftforge.fml.common.event.FMLFingerprintViolationEvent; -import net.minecraftforge.fml.common.event.FMLInitializationEvent; -import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; -import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; +import net.minecraftforge.fml.common.event.FMLPostResourceLoadEvent; +import net.minecraftforge.fml.common.event.FMLPreregistrationEvent; import net.minecraftforge.fml.common.event.FMLServerAboutToStartEvent; import net.minecraftforge.fml.common.event.FMLServerStartedEvent; import net.minecraftforge.fml.common.event.FMLServerStartingEvent; import net.minecraftforge.fml.common.event.FMLServerStoppedEvent; import net.minecraftforge.fml.common.event.FMLServerStoppingEvent; +import net.minecraftforge.fml.common.event.ModLifecycleEvent; +import net.minecraftforge.fml.common.event.PostRegistrationEvent; import net.minecraftforge.fml.common.registry.GameRegistry; /** @@ -67,11 +67,11 @@ public @interface Mod * * These suggestions are mostly just suggestions on what to do in each event. *
    - *
  • {@link FMLPreInitializationEvent} : Run before anything else. Read your config, create blocks, + *
  • {@link FMLPreregistrationEvent} : Run before anything else. Read your config, create blocks, * items, etc, and register them with the {@link GameRegistry}.
  • - *
  • {@link FMLInitializationEvent} : Do your mod setup. Build whatever data structures you care about. Register recipes, + *
  • {@link PostRegistrationEvent} : Do your mod setup. Build whatever data structures you care about. Register recipes, * send {@link FMLInterModComms} messages to other mods.
  • - *
  • {@link FMLPostInitializationEvent} : Handle interaction with other mods, complete your setup based on this.
  • + *
  • {@link FMLPostResourceLoadEvent} : Handle interaction with other mods, complete your setup based on this.
  • *
*

These are the server lifecycle events. They are fired whenever a server is running, or about to run. Each time a server * starts they will be fired in this sequence. @@ -86,9 +86,9 @@ public @interface Mod * The second set of events are more specialized, for receiving notification of specific * information. *

    - *
  • {@link FMLFingerprintViolationEvent} : Sent just before {@link FMLPreInitializationEvent} + *
  • {@link FMLFingerprintViolationEvent} : Sent just before {@link FMLPreregistrationEvent} * if something is wrong with your mod signature
  • - *
  • {@link IMCEvent} : Sent just after {@link FMLInitializationEvent} if you have IMC messages waiting + *
  • {@link IMCEvent} : Sent just after {@link PostRegistrationEvent} if you have IMC messages waiting * from other mods
  • *
* diff --git a/src/main/java/net/minecraftforge/fml/common/event/FMLPostInitializationEvent.java b/src/main/java/net/minecraftforge/fml/common/event/FMLPostResourceLoadEvent.java similarity index 76% rename from src/main/java/net/minecraftforge/fml/common/event/FMLPostInitializationEvent.java rename to src/main/java/net/minecraftforge/fml/common/event/FMLPostResourceLoadEvent.java index f11f9beeb..00b45d0b2 100644 --- a/src/main/java/net/minecraftforge/fml/common/event/FMLPostInitializationEvent.java +++ b/src/main/java/net/minecraftforge/fml/common/event/FMLPostResourceLoadEvent.java @@ -22,17 +22,16 @@ package net.minecraftforge.fml.common.event; import net.minecraftforge.fml.ModContainer; /** - * Called after {@link FMLInitializationEvent} has been dispatched on every mod. This is the third and last + * Called after {@link PostRegistrationEvent} has been dispatched on every mod. This is the third and last * commonly called event during mod initialization. * * Recommended activities: interact with other mods to establish cross-mod behaviours. * - * @see net.minecraftforge.fml.common.Mod.EventHandler for how to subscribe to this event * @author cpw */ -public class FMLPostInitializationEvent extends ModLifecycleEvent +public class FMLPostResourceLoadEvent extends ModLifecycleEvent { - public FMLPostInitializationEvent(final ModContainer container) + public FMLPostResourceLoadEvent(final ModContainer container) { super(container); } diff --git a/src/main/java/net/minecraftforge/fml/common/event/FMLPreInitializationEvent.java b/src/main/java/net/minecraftforge/fml/common/event/FMLPreregistrationEvent.java similarity index 88% rename from src/main/java/net/minecraftforge/fml/common/event/FMLPreInitializationEvent.java rename to src/main/java/net/minecraftforge/fml/common/event/FMLPreregistrationEvent.java index d8d31bfb4..f37223255 100644 --- a/src/main/java/net/minecraftforge/fml/common/event/FMLPreInitializationEvent.java +++ b/src/main/java/net/minecraftforge/fml/common/event/FMLPreregistrationEvent.java @@ -22,7 +22,7 @@ package net.minecraftforge.fml.common.event; import net.minecraftforge.fml.ModContainer; /** - * Called before {@link FMLInitializationEvent} during mod startup. + * Called before {@link PostRegistrationEvent} during mod startup. * * This is the first of three commonly called events during mod initialization. * @@ -36,9 +36,9 @@ import net.minecraftforge.fml.ModContainer; * @see net.minecraftforge.fml.common.Mod.EventHandler for how to subscribe to this event * @author cpw */ -public class FMLPreInitializationEvent extends ModLifecycleEvent +public class FMLPreregistrationEvent extends ModLifecycleEvent { - public FMLPreInitializationEvent(final ModContainer container) + public FMLPreregistrationEvent(final ModContainer container) { super(container); } diff --git a/src/main/java/net/minecraftforge/fml/common/event/FMLServerAboutToStartEvent.java b/src/main/java/net/minecraftforge/fml/common/event/FMLServerAboutToStartEvent.java index 8a73f0d81..232cbdc64 100644 --- a/src/main/java/net/minecraftforge/fml/common/event/FMLServerAboutToStartEvent.java +++ b/src/main/java/net/minecraftforge/fml/common/event/FMLServerAboutToStartEvent.java @@ -19,12 +19,10 @@ package net.minecraftforge.fml.common.event; -import com.mojang.brigadier.CommandDispatcher; -import net.minecraft.command.CommandSource; import net.minecraft.server.MinecraftServer; /** - * Called before the server begins loading anything. Called after {@link FMLPostInitializationEvent} on the dedicated + * Called before the server begins loading anything. Called after {@link FMLPostResourceLoadEvent} on the dedicated * server, and after the player has hit "Play Selected World" in the client. Called before {@link FMLServerStartingEvent}. * * You can obtain a reference to the server with this event. diff --git a/src/main/java/net/minecraftforge/fml/common/event/FMLInitializationEvent.java b/src/main/java/net/minecraftforge/fml/common/event/PostRegistrationEvent.java similarity index 85% rename from src/main/java/net/minecraftforge/fml/common/event/FMLInitializationEvent.java rename to src/main/java/net/minecraftforge/fml/common/event/PostRegistrationEvent.java index 7743ed9bd..619d3ee5d 100644 --- a/src/main/java/net/minecraftforge/fml/common/event/FMLInitializationEvent.java +++ b/src/main/java/net/minecraftforge/fml/common/event/PostRegistrationEvent.java @@ -22,7 +22,7 @@ package net.minecraftforge.fml.common.event; import net.minecraftforge.fml.ModContainer; /** - * Called after {@link FMLPreInitializationEvent} and before {@link FMLPostInitializationEvent} during mod + * Called after {@link FMLPreregistrationEvent} and before {@link FMLPostResourceLoadEvent} during mod * startup. * * This is the second of three commonly called events during mod initialization. @@ -34,10 +34,10 @@ import net.minecraftforge.fml.ModContainer; * @see net.minecraftforge.fml.common.Mod.EventHandler for how to subscribe to this event * @author cpw */ -public class FMLInitializationEvent extends ModLifecycleEvent +public class PostRegistrationEvent extends ModLifecycleEvent { - public FMLInitializationEvent(final ModContainer container) + public PostRegistrationEvent(final ModContainer container) { super(container); } diff --git a/src/main/java/net/minecraftforge/fml/javafmlmod/FMLJavaModLanguageProvider.java b/src/main/java/net/minecraftforge/fml/javafmlmod/FMLJavaModLanguageProvider.java index 151b40e2b..e32d55ea0 100644 --- a/src/main/java/net/minecraftforge/fml/javafmlmod/FMLJavaModLanguageProvider.java +++ b/src/main/java/net/minecraftforge/fml/javafmlmod/FMLJavaModLanguageProvider.java @@ -19,10 +19,10 @@ package net.minecraftforge.fml.javafmlmod; -import net.minecraftforge.fml.language.ILifecycleEvent; -import net.minecraftforge.fml.language.IModLanguageProvider; -import net.minecraftforge.fml.language.IModInfo; -import net.minecraftforge.fml.language.ModFileScanData; +import net.minecraftforge.forgespi.language.ILifecycleEvent; +import net.minecraftforge.forgespi.language.IModLanguageProvider; +import net.minecraftforge.forgespi.language.IModInfo; +import net.minecraftforge.forgespi.language.ModFileScanData; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.objectweb.asm.Type; diff --git a/src/main/java/net/minecraftforge/fml/javafmlmod/FMLModContainer.java b/src/main/java/net/minecraftforge/fml/javafmlmod/FMLModContainer.java index 150f89f1f..59d274b02 100644 --- a/src/main/java/net/minecraftforge/fml/javafmlmod/FMLModContainer.java +++ b/src/main/java/net/minecraftforge/fml/javafmlmod/FMLModContainer.java @@ -30,8 +30,8 @@ import net.minecraftforge.fml.ModLoadingException; import net.minecraftforge.fml.ModLoadingStage; import net.minecraftforge.fml.ModThreadContext; import net.minecraftforge.fml.common.event.ModLifecycleEvent; -import net.minecraftforge.fml.language.IModInfo; -import net.minecraftforge.fml.language.ModFileScanData; +import net.minecraftforge.forgespi.language.IModInfo; +import net.minecraftforge.forgespi.language.ModFileScanData; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/src/main/java/net/minecraftforge/registries/ObjectHolderRegistry.java b/src/main/java/net/minecraftforge/registries/ObjectHolderRegistry.java index 66ec9f9e2..bc67eea8c 100644 --- a/src/main/java/net/minecraftforge/registries/ObjectHolderRegistry.java +++ b/src/main/java/net/minecraftforge/registries/ObjectHolderRegistry.java @@ -31,7 +31,7 @@ import java.util.stream.Collectors; import net.minecraftforge.fml.ModList; import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.language.ModFileScanData; +import net.minecraftforge.forgespi.language.ModFileScanData; import com.google.common.collect.Maps; diff --git a/src/main/resources/META-INF/services/net.minecraftforge.fml.language.IModLanguageProvider b/src/main/resources/META-INF/services/net.minecraftforge.forgespi.language.IModLanguageProvider similarity index 100% rename from src/main/resources/META-INF/services/net.minecraftforge.fml.language.IModLanguageProvider rename to src/main/resources/META-INF/services/net.minecraftforge.forgespi.language.IModLanguageProvider