Move the version packages somewhere that is now filtered so it doesn't

load twice.
This commit is contained in:
cpw 2018-10-04 19:28:45 -04:00
parent 978d0ff2e3
commit ca765b857b
26 changed files with 48 additions and 89 deletions

View file

@ -561,7 +561,7 @@ project(':forge') {
'Implementation-Title': 'Forge',
'Implementation-Version': project.version.substring(MC_VERSION.length() + 1),
'Implementation-Vendor': 'Forge Development LLC'
] as LinkedHashMap, 'net/minecraftforge/common/')
] as LinkedHashMap, 'net/minecraftforge/versions/forge/')
manifest.attributes([
'Specification-Title': 'Minecraft',
'Specification-Vendor': 'Mojang',
@ -569,7 +569,7 @@ project(':forge') {
'Implementation-Title': 'MCP',
'Implementation-Version': MCP_VERSION,
'Implementation-Vendor': 'Forge'
] as LinkedHashMap, 'net/minecraftforge/mcp/')
] as LinkedHashMap, 'net/minecraftforge/versions/mcp/')
}
}

View file

@ -126,7 +126,7 @@ import net.minecraftforge.client.resource.IResourceType;
import net.minecraftforge.client.resource.SelectiveReloadStateHandler;
import net.minecraftforge.client.resource.VanillaResourceType;
import net.minecraftforge.common.ForgeMod;
import net.minecraftforge.common.ForgeVersion;
import net.minecraftforge.versions.forge.ForgeVersion;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.model.IModelPart;
import net.minecraftforge.common.model.ITransformation;

View file

@ -32,7 +32,7 @@ import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.resources.I18n;
import net.minecraftforge.common.ForgeChunkManager;
import net.minecraftforge.common.ForgeMod;
import net.minecraftforge.common.ForgeVersion;
import net.minecraftforge.versions.forge.ForgeVersion;
import net.minecraftforge.common.config.ConfigCategory;
import net.minecraftforge.common.config.ConfigElement;
import net.minecraftforge.common.config.Configuration;

View file

@ -27,7 +27,7 @@ import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.common.ForgeMod;
import net.minecraftforge.common.ForgeVersion;
import net.minecraftforge.versions.forge.ForgeVersion;
import net.minecraftforge.fml.VersionChecker;
import net.minecraftforge.fml.client.ClientModLoader;
import net.minecraftforge.api.distmarker.Dist;

View file

@ -21,7 +21,7 @@ package net.minecraftforge.client.model;
import javax.vecmath.Vector4f;
import net.minecraftforge.common.ForgeVersion;
import net.minecraftforge.versions.forge.ForgeVersion;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.renderer.block.model.IBakedModel;
@ -29,8 +29,6 @@ import net.minecraft.client.renderer.block.model.IUnbakedModel;
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType;
import net.minecraft.client.renderer.block.model.ItemOverrideList;
import net.minecraft.client.renderer.block.model.ModelBlock;
import net.minecraft.client.renderer.block.model.ModelRotation;
import net.minecraft.client.renderer.texture.NativeImage;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.resources.IResourceManager;

View file

@ -24,7 +24,6 @@ import java.util.Collection;
import java.util.Collections;
import java.util.Map;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.vecmath.Quat4f;
@ -40,7 +39,6 @@ import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.client.resources.data.AnimationMetadataSection;
import net.minecraft.client.resources.data.AnimationMetadataSectionSerializer;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
import net.minecraft.resources.IResource;
@ -48,15 +46,12 @@ import net.minecraft.resources.IResourceManager;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeVersion;
import net.minecraftforge.versions.forge.ForgeVersion;
import net.minecraftforge.common.model.IModelState;
import net.minecraftforge.common.model.TRSRTransformation;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidUtil;
import java.util.Objects;
import java.util.function.Function;
import java.util.Optional;
import java.util.Random;
@ -66,7 +61,6 @@ import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Maps;
import org.apache.commons.io.IOUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

View file

@ -45,12 +45,11 @@ import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.MathHelper;
import net.minecraftforge.client.model.pipeline.UnpackedBakedQuad;
import net.minecraftforge.common.ForgeVersion;
import net.minecraftforge.versions.forge.ForgeVersion;
import net.minecraftforge.common.model.IModelState;
import net.minecraftforge.common.model.TRSRTransformation;
import net.minecraftforge.common.property.IExtendedBlockState;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.logging.log4j.LogManager;

