mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-14 01:04:24 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
db4d8a4729 | ||
|
|
0ca1d0ebd0 | ||
|
|
4995902bc0 | ||
|
|
28e55b2843 | ||
|
|
decaace84a | ||
|
|
72f98dc4a3 | ||
|
|
2951c1dac8 | ||
|
|
40a0a16db0 | ||
|
|
520680b037 | ||
|
|
2844bead6e | ||
|
|
d498ec4a45 | ||
|
|
e2d1ca7d0e | ||
|
|
a547327c61 | ||
|
|
e9a7ce9544 | ||
|
|
511be6415c | ||
|
|
4d85053a4d | ||
|
|
4fcf1877c1 | ||
|
|
41fd15fc57 | ||
|
|
8e0845d032 | ||
|
|
c04e533a61 | ||
|
|
54f4997f71 | ||
|
|
3272e995ab | ||
|
|
8edb551571 | ||
|
|
4bf0de4763 | ||
|
|
f6a54436b9 | ||
|
|
7a497cdbd6 | ||
|
|
06336a40d8 | ||
|
|
842c95cfb9 | ||
|
|
aa2f471e87 | ||
|
|
4209d1fc12 | ||
|
|
583f363b6b | ||
|
|
1c633b4624 | ||
|
|
2677511da6 | ||
|
|
387441c045 | ||
|
|
4a2db246e0 | ||
|
|
3d9e12a71d | ||
|
|
cdeb786877 | ||
|
|
ff7085b95b | ||
|
|
16dde4d551 | ||
|
|
60661350c6 | ||
|
|
7ee4a44c75 | ||
|
|
f22894cf70 | ||
|
|
a3fce36942 | ||
|
|
549dbe7df4 | ||
|
|
5505e472aa | ||
|
|
c2c7f9b656 | ||
|
|
fd8a0f9c8b | ||
|
|
0ac873e296 | ||
|
|
38b5b678cb | ||
|
|
9a2bc1e7c2 | ||
|
|
95b49bedbc | ||
|
|
7c36115e3d | ||
|
|
c037e6aca1 | ||
|
|
e8f1b7ed6d | ||
|
|
5da16e6719 | ||
|
|
f0a82d79a6 | ||
|
|
2b3a4137e1 | ||
|
|
640c206117 | ||
|
|
59a7bbdb57 | ||
|
|
be7ad14b4b | ||
|
|
c700b4ea9d | ||
|
|
dffa3dd4c9 | ||
|
|
4b934809c4 | ||
|
|
ddf76db9b3 | ||
|
|
64d6b4f76a | ||
|
|
58012bfb17 | ||
|
|
0cad6b14d9 | ||
|
|
8848294210 | ||
|
|
0e28336fc0 | ||
|
|
968fa9eeb5 | ||
|
|
43768ea328 | ||
|
|
0e829630da | ||
|
|
0467d71466 | ||
|
|
115eb5e4c8 | ||
|
|
a7345372fd | ||
|
|
bd714b2f76 |
No files matched your search
Vendored
+1
-1
@@ -38,7 +38,7 @@ project {
|
||||
params {
|
||||
text("docker_jdk_version", "21", label = "Gradle version", description = "The version of the JDK to use during execution of tasks in a JDK.", display = ParameterDisplay.HIDDEN, allowEmpty = false)
|
||||
text("docker_gradle_version", "8.7", label = "Gradle version", description = "The version of Gradle to use during execution of Gradle tasks.", display = ParameterDisplay.HIDDEN, allowEmpty = false)
|
||||
text("git_main_branch", "1.20.x", label = "Git Main Branch", description = "The git main or default branch to use in VCS operations.", display = ParameterDisplay.HIDDEN, allowEmpty = false)
|
||||
text("git_main_branch", "1.21.x", label = "Git Main Branch", description = "The git main or default branch to use in VCS operations.", display = ParameterDisplay.HIDDEN, allowEmpty = false)
|
||||
text("git_branch_spec", """
|
||||
+:refs/heads/(main*)
|
||||
+:refs/heads/(master*)
|
||||
|
||||
@@ -140,7 +140,7 @@ abstract class CheckPatches extends CheckTask {
|
||||
final nextLineChange = i + 1 < lines.size() && lines[i + 1].startsWithAny('+','-')
|
||||
|
||||
if (!prevLineChange && !nextLineChange) {
|
||||
reporter.report("Patch contains white space change in valid hunk at line ${i + 1}, file: $patchPath", false)
|
||||
reporter.report("Patch contains white space change in valid hunk at line ${i + 1}, file: $patchPath \n$prevLine\n$line\n${lines[i+1]}", false)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+8
-38
@@ -180,6 +180,7 @@ patcher {
|
||||
|
||||
forge_client_test {
|
||||
parent runs.forge_client
|
||||
source sourceSets.test
|
||||
}
|
||||
|
||||
forge_server {
|
||||
@@ -188,6 +189,7 @@ patcher {
|
||||
|
||||
forge_server_test {
|
||||
parent runs.forge_server
|
||||
source sourceSets.test
|
||||
}
|
||||
|
||||
forge_server_gametest {
|
||||
@@ -196,6 +198,7 @@ patcher {
|
||||
|
||||
forge_server_gametest_test {
|
||||
parent runs.forge_server_gametest
|
||||
source sourceSets.test
|
||||
}
|
||||
|
||||
forge_data {
|
||||
@@ -211,6 +214,7 @@ patcher {
|
||||
}
|
||||
|
||||
forge_data_test {
|
||||
source sourceSets.test
|
||||
args '--launchTarget', 'forge_dev_data',
|
||||
'--mod', '.+',
|
||||
'--all',
|
||||
@@ -221,7 +225,6 @@ patcher {
|
||||
'--assetsDir', downloadAssets.output,
|
||||
'--assetIndex', "{asset_index}"
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -401,16 +404,6 @@ tasks.register("downloadServerShim", DownloadMavenArtifact) {
|
||||
artifact = libs.bootstrap.shim.get().toString()
|
||||
changing = true
|
||||
}
|
||||
tasks.register("downloadMCPConfig", DownloadMavenArtifact) {
|
||||
artifact = MCP_ARTIFACT
|
||||
}
|
||||
tasks.register('extractMCPConfigMappings', net.minecraftforge.gradle.common.tasks.JarExec) {
|
||||
ext.output = file('build/mcp_mappings.tsrg')
|
||||
tool = INSTALLER_TOOLS + ':fatjar'
|
||||
args = ['--task', 'MCP_DATA', '--key', 'mappings', '--input', downloadMCPConfig.output.get().asFile.absolutePath, '--output', output.absolutePath]
|
||||
outputs.file(output)
|
||||
inputs.file(downloadMCPConfig.output)
|
||||
}
|
||||
tasks.register('downloadClientMappings', net.minecraftforge.gradle.common.tasks.JarExec) {
|
||||
ext.output = file('build/client_mappings.tsrg')
|
||||
tool = INSTALLER_TOOLS + ':fatjar'
|
||||
@@ -480,10 +473,10 @@ tasks.register('createServerShimClasspath', BundleList) {
|
||||
tasks.register('createServerShimConfig') {
|
||||
ext.output = file('build/libs/bootstrap-shim.properties')
|
||||
doLast {
|
||||
def cfg = new CleanProperties()
|
||||
cfg."Main-Class" = 'net.minecraftforge.bootstrap.ForgeBootstrap'
|
||||
cfg."Java-Version" = '17'
|
||||
cfg."Arguments" = "--launchTarget forge_server"
|
||||
var cfg = new CleanProperties()
|
||||
cfg['Main-Class'] = 'net.minecraftforge.bootstrap.ForgeBootstrap'
|
||||
cfg['Java-Version'] = '21'
|
||||
cfg['Arguments'] = '--launchTarget forge_server'
|
||||
cfg.store(output)
|
||||
}
|
||||
}
|
||||
@@ -617,9 +610,6 @@ tasks.register('installerJson', InstallerJson) {
|
||||
dependsOn(launcherJson)
|
||||
input.from(launcherJson.output)
|
||||
|
||||
// Extract MCP Mappings
|
||||
dependsOn(extractMCPConfigMappings)
|
||||
input.from(extractMCPConfigMappings.output)
|
||||
// Download Official Mappings
|
||||
dependsOn(downloadClientMappings, downloadServerMappings)
|
||||
input.from(downloadClientMappings.output, downloadServerMappings.output)
|
||||
@@ -646,14 +636,6 @@ tasks.register('installerJson', InstallerJson) {
|
||||
minecraft: MC_VERSION,
|
||||
serverJarPath: '{LIBRARY_DIR}/net/minecraft/server/{MINECRAFT_VERSION}/server-{MINECRAFT_VERSION}-bundled.jar',
|
||||
data: [
|
||||
MAPPINGS: [
|
||||
client: "[${MCP_ARTIFACT.group}:${MCP_ARTIFACT.name}:${MCP_ARTIFACT.version}:mappings@tsrg]",
|
||||
server: "[${MCP_ARTIFACT.group}:${MCP_ARTIFACT.name}:${MCP_ARTIFACT.version}:mappings@tsrg]"
|
||||
],
|
||||
MAPPINGS_SHA: [
|
||||
client: "'${extractMCPConfigMappings.output.sha1}'",
|
||||
server: "'${extractMCPConfigMappings.output.sha1}'"
|
||||
],
|
||||
MOJMAPS: [
|
||||
client: "[net.minecraft:client:${MC_VERSION}:mappings@tsrg]",
|
||||
server: "[net.minecraft:server:${MC_VERSION}:mappings@tsrg]"
|
||||
@@ -743,18 +725,6 @@ tasks.register('installerJson', InstallerJson) {
|
||||
outputs: [
|
||||
'{MC_UNPACKED}': '{MC_UNPACKED_SHA}'
|
||||
]
|
||||
], [
|
||||
jar: INSTALLER_TOOLS,
|
||||
classpath: INSTALLER_TOOLS_CLASSPATH,
|
||||
args: [
|
||||
'--task', 'MCP_DATA',
|
||||
'--input', "[${MCP_ARTIFACT.descriptor}]",
|
||||
'--output', '{MAPPINGS}',
|
||||
'--key', 'mappings'
|
||||
],
|
||||
outputs: [
|
||||
'{MAPPINGS}': '{MAPPINGS_SHA}'
|
||||
]
|
||||
], [
|
||||
jar: INSTALLER_TOOLS,
|
||||
classpath: INSTALLER_TOOLS_CLASSPATH,
|
||||
|
||||
@@ -44,6 +44,7 @@ tasks.withType(JavaCompile).configureEach {
|
||||
dependsOn 'processResources' // Needed because we merge the output of this with the output of the compile task. And gradle detects downstream tasks using the output without a hard dep
|
||||
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
|
||||
options.warnings = false // Shutup deprecated for removal warnings
|
||||
options.forkOptions.jvmArgs += '-Xmx3G' // Needed to make compiling faster, and not run out of heap space in some cases.
|
||||
}
|
||||
|
||||
// Merge the resources and classes into the same directory. We'll need to split them at runtime because
|
||||
|
||||
+2
-2
@@ -2,8 +2,8 @@
|
||||
|
||||
MinecraftForge
|
||||
=============
|
||||
[][Download]
|
||||
[][Download]
|
||||
[][Download] [][Discord] [][Patreon]
|
||||
|
||||
Forge is a free, open-source modding API all of your favourite mods use!
|
||||
|
||||
@@ -9,41 +9,35 @@ import net.minecraftforge.eventbus.api.IEventBus;
|
||||
import net.minecraftforge.fml.config.IConfigEvent;
|
||||
import net.minecraftforge.fml.loading.FMLLoader;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.ServiceConfigurationError;
|
||||
import java.util.ServiceLoader;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/**
|
||||
* Used to allow access to certain things from the game layer
|
||||
*/
|
||||
public class Bindings {
|
||||
private static final Bindings INSTANCE = new Bindings();
|
||||
private Bindings() {}
|
||||
|
||||
private final IBindingsProvider provider;
|
||||
|
||||
private Bindings() {
|
||||
var providers = new ArrayList<IBindingsProvider>(1);
|
||||
for (var itr = ServiceLoader.load(FMLLoader.getGameLayer(), IBindingsProvider.class).iterator(); itr.hasNext(); ) {
|
||||
try {
|
||||
providers.add(itr.next());
|
||||
} catch (ServiceConfigurationError sce) {
|
||||
sce.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
if (providers.size() != 1)
|
||||
throw new IllegalStateException("Could not find bindings provider: " + providers);
|
||||
|
||||
this.provider = providers.get(0);
|
||||
}
|
||||
/**
|
||||
* The provider of the bindings
|
||||
* @implNote May also throw a {@link ServiceConfigurationError}
|
||||
*/
|
||||
private static final IBindingsProvider PROVIDER = ServiceLoader.load(FMLLoader.getGameLayer(), IBindingsProvider.class)
|
||||
.findFirst().orElseThrow(() -> new IllegalStateException("Could not find bindings provider"));
|
||||
|
||||
/**
|
||||
* @return A supplier of net.minecraftforge.common.MinecraftForge#EVENT_BUS
|
||||
*/
|
||||
public static Supplier<IEventBus> getForgeBus() {
|
||||
return INSTANCE.provider.getForgeBusSupplier();
|
||||
return PROVIDER.getForgeBusSupplier();
|
||||
}
|
||||
|
||||
public static Supplier<I18NParser> getMessageParser() {
|
||||
return INSTANCE.provider.getMessageParser();
|
||||
return PROVIDER.getMessageParser();
|
||||
}
|
||||
|
||||
public static Supplier<IConfigEvent.ConfigConfig> getConfigConfiguration() {
|
||||
return INSTANCE.provider.getConfigConfiguration();
|
||||
return PROVIDER.getConfigConfiguration();
|
||||
}
|
||||
}
|
||||
@@ -16,8 +16,7 @@ import net.minecraftforge.api.distmarker.Dist;
|
||||
*
|
||||
* @see Dist
|
||||
*/
|
||||
public enum LogicalSide
|
||||
{
|
||||
public enum LogicalSide {
|
||||
/**
|
||||
* The logical client of the Minecraft game, which interfaces with the player's inputs and renders the player's
|
||||
* viewpoint.
|
||||
@@ -27,6 +26,7 @@ public enum LogicalSide
|
||||
* @see Dist#CLIENT
|
||||
*/
|
||||
CLIENT,
|
||||
|
||||
/**
|
||||
* The logical server of the Minecraft game, responsible for connecting to clients and running the simulation logic
|
||||
* on the level.
|
||||
@@ -41,16 +41,14 @@ public enum LogicalSide
|
||||
/**
|
||||
* {@return if this logical side is the server}
|
||||
*/
|
||||
public boolean isServer()
|
||||
{
|
||||
public boolean isServer() {
|
||||
return !isClient();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return if the logical side is the client}
|
||||
*/
|
||||
public boolean isClient()
|
||||
{
|
||||
public boolean isClient() {
|
||||
return this == CLIENT;
|
||||
}
|
||||
}
|
||||
@@ -48,8 +48,8 @@ public class VersionChecker {
|
||||
BETA(),
|
||||
BETA_OUTDATED(6, true, true);
|
||||
|
||||
final int sheetOffset;
|
||||
final boolean draw, animated;
|
||||
private final int sheetOffset;
|
||||
private final boolean draw, animated;
|
||||
|
||||
Status() {
|
||||
this(0, false, false);
|
||||
@@ -72,6 +72,10 @@ public class VersionChecker {
|
||||
public boolean isAnimated() {
|
||||
return animated;
|
||||
}
|
||||
|
||||
public boolean isOutdated() {
|
||||
return this == OUTDATED || this == BETA_OUTDATED;
|
||||
}
|
||||
}
|
||||
|
||||
public record CheckResult(VersionChecker.Status status, ComparableVersion target, Map<ComparableVersion, String> changes, String url) {}
|
||||
@@ -211,7 +215,7 @@ public class VersionChecker {
|
||||
LOGGER.warn("Failed to process update information", e);
|
||||
status = FAILED;
|
||||
}
|
||||
results.put(mod, new CheckResult(status, target, changes, display_url));
|
||||
RESULTS.put(mod, new CheckResult(status, target, changes, display_url));
|
||||
}
|
||||
}.start();
|
||||
}
|
||||
@@ -226,10 +230,10 @@ public class VersionChecker {
|
||||
return ret;
|
||||
}
|
||||
|
||||
private static Map<IModInfo, CheckResult> results = new ConcurrentHashMap<>();
|
||||
private static final Map<IModInfo, CheckResult> RESULTS = new ConcurrentHashMap<>();
|
||||
private static final CheckResult PENDING_CHECK = new CheckResult(PENDING, null, null, null);
|
||||
|
||||
public static CheckResult getResult(IModInfo mod) {
|
||||
return results.getOrDefault(mod, PENDING_CHECK);
|
||||
return RESULTS.getOrDefault(mod, PENDING_CHECK);
|
||||
}
|
||||
}
|
||||
@@ -47,12 +47,8 @@ public class ConfigFileTypeHandler {
|
||||
throw new ConfigLoadingException(c, ex);
|
||||
}
|
||||
LOGGER.debug(CONFIG, "Loaded TOML config file {}", configPath.toString());
|
||||
try {
|
||||
FileWatcher.defaultInstance().addWatch(configPath, new ConfigWatcher(c, configData, Thread.currentThread().getContextClassLoader()));
|
||||
LOGGER.debug(CONFIG, "Watching TOML config file {} for changes", configPath.toString());
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException("Couldn't watch config file", e);
|
||||
}
|
||||
FileWatcher.defaultInstance().addWatch(configPath, new ConfigWatcher(c, configData, Thread.currentThread().getContextClassLoader()));
|
||||
LOGGER.debug(CONFIG, "Watching TOML config file {} for changes", configPath.toString());
|
||||
return configData;
|
||||
};
|
||||
}
|
||||
@@ -67,7 +63,9 @@ public class ConfigFileTypeHandler {
|
||||
}
|
||||
|
||||
private boolean setupConfigFile(final ModConfig modConfig, final Path file, final ConfigFormat<?> conf) throws IOException {
|
||||
Files.createDirectories(file.getParent());
|
||||
if (!Files.isDirectory(file.getParent())) {
|
||||
Files.createDirectories(file.getParent());
|
||||
}
|
||||
Path p = defaultConfigPath.resolve(modConfig.getFileName());
|
||||
if (Files.exists(p)) {
|
||||
LOGGER.info(CONFIG, "Loading default config file from path {}", p);
|
||||
|
||||
+11
-25
@@ -49,49 +49,38 @@ public class CapabilityTokenSubclass implements ILaunchPluginService {
|
||||
private static final EnumSet<Phase> NAY = EnumSet.noneOf(Phase.class);
|
||||
|
||||
@Override
|
||||
public EnumSet<Phase> handlesClass(Type classType, boolean isEmpty)
|
||||
{
|
||||
public EnumSet<Phase> handlesClass(Type classType, boolean isEmpty) {
|
||||
return isEmpty ? NAY : YAY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int processClassWithFlags(final Phase phase, final ClassNode classNode, final Type classType, final String reason)
|
||||
{
|
||||
if (CAP_INJECT.equals(classNode.name))
|
||||
{
|
||||
for (MethodNode mtd : classNode.methods)
|
||||
{
|
||||
if (FUNC_NAME.equals(mtd.name) && FUNC_DESC.equals(mtd.desc))
|
||||
{
|
||||
public int processClassWithFlags(final Phase phase, final ClassNode classNode, final Type classType, final String reason) {
|
||||
if (CAP_INJECT.equals(classNode.name)) {
|
||||
for (MethodNode mtd : classNode.methods) {
|
||||
if (FUNC_NAME.equals(mtd.name) && FUNC_DESC.equals(mtd.desc)) {
|
||||
mtd.access &= ~Opcodes.ACC_FINAL; // We have it final in code so people don't override it, cuz that'd be stupid, and make our transformer more complicated.
|
||||
}
|
||||
}
|
||||
return ComputeFlags.SIMPLE_REWRITE;
|
||||
}
|
||||
else if (CAP_INJECT.equals(classNode.superName))
|
||||
{
|
||||
} else if (CAP_INJECT.equals(classNode.superName)) {
|
||||
Holder cls = new Holder();
|
||||
|
||||
SignatureReader reader = new SignatureReader(classNode.signature); // Having a node version of this would probably be useful.
|
||||
reader.accept(new SignatureVisitor(Opcodes.ASM9)
|
||||
{
|
||||
reader.accept(new SignatureVisitor(Opcodes.ASM9) {
|
||||
Deque<String> stack = new ArrayDeque<>();
|
||||
|
||||
@Override
|
||||
public void visitClassType(final String name)
|
||||
{
|
||||
public void visitClassType(final String name) {
|
||||
stack.push(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitInnerClassType(final String name)
|
||||
{
|
||||
public void visitInnerClassType(final String name) {
|
||||
stack.push(stack.pop() + '$' + name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitEnd()
|
||||
{
|
||||
public void visitEnd() {
|
||||
var val = stack.pop();
|
||||
if (!stack.isEmpty() && CAP_INJECT.equals(stack.peek()))
|
||||
cls.value = val;
|
||||
@@ -106,9 +95,7 @@ public class CapabilityTokenSubclass implements ILaunchPluginService {
|
||||
mtd.visitInsn(Opcodes.ARETURN);
|
||||
mtd.visitEnd();
|
||||
return ComputeFlags.COMPUTE_MAXS;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
return ComputeFlags.NO_REWRITE;
|
||||
}
|
||||
}
|
||||
@@ -116,5 +103,4 @@ public class CapabilityTokenSubclass implements ILaunchPluginService {
|
||||
private static class Holder {
|
||||
String value;
|
||||
}
|
||||
|
||||
}
|
||||
+14
@@ -10,6 +10,8 @@ import cpw.mods.jarhandling.SecureJar;
|
||||
import cpw.mods.modlauncher.api.LamdbaExceptionUtils;
|
||||
import cpw.mods.modlauncher.api.NamedPath;
|
||||
import cpw.mods.modlauncher.serviceapi.ITransformerDiscoveryService;
|
||||
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -20,6 +22,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@ApiStatus.Internal
|
||||
public class ModDirTransformerDiscoverer implements ITransformerDiscoveryService {
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
private static final Set<String> SERVICES = Set.of(
|
||||
@@ -76,4 +79,15 @@ public class ModDirTransformerDiscoverer implements ITransformerDiscoveryService
|
||||
.filter(SERVICES::contains)
|
||||
.forEach(s -> found.add(new NamedPath(s, path)));
|
||||
}
|
||||
|
||||
public static boolean isServiceProvider(Path path) {
|
||||
var jar = SecureJar.from(path);
|
||||
|
||||
for (var providers : jar.moduleDataProvider().descriptor().provides()) {
|
||||
if (SERVICES.contains(providers.service()))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -57,11 +57,17 @@ public class RuntimeDistCleaner implements ILaunchPluginService
|
||||
throw new RuntimeException("Attempted to load class "+ classNode.name + " for invalid dist "+ DIST);
|
||||
}
|
||||
|
||||
if (!FMLEnvironment.production && hasOnlyInWithModAnnotation(classNode.visibleAnnotations))
|
||||
{
|
||||
LOGGER.error(DISTXFORM, "Attempted to load class {} with @Mod and @OnlyIn/@OnlyIns annotations", classNode.name);
|
||||
throw new RuntimeException("Found @OnlyIn on @Mod class "+ classNode.name + " - this is not allowed as it causes crashes. Remove the OnlyIn and consider setting clientSideOnly=true in the root of your mods.toml instead");
|
||||
}
|
||||
|
||||
if (classNode.interfaces != null )
|
||||
{
|
||||
unpack(classNode.visibleAnnotations).stream()
|
||||
.filter(ann->Objects.equals(ann.desc, ONLYIN))
|
||||
.filter(ann->ann.values.indexOf("_interface") != -1)
|
||||
.filter(ann-> ann.values.contains("_interface"))
|
||||
.filter(ann->!Objects.equals(((String[])ann.values.get(ann.values.indexOf("value") + 1))[1], DIST))
|
||||
.map(ann -> ((Type)ann.values.get(ann.values.indexOf("_interface") + 1)).getInternalName())
|
||||
.forEach(intf -> {
|
||||
@@ -137,22 +143,78 @@ public class RuntimeDistCleaner implements ILaunchPluginService
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private static List<AnnotationNode> unpack(final List<AnnotationNode> anns) {
|
||||
if (anns == null) return Collections.emptyList();
|
||||
List<AnnotationNode> ret = anns.stream().filter(ann->Objects.equals(ann.desc, ONLYIN)).collect(Collectors.toList());
|
||||
anns.stream().filter(ann->Objects.equals(ann.desc, ONLYINS) && ann.values != null)
|
||||
.map( ann -> (List<AnnotationNode>)ann.values.get(ann.values.indexOf("value") + 1))
|
||||
.filter(v -> v != null)
|
||||
.forEach(v -> v.forEach(ret::add));
|
||||
return ret;
|
||||
private static List<AnnotationNode> unpack(final List<AnnotationNode> anns)
|
||||
{
|
||||
if (anns == null)
|
||||
{
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
List<AnnotationNode> unpacked = new ArrayList<>();
|
||||
|
||||
for (var annotationNode : anns)
|
||||
{
|
||||
if (Objects.equals(annotationNode.desc, ONLYINS))
|
||||
{
|
||||
unpacked.add(annotationNode);
|
||||
|
||||
if (annotationNode.values != null)
|
||||
{
|
||||
List<AnnotationNode> subNodes = (List<AnnotationNode>) annotationNode.values.get(annotationNode.values.indexOf("value") + 1);
|
||||
|
||||
if (subNodes != null)
|
||||
{
|
||||
unpacked.addAll(subNodes);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return unpacked;
|
||||
}
|
||||
|
||||
private boolean remove(final List<AnnotationNode> anns, final String side)
|
||||
{
|
||||
return unpack(anns).stream().
|
||||
filter(ann->Objects.equals(ann.desc, ONLYIN)).
|
||||
filter(ann->ann.values.indexOf("_interface") == -1).
|
||||
anyMatch(ann -> !Objects.equals(((String[])ann.values.get(ann.values.indexOf("value")+1))[1], side));
|
||||
var onlyIns = unpack(anns);
|
||||
|
||||
for (var onlyIn : onlyIns)
|
||||
{
|
||||
if (!Objects.equals(onlyIn.desc, ONLYINS) || onlyIn.values.contains("_interface"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!Objects.equals(((String[])onlyIn.values.get(onlyIn.values.indexOf("value") + 1))[1], side))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean hasOnlyInWithModAnnotation(final List<AnnotationNode> anns)
|
||||
{
|
||||
if (anns == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var foundModAnnotation = false;
|
||||
var foundOnlyIn = false;
|
||||
|
||||
for (var ann : anns)
|
||||
{
|
||||
if (ann.desc.equals("Lnet/minecraftforge/fml/common/Mod;"))
|
||||
{
|
||||
foundModAnnotation = true;
|
||||
} else if (Objects.equals(ann.desc, ONLYIN) || Objects.equals(ann.desc, ONLYINS))
|
||||
{
|
||||
foundOnlyIn = true;
|
||||
}
|
||||
}
|
||||
|
||||
return foundModAnnotation && foundOnlyIn;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
||||
+14
-2
@@ -8,7 +8,6 @@ package net.minecraftforge.fml.loading.moddiscovery;
|
||||
import com.mojang.logging.LogUtils;
|
||||
import cpw.mods.jarhandling.JarMetadata;
|
||||
import cpw.mods.jarhandling.SecureJar;
|
||||
import net.minecraftforge.fml.loading.EarlyLoadingException;
|
||||
import net.minecraftforge.fml.loading.LogMarkers;
|
||||
import net.minecraftforge.forgespi.language.IConfigurable;
|
||||
import net.minecraftforge.forgespi.language.IModFileInfo;
|
||||
@@ -19,6 +18,7 @@ import net.minecraftforge.forgespi.locating.IModProvider;
|
||||
import net.minecraftforge.forgespi.locating.ModFileLoadingException;
|
||||
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -37,6 +37,16 @@ public abstract class AbstractModProvider implements IModProvider {
|
||||
protected static final String MODS_TOML = "META-INF/mods.toml";
|
||||
|
||||
protected IModLocator.ModFileOrException createMod(Path path) {
|
||||
return createMod(path, false);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected IModLocator.ModFileOrException createMod(Path path, boolean ignoreUnknown) {
|
||||
return createMod(path, false, getDefaultJarModType());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected IModLocator.ModFileOrException createMod(Path path, boolean ignoreUnknown, String defaultType) {
|
||||
var mjm = new ModJarMetadata();
|
||||
var sj = SecureJar.from(
|
||||
jar -> jar.moduleDataProvider().findFile(MODS_TOML).isPresent() ? mjm : JarMetadata.from(jar, path),
|
||||
@@ -46,7 +56,7 @@ public abstract class AbstractModProvider implements IModProvider {
|
||||
IModFile mod;
|
||||
var type = sj.moduleDataProvider().getManifest().getMainAttributes().getValue(ModFile.TYPE);
|
||||
if (type == null)
|
||||
type = getDefaultJarModType();
|
||||
type = defaultType;
|
||||
|
||||
if (sj.moduleDataProvider().findFile(MODS_TOML).isPresent()) {
|
||||
LOGGER.debug(LogMarkers.SCAN, "Found {} mod of type {}: {}", MODS_TOML, type, path);
|
||||
@@ -58,6 +68,8 @@ public abstract class AbstractModProvider implements IModProvider {
|
||||
} else if (type != null) {
|
||||
LOGGER.debug(LogMarkers.SCAN, "Found {} mod of type {}: {}", JarFile.MANIFEST_NAME, type, path);
|
||||
mod = new ModFile(sj, this, this::manifestParser, type);
|
||||
} else if (ignoreUnknown) {
|
||||
return null;
|
||||
} else
|
||||
return new IModLocator.ModFileOrException(null, new ModFileLoadingException("Invalid mod file found " + path));
|
||||
|
||||
|
||||
+6
-2
@@ -8,6 +8,7 @@ package net.minecraftforge.fml.loading.moddiscovery;
|
||||
import com.mojang.logging.LogUtils;
|
||||
|
||||
import net.minecraftforge.fml.loading.LogMarkers;
|
||||
import net.minecraftforge.fml.loading.ModDirTransformerDiscoverer;
|
||||
import net.minecraftforge.forgespi.locating.IModLocator;
|
||||
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
@@ -71,8 +72,11 @@ public class ClasspathLocator extends AbstractModProvider implements IModLocator
|
||||
}
|
||||
|
||||
var ret = new ArrayList<ModFileOrException>();
|
||||
for (var path : claimed)
|
||||
ret.add(createMod(path));
|
||||
for (var path : claimed) {
|
||||
// Filter out anything found by the ServiceLoader
|
||||
if (!ModDirTransformerDiscoverer.isServiceProvider(path))
|
||||
ret.add(createMod(path));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
+8
-1
@@ -83,7 +83,14 @@ public class JarInJarDependencyLocator extends AbstractModProvider implements ID
|
||||
final Map<String, ?> outerFsArgs = ImmutableMap.of("packagePath", pathInModFile);
|
||||
final FileSystem zipFS = FileSystems.newFileSystem(filePathUri, outerFsArgs);
|
||||
final Path pathInFS = zipFS.getPath("/");
|
||||
return Optional.of(createMod(pathInFS).file());
|
||||
final IModFile.Type parentType = file.getType();
|
||||
final String modType;
|
||||
if (parentType == IModFile.Type.LIBRARY || parentType == IModFile.Type.LANGPROVIDER) {
|
||||
modType = IModFile.Type.LIBRARY.name();
|
||||
} else {
|
||||
modType = IModFile.Type.GAMELIBRARY.name();
|
||||
}
|
||||
return Optional.of(createMod(pathInFS, false, modType).file());
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("Failed to load mod file {} from {}", path, file.getFileName());
|
||||
final RuntimeException exception = new ModFileLoadingException("Failed to load mod file " + file.getFileName());
|
||||
|
||||
+84
-66
@@ -7,7 +7,6 @@ package net.minecraftforge.fml.loading.moddiscovery;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import com.mojang.logging.LogUtils;
|
||||
import cpw.mods.modlauncher.api.LamdbaExceptionUtils;
|
||||
import net.minecraftforge.fml.loading.LogMarkers;
|
||||
import net.minecraftforge.fml.loading.StringUtils;
|
||||
import net.minecraftforge.forgespi.language.IConfigurable;
|
||||
@@ -18,17 +17,15 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
import org.slf4j.Logger;
|
||||
import javax.security.auth.x500.X500Principal;
|
||||
import java.net.URL;
|
||||
import java.security.CodeSigner;
|
||||
import java.security.InvalidKeyException;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.NoSuchProviderException;
|
||||
import java.security.SignatureException;
|
||||
import java.security.cert.Certificate;
|
||||
import java.security.cert.CertificateEncodingException;
|
||||
import java.security.cert.CertificateException;
|
||||
import java.security.cert.X509Certificate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
@@ -37,10 +34,8 @@ import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class ModFileInfo implements IModFileInfo, IConfigurable
|
||||
{
|
||||
public class ModFileInfo implements IModFileInfo, IConfigurable {
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
private static final String MAYBE_NOT_JAVAFML_VER = "[2,)";
|
||||
private static final String JAVAFML = "javafml";
|
||||
@@ -60,8 +55,7 @@ public class ModFileInfo implements IModFileInfo, IConfigurable
|
||||
private final String license;
|
||||
private final List<String> usesServices;
|
||||
|
||||
ModFileInfo(final ModFile modFile, final IConfigurable config, Consumer<IModFileInfo> configFileConsumer)
|
||||
{
|
||||
ModFileInfo(final ModFile modFile, final IConfigurable config, Consumer<IModFileInfo> configFileConsumer) {
|
||||
this.modFile = modFile;
|
||||
this.config = config;
|
||||
configFileConsumer.accept(this);
|
||||
@@ -86,10 +80,6 @@ public class ModFileInfo implements IModFileInfo, IConfigurable
|
||||
.orElse(false);
|
||||
this.clientSideOnly = config.<Boolean>getConfigElement("clientSideOnly")
|
||||
.orElse(false);
|
||||
if (this.clientSideOnly) {
|
||||
// if clientSideOnly, then this is definitely a Forge mod
|
||||
maybeNotAForgeMod = false;
|
||||
}
|
||||
this.showAsDataPack = config.<Boolean>getConfigElement("showAsDataPack")
|
||||
.orElse(false);
|
||||
this.usesServices = config.<List<String>>getConfigElement("services")
|
||||
@@ -98,6 +88,10 @@ public class ModFileInfo implements IModFileInfo, IConfigurable
|
||||
.map(StringUtils::toURL)
|
||||
.orElse(null);
|
||||
|
||||
// if clientSideOnly, then this is definitely a Forge mod
|
||||
if (this.clientSideOnly)
|
||||
maybeNotAForgeMod = false;
|
||||
|
||||
if (maybeNotAForgeMod) {
|
||||
// mark this file as not a Forge mod. Note: this marker may be removed later based on the mod dependencies
|
||||
this.properties = config.<Map<String, Object>>getConfigElement("properties")
|
||||
@@ -111,14 +105,13 @@ public class ModFileInfo implements IModFileInfo, IConfigurable
|
||||
|
||||
final List<? extends IConfigurable> modConfigs = config.getConfigList("mods");
|
||||
if (modConfigs.isEmpty())
|
||||
{
|
||||
throw new InvalidModFileException("Missing mods list", this);
|
||||
}
|
||||
|
||||
this.mods = modConfigs.stream()
|
||||
.map(mi-> (IModInfo)new ModInfo(this, mi))
|
||||
.toList();
|
||||
if (LOGGER.isDebugEnabled(LogMarkers.LOADING))
|
||||
{
|
||||
|
||||
if (LOGGER.isDebugEnabled(LogMarkers.LOADING)) {
|
||||
LOGGER.debug(LogMarkers.LOADING, "Found valid mod file {} with {} mods - versions {}",
|
||||
this.modFile.getFileName(),
|
||||
this.mods.stream().map(IModInfo::getModId).collect(Collectors.joining(",", "{", "}")),
|
||||
@@ -132,13 +125,11 @@ public class ModFileInfo implements IModFileInfo, IConfigurable
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IModInfo> getMods()
|
||||
{
|
||||
public List<IModInfo> getMods() {
|
||||
return mods;
|
||||
}
|
||||
|
||||
public ModFile getFile()
|
||||
{
|
||||
public ModFile getFile() {
|
||||
return this.modFile;
|
||||
}
|
||||
|
||||
@@ -148,44 +139,37 @@ public class ModFileInfo implements IModFileInfo, IConfigurable
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getFileProperties()
|
||||
{
|
||||
public Map<String, Object> getFileProperties() {
|
||||
return this.properties;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showAsResourcePack()
|
||||
{
|
||||
public boolean showAsResourcePack() {
|
||||
return this.showAsResourcePack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isClientSideOnly()
|
||||
{
|
||||
public boolean isClientSideOnly() {
|
||||
return this.clientSideOnly;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showAsDataPack()
|
||||
{
|
||||
public boolean showAsDataPack() {
|
||||
return this.showAsDataPack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> Optional<T> getConfigElement(final String... key)
|
||||
{
|
||||
public <T> Optional<T> getConfigElement(final String... key) {
|
||||
return this.config.getConfigElement(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends IConfigurable> getConfigList(final String... key)
|
||||
{
|
||||
public List<? extends IConfigurable> getConfigList(final String... key) {
|
||||
return this.config.getConfigList(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLicense()
|
||||
{
|
||||
public String getLicense() {
|
||||
return license;
|
||||
}
|
||||
|
||||
@@ -194,49 +178,78 @@ public class ModFileInfo implements IModFileInfo, IConfigurable
|
||||
return this;
|
||||
}
|
||||
|
||||
public URL getIssueURL()
|
||||
{
|
||||
public URL getIssueURL() {
|
||||
return issueURL;
|
||||
}
|
||||
|
||||
public boolean missingLicense()
|
||||
{
|
||||
public boolean missingLicense() {
|
||||
return Strings.isNullOrEmpty(license);
|
||||
}
|
||||
|
||||
private final char[] HEX = "0123456789ABCDEF".toCharArray();
|
||||
public Optional<String> getCodeSigningFingerprint() {
|
||||
var signers = this.modFile.getSecureJar().getManifestSigners();
|
||||
return (signers == null ? Stream.<CodeSigner>of() : Arrays.stream(signers))
|
||||
.flatMap(csa->csa.getSignerCertPath().getCertificates().stream())
|
||||
.findFirst()
|
||||
.map(LamdbaExceptionUtils.rethrowFunction(Certificate::getEncoded))
|
||||
.map(bytes->LamdbaExceptionUtils.uncheck(()->MessageDigest.getInstance("SHA-256")).digest(bytes))
|
||||
.map(StringUtils::binToHex)
|
||||
.map(str-> String.join(":", str.split("(?<=\\G.{2})")));
|
||||
if (signers == null)
|
||||
return Optional.empty();
|
||||
|
||||
for (var signer : signers) {
|
||||
for (var cert : signer.getSignerCertPath().getCertificates()) {
|
||||
try {
|
||||
var encoded = cert.getEncoded();
|
||||
var sha256 = MessageDigest.getInstance("SHA-256");
|
||||
var digest = sha256.digest(encoded);
|
||||
var buf = new StringBuilder(digest.length * 3);
|
||||
for (int x = 0; x < digest.length - 1; x++) {
|
||||
buf.append(HEX[(digest[x] & 0xF0) >> 4]);
|
||||
buf.append(HEX[(digest[x] & 0x0F) ]);
|
||||
buf.append(':');
|
||||
}
|
||||
buf.append(HEX[(digest[digest.length - 1] & 0xF0) >> 4]);
|
||||
buf.append(HEX[(digest[digest.length - 1] & 0x0F) ]);
|
||||
|
||||
// We only care about the first. Should we list them all?
|
||||
return Optional.of(buf.toString());
|
||||
} catch (CertificateEncodingException | NoSuchAlgorithmException e) {
|
||||
sneak(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Optional.empty();
|
||||
|
||||
}
|
||||
|
||||
public Optional<String> getTrustData() {
|
||||
return Arrays.stream(this.modFile.getSecureJar().getManifestSigners())
|
||||
.flatMap(csa->csa.getSignerCertPath().getCertificates().stream())
|
||||
.findFirst()
|
||||
.map(X509Certificate.class::cast)
|
||||
.map(c->{
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append(c.getSubjectX500Principal().getName(X500Principal.RFC2253).split(",")[0]);
|
||||
boolean selfSigned = false;
|
||||
try {
|
||||
c.verify(c.getPublicKey());
|
||||
selfSigned = true;
|
||||
} catch (CertificateException | NoSuchAlgorithmException | InvalidKeyException | SignatureException | NoSuchProviderException e) {
|
||||
// not self signed
|
||||
}
|
||||
if (selfSigned) {
|
||||
var signers = this.modFile.getSecureJar().getManifestSigners();
|
||||
if (signers == null)
|
||||
return Optional.empty();
|
||||
|
||||
for (var signer : signers) {
|
||||
for (var cert : signer.getSignerCertPath().getCertificates()) {
|
||||
if (!(cert instanceof X509Certificate x509))
|
||||
continue;
|
||||
|
||||
var sb = new StringBuilder();
|
||||
sb.append(x509.getSubjectX500Principal().getName(X500Principal.RFC2253).split(",")[0]);
|
||||
|
||||
var selfSigned = false;
|
||||
try {
|
||||
x509.verify(x509.getPublicKey());
|
||||
selfSigned = true;
|
||||
} catch (CertificateException | NoSuchAlgorithmException | InvalidKeyException | SignatureException | NoSuchProviderException e) {
|
||||
// not self signed
|
||||
}
|
||||
|
||||
if (selfSigned)
|
||||
sb.append(" self-signed");
|
||||
} else {
|
||||
sb.append(" signed by ").append(c.getIssuerX500Principal().getName(X500Principal.RFC2253).split(",")[0]);
|
||||
};
|
||||
return sb.toString();
|
||||
});
|
||||
else
|
||||
sb.append(" signed by ").append(x509.getIssuerX500Principal().getName(X500Principal.RFC2253).split(",")[0]);
|
||||
|
||||
return Optional.of(sb.toString());
|
||||
}
|
||||
}
|
||||
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -253,4 +266,9 @@ public class ModFileInfo implements IModFileInfo, IConfigurable
|
||||
public List<String> usesServices() {
|
||||
return usesServices;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private static <E extends Throwable, R> R sneak(Throwable e) throws E {
|
||||
throw (E)e;
|
||||
}
|
||||
}
|
||||
@@ -19,11 +19,11 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@ApiStatus.Internal
|
||||
@@ -50,34 +50,39 @@ public class ModInfo implements IModInfo, IConfigurable {
|
||||
private final IConfigurable config;
|
||||
private final Optional<URL> modUrl;
|
||||
|
||||
public ModInfo(final ModFileInfo owningFile, final IConfigurable config)
|
||||
{
|
||||
public ModInfo(final ModFileInfo owningFile, final IConfigurable config) {
|
||||
Optional<ModFileInfo> ownFile = Optional.ofNullable(owningFile);
|
||||
this.owningFile = owningFile;
|
||||
this.config = config;
|
||||
|
||||
// These are sourced from the mod specific [[mod]] entry
|
||||
this.modId = config.<String>getConfigElement("modId")
|
||||
.orElseThrow(() -> new InvalidModFileException("Missing modId", owningFile));
|
||||
|
||||
// verify we have a valid modid
|
||||
if (!VALID_MODID.matcher(this.modId).matches()) {
|
||||
LOGGER.error(LogUtils.FATAL_MARKER, "Invalid modId found in file {} - {} does not match the standard: {}", this.owningFile.getFile().getFilePath(), this.modId, VALID_MODID.pattern());
|
||||
throw new InvalidModFileException("Invalid modId found : " + this.modId, owningFile);
|
||||
}
|
||||
|
||||
this.namespace = config.<String>getConfigElement("namespace")
|
||||
.orElse(this.modId);
|
||||
|
||||
// verify our namespace is valid
|
||||
if (!VALID_NAMESPACE.matcher(this.namespace).matches()) {
|
||||
LOGGER.error(LogUtils.FATAL_MARKER, "Invalid override namespace found in file {} - {} does not match the standard: {}", this.owningFile.getFile().getFilePath(), this.namespace, VALID_NAMESPACE.pattern());
|
||||
throw new InvalidModFileException("Invalid override namespace found : " + this.namespace, owningFile);
|
||||
}
|
||||
|
||||
this.version = config.<String>getConfigElement("version")
|
||||
.map(s -> StringSubstitutor.replace(s, ownFile.map(ModFileInfo::getFile).orElse(null)))
|
||||
.map(DefaultArtifactVersion::new)
|
||||
.orElse(DEFAULT_VERSION);
|
||||
|
||||
// verify we have a valid mod version
|
||||
if (!VALID_VERSION.matcher(this.version.toString()).matches()) {
|
||||
throw new InvalidModFileException("Illegal version number specified "+this.version, this.getOwningFile());
|
||||
}
|
||||
if (!VALID_VERSION.matcher(this.version.toString()).matches())
|
||||
throw new InvalidModFileException("Illegal version number specified " + this.version, this.getOwningFile());
|
||||
|
||||
// The remaining properties all default to sensible values and are not essential
|
||||
this.displayName = config.<String>getConfigElement("displayName")
|
||||
.orElse(this.modId);
|
||||
@@ -88,25 +93,48 @@ public class ModInfo implements IModInfo, IConfigurable {
|
||||
.orElseGet(() -> ownFile.flatMap(mf -> mf.<String>getConfigElement("logoFile"))
|
||||
.orElse(null)));
|
||||
this.logoBlur = config.<Boolean>getConfigElement("logoBlur")
|
||||
.orElseGet(() -> ownFile.flatMap(f -> f.<Boolean>getConfigElement("logoBlur"))
|
||||
.orElseGet(() -> ownFile.flatMap(mf -> mf.<Boolean>getConfigElement("logoBlur"))
|
||||
.orElse(true));
|
||||
this.updateJSONURL = config.<String>getConfigElement("updateJSONURL")
|
||||
.map(StringUtils::toURL);
|
||||
this.modUrl = config.<String>getConfigElement("modUrl")
|
||||
.map(StringUtils::toURL);
|
||||
|
||||
// These are sourced from the file rather than the mod-specific block, but with a modid tag
|
||||
this.dependencies = ownFile.map(mfi -> mfi.getConfigList("dependencies", this.modId))
|
||||
.orElse(Collections.emptyList())
|
||||
.stream()
|
||||
.map(dep -> new ModVersion(this, dep))
|
||||
.toList();
|
||||
this.features = ownFile.flatMap(mfi -> mfi.<Map<String, Object>>getConfigElement("features", this.modId))
|
||||
.stream()
|
||||
.flatMap(m->m.entrySet().stream())
|
||||
.map(this::makeBound)
|
||||
.toList();
|
||||
this.properties = ownFile.flatMap(mfi -> mfi.<Map<String, Object>>getConfigElement("modproperties", this.modId))
|
||||
.orElse(Collections.emptyMap());
|
||||
if (ownFile.isEmpty()) {
|
||||
this.dependencies = Collections.emptyList();
|
||||
this.features = Collections.emptyList();
|
||||
this.properties = Collections.emptyMap();
|
||||
} else {
|
||||
var deps = this.owningFile.getConfigList("dependencies", this.modId);
|
||||
if (deps == null || deps.isEmpty()) {
|
||||
this.dependencies = Collections.emptyList();
|
||||
} else {
|
||||
var tmp = new ArrayList<ModVersion>();
|
||||
for (var dep : deps)
|
||||
tmp.add(new ModVersion(this, dep));
|
||||
this.dependencies = Collections.unmodifiableList(tmp);
|
||||
}
|
||||
|
||||
var feats = this.owningFile.<Map<String, Object>>getConfigElement("features", this.modId).orElse(null);
|
||||
if (feats == null) {
|
||||
this.features = Collections.emptyList();
|
||||
} else {
|
||||
var tmp = new ArrayList<ForgeFeature.Bound>();
|
||||
for (var entry : feats.entrySet()) {
|
||||
if (!(entry.getValue() instanceof String val))
|
||||
throw new InvalidModFileException("Invalid feature bound {" + entry.getValue() + "} for key {" + entry.getKey() + "} only strings are accepted", this.owningFile);
|
||||
tmp.add(new ForgeFeature.Bound(entry.getKey(), val, this));
|
||||
}
|
||||
this.features = Collections.unmodifiableList(tmp);
|
||||
}
|
||||
|
||||
var props = this.owningFile.<Map<String, Object>>getConfigElement("modproperties", this.modId).orElse(null);
|
||||
if (props == null)
|
||||
this.properties = Collections.emptyMap();
|
||||
else
|
||||
this.properties = Collections.unmodifiableMap(props);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -120,14 +148,12 @@ public class ModInfo implements IModInfo, IConfigurable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisplayName()
|
||||
{
|
||||
public String getDisplayName() {
|
||||
return this.displayName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription()
|
||||
{
|
||||
public String getDescription() {
|
||||
return this.description;
|
||||
}
|
||||
|
||||
@@ -157,14 +183,12 @@ public class ModInfo implements IModInfo, IConfigurable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<String> getLogoFile()
|
||||
{
|
||||
public Optional<String> getLogoFile() {
|
||||
return this.logoFile;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getLogoBlur()
|
||||
{
|
||||
public boolean getLogoBlur() {
|
||||
return this.logoBlur;
|
||||
}
|
||||
|
||||
@@ -193,14 +217,6 @@ public class ModInfo implements IModInfo, IConfigurable {
|
||||
return modUrl;
|
||||
}
|
||||
|
||||
private ForgeFeature.Bound makeBound(Map.Entry<String, Object> e) {
|
||||
if (e.getValue() instanceof String val) {
|
||||
return new ForgeFeature.Bound(e.getKey(), val, this);
|
||||
} else {
|
||||
throw new InvalidModFileException("Invalid feature bound {" + e.getValue() + "} for key {" + e.getKey() + "} only strings are accepted", this.owningFile);
|
||||
}
|
||||
}
|
||||
|
||||
class ModVersion implements net.minecraftforge.forgespi.language.IModInfo.ModVersion {
|
||||
private IModInfo owner;
|
||||
private final String modId;
|
||||
@@ -214,6 +230,7 @@ public class ModInfo implements IModInfo, IConfigurable {
|
||||
this.owner = owner;
|
||||
this.modId = config.<String>getConfigElement("modId")
|
||||
.orElseThrow(()->new InvalidModFileException("Missing required field modid in dependency", getOwningFile()));
|
||||
|
||||
if (this.modId.equals("forge")) {
|
||||
var fileProps = owner.getOwningFile().getFileProperties();
|
||||
// Checking containsKey to avoid a possible exception if the property is not present (due to Collections.emptyMap())
|
||||
@@ -223,14 +240,15 @@ public class ModInfo implements IModInfo, IConfigurable {
|
||||
fileProps.remove(ModFileInfo.NOT_A_FORGE_MOD_PROP);
|
||||
}
|
||||
}
|
||||
|
||||
var mandatory = config.<Boolean>getConfigElement("mandatory");
|
||||
if (mandatory.isPresent()) {
|
||||
if (mandatory.isPresent())
|
||||
this.mandatory = mandatory.get();
|
||||
} else if (owner.getOwningFile().getFileProperties().containsKey(ModFileInfo.NOT_A_FORGE_MOD_PROP)) {
|
||||
else if (owner.getOwningFile().getFileProperties().containsKey(ModFileInfo.NOT_A_FORGE_MOD_PROP))
|
||||
this.mandatory = true;
|
||||
} else {
|
||||
else
|
||||
throw new InvalidModFileException("Missing required field mandatory in dependency", getOwningFile());
|
||||
}
|
||||
|
||||
this.versionRange = config.<String>getConfigElement("versionRange")
|
||||
.map(MavenVersionAdapter::createFromVersionSpec)
|
||||
.orElse(UNBOUNDED);
|
||||
@@ -244,46 +262,38 @@ public class ModInfo implements IModInfo, IConfigurable {
|
||||
.map(StringUtils::toURL);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getModId()
|
||||
{
|
||||
public String getModId() {
|
||||
return modId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VersionRange getVersionRange()
|
||||
{
|
||||
public VersionRange getVersionRange() {
|
||||
return versionRange;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMandatory()
|
||||
{
|
||||
public boolean isMandatory() {
|
||||
return mandatory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Ordering getOrdering()
|
||||
{
|
||||
public Ordering getOrdering() {
|
||||
return ordering;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DependencySide getSide()
|
||||
{
|
||||
public DependencySide getSide() {
|
||||
return side;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOwner(final IModInfo owner)
|
||||
{
|
||||
public void setOwner(final IModInfo owner) {
|
||||
this.owner = owner;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IModInfo getOwner()
|
||||
{
|
||||
public IModInfo getOwner() {
|
||||
return owner;
|
||||
}
|
||||
|
||||
@@ -292,5 +302,4 @@ public class ModInfo implements IModInfo, IConfigurable {
|
||||
return referralUrl;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+16
-5
@@ -16,6 +16,7 @@ import org.slf4j.Logger;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
@@ -42,11 +43,21 @@ public class ModsFolderLocator extends AbstractModProvider implements IModLocato
|
||||
public List<IModLocator.ModFileOrException> scanMods() {
|
||||
LOGGER.debug(LogMarkers.SCAN, "Scanning mods dir {} for mods", this.modFolder);
|
||||
var excluded = ModDirTransformerDiscoverer.allExcluded();
|
||||
try (var stream = Files.list(this.modFolder)) {
|
||||
return stream.filter(path -> !excluded.contains(path) && path.getFileName().toString().toLowerCase(Locale.ROOT).endsWith(SUFFIX))
|
||||
.sorted(Comparator.comparing(path -> path.getFileName().toString().toLowerCase(Locale.ROOT)))
|
||||
.map(this::createMod)
|
||||
.toList();
|
||||
try {
|
||||
var ret = new ArrayList<IModLocator.ModFileOrException>();
|
||||
var files = Files.list(this.modFolder).toList();
|
||||
for (var file : files) {
|
||||
var name = file.getFileName().toString().toLowerCase(Locale.ROOT);
|
||||
if (excluded.contains(file) || !name.endsWith(SUFFIX))
|
||||
continue;
|
||||
var mod = this.createMod(file, true);
|
||||
if (mod == null) {
|
||||
LOGGER.debug(LogMarkers.SCAN, "Found unknown jar file {} ignoring", file);
|
||||
} else {
|
||||
ret.add(mod);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
} catch (IOException e) {
|
||||
return sneak(e);
|
||||
}
|
||||
|
||||
+8
-2
@@ -6,6 +6,8 @@
|
||||
package net.minecraftforge.fml.loading.moddiscovery;
|
||||
|
||||
import com.electronwill.nightconfig.core.UnmodifiableConfig;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import net.minecraftforge.forgespi.language.IConfigurable;
|
||||
import net.minecraftforge.forgespi.language.IModFileInfo;
|
||||
|
||||
@@ -38,8 +40,12 @@ class NightConfigWrapper implements IConfigurable {
|
||||
public <T> Optional<T> getConfigElement(final String... key) {
|
||||
var path = asList(key);
|
||||
return this.config.getOptional(path).map(value -> {
|
||||
if (value instanceof UnmodifiableConfig) {
|
||||
return (T) ((UnmodifiableConfig) value).valueMap();
|
||||
if (value instanceof UnmodifiableConfig cfg) {
|
||||
// New Night config doesn't implement valueMap(), so do a copy.
|
||||
var builder = ImmutableMap.builder();
|
||||
for (var e: cfg.entrySet())
|
||||
builder.put(e.getKey(), e.getValue());
|
||||
return (T)builder.build();
|
||||
} else if (value instanceof ArrayList<?> al && al.size() > 0 && al.get(0) instanceof UnmodifiableConfig) {
|
||||
throw new InvalidModFileException("The configuration path " + path + " is invalid. I wasn't expecting a multi-object list - remove one of the [[ ]]", file);
|
||||
}
|
||||
|
||||
+5
-5
@@ -5,13 +5,13 @@ org.gradle.daemon=false
|
||||
org.gradle.parallel=true
|
||||
|
||||
JAVA_VERSION=21
|
||||
MC_VERSION=1.20.6
|
||||
MC_NEXT_VERSION=1.21
|
||||
MCP_VERSION=20240429.135109
|
||||
MC_VERSION=1.21.1
|
||||
MC_NEXT_VERSION=1.22
|
||||
MCP_VERSION=20240808.132146
|
||||
MAPPING_CHANNEL=official
|
||||
MAPPING_VERSION=1.20.6
|
||||
MAPPING_VERSION=1.21.1
|
||||
|
||||
// Set to true before the first build of a new MC version, so we don't do compatibility checks
|
||||
CHECK_COMPATIBILITY=false
|
||||
// Set to true to allow for fuzzy patching. Useful during updateing
|
||||
UPDATING=false
|
||||
UPDATING=true
|
||||
+12
@@ -6,6 +6,7 @@
|
||||
package net.minecraftforge.fml.javafmlmod;
|
||||
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.fml.Logging;
|
||||
import net.minecraftforge.fml.ModContainer;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
@@ -19,6 +20,7 @@ import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.objectweb.asm.Type;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -32,6 +34,7 @@ public class AutomaticEventSubscriber {
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
private static final Type AUTO_SUBSCRIBER = Type.getType(EventBusSubscriber.class);
|
||||
private static final Type MOD_TYPE = Type.getType(Mod.class);
|
||||
private static final Type ONLY_IN_TYPE = Type.getType(OnlyIn.class);
|
||||
|
||||
public static void inject(ModContainer mod, ModFileScanData scanData, ClassLoader loader) {
|
||||
if (scanData == null) return;
|
||||
@@ -41,6 +44,11 @@ public class AutomaticEventSubscriber {
|
||||
.filter(data -> AUTO_SUBSCRIBER.equals(data.annotationType()))
|
||||
.toList();
|
||||
|
||||
var onlyIns = FMLEnvironment.production ? Collections.emptySet() : scanData.getAnnotations().stream()
|
||||
.filter(data -> ONLY_IN_TYPE.equals(data.annotationType()))
|
||||
.map(data -> data.clazz().getClassName())
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
var modids = scanData.getAnnotations().stream()
|
||||
.filter(data -> MOD_TYPE.equals(data.annotationType()))
|
||||
.collect(Collectors.toMap(a -> a.clazz().getClassName(), a -> (String)a.annotationData().get("value")));
|
||||
@@ -49,6 +57,10 @@ public class AutomaticEventSubscriber {
|
||||
var defaultBus = new EnumData(null, "FORGE");
|
||||
|
||||
for (var data : targets) {
|
||||
if (!FMLEnvironment.production && onlyIns.contains(data.clazz().getClassName())) {
|
||||
throw new RuntimeException("Found @OnlyIn on @EventBusSubscriber class " + data.clazz().getClassName() + " - this is not allowed as it causes crashes. Remove the OnlyIn and set value=Dist.CLIENT in the EventBusSubscriber annotation instead");
|
||||
}
|
||||
|
||||
var modId = modids.getOrDefault(data.clazz().getClassName(), mod.getModId());
|
||||
modId = value(data, "modid", modId);
|
||||
|
||||
|
||||
+5
-2
@@ -2,7 +2,7 @@ plugins {
|
||||
id 'eclipse'
|
||||
id 'idea'
|
||||
id 'maven-publish'
|
||||
id 'net.minecraftforge.gradle' version '[6.0.16,6.2)'
|
||||
id 'net.minecraftforge.gradle' version '[6.0.24,6.2)'
|
||||
}
|
||||
|
||||
version = mod_version
|
||||
@@ -31,6 +31,9 @@ minecraft {
|
||||
// Use non-default mappings at your own risk. They may not always work.
|
||||
// Simply re-run your setup task after changing the mappings to update your workspace.
|
||||
mappings channel: mapping_channel, version: mapping_version
|
||||
|
||||
// Tell FG to not automtically create the reobf tasks, as we now use Official mappings at runtime, If you don't use them at dev time then you'll have to fix your reobf yourself.
|
||||
reobf = false
|
||||
|
||||
// When true, this property will have all Eclipse/IntelliJ IDEA run configurations run the "prepareX" task for the given run configuration before launching the game.
|
||||
// In most cases, it is not necessary to enable.
|
||||
@@ -139,7 +142,7 @@ dependencies {
|
||||
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
|
||||
// http://www.gradle.org/docs/current/userguide/dependency_management.html
|
||||
|
||||
// Hack fix for now, force jopt-simple to be exactly 5.0.4 because Mojang ships that version, but some transtive dependencies request 6.0+
|
||||
// Hack fix for now, force jopt-simple to be exactly 5.0.4 because Mojang ships that version, but some transitive dependencies request 6.0+
|
||||
implementation('net.sf.jopt-simple:jopt-simple:5.0.4') { version { strictly '5.0.4' } }
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ public class Config
|
||||
|
||||
private static boolean validateItemName(final Object obj)
|
||||
{
|
||||
return obj instanceof final String itemName && ForgeRegistries.ITEMS.containsKey(new ResourceLocation(itemName));
|
||||
return obj instanceof final String itemName && ForgeRegistries.ITEMS.containsKey(ResourceLocation.tryParse(itemName));
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
@@ -58,7 +58,7 @@ public class Config
|
||||
|
||||
// convert the list of strings into a set of items
|
||||
items = ITEM_STRINGS.get().stream()
|
||||
.map(itemName -> ForgeRegistries.ITEMS.getValue(new ResourceLocation(itemName)))
|
||||
.map(itemName -> ForgeRegistries.ITEMS.getValue(ResourceLocation.tryParse(itemName)))
|
||||
.collect(Collectors.toSet());
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,18 @@
|
||||
--- a/com/mojang/blaze3d/pipeline/RenderTarget.java
|
||||
+++ b/com/mojang/blaze3d/pipeline/RenderTarget.java
|
||||
@@ -113,11 +_,19 @@
|
||||
GlStateManager._bindTexture(this.colorTextureId);
|
||||
GlStateManager._texParameter(3553, 10242, 33071);
|
||||
GlStateManager._texParameter(3553, 10243, 33071);
|
||||
+ if (!stencilEnabled)
|
||||
@@ -104,7 +_,10 @@
|
||||
GlStateManager._texParameter(3553, 34892, 0);
|
||||
GlStateManager._texParameter(3553, 10242, 33071);
|
||||
GlStateManager._texParameter(3553, 10243, 33071);
|
||||
+ if (!stencilEnabled)
|
||||
GlStateManager._texImage2D(3553, 0, 6402, this.width, this.height, 0, 6402, 5126, null);
|
||||
+ else
|
||||
+ GlStateManager._texImage2D(3553, 0, org.lwjgl.opengl.GL30.GL_DEPTH32F_STENCIL8, this.width, this.height, 0, org.lwjgl.opengl.GL30.GL_DEPTH_STENCIL, org.lwjgl.opengl.GL30.GL_FLOAT_32_UNSIGNED_INT_24_8_REV, null);
|
||||
}
|
||||
|
||||
this.setFilterMode(9728, true);
|
||||
@@ -114,8 +_,13 @@
|
||||
GlStateManager._texImage2D(3553, 0, 32856, this.width, this.height, 0, 6408, 5121, null);
|
||||
+ else
|
||||
+ GlStateManager._texImage2D(3553, 0, org.lwjgl.opengl.GL30.GL_DEPTH32F_STENCIL8, this.width, this.height, 0, org.lwjgl.opengl.GL30.GL_DEPTH_STENCIL, org.lwjgl.opengl.GL30.GL_FLOAT_32_UNSIGNED_INT_24_8_REV, null);
|
||||
GlStateManager._glBindFramebuffer(36160, this.frameBufferId);
|
||||
GlStateManager._glFramebufferTexture2D(36160, 36064, 3553, this.colorTextureId, 0);
|
||||
- if (this.useDepth) {
|
||||
@@ -21,7 +26,7 @@
|
||||
}
|
||||
|
||||
this.checkStatus();
|
||||
@@ -280,5 +_,26 @@
|
||||
@@ -257,5 +_,26 @@
|
||||
|
||||
public int getDepthTextureId() {
|
||||
return this.depthBufferId;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/com/mojang/blaze3d/platform/Window.java
|
||||
+++ b/com/mojang/blaze3d/platform/Window.java
|
||||
@@ -82,7 +_,8 @@
|
||||
@@ -84,7 +_,8 @@
|
||||
GLFW.glfwWindowHint(139267, 2);
|
||||
GLFW.glfwWindowHint(139272, 204801);
|
||||
GLFW.glfwWindowHint(139270, 1);
|
||||
@@ -10,7 +10,7 @@
|
||||
if (monitor != null) {
|
||||
VideoMode videomode = monitor.getPreferredVidMode(this.fullscreen ? this.preferredFullscreenVideoMode : Optional.empty());
|
||||
this.windowedX = this.x = monitor.getX() + videomode.getWidth() / 2 - this.width / 2;
|
||||
@@ -94,6 +_,7 @@
|
||||
@@ -96,6 +_,7 @@
|
||||
this.windowedX = this.x = aint1[0];
|
||||
this.windowedY = this.y = aint[0];
|
||||
}
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
GLFW.glfwMakeContextCurrent(this.window);
|
||||
GL.createCapabilities();
|
||||
@@ -242,6 +_,9 @@
|
||||
@@ -254,6 +_,9 @@
|
||||
GLFW.glfwGetFramebufferSize(this.window, aint, aint1);
|
||||
this.framebufferWidth = aint[0] > 0 ? aint[0] : 1;
|
||||
this.framebufferHeight = aint1[0] > 0 ? aint1[0] : 1;
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
--- a/com/mojang/blaze3d/vertex/BufferBuilder.java
|
||||
+++ b/com/mojang/blaze3d/vertex/BufferBuilder.java
|
||||
@@ -389,6 +_,15 @@
|
||||
return MemoryUtil.memSlice(this.buffer, p_231170_, p_231171_ - p_231170_);
|
||||
}
|
||||
|
||||
+ public void putBulkData(ByteBuffer buffer) {
|
||||
+ ensureCapacity(buffer.limit() + this.format.getVertexSize());
|
||||
+ this.buffer.position(this.nextElementByte);
|
||||
+ this.buffer.put(buffer);
|
||||
+ this.buffer.position(0);
|
||||
+ this.vertices += buffer.limit() / this.format.getVertexSize();
|
||||
+ this.nextElementByte += buffer.limit();
|
||||
+ }
|
||||
+
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static record DrawState(
|
||||
VertexFormat format, int vertexCount, int indexCount, VertexFormat.Mode mode, VertexFormat.IndexType indexType, boolean indexOnly, boolean sequentialIndex
|
||||
@@ -1,11 +1,11 @@
|
||||
--- a/com/mojang/blaze3d/vertex/SheetedDecalTextureGenerator.java
|
||||
+++ b/com/mojang/blaze3d/vertex/SheetedDecalTextureGenerator.java
|
||||
@@ -47,7 +_,7 @@
|
||||
@Override
|
||||
public void endVertex() {
|
||||
Vector3f vector3f = this.normalInversePose.transform(new Vector3f(this.nx, this.ny, this.nz));
|
||||
@@ -62,7 +_,7 @@
|
||||
public VertexConsumer setNormal(float p_344306_, float p_342091_, float p_344579_) {
|
||||
this.delegate.setNormal(p_344306_, p_342091_, p_344579_);
|
||||
Vector3f vector3f = this.normalInversePose.transform(p_344306_, p_342091_, p_344579_, this.normal);
|
||||
- Direction direction = Direction.getNearest(vector3f.x(), vector3f.y(), vector3f.z());
|
||||
+ Direction direction = net.minecraftforge.client.ForgeHooksClient.getNearestStable(vector3f.x(), vector3f.y(), vector3f.z());
|
||||
Vector4f vector4f = this.cameraInversePose.transform(new Vector4f(this.x, this.y, this.z, 1.0F));
|
||||
vector4f.rotateY((float) Math.PI);
|
||||
vector4f.rotateX((float) (-Math.PI / 2));
|
||||
Vector3f vector3f1 = this.cameraInversePose.transformPosition(this.x, this.y, this.z, this.worldPos);
|
||||
vector3f1.rotateY((float) Math.PI);
|
||||
vector3f1.rotateX((float) (-Math.PI / 2));
|
||||
@@ -1,24 +1,24 @@
|
||||
--- a/com/mojang/blaze3d/vertex/VertexConsumer.java
|
||||
+++ b/com/mojang/blaze3d/vertex/VertexConsumer.java
|
||||
@@ -13,7 +_,7 @@
|
||||
@@ -12,7 +_,7 @@
|
||||
import org.lwjgl.system.MemoryStack;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
-public interface VertexConsumer {
|
||||
+public interface VertexConsumer extends net.minecraftforge.client.extensions.IForgeVertexConsumer {
|
||||
VertexConsumer vertex(double p_85945_, double p_85946_, double p_85947_);
|
||||
VertexConsumer addVertex(float p_344294_, float p_342213_, float p_344859_);
|
||||
|
||||
VertexConsumer color(int p_85973_, int p_85974_, int p_85975_, int p_85976_);
|
||||
@@ -142,10 +_,11 @@
|
||||
f5 = afloat[k] * p_85992_;
|
||||
VertexConsumer setColor(int p_342749_, int p_344324_, int p_343336_, int p_342831_);
|
||||
@@ -135,10 +_,11 @@
|
||||
}
|
||||
|
||||
- int l = aint[k];
|
||||
+ int l = applyBakedLighting(aint[k], bytebuffer);
|
||||
float f9 = bytebuffer.getFloat(16);
|
||||
float f10 = bytebuffer.getFloat(20);
|
||||
Vector4f vector4f = matrix4f.transform(new Vector4f(f, f1, f2, 1.0F));
|
||||
int i1 = FastColor.ARGB32.color(k, (int)f3, (int)f4, (int)f5);
|
||||
- int j1 = p_331444_[l];
|
||||
+ int j1 = applyBakedLighting(p_331444_[l], bytebuffer);
|
||||
float f10 = bytebuffer.getFloat(16);
|
||||
float f9 = bytebuffer.getFloat(20);
|
||||
Vector3f vector3f1 = matrix4f.transformPosition(f, f1, f2, new Vector3f());
|
||||
+ applyBakedNormals(vector3f, bytebuffer, p_85988_.normal());
|
||||
this.vertex(vector4f.x(), vector4f.y(), vector4f.z(), f3, f4, f5, p_335371_, f9, f10, p_85993_, l, vector3f.x(), vector3f.y(), vector3f.z());
|
||||
this.addVertex(vector3f1.x(), vector3f1.y(), vector3f1.z(), i1, f10, f9, p_85993_, j1, vector3f.x(), vector3f.y(), vector3f.z());
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,41 @@
|
||||
--- a/com/mojang/blaze3d/vertex/VertexFormat.java
|
||||
+++ b/com/mojang/blaze3d/vertex/VertexFormat.java
|
||||
@@ -114,6 +_,13 @@
|
||||
return vertexbuffer;
|
||||
@@ -13,7 +_,7 @@
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
-public class VertexFormat {
|
||||
+public class VertexFormat implements net.minecraftforge.client.extensions.IForgeVertexFormat {
|
||||
public static final int UNKNOWN_ELEMENT = -1;
|
||||
private final List<VertexFormatElement> elements;
|
||||
private final List<String> names;
|
||||
@@ -22,6 +_,7 @@
|
||||
private final int[] offsetsByElement = new int[32];
|
||||
@Nullable
|
||||
private VertexBuffer immediateDrawVertexBuffer;
|
||||
+ private final com.google.common.collect.ImmutableMap<String, VertexFormatElement> elementMapping;
|
||||
|
||||
VertexFormat(List<VertexFormatElement> p_343616_, List<String> p_345241_, IntList p_345522_, int p_344162_) {
|
||||
this.elements = p_343616_;
|
||||
@@ -34,6 +_,11 @@
|
||||
int j = vertexformatelement != null ? p_343616_.indexOf(vertexformatelement) : -1;
|
||||
this.offsetsByElement[i] = j != -1 ? p_345522_.getInt(j) : -1;
|
||||
}
|
||||
+
|
||||
+ ImmutableMap.Builder<String, VertexFormatElement> elements = ImmutableMap.builder();
|
||||
+ for (int i = 0; i < p_343616_.size(); i++)
|
||||
+ elements.put(p_345241_.get(i), p_343616_.get(i));
|
||||
+ this.elementMapping = elements.buildOrThrow();
|
||||
}
|
||||
|
||||
+ public ImmutableMap<String, VertexFormatElement> getElementMapping() { return elementMapping; }
|
||||
+ public int getOffset(int index) { return offsets.getInt(index); }
|
||||
+ public boolean hasPosition() { return elements.stream().anyMatch(e -> e.getUsage() == VertexFormatElement.Usage.POSITION); }
|
||||
+ public boolean hasNormal() { return elements.stream().anyMatch(e -> e.getUsage() == VertexFormatElement.Usage.NORMAL); }
|
||||
+ public boolean hasColor() { return elements.stream().anyMatch(e -> e.getUsage() == VertexFormatElement.Usage.COLOR); }
|
||||
+ public boolean hasUV(int which) { return elements.stream().anyMatch(e -> e.getUsage() == VertexFormatElement.Usage.UV && e.getIndex() == which); }
|
||||
public static VertexFormat.Builder builder() {
|
||||
@@ -158,6 +_,9 @@
|
||||
|
||||
return vertexbuffer;
|
||||
}
|
||||
+
|
||||
+ public ImmutableMap<String, VertexFormatElement> getElementMapping() { return elementMapping; }
|
||||
+ public int getOffset(int index) { return offsetsByElement[index]; }
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static enum IndexType {
|
||||
SHORT(5123, 2),
|
||||
public static class Builder {
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/CrashReport.java
|
||||
+++ b/net/minecraft/CrashReport.java
|
||||
@@ -59,14 +_,9 @@
|
||||
@@ -58,14 +_,9 @@
|
||||
if (this.uncategorizedStackTrace != null && this.uncategorizedStackTrace.length > 0) {
|
||||
p_127520_.append("-- Head --\n");
|
||||
p_127520_.append("Thread: ").append(Thread.currentThread().getName()).append("\n");
|
||||
@@ -18,7 +18,7 @@
|
||||
}
|
||||
|
||||
for (CrashReportCategory crashreportcategory : this.details) {
|
||||
@@ -74,6 +_,7 @@
|
||||
@@ -73,6 +_,7 @@
|
||||
p_127520_.append("\n\n");
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
this.systemReport.appendToCrashReportString(p_127520_);
|
||||
}
|
||||
|
||||
@@ -93,18 +_,7 @@
|
||||
@@ -92,18 +_,7 @@
|
||||
throwable.setStackTrace(this.exception.getStackTrace());
|
||||
}
|
||||
|
||||
@@ -45,4 +45,4 @@
|
||||
+ return net.minecraftforge.logging.CrashReportExtender.generateEnhancedStackTrace(throwable);
|
||||
}
|
||||
|
||||
public String getFriendlyReport() {
|
||||
public String getFriendlyReport(ReportType p_343869_, List<String> p_342487_) {
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/SharedConstants.java
|
||||
+++ b/net/minecraft/SharedConstants.java
|
||||
@@ -181,6 +_,7 @@
|
||||
@@ -171,6 +_,7 @@
|
||||
}
|
||||
|
||||
static {
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
}
|
||||
|
||||
public AdvancementHolder save(Consumer<AdvancementHolder> p_138390_, String p_138391_) {
|
||||
- AdvancementHolder advancementholder = this.build(new ResourceLocation(p_138391_));
|
||||
+ return save(p_138390_, new ResourceLocation(p_138391_));
|
||||
- AdvancementHolder advancementholder = this.build(ResourceLocation.parse(p_138391_));
|
||||
+ return save(p_138390_, ResourceLocation.parse(p_138391_));
|
||||
+ }
|
||||
+
|
||||
+ public AdvancementHolder save(Consumer<AdvancementHolder> p_138390_, ResourceLocation id) {
|
||||
|
||||
@@ -1,12 +1,24 @@
|
||||
--- a/net/minecraft/client/Camera.java
|
||||
+++ b/net/minecraft/client/Camera.java
|
||||
@@ -227,6 +_,18 @@
|
||||
return this.partialTickTime;
|
||||
@@ -105,9 +_,13 @@
|
||||
}
|
||||
|
||||
+ public void setAnglesInternal(float yaw, float pitch) {
|
||||
+ this.yRot = yaw;
|
||||
+ this.xRot = pitch;
|
||||
protected void setRotation(float p_90573_, float p_90574_) {
|
||||
+ setRotation(p_90573_, p_90574_, 0.0f);
|
||||
+ }
|
||||
+
|
||||
+ public void setRotation(float p_90573_, float p_90574_, float z) {
|
||||
this.xRot = p_90574_;
|
||||
this.yRot = p_90573_;
|
||||
- this.rotation.rotationYXZ((float) Math.PI - p_90573_ * (float) (Math.PI / 180.0), -p_90574_ * (float) (Math.PI / 180.0), 0.0F);
|
||||
+ this.rotation.rotationYXZ((float) Math.PI - p_90573_ * (float) (Math.PI / 180.0), -p_90574_ * (float) (Math.PI / 180.0), z * (float) (Math.PI / 180.0));
|
||||
FORWARDS.rotate(this.rotation, this.forwards);
|
||||
UP.rotate(this.rotation, this.up);
|
||||
LEFT.rotate(this.rotation, this.left);
|
||||
@@ -223,6 +_,13 @@
|
||||
|
||||
public float getPartialTickTime() {
|
||||
return this.partialTickTime;
|
||||
+ }
|
||||
+
|
||||
+ public net.minecraft.world.level.block.state.BlockState getBlockAtCamera() {
|
||||
@@ -14,8 +26,6 @@
|
||||
+ return net.minecraft.world.level.block.Blocks.AIR.defaultBlockState();
|
||||
+ else
|
||||
+ return this.level.getBlockState(this.blockPosition).getStateAtViewpoint(this.level, this.blockPosition, this.position);
|
||||
+ }
|
||||
+
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static class NearPlane {
|
||||
final Vec3 forward;
|
||||
@@ -0,0 +1,25 @@
|
||||
--- a/net/minecraft/client/DeltaTracker.java
|
||||
+++ b/net/minecraft/client/DeltaTracker.java
|
||||
@@ -87,18 +_,22 @@
|
||||
|
||||
private void pause() {
|
||||
if (!this.paused) {
|
||||
+ if (net.minecraftforge.client.ForgeHooksClient.onClientPauseChangePre(true)) return;
|
||||
this.pausedDeltaTickResidual = this.deltaTickResidual;
|
||||
}
|
||||
|
||||
this.paused = true;
|
||||
+ net.minecraftforge.client.ForgeHooksClient.onClientPauseChangePost(true);
|
||||
}
|
||||
|
||||
private void unPause() {
|
||||
if (this.paused) {
|
||||
+ if (net.minecraftforge.client.ForgeHooksClient.onClientPauseChangePre(false)) return;
|
||||
this.deltaTickResidual = this.pausedDeltaTickResidual;
|
||||
}
|
||||
|
||||
this.paused = false;
|
||||
+ net.minecraftforge.client.ForgeHooksClient.onClientPauseChangePost(false);
|
||||
}
|
||||
|
||||
public void updateFrozenState(boolean p_344005_) {
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/KeyboardHandler.java
|
||||
+++ b/net/minecraft/client/KeyboardHandler.java
|
||||
@@ -410,9 +_,9 @@
|
||||
@@ -405,9 +_,9 @@
|
||||
Screen.wrapScreenError(() -> {
|
||||
if (p_90897_ == 1 || p_90897_ == 2) {
|
||||
screen.afterKeyboardAction();
|
||||
@@ -12,7 +12,7 @@
|
||||
}
|
||||
}, "keyPressed event handler", screen.getClass().getCanonicalName());
|
||||
if (aboolean[0]) {
|
||||
@@ -481,20 +_,21 @@
|
||||
@@ -476,20 +_,21 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/Minecraft.java
|
||||
+++ b/net/minecraft/client/Minecraft.java
|
||||
@@ -259,7 +_,7 @@
|
||||
@@ -254,7 +_,7 @@
|
||||
import org.slf4j.Logger;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@@ -9,7 +9,7 @@
|
||||
static Minecraft instance;
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
public static final boolean ON_OSX = Util.getPlatform() == Util.OS.OSX;
|
||||
@@ -438,7 +_,6 @@
|
||||
@@ -431,7 +_,6 @@
|
||||
}
|
||||
}, Util.nonCriticalIoPool());
|
||||
LOGGER.info("Setting user: {}", this.user.getName());
|
||||
@@ -17,7 +17,7 @@
|
||||
this.demo = p_91084_.game.demo;
|
||||
this.allowsMultiplayer = !p_91084_.game.disableMultiplayer;
|
||||
this.allowsChat = !p_91084_.game.disableChat;
|
||||
@@ -475,15 +_,15 @@
|
||||
@@ -468,15 +_,15 @@
|
||||
}
|
||||
|
||||
this.window.setFramerateLimit(this.options.framerateLimit().get());
|
||||
@@ -34,8 +34,8 @@
|
||||
+ net.minecraftforge.client.loading.ClientModLoader.begin(this, this.resourcePackRepository, this.resourceManager);
|
||||
this.resourcePackRepository.reload();
|
||||
this.options.loadSelectedResourcePacks(this.resourcePackRepository);
|
||||
this.languageManager = new LanguageManager(this.options.languageCode);
|
||||
@@ -542,6 +_,7 @@
|
||||
this.languageManager = new LanguageManager(this.options.languageCode, p_340763_ -> {
|
||||
@@ -540,6 +_,7 @@
|
||||
this.entityRenderDispatcher = new EntityRenderDispatcher(this, this.textureManager, this.itemRenderer, this.blockRenderer, this.font, this.options, this.entityModels);
|
||||
this.resourceManager.registerReloadListener(this.entityRenderDispatcher);
|
||||
this.particleEngine = new ParticleEngine(this.level, this.textureManager);
|
||||
@@ -43,16 +43,12 @@
|
||||
this.resourceManager.registerReloadListener(this.particleEngine);
|
||||
this.paintingTextures = new PaintingTextureManager(this.textureManager);
|
||||
this.resourceManager.registerReloadListener(this.paintingTextures);
|
||||
@@ -554,13 +_,18 @@
|
||||
@@ -552,11 +_,15 @@
|
||||
this.gameRenderer = new GameRenderer(this, this.entityRenderDispatcher.getItemInHandRenderer(), this.resourceManager, this.renderBuffers);
|
||||
this.resourceManager.registerReloadListener(this.gameRenderer.createReloadListener());
|
||||
this.levelRenderer = new LevelRenderer(this, this.entityRenderDispatcher, this.blockEntityRenderDispatcher, this.renderBuffers);
|
||||
+ net.minecraftforge.fml.ModLoader.get().postEvent(new net.minecraftforge.client.event.RenderLevelStageEvent.RegisterStageEvent());
|
||||
this.resourceManager.registerReloadListener(this.levelRenderer);
|
||||
- this.createSearchTrees();
|
||||
+ // Forge: We delay this to allow registration of modded creative mode tabs
|
||||
+ //this.createSearchTrees();
|
||||
this.resourceManager.registerReloadListener(this.searchRegistry);
|
||||
this.gpuWarnlistManager = new GpuWarnlistManager();
|
||||
this.resourceManager.registerReloadListener(this.gpuWarnlistManager);
|
||||
this.resourceManager.registerReloadListener(this.regionalCompliancies);
|
||||
@@ -63,7 +59,7 @@
|
||||
this.debugRenderer = new DebugRenderer(this);
|
||||
RealmsClient realmsclient = RealmsClient.create(this);
|
||||
this.realmsDataFetcher = new RealmsDataFetcher(realmsclient);
|
||||
@@ -584,6 +_,7 @@
|
||||
@@ -580,6 +_,7 @@
|
||||
this.options.fullscreen().set(this.window.isFullscreen());
|
||||
}
|
||||
|
||||
@@ -71,7 +67,7 @@
|
||||
this.window.updateVsync(this.options.enableVsync().get());
|
||||
this.window.updateRawMouseInput(this.options.rawMouseInput().get());
|
||||
this.window.setDefaultErrorCallback();
|
||||
@@ -604,16 +_,17 @@
|
||||
@@ -600,16 +_,17 @@
|
||||
GameLoadTimesEvent.INSTANCE.beginStep(TelemetryProperty.LOAD_TIME_LOADING_OVERLAY_MS);
|
||||
Minecraft.GameLoadCookie minecraft$gameloadcookie = new Minecraft.GameLoadCookie(realmsclient, p_91084_.quickPlay);
|
||||
this.setOverlay(
|
||||
@@ -92,7 +88,7 @@
|
||||
);
|
||||
this.quickPlayLog = QuickPlayLog.of(p_91084_.quickPlay.path());
|
||||
}
|
||||
@@ -702,6 +_,7 @@
|
||||
@@ -698,6 +_,7 @@
|
||||
StringBuilder stringbuilder = new StringBuilder("Minecraft");
|
||||
if (checkModStatus().shouldReportAsModified()) {
|
||||
stringbuilder.append("*");
|
||||
@@ -100,7 +96,7 @@
|
||||
}
|
||||
|
||||
stringbuilder.append(" ");
|
||||
@@ -725,6 +_,8 @@
|
||||
@@ -721,6 +_,8 @@
|
||||
}
|
||||
|
||||
private UserApiService createUserApiService(YggdrasilAuthenticationService p_193586_, GameConfig p_193587_) {
|
||||
@@ -109,7 +105,7 @@
|
||||
return p_193587_.user.user.getType() != User.Type.MSA
|
||||
? UserApiService.OFFLINE
|
||||
: p_193586_.createUserApiService(p_193587_.user.user.getAccessToken());
|
||||
@@ -735,7 +_,7 @@
|
||||
@@ -731,7 +_,7 @@
|
||||
}
|
||||
|
||||
private void rollbackResourcePacks(Throwable p_91240_, @Nullable Minecraft.GameLoadCookie p_299515_) {
|
||||
@@ -118,48 +114,7 @@
|
||||
this.clearResourcePacksOnError(p_91240_, null, p_299515_);
|
||||
} else {
|
||||
Util.throwAsRuntime(p_91240_);
|
||||
@@ -817,9 +_,12 @@
|
||||
}
|
||||
|
||||
public void createSearchTrees() {
|
||||
+ var nameSearchKeys = net.minecraftforge.client.CreativeModeTabSearchRegistry.getNameSearchKeys();
|
||||
+ var tagSearchKeys = net.minecraftforge.client.CreativeModeTabSearchRegistry.getTagSearchKeys();
|
||||
+ for (var nameSearchKey : nameSearchKeys.values())
|
||||
this.searchRegistry
|
||||
.register(
|
||||
- SearchRegistry.CREATIVE_NAMES,
|
||||
+ nameSearchKey,
|
||||
p_231451_ -> new FullTextSearchTree<>(
|
||||
p_325272_ -> p_325272_.getTooltipLines(Item.TooltipContext.EMPTY, null, TooltipFlag.Default.NORMAL.asCreative())
|
||||
.stream()
|
||||
@@ -829,8 +_,9 @@
|
||||
p_231451_
|
||||
)
|
||||
);
|
||||
+ for (var tagSearchKey : tagSearchKeys.values())
|
||||
this.searchRegistry
|
||||
- .register(SearchRegistry.CREATIVE_TAGS, p_231430_ -> new IdSearchTree<>(p_231353_ -> p_231353_.getTags().map(TagKey::location), p_231430_));
|
||||
+ .register(tagSearchKey, p_231430_ -> new IdSearchTree<>(p_231353_ -> p_231353_.getTags().map(TagKey::location), p_231430_));
|
||||
this.searchRegistry
|
||||
.register(
|
||||
SearchRegistry.RECIPE_COLLECTIONS,
|
||||
@@ -854,9 +_,12 @@
|
||||
p_301514_
|
||||
)
|
||||
);
|
||||
- CreativeModeTabs.searchTab().setSearchTreeBuilder(p_255439_ -> {
|
||||
- this.populateSearchTree(SearchRegistry.CREATIVE_NAMES, p_255439_);
|
||||
- this.populateSearchTree(SearchRegistry.CREATIVE_TAGS, p_255439_);
|
||||
+ nameSearchKeys.forEach((tab, nameSearchKey) -> {
|
||||
+ var tagSearchKey = tagSearchKeys.get(tab);
|
||||
+ tab.setSearchTreeBuilder(contents -> {
|
||||
+ this.populateSearchTree(nameSearchKey, contents);
|
||||
+ this.populateSearchTree(tagSearchKey, contents);
|
||||
+ });
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1039,12 +_,6 @@
|
||||
@@ -991,12 +_,6 @@
|
||||
LOGGER.error("setScreen called from non-game thread");
|
||||
}
|
||||
|
||||
@@ -172,7 +127,7 @@
|
||||
if (p_91153_ == null && this.clientLevelTeardownInProgress) {
|
||||
throw new IllegalStateException("Trying to return to in-game GUI during disconnection");
|
||||
} else {
|
||||
@@ -1058,6 +_,23 @@
|
||||
@@ -1010,6 +_,23 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -196,37 +151,19 @@
|
||||
this.screen = p_91153_;
|
||||
if (this.screen != null) {
|
||||
this.screen.added();
|
||||
@@ -1204,9 +_,12 @@
|
||||
@@ -1155,9 +_,11 @@
|
||||
this.mouseHandler.handleAccumulatedMovement();
|
||||
this.profiler.pop();
|
||||
if (!this.noRender) {
|
||||
+ this.realPartialTick = this.pause ? this.pausePartialTick : this.timer.partialTick; // Cache this since pause is volatile
|
||||
+ net.minecraftforge.event.ForgeEventFactory.onRenderTickStart(this.realPartialTick);
|
||||
+ net.minecraftforge.client.event.ForgeEventFactoryClient.onRenderTickStart(this.timer);
|
||||
this.profiler.popPush("gameRenderer");
|
||||
this.gameRenderer.render(this.pause ? this.pausePartialTick : this.timer.partialTick, i, p_91384_);
|
||||
this.gameRenderer.render(this.timer, p_91384_);
|
||||
this.profiler.pop();
|
||||
+ net.minecraftforge.event.ForgeEventFactory.onRenderTickEnd(this.realPartialTick);
|
||||
+ net.minecraftforge.client.event.ForgeEventFactoryClient.onRenderTickEnd(this.timer);
|
||||
}
|
||||
|
||||
if (this.fpsPieResults != null) {
|
||||
@@ -1240,7 +_,7 @@
|
||||
boolean flag1 = this.hasSingleplayerServer()
|
||||
&& (this.screen != null && this.screen.isPauseScreen() || this.overlay != null && this.overlay.isPauseScreen())
|
||||
&& !this.singleplayerServer.isPublished();
|
||||
- if (this.pause != flag1) {
|
||||
+ if (this.pause != flag1 && !net.minecraftforge.client.ForgeHooksClient.onClientPauseChangePre(flag1)) {
|
||||
if (flag1) {
|
||||
this.pausePartialTick = this.timer.partialTick;
|
||||
} else {
|
||||
@@ -1248,6 +_,7 @@
|
||||
}
|
||||
|
||||
this.pause = flag1;
|
||||
+ net.minecraftforge.client.ForgeHooksClient.onClientPauseChangePost(flag1);
|
||||
}
|
||||
|
||||
long l = Util.getNanos();
|
||||
@@ -1340,10 +_,12 @@
|
||||
@@ -1283,10 +_,12 @@
|
||||
this.window.setGuiScale((double)i);
|
||||
if (this.screen != null) {
|
||||
this.screen.resize(this, this.window.getGuiScaledWidth(), this.window.getGuiScaledHeight());
|
||||
@@ -239,7 +176,7 @@
|
||||
this.gameRenderer.resize(this.window.getWidth(), this.window.getHeight());
|
||||
this.mouseHandler.setIgnoreFirstMove();
|
||||
}
|
||||
@@ -1619,6 +_,7 @@
|
||||
@@ -1554,6 +_,7 @@
|
||||
}
|
||||
|
||||
public void stop() {
|
||||
@@ -247,7 +184,7 @@
|
||||
this.running = false;
|
||||
}
|
||||
|
||||
@@ -1647,10 +_,18 @@
|
||||
@@ -1582,10 +_,18 @@
|
||||
if (p_91387_ && this.hitResult != null && this.hitResult.getType() == HitResult.Type.BLOCK) {
|
||||
BlockHitResult blockhitresult = (BlockHitResult)this.hitResult;
|
||||
BlockPos blockpos = blockhitresult.getBlockPos();
|
||||
@@ -269,7 +206,7 @@
|
||||
this.player.swing(InteractionHand.MAIN_HAND);
|
||||
}
|
||||
}
|
||||
@@ -1678,6 +_,8 @@
|
||||
@@ -1613,6 +_,8 @@
|
||||
return false;
|
||||
} else {
|
||||
boolean flag = false;
|
||||
@@ -278,7 +215,7 @@
|
||||
switch (this.hitResult.getType()) {
|
||||
case ENTITY:
|
||||
this.gameMode.attack(this.player, ((EntityHitResult)this.hitResult).getEntity());
|
||||
@@ -1685,7 +_,7 @@
|
||||
@@ -1620,7 +_,7 @@
|
||||
case BLOCK:
|
||||
BlockHitResult blockhitresult = (BlockHitResult)this.hitResult;
|
||||
BlockPos blockpos = blockhitresult.getBlockPos();
|
||||
@@ -287,7 +224,7 @@
|
||||
this.gameMode.startDestroyBlock(blockpos, blockhitresult.getDirection());
|
||||
if (this.level.getBlockState(blockpos).isAir()) {
|
||||
flag = true;
|
||||
@@ -1698,8 +_,10 @@
|
||||
@@ -1633,8 +_,10 @@
|
||||
}
|
||||
|
||||
this.player.resetAttackStrengthTicker();
|
||||
@@ -298,7 +235,7 @@
|
||||
this.player.swing(InteractionHand.MAIN_HAND);
|
||||
return flag;
|
||||
}
|
||||
@@ -1715,6 +_,12 @@
|
||||
@@ -1650,6 +_,12 @@
|
||||
}
|
||||
|
||||
for (InteractionHand interactionhand : InteractionHand.values()) {
|
||||
@@ -311,7 +248,7 @@
|
||||
ItemStack itemstack = this.player.getItemInHand(interactionhand);
|
||||
if (!itemstack.isItemEnabled(this.level.enabledFeatures())) {
|
||||
return;
|
||||
@@ -1735,7 +_,7 @@
|
||||
@@ -1670,7 +_,7 @@
|
||||
}
|
||||
|
||||
if (interactionresult.consumesAction()) {
|
||||
@@ -320,7 +257,7 @@
|
||||
this.player.swing(interactionhand);
|
||||
}
|
||||
|
||||
@@ -1747,7 +_,7 @@
|
||||
@@ -1682,7 +_,7 @@
|
||||
int i = itemstack.getCount();
|
||||
InteractionResult interactionresult1 = this.gameMode.useItemOn(this.player, interactionhand, blockhitresult);
|
||||
if (interactionresult1.consumesAction()) {
|
||||
@@ -329,7 +266,7 @@
|
||||
this.player.swing(interactionhand);
|
||||
if (!itemstack.isEmpty() && (itemstack.getCount() != i || this.gameMode.hasInfiniteItems())) {
|
||||
this.gameRenderer.itemInHandRenderer.itemUsed(interactionhand);
|
||||
@@ -1763,6 +_,9 @@
|
||||
@@ -1698,6 +_,9 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -339,7 +276,7 @@
|
||||
if (!itemstack.isEmpty()) {
|
||||
InteractionResult interactionresult2 = this.gameMode.useItem(this.player, interactionhand);
|
||||
if (interactionresult2.consumesAction()) {
|
||||
@@ -1793,6 +_,8 @@
|
||||
@@ -1728,6 +_,8 @@
|
||||
this.rightClickDelay--;
|
||||
}
|
||||
|
||||
@@ -348,7 +285,7 @@
|
||||
this.profiler.push("gui");
|
||||
this.chatListener.tick();
|
||||
this.gui.tick(this.pause);
|
||||
@@ -1877,6 +_,7 @@
|
||||
@@ -1811,6 +_,7 @@
|
||||
|
||||
this.tutorial.tick();
|
||||
|
||||
@@ -356,7 +293,7 @@
|
||||
try {
|
||||
this.level.tick(() -> true);
|
||||
} catch (Throwable throwable) {
|
||||
@@ -1890,6 +_,7 @@
|
||||
@@ -1824,6 +_,7 @@
|
||||
|
||||
throw new ReportedException(crashreport);
|
||||
}
|
||||
@@ -364,15 +301,15 @@
|
||||
}
|
||||
|
||||
this.profiler.popPush("animateTick");
|
||||
@@ -1909,6 +_,7 @@
|
||||
@@ -1843,6 +_,7 @@
|
||||
this.profiler.popPush("keyboard");
|
||||
this.keyboardHandler.tick();
|
||||
this.profiler.pop();
|
||||
+ net.minecraftforge.event.ForgeEventFactory.onPostClientTick();
|
||||
}
|
||||
|
||||
private boolean isMultiplayerServer() {
|
||||
@@ -2105,6 +_,7 @@
|
||||
private boolean isLevelRunningNormally() {
|
||||
@@ -2043,6 +_,7 @@
|
||||
}
|
||||
|
||||
public void setLevel(ClientLevel p_91157_, ReceivingLevelScreen.Reason p_335893_) {
|
||||
@@ -380,7 +317,7 @@
|
||||
this.updateScreenAndTick(new ReceivingLevelScreen(() -> false, p_335893_));
|
||||
this.level = p_91157_;
|
||||
this.updateLevelInEngines(p_91157_);
|
||||
@@ -2142,6 +_,7 @@
|
||||
@@ -2080,6 +_,7 @@
|
||||
IntegratedServer integratedserver = this.singleplayerServer;
|
||||
this.singleplayerServer = null;
|
||||
this.gameRenderer.resetData();
|
||||
@@ -388,7 +325,7 @@
|
||||
this.gameMode = null;
|
||||
this.narrator.clear();
|
||||
this.clientLevelTeardownInProgress = true;
|
||||
@@ -2149,6 +_,7 @@
|
||||
@@ -2087,6 +_,7 @@
|
||||
try {
|
||||
this.updateScreenAndTick(p_335030_);
|
||||
if (this.level != null) {
|
||||
@@ -396,7 +333,7 @@
|
||||
if (integratedserver != null) {
|
||||
this.profiler.push("waitForServer");
|
||||
|
||||
@@ -2161,6 +_,7 @@
|
||||
@@ -2099,6 +_,7 @@
|
||||
|
||||
this.gui.onDisconnected();
|
||||
this.isLocalServer = false;
|
||||
@@ -404,7 +341,7 @@
|
||||
}
|
||||
|
||||
this.level = null;
|
||||
@@ -2307,6 +_,7 @@
|
||||
@@ -2245,6 +_,7 @@
|
||||
|
||||
private void pickBlock() {
|
||||
if (this.hitResult != null && this.hitResult.getType() != HitResult.Type.MISS) {
|
||||
@@ -412,7 +349,7 @@
|
||||
boolean flag = this.player.getAbilities().instabuild;
|
||||
BlockEntity blockentity = null;
|
||||
HitResult.Type hitresult$type = this.hitResult.getType();
|
||||
@@ -2319,7 +_,7 @@
|
||||
@@ -2257,7 +_,7 @@
|
||||
}
|
||||
|
||||
Block block = blockstate.getBlock();
|
||||
@@ -421,7 +358,7 @@
|
||||
if (itemstack.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
@@ -2333,7 +_,7 @@
|
||||
@@ -2271,7 +_,7 @@
|
||||
}
|
||||
|
||||
Entity entity = ((EntityHitResult)this.hitResult).getEntity();
|
||||
@@ -430,7 +367,7 @@
|
||||
if (itemstack == null) {
|
||||
return;
|
||||
}
|
||||
@@ -2931,6 +_,19 @@
|
||||
@@ -2855,6 +_,10 @@
|
||||
@Nullable
|
||||
public static String getLauncherBrand() {
|
||||
return System.getProperty("minecraft.launcher.brand");
|
||||
@@ -438,15 +375,6 @@
|
||||
+
|
||||
+ public ItemColors getItemColors() {
|
||||
+ return this.itemColors;
|
||||
+ }
|
||||
+
|
||||
+ public SearchRegistry getSearchTreeManager() {
|
||||
+ return this.searchRegistry;
|
||||
+ }
|
||||
+
|
||||
+ private float realPartialTick;
|
||||
+ public float getPartialTick() {
|
||||
+ return this.realPartialTick;
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/MouseHandler.java
|
||||
+++ b/net/minecraft/client/MouseHandler.java
|
||||
@@ -74,6 +_,7 @@
|
||||
@@ -79,6 +_,7 @@
|
||||
this.activeButton = -1;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
boolean[] aboolean = new boolean[]{false};
|
||||
if (this.minecraft.getOverlay() == null) {
|
||||
if (this.minecraft.screen == null) {
|
||||
@@ -86,9 +_,9 @@
|
||||
@@ -91,9 +_,9 @@
|
||||
Screen screen = this.minecraft.screen;
|
||||
if (flag) {
|
||||
screen.afterMouseAction();
|
||||
@@ -20,7 +20,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -111,6 +_,7 @@
|
||||
@@ -116,6 +_,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -28,7 +28,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,7 +_,9 @@
|
||||
@@ -129,7 +_,9 @@
|
||||
if (this.minecraft.screen != null) {
|
||||
double d3 = this.xpos * (double)this.minecraft.getWindow().getGuiScaledWidth() / (double)this.minecraft.getWindow().getScreenWidth();
|
||||
double d4 = this.ypos * (double)this.minecraft.getWindow().getGuiScaledHeight() / (double)this.minecraft.getWindow().getScreenHeight();
|
||||
@@ -39,7 +39,7 @@
|
||||
this.minecraft.screen.afterMouseAction();
|
||||
} else if (this.minecraft.player != null) {
|
||||
if (this.accumulatedScrollX != 0.0 && Math.signum(d1) != Math.signum(this.accumulatedScrollX)) {
|
||||
@@ -146,6 +_,7 @@
|
||||
@@ -151,6 +_,7 @@
|
||||
this.accumulatedScrollX -= (double)j;
|
||||
this.accumulatedScrollY -= (double)i;
|
||||
int k = i == 0 ? -j : i;
|
||||
@@ -47,7 +47,7 @@
|
||||
if (this.minecraft.player.isSpectator()) {
|
||||
if (this.minecraft.gui.getSpectatorGui().isMenuActive()) {
|
||||
this.minecraft.gui.getSpectatorGui().onMouseScrolled(-k);
|
||||
@@ -216,7 +_,7 @@
|
||||
@@ -236,7 +_,7 @@
|
||||
if (this.activeButton != -1 && this.mousePressedTime > 0.0) {
|
||||
double d4 = this.accumulatedDX * (double)this.minecraft.getWindow().getGuiScaledWidth() / (double)this.minecraft.getWindow().getScreenWidth();
|
||||
double d5 = this.accumulatedDY * (double)this.minecraft.getWindow().getGuiScaledHeight() / (double)this.minecraft.getWindow().getScreenHeight();
|
||||
@@ -56,7 +56,7 @@
|
||||
}
|
||||
|
||||
screen.afterMouseMove();
|
||||
@@ -283,6 +_,14 @@
|
||||
@@ -303,6 +_,14 @@
|
||||
|
||||
public double ypos() {
|
||||
return this.ypos;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/Options.java
|
||||
+++ b/net/minecraft/client/Options.java
|
||||
@@ -680,7 +_,8 @@
|
||||
@@ -681,7 +_,8 @@
|
||||
},
|
||||
new OptionInstance.LazyEnum<>(
|
||||
() -> Stream.concat(Stream.of(""), Minecraft.getInstance().getSoundManager().getAvailableSoundDevices().stream()).toList(),
|
||||
@@ -10,7 +10,7 @@
|
||||
? Optional.empty()
|
||||
: Optional.of(p_232011_),
|
||||
Codec.STRING
|
||||
@@ -1044,6 +_,7 @@
|
||||
@@ -1050,6 +_,7 @@
|
||||
}
|
||||
|
||||
public Options(Minecraft p_92138_, File p_92139_) {
|
||||
@@ -18,7 +18,7 @@
|
||||
this.minecraft = p_92138_;
|
||||
this.optionsFile = new File(p_92139_, "options.txt");
|
||||
boolean flag = Runtime.getRuntime().maxMemory() >= 1000000000L;
|
||||
@@ -1178,12 +_,22 @@
|
||||
@@ -1184,12 +_,22 @@
|
||||
p_168428_.process("telemetryOptInExtra", this.telemetryOptInExtra);
|
||||
this.onboardAccessibility = p_168428_.process("onboardAccessibility", this.onboardAccessibility);
|
||||
p_168428_.process("menuBackgroundBlurriness", this.menuBackgroundBlurriness);
|
||||
@@ -42,7 +42,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1201,6 +_,10 @@
|
||||
@@ -1207,6 +_,10 @@
|
||||
}
|
||||
|
||||
public void load() {
|
||||
@@ -53,7 +53,7 @@
|
||||
try {
|
||||
if (!this.optionsFile.exists()) {
|
||||
return;
|
||||
@@ -1228,7 +_,8 @@
|
||||
@@ -1234,7 +_,8 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@
|
||||
new Options.FieldAccess() {
|
||||
@Nullable
|
||||
private String getValueOrNull(String p_168459_) {
|
||||
@@ -1422,6 +_,7 @@
|
||||
@@ -1428,6 +_,7 @@
|
||||
}
|
||||
|
||||
public void broadcastOptions() {
|
||||
@@ -71,7 +71,7 @@
|
||||
if (this.minecraft.player != null) {
|
||||
this.minecraft.player.connection.send(new ServerboundClientInformationPacket(this.buildPlayerInformation()));
|
||||
}
|
||||
@@ -1544,6 +_,23 @@
|
||||
@@ -1546,6 +_,23 @@
|
||||
|
||||
public static Component genericValueLabel(Component p_231901_, int p_231902_) {
|
||||
return genericValueLabel(p_231901_, Component.literal(Integer.toString(p_231902_)));
|
||||
@@ -94,4 +94,4 @@
|
||||
+ keySmoothCamera.setKeyConflictContext(inGame);
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static Component genericValueOrOffLabel(Component p_345288_, int p_344826_) {
|
||||
@@ -9,7 +9,16 @@
|
||||
private final SubtitleOverlay subtitleOverlay;
|
||||
private final SpectatorGui spectatorGui;
|
||||
private final PlayerTabOverlay tabList;
|
||||
@@ -444,6 +_,8 @@
|
||||
@@ -318,7 +_,7 @@
|
||||
Window window = this.minecraft.getWindow();
|
||||
int i = Mth.floor(this.minecraft.mouseHandler.xpos() * (double)window.getGuiScaledWidth() / (double)window.getScreenWidth());
|
||||
int j = Mth.floor(this.minecraft.mouseHandler.ypos() * (double)window.getGuiScaledHeight() / (double)window.getScreenHeight());
|
||||
- this.chat.render(p_329202_, this.tickCount, i, j, false);
|
||||
+ net.minecraftforge.client.ForgeHooksClient.onCustomizeChatEvent(p_329202_, this.chat, window, i, j, this.tickCount);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -434,6 +_,8 @@
|
||||
|
||||
for (MobEffectInstance mobeffectinstance : Ordering.natural().reverse().sortedCopy(collection)) {
|
||||
Holder<MobEffect> holder = mobeffectinstance.getEffect();
|
||||
@@ -18,7 +27,7 @@
|
||||
if (mobeffectinstance.showIcon()) {
|
||||
int i = p_282812_.guiWidth();
|
||||
int j = 1;
|
||||
@@ -473,6 +_,7 @@
|
||||
@@ -463,6 +_,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +35,7 @@
|
||||
TextureAtlasSprite textureatlassprite = mobeffecttexturemanager.get(holder);
|
||||
int l1 = i;
|
||||
int i1 = j;
|
||||
@@ -635,6 +_,10 @@
|
||||
@@ -625,6 +_,10 @@
|
||||
}
|
||||
|
||||
private void renderSelectedItemName(GuiGraphics p_283501_) {
|
||||
@@ -37,7 +46,7 @@
|
||||
this.minecraft.getProfiler().push("selectedItemName");
|
||||
if (this.toolHighlightTimer > 0 && !this.lastToolHighlight.isEmpty()) {
|
||||
MutableComponent mutablecomponent = Component.empty().append(this.lastToolHighlight.getHoverName()).withStyle(this.lastToolHighlight.getRarity().color());
|
||||
@@ -642,9 +_,10 @@
|
||||
@@ -632,9 +_,10 @@
|
||||
mutablecomponent.withStyle(ChatFormatting.ITALIC);
|
||||
}
|
||||
|
||||
@@ -50,10 +59,10 @@
|
||||
if (!this.minecraft.gameMode.canHurtPlayer()) {
|
||||
k += 14;
|
||||
}
|
||||
@@ -657,6 +_,13 @@
|
||||
@@ -646,6 +_,13 @@
|
||||
|
||||
if (l > 0) {
|
||||
p_283501_.fill(j - 2, k - 2, j + i + 2, k + 9 + 2, this.minecraft.options.getBackgroundColor(0));
|
||||
p_283501_.drawString(this.getFont(), mutablecomponent, j, k, 16777215 + (l << 24));
|
||||
p_283501_.drawStringWithBackdrop(this.getFont(), mutablecomponent, j, k, i, FastColor.ARGB32.color(l, -1));
|
||||
+ Font font = net.minecraftforge.client.extensions.common.IClientItemExtensions.of(lastToolHighlight).getFont(lastToolHighlight, net.minecraftforge.client.extensions.common.IClientItemExtensions.FontContext.SELECTED_ITEM_NAME);
|
||||
+ if (font == null) {
|
||||
+ p_283501_.drawString(this.getFont(), highlightTip, j, k, 16777215 + (l << 24));
|
||||
@@ -64,7 +73,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1155,7 +_,7 @@
|
||||
@@ -1146,7 +_,7 @@
|
||||
ItemStack itemstack = this.minecraft.player.getInventory().getSelected();
|
||||
if (itemstack.isEmpty()) {
|
||||
this.toolHighlightTimer = 0;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
public static final float MAX_GUI_Z = 10000.0F;
|
||||
public static final float MIN_GUI_Z = -10000.0F;
|
||||
private static final int EXTRA_SPACE_AFTER_FIRST_TOOLTIP_LINE = 2;
|
||||
@@ -280,6 +_,11 @@
|
||||
@@ -268,6 +_,11 @@
|
||||
}
|
||||
|
||||
public int drawString(Font p_283343_, @Nullable String p_281896_, int p_283569_, int p_283418_, int p_281560_, boolean p_282130_) {
|
||||
@@ -21,7 +21,7 @@
|
||||
if (p_281896_ == null) {
|
||||
return 0;
|
||||
} else {
|
||||
@@ -306,6 +_,11 @@
|
||||
@@ -294,6 +_,11 @@
|
||||
}
|
||||
|
||||
public int drawString(Font p_282636_, FormattedCharSequence p_281596_, int p_281586_, int p_282816_, int p_281743_, boolean p_282394_) {
|
||||
@@ -33,7 +33,7 @@
|
||||
int i = p_282636_.drawInBatch(
|
||||
p_281596_,
|
||||
(float)p_281586_,
|
||||
@@ -872,6 +_,7 @@
|
||||
@@ -864,6 +_,7 @@
|
||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Rendering item");
|
||||
CrashReportCategory crashreportcategory = crashreport.addCategory("Item being rendered");
|
||||
crashreportcategory.setDetail("Item Type", () -> String.valueOf(p_281675_.getItem()));
|
||||
@@ -41,7 +41,7 @@
|
||||
crashreportcategory.setDetail("Item Components", () -> String.valueOf(p_281675_.getComponents()));
|
||||
crashreportcategory.setDetail("Item Foil", () -> String.valueOf(p_281675_.hasFoil()));
|
||||
throw new ReportedException(crashreport);
|
||||
@@ -912,16 +_,26 @@
|
||||
@@ -904,16 +_,26 @@
|
||||
}
|
||||
|
||||
this.pose.popPose();
|
||||
@@ -70,7 +70,7 @@
|
||||
this.renderTooltipInternal(p_283128_, list, p_283678_, p_281696_, DefaultTooltipPositioner.INSTANCE);
|
||||
}
|
||||
|
||||
@@ -930,7 +_,15 @@
|
||||
@@ -922,7 +_,22 @@
|
||||
}
|
||||
|
||||
public void renderComponentTooltip(Font p_282739_, List<Component> p_281832_, int p_282191_, int p_282446_) {
|
||||
@@ -83,11 +83,18 @@
|
||||
+ this.tooltipStack = stack;
|
||||
+ List<ClientTooltipComponent> components = net.minecraftforge.client.ForgeHooksClient.gatherTooltipComponents(stack, tooltips, mouseX, guiWidth(), guiHeight(), font);
|
||||
+ this.renderTooltipInternal(font, components, mouseX, mouseY, DefaultTooltipPositioner.INSTANCE);
|
||||
+ this.tooltipStack = ItemStack.EMPTY;
|
||||
+ }
|
||||
+
|
||||
+ public void renderComponentTooltipFromElements(Font font, List<com.mojang.datafixers.util.Either<FormattedText, TooltipComponent>> elements, int mouseX, int mouseY, ItemStack stack) {
|
||||
+ this.tooltipStack = stack;
|
||||
+ List<ClientTooltipComponent> components = net.minecraftforge.client.ForgeHooksClient.gatherTooltipComponentsFromElements(stack, elements, mouseX, guiWidth(), guiHeight(), font);
|
||||
+ this.renderTooltipInternal(font, components, mouseX, mouseY, DefaultTooltipPositioner.INSTANCE);
|
||||
+ this.tooltipStack = ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
public void renderTooltip(Font p_282192_, List<? extends FormattedCharSequence> p_282297_, int p_281680_, int p_283325_) {
|
||||
@@ -949,11 +_,13 @@
|
||||
@@ -941,11 +_,13 @@
|
||||
|
||||
private void renderTooltipInternal(Font p_282675_, List<ClientTooltipComponent> p_282615_, int p_283230_, int p_283417_, ClientTooltipPositioner p_282442_) {
|
||||
if (!p_282615_.isEmpty()) {
|
||||
@@ -102,7 +109,7 @@
|
||||
if (k > i) {
|
||||
i = k;
|
||||
}
|
||||
@@ -963,18 +_,21 @@
|
||||
@@ -955,18 +_,21 @@
|
||||
|
||||
int i2 = i;
|
||||
int j2 = j;
|
||||
@@ -127,7 +134,7 @@
|
||||
k1 += clienttooltipcomponent1.getHeight() + (l1 == 0 ? 2 : 0);
|
||||
}
|
||||
|
||||
@@ -982,7 +_,7 @@
|
||||
@@ -974,7 +_,7 @@
|
||||
|
||||
for (int k2 = 0; k2 < p_282615_.size(); k2++) {
|
||||
ClientTooltipComponent clienttooltipcomponent2 = p_282615_.get(k2);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/gui/components/AbstractButton.java
|
||||
+++ b/net/minecraft/client/gui/components/AbstractButton.java
|
||||
@@ -32,7 +_,7 @@
|
||||
@@ -34,7 +_,7 @@
|
||||
RenderSystem.enableDepthTest();
|
||||
p_281670_.blitSprite(SPRITES.get(this.active, this.isHoveredOrFocused()), this.getX(), this.getY(), this.getWidth(), this.getHeight());
|
||||
p_281670_.setColor(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
list.add("");
|
||||
boolean flag = this.minecraft.getSingleplayerServer() != null;
|
||||
list.add(
|
||||
@@ -176,7 +_,12 @@
|
||||
@@ -176,11 +_,18 @@
|
||||
+ (this.renderNetworkCharts ? " visible" : " hidden")
|
||||
);
|
||||
list.add("For help: press F3 + Q");
|
||||
@@ -79,10 +79,16 @@
|
||||
+ protected void drawGameInformation(GuiGraphics p_281525_) {
|
||||
+ List<String> list = this.getGameInformation();
|
||||
+ list.addAll(this.getOverlayHelp());
|
||||
+ net.minecraftforge.client.ForgeHooksClient.onCustomizeDebugEvent(p_281525_, minecraft.getWindow(), minecraft.getTimer().getRealtimeDeltaTicks(), list, true);
|
||||
+ this.renderLines(p_281525_, list, true);
|
||||
}
|
||||
|
||||
protected void drawSystemInformation(GuiGraphics p_281261_) {
|
||||
List<String> list = this.getSystemInformation();
|
||||
+ net.minecraftforge.client.ForgeHooksClient.onCustomizeDebugEvent(p_281261_, minecraft.getWindow(), minecraft.getTimer().getRealtimeDeltaTicks(), list, false);
|
||||
this.renderLines(p_281261_, list, false);
|
||||
}
|
||||
|
||||
@@ -529,6 +_,7 @@
|
||||
list.add("");
|
||||
list.add(ChatFormatting.UNDERLINE + "Targeted Entity");
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/gui/screens/PauseScreen.java
|
||||
+++ b/net/minecraft/client/gui/screens/PauseScreen.java
|
||||
@@ -86,6 +_,7 @@
|
||||
@@ -94,6 +_,7 @@
|
||||
} else {
|
||||
gridlayout$rowhelper.addChild(this.openScreenButton(PLAYER_REPORTING, () -> new SocialInteractionsScreen(this)));
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/gui/screens/Screen.java
|
||||
+++ b/net/minecraft/client/gui/screens/Screen.java
|
||||
@@ -204,7 +_,7 @@
|
||||
@@ -201,7 +_,7 @@
|
||||
}
|
||||
|
||||
public void onClose() {
|
||||
@@ -9,7 +9,7 @@
|
||||
}
|
||||
|
||||
protected <T extends GuiEventListener & Renderable & NarratableEntry> T addRenderableWidget(T p_169406_) {
|
||||
@@ -320,8 +_,10 @@
|
||||
@@ -312,8 +_,10 @@
|
||||
this.width = p_96608_;
|
||||
this.height = p_96609_;
|
||||
if (!this.initialized) {
|
||||
@@ -20,7 +20,7 @@
|
||||
} else {
|
||||
this.repositionElements();
|
||||
}
|
||||
@@ -334,8 +_,10 @@
|
||||
@@ -326,8 +_,10 @@
|
||||
protected void rebuildWidgets() {
|
||||
this.clearWidgets();
|
||||
this.clearFocus();
|
||||
@@ -31,7 +31,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -362,6 +_,7 @@
|
||||
@@ -354,6 +_,7 @@
|
||||
|
||||
this.renderBlurredBackground(p_297268_);
|
||||
this.renderMenuBackground(p_283688_);
|
||||
@@ -39,7 +39,7 @@
|
||||
}
|
||||
|
||||
protected void renderBlurredBackground(float p_336041_) {
|
||||
@@ -492,6 +_,19 @@
|
||||
@@ -463,6 +_,19 @@
|
||||
}
|
||||
|
||||
public void onFilesDrop(List<Path> p_96591_) {
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
--- a/net/minecraft/client/gui/screens/TitleScreen.java
|
||||
+++ b/net/minecraft/client/gui/screens/TitleScreen.java
|
||||
@@ -61,6 +_,7 @@
|
||||
@Nullable
|
||||
private TitleScreen.WarningLabel warningLabel;
|
||||
@@ -60,6 +_,7 @@
|
||||
private boolean fading;
|
||||
private long fadeInStart;
|
||||
private final LogoRenderer logoRenderer;
|
||||
+ private net.minecraftforge.client.gui.TitleScreenModUpdateIndicator modUpdateNotification;
|
||||
|
||||
public TitleScreen() {
|
||||
this(false);
|
||||
@@ -116,11 +_,15 @@
|
||||
@@ -115,11 +_,15 @@
|
||||
int j = this.width - i - 2;
|
||||
int k = 24;
|
||||
int l = this.height / 4 + 48;
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
SpriteIconButton spriteiconbutton = this.addRenderableWidget(
|
||||
CommonButtons.language(
|
||||
@@ -171,7 +_,7 @@
|
||||
@@ -170,7 +_,7 @@
|
||||
}).bounds(this.width / 2 - 100, p_96764_ + p_96765_ * 1, 200, 20).tooltip(tooltip).build()).active = flag;
|
||||
this.addRenderableWidget(
|
||||
Button.builder(Component.translatable("menu.online"), p_325369_ -> this.minecraft.setScreen(new RealmsMainScreen(this)))
|
||||
@@ -33,15 +33,15 @@
|
||||
.tooltip(tooltip)
|
||||
.build()
|
||||
)
|
||||
@@ -281,6 +_,7 @@
|
||||
this.warningLabel.render(p_282860_, i);
|
||||
}
|
||||
|
||||
@@ -276,6 +_,7 @@
|
||||
if ((i & -67108864) != 0) {
|
||||
super.render(p_282860_, p_281753_, p_283539_, p_282628_);
|
||||
this.logoRenderer.renderLogo(p_282860_, this.width, f);
|
||||
+ net.minecraftforge.client.ForgeHooksClient.renderMainMenu(this, p_282860_, this.font, this.width, this.height, i);
|
||||
if (this.splash != null && !this.minecraft.options.hideSplashTexts().get()) {
|
||||
this.splash.render(p_282860_, this.width, this.font, i);
|
||||
}
|
||||
@@ -296,11 +_,19 @@
|
||||
@@ -291,11 +_,19 @@
|
||||
s = s + I18n.get("menu.modded");
|
||||
}
|
||||
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
--- a/net/minecraft/client/gui/screens/controls/KeyBindsScreen.java
|
||||
+++ b/net/minecraft/client/gui/screens/controls/KeyBindsScreen.java
|
||||
@@ -33,7 +_,7 @@
|
||||
this.keyBindsList = this.addRenderableWidget(new KeyBindsList(this, this.minecraft));
|
||||
this.resetButton = Button.builder(Component.translatable("controls.resetAll"), p_269619_ -> {
|
||||
for (KeyMapping keymapping : this.options.keyMappings) {
|
||||
- keymapping.setKey(keymapping.getDefaultKey());
|
||||
+ keymapping.setToDefault();
|
||||
}
|
||||
|
||||
this.keyBindsList.resetMappingAndUpdateButtons();
|
||||
@@ -70,11 +_,14 @@
|
||||
public boolean keyPressed(int p_193987_, int p_193988_, int p_193989_) {
|
||||
if (this.selectedKey != null) {
|
||||
if (p_193987_ == 256) {
|
||||
+ this.selectedKey.setKeyModifierAndCode(null, InputConstants.UNKNOWN);
|
||||
this.options.setKey(this.selectedKey, InputConstants.UNKNOWN);
|
||||
} else {
|
||||
+ this.selectedKey.setKeyModifierAndCode(null, InputConstants.getKey(p_193987_, p_193988_));
|
||||
this.options.setKey(this.selectedKey, InputConstants.getKey(p_193987_, p_193988_));
|
||||
}
|
||||
|
||||
+ if (p_193987_ == 256 || !net.minecraftforge.client.settings.KeyModifier.isKeyCodeModifier(this.selectedKey.getKey()))
|
||||
this.selectedKey = null;
|
||||
this.lastKeySelection = Util.getMillis();
|
||||
this.keyBindsList.resetMappingAndUpdateButtons();
|
||||
@@ -82,6 +_,19 @@
|
||||
} else {
|
||||
return super.keyPressed(p_193987_, p_193988_, p_193989_);
|
||||
}
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean keyReleased(int keyCode, int scanCode, int modifiers) {
|
||||
+ // Forge: We wait for a second key above if the first press is a modifier
|
||||
+ // but if they release the modifier then set it explicitly.
|
||||
+ var key = InputConstants.getKey(keyCode, scanCode);
|
||||
+ if (this.selectedKey != null && this.selectedKey.getKey() == key) {
|
||||
+ this.selectedKey = null;
|
||||
+ this.lastKeySelection = Util.getMillis();
|
||||
+ this.keyBindsList.resetMappingAndUpdateButtons();
|
||||
+ }
|
||||
+ return super.keyReleased(keyCode, scanCode, modifiers);
|
||||
}
|
||||
|
||||
@Override
|
||||
+44
-52
@@ -7,9 +7,9 @@
|
||||
+ private final List<net.minecraftforge.client.gui.CreativeTabsScreenPage> pages = new java.util.ArrayList<>();
|
||||
+ private net.minecraftforge.client.gui.CreativeTabsScreenPage currentPage = new net.minecraftforge.client.gui.CreativeTabsScreenPage(new java.util.ArrayList<>());
|
||||
|
||||
public CreativeModeInventoryScreen(Player p_259788_, FeatureFlagSet p_260074_, boolean p_259569_) {
|
||||
super(new CreativeModeInventoryScreen.ItemPickerMenu(p_259788_), p_259788_.getInventory(), CommonComponents.EMPTY);
|
||||
@@ -144,7 +_,7 @@
|
||||
public CreativeModeInventoryScreen(LocalPlayer p_344408_, FeatureFlagSet p_260074_, boolean p_259569_) {
|
||||
super(new CreativeModeInventoryScreen.ItemPickerMenu(p_344408_), p_344408_.getInventory(), CommonComponents.EMPTY);
|
||||
@@ -159,7 +_,7 @@
|
||||
private void refreshCurrentTabContents(Collection<ItemStack> p_261591_) {
|
||||
int i = this.menu.getRowIndexForScroll(this.scrollOffs);
|
||||
this.menu.items.clear();
|
||||
@@ -18,7 +18,7 @@
|
||||
this.refreshSearchResults();
|
||||
} else {
|
||||
this.menu.items.addAll(p_261591_);
|
||||
@@ -307,6 +_,35 @@
|
||||
@@ -322,6 +_,35 @@
|
||||
protected void init() {
|
||||
if (this.minecraft.gameMode.hasInfiniteItems()) {
|
||||
super.init();
|
||||
@@ -54,7 +54,7 @@
|
||||
this.searchBox = new EditBox(this.font, this.leftPos + 82, this.topPos + 6, 80, 9, Component.translatable("itemGroup.search"));
|
||||
this.searchBox.setMaxLength(50);
|
||||
this.searchBox.setBordered(false);
|
||||
@@ -353,7 +_,7 @@
|
||||
@@ -368,7 +_,7 @@
|
||||
public boolean charTyped(char p_98521_, int p_98522_) {
|
||||
if (this.ignoreTextInput) {
|
||||
return false;
|
||||
@@ -63,7 +63,7 @@
|
||||
return false;
|
||||
} else {
|
||||
String s = this.searchBox.getValue();
|
||||
@@ -372,7 +_,7 @@
|
||||
@@ -387,7 +_,7 @@
|
||||
@Override
|
||||
public boolean keyPressed(int p_98547_, int p_98548_, int p_98549_) {
|
||||
this.ignoreTextInput = false;
|
||||
@@ -72,7 +72,7 @@
|
||||
if (this.minecraft.options.keyChat.matches(p_98547_, p_98548_)) {
|
||||
this.ignoreTextInput = true;
|
||||
this.selectTab(CreativeModeTabs.searchTab());
|
||||
@@ -408,6 +_,7 @@
|
||||
@@ -423,6 +_,7 @@
|
||||
}
|
||||
|
||||
private void refreshSearchResults() {
|
||||
@@ -80,20 +80,20 @@
|
||||
this.menu.items.clear();
|
||||
this.visibleTags.clear();
|
||||
String s = this.searchBox.getValue();
|
||||
@@ -417,10 +_,10 @@
|
||||
SearchTree<ItemStack> searchtree;
|
||||
if (s.startsWith("#")) {
|
||||
s = s.substring(1);
|
||||
- searchtree = this.minecraft.getSearchTree(SearchRegistry.CREATIVE_TAGS);
|
||||
+ searchtree = this.minecraft.getSearchTree(net.minecraftforge.client.CreativeModeTabSearchRegistry.getTagSearchKey(selectedTab));
|
||||
this.updateVisibleTags(s);
|
||||
} else {
|
||||
- searchtree = this.minecraft.getSearchTree(SearchRegistry.CREATIVE_NAMES);
|
||||
+ searchtree = this.minecraft.getSearchTree(net.minecraftforge.client.CreativeModeTabSearchRegistry.getNameSearchKey(selectedTab));
|
||||
}
|
||||
@@ -435,10 +_,10 @@
|
||||
SearchTree<ItemStack> searchtree;
|
||||
if (s.startsWith("#")) {
|
||||
s = s.substring(1);
|
||||
- searchtree = sessionsearchtrees.creativeTagSearch();
|
||||
+ searchtree = sessionsearchtrees.getSearchTree(net.minecraftforge.client.CreativeModeTabSearchRegistry.getTagSearchKey(selectedTab));
|
||||
this.updateVisibleTags(s);
|
||||
} else {
|
||||
- searchtree = sessionsearchtrees.creativeNameSearch();
|
||||
+ searchtree = sessionsearchtrees.getSearchTree(net.minecraftforge.client.CreativeModeTabSearchRegistry.getNameSearchKey(selectedTab));
|
||||
}
|
||||
|
||||
this.menu.items.addAll(searchtree.search(s.toLowerCase(Locale.ROOT)));
|
||||
@@ -447,7 +_,8 @@
|
||||
this.menu.items.addAll(searchtree.search(s.toLowerCase(Locale.ROOT)));
|
||||
@@ -466,7 +_,8 @@
|
||||
@Override
|
||||
protected void renderLabels(GuiGraphics p_283168_, int p_281774_, int p_281466_) {
|
||||
if (selectedTab.showTitle()) {
|
||||
@@ -103,7 +103,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -457,7 +_,7 @@
|
||||
@@ -476,7 +_,7 @@
|
||||
double d0 = p_98531_ - (double)this.leftPos;
|
||||
double d1 = p_98532_ - (double)this.topPos;
|
||||
|
||||
@@ -112,7 +112,7 @@
|
||||
if (this.checkTabClicked(creativemodetab, d0, d1)) {
|
||||
return true;
|
||||
}
|
||||
@@ -479,7 +_,7 @@
|
||||
@@ -498,7 +_,7 @@
|
||||
double d1 = p_98623_ - (double)this.topPos;
|
||||
this.scrolling = false;
|
||||
|
||||
@@ -121,7 +121,7 @@
|
||||
if (this.checkTabClicked(creativemodetab, d0, d1)) {
|
||||
this.selectTab(creativemodetab);
|
||||
return true;
|
||||
@@ -497,6 +_,7 @@
|
||||
@@ -516,6 +_,7 @@
|
||||
private void selectTab(CreativeModeTab p_98561_) {
|
||||
CreativeModeTab creativemodetab = selectedTab;
|
||||
selectedTab = p_98561_;
|
||||
@@ -129,7 +129,7 @@
|
||||
this.quickCraftSlots.clear();
|
||||
this.menu.items.clear();
|
||||
this.clearDraggingState();
|
||||
@@ -573,13 +_,15 @@
|
||||
@@ -592,13 +_,15 @@
|
||||
this.originalSlots = null;
|
||||
}
|
||||
|
||||
@@ -146,19 +146,11 @@
|
||||
|
||||
this.refreshSearchResults();
|
||||
} else {
|
||||
@@ -642,7 +_,7 @@
|
||||
@@ -661,7 +_,15 @@
|
||||
public void render(GuiGraphics p_283000_, int p_281317_, int p_282770_, float p_281295_) {
|
||||
super.render(p_283000_, p_281317_, p_282770_, p_281295_);
|
||||
|
||||
- for (CreativeModeTab creativemodetab : CreativeModeTabs.tabs()) {
|
||||
+ for (CreativeModeTab creativemodetab : currentPage.getVisibleTabs()) {
|
||||
if (this.checkTabHovering(p_283000_, creativemodetab, p_281317_, p_282770_)) {
|
||||
break;
|
||||
}
|
||||
@@ -653,7 +_,15 @@
|
||||
&& this.isHovering(this.destroyItemSlot.x, this.destroyItemSlot.y, 16, 16, (double)p_281317_, (double)p_282770_)) {
|
||||
p_283000_.renderTooltip(this.font, TRASH_SLOT_TOOLTIP, p_281317_, p_282770_);
|
||||
}
|
||||
+ if (this.pages.size() != 1) {
|
||||
+ Component page = Component.literal(String.format("%d / %d", this.pages.indexOf(this.currentPage) + 1, this.pages.size()));
|
||||
+ p_283000_.pose().pushPose();
|
||||
@@ -166,21 +158,29 @@
|
||||
+ p_283000_.drawString(font, page.getVisualOrderText(), leftPos + (imageWidth / 2) - (font.width(page) / 2), topPos - 44, -1);
|
||||
+ p_283000_.pose().popPose();
|
||||
+ }
|
||||
+
|
||||
+ for (CreativeModeTab creativemodetab : currentPage.getVisibleTabs()) {
|
||||
if (this.checkTabHovering(p_283000_, creativemodetab, p_281317_, p_282770_)) {
|
||||
break;
|
||||
}
|
||||
@@ -673,6 +_,7 @@
|
||||
p_283000_.renderTooltip(this.font, TRASH_SLOT_TOOLTIP, p_281317_, p_282770_);
|
||||
}
|
||||
|
||||
+ com.mojang.blaze3d.systems.RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.renderTooltip(p_283000_, p_281317_, p_282770_);
|
||||
}
|
||||
|
||||
@@ -661,7 +_,7 @@
|
||||
@@ -680,7 +_,7 @@
|
||||
public List<Component> getTooltipFromContainerItem(ItemStack p_281769_) {
|
||||
boolean flag = this.hoveredSlot != null && this.hoveredSlot instanceof CreativeModeInventoryScreen.CustomCreativeSlot;
|
||||
boolean flag1 = selectedTab.getType() == CreativeModeTab.Type.CATEGORY;
|
||||
- boolean flag2 = selectedTab.getType() == CreativeModeTab.Type.SEARCH;
|
||||
+ boolean flag2 =selectedTab.hasSearchBar();
|
||||
+ boolean flag2 = selectedTab.hasSearchBar();
|
||||
TooltipFlag.Default tooltipflag$default = this.minecraft.options.advancedItemTooltips ? TooltipFlag.Default.ADVANCED : TooltipFlag.Default.NORMAL;
|
||||
TooltipFlag tooltipflag = flag ? tooltipflag$default.asCreative() : tooltipflag$default;
|
||||
List<Component> list = p_281769_.getTooltipLines(Item.TooltipContext.of(this.minecraft.level), this.minecraft.player, tooltipflag);
|
||||
@@ -680,7 +_,7 @@
|
||||
@@ -699,7 +_,7 @@
|
||||
int i = 1;
|
||||
|
||||
for (CreativeModeTab creativemodetab : CreativeModeTabs.tabs()) {
|
||||
@@ -189,7 +189,7 @@
|
||||
list1.add(i++, creativemodetab.getDisplayName().copy().withStyle(ChatFormatting.BLUE));
|
||||
}
|
||||
}
|
||||
@@ -691,14 +_,14 @@
|
||||
@@ -710,7 +_,7 @@
|
||||
|
||||
@Override
|
||||
protected void renderBg(GuiGraphics p_282663_, float p_282504_, int p_282089_, int p_282249_) {
|
||||
@@ -198,15 +198,7 @@
|
||||
if (creativemodetab != selectedTab) {
|
||||
this.renderTabButton(p_282663_, creativemodetab);
|
||||
}
|
||||
}
|
||||
|
||||
p_282663_.blit(
|
||||
- new ResourceLocation("textures/gui/container/creative_inventory/tab_" + selectedTab.getBackgroundSuffix()),
|
||||
+ selectedTab.getBackgroundLocation(),
|
||||
this.leftPos,
|
||||
this.topPos,
|
||||
0,
|
||||
@@ -715,6 +_,7 @@
|
||||
@@ -726,6 +_,7 @@
|
||||
p_282663_.blitSprite(resourcelocation, j, k + (int)((float)(i - k - 17) * this.scrollOffs), 12, 15);
|
||||
}
|
||||
|
||||
@@ -214,7 +206,7 @@
|
||||
this.renderTabButton(p_282663_, selectedTab);
|
||||
if (selectedTab.getType() == CreativeModeTab.Type.INVENTORY) {
|
||||
InventoryScreen.renderEntityInInventoryFollowsMouse(
|
||||
@@ -733,7 +_,7 @@
|
||||
@@ -744,7 +_,7 @@
|
||||
}
|
||||
|
||||
private int getTabX(CreativeModeTab p_260136_) {
|
||||
@@ -223,7 +215,7 @@
|
||||
int j = 27;
|
||||
int k = 27 * i;
|
||||
if (p_260136_.isAlignedRight()) {
|
||||
@@ -745,7 +_,7 @@
|
||||
@@ -756,7 +_,7 @@
|
||||
|
||||
private int getTabY(CreativeModeTab p_260181_) {
|
||||
int i = 0;
|
||||
@@ -232,7 +224,7 @@
|
||||
i -= 32;
|
||||
} else {
|
||||
i += this.imageHeight;
|
||||
@@ -773,8 +_,8 @@
|
||||
@@ -784,8 +_,8 @@
|
||||
|
||||
protected void renderTabButton(GuiGraphics p_283590_, CreativeModeTab p_283489_) {
|
||||
boolean flag = p_283489_ == selectedTab;
|
||||
@@ -243,7 +235,7 @@
|
||||
int j = this.leftPos + this.getTabX(p_283489_);
|
||||
int k = this.topPos - (flag1 ? 28 : -(this.imageHeight - 4));
|
||||
ResourceLocation[] aresourcelocation;
|
||||
@@ -784,6 +_,7 @@
|
||||
@@ -795,6 +_,7 @@
|
||||
aresourcelocation = flag ? SELECTED_BOTTOM_TABS : UNSELECTED_BOTTOM_TABS;
|
||||
}
|
||||
|
||||
@@ -251,7 +243,7 @@
|
||||
p_283590_.blitSprite(aresourcelocation[Mth.clamp(i, 0, aresourcelocation.length)], j, k, 26, 32);
|
||||
p_283590_.pose().pushPose();
|
||||
p_283590_.pose().translate(0.0F, 0.0F, 100.0F);
|
||||
@@ -825,6 +_,14 @@
|
||||
@@ -836,6 +_,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -266,7 +258,7 @@
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
static class CustomCreativeSlot extends Slot {
|
||||
public CustomCreativeSlot(Container p_98633_, int p_98634_, int p_98635_, int p_98636_) {
|
||||
@@ -1009,6 +_,22 @@
|
||||
@@ -1020,6 +_,22 @@
|
||||
@Override
|
||||
public boolean mayPickup(Player p_98665_) {
|
||||
return this.target.mayPickup(p_98665_);
|
||||
|
||||
+22
-18
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/gui/screens/inventory/EnchantmentScreen.java
|
||||
+++ b/net/minecraft/client/gui/screens/inventory/EnchantmentScreen.java
|
||||
@@ -108,7 +_,7 @@
|
||||
@@ -111,7 +_,7 @@
|
||||
int l1 = 86 - this.font.width(s);
|
||||
FormattedText formattedtext = EnchantmentNames.getInstance().getRandomName(this.font, l1);
|
||||
int i2 = 6839882;
|
||||
@@ -9,20 +9,24 @@
|
||||
RenderSystem.enableBlend();
|
||||
p_282430_.blitSprite(ENCHANTMENT_SLOT_DISABLED_SPRITE, i1, j + 14 + 19 * l, 108, 19);
|
||||
p_282430_.blitSprite(DISABLED_LEVEL_SPRITES[l], i1 + 1, j + 15 + 19 * l, 16, 16);
|
||||
@@ -173,10 +_,13 @@
|
||||
Enchantment enchantment = Enchantment.byId(this.menu.enchantClue[j]);
|
||||
int l = this.menu.levelClue[j];
|
||||
int i1 = j + 1;
|
||||
- if (this.isHovering(60, 14 + 19 * j, 108, 17, (double)p_282491_, (double)p_281953_) && k > 0 && l >= 0 && enchantment != null) {
|
||||
+ if (this.isHovering(60, 14 + 19 * j, 108, 17, (double)p_282491_, (double)p_281953_) && k > 0) {
|
||||
List<Component> list = Lists.newArrayList();
|
||||
- list.add(Component.translatable("container.enchant.clue", enchantment.getFullname(l)).withStyle(ChatFormatting.WHITE));
|
||||
- if (!flag) {
|
||||
+ list.add((Component.translatable("container.enchant.clue", enchantment == null ? "" : enchantment.getFullname(l))).withStyle(ChatFormatting.WHITE));
|
||||
+ if (enchantment == null) {
|
||||
+ list.add(Component.literal(""));
|
||||
+ list.add(Component.translatable("forge.container.enchant.limitedEnchantability").withStyle(ChatFormatting.RED));
|
||||
+ } else if (!flag) {
|
||||
list.add(CommonComponents.EMPTY);
|
||||
if (this.minecraft.player.experienceLevel < k) {
|
||||
list.add(Component.translatable("container.enchant.level.requirement", this.menu.costs[j]).withStyle(ChatFormatting.RED));
|
||||
@@ -177,13 +_,16 @@
|
||||
.registryAccess()
|
||||
.registryOrThrow(Registries.ENCHANTMENT)
|
||||
.getHolder(this.menu.enchantClue[j]);
|
||||
- if (!optional.isEmpty()) {
|
||||
+ {
|
||||
int l = this.menu.levelClue[j];
|
||||
int i1 = j + 1;
|
||||
- if (this.isHovering(60, 14 + 19 * j, 108, 17, (double)p_282491_, (double)p_281953_) && k > 0 && l >= 0 && optional != null) {
|
||||
+ if (this.isHovering(60, 14 + 19 * j, 108, 17, (double)p_282491_, (double)p_281953_) && k > 0) {
|
||||
List<Component> list = Lists.newArrayList();
|
||||
- list.add(Component.translatable("container.enchant.clue", Enchantment.getFullname(optional.get(), l)).withStyle(ChatFormatting.WHITE));
|
||||
- if (!flag) {
|
||||
+ list.add(Component.translatable("container.enchant.clue", optional.isEmpty() ? "" : Enchantment.getFullname(optional.get(), l)).withStyle(ChatFormatting.WHITE));
|
||||
+ if (optional.isEmpty()) {
|
||||
+ list.add(Component.literal(""));
|
||||
+ list.add(Component.translatable("forge.container.enchant.limitedEnchantability").withStyle(ChatFormatting.RED));
|
||||
+ } else if (!flag) {
|
||||
list.add(CommonComponents.EMPTY);
|
||||
if (this.minecraft.player.experienceLevel < k) {
|
||||
list.add(Component.translatable("container.enchant.level.requirement", this.menu.costs[j]).withStyle(ChatFormatting.RED));
|
||||
+2
-2
@@ -4,8 +4,8 @@
|
||||
private static final Vector3f TEXT_SCALE = new Vector3f(1.0F, 1.0F, 1.0F);
|
||||
private static final int TEXTURE_WIDTH = 16;
|
||||
private static final int TEXTURE_HEIGHT = 16;
|
||||
- private final ResourceLocation texture = new ResourceLocation("textures/gui/hanging_signs/" + this.woodType.name() + ".png");
|
||||
+ private final ResourceLocation texture = new ResourceLocation(this.woodType.name() + ".png").withPrefix("textures/gui/hanging_signs/"); // possibly unnecessary patch(?) -Paint_Ninja
|
||||
- private final ResourceLocation texture = ResourceLocation.withDefaultNamespace("textures/gui/hanging_signs/" + this.woodType.name() + ".png");
|
||||
+ private final ResourceLocation texture = ResourceLocation.parse(this.woodType.name() + ".png").withPrefix("textures/gui/hanging_signs/");
|
||||
|
||||
public HangingSignEditScreen(SignBlockEntity p_278017_, boolean p_277942_, boolean p_277778_) {
|
||||
super(p_278017_, p_277942_, p_277778_, Component.translatable("hanging_sign.edit"));
|
||||
+3
-3
@@ -1,8 +1,8 @@
|
||||
--- a/net/minecraft/client/gui/screens/inventory/tooltip/ClientTooltipComponent.java
|
||||
+++ b/net/minecraft/client/gui/screens/inventory/tooltip/ClientTooltipComponent.java
|
||||
@@ -20,6 +_,8 @@
|
||||
if (p_169951_ instanceof BundleTooltip bundletooltip) {
|
||||
return new ClientBundleTooltip(bundletooltip.contents());
|
||||
@@ -22,6 +_,8 @@
|
||||
} else if (p_169951_ instanceof ClientActivePlayersTooltip.ActivePlayersTooltip clientactiveplayerstooltip$activeplayerstooltip) {
|
||||
return new ClientActivePlayersTooltip(clientactiveplayerstooltip$activeplayerstooltip);
|
||||
} else {
|
||||
+ ClientTooltipComponent result = net.minecraftforge.client.gui.ClientTooltipComponentManager.createClientTooltipComponent(p_169951_);
|
||||
+ if (result != null) return result;
|
||||
|
||||
+11
-11
@@ -1,5 +1,5 @@
|
||||
--- a/net/minecraft/client/gui/screens/controls/KeyBindsList.java
|
||||
+++ b/net/minecraft/client/gui/screens/controls/KeyBindsList.java
|
||||
--- a/net/minecraft/client/gui/screens/options/controls/KeyBindsList.java
|
||||
+++ b/net/minecraft/client/gui/screens/options/controls/KeyBindsList.java
|
||||
@@ -69,6 +_,11 @@
|
||||
return 340;
|
||||
}
|
||||
@@ -13,25 +13,25 @@
|
||||
public class CategoryEntry extends KeyBindsList.Entry {
|
||||
final Component name;
|
||||
@@ -153,9 +_,10 @@
|
||||
this.name = p_193917_;
|
||||
this.changeButton = Button.builder(p_193917_, p_269618_ -> {
|
||||
KeyBindsList.this.keyBindsScreen.selectedKey = p_193916_;
|
||||
+ p_193916_.setKeyModifierAndCode(null, com.mojang.blaze3d.platform.InputConstants.UNKNOWN);
|
||||
this.name = p_343976_;
|
||||
this.changeButton = Button.builder(p_343976_, p_342196_ -> {
|
||||
KeyBindsList.this.keyBindsScreen.selectedKey = p_343088_;
|
||||
+ p_343088_.setKeyModifierAndCode(null, com.mojang.blaze3d.platform.InputConstants.UNKNOWN);
|
||||
KeyBindsList.this.resetMappingAndUpdateButtons();
|
||||
})
|
||||
- .bounds(0, 0, 75, 20)
|
||||
+ .bounds(0, 0, 75 + 20 /* Forge: Add space */, 20)
|
||||
.createNarration(
|
||||
p_253311_ -> p_193916_.isUnbound()
|
||||
? Component.translatable("narrator.controls.unbound", p_193917_)
|
||||
p_342179_ -> p_343088_.isUnbound()
|
||||
? Component.translatable("narrator.controls.unbound", p_343976_)
|
||||
@@ -163,6 +_,7 @@
|
||||
)
|
||||
.build();
|
||||
this.resetButton = Button.builder(RESET_BUTTON_TITLE, p_325376_ -> {
|
||||
this.resetButton = Button.builder(RESET_BUTTON_TITLE, p_343650_ -> {
|
||||
+ this.key.setToDefault();
|
||||
KeyBindsList.this.minecraft.options.setKey(p_193916_, p_193916_.getDefaultKey());
|
||||
KeyBindsList.this.minecraft.options.setKey(p_343088_, p_343088_.getDefaultKey());
|
||||
KeyBindsList.this.resetMappingAndUpdateButtons();
|
||||
}).bounds(0, 0, 50, 20).createNarration(p_253313_ -> Component.translatable("narrator.controls.reset", p_193917_)).build();
|
||||
}).bounds(0, 0, 50, 20).createNarration(p_344192_ -> Component.translatable("narrator.controls.reset", p_343976_)).build();
|
||||
@@ -215,7 +_,7 @@
|
||||
MutableComponent mutablecomponent = Component.empty();
|
||||
if (!this.key.isUnbound()) {
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
--- a/net/minecraft/client/gui/screens/options/controls/KeyBindsScreen.java
|
||||
+++ b/net/minecraft/client/gui/screens/options/controls/KeyBindsScreen.java
|
||||
@@ -41,7 +_,7 @@
|
||||
protected void addFooter() {
|
||||
this.resetButton = Button.builder(Component.translatable("controls.resetAll"), p_343640_ -> {
|
||||
for (KeyMapping keymapping : this.options.keyMappings) {
|
||||
- keymapping.setKey(keymapping.getDefaultKey());
|
||||
+ keymapping.setToDefault();
|
||||
}
|
||||
|
||||
this.keyBindsList.resetMappingAndUpdateButtons();
|
||||
@@ -73,11 +_,14 @@
|
||||
public boolean keyPressed(int p_342715_, int p_342862_, int p_345515_) {
|
||||
if (this.selectedKey != null) {
|
||||
if (p_342715_ == 256) {
|
||||
+ this.selectedKey.setKeyModifierAndCode(null, InputConstants.UNKNOWN);
|
||||
this.options.setKey(this.selectedKey, InputConstants.UNKNOWN);
|
||||
} else {
|
||||
+ this.selectedKey.setKeyModifierAndCode(null, InputConstants.getKey(p_342715_, p_342862_));
|
||||
this.options.setKey(this.selectedKey, InputConstants.getKey(p_342715_, p_342862_));
|
||||
}
|
||||
|
||||
+ if (p_342715_ == 256 || !net.minecraftforge.client.settings.KeyModifier.isKeyCodeModifier(this.selectedKey.getKey()))
|
||||
this.selectedKey = null;
|
||||
this.lastKeySelection = Util.getMillis();
|
||||
this.keyBindsList.resetMappingAndUpdateButtons();
|
||||
@@ -100,5 +_,18 @@
|
||||
}
|
||||
|
||||
this.resetButton.active = flag;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean keyReleased(int keyCode, int scanCode, int modifiers) {
|
||||
+ // Forge: We wait for a second key above if the first press is a modifier
|
||||
+ // but if they release the modifier then set it explicitly.
|
||||
+ var key = InputConstants.getKey(keyCode, scanCode);
|
||||
+ if (this.selectedKey != null && this.selectedKey.getKey() == key) {
|
||||
+ this.selectedKey = null;
|
||||
+ this.lastKeySelection = Util.getMillis();
|
||||
+ this.keyBindsList.resetMappingAndUpdateButtons();
|
||||
+ }
|
||||
+ return super.keyReleased(keyCode, scanCode, modifiers);
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -6,6 +6,6 @@
|
||||
p_100014_.setSelected(null);
|
||||
- p_100015_.forEach(
|
||||
+ p_100015_.filter(PackSelectionModel.Entry::notHidden).forEach(
|
||||
p_325390_ -> {
|
||||
p_340813_ -> {
|
||||
TransferableSelectionList.PackEntry transferableselectionlist$packentry1 = new TransferableSelectionList.PackEntry(
|
||||
this.minecraft, p_100014_, p_325390_
|
||||
this.minecraft, p_100014_, p_340813_
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/gui/screens/recipebook/RecipeBookComponent.java
|
||||
+++ b/net/minecraft/client/gui/screens/recipebook/RecipeBookComponent.java
|
||||
@@ -116,7 +_,7 @@
|
||||
@@ -115,7 +_,7 @@
|
||||
this.initFilterButtonTextures();
|
||||
this.tabButtons.clear();
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
this.tabButtons.add(new RecipeBookTabButton(recipebookcategories));
|
||||
}
|
||||
|
||||
@@ -291,7 +_,7 @@
|
||||
@@ -293,7 +_,7 @@
|
||||
}
|
||||
|
||||
if (itemstack != null && this.minecraft.screen != null) {
|
||||
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java
|
||||
+++ b/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java
|
||||
@@ -119,6 +_,7 @@
|
||||
@@ -118,6 +_,7 @@
|
||||
public static void openFresh(Minecraft p_232897_, @Nullable Screen p_232898_) {
|
||||
queueLoadScreen(p_232897_, PREPARING_WORLD_DATA);
|
||||
PackRepository packrepository = new PackRepository(new ServerPacksSource(p_232897_.directoryValidator()));
|
||||
@@ -8,7 +8,7 @@
|
||||
WorldLoader.InitConfig worldloader$initconfig = createDefaultLoadConfig(packrepository, WorldDataConfiguration.DEFAULT);
|
||||
CompletableFuture<WorldCreationContext> completablefuture = WorldLoader.load(
|
||||
worldloader$initconfig,
|
||||
@@ -419,7 +_,7 @@
|
||||
@@ -415,7 +_,7 @@
|
||||
if (p_269627_) {
|
||||
p_270552_.accept(this.uiState.getSettings().dataConfiguration());
|
||||
} else {
|
||||
@@ -17,7 +17,7 @@
|
||||
}
|
||||
},
|
||||
Component.translatable("dataPack.validation.failed"),
|
||||
@@ -537,6 +_,7 @@
|
||||
@@ -533,6 +_,7 @@
|
||||
if (path != null) {
|
||||
if (this.tempDataPackRepository == null) {
|
||||
this.tempDataPackRepository = ServerPacksSource.createPackRepository(path, this.packValidator);
|
||||
|
||||
+3
-3
@@ -1,10 +1,10 @@
|
||||
--- a/net/minecraft/client/gui/screens/worldselection/WorldSelectionList.java
|
||||
+++ b/net/minecraft/client/gui/screens/worldselection/WorldSelectionList.java
|
||||
@@ -75,6 +_,7 @@
|
||||
static final ResourceLocation JOIN_HIGHLIGHTED_SPRITE = new ResourceLocation("world_list/join_highlighted");
|
||||
static final ResourceLocation JOIN_SPRITE = new ResourceLocation("world_list/join");
|
||||
static final ResourceLocation JOIN_HIGHLIGHTED_SPRITE = ResourceLocation.withDefaultNamespace("world_list/join_highlighted");
|
||||
static final ResourceLocation JOIN_SPRITE = ResourceLocation.withDefaultNamespace("world_list/join");
|
||||
static final Logger LOGGER = LogUtils.getLogger();
|
||||
+ private static final ResourceLocation FORGE_EXPERIMENTAL_WARNING_ICON = new ResourceLocation("forge","textures/gui/experimental_warning.png");
|
||||
+ private static final ResourceLocation FORGE_EXPERIMENTAL_WARNING_ICON = ResourceLocation.fromNamespaceAndPath("forge","textures/gui/experimental_warning.png");
|
||||
static final Component FROM_NEWER_TOOLTIP_1 = Component.translatable("selectWorld.tooltip.fromNewerVersion1").withStyle(ChatFormatting.RED);
|
||||
static final Component FROM_NEWER_TOOLTIP_2 = Component.translatable("selectWorld.tooltip.fromNewerVersion2").withStyle(ChatFormatting.RED);
|
||||
static final Component SNAPSHOT_TOOLTIP_1 = Component.translatable("selectWorld.tooltip.snapshot1").withStyle(ChatFormatting.GOLD);
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
--- a/net/minecraft/client/main/Main.java
|
||||
+++ b/net/minecraft/client/main/Main.java
|
||||
@@ -154,8 +_,8 @@
|
||||
CrashReport.preload();
|
||||
|
||||
try {
|
||||
@@ -111,8 +_,8 @@
|
||||
CrashReport.preload();
|
||||
logger = LogUtils.getLogger();
|
||||
s1 = "Bootstrap";
|
||||
- Bootstrap.bootStrap();
|
||||
GameLoadTimesEvent.INSTANCE.setBootstrapTime(Bootstrap.bootstrapDuration.get());
|
||||
+ net.minecraftforge.fml.loading.BackgroundWaiter.runAndTick(Bootstrap::bootStrap, net.minecraftforge.fml.loading.FMLLoader.progressWindowTick);
|
||||
Bootstrap.validate();
|
||||
} catch (Throwable throwable2) {
|
||||
CrashReport crashreport = CrashReport.forThrowable(throwable2, "Bootstrap");
|
||||
s1 = "Argument parsing";
|
||||
List<String> list = optionset.valuesOf(optionspec27);
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/model/geom/LayerDefinitions.java
|
||||
+++ b/net/minecraft/client/model/geom/LayerDefinitions.java
|
||||
@@ -328,6 +_,7 @@
|
||||
@@ -329,6 +_,7 @@
|
||||
WoodType.values().forEach(p_171114_ -> builder.put(ModelLayers.createSignModelName(p_171114_), layerdefinition23));
|
||||
LayerDefinition layerdefinition24 = HangingSignRenderer.createHangingSignLayer();
|
||||
WoodType.values().forEach(p_247864_ -> builder.put(ModelLayers.createHangingSignModelName(p_247864_), layerdefinition24));
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
--- a/net/minecraft/client/model/geom/ModelLayers.java
|
||||
+++ b/net/minecraft/client/model/geom/ModelLayers.java
|
||||
@@ -229,11 +_,13 @@
|
||||
}
|
||||
|
||||
public static ModelLayerLocation createSignModelName(WoodType p_171292_) {
|
||||
- return createLocation("sign/" + p_171292_.name(), "main");
|
||||
+ ResourceLocation location = ResourceLocation.parse(p_171292_.name());
|
||||
+ return new ModelLayerLocation(ResourceLocation.fromNamespaceAndPath(location.getNamespace(), "sign/" + location.getPath()), "main");
|
||||
}
|
||||
|
||||
public static ModelLayerLocation createHangingSignModelName(WoodType p_252225_) {
|
||||
- return createLocation("hanging_sign/" + p_252225_.name(), "main");
|
||||
+ ResourceLocation location = ResourceLocation.parse(p_252225_.name());
|
||||
+ return new ModelLayerLocation(ResourceLocation.fromNamespaceAndPath(location.getNamespace(), "hanging_sign/" + location.getPath()), "main");
|
||||
}
|
||||
|
||||
public static Stream<ModelLayerLocation> getKnownLocations() {
|
||||
+2
-2
@@ -1,10 +1,10 @@
|
||||
--- a/net/minecraft/client/multiplayer/ClientCommonPacketListenerImpl.java
|
||||
+++ b/net/minecraft/client/multiplayer/ClientCommonPacketListenerImpl.java
|
||||
@@ -116,6 +_,7 @@
|
||||
@@ -149,6 +_,7 @@
|
||||
|
||||
@Override
|
||||
public void handleCustomPayload(ClientboundCustomPayloadPacket p_298103_) {
|
||||
+ if (net.minecraftforge.common.ForgeHooks.onCustomPayload(p_298103_, this.connection)) return;
|
||||
+ if (net.minecraftforge.common.ForgeHooks.onCustomPayload(p_298103_.payload(), this.connection)) return;
|
||||
CustomPacketPayload custompacketpayload = p_298103_.payload();
|
||||
if (!(custompacketpayload instanceof DiscardedPayload)) {
|
||||
PacketUtils.ensureRunningOnSameThread(p_298103_, this, this.minecraft);
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
--- a/net/minecraft/client/multiplayer/ClientConfigurationPacketListenerImpl.java
|
||||
+++ b/net/minecraft/client/multiplayer/ClientConfigurationPacketListenerImpl.java
|
||||
@@ -141,6 +_,7 @@
|
||||
@@ -143,6 +_,7 @@
|
||||
);
|
||||
this.connection.send(ServerboundFinishConfigurationPacket.INSTANCE);
|
||||
this.connection.setupOutboundProtocol(GameProtocols.SERVERBOUND.bind(RegistryFriendlyByteBuf.decorator(registryaccess$frozen)));
|
||||
this.connection.setupOutboundProtocol(GameProtocols.SERVERBOUND_TEMPLATE.bind(RegistryFriendlyByteBuf.decorator(registryaccess$frozen)));
|
||||
+ net.minecraftforge.common.ForgeHooks.handleClientConfigurationComplete(this.connection);
|
||||
}
|
||||
|
||||
|
||||
+5
-5
@@ -1,14 +1,14 @@
|
||||
--- a/net/minecraft/client/multiplayer/ClientHandshakePacketListenerImpl.java
|
||||
+++ b/net/minecraft/client/multiplayer/ClientHandshakePacketListenerImpl.java
|
||||
@@ -205,6 +_,7 @@
|
||||
@@ -210,6 +_,7 @@
|
||||
Component component = this.wasTransferredTo ? CommonComponents.TRANSFER_CONNECT_FAILED : CommonComponents.CONNECT_FAILED;
|
||||
if (this.serverData != null && this.serverData.isRealm()) {
|
||||
this.minecraft.setScreen(new DisconnectedRealmsScreen(this.parent, component, p_104543_));
|
||||
+ } else if (net.minecraftforge.client.ForgeHooksClient.onClientDisconnect(this.connection, this.minecraft, this.parent, p_104543_)) {
|
||||
this.minecraft.setScreen(new DisconnectedRealmsScreen(this.parent, component, p_342266_.reason()));
|
||||
+ } else if (net.minecraftforge.client.ForgeHooksClient.onClientDisconnect(this.connection, this.minecraft, this.parent, p_342266_.reason())) {
|
||||
} else {
|
||||
this.minecraft.setScreen(new DisconnectedScreen(this.parent, component, p_104543_));
|
||||
this.minecraft.setScreen(new DisconnectedScreen(this.parent, component, p_342266_));
|
||||
}
|
||||
@@ -229,6 +_,7 @@
|
||||
@@ -234,6 +_,7 @@
|
||||
|
||||
@Override
|
||||
public void handleCustomQuery(ClientboundCustomQueryPacket p_104545_) {
|
||||
|
||||
+12
-12
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/multiplayer/ClientPacketListener.java
|
||||
+++ b/net/minecraft/client/multiplayer/ClientPacketListener.java
|
||||
@@ -425,6 +_,7 @@
|
||||
@@ -427,6 +_,7 @@
|
||||
|
||||
this.minecraft.debugRenderer.clear();
|
||||
this.minecraft.player.resetPos();
|
||||
@@ -8,8 +8,8 @@
|
||||
this.minecraft.player.setId(p_105030_.playerId());
|
||||
this.level.addEntity(this.minecraft.player);
|
||||
this.minecraft.player.input = new KeyboardInput(this.minecraft.options);
|
||||
@@ -1159,7 +_,9 @@
|
||||
localplayer1.getAttributes().assignValues(localplayer.getAttributes());
|
||||
@@ -1164,7 +_,9 @@
|
||||
localplayer1.getAttributes().assignBaseValues(localplayer.getAttributes());
|
||||
}
|
||||
|
||||
+ localplayer1.updateSyncFields(localplayer); // Forge: fix MC-10657
|
||||
@@ -18,7 +18,7 @@
|
||||
this.level.addEntity(localplayer1);
|
||||
localplayer1.setYRot(-180.0F);
|
||||
localplayer1.input = new KeyboardInput(this.minecraft.options);
|
||||
@@ -1294,10 +_,7 @@
|
||||
@@ -1300,10 +_,7 @@
|
||||
PacketUtils.ensureRunningOnSameThread(p_104976_, this, this.minecraft);
|
||||
BlockPos blockpos = p_104976_.getPos();
|
||||
this.minecraft.level.getBlockEntity(blockpos, p_104976_.getType()).ifPresent(p_325478_ -> {
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
if (p_325478_ instanceof CommandBlockEntity && this.minecraft.screen instanceof CommandBlockEditScreen) {
|
||||
((CommandBlockEditScreen)this.minecraft.screen).updateGui();
|
||||
@@ -1464,7 +_,9 @@
|
||||
@@ -1465,7 +_,9 @@
|
||||
@Override
|
||||
public void handleCommands(ClientboundCommandsPacket p_104990_) {
|
||||
PacketUtils.ensureRunningOnSameThread(p_104990_, this, this.minecraft);
|
||||
@@ -41,24 +41,24 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1486,6 +_,7 @@
|
||||
@@ -1487,6 +_,7 @@
|
||||
ClientRecipeBook clientrecipebook = this.minecraft.player.getRecipeBook();
|
||||
clientrecipebook.setupCollections(this.recipeManager.getOrderedRecipes(), this.minecraft.level.registryAccess());
|
||||
this.minecraft.populateSearchTree(SearchRegistry.RECIPE_COLLECTIONS, clientrecipebook.getCollections());
|
||||
this.searchTrees.updateRecipes(clientrecipebook, this.registryAccess);
|
||||
+ net.minecraftforge.client.ForgeHooksClient.onRecipesUpdated(this.recipeManager);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1582,6 +_,8 @@
|
||||
TagCollector tagcollector = new TagCollector();
|
||||
p_298004_.getTags().forEach(tagcollector::append);
|
||||
@@ -1585,6 +_,8 @@
|
||||
tagcollector.updateTags(this.registryAccess, this.connection.isMemoryConnection());
|
||||
List<ItemStack> list = List.copyOf(CreativeModeTabs.searchTab().getDisplayItems());
|
||||
this.searchTrees.updateCreativeTags(list);
|
||||
+
|
||||
+ net.minecraftforge.event.ForgeEventFactory.onTagsUpdated(this.registryAccess, true, this.connection.isMemoryConnection());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -2388,6 +_,8 @@
|
||||
@@ -2389,6 +_,8 @@
|
||||
}
|
||||
|
||||
public void sendChat(String p_249888_) {
|
||||
@@ -67,7 +67,7 @@
|
||||
Instant instant = Instant.now();
|
||||
long i = Crypt.SaltSupplier.getLong();
|
||||
LastSeenMessagesTracker.Update lastseenmessagestracker$update = this.lastSeenMessages.generateAndApplyUpdate();
|
||||
@@ -2396,6 +_,7 @@
|
||||
@@ -2397,6 +_,7 @@
|
||||
}
|
||||
|
||||
public void sendCommand(String p_250092_) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/multiplayer/MultiPlayerGameMode.java
|
||||
+++ b/net/minecraft/client/multiplayer/MultiPlayerGameMode.java
|
||||
@@ -106,6 +_,7 @@
|
||||
@@ -105,6 +_,7 @@
|
||||
}
|
||||
|
||||
public boolean destroyBlock(BlockPos p_105268_) {
|
||||
@@ -8,7 +8,7 @@
|
||||
if (this.minecraft.player.blockActionRestricted(this.minecraft.level, p_105268_, this.localPlayerMode)) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -120,9 +_,8 @@
|
||||
@@ -119,9 +_,8 @@
|
||||
} else if (blockstate.isAir()) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -19,7 +19,7 @@
|
||||
if (flag) {
|
||||
block.destroy(level, p_105268_, blockstate);
|
||||
}
|
||||
@@ -143,6 +_,7 @@
|
||||
@@ -142,6 +_,7 @@
|
||||
BlockState blockstate = this.minecraft.level.getBlockState(p_105270_);
|
||||
this.minecraft.getTutorial().onDestroyBlock(this.minecraft.level, p_105270_, blockstate, 1.0F);
|
||||
this.startPrediction(this.minecraft.level, p_233757_ -> {
|
||||
@@ -27,7 +27,7 @@
|
||||
this.destroyBlock(p_105270_);
|
||||
return new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK, p_105270_, p_105271_, p_233757_);
|
||||
});
|
||||
@@ -152,15 +_,18 @@
|
||||
@@ -151,15 +_,18 @@
|
||||
this.connection
|
||||
.send(new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.ABORT_DESTROY_BLOCK, this.destroyBlockPos, p_105271_));
|
||||
}
|
||||
@@ -46,7 +46,7 @@
|
||||
if (flag && blockstate1.getDestroyProgress(this.minecraft.player, this.minecraft.player.level(), p_105270_) >= 1.0F) {
|
||||
this.destroyBlock(p_105270_);
|
||||
} else {
|
||||
@@ -171,6 +_,7 @@
|
||||
@@ -170,6 +_,7 @@
|
||||
this.destroyTicks = 0.0F;
|
||||
this.minecraft.level.destroyBlockProgress(this.minecraft.player.getId(), this.destroyBlockPos, this.getDestroyStage());
|
||||
}
|
||||
@@ -54,7 +54,7 @@
|
||||
|
||||
return new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK, p_105270_, p_105271_, p_233728_);
|
||||
});
|
||||
@@ -203,6 +_,7 @@
|
||||
@@ -202,6 +_,7 @@
|
||||
BlockState blockstate1 = this.minecraft.level.getBlockState(p_105284_);
|
||||
this.minecraft.getTutorial().onDestroyBlock(this.minecraft.level, p_105284_, blockstate1, 1.0F);
|
||||
this.startPrediction(this.minecraft.level, p_233753_ -> {
|
||||
@@ -62,7 +62,7 @@
|
||||
this.destroyBlock(p_105284_);
|
||||
return new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK, p_105284_, p_105285_, p_233753_);
|
||||
});
|
||||
@@ -215,7 +_,7 @@
|
||||
@@ -214,7 +_,7 @@
|
||||
} else {
|
||||
this.destroyProgress = this.destroyProgress + blockstate.getDestroyProgress(this.minecraft.player, this.minecraft.player.level(), p_105284_);
|
||||
if (this.destroyTicks % 4.0F == 0.0F) {
|
||||
@@ -71,7 +71,7 @@
|
||||
this.minecraft
|
||||
.getSoundManager()
|
||||
.play(
|
||||
@@ -232,6 +_,7 @@
|
||||
@@ -231,6 +_,7 @@
|
||||
|
||||
this.destroyTicks++;
|
||||
this.minecraft.getTutorial().onDestroyBlock(this.minecraft.level, p_105284_, blockstate, Mth.clamp(this.destroyProgress, 0.0F, 1.0F));
|
||||
@@ -79,7 +79,7 @@
|
||||
if (this.destroyProgress >= 1.0F) {
|
||||
this.isDestroying = false;
|
||||
this.startPrediction(this.minecraft.level, p_233739_ -> {
|
||||
@@ -270,7 +_,7 @@
|
||||
@@ -269,7 +_,7 @@
|
||||
|
||||
private boolean sameDestroyTarget(BlockPos p_105282_) {
|
||||
ItemStack itemstack = this.minecraft.player.getMainHandItem();
|
||||
@@ -88,7 +88,7 @@
|
||||
}
|
||||
|
||||
private void ensureHasSentCarriedItem() {
|
||||
@@ -298,12 +_,23 @@
|
||||
@@ -297,12 +_,23 @@
|
||||
private InteractionResult performUseItemOn(LocalPlayer p_233747_, InteractionHand p_233748_, BlockHitResult p_233749_) {
|
||||
BlockPos blockpos = p_233749_.getBlockPos();
|
||||
ItemStack itemstack = p_233747_.getItemInHand(p_233748_);
|
||||
@@ -114,7 +114,7 @@
|
||||
BlockState blockstate = this.minecraft.level.getBlockState(blockpos);
|
||||
if (!this.connection.isFeatureEnabled(blockstate.getBlock().requiredFeatures())) {
|
||||
return InteractionResult.FAIL;
|
||||
@@ -324,8 +_,10 @@
|
||||
@@ -323,8 +_,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,26 +127,26 @@
|
||||
InteractionResult interactionresult1;
|
||||
if (this.localPlayerMode.isCreative()) {
|
||||
int i = itemstack.getCount();
|
||||
@@ -361,10 +_,18 @@
|
||||
mutableobject.setValue(InteractionResult.PASS);
|
||||
return serverbounduseitempacket;
|
||||
} else {
|
||||
+ var event = net.minecraftforge.event.ForgeEventFactory.onRightClickItem(p_233722_, p_233723_);
|
||||
+ if (event.isCanceled()) {
|
||||
+ mutableobject.setValue(event.getCancellationResult());
|
||||
+ return serverbounduseitempacket;
|
||||
+ }
|
||||
InteractionResultHolder<ItemStack> interactionresultholder = itemstack.use(this.minecraft.level, p_233722_, p_233723_);
|
||||
ItemStack itemstack1 = interactionresultholder.getObject();
|
||||
if (itemstack1 != itemstack) {
|
||||
p_233722_.setItemInHand(p_233723_, itemstack1);
|
||||
+ if (itemstack1.isEmpty()) {
|
||||
+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(p_233722_, itemstack, p_233723_);
|
||||
@@ -358,10 +_,18 @@
|
||||
mutableobject.setValue(InteractionResult.PASS);
|
||||
return serverbounduseitempacket;
|
||||
} else {
|
||||
+ var event = net.minecraftforge.event.ForgeEventFactory.onRightClickItem(p_233722_, p_233723_);
|
||||
+ if (event.isCanceled()) {
|
||||
+ mutableobject.setValue(event.getCancellationResult());
|
||||
+ return serverbounduseitempacket;
|
||||
+ }
|
||||
}
|
||||
InteractionResultHolder<ItemStack> interactionresultholder = itemstack.use(this.minecraft.level, p_233722_, p_233723_);
|
||||
ItemStack itemstack1 = interactionresultholder.getObject();
|
||||
if (itemstack1 != itemstack) {
|
||||
p_233722_.setItemInHand(p_233723_, itemstack1);
|
||||
+ if (itemstack1.isEmpty()) {
|
||||
+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(p_233722_, itemstack, p_233723_);
|
||||
+ }
|
||||
}
|
||||
|
||||
mutableobject.setValue(interactionresultholder.getResult());
|
||||
@@ -395,6 +_,10 @@
|
||||
mutableobject.setValue(interactionresultholder.getResult());
|
||||
@@ -393,6 +_,10 @@
|
||||
public InteractionResult interact(Player p_105227_, Entity p_105228_, InteractionHand p_105229_) {
|
||||
this.ensureHasSentCarriedItem();
|
||||
this.connection.send(ServerboundInteractPacket.createInteractionPacket(p_105228_, p_105227_.isShiftKeyDown(), p_105229_));
|
||||
@@ -157,7 +157,7 @@
|
||||
return this.localPlayerMode == GameType.SPECTATOR ? InteractionResult.PASS : p_105227_.interactOn(p_105228_, p_105229_);
|
||||
}
|
||||
|
||||
@@ -402,6 +_,10 @@
|
||||
@@ -400,6 +_,10 @@
|
||||
this.ensureHasSentCarriedItem();
|
||||
Vec3 vec3 = p_105233_.getLocation().subtract(p_105232_.getX(), p_105232_.getY(), p_105232_.getZ());
|
||||
this.connection.send(ServerboundInteractPacket.createInteractionPacket(p_105232_, p_105231_.isShiftKeyDown(), p_105234_, vec3));
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/multiplayer/ServerStatusPinger.java
|
||||
+++ b/net/minecraft/client/multiplayer/ServerStatusPinger.java
|
||||
@@ -98,6 +_,7 @@
|
||||
@@ -99,6 +_,7 @@
|
||||
p_105461_.run();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
--- a/net/minecraft/client/multiplayer/SessionSearchTrees.java
|
||||
+++ b/net/minecraft/client/multiplayer/SessionSearchTrees.java
|
||||
@@ -31,8 +_,8 @@
|
||||
private static final SessionSearchTrees.Key RECIPE_COLLECTIONS = new SessionSearchTrees.Key();
|
||||
public static final SessionSearchTrees.Key CREATIVE_NAMES = new SessionSearchTrees.Key();
|
||||
public static final SessionSearchTrees.Key CREATIVE_TAGS = new SessionSearchTrees.Key();
|
||||
- private CompletableFuture<SearchTree<ItemStack>> creativeByNameSearch = CompletableFuture.completedFuture(SearchTree.empty());
|
||||
- private CompletableFuture<SearchTree<ItemStack>> creativeByTagSearch = CompletableFuture.completedFuture(SearchTree.empty());
|
||||
+ private CompletableFuture<SearchTree<ItemStack>> EMPTY = CompletableFuture.completedFuture(SearchTree.empty());
|
||||
+ private Map<SessionSearchTrees.Key, CompletableFuture<SearchTree<ItemStack>>> creativeSearch = new IdentityHashMap<>();
|
||||
private CompletableFuture<SearchTree<RecipeCollection>> recipeSearch = CompletableFuture.completedFuture(SearchTree.empty());
|
||||
private final Map<SessionSearchTrees.Key, Runnable> reloaders = new IdentityHashMap<>();
|
||||
|
||||
@@ -82,44 +_,52 @@
|
||||
}
|
||||
|
||||
public void updateCreativeTags(List<ItemStack> p_344581_) {
|
||||
+ for (var entry : net.minecraftforge.client.CreativeModeTabSearchRegistry.getTagSearchKeys().entrySet())
|
||||
this.register(
|
||||
- CREATIVE_TAGS,
|
||||
+ entry.getValue(),
|
||||
() -> {
|
||||
- CompletableFuture<?> completablefuture = this.creativeByTagSearch;
|
||||
- this.creativeByTagSearch = CompletableFuture.supplyAsync(
|
||||
- () -> new IdSearchTree<>(p_342206_ -> p_342206_.getTags().map(TagKey::location), p_344581_), Util.backgroundExecutor()
|
||||
- );
|
||||
+ var items = entry.getKey() == net.minecraft.world.item.CreativeModeTabs.searchTab() ? p_344581_ : List.copyOf(entry.getKey().getDisplayItems());
|
||||
+ CompletableFuture<?> completablefuture = this.creativeSearch.getOrDefault(entry.getValue(), EMPTY);
|
||||
+ this.creativeSearch.put(entry.getValue(), CompletableFuture.supplyAsync(
|
||||
+ () -> new IdSearchTree<>(p_342206_ -> p_342206_.getTags().map(TagKey::location), items), Util.backgroundExecutor()
|
||||
+ ));
|
||||
completablefuture.cancel(true);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
public SearchTree<ItemStack> creativeTagSearch() {
|
||||
- return this.creativeByTagSearch.join();
|
||||
+ return this.getSearchTree(CREATIVE_TAGS);
|
||||
}
|
||||
|
||||
public void updateCreativeTooltips(HolderLookup.Provider p_343364_, List<ItemStack> p_342500_) {
|
||||
+ for (var entry : net.minecraftforge.client.CreativeModeTabSearchRegistry.getNameSearchKeys().entrySet())
|
||||
this.register(
|
||||
- CREATIVE_NAMES,
|
||||
+ entry.getValue(),
|
||||
() -> {
|
||||
+ var items = entry.getKey() == net.minecraft.world.item.CreativeModeTabs.searchTab() ? p_342500_ : List.copyOf(entry.getKey().getDisplayItems());
|
||||
Item.TooltipContext item$tooltipcontext = Item.TooltipContext.of(p_343364_);
|
||||
TooltipFlag tooltipflag = TooltipFlag.Default.NORMAL.asCreative();
|
||||
- CompletableFuture<?> completablefuture = this.creativeByNameSearch;
|
||||
- this.creativeByNameSearch = CompletableFuture.supplyAsync(
|
||||
+ CompletableFuture<?> completablefuture = this.creativeSearch.getOrDefault(entry.getValue(), EMPTY);
|
||||
+ this.creativeSearch.put(entry.getValue(), CompletableFuture.supplyAsync(
|
||||
() -> new FullTextSearchTree<>(
|
||||
p_345254_ -> getTooltipLines(Stream.of(p_345254_), item$tooltipcontext, tooltipflag),
|
||||
p_344415_ -> p_344415_.getItemHolder().unwrapKey().map(ResourceKey::location).stream(),
|
||||
- p_342500_
|
||||
+ items
|
||||
),
|
||||
Util.backgroundExecutor()
|
||||
- );
|
||||
+ ));
|
||||
completablefuture.cancel(true);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
public SearchTree<ItemStack> creativeNameSearch() {
|
||||
- return this.creativeByNameSearch.join();
|
||||
+ return this.getSearchTree(CREATIVE_NAMES);
|
||||
+ }
|
||||
+
|
||||
+ public SearchTree<ItemStack> getSearchTree(SessionSearchTrees.Key key) {
|
||||
+ return this.creativeSearch.getOrDefault(key, EMPTY).join();
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@@ -1,11 +0,0 @@
|
||||
--- a/net/minecraft/client/multiplayer/TagCollector.java
|
||||
+++ b/net/minecraft/client/multiplayer/TagCollector.java
|
||||
@@ -23,7 +_,7 @@
|
||||
}
|
||||
|
||||
private static void refreshCommonTagDependentData() {
|
||||
- CreativeModeTabs.searchTab().rebuildSearchTree();
|
||||
+ CreativeModeTabs.allTabs().stream().filter(tab -> tab.hasSearchBar()).forEach(tab -> tab.rebuildSearchTree());
|
||||
}
|
||||
|
||||
private static void refreshBuiltInTagDependentData() {
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/particle/ParticleEngine.java
|
||||
+++ b/net/minecraft/client/particle/ParticleEngine.java
|
||||
@@ -75,11 +_,11 @@
|
||||
@@ -77,11 +_,11 @@
|
||||
ParticleRenderType.TERRAIN_SHEET, ParticleRenderType.PARTICLE_SHEET_OPAQUE, ParticleRenderType.PARTICLE_SHEET_LIT, ParticleRenderType.PARTICLE_SHEET_TRANSLUCENT, ParticleRenderType.CUSTOM
|
||||
);
|
||||
protected ClientLevel level;
|
||||
@@ -14,7 +14,7 @@
|
||||
private final Queue<Particle> particlesToAdd = Queues.newArrayDeque();
|
||||
private final Map<ResourceLocation, ParticleEngine.MutableSpriteSet> spriteSets = Maps.newHashMap();
|
||||
private final TextureAtlas textureAtlas;
|
||||
@@ -210,10 +_,14 @@
|
||||
@@ -212,10 +_,14 @@
|
||||
this.register(ParticleTypes.OMINOUS_SPAWNING, FlyStraightTowardsParticle.OminousSpawnProvider::new);
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
public <T extends ParticleOptions> void register(ParticleType<T> p_273423_, ParticleProvider.Sprite<T> p_273134_) {
|
||||
this.register(
|
||||
p_273423_,
|
||||
@@ -230,10 +_,12 @@
|
||||
@@ -232,10 +_,12 @@
|
||||
);
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -359,7 +_,7 @@
|
||||
@@ -361,7 +_,7 @@
|
||||
private <T extends ParticleOptions> Particle makeParticle(
|
||||
T p_107396_, double p_107397_, double p_107398_, double p_107399_, double p_107400_, double p_107401_, double p_107402_
|
||||
) {
|
||||
@@ -53,7 +53,7 @@
|
||||
return particleprovider == null
|
||||
? null
|
||||
: particleprovider.createParticle(p_107396_, this.level, p_107397_, p_107398_, p_107399_, p_107400_, p_107401_, p_107402_);
|
||||
@@ -435,11 +_,19 @@
|
||||
@@ -437,11 +_,19 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,18 +71,18 @@
|
||||
- for (ParticleRenderType particlerendertype : RENDER_ORDER) {
|
||||
+ for (ParticleRenderType particlerendertype : this.particles.keySet()) { // Forge: allow custom IParticleRenderType's
|
||||
+ if (particlerendertype == ParticleRenderType.NO_RENDER) continue;
|
||||
Iterable<Particle> iterable = this.particles.get(particlerendertype);
|
||||
if (iterable != null) {
|
||||
Queue<Particle> queue = this.particles.get(particlerendertype);
|
||||
if (queue != null && !queue.isEmpty()) {
|
||||
RenderSystem.setShader(GameRenderer::getParticleShader);
|
||||
@@ -448,6 +_,7 @@
|
||||
particlerendertype.begin(bufferbuilder, this.textureManager);
|
||||
|
||||
for (Particle particle : iterable) {
|
||||
+ if (frustum != null && particle.shouldCull() && !frustum.isVisible(particle.getBoundingBox())) continue;
|
||||
try {
|
||||
particle.render(bufferbuilder, p_107340_, p_107341_);
|
||||
} catch (Throwable throwable) {
|
||||
@@ -475,7 +_,7 @@
|
||||
@@ -449,6 +_,7 @@
|
||||
BufferBuilder bufferbuilder = particlerendertype.begin(tesselator, this.textureManager);
|
||||
if (bufferbuilder != null) {
|
||||
for (Particle particle : queue) {
|
||||
+ if (frustum != null && particle.shouldCull() && !frustum.isVisible(particle.getBoundingBox())) continue;
|
||||
try {
|
||||
particle.render(bufferbuilder, p_107340_, p_107341_);
|
||||
} catch (Throwable throwable) {
|
||||
@@ -480,7 +_,7 @@
|
||||
}
|
||||
|
||||
public void destroy(BlockPos p_107356_, BlockState p_107357_) {
|
||||
@@ -91,7 +91,7 @@
|
||||
VoxelShape voxelshape = p_107357_.getShape(this.level, p_107356_);
|
||||
double d0 = 0.25;
|
||||
voxelshape.forAllBoxes(
|
||||
@@ -508,6 +_,7 @@
|
||||
@@ -513,6 +_,7 @@
|
||||
p_107357_,
|
||||
p_107356_
|
||||
)
|
||||
@@ -99,7 +99,7 @@
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -517,6 +_,13 @@
|
||||
@@ -522,6 +_,13 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@
|
||||
public void crack(BlockPos p_107368_, Direction p_107369_) {
|
||||
BlockState blockstate = this.level.getBlockState(p_107368_);
|
||||
if (blockstate.getRenderShape() != RenderShape.INVISIBLE && blockstate.shouldSpawnTerrainParticles()) {
|
||||
@@ -552,7 +_,7 @@
|
||||
@@ -557,7 +_,7 @@
|
||||
d0 = (double)i + aabb.maxX + 0.1F;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/particle/VibrationSignalParticle.java
|
||||
+++ b/net/minecraft/client/particle/VibrationSignalParticle.java
|
||||
@@ -122,6 +_,7 @@
|
||||
@@ -76,6 +_,7 @@
|
||||
this.x = Mth.lerp(d0, this.x, vec3.x());
|
||||
this.y = Mth.lerp(d0, this.y, vec3.y());
|
||||
this.z = Mth.lerp(d0, this.z, vec3.z());
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/player/LocalPlayer.java
|
||||
+++ b/net/minecraft/client/player/LocalPlayer.java
|
||||
@@ -160,6 +_,7 @@
|
||||
@@ -161,6 +_,7 @@
|
||||
|
||||
@Override
|
||||
public boolean hurt(DamageSource p_108662_, float p_108663_) {
|
||||
@@ -8,7 +8,7 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -303,6 +_,7 @@
|
||||
@@ -304,6 +_,7 @@
|
||||
ServerboundPlayerActionPacket.Action serverboundplayeractionpacket$action = p_108701_
|
||||
? ServerboundPlayerActionPacket.Action.DROP_ALL_ITEMS
|
||||
: ServerboundPlayerActionPacket.Action.DROP_ITEM;
|
||||
@@ -16,7 +16,7 @@
|
||||
ItemStack itemstack = this.getInventory().removeFromSelected(p_108701_);
|
||||
this.connection.send(new ServerboundPlayerActionPacket(serverboundplayeractionpacket$action, BlockPos.ZERO, Direction.DOWN));
|
||||
return !itemstack.isEmpty();
|
||||
@@ -505,7 +_,11 @@
|
||||
@@ -501,7 +_,11 @@
|
||||
|
||||
@Override
|
||||
public void playSound(SoundEvent p_108651_, float p_108652_, float p_108653_) {
|
||||
@@ -29,15 +29,15 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -697,6 +_,7 @@
|
||||
@@ -694,6 +_,7 @@
|
||||
&& (this.isShiftKeyDown() || !this.isSleeping() && !this.canPlayerFitWithinBlocksAndEntitiesWhen(Pose.STANDING));
|
||||
float f = Mth.clamp(0.3F + EnchantmentHelper.getSneakingSpeedBonus(this), 0.0F, 1.0F);
|
||||
float f = (float)this.getAttributeValue(Attributes.SNEAKING_SPEED);
|
||||
this.input.tick(this.isMovingSlowly(), f);
|
||||
+ net.minecraftforge.client.ForgeHooksClient.onMovementInputUpdate(this, this.input);
|
||||
this.minecraft.getTutorial().onInput(this.input);
|
||||
if (this.isUsingItem() && !this.isPassenger()) {
|
||||
this.input.leftImpulse *= 0.2F;
|
||||
@@ -725,7 +_,7 @@
|
||||
@@ -722,7 +_,7 @@
|
||||
boolean flag4 = this.canStartSprinting();
|
||||
boolean flag5 = this.isPassenger() ? this.getVehicle().onGround() : this.onGround();
|
||||
boolean flag6 = !flag1 && !flag2;
|
||||
@@ -46,7 +46,7 @@
|
||||
if (this.sprintTriggerTime <= 0 && !this.minecraft.options.keySprint.isDown()) {
|
||||
this.sprintTriggerTime = 7;
|
||||
} else {
|
||||
@@ -733,15 +_,15 @@
|
||||
@@ -730,15 +_,15 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
this.setSprinting(false);
|
||||
}
|
||||
} else if (flag8) {
|
||||
@@ -775,14 +_,15 @@
|
||||
@@ -772,14 +_,15 @@
|
||||
|
||||
if (this.input.jumping && !flag9 && !flag && !abilities.flying && !this.isPassenger() && !this.onClimbable()) {
|
||||
ItemStack itemstack = this.getItemBySlot(EquipmentSlot.CHEST);
|
||||
@@ -84,7 +84,7 @@
|
||||
}
|
||||
|
||||
if (this.isEyeInFluid(FluidTags.WATER)) {
|
||||
@@ -882,6 +_,7 @@
|
||||
@@ -885,6 +_,7 @@
|
||||
@Override
|
||||
public void rideTick() {
|
||||
super.rideTick();
|
||||
@@ -92,7 +92,7 @@
|
||||
this.handsBusy = false;
|
||||
if (this.getControlledVehicle() instanceof Boat boat) {
|
||||
boat.setInput(this.input.left, this.input.right, this.input.up, this.input.down);
|
||||
@@ -1139,5 +_,17 @@
|
||||
@@ -1142,5 +_,17 @@
|
||||
@Override
|
||||
public float getVisualRotationYInDegrees() {
|
||||
return this.getYRot();
|
||||
|
||||
@@ -1,22 +1,20 @@
|
||||
--- a/net/minecraft/client/renderer/EffectInstance.java
|
||||
+++ b/net/minecraft/client/renderer/EffectInstance.java
|
||||
@@ -58,7 +_,8 @@
|
||||
@@ -58,7 +_,7 @@
|
||||
private final EffectProgram fragmentProgram;
|
||||
|
||||
public EffectInstance(ResourceProvider p_334130_, String p_108942_) throws IOException {
|
||||
- ResourceLocation resourcelocation = new ResourceLocation("shaders/program/" + p_108942_ + ".json");
|
||||
+ ResourceLocation rl = ResourceLocation.tryParse(p_108942_);
|
||||
+ ResourceLocation resourcelocation = new ResourceLocation(rl.getNamespace(), "shaders/program/" + rl.getPath() + ".json");
|
||||
- ResourceLocation resourcelocation = ResourceLocation.withDefaultNamespace("shaders/program/" + p_108942_ + ".json");
|
||||
+ ResourceLocation resourcelocation = ResourceLocation.tryParse(p_108942_).withPath(p -> "shaders/program/" + p + ".json");
|
||||
this.name = p_108942_;
|
||||
Resource resource = p_334130_.getResourceOrThrow(resourcelocation);
|
||||
|
||||
@@ -150,7 +_,8 @@
|
||||
@@ -150,7 +_,7 @@
|
||||
} else {
|
||||
EffectProgram effectprogram;
|
||||
if (program == null) {
|
||||
- ResourceLocation resourcelocation = new ResourceLocation("shaders/program/" + p_172569_ + p_172568_.getExtension());
|
||||
+ ResourceLocation rl = ResourceLocation.tryParse(p_172569_);
|
||||
+ ResourceLocation resourcelocation = new ResourceLocation(rl.getNamespace(), "shaders/program/" + rl.getPath() + p_172568_.getExtension());
|
||||
- ResourceLocation resourcelocation = ResourceLocation.withDefaultNamespace("shaders/program/" + p_172569_ + p_172568_.getExtension());
|
||||
+ ResourceLocation resourcelocation = ResourceLocation.tryParse(p_172569_).withPath(p -> "shaders/program/" + p + p_172568_.getExtension());
|
||||
Resource resource = p_331503_.getResourceOrThrow(resourcelocation);
|
||||
|
||||
try (InputStream inputstream = resource.open()) {
|
||||
@@ -1,15 +1,15 @@
|
||||
--- a/net/minecraft/client/renderer/GameRenderer.java
|
||||
+++ b/net/minecraft/client/renderer/GameRenderer.java
|
||||
@@ -310,6 +_,8 @@
|
||||
this.loadEffect(new ResourceLocation("shaders/post/spider.json"));
|
||||
@@ -311,6 +_,8 @@
|
||||
this.loadEffect(ResourceLocation.withDefaultNamespace("shaders/post/spider.json"));
|
||||
} else if (p_109107_ instanceof EnderMan) {
|
||||
this.loadEffect(new ResourceLocation("shaders/post/invert.json"));
|
||||
this.loadEffect(ResourceLocation.withDefaultNamespace("shaders/post/invert.json"));
|
||||
+ } else {
|
||||
+ net.minecraftforge.client.ForgeHooksClient.loadEntityShader(p_109107_, this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -532,6 +_,7 @@
|
||||
@@ -526,6 +_,7 @@
|
||||
Pair.of(new ShaderInstance(p_250719_, "rendertype_gui_ghost_recipe_overlay", DefaultVertexFormat.POSITION_COLOR), p_286147_ -> rendertypeGuiGhostRecipeOverlayShader = p_286147_)
|
||||
);
|
||||
list1.add(Pair.of(new ShaderInstance(p_250719_, "rendertype_breeze_wind", DefaultVertexFormat.NEW_ENTITY), p_308287_ -> rendertypeBreezeWindShader = p_308287_));
|
||||
@@ -17,7 +17,7 @@
|
||||
this.loadBlurEffect(p_250719_);
|
||||
} catch (IOException ioexception) {
|
||||
list1.forEach(p_172729_ -> p_172729_.getFirst().close());
|
||||
@@ -691,7 +_,7 @@
|
||||
@@ -685,7 +_,7 @@
|
||||
d0 *= Mth.lerp(this.minecraft.options.fovEffectScale().get(), 1.0, 0.85714287F);
|
||||
}
|
||||
|
||||
@@ -26,44 +26,43 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -850,12 +_,12 @@
|
||||
@@ -843,12 +_,12 @@
|
||||
(float)((double)window.getHeight() / window.getGuiScale()),
|
||||
0.0F,
|
||||
1000.0F,
|
||||
- 21000.0F
|
||||
+ 21000.0f
|
||||
+ net.minecraftforge.client.ForgeHooksClient.getGuiFarPlane()
|
||||
);
|
||||
RenderSystem.setProjectionMatrix(matrix4f, VertexSorting.ORTHOGRAPHIC_Z);
|
||||
Matrix4fStack matrix4fstack = RenderSystem.getModelViewStack();
|
||||
matrix4fstack.pushMatrix();
|
||||
- matrix4fstack.translation(0.0F, 0.0F, -11000.0F);
|
||||
+ matrix4fstack.translation(0.0F, 0.0F, 1000F - net.minecraftforge.client.ForgeHooksClient.getGuiFarPlane());
|
||||
+ matrix4fstack.translation(0.0F, 0.0F, 10000F - net.minecraftforge.client.ForgeHooksClient.getGuiFarPlane());
|
||||
RenderSystem.applyModelViewMatrix();
|
||||
Lighting.setupFor3DItems();
|
||||
GuiGraphics guigraphics = new GuiGraphics(this.minecraft, this.renderBuffers.bufferSource());
|
||||
@@ -889,7 +_,7 @@
|
||||
@@ -882,7 +_,7 @@
|
||||
}
|
||||
} else if (flag && this.minecraft.screen != null) {
|
||||
try {
|
||||
- this.minecraft.screen.renderWithTooltip(guigraphics, i, j, this.minecraft.getDeltaFrameTime());
|
||||
+ net.minecraftforge.client.ForgeHooksClient.drawScreen(this.minecraft.screen, guigraphics, i, j, this.minecraft.getDeltaFrameTime());
|
||||
- this.minecraft.screen.renderWithTooltip(guigraphics, i, j, p_343467_.getRealtimeDeltaTicks());
|
||||
+ net.minecraftforge.client.ForgeHooksClient.drawScreen(this.minecraft.screen, guigraphics, i, j, p_343467_.getRealtimeDeltaTicks());
|
||||
} catch (Throwable throwable1) {
|
||||
CrashReport crashreport1 = CrashReport.forThrowable(throwable1, "Rendering screen");
|
||||
CrashReportCategory crashreportcategory1 = crashreport1.addCategory("Screen render details");
|
||||
@@ -1064,12 +_,17 @@
|
||||
@@ -1053,12 +_,17 @@
|
||||
}
|
||||
|
||||
this.resetProjectionMatrix(matrix4f);
|
||||
+
|
||||
+ var cameraSetup = net.minecraftforge.client.event.ForgeEventFactoryClient.fireComputeCameraAngles(this, camera, p_109090_);
|
||||
+ camera.setAnglesInternal(cameraSetup.getYaw(), cameraSetup.getPitch());
|
||||
Matrix4f matrix4f1 = new Matrix4f()
|
||||
- .rotationXYZ(camera.getXRot() * (float) (Math.PI / 180.0), camera.getYRot() * (float) (Math.PI / 180.0) + (float) Math.PI, 0.0F);
|
||||
+ .rotationXYZ(camera.getXRot() * (float) (Math.PI / 180.0), camera.getYRot() * (float) (Math.PI / 180.0) + (float) Math.PI, cameraSetup.getRoll() * (float) (Math.PI / 180.0));
|
||||
+ var cameraSetup = net.minecraftforge.client.event.ForgeEventFactoryClient.fireComputeCameraAngles(this, camera, f);
|
||||
+ camera.setRotation(cameraSetup.getYaw(), cameraSetup.getPitch(), cameraSetup.getRoll());
|
||||
Quaternionf quaternionf = camera.rotation().conjugate(new Quaternionf());
|
||||
Matrix4f matrix4f1 = new Matrix4f().rotation(quaternionf);
|
||||
this.minecraft
|
||||
.levelRenderer
|
||||
.prepareCullFrustum(camera.getPosition(), matrix4f1, this.getProjectionMatrix(Math.max(d0, (double)this.minecraft.options.fov().get().intValue())));
|
||||
this.minecraft.levelRenderer.renderLevel(p_109090_, p_109091_, flag, camera, this, this.lightTexture, matrix4f1, matrix4f);
|
||||
this.minecraft.levelRenderer.renderLevel(p_342230_, flag, camera, this, this.lightTexture, matrix4f1, matrix4f);
|
||||
+ this.minecraft.getProfiler().popPush("forge_render_last");
|
||||
+ net.minecraftforge.client.event.RenderLevelStageEvent.Stage.AFTER_LEVEL.dispatch(this.minecraft.levelRenderer, posestack.last().pose(), matrix4f, this.minecraft.levelRenderer.getTicks(), camera, this.minecraft.levelRenderer.getFrustum());
|
||||
this.minecraft.getProfiler().popPush("hand");
|
||||
|
||||
@@ -5,18 +5,18 @@
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class ItemBlockRenderTypes {
|
||||
+ @Deprecated
|
||||
private static final Map<Block, RenderType> TYPE_BY_BLOCK = Util.make(Maps.newHashMap(), p_325496_ -> {
|
||||
private static final Map<Block, RenderType> TYPE_BY_BLOCK = Util.make(Maps.newHashMap(), p_340896_ -> {
|
||||
RenderType rendertype = RenderType.tripwire();
|
||||
p_325496_.put(Blocks.TRIPWIRE, rendertype);
|
||||
@@ -336,6 +_,7 @@
|
||||
p_325496_.put(Blocks.BUBBLE_COLUMN, rendertype3);
|
||||
p_325496_.put(Blocks.TINTED_GLASS, rendertype3);
|
||||
p_340896_.put(Blocks.TRIPWIRE, rendertype);
|
||||
@@ -335,6 +_,7 @@
|
||||
p_340896_.put(Blocks.BUBBLE_COLUMN, rendertype3);
|
||||
p_340896_.put(Blocks.TINTED_GLASS, rendertype3);
|
||||
});
|
||||
+ @Deprecated
|
||||
private static final Map<Fluid, RenderType> TYPE_BY_FLUID = Util.make(Maps.newHashMap(), p_109290_ -> {
|
||||
RenderType rendertype = RenderType.translucent();
|
||||
p_109290_.put(Fluids.FLOWING_WATER, rendertype);
|
||||
@@ -343,6 +_,8 @@
|
||||
@@ -342,6 +_,8 @@
|
||||
});
|
||||
private static boolean renderCutout;
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
public static RenderType getChunkRenderType(BlockState p_109283_) {
|
||||
Block block = p_109283_.getBlock();
|
||||
if (block instanceof LeavesBlock) {
|
||||
@@ -353,6 +_,8 @@
|
||||
@@ -352,6 +_,8 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
public static RenderType getMovingBlockRenderType(BlockState p_109294_) {
|
||||
Block block = p_109294_.getBlock();
|
||||
if (block instanceof LeavesBlock) {
|
||||
@@ -367,6 +_,8 @@
|
||||
@@ -366,6 +_,8 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
public static RenderType getRenderType(BlockState p_109285_, boolean p_109286_) {
|
||||
RenderType rendertype = getChunkRenderType(p_109285_);
|
||||
if (rendertype == RenderType.translucent()) {
|
||||
@@ -380,6 +_,8 @@
|
||||
@@ -379,6 +_,8 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
public static RenderType getRenderType(ItemStack p_109280_, boolean p_109281_) {
|
||||
Item item = p_109280_.getItem();
|
||||
if (item instanceof BlockItem) {
|
||||
@@ -391,11 +_,74 @@
|
||||
@@ -390,11 +_,74 @@
|
||||
}
|
||||
|
||||
public static RenderType getRenderLayer(FluidState p_109288_) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/renderer/ItemInHandRenderer.java
|
||||
+++ b/net/minecraft/client/renderer/ItemInHandRenderer.java
|
||||
@@ -331,12 +_,14 @@
|
||||
@@ -332,12 +_,14 @@
|
||||
if (iteminhandrenderer$handrenderselection.renderMainHand) {
|
||||
float f4 = interactionhand == InteractionHand.MAIN_HAND ? f : 0.0F;
|
||||
float f5 = 1.0F - Mth.lerp(p_109315_, this.oMainHandHeight, this.mainHandHeight);
|
||||
@@ -11,11 +11,11 @@
|
||||
if (iteminhandrenderer$handrenderselection.renderOffHand) {
|
||||
float f6 = interactionhand == InteractionHand.OFF_HAND ? f : 0.0F;
|
||||
float f7 = 1.0F - Mth.lerp(p_109315_, this.oOffHandHeight, this.offHandHeight);
|
||||
+ if (!net.minecraftforge.client.ForgeHooksClient.renderSpecificFirstPersonHand(InteractionHand.MAIN_HAND, p_109316_, p_109317_, p_109319_, p_109315_, f1, f6, f7, this.mainHandItem))
|
||||
+ if (!net.minecraftforge.client.ForgeHooksClient.renderSpecificFirstPersonHand(InteractionHand.OFF_HAND, p_109316_, p_109317_, p_109319_, p_109315_, f1, f6, f7, this.offHandItem))
|
||||
this.renderArmWithItem(p_109318_, p_109315_, f1, InteractionHand.OFF_HAND, f6, this.offHandItem, f7, p_109316_, p_109317_, p_109319_);
|
||||
}
|
||||
|
||||
@@ -402,7 +_,7 @@
|
||||
@@ -403,7 +_,7 @@
|
||||
} else {
|
||||
this.renderOneHandedMap(p_109379_, p_109380_, p_109381_, p_109378_, humanoidarm, p_109376_, p_109377_);
|
||||
}
|
||||
@@ -24,7 +24,7 @@
|
||||
boolean flag1 = CrossbowItem.isCharged(p_109377_);
|
||||
boolean flag2 = humanoidarm == HumanoidArm.RIGHT;
|
||||
int i = flag2 ? 1 : -1;
|
||||
@@ -452,6 +_,7 @@
|
||||
@@ -453,6 +_,7 @@
|
||||
);
|
||||
} else {
|
||||
boolean flag3 = humanoidarm == HumanoidArm.RIGHT;
|
||||
@@ -32,7 +32,7 @@
|
||||
if (p_109372_.isUsingItem() && p_109372_.getUseItemRemainingTicks() > 0 && p_109372_.getUsedItemHand() == p_109375_) {
|
||||
int k = flag3 ? 1 : -1;
|
||||
switch (p_109377_.getUseAnimation()) {
|
||||
@@ -566,8 +_,16 @@
|
||||
@@ -567,8 +_,16 @@
|
||||
this.offHandHeight = Mth.clamp(this.offHandHeight - 0.4F, 0.0F, 1.0F);
|
||||
} else {
|
||||
float f = localplayer.getAttackStrengthScale(1.0F);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/renderer/LevelRenderer.java
|
||||
+++ b/net/minecraft/client/renderer/LevelRenderer.java
|
||||
@@ -251,6 +_,9 @@
|
||||
@@ -256,6 +_,9 @@
|
||||
}
|
||||
|
||||
private void renderSnowAndRain(LightTexture p_109704_, float p_109705_, double p_109706_, double p_109707_, double p_109708_) {
|
||||
@@ -10,7 +10,7 @@
|
||||
float f = this.minecraft.level.getRainLevel(p_109705_);
|
||||
if (!(f <= 0.0F)) {
|
||||
p_109704_.turnOnLightLayer();
|
||||
@@ -405,6 +_,9 @@
|
||||
@@ -418,6 +_,9 @@
|
||||
}
|
||||
|
||||
public void tickRain(Camera p_109694_) {
|
||||
@@ -20,11 +20,11 @@
|
||||
float f = this.minecraft.level.getRainLevel(1.0F) / (Minecraft.useFancyGraphics() ? 1.0F : 2.0F);
|
||||
if (!(f <= 0.0F)) {
|
||||
RandomSource randomsource = RandomSource.create((long)this.ticks * 312987231L);
|
||||
@@ -956,9 +_,11 @@
|
||||
@@ -929,9 +_,11 @@
|
||||
RenderSystem.clear(16640, Minecraft.ON_OSX);
|
||||
float f1 = p_109605_.getRenderDistance();
|
||||
boolean flag1 = this.minecraft.level.effects().isFoggyAt(Mth.floor(d0), Mth.floor(d1)) || this.minecraft.gui.getBossOverlay().shouldCreateWorldFog();
|
||||
+ FogRenderer.setupFog(p_109604_, FogRenderer.FogMode.FOG_SKY, f, flag1, p_109601_);
|
||||
+ FogRenderer.setupFog(p_109604_, FogRenderer.FogMode.FOG_SKY, f1, flag1, f);
|
||||
profilerfiller.popPush("sky");
|
||||
RenderSystem.setShader(GameRenderer::getPositionShader);
|
||||
this.renderSky(p_254120_, p_330527_, f, p_109604_, flag1, () -> FogRenderer.setupFog(p_109604_, FogRenderer.FogMode.FOG_SKY, f1, flag1, f));
|
||||
@@ -32,7 +32,7 @@
|
||||
profilerfiller.popPush("fog");
|
||||
FogRenderer.setupFog(p_109604_, FogRenderer.FogMode.FOG_TERRAIN, Math.max(f1, 32.0F), flag1, f);
|
||||
profilerfiller.popPush("terrain_setup");
|
||||
@@ -967,7 +_,9 @@
|
||||
@@ -940,7 +_,9 @@
|
||||
this.compileSections(p_109604_);
|
||||
profilerfiller.popPush("terrain");
|
||||
this.renderSectionLayer(RenderType.solid(), d0, d1, d2, p_254120_, p_330527_);
|
||||
@@ -42,7 +42,7 @@
|
||||
this.renderSectionLayer(RenderType.cutout(), d0, d1, d2, p_254120_, p_330527_);
|
||||
if (this.level.effects().constantAmbientLight()) {
|
||||
Lighting.setupNetherLevel();
|
||||
@@ -1010,7 +_,7 @@
|
||||
@@ -983,7 +_,7 @@
|
||||
|| p_109604_.isDetached()
|
||||
|| p_109604_.getEntity() instanceof LivingEntity && ((LivingEntity)p_109604_.getEntity()).isSleeping()
|
||||
)
|
||||
@@ -51,7 +51,7 @@
|
||||
this.renderedEntities++;
|
||||
if (entity.tickCount == 0) {
|
||||
entity.xOld = entity.getX();
|
||||
@@ -1026,6 +_,9 @@
|
||||
@@ -999,6 +_,9 @@
|
||||
int i = entity.getTeamColor();
|
||||
outlinebuffersource.setColor(FastColor.ARGB32.red(i), FastColor.ARGB32.green(i), FastColor.ARGB32.blue(i), 255);
|
||||
} else {
|
||||
@@ -61,7 +61,7 @@
|
||||
multibuffersource = multibuffersource$buffersource;
|
||||
}
|
||||
|
||||
@@ -1041,12 +_,14 @@
|
||||
@@ -1014,12 +_,14 @@
|
||||
multibuffersource$buffersource.endBatch(RenderType.entityCutout(TextureAtlas.LOCATION_BLOCKS));
|
||||
multibuffersource$buffersource.endBatch(RenderType.entityCutoutNoCull(TextureAtlas.LOCATION_BLOCKS));
|
||||
multibuffersource$buffersource.endBatch(RenderType.entitySmoothCutout(TextureAtlas.LOCATION_BLOCKS));
|
||||
@@ -76,7 +76,7 @@
|
||||
BlockPos blockpos4 = blockentity1.getBlockPos();
|
||||
MultiBufferSource multibuffersource1 = multibuffersource$buffersource;
|
||||
posestack.pushPose();
|
||||
@@ -1066,6 +_,10 @@
|
||||
@@ -1039,6 +_,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@
|
||||
this.blockEntityRenderDispatcher.render(blockentity1, f, posestack, multibuffersource1);
|
||||
posestack.popPose();
|
||||
}
|
||||
@@ -1074,9 +_,13 @@
|
||||
@@ -1047,9 +_,13 @@
|
||||
|
||||
synchronized (this.globalBlockEntities) {
|
||||
for (BlockEntity blockentity : this.globalBlockEntities) {
|
||||
@@ -101,7 +101,7 @@
|
||||
this.blockEntityRenderDispatcher.render(blockentity, f, posestack, multibuffersource$buffersource);
|
||||
posestack.popPose();
|
||||
}
|
||||
@@ -1099,6 +_,7 @@
|
||||
@@ -1072,6 +_,7 @@
|
||||
this.minecraft.getMainRenderTarget().bindWrite(false);
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@
|
||||
profilerfiller.popPush("destroyProgress");
|
||||
|
||||
for (Entry<SortedSet<BlockDestructionProgress>> entry : this.destructionProgress.long2ObjectEntrySet()) {
|
||||
@@ -1116,7 +_,8 @@
|
||||
@@ -1089,7 +_,8 @@
|
||||
VertexConsumer vertexconsumer1 = new SheetedDecalTextureGenerator(
|
||||
this.renderBuffers.crumblingBufferSource().getBuffer(ModelBakery.DESTROY_TYPES.get(k)), posestack$pose1, 1.0F
|
||||
);
|
||||
@@ -119,49 +119,49 @@
|
||||
posestack.popPose();
|
||||
}
|
||||
}
|
||||
@@ -1128,10 +_,13 @@
|
||||
@@ -1101,10 +_,13 @@
|
||||
profilerfiller.popPush("outline");
|
||||
BlockPos blockpos1 = ((BlockHitResult)hitresult).getBlockPos();
|
||||
BlockState blockstate = this.level.getBlockState(blockpos1);
|
||||
+ if (!net.minecraftforge.client.ForgeHooksClient.onDrawHighlight(this, p_109604_, hitresult, p_109601_, p_254120_, multibuffersource$buffersource))
|
||||
+ if (!net.minecraftforge.client.ForgeHooksClient.onDrawHighlight(this, p_109604_, hitresult, f, posestack, multibuffersource$buffersource))
|
||||
if (!blockstate.isAir() && this.level.getWorldBorder().isWithinBounds(blockpos1)) {
|
||||
VertexConsumer vertexconsumer2 = multibuffersource$buffersource.getBuffer(RenderType.lines());
|
||||
this.renderHitOutline(posestack, vertexconsumer2, p_109604_.getEntity(), d0, d1, d2, blockpos1, blockstate);
|
||||
}
|
||||
+ } else if (hitresult != null && hitresult.getType() == HitResult.Type.ENTITY) {
|
||||
+ net.minecraftforge.client.ForgeHooksClient.onDrawHighlight(this, p_109604_, hitresult, p_109601_, p_254120_, multibuffersource$buffersource);
|
||||
+ net.minecraftforge.client.ForgeHooksClient.onDrawHighlight(this, p_109604_, hitresult, f, posestack, multibuffersource$buffersource);
|
||||
}
|
||||
|
||||
this.minecraft.debugRenderer.render(posestack, multibuffersource$buffersource, d0, d1, d2);
|
||||
@@ -1161,7 +_,8 @@
|
||||
@@ -1132,7 +_,8 @@
|
||||
this.particlesTarget.copyDepthFrom(this.minecraft.getMainRenderTarget());
|
||||
RenderStateShard.PARTICLES_TARGET.setupRenderState();
|
||||
profilerfiller.popPush("particles");
|
||||
- this.minecraft.particleEngine.render(p_109606_, p_109604_, f);
|
||||
+ this.minecraft.particleEngine.render(p_109606_, p_109604_, f, frustum);
|
||||
+ net.minecraftforge.client.event.RenderLevelStageEvent.Stage.AFTER_PARTICLES.dispatch(this, p_254120_, p_254120_, this.ticks, p_109604_, frustum);
|
||||
+ net.minecraftforge.client.event.RenderLevelStageEvent.Stage.AFTER_PARTICLES.dispatch(this, posestack.last().pose(), p_254120_, this.ticks, p_109604_, frustum);
|
||||
RenderStateShard.PARTICLES_TARGET.clearRenderState();
|
||||
} else {
|
||||
profilerfiller.popPush("translucent");
|
||||
@@ -1175,7 +_,8 @@
|
||||
@@ -1146,7 +_,8 @@
|
||||
profilerfiller.popPush("string");
|
||||
this.renderSectionLayer(RenderType.tripwire(), d0, d1, d2, p_254120_, p_330527_);
|
||||
profilerfiller.popPush("particles");
|
||||
- this.minecraft.particleEngine.render(p_109606_, p_109604_, f);
|
||||
+ this.minecraft.particleEngine.render(p_109606_, p_109604_, f, frustum);
|
||||
+ net.minecraftforge.client.event.RenderLevelStageEvent.Stage.AFTER_PARTICLES.dispatch(this, p_254120_, p_254120_, this.ticks, p_109604_, frustum);
|
||||
+ net.minecraftforge.client.event.RenderLevelStageEvent.Stage.AFTER_PARTICLES.dispatch(this, posestack.last().pose(), p_254120_, this.ticks, p_109604_, frustum);
|
||||
}
|
||||
|
||||
if (this.minecraft.options.getCloudsType() != CloudStatus.OFF) {
|
||||
@@ -1191,6 +_,7 @@
|
||||
@@ -1162,6 +_,7 @@
|
||||
RenderStateShard.WEATHER_TARGET.setupRenderState();
|
||||
profilerfiller.popPush("weather");
|
||||
this.renderSnowAndRain(p_109606_, f, d0, d1, d2);
|
||||
+ net.minecraftforge.client.event.RenderLevelStageEvent.Stage.AFTER_WEATHER.dispatch(this, posestack.last().pose(), p_254120_, this.ticks, p_109604_, frustum);
|
||||
this.renderWorldBorder(p_109604_);
|
||||
RenderStateShard.WEATHER_TARGET.clearRenderState();
|
||||
this.transparencyChain.process(f);
|
||||
@@ -1199,6 +_,7 @@
|
||||
this.transparencyChain.process(p_342180_.getGameTimeDeltaTicks());
|
||||
@@ -1170,6 +_,7 @@
|
||||
RenderSystem.depthMask(false);
|
||||
profilerfiller.popPush("weather");
|
||||
this.renderSnowAndRain(p_109606_, f, d0, d1, d2);
|
||||
@@ -169,7 +169,7 @@
|
||||
this.renderWorldBorder(p_109604_);
|
||||
RenderSystem.depthMask(true);
|
||||
}
|
||||
@@ -1344,6 +_,7 @@
|
||||
@@ -1269,6 +_,7 @@
|
||||
shaderinstance.clear();
|
||||
VertexBuffer.unbind();
|
||||
this.minecraft.getProfiler().pop();
|
||||
@@ -177,7 +177,7 @@
|
||||
p_298012_.clearRenderState();
|
||||
}
|
||||
|
||||
@@ -1604,6 +_,9 @@
|
||||
@@ -1519,6 +_,9 @@
|
||||
}
|
||||
|
||||
public void renderSky(Matrix4f p_254034_, Matrix4f p_333200_, float p_202426_, Camera p_202427_, boolean p_202428_, Runnable p_202429_) {
|
||||
@@ -187,7 +187,7 @@
|
||||
p_202429_.run();
|
||||
if (!p_202428_) {
|
||||
FogType fogtype = p_202427_.getFluidInCamera();
|
||||
@@ -1728,6 +_,9 @@
|
||||
@@ -1642,6 +_,9 @@
|
||||
}
|
||||
|
||||
public void renderClouds(PoseStack p_254145_, Matrix4f p_254537_, Matrix4f p_330176_, float p_254364_, double p_253843_, double p_253663_, double p_253795_) {
|
||||
@@ -197,7 +197,7 @@
|
||||
float f = this.level.effects().getCloudHeight();
|
||||
if (!Float.isNaN(f)) {
|
||||
float f1 = 12.0F;
|
||||
@@ -2017,7 +_,7 @@
|
||||
@@ -1901,7 +_,7 @@
|
||||
boolean flag = false;
|
||||
if (this.minecraft.options.prioritizeChunkUpdates().get() == PrioritizeChunkUpdates.NEARBY) {
|
||||
BlockPos blockpos1 = sectionrenderdispatcher$rendersection.getOrigin().offset(8, 8, 8);
|
||||
@@ -206,7 +206,7 @@
|
||||
} else if (this.minecraft.options.prioritizeChunkUpdates().get() == PrioritizeChunkUpdates.PLAYER_AFFECTED) {
|
||||
flag = sectionrenderdispatcher$rendersection.isDirtyFromPlayer();
|
||||
}
|
||||
@@ -2609,7 +_,23 @@
|
||||
@@ -2477,6 +_,14 @@
|
||||
this.viewArea.setDirty(p_109502_, p_109503_, p_109504_, p_109505_);
|
||||
}
|
||||
|
||||
@@ -218,37 +218,10 @@
|
||||
+ return this.ticks;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * @deprecated Forge: Use item aware function below
|
||||
+ */
|
||||
+ @Deprecated
|
||||
public void playStreamingMusic(@Nullable SoundEvent p_109515_, BlockPos p_109516_) {
|
||||
+ this.playStreamingMusic(p_109515_, p_109516_, p_109515_ == null? null : RecordItem.getBySound(p_109515_));
|
||||
+ }
|
||||
+
|
||||
+ public void playStreamingMusic(@Nullable SoundEvent p_109515_, BlockPos p_109516_, @Nullable RecordItem musicDiscItem) {
|
||||
SoundInstance soundinstance = this.playingRecords.get(p_109516_);
|
||||
if (soundinstance != null) {
|
||||
this.minecraft.getSoundManager().stop(soundinstance);
|
||||
@@ -2617,7 +_,7 @@
|
||||
}
|
||||
|
||||
if (p_109515_ != null) {
|
||||
- RecordItem recorditem = RecordItem.getBySound(p_109515_);
|
||||
+ RecordItem recorditem = musicDiscItem;
|
||||
if (recorditem != null) {
|
||||
this.minecraft.gui.setNowPlaying(recorditem.getDisplayName());
|
||||
}
|
||||
@@ -2809,7 +_,7 @@
|
||||
break;
|
||||
case 1010:
|
||||
if (Item.byId(p_234307_) instanceof RecordItem recorditem) {
|
||||
- this.playStreamingMusic(recorditem.getSound(), p_234306_);
|
||||
+ this.playStreamingMusic(recorditem.getSound(), p_234306_, recorditem);
|
||||
}
|
||||
break;
|
||||
case 1011:
|
||||
@@ -3011,7 +_,7 @@
|
||||
public void playJukeboxSong(Holder<JukeboxSong> p_343944_, BlockPos p_342259_) {
|
||||
if (this.level != null) {
|
||||
this.stopJukeboxSong(p_342259_);
|
||||
@@ -2886,7 +_,7 @@
|
||||
case 2001:
|
||||
BlockState blockstate1 = Block.stateById(p_234307_);
|
||||
if (!blockstate1.isAir()) {
|
||||
@@ -257,7 +230,7 @@
|
||||
this.level
|
||||
.playLocalSound(
|
||||
p_234306_, soundtype.getBreakSound(), SoundSource.BLOCKS, (soundtype.getVolume() + 1.0F) / 2.0F, soundtype.getPitch() * 0.8F, false
|
||||
@@ -3466,7 +_,7 @@
|
||||
@@ -3338,7 +_,7 @@
|
||||
} else {
|
||||
int i = p_109538_.getBrightness(LightLayer.SKY, p_109540_);
|
||||
int j = p_109538_.getBrightness(LightLayer.BLOCK, p_109540_);
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
--- a/net/minecraft/client/renderer/PostChain.java
|
||||
+++ b/net/minecraft/client/renderer/PostChain.java
|
||||
@@ -156,7 +_,8 @@
|
||||
@@ -156,7 +_,7 @@
|
||||
throw new ChainedJsonException("Render target '" + s4 + "' can't be used as depth buffer");
|
||||
}
|
||||
|
||||
- ResourceLocation resourcelocation = new ResourceLocation("textures/effect/" + s4 + ".png");
|
||||
+ ResourceLocation rl = ResourceLocation.tryParse(s4);
|
||||
+ ResourceLocation resourcelocation = new ResourceLocation(rl.getNamespace(), "textures/effect/" + rl.getPath() + ".png");
|
||||
- ResourceLocation resourcelocation = ResourceLocation.withDefaultNamespace("textures/effect/" + s4 + ".png");
|
||||
+ ResourceLocation resourcelocation = ResourceLocation.tryParse(s4).withPath(p -> "textures/effect/" + p + ".png");
|
||||
this.resourceProvider
|
||||
.getResource(resourcelocation)
|
||||
.orElseThrow(() -> new ChainedJsonException("Render target or texture '" + s4 + "' does not exist"));
|
||||
|
||||
@@ -1,6 +1,29 @@
|
||||
--- a/net/minecraft/client/renderer/RenderType.java
|
||||
+++ b/net/minecraft/client/renderer/RenderType.java
|
||||
@@ -907,7 +_,7 @@
|
||||
@@ -674,11 +_,22 @@
|
||||
RenderType.CompositeState.builder().setShaderState(RENDERTYPE_GUI_GHOST_RECIPE_OVERLAY_SHADER).setTransparencyState(TRANSLUCENT_TRANSPARENCY).setDepthTestState(GREATER_DEPTH_TEST).setWriteMaskState(COLOR_WRITE).createCompositeState(false)
|
||||
);
|
||||
private static final ImmutableList<RenderType> CHUNK_BUFFER_LAYERS = ImmutableList.of(solid(), cutoutMipped(), cutout(), translucent(), tripwire());
|
||||
+ static {
|
||||
+ int i = 0;
|
||||
+ for (var layer : CHUNK_BUFFER_LAYERS)
|
||||
+ layer.chunkLayerId = i++;
|
||||
+ }
|
||||
+
|
||||
private final VertexFormat format;
|
||||
private final VertexFormat.Mode mode;
|
||||
private final int bufferSize;
|
||||
private final boolean affectsCrumbling;
|
||||
private final boolean sortOnUpload;
|
||||
+ private int chunkLayerId = -1;
|
||||
+ /** {@return the unique ID of this {@link RenderType} for chunk rendering purposes, or {@literal -1} if this is not a chunk {@link RenderType}} */
|
||||
+ public final int getChunkLayerId() {
|
||||
+ return chunkLayerId;
|
||||
+ }
|
||||
|
||||
public static RenderType solid() {
|
||||
return SOLID;
|
||||
@@ -899,7 +_,7 @@
|
||||
}
|
||||
|
||||
public static RenderType text(ResourceLocation p_110498_) {
|
||||
@@ -9,7 +32,7 @@
|
||||
}
|
||||
|
||||
public static RenderType textBackground() {
|
||||
@@ -915,19 +_,19 @@
|
||||
@@ -907,19 +_,19 @@
|
||||
}
|
||||
|
||||
public static RenderType textIntensity(ResourceLocation p_173238_) {
|
||||
@@ -33,7 +56,7 @@
|
||||
}
|
||||
|
||||
public static RenderType textBackgroundSeeThrough() {
|
||||
@@ -935,12 +_,25 @@
|
||||
@@ -927,7 +_,7 @@
|
||||
}
|
||||
|
||||
public static RenderType textIntensitySeeThrough(ResourceLocation p_173241_) {
|
||||
@@ -42,21 +65,3 @@
|
||||
}
|
||||
|
||||
public static RenderType lightning() {
|
||||
return LIGHTNING;
|
||||
}
|
||||
+
|
||||
+ // Forge start
|
||||
+ private int chunkLayerId = -1;
|
||||
+ /** {@return the unique ID of this {@link RenderType} for chunk rendering purposes, or {@literal -1} if this is not a chunk {@link RenderType}} */
|
||||
+ public final int getChunkLayerId() {
|
||||
+ return chunkLayerId;
|
||||
+ }
|
||||
+ static {
|
||||
+ int i = 0;
|
||||
+ for (var layer : chunkBufferLayers())
|
||||
+ layer.chunkLayerId = i++;
|
||||
+ }
|
||||
+ // Forge end
|
||||
|
||||
private static RenderType.CompositeState tripwireState() {
|
||||
return RenderType.CompositeState.builder()
|
||||
@@ -49,7 +49,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,8 +_,12 @@
|
||||
@@ -88,8 +_,12 @@
|
||||
}
|
||||
|
||||
private static void renderWater(Minecraft p_110726_, PoseStack p_110727_) {
|
||||
@@ -60,6 +60,6 @@
|
||||
RenderSystem.setShader(GameRenderer::getPositionTexShader);
|
||||
- RenderSystem.setShaderTexture(0, UNDERWATER_LOCATION);
|
||||
+ RenderSystem.setShaderTexture(0, texture);
|
||||
BufferBuilder bufferbuilder = Tesselator.getInstance().getBuilder();
|
||||
BlockPos blockpos = BlockPos.containing(p_110726_.player.getX(), p_110726_.player.getEyeY(), p_110726_.player.getZ());
|
||||
float f = LightTexture.getBrightness(p_110726_.player.level().dimensionType(), p_110726_.player.level().getMaxLocalRawBrightness(blockpos));
|
||||
RenderSystem.enableBlend();
|
||||
@@ -7,31 +7,30 @@
|
||||
+ @Deprecated // Forge: Use the ResourceLocation variant below
|
||||
public ShaderInstance(ResourceProvider p_173336_, String p_173337_, VertexFormat p_173338_) throws IOException {
|
||||
- this.name = p_173337_;
|
||||
+ this(p_173336_, new ResourceLocation(p_173337_), p_173338_);
|
||||
+ this(p_173336_, ResourceLocation.parse(p_173337_), p_173338_);
|
||||
+ }
|
||||
+
|
||||
+ public ShaderInstance(ResourceProvider p_173336_, ResourceLocation shaderLocation, VertexFormat p_173338_) throws IOException {
|
||||
+ this.name = shaderLocation.getNamespace().equals("minecraft") ? shaderLocation.getPath() : shaderLocation.toString();
|
||||
this.vertexFormat = p_173338_;
|
||||
- ResourceLocation resourcelocation = new ResourceLocation("shaders/core/" + p_173337_ + ".json");
|
||||
+ ResourceLocation resourcelocation = new ResourceLocation(shaderLocation.getNamespace(), "shaders/core/" + shaderLocation.getPath() + ".json");
|
||||
- ResourceLocation resourcelocation = ResourceLocation.withDefaultNamespace("shaders/core/" + p_173337_ + ".json");
|
||||
+ ResourceLocation resourcelocation = shaderLocation.withPath(p -> "shaders/core/" + p + ".json");
|
||||
|
||||
try (Reader reader = p_173336_.openAsReader(resourcelocation)) {
|
||||
JsonObject jsonobject = GsonHelper.parse(reader);
|
||||
@@ -178,8 +_,10 @@
|
||||
@@ -177,8 +_,9 @@
|
||||
Program program1 = p_173342_.getPrograms().get(p_173343_);
|
||||
Program program;
|
||||
if (program1 == null) {
|
||||
- String s = "shaders/core/" + p_173343_ + p_173342_.getExtension();
|
||||
- Resource resource = p_173341_.getResourceOrThrow(new ResourceLocation(s));
|
||||
+ ResourceLocation loc = new ResourceLocation(p_173343_);
|
||||
+ String s = "shaders/core/" + loc.getPath() + p_173342_.getExtension();
|
||||
+ ResourceLocation resourcelocation = new ResourceLocation(loc.getNamespace(), s);
|
||||
- Resource resource = p_173341_.getResourceOrThrow(ResourceLocation.withDefaultNamespace(s));
|
||||
+ ResourceLocation resourcelocation = ResourceLocation.parse(p_173343_).withPath(p -> "shaders/core/" + p + p_173342_.getExtension());
|
||||
+ String s = resourcelocation.getPath();
|
||||
+ Resource resource = p_173341_.getResourceOrThrow(resourcelocation);
|
||||
|
||||
try (InputStream inputstream = resource.open()) {
|
||||
final String s1 = FileUtil.getFullResourcePath(s);
|
||||
@@ -188,12 +_,11 @@
|
||||
@@ -187,12 +_,11 @@
|
||||
|
||||
@Override
|
||||
public String applyImport(boolean p_173374_, String p_173375_) {
|
||||
@@ -42,12 +41,12 @@
|
||||
+ if (!this.importedPaths.add(resourcelocation.toString())) {
|
||||
return null;
|
||||
} else {
|
||||
- ResourceLocation resourcelocation = new ResourceLocation(p_173375_);
|
||||
- ResourceLocation resourcelocation = ResourceLocation.parse(p_173375_);
|
||||
-
|
||||
try {
|
||||
String s2;
|
||||
try (Reader reader = p_173341_.openAsReader(resourcelocation)) {
|
||||
@@ -202,7 +_,8 @@
|
||||
@@ -201,7 +_,8 @@
|
||||
|
||||
return s2;
|
||||
} catch (IOException ioexception) {
|
||||
|
||||
@@ -1,22 +1,20 @@
|
||||
--- a/net/minecraft/client/renderer/Sheets.java
|
||||
+++ b/net/minecraft/client/renderer/Sheets.java
|
||||
@@ -144,11 +_,13 @@
|
||||
@@ -145,11 +_,11 @@
|
||||
}
|
||||
|
||||
private static Material createSignMaterial(WoodType p_173386_) {
|
||||
- return new Material(SIGN_SHEET, new ResourceLocation("entity/signs/" + p_173386_.name()));
|
||||
+ ResourceLocation location = new ResourceLocation(p_173386_.name());
|
||||
+ return new Material(SIGN_SHEET, new ResourceLocation(location.getNamespace(), "entity/signs/" + location.getPath()));
|
||||
- return new Material(SIGN_SHEET, ResourceLocation.withDefaultNamespace("entity/signs/" + p_173386_.name()));
|
||||
+ return new Material(SIGN_SHEET, ResourceLocation.parse(p_173386_.name()).withPrefix("entity/signs/"));
|
||||
}
|
||||
|
||||
private static Material createHangingSignMaterial(WoodType p_251735_) {
|
||||
- return new Material(SIGN_SHEET, new ResourceLocation("entity/signs/hanging/" + p_251735_.name()));
|
||||
+ ResourceLocation location = new ResourceLocation(p_251735_.name());
|
||||
+ return new Material(SIGN_SHEET, new ResourceLocation(location.getNamespace(), "entity/signs/hanging/" + location.getPath()));
|
||||
- return new Material(SIGN_SHEET, ResourceLocation.withDefaultNamespace("entity/signs/hanging/" + p_251735_.name()));
|
||||
+ return new Material(SIGN_SHEET, ResourceLocation.parse(p_251735_.name()).withPrefix("entity/signs/hanging/"));
|
||||
}
|
||||
|
||||
public static Material getSignMaterial(WoodType p_173382_) {
|
||||
@@ -207,6 +_,23 @@
|
||||
@@ -208,6 +_,23 @@
|
||||
case SINGLE:
|
||||
default:
|
||||
return p_110773_;
|
||||
|
||||
+18
-18
@@ -3,44 +3,44 @@
|
||||
@@ -17,32 +_,38 @@
|
||||
|
||||
@Override
|
||||
public VertexConsumer vertex(double p_110801_, double p_110802_, double p_110803_) {
|
||||
- return this.delegate.vertex(p_110801_, p_110802_, p_110803_);
|
||||
+ this.delegate.vertex(p_110801_, p_110802_, p_110803_);
|
||||
public VertexConsumer addVertex(float p_342932_, float p_342886_, float p_342696_) {
|
||||
- return this.delegate.addVertex(p_342932_, p_342886_, p_342696_);
|
||||
+ this.delegate.addVertex(p_342932_, p_342886_, p_342696_);
|
||||
+ return this; // Forge: Fix MC-263524 not working with chained methods
|
||||
}
|
||||
|
||||
@Override
|
||||
public VertexConsumer color(int p_110826_, int p_110827_, int p_110828_, int p_110829_) {
|
||||
- return this.delegate.color(p_110826_, p_110827_, p_110828_, p_110829_);
|
||||
+ this.delegate.color(p_110826_, p_110827_, p_110828_, p_110829_);
|
||||
public VertexConsumer setColor(int p_344589_, int p_342555_, int p_344320_, int p_345258_) {
|
||||
- return this.delegate.setColor(p_344589_, p_342555_, p_344320_, p_345258_);
|
||||
+ this.delegate.setColor(p_344589_, p_342555_, p_344320_, p_345258_);
|
||||
+ return this; // Forge: Fix MC-263524 not working with chained methods
|
||||
}
|
||||
|
||||
@Override
|
||||
public VertexConsumer uv(float p_110805_, float p_110806_) {
|
||||
- return this.delegate.uv(this.sprite.getU(p_110805_), this.sprite.getV(p_110806_));
|
||||
+ this.delegate.uv(this.sprite.getU(p_110805_), this.sprite.getV(p_110806_));
|
||||
public VertexConsumer setUv(float p_343856_, float p_344420_) {
|
||||
- return this.delegate.setUv(this.sprite.getU(p_343856_), this.sprite.getV(p_344420_));
|
||||
+ this.delegate.setUv(this.sprite.getU(p_343856_), this.sprite.getV(p_344420_));
|
||||
+ return this; // Forge: Fix MC-263524 not working with chained methods
|
||||
}
|
||||
|
||||
@Override
|
||||
public VertexConsumer overlayCoords(int p_110823_, int p_110824_) {
|
||||
- return this.delegate.overlayCoords(p_110823_, p_110824_);
|
||||
+ this.delegate.overlayCoords(p_110823_, p_110824_);
|
||||
public VertexConsumer setUv1(int p_343784_, int p_344827_) {
|
||||
- return this.delegate.setUv1(p_343784_, p_344827_);
|
||||
+ this.delegate.setUv1(p_343784_, p_344827_);
|
||||
+ return this; // Forge: Fix MC-263524 not working with chained methods
|
||||
}
|
||||
|
||||
@Override
|
||||
public VertexConsumer uv2(int p_110835_, int p_110836_) {
|
||||
- return this.delegate.uv2(p_110835_, p_110836_);
|
||||
+ this.delegate.uv2(p_110835_, p_110836_);
|
||||
public VertexConsumer setUv2(int p_345257_, int p_344124_) {
|
||||
- return this.delegate.setUv2(p_345257_, p_344124_);
|
||||
+ this.delegate.setUv2(p_345257_, p_344124_);
|
||||
+ return this; // Forge: Fix MC-263524 not working with chained methods
|
||||
}
|
||||
|
||||
@Override
|
||||
public VertexConsumer normal(float p_110831_, float p_110832_, float p_110833_) {
|
||||
- return this.delegate.normal(p_110831_, p_110832_, p_110833_);
|
||||
+ this.delegate.normal(p_110831_, p_110832_, p_110833_);
|
||||
public VertexConsumer setNormal(float p_342779_, float p_342534_, float p_344783_) {
|
||||
- return this.delegate.setNormal(p_342779_, p_342534_, p_344783_);
|
||||
+ this.delegate.setNormal(p_342779_, p_342534_, p_344783_);
|
||||
+ return this; // Forge: Fix MC-263524 not working with chained methods
|
||||
}
|
||||
|
||||
|
||||
+13
-13
@@ -43,19 +43,19 @@
|
||||
+ net.minecraft.client.renderer.RenderType renderType
|
||||
) {
|
||||
try {
|
||||
RenderShape rendershape = p_234356_.getRenderShape();
|
||||
@@ -76,7 +_,9 @@
|
||||
p_234361_,
|
||||
p_234362_,
|
||||
p_234356_.getSeed(p_234357_),
|
||||
- OverlayTexture.NO_OVERLAY
|
||||
+ OverlayTexture.NO_OVERLAY,
|
||||
+ modelData,
|
||||
+ renderType
|
||||
);
|
||||
}
|
||||
this.modelRenderer
|
||||
@@ -74,7 +_,9 @@
|
||||
p_234361_,
|
||||
p_234362_,
|
||||
p_234356_.getSeed(p_234357_),
|
||||
- OverlayTexture.NO_OVERLAY
|
||||
+ OverlayTexture.NO_OVERLAY,
|
||||
+ modelData,
|
||||
+ renderType
|
||||
);
|
||||
} catch (Throwable throwable) {
|
||||
@@ -106,7 +_,12 @@
|
||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Tesselating block in world");
|
||||
@@ -103,7 +_,12 @@
|
||||
return this.blockModelShaper.getBlockModel(p_110911_);
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
RenderShape rendershape = p_110913_.getRenderShape();
|
||||
if (rendershape != RenderShape.INVISIBLE) {
|
||||
switch (rendershape) {
|
||||
@@ -116,21 +_,26 @@
|
||||
@@ -113,21 +_,26 @@
|
||||
float f = (float)(i >> 16 & 0xFF) / 255.0F;
|
||||
float f1 = (float)(i >> 8 & 0xFF) / 255.0F;
|
||||
float f2 = (float)(i & 0xFF) / 255.0F;
|
||||
|
||||
+57
-57
@@ -14,41 +14,41 @@
|
||||
float f1 = (float)(i >> 8 & 0xFF) / 255.0F;
|
||||
float f2 = (float)(i & 0xFF) / 255.0F;
|
||||
@@ -181,15 +_,15 @@
|
||||
float f52 = f4 * f;
|
||||
float f30 = f4 * f1;
|
||||
float f31 = f4 * f2;
|
||||
- this.vertex(p_234372_, d1 + 0.0, d2 + (double)f8, d0 + 0.0, f52, f30, f31, f18, f22, l);
|
||||
- this.vertex(p_234372_, d1 + 0.0, d2 + (double)f10, d0 + 1.0, f52, f30, f31, f19, f23, l);
|
||||
- this.vertex(p_234372_, d1 + 1.0, d2 + (double)f9, d0 + 1.0, f52, f30, f31, f20, f24, l);
|
||||
- this.vertex(p_234372_, d1 + 1.0, d2 + (double)f7, d0 + 0.0, f52, f30, f31, f21, f25, l);
|
||||
+ this.vertex(p_234372_, d1 + 0.0, d2 + (double)f8, d0 + 0.0, f52, f30, f31, f18, f22, l, alpha);
|
||||
+ this.vertex(p_234372_, d1 + 0.0, d2 + (double)f10, d0 + 1.0, f52, f30, f31, f19, f23, l, alpha);
|
||||
+ this.vertex(p_234372_, d1 + 1.0, d2 + (double)f9, d0 + 1.0, f52, f30, f31, f20, f24, l, alpha);
|
||||
+ this.vertex(p_234372_, d1 + 1.0, d2 + (double)f7, d0 + 0.0, f52, f30, f31, f21, f25, l, alpha);
|
||||
float f57 = f4 * f;
|
||||
float f29 = f4 * f1;
|
||||
float f30 = f4 * f2;
|
||||
- this.vertex(p_234372_, f36 + 0.0F, f37 + f8, f38 + 0.0F, f57, f29, f30, f17, f21, l);
|
||||
- this.vertex(p_234372_, f36 + 0.0F, f37 + f10, f38 + 1.0F, f57, f29, f30, f18, f22, l);
|
||||
- this.vertex(p_234372_, f36 + 1.0F, f37 + f9, f38 + 1.0F, f57, f29, f30, f19, f23, l);
|
||||
- this.vertex(p_234372_, f36 + 1.0F, f37 + f7, f38 + 0.0F, f57, f29, f30, f20, f24, l);
|
||||
+ this.vertex(p_234372_, f36 + 0.0F, f37 + f8, f38 + 0.0F, f57, f29, f30, f17, f21, l, alpha);
|
||||
+ this.vertex(p_234372_, f36 + 0.0F, f37 + f10, f38 + 1.0F, f57, f29, f30, f18, f22, l, alpha);
|
||||
+ this.vertex(p_234372_, f36 + 1.0F, f37 + f9, f38 + 1.0F, f57, f29, f30, f19, f23, l, alpha);
|
||||
+ this.vertex(p_234372_, f36 + 1.0F, f37 + f7, f38 + 0.0F, f57, f29, f30, f20, f24, l, alpha);
|
||||
if (p_234374_.shouldRenderBackwardUpFace(p_234370_, p_234371_.above())) {
|
||||
- this.vertex(p_234372_, d1 + 0.0, d2 + (double)f8, d0 + 0.0, f52, f30, f31, f18, f22, l);
|
||||
- this.vertex(p_234372_, d1 + 1.0, d2 + (double)f7, d0 + 0.0, f52, f30, f31, f21, f25, l);
|
||||
- this.vertex(p_234372_, d1 + 1.0, d2 + (double)f9, d0 + 1.0, f52, f30, f31, f20, f24, l);
|
||||
- this.vertex(p_234372_, d1 + 0.0, d2 + (double)f10, d0 + 1.0, f52, f30, f31, f19, f23, l);
|
||||
+ this.vertex(p_234372_, d1 + 0.0, d2 + (double)f8, d0 + 0.0, f52, f30, f31, f18, f22, l, alpha);
|
||||
+ this.vertex(p_234372_, d1 + 1.0, d2 + (double)f7, d0 + 0.0, f52, f30, f31, f21, f25, l, alpha);
|
||||
+ this.vertex(p_234372_, d1 + 1.0, d2 + (double)f9, d0 + 1.0, f52, f30, f31, f20, f24, l, alpha);
|
||||
+ this.vertex(p_234372_, d1 + 0.0, d2 + (double)f10, d0 + 1.0, f52, f30, f31, f19, f23, l, alpha);
|
||||
- this.vertex(p_234372_, f36 + 0.0F, f37 + f8, f38 + 0.0F, f57, f29, f30, f17, f21, l);
|
||||
- this.vertex(p_234372_, f36 + 1.0F, f37 + f7, f38 + 0.0F, f57, f29, f30, f20, f24, l);
|
||||
- this.vertex(p_234372_, f36 + 1.0F, f37 + f9, f38 + 1.0F, f57, f29, f30, f19, f23, l);
|
||||
- this.vertex(p_234372_, f36 + 0.0F, f37 + f10, f38 + 1.0F, f57, f29, f30, f18, f22, l);
|
||||
+ this.vertex(p_234372_, f36 + 0.0F, f37 + f8, f38 + 0.0F, f57, f29, f30, f17, f21, l, alpha);
|
||||
+ this.vertex(p_234372_, f36 + 1.0F, f37 + f7, f38 + 0.0F, f57, f29, f30, f20, f24, l, alpha);
|
||||
+ this.vertex(p_234372_, f36 + 1.0F, f37 + f9, f38 + 1.0F, f57, f29, f30, f19, f23, l, alpha);
|
||||
+ this.vertex(p_234372_, f36 + 0.0F, f37 + f10, f38 + 1.0F, f57, f29, f30, f18, f22, l, alpha);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -202,10 +_,10 @@
|
||||
float f46 = f3 * f;
|
||||
float f47 = f3 * f1;
|
||||
float f48 = f3 * f2;
|
||||
- this.vertex(p_234372_, d1, d2 + (double)f17, d0 + 1.0, f46, f47, f48, f40, f43, k);
|
||||
- this.vertex(p_234372_, d1, d2 + (double)f17, d0, f46, f47, f48, f40, f42, k);
|
||||
- this.vertex(p_234372_, d1 + 1.0, d2 + (double)f17, d0, f46, f47, f48, f41, f42, k);
|
||||
- this.vertex(p_234372_, d1 + 1.0, d2 + (double)f17, d0 + 1.0, f46, f47, f48, f41, f43, k);
|
||||
+ this.vertex(p_234372_, d1, d2 + (double)f17, d0 + 1.0, f46, f47, f48, f40, f43, k, alpha);
|
||||
+ this.vertex(p_234372_, d1, d2 + (double)f17, d0, f46, f47, f48, f40, f42, k, alpha);
|
||||
+ this.vertex(p_234372_, d1 + 1.0, d2 + (double)f17, d0, f46, f47, f48, f41, f42, k, alpha);
|
||||
+ this.vertex(p_234372_, d1 + 1.0, d2 + (double)f17, d0 + 1.0, f46, f47, f48, f41, f43, k, alpha);
|
||||
float f48 = f3 * f1;
|
||||
float f50 = f3 * f2;
|
||||
- this.vertex(p_234372_, f36, f37 + f16, f38 + 1.0F, f46, f48, f50, f40, f43, k);
|
||||
- this.vertex(p_234372_, f36, f37 + f16, f38, f46, f48, f50, f40, f42, k);
|
||||
- this.vertex(p_234372_, f36 + 1.0F, f37 + f16, f38, f46, f48, f50, f41, f42, k);
|
||||
- this.vertex(p_234372_, f36 + 1.0F, f37 + f16, f38 + 1.0F, f46, f48, f50, f41, f43, k);
|
||||
+ this.vertex(p_234372_, f36, f37 + f16, f38 + 1.0F, f46, f48, f50, f40, f43, k, alpha);
|
||||
+ this.vertex(p_234372_, f36, f37 + f16, f38, f46, f48, f50, f40, f42, k, alpha);
|
||||
+ this.vertex(p_234372_, f36 + 1.0F, f37 + f16, f38, f46, f48, f50, f41, f42, k, alpha);
|
||||
+ this.vertex(p_234372_, f36 + 1.0F, f37 + f16, f38 + 1.0F, f46, f48, f50, f41, f43, k, alpha);
|
||||
}
|
||||
|
||||
int j = this.getLightColor(p_234370_, p_234371_);
|
||||
@@ -67,40 +67,40 @@
|
||||
}
|
||||
|
||||
@@ -275,15 +_,15 @@
|
||||
float f37 = f4 * f36 * f;
|
||||
float f38 = f4 * f36 * f1;
|
||||
float f39 = f4 * f36 * f2;
|
||||
- this.vertex(p_234372_, d3, d2 + (double)f44, d4, f37, f38, f39, f53, f33, j);
|
||||
- this.vertex(p_234372_, d5, d2 + (double)f45, d6, f37, f38, f39, f32, f34, j);
|
||||
- this.vertex(p_234372_, d5, d2 + (double)f17, d6, f37, f38, f39, f32, f35, j);
|
||||
- this.vertex(p_234372_, d3, d2 + (double)f17, d4, f37, f38, f39, f53, f35, j);
|
||||
+ this.vertex(p_234372_, d3, d2 + (double)f44, d4, f37, f38, f39, f53, f33, j, alpha);
|
||||
+ this.vertex(p_234372_, d5, d2 + (double)f45, d6, f37, f38, f39, f32, f34, j, alpha);
|
||||
+ this.vertex(p_234372_, d5, d2 + (double)f17, d6, f37, f38, f39, f32, f35, j, alpha);
|
||||
+ this.vertex(p_234372_, d3, d2 + (double)f17, d4, f37, f38, f39, f53, f35, j, alpha);
|
||||
float f33 = f4 * f32 * f;
|
||||
float f34 = f4 * f32 * f1;
|
||||
float f35 = f4 * f32 * f2;
|
||||
- this.vertex(p_234372_, f47, f37 + f44, f49, f33, f34, f35, f56, f59, j);
|
||||
- this.vertex(p_234372_, f51, f37 + f45, f52, f33, f34, f35, f58, f60, j);
|
||||
- this.vertex(p_234372_, f51, f37 + f16, f52, f33, f34, f35, f58, f31, j);
|
||||
- this.vertex(p_234372_, f47, f37 + f16, f49, f33, f34, f35, f56, f31, j);
|
||||
+ this.vertex(p_234372_, f47, f37 + f44, f49, f33, f34, f35, f56, f59, j, alpha);
|
||||
+ this.vertex(p_234372_, f51, f37 + f45, f52, f33, f34, f35, f58, f60, j, alpha);
|
||||
+ this.vertex(p_234372_, f51, f37 + f16, f52, f33, f34, f35, f58, f31, j, alpha);
|
||||
+ this.vertex(p_234372_, f47, f37 + f16, f49, f33, f34, f35, f56, f31, j, alpha);
|
||||
if (textureatlassprite2 != this.waterOverlay) {
|
||||
- this.vertex(p_234372_, d3, d2 + (double)f17, d4, f37, f38, f39, f53, f35, j);
|
||||
- this.vertex(p_234372_, d5, d2 + (double)f17, d6, f37, f38, f39, f32, f35, j);
|
||||
- this.vertex(p_234372_, d5, d2 + (double)f45, d6, f37, f38, f39, f32, f34, j);
|
||||
- this.vertex(p_234372_, d3, d2 + (double)f44, d4, f37, f38, f39, f53, f33, j);
|
||||
+ this.vertex(p_234372_, d3, d2 + (double)f17, d4, f37, f38, f39, f53, f35, j, alpha);
|
||||
+ this.vertex(p_234372_, d5, d2 + (double)f17, d6, f37, f38, f39, f32, f35, j, alpha);
|
||||
+ this.vertex(p_234372_, d5, d2 + (double)f45, d6, f37, f38, f39, f32, f34, j, alpha);
|
||||
+ this.vertex(p_234372_, d3, d2 + (double)f44, d4, f37, f38, f39, f53, f33, j, alpha);
|
||||
- this.vertex(p_234372_, f47, f37 + f16, f49, f33, f34, f35, f56, f31, j);
|
||||
- this.vertex(p_234372_, f51, f37 + f16, f52, f33, f34, f35, f58, f31, j);
|
||||
- this.vertex(p_234372_, f51, f37 + f45, f52, f33, f34, f35, f58, f60, j);
|
||||
- this.vertex(p_234372_, f47, f37 + f44, f49, f33, f34, f35, f56, f59, j);
|
||||
+ this.vertex(p_234372_, f47, f37 + f16, f49, f33, f34, f35, f56, f31, j, alpha);
|
||||
+ this.vertex(p_234372_, f51, f37 + f16, f52, f33, f34, f35, f58, f31, j, alpha);
|
||||
+ this.vertex(p_234372_, f51, f37 + f45, f52, f33, f34, f35, f58, f60, j, alpha);
|
||||
+ this.vertex(p_234372_, f47, f37 + f44, f49, f33, f34, f35, f56, f59, j, alpha);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -345,10 +_,11 @@
|
||||
float p_110991_,
|
||||
float p_110992_,
|
||||
float p_110993_,
|
||||
float p_343128_,
|
||||
float p_344448_,
|
||||
float p_344284_,
|
||||
- int p_110994_
|
||||
+ int p_110994_,
|
||||
+ float alpha
|
||||
) {
|
||||
p_110985_.vertex(p_110986_, p_110987_, p_110988_)
|
||||
- .color(p_110989_, p_110990_, p_110991_, 1.0F)
|
||||
+ .color(p_110989_, p_110990_, p_110991_, alpha)
|
||||
.uv(p_110992_, p_110993_)
|
||||
.uv2(p_110994_)
|
||||
.normal(0.0F, 1.0F, 0.0F)
|
||||
p_110985_.addVertex(p_110989_, p_110990_, p_110991_)
|
||||
- .setColor(p_110992_, p_110993_, p_343128_, 1.0F)
|
||||
+ .setColor(p_110992_, p_110993_, p_343128_, alpha)
|
||||
.setUv(p_344448_, p_344284_)
|
||||
.setLight(p_110994_)
|
||||
.setNormal(0.0F, 1.0F, 0.0F);
|
||||
@@ -1,50 +0,0 @@
|
||||
--- a/net/minecraft/client/renderer/block/model/BlockElement.java
|
||||
+++ b/net/minecraft/client/renderer/block/model/BlockElement.java
|
||||
@@ -29,16 +_,23 @@
|
||||
public final Map<Direction, BlockElementFace> faces;
|
||||
public final BlockElementRotation rotation;
|
||||
public final boolean shade;
|
||||
+ private net.minecraftforge.client.model.ForgeFaceData faceData;
|
||||
|
||||
public BlockElement(
|
||||
Vector3f p_253626_, Vector3f p_254426_, Map<Direction, BlockElementFace> p_254454_, @Nullable BlockElementRotation p_254229_, boolean p_253661_
|
||||
) {
|
||||
+ this(p_253626_, p_254426_, p_254454_, p_254229_, p_253661_, net.minecraftforge.client.model.ForgeFaceData.DEFAULT);
|
||||
+ }
|
||||
+
|
||||
+ public BlockElement(Vector3f p_253626_, Vector3f p_254426_, Map<Direction, BlockElementFace> p_254454_, @Nullable BlockElementRotation p_254229_, boolean p_253661_, net.minecraftforge.client.model.ForgeFaceData faceData) {
|
||||
this.from = p_253626_;
|
||||
this.to = p_254426_;
|
||||
this.faces = p_254454_;
|
||||
this.rotation = p_254229_;
|
||||
this.shade = p_253661_;
|
||||
this.fillUvs();
|
||||
+ this.setFaceData(faceData);
|
||||
+ this.faces.values().forEach(face -> face.parent = this);
|
||||
}
|
||||
|
||||
private void fillUvs() {
|
||||
@@ -66,6 +_,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ public net.minecraftforge.client.model.ForgeFaceData getFaceData() {
|
||||
+ return this.faceData;
|
||||
+ }
|
||||
+
|
||||
+ public void setFaceData(net.minecraftforge.client.model.ForgeFaceData faceData) {
|
||||
+ this.faceData = java.util.Objects.requireNonNull(faceData);
|
||||
+ }
|
||||
+
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static class Deserializer implements JsonDeserializer<BlockElement> {
|
||||
private static final boolean DEFAULT_SHADE = true;
|
||||
@@ -80,7 +_,7 @@
|
||||
throw new JsonParseException("Expected shade to be a Boolean");
|
||||
} else {
|
||||
boolean flag = GsonHelper.getAsBoolean(jsonobject, "shade", true);
|
||||
- return new BlockElement(vector3f, vector3f1, map, blockelementrotation, flag);
|
||||
+ return new BlockElement(vector3f, vector3f1, map, blockelementrotation, flag, net.minecraftforge.client.model.ForgeFaceData.read(jsonobject.get("forge_data"), net.minecraftforge.client.model.ForgeFaceData.DEFAULT));
|
||||
}
|
||||
}
|
||||
|
||||
+15
-27
@@ -1,38 +1,26 @@
|
||||
--- a/net/minecraft/client/renderer/block/model/BlockElementFace.java
|
||||
+++ b/net/minecraft/client/renderer/block/model/BlockElementFace.java
|
||||
@@ -19,13 +_,31 @@
|
||||
public final int tintIndex;
|
||||
public final String texture;
|
||||
public final BlockFaceUV uv;
|
||||
+ @Nullable
|
||||
+ private final net.minecraftforge.client.model.ForgeFaceData faceData; // If null, we defer to the parent BlockElement's ForgeFaceData, which is not nullable.
|
||||
+ @Nullable
|
||||
+ BlockElement parent; // Parent canot be set by the constructor due to instantiation ordering. This shouldn't really ever be null, but it could theoretically be.
|
||||
@@ -13,9 +_,18 @@
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
public BlockElementFace(@Nullable Direction p_111359_, int p_111360_, String p_111361_, BlockFaceUV p_111362_) {
|
||||
+ this(p_111359_, p_111360_, p_111361_, p_111362_, null);
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
-public record BlockElementFace(@Nullable Direction cullForDirection, int tintIndex, String texture, BlockFaceUV uv) {
|
||||
+public record BlockElementFace(@Nullable Direction cullForDirection, int tintIndex, String texture, BlockFaceUV uv, @Nullable net.minecraftforge.client.model.ForgeFaceData data) {
|
||||
public static final int NO_TINT = -1;
|
||||
|
||||
+ public BlockElementFace(@Nullable Direction cullForDirection, int tintIndex, String texture, BlockFaceUV uv) {
|
||||
+ this(cullForDirection, tintIndex, texture, uv, null);
|
||||
+ }
|
||||
+
|
||||
+ public BlockElementFace(@Nullable Direction p_111359_, int p_111360_, String p_111361_, BlockFaceUV p_111362_, @Nullable net.minecraftforge.client.model.ForgeFaceData faceData) {
|
||||
this.cullForDirection = p_111359_;
|
||||
this.tintIndex = p_111360_;
|
||||
this.texture = p_111361_;
|
||||
this.uv = p_111362_;
|
||||
+ this.faceData = faceData;
|
||||
}
|
||||
+ @Override
|
||||
+ public net.minecraftforge.client.model.ForgeFaceData data() {
|
||||
+ return this.data == null ? net.minecraftforge.client.model.ForgeFaceData.DEFAULT : this.data;
|
||||
+ }
|
||||
+
|
||||
+ public net.minecraftforge.client.model.ForgeFaceData getFaceData() {
|
||||
+ if (this.faceData != null) {
|
||||
+ return this.faceData;
|
||||
+ } else if (this.parent != null) {
|
||||
+ return this.parent.getFaceData();
|
||||
+ }
|
||||
+ return net.minecraftforge.client.model.ForgeFaceData.DEFAULT;
|
||||
+ }
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static class Deserializer implements JsonDeserializer<BlockElementFace> {
|
||||
@@ -37,7 +_,7 @@
|
||||
private static final int DEFAULT_TINT_INDEX = -1;
|
||||
@@ -26,7 +_,7 @@
|
||||
int i = this.getTintIndex(jsonobject);
|
||||
String s = this.getTexture(jsonobject);
|
||||
BlockFaceUV blockfaceuv = p_111367_.deserialize(jsonobject, BlockFaceUV.class);
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
this.overrides.forEach(p_247932_ -> {
|
||||
UnbakedModel unbakedmodel1 = p_249059_.apply(p_247932_.getModel());
|
||||
if (!Objects.equals(unbakedmodel1, this)) {
|
||||
@@ -192,18 +_,27 @@
|
||||
@@ -192,13 +_,21 @@
|
||||
});
|
||||
}
|
||||
|
||||
@@ -61,27 +61,21 @@
|
||||
+ */
|
||||
+ @Deprecated
|
||||
@Override
|
||||
public BakedModel bake(ModelBaker p_252120_, Function<Material, TextureAtlasSprite> p_250023_, ModelState p_251130_, ResourceLocation p_252208_) {
|
||||
return this.bake(p_252120_, this, p_250023_, p_251130_, p_252208_, true);
|
||||
public BakedModel bake(ModelBaker p_252120_, Function<Material, TextureAtlasSprite> p_250023_, ModelState p_251130_) {
|
||||
return this.bake(p_252120_, this, p_250023_, p_251130_, true);
|
||||
}
|
||||
|
||||
+ public BakedModel bake(ModelBaker p_249720_, BlockModel p_111451_, Function<Material, TextureAtlasSprite> p_111452_, ModelState p_111453_, ResourceLocation p_111454_, boolean p_111455_) {
|
||||
+ return net.minecraftforge.client.model.geometry.UnbakedGeometryHelper.bake(this, p_249720_, p_111451_, p_111452_, p_111453_, p_111454_, p_111455_);
|
||||
+ public BakedModel bake(ModelBaker p_249720_, BlockModel p_111451_, Function<Material, TextureAtlasSprite> p_111452_, ModelState p_111453_, boolean p_111455_) {
|
||||
+ return net.minecraftforge.client.model.geometry.UnbakedGeometryHelper.bake(this, p_249720_, p_111451_, p_111452_, p_111453_, p_111455_);
|
||||
+ }
|
||||
+
|
||||
public BakedModel bake(
|
||||
ModelBaker p_249720_,
|
||||
BlockModel p_111451_,
|
||||
Function<Material, TextureAtlasSprite> p_111452_,
|
||||
ModelState p_111453_,
|
||||
ResourceLocation p_111454_,
|
||||
- boolean p_111455_
|
||||
+ boolean p_111455_,
|
||||
+ net.minecraftforge.client.RenderTypeGroup renderTypes
|
||||
- ModelBaker p_249720_, BlockModel p_111451_, Function<Material, TextureAtlasSprite> p_111452_, ModelState p_111453_, boolean p_111455_
|
||||
+ ModelBaker p_249720_, BlockModel p_111451_, Function<Material, TextureAtlasSprite> p_111452_, ModelState p_111453_, boolean p_111455_, net.minecraftforge.client.RenderTypeGroup renderTypes
|
||||
) {
|
||||
TextureAtlasSprite textureatlassprite = p_111452_.apply(this.getMaterial("particle"));
|
||||
if (this.getRootModel() == ModelBakery.BLOCK_ENTITY_MARKER) {
|
||||
@@ -295,7 +_,18 @@
|
||||
@@ -290,7 +_,18 @@
|
||||
ItemTransform itemtransform5 = this.getTransform(ItemDisplayContext.GUI);
|
||||
ItemTransform itemtransform6 = this.getTransform(ItemDisplayContext.GROUND);
|
||||
ItemTransform itemtransform7 = this.getTransform(ItemDisplayContext.FIXED);
|
||||
@@ -101,7 +95,7 @@
|
||||
}
|
||||
|
||||
private ItemTransform getTransform(ItemDisplayContext p_270662_) {
|
||||
@@ -413,6 +_,10 @@
|
||||
@@ -408,6 +_,10 @@
|
||||
|
||||
public boolean lightLikeBlock() {
|
||||
return this == SIDE;
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
--- a/net/minecraft/client/renderer/block/model/FaceBakery.java
|
||||
+++ b/net/minecraft/client/renderer/block/model/FaceBakery.java
|
||||
@@ -59,7 +_,14 @@
|
||||
@@ -57,7 +_,14 @@
|
||||
this.recalculateWinding(aint, direction);
|
||||
}
|
||||
|
||||
- return new BakedQuad(aint, p_111603_.tintIndex, direction, p_111604_, p_111608_);
|
||||
+ net.minecraftforge.client.ForgeHooksClient.fillNormal(aint, direction, p_111603_.getFaceData().calculateNormals());
|
||||
+ var data = p_111603_.getFaceData();
|
||||
+ var quad = new BakedQuad(aint, p_111603_.tintIndex, direction, p_111604_, p_111608_, data.ambientOcclusion());
|
||||
- return new BakedQuad(aint, p_111603_.tintIndex(), direction, p_111604_, p_111608_);
|
||||
+ var data = p_111603_.data();
|
||||
+ net.minecraftforge.client.ForgeHooksClient.fillNormal(aint, direction, data.calculateNormals());
|
||||
+ var quad = new BakedQuad(aint, p_111603_.tintIndex(), direction, p_111604_, p_111608_, data.ambientOcclusion());
|
||||
+ if (!net.minecraftforge.client.model.ForgeFaceData.DEFAULT.equals(data)) {
|
||||
+ net.minecraftforge.client.model.QuadTransformers.applyingLightmap(data.blockLight(), data.skyLight()).processInPlace(quad);
|
||||
+ net.minecraftforge.client.model.QuadTransformers.applyingColor(data.color()).processInPlace(quad);
|
||||
@@ -15,4 +15,4 @@
|
||||
+ return quad;
|
||||
}
|
||||
|
||||
public static BlockFaceUV recomputeUVs(BlockFaceUV p_111582_, Direction p_111583_, Transformation p_111584_, ResourceLocation p_111585_) {
|
||||
public static BlockFaceUV recomputeUVs(BlockFaceUV p_111582_, Direction p_111583_, Transformation p_111584_) {
|
||||
@@ -1,8 +1,8 @@
|
||||
--- a/net/minecraft/client/renderer/chunk/RenderChunkRegion.java
|
||||
+++ b/net/minecraft/client/renderer/chunk/RenderChunkRegion.java
|
||||
@@ -74,4 +_,14 @@
|
||||
public int getHeight() {
|
||||
return this.level.getHeight();
|
||||
@@ -78,4 +_,14 @@
|
||||
public static int index(int p_345383_, int p_342744_, int p_343921_, int p_343462_) {
|
||||
return p_343921_ - p_345383_ + (p_343462_ - p_342744_) * 3;
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
--- a/net/minecraft/client/renderer/chunk/SectionCompiler.java
|
||||
+++ b/net/minecraft/client/renderer/chunk/SectionCompiler.java
|
||||
@@ -41,6 +_,7 @@
|
||||
}
|
||||
|
||||
public SectionCompiler.Results compile(SectionPos p_344383_, RenderChunkRegion p_342669_, VertexSorting p_342522_, SectionBufferBuilderPack p_343546_) {
|
||||
+ var modelDataMap = net.minecraft.client.Minecraft.getInstance().level.getModelDataManager().getAt(p_344383_);
|
||||
SectionCompiler.Results sectioncompiler$results = new SectionCompiler.Results();
|
||||
BlockPos blockpos = p_344383_.origin();
|
||||
BlockPos blockpos1 = blockpos.offset(15, 15, 15);
|
||||
@@ -71,7 +_,11 @@
|
||||
}
|
||||
|
||||
if (blockstate.getRenderShape() == RenderShape.MODEL) {
|
||||
- RenderType rendertype2 = ItemBlockRenderTypes.getChunkRenderType(blockstate);
|
||||
+ var model = this.blockRenderer.getBlockModel(blockstate);
|
||||
+ var data = modelDataMap.getOrDefault(blockpos2, net.minecraftforge.client.model.data.ModelData.EMPTY);
|
||||
+ data = model.getModelData(p_342669_, blockpos2, blockstate, data);
|
||||
+ randomsource.setSeed(blockstate.getSeed(blockpos2));
|
||||
+ for (RenderType rendertype2 : model.getRenderTypes(blockstate, randomsource, data)) {
|
||||
BufferBuilder bufferbuilder1 = this.getOrBeginLayer(map, p_343546_, rendertype2);
|
||||
posestack.pushPose();
|
||||
posestack.translate(
|
||||
@@ -79,8 +_,9 @@
|
||||
(float)SectionPos.sectionRelative(blockpos2.getY()),
|
||||
(float)SectionPos.sectionRelative(blockpos2.getZ())
|
||||
);
|
||||
- this.blockRenderer.renderBatched(blockstate, blockpos2, p_342669_, posestack, bufferbuilder1, true, randomsource);
|
||||
+ this.blockRenderer.renderBatched(blockstate, blockpos2, p_342669_, posestack, bufferbuilder1, true, randomsource, data, rendertype2);
|
||||
posestack.popPose();
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,9 +_,10 @@
|
||||
private <E extends BlockEntity> void handleBlockEntity(SectionCompiler.Results p_343713_, E p_343478_) {
|
||||
BlockEntityRenderer<E> blockentityrenderer = this.blockEntityRenderer.getRenderer(p_343478_);
|
||||
if (blockentityrenderer != null) {
|
||||
- p_343713_.blockEntities.add(p_343478_);
|
||||
if (blockentityrenderer.shouldRenderOffScreen(p_343478_)) {
|
||||
p_343713_.globalBlockEntities.add(p_343478_);
|
||||
+ } else {
|
||||
+ p_343713_.blockEntities.add(p_343478_); //FORGE: Fix MC-112730
|
||||
}
|
||||
}
|
||||
}
|
||||
-118
@@ -1,118 +0,0 @@
|
||||
--- a/net/minecraft/client/renderer/chunk/SectionRenderDispatcher.java
|
||||
+++ b/net/minecraft/client/renderer/chunk/SectionRenderDispatcher.java
|
||||
@@ -402,7 +_,7 @@
|
||||
if (!sectionrenderdispatcher$compiledsection.hasBlocks.contains(p_301074_)) {
|
||||
return false;
|
||||
} else {
|
||||
- this.lastResortTransparencyTask = new SectionRenderDispatcher.RenderSection.ResortTransparencyTask(this.getDistToPlayerSqr(), sectionrenderdispatcher$compiledsection);
|
||||
+ this.lastResortTransparencyTask = new SectionRenderDispatcher.RenderSection.ResortTransparencyTask(new net.minecraft.world.level.ChunkPos(getOrigin()), this.getDistToPlayerSqr(), sectionrenderdispatcher$compiledsection);
|
||||
p_298196_.schedule(this.lastResortTransparencyTask);
|
||||
return true;
|
||||
}
|
||||
@@ -436,7 +_,7 @@
|
||||
this.initialCompilationCancelCount.incrementAndGet();
|
||||
}
|
||||
|
||||
- this.lastRebuildTask = new SectionRenderDispatcher.RenderSection.RebuildTask(this.getDistToPlayerSqr(), renderchunkregion, !flag1 || this.initialCompilationCancelCount.get() > 2);
|
||||
+ this.lastRebuildTask = new SectionRenderDispatcher.RenderSection.RebuildTask(new net.minecraft.world.level.ChunkPos(getOrigin()), this.getDistToPlayerSqr(), renderchunkregion, !flag1 || this.initialCompilationCancelCount.get() > 2);
|
||||
return this.lastRebuildTask;
|
||||
}
|
||||
|
||||
@@ -476,10 +_,21 @@
|
||||
protected final double distAtCreation;
|
||||
protected final AtomicBoolean isCancelled = new AtomicBoolean(false);
|
||||
protected final boolean isHighPriority;
|
||||
+ protected java.util.Map<net.minecraft.core.BlockPos, net.minecraftforge.client.model.data.ModelData> modelData;
|
||||
|
||||
+ @Deprecated
|
||||
public CompileTask(final double p_300617_, final boolean p_299251_) {
|
||||
+ this(null, p_300617_, p_299251_);
|
||||
+ }
|
||||
+
|
||||
+ public CompileTask(@Nullable net.minecraft.world.level.ChunkPos pos, double p_300617_, boolean p_299251_) {
|
||||
this.distAtCreation = p_300617_;
|
||||
this.isHighPriority = p_299251_;
|
||||
+ if (pos == null) {
|
||||
+ this.modelData = java.util.Collections.emptyMap();
|
||||
+ } else {
|
||||
+ this.modelData = net.minecraft.client.Minecraft.getInstance().level.getModelDataManager().getAt(pos);
|
||||
+ }
|
||||
}
|
||||
|
||||
public abstract CompletableFuture<SectionRenderDispatcher.SectionTaskResult> doTask(SectionBufferBuilderPack p_300298_);
|
||||
@@ -491,6 +_,10 @@
|
||||
public int compareTo(SectionRenderDispatcher.RenderSection.CompileTask p_298947_) {
|
||||
return Doubles.compare(this.distAtCreation, p_298947_.distAtCreation);
|
||||
}
|
||||
+
|
||||
+ public net.minecraftforge.client.model.data.ModelData getModelData(net.minecraft.core.BlockPos pos) {
|
||||
+ return modelData.getOrDefault(pos, net.minecraftforge.client.model.data.ModelData.EMPTY);
|
||||
+ }
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@@ -498,8 +_,13 @@
|
||||
@Nullable
|
||||
protected RenderChunkRegion region;
|
||||
|
||||
+ @Deprecated
|
||||
public RebuildTask(final double p_301300_, @Nullable final RenderChunkRegion p_300496_, final boolean p_299891_) {
|
||||
- super(p_301300_, p_299891_);
|
||||
+ this(null, p_301300_, p_300496_, p_299891_);
|
||||
+ }
|
||||
+
|
||||
+ public RebuildTask(@Nullable net.minecraft.world.level.ChunkPos pos, double p_301300_, @Nullable RenderChunkRegion p_300496_, boolean p_299891_) {
|
||||
+ super(pos, p_301300_, p_299891_);
|
||||
this.region = p_300496_;
|
||||
}
|
||||
|
||||
@@ -601,7 +_,10 @@
|
||||
}
|
||||
|
||||
if (blockstate.getRenderShape() != RenderShape.INVISIBLE) {
|
||||
- RenderType rendertype2 = ItemBlockRenderTypes.getChunkRenderType(blockstate);
|
||||
+ var model = blockrenderdispatcher.getBlockModel(blockstate);
|
||||
+ var modelData = model.getModelData(renderchunkregion, blockpos2, blockstate, getModelData(blockpos2));
|
||||
+ randomsource.setSeed(blockstate.getSeed(blockpos2));
|
||||
+ for (RenderType rendertype2 : model.getRenderTypes(blockstate, randomsource, modelData)) {
|
||||
BufferBuilder bufferbuilder2 = p_300020_.builder(rendertype2);
|
||||
if (set.add(rendertype2)) {
|
||||
RenderSection.this.beginLayer(bufferbuilder2);
|
||||
@@ -609,8 +_,9 @@
|
||||
|
||||
posestack.pushPose();
|
||||
posestack.translate((float)(blockpos2.getX() & 15), (float)(blockpos2.getY() & 15), (float)(blockpos2.getZ() & 15));
|
||||
- blockrenderdispatcher.renderBatched(blockstate, blockpos2, renderchunkregion, posestack, bufferbuilder2, true, randomsource);
|
||||
+ blockrenderdispatcher.renderBatched(blockstate, blockpos2, renderchunkregion, posestack, bufferbuilder2, true, randomsource, modelData, rendertype2);
|
||||
posestack.popPose();
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -643,9 +_,10 @@
|
||||
private <E extends BlockEntity> void handleBlockEntity(SectionRenderDispatcher.RenderSection.RebuildTask.CompileResults p_297364_, E p_299361_) {
|
||||
BlockEntityRenderer<E> blockentityrenderer = Minecraft.getInstance().getBlockEntityRenderDispatcher().getRenderer(p_299361_);
|
||||
if (blockentityrenderer != null) {
|
||||
- p_297364_.blockEntities.add(p_299361_);
|
||||
if (blockentityrenderer.shouldRenderOffScreen(p_299361_)) {
|
||||
p_297364_.globalBlockEntities.add(p_299361_);
|
||||
+ } else {
|
||||
+ p_297364_.blockEntities.add(p_299361_); //FORGE: Fix MC-112730
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -673,8 +_,13 @@
|
||||
class ResortTransparencyTask extends SectionRenderDispatcher.RenderSection.CompileTask {
|
||||
private final SectionRenderDispatcher.CompiledSection compiledSection;
|
||||
|
||||
+ @Deprecated
|
||||
public ResortTransparencyTask(final double p_300619_, final SectionRenderDispatcher.CompiledSection p_297742_) {
|
||||
- super(p_300619_, true);
|
||||
+ this(null, p_300619_, p_297742_);
|
||||
+ }
|
||||
+
|
||||
+ public ResortTransparencyTask(@Nullable net.minecraft.world.level.ChunkPos pos, double p_300619_, SectionRenderDispatcher.CompiledSection p_297742_) {
|
||||
+ super(pos, p_300619_, true);
|
||||
this.compiledSection = p_297742_;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/renderer/entity/BoatRenderer.java
|
||||
+++ b/net/minecraft/client/renderer/entity/BoatRenderer.java
|
||||
@@ -75,7 +_,7 @@
|
||||
@@ -76,7 +_,7 @@
|
||||
p_113932_.mulPose(new Quaternionf().setAngleAxis(p_113929_.getBubbleAngle(p_113931_) * (float) (Math.PI / 180.0), 1.0F, 0.0F, 1.0F));
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
ResourceLocation resourcelocation = pair.getFirst();
|
||||
ListModel<Boat> listmodel = pair.getSecond();
|
||||
p_113932_.scale(-1.0F, -1.0F, 1.0F);
|
||||
@@ -94,7 +_,12 @@
|
||||
@@ -95,7 +_,12 @@
|
||||
super.render(p_113929_, p_113930_, p_113931_, p_113932_, p_113933_, p_113934_);
|
||||
}
|
||||
|
||||
|
||||
+5
-5
@@ -1,9 +1,9 @@
|
||||
--- a/net/minecraft/client/renderer/entity/EntityRenderDispatcher.java
|
||||
+++ b/net/minecraft/client/renderer/entity/EntityRenderDispatcher.java
|
||||
@@ -190,12 +_,12 @@
|
||||
private static void renderHitbox(PoseStack p_114442_, VertexConsumer p_114443_, Entity p_114444_, float p_114445_) {
|
||||
@@ -222,12 +_,12 @@
|
||||
) {
|
||||
AABB aabb = p_114444_.getBoundingBox().move(-p_114444_.getX(), -p_114444_.getY(), -p_114444_.getZ());
|
||||
LevelRenderer.renderLineBox(p_114442_, p_114443_, aabb, 1.0F, 1.0F, 1.0F, 1.0F);
|
||||
LevelRenderer.renderLineBox(p_114442_, p_114443_, aabb, p_343193_, p_342304_, p_342638_, 1.0F);
|
||||
- if (p_114444_ instanceof EnderDragon) {
|
||||
+ if (p_114444_.isMultipartEntity()) {
|
||||
double d0 = -Mth.lerp((double)p_114445_, p_114444_.xOld, p_114444_.getX());
|
||||
@@ -15,7 +15,7 @@
|
||||
p_114442_.pushPose();
|
||||
double d3 = d0 + Mth.lerp((double)p_114445_, enderdragonpart.xOld, enderdragonpart.getX());
|
||||
double d4 = d1 + Mth.lerp((double)p_114445_, enderdragonpart.yOld, enderdragonpart.getY());
|
||||
@@ -440,6 +_,10 @@
|
||||
@@ -467,6 +_,10 @@
|
||||
return this.itemInHandRenderer;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
@Override
|
||||
public void onResourceManagerReload(ResourceManager p_174004_) {
|
||||
EntityRendererProvider.Context entityrendererprovider$context = new EntityRendererProvider.Context(
|
||||
@@ -447,5 +_,6 @@
|
||||
@@ -474,5 +_,6 @@
|
||||
);
|
||||
this.renderers = EntityRenderers.createEntityRenderers(entityrendererprovider$context);
|
||||
this.playerRenderers = EntityRenderers.createPlayerRenderers(entityrendererprovider$context);
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
--- a/net/minecraft/client/renderer/entity/EntityRenderer.java
|
||||
+++ b/net/minecraft/client/renderer/entity/EntityRenderer.java
|
||||
@@ -71,8 +_,9 @@
|
||||
}
|
||||
@@ -94,8 +_,9 @@
|
||||
}
|
||||
}
|
||||
|
||||
public void render(T p_114485_, float p_114486_, float p_114487_, PoseStack p_114488_, MultiBufferSource p_114489_, int p_114490_) {
|
||||
- if (this.shouldShowName(p_114485_)) {
|
||||
- this.renderNameTag(p_114485_, p_114485_.getDisplayName(), p_114488_, p_114489_, p_114490_, p_114487_);
|
||||
+ var event = net.minecraftforge.client.event.ForgeEventFactoryClient.fireRenderNameTagEvent(p_114485_, p_114485_.getDisplayName(), this, p_114488_, p_114489_, p_114490_, p_114487_);
|
||||
+ if (event.getResult() != net.minecraftforge.eventbus.api.Event.Result.DENY && (event.getResult() == net.minecraftforge.eventbus.api.Event.Result.ALLOW || this.shouldShowName(p_114485_))) {
|
||||
+ if (!event.getResult().isDenied() && (event.getResult().isAllowed() || this.shouldShowName(p_114485_))) {
|
||||
+ this.renderNameTag(p_114485_, event.getContent(), p_114488_, p_114489_, p_114490_, p_114487_);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,7 +_,7 @@
|
||||
@@ -181,7 +_,7 @@
|
||||
|
||||
protected void renderNameTag(T p_114498_, Component p_114499_, PoseStack p_114500_, MultiBufferSource p_114501_, int p_114502_, float p_334448_) {
|
||||
double d0 = this.entityRenderDispatcher.distanceToSqr(p_114498_);
|
||||
|
||||
+2
-1
@@ -1,11 +1,12 @@
|
||||
--- a/net/minecraft/client/renderer/entity/FallingBlockRenderer.java
|
||||
+++ b/net/minecraft/client/renderer/entity/FallingBlockRenderer.java
|
||||
@@ -34,20 +_,25 @@
|
||||
@@ -34,20 +_,26 @@
|
||||
p_114637_.pushPose();
|
||||
BlockPos blockpos = BlockPos.containing(p_114634_.getX(), p_114634_.getBoundingBox().maxY, p_114634_.getZ());
|
||||
p_114637_.translate(-0.5, 0.0, -0.5);
|
||||
+ var model = this.dispatcher.getBlockModel(blockstate);
|
||||
+ for (var renderType : model.getRenderTypes(blockstate, RandomSource.create(blockstate.getSeed(p_114634_.getStartPos())), net.minecraftforge.client.model.data.ModelData.EMPTY)) {
|
||||
+ renderType = net.minecraftforge.client.RenderTypeHelper.getMovingBlockRenderType(renderType);
|
||||
this.dispatcher
|
||||
.getModelRenderer()
|
||||
.tesselateBlock(
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/renderer/entity/FishingHookRenderer.java
|
||||
+++ b/net/minecraft/client/renderer/entity/FishingHookRenderer.java
|
||||
@@ -66,7 +_,7 @@
|
||||
@@ -64,7 +_,7 @@
|
||||
private Vec3 getPlayerHandPos(Player p_328037_, float p_328369_, float p_332926_) {
|
||||
int i = p_328037_.getMainArm() == HumanoidArm.RIGHT ? 1 : -1;
|
||||
ItemStack itemstack = p_328037_.getMainHandItem();
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
VertexConsumer vertexconsumer;
|
||||
if (hasAnimatedTexture(p_115144_) && p_115144_.hasFoil()) {
|
||||
PoseStack.Pose posestack$pose = p_115147_.last().copy();
|
||||
@@ -150,9 +_,11 @@
|
||||
@@ -146,9 +_,11 @@
|
||||
vertexconsumer = getFoilBuffer(p_115148_, rendertype, true, p_115144_.hasFoil());
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
}
|
||||
|
||||
p_115147_.popPose();
|
||||
@@ -211,7 +_,7 @@
|
||||
@@ -199,7 +_,7 @@
|
||||
float f1 = (float)FastColor.ARGB32.red(i) / 255.0F;
|
||||
float f2 = (float)FastColor.ARGB32.green(i) / 255.0F;
|
||||
float f3 = (float)FastColor.ARGB32.blue(i) / 255.0F;
|
||||
@@ -51,7 +51,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -264,5 +_,9 @@
|
||||
@@ -252,5 +_,9 @@
|
||||
@Override
|
||||
public void onResourceManagerReload(ResourceManager p_115105_) {
|
||||
this.itemModelShaper.rebuildCache();
|
||||
|
||||
+9
-31
@@ -1,5 +1,14 @@
|
||||
--- a/net/minecraft/client/renderer/entity/layers/ElytraLayer.java
|
||||
+++ b/net/minecraft/client/renderer/entity/layers/ElytraLayer.java
|
||||
@@ -23,7 +_,7 @@
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
-public class ElytraLayer<T extends LivingEntity, M extends EntityModel<T>> extends RenderLayer<T, M> {
|
||||
+public class ElytraLayer<T extends LivingEntity, M extends EntityModel<T>> extends RenderLayer<T, M> implements net.minecraftforge.client.extensions.IForgeElytraLayer<T> {
|
||||
public static final ResourceLocation WINGS_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/elytra.png");
|
||||
private final ElytraModel<T> elytraModel;
|
||||
|
||||
@@ -45,7 +_,7 @@
|
||||
float p_116960_
|
||||
) {
|
||||
@@ -22,34 +31,3 @@
|
||||
}
|
||||
|
||||
p_116951_.pushPose();
|
||||
@@ -68,5 +_,30 @@
|
||||
this.elytraModel.renderToBuffer(p_116951_, vertexconsumer, p_116953_, OverlayTexture.NO_OVERLAY, 1.0F, 1.0F, 1.0F, 1.0F);
|
||||
p_116951_.popPose();
|
||||
}
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Determines if the ElytraLayer should render.
|
||||
+ * ItemStack and Entity are provided for modder convenience,
|
||||
+ * For example, using the same ElytraLayer for multiple custom Elytra.
|
||||
+ *
|
||||
+ * @param stack The Elytra ItemStack
|
||||
+ * @param entity The entity being rendered.
|
||||
+ * @return If the ElytraLayer should render.
|
||||
+ */
|
||||
+ public boolean shouldRender(ItemStack stack, T entity) {
|
||||
+ return stack.getItem() == Items.ELYTRA;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the texture to use with this ElytraLayer.
|
||||
+ * This assumes the vanilla Elytra model.
|
||||
+ *
|
||||
+ * @param stack The Elytra ItemStack.
|
||||
+ * @param entity The entity being rendered.
|
||||
+ * @return The texture.
|
||||
+ */
|
||||
+ public ResourceLocation getElytraTexture(ItemStack stack, T entity) {
|
||||
+ return WINGS_LOCATION;
|
||||
}
|
||||
}
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
--- a/net/minecraft/client/renderer/entity/layers/HumanoidArmorLayer.java
|
||||
+++ b/net/minecraft/client/renderer/entity/layers/HumanoidArmorLayer.java
|
||||
@@ -66,22 +_,24 @@
|
||||
if (armoritem.getEquipmentSlot() == p_117122_) {
|
||||
this.getParentModel().copyPropertiesTo(p_117124_);
|
||||
this.setPartVisibility(p_117124_, p_117122_);
|
||||
+ net.minecraft.client.model.Model model = getArmorModelHook(p_117121_, itemstack, p_117122_, p_117124_);
|
||||
boolean flag = this.usesInnerModel(p_117122_);
|
||||
ArmorMaterial armormaterial = armoritem.getMaterial().value();
|
||||
int i = itemstack.is(ItemTags.DYEABLE) ? FastColor.ARGB32.opaque(DyedItemColor.getOrDefault(itemstack, -6265536)) : -1;
|
||||
|
||||
for (ArmorMaterial.Layer armormaterial$layer : armormaterial.layers()) {
|
||||
int j = armormaterial$layer.dyeable() ? i : -1;
|
||||
- this.renderModel(p_117119_, p_117120_, p_117123_, p_117124_, j, armormaterial$layer.texture(flag));
|
||||
+ var texture = net.minecraftforge.client.ForgeHooksClient.getArmorTexture(p_117121_, itemstack, p_117122_, armormaterial$layer, flag);
|
||||
+ this.renderModel(p_117119_, p_117120_, p_117123_, model, j, texture);
|
||||
}
|
||||
|
||||
ArmorTrim armortrim = itemstack.get(DataComponents.TRIM);
|
||||
if (armortrim != null) {
|
||||
- this.renderTrim(armoritem.getMaterial(), p_117119_, p_117120_, p_117123_, armortrim, p_117124_, flag);
|
||||
+ this.renderTrim(armoritem.getMaterial(), p_117119_, p_117120_, p_117123_, armortrim, model, flag);
|
||||
}
|
||||
|
||||
if (itemstack.hasFoil()) {
|
||||
- this.renderGlint(p_117119_, p_117120_, p_117123_, p_117124_);
|
||||
+ this.renderGlint(p_117119_, p_117120_, p_117123_, model);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -111,12 +_,20 @@
|
||||
}
|
||||
|
||||
private void renderModel(PoseStack p_289664_, MultiBufferSource p_289689_, int p_289681_, A p_289658_, int p_342257_, ResourceLocation p_328978_) {
|
||||
+ renderModel(p_289664_, p_289689_, p_289681_, (net.minecraft.client.model.Model)p_289658_, p_342257_, p_328978_);
|
||||
+ }
|
||||
+
|
||||
+ private void renderModel(PoseStack p_289664_, MultiBufferSource p_289689_, int p_289681_, net.minecraft.client.model.Model p_289658_, int p_342257_, ResourceLocation p_328978_) {
|
||||
VertexConsumer vertexconsumer = p_289689_.getBuffer(RenderType.armorCutoutNoCull(p_328978_));
|
||||
p_289658_.renderToBuffer(p_289664_, vertexconsumer, p_289681_, OverlayTexture.NO_OVERLAY, p_342257_);
|
||||
}
|
||||
|
||||
+ private void renderTrim(Holder<ArmorMaterial> p_331988_, PoseStack p_289687_, MultiBufferSource p_289643_, int p_289683_, ArmorTrim p_289692_, A p_289663_, boolean p_289651_) {
|
||||
+ renderTrim(p_331988_, p_289687_, p_289643_, p_289683_, p_289692_, (net.minecraft.client.model.Model)p_289663_, p_289651_);
|
||||
+ }
|
||||
+
|
||||
private void renderTrim(
|
||||
- Holder<ArmorMaterial> p_331988_, PoseStack p_289687_, MultiBufferSource p_289643_, int p_289683_, ArmorTrim p_289692_, A p_289663_, boolean p_289651_
|
||||
+ Holder<ArmorMaterial> p_331988_, PoseStack p_289687_, MultiBufferSource p_289643_, int p_289683_, ArmorTrim p_289692_, net.minecraft.client.model.Model p_289663_, boolean p_289651_
|
||||
) {
|
||||
TextureAtlasSprite textureatlassprite = this.armorTrimAtlas.getSprite(p_289651_ ? p_289692_.innerTexture(p_331988_) : p_289692_.outerTexture(p_331988_));
|
||||
VertexConsumer vertexconsumer = textureatlassprite.wrap(p_289643_.getBuffer(Sheets.armorTrimsSheet(p_289692_.pattern().value().decal())));
|
||||
@@ -124,6 +_,10 @@
|
||||
}
|
||||
|
||||
private void renderGlint(PoseStack p_289673_, MultiBufferSource p_289654_, int p_289649_, A p_289659_) {
|
||||
+ renderGlint(p_289673_, p_289654_, p_289649_, (net.minecraft.client.model.Model)p_289659_);
|
||||
+ }
|
||||
+
|
||||
+ private void renderGlint(PoseStack p_289673_, MultiBufferSource p_289654_, int p_289649_, net.minecraft.client.model.Model p_289659_) {
|
||||
p_289659_.renderToBuffer(p_289673_, p_289654_.getBuffer(RenderType.armorEntityGlint()), p_289649_, OverlayTexture.NO_OVERLAY);
|
||||
}
|
||||
|
||||
@@ -133,5 +_,12 @@
|
||||
|
||||
private boolean usesInnerModel(EquipmentSlot p_117129_) {
|
||||
return p_117129_ == EquipmentSlot.LEGS;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Hook to allow item-sensitive armor model. for HumanoidArmorLayer.
|
||||
+ */
|
||||
+ protected net.minecraft.client.model.Model getArmorModelHook(T entity, ItemStack itemStack, EquipmentSlot slot, A model) {
|
||||
+ return net.minecraftforge.client.ForgeHooksClient.getArmorModel(entity, itemStack, slot, model);
|
||||
}
|
||||
}
|
||||
+7
-6
@@ -1,16 +1,17 @@
|
||||
--- a/net/minecraft/client/resources/language/LanguageManager.java
|
||||
+++ b/net/minecraft/client/resources/language/LanguageManager.java
|
||||
@@ -28,7 +_,7 @@
|
||||
private String currentCode;
|
||||
@@ -30,8 +_,8 @@
|
||||
private final Consumer<ClientLanguage> reloadCallback;
|
||||
|
||||
public LanguageManager(String p_118971_) {
|
||||
public LanguageManager(String p_118971_, Consumer<ClientLanguage> p_342376_) {
|
||||
- this.currentCode = p_118971_;
|
||||
this.reloadCallback = p_342376_;
|
||||
+ setSelected(p_118971_);
|
||||
}
|
||||
|
||||
private static Map<String, LanguageInfo> extractLanguages(Stream<PackResources> p_118982_) {
|
||||
@@ -65,8 +_,12 @@
|
||||
Language.inject(clientlanguage);
|
||||
@@ -69,8 +_,12 @@
|
||||
this.reloadCallback.accept(clientlanguage);
|
||||
}
|
||||
|
||||
+ private java.util.Locale javaLocale; // Forge: add locale information for modders
|
||||
@@ -18,7 +19,7 @@
|
||||
public void setSelected(String p_265224_) {
|
||||
this.currentCode = p_265224_;
|
||||
+ final String[] langSplit = p_265224_.split("_", 2);
|
||||
+ this.javaLocale = langSplit.length == 1 ? new java.util.Locale(langSplit[0]) : new java.util.Locale(langSplit[0], langSplit[1]);
|
||||
+ this.javaLocale = langSplit.length == 1 ? java.util.Locale.of(langSplit[0]) : java.util.Locale.of(langSplit[0], langSplit[1]);
|
||||
}
|
||||
|
||||
public String getSelected() {
|
||||
@@ -1,20 +1,17 @@
|
||||
--- a/net/minecraft/client/resources/model/ModelBakery.java
|
||||
+++ b/net/minecraft/client/resources/model/ModelBakery.java
|
||||
@@ -161,6 +_,13 @@
|
||||
@@ -115,6 +_,10 @@
|
||||
p_252014_.popPush("special");
|
||||
this.loadTopLevel(ItemRenderer.TRIDENT_IN_HAND_MODEL);
|
||||
this.loadTopLevel(ItemRenderer.SPYGLASS_IN_HAND_MODEL);
|
||||
+ Set<ResourceLocation> additionalModels = Sets.newHashSet();
|
||||
this.loadSpecialItemModelAndDependencies(ItemRenderer.TRIDENT_IN_HAND_MODEL);
|
||||
this.loadSpecialItemModelAndDependencies(ItemRenderer.SPYGLASS_IN_HAND_MODEL);
|
||||
+ Set<ModelResourceLocation> additionalModels = new HashSet<>();
|
||||
+ net.minecraftforge.client.ForgeHooksClient.onRegisterAdditionalModels(additionalModels);
|
||||
+ for (ResourceLocation rl : additionalModels) {
|
||||
+ UnbakedModel unbakedmodel = this.getModel(rl); // loadTopLevel(...), but w/o ModelResourceLocation limitation
|
||||
+ this.unbakedCache.put(rl, unbakedmodel);
|
||||
+ this.topLevelModels.put(rl, unbakedmodel);
|
||||
+ }
|
||||
+ for (var rl : additionalModels)
|
||||
+ this.registerModel(rl, this.getModel(rl.id()));
|
||||
this.topLevelModels.values().forEach(p_247954_ -> p_247954_.resolveParents(this::getModel));
|
||||
p_252014_.pop();
|
||||
}
|
||||
@@ -478,7 +_,17 @@
|
||||
@@ -244,14 +_,24 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -32,16 +29,30 @@
|
||||
ModelBakery.BakedCacheKey modelbakery$bakedcachekey = new ModelBakery.BakedCacheKey(p_252176_, p_249765_.getRotation(), p_249765_.isUvLocked());
|
||||
BakedModel bakedmodel = ModelBakery.this.bakedCache.get(modelbakery$bakedcachekey);
|
||||
if (bakedmodel != null) {
|
||||
@@ -486,10 +_,10 @@
|
||||
return bakedmodel;
|
||||
} else {
|
||||
UnbakedModel unbakedmodel = this.getModel(p_252176_);
|
||||
if (unbakedmodel instanceof BlockModel blockmodel && blockmodel.getRootModel() == ModelBakery.GENERATION_MARKER) {
|
||||
- return ModelBakery.ITEM_MODEL_GENERATOR.generateBlockModel(this.modelTextureGetter, blockmodel).bake(this, blockmodel, this.modelTextureGetter, p_249765_, p_252176_, false);
|
||||
+ return ModelBakery.ITEM_MODEL_GENERATOR.generateBlockModel(sprites, blockmodel).bake(this, blockmodel, sprites, p_249765_, p_252176_, false);
|
||||
}
|
||||
|
||||
- BakedModel bakedmodel1 = unbakedmodel.bake(this, this.modelTextureGetter, p_249765_, p_252176_);
|
||||
+ BakedModel bakedmodel1 = unbakedmodel.bake(this, sprites, p_249765_, p_252176_);
|
||||
- BakedModel bakedmodel1 = this.bakeUncached(unbakedmodel, p_249765_);
|
||||
+ BakedModel bakedmodel1 = this.bakeUncached(unbakedmodel, p_249765_, sprites);
|
||||
ModelBakery.this.bakedCache.put(modelbakery$bakedcachekey, bakedmodel1);
|
||||
return bakedmodel1;
|
||||
}
|
||||
@@ -259,11 +_,16 @@
|
||||
|
||||
@Nullable
|
||||
BakedModel bakeUncached(UnbakedModel p_343761_, ModelState p_342939_) {
|
||||
+ return bakeUncached(p_343761_, p_342939_, this.modelTextureGetter);
|
||||
+ }
|
||||
+
|
||||
+ @Nullable
|
||||
+ BakedModel bakeUncached(UnbakedModel p_343761_, ModelState p_342939_, Function<Material, TextureAtlasSprite> sprites) {
|
||||
if (p_343761_ instanceof BlockModel blockmodel && blockmodel.getRootModel() == ModelBakery.GENERATION_MARKER) {
|
||||
- return ModelBakery.ITEM_MODEL_GENERATOR.generateBlockModel(this.modelTextureGetter, blockmodel).bake(this, blockmodel, this.modelTextureGetter, p_342939_, false);
|
||||
+ return ModelBakery.ITEM_MODEL_GENERATOR.generateBlockModel(sprites, blockmodel).bake(this, blockmodel, sprites, p_342939_, false);
|
||||
}
|
||||
|
||||
- return p_343761_.bake(this, this.modelTextureGetter, p_342939_);
|
||||
+ return p_343761_.bake(this, sprites, p_342939_);
|
||||
}
|
||||
}
|
||||
|
||||
Loaded 100 of 1079 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user