Update a bunch of libs, rename some of the mod events to more

meaningful names.
This commit is contained in:
cpw 2019-01-13 22:51:36 -05:00
parent eb42614288
commit 99452a8b45
45 changed files with 98 additions and 493 deletions

View file

@ -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'

View file

@ -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

View file

@ -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<R extends ILifecycleEvent<?>> {
@SuppressWarnings("unchecked")
default R concrete() {
return (R) this;
}
}

View file

@ -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<IModInfo> getMods();
UnmodifiableConfig getConfig();
URL getUpdateURL(IModFileInfo modFileInfo);
String getModLoader();
VersionRange getModLoaderVersion();
}

View file

@ -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<ModVersion> 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;
}
}
}

View file

@ -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<ModFileScanData> getFileVisitor();
<R extends ILifecycleEvent<R>> void consumeLifecycleEvent(Supplier<R> consumeEvent);
interface IModLanguageLoader {
<T> T loadMod(IModInfo info, ClassLoader modClassLoader, ModFileScanData modFileScanResults);
}
}

View file

@ -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<ModFileScanData.AnnotationData> annotations = new ArrayList<>();
private final List<ModFileScanData.ClassData> classes = new ArrayList<>();
private Map<String,? extends IModLanguageProvider.IModLanguageLoader> modTargets;
private Map<String,?> functionalScanners;
public static Predicate<Type> interestingAnnotations() {
return t->true;
}
public List<ModFileScanData.ClassData> getClasses() {
return classes;
}
public List<ModFileScanData.AnnotationData> getAnnotations() {
return annotations;
}
public void addLanguageLoader(Map<String,? extends IModLanguageProvider.IModLanguageLoader> modTargetMap)
{
modTargets = modTargetMap;
}
public Map<String, ? extends IModLanguageProvider.IModLanguageLoader> getTargets()
{
return modTargets;
}
public static class ClassData {
private final Type clazz;
private final Type parent;
private final Set<Type> interfaces;
public ClassData(final Type clazz, final Type parent, final Set<Type> 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<String,Object> annotationData;
public AnnotationData(final Type annotationType, final ElementType targetType, final Type clazz, final String memberName, final Map<String, Object> 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<String, Object> getAnnotationData() {
return annotationData;
}
}
}

View file

@ -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;

View file

@ -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);
}
}

View file

@ -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());

View file

@ -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

View file

@ -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;

View file

@ -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);
}
}
}

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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
{

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -354,7 +354,7 @@ public class ForgeConfig
}
@Subscribe
public void postInit(FMLPostInitializationEvent evt)
public void postInit(FMLPostResourceLoadEvent evt)
{
ForgeChunkManager.loadConfiguration();
}

View file

@ -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();

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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);

View file

@ -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;

View file

@ -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;

View file

@ -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.
* <ul>
* <li> {@link FMLPreInitializationEvent} : Run before anything else. Read your config, create blocks,
* <li> {@link FMLPreregistrationEvent} : Run before anything else. Read your config, create blocks,
* items, etc, and register them with the {@link GameRegistry}.</li>
* <li> {@link FMLInitializationEvent} : Do your mod setup. Build whatever data structures you care about. Register recipes,
* <li> {@link PostRegistrationEvent} : Do your mod setup. Build whatever data structures you care about. Register recipes,
* send {@link FMLInterModComms} messages to other mods.</li>
* <li> {@link FMLPostInitializationEvent} : Handle interaction with other mods, complete your setup based on this.</li>
* <li> {@link FMLPostResourceLoadEvent} : Handle interaction with other mods, complete your setup based on this.</li>
* </ul>
* <p>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.
* <ul>
* <li> {@link FMLFingerprintViolationEvent} : Sent just before {@link FMLPreInitializationEvent}
* <li> {@link FMLFingerprintViolationEvent} : Sent just before {@link FMLPreregistrationEvent}
* if something is wrong with your mod signature</li>
* <li> {@link IMCEvent} : Sent just after {@link FMLInitializationEvent} if you have IMC messages waiting
* <li> {@link IMCEvent} : Sent just after {@link PostRegistrationEvent} if you have IMC messages waiting
* from other mods</li>
* </ul>
*

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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.

View file

@ -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);
}

View file

@ -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;

View file

@ -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;

View file

@ -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;