View file

@ -40,7 +40,7 @@ import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.MinecraftForgeClient;
import net.minecraftforge.common.ForgeVersion;
import net.minecraftforge.versions.forge.ForgeVersion;
import net.minecraftforge.common.model.IModelState;
import net.minecraftforge.common.model.TRSRTransformation;

View file

@ -44,7 +44,7 @@ import javax.vecmath.Vector2f;
import javax.vecmath.Vector3f;
import javax.vecmath.Vector4f;
import net.minecraftforge.common.ForgeVersion;
import net.minecraftforge.versions.forge.ForgeVersion;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.commons.lang3.tuple.Triple;

View file

@ -32,6 +32,7 @@ import java.util.UUID;
import javax.annotation.Nullable;
import net.minecraftforge.versions.forge.ForgeVersion;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.Marker;

View file

@ -20,14 +20,12 @@
package net.minecraftforge.common;
import net.minecraft.client.Minecraft;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.biome.Biome;
import static net.minecraftforge.common.config.Configuration.CATEGORY_CLIENT;
import static net.minecraftforge.common.config.Configuration.CATEGORY_GENERAL;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.fml.DistExecutor;
@ -36,6 +34,7 @@ import net.minecraftforge.fml.WorldPersistenceHooks;
import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
import net.minecraftforge.fml.javafmlmod.FMLModLoadingContext;
import net.minecraftforge.server.command.ForgeCommand;
import net.minecraftforge.versions.forge.ForgeVersion;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@ -47,7 +46,6 @@ import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.config.Property;
import net.minecraftforge.common.model.animation.CapabilityAnimation;
import net.minecraftforge.energy.CapabilityEnergy;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.fluids.UniversalBucket;

View file

@ -19,20 +19,12 @@
package net.minecraftforge.common;
import net.minecraftforge.fml.common.ICrashCallable;
import net.minecraftforge.eventbus.api.IEventBus;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import com.google.common.collect.Lists;
import net.minecraft.crash.CrashReport;
import net.minecraft.crash.ICrashReportDetail;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.ForgeHooks.SeedEntry;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.versions.forge.ForgeVersion;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.Marker;

View file

