-
-
Notifications
You must be signed in to change notification settings - Fork 252
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
308 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
src/fmllauncher/java/net/minecraftforge/fml/loading/VersionSupportMatrix.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package net.minecraftforge.fml.loading; | ||
|
||
import net.minecraftforge.forgespi.language.MavenVersionAdapter; | ||
import org.apache.maven.artifact.versioning.ArtifactVersion; | ||
import org.apache.maven.artifact.versioning.DefaultArtifactVersion; | ||
import org.apache.maven.artifact.versioning.VersionRange; | ||
|
||
import java.util.HashMap; | ||
import java.util.function.BiPredicate; | ||
|
||
public class VersionSupportMatrix { | ||
private static final HashMap<String, ArtifactVersion> overrideVersions = new HashMap<>(); | ||
static { | ||
final ArtifactVersion version = new DefaultArtifactVersion(FMLLoader.mcVersion); | ||
if (MavenVersionAdapter.createFromVersionSpec("[1.16.4]").containsVersion(version)) { | ||
overrideVersions.put("languageloader.javafml", new DefaultArtifactVersion("34")); // we also work with javafml 34 | ||
overrideVersions.put("mod.minecraft", new DefaultArtifactVersion("1.16.3")); // we work with anything declaring 1.16.3 | ||
overrideVersions.put("mod.forge", new DefaultArtifactVersion("34.1.42")); // we work with anything that supports forge 34.1.42 | ||
} | ||
} | ||
public static <T> boolean testVersionSupportMatrix(VersionRange declaredRange, String lookupId, String type, BiPredicate<String, VersionRange> standardLookup) { | ||
return standardLookup.test(lookupId, declaredRange) || overrideVersions.containsKey(type +"." +lookupId) && declaredRange.containsVersion(overrideVersions.get(type +"." +lookupId)); | ||
} | ||
} |
73 changes: 73 additions & 0 deletions
73
src/fmllauncher/java/net/minecraftforge/fml/loading/log4j/ForgeHighlight.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/* | ||
* Minecraft Forge | ||
* Copyright (c) 2016-2020. | ||
* | ||
* 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.log4j; | ||
|
||
import net.minecrell.terminalconsole.HighlightErrorConverter; | ||
import net.minecrell.terminalconsole.TerminalConsoleAppender; | ||
import org.apache.logging.log4j.Logger; | ||
import org.apache.logging.log4j.core.config.Configuration; | ||
import org.apache.logging.log4j.core.config.plugins.Plugin; | ||
import org.apache.logging.log4j.core.pattern.ConverterKeys; | ||
import org.apache.logging.log4j.core.pattern.HighlightConverter; | ||
import org.apache.logging.log4j.core.pattern.PatternConverter; | ||
import org.apache.logging.log4j.status.StatusLogger; | ||
import org.apache.logging.log4j.util.PerformanceSensitive; | ||
|
||
import javax.annotation.Nullable; | ||
import java.lang.reflect.Method; | ||
import java.util.ArrayList; | ||
import java.util.Arrays; | ||
import java.util.List; | ||
|
||
/** | ||
* A wrapper for {@link HighlightConverter} that auto-disables ANSI when the terminal doesn't support it. | ||
* Ansi support is determined by TerminalConsoleAppender | ||
*/ | ||
@Plugin(name = "highlightForge", category = PatternConverter.CATEGORY) | ||
@ConverterKeys("highlightForge") | ||
@PerformanceSensitive("allocation") | ||
public class ForgeHighlight { | ||
protected static final Logger LOGGER = StatusLogger.getLogger(); | ||
|
||
/** | ||
* Gets a new instance of the {@link HighlightErrorConverter} with the | ||
* specified options. | ||
* | ||
* @param config The current configuration | ||
* @param options The pattern options | ||
* @return The new instance | ||
*/ | ||
public static @Nullable HighlightConverter newInstance(Configuration config, String[] options) { | ||
try { | ||
Method method = TerminalConsoleAppender.class.getDeclaredMethod("initializeTerminal"); | ||
method.setAccessible(true); | ||
method.invoke(null); | ||
} catch (ReflectiveOperationException e) { | ||
LOGGER.warn("Failed to invoke initializeTerminal on TCA", e); | ||
} | ||
if (!TerminalConsoleAppender.isAnsiSupported() && Arrays.stream(options).noneMatch(s -> s.equals("disableAnsi=true"))) { | ||
List<String> optionList = new ArrayList<>(); | ||
optionList.add(options[0]); | ||
optionList.add("disableAnsi=true"); | ||
options = optionList.toArray(new String[0]); | ||
} | ||
return HighlightConverter.newInstance(config, options); | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
src/main/java/net/minecraftforge/client/event/ClientPlayerChangeGameModeEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
src/main/java/net/minecraftforge/client/model/generators/CustomLoaderBuilder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
src/main/java/net/minecraftforge/client/model/generators/loaders/CompositeModelBuilder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
...in/java/net/minecraftforge/client/model/generators/loaders/DynamicBucketModelBuilder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
src/main/java/net/minecraftforge/client/model/generators/loaders/ItemLayersModelBuilder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
src/main/java/net/minecraftforge/client/model/generators/loaders/MultiLayerModelBuilder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.