@ -21,16 +21,12 @@ package net.minecraftforge.fml;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import net.minecraftforge.common.ForgeVersion;
import net.minecraftforge.mcp.MCPVersion;
import net.minecraftforge.versions.forge.ForgeVersion;
import net.minecraftforge.versions.mcp.MCPVersion;
import java.text.MessageFormat;
import java.util.Arrays;
import java.util.List;
import java.util.function.BiConsumer;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import java.util.stream.Stream;
public class BrandingControl
{

View file

@ -13,7 +13,7 @@ public class MavenVersionStringHelper {
}
public static String versionRangeToString(final VersionRange range) {
return range.getRestrictions().stream().map(MavenVersionStringHelper::restrictionToString).collect(Collectors.joining(","));
return range.getRestrictions().stream().map(MavenVersionStringHelper::restrictionToString).collect(Collectors.joining(", "));
}
public static String restrictionToString(final Restriction restriction) {

View file

@ -25,7 +25,7 @@ import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiListExtended;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.ForgeVersion;
import net.minecraftforge.versions.forge.ForgeVersion;
import net.minecraftforge.fml.MavenVersionStringHelper;
import net.minecraftforge.fml.VersionChecker;
import net.minecraftforge.fml.loading.moddiscovery.ModInfo;

View file

@ -23,19 +23,15 @@ import cpw.mods.modlauncher.api.IEnvironment;
import cpw.mods.modlauncher.api.ILaunchHandlerService;
import cpw.mods.modlauncher.api.ITransformingClassLoader;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.common.ForgeVersion;
import net.minecraftforge.mcp.MCPVersion;
import org.apache.logging.log4j.Level;
import net.minecraftforge.versions.forge.ForgeVersion;
import net.minecraftforge.versions.mcp.MCPVersion;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.core.config.Configurator;
import java.net.URISyntaxException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.Callable;
public class FMLClientLaunchProvider extends FMLCommonLaunchHandler implements ILaunchHandlerService
@ -44,13 +40,7 @@ public class FMLClientLaunchProvider extends FMLCommonLaunchHandler implements I
private static final Path forgePath;
private static final Path patchedBinariesPath;
private static final Path srgMcPath;
private static final List<String> SKIPPACKAGES = Arrays.asList(
"joptsimple.", "org.lwjgl.", "com.mojang.", "com.google.",
"org.apache.commons.", "io.netty.", "net.minecraftforge.fml.loading.", "net.minecraftforge.fml.language.",
"net.minecraftforge.eventbus.", "it.unimi.dsi.fastutil.", "net.minecraftforge.api.",
"paulscode.sound.", "com.ibm.icu.", "sun.", "gnu.trove.", "com.electronwill.nightconfig.",
"net.minecraftforge.fml.common.versioning."
);
static {
Path forgePath1 = null;
Path patchedBinariesPath1 = null;
@ -90,7 +80,7 @@ public class FMLClientLaunchProvider extends FMLCommonLaunchHandler implements I
{
return () -> {
super.beforeStart(launchClassLoader, forgePath);
launchClassLoader.addTargetPackageFilter(cn -> SKIPPACKAGES.stream().noneMatch(cn::startsWith));
launchClassLoader.addTargetPackageFilter(getPackagePredicate());
Class.forName("net.minecraft.client.main.Main", true, launchClassLoader.getInstance()).getMethod("main", String[].class).invoke(null, (Object)arguments);
return null;
};

View file

@ -24,12 +24,27 @@ import cpw.mods.modlauncher.api.ITransformingClassLoader;
import net.minecraftforge.api.distmarker.Dist;
import java.nio.file.Path;
import java.util.Arrays;
import java.util.List;
import java.util.function.Predicate;
public abstract class FMLCommonLaunchHandler
{
private static final List<String> SKIPPACKAGES = Arrays.asList(
// standard libs
"joptsimple.", "org.lwjgl.", "com.mojang.", "com.google.", "org.apache.commons.", "io.netty.",
"paulscode.sound.", "com.ibm.icu.", "sun.", "gnu.trove.", "com.electronwill.nightconfig.",
"net.minecraftforge.fml.loading.", "net.minecraftforge.fml.language.", "net.minecraftforge.versions.",
"net.minecraftforge.eventbus.", "net.minecraftforge.api."
);
protected Predicate<String> getPackagePredicate() {
return cn -> SKIPPACKAGES.stream().noneMatch(cn::startsWith);
}
public void setup(final IEnvironment environment)
{
// We need to check for deobf and patched jar here and if not, build one.
}
public abstract Dist getDist();

View file

@ -47,14 +47,6 @@ public class FMLDevClientLaunchProvider extends FMLCommonLaunchHandler implement
return "fmldevclient";
}
private static final List<String> SKIPPACKAGES = Arrays.asList(
"joptsimple.", "org.lwjgl.", "com.mojang.", "com.google.",
"org.apache.commons.", "io.netty.", "net.minecraftforge.fml.loading.", "net.minecraftforge.fml.language.",
"net.minecraftforge.eventbus.", "it.unimi.dsi.fastutil.", "net.minecraftforge.api.",
"paulscode.sound.", "com.ibm.icu.", "sun.", "gnu.trove.", "com.electronwill.nightconfig.",
"net.minecraftforge.fml.common.versioning."
);
private static final Path myPath;
static
@ -81,11 +73,7 @@ public class FMLDevClientLaunchProvider extends FMLCommonLaunchHandler implement
return () -> {
LOGGER.debug(CORE, "Launching minecraft in {} with arguments {}", launchClassLoader, arguments);
super.beforeStart(launchClassLoader, myPath);
launchClassLoader.addTargetPackageFilter(cn -> SKIPPACKAGES.stream().noneMatch(cn::startsWith));
Field scl = ClassLoader.class.getDeclaredField("scl"); // Get system class loader
scl.setAccessible(true); // Set accessible
scl.set(null, launchClassLoader.getInstance()); // Update it to your class loader
Thread.currentThread().setContextClassLoader(launchClassLoader.getInstance());
launchClassLoader.addTargetPackageFilter(getPackagePredicate());
Class.forName("net.minecraft.client.main.Main", true, launchClassLoader.getInstance()).getMethod("main", String[].class).invoke(null, (Object)arguments);
return null;
};

View file

@ -33,6 +33,7 @@ import java.nio.file.Paths;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.function.Predicate;
import static net.minecraftforge.fml.Logging.CORE;
@ -47,14 +48,6 @@ public class FMLDevServerLaunchProvider extends FMLCommonLaunchHandler implement
return "fmldevserver";
}
private static final List<String> SKIPPACKAGES = Arrays.asList(
"joptsimple.", "org.lwjgl.", "com.mojang.", "com.google.",
"org.apache.commons.", "io.netty.", "net.minecraftforge.fml.loading.", "net.minecraftforge.fml.language.",
"net.minecraftforge.eventbus.", "it.unimi.dsi.fastutil.", "net.minecraftforge.api.",
"paulscode.sound.", "com.ibm.icu.", "sun.", "gnu.trove.", "com.electronwill.nightconfig.",
"net.minecraftforge.fml.common.versioning."
);
private static final Path myPath;
static
@ -81,10 +74,7 @@ public class FMLDevServerLaunchProvider extends FMLCommonLaunchHandler implement
return () -> {
LOGGER.debug(CORE, "Launching minecraft in {} with arguments {}", launchClassLoader, arguments);
super.beforeStart(launchClassLoader, myPath);
launchClassLoader.addTargetPackageFilter(cn -> SKIPPACKAGES.stream().noneMatch(cn::startsWith));
Field scl = ClassLoader.class.getDeclaredField("scl"); // Get system class loader
scl.setAccessible(true); // Set accessible
scl.set(null, launchClassLoader.getInstance()); // Update it to your class loader
launchClassLoader.addTargetPackageFilter(getPackagePredicate());
Thread.currentThread().setContextClassLoader(launchClassLoader.getInstance());
Class.forName("net.minecraft.server.MinecraftServer", true, launchClassLoader.getInstance()).getMethod("main", String[].class).invoke(null, (Object)arguments);
return null;

View file

@ -26,7 +26,7 @@ import cpw.mods.modlauncher.api.ITransformingClassLoader;
import cpw.mods.modlauncher.api.IncompatibleEnvironmentException;
import cpw.mods.modlauncher.serviceapi.ILaunchPluginService;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.common.ForgeVersion;
import net.minecraftforge.versions.forge.ForgeVersion;
import net.minecraftforge.fml.loading.moddiscovery.BackgroundScanHandler;
import net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer;
import net.minecraftforge.fml.loading.moddiscovery.ModFile;

View file

@ -19,7 +19,7 @@
package net.minecraftforge.fml.loading;
import net.minecraftforge.common.ForgeVersion;
import net.minecraftforge.versions.forge.ForgeVersion;
import net.minecraftforge.fml.language.IModLanguageProvider;
import net.minecraftforge.fml.loading.moddiscovery.ExplodedDirectoryLocator;
import net.minecraftforge.fml.loading.moddiscovery.ModFile;

View file

@ -20,7 +20,7 @@
package net.minecraftforge.fml.loading;
import com.google.common.collect.ImmutableMap;
import net.minecraftforge.common.ForgeVersion;
import net.minecraftforge.versions.forge.ForgeVersion;
import net.minecraftforge.fml.loading.moddiscovery.ModFile;
import org.apache.commons.lang3.text.StrLookup;
import org.apache.commons.lang3.text.StrSubstitutor;

View file

@ -54,9 +54,7 @@ import org.apache.maven.artifact.versioning.ArtifactVersion;
import com.google.common.io.ByteStreams;
import com.google.common.io.Files;
import cpw.mods.modlauncher.Launcher;
import net.minecraftforge.common.ForgeVersion;
import net.minecraftforge.fml.loading.FMLCommonLaunchHandler;
import net.minecraftforge.versions.forge.ForgeVersion;
import net.minecraftforge.fml.loading.FMLEnvironment;
public class LibraryManager

View file

@ -39,7 +39,7 @@ import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonSyntaxException;
import net.minecraftforge.common.ForgeVersion;
import net.minecraftforge.versions.forge.ForgeVersion;
public class ModList
{

View file

@ -17,7 +17,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package net.minecraftforge.common;
package net.minecraftforge.versions.forge;
import net.minecraftforge.fml.VersionChecker;
import org.apache.logging.log4j.LogManager;

View file

@ -1,4 +1,4 @@
package net.minecraftforge.mcp;
package net.minecraftforge.versions.mcp;